From 7b28c13f848c8ac7a5e9ac9a6a0a40a82c6bc74f Mon Sep 17 00:00:00 2001 From: Tim Mickel Date: Tue, 2 Feb 2016 16:38:31 -0500 Subject: [PATCH] blocks.html, interface.html, paint.html remaining scripts Moved to app.js entry --- editions/free/src/inapp/blocks.html | 174 ++++++++----------------- editions/free/src/inapp/interface.html | 82 +++--------- editions/free/src/inapp/paint.html | 72 ++-------- src/entry/app.js | 171 +++++++++++++++++++++++- 4 files changed, 253 insertions(+), 246 deletions(-) diff --git a/editions/free/src/inapp/blocks.html b/editions/free/src/inapp/blocks.html index d14a4f4..4ab1aa2 100644 --- a/editions/free/src/inapp/blocks.html +++ b/editions/free/src/inapp/blocks.html @@ -14,366 +14,304 @@
-
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
-
- +
-
- +
-
- +
-
- +
-
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
-
-
- +
-
- +
-
- +
-
- +
-
- +
-
- +
diff --git a/editions/free/src/inapp/interface.html b/editions/free/src/inapp/interface.html index cc8e113..b6dad60 100644 --- a/editions/free/src/inapp/interface.html +++ b/editions/free/src/inapp/interface.html @@ -15,13 +15,13 @@
-
+
1
-
+
2
@@ -30,55 +30,55 @@
-
+
3
-
+
4
-
+
5
-
+
6
-
+
7
-
+
8
-
+
9
-
+
10
-
+
16
@@ -86,7 +86,7 @@
-
+
15
@@ -94,7 +94,7 @@
-
+
14
@@ -102,13 +102,13 @@
-
+
13
-
+
12
@@ -116,7 +116,7 @@
-
+
11
@@ -126,10 +126,8 @@
-
-
@@ -138,53 +136,5 @@
- diff --git a/editions/free/src/inapp/paint.html b/editions/free/src/inapp/paint.html index d174b62..1888773 100644 --- a/editions/free/src/inapp/paint.html +++ b/editions/free/src/inapp/paint.html @@ -15,19 +15,19 @@
-
+
1
-
+
2
-
+
3
@@ -36,13 +36,13 @@
-
+
4
-
+
5
@@ -50,48 +50,48 @@
-
+
6
-
+
7
-
+
8
-
+
9
-
+
10
-
+
11
-
+
12
@@ -99,7 +99,7 @@
-
+
13
@@ -108,58 +108,12 @@
-
-
- diff --git a/src/entry/app.js b/src/entry/app.js index 314595c..e1ad035 100644 --- a/src/entry/app.js +++ b/src/entry/app.js @@ -177,14 +177,179 @@ function inappAbout () { function inappInterfaceGuide () { + var interfaceKeyHeaderNode = gn('interface-key-header'); + var interfaceKeyDescriptionNode = gn('interface-key-description'); + + interfaceKeyHeaderNode.textContent = Localization.localize('INTERFACE_GUIDE_SAVE', {N: 1}); + interfaceKeyDescriptionNode.textContent = Localization.localize('INTERFACE_GUIDE_SAVE_DESCRIPTION'); + + var interfaceKeys = [ + 'SAVE', + 'STAGE', + 'PRESENTATION_MODE', + 'GRID', + 'CHANGE_BG', + 'ADD_TEXT', + 'RESET_CHAR', + 'GREEN_FLAG', + 'PAGES', + 'PROJECT_INFO', + 'UNDO_REDO', + 'PROGRAMMING_SCRIPT', + 'PROGRAMMING_AREA', + 'BLOCKS_PALETTE', + 'BLOCKS_CATEGORIES', + 'CHARACTERS' + ]; + + var interfaceDescriptions = []; + for (var i = 0; i < interfaceKeys.length; i++) { + var key = interfaceKeys[i]; + interfaceDescriptions.push([ + Localization.localize('INTERFACE_GUIDE_' + key, {N: i+1}), + Localization.localize('INTERFACE_GUIDE_' + key + '_DESCRIPTION') + ]); + } + + + var currentButton = document.getElementById('interface-button-save'); + + var switchHelp = function (e) { + var target = e.target; + if (target.className == 'interface-button-text') { + var descriptionId = parseInt(target.innerText - 1); + interfaceKeyHeaderNode.textContent = interfaceDescriptions[descriptionId][0]; + interfaceKeyDescriptionNode.textContent = interfaceDescriptions[descriptionId][1]; + currentButton.className = 'interface-button'; + currentButton = target.parentNode; + currentButton.className = currentButton.className + ' interface-button-selected'; + ScratchAudio.sndFXWithVolume('keydown.wav', 0.3); + } + }; + document.addEventListener('touchstart', switchHelp, false); } function inappPaintEditorGuide () { + var paintKeyHeaderNode = gn('paint-key-header'); + var paintKeyDescriptionNode = gn('paint-key-description'); + paintKeyHeaderNode.textContent = Localization.localize('PAINT_GUIDE_UNDO', {N:1}); + paintKeyDescriptionNode.textContent = Localization.localize('PAINT_GUIDE_UNDO_DESCRIPTION'); + + var paintKeys = [ + 'UNDO', + 'REDO', + 'SHAPE', + 'CHARACTER_NAME', + 'CUT', + 'DUPLICATE', + 'ROTATE', + 'DRAG', + 'SAVE', + 'FILL', + 'CAMERA', + 'COLOR', + 'LINE_WIDTH' + ]; + + var paintDescriptions = []; + for (var i = 0; i < paintKeys.length; i++) { + var key = paintKeys[i]; + paintDescriptions.push([ + Localization.localize('PAINT_GUIDE_' + key, {N: i+1}), + Localization.localize('PAINT_GUIDE_' + key + '_DESCRIPTION') + ]); + } + + + var currentButton = document.getElementById('paint-button-undo'); + + var switchHelp = function (e) { + var target = e.target; + if (target.className == 'paint-button-text') { + var descriptionId = parseInt(target.innerText - 1); + paintKeyHeaderNode.textContent = paintDescriptions[descriptionId][0]; + paintKeyDescriptionNode.textContent = paintDescriptions[descriptionId][1]; + currentButton.className = 'paint-button'; + currentButton = target.parentNode; + currentButton.className = currentButton.className + ' paint-button-selected'; + ScratchAudio.sndFXWithVolume('keydown.wav', 0.3); + } + }; + document.addEventListener('touchstart', switchHelp, false); } function inappBlocksGuide () { + // Localized category names + gn('yellow-block-category-header').textContent = Localization.localize('BLOCKS_TRIGGERING_BLOCKS'); + gn('blue-block-category-header').textContent = Localization.localize('BLOCKS_MOTION_BLOCKS'); + gn('purple-block-category-header').textContent = Localization.localize('BLOCKS_LOOKS_BLOCKS'); + gn('green-block-category-header').textContent = Localization.localize('BLOCKS_SOUND_BLOCKS'); + gn('orange-block-category-header').textContent = Localization.localize('BLOCKS_CONTROL_BLOCKS'); + gn('red-block-category-header').textContent = Localization.localize('BLOCKS_END_BLOCKS'); + var blockDescriptionKeys = [ + 'BLOCKS_GREEN_FLAG', + 'BLOCKS_GREEN_FLAG_DESCRIPTION', + 'BLOCKS_ON_TAP', + 'BLOCKS_ON_TAP_DESCRIPTION', + 'BLOCKS_ON_TOUCH', + 'BLOCKS_ON_TOUCH_DESCRIPTION', + 'BLOCKS_ON_MESSAGE', + 'BLOCKS_ON_MESSAGE_DESCRIPTION', + 'BLOCKS_SEND_MESSAGE', + 'BLOCKS_SEND_MESSAGE_DESCRIPTION', + 'BLOCKS_MOVE_RIGHT', + 'BLOCKS_MOVE_RIGHT_DESCRIPTION', + 'BLOCKS_MOVE_LEFT', + 'BLOCKS_MOVE_LEFT_DESCRIPTION', + 'BLOCKS_MOVE_UP', + 'BLOCKS_MOVE_UP_DESCRIPTION', + 'BLOCKS_MOVE_DOWN', + 'BLOCKS_MOVE_DOWN_DESCRIPTION', + 'BLOCKS_TURN_RIGHT', + 'BLOCKS_TURN_RIGHT_DESCRIPTION', + 'BLOCKS_TURN_LEFT', + 'BLOCKS_TURN_LEFT_DESCRIPTION', + 'BLOCKS_HOP', + 'BLOCKS_HOP_DESCRIPTION', + 'BLOCKS_GO_HOME', + 'BLOCKS_GO_HOME_DESCRIPTION', + 'BLOCKS_SAY', + 'BLOCKS_SAY_DESCRIPTION', + 'BLOCKS_GROW', + 'BLOCKS_GROW_DESCRIPTION', + 'BLOCKS_SHRINK', + 'BLOCKS_SHRINK_DESCRIPTION', + 'BLOCKS_RESET_SIZE', + 'BLOCKS_RESET_SIZE_DESCRIPTION', + 'BLOCKS_HIDE', + 'BLOCKS_HIDE_DESCRIPTION', + 'BLOCKS_SHOW', + 'BLOCKS_SHOW_DESCRIPTION', + 'BLOCKS_POP', + 'BLOCKS_POP_DESCRIPTION', + 'BLOCKS_PLAY_RECORDED', + 'BLOCKS_PLAY_RECORDED_DESCRIPTION', + 'BLOCKS_WAIT', + 'BLOCKS_WAIT_DESCRIPTION', + 'BLOCKS_STOP', + 'BLOCKS_STOP_DESCRIPTION', + 'BLOCKS_SET_SPEED', + 'BLOCKS_SET_SPEED_DESCRIPTION', + 'BLOCKS_REPEAT', + 'BLOCKS_REPEAT_DESCRIPTION', + 'BLOCKS_END', + 'BLOCKS_END_DESCRIPTION', + 'BLOCKS_REPEAT_FOREVER', + 'BLOCKS_REPEAT_FOREVER_DESCRIPTION', + 'BLOCKS_GO_TO_PAGE', + 'BLOCKS_GO_TO_PAGE_DESCRIPTION' + ]; + + for (let key of blockDescriptionKeys) { + gn(key).textContent = Localization.localize(key); + } } // App-wide entry-point @@ -239,15 +404,15 @@ window.onload = () => { } else if (page == 'inappInterfaceGuide') { preprocessAndLoadCss('style', 'style/style.css'); preprocessAndLoadCss('style', 'style/interface.css'); - iOS.waitForInterface(inappInterfaceGuide); + inappInterfaceGuide(); } else if (page == 'inappPaintEditorGuide') { preprocessAndLoadCss('style', 'style/style.css'); preprocessAndLoadCss('style', 'style/paint.css'); - iOS.waitForInterface(inappPaintEditorGuide); + inappPaintEditorGuide(); } else if (page == 'inappBlocksGuide') { preprocessAndLoadCss('style', 'style/style.css'); preprocessAndLoadCss('style', 'style/blocks.css'); - iOS.waitForInterface(inappBlocksGuide); + inappBlocksGuide(); } }); });