rem
stringlengths 0
126k
| add
stringlengths 0
441k
| context
stringlengths 15
136k
|
---|---|---|
if(line != null && line.length > 0) { | if(line !== null && line.length > 0) { | success: function(response, options) { if (isGmlDataThere(response.responseText)) { //Parse the response var XmlDoc = GXml.parse(response.responseText); if (g_IsIE) { XmlDoc.setProperty("SelectionLanguage", "XPath"); } var rootNode = XmlDoc.documentElement; if (!rootNode) { return; } var schemaLoc = rootNode.getAttribute("xsi:schemaLocation"); var reqTypeName = schemaLoc.substring(schemaLoc.indexOf("typeName")+9, schemaLoc.indexOf(' ', schemaLoc.indexOf("typeName")+9)); //Browser may have replaced certain characters reqTypeName = reqTypeName.replace("%3A", ":"); //Extract the line Id from the XML var line = rootNode.getElementsByTagName("gt:LINE"); if(line == null || line.length <= 0) { //Chrome, Opera may not want the namespace prefix line = rootNode.getElementsByTagName("LINE"); } // Change to enable the SURV_LINE which is the key in the shapefile if(line == null || line.length <= 0) { line = rootNode.getElementsByTagName("gt:SURV_LINE"); if(line == null || line.length <= 0) { line = rootNode.getElementsByTagName("SURV_LINE"); } } //Get the line var lineId = ""; if(line != null && line.length > 0) { if(document.all) { //IE lineId = line[0].text; } else { lineId = line[0].textContent; } //Remove the prefixes - we dont store them in the DB if(lineId.indexOf("cdp") == 0) { lineId = lineId.substring(3, lineId.length); } var infoWindow = new GeotransectsInfoWindow(latlng, map, lineId, options.cswRecord, options.wmsOnlineResource, url); infoWindow.show(); } else { alert("Remote server returned an unsupported response."); } } }, |
if(lineId.indexOf("cdp") == 0) { | if(lineId.indexOf("cdp") === 0) { | success: function(response, options) { if (isGmlDataThere(response.responseText)) { //Parse the response var XmlDoc = GXml.parse(response.responseText); if (g_IsIE) { XmlDoc.setProperty("SelectionLanguage", "XPath"); } var rootNode = XmlDoc.documentElement; if (!rootNode) { return; } var schemaLoc = rootNode.getAttribute("xsi:schemaLocation"); var reqTypeName = schemaLoc.substring(schemaLoc.indexOf("typeName")+9, schemaLoc.indexOf(' ', schemaLoc.indexOf("typeName")+9)); //Browser may have replaced certain characters reqTypeName = reqTypeName.replace("%3A", ":"); //Extract the line Id from the XML var line = rootNode.getElementsByTagName("gt:LINE"); if(line == null || line.length <= 0) { //Chrome, Opera may not want the namespace prefix line = rootNode.getElementsByTagName("LINE"); } // Change to enable the SURV_LINE which is the key in the shapefile if(line == null || line.length <= 0) { line = rootNode.getElementsByTagName("gt:SURV_LINE"); if(line == null || line.length <= 0) { line = rootNode.getElementsByTagName("SURV_LINE"); } } //Get the line var lineId = ""; if(line != null && line.length > 0) { if(document.all) { //IE lineId = line[0].text; } else { lineId = line[0].textContent; } //Remove the prefixes - we dont store them in the DB if(lineId.indexOf("cdp") == 0) { lineId = lineId.substring(3, lineId.length); } var infoWindow = new GeotransectsInfoWindow(latlng, map, lineId, options.cswRecord, options.wmsOnlineResource, url); infoWindow.show(); } else { alert("Remote server returned an unsupported response."); } } }, |
jsBackend.layout.showMessage('error', 'page can\'t be moved'); | jsBackend.layout.showMessage('error', '{$errCantBeMoved}'); | success: function(json, textStatus) { if(json.code != 200) { if(jsBackend.debug) alert(textStatus); // show message jsBackend.layout.showMessage('error', 'page can\'t be moved'); // @todo label // rollback $.tree.rollback(rollback); } else { // show message jsBackend.layout.showMessage('success', 'page moved'); // @todo label } }, |
jsBackend.layout.showMessage('success', 'page moved'); | jsBackend.layout.showMessage('success', '{$msgPageIsMoved}'); | success: function(json, textStatus) { if(json.code != 200) { if(jsBackend.debug) alert(textStatus); // show message jsBackend.layout.showMessage('error', 'page can\'t be moved'); // @todo label // rollback $.tree.rollback(rollback); } else { // show message jsBackend.layout.showMessage('success', 'page moved'); // @todo label } }, |
jsBackend.layout.showMessage('error', 'page can\'t be moved'); | success: function(json, textStatus) { if(json.code != 200) { if(jsBackend.debug) alert(textStatus); // show error // @todo show errormessage // rollback $.tree.rollback(rollback); } else { // @todo show succesmessage } }, |
|
jsBackend.layout.showMessage('success', 'page moved'); | success: function(json, textStatus) { if(json.code != 200) { if(jsBackend.debug) alert(textStatus); // show error // @todo show errormessage // rollback $.tree.rollback(rollback); } else { // @todo show succesmessage } }, |
|
jsBackend.messages.add('success', '{$msgPageIsMoved}'); | jsBackend.messages.add('success', '{$msgPageIsMoved|addslashes}'.replace('%1$s', 'tet')); | success: function(json, textStatus) { if(json.code != 200) { if(jsBackend.debug) alert(textStatus); // show message jsBackend.messages.add('error', '{$errCantBeMoved}'); // rollback $.tree.rollback(rollback); } else { // show message jsBackend.messages.add('success', '{$msgPageIsMoved}'); } } |
jsBackend.messages.add('success', '{$msgPageIsMoved|addslashes}'.replace('%1$s', 'tet')); | jsBackend.messages.add('success', '{$msgPageIsMoved|addslashes}'.replace('%1$s', json.data.title)); | success: function(json, textStatus) { if(json.code != 200) { if(jsBackend.debug) alert(textStatus); // show message jsBackend.messages.add('error', '{$errCantBeMoved}'); // rollback $.tree.rollback(rollback); } else { // show message jsBackend.messages.add('success', '{$msgPageIsMoved|addslashes}'.replace('%1$s', 'tet')); // @todo tijs - 'tet' moet uiteraard de naam van de pagina worden. } } |
APP.emit(el, "select", line.id, edit.id); | function suggestionClicked(line) { var suggestion = line.firstChild, edit = WT.getElement(editId), sText = suggestion.innerHTML, sValue = suggestion.getAttribute('sug'); edit.focus(); replacerJS(edit, sText, sValue); hidePopup(); editId = null; }; |
|
"1"}else if(a.currentStyle){e=b.replace(oa,qa);g=a.currentStyle[b]||a.currentStyle[e];if(!Qa.test(g)&&Ra.test(g)){b=h.left;var k=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=e==="fontSize"?"1em":g||0;g=h.pixelLeft+"px";h.left=b;a.runtimeStyle.left=k}}return g},swap:function(a,b,e){var g={};for(var h in b){g[h]=a.style[h];a.style[h]=b[h]}e.call(a);for(h in b)a.style[h]=g[h]}});if(d.expr&&d.expr.filters){d.expr.filters.hidden=function(a){var b=a.offsetWidth,e=a.offsetHeight,g= | "-$1").toLowerCase();h=a.ownerDocument.defaultView;if(!h)return null;if(a=h.getComputedStyle(a,null))f=a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){e=b.replace(oa,qa);f=a.currentStyle[b]||a.currentStyle[e];if(!Qa.test(f)&&Ra.test(f)){b=h.left;var k=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=e==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=b;a.runtimeStyle.left=k}}return f},swap:function(a,b,e){var f={};for(var h in b){f[h]=a.style[h];a.style[h]= b[h]}e.call(a);for(h in b)a.style[h]=f[h]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetWidth,e=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&e===0&&!f?true:b>0&&e>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}x.jQuery=x.$=c})(window); | "1"}else if(a.currentStyle){e=b.replace(oa,qa);g=a.currentStyle[b]||a.currentStyle[e];if(!Qa.test(g)&&Ra.test(g)){b=h.left;var k=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=e==="fontSize"?"1em":g||0;g=h.pixelLeft+"px";h.left=b;a.runtimeStyle.left=k}}return g},swap:function(a,b,e){var g={};for(var h in b){g[h]=a.style[h];a.style[h]=b[h]}e.call(a);for(h in b)a.style[h]=g[h]}});if(d.expr&&d.expr.filters){d.expr.filters.hidden=function(a){var b=a.offsetWidth,e=a.offsetHeight,g= |
log.debug("Preparing a synchronous request to the JSON-RPC server..." + method + ":" + params); | if (log.logSensitiveData) log.debug("Preparing a synchronous request to the JSON-RPC server:" + method + ":" + params); else log.debug("Preparing a synchronous request to the JSON-RPC server."); | this.syncRequest = function(session, method, params) { log.debug("Preparing a synchronous request to the JSON-RPC server..." + method + ":" + params); //this.syncRequestComplete = false; //ASSUMPTION: this operation is atomic (if not, very unfortunate // multi-thread timing could lead to two requests with the same ID) var myRequestId = ++this.requestId; this.syncRequestResults[myRequestId] = null; //TODO: can the JSON parser ever // return null? if so, change this or else we might deadlock // TODO: set a timeout on this sync event (set above to non-null value - maybe a JS exception object?) this.request(session, method, params, function rpc_callback(resultWrapper) { var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var window = wm.getMostRecentWindow("navigator:browser"); //window.keeFoxInst.KeePassRPC.syncRequestComplete = true; window.keeFoxInst.KeePassRPC.syncRequestResults[resultWrapper.id] = resultWrapper.result; }, myRequestId); log.debug("Waiting for the synchronous request to the JSON-RPC server to end..." + method + ":" + params); //yield; var thread = Components.classes["@mozilla.org/thread-manager;1"] .getService(Components.interfaces.nsIThreadManager) .currentThread; while (this.syncRequestResults[myRequestId] == null) thread.processNextEvent(true); log.debug("Synchronous request to the JSON-RPC server has returned..." + method + ":" + params); var result = this.syncRequestResults[myRequestId]; // we won't ever use this array slot again but I // suspect clearing it will help with JS memory recovery this.syncRequestResults[myRequestId] = null; return result; } |
log.debug("Waiting for the synchronous request to the JSON-RPC server to end..." + method + ":" + params); | if (log.logSensitiveData) log.debug("Waiting for the synchronous request to the JSON-RPC server to end:" + method + ":" + params); else log.debug("Waiting for the synchronous request to the JSON-RPC server to end."); | this.syncRequest = function(session, method, params) { log.debug("Preparing a synchronous request to the JSON-RPC server..." + method + ":" + params); //this.syncRequestComplete = false; //ASSUMPTION: this operation is atomic (if not, very unfortunate // multi-thread timing could lead to two requests with the same ID) var myRequestId = ++this.requestId; this.syncRequestResults[myRequestId] = null; //TODO: can the JSON parser ever // return null? if so, change this or else we might deadlock // TODO: set a timeout on this sync event (set above to non-null value - maybe a JS exception object?) this.request(session, method, params, function rpc_callback(resultWrapper) { var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var window = wm.getMostRecentWindow("navigator:browser"); //window.keeFoxInst.KeePassRPC.syncRequestComplete = true; window.keeFoxInst.KeePassRPC.syncRequestResults[resultWrapper.id] = resultWrapper.result; }, myRequestId); log.debug("Waiting for the synchronous request to the JSON-RPC server to end..." + method + ":" + params); //yield; var thread = Components.classes["@mozilla.org/thread-manager;1"] .getService(Components.interfaces.nsIThreadManager) .currentThread; while (this.syncRequestResults[myRequestId] == null) thread.processNextEvent(true); log.debug("Synchronous request to the JSON-RPC server has returned..." + method + ":" + params); var result = this.syncRequestResults[myRequestId]; // we won't ever use this array slot again but I // suspect clearing it will help with JS memory recovery this.syncRequestResults[myRequestId] = null; return result; } |
log.debug("Synchronous request to the JSON-RPC server has returned..." + method + ":" + params); | if (log.logSensitiveData) log.debug("Synchronous request to the JSON-RPC server has returned:" + method + ":" + params); else log.debug("Synchronous request to the JSON-RPC server has returned."); | this.syncRequest = function(session, method, params) { log.debug("Preparing a synchronous request to the JSON-RPC server..." + method + ":" + params); //this.syncRequestComplete = false; //ASSUMPTION: this operation is atomic (if not, very unfortunate // multi-thread timing could lead to two requests with the same ID) var myRequestId = ++this.requestId; this.syncRequestResults[myRequestId] = null; //TODO: can the JSON parser ever // return null? if so, change this or else we might deadlock // TODO: set a timeout on this sync event (set above to non-null value - maybe a JS exception object?) this.request(session, method, params, function rpc_callback(resultWrapper) { var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var window = wm.getMostRecentWindow("navigator:browser"); //window.keeFoxInst.KeePassRPC.syncRequestComplete = true; window.keeFoxInst.KeePassRPC.syncRequestResults[resultWrapper.id] = resultWrapper.result; }, myRequestId); log.debug("Waiting for the synchronous request to the JSON-RPC server to end..." + method + ":" + params); //yield; var thread = Components.classes["@mozilla.org/thread-manager;1"] .getService(Components.interfaces.nsIThreadManager) .currentThread; while (this.syncRequestResults[myRequestId] == null) thread.processNextEvent(true); log.debug("Synchronous request to the JSON-RPC server has returned..." + method + ":" + params); var result = this.syncRequestResults[myRequestId]; // we won't ever use this array slot again but I // suspect clearing it will help with JS memory recovery this.syncRequestResults[myRequestId] = null; return result; } |
window.keeFoxInst.KeePassRPC.syncRequestResults[resultWrapper.id] = resultWrapper.result; | if ("result" in resultWrapper && resultWrapper.result !== false) { if (resultWrapper.result !== null) window.keeFoxInst.KeePassRPC.syncRequestResults[resultWrapper.id] = resultWrapper.result; else window.keeFoxInst.KeePassRPC.syncRequestResults[resultWrapper.id] = new Error("Null return result received"); } else window.keeFoxInst.KeePassRPC.syncRequestResults[resultWrapper.id] = new Error(resultWrapper.error); | this.syncRequest = function(session, method, params) { if (log.logSensitiveData) log.debug("Preparing a synchronous request to the JSON-RPC server:" + method + ":" + params); else log.debug("Preparing a synchronous request to the JSON-RPC server."); //ASSUMPTION: this operation is atomic (if not, very unfortunate // multi-thread timing could lead to two requests with the same ID) var myRequestId = ++this.requestId; this.syncRequestResults[myRequestId] = null; //TODO: can the JSON parser ever // return null? if so, change this or else we might deadlock // TODO: set a timeout on this sync event (set above to a JS Error object) this.request(session, method, params, function rpc_callback(resultWrapper) { var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); var window = wm.getMostRecentWindow("navigator:browser"); window.keeFoxInst.KeePassRPC.syncRequestResults[resultWrapper.id] = resultWrapper.result; }, myRequestId); if (log.logSensitiveData) log.debug("Waiting for the synchronous request to the JSON-RPC server to end:" + method + ":" + params); else log.debug("Waiting for the synchronous request to the JSON-RPC server to end."); var thread = Components.classes["@mozilla.org/thread-manager;1"] .getService(Components.interfaces.nsIThreadManager) .currentThread; while (this.syncRequestResults[myRequestId] == null) thread.processNextEvent(true); if (log.logSensitiveData) log.debug("Synchronous request to the JSON-RPC server has returned:" + method + ":" + params); else log.debug("Synchronous request to the JSON-RPC server has returned."); var result = this.syncRequestResults[myRequestId]; // we won't ever use this array slot again but I // suspect clearing it will help with JS memory recovery this.syncRequestResults[myRequestId] = null; return result; } |
WT_DECLARE_WT_MEMBER(2,"WSuggestionPopupStdMatcher",function(s,f,x,C,q,y){function t(c){var g=c.value;c=c.selectionStart?c.selectionStart:g.length;for(var d=x?g.lastIndexOf(x,c-1)+1:0;d<c&&C.indexOf(g.charAt(d))!=-1;)++d;return{start:d,end:c}}this.match=function(c){var g=t(c),d=c.value.substring(g.start,g.end),m="^";if(q.length!=0)m="(^|(?:["+q+"]))";m+="("+d.replace(new RegExp("([\\^\\\\\\][\\-.$*+?()|{}])","g"),"\\$1")+")";m=new RegExp(m,"gi");return function(o){if(!o)return d;var u=false;if(d.length){var z= | WT_DECLARE_WT_MEMBER(1,"WSuggestionPopup",function(s,f,w,C,q,x,y){function c(a){return $(a).hasClass("Wt-suggest-onedit")||$(a).hasClass("Wt-suggest-dropdown")}function g(){return f.style.display!="none"}function d(){f.style.display="none"}function m(a){e.positionAtWidget(f.id,a.id,e.Vertical,y)}function o(a){a=e.target(a||window.event);if(a.className!="content"){for(;a&&!e.hasTag(a,"DIV");)a=a.parentNode;a&&t(a)}}function t(a){var b=a.firstChild,k=e.getElement(i),l=b.innerHTML;b=b.getAttribute("sug"); k.focus();s.emit(f,"select",a.id,k.id);w(k,l,b);d();i=null}function z(a,b){for(a=b?a.nextSibling:a.previousSibling;a;a=b?a.nextSibling:a.previousSibling)if(e.hasTag(a,"DIV"))if(a.style.display!="none")return a;return null}function F(a){var b=a.parentNode;if(a.offsetTop+a.offsetHeight>b.scrollTop+b.clientHeight)b.scrollTop=a.offsetTop+a.offsetHeight-b.clientHeight;else if(a.offsetTop<b.scrollTop)b.scrollTop=a.offsetTop}$(".Wt-domRoot").add(f);jQuery.data(f,"obj",this);var A=this,e=s.WT,n=null,i=null, | WT_DECLARE_WT_MEMBER(2,"WSuggestionPopupStdMatcher",function(s,f,x,C,q,y){function t(c){var g=c.value;c=c.selectionStart?c.selectionStart:g.length;for(var d=x?g.lastIndexOf(x,c-1)+1:0;d<c&&C.indexOf(g.charAt(d))!=-1;)++d;return{start:d,end:c}}this.match=function(c){var g=t(c),d=c.value.substring(g.start,g.end),m="^";if(q.length!=0)m="(^|(?:["+q+"]))";m+="("+d.replace(new RegExp("([\\^\\\\\\][\\-.$*+?()|{}])","g"),"\\$1")+")";m=new RegExp(m,"gi");return function(o){if(!o)return d;var u=false;if(d.length){var z= |
WT_DECLARE_WT_MEMBER(1,"WSuggestionPopup",function(q,d,y,z,r){function m(a){return $(a).hasClass("Wt-suggest-onedit")||$(a).hasClass("Wt-suggest-dropdown")}function s(){return d.style.display!="none"}function k(){d.style.display="none"}function A(a){c.positionAtWidget(d.id,a.id,c.Vertical)}function B(a){a=a||window.event;a=a.target||a.srcElement;if(a.className!="content"){for(;a&&!c.hasTag(a,"DIV");)a=a.parentNode;a&&t(a)}}function t(a){var b=a.firstChild,h=c.getElement(f),e=b.innerHTML;b=b.getAttribute("sug"); h.focus();q.emit(d,"select",a.id,h.id);y(h,e,b);k();f=null}function C(a,b){for(a=b?a.nextSibling:a.previousSibling;a;a=b?a.nextSibling:a.previousSibling)if(c.hasTag(a,"DIV"))if(a.style.display!="none")return a;return null}$(".Wt-domRoot").add(d);jQuery.data(d,"obj",this);var n=this,c=q.WT,l=null,f=null,u=false,v=null,w=null,o=null;this.showPopup=function(){d.style.display="";l=null};this.editMouseMove=function(a,b){if(m(a))a.style.cursor=c.widgetCoordinates(a,b).x>a.offsetWidth-16?"default":""};this.editClick= | WT_DECLARE_WT_MEMBER(1,"WSuggestionPopup",function(q,d,A,B,r){function m(a){return $(a).hasClass("Wt-suggest-onedit")||$(a).hasClass("Wt-suggest-dropdown")}function t(){return d.style.display!="none"}function l(){d.style.display="none"}function C(a){c.positionAtWidget(d.id,a.id,c.Vertical)}function D(a){a=a||window.event;a=a.target||a.srcElement;if(a.className!="content"){for(;a&&!c.hasTag(a,"DIV");)a=a.parentNode;a&&u(a)}}function u(a){var b=a.firstChild,h=c.getElement(f),e=b.innerHTML;b=b.getAttribute("sug"); | WT_DECLARE_WT_MEMBER(1,"WSuggestionPopup",function(q,d,y,z,r){function m(a){return $(a).hasClass("Wt-suggest-onedit")||$(a).hasClass("Wt-suggest-dropdown")}function s(){return d.style.display!="none"}function k(){d.style.display="none"}function A(a){c.positionAtWidget(d.id,a.id,c.Vertical)}function B(a){a=a||window.event;a=a.target||a.srcElement;if(a.className!="content"){for(;a&&!c.hasTag(a,"DIV");)a=a.parentNode;a&&t(a)}}function t(a){var b=a.firstChild,h=c.getElement(f),e=b.innerHTML;b=b.getAttribute("sug");h.focus();q.emit(d,"select",a.id,h.id);y(h,e,b);k();f=null}function C(a,b){for(a=b?a.nextSibling:a.previousSibling;a;a=b?a.nextSibling:a.previousSibling)if(c.hasTag(a,"DIV"))if(a.style.display!="none")return a;return null}$(".Wt-domRoot").add(d);jQuery.data(d,"obj",this);var n=this,c=q.WT,l=null,f=null,u=false,v=null,w=null,o=null;this.showPopup=function(){d.style.display="";l=null};this.editMouseMove=function(a,b){if(m(a))a.style.cursor=c.widgetCoordinates(a,b).x>a.offsetWidth-16?"default":""};this.editClick= |
a);g.firedTarget=null}else g.condCall(b,"onmousemove",a);return S=false}else return true}function T(a){var b=t(a);g.capture(null);if(b){if(!a)a=window.event;if(g.isIE){g.firedTarget=a.srcElement||b;b.fireEvent("onmouseup",a);g.firedTarget=null}else g.condCall(b,"onmouseup",a);g.cancelEvent(a,g.CancelPropagate);return false}else return true}function ca(){if(!Y){Y=true;if(document.body.addEventListener){var a=document.body;a.addEventListener("mousemove",D,true);a.addEventListener("mouseup",T,true); | a);g.firedTarget=null}else g.condCall(b,"onmousemove",a);return S=false}else return true}function T(a){var b=u(a);g.capture(null);if(b){if(!a)a=window.event;if(g.isIE){g.firedTarget=a.srcElement||b;b.fireEvent("onmouseup",a);g.firedTarget=null}else g.condCall(b,"onmouseup",a);g.cancelEvent(a,g.CancelPropagate);return false}else return true}function ca(){if(!U){U=true;if(document.body.addEventListener){var a=document.body;a.addEventListener("mousemove",D,true);a.addEventListener("mouseup",T,true); | a);g.firedTarget=null}else g.condCall(b,"onmousemove",a);return S=false}else return true}function T(a){var b=t(a);g.capture(null);if(b){if(!a)a=window.event;if(g.isIE){g.firedTarget=a.srcElement||b;b.fireEvent("onmouseup",a);g.firedTarget=null}else g.condCall(b,"onmouseup",a);g.cancelEvent(a,g.CancelPropagate);return false}else return true}function ca(){if(!Y){Y=true;if(document.body.addEventListener){var a=document.body;a.addEventListener("mousemove",D,true);a.addEventListener("mouseup",T,true); |
var _$_WT_CLASS_$_=new (function(){function w(a,b){return a.style[b]?a.style[b]:document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(a,null)[b]:a.currentStyle?a.currentStyle[b]:null}function t(a){if(C!=null){if(!a)a=window.event;h.condCall(C,"onmousemove",a);return false}else return true}function B(a){if(C!=null){var b=C;h.capture(null);if(!a)a=window.event;h.condCall(b,"onmouseup",a);h.cancelEvent(a,h.CancelPropagate);return false}else return true}function ba(){if(!T){T= | var _$_WT_CLASS_$_=new (function(){function v(a,b){return a.style[b]?a.style[b]:document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(a,null)[b]:a.currentStyle?a.currentStyle[b]:null}function t(a){if(B!=null){if(!a)a=window.event;g.condCall(B,"onmousemove",a);return false}else return true}function A(a){if(B!=null){var b=B;g.capture(null);if(!a)a=window.event;g.condCall(b,"onmouseup",a);g.cancelEvent(a,g.CancelPropagate);return false}else return true}function aa(){if(!S){S= | var _$_WT_CLASS_$_=new (function(){function w(a,b){return a.style[b]?a.style[b]:document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(a,null)[b]:a.currentStyle?a.currentStyle[b]:null}function t(a){if(C!=null){if(!a)a=window.event;h.condCall(C,"onmousemove",a);return false}else return true}function B(a){if(C!=null){var b=C;h.capture(null);if(!a)a=window.event;h.condCall(b,"onmouseup",a);h.cancelEvent(a,h.CancelPropagate);return false}else return true}function ba(){if(!T){T= |
c.object.style.left=c.objectPrevStyle.left;c.object.style.top=c.objectPrevStyle.top;c.object.className=c.objectPrevStyle.className;c.object=null}}function T(d,c){var f,j;j=d.event;c=c>0?"&e"+c:"&";f=c+"signal="+d.signal;if(d.id){f+=c+"id="+d.id+c+"name="+encodeURIComponent(d.name)+c+"an="+d.args.length;for(var m=0;m<d.args.length;++m)f+=c+"a"+m+"="+encodeURIComponent(d.args[m])}for(var h=0;h<U.length;++h){var s=o.getElement(U[h]),v=null,Z;if(s!=null){if(s.type=="select-multiple"){m=0;for(Z=s.options.length;m< Z;m++)if(s.options[m].selected)f+=c+U[h]+"="+encodeURIComponent(s.options[m].value)}else if(o.hasTag(s,"SPAN")){m=0;for(Z=s.childNodes.length;m<Z;++m)if(s.childNodes[m].type=="checkbox"){m=s.childNodes[m];if(m.style.display=="none")v="indeterminate";else if(m.checked)v=m.value;break}}else if(s.type=="checkbox"||s.type=="radio")if(s.indeterminate)v="indeterminate";else{if(s.checked)v=s.value}else if(s.type!="file")v=$(s).hasClass("Wt-edit-emptyText")?"":""+s.value;if(v!=null)f+=c+U[h]+"="+encodeURIComponent(v)}}if(P!= null)f+=c+"_="+encodeURIComponent(unescape(P));if(!j){d.data=f;return d}for(h=j.target||j.srcElement;!h.id&&h.parentNode;)h=h.parentNode;if(h.id)f+=c+"tid="+h.id;try{f+=c+"type="+j.type}catch(la){}if(j.clientX||j.clientY)f+=c+"clientX="+j.clientX+c+"clientY="+j.clientY;v=o.pageCoordinates(j);h=v.x;v=v.y;if(h||v){f+=c+"documentX="+h+c+"documentY="+v;f+=c+"dragdX="+(h-H)+c+"dragdY="+(v-ea)}if(j.screenX||j.screenY)f+=c+"screenX="+j.screenX+c+"screenY="+j.screenY;if(d.object&&d.object.nodeType!=9){m= o.widgetPageCoordinates(d.object);f+=c+"scrollX="+d.object.scrollLeft+c+"scrollY="+d.object.scrollTop+c+"width="+d.object.clientWidth+c+"height="+d.object.clientHeight+c+"widgetX="+(h-m.x)+c+"widgetY="+(v-m.y)}h=o.button(j);if(!h)if(o.buttons&1)h=1;else if(o.buttons&2)h=2;else if(o.buttons&4)h=4;f+=c+"button="+h;if(typeof j.keyCode!=="undefined")f+=c+"keyCode="+j.keyCode;if(typeof j.charCode!=="undefined")f+=c+"charCode="+j.charCode;if(j.altKey)f+=c+"altKey=1";if(j.ctrlKey)f+=c+"ctrlKey=1";if(j.metaKey)f+= | c.object.style.left=c.objectPrevStyle.left;c.object.style.top=c.objectPrevStyle.top;c.object.className=c.objectPrevStyle.className;c.object=null}}function T(d,c){var f,j;j=d.event;c=c>0?"&e"+c:"&";f=c+"signal="+d.signal;if(d.id){f+=c+"id="+d.id+c+"name="+encodeURIComponent(d.name)+c+"an="+d.args.length;for(var m=0;m<d.args.length;++m)f+=c+"a"+m+"="+encodeURIComponent(d.args[m])}for(var g=0;g<U.length;++g){var s=o.getElement(U[g]),v=null,Z;if(s!=null){if(s.type=="select-multiple"){m=0;for(Z=s.options.length;m< Z;m++)if(s.options[m].selected)f+=c+U[g]+"="+encodeURIComponent(s.options[m].value)}else if(o.hasTag(s,"SPAN")){m=0;for(Z=s.childNodes.length;m<Z;++m)if(s.childNodes[m].type=="checkbox"){m=s.childNodes[m];if(m.style.display=="none")v="indeterminate";else if(m.checked)v=m.value;break}}else if(s.type=="checkbox"||s.type=="radio")if(s.indeterminate)v="indeterminate";else{if(s.checked)v=s.value}else if(s.type!="file")v=$(s).hasClass("Wt-edit-emptyText")?"":""+s.value;if(v!=null)f+=c+U[g]+"="+encodeURIComponent(v)}}if(P!= null)f+=c+"_="+encodeURIComponent(unescape(P));if(!j){d.data=f;return d}for(g=j.target||j.srcElement;!g.id&&g.parentNode;)g=g.parentNode;if(g.id)f+=c+"tid="+g.id;try{f+=c+"type="+j.type}catch(la){}if(j.clientX||j.clientY)f+=c+"clientX="+j.clientX+c+"clientY="+j.clientY;v=o.pageCoordinates(j);g=v.x;v=v.y;if(g||v){f+=c+"documentX="+g+c+"documentY="+v;f+=c+"dragdX="+(g-H)+c+"dragdY="+(v-ea)}if(j.screenX||j.screenY)f+=c+"screenX="+j.screenX+c+"screenY="+j.screenY;if(d.object&&d.object.nodeType!=9){m= o.widgetPageCoordinates(d.object);f+=c+"scrollX="+d.object.scrollLeft+c+"scrollY="+d.object.scrollTop+c+"width="+d.object.clientWidth+c+"height="+d.object.clientHeight+c+"widgetX="+(g-m.x)+c+"widgetY="+(v-m.y)}g=o.button(j);if(!g)if(o.buttons&1)g=1;else if(o.buttons&2)g=2;else if(o.buttons&4)g=4;f+=c+"button="+g;if(typeof j.keyCode!=="undefined")f+=c+"keyCode="+j.keyCode;if(typeof j.charCode!=="undefined")f+=c+"charCode="+j.charCode;if(j.altKey)f+=c+"altKey=1";if(j.ctrlKey)f+=c+"ctrlKey=1";if(j.metaKey)f+= | c.object.style.left=c.objectPrevStyle.left;c.object.style.top=c.objectPrevStyle.top;c.object.className=c.objectPrevStyle.className;c.object=null}}function T(d,c){var f,j;j=d.event;c=c>0?"&e"+c:"&";f=c+"signal="+d.signal;if(d.id){f+=c+"id="+d.id+c+"name="+encodeURIComponent(d.name)+c+"an="+d.args.length;for(var m=0;m<d.args.length;++m)f+=c+"a"+m+"="+encodeURIComponent(d.args[m])}for(var h=0;h<U.length;++h){var s=o.getElement(U[h]),v=null,Z;if(s!=null){if(s.type=="select-multiple"){m=0;for(Z=s.options.length;m<Z;m++)if(s.options[m].selected)f+=c+U[h]+"="+encodeURIComponent(s.options[m].value)}else if(o.hasTag(s,"SPAN")){m=0;for(Z=s.childNodes.length;m<Z;++m)if(s.childNodes[m].type=="checkbox"){m=s.childNodes[m];if(m.style.display=="none")v="indeterminate";else if(m.checked)v=m.value;break}}else if(s.type=="checkbox"||s.type=="radio")if(s.indeterminate)v="indeterminate";else{if(s.checked)v=s.value}else if(s.type!="file")v=$(s).hasClass("Wt-edit-emptyText")?"":""+s.value;if(v!=null)f+=c+U[h]+"="+encodeURIComponent(v)}}if(P!=null)f+=c+"_="+encodeURIComponent(unescape(P));if(!j){d.data=f;return d}for(h=j.target||j.srcElement;!h.id&&h.parentNode;)h=h.parentNode;if(h.id)f+=c+"tid="+h.id;try{f+=c+"type="+j.type}catch(la){}if(j.clientX||j.clientY)f+=c+"clientX="+j.clientX+c+"clientY="+j.clientY;v=o.pageCoordinates(j);h=v.x;v=v.y;if(h||v){f+=c+"documentX="+h+c+"documentY="+v;f+=c+"dragdX="+(h-H)+c+"dragdY="+(v-ea)}if(j.screenX||j.screenY)f+=c+"screenX="+j.screenX+c+"screenY="+j.screenY;if(d.object&&d.object.nodeType!=9){m=o.widgetPageCoordinates(d.object);f+=c+"scrollX="+d.object.scrollLeft+c+"scrollY="+d.object.scrollTop+c+"width="+d.object.clientWidth+c+"height="+d.object.clientHeight+c+"widgetX="+(h-m.x)+c+"widgetY="+(v-m.y)}h=o.button(j);if(!h)if(o.buttons&1)h=1;else if(o.buttons&2)h=2;else if(o.buttons&4)h=4;f+=c+"button="+h;if(typeof j.keyCode!=="undefined")f+=c+"keyCode="+j.keyCode;if(typeof j.charCode!=="undefined")f+=c+"charCode="+j.charCode;if(j.altKey)f+=c+"altKey=1";if(j.ctrlKey)f+=c+"ctrlKey=1";if(j.metaKey)f+=c+"metaKey=1";if(j.shiftKey)f+=c+"shiftKey=1";d.data=f;return d}function a(){for(var d="",c=false,f=0;f<z.length;++f){c=c||z[f].feedback;d+=z[f].data}ca=z;z=[];return{feedback:c,result:d}}function b(){Q=true;if(V){clearTimeout(V);V=null}var d=$("#Wt-timers");d.size()>0&&o.setHtml(d.get(0),"",false)}function e(){o.history._initTimeout();W==0&&A(null,"none",null,false);V=setTimeout(e,_$_KEEP_ALIVE_$_000)}function k(d){if(!o.isIEMobile)document.title=d}function i(){if(!document.activeElement){function d(f){if(f&& |
function c(){d=true;switch(b.readyState){case 0:a.aborted(b);break;case 4:b.status===200?a.complete(b):a.error(Xmla.Exception._newError("HTTP_ERROR","_ajax",a));break}}b.onreadystatechange=c;b.setRequestHeader("Content-Type","text/xml");b.send(a.data);!a.async&&!d&&c.call(b);return b}function j(a){return typeof a==="undefined"}function t(a){return typeof a==="function"}function N(a){return typeof a==="string"}function O(a){return typeof a==="number"}function P(a){return typeof a==="object"}function C(a){return a.replace(/\&/g, | "&").replace(/</g,"<").replace(/>/g,">")}var o=document.getElementsByTagNameNS?function(a,b,d,c){return a.getElementsByTagNameNS(b,c)}:function(a,b,d,c){return d?a.getElementsByTagName(d+":"+c):a.getElementsByTagName(c)},C=document.documentElement.getAttributeNS?function(a,b,d,c){return a.getAttributeNS(b,c)}:function(a,b,d,c){return d?a.getAttribute(d+":"+c):a.getAttribute(c)};function t(a,b,d,c){c||(c="");var e,h,f,i,n,k="\n"+c+"<"+a+">";if(d){k+="\n"+c+" <"+b+">";for(i in d)if(d.hasOwnProperty(i)){n= d[i];k+="\n"+c+" <"+i+">";if(typeof n==="array"){h=0;for(e=n.length;h<e;h+=1){f=n[h];k+="<Value>"+B(f)+"</Value>"}}else k+=B(n);k+="</"+i+">"}k+="\n"+c+" </"+b+">"}k+="\n"+c+"</"+a+">";return k}var D="RequestType";function Q(a){var b="",d=a.method,c=null;b+="\n<"+p+":Envelope "+E+" "+w+">\n <"+p+":Body>\n <"+d+" "+F+" "+w+">";switch(d){case Xmla.METHOD_DISCOVER:if(j(a.requestType))c=Xmla.Exception._newError("MISSING_REQUEST_TYPE","Xmla._getXmlaSoapMessage",a);else b+="\n <"+D+">"+a.requestType+ | function c(){d=true;switch(b.readyState){case 0:a.aborted(b);break;case 4:b.status===200?a.complete(b):a.error(Xmla.Exception._newError("HTTP_ERROR","_ajax",a));break}}b.onreadystatechange=c;b.setRequestHeader("Content-Type","text/xml");b.send(a.data);!a.async&&!d&&c.call(b);return b}function j(a){return typeof a==="undefined"}function t(a){return typeof a==="function"}function N(a){return typeof a==="string"}function O(a){return typeof a==="number"}function P(a){return typeof a==="object"}function C(a){return a.replace(/\&/g, |
this.tabs = new Array(); | this.tabs = []; | function tabberObj(argsObj){ var arg; /* name of an argument to override */ /* Element for the main tabber div. If you supply this in argsObj, then the init() method will be called. */ this.div = null; /* Class of the main tabber div */ this.classMain = "tabber"; /* Rename classMain to classMainLive after tabifying (so updateCSWRecords different style can be applied) */ this.classMainLive = "tabberlive"; /* Class of each DIV that contains updateCSWRecords tab */ this.classTab = "tabbertab"; /* Class to indicate which tab should be active on startup */ this.classTabDefault = "tabbertabdefault"; /* Class for the navigation UL */ this.classNav = "tabbernav"; /* When updateCSWRecords tab is to be hidden, instead of setting display='none', we set the class of the div to classTabHide. In your screen stylesheet you should set classTabHide to display:none. In your print stylesheet you should set display:block to ensure that all the information is printed. */ this.classTabHide = "tabbertabhide"; /* Class to set the navigation LI when the tab is active, so you can use updateCSWRecords different style on the active tab. */ this.classNavActive = "tabberactive"; /* Elements that might contain the title for the tab, only used if updateCSWRecords title is not specified in the TITLE attribute of DIV classTab. */ this.titleElements = ['h2','h3','h4','h5','h6']; /* Should we strip out the HTML from the innerHTML of the title elements? This should usually be true. */ this.titleElementsStripHTML = true; /* If the user specified the tab names using updateCSWRecords TITLE attribute on the DIV, then the browser will display updateCSWRecords tooltip whenever the mouse is over the DIV. To prevent this tooltip, we can remove the TITLE attribute after getting the tab name. */ this.removeTitle = true; /* If you want to add an id to each link set this to true */ this.addLinkId = false; /* If addIds==true, then you can set updateCSWRecords format for the ids. <tabberid> will be replaced with the id of the main tabber div. <tabnumberzero> will be replaced with the tab number (tab numbers starting at zero) <tabnumberone> will be replaced with the tab number (tab numbers starting at one) <tabtitle> will be replaced by the tab title (with all non-alphanumeric characters removed) */ this.linkIdFormat = '<tabberid>nav<tabnumberone>'; this.wfs=null; /* You can override the defaults listed above by passing in an object: var mytab = new tabber({property:value,property:value}); */ for (arg in argsObj) { this[arg] = argsObj[arg]; } /* Create regular expressions for the class names; Note: if you change the class names after updateCSWRecords new object is created you must also change these regular expressions. */ this.REclassMain = new RegExp('\\b' + this.classMain + '\\b', 'gi'); this.REclassMainLive = new RegExp('\\b' + this.classMainLive + '\\b', 'gi'); this.REclassTab = new RegExp('\\b' + this.classTab + '\\b', 'gi'); this.REclassTabDefault = new RegExp('\\b' + this.classTabDefault + '\\b', 'gi'); this.REclassTabHide = new RegExp('\\b' + this.classTabHide + '\\b', 'gi'); /* Array of objects holding info about each tab */ this.tabs = new Array(); /* If the main tabber div was specified, call init() now */ if (this.div) { this.init(this.div); /* We don't need the main div anymore, and to prevent updateCSWRecords memory leak in IE, we must remove the circular reference between the div and the tabber object. */ this.div = null; }} |
this.each(function(i) { | this.each(function() { | $.fn.tabs = function(paneSelector, conf) { // return existing instance var el = this.data("tabs"); if (el) { return el; } if ($.isFunction(conf)) { conf = {onBeforeClick: conf}; } // setup conf conf = $.extend({}, $.tools.tabs.conf, conf); this.each(function(i) { el = new Tabs($(this), paneSelector, conf); $(this).data("tabs", el); }); return conf.api ? el: this; }; |
if (location.hash && conf.tabs === "a" && root.find(conf.tabs + location.hash)) { | if (location.hash && conf.tabs === "a" && root.find(conf.tabs + location.hash).length) { | function Tabs(root, paneSelector, conf) { var self = this, trigger = root.add(this), tabs = root.find(conf.tabs), panes = paneSelector.jquery ? paneSelector : root.children(paneSelector), current; // make sure tabs and panes are found if (!tabs.length) { tabs = root.children(); } if (!panes.length) { panes = root.parent().find(paneSelector); } if (!panes.length) { panes = $(paneSelector); } // public methods $.extend(this, { click: function(i, e) { var tab = tabs.eq(i); if (typeof i == 'string' && i.replace("#", "")) { tab = tabs.filter("[href*=" + i.replace("#", "") + "]"); i = Math.max(tabs.index(tab), 0); } if (conf.rotate) { var last = tabs.length -1; if (i < 0) { return self.click(last, e); } if (i > last) { return self.click(0, e); } } if (!tab.length) { if (current >= 0) { return self; } i = conf.initialIndex; tab = tabs.eq(i); } // current tab is being clicked if (i === current) { return self; } // possibility to cancel click action e = e || $.Event(); e.type = "onBeforeClick"; trigger.trigger(e, [i]); if (e.isDefaultPrevented()) { return; } // call the effect effects[conf.effect].call(self, i, function() { // onClick callback e.type = "onClick"; trigger.trigger(e, [i]); }); // default behaviour current = i; tabs.removeClass(conf.current); tab.addClass(conf.current); return self; }, getConf: function() { return conf; }, getTabs: function() { return tabs; }, getPanes: function() { return panes; }, getCurrentPane: function() { return panes.eq(current); }, getCurrentTab: function() { return tabs.eq(current); }, getIndex: function() { return current; }, next: function() { return self.click(current + 1); }, prev: function() { return self.click(current - 1); }, destroy: function() { tabs.unbind(conf.event).removeClass(conf.current); panes.find("a[href^=#]").unbind("click.T"); return self; } }); // callbacks $.each("onBeforeClick,onClick".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } // API self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); if (conf.history && $.fn.history) { $.tools.history.init(tabs); conf.event = 'history'; } // setup click actions for each tab tabs.each(function(i) { $(this).bind(conf.event, function(e) { self.click(i, e); return e.preventDefault(); }); }); // cross tab anchor link panes.find("a[href^=#]").bind("click.T", function(e) { self.click($(this).attr("href"), e); }); // open initial tab if (location.hash && conf.tabs === "a" && root.find(conf.tabs + location.hash)) { self.click(location.hash); } else { if (conf.initialIndex === 0 || conf.initialIndex > 0) { self.click(conf.initialIndex); } } } |
lazies = lconf === true ? panes : root.find(lconf.select || lconf); | if (lconf === true) { lconf = "img, :backgroundImage"; } lazies = root.find(lconf.select || lconf); | function Tabs(tabs, panes, conf) { var self = this, $self = $(this), root = panes.parent(), current; // public methods $.extend(this, { click: function(i, e) { var pane = self.getCurrentPane(), tab = tabs.eq(i); if (typeof i == 'string' && i.replace("#", "")) { tab = tabs.filter("[href*=" + i.replace("#", "") + "]"); i = Math.max(tabs.index(tab), 0); } if (conf.rotate) { var last = tabs.length -1; if (i < 0) { return self.click(last, e); } if (i > last) { return self.click(0, e); } } if (!tab.length) { if (current >= 0) { return self; } i = conf.initialIndex; tab = tabs.eq(i); } // current tab is being clicked if (i === current) { return self; } // possibility to cancel click action e = e || $.Event(); e.type = "onBeforeClick"; $self.trigger(e, [i]); if (e.isDefaultPrevented()) { return; } // call the effect effects[conf.effect].call(self, i, function() { // onClick callback e.type = "onClick"; $self.trigger(e, [i]); }); // default behaviour current = i; tabs.removeClass(conf.current); tab.addClass(conf.current); return self; }, getConf: function() { return conf; }, getTabs: function() { return tabs; }, getPanes: function() { return panes; }, getCurrentPane: function() { return panes.eq(current); }, getCurrentTab: function() { return tabs.eq(current); }, getLoader: function() { return loader; }, getIndex: function() { return current; }, next: function() { return self.click(current + 1); }, prev: function() { return self.click(current - 1); }, bind: function(name, fn) { $self.bind(name, fn); return self; }, onBeforeClick: function(fn) { return this.bind("onBeforeClick", fn); }, onClick: function(fn) { return this.bind("onClick", fn); }, unbind: function(name) { $self.unbind(name); return self; } }); // bind all callbacks from configuration $.each(conf, function(name, fn) { if ($.isFunction(fn)) { $self.bind(name, fn); } }); // setup click actions for each tab tabs.each(function(i) { $(this).bind(conf.event, function(e) { self.click(i, e); return false; }); }); // cross tab anchor link panes.find("a[href^=#]").click(function(e) { self.click($(this).attr("href"), e); }); // history support if (conf.history && $.fn.history) { // enable history support tabs.history(function(evt, hash) { if (!hash || hash == '#') { hash = conf.initialIndex; } self.click(hash); }); // tab clicks perform their original action tabs.click(function(e) { location.hash = $(this).attr("href").replace("#", ""); }); } // lazyload support. all logic is here. var lconf = $.tools.lazyload && conf.lazyload, loader, lazies; if (lconf) { lazies = lconf === true ? panes : root.find(lconf.select || lconf); if (typeof lconf != 'object') { lconf = {}; } $.extend(lconf, { growParent: root, api: true}, lconf); loader = lazies.lazyload(lconf); self.onBeforeClick(function(e, i) { loader.load(panes.eq(i).find(":unloaded").andSelf()); }); } // open initial tab if (location.hash) { self.click(location.hash); } else { if (conf.initialIndex === 0 || conf.initialIndex > 0) { self.click(conf.initialIndex); } } } |
var lconf = $.tools.lazyload && conf.lazyload, loader; if (lconf) { if (typeof lconf != 'object') { lconf = { select: lconf }; } if (typeof lconf.select != 'string') { lconf.select = "img, :backgroundImage"; } $.extend(lconf, { growParent: panes.parent(), api: true }, lconf); loader = panes.parent().find(lconf.select).lazyload(lconf); self.onBeforeClick(function(e, i) { loader.load(panes.eq(i).find(":unloaded").andSelf()); }); } | function Tabs(root, paneSelector, conf) { var self = this, trigger = root.add(this), tabs = root.find(conf.tabs), panes = paneSelector.jquery ? paneSelector : root.children(paneSelector), current; // make sure tabs and panes are found if (!tabs.length) { tabs = root.children(); } if (!panes.length) { panes = root.parent().find(paneSelector); } if (!panes.length) { panes = $(paneSelector); } // public methods $.extend(this, { click: function(i, e) { if (panes.eq(i).is(":visible")) { return self; } var tab = tabs.eq(i); if (typeof i == 'string' && i.replace("#", "")) { tab = tabs.filter("[href*=" + i.replace("#", "") + "]"); i = Math.max(tabs.index(tab), 0); } if (conf.rotate) { var last = tabs.length -1; if (i < 0) { return self.click(last, e); } if (i > last) { return self.click(0, e); } } if (!tab.length) { if (current >= 0) { return self; } i = conf.initialIndex; tab = tabs.eq(i); } // current tab is being clicked if (i === current) { return self; } // possibility to cancel click action e = e || $.Event(); e.type = "onBeforeClick"; trigger.trigger(e, [i]); if (e.isDefaultPrevented()) { return; } // call the effect effects[conf.effect].call(self, i, function() { // onClick callback e.type = "onClick"; trigger.trigger(e, [i]); }); // default behaviour current = i; tabs.removeClass(conf.current); tab.addClass(conf.current); return self; }, getConf: function() { return conf; }, getTabs: function() { return tabs; }, getPanes: function() { return panes; }, getCurrentPane: function() { return panes.eq(current); }, getCurrentTab: function() { return tabs.eq(current); }, getIndex: function() { return current; }, next: function() { return self.click(current + 1); }, prev: function() { return self.click(current - 1); } }); // callbacks $.each("onBeforeClick,onClick".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } // API self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // setup click actions for each tab tabs.each(function(i) { $(this).bind(conf.event, function(e) { self.click(i, e); return e.preventDefault(); }); }); // cross tab anchor link panes.find("a[href^=#]").click(function(e) { self.click($(this).attr("href"), e); }); // history support if (conf.history && $.fn.history) { // enable history support tabs.history(function(evt, hash) { if (!hash || hash == '#') { hash = conf.initialIndex; } self.click(hash); }); // tab clicks perform their original action tabs.click(function(e) { location.hash = $(this).attr("href").replace("#", ""); }); } // lazyload support. all logic is here. var lconf = $.tools.lazyload && conf.lazyload, loader; if (lconf) { // lazyload configuration if (typeof lconf != 'object') { lconf = { select: lconf }; } if (typeof lconf.select != 'string') { lconf.select = "img, :backgroundImage"; } $.extend(lconf, { growParent: panes.parent(), api: true }, lconf); // initialize lazyload loader = panes.parent().find(lconf.select).lazyload(lconf); self.onBeforeClick(function(e, i) { loader.load(panes.eq(i).find(":unloaded").andSelf()); }); } // open initial tab if (location.hash) { self.click(location.hash); } else { if (conf.initialIndex === 0 || conf.initialIndex > 0) { self.click(conf.initialIndex); } } } |
|
if (panes.eq(i).is(":visible")) { return self; } | function Tabs(root, paneSelector, conf) { var self = this, trigger = root.add(this), tabs = root.find(conf.tabs), panes = paneSelector.jquery ? paneSelector : root.children(paneSelector), current; // make sure tabs and panes are found if (!tabs.length) { tabs = root.children(); } if (!panes.length) { panes = root.parent().find(paneSelector); } if (!panes.length) { panes = $(paneSelector); } // public methods $.extend(this, { click: function(i, e) { if (panes.eq(i).is(":visible")) { return self; } var tab = tabs.eq(i); if (typeof i == 'string' && i.replace("#", "")) { tab = tabs.filter("[href*=" + i.replace("#", "") + "]"); i = Math.max(tabs.index(tab), 0); } if (conf.rotate) { var last = tabs.length -1; if (i < 0) { return self.click(last, e); } if (i > last) { return self.click(0, e); } } if (!tab.length) { if (current >= 0) { return self; } i = conf.initialIndex; tab = tabs.eq(i); } // current tab is being clicked if (i === current) { return self; } // possibility to cancel click action e = e || $.Event(); e.type = "onBeforeClick"; trigger.trigger(e, [i]); if (e.isDefaultPrevented()) { return; } // call the effect effects[conf.effect].call(self, i, function() { // onClick callback e.type = "onClick"; trigger.trigger(e, [i]); }); // default behaviour current = i; tabs.removeClass(conf.current); tab.addClass(conf.current); return self; }, getConf: function() { return conf; }, getTabs: function() { return tabs; }, getPanes: function() { return panes; }, getCurrentPane: function() { return panes.eq(current); }, getCurrentTab: function() { return tabs.eq(current); }, getIndex: function() { return current; }, next: function() { return self.click(current + 1); }, prev: function() { return self.click(current - 1); } }); // callbacks $.each("onBeforeClick,onClick".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } // API self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // setup click actions for each tab tabs.each(function(i) { $(this).bind(conf.event, function(e) { self.click(i, e); return e.preventDefault(); }); }); // cross tab anchor link panes.find("a[href^=#]").click(function(e) { self.click($(this).attr("href"), e); }); // history support if (conf.history && $.fn.history) { // enable history support tabs.history(function(evt, hash) { if (!hash || hash == '#') { hash = conf.initialIndex; } self.click(hash); }); // tab clicks perform their original action tabs.click(function(e) { location.hash = $(this).attr("href").replace("#", ""); }); } // open initial tab if (location.hash) { self.click(location.hash); } else { if (conf.initialIndex === 0 || conf.initialIndex > 0) { self.click(conf.initialIndex); } } } |
|
$(self).bind(name, fn); | if (fn) { $(self).bind(name, fn); } | function Tabs(root, paneSelector, conf) { var self = this, trigger = root.add(this), tabs = root.find(conf.tabs), panes = paneSelector.jquery ? paneSelector : root.children(paneSelector), current; // make sure tabs and panes are found if (!tabs.length) { tabs = root.children(); } if (!panes.length) { panes = root.parent().find(paneSelector); } if (!panes.length) { panes = $(paneSelector); } // public methods $.extend(this, { click: function(i, e) { var tab = tabs.eq(i); if (typeof i == 'string' && i.replace("#", "")) { tab = tabs.filter("[href*=" + i.replace("#", "") + "]"); i = Math.max(tabs.index(tab), 0); } if (conf.rotate) { var last = tabs.length -1; if (i < 0) { return self.click(last, e); } if (i > last) { return self.click(0, e); } } if (!tab.length) { if (current >= 0) { return self; } i = conf.initialIndex; tab = tabs.eq(i); } // current tab is being clicked if (i === current) { return self; } // possibility to cancel click action e = e || $.Event(); e.type = "onBeforeClick"; trigger.trigger(e, [i]); if (e.isDefaultPrevented()) { return; } // call the effect effects[conf.effect].call(self, i, function() { // onClick callback e.type = "onClick"; trigger.trigger(e, [i]); }); // default behaviour current = i; tabs.removeClass(conf.current); tab.addClass(conf.current); return self; }, getConf: function() { return conf; }, getTabs: function() { return tabs; }, getPanes: function() { return panes; }, getCurrentPane: function() { return panes.eq(current); }, getCurrentTab: function() { return tabs.eq(current); }, getIndex: function() { return current; }, next: function() { return self.click(current + 1); }, prev: function() { return self.click(current - 1); }, destroy: function() { tabs.unbind(conf.event).removeClass(conf.current); panes.find("a[href^=#]").unbind("click.T"); return self; } }); // callbacks $.each("onBeforeClick,onClick".split(","), function(i, name) { // configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } // API self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); if (conf.history && $.fn.history) { $.tools.history.init(tabs); conf.event = 'history'; } // setup click actions for each tab tabs.each(function(i) { $(this).bind(conf.event, function(e) { self.click(i, e); return e.preventDefault(); }); }); // cross tab anchor link panes.find("a[href^=#]").bind("click.T", function(e) { self.click($(this).attr("href"), e); }); // open initial tab if (location.hash && conf.tabs === "a" && root.find(conf.tabs + location.hash).length) { self.click(location.hash); } else { if (conf.initialIndex === 0 || conf.initialIndex > 0) { self.click(conf.initialIndex); } } } |
q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>"; | n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&& | q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML="<a href='#'></a>"; |
0)o.find.TAG=function(f,i){i=i.getElementsByTagName(f[1]);if(f[1]==="*"){f=[];for(var j=0;i[j];j++)i[j].nodeType===1&&f.push(i[j]);i=f}return i};c.innerHTML="<a href='#'></a>";if(c.firstChild&&typeof c.firstChild.getAttribute!=="undefined"&&c.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(f){return f.getAttribute("href",2)};c=null})();r.querySelectorAll&&function(){var c=p,f=r.createElement("div");f.innerHTML="<p class='TEST'></p>";if(!(f.querySelectorAll&&f.querySelectorAll(".TEST").length=== | " "+c[1].replace(/\\/g,"")+" ";if(m)return c;m=0;for(var t;(t=f[m])!=null;m++)if(t)if(n^(t.className&&(" "+t.className+" ").replace(/[\t\n]/g," ").indexOf(c)>=0))i||j.push(t);else if(i)f[m]=false;return false},ID:function(c){return c[1].replace(/\\/g,"")},TAG:function(c){return c[1].toLowerCase()},CHILD:function(c){if(c[1]==="nth"){var f=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(c[2]==="even"&&"2n"||c[2]==="odd"&&"2n+1"||!/\D/.test(c[2])&&"0n+"+c[2]||c[2]);c[2]=f[1]+(f[2]||1)-0;c[3]=f[3]-0}c[0]=h++;return c}, | 0)o.find.TAG=function(f,i){i=i.getElementsByTagName(f[1]);if(f[1]==="*"){f=[];for(var j=0;i[j];j++)i[j].nodeType===1&&f.push(i[j]);i=f}return i};c.innerHTML="<a href='#'></a>";if(c.firstChild&&typeof c.firstChild.getAttribute!=="undefined"&&c.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(f){return f.getAttribute("href",2)};c=null})();r.querySelectorAll&&function(){var c=p,f=r.createElement("div");f.innerHTML="<p class='TEST'></p>";if(!(f.querySelectorAll&&f.querySelectorAll(".TEST").length=== |
$('#addValue-'+ id).live('keypress', function(evt) { | $('#addValue-'+ id).live('keyup', function(evt) { | $.fn.tagBox = function(options) { // define defaults var defaults = { splitChar: ',', emptyMessage: '', addLabel: 'add', removeLabel: 'delete', autoCompleteUrl: '', canAddNew: false }; // extend options var options = $.extend(defaults, options); // loop all elements return this.each(function() { // define some vars var id = $(this).attr('id'); var elements = get(); // build replace html var html = '<div class="tagsWrapper">'+ ' <div class="oneLiner">'+ ' <p><input class="inputText" id="addValue-'+ id +'" name="addValue-'+ id +'" type="text" /></p>'+ ' <div class="buttonHolder">'+ ' <a href="#" id="addButton-'+ id +'" class="button icon iconAdd iconOnly disabledButton">'+ ' <span><span><span>'+ options.addLabel +'</span></span></span>'+ ' </a>'+ ' </div>'+ ' </div>'+ ' <div id="elementList-'+ id +'" class="tagList">'+ ' </div>'+ '</div>'; // hide current element $(this).css('visibility', 'hidden') .css('position', 'absolute') .css('top', '-9000px') .css('left', '-9000px') .attr('tabindex', '-1'); // prepend html $(this).before(html); // add elements list build(); // bind autocomplete if needed if(options.autoCompleteUrl != '') { $('#addValue-'+ id).autocomplete(options.autoCompleteUrl, { minChars: 1, dataType: 'json', width: $('#addValue-'+ id).width(), parse: function(json) { // init vars var parsed = []; // validate json if(json.code != 200) return parsed; // only process if we have results if(json.data.length > 0) { // loop data for(i in json.data) { parsed[parsed.length] = { data: [json.data[i].name], value: json.data[i].value, result: json.data[i].name }; } } // return data return parsed; } }); } // bind keypress on value-field $('#addValue-'+ id).live('keypress', function(evt) { // grab code var code = (evt.which||evt.charCode||evt.keyCode); // enter of splitchar should add an element if(code == 13 || String.fromCharCode(code) == options.splitChar) { evt.preventDefault(); evt.stopPropagation(); // add element add(); } // disable or enable button if($(this).val().replace(/^\s+|\s+$/g, '') == '') $('#addButton-'+ id).addClass('disabledButton'); else $('#addButton-'+ id).removeClass('disabledButton'); }); // bind click on add-button $('#addButton-'+ id).live('click', function(evt) { // dont submit evt.preventDefault(); evt.stopPropagation(); // add element add(); }); // bind click on delete-button $('.deleteButton-'+ id).live('click', function(evt) { // dont submit evt.preventDefault(); evt.stopPropagation(); // remove element remove($(this).attr('rel')); }); // add an element function add() { // init some vars var value = $('#addValue-'+ id).val().replace(/^\s+|\s+$/g, ''); var inElements = false; // reset box $('#addValue-'+ id).val('').focus(); $('#addButton-'+ id).addClass('disabledButton'); // only add new element if it isn't empty if(value != '') { // already in elements? for(var i in elements) if(value == elements[i]) inElements = true; // only add if not already in elements if(!inElements) { // add elements elements.push(value); // set new value $('#'+ id).val(elements.join(options.splitChar)); // rebuild element list build(); } } } // build the list function build() { // init var var html = ''; // no items and message given? if(elements.length == 0 && options.emptyMessage != '') html = '<p class="helpTxt">'+ options.emptyMessage +'</p>'; // items available else { // start html html = '<ul>'; // loop elements for(var i in elements) { html += ' <li><span><strong>'+ elements[i] +'</strong>'+ ' <a href="#" class="deleteButton-'+ id +'" rel="'+ elements[i] +'" title="'+ options.removeLabel +'">'+ options.removeLabel +'</a></span>'+ ' </li>'; } // end html html += '</ul>'; } // set html $('#elementList-'+ id).html(html); } // get all items function get() { // get chunks var chunks = $('#'+ id).val().split(options.splitChar); var elements = []; // loop elements and trim them from spaces for(var i in chunks) { value = chunks[i].replace(/^\s+|\s+$/g,''); if(value != '') elements.push(value) } return elements; } // remove an item function remove(value) { // get index for element var index = elements.indexOf(value); // remove element if(index > -1) elements.splice(index, 1); // set new value $('#'+ id).val(elements.join(options.splitChar)); // rebuild element list build(); } }); }; |
$('label[for="'+ id +'"]').attr('for', 'addValue-'+ id); | $.fn.tagBox = function(options) { // define defaults var defaults = { splitChar: ',', emptyMessage: '', addLabel: 'add', removeLabel: 'delete', autoCompleteUrl: '', canAddNew: false, showIconOnly: true }; // extend options var options = $.extend(defaults, options); // loop all elements return this.each(function() { // define some vars var id = $(this).attr('id'); var elements = get(); var blockSubmit = false; // bind submit $(this.form).submit(function() { return !blockSubmit; }); // build replace html var html = '<div class="tagsWrapper">'+ ' <div class="oneLiner">'+ ' <p><input class="inputText dontSubmit" id="addValue-'+ id +'" name="addValue-'+ id +'" type="text" /></p>'+ ' <div class="buttonHolder">'+ ' <a href="#" id="addButton-'+ id +'" class="button icon iconAdd disabledButton'; if(options.showIconOnly) html += ' iconOnly'; html += '">'+ ' <span>'+ options.addLabel +'</span>'+ ' </a>'+ ' </div>'+ ' </div>'+ ' <div id="elementList-'+ id +'" class="tagList">'+ ' </div>'+ '</div>'; // hide current element $(this).css('visibility', 'hidden') .css('position', 'absolute') .css('top', '-9000px') .css('left', '-9000px') .attr('tabindex', '-1'); // prepend html $(this).before(html); // add elements list build(); // bind autocomplete if needed if(options.autoCompleteUrl != '') { $('#addValue-'+ id).autocomplete({ delay: 200, minLength: 2, source: function(request, response) { $.ajax({ url: options.autoCompleteUrl, type: 'GET', data: 'term=' + request.term, success: function(data, textStatus) { // init var var realData = []; // alert the user if(data.code != 200 && jsBackend.debug) { alert(data.message); } if(data.code == 200) { for(var i in data.data) realData.push({ label: data.data[i].name, value: data.data[i].name }); } // set response response(realData); } }); } }); } // bind keypress on value-field $('#addValue-'+ id).bind('keyup', function(evt) { blockSubmit = true; // grab code var code = evt.which; // enter of splitchar should add an element if(code == 13 || String.fromCharCode(code) == options.splitChar) { // prevent default behaviour evt.preventDefault(); evt.stopPropagation(); // add element add(); } // disable or enable button if($(this).val().replace(/^\s+|\s+$/g, '') == '') { blockSubmit = false; $('#addButton-'+ id).addClass('disabledButton'); } else $('#addButton-'+ id).removeClass('disabledButton'); }); // bind click on add-button $('#addButton-'+ id).bind('click', function(evt) { // dont submit evt.preventDefault(); evt.stopPropagation(); // add element add(); }); // bind click on delete-button $('.deleteButton-'+ id).live('click', function(evt) { // dont submit evt.preventDefault(); evt.stopPropagation(); // remove element remove($(this).attr('rel')); }); // add an element function add() { blockSubmit = false; // init some vars var value = $('#addValue-'+ id).val().replace(/^\s+|\s+$/g, ''); var inElements = false; // reset box $('#addValue-'+ id).val('').focus(); $('#addButton-'+ id).addClass('disabledButton'); // only add new element if it isn't empty if(value != '') { // already in elements? for(var i in elements) if(value == elements[i]) inElements = true; // only add if not already in elements if(!inElements) { // add elements elements.push(value); // set new value $('#'+ id).val(elements.join(options.splitChar)); // rebuild element list build(); } } } // build the list function build() { // init var var html = ''; // no items and message given? if(elements.length == 0 && options.emptyMessage != '') html = '<p class="helpTxt">'+ options.emptyMessage +'</p>'; // items available else { // start html html = '<ul>'; // loop elements for(var i in elements) { html += ' <li><span><strong>'+ elements[i] +'</strong>'+ ' <a href="#" class="deleteButton-'+ id +'" rel="'+ elements[i] +'" title="'+ options.removeLabel +'">'+ options.removeLabel +'</a></span>'+ ' </li>'; } // end html html += '</ul>'; } // set html $('#elementList-'+ id).html(html); } // get all items function get() { // get chunks var chunks = $('#'+ id).val().split(options.splitChar); var elements = []; // loop elements and trim them from spaces for(var i in chunks) { value = chunks[i].replace(/^\s+|\s+$/g,''); if(value != '') elements.push(value); } return elements; } // remove an item function remove(value) { // get index for element var index = elements.indexOf(value); // remove element if(index > -1) elements.splice(index, 1); // set new value $('#'+ id).val(elements.join(options.splitChar)); // rebuild element list build(); } }); }; |
|
if(code == 13 || String.fromCharCode(code) == options.splitChar) | if(code == 13 || $(this).val().indexOf(options.splitChar) != -1) | $.fn.tagBox = function(options) { // define defaults var defaults = { splitChar: ',', emptyMessage: '', errorMessage: 'Add the tag before submitting', addLabel: 'add', removeLabel: 'delete', autoCompleteUrl: '', canAddNew: false, showIconOnly: true, multiple: true }; // extend options var options = $.extend(defaults, options); // loop all elements return this.each(function() { // define some vars var id = $(this).attr('id'); var elements = get(); var blockSubmit = false; var timer = null; // reset label, so it points to the correct item $('label[for="' + id + '"]').attr('for', 'addValue-' + id); // bind submit $(this.form).submit(function(evt) { // hide before.. $('#errorMessage-'+ id).remove(); if(blockSubmit && $('#addValue-' + id).val().replace(/^\s+|\s+$/g, '') != '') { // show warning $($('#addValue-'+ id).parents('.oneLiner')).append('<span style="display: none;" id="errorMessage-'+ id +'" class="formError">'+ options.errorMessage +'</span>'); // clear other timers clearTimeout(timer); // we need the timeout otherwise the error is show every time the user presses enter in the tagbox timer = setTimeout(function() { $('#errorMessage-'+ id).show(); }, 200); } return !blockSubmit; }); // build replace html var html = '<div class="tagsWrapper">' + ' <div class="oneLiner">' + ' <p><input class="inputText dontSubmit" id="addValue-' + id + '" name="addValue-' + id + '" type="text" /></p>' + ' <div class="buttonHolder">' + ' <a href="#" id="addButton-' + id + '" class="button icon iconAdd disabledButton'; if(options.showIconOnly) html += ' iconOnly'; html += '">' + ' <span>' + options.addLabel + '</span>' + ' </a>' + ' </div>' + ' </div>' + ' <div id="elementList-' + id + '" class="tagList">' + ' </div>' + '</div>'; // hide current element $(this).css('visibility', 'hidden').css('position', 'absolute').css('top', '-9000px').css('left', '-9000px').attr('tabindex', '-1'); // prepend html $(this).before(html); // add elements list build(); // bind autocomplete if needed if(options.autoCompleteUrl != '') { $('#addValue-' + id).autocomplete({ delay: 200, minLength: 2, source: function(request, response) { $.ajax({ url: options.autoCompleteUrl, type: 'GET', data: 'term=' + request.term, success: function(data, textStatus) { // init var var realData = []; // alert the user if(data.code != 200 && jsBackend.debug) { alert(data.message); } if(data.code == 200) { for( var i in data.data) { realData.push({ label: data.data[i].name, value: data.data[i].name }); } } // set response response(realData); } }); } }); } // bind keypress on value-field $('#addValue-' + id).bind('keyup', function(evt) { blockSubmit = true; // grab code var code = evt.which; // remove error message $('#errorMessage-'+ id).remove(); // enter of splitchar should add an element if(code == 13 || String.fromCharCode(code) == options.splitChar) { // hide before.. $('#errorMessage-'+ id).remove(); // prevent default behaviour evt.preventDefault(); evt.stopPropagation(); // add element add(); } // disable or enable button if($(this).val().replace(/^\s+|\s+$/g, '') == '') { blockSubmit = false; $('#addButton-' + id).addClass('disabledButton'); } else $('#addButton-' + id).removeClass('disabledButton'); }); // bind click on add-button $('#addButton-' + id).bind('click', function(evt) { // dont submit evt.preventDefault(); evt.stopPropagation(); // add element add(); }); // bind click on delete-button $('.deleteButton-' + id).live('click', function(evt) { // dont submit evt.preventDefault(); evt.stopPropagation(); // remove element remove($(this).attr('rel')); }); // add an element function add() { blockSubmit = false; // init some vars var value = $('#addValue-' + id).val().replace(/^\s+|\s+$/g, ''); var inElements = false; // if multiple arguments aren't allowed, clear before adding if(!options.multiple) elements = []; // reset box $('#addValue-' + id).val('').focus(); $('#addButton-' + id).addClass('disabledButton'); // remove error message $('#errorMessage-'+ id).remove(); // only add new element if it isn't empty if(value != '') { // already in elements? for( var i in elements) { if(value == elements[i]) inElements = true; } // only add if not already in elements if(!inElements) { // add elements elements.push(value); // set new value $('#' + id).val(elements.join(options.splitChar)); // rebuild element list build(); } } } // build the list function build() { // init var var html = ''; // no items and message given? if(elements.length == 0 && options.emptyMessage != '') html = '<p class="helpTxt">' + options.emptyMessage + '</p>'; // items available else { // start html html = '<ul>'; // loop elements for( var i in elements) { html += ' <li><span><strong>' + elements[i] + '</strong>' + ' <a href="#" class="deleteButton-' + id + '" rel="' + elements[i] + '" title="' + options.removeLabel + '">' + options.removeLabel + '</a></span>' + ' </li>'; } // end html html += '</ul>'; } // set html $('#elementList-' + id).html(html); } // get all items function get() { // get chunks var chunks = $('#' + id).val().split(options.splitChar); var elements = []; // loop elements and trim them from spaces for( var i in chunks) { value = chunks[i].replace(/^\s+|\s+$/g, ''); if(value != '') elements.push(value); } return elements; } // remove an item function remove(value) { // get index for element var index = $.inArray(value, elements); // remove element if(index > -1) elements.splice(index, 1); // set new value $('#' + id).val(elements.join(options.splitChar)); // rebuild element list build(); } }); }; |
var value = $('#addValue-' + id).val().replace(/^\s+|\s+$/g, ''); | var value = $('#addValue-' + id).val().replace(/^\s+|\s+$/g, '').replace(options.splitChar, ''); | $.fn.tagBox = function(options) { // define defaults var defaults = { splitChar: ',', emptyMessage: '', errorMessage: 'Add the tag before submitting', addLabel: 'add', removeLabel: 'delete', autoCompleteUrl: '', canAddNew: false, showIconOnly: true, multiple: true }; // extend options var options = $.extend(defaults, options); // loop all elements return this.each(function() { // define some vars var id = $(this).attr('id'); var elements = get(); var blockSubmit = false; var timer = null; // reset label, so it points to the correct item $('label[for="' + id + '"]').attr('for', 'addValue-' + id); // bind submit $(this.form).submit(function(evt) { // hide before.. $('#errorMessage-'+ id).remove(); if(blockSubmit && $('#addValue-' + id).val().replace(/^\s+|\s+$/g, '') != '') { // show warning $($('#addValue-'+ id).parents('.oneLiner')).append('<span style="display: none;" id="errorMessage-'+ id +'" class="formError">'+ options.errorMessage +'</span>'); // clear other timers clearTimeout(timer); // we need the timeout otherwise the error is show every time the user presses enter in the tagbox timer = setTimeout(function() { $('#errorMessage-'+ id).show(); }, 200); } return !blockSubmit; }); // build replace html var html = '<div class="tagsWrapper">' + ' <div class="oneLiner">' + ' <p><input class="inputText dontSubmit" id="addValue-' + id + '" name="addValue-' + id + '" type="text" /></p>' + ' <div class="buttonHolder">' + ' <a href="#" id="addButton-' + id + '" class="button icon iconAdd disabledButton'; if(options.showIconOnly) html += ' iconOnly'; html += '">' + ' <span>' + options.addLabel + '</span>' + ' </a>' + ' </div>' + ' </div>' + ' <div id="elementList-' + id + '" class="tagList">' + ' </div>' + '</div>'; // hide current element $(this).css('visibility', 'hidden').css('position', 'absolute').css('top', '-9000px').css('left', '-9000px').attr('tabindex', '-1'); // prepend html $(this).before(html); // add elements list build(); // bind autocomplete if needed if(options.autoCompleteUrl != '') { $('#addValue-' + id).autocomplete({ delay: 200, minLength: 2, source: function(request, response) { $.ajax({ url: options.autoCompleteUrl, type: 'GET', data: 'term=' + request.term, success: function(data, textStatus) { // init var var realData = []; // alert the user if(data.code != 200 && jsBackend.debug) { alert(data.message); } if(data.code == 200) { for( var i in data.data) { realData.push({ label: data.data[i].name, value: data.data[i].name }); } } // set response response(realData); } }); } }); } // bind keypress on value-field $('#addValue-' + id).bind('keyup', function(evt) { blockSubmit = true; // grab code var code = evt.which; // remove error message $('#errorMessage-'+ id).remove(); // enter of splitchar should add an element if(code == 13 || String.fromCharCode(code) == options.splitChar) { // hide before.. $('#errorMessage-'+ id).remove(); // prevent default behaviour evt.preventDefault(); evt.stopPropagation(); // add element add(); } // disable or enable button if($(this).val().replace(/^\s+|\s+$/g, '') == '') { blockSubmit = false; $('#addButton-' + id).addClass('disabledButton'); } else $('#addButton-' + id).removeClass('disabledButton'); }); // bind click on add-button $('#addButton-' + id).bind('click', function(evt) { // dont submit evt.preventDefault(); evt.stopPropagation(); // add element add(); }); // bind click on delete-button $('.deleteButton-' + id).live('click', function(evt) { // dont submit evt.preventDefault(); evt.stopPropagation(); // remove element remove($(this).attr('rel')); }); // add an element function add() { blockSubmit = false; // init some vars var value = $('#addValue-' + id).val().replace(/^\s+|\s+$/g, ''); var inElements = false; // if multiple arguments aren't allowed, clear before adding if(!options.multiple) elements = []; // reset box $('#addValue-' + id).val('').focus(); $('#addButton-' + id).addClass('disabledButton'); // remove error message $('#errorMessage-'+ id).remove(); // only add new element if it isn't empty if(value != '') { // already in elements? for( var i in elements) { if(value == elements[i]) inElements = true; } // only add if not already in elements if(!inElements) { // add elements elements.push(value); // set new value $('#' + id).val(elements.join(options.splitChar)); // rebuild element list build(); } } } // build the list function build() { // init var var html = ''; // no items and message given? if(elements.length == 0 && options.emptyMessage != '') html = '<p class="helpTxt">' + options.emptyMessage + '</p>'; // items available else { // start html html = '<ul>'; // loop elements for( var i in elements) { html += ' <li><span><strong>' + elements[i] + '</strong>' + ' <a href="#" class="deleteButton-' + id + '" rel="' + elements[i] + '" title="' + options.removeLabel + '">' + options.removeLabel + '</a></span>' + ' </li>'; } // end html html += '</ul>'; } // set html $('#elementList-' + id).html(html); } // get all items function get() { // get chunks var chunks = $('#' + id).val().split(options.splitChar); var elements = []; // loop elements and trim them from spaces for( var i in chunks) { value = chunks[i].replace(/^\s+|\s+$/g, ''); if(value != '') elements.push(value); } return elements; } // remove an item function remove(value) { // get index for element var index = $.inArray(value, elements); // remove element if(index > -1) elements.splice(index, 1); // set new value $('#' + id).val(elements.join(options.splitChar)); // rebuild element list build(); } }); }; |
.css('top', '-9000px;') .css('left', '-9000px;') | .css('position', 'absolute') .css('top', '-9000px') .css('left', '-9000px') | $.fn.tagBox = function(options) { // define defaults var defaults = { splitChar: ',', emptyMessage: '', addLabel: 'add', removeLabel: 'delete', autoCompleteUrl: '', canAddNew: false }; // extend options var options = $.extend(defaults, options); // loop all elements return this.each(function() { // define some vars var id = $(this).attr('id'); var elements = get(); // build replace html var html = '<div class="tagsWrapper">'+ ' <div class="oneLiner">'+ ' <p><input class="inputText" id="addValue-'+ id +'" name="addValue-'+ id +'" type="text" /></p>'+ ' <div class="buttonHolder">'+ ' <a href="#" id="addButton-'+ id +'" class="button icon iconAdd iconOnly disabledButton">'+ ' <span><span><span>'+ options.addLabel +'</span></span></span>'+ ' </a>'+ ' </div>'+ ' </div>'+ ' <div id="elementList-'+ id +'" class="tagList">'+ ' </div>'+ '</div>'; // @todo hide current element $(this).css('visibility', 'hidden') .css('top', '-9000px;') .css('left', '-9000px;') .attr('tabindex', '-1'); // prepend html $(this).before(html); // add elements list build(); // bind autocomplete if needed if(options.autoCompleteUrl != '') { $('#addValue-'+ id).autocomplete(options.autoCompleteUrl, { minChars: 1, dataType: 'json', width: $('#addValue-'+ id).width(), parse: function(json) { // init vars var parsed = []; // validate json if(json.code != 200) return parsed; // only process if we have results if(json.data.length > 0) { // loop data for(i in json.data) { parsed[parsed.length] = { data: [json.data[i].name], value: json.data[i].value, result: json.data[i].name }; } } // return data return parsed; } }); } // bind keypress on value-field $('#addValue-'+ id).live('keypress', function(evt) { // grab code var code = (evt.which||evt.charCode||evt.keyCode); // enter of splitchar should add an element if(code == 13 || String.fromCharCode(code) == options.splitChar) { evt.preventDefault(); evt.stopPropagation(); // add element add(); } // disable or enable button if($(this).val().replace(/^\s+|\s+$/g, '') == '') $('#addButton-'+ id).addClass('disabledButton'); else $('#addButton-'+ id).removeClass('disabledButton'); }); // bind click on add-button $('#addButton-'+ id).live('click', function(evt) { // dont submit evt.preventDefault(); evt.stopPropagation(); // add element add(); }); // bind click on delete-button $('.deleteButton-'+ id).live('click', function(evt) { // dont submit evt.preventDefault(); evt.stopPropagation(); // remove element remove($(this).attr('rel')); }); // add an element function add() { // init some vars var value = $('#addValue-'+ id).val().replace(/^\s+|\s+$/g, ''); var inElements = false; // reset box $('#addValue-'+ id).val('').focus(); $('#addButton-'+ id).addClass('disabledButton'); // only add new element if it isn't empty if(value != '') { // already in elements? for(var i in elements) if(value == elements[i]) inElements = true; // only add if not already in elements if(!inElements) { // add elements elements.push(value); // set new value $('#'+ id).val(elements.join(options.splitChar)); // rebuild element list build(); } } } // build the list function build() { // init var var html = ''; // no items and message given? if(elements.length == 0 && options.emptyMessage != '') html = '<p class="helpTxt">'+ options.emptyMessage +'</p>'; // items available else { // start html html = '<ul>'; // loop elements for(var i in elements) { html += ' <li><span><strong>'+ elements[i] +'</strong>'+ ' <a href="#" class="deleteButton-'+ id +'" rel="'+ elements[i] +'" title="'+ options.removeLabel +'">'+ options.removeLabel +'</a></span>'+ ' </li>'; } // end html html += '</ul>'; } // set html $('#elementList-'+ id).html(html); } // get all items function get() { // get chunks var chunks = $('#'+ id).val().split(options.splitChar); var elements = []; // loop elements and trim them from spaces for(var i in chunks) { value = chunks[i].replace(/^\s+|\s+$/g,''); if(value != '') elements.push(value) } return elements; } // remove an item function remove(value) { // get index for element var index = elements.indexOf(value); // remove element if(index > -1) elements.splice(index, 1); // set new value $('#'+ id).val(elements.join(options.splitChar)); // rebuild element list build(); } }); }; |
' <p><input class="inputText" id="addValue-'+ id +'" type="text" /></p>'+ | ' <p><input class="inputText" id="addValue-'+ id +'" name="addValue-'+ id +'" type="text" /></p>'+ | $.fn.tagBox = function(options) { // define defaults var defaults = { splitChar: ',', emptyMessage: '', addLabel: 'add', removeLabel: 'delete', autoCompleteUrl: '', canAddNew: false }; // extend options var options = $.extend(defaults, options); // loop all elements return this.each(function() { // define some vars var id = $(this).attr('id'); var elements = get(); // build replace html var html = '<div class="tagsWrapper">'+ ' <div class="oneLiner">'+ ' <p><input class="inputText" id="addValue-'+ id +'" type="text" /></p>'+ ' <div class="buttonHolder">'+ ' <a href="#" id="addButton-'+ id +'" class="button icon iconAdd iconOnly disabledButton">'+ ' <span><span><span>'+ options.addLabel +'</span></span></span>'+ ' </a>'+ ' </div>'+ ' </div>'+ ' <div id="elementList-'+ id +'" class="tagList">'+ ' </div>'+ '</div>'; // hide current element $(this).hide() .attr('tabindex', '-1'); // prepend html $(this).before(html); // add elements list build(); // bind autocomplete if needed if(options.autoCompleteUrl != '') { $('#addValue-'+ id).autocomplete(options.autoCompleteUrl, { minChars: 1, dataType: 'json', width: $('#addValue-'+ id).width(), parse: function(json) { // init vars var parsed = []; // validate json if(json.code != 200) return parsed; // only process if we have results if(json.data.length > 0) { // loop data for(i in json.data) { parsed[parsed.length] = { data: [json.data[i].name], value: json.data[i].value, result: json.data[i].name }; } } // return data return parsed; } }); } // bind keypress on value-field $('#addValue-'+ id).live('keypress', function(evt) { // grab code var code = (evt.which||evt.charCode||evt.keyCode); // enter of splitchar should add an element if(code == 13 || String.fromCharCode(code) == options.splitChar) { evt.preventDefault(); evt.stopPropagation(); // add element add(); } // disable or enable button if($(this).val().replace(/^\s+|\s+$/g, '') == '') $('#addButton-'+ id).addClass('disabledButton'); else $('#addButton-'+ id).removeClass('disabledButton'); }); // bind click on add-button $('#addButton-'+ id).live('click', function(evt) { // dont submit evt.preventDefault(); evt.stopPropagation(); // add element add(); }); // bind click on delete-button $('.deleteButton-'+ id).live('click', function(evt) { // dont submit evt.preventDefault(); evt.stopPropagation(); // remove element remove($(this).attr('rel')); }); // add an element function add() { // init some vars var value = $('#addValue-'+ id).val().replace(/^\s+|\s+$/g, ''); var inElements = false; // reset box $('#addValue-'+ id).val('').focus(); $('#addButton-'+ id).addClass('disabledButton'); // only add new element if it isn't empty if(value != '') { // already in elements? for(var i in elements) if(value == elements[i]) inElements = true; // only add if not already in elements if(!inElements) { // add elements elements.push(value); // set new value $('#'+ id).val(elements.join(options.splitChar)); // rebuild element list build(); } } } // build the list function build() { // init var var html = ''; // no items and message given? if(elements.length == 0 && options.emptyMessage != '') html = '<p class="helpTxt">'+ options.emptyMessage +'</p>'; // items available else { // start html html = '<ul>'; // loop elements for(var i in elements) { html += ' <li><span><strong>'+ elements[i] +'</strong>'+ ' <a href="#" class="deleteButton-'+ id +'" rel="'+ elements[i] +'" title="'+ options.removeLabel +'">'+ options.removeLabel +'</a></span>'+ ' </li>'; } // end html html += '</ul>'; } // set html $('#elementList-'+ id).html(html); } // get all items function get() { // get chunks var chunks = $('#'+ id).val().split(options.splitChar); var elements = []; // loop elements and trim them from spaces for(var i in chunks) { value = chunks[i].replace(/^\s+|\s+$/g,''); if(value != '') elements.push(value) } return elements; } // remove an item function remove(value) { // get index for element var index = elements.indexOf(value); // remove element if(index > -1) elements.splice(index, 1); // set new value $('#'+ id).val(elements.join(options.splitChar)); // rebuild element list build(); } }); }; |
$(this).hide() | $(this).css('visibility', 'hidden') | $.fn.tagBox = function(options) { // define defaults var defaults = { splitChar: ',', emptyMessage: '', addLabel: 'add', removeLabel: 'delete', autoCompleteUrl: '', canAddNew: false }; // extend options var options = $.extend(defaults, options); // loop all elements return this.each(function() { // define some vars var id = $(this).attr('id'); var elements = get(); // build replace html var html = '<div class="tagsWrapper">'+ ' <div class="oneLiner">'+ ' <p><input class="inputText" id="addValue-'+ id +'" type="text" /></p>'+ ' <div class="buttonHolder">'+ ' <a href="#" id="addButton-'+ id +'" class="button icon iconAdd iconOnly disabledButton">'+ ' <span><span><span>'+ options.addLabel +'</span></span></span>'+ ' </a>'+ ' </div>'+ ' </div>'+ ' <div id="elementList-'+ id +'" class="tagList">'+ ' </div>'+ '</div>'; // hide current element $(this).hide() .attr('tabindex', '-1'); // prepend html $(this).before(html); // add elements list build(); // bind autocomplete if needed if(options.autoCompleteUrl != '') { $('#addValue-'+ id).autocomplete(options.autoCompleteUrl, { minChars: 1, dataType: 'json', width: $('#addValue-'+ id).width(), parse: function(json) { // init vars var parsed = []; // validate json if(json.code != 200) return parsed; // only process if we have results if(json.data.length > 0) { // loop data for(i in json.data) { parsed[parsed.length] = { data: [json.data[i].name], value: json.data[i].value, result: json.data[i].name }; } } // return data return parsed; } }); } // bind keypress on value-field $('#addValue-'+ id).live('keypress', function(evt) { // grab code var code = (evt.which||evt.charCode||evt.keyCode); // enter of splitchar should add an element if(code == 13 || String.fromCharCode(code) == options.splitChar) { evt.preventDefault(); evt.stopPropagation(); // add element add(); } // disable or enable button if($(this).val().replace(/^\s+|\s+$/g, '') == '') $('#addButton-'+ id).addClass('disabledButton'); else $('#addButton-'+ id).removeClass('disabledButton'); }); // bind click on add-button $('#addButton-'+ id).live('click', function(evt) { // dont submit evt.preventDefault(); evt.stopPropagation(); // add element add(); }); // bind click on delete-button $('.deleteButton-'+ id).live('click', function(evt) { // dont submit evt.preventDefault(); evt.stopPropagation(); // remove element remove($(this).attr('rel')); }); // add an element function add() { // init some vars var value = $('#addValue-'+ id).val().replace(/^\s+|\s+$/g, ''); var inElements = false; // reset box $('#addValue-'+ id).val('').focus(); $('#addButton-'+ id).addClass('disabledButton'); // only add new element if it isn't empty if(value != '') { // already in elements? for(var i in elements) if(value == elements[i]) inElements = true; // only add if not already in elements if(!inElements) { // add elements elements.push(value); // set new value $('#'+ id).val(elements.join(options.splitChar)); // rebuild element list build(); } } } // build the list function build() { // init var var html = ''; // no items and message given? if(elements.length == 0 && options.emptyMessage != '') html = '<p class="helpTxt">'+ options.emptyMessage +'</p>'; // items available else { // start html html = '<ul>'; // loop elements for(var i in elements) { html += ' <li><span><strong>'+ elements[i] +'</strong>'+ ' <a href="#" class="deleteButton-'+ id +'" rel="'+ elements[i] +'" title="'+ options.removeLabel +'">'+ options.removeLabel +'</a></span>'+ ' </li>'; } // end html html += '</ul>'; } // set html $('#elementList-'+ id).html(html); } // get all items function get() { // get chunks var chunks = $('#'+ id).val().split(options.splitChar); var elements = []; // loop elements and trim them from spaces for(var i in chunks) { value = chunks[i].replace(/^\s+|\s+$/g,''); if(value != '') elements.push(value) } return elements; } // remove an item function remove(value) { // get index for element var index = elements.indexOf(value); // remove element if(index > -1) elements.splice(index, 1); // set new value $('#'+ id).val(elements.join(options.splitChar)); // rebuild element list build(); } }); }; |
if($('#leftColumn input.tagBox').length > 0) { $('#leftColumn input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}', showIconOnly: false }); } | if($('#leftColumn input.tagBox, #tabTags input.tagBox').length > 0) { $('#leftColumn input.tagBox, #tabTags input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}', showIconOnly: false }); } | tagBoxes: function() { if($('#sidebar input.tagBox').length > 0) { $('#sidebar input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}' }); } if($('#leftColumn input.tagBox').length > 0) { $('#leftColumn input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}', showIconOnly: false }); } }, |
$('input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAddTag|ucfirst}', removeLabel: '{$lblDeleteTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete' }); | $('input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete' }); | tagBoxes: function() { if($('input.tagBox').length > 0) { $('input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAddTag|ucfirst}', removeLabel: '{$lblDeleteTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete' }); } }, |
if($('#sidebar input.tagBox').length > 0) { $('#sidebar input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}' }); } if($('#leftColumn input.tagBox, #tabTags input.tagBox').length > 0) { $('#leftColumn input.tagBox, #tabTags input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}', showIconOnly: false }); } | if($('#sidebar input.tagBox').length > 0) { $('#sidebar input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteThisTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}' }); } if($('#leftColumn input.tagBox, #tabTags input.tagBox').length > 0) { $('#leftColumn input.tagBox, #tabTags input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteThisTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}', showIconOnly: false }); } | tagBoxes: function() { if($('#sidebar input.tagBox').length > 0) { $('#sidebar input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}' }); } if($('#leftColumn input.tagBox, #tabTags input.tagBox').length > 0) { $('#leftColumn input.tagBox, #tabTags input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}', showIconOnly: false }); } }, |
if($('#sidebar input.tagBox').length > 0) { $('#sidebar input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteThisTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}' }); } if($('#leftColumn input.tagBox, #tabTags input.tagBox').length > 0) { $('#leftColumn input.tagBox, #tabTags input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteThisTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}', showIconOnly: false }); } | if($('#sidebar input.tagBox').length > 0) { $('#sidebar input.tagBox').tagBox({ emptyMessage: '{$msgNoTags|addslashes}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteThisTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}' }); } if($('#leftColumn input.tagBox, #tabTags input.tagBox').length > 0) { $('#leftColumn input.tagBox, #tabTags input.tagBox').tagBox({ emptyMessage: '{$msgNoTags|addslashes}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteThisTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}', showIconOnly: false }); } | tagBoxes: function() { if($('#sidebar input.tagBox').length > 0) { $('#sidebar input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteThisTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}' }); } if($('#leftColumn input.tagBox, #tabTags input.tagBox').length > 0) { $('#leftColumn input.tagBox, #tabTags input.tagBox').tagBox({ emptyMessage: '{$msgNoTags}', addLabel: '{$lblAdd|ucfirst}', removeLabel: '{$lblDeleteThisTag|ucfirst}', autoCompleteUrl: '/backend/ajax.php?module=tags&action=autocomplete&language={$LANGUAGE}', showIconOnly: false }); } }, |
console.log("tagTextArea:"+text); | function tagTextArea(text){ console.log("tagTextArea:"+text); // We don't want to tag all text boxen, especially if they are hidden var display = text.style.getPropertyCSSValue('display'); if (display && display.cssText=="none") { console.log(" invisible text box"); return; } // Also skip textareas we have already tagged var existing_id = text.getAttribute("edit_id"); if (existing_id) { console.log(" skipping tagged textarea:" +existing_id); return; } // Set attribute of text box so we can find it var edit_id = "eta_"+page_edit_id; text.setAttribute("edit_id", edit_id); text.addEventListener('focus', setFocused); // Add a clickable edit img to trigger edit events var image = document.createElement('img'); image.setAttribute("edit_id", edit_id); image.src = editImgURL; text.parentNode.insertBefore(image, text.nextSibling); image.addEventListener('click', editTextArea, false); // Inc page_edit_id = page_edit_id + 1;} |
|
console.log(" invisible text box"); | function tagTextArea(text){ console.log("tagTextArea:"+text); // We don't want to tag all text boxen, especially if they are hidden var display = text.style.getPropertyCSSValue('display'); if (display && display.cssText=="none") { console.log(" invisible text box"); return; } // Also skip textareas we have already tagged var existing_id = text.getAttribute("edit_id"); if (existing_id) { console.log(" skipping tagged textarea:" +existing_id); return; } // Set attribute of text box so we can find it var edit_id = "eta_"+page_edit_id; text.setAttribute("edit_id", edit_id); text.addEventListener('focus', setFocused); // Add a clickable edit img to trigger edit events var image = document.createElement('img'); image.setAttribute("edit_id", edit_id); image.src = editImgURL; text.parentNode.insertBefore(image, text.nextSibling); image.addEventListener('click', editTextArea, false); // Inc page_edit_id = page_edit_id + 1;} |
|
console.log(" skipping tagged textarea:" +existing_id); | function tagTextArea(text){ console.log("tagTextArea:"+text); // We don't want to tag all text boxen, especially if they are hidden var display = text.style.getPropertyCSSValue('display'); if (display && display.cssText=="none") { console.log(" invisible text box"); return; } // Also skip textareas we have already tagged var existing_id = text.getAttribute("edit_id"); if (existing_id) { console.log(" skipping tagged textarea:" +existing_id); return; } // Set attribute of text box so we can find it var edit_id = "eta_"+page_edit_id; text.setAttribute("edit_id", edit_id); text.addEventListener('focus', setFocused); // Add a clickable edit img to trigger edit events var image = document.createElement('img'); image.setAttribute("edit_id", edit_id); image.src = editImgURL; text.parentNode.insertBefore(image, text.nextSibling); image.addEventListener('click', editTextArea, false); // Inc page_edit_id = page_edit_id + 1;} |
|
else { interceptClickEvent = true; } | Tapestry.Initializer.tapxConfirm = function(spec) { var element = $(spec.clientId); var type = element.type; /* * This function is executed with "early" priority, so it gets to add its * own "click" handlers before others. Function that runs the dialog, and * invokes the proceed button if the user clicks "Yes" Otherwise, the (if * "No" or the modal dialog is closed), no further processing occurs. */ var runModalDialog = function(proceed) { var div = new Element('div', { className : 'mb-confirm' }).update(new Element('p').update(spec.message)); /* * Have to assign ids and reconnect at after load, because ModalBox * copies DOM elements, rather than moves them. */ var baseId = "mb-" + new Date().getTime(); var yesId = baseId + "-yes"; var noId = baseId + "-no"; var yesButton = new Element('button', { className : 'mb-yes-button', id : yesId }).update('Yes'); var noButton = new Element('button', { className : 'mb-no-button', id : noId }).update('No'); div.insert(yesButton).insert(noButton); Modalbox.show(div, { title : spec.title, afterLoad : function() { $(noId).observe("click", Modalbox.hide.bindAsEventListener(Modalbox)); $(yesId).observe("click", function(event) { event.stop(); Modalbox.hide(); proceed.defer(); }); } }); }; var interceptClickEvent = true; /* * Replace the normal click event, knowing that in most cases, the original * link or button has an Tapestry.ACTION_EVENT event handler to do its real * work. */ element.stopObserving("click"); function doAction() { if ($T(element).hasAction) { element.fire(Tapestry.ACTION_EVENT, event); return; } /* * Is it a submit element (i.e., it has a click() method)? Try that * next. */ if (element.click) { interceptClickEvent = false; element.click(); return; } /* * Not a zone update, so just do a full page refresh to the indicated * URL. */ window.location = element.href; } element.observe("click", function(event) { if (interceptClickEvent) { event.stop(); if ($(element).hasClassName('tx-disable-confirm')) { doAction(); return; } runModalDialog(doAction); } });}; |
|
$(yesId).observe("click", function() { | $(yesId).observe("click", function(event) { event.stop(); | Tapestry.Initializer.tapxConfirm = function(spec) { var element = $(spec.clientId); var type = element.type; /* * This function is executed with "early" priority, so it gets to add its * own "click" handlers before others. Function that runs the dialog, and * invokes the proceed button if the user clicks "Yes" Otherwise, the (if * "No" or the modal dialog is closed), no further processing occurs. */ var runModalDialog = function(proceed) { var div = new Element('div', { className : 'mb-confirm' }).update(new Element('p').update(spec.message)); /* * Have to assign ids and reconnect at after load, because ModalBox * copies DOM elements, rather than moves them. */ var baseId = "mb-" + new Date().getTime(); var yesId = baseId + "-yes"; var noId = baseId + "-no"; var yesButton = new Element('button', { className : 'mb-yes-button', id : yesId }).update('Yes'); var noButton = new Element('button', { className : 'mb-no-button', id : noId }).update('No'); div.insert(yesButton).insert(noButton); Modalbox.show(div, { title : spec.title, afterLoad : function() { $(noId).observe("click", Modalbox.hide.bindAsEventListener(Modalbox)); $(yesId).observe("click", function() { Modalbox.hide(); proceed.defer(); }); } }); }; var interceptClickEvent = true; /* * Replace the normal click event, knowing that in most cases, the original * link or button has an Tapestry.ACTION_EVENT event handler to do its real * work. */ element.stopObserving("click"); element.observe("click", function(event) { if (interceptClickEvent) { event.stop(); runModalDialog(function() { if ($T(element).hasAction) { element.fire(Tapestry.ACTION_EVENT, event); return; } /* * A submit element (i.e., it has a click() method)? Try that * next. */ if (element.click) { interceptClickEvent = false; element.click(); } /* * Not a zone updater, so just do a full page refresh to the * indicated URL. */ window.location = element.href; }); } });}; |
return; | Tapestry.Initializer.tapxConfirm = function(spec) { var element = $(spec.clientId); var type = element.type; /* * This function is executed with "early" priority, so it gets to add its * own "click" handlers before others. Function that runs the dialog, and * invokes the proceed button if the user clicks "Yes" Otherwise, the (if * "No" or the modal dialog is closed), no further processing occurs. */ var runModalDialog = function(proceed) { var div = new Element('div', { className : 'mb-confirm' }).update(new Element('p').update(spec.message)); /* * Have to assign ids and reconnect at after load, because ModalBox * copies DOM elements, rather than moves them. */ var baseId = "mb-" + new Date().getTime(); var yesId = baseId + "-yes"; var noId = baseId + "-no"; var yesButton = new Element('button', { className : 'mb-yes-button', id : yesId }).update('Yes'); var noButton = new Element('button', { className : 'mb-no-button', id : noId }).update('No'); div.insert(yesButton).insert(noButton); Modalbox.show(div, { title : spec.title, afterLoad : function() { $(noId).observe("click", Modalbox.hide.bindAsEventListener(Modalbox)); $(yesId).observe("click", function() { Modalbox.hide(); proceed.defer(); }); } }); }; var interceptClickEvent = true; /* * Replace the normal click event, knowing that in most cases, the original * link or button has an Tapestry.ACTION_EVENT event handler to do its real * work. */ element.stopObserving("click"); element.observe("click", function(event) { if (interceptClickEvent) { event.stop(); runModalDialog(function() { if ($T(element).hasAction) { element.fire(Tapestry.ACTION_EVENT, event); return; } /* * A submit element (i.e., it has a click() method)? Try that * next. */ if (element.click) { interceptClickEvent = false; element.click(); } /* * Not a zone updater, so just do a full page refresh to the * indicated URL. */ window.location = element.href; }); } });}; |
|
var runModalDialog = function(proceed) { var div = new Element('div', { className : 'mb-confirm' }).update(new Element('p').update(spec.message)); var baseId = "mb-" + new Date().getTime(); var yesId = baseId + "-yes"; var noId = baseId + "-no"; var yesButton = new Element('button', { className : 'mb-yes-button', id : yesId }).update('Yes'); var noButton = new Element('button', { className : 'mb-no-button', id : noId }).update('No'); div.insert(yesButton).insert(noButton); Modalbox.show(div, { title : spec.title, afterLoad : function() { $(noId).observe("click", Modalbox.hide.bindAsEventListener(Modalbox)); $(yesId).observe("click", function(event) { event.stop(); Modalbox.hide(); proceed.defer(); }); } }); }; | Tapestry.Initializer.tapxConfirm = function(spec) { var element = $(spec.clientId); var type = element.type; /* * This function is executed with "early" priority, so it gets to add its * own "click" handlers before others. Function that runs the dialog, and * invokes the proceed button if the user clicks "Yes" Otherwise, the (if * "No" or the modal dialog is closed), no further processing occurs. */ var runModalDialog = function(proceed) { var div = new Element('div', { className : 'mb-confirm' }).update(new Element('p').update(spec.message)); /* * Have to assign ids and reconnect at after load, because ModalBox * copies DOM elements, rather than moves them. */ var baseId = "mb-" + new Date().getTime(); var yesId = baseId + "-yes"; var noId = baseId + "-no"; var yesButton = new Element('button', { className : 'mb-yes-button', id : yesId }).update('Yes'); var noButton = new Element('button', { className : 'mb-no-button', id : noId }).update('No'); div.insert(yesButton).insert(noButton); Modalbox.show(div, { title : spec.title, afterLoad : function() { $(noId).observe("click", Modalbox.hide.bindAsEventListener(Modalbox)); $(yesId).observe("click", function(event) { event.stop(); Modalbox.hide(); proceed.defer(); }); } }); }; var interceptClickEvent = true; /* * Replace the normal click event, knowing that in most cases, the original * link or button has an Tapestry.ACTION_EVENT event handler to do its real * work. */ element.stopObserving("click"); function doAction() { if ($T(element).hasAction) { element.fire(Tapestry.ACTION_EVENT, event); return; } /* * Is it a submit element (i.e., it has a click() method)? Try that * next. */ if (element.click) { interceptClickEvent = false; element.click(); return; } /* * Not a zone update, so just do a full page refresh to the indicated * URL. */ window.location = element.href; } element.observe("click", function(event) { if (interceptClickEvent) { event.stop(); if ($(element).hasClassName('tx-disable-confirm')) { doAction(); return; } runModalDialog(doAction); } else { interceptClickEvent = true; } });}; |
|
runModalDialog(doAction); } else { | Tapx.runModalDialog(spec.title, spec.message, doAction); } else { | Tapestry.Initializer.tapxConfirm = function(spec) { var element = $(spec.clientId); var type = element.type; /* * This function is executed with "early" priority, so it gets to add its * own "click" handlers before others. Function that runs the dialog, and * invokes the proceed button if the user clicks "Yes" Otherwise, the (if * "No" or the modal dialog is closed), no further processing occurs. */ var runModalDialog = function(proceed) { var div = new Element('div', { className : 'mb-confirm' }).update(new Element('p').update(spec.message)); /* * Have to assign ids and reconnect at after load, because ModalBox * copies DOM elements, rather than moves them. */ var baseId = "mb-" + new Date().getTime(); var yesId = baseId + "-yes"; var noId = baseId + "-no"; var yesButton = new Element('button', { className : 'mb-yes-button', id : yesId }).update('Yes'); var noButton = new Element('button', { className : 'mb-no-button', id : noId }).update('No'); div.insert(yesButton).insert(noButton); Modalbox.show(div, { title : spec.title, afterLoad : function() { $(noId).observe("click", Modalbox.hide.bindAsEventListener(Modalbox)); $(yesId).observe("click", function(event) { event.stop(); Modalbox.hide(); proceed.defer(); }); } }); }; var interceptClickEvent = true; /* * Replace the normal click event, knowing that in most cases, the original * link or button has an Tapestry.ACTION_EVENT event handler to do its real * work. */ element.stopObserving("click"); function doAction() { if ($T(element).hasAction) { element.fire(Tapestry.ACTION_EVENT, event); return; } /* * Is it a submit element (i.e., it has a click() method)? Try that * next. */ if (element.click) { interceptClickEvent = false; element.click(); return; } /* * Not a zone update, so just do a full page refresh to the indicated * URL. */ window.location = element.href; } element.observe("click", function(event) { if (interceptClickEvent) { event.stop(); if ($(element).hasClassName('tx-disable-confirm')) { doAction(); return; } runModalDialog(doAction); } else { interceptClickEvent = true; } });}; |
g.px(a,"borderLeftWidth")-g.px(a,"borderRightWidth")-g.px(a.parentNode,"paddingLeft")-g.px(a.parentNode,"paddingRight");b=U(b,0);f=U(f,1E5);return l<b?b-1:l>f?f+1:a.style.styleFloat!=""?b-1:"auto"}else return"auto"};this.hide=function(a){g.getElement(a).style.display="none"};this.inline=function(a){g.getElement(a).style.display="inline"};this.block=function(a){g.getElement(a).style.display="block"};this.show=function(a){g.getElement(a).style.display=""};var z=null;this.firedTarget=null;this.target= function(a){return g.firedTarget||a.target||a.srcElement};var da=false;this.capture=function(a){W();if(!(z&&a)){z=a;var b=document.body;if(b.setCapture)a!=null?b.setCapture():b.releaseCapture();if(a!=null){$(b).addClass("unselectable");b.setAttribute("unselectable","on");b.onselectstart="return false;"}else{$(b).removeClass("unselectable");b.setAttribute("unselectable","off");b.onselectstart=""}}};this.checkReleaseCapture=function(a,b){z&&a==z&&b.type=="mouseup"&&this.capture(null)};this.getElementsByClassName= | "block"};this.show=function(a){g.getElement(a).style.display=""};var z=null;this.firedTarget=null;this.target=function(a){return g.firedTarget||a.target||a.srcElement};var da=false;this.capture=function(a){W();if(!(z&&a)){z=a;var b=document.body;if(b.setCapture)a!=null?b.setCapture():b.releaseCapture();if(a!=null){$(b).addClass("unselectable");b.setAttribute("unselectable","on");b.onselectstart="return false;"}else{$(b).removeClass("unselectable");b.setAttribute("unselectable","off");b.onselectstart= | g.px(a,"borderLeftWidth")-g.px(a,"borderRightWidth")-g.px(a.parentNode,"paddingLeft")-g.px(a.parentNode,"paddingRight");b=U(b,0);f=U(f,1E5);return l<b?b-1:l>f?f+1:a.style.styleFloat!=""?b-1:"auto"}else return"auto"};this.hide=function(a){g.getElement(a).style.display="none"};this.inline=function(a){g.getElement(a).style.display="inline"};this.block=function(a){g.getElement(a).style.display="block"};this.show=function(a){g.getElement(a).style.display=""};var z=null;this.firedTarget=null;this.target=function(a){return g.firedTarget||a.target||a.srcElement};var da=false;this.capture=function(a){W();if(!(z&&a)){z=a;var b=document.body;if(b.setCapture)a!=null?b.setCapture():b.releaseCapture();if(a!=null){$(b).addClass("unselectable");b.setAttribute("unselectable","on");b.onselectstart="return false;"}else{$(b).removeClass("unselectable");b.setAttribute("unselectable","off");b.onselectstart=""}}};this.checkReleaseCapture=function(a,b){z&&a==z&&b.type=="mouseup"&&this.capture(null)};this.getElementsByClassName= |
g.px(a,"borderRightWidth")-g.px(a.parentNode,"paddingLeft")-g.px(a.parentNode,"paddingRight");b=U(b,0);f=U(f,1E5);return l<b?b-1:l>f?f+1:a.style.styleFloat!=""?b-1:"auto"}else return"auto"};this.hide=function(a){g.getElement(a).style.display="none"};this.inline=function(a){g.getElement(a).style.display="inline"};this.block=function(a){g.getElement(a).style.display="block"};this.show=function(a){g.getElement(a).style.display=""};var z=null;this.firedTarget=null;this.target=function(a){return g.firedTarget|| a.target||a.srcElement};var P=false,da=false;this.capture=function(a){W();if(!(z&&a)){z=a;var b=document.body;if(b.setCapture)a!=null?b.setCapture():b.releaseCapture();if(a!=null){$(b).addClass("unselectable");b.setAttribute("unselectable","on");b.onselectstart="return false;"}else{$(b).removeClass("unselectable");b.setAttribute("unselectable","off");b.onselectstart=""}}};this.checkReleaseCapture=function(a,b){z&&a==z&&b.type=="mouseup"&&this.capture(null)};this.getElementsByClassName=function(a, | g.px(a,"borderLeftWidth")-g.px(a,"borderRightWidth")-g.px(a.parentNode,"paddingLeft")-g.px(a.parentNode,"paddingRight");b=U(b,0);f=U(f,1E5);return l<b?b-1:l>f?f+1:a.style.styleFloat!=""?b-1:"auto"}else return"auto"};this.hide=function(a){g.getElement(a).style.display="none"};this.inline=function(a){g.getElement(a).style.display="inline"};this.block=function(a){g.getElement(a).style.display="block"};this.show=function(a){g.getElement(a).style.display=""};var z=null;this.firedTarget=null;this.target= function(a){return g.firedTarget||a.target||a.srcElement};var da=false;this.capture=function(a){W();if(!(z&&a)){z=a;var b=document.body;if(b.setCapture)a!=null?b.setCapture():b.releaseCapture();if(a!=null){$(b).addClass("unselectable");b.setAttribute("unselectable","on");b.onselectstart="return false;"}else{$(b).removeClass("unselectable");b.setAttribute("unselectable","off");b.onselectstart=""}}};this.checkReleaseCapture=function(a,b){z&&a==z&&b.type=="mouseup"&&this.capture(null)};this.getElementsByClassName= | g.px(a,"borderRightWidth")-g.px(a.parentNode,"paddingLeft")-g.px(a.parentNode,"paddingRight");b=U(b,0);f=U(f,1E5);return l<b?b-1:l>f?f+1:a.style.styleFloat!=""?b-1:"auto"}else return"auto"};this.hide=function(a){g.getElement(a).style.display="none"};this.inline=function(a){g.getElement(a).style.display="inline"};this.block=function(a){g.getElement(a).style.display="block"};this.show=function(a){g.getElement(a).style.display=""};var z=null;this.firedTarget=null;this.target=function(a){return g.firedTarget||a.target||a.srcElement};var P=false,da=false;this.capture=function(a){W();if(!(z&&a)){z=a;var b=document.body;if(b.setCapture)a!=null?b.setCapture():b.releaseCapture();if(a!=null){$(b).addClass("unselectable");b.setAttribute("unselectable","on");b.onselectstart="return false;"}else{$(b).removeClass("unselectable");b.setAttribute("unselectable","off");b.onselectstart=""}}};this.checkReleaseCapture=function(a,b){z&&a==z&&b.type=="mouseup"&&this.capture(null)};this.getElementsByClassName=function(a, |
var lang = document.getElementById(objname+'_lang').value; | var dis = document.getElementById(objname+'_dis').value; var hl = document.getElementById(objname+'_hl').value; | function tc_setDay(objname, dvalue, path){ var obj = document.getElementById(objname); var date_array = obj.value.split("-"); //check if date is not allow to select if(!isDateAllow(objname, dvalue, date_array[1], date_array[0])){ alert(l_not_allowed); restoreDate(objname); }else{ if(isDate(dvalue, date_array[1], date_array[0])){ obj.value = date_array[0] + "-" + date_array[1] + "-" + dvalue; var obj = document.getElementById(objname+'_frame'); var year_start = document.getElementById(objname+'_year_start').value; var year_end = document.getElementById(objname+'_year_end').value; var dp = document.getElementById(objname+'_dp').value; var smon = document.getElementById(objname+'_mon').value; var da1 = document.getElementById(objname+'_da1').value; var da2 = document.getElementById(objname+'_da2').value; var sna = document.getElementById(objname+'_sna').value; var aut = document.getElementById(objname+'_aut').value; var frm = document.getElementById(objname+'_frm').value; var tar = document.getElementById(objname+'_tar').value; var inp = document.getElementById(objname+'_inp').value; var fmt = document.getElementById(objname+'_fmt').value; var lang = document.getElementById(objname+'_lang').value; obj.src = path+"calendar_form.php?objname="+objname.toString()+"&selected_day="+dvalue+"&selected_month="+date_array[1]+"&selected_year="+date_array[0]+"&year_start="+year_start+"&year_end="+year_end+"&dp="+dp+"&mon="+smon+"&da1="+da1+"&da2="+da2+"&sna="+sna+"&aut="+aut+"&frm="+frm+"&tar="+tar+"&inp="+inp+"&fmt="+fmt+"&lang="+lang; obj.contentWindow.submitNow(dvalue, date_array[1], date_array[0]); }else document.getElementById(objname+"_day").selectedIndex = date_array[2]; }} |
obj.src = path+"calendar_form.php?objname="+objname.toString()+"&selected_day="+dvalue+"&selected_month="+date_array[1]+"&selected_year="+date_array[0]+"&year_start="+year_start+"&year_end="+year_end+"&dp="+dp+"&mon="+smon+"&da1="+da1+"&da2="+da2+"&sna="+sna+"&aut="+aut+"&frm="+frm+"&tar="+tar+"&inp="+inp+"&fmt="+fmt+"&lang="+lang; | obj.src = path+"calendar_form.php?objname="+objname.toString()+"&selected_day="+dvalue+"&selected_month="+date_array[1]+"&selected_year="+date_array[0]+"&year_start="+year_start+"&year_end="+year_end+"&dp="+dp+"&mon="+smon+"&da1="+da1+"&da2="+da2+"&sna="+sna+"&aut="+aut+"&frm="+frm+"&tar="+tar+"&inp="+inp+"&fmt="+fmt+"&dis="+dis+"&hl="+hl; | function tc_setDay(objname, dvalue, path){ var obj = document.getElementById(objname); var date_array = obj.value.split("-"); //check if date is not allow to select if(!isDateAllow(objname, dvalue, date_array[1], date_array[0])){ alert(l_not_allowed); restoreDate(objname); }else{ if(isDate(dvalue, date_array[1], date_array[0])){ obj.value = date_array[0] + "-" + date_array[1] + "-" + dvalue; var obj = document.getElementById(objname+'_frame'); var year_start = document.getElementById(objname+'_year_start').value; var year_end = document.getElementById(objname+'_year_end').value; var dp = document.getElementById(objname+'_dp').value; var smon = document.getElementById(objname+'_mon').value; var da1 = document.getElementById(objname+'_da1').value; var da2 = document.getElementById(objname+'_da2').value; var sna = document.getElementById(objname+'_sna').value; var aut = document.getElementById(objname+'_aut').value; var frm = document.getElementById(objname+'_frm').value; var tar = document.getElementById(objname+'_tar').value; var inp = document.getElementById(objname+'_inp').value; var fmt = document.getElementById(objname+'_fmt').value; var lang = document.getElementById(objname+'_lang').value; obj.src = path+"calendar_form.php?objname="+objname.toString()+"&selected_day="+dvalue+"&selected_month="+date_array[1]+"&selected_year="+date_array[0]+"&year_start="+year_start+"&year_end="+year_end+"&dp="+dp+"&mon="+smon+"&da1="+da1+"&da2="+da2+"&sna="+sna+"&aut="+aut+"&frm="+frm+"&tar="+tar+"&inp="+inp+"&fmt="+fmt+"&lang="+lang; obj.contentWindow.submitNow(dvalue, date_array[1], date_array[0]); }else document.getElementById(objname+"_day").selectedIndex = date_array[2]; }} |
var lang = document.getElementById(objname+'_lang').value; | var dis = document.getElementById(objname+'_dis').value; var hl = document.getElementById(objname+'_hl').value; | function tc_setMonth(objname, mvalue, path){ var obj = document.getElementById(objname); var date_array = obj.value.split("-"); //check if date is not allow to select if(!isDateAllow(objname, date_array[2], mvalue, date_array[0])){ alert(l_not_allowed); restoreDate(objname); }else{ if(document.getElementById(objname+'_dp').value && document.getElementById(objname+'_inp').value){ //update 'day' combo box date_array[2] = tc_updateDay(objname, date_array[0], mvalue, date_array[2]); } if(isDate(date_array[2], mvalue, date_array[0])){ obj.value = date_array[0] + "-" + mvalue + "-" + date_array[2]; var obj = document.getElementById(objname+'_frame'); var year_start = document.getElementById(objname+'_year_start').value; var year_end = document.getElementById(objname+'_year_end').value; var dp = document.getElementById(objname+'_dp').value; var smon = document.getElementById(objname+'_mon').value; var da1 = document.getElementById(objname+'_da1').value; var da2 = document.getElementById(objname+'_da2').value; var sna = document.getElementById(objname+'_sna').value; var aut = document.getElementById(objname+'_aut').value; var frm = document.getElementById(objname+'_frm').value; var tar = document.getElementById(objname+'_tar').value; var inp = document.getElementById(objname+'_inp').value; var fmt = document.getElementById(objname+'_fmt').value; var lang = document.getElementById(objname+'_lang').value; obj.src = path+"calendar_form.php?objname="+objname.toString()+"&selected_day="+date_array[2]+"&selected_month="+mvalue+"&selected_year="+date_array[0]+"&year_start="+year_start+"&year_end="+year_end+"&dp="+dp+"&mon="+smon+"&da1="+da1+"&da2="+da2+"&sna="+sna+"&aut="+aut+"&frm="+frm+"&tar="+tar+"&inp="+inp+"&fmt="+fmt+"&lang="+lang; obj.contentWindow.submitNow(date_array[2], mvalue, date_array[0]); }else document.getElementById(objname+"_month").selectedIndex = date_array[1]; }} |
obj.src = path+"calendar_form.php?objname="+objname.toString()+"&selected_day="+date_array[2]+"&selected_month="+mvalue+"&selected_year="+date_array[0]+"&year_start="+year_start+"&year_end="+year_end+"&dp="+dp+"&mon="+smon+"&da1="+da1+"&da2="+da2+"&sna="+sna+"&aut="+aut+"&frm="+frm+"&tar="+tar+"&inp="+inp+"&fmt="+fmt+"&lang="+lang; | obj.src = path+"calendar_form.php?objname="+objname.toString()+"&selected_day="+date_array[2]+"&selected_month="+mvalue+"&selected_year="+date_array[0]+"&year_start="+year_start+"&year_end="+year_end+"&dp="+dp+"&mon="+smon+"&da1="+da1+"&da2="+da2+"&sna="+sna+"&aut="+aut+"&frm="+frm+"&tar="+tar+"&inp="+inp+"&fmt="+fmt+"&dis="+dis+"&hl="+hl; | function tc_setMonth(objname, mvalue, path){ var obj = document.getElementById(objname); var date_array = obj.value.split("-"); //check if date is not allow to select if(!isDateAllow(objname, date_array[2], mvalue, date_array[0])){ alert(l_not_allowed); restoreDate(objname); }else{ if(document.getElementById(objname+'_dp').value && document.getElementById(objname+'_inp').value){ //update 'day' combo box date_array[2] = tc_updateDay(objname, date_array[0], mvalue, date_array[2]); } if(isDate(date_array[2], mvalue, date_array[0])){ obj.value = date_array[0] + "-" + mvalue + "-" + date_array[2]; var obj = document.getElementById(objname+'_frame'); var year_start = document.getElementById(objname+'_year_start').value; var year_end = document.getElementById(objname+'_year_end').value; var dp = document.getElementById(objname+'_dp').value; var smon = document.getElementById(objname+'_mon').value; var da1 = document.getElementById(objname+'_da1').value; var da2 = document.getElementById(objname+'_da2').value; var sna = document.getElementById(objname+'_sna').value; var aut = document.getElementById(objname+'_aut').value; var frm = document.getElementById(objname+'_frm').value; var tar = document.getElementById(objname+'_tar').value; var inp = document.getElementById(objname+'_inp').value; var fmt = document.getElementById(objname+'_fmt').value; var lang = document.getElementById(objname+'_lang').value; obj.src = path+"calendar_form.php?objname="+objname.toString()+"&selected_day="+date_array[2]+"&selected_month="+mvalue+"&selected_year="+date_array[0]+"&year_start="+year_start+"&year_end="+year_end+"&dp="+dp+"&mon="+smon+"&da1="+da1+"&da2="+da2+"&sna="+sna+"&aut="+aut+"&frm="+frm+"&tar="+tar+"&inp="+inp+"&fmt="+fmt+"&lang="+lang; obj.contentWindow.submitNow(date_array[2], mvalue, date_array[0]); }else document.getElementById(objname+"_month").selectedIndex = date_array[1]; }} |
var lang = document.getElementById(objname+'_lang').value; | var dis = document.getElementById(objname+'_dis').value; var hl = document.getElementById(objname+'_hl').value; | function tc_setYear(objname, yvalue, path){ var obj = document.getElementById(objname); var date_array = obj.value.split("-"); //check if date is not allow to select if(!isDateAllow(objname, date_array[2], date_array[1], yvalue)){ alert(l_not_allowed); restoreDate(objname); }else{ if(document.getElementById(objname+'_dp').value && document.getElementById(objname+'_inp').value){ //update 'day' combo box date_array[2] = tc_updateDay(objname, yvalue, date_array[1], date_array[2]); } if(isDate(date_array[2], date_array[1], yvalue)){ obj.value = yvalue + "-" + date_array[1] + "-" + date_array[2]; var obj = document.getElementById(objname+'_frame'); var year_start = document.getElementById(objname+'_year_start').value; var year_end = document.getElementById(objname+'_year_end').value; var dp = document.getElementById(objname+'_dp').value; var smon = document.getElementById(objname+'_mon').value; var da1 = document.getElementById(objname+'_da1').value; var da2 = document.getElementById(objname+'_da2').value; var sna = document.getElementById(objname+'_sna').value; var aut = document.getElementById(objname+'_aut').value; var frm = document.getElementById(objname+'_frm').value; var tar = document.getElementById(objname+'_tar').value; var inp = document.getElementById(objname+'_inp').value; var fmt = document.getElementById(objname+'_fmt').value; var lang = document.getElementById(objname+'_lang').value; obj.src = path+"calendar_form.php?objname="+objname.toString()+"&selected_day="+date_array[2]+"&selected_month="+date_array[1]+"&selected_year="+yvalue+"&year_start="+year_start+"&year_end="+year_end+"&dp="+dp+"&mon="+smon+"&da1="+da1+"&da2="+da2+"&sna="+sna+"&aut="+aut+"&frm="+frm+"&tar="+tar+"&inp="+inp+"&fmt="+fmt+"&lang="+lang; obj.contentWindow.submitNow(date_array[2], date_array[1], yvalue); }else document.getElementById(objname+"_year").value = date_array[0]; }} |
obj.src = path+"calendar_form.php?objname="+objname.toString()+"&selected_day="+date_array[2]+"&selected_month="+date_array[1]+"&selected_year="+yvalue+"&year_start="+year_start+"&year_end="+year_end+"&dp="+dp+"&mon="+smon+"&da1="+da1+"&da2="+da2+"&sna="+sna+"&aut="+aut+"&frm="+frm+"&tar="+tar+"&inp="+inp+"&fmt="+fmt+"&lang="+lang; | obj.src = path+"calendar_form.php?objname="+objname.toString()+"&selected_day="+date_array[2]+"&selected_month="+date_array[1]+"&selected_year="+yvalue+"&year_start="+year_start+"&year_end="+year_end+"&dp="+dp+"&mon="+smon+"&da1="+da1+"&da2="+da2+"&sna="+sna+"&aut="+aut+"&frm="+frm+"&tar="+tar+"&inp="+inp+"&fmt="+fmt+"&dis="+dis+"&hl="+hl; | function tc_setYear(objname, yvalue, path){ var obj = document.getElementById(objname); var date_array = obj.value.split("-"); //check if date is not allow to select if(!isDateAllow(objname, date_array[2], date_array[1], yvalue)){ alert(l_not_allowed); restoreDate(objname); }else{ if(document.getElementById(objname+'_dp').value && document.getElementById(objname+'_inp').value){ //update 'day' combo box date_array[2] = tc_updateDay(objname, yvalue, date_array[1], date_array[2]); } if(isDate(date_array[2], date_array[1], yvalue)){ obj.value = yvalue + "-" + date_array[1] + "-" + date_array[2]; var obj = document.getElementById(objname+'_frame'); var year_start = document.getElementById(objname+'_year_start').value; var year_end = document.getElementById(objname+'_year_end').value; var dp = document.getElementById(objname+'_dp').value; var smon = document.getElementById(objname+'_mon').value; var da1 = document.getElementById(objname+'_da1').value; var da2 = document.getElementById(objname+'_da2').value; var sna = document.getElementById(objname+'_sna').value; var aut = document.getElementById(objname+'_aut').value; var frm = document.getElementById(objname+'_frm').value; var tar = document.getElementById(objname+'_tar').value; var inp = document.getElementById(objname+'_inp').value; var fmt = document.getElementById(objname+'_fmt').value; var lang = document.getElementById(objname+'_lang').value; obj.src = path+"calendar_form.php?objname="+objname.toString()+"&selected_day="+date_array[2]+"&selected_month="+date_array[1]+"&selected_year="+yvalue+"&year_start="+year_start+"&year_end="+year_end+"&dp="+dp+"&mon="+smon+"&da1="+da1+"&da2="+da2+"&sna="+sna+"&aut="+aut+"&frm="+frm+"&tar="+tar+"&inp="+inp+"&fmt="+fmt+"&lang="+lang; obj.contentWindow.submitNow(date_array[2], date_array[1], yvalue); }else document.getElementById(objname+"_year").value = date_array[0]; }} |
delimiter: ",", separator: ".", | delimiter: ".", separator: ",", | testCurrentWithCustomSettings: function() { with(this) { I18n.translations["en"] = { number: { currency: { format: { format: "%n %u", unit: "USD", delimiter: ",", separator: ".", precision: 2 } } } }; assertEqual("12,00 USD", I18n.toCurrency(12)); assertEqual("123,00 USD", I18n.toCurrency(123)); assertEqual("1.234,56 USD", I18n.toCurrency(1234.56)); }}, |
}}, | }} | testDefaultValueForPluralizeShouldNotBeUsedWhenScopeExist: function() { with(this) { options = {defaultValue: { none: "No things here!", one: "There is {{count}} thing here!", other: "There are {{count}} things here!" }}; assertEqual("You have no messages", I18n.pluralize(0, "inbox", options)); assertEqual("You have 1 message", I18n.pluralize(1, "inbox", options)); assertEqual("You have 5 messages", I18n.pluralize(5, "inbox", options)); }}, |
assertEqual("1,234,567.00", I18n.localize("number", 1234567)); | assertEqual("1,234,567.000", I18n.localize("number", 1234567)); | testLocalizeNumbers: function() { with(this) { assertEqual("1,234,567.00", I18n.localize("number", 1234567)); }}, |
assertEqual("1.00", I18n.toNumber(1, options)); assertEqual("12.00", I18n.toNumber(12, options)); assertEqual("123.00", I18n.toNumber(123, options)); assertEqual("1,234.00", I18n.toNumber(1234, options)); assertEqual("123,456.00", I18n.toNumber(123456, options)); assertEqual("1,234,567.00", I18n.toNumber(1234567, options)); assertEqual("12,345,678.00", I18n.toNumber(12345678, options)); | assertEqual("1,00", I18n.toNumber(1, options)); assertEqual("12,00", I18n.toNumber(12, options)); assertEqual("123,00", I18n.toNumber(123, options)); assertEqual("1.234,00", I18n.toNumber(1234, options)); assertEqual("123.456,00", I18n.toNumber(123456, options)); assertEqual("1.234.567,00", I18n.toNumber(1234567, options)); assertEqual("12.345.678,00", I18n.toNumber(12345678, options)); | testNumbersConsideringOptions: function() { with(this) { options = { precision: 2, separator: ",", delimiter: "." }; assertEqual("1.00", I18n.toNumber(1, options)); assertEqual("12.00", I18n.toNumber(12, options)); assertEqual("123.00", I18n.toNumber(123, options)); assertEqual("1,234.00", I18n.toNumber(1234, options)); assertEqual("123,456.00", I18n.toNumber(123456, options)); assertEqual("1,234,567.00", I18n.toNumber(1234567, options)); assertEqual("12,345,678.00", I18n.toNumber(12345678, options)); }}, |
options = {separator: ",", delimiter: "."}; | options = {separator: ".", delimiter: ","}; | testNumbersWithDifferentPrecisions: function() { with(this) { options = {separator: ",", delimiter: "."}; options["precision"] = 2; assertEqual("1.98", I18n.toNumber(1.98, options)); options["precision"] = 3; assertEqual("1.980", I18n.toNumber(1.98, options)); options["precision"] = 3; assertEqual("1.980", I18n.toNumber(1.98, options)); options["precision"] = 2; assertEqual("1.99", I18n.toNumber(1.987, options)); options["precision"] = 1; assertEqual("2.0", I18n.toNumber(1.98, options)); }}, |
options["precision"] = 3; assertEqual("1.980", I18n.toNumber(1.98, options)); | testNumbersWithDifferentPrecisions: function() { with(this) { options = {separator: ",", delimiter: "."}; options["precision"] = 2; assertEqual("1.98", I18n.toNumber(1.98, options)); options["precision"] = 3; assertEqual("1.980", I18n.toNumber(1.98, options)); options["precision"] = 3; assertEqual("1.980", I18n.toNumber(1.98, options)); options["precision"] = 2; assertEqual("1.99", I18n.toNumber(1.987, options)); options["precision"] = 1; assertEqual("2.0", I18n.toNumber(1.98, options)); }}, |
|
expected = new Date(Date.UTC(2010, 2, 3, 0, 43, 0)); assertEqual(expected.toString(), I18n.parseDate("2010-03-03T00:43:00+00:00").toString()); | testParseDate: function() { with(this) { expected = new Date(2009, 0, 24, 0, 0, 0); assertEqual(expected.toString(), I18n.parseDate("2009-01-24").toString()); expected = new Date(2009, 0, 24, 15, 33, 44); assertEqual(expected.toString(), I18n.parseDate("2009-01-24 15:33:44").toString()); expected = new Date(2009, 0, 24, 0, 0, 0); assertEqual(expected.toString(), I18n.parseDate(expected.getTime()).toString()); expected = new Date(2009, 0, 24, 0, 0, 0); assertEqual(expected.toString(), I18n.parseDate("01/24/2009").toString()); expected = new Date(2009, 0, 24, 14, 33, 55); assertEqual(expected.toString(), I18n.parseDate(expected).toString()); expected = new Date(2009, 0, 24, 15, 33, 44); assertEqual(expected.toString(), I18n.parseDate("2009-01-24T15:33:44").toString()); expected = new Date(Date.UTC(2009, 0, 24, 15, 33, 44)); assertEqual(expected.toString(), I18n.parseDate("2009-01-24T15:33:44Z").toString()); expected = new Date(Date.UTC(2010, 2, 3, 0, 43, 0)); assertEqual(expected.toString(), I18n.parseDate("2010-03-03T00:43:00+00:00").toString()); }}, |
|
expected = new Date(Date.UTC(2010, 2, 3, 0, 43, 0)); assertEqual(expected.toString(), I18n.parseDate("2010-03-03T00:43:00+00:00").toString()); | testParseDate: function() { with(this) { expected = new Date(2009, 0, 24, 0, 0, 0); assertEqual(expected.toString(), I18n.parseDate("2009-01-24").toString()); expected = new Date(2009, 0, 24, 15, 33, 44); assertEqual(expected.toString(), I18n.parseDate("2009-01-24 15:33:44").toString()); expected = new Date(2009, 0, 24, 0, 0, 0); assertEqual(expected.toString(), I18n.parseDate(expected.getTime()).toString()); expected = new Date(2009, 0, 24, 0, 0, 0); assertEqual(expected.toString(), I18n.parseDate("01/24/2009").toString()); expected = new Date(2009, 0, 24, 14, 33, 55); assertEqual(expected.toString(), I18n.parseDate(expected).toString()); expected = new Date(2009, 0, 24, 15, 33, 44); assertEqual(expected.toString(), I18n.parseDate("2009-01-24T15:33:44").toString()); expected = new Date(Date.UTC(2009, 0, 24, 15, 33, 44)); assertEqual(expected.toString(), I18n.parseDate("2009-01-24T15:33:44Z").toString()); }}, |
|
expected = new Date(2009, 0, 24, 0, 15, 0); assertEqual(expected.toString(), I18n.parseDate("2009-01-24 00:15:00").toString()); expected = new Date(2009, 0, 24, 0, 0, 15); assertEqual(expected.toString(), I18n.parseDate("2009-01-24 00:00:15").toString()); | testParseDate: function() { with(this) { expected = new Date(2009, 0, 24, 0, 0, 0); assertEqual(expected.toString(), I18n.parseDate("2009-01-24").toString()); expected = new Date(2009, 0, 24, 15, 33, 44); assertEqual(expected.toString(), I18n.parseDate("2009-01-24 15:33:44").toString()); expected = new Date(2009, 0, 24, 0, 0, 0); assertEqual(expected.toString(), I18n.parseDate(expected.getTime()).toString()); expected = new Date(2009, 0, 24, 0, 0, 0); assertEqual(expected.toString(), I18n.parseDate("01/24/2009").toString()); expected = new Date(2009, 0, 24, 14, 33, 55); assertEqual(expected.toString(), I18n.parseDate(expected).toString()); expected = new Date(2009, 0, 24, 15, 33, 44); assertEqual(expected.toString(), I18n.parseDate("2009-01-24T15:33:44").toString()); expected = new Date(Date.UTC(2009, 0, 24, 15, 33, 44)); assertEqual(expected.toString(), I18n.parseDate("2009-01-24T15:33:44Z").toString()); }}, |
|
assertEqual("1234%", I18n.toPercentage(1234, {delimiter: "", precision: 0})); | assertEqual("1_234%", I18n.toPercentage(1234, {delimiter: "_", precision: 0})); | testPercentageWithCustomOptions: function() { with(this) { assertEqual("1234%", I18n.toPercentage(1234, {delimiter: "", precision: 0})); }}, |
assertEqual("1,234.000%", I18n.toPercentage(1234)); | assertEqual("1234.000%", I18n.toPercentage(1234)); | testPercentageWithDefaults: function() { with(this) { assertEqual("1,234.000%", I18n.toPercentage(1234)); }}, |
}}, | }} | testPercentageWithTranslationAndCustomOptions: function() { with(this) { I18n.translations.en.number = { percentage: { format: { precision: 2, delimiter: ".", separator: "," } } } assertEqual("1-234+0000%", I18n.toPercentage(1234, {precision: 4, delimiter: "-", separator: "+"})); }}, |
}}, | }} | testReturnTranslationForCustomScopeSeparator: function() { with(this) { I18n.defaultSeparator = "•"; actual = I18n.translate("greetings•stranger"); assertEqual("Hello stranger!", actual); }}, |
a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, | "<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, | a:b+"></"+d+">"},F={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, |
_default:[0,"",""]};y.optgroup=y.option;y.tbody=y.tfoot=y.colgroup=y.caption=y.thead;y.th=y.td;if(!d.support.htmlSerialize)y._default=[1,"div<div>","</div>"];d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var e=d(this);return e.text(a.call(this,b,e.text()))});if(typeof a!=="object"&&a!==v)return this.empty().append((this[0]&&this[0].ownerDocument||r).createTextNode(a));return d.getText(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(e){d(this).wrapAll(a.call(this, | text: function(a){return "text"==a.type;}, | _default:[0,"",""]};y.optgroup=y.option;y.tbody=y.tfoot=y.colgroup=y.caption=y.thead;y.th=y.td;if(!d.support.htmlSerialize)y._default=[1,"div<div>","</div>"];d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var e=d(this);return e.text(a.call(this,b,e.text()))});if(typeof a!=="object"&&a!==v)return this.empty().append((this[0]&&this[0].ownerDocument||r).createTextNode(a));return d.getText(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(e){d(this).wrapAll(a.call(this, |
area:[1,"<map>","</map>"],_default:[0,"",""]};O.optgroup=O.option;O.tbody=O.tfoot=O.colgroup=O.caption=O.thead;O.th=O.td;if(!c.support.htmlSerialize)O._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==A)return this.empty().append((this[0]&&this[0].ownerDocument||u).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this, | "<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, | area:[1,"<map>","</map>"],_default:[0,"",""]};O.optgroup=O.option;O.tbody=O.tfoot=O.colgroup=O.caption=O.thead;O.th=O.td;if(!c.support.htmlSerialize)O._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==A)return this.empty().append((this[0]&&this[0].ownerDocument||u).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this, |
var p=null,q=null,r=[],s=o;while(s){if(s.type==1){if(!u.lastElement)u.lastElement=s;var t=s.getName();if(c&&s.$.scopeName!='HTML')t=s.$.scopeName.toLowerCase()+':'+t;if(!q){if(!p&&l[t])p=s;if(m[t])if(!p&&t=='div'&&!n(s))p=s;else q=s;}r.push(s);if(t=='body')break;}s=s.getParent();}u.block=p;u.blockLimit=q;u.elements=r;};})();d.elementPath.prototype={compare:function(l){var m=this.elements,n=l&&l.elements;if(!n||m.length!=n.length)return false;for(var o=0;o<m.length;o++){if(!m[o].equals(n[o]))return false;}return true;}};d.text=function(l,m){if(typeof l=='string')l=(m?m.$:document).createTextNode(l);this.$=l;};d.text.prototype=new d.node();e.extend(d.text.prototype,{type:3,getLength:function(){return this.$.nodeValue.length;},getText:function(){return this.$.nodeValue;},split:function(l){var q=this;if(c&&l==q.getLength()){var m=q.getDocument().createText('');m.insertAfter(q);return m;}var n=q.getDocument(),o=new d.text(q.$.splitText(l),n);if(b.ie8){var p=new d.text('',n);p.insertAfter(o);p.remove();}return o;},substring:function(l,m){if(typeof m!='number')return this.$.nodeValue.substr(l);else return this.$.nodeValue.substring(l,m);}});d.documentFragment=function(l){l=l||a.document;this.$=l.$.createDocumentFragment();};e.extend(d.documentFragment.prototype,h.prototype,{type:11,insertAfterNode:function(l){l=l.$;l.parentNode.insertBefore(this.$,l.nextSibling);}},true,{append:1,appendBogus:1,getFirst:1,getLast:1,appendTo:1,moveChildren:1,insertBefore:1,insertAfterNode:1,replace:1,trim:1,type:1,ltrim:1,rtrim:1,getDocument:1,getChildCount:1,getChild:1,getChildren:1});(function(){function l(t,u){if(this._.end)return null;var v,w=this.range,x,y=this.guard,z=this.type,A=t?'getPreviousSourceNode':'getNextSourceNode';if(!this._.start){this._.start=1;w.trim();if(w.collapsed){this.end();return null;}}if(!t&&!this._.guardLTR){var B=w.endContainer,C=B.getChild(w.endOffset);this._.guardLTR=function(G,H){return(!H||!B.equals(G))&&(!C||!G.equals(C))&&(G.type!=1||!H||G.getName()!='body');};}if(t&&!this._.guardRTL){var D=w.startContainer,E=w.startOffset>0&&D.getChild(w.startOffset-1);this._.guardRTL=function(G,H){return(!H||!D.equals(G))&&(!E||!G.equals(E))&&(G.type!=1||!H||G.getName()!='body');};}var F=t?this._.guardRTL:this._.guardLTR;if(y)x=function(G,H){if(F(G,H)===false)return false;return y(G,H);};else x=F;if(this.current)v=this.current[A](false,z,x);else if(t){v=w.endContainer;if(w.endOffset>0){v=v.getChild(w.endOffset-1);if(x(v)===false)v=null;}else v=x(v,true)===false?null:v.getPreviousSourceNode(true,z,x); | },onAttribute:function(q,r,s){var t=this._.attributes[r];if(t){var u=t.filter(s,q,this);if(u===false)return false;if(typeof u!='undefined')return u;}return s;}}});function l(q,r){for(var s=0;q&&s<r.length;s++){var t=r[s];q=q.replace(t[0],t[1]);}return q;};function m(q,r,s){if(typeof r=='function')r=[r];var t,u,v=q.length,w=r&&r.length;if(w){for(t=0;t<v&&q[t].pri<s;t++){}for(u=w-1;u>=0;u--){var x=r[u];if(x){x.pri=s;q.splice(t,0,x);}}}};function n(q,r,s){if(r)for(var t in r){var u=q[t];q[t]=o(u,r[t],s);if(!u)q.$length++;}};function o(q,r,s){if(r){r.pri=s;if(q){if(!q.splice){if(q.pri>s)q=[r,q];else q=[q,r];q.filter=p;}else m(q,r,s);return q;}else{r.filter=r;return r;}}};function p(q){var r=typeof q=='object';for(var s=0;s<this.length;s++){var t=this[s],u=t.apply(window,arguments);if(typeof u!='undefined'){if(u===false)return false;if(r&&u!=q)return u;}}return null;};})();a.htmlParser.basicWriter=e.createClass({$:function(){this._={output:[]};},proto:{openTag:function(l,m){this._.output.push('<',l);},openTagClose:function(l,m){if(m)this._.output.push(' />');else this._.output.push('>');},attribute:function(l,m){if(typeof m=='string')m=e.htmlEncodeAttr(m);this._.output.push(' ',l,'="',m,'"');},closeTag:function(l){this._.output.push('</',l,'>');},text:function(l){this._.output.push(l);},comment:function(l){this._.output.push('<!--',l,'-->');},write:function(l){this._.output.push(l);},reset:function(){this._.output=[];this._.indent=false;},getHtml:function(l){var m=this._.output.join('');if(l)this.reset();return m;}}});delete a.loadFullCore;a.instances={};a.document=new g(document);a.add=function(l){a.instances[l.name]=l;l.on('focus',function(){if(a.currentInstance!=l){a.currentInstance=l;a.fire('currentInstance');}});l.on('blur',function(){if(a.currentInstance==l){a.currentInstance=null;a.fire('currentInstance');}});};a.remove=function(l){delete a.instances[l.name];};a.TRISTATE_ON=1;a.TRISTATE_OFF=2;a.TRISTATE_DISABLED=0;d.comment=e.createClass({base:d.node,$:function(l,m){if(typeof l=='string')l=(m?m.$:document).createComment(l);this.base(l);},proto:{type:8,getOuterHtml:function(){return '<!--'+this.$.nodeValue+'-->';}}});(function(){var l={address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,dd:1},m={body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,caption:1,form:1},n=function(o){var p=o.getChildren();for(var q=0,r=p.count();q<r;q++){var s=p.getItem(q);if(s.type==1&&f.$block[s.getName()])return true;}return false;};d.elementPath=function(o){var u=this; | var p=null,q=null,r=[],s=o;while(s){if(s.type==1){if(!u.lastElement)u.lastElement=s;var t=s.getName();if(c&&s.$.scopeName!='HTML')t=s.$.scopeName.toLowerCase()+':'+t;if(!q){if(!p&&l[t])p=s;if(m[t])if(!p&&t=='div'&&!n(s))p=s;else q=s;}r.push(s);if(t=='body')break;}s=s.getParent();}u.block=p;u.blockLimit=q;u.elements=r;};})();d.elementPath.prototype={compare:function(l){var m=this.elements,n=l&&l.elements;if(!n||m.length!=n.length)return false;for(var o=0;o<m.length;o++){if(!m[o].equals(n[o]))return false;}return true;}};d.text=function(l,m){if(typeof l=='string')l=(m?m.$:document).createTextNode(l);this.$=l;};d.text.prototype=new d.node();e.extend(d.text.prototype,{type:3,getLength:function(){return this.$.nodeValue.length;},getText:function(){return this.$.nodeValue;},split:function(l){var q=this;if(c&&l==q.getLength()){var m=q.getDocument().createText('');m.insertAfter(q);return m;}var n=q.getDocument(),o=new d.text(q.$.splitText(l),n);if(b.ie8){var p=new d.text('',n);p.insertAfter(o);p.remove();}return o;},substring:function(l,m){if(typeof m!='number')return this.$.nodeValue.substr(l);else return this.$.nodeValue.substring(l,m);}});d.documentFragment=function(l){l=l||a.document;this.$=l.$.createDocumentFragment();};e.extend(d.documentFragment.prototype,h.prototype,{type:11,insertAfterNode:function(l){l=l.$;l.parentNode.insertBefore(this.$,l.nextSibling);}},true,{append:1,appendBogus:1,getFirst:1,getLast:1,appendTo:1,moveChildren:1,insertBefore:1,insertAfterNode:1,replace:1,trim:1,type:1,ltrim:1,rtrim:1,getDocument:1,getChildCount:1,getChild:1,getChildren:1});(function(){function l(t,u){if(this._.end)return null;var v,w=this.range,x,y=this.guard,z=this.type,A=t?'getPreviousSourceNode':'getNextSourceNode';if(!this._.start){this._.start=1;w.trim();if(w.collapsed){this.end();return null;}}if(!t&&!this._.guardLTR){var B=w.endContainer,C=B.getChild(w.endOffset);this._.guardLTR=function(G,H){return(!H||!B.equals(G))&&(!C||!G.equals(C))&&(G.type!=1||!H||G.getName()!='body');};}if(t&&!this._.guardRTL){var D=w.startContainer,E=w.startOffset>0&&D.getChild(w.startOffset-1);this._.guardRTL=function(G,H){return(!H||!D.equals(G))&&(!E||!G.equals(E))&&(G.type!=1||!H||G.getName()!='body');};}var F=t?this._.guardRTL:this._.guardLTR;if(y)x=function(G,H){if(F(G,H)===false)return false;return y(G,H);};else x=F;if(this.current)v=this.current[A](false,z,x);else if(t){v=w.endContainer;if(w.endOffset>0){v=v.getChild(w.endOffset-1);if(x(v)===false)v=null;}else v=x(v,true)===false?null:v.getPreviousSourceNode(true,z,x); |
console.log("textareas_message_handler: "+JSON.stringify(msg)); | function textareas_message_handler(msg, port) { console.log("textareas_message_handler: "+JSON.stringify(msg)); // What was the bidding? var cmd = msg.msg; if (cmd == "find_edit") { findActiveTextArea(); } else if (cmd == "update") { var id = msg.id; var content = msg.text; updateTextArea(id, content); } else { console.log("textareas_message_handler: un-handled message:"+cmd); }} |
|
this.updateEvents = function() { updateEvent(this.text, 'focus', this.focusListener); updateEvent(this.text, 'dblclick', this.dblclickListener); if (this.image) updateEvent(this.image, 'click', this.clickListener); } | function textAreaTracker(text){ this.edit_id = "eta_"+page_edit_id; page_edit_id = page_edit_id + 1; this.text = text; this.text.setAttribute("edit_id", this.edit_id); // The text areas event handlers we attach this.focusListener = setFocused; this.dblclickListener = function(){sendTextArea(this);}; this.keydownListener = function (e) { // Alt-Enter if (e.altKey && e.keyCode == 13) sendTextArea(this); }; this.text.addEventListener('focus', this.focusListener); if (enable_dblclick) this.text.addEventListener('dblclick', this.dblclickListener); if (enable_keys) this.text.addEventListener('keydown', this.keydownListener); // The img if (enable_button) { this.image = document.createElement('img'); this.image.style.cursor='pointer'; this.image.setAttribute("edit_id", this.edit_id); this.image.src = editImgURL; this.clickListener = editTextArea; this.image.addEventListener('click', this.clickListener, false); this.text.parentNode.insertBefore(this.image, text.nextSibling); } // The update function removes and re-adds events this.updateEvents = function() { updateEvent(this.text, 'focus', this.focusListener); updateEvent(this.text, 'dblclick', this.dblclickListener); if (this.image) updateEvent(this.image, 'click', this.clickListener); }} |
|
this.text.addEventListener('keydown', this.keydownListener); | function textAreaTracker(text){ this.edit_id = "eta_"+page_edit_id; page_edit_id = page_edit_id + 1; this.text = text; this.text.setAttribute("edit_id", this.edit_id); // The text areas event handlers we attach this.focusListener = setFocused; this.dblclickListener = function(){sendTextArea(this);}; this.text.addEventListener('focus', this.focusListener); this.text.addEventListener('dblclick', this.dblclickListener); // The img this.image = document.createElement('img'); this.image.style.cursor='pointer'; this.image.setAttribute("edit_id", this.edit_id); this.image.src = editImgURL; this.clickListener = editTextArea; this.image.addEventListener('click', this.clickListener, false); this.text.parentNode.insertBefore(this.image, text.nextSibling); // The update function removes and re-adds events this.updateEvents = function() { updateEvent(this.text, 'focus', this.focusListener); updateEvent(this.text, 'dblclick', this.dblclickListener); updateEvent(this.image, 'click', this.clickListener); }} |
|
console.error(msg+" at D:"+this.stack.length+" S:"+this.currentContext.step); | throwerror:function(msg) { $clear(this.timerid); console.error(msg+" at D:"+this.stack.length+" S:"+this.currentContext.step); this.whendone(false,msg); throw "NS terminating"; //need to throw in order not to return to calling function }.protect(), |
|
if (config.tabbrowser.mTabs.length > 1) config.tabbrowser.removeTab(tab); | if (config.tabbrowser.mTabs.length > 1 && !tab.hasAttribute("first-tab")) config.tabbrowser.closeTab(tab); | Thunderbird: function (tab) { if (config.tabbrowser.mTabs.length > 1) config.tabbrowser.removeTab(tab); else liberator.beep(); }, |
this.tilePoint = new GPoint((point.x % this.tileSize),(point.y % this.tileSize) ); } | this.tilePoint = new GPoint((point.x % this.tileSize),(point.y % this.tileSize) ); }; | Tile = function( iMap,iLatLng) { // The GM tiles are assumed to be quadratic. // All tiles have the same tile size. this.tileSize = iMap.getCurrentMapType().getTileSize(); this.width = this.tileSize; this.height = this.tileSize; this.map = iMap; this.zoom = iMap.getZoom(); this.latlng = iLatLng; this.tileCoordinates = null; this.currentProjection = iMap.getCurrentMapType().getProjection(); var tile = new GPoint(); var point = new GPoint(); point = this.currentProjection.fromLatLngToPixel( this.latlng,this.zoom); tile.x = Math.floor( point.x / this.tileSize); tile.y = Math.floor( point.y / this.tileSize); var boundspixels = tile.x * this.tileSize + " " + tile.y * this.tileSize + " " + (tile.x+1) * this.tileSize + " " + (tile.y+1) * this.tileSize; latlng1 = this.currentProjection.fromPixelToLatLng ( new GPoint(tile.x*this.tileSize, (tile.y+1)*this.tileSize), this.zoom); latlng2 = this.currentProjection.fromPixelToLatLng ( new GPoint((tile.x+1)*this.tileSize, tile.y*this.tileSize), this.zoom); this.tileCoordinates = latlng1.lng() + "," + latlng1.lat() + "," + latlng2.lng() + "," + latlng2.lat(); this.tilePoint = new GPoint((point.x % this.tileSize),(point.y % this.tileSize) );} |
obj.onclick(); | if (obj.onclick) obj.onclick(); | var tm = function() { var obj = WT.getElement(timerid); if (obj) { if (repeat) obj.timer = setTimeout(obj.tm, msec); else { obj.timer = null; obj.tm = null; } obj.onclick(); } }; |
if (!options) { options = { unit: "$", precision: 2, format: "%u%n", separator: ",", delimiter: "." }; } | options = options || { unit: "$", precision: 2, format: "%u%n", separator: ".", delimiter: "," }; | I18n.toCurrency = function(number) { var options = this.lookup("number.currency.format"); if (!options) { options = { unit: "$", precision: 2, format: "%u%n", separator: ",", delimiter: "." }; } // first, convert number number = this.toNumber(number, options); number = options["format"] .replace("%u", options["unit"]) .replace("%n", number); return number;}; |
var defaults = this.optionsWithDefaults({ | options = this.optionsWithDefaults(this.lookup("number.currency.format"), options); options = this.optionsWithDefaults(this.lookup("number.format"), options); options = this.optionsWithDefaults({ | I18n.toCurrency = function(number, options) { var defaults = this.optionsWithDefaults({ unit: "$", precision: 2, format: "%u%n" }, this.lookup("number.currency.format")); options = this.optionsWithDefaults(defaults, options); // first, convert number number = this.toNumber(number, options); number = options["format"] .replace("%u", options["unit"]) .replace("%n", number); return number;}; |
format: "%u%n" }, this.lookup("number.currency.format")); | format: "%u%n", delimiter: ",", separator: "." }, options); | I18n.toCurrency = function(number, options) { var defaults = this.optionsWithDefaults({ unit: "$", precision: 2, format: "%u%n" }, this.lookup("number.currency.format")); options = this.optionsWithDefaults(defaults, options); // first, convert number number = this.toNumber(number, options); number = options["format"] .replace("%u", options["unit"]) .replace("%n", number); return number;}; |
options = this.optionsWithDefaults(defaults, options); | I18n.toCurrency = function(number, options) { var defaults = this.optionsWithDefaults({ unit: "$", precision: 2, format: "%u%n" }, this.lookup("number.currency.format")); options = this.optionsWithDefaults(defaults, options); // first, convert number number = this.toNumber(number, options); number = options["format"] .replace("%u", options["unit"]) .replace("%n", number); return number;}; |
|
k.length-1)}else h.className=""}return this},toggleClass:function(a,b){var e=typeof a,g=typeof b==="boolean";if(d.isFunction(a))return this.each(function(h){var k=d(this);k.toggleClass(a.call(this,h,k.attr("class"),b),b)});return this.each(function(){if(e==="string")for(var h,k=0,l=d(this),q=b,p=a.split(W);h=p[k++];){q=g?q:!l.hasClass(h);l[q?"addClass":"removeClass"](h)}else if(e==="undefined"||e==="boolean"){this.className&&d.data(this,"__className__",this.className);this.className=this.className|| a===false?"":d.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,e=this.length;b<e;b++)if((" "+this[b].className+" ").replace(ia," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===v){var b=this[0];if(b){if(d.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(d.nodeName(b,"select")){var e=b.selectedIndex,g=[],h=b.options;b=b.type==="select-one";if(e<0)return null;var k=b?e:0;for(e=b?e+1:h.length;k<e;k++){var l=h[k];if(l.selected){a= | this[e];if(h.nodeType===1&&h.className)if(a){for(var k=(" "+h.className+" ").replace(ia," "),l=0,q=b.length;l<q;l++)k=k.replace(" "+b[l]+" "," ");h.className=k.substring(1,k.length-1)}else h.className=""}return this},toggleClass:function(a,b){var e=typeof a,f=typeof b==="boolean";if(c.isFunction(a))return this.each(function(h){var k=c(this);k.toggleClass(a.call(this,h,k.attr("class"),b),b)});return this.each(function(){if(e==="string")for(var h,k=0,l=c(this),q=b,p=a.split(W);h=p[k++];){q=f?q:!l.hasClass(h); l[q?"addClass":"removeClass"](h)}else if(e==="undefined"||e==="boolean"){this.className&&c.data(this,"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,e=this.length;b<e;b++)if((" "+this[b].className+" ").replace(ia," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===v){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b, | k.length-1)}else h.className=""}return this},toggleClass:function(a,b){var e=typeof a,g=typeof b==="boolean";if(d.isFunction(a))return this.each(function(h){var k=d(this);k.toggleClass(a.call(this,h,k.attr("class"),b),b)});return this.each(function(){if(e==="string")for(var h,k=0,l=d(this),q=b,p=a.split(W);h=p[k++];){q=g?q:!l.hasClass(h);l[q?"addClass":"removeClass"](h)}else if(e==="undefined"||e==="boolean"){this.className&&d.data(this,"__className__",this.className);this.className=this.className||a===false?"":d.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,e=this.length;b<e;b++)if((" "+this[b].className+" ").replace(ia," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===v){var b=this[0];if(b){if(d.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(d.nodeName(b,"select")){var e=b.selectedIndex,g=[],h=b.options;b=b.type==="select-one";if(e<0)return null;var k=b?e:0;for(e=b?e+1:h.length;k<e;k++){var l=h[k];if(l.selected){a= |
tokens.push({ type: 'quote', token: line.substring(start+1, i)}); | tokens.push({ type: 'quote', token: line.substring(start+1, i), start: start+1, end: i}); | this.tokenize = function(line, start, end) { // this returns all the tokens inside the passed string. A token is a punctuation mark, a string of digits, a string of letters. // Quoted strings are one token. // The type of token is returned: quote, alpha, number, punct var ret = this.getMeat(line, start, end); start = ret.start; end = ret.end; var tokens = []; var i; while (start < end) { if (line[start] === '"') { i = start+1; while (i < end && line[i] !== '"') i++; tokens.push({ type: 'quote', token: line.substring(start+1, i)}); i++; } else if ((line[start] >= 'A' && line[start] <= 'Z') || (line[start] >= 'a' && line[start] <= 'z')) { i = start+1; while (i < end && ((line[i] >= 'A' && line[i] <= 'Z') || (line[i] >= 'a' && line[i] <= 'z'))) i++; tokens.push({ type: 'alpha', token: line.substring(start, i)}); start = i + 1; } else if ((line[start] >= '0' && line[start] <= '9')) { i = start+1; while (i < end && line[i] >= '0' && line[i] <= '9') i++; tokens.push({ type: 'number', token: line.substring(start, i)}); start = i + 1; } else if (line[start] === ' ') { i = start+1; } else { tokens.push({ type: 'punct', token: line[start]}); i = start+1; } start = i; } return tokens; } |
} else if ((line[start] >= 'A' && line[start] <= 'Z') || (line[start] >= 'a' && line[start] <= 'z')) { | } else if (isLetter(line[start])) { | this.tokenize = function(line, start, end) { // this returns all the tokens inside the passed string. A token is a punctuation mark, a string of digits, a string of letters. // Quoted strings are one token. // The type of token is returned: quote, alpha, number, punct var ret = this.getMeat(line, start, end); start = ret.start; end = ret.end; var tokens = []; var i; while (start < end) { if (line[start] === '"') { i = start+1; while (i < end && line[i] !== '"') i++; tokens.push({ type: 'quote', token: line.substring(start+1, i)}); i++; } else if ((line[start] >= 'A' && line[start] <= 'Z') || (line[start] >= 'a' && line[start] <= 'z')) { i = start+1; while (i < end && ((line[i] >= 'A' && line[i] <= 'Z') || (line[i] >= 'a' && line[i] <= 'z'))) i++; tokens.push({ type: 'alpha', token: line.substring(start, i)}); start = i + 1; } else if ((line[start] >= '0' && line[start] <= '9')) { i = start+1; while (i < end && line[i] >= '0' && line[i] <= '9') i++; tokens.push({ type: 'number', token: line.substring(start, i)}); start = i + 1; } else if (line[start] === ' ') { i = start+1; } else { tokens.push({ type: 'punct', token: line[start]}); i = start+1; } start = i; } return tokens; } |
while (i < end && ((line[i] >= 'A' && line[i] <= 'Z') || (line[i] >= 'a' && line[i] <= 'z'))) i++; tokens.push({ type: 'alpha', token: line.substring(start, i)}); | while (i < end && isLetter(line[i])) i++; tokens.push({ type: 'alpha', token: line.substring(start, i), continueId: isNumber(line[i]), start: start, end: i}); | this.tokenize = function(line, start, end) { // this returns all the tokens inside the passed string. A token is a punctuation mark, a string of digits, a string of letters. // Quoted strings are one token. // The type of token is returned: quote, alpha, number, punct var ret = this.getMeat(line, start, end); start = ret.start; end = ret.end; var tokens = []; var i; while (start < end) { if (line[start] === '"') { i = start+1; while (i < end && line[i] !== '"') i++; tokens.push({ type: 'quote', token: line.substring(start+1, i)}); i++; } else if ((line[start] >= 'A' && line[start] <= 'Z') || (line[start] >= 'a' && line[start] <= 'z')) { i = start+1; while (i < end && ((line[i] >= 'A' && line[i] <= 'Z') || (line[i] >= 'a' && line[i] <= 'z'))) i++; tokens.push({ type: 'alpha', token: line.substring(start, i)}); start = i + 1; } else if ((line[start] >= '0' && line[start] <= '9')) { i = start+1; while (i < end && line[i] >= '0' && line[i] <= '9') i++; tokens.push({ type: 'number', token: line.substring(start, i)}); start = i + 1; } else if (line[start] === ' ') { i = start+1; } else { tokens.push({ type: 'punct', token: line[start]}); i = start+1; } start = i; } return tokens; } |
} else if ((line[start] >= '0' && line[start] <= '9')) { | } else if (isNumber(line[start])) { | this.tokenize = function(line, start, end) { // this returns all the tokens inside the passed string. A token is a punctuation mark, a string of digits, a string of letters. // Quoted strings are one token. // The type of token is returned: quote, alpha, number, punct var ret = this.getMeat(line, start, end); start = ret.start; end = ret.end; var tokens = []; var i; while (start < end) { if (line[start] === '"') { i = start+1; while (i < end && line[i] !== '"') i++; tokens.push({ type: 'quote', token: line.substring(start+1, i)}); i++; } else if ((line[start] >= 'A' && line[start] <= 'Z') || (line[start] >= 'a' && line[start] <= 'z')) { i = start+1; while (i < end && ((line[i] >= 'A' && line[i] <= 'Z') || (line[i] >= 'a' && line[i] <= 'z'))) i++; tokens.push({ type: 'alpha', token: line.substring(start, i)}); start = i + 1; } else if ((line[start] >= '0' && line[start] <= '9')) { i = start+1; while (i < end && line[i] >= '0' && line[i] <= '9') i++; tokens.push({ type: 'number', token: line.substring(start, i)}); start = i + 1; } else if (line[start] === ' ') { i = start+1; } else { tokens.push({ type: 'punct', token: line[start]}); i = start+1; } start = i; } return tokens; } |
while (i < end && line[i] >= '0' && line[i] <= '9') i++; tokens.push({ type: 'number', token: line.substring(start, i)}); | while (i < end && isNumber(line[i])) i++; tokens.push({ type: 'number', token: line.substring(start, i), continueId: isLetter(line[i]), start: start, end: i}); | this.tokenize = function(line, start, end) { // this returns all the tokens inside the passed string. A token is a punctuation mark, a string of digits, a string of letters. // Quoted strings are one token. // The type of token is returned: quote, alpha, number, punct var ret = this.getMeat(line, start, end); start = ret.start; end = ret.end; var tokens = []; var i; while (start < end) { if (line[start] === '"') { i = start+1; while (i < end && line[i] !== '"') i++; tokens.push({ type: 'quote', token: line.substring(start+1, i)}); i++; } else if ((line[start] >= 'A' && line[start] <= 'Z') || (line[start] >= 'a' && line[start] <= 'z')) { i = start+1; while (i < end && ((line[i] >= 'A' && line[i] <= 'Z') || (line[i] >= 'a' && line[i] <= 'z'))) i++; tokens.push({ type: 'alpha', token: line.substring(start, i)}); start = i + 1; } else if ((line[start] >= '0' && line[start] <= '9')) { i = start+1; while (i < end && line[i] >= '0' && line[i] <= '9') i++; tokens.push({ type: 'number', token: line.substring(start, i)}); start = i + 1; } else if (line[start] === ' ') { i = start+1; } else { tokens.push({ type: 'punct', token: line[start]}); i = start+1; } start = i; } return tokens; } |
tokens.push({ type: 'punct', token: line[start]}); | tokens.push({ type: 'punct', token: line[start], start: start, end: start+1}); | this.tokenize = function(line, start, end) { // this returns all the tokens inside the passed string. A token is a punctuation mark, a string of digits, a string of letters. // Quoted strings are one token. // The type of token is returned: quote, alpha, number, punct var ret = this.getMeat(line, start, end); start = ret.start; end = ret.end; var tokens = []; var i; while (start < end) { if (line[start] === '"') { i = start+1; while (i < end && line[i] !== '"') i++; tokens.push({ type: 'quote', token: line.substring(start+1, i)}); i++; } else if ((line[start] >= 'A' && line[start] <= 'Z') || (line[start] >= 'a' && line[start] <= 'z')) { i = start+1; while (i < end && ((line[i] >= 'A' && line[i] <= 'Z') || (line[i] >= 'a' && line[i] <= 'z'))) i++; tokens.push({ type: 'alpha', token: line.substring(start, i)}); start = i + 1; } else if ((line[start] >= '0' && line[start] <= '9')) { i = start+1; while (i < end && line[i] >= '0' && line[i] <= '9') i++; tokens.push({ type: 'number', token: line.substring(start, i)}); start = i + 1; } else if (line[start] === ' ') { i = start+1; } else { tokens.push({ type: 'punct', token: line[start]}); i = start+1; } start = i; } return tokens; } |
var ret = this.getMeat(line, start, end); start = ret.start; end = ret.end; var tokens = []; var i; while (start < end) { if (line[start] === '"') { i = start+1; while (i < end && line[i] !== '"') i++; tokens.push({ type: 'quote', token: line.substring(start+1, i), start: start+1, end: i}); i++; } else if (isLetter(line[start])) { i = start+1; while (i < end && isLetter(line[i])) i++; tokens.push({ type: 'alpha', token: line.substring(start, i), continueId: isNumber(line[i]), start: start, end: i}); start = i + 1; } else if (isNumber(line[start])) { i = start+1; while (i < end && isNumber(line[i])) i++; tokens.push({ type: 'number', token: line.substring(start, i), continueId: isLetter(line[i]), start: start, end: i}); start = i + 1; } else if (line[start] === ' ') { i = start+1; } else { tokens.push({ type: 'punct', token: line[start], start: start, end: start+1}); i = start+1; } start = i; | var ret = this.getMeat(line, start, end); start = ret.start; end = ret.end; var tokens = []; var i; while (start < end) { if (line[start] === '"') { i = start+1; while (i < end && line[i] !== '"') i++; tokens.push({ type: 'quote', token: line.substring(start+1, i), start: start+1, end: i}); i++; } else if (isLetter(line[start])) { i = start+1; while (i < end && isLetter(line[i])) i++; tokens.push({ type: 'alpha', token: line.substring(start, i), continueId: isNumber(line[i]), start: start, end: i}); start = i + 1; } else if (isNumber(line[start])) { i = start+1; while (i < end && isNumber(line[i])) i++; tokens.push({ type: 'number', token: line.substring(start, i), continueId: isLetter(line[i]), start: start, end: i}); start = i + 1; } else if (line[start] === ' ') { i = start+1; } else { tokens.push({ type: 'punct', token: line[start], start: start, end: start+1}); i = start+1; | this.tokenize = function(line, start, end) { // this returns all the tokens inside the passed string. A token is a punctuation mark, a string of digits, a string of letters. // Quoted strings are one token. // The type of token is returned: quote, alpha, number, punct var ret = this.getMeat(line, start, end); start = ret.start; end = ret.end; var tokens = []; var i; while (start < end) { if (line[start] === '"') { i = start+1; while (i < end && line[i] !== '"') i++; tokens.push({ type: 'quote', token: line.substring(start+1, i), start: start+1, end: i}); i++; } else if (isLetter(line[start])) { i = start+1; while (i < end && isLetter(line[i])) i++; tokens.push({ type: 'alpha', token: line.substring(start, i), continueId: isNumber(line[i]), start: start, end: i}); start = i + 1; } else if (isNumber(line[start])) { i = start+1; while (i < end && isNumber(line[i])) i++; tokens.push({ type: 'number', token: line.substring(start, i), continueId: isLetter(line[i]), start: start, end: i}); start = i + 1; } else if (line[start] === ' ') { i = start+1; } else { tokens.push({ type: 'punct', token: line[start], start: start, end: start+1}); i = start+1; } start = i; } return tokens; }; |
return tokens; }; | start = i; } return tokens; }; | this.tokenize = function(line, start, end) { // this returns all the tokens inside the passed string. A token is a punctuation mark, a string of digits, a string of letters. // Quoted strings are one token. // The type of token is returned: quote, alpha, number, punct var ret = this.getMeat(line, start, end); start = ret.start; end = ret.end; var tokens = []; var i; while (start < end) { if (line[start] === '"') { i = start+1; while (i < end && line[i] !== '"') i++; tokens.push({ type: 'quote', token: line.substring(start+1, i), start: start+1, end: i}); i++; } else if (isLetter(line[start])) { i = start+1; while (i < end && isLetter(line[i])) i++; tokens.push({ type: 'alpha', token: line.substring(start, i), continueId: isNumber(line[i]), start: start, end: i}); start = i + 1; } else if (isNumber(line[start])) { i = start+1; while (i < end && isNumber(line[i])) i++; tokens.push({ type: 'number', token: line.substring(start, i), continueId: isLetter(line[i]), start: start, end: i}); start = i + 1; } else if (line[start] === ' ') { i = start+1; } else { tokens.push({ type: 'punct', token: line[start], start: start, end: start+1}); i = start+1; } start = i; } return tokens; }; |
id: 'GM_config_field_' + id, | id: 'GM_config_field_' + id | toNode: function() { var field = this.settings, value = this.value, options = field.options, label = field.label, id = this.id, create = this.create; var retNode = create('div', { className: 'config_var', title: field.title || '' }); if (field.type != "hidden" || field.type != "button") retNode.appendChild(create('span', { textContent: label, className: 'field_label' })); switch (field.type) { case 'textarea': retNode.appendChild(create('textarea', { id: 'GM_config_field_' + this.id, innerHTML: value, cols: (field.cols ? field.cols : 20), rows: (field.rows ? field.rows : 2) })); break; case 'radio': var wrap = create('div', { id: 'GM_config_field_' + id, }); for (var i = 0, len = options.length; i < len; ++i) { wrap.appendChild(create('span', { textContent: options[i] })); wrap.appendChild(create('input', { value: options[i], type: 'radio', name: id, checked: options[i] == value ? true : false })); } retNode.appendChild(wrap); break; case 'select': var wrap = create('select', { id: 'GM_config_field_' + id, }); for (var i in options) wrap.appendChild(create('option', { textContent: options[i], value: i, selected: options[i] == value ? true : false })); retNode.appendChild(wrap); break; case 'checkbox': retNode.appendChild(create('input', { id: 'GM_config_field_' + id, type: 'checkbox', value: value, checked: value })); break; case 'button': var btn = create('input', { id: 'GM_config_field_' + id, type: 'button', value: label, size: (field.size ? field.size : 25), title: field.title || '' }); if (field.script) obj.addEvent(btn, 'click', field.script); retNode.appendChild(btn); break; case 'hidden': retNode.appendChild(create('input', { id: 'GM_config_field_' + id, type: 'hidden', value: value })); break; default: // type = text, int, or float retNode.appendChild(create('input', { id: 'GM_config_field_' + id, type: 'text', value: value, size: (field.size ? field.size : 25) })); } return retNode; }, |
id = this.id; | id = this.id, | toNode: function() { var field = this.settings, value = this.value, options = field.options, label = field.label, id = this.id; create = this.create; var retNode = create('div', { className: 'config_var', title: field.title || '' }); if (field.type != "hidden" || field.type != "button") retNode.appendChild(create('span', { textContent: label, className: 'field_label' })); switch (field.type) { case 'textarea': retNode.appendChild(create('textarea', { id: 'GM_config_field_' + this.id, innerHTML: value, cols: (field.cols ? field.cols : 20), rows: (field.rows ? field.rows : 2) })); break; case 'radio': var wrap = create('div', { id: 'GM_config_field_' + id, }); for (var i = 0, len = options.length; i < len; ++i) { wrap.appendChild(create('span', { textContent: options[i] })); wrap.appendChild(create('input', { value: options[i], type: 'radio', name: id, checked: options[i] == value ? true : false })); } retNode.appendChild(wrap); break; case 'select': var wrap = create('select', { id: 'GM_config_field_' + id, }); for (var i in options) wrap.appendChild(create('option', { textContent: options[i], value: i, selected: options[i] == value ? true : false })); retNode.appendChild(wrap); break; case 'checkbox': retNode.appendChild(create('input', { id: 'GM_config_field_' + id, type: 'checkbox', value: value, checked: value })); break; case 'button': var btn = create('input', { id: 'GM_config_field_' + id, type: 'button', value: label, size: (field.size ? field.size : 25), title: field.title || '' }); if (field.script) obj.addEvent(btn, 'click', field.script); retNode.appendChild(btn); break; case 'hidden': retNode.appendChild(create('input', { id: 'GM_config_field_' + id, type: 'hidden', value: value })); break; default: // type = text, int, or float retNode.appendChild(create('input', { id: 'GM_config_field_' + id, type: 'text', value: value, size: (field.size ? field.size : 25) })); } return retNode; }, |
precision: 2, separator: ',', delimiter: '.' } | precision: 3, separator: '.', delimiter: ',' }; | I18n.toNumber = function(number, options) { options = options || { precision: 2, separator: ',', delimiter: '.' } var string = number.toFixed(options["precision"]).toString(); var parts = string.split("."); number = parts[0]; var precision = parts[1]; var n = []; while (number.length > 0) { n.unshift(number.substr(Math.max(0, number.length - 3), 3)); number = number.substr(0, number.length -3); } return n.join(options["separator"]) + options["delimiter"] + parts[1];}; |
return n.join(options["separator"]) + options["delimiter"] + parts[1]; | return n.join(options["delimiter"]) + options["separator"] + parts[1]; | I18n.toNumber = function(number, options) { options = options || { precision: 2, separator: ',', delimiter: '.' } var string = number.toFixed(options["precision"]).toString(); var parts = string.split("."); number = parts[0]; var precision = parts[1]; var n = []; while (number.length > 0) { n.unshift(number.substr(Math.max(0, number.length - 3), 3)); number = number.substr(0, number.length -3); } return n.join(options["separator"]) + options["delimiter"] + parts[1];}; |
var defaults = this.optionsWithDefaults({ | options = this.optionsWithDefaults(this.lookup("number.format"), options); options = this.optionsWithDefaults({ | I18n.toNumber = function(number, options) { var defaults = this.optionsWithDefaults({ precision: 3, separator: '.', delimiter: ',' }, this.lookup("number.format")); options = this.optionsWithDefaults(defaults, options); var string = number.toFixed(options["precision"]).toString(); var parts = string.split("."); number = parts[0]; var precision = parts[1]; var n = []; while (number.length > 0) { n.unshift(number.substr(Math.max(0, number.length - 3), 3)); number = number.substr(0, number.length -3); } var formattedNumber = n.join(options["delimiter"]); if (options["precision"] > 0) { formattedNumber += options["separator"] + parts[1]; } return formattedNumber;}; |
}, this.lookup("number.format")); options = this.optionsWithDefaults(defaults, options); | }, options); | I18n.toNumber = function(number, options) { var defaults = this.optionsWithDefaults({ precision: 3, separator: '.', delimiter: ',' }, this.lookup("number.format")); options = this.optionsWithDefaults(defaults, options); var string = number.toFixed(options["precision"]).toString(); var parts = string.split("."); number = parts[0]; var precision = parts[1]; var n = []; while (number.length > 0) { n.unshift(number.substr(Math.max(0, number.length - 3), 3)); number = number.substr(0, number.length -3); } var formattedNumber = n.join(options["delimiter"]); if (options["precision"] > 0) { formattedNumber += options["separator"] + parts[1]; } return formattedNumber;}; |
var string = number.toFixed(options["precision"]).toString(); | var negative = number < 0; var string = Math.abs(number).toFixed(options["precision"]).toString(); | I18n.toNumber = function(number, options) { options = this.prepareOptions( options, this.lookup("number.format"), {precision: 3, separator: ".", delimiter: ","} ); var string = number.toFixed(options["precision"]).toString(); var parts = string.split("."); number = parts[0]; var precision = parts[1]; var n = []; while (number.length > 0) { n.unshift(number.substr(Math.max(0, number.length - 3), 3)); number = number.substr(0, number.length -3); } var formattedNumber = n.join(options["delimiter"]); if (options["precision"] > 0) { formattedNumber += options["separator"] + parts[1]; } return formattedNumber;}; |