-
Notifications
You must be signed in to change notification settings - Fork 4
/
design.js
67 lines (59 loc) · 1.81 KB
/
design.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
60
61
62
63
64
65
66
67
var actualAlert;
function init() {
$(document).keypress(function (e) {
if (e.keyCode === "13") {
if (actualAlert === "new") {
newFile();
} else if (actualAlert === "color") {
selectColor();
} else if (actualAlert === "export") {
downloadFile();
}
}
});
}
$(document).on("ready", init());
// to display the "new file" alert and stop displaying the other alerts
function newAlert() {
actualAlert = "new";
$(".alert#new_alert").css("display", "block");
$(".alert#color_alert").css("display", "none");
$(".alert#export_alert").css("display", "none");
}
// to display the "select color" alert and stop displaying the other alerts
function colorAlert() {
actualAlert = "color";
$(".alert#new_alert").css("display", "none");
$(".alert#color_alert").css("display", "block");
$(".alert#export_alert").css("display", "none");
$("#select_color").on("change", function () {
var colorValue = $("#select_color").val();
$("#text_color").val(colorValue);
});
$("#text_color").on("input", function () {
var colorValue = $("#text_color").val();
$("#select_color").val(colorValue);
});
}
// to display the "export to css" alert and stop displaying the other alerts
function exportAlert() {
actualAlert = "export";
$(".alert#new_alert").css("display", "none");
$(".alert#color_alert").css("display", "none");
$(".alert#export_alert").css("display", "block");
}
// to exit the alert (it will stop displaying it)
function exitAlert() {
if (actualAlert === "new") {
$(".alert#new_alert").css("display", "none");
} else if (actualAlert === "color") {
$(".alert#color_alert").css("display", "none");
} else if (actualAlert === "export") {
$(".alert#export_alert").css("display", "none");
}
actualAlert = undefined;
}
// to launch the help site
function help() {
window.open("help.html", "_blank");
}