-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
47 lines (38 loc) · 1.1 KB
/
script.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
//
// Settings
//
var max_number_of_themes = 5;
//
// Variables
//
var number_of_themes = 1;
//
// Theme - Container
//
var theme_container = document.getElementById("empty_theme_container");
//
// Main
//
// Function: Add Theme
function addTheme() {
// Check if the number of themes is less than the maximum number of themes
if (number_of_themes <= max_number_of_themes) {
// Create a new theme div
var new_theme = theme_container.cloneNode(true);
// Add the right class
new_theme.className = "theme_container";
// Add an id containing the container number
new_theme.id = "theme_container_" + number_of_themes;
// Add the theme div to the theme container
document.getElementById("generator_container").appendChild(new_theme);
// Increase the number of themes
number_of_themes++;
}
}
// Function: Remove Theme
function removeTheme(element) {
// Remove the theme container
document.getElementById(element.parentNode.parentNode.id).remove();
// Increase the max number of themes
max_number_of_themes++;
}