svn commit: samba r13135 - in branches/tmp/deryck-samba4-swat/swat: . js

deryck at samba.org deryck at samba.org
Wed Jan 25 20:43:03 GMT 2006


Author: deryck
Date: 2006-01-25 20:43:03 +0000 (Wed, 25 Jan 2006)
New Revision: 13135

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13135

Log:
This adds a script from my gkit JavaScript lib
to help with the AJAX stuff.  All I'm doing with it
now is syncing up the height of the left menu with the
SWAT "console".

I chose to just include a final script built from
the various files in my JS lib, rather than include
the whole library (which would then have to include
each script or build a script during Samba/SWAT's build.
Just seemed easier to me to keep the AJAX stuff separate
as I'll continue development on it and incoporate it 
into other things.  If people feel differently and want
me to include the entire gkit lib, I don't mind.

(I really don't have strong feelings about this either
way and just went with what seemed easier.)

deryck

Added:
   branches/tmp/deryck-samba4-swat/swat/js/display.js
   branches/tmp/deryck-samba4-swat/swat/js/gkitlib.js
Modified:
   branches/tmp/deryck-samba4-swat/swat/header.esp


Changeset:
Modified: branches/tmp/deryck-samba4-swat/swat/header.esp
===================================================================
--- branches/tmp/deryck-samba4-swat/swat/header.esp	2006-01-25 15:52:08 UTC (rev 13134)
+++ branches/tmp/deryck-samba4-swat/swat/header.esp	2006-01-25 20:43:03 UTC (rev 13135)
@@ -3,12 +3,15 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
 <head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Content-Language" content="en-us" />
+
   <title>@@global.page.title</title>
 
   <link rel="stylesheet" href="/style/console.css" type="text/css" media="all" />
+  <script src="/js/gkitlib.js" type="text/javascript"></script>
+  <script src="/js/display.js" type="text/javascript"></script>
 
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-  <meta http-equiv="Content-Language" content="en-us" />
 </head>
 
 <body>

Added: branches/tmp/deryck-samba4-swat/swat/js/display.js
===================================================================
--- branches/tmp/deryck-samba4-swat/swat/js/display.js	2006-01-25 15:52:08 UTC (rev 13134)
+++ branches/tmp/deryck-samba4-swat/swat/js/display.js	2006-01-25 20:43:03 UTC (rev 13135)
@@ -0,0 +1,39 @@
+//  Functions to help display/style issues
+//  Will be incorporated into a single SWAT js script
+//  when all is said and done.
+//
+//  Requires gkitlib.js included with SWAT.
+//
+//  Released under the GNU GPL v2 or later.
+
+function setHelpLen()
+{
+	// Find the nodes by ID
+	var header = el('header');
+	var menu = el('menu');
+	var app = el('app');
+	var help = el('help');
+
+	// Get the availble space after header, menu, and padding
+	var appFace = elY(app) - (elY(header) + elY(menu) + 27);
+
+	// Set Help menu to fill the available space
+	if (elY(help) != appFace) {
+		help.style.height = px(appFace);
+	}
+
+}
+
+// Init the page.
+// All client side onload functions should be placed here for now.
+window.onload = function() {
+	if (el('help')) {
+		setHelpLen();
+	}
+}
+window.onresize = function() {
+	if (el('help')) {
+		setHelpLen();
+	}
+}
+

Added: branches/tmp/deryck-samba4-swat/swat/js/gkitlib.js
===================================================================
--- branches/tmp/deryck-samba4-swat/swat/js/gkitlib.js	2006-01-25 15:52:08 UTC (rev 13134)
+++ branches/tmp/deryck-samba4-swat/swat/js/gkitlib.js	2006-01-25 20:43:03 UTC (rev 13135)
@@ -0,0 +1,114 @@
+//   This script was built from gkit on Wed Jan 25 13:42:55 2006.
+//   See http://www.devurandom.org/googledevel/gkit/ for more info.
+
+var ua = navigator.userAgent.toLowerCase();var is_opera = ua.indexOf('opera') > -1;var is_ie = ua.indexOf('msie') > -1 && !is_opera;var is_ie5 = is_ie && ua.indexOf('msie 5') > -1;var is_safari = ua.indexOf('safari') > -1;var is_konq = ua.indexOf('konqueror') > -1;var is_moz = ua.indexOf('mozilla') > -1 && !is_ie && !is_opera && !is_konq;var is_ff = is_moz && ua.indexOf('firefox') > -1;var is_gecko = ua.indexOf('gecko') > -1 && !is_konq && !is_safari;var is_netscape = ua.indexOf('netscape') > -1;var is_netscape_ie = is_netscape && ua.indexOf('msie') > -1;var is_netscape_moz = is_netscape && ua.indexOf('gecko') > -1;var is_mac = ua.indexOf('macintosh') > -1 || ua.indexOf('mac') > -1;var is_linux = ua.indexOf('linux') > -1;var is_windows = ua.indexOf('windows') > -1;
+function isSupported(){if ( (is_moz && ua.indexOf('rv:1') > -1) ||(is_netscape && (ua.indexOf('/7') > -1 || ua.indexOf('/8') > -1)) ||(is_ie && ua.indexOf('msie 4') == -1) ||(is_opera && ua.indexOf('opera 8') > -1) ||(is_safari && (ua.indexOf('/4') > -1 || ua.indexOf('/3') > -1 || us.indexOf('/12') > -1)) ) {return true;} else {return false;}}
+function el(i) { return document.getElementById(i);}
+function px(x) { return x + 'px';}
+function els(t){return document.getElementsByTagName(t);}
+function El(el){return document.createElement(el);}
+function txt(txt){return document.createTextNode(txt);}
+function into(id, txt){el(id).innerHTML = txt;}
+function stringSplit(s, c) { var a = s.indexOf(c); if (a == -1) {  return [ s ]; }  var parts = []; parts.push(s.substr(0,a)); while (a != -1) {  var a1 = s.indexOf(c, a + 1);  if (a1 != -1) {   parts.push(s.substr(a + 1, a1 - a - 1));  } else {   parts.push(s.substr(a + 1));  }   a = a1; } return parts;}
+function xmlValue(node) { if (!node) {  return ''; } var ret = ''; if (node.nodeType == DOM_TEXT_NODE ||   node.nodeType == DOM_CDATA_SECTION_NODE ||   node.nodeType == DOM_ATTRIBUTE_NODE) {  ret += node.nodeValue; } else if (node.nodeType == DOM_ELEMENT_NODE ||       node.nodeType == DOM_DOCUMENT_NODE ||       node.nodeType == DOM_DOCUMENT_FRAGMENT_NODE) {  for (var i = 0; i < node.childNodes.length; ++i) {   ret += arguments.callee(node.childNodes[i]);  } } return ret;}
+function xmlText(node) { var ret = ''; if (node.nodeType == DOM_TEXT_NODE) {  ret += xmlEscapeText(node.nodeValue);   } else if (node.nodeType == DOM_ELEMENT_NODE) {  ret += '<' + node.nodeName;  for (var i = 0; i < node.attributes.length; ++i) {   var a = node.attributes[i];   if (a && a.nodeName && a.nodeValue) {    ret += ' ' + a.nodeName;    ret += '="' + xmlEscapeAttr(a.nodeValue) + '"';   }  }  if (node.childNodes.length == 0) {   ret += '/>';  } else {   ret += '>';   for (var i = 0; i < node.childNodes.length; ++i) {    ret += arguments.callee(node.childNodes[i]);   }   ret += '</' + node.nodeName + '>';  }   } else if (node.nodeType == DOM_DOCUMENT_NODE ||       node.nodeType == DOM_DOCUMENT_FRAGMENT_NODE) {  for (var i = 0; i < node.childNodes.length; ++i) {   ret += arguments.callee(node.childNodes[i]);  } }  return ret;}
+function mapExec(array, func) { for (var i = 0; i < array.length; ++i) {  func(array[i]); }}
+function mapExpr(array, func) { var ret = []; for (var i = 0; i < array.length; ++i) {  ret.push(func(array[i])); } return ret;};
+function reverseInplace(array) { for (var i = 0; i < array.length / 2; ++i) {  var h = array[i];  var ii = array.length - i - 1;  array[i] = array[ii];  array[ii] = h; }}
+function copyArray(dst, src) {  for (var i = 0; i < src.length; ++i) {  dst.push(src[i]); }}
+function assert(b) { if (!b) {  throw 'assertion failed'; }};var DOM_ELEMENT_NODE = 1;var DOM_ATTRIBUTE_NODE = 2;var DOM_TEXT_NODE = 3;var DOM_CDATA_SECTION_NODE = 4;var DOM_ENTITY_REFERENCE_NODE = 5;var DOM_ENTITY_NODE = 6;var DOM_PROCESSING_INSTRUCTION_NODE = 7;var DOM_COMMENT_NODE = 8;var DOM_DOCUMENT_NODE = 9;var DOM_DOCUMENT_TYPE_NODE = 10;var DOM_DOCUMENT_FRAGMENT_NODE = 11;var DOM_NOTATION_NODE = 12;var xpathdebug = false; var xsltdebug = false; function xmlEscapeText(s) { return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');}
+function xmlEscapeAttr(s) { return xmlEscapeText(s).replace(/\"/g, '&quot;');}
+function xmlEscapeTags(s) { return s.replace(/</g, '&lt;').replace(/>/g, '&gt;');};var logging__ = true;
+function Log() {};Log.lines = [];
+Log.write = function(s) { if (logging__) {  this.lines.push(xmlEscapeText(s));  this.show(); }};
+Log.writeXML = function(xml) { if (logging__) {  var s0 = xml.replace(/</g, '\n<');  var s1 = xmlEscapeText(s0);  var s2 = s1.replace(/\s*\n(\s|\n)*/g, '<br/>');  this.lines.push(s2);  this.show(); }}
+Log.writeRaw = function(s) { if (logging__) {  this.lines.push(s);  this.show(); }}
+Log.clear = function() { if (logging__) {  var l = this.div();  l.innerHTML = '';  this.lines = []; }}
+Log.show = function() { var l = this.div(); l.innerHTML += this.lines.join('<br/>') + '<br/>'; this.lines = []; l.scrollTop = l.scrollHeight;}
+Log.div = function() { var l = document.getElementById('log'); if (!l) {  l = document.createElement('div');  l.id = 'log';  l.style.position = 'absolute';  l.style.right = '5px';  l.style.top = '5px';  l.style.width = '250px';  l.style.height = '150px';  l.style.overflow = 'auto';  l.style.backgroundColor = '#f0f0f0';  l.style.border = '1px solid gray';  l.style.fontSize = '10px';  l.style.padding = '5px';  document.body.appendChild(l); } return l;}
+function Timer() {}
+Timer.start = function() {}
+Timer.end = function() {}
+function xmlResolveEntities(s) { var parts = stringSplit(s, '&'); var ret = parts[0]; for (var i = 1; i < parts.length; ++i) {  var rp = stringSplit(parts[i], ';');  if (rp.length == 1) {      ret += parts[i];   continue;  }    var ch;  switch (rp[0]) {   case 'lt':     ch = '<';    break;   case 'gt':     ch = '>';    break;   case 'amp':     ch = '&';    break;   case 'quot':     ch = '"';    break;   case 'apos':     ch = '\'';    break;   case 'nbsp':     ch = String.fromCharCode(160);    break;   default:                    var span = window.document.createElement('span');    span.innerHTML = '&' + rp[0] + '; ';    ch = span.childNodes[0].nodeValue.charAt(0);  }  ret += ch + rp[1]; } return ret;}
+function xmlParse(xml) { Timer.start('xmlparse'); var regex_empty = /\/$/;    var regex_tagname = /^([\w:-]*)/; var regex_attribute = /([\w:-]+)\s?=\s?('([^\']*)'|"([^\"]*)")/g; var xmldoc = new XDocument(); var root = xmldoc;        var stack = []; var parent = root; stack.push(parent); var x = stringSplit(xml, '<'); for (var i = 1; i < x.length; ++i) {  var xx = stringSplit(x[i], '>');  var tag = xx[0];  var text = xmlResolveEntities(xx[1] || '');  if (tag.charAt(0) == '/') {   stack.pop();   parent = stack[stack.length-1];  } else if (tag.charAt(0) == '?') {     } else if (tag.charAt(0) == '!') {     } else {   var empty = tag.match(regex_empty);   var tagname = regex_tagname.exec(tag)[1];   var node = xmldoc.createElement(tagname);   var att;   while (att = regex_attribute.exec(tag)) {    var val = xmlResolveEntities(att[3] || att[4] || '');    node.setAttribute(att[1], val);   }      if (empty) {    parent.appendChild(node);   } else {    parent.appendChild(node);    parent = node;    stack.push(node);   }  }  if (text && parent != root) {   parent.appendChild(xmldoc.createTextNode(text));  } } Timer.end('xmlparse'); return root;}
+function xmlParseDiv(xml) { Timer.start('xmlparse'); var regex_empty = /\/$/;    var regex_tagname = /^([\w:-]*)/; var regex_attribute = /([\w:-]+)\s?=\s?('([^\']*)'|"([^\"]*)")/g;  var doc = window.document;  var root = doc.createElement('div');        var stack = []; var parent = root; stack.push(parent); var x = stringSplit(xml, '<'); for (var i = 1; i < x.length; ++i) {  var xx = stringSplit(x[i], '>');  var tag = xx[0];  var text = xmlResolveEntities(xx[1] || '');  if (tag.charAt(0) == '/') {   stack.pop();   parent = stack[stack.length-1];  } else if (tag.charAt(0) == '?') {     } else if (tag.charAt(0) == '!') {     } else {   var empty = tag.match(regex_empty);   var tagname = regex_tagname.exec(tag)[1];   var node = doc.createElement(tagname);   var att;   while (att = regex_attribute.exec(tag)) {    var val = xmlResolveEntities(att[3] || att[4] || '');    node.setAttribute(att[1], val);   }      if (empty) {    parent.appendChild(node);   } else {    parent.appendChild(node);    parent = node;    stack.push(node);   }  }  if (text && parent != root) {   parent.appendChild(doc.createTextNode(text));  } } Timer.end('xmlparse'); return root;}
+function XNode(type, name, value, owner) { this.attributes = []; this.childNodes = []; XNode.init.call(this, type, name, value, owner);}
+XNode.init = function(type, name, value, owner) { this.nodeType = type - 0; this.nodeName = '' + name; this.nodeValue = '' + value; this.ownerDocument = owner; this.firstChild = null; this.lastChild = null; this.nextSibling = null; this.previousSibling = null; this.parentNode = null;};XNode.unused_ = [];
+XNode.recycle = function(node) { if (!node) {  return; } if (node.constructor == XDocument) {  XNode.recycle(node.documentElement);  return; } if (node.constructor != this) {  return; } XNode.unused_.push(node); for (var a = 0; a < node.attributes.length; ++a) {  XNode.recycle(node.attributes[a]); } for (var c = 0; c < node.childNodes.length; ++c) {  XNode.recycle(node.childNodes[c]); } node.attributes.length = 0; node.childNodes.length = 0; XNode.init.call(node, 0, '', '', null);}
+XNode.create = function(type, name, value, owner) { if (XNode.unused_.length > 0) {  var node = XNode.unused_.pop();  XNode.init.call(node, type, name, value, owner);  return node; } else {  return new XNode(type, name, value, owner); }}
+XNode.prototype.appendChild = function(node) {  if (this.childNodes.length == 0) {  this.firstChild = node; }  node.previousSibling = this.lastChild;  node.nextSibling = null; if (this.lastChild) {  this.lastChild.nextSibling = node; }  node.parentNode = this;  this.lastChild = node;  this.childNodes.push(node);}
+XNode.prototype.replaceChild = function(newNode, oldNode) { if (oldNode == newNode) {  return; } for (var i = 0; i < this.childNodes.length; ++i) {  if (this.childNodes[i] == oldNode) {   this.childNodes[i] = newNode;      var p = oldNode.parentNode;   oldNode.parentNode = null;   newNode.parentNode = p;      p = oldNode.previousSibling;   oldNode.previousSibling = null;   newNode.previousSibling = p;   if (newNode.previousSibling) {    newNode.previousSibling.nextSibling = newNode;   }      p = oldNode.nextSibling;   oldNode.nextSibling = null;   newNode.nextSibling = p;   if (newNode.nextSibling) {    newNode.nextSibling.previousSibling = newNode;   }   if (this.firstChild == oldNode) {    this.firstChild = newNode;   }   if (this.lastChild == oldNode) {    this.lastChild = newNode;   }   break;  } }}
+XNode.prototype.insertBefore = function(newNode, oldNode) { if (oldNode == newNode) {  return; } if (oldNode.parentNode != this) {  return; } if (newNode.parentNode) {  newNode.parentNode.removeChild(newNode); } var newChildren = []; for (var i = 0; i < this.childNodes.length; ++i) {  var c = this.childNodes[i];  if (c == oldNode) {   newChildren.push(newNode);   newNode.parentNode = this;   newNode.previousSibling = oldNode.previousSibling;   oldNode.previousSibling = newNode;   if (newNode.previousSibling) {    newNode.previousSibling.nextSibling = newNode;   }      newNode.nextSibling = oldNode;   if (this.firstChild == oldNode) {    this.firstChild = newNode;   }  }  newChildren.push(c); } this.childNodes = newChildren;}
+XNode.prototype.removeChild = function(node) { var newChildren = []; for (var i = 0; i < this.childNodes.length; ++i) {  var c = this.childNodes[i];  if (c != node) {   newChildren.push(c);  } else {   if (c.previousSibling) {    c.previousSibling.nextSibling = c.nextSibling;   }   if (c.nextSibling) {    c.nextSibling.previousSibling = c.previousSibling;   }   if (this.firstChild == c) {    this.firstChild = c.nextSibling;   }   if (this.lastChild == c) {    this.lastChild = c.previousSibling;   }  } } this.childNodes = newChildren;}
+XNode.prototype.hasAttributes = function() { return this.attributes.length > 0;}
+XNode.prototype.setAttribute = function(name, value) { for (var i = 0; i < this.attributes.length; ++i) {  if (this.attributes[i].nodeName == name) {   this.attributes[i].nodeValue = '' + value;   return;  } } this.attributes.push(new XNode(DOM_ATTRIBUTE_NODE, name, value));}
+XNode.prototype.getAttribute = function(name) { for (var i = 0; i < this.attributes.length; ++i) {  if (this.attributes[i].nodeName == name) {   return this.attributes[i].nodeValue;  } } return null;}
+XNode.prototype.removeAttribute = function(name) { var a = []; for (var i = 0; i < this.attributes.length; ++i) {  if (this.attributes[i].nodeName != name) {   a.push(this.attributes[i]);  } } this.attributes = a;}
+function XDocument() { XNode.call(this, DOM_DOCUMENT_NODE, '#document', null, this); this.documentElement = null;};XDocument.prototype = new XNode(DOM_DOCUMENT_NODE, '#document');
+XDocument.prototype.clear = function() { XNode.recycle(this.documentElement); this.documentElement = null;}
+XDocument.prototype.appendChild = function(node) { XNode.prototype.appendChild.call(this, node); this.documentElement = this.childNodes[0];}
+XDocument.prototype.createElement = function(name) { return XNode.create(DOM_ELEMENT_NODE, name, null, this);}
+XDocument.prototype.createDocumentFragment = function() { return XNode.create(DOM_DOCUMENT_FRAGMENT_NODE, '#document-fragment',          null, this);}
+XDocument.prototype.createTextNode = function(value) { return XNode.create(DOM_TEXT_NODE, '#text', value, this);}
+XDocument.prototype.createAttribute = function(name) { return XNode.create(DOM_ATTRIBUTE_NODE, name, null, this);}
+XDocument.prototype.createComment = function(data) { return XNode.create(DOM_COMMENT_NODE, '#comment', data, this);}
+XNode.prototype.getElementsByTagName = function(name, list) { if (!list) {  list = []; } if (this.nodeName == name) {  list.push(this); } for (var i = 0; i < this.childNodes.length; ++i) {  this.childNodes[i].getElementsByTagName(name, list); } return list;}
+function cssValue(node, prop){var value;if (is_ie) {value = node.currentStyle[prop];} else {value = document.defaultView.getComputedStyle(node, '').getPropertyValue(prop);}return value;}
+function docX(){    var x;    if (window.innerWidth) {        x = window.innerWidth;    } else {        x = document.documentElement.clientWidth;    }    return x;}
+function docY(){    var y;    if (window.innerHeight) {        y = window.innerHeight;    } else {        y = document.documentElement.clientHeight;    }    return y;}
+function elX(node){var elX = node.offsetWidth;return elX;}
+function elY(node){var elY = node.offsetHeight;return elY;}
+function evtPosX(e){var x;if (is_ie) {x = event.clientX;} else {x = e.clientX;}return x;}
+function evtPosY(e){var y;if (is_ie) {y = event.clientY;} else {y = e.clientY;}return y;}
+function elLeft(node){return node.offsetLeft;}
+function elTop(node){return node.offsetTop;}
+function elPosX(node){if (node.offsetParent) {if (node.offsetParent.nodeName.toLowerCase() == 'body') {return elLeft(node);} else {var left = 0;var n = node;while (n) {left += n.offsetLeft;n = n.offsetParent;}return left;}} else {return elLeft(node);}}
+function elPosY(node){if (node.offsetParent) {if (node.offsetParent.nodeName.toLowerCase() == 'body') {return elTop(node);} else {var top = 0;var op = node.offsetParent;while (op) {top += op.offsetTop;op = op.offsetParent;}return top;}} else {return elTop(node);}}
+function randomX(w){var x;if (w) {    x = Math.floor((docX() - w) * Math.random());} else {    x = Math.floor(docX() * Math.random());}    return x;}
+function randomY(h){    var y;if (h) {y = Math.floor((docY() - h) * Math.random());} else {y = Math.floor(docY() * Math.random());}    return y;}
+var i;var j;
+function setOpacity(node, value){node.style.MozOpacity = value / 100;node.style.KHTMLOpacity = value / 100 ;node.style.filter = 'alpha(opacity=' + value + ')';node.style.opacity = value / 100;}
+function colorIndex(node){var rgb = cssValue(node, 'color');var s;var r, g, b;if (rgb.indexOf('rgb') == -1) {if (rgb.indexOf('#') > -1) {s = rgb.slice(1);} else {s = rgb;}if (s.length == 3) {var rA = s.substring(0,1);var gA = s.substring(2,1);var bA = s.substring(2);s = rA + rA+ gA + gA + bA + bA;};r = parseInt(s.substring(0,2), 16);g = parseInt(s.substring(2,4), 16);b = parseInt(s.substring(4,6), 16);} else {s = rgb.slice(4,-1).split(',');r = parseInt(s[0]);g = parseInt(s[1]);b = parseInt(s[2]);};var value = Math.max(r, Math.max(g, b));return value;}
+function textToBlack(id, speed, _loop){var node = el(id);if (!_loop) {i = colorIndex(node);}if (i > 0) {i -= 5;node.style.color = 'rgb(' + i + ', ' + i + ', ' + i + ')';if (speed) {setTimeout('textToBlack("' + id + '", "' + speed + '", ' + true + ')', speed);} else {setTimeout('textToBlack("' + id + '", "' + true + ')', speed);}} else if (i == 0) {node.style.color = 'rgb(' + i + ', ' + i + ', ' + i + ')';}}
+function textToWhite(id, speed, _loop){var node = el(id);if (!_loop) {i = colorIndex(node);}if (i < 255) {i += 5;node.style.color = 'rgb(' + i + ', ' + i + ', ' + i + ')';if (speed) {setTimeout('textToWhite("' + id + '", "' + speed + '", ' + true + ')', speed);} else {setTimeout('textToWhite("' + id + '", "' + true + ')', 0);}}}
+function fadeIn(id, speed, _loop){var node = el(id);if (!_loop) {j = 0;}if (j < 99) {if (speed) {setTimeout('fadeIn("' + id + '", "' + speed + '", ' + true + ')', speed); } else {setTimeout('fadeIn("' + id + '", ' + null + ', ' + true + ')', 0); }setOpacity(node, j);j++;}}
+function fadeOut(id, speed, _loop){var node = el(id);if (!_loop) {j = 99;}if (j > 0) {if (speed) {setTimeout('fadeOut("' + id + '", "' + speed + '", ' + true + ')', speed); } else {setTimeout('fadeOut("' + id + '", ' + null + ', ' + true + ')', 0); }setOpacity(node, j);j--;}}
+function moveX(id, len, speed){var node = el(id);var x = elLeft(node);var y = elTop(node);node.style.position = 'absolute';node.style.left = px(x);node.style.top = px(y);var nX = x + 1;if (len > 0) {node.style.left = px(nX);len--;if (speed) {setTimeout('moveX("' + id + '", "' + len + '", "' + speed + '")', speed);} else {setTimeout('moveX("' + id + '", "' + len + '")', 0);}}}
+function moveY(id, depth, speed){var node = el(id);var x = elLeft(node);var y = elTop(node);node.style.position = 'absolute';node.style.left = px(x);node.style.top = px(y);var nY = y + 1;if (depth > 0) {node.style.top = px(nY);depth--;if (speed) {setTimeout('moveY("' + id + '", "' + depth + '", "' + speed + '")', speed);} else {setTimeout('moveY("' + id + '", "' + depth + '")', 0);}}}
+function moveXY(id, len, depth, speed){var node = el(id);var x = elLeft(node);var y = elTop(node);node.style.position = 'absolute';node.style.left = px(x);node.style.top = px(y);var nX = x + 1;var nY = y + 1;if (depth > 0) {node.style.top = px(nY);depth--;}if (len > 0) {node.style.left = px(nX);len--;}if (len == 0 && depth == 0) {return;} else {if (speed) {setTimeout('moveXY("' + id + '", "' + len + '", "' + depth + '", "' + speed + '")', speed);} else {setTimeout('moveXY("' + id + '", "' + len + '", "' + depth + '")', 0);}}}
+function getHttp(url, handler, data){var request = getReqListRequest();if (data) {makeHttpGet(request, url, handler, data);} else {makeHttpGet(request, url, handler, null);}}
+function postHttp(url, handler, data){var request = getReqListRequest();if (data) {makeHttpPost(request, url, handler, data);} else {makeHttpPost(request, url, handler, null);}}
+document.insertHttpText = function(method, url, target){this.formatter = function(request) {el(target).innerHTML = request.responseText;};if (method.toLowerCase() == 'get') {getHttp(url, this.formatter);} else {postHttp(url, this.formatter, null);}}
+document.insertHttpXML = function(method, url, target){this.formatter = function(request) {el(target).innerHTML = request.responseXML;};if (method.toLowerCase() == 'get') {getHttp(url, this.formatter);} else {postHttp(url, this.formatter, null);}}
+document.insertBeforeHttpText = function(method, url, target, child){this.formatter = function(request) {var div = El('div');div.appendChild(txt(request.responseText));el(target).insertBefore(div, child);};if (method.toLowerCase() == 'get') {getHttp(url, this.formatter);} else {postHttp(url, this.formatter, null);}}
+document.insertBeforeHttpXML = function(method, url, target, child){this.formatter = function(request) {if (is_ie) {alert('This method is not supported in IE.');return;};var body = request.responseXML.documentElement.getElementsByTagName('body')[0];el(target).insertBefore(body, child);};if (method.toLowerCase() == 'get') {getHttp(url, this.formatter);} else {postHttp(url, this.formatter, null);}}
+document.appendHttpText = function(method, url, target){this.formatter = function(request) {var div = El('div');div.appendChild(txt(request.responseText));el(target).appendChild(div);};if (method.toLowerCase() == 'get') {getHttp(url, this.formatter);} else {postHttp(url, this.formatter, null);}}
+document.appendHttpXML = function(method, url, target){this.formatter = function(request) {if (is_ie) {alert('This method is not supported in IE.');return;};var body = request.responseXML.documentElement.getElementsByTagName('body')[0];el(target).appendChild(body);};if (method.toLowerCase() == 'get') {getHttp(url, this.formatter);} else {postHttp(url, this.formatter, null);}};var reqList = [];
+function getReqListRequest(){var request = reqList.pop();if (!request) {setTimeout(fillReqList, 0);return initRequest();}return request;}
+function fillReqList(){try {while (reqList.length < 5) {reqList.push(initRequest())}} catch (err) {}}setTimeout(fillReqList, 0);
+function initRequest(){var request = null;if (is_ie) {var objVer = is_ie5 ? "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP";try {request= new ActiveXObject(objVer);}catch (err) {}} else {try {request = new XMLHttpRequest();}catch (err) {}}return request;}
+function makeHttpGet(request, url, handler, data){request.onreadystatechange = function() {if (request.readyState == 4) {if (request.status == 200) {if (handler) {handler(request, url);}}}};request.open('GET', url, true);request.send(data)}
+function makeHttpPost(request, url, handler, data){request.onreadystatechange = function() {if (request.readyState == 4) {if (request.status == 200) {if (handler) {handler(request, url);}}}};request.open('POST', url, true);request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');request.send(data)}
+function normalizeE(e){if (typeof e == 'undefined') {e = window.event;}if (typeof e.target == 'undefined') {e.target = e.srcElement;}return e;};var Drag = new Object();Drag.obj = null;
+Drag.init = function(type, node, root, minX, maxX, minY, maxY) {node.onmouseover = Drag.hover;node.onmousedown = Drag.start;node.dragType = type;if (root && root != null) {node.root = root;} else {node.root = node;};node.root.style.position = 'absolute';if (isNaN(parseInt(node.root.style.left))) {node.root.style.left = px(elLeft(node.root));}if (isNaN(parseInt(node.root.style.top))) {node.root.style.top = px(elTop(node.root));};node.minX = typeof minX != 'undefined' ? minX : null;node.minY = typeof minY != 'undefined' ? minY : null;node.maxX = typeof maxX != 'undefined' ? maxX : null;node.maxY = typeof maxY != 'undefined' ? maxY : null;node.root.onDragStart= new Function();node.root.onDragEnd= new Function();node.root.onDrag= new Function();if (is_ie) {document.onselectstart = function() {return false;};}}
+Drag.hover = function() {var node = Drag.obj = this;if (node.dragType == 'move') {node.style.cursor = 'move';} else if (node.dragType == 'resize') {node.style.cursor = 'nw-resize';}return false;}
+Drag.start = function(e) {var node = Drag.obj;e = normalizeE(e);var y = parseInt(node.root.style.top);var x = parseInt(node.root.style.left);node.root.onDragStart(x, y);node.lastMouseX= e.clientX;node.lastMouseY= e.clientY;if (node.minX != null) {node.minMouseX= e.clientX - x + node.minX;}if (node.maxX != null){node.maxMouseX= node.minMouseX + node.maxX - node.minX;}if (node.minY != null) {node.minMouseY= e.clientY - y + node.minY;}if (node.maxY != null) {node.maxMouseY= node.minMouseY + node.maxY - node.minY;};node.onmousemove = Drag.drag;node.onmouseup = Drag.end;node.onmouseout = Drag.off;return false;}
+Drag.drag = function(e) {e = normalizeE(e);var node = Drag.obj;var ey= e.clientY;var ex= e.clientX;var x, y;var nx, ny;if (node.dragType == 'move') {x = parseInt(node.root.style.left);y = parseInt(node.root.style.top);} else if (node.dragType == 'resize') {x = elX(node.root);y = elY(node.root);}if (node.minX != null) {ex = Math.max(ex, node.minMouseX);}if (node.maxX != null) {ex = Math.min(ex, node.maxMouseX);}if (node.minY != null) {ey = Math.max(ey, node.minMouseY);}if (node.maxY != null) {ey = Math.min(ey, node.maxMouseY);};nx = x + ex - node.lastMouseX;ny = y + ey - node.lastMouseY;if (node.dragType == 'move') {node.root.style.left = px(nx);node.root.style.top = px(ny);} else if (node.dragType == 'resize') {node.root.style.width = px(nx);node.root.style.height = px(ny);};node.lastMouseX = ex;node.lastMouseY = ey;node.root.onDrag(nx, ny);return false;}
+Drag.end = function() {var node = Drag.obj;var y = parseInt(node.root.style.top);var x = parseInt(node.root.style.left);node.root.onDragEnd(x, y);node.onmousemove = null;node.onmouseup  = null;}
+Drag.off = function() {var node = Drag.obj;node.style.cursor = 'auto';node.onmousemove = null;node.onmouseup  = null;Drag.obj = null;}
+function corners(limit, node){var pts = new Array();var box = el(limit);var diffX = 0;var diffY = 0;if (cssValue(box, 'position') == 'absolute' && !is_ie) {diffX = box.offsetLeft;diffY = box.offsetTop;}pts[0] = elPosX(box) - diffX;pts[1] = pts[0] + elX(box) - elX(node);pts[2] = elPosY(box) - diffY;pts[3] = pts[2] + elY(box) - elY(node);return pts;}
+document.setDragById = function(id, grip, limit) {var node = el(id);var hand;var pts;if (grip) {hand = el(grip);}if (limit) {pts = corners(limit, node);}if (grip && limit) {Drag.init('move', hand, node, pts[0], pts[1], pts[2], pts[3]);} else if (grip && !limit) {Drag.init('move', hand, node);} else if (!grip && limit) {Drag.init('move', node, null, pts[0], pts[1], pts[2], pts[3]);} else {Drag.init('move', node);}}
+document.setDragByClass = function(cls, grip, limit) {this._setNodes = function(e) {e = normalizeE(e);if (e.target.className == cls) {var node = e.target;var hand;var pts;if (grip) {hand = el(grip);}if (limit) {pts = corners(limit, node);}if (grip && limit) {Drag.init('move', hand, node, pts[0], pts[1], pts[2], pts[3]);} else if (grip && !limit) {Drag.init('move', hand, node);} else if (!grip && limit) {Drag.init('move', node, null, pts[0], pts[1], pts[2], pts[3]);} else {Drag.init('move', node);}}return false;};document.onmouseover = this._setNodes;}
+document.setResizeById = function(id, grip) {var node = el(id);var hand;if (grip) {hand = el(grip);Drag.init('resize', hand, node);return;} else {Drag.init('resize', node);}}
+function Cache() {};
+Cache.prototype.cacheRequest = function(url, response, contentType) {this[url] = {};this[url].response = response;this[url].contentType = contentType;}
+Cache.prototype.getFromCache = function(url) {return this[url].response;}
+Cache.prototype.contentType = function(url) {return this[url].contentType;}
+Cache.prototype.size = function() {var count = [];this.self = this;for (var n in this.self) {if (this[n].contentType) {count.push(n);}}return count.length -1;}
+function c(){return document.cookie;}
+function isCookie(name){if (c().indexOf(name + '=') > -1) {return true;} else {return false;}}
+function numDaysGMT(n){var date = new Date();date.setDate(date.getDate() + n);return date.toGMTString();}
+function setCookie(name, value, expires){if (expires) {document.cookie = name + '=' + value + ';expires=' + expires;} else {document.cookie = name + '=' + value;}}
+function killCookie(name){if (isCookie(name)) {var date = new Date();date.setTime(date.getTime() - 1);document.cookie = name + '=' + getCookie(name) + ';expires=' + date.toGMTString()}}
+function killAllCookies(){document.cookie = '';}
+function getCookie(name){if (isCookie(name)) {var cookies = c();var a, b;a = cookies.indexOf(name + '=');if (a == -1) {return;};b = cookies.indexOf(';', a);var cook;if (b > -1) {cook = cookies.slice(a, b);} else {cook = cookies.slice(a);}return cook.split('=')[1];}}



More information about the samba-cvs mailing list