-
Notifications
You must be signed in to change notification settings - Fork 0
/
System.js
59 lines (48 loc) · 1.4 KB
/
System.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
function initialiser() {
Affichage = "";
}
function actualiser() {
document.getElementById("interface").innerHTML = Affichage;
}
function fonction(nom, link, classes = "") {
Affichage += "<button onclick='javascript:" + link + "' class='" + classes + "'>" + nom + "</button>";
}
function lien(nom, link, classes = "") {
Affichage += "<a href='" + link + "' class='" + classes + "'>" + nom + "</a>";
}
function afficher(texte) {
Affichage += texte;
}
function saut(nombre = 1) {
for (let n = 0; n < nombre; n++) {
Affichage += "<br/>";
}
}
function div(nom, classes = "") {
Affichage += "<div id='" + nom + "' class='" + classes + "'>";
}
function div_fin() {
Affichage += "</div>";
}
function div_actualiser(div, value) {
document.getElementById(div).innerHTML = value;
}
function dupliquer_objet(a) {
let b = {};
for (i in a) {
b[i] = a[i];
}
return b;
}
function telecharger(nom, texte) {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(texte));
element.setAttribute('download', nom);
element.style.display = 'none';
document.body.appendChild(element)
element.click()
document.body.removeChild(element)
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}