forked from ccz-2/No-Distractions-Full-Screen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ND_answerbar.js
61 lines (55 loc) · 1.5 KB
/
ND_answerbar.js
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
//No Distractions Full Screen v4.0
function ansConf(ease, remaining){
var pressed = '.platform[data-ease='+ ease +']';
if ($(pressed)[0] != null) {
$(pressed).parent().siblings('div').css({'opacity':'0', 'transition': '0.3s'})
$(pressed).addClass('ansConf')
$(pressed).on("animationend", function(){
$('.button').remove();
insertQuesBut(remaining);
});
}
else {
$('.button').remove();
insertQuesBut(remaining);
}
}
function insertAnsBut(due, extra, i, label) {
$('.ques').remove();
$('#container').append(`
<div id='`+ label +`' class='ans button'>
<div `+ extra +` class='platform' data-ease='`+ i +`' onclick='pycmd("ease`+ i +`")'>`+ due +`</div>
</div>
`)
}
function insertQuesBut(remaining) {
if ($('.ans')[0] == null) {
$('.ques').remove();
$('#container').append(`
<div class='ques button'>
<div class='platform' onclick='pycmd("ans");'>`+ remaining +`</div>
</div>
`)
}
}
function clearButs() {
$('.button').remove();
}
if (showQuestion.wrapped == null){
var og_showQuestion = showQuestion
window.showQuestion = function(txt, maxTime_) {
og_showQuestion.call(this, txt, maxTime_);
$("#middle")[0].innerHTML = '';
pycmd("NDFS_showQues");
}
showQuestion.wrapped = true
}
if (showAnswer.wrapped == null){
var og_showAnswer = showAnswer
window.showAnswer = function(txt) {
og_showAnswer.call(this, txt);
$("#middle")[0].innerHTML = '';
pycmd("NDFS_showAns");
}
showAnswer.wrapped = true
}