-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.js
More file actions
62 lines (50 loc) · 1.14 KB
/
Copy pathhelpers.js
File metadata and controls
62 lines (50 loc) · 1.14 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*Various helper functions for simulation animation*/
function getAllianceColour(num){
if (num == 1){
return 'Blue';
}
else if (num == 2){
return 'Green';
}
else if (num == 3){
return 'Orange';
}
else if (num == 4){
return 'Purple';
}
else if (num == 5){
return 'Yellow';
}
else{
return 'Pink';
}
}
function removeWithRegex(div, pattern){
var classes = $(div).attr('class').split(' ');
for (var k=0; k<classes.length; k++){
if (classes[k].match(pattern)){
$(div).removeClass(classes[k]);
}
}
}
function removeContent(div) {
$('#'+div).empty().append('<br>');
}
function removeQuizContent(div) {
$('#'+div).empty();
}
function addContent(div, content){
$('#'+div).append(content + '<br>');
}
function initialPowerSort(a, b){
return b[0] - a[0];
}
function initialOrderSort(a, b){
return a[3] - b[3]
}
function hideStories(){
var stories = $('.story.visible');
for (var i=0; i < stories.length; i++){
$(stories[i]).removeClass('visible').addClass('hidden');
}
}