Skip to content

Commit 91a0bb8

Browse files
committed
Sync full app to MacGap application build directory
1 parent 4198aa8 commit 91a0bb8

File tree

6 files changed

+28
-64
lines changed

6 files changed

+28
-64
lines changed

OSX_build/MacGap1/public/configure.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
qa: qElem.eq(i).val()
2828
};
2929
}
30+
jstConfig.qasoundOn=$("input[name='qasndon']").is(':checked');
31+
console.log("QA sound is "+jstConfig.qasoundOn);
3032
localStorage['jstConfig']=JSON.stringify(jstConfig);
3133
window.location.href="index.html";
3234
}
@@ -47,6 +49,7 @@
4749
$(".remPre").click( function(e) {
4850
$(this).closest("li").remove();
4951
});
52+
$("input[name='qasndon']").prop('checked', jstConfig.qasoundOn);
5053

5154
}
5255
function cancelSettings() {
@@ -91,6 +94,10 @@ <h2>Configure JS Timer</h2>
9194
Q&A time label:
9295
<input type="text" size="20" name="qaVoc" />
9396
</div>
97+
<div class="preset">
98+
Play sound when starting Q&A
99+
<input type="checkbox" name="qasndon" >
100+
</div>
94101
</td>
95102
<td valign="top">
96103
<div class="preset">

OSX_build/MacGap1/public/index.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
<script src="jquery-ui.js"></script>
1010
<script src="timer.js"></script>
1111
</head>
12-
<body onkeypress="handleKey(event)">
12+
<body>
1313
<div id="screen">
1414

1515
<div id="gui">
1616
<div id="presets" class="runpreset">
1717
</div>
1818
<div id="stdButtons" class="runpreset">
19-
<button id="demo" onClick="startTimer(15,10)">Demo<br/>15s / 10s</button>
19+
<button id="demo" onClick="startTimer(10,5)">Demo<br/>10s / 5s</button>
2020
<button onClick="showClock()">Real-time<br/>clock</button>
2121
</div>
2222
<hr/>
@@ -54,15 +54,18 @@
5454
Chart.defaults.global.animation=false;
5555
var pieChart = new Chart(ctx).Pie(timedata, {
5656
segmentShowStroke : false
57-
5857
});
5958
handleResize();
6059
window.addEventListener('resize', handleResize);
60+
window.addEventListener('keydown', handleKey);
6161
</script>
6262
<audio id="timeupsnd">
63-
<source src="sound/ping2.mp3"></source>
64-
JSTimer requires an HTML5-compliant browser. Audio
65-
will not function.
63+
<source src="sound/end_beep.mp3"></source>
64+
JSTimer requires an HTML5-compliant browser. Audio will not function.
65+
</audio>
66+
<audio id="qasnd">
67+
<source src="sound/qa_beep.mp3"></source>
68+
JSTimer requires an HTML5-compliant browser. Audio will not function.
6669
</audio>
6770

6871
</div> <!-- screen -->
51.5 KB
Binary file not shown.
-63.8 KB
Binary file not shown.
33.2 KB
Binary file not shown.

OSX_build/MacGap1/public/timer.js

Lines changed: 12 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -26,59 +26,7 @@ function pageStartup() {
2626
initConfig();
2727
}
2828

29-
if(typeof(macgap)!="undefined") {
30-
// Add some handlers if using MacGap binary
31-
macgap.menu.getItem("Help").submenu().getItem("JS Timer Help").setCallback(
32-
function() { goHelp(); } );
33-
macgap.menu.getItem("Run").submenu().getItem('Preset 1').setCallback(
34-
function() { document.getElementById('preset0').click(); } );
35-
macgap.menu.getItem("Run").submenu().getItem('Preset 2').setCallback(
36-
function() { document.getElementById('preset1').click(); } );
37-
macgap.menu.getItem("Run").submenu().getItem('Preset 3').setCallback(
38-
function() { document.getElementById('preset2').click(); } );
39-
macgap.menu.getItem("Run").submenu().getItem('Demo').setCallback(
40-
function() { document.getElementById('demo').click(); } );
41-
macgap.menu.getItem("Run").submenu().getItem('Clock').setCallback(
42-
function() { showClock(); } );
43-
} // End macgap setup
44-
var isNode = (typeof process !== "undefined" && typeof require !== "undefined");
45-
if(isNode) {
46-
// GUI handler options for running in node-webkit
47-
var gui = require('nw.gui');
48-
var win = gui.Window.get();
49-
var menubar = new gui.Menu({type: 'menubar'});
50-
var mrun = new gui.Menu();
51-
menubar.append(new gui.MenuItem( {label: 'Run...', submenu: mrun}));
52-
53-
mrun.append(new gui.MenuItem({
54-
label: 'Preset 1',
55-
click: function() { document.getElementById('preset0').click(); },
56-
key: 'F1'
57-
}));
58-
mrun.append(new gui.MenuItem({
59-
label: 'Preset 2',
60-
click: function() { document.getElementById('preset1').click(); },
61-
key: 'F2'
62-
}));
63-
mrun.append(new gui.MenuItem({
64-
label: 'Preset 3',
65-
click: function() { document.getElementById('preset2').click(); },
66-
key: 'F3'
67-
}));
68-
mrun.append(new gui.MenuItem({
69-
label: 'Demo',
70-
click: function() { document.getElementById('demo').click(); },
71-
key: 'F4'
72-
}));
73-
mrun.append(new gui.MenuItem({
74-
label: 'Clock',
75-
click: function() { showClock(); },
76-
key: 'c'
77-
}));
78-
79-
win.menu = menubar;
80-
} // End node setup
81-
// Load the sound clip
29+
// Load the sound clip
8230
$("#timeupsnd").trigger('load');
8331
setupGui();
8432
updateDisplay();
@@ -88,15 +36,15 @@ function userTimer(F) {
8836
startTimer(F.userTalk.value*60, F.userQA.value*60);
8937
}
9038
function startTimer(talkSecs, qaSecs) {
39+
elapsed=0;
40+
qaTime=0;
9141
if (talkSecs>0) {
92-
elapsed=0;
9342
$("#mode").html(jstConfig["presVocab"]);
9443
ticks=talkSecs;
9544
talkPart=1;
9645
qaTime=qaSecs;
9746
} else {
9847
if (qaSecs>0) {
99-
elapsed=0;
10048
$("#mode").html(jstConfig["qaVocab"]);
10149
talkPart=2;
10250
ticks=qaSecs;
@@ -133,15 +81,20 @@ function updateDisplay() {
13381
pieChart.update();
13482
}
13583
}
84+
85+
// timerFunc is the main tick handler
13686
function timerFunc() {
13787
ticks=ticks-1;
13888
elapsed=elapsed+1;
13989
if (ticks <=0 ) {
14090
var x=document.getElementById('autoQA');
141-
if (talkPart==1 && x.checked) {
91+
if (talkPart==1 && x.checked && qaTime > 0) {
14292
talkPart=2;
14393
ticks=qaTime;
14494
updateDisplay();
95+
if(jstConfig.qasoundOn) {
96+
$("#qasnd").trigger('play');
97+
}
14598
$("#mode").html("Question / Answer");
14699
} else {
147100
updateDisplay();
@@ -221,8 +174,9 @@ function goHelp() {
221174
}
222175

223176
function handleKey(evt) {
224-
var theKey=(evt.which) ? evt.which : evt.keyCode;
225-
if(theKey>111 && theKey< 119) {
177+
var theKey=evt.which;
178+
// Disabled for now
179+
if(false && theKey>111 && theKey< 119) {
226180
// F1-F8 keys, - Activate presets
227181
evt.preventDefault();
228182
var presetNum=theKey-112;

0 commit comments

Comments
 (0)