Skip to content

Commit

Permalink
Merge branch 'pr/1463' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Laské committed Jan 9, 2024
2 parents cf5e1cf + b746b31 commit 8546318
Show file tree
Hide file tree
Showing 20 changed files with 191 additions and 1,724 deletions.
29 changes: 21 additions & 8 deletions activities/Flip.activity/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,43 @@
<script>if (window.module) module = window.module;</script>
<script data-main="js/loader" src="lib/require.js"></script>
<script type="text/javascript" src="../../cordova.js"></script>
<link rel="prefetch" type="application/l10n" href="./localization.ini">
<style>*{-webkit-tap-highlight-color: rgba(0, 0, 0, 0);}</style>
<style> #canvas{background-color: #C0C0C0}</style>
</head>

<body>
<div id="main-toolbar" class="toolbar">
<button class="toolbutton" data-l10n-id="activity-button" id="activity-button" title="Flip Activity"></button>
<button class="toolbutton" data-l10n-id="new-game-button" id="new-game-button" title="Start a game."></button>
<button class="toolbutton" data-l10n-id="size-button" id="size-button" title="Change size of grid"></button>
<button class="toolbutton" data-i18n="activity-button" id="activity-button" title="Flip Activity"></button>
<button class="toolbutton" data-i18n="new-game-button" id="new-game-button" title="Start a game."></button>
<button class="toolbutton" data-i18n="size-button" id="size-button" title="Change size of grid"></button>
<!-- Add more buttons here -->
<!-- Buttons with class="pull-right" will be right aligned -->
<button class="toolbutton pull-right" data-l10n-id="stop-button" id="stop-button" title="Stop"></button>
<button class="toolbutton pull-right" data-i18n="stop-button" id="stop-button" title="Stop"></button>
<button class="toolbutton pull-right" id="fullscreen-button" title="Fullscreen"></button>
<button class="toolbutton pull-right" id="help-button" title="Tutorial"></button>
<button class="toolbutton pull-right" data-l10n-id="solve-button" id="solve-button" title="Solve the puzzle"></button>
<button class="toolbutton pull-right" data-i18n="solve-button" id="solve-button" title="Solve the puzzle"></button>
</div>

<!-- The content of your activity goes inside the canvas -->
<div id="canvas" style="overflow-y: hidden;">
<div id='flip-count'><span id="fliptext"><span data-l10n-id="turntext"></span><span id="turnno"></span></span></div>
<div id='flip-count'><span id="fliptext"><span data-i18n="turntext"></span><span id="turnno"></span></span></div>
<canvas id="actualcanvas"></canvas>
</div>
<button class="toolbutton pull-right" id="unfullscreen-button" title="UnFullscreen"></button>
</body>

<script type="text/javascript">
requirejs.config({
baseUrl: "js",
paths: {
activity: "../js"
}
});
var l10n = null;
requirejs(["../lib/l10n"], function (il10n) {
l10n = il10n;
});
window.addEventListener('localized', function() {
l10n.updateDocument();
}, false);
</script>
</html>
7 changes: 3 additions & 4 deletions activities/Flip.activity/js/activity.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(["sugar-web/activity/activity", "webL10n", 'easeljs','tweenjs','activity/game','activity/flipdot'], function (act, webL10n) {
define(["sugar-web/activity/activity", "l10n", 'easeljs','tweenjs','activity/game','activity/flipdot'], function (act, l10n) {

// Manipulate the DOM only when it is ready.
requirejs(['domReady!'], function (doc) {
Expand All @@ -11,13 +11,12 @@ define(["sugar-web/activity/activity", "webL10n", 'easeljs','tweenjs','activity/
});
env.getEnvironment(function(err, environment) {
currentenv = environment;

// Set current language to Sugarizer
var defaultLanguage = (typeof chrome != 'undefined' && chrome.app && chrome.app.runtime) ? chrome.i18n.getUILanguage() : navigator.language;
var language = environment.user ? environment.user.language : defaultLanguage;
webL10n.language.code = language;
l10n.init(language);
});
});
});
});

});
Expand Down
1 change: 1 addition & 0 deletions activities/Flip.activity/js/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ function Game(stage,xocolor,doc,datastore,activity,sizepalette){
this.init = function(){
//console.log(activity.getDatastoreObject());
this.palette = new sizepalette.SizePalette(this,doc.getElementById('size-button'),undefined);
l10n.updateDocument();
activity.getDatastoreObject().getMetadata(this.init_canaccessdatastore.bind(this));
document.getElementById("turnno").innerHTML = " " + (this.turns);
this.drawIndicator();
Expand Down
10 changes: 5 additions & 5 deletions activities/Flip.activity/js/sizepalette.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ define(["sugar-web/graphics/palette"], function (palette) {
var fourbutton = document.createElement('button');
fourbutton.className = 'toolbutton';
fourbutton.setAttribute('id','four-button');
fourbutton.setAttribute('data-l10n-id','four-button');
fourbutton.setAttribute('data-i18n','four-button');
fourbutton.setAttribute('title','4x4 grid');
fourbutton.onclick = function() {
that.setSize(4);
Expand All @@ -23,7 +23,7 @@ define(["sugar-web/graphics/palette"], function (palette) {
var fivebutton = document.createElement('button');
fivebutton.className = 'toolbutton';
fivebutton.setAttribute('id','five-button');
fivebutton.setAttribute('data-l10n-id','five-button');
fivebutton.setAttribute('data-i18n','five-button');
fivebutton.setAttribute('title','5x5 grid');
fivebutton.onclick = function() {
that.setSize(5);
Expand All @@ -32,7 +32,7 @@ define(["sugar-web/graphics/palette"], function (palette) {
var sixbutton = document.createElement('button');
sixbutton.className = 'toolbutton';
sixbutton.setAttribute('id','six-button');
sixbutton.setAttribute('data-l10n-id','six-button');
sixbutton.setAttribute('data-i18n','six-button');
sixbutton.setAttribute('title','6x6 grid');
sixbutton.onclick = function() {
that.setSize(6);
Expand All @@ -41,7 +41,7 @@ define(["sugar-web/graphics/palette"], function (palette) {
var sevenbutton = document.createElement('button');
sevenbutton.className = 'toolbutton';
sevenbutton.setAttribute('id','seven-button');
sevenbutton.setAttribute('data-l10n-id','seven-button');
sevenbutton.setAttribute('data-i18n','seven-button');
sevenbutton.setAttribute('title','7x7 grid');
sevenbutton.onclick = function() {
that.setSize(7);
Expand Down Expand Up @@ -86,7 +86,7 @@ define(["sugar-web/graphics/palette"], function (palette) {
break;
}
}

div.appendChild(fourbutton);
div.appendChild(fivebutton);
div.appendChild(sixbutton);
Expand Down
3 changes: 3 additions & 0 deletions activities/Flip.activity/lib/axios.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions activities/Flip.activity/lib/i18next.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 8546318

Please sign in to comment.