-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
60 lines (54 loc) · 1.32 KB
/
main.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
require("sdk/ui/button/action").ActionButton({
id: "iNoPASSaran",
label: "¡No PASSarán",
icon: {
"16": "./img/icon/16.png",
"32": "./img/icon/32.png",
"64": "./img/icon/64.png"
},
onClick: handleClick
});
function handleClick(state) {
var preferences = require("sdk/simple-prefs").prefs,
tabs = require('sdk/tabs'),
popup = require("sdk/panel").Panel({
contentURL: "./popup.html",
contentScriptOptions: {
lang : preferences.lang,
algorithm : preferences.algorithm,
salt : preferences.salt,
data : preferences.data,
hashtype : preferences.hashtype,
url : tabs.activeTab.url,
_ : require("sdk/l10n").get
},
contentScriptFile: [
"./js/md5-min.js",
"./js/you_shall_pass.js",
"./js/functions.js",
"./js/popup.js"
],
width: 250,
height: 154
});
popup.show();
popup.on("show", function() {
popup.port.emit("show");
});
popup.port.on("update", function(v) {
preferences.data = v;
});
popup.port.on("resize", function(v) {
popup.resize(v[0],v[1]);
});
popup.port.on("text-entered", function (text) {
require("sdk/tabs").activeTab.attach({
contentScript: 'this.document.activeElement.value = "' + text + '";'
});
popup.hide();
});
popup.port.on("copy", function(text) {
var clipboard = require("sdk/clipboard");
clipboard.set(text);
});
}