Commit 90700bc7 authored by Julien Cigar's avatar Julien Cigar
Browse files

set_title, set_body, set_position, ...

parent ad730d5b
......@@ -23,13 +23,14 @@
if (this.options.onscroll == 'scroll') {
Yeti.Evt.bind(window, 'scroll', function() {
_self.refresh_position();
_self.set_position();
});
}
this.container = document.body;
this.frame = document.createElement('div');
this.header = document.createElement('div');
this.title = document.createElement('span');
this.body = document.createElement('div');
this.frame.style.zIndex = this.options.zindex;
......@@ -55,17 +56,19 @@
Yeti.DOM.addClass(this.frame, 'ui-frame');
Yeti.DOM.addClass(this.header, 'ui-frame-header');
Yeti.DOM.addClass(this.title, 'ui-frame-title');
Yeti.DOM.addClass(this.body, 'ui-frame-body');
this.header.appendChild(document.createTextNode(this.options.title));
this.header.appendChild(this.title);
this.frame.appendChild(this.header);
this.frame.appendChild(this.body);
this.frame.style.width = this.options.width;
this.frame.style.height = this.options.height;
this.refresh_position();
this.set_title(this.options.title);
this.set_body(this.options.body);
this.set_position();
}
UI.Frame.prototype.update_options = function(opts) {
......@@ -97,13 +100,29 @@
}
}
UI.Frame.prototype.refresh_position = function() {
var position = this.get_position();
UI.Frame.prototype.set_position = function(position) {
var position = position || this.get_position();
this.frame.style.left = position.left;
this.frame.style.top = position.top;
}
UI.Frame.prototype.set_title = function(value) {
Yeti.DOM.removeNodes(this.title);
this.title.appendChild(document.createTextNode(value));
}
UI.Frame.prototype.set_body = function(value) {
var content = Yeti.Element(value);
if (content) {
Yeti.DOM.removeNodes(this.body);
if (content.style.display == 'none') {
content.style.display = 'block';
}
this.body.appendChild(content);
}
}
UI.Frame.prototype.attach = function() {
if (this.overlay) {
this.container.appendChild(this.overlay);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment