You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
15 KiB
Plaintext
1 line
15 KiB
Plaintext
var dbx;function dbxManager(a){dbx=this;if(!/^[-_a-z0-9]+$/i.test(a)){alert('Error from dbxManager:\n"'+a+'" is an invalid session ID');return}this.supported=!(document.getElementsByTagName("*").length==0||(navigator.vendor=="KDE"&&typeof window.sidebar=="undefined"));if(!this.supported){return}this.etype=typeof document.addEventListener!="undefined"?"addEventListener":typeof document.attachEvent!="undefined"?"attachEvent":"none";this.eprefix=(this.etype=="attachEvent"?"on":"");if(typeof window.opera!="undefined"&&parseFloat(navigator.userAgent.toLowerCase().split(/opera[\/ ]/)[1].split(" ")[0],10)<7.5){this.etype="none"}if(this.etype=="none"){this.supported=false;return}this.running=0;this.sid=a;this.savedata={};this.cookiestate=this.getCookieState()}dbxManager.prototype.setCookieState=function(){var a=new Date();a.setTime(a.getTime()+(365*24*60*60*1000));var b="";for(j in this.savedata){if(typeof this.savedata[j]!="function"){b+=j+"="+this.savedata[j]+"&"}}this.state=b.replace(/^(.+)&$/,"$1");this.cookiestring=this.state.replace(/,/g,"|");this.cookiestring=this.cookiestring.replace(/=/g,":");if(typeof this.onstatechange=="undefined"||this.onstatechange()){document.cookie="dbx-"+this.sid+"="+this.cookiestring+"; expires="+a.toGMTString()+"; path=/"}};dbxManager.prototype.getCookieState=function(){this.cookiestate=null;if(document.cookie){if(document.cookie.indexOf("dbx-"+this.sid)!=-1){this.cookie=document.cookie.split("dbx-"+this.sid+"=")[1].split(";")[0].split("&");for(var a in this.cookie){if(typeof this.cookie[a]!="function"){this.cookie[a]=this.cookie[a].replace(/\|/g,",");this.cookie[a]=this.cookie[a].replace(/:/g,"=");this.cookie[a]=this.cookie[a].split("=");this.cookie[a][1]=this.cookie[a][1].split(",")}}this.cookiestate={};for(a in this.cookie){if(typeof this.cookie[a]!="function"){this.cookiestate[this.cookie[a][0]]=this.cookie[a][1]}}}}return this.cookiestate};dbxManager.prototype.addDataMember=function(b,a){this.savedata[b]=a};dbxManager.prototype.createElement=function(a){return typeof document.createElementNS!="undefined"?document.createElementNS("http://www.w3.org/1999/xhtml",a):document.createElement(a)};dbxManager.prototype.getTarget=function(f,c,b){if(typeof b!="undefined"){var d=b}else{d=typeof f.target!="undefined"?f.target:f.srcElement}var a=new RegExp(c,"");while(!a.test(d.className)){d=d.parentNode}return d};function dbxGroup(k,m,a,l,u,b,f,e,g,n,p,o,s,t){if(!/^[-_a-z0-9]+$/i.test(k)){alert('Error from dbxGroup:\n"'+k+'" is an invalid container ID');return}this.container=document.getElementById(k);if(this.container==null||!dbx.supported){return}var h=this;this.gid=k;this.dragok=false;this.box=null;this.vertical=m=="vertical";this.threshold=parseInt(a,10);this.restrict=l=="yes";this.resolution=parseInt(u,10);this.toggles=b=="yes";this.defopen=f!="closed";this.vocab={open:e,close:g,move:n,toggle:p,kmove:o,ktoggle:s,syntax:t};this.container.style.position="relative";this.container.style.display="block";if(typeof window.opera!="undefined"){this.container.style.display="run-in"}this.boxes=[];this.buttons=[];this.order=[];this.eles=this.container.getElementsByTagName("*");for(var q=0;q<this.eles.length;q++){if(/dbx\-box/i.test(this.eles[q].className)&&!/dbx\-dummy/i.test(this.eles[q].className)){this.eles[q].style.position="relative";this.eles[q].style.display="block";this.boxes.push(this.eles[q]);this.eles[q].className+=" dbx-box-open";this.eles[q].className+=" dbxid"+this.order.length;this.order.push(this.order.length.toString()+"+");this.eles[q][dbx.etype](dbx.eprefix+"mousedown",function(i){if(!i){i=window.event}h.mousedown(i,dbx.getTarget(i,"dbx-box"))},false)}if(/dbx\-handle/i.test(this.eles[q].className)){this.eles[q].style.position="relative";this.eles[q].style.display="block";this.eles[q].className+=" dbx-handle-cursor";this.eles[q].setAttribute("title",this.eles[q].getAttribute("title")==null||this.eles[q].title==""?this.vocab.move:this.vocab.syntax.replace("%mytitle%",this.eles[q].title).replace("%dbxtitle%",this.vocab.move));if(this.toggles){this.buttons.push(this.addToggleBehavior(this.eles[q]))}else{this.eles[q][dbx.etype](dbx.eprefix+"key"+(typeof document.uniqueID!="undefined"||navigator.vendor=="Apple Computer, Inc."?"down":"press"),function(i){if(!i){i=window.event}return h.keypress(i,dbx.getTarget(i,"dbx-handle"))},false);this.eles[q][dbx.etype](dbx.eprefix+"focus",function(i){if(!i){i=window.event}h.createTooltip(null,dbx.getTarget(i,"dbx-handle"))},false);this.eles[q][dbx.etype](dbx.eprefix+"blur",function(){h.removeTooltip()},false)}}}dbx.addDataMember(this.gid,this.order.join(","));var v=this.container.appendChild(dbx.createElement("span"));v.className="dbx-box dbx-dummy";v.style.display="block";v.style.width="0";v.style.height="0";v.style.overflow="hidden";if(this.vertical){v.className+=" dbx-offdummy"}this.boxes.push(v);if(dbx.cookiestate!=null&&typeof dbx.cookiestate[this.gid]!="undefined"){var d=dbx.cookiestate[this.gid].length;if(d==this.boxes.length-1){for(q=0;q<d;q++){var c=parseInt(dbx.cookiestate[this.gid][q],10);this.container.insertBefore(this.boxes[c],v);if(this.toggles&&/\-$/.test(dbx.cookiestate[this.gid][q])){this.toggleBoxState(this.buttons[c],false)}}this.getBoxOrder()}}else{if(!this.defopen&&this.toggles){var r=this.buttons.length;for(q=0;q<r;q++){this.toggleBoxState(this.buttons[q],true)}}}document[dbx.etype](dbx.eprefix+"mouseout",function(i){if(typeof i.target=="undefined"){i=window.event;i.relatedTarget=i.toElement}if(i.relatedTarget==null){h.mouseup(i)}},false);document[dbx.etype](dbx.eprefix+"mousemove",function(i){h.mousemove(i);return !h.dragok},false);document[dbx.etype](dbx.eprefix+"mouseup",function(i){h.mouseup(i)},false);this.keydown=false;document[dbx.etype](dbx.eprefix+"keydown",function(){h.keydown=true},false);document[dbx.etype](dbx.eprefix+"keyup",function(){h.keydown=false},false)}dbxGroup.prototype.addToggleBehavior=function(){var a=this;var b=arguments[0].appendChild(dbx.createElement("a"));b.appendChild(document.createTextNode("\u00a0"));b.style.cursor="pointer";b.href="javascript:void(null)";b.className="dbx-toggle dbx-toggle-open";b.setAttribute("title",this.vocab.toggle.replace("%toggle%",this.vocab.close));b.hasfocus=typeof window.opera!="undefined"||navigator.vendor=="Apple Computer, Inc."?null:false;this.tooltip=null;b.onclick=function(){if(this.hasfocus===true||this.hasfocus===null){a.removeTooltip();a.toggleBoxState(this,true)}};b["onkey"+(typeof document.uniqueID!="undefined"||navigator.vendor=="Apple Computer, Inc."?"down":"press")]=function(c){if(!c){c=window.event}return a.keypress(c,this)};b.onfocus=function(){var c=a.buttons.length;for(var d=0;d<c;d++){a.buttons[d].className=a.buttons[d].className.replace(/[ ](dbx\-toggle\-hilite\-)(open|closed)/,"")}var e=(/dbx\-toggle\-open/.test(this.className));this.className+=" dbx-toggle-hilite-"+(e?"open":"closed");a.createTooltip(e,this);this.isactive=true;if(this.hasfocus!==null){this.hasfocus=true}};b.onblur=function(){this.className=this.className.replace(/[ ](dbx\-toggle\-hilite\-)(open|closed)/,"");a.removeTooltip();if(this.hasfocus!==null){this.hasfocus=false}};return b};dbxGroup.prototype.toggleBoxState=function(a,c){var d=(/dbx\-toggle\-open/.test(a.className));var b=dbx.getTarget(null,"dbx-box",a);dbx.box=b;dbx.toggle=a;if(typeof dbx.container=="undefined"){dbx.group=dbx.getTarget(null,"dbx-group",b)}else{dbx.group=dbx.container}if((!d&&(typeof dbx.onboxopen=="undefined"||dbx.onboxopen()))||(d&&(typeof dbx.onboxclose=="undefined"||dbx.onboxclose()))){a.className="dbx-toggle dbx-toggle-"+(d?"closed":"open");a.title=this.vocab.toggle.replace("%toggle%",d?this.vocab.open:this.vocab.close);if(typeof a.isactive!="undefined"){a.className+=" dbx-toggle-hilite-"+(d?"closed":"open")}b.className=b.className.replace(/[ ](dbx-box-)(open|closed)/," $1"+(d?"closed":"open"));if(c){this.getBoxOrder()}}};dbxGroup.prototype.shiftBoxPosition=function(l,f,g){var n=dbx.getTarget(null,"dbx-box",f);dbx.group=this.container;dbx.box=n;dbx.event=l;if(typeof dbx.onboxdrag=="undefined"||dbx.onboxdrag()){var h=[];var k=this.boxes.length;for(var d=0;d<k;d++){h[d]=[d,this.boxes[d][this.vertical?"offsetTop":"offsetLeft"]];if(n==this.boxes[d]){this.idref=d}}h.sort(this.compare);for(d=0;d<k;d++){if(h[d][0]==this.idref){if((g&&d<k-2)||(!g&&d>0)){var o=this.boxes[h[d+(g?1:-1)][0]];if(this.resolution>0){var m={x:n.offsetLeft,y:n.offsetTop};var a={x:o.offsetLeft,y:o.offsetTop}}var c={insert:(g?o:n),before:(g?n:o)};this.container.insertBefore(c.insert,c.before);if(this.resolution>0){var b={sibling:new dbxAnimator(this,o,a,this.resolution,true,f),parent:new dbxAnimator(this,n,m,this.resolution,true,f)}}else{f.focus()}break}}}this.getBoxOrder()}};dbxGroup.prototype.compare=function(d,c){return d[1]-c[1]};dbxGroup.prototype.createTooltip=function(d,a){if(this.keydown){this.tooltip=this.container.appendChild(dbx.createElement("span"));this.tooltip.style.visibility="hidden";this.tooltip.className="dbx-tooltip";if(d!=null){this.tooltip.appendChild(document.createTextNode(this.vocab.kmove+this.vocab.ktoggle.replace("%toggle%",d?this.vocab.close:this.vocab.open)))}else{this.tooltip.appendChild(document.createTextNode(this.vocab.kmove))}var b=dbx.getTarget(null,"dbx-box",a);this.tooltip.style.left=b.offsetLeft+"px";this.tooltip.style.top=b.offsetTop+"px";var c=this.tooltip;window.setTimeout(function(){if(c!=null){c.style.visibility="visible"}},500)}};dbxGroup.prototype.removeTooltip=function(){if(this.tooltip!=null){this.tooltip.parentNode.removeChild(this.tooltip);this.tooltip=null}};dbxGroup.prototype.mousedown=function(c,b){var a=typeof c.target!="undefined"?c.target:c.srcElement;if(a.nodeName=="#text"){a=a.parentNode}if(!/dbx\-(toggle|box|group)/i.test(a.className)){while(!/dbx\-(handle|box|group)/i.test(a.className)){a=a.parentNode}}if(/dbx\-handle/i.test(a.className)){this.removeTooltip();this.released=false;this.initial={x:c.clientX,y:c.clientY};this.current={x:0,y:0};this.createCloneBox(b);if(typeof c.preventDefault!="undefined"){c.preventDefault()}if(typeof document.onselectstart!="undefined"){document.onselectstart=function(){return false}}}};dbxGroup.prototype.mousemove=function(b){if(this.dragok&&this.box!=null){this.positive=this.vertical?(b.clientY>this.current.y?true:false):(b.clientX>this.current.x?true:false);this.current={x:b.clientX,y:b.clientY};var a={x:this.current.x-this.initial.x,y:this.current.y-this.initial.y};if(((a.x>=0&&a.x<=this.threshold)||(a.x<=0&&a.x>=0-this.threshold))&&((a.y>=0&&a.y<=this.threshold)||(a.y<=0&&a.y>=0-this.threshold))){this.current.x-=a.x;this.current.y-=a.y}if(this.released||a.x>this.threshold||a.x<(0-this.threshold)||a.y>this.threshold||a.y<(0-this.threshold)){dbx.group=this.container;dbx.box=this.box;dbx.event=b;if(typeof dbx.onboxdrag=="undefined"||dbx.onboxdrag()){this.released=true;if(!this.restrict||!this.vertical){this.boxclone.style.left=(this.current.x-this.difference.x)+"px"}if(!this.restrict||this.vertical){this.boxclone.style.top=(this.current.y-this.difference.y)+"px"}this.moveOriginalToPosition(this.current.x,this.current.y);if(typeof b.preventDefault!="undefined"){b.preventDefault()}}}}return true};dbxGroup.prototype.mouseup=function(a){if(this.box!=null){this.moveOriginalToPosition(a.clientX,a.clientY);this.removeCloneBox();this.getBoxOrder();if(typeof document.onselectstart!="undefined"){document.onselectstart=function(){return true}}}this.dragok=false};dbxGroup.prototype.keypress=function(b,a){if(/^(3[7-9])|(40)$/.test(b.keyCode)){this.removeTooltip();if((this.vertical&&/^(38|40)$/.test(b.keyCode))||(!this.vertical&&/^(37|39)$/.test(b.keyCode))){this.shiftBoxPosition(b,a,/^[3][78]$/.test(b.keyCode)?false:true);if(typeof b.preventDefault!="undefined"){b.preventDefault()}else{return false}typeof b.stopPropagation!="undefined"?b.stopPropagation():b.cancelBubble=true;this.keydown=false}}return true};dbxGroup.prototype.getBoxOrder=function(){this.order=[];var a=this.eles.length;for(var b=0;b<a;b++){if(/dbx\-box/i.test(this.eles[b].className)&&!/dbx\-(clone|dummy)/i.test(this.eles[b].className)){this.order.push(this.eles[b].className.split("dbxid")[1]+(/dbx\-box\-open/i.test(this.eles[b].className)?"+":"-"))}}dbx.savedata[this.gid]=this.order.join(",");dbx.setCookieState()};dbxGroup.prototype.createClone=function(){var a=this.container.appendChild(arguments[0].cloneNode(true));a.className+=" dbx-clone";a.style.position="absolute";a.style.visibility="hidden";a.style.zIndex=arguments[1];a.style.left=arguments[2].x+"px";a.style.top=arguments[2].y+"px";a.style.width=arguments[0].offsetWidth+"px";a.style.height=arguments[0].offsetHeight+"px";return a};dbxGroup.prototype.createCloneBox=function(a){this.box=a;this.position={x:this.box.offsetLeft,y:this.box.offsetTop};this.difference={x:(this.initial.x-this.position.x),y:(this.initial.y-this.position.y)};this.boxclone=this.createClone(this.box,30000,this.position);this.boxclone.style.cursor="move";this.dragok=true};dbxGroup.prototype.removeCloneBox=function(){this.container.removeChild(this.boxclone);this.box.style.visibility="visible";this.box=null};dbxGroup.prototype.moveOriginalToPosition=function(b,a){var k={xy:this.vertical?a-this.difference.y:b-this.difference.x,wh:this.vertical?this.boxclone.offsetHeight:this.boxclone.offsetWidth};this.box.style.visibility="hidden";this.boxclone.style.visibility="visible";var g=this.boxes.length;for(var f=0;f<g;f++){var c={xy:this.vertical?this.boxes[f].offsetTop:this.boxes[f].offsetLeft,wh:this.vertical?this.boxes[f].offsetHeight:this.boxes[f].offsetWidth};if((this.positive&&k.xy+k.wh>c.xy&&k.xy<c.xy)||(!this.positive&&k.xy<c.xy&&k.xy+k.wh>c.xy)){if(this.boxes[f]==this.box){return}var m=this.box.nextSibling;while(m.className==null||!/dbx\-box/.test(m.className)){m=m.nextSibling}if(this.boxes[f]==m){return}if(this.resolution>0){if(this.box[this.vertical?"offsetTop":"offsetLeft"]<c.xy){var e=this.boxes[f].previousSibling;while(e.className==null||!/dbx\-box/.test(e.className)){e=e.previousSibling}}else{e=this.boxes[f]}var h={x:e.offsetLeft,y:e.offsetTop}}var l={x:this.box.offsetLeft,y:this.box.offsetTop};this.container.insertBefore(this.box,this.boxes[f]);this.initial.x+=(this.box.offsetLeft-l.x);this.initial.y+=(this.box.offsetTop-l.y);if(this.resolution>0&&e!=this.box){var d=new dbxAnimator(this,e,h,this.resolution,false,null)}else{}break}}};function dbxAnimator(b,d,g,e,i,c){this.caller=b;this.box=d;this.timer=null;var h=g[this.caller.vertical?"y":"x"];var a=this.box[this.caller.vertical?"offsetTop":"offsetLeft"];if(h!=a){if(dbx.running>this.caller.boxes.length-1){return}var f=this.caller.createClone(this.box,29999,arguments[2]);f.style.visibility="visible";this.box.style.visibility="hidden";this.animateClone(f,h,a>h?a-h:0-(h-a),this.caller.vertical?"top":"left",e,i,c)}}dbxAnimator.prototype.animateClone=function(f,d,g,a,e,h,b){var i=this;var c=0;dbx.running++;this.timer=window.setInterval(function(){c++;d+=g/e;f.style[a]=d+"px";if(c==e){window.clearTimeout(i.timer);i.timer=null;dbx.running--;i.caller.container.removeChild(f);i.box.style.visibility="visible";if(h){if(b!=null&&b.parentNode.style.visibility!="hidden"){b.focus()}else{if(i.caller.toggles){var k=i.caller.buttons[parseInt(i.box.className.split("dbxid")[1],10)];if(k!=null&&typeof k.isactive!="undefined"){k.focus()}}}}}},20)};if(typeof window.attachEvent!="undefined"){window.attachEvent("onunload",function(){var e=["mousedown","mousemove","mouseup","mouseout","click","keydown","keyup","focus","blur","selectstart","statechange","boxdrag","boxopen","boxclose"];var d=e.length;var b=document.all.length;for(var c=0;c<b;c++){for(var a=0;a<d;a++){document.all[c]["on"+e[a]]=null}}})}; |