-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathabstractsitehandler.js
35 lines (35 loc) · 1.15 KB
/
abstractsitehandler.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
var AbstractSiteHandler = Class.extend ({
urlPattern: "http://*/*",
controller: undefined,
suspects: [],
init: function(controller, urlPattern) {
this.urlPatern = urlPattern;
this.controller = controller;
this.addControl("action_reload_index", "⟳Reload", this, this.reloadIndex);
this.addControl("action_config", "⟁Config", this, controller.showConfig);
this.addControl("action_select_definition", "⏚Все списки", this, controller.showDefinitionSelector);
},
reloadIndex: function () {
this.controller.loadIndex();
},
getControlBar: function () {
if ($(".floating-menu").length == 0){
$("body"). prepend('<div class="floating-menu"></div>')
$(".floating-menu").css({ 'position': 'fixed',
'background': '#CCC',
'border': '1px solid #ccc',
'width': '64px',
'z-index': '100',
'bottom': '10px',
'right': '15px'
});
}
return $(".floating-menu");
},
addControl: function (id, text, scope, callBack, args) {
$(this.getControlBar()).append('<button id="' + id + '">' + text + '</button></br>');
$("#" + id).click(function () {
callBack.apply(scope, [args]);
});
}
});