forked from zombieFox/nightTab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrol.js
More file actions
48 lines (41 loc) · 967 Bytes
/
Copy pathcontrol.js
File metadata and controls
48 lines (41 loc) · 967 Bytes
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
var control = (function() {
var state = {
edit: false
};
var bind = function() {
var controlAdd = helper.e(".control-add");
var controlEdit = helper.e(".control-edit");
controlAdd.addEventListener("click", function() {
_add();
}, false);
controlEdit.addEventListener("click", function() {
_edit();
}, false);
};
var _add = function() {
links.add();
};
var _edit = function() {
var body = helper.e("body");
var controlEdit = helper.e(".control-edit");
if (state.edit) {
helper.removeClass(body, "is-edit");
helper.removeClass(controlEdit, "active");
state.edit = false;
links.tabindex();
} else {
helper.addClass(body, "is-edit");
helper.addClass(controlEdit, "active");
state.edit = true;
links.tabindex();
};
};
var init = function() {
bind();
};
// exposed methods
return {
init: init,
state: state
};
})();