summaryrefslogtreecommitdiff
path: root/skins
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-06-04 09:02:43 +0200
committerAleksander Machniak <alec@alec.pl>2013-06-04 09:02:43 +0200
commit3d78d55b5ad01a13030ebb37b4afda662ad12533 (patch)
tree01ae04d549c4b541d1058f11423c5eb4c8500dc0 /skins
parentad2ba95dcd196bf21c159c57f9198a0674f5125d (diff)
Move rcube_layer class to classic skin, it was used only there
Diffstat (limited to 'skins')
-rw-r--r--skins/classic/functions.js110
1 files changed, 109 insertions, 1 deletions
diff --git a/skins/classic/functions.js b/skins/classic/functions.js
index 1dcaa1586..5dd332ab7 100644
--- a/skins/classic/functions.js
+++ b/skins/classic/functions.js
@@ -634,9 +634,117 @@ enable_command: function(p)
};
/**
- * Scroller
+ * Roundcube generic layer (floating box) class
+ *
+ * @constructor
*/
+function rcube_layer(id, attributes)
+{
+ this.name = id;
+
+ // create a new layer in the current document
+ this.create = function(arg)
+ {
+ var l = (arg.x) ? arg.x : 0,
+ t = (arg.y) ? arg.y : 0,
+ w = arg.width,
+ h = arg.height,
+ z = arg.zindex,
+ vis = arg.vis,
+ parent = arg.parent,
+ obj = document.createElement('DIV');
+
+ obj.id = this.name;
+ obj.style.position = 'absolute';
+ obj.style.visibility = (vis) ? (vis==2) ? 'inherit' : 'visible' : 'hidden';
+ obj.style.left = l+'px';
+ obj.style.top = t+'px';
+ if (w)
+ obj.style.width = w.toString().match(/\%$/) ? w : w+'px';
+ if (h)
+ obj.style.height = h.toString().match(/\%$/) ? h : h+'px';
+ if (z)
+ obj.style.zIndex = z;
+
+ if (parent)
+ parent.appendChild(obj);
+ else
+ document.body.appendChild(obj);
+
+ this.elm = obj;
+ };
+
+ // create new layer
+ if (attributes != null) {
+ this.create(attributes);
+ this.name = this.elm.id;
+ }
+ else // just refer to the object
+ this.elm = document.getElementById(id);
+
+ if (!this.elm)
+ return false;
+
+
+ // ********* layer object properties *********
+
+ this.css = this.elm.style;
+ this.event = this.elm;
+ this.width = this.elm.offsetWidth;
+ this.height = this.elm.offsetHeight;
+ this.x = parseInt(this.elm.offsetLeft);
+ this.y = parseInt(this.elm.offsetTop);
+ this.visible = (this.css.visibility=='visible' || this.css.visibility=='show' || this.css.visibility=='inherit') ? true : false;
+
+
+ // ********* layer object methods *********
+
+ // move the layer to a specific position
+ this.move = function(x, y)
+ {
+ this.x = x;
+ this.y = y;
+ this.css.left = Math.round(this.x)+'px';
+ this.css.top = Math.round(this.y)+'px';
+ };
+ // change the layers width and height
+ this.resize = function(w,h)
+ {
+ this.css.width = w+'px';
+ this.css.height = h+'px';
+ this.width = w;
+ this.height = h;
+ };
+
+ // show or hide the layer
+ this.show = function(a)
+ {
+ if(a == 1) {
+ this.css.visibility = 'visible';
+ this.visible = true;
+ }
+ else if(a == 2) {
+ this.css.visibility = 'inherit';
+ this.visible = true;
+ }
+ else {
+ this.css.visibility = 'hidden';
+ this.visible = false;
+ }
+ };
+
+ // write new content into a Layer
+ this.write = function(cont)
+ {
+ this.elm.innerHTML = cont;
+ };
+
+};
+
+/**
+ * Scroller
+ */
function rcmail_scroller(list, top, bottom)
{
var ref = this;