-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialog.js
48 lines (36 loc) · 1.34 KB
/
dialog.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
(function (window, $, Voltron, jenga) {
'use strict';
// set prototype to base component and assign
// Dialog constructor to the constructor prototype
Dialog.prototype = new Voltron({});
Dialog.prototype.constructor = Dialog;
// constructor
function Dialog (options) {
// optionally clone dialog $el
options.$el = options.clone ? $(options.$el).clone() :
$(options.$el);
// append to body
$('body').append(options.$el);
Voltron.call(this, options);
return this;
}
Dialog.prototype.init = function (options) {
// call super method
Voltron.prototype.init.call(this, options);
// position the dialog's root element absolutely
this.$el.css({ position: 'absolute' });
};
// defaults, e.g., width and height
Dialog.prototype.defaults = {};
// event listeners; this is processed by Voltron.prototype.bind
Dialog.prototype.events = {};
// process template for injection into DOM
Dialog.prototype.render = function () {};
// makes dialog visible in the UI
Dialog.prototype.show = function () {
jenga.bringToFront(this.$el[0]);
};
// makes dialog invisible in the UI
Dialog.prototype.hide = function () {};
window.Dialog = window.Dialog || Dialog;
})(window, jQuery, Voltron, jenga);