Skip to content

Commit ff52d90

Browse files
committed
Add the button of film and modify the css of toolMenu
1 parent 647d4fc commit ff52d90

6 files changed

Lines changed: 42 additions & 0 deletions

File tree

css/stages.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,12 @@ table.nav{
301301
opacity: 0;
302302
z-index: 9999;
303303
}
304+
305+
/* 處理按鈕列的提示字串位置 */
306+
.toolMenu div{
307+
display: flex !important;
308+
justify-content: center;
309+
text-align: center;
310+
left: 0px;
311+
right: 0px;
312+
}

js/stages.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
+(function () {
22

3+
var FILMS = {
4+
'stages/01': 'https://youtu.be/o9NPI3BtNoA',
5+
'stages/02': 'https://youtu.be/VN4sKngbiGI',
6+
'stages/03': 'https://youtu.be/mXCnzUzcNSk',
7+
'stages/05': 'https://youtu.be/UmMJG2zInWU',
8+
'stages/10': 'https://youtu.be/NA2kjjwoWNA'
9+
};
10+
311
window.addEventListener('load', function () {
412

513
// 當點選關卡而非解答時,清空內容
@@ -8,6 +16,9 @@
816
// 當點選關卡而非解答時,清空內容
917
restoreSimulator();
1018

19+
// 決定影片按鈕的行為
20+
watchFilm();
21+
1122
// 計算闖關時間
1223
window.stage = {
1324
startTime: Date.now(),
@@ -78,4 +89,20 @@
7889
return frame.contentWindow.blockly.getConfig();
7990
}
8091

92+
function watchFilm() {
93+
var stageName = Code.getStringParamFromUrl('page');
94+
var url = FILMS[stageName];
95+
var watchFilm = document.getElementById('watchFilm');
96+
97+
if (!url) {
98+
watchFilm.style.display = "none";
99+
return;
100+
}
101+
102+
Code.bindClick(watchFilm,
103+
function () {
104+
window.open(url);
105+
});
106+
}
107+
81108
})();

msg/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ var MSG = {
2121
timeout: "Maximum execution iterations exceeded.",
2222
trashTooltip: "Discard All Blocks",
2323
sampleTooltip: "Load Sample Blocks",
24+
film: "Film",
2425
helpTooltip: "Help",
2526
simulatorTooltip: "Simulator Area",
2627
demoTooltip: "Web Demo Area",

msg/zh-hans.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ var MSG = {
2121
timeout: "超过最大执行数",
2222
trashTooltip: "删除所有积木",
2323
sampleTooltip: "载入范例积木",
24+
film: "影片",
2425
helpTooltip: "提示",
2526
simulatorTooltip: "模拟器区域",
2627
demoTooltip: "网页互动区域",

msg/zh-hant.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ var MSG = {
2121
timeout: "超過最大執行數",
2222
trashTooltip: "刪除所有積木",
2323
sampleTooltip: "載入範例積木",
24+
film: "影片",
2425
helpTooltip: "提示",
2526
simulatorTooltip: "模擬器區域",
2627
demoTooltip: "網頁互動區域",

views/stages.handlebars

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
<td class="tabmin">&nbsp;</td>
5858
<td id="tab_xml" class="taboff" style="display:none;">XML</td>
5959
<td class="tabmax">
60+
<button id="watchFilm" class="notext toolMenu">
61+
<i class="icon-film"></i> <div>{{film}}</div>
62+
</button>
6063
<button id="helpButton" class="notext toolMenu">
6164
<i class="icon-info"></i> <div>{{helpTooltip}}</div>
6265
</button>

0 commit comments

Comments
 (0)