-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpopup.js
44 lines (37 loc) · 1.25 KB
/
popup.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
var PopupController = function () {
this.enbutton_ = document.getElementById("enCrypt");
this.debutton_ = document.getElementById("deCrypt");
this.password_ = document.getElementById("input");
this.search_ = document.getElementById("search");
this.enListener_();
this.deListener_();
};
PopupController.prototype = {
//constructor
enbutton_: null,
debutton_: null,
password_: null,
search_: null,
enListener_: function () {
this.enbutton_.addEventListener("click", this.handleClick_.bind(this));
},
deListener_: function () {
this.debutton_.addEventListener("click", this.handleClick_.bind(this));
},
//Actual button function
handleClick_: function () {
if (this.password_.value === "") {
alert("Error, no password entered.");
}
else {
var success = document.createElement("div");
success.classList.add("overlay");
success.setAttribute("role", "alert");
success.textContent = "Password has been processed: " + this.password_.value;
document.body.appendChild(success);
}
}
};
document.addEventListener("DOMContentLoaded", function () {
window.PC = new PopupController();
});