1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/*
* TODO:
*
* - make all buttons work
* - add all hotkeys
* - start, stop & ticking sounds
* - save time wasting time to local storage every tick
* - rework use of global variables
* - button to make a loud noise like bell
*/
$.ionSound({
sounds: [
{
name: "klaxon"
},
{
name: "button_tiny",
},
{
name: "cheonjae",
}
],
// volume: 0.5,
path: "sounds/",
preload: true
});
var timeWastingClock = new FlipClock($('.time-wasting-clock'), {
autoStart:false,
callbacks:{
interval:function () {
$.ionSound.play("button_tiny");
}
}
});
var $timeWastingClockRunning = false;
var activityClock = new FlipClock($('.activity-countdown'), {
autoStart:false,
countdown:true,
callbacks:{
stop:function () {
$.ionSound.play("cheonjae");
}
}
});
function timeWastingClockToggle()
{
if ($timeWastingClockRunning)
{
$('#timeWastingClockGo').html('Start <u>t</u>imer');
timeWastingClock.stop();
$timeWastingClockRunning = false;
}
else
{
$('#timeWastingClockGo').html('Stop <u>t</u>imer');
timeWastingClock.start();
$timeWastingClockRunning = true;
}
}
$(document).bind('keydown', 't', timeWastingClockToggle);
$(document).bind('keydown', 'j', timeWastingClockToggle);
$(document).bind('keydown', 'k', function (){$.ionSound.play("klaxon");});
function activityClockGo($seconds)
{
activityClock.setTime($seconds);
activityClock.start();
}
$(document).bind('keydown', '1', function (){activityClockGo(60);});
$(document).ready(function(){
$('#klaxon').button();
$('#klaxon').click(function (){$.ionSound.play("klaxon");});
$('#timeWastingClockGo').button();
$('#timeWastingClockGo').click(timeWastingClockToggle);
$('#timeWastingClockReset').button();
$('#timeWastingClockReset').click(function() {
if (timeWastingClock.getTime() != 0)
{
var $timeWastingClockResetConfirm = confirm("Are you sure?");
if ($timeWastingClockResetConfirm)
{
if ($timeWastingClockRunning)
{
$('#timeWastingClockGo').html('Start timer (Hotkey: j)');
timeWastingClock.stop();
$timeWastingClockRunning = false;
}
timeWastingClock.setTime(0);
}
}
});
$('#activityClock30s').button();
$('#activityClock30s').click(function (){activityClockGo(30);})
$('#activityClock60s').button();
$('#activityClock60s').click(function (){activityClockGo(60);})
$('#activityClock90s').button();
$('#activityClock90s').click(function (){activityClockGo(90);})
$('#activityClock120s').button();
$('#activityClock120s').click(function (){activityClockGo(120);})
$('#activityClock180s').button();
$('#activityClock180s').click(function (){activityClockGo(180);})
$('#activityClock240s').button();
$('#activityClock240s').click(function (){activityClockGo(240);})
$('#activityClock300s').button();
$('#activityClock300s').click(function (){activityClockGo(300);})
});
|