forked from fungiboletus/JsCHRIST
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtools.js
More file actions
56 lines (47 loc) · 865 Bytes
/
tools.js
File metadata and controls
56 lines (47 loc) · 865 Bytes
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
var byId = function(id)
{
return document.getElementById(id);
};
var _ = function(chaine)
{
return chaine;
};
var newDom = function(nom)
{
return document.createElement(nom);
};
var delDom = function(element)
{
if (element.hasChildNodes())
{
element.removeChild(element.firstChild);
};
};
var emptyDom = function(element)
{
while(element.hasChildNodes())
{
element.removeChild(element.firstChild);
};
};
var randInt = function(min, max)
{
return Math.floor(Math.random()*(max-min))+min;
};
var arrayShuffle = function(tableau)
{
tableau.sort(function(a, b)
{
return ((2 * Math.round(Math.random())) - 1);
});
return tableau;
};
var delChar = function(chaine, caractere)
{
var index = chaine.indexOf(caractere);
return chaine.substr(0,index)+chaine.substr(index+1);
};
var log = function(element)
{
window.console.log(element);
};