Exit Full View

ntcslash / src / main / webapp / ww_resources / webwidgets-min.js

var shortcutListener={listen:!0,root:null,onEscape:null,shortcut:null,combination:"",lastKeypress:0,clearTimeout:2E3,keys:{KEY_BACKSPACE:8,KEY_TAB:9,KEY_ENTER:13,KEY_SHIFT:16,KEY_CTRL:17,KEY_ALT:18,KEY_ESC:27,KEY_SPACE:32,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34},init:function(){if(!this.root)return!1;null==document.getElementById("shortcut_status")&&this.createStatusArea();this.setObserver()},add:function(a,b){this.root||(this.root=
{});for(var d=this.root,c=0;c<a.length;c++){var e=a[c].toLowerCase();if(!d[e])d[e]=c==a.length-1?b:{};else if(c==a.length-1){alert("shortcut '"+a+"' clashes with one or more longer shortcuts.");break}else if("function"==typeof d[e]){alert("shortcut '"+a+"' clashes with an existing shortcut length "+(c+1));break}d=d[e]}},isInputTarget:function(a){if((a=a.target||a.srcElement)&&a.nodeName){var b=a.nodeName.toLowerCase();if("textarea"==b||"select"==b||"input"==b&&a.type&&("text"==a.type.toLowerCase()||
"password"==a.type.toLowerCase()))return!0}return!1},stopEvent:function(a){a.preventDefault?(a.preventDefault(),a.stopPropagation()):(a.returnValue=!1,a.cancelBubble=!0)},createStatusArea:function(){var a=document.createElement("div");a.setAttribute("id","shortcut_status");a.style.display="none";document.body.appendChild(a)},showStatus:function(){document.getElementById("shortcut_status").style.display=""},hideStatus:function(){document.getElementById("shortcut_status").style.display="none"},showCombination:function(){document.getElementById("shortcut_status").innerHTML=
this.combination;this.showStatus()},setObserver:function(){var a="keypress";if(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||document.detachEvent)a="keydown";document.addEventListener?document.addEventListener(a,function(a){shortcutListener.keyCollector(a)},!1):document.attachEvent&&document.attachEvent("on"+a,function(a){shortcutListener.keyCollector(a)})},keyCollector:function(a){if(!this.root||!shortcutListener.listen||a.altKey||a.ctrlKey||a.metaKey)return!1;if(27==a.keyCode&&(shortcutListener.clearCombination(),
this.onEscape))this.onEscape();for(var b in this.keys)if(a.keyCode==this.keys[b])return!1;if(navigator.userAgent.match(/Gecko/)&&112<=a.keyCode&&123>=a.keyCode||this.isInputTarget(a))return!1;b=String.fromCharCode(a.which?a.which:a.keyCode).toLowerCase();a.shiftKey&&(b=b.toUpperCase());shortcutListener.process(b)&&shortcutListener.stopEvent(a)},process:function(a){if(!this.root||!shortcutListener.listen)return!1;shortcutListener.shortcut||(shortcutListener.shortcut=this.root);if(!shortcutListener.shortcut[a])return!1;
"function"==typeof shortcutListener.shortcut[a]?(shortcutListener.shortcut[a](),shortcutListener.clearCombination()):(shortcutListener.shortcut=shortcutListener.shortcut[a],shortcutListener.combination+=a,0<shortcutListener.combination.length&&(shortcutListener.showCombination(),shortcutListener.lastKeypress=(new Date).getTime(),setTimeout("shortcutListener.clearCombinationOnTimeout()",shortcutListener.clearTimeout)));return!0},clearCombination:function(){shortcutListener.shortcut=null;shortcutListener.combination=
"";this.hideStatus()},clearCombinationOnTimeout:function(){(new Date).getTime()-shortcutListener.lastKeypress>=shortcutListener.clearTimeout-100&&shortcutListener.clearCombination()}};function ww_doClose(a){if(a=ww_getMinimizer(a))a.className="ww_closed";return!1}function ww_doToggleMinimize(a){if(a=ww_getMinimizer(a))a.className="ww_minimized"==a.className?"ww_maximized":"ww_minimized";return!1}function ww_doMinimize(a){if(a=ww_getMinimizer(a))a.className="ww_minimized";return!1}
function ww_doMaximize(a){if(a=ww_getMinimizer(a))a.className="ww_maximized";return!1}function ww_getMinimizer(a){if(a=a.srcElement?a.srcElement:a.target){do a=a.parentNode;while(a&&"ww_minimized"!=a.className&&"ww_maximized"!=a.className)}return a}function ww_findObj(a,b){if(a instanceof Element)return a;var d,c;null==b&&(b=document);!b[a]&&b.getElementById?c=b.getElementById(a):!(c=b[a])&&b.all&&(c=b.all[a]);for(d=0;!c&&d<b.forms.length;d++)c=b.forms[d][a];return c}
function ww_innerWidth(){return self.innerWidth?self.innerWidth:document.documentElement&&document.documentElement.clientWidth?document.documentElement.clientWidth:document.body?document.body.clientWidth:"ww_innerWidth Failed"}function ww_innerHeight(){return self.innerHeight?self.innerHeight:document.documentElement&&document.documentElement.clientHeight?document.documentElement.clientHeight:document.body?document.body.clientHeight:"ww_innerHeight Failed"}
function ww_scrollX(){return self.pageXOffset?self.pageXOffset:document.documentElement&&document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body?document.body.scrollLeft:"ww_scrollX failed"}function ww_scrollY(){return self.pageYOffset?self.pageYOffset:document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body?document.body.scrollTop:"ww_scrollY failed"}
function ww_getEventElement(a){return a.srcElement?a.srcElement:a.target}function ww_changeImage(a,b){a.oldSrc||(a.ww_oldSrc=a.src);a.src=b}function ww_restoreImage(a){a.ww_oldSrc&&(a.src=a.ww_oldSrc)}ww_imageCache=[];function ww_cacheImage(a){var b=new Image;b.src=a;ww_imageCache[ww_imageCache.length]=b}
function ww_dump(a,b,d){null==b&&(b=1);d||(d="");if(1>b)return"...";var c="{\n",e;for(e in a)var f=a[e],c=c+(d+"    ["+e+"] : "),c="object"==typeof f?c+(ww_dump(f,b-1,d+"    ")+"\n"):c+(f+"\n");return c+(d+"}")}function ww_followLink(a){a=ww_findObj(a);null==a||null!=a.onclick&&!a.onclick()||(document.location=a)}function ww_pressButton(a){a=ww_findObj(a);null!=a&&a.click()}
function ww_findFirst(a,b){a=ww_findObj(a);if(null==a)return null;for(var d=0;d<a.childNodes.length;d++){var c=a.childNodes[d];if(c.nodeName==b)return c;c=ww_findFirst(c,b);if(null!=c)return c}return null}function ww_focusFirstLink(a){a=ww_findFirst(a,"A");return null!=a?(a.focus(),!0):!1};