-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobals.js
More file actions
39 lines (36 loc) · 1.36 KB
/
globals.js
File metadata and controls
39 lines (36 loc) · 1.36 KB
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
window.onload = function() { main(); }; // call the main() function when fully loaded
window.onerror = function (message, url, lineNo) {
alert(
'Error: ' + message +
'\n Url: ' + url +
'\n Line Number: ' + lineNo);
return false;
};
var GLOBAL = {
cheat: function() {
if (GLOBAL.canCheat) {
for (stack in GLOBAL.game.stacks) {
var stackContent = GLOBAL.game.stacks[stack].getStackContents()
for (card in stackContent) {
if(stackContent[card].faceDown === true) {
var thisImage = stackContent[card].image;
stackContent[card].setImage(stackContent[card].otherImage);
stackContent[card].otherImage = thisImage;
stackContent[card].faceDown = false;
stackContent[card].topCard = true;
stackContent[card].draggable(true);
}
}
}
}
GLOBAL.canCheat = false;
},
canCheat: true,
game: null,
gameWidth: 800,
gameHeight: 800,
requestAnimationFrame: window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame ||
window.oRequestAnimationFrame // ensure the right RAF method is used
};