-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.js
68 lines (57 loc) · 1.51 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
function popupGenerator(config) {
//functions
var generateNote = function(config){
var note = noteGenerator({
obj:{},
renderTo: config.popup,
editable: true,
backgroundColor: SSN.manager.getSettings().backgroundColor,
firstDragStop: function(event, ui) {
var target = $(event.target);
var offset = target.offset();
target.appendTo(document.body);
target.css("left", offset.left);
target.css("top", offset.top);
target.css("position", "absolute");
clearActions(target);
SSN.manager.appendExistingNote(ui.helper);
},
firstDragStart: function(event, ui) {
generateNote(config);
},
onRemove: function(){}
});
}
//init
var forContent = getJElement({
cls: SSN.cls.forContentPopup
});
var boxRemove = getJElement({
cls: SSN.cls.box
});
var buttonRemoveAll = getJElement({
html: "button",
cls: [SSN.cls.removeButton, SSN.cls.text, SSN.cls.managableActions].join(' '),
items: [chrome.i18n.getMessage("removeAllButton")]
});
buttonRemoveAll.hide();
boxRemove.click(function() {
SSN.manager.clickRemoveActions();
});
var popupActions = getJElement({
cls: SSN.cls.popupActions,
items: [boxRemove, buttonRemoveAll]
});
buttonRemoveAll.click(function(){
SSN.manager.removeAll();
});
var popup = getJElement({
cls: SSN.cls.contentPopupDiv,
items: [forContent, popupActions]
});
popup.appendTo($(config.renderTo));
generateNote({
popup: forContent
});
return popup;
}