-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tis
55 lines (43 loc) · 1.19 KB
/
main.tis
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
// Betakat v1.0
// https://github.com/MustafaHi/Betakat
include "data.tis";
include "navigation.tis";
function Element.focus() { this.state.focus = true; }
function Element.current() {
if (var el = $(:current)) el.state.current = false;
this.state.current = true;
this.focus();
}
function Array.shuffle() {
var ri; const rnd = rand;
var shuffled = new Array(this.length);
for(var (i,v) in this) {
ri = rnd(i);
shuffled[i] = shuffled[ri];
shuffled[ri] = v;
}
return shuffled;
}
const Content = self[1][1]; // $(content);
var currentDeck;
var qIndex = 0;
var QuestionsList = [];
function self.ready() {
Nav.decks.list();
// center window on screen
initWindow();
}
function initWindow() {
const w = 440,
h = 650,
(sw, sh) = view.screenBox(#frame, #dimension);
view.move((sw / 2) - (w / 2), (sh / 2) - (h / 2), w, h, true);
view.windowResizable = false;
view.windowMaximizable = false;
}
function setDeck(deck) {
currentDeck = deck.id;
$(#title).text = "Betakat | " + deck[1].text;
}
event click $(a[href]) { Sciter.launch(this.@#href); return true; }
event click $(#bShowOptions) { Nav.options(); }