-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.js
92 lines (61 loc) · 2.42 KB
/
admin.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
(function() {
document.addEventListener("DOMContentLoaded", function() {
const templateBody = document.querySelectorAll("BODY.codisto-templates");
if(templateBody.length) {
document.querySelectorAll(".new-template").forEach(function(el) {
el.addEventListener("click", function(e) {
document.location.search = "page=codisto-templates&file=_new";
});
});
document.querySelectorAll("#filename").forEach(function(el) {
el.focus();
});
}
});
})();
(function() {
const checkButton = function() {
const email = document.querySelector("#codisto-form input[name=email]").value;
const emailconfirm = document.querySelector("#codisto-form input[name=emailconfirm]").value;
if (email && emailconfirm
&& (email == emailconfirm)) {
document.querySelector("#codisto-form .next BUTTON").classList.add("button-primary");
} else {
document.querySelector("#codisto-form .next BUTTON").classList.remove("button-primary");
}
};
document.addEventListener("DOMContentLoaded", function() {
const codistoForm = document.querySelector("#codisto-form");
if(codistoForm) {
document.querySelector("#create-account-modal .selection").style.opacity = 0.1;
function jsonp(url, callback) {
var callbackName = 'jsonp_callback_' + Math.round(100000 * Math.random());
var script = document.createElement('script');
script.src = url + (url.indexOf('?') >= 0 ? '&' : '?') + 'callback=' + callbackName;
document.body.appendChild(script);
window[callbackName] = function(data) {
delete window[callbackName];
document.body.removeChild(script);
callback(data);
};
}
jsonp("https://ui.codisto.com/getcountrylist", function(data) {
document.querySelector(".select-html-wrapper").innerHTML = data;
document.querySelector("#create-account-modal .selection").style.opacity = 1;
});
codistoForm.addEventListener("change", checkButton);
codistoForm.addEventListener("keyup", checkButton);
codistoForm.addEventListener("submit", function(e) {
const email = codistoForm.querySelector("INPUT[name=email]").value;
const emailConfirm = codistoForm.querySelector("INPUT[name=emailconfirm]").value;
if (email != emailConfirm) {
e.stopPropagation();
e.preventDefault();
document.querySelector(".error-message").style.display = "block";
} else {
document.querySelector(".error-message").style.display = "none";
}
});
}
});
})();