Roxen.git / server / modules / js-support / scripts / roxen-all.min.js

version» Context lines:

Roxen.git/server/modules/js-support/scripts/roxen-all.min.js:1:   if("undefined"==typeof ROXEN||!ROXEN)var ROXEN={};   !function(){var e={array2object:function(e){for(var n={},r=0;r<e.length;r++)n[e[r]]=!0;return n},arrayUnique:function(e){return e.filter(function(n,r){return e.indexOf(n)===r})},indices:function(e){var n=[];for(var r in e)e.hasOwnProperty(r)&&n.push(r);return n},bind:function(e,n){return function(){return n.apply(e,arguments)}},clone:function(e){function n(){}return n.prototype=e,new n},deepCompare:function(e,n){if(e===n)return!0;if(!(e instanceof Object&&n instanceof Object))return!1;if(e.constructor!==n.constructor)return!1;for(var r in e)if(e.hasOwnProperty(r)){if(!n.hasOwnProperty(r))return!1;if(e[r]!==n[r]){if("object"!=typeof e[r])return!1;if(!deepCompare(e[r],n[r]))return!1}}for(r in n)if(n.hasOwnProperty(r)&&!e.hasOwnProperty(r))return!1;return!0},deepCopy:function(e){var n,r,t;if("[object Array]"===Object.prototype.toString.call(e)){for(n=[],t=e.length,r=0;r<t;r++)n[r]=arguments.callee(e[r]);return n}if(null===e)return null;if("object"==typeof e){n={};for(r in e)n[r]=arguments.callee(e[r]);return n}return e},createElement:function(e,n,r){var t=document.createElement(e);ROXEN.isString(n)&&YAHOO.util.Dom.addClass(t,n);for(var o in r)r.hasOwnProperty(o)&&t.setAttribute(o,r[o]);return t},createObject:function(e,n){for(var r={},t=0;t<e.length;t++)r[e[t]]=n[t];return r},createObjects:function(e,n){for(var r=[],t=0;t<n.length;t++)r.push(ROXEN.createObject(e,n[t]));return r},debugLog:function(e){ROXEN.AFS.call("debug-log",{message:e})},escape:function(e){return escape(e).replace(/\+/g,"%2B")},escapeURIComponent:function(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/\x27/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")},escapeHTML:function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\x27/g,"&apos;").replace(/\x22/g,"&quot;")},unescapeHTML:function(e){return e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&apos;/g,"'").replace(/&quot;/g,'"')},filter:function(e,n,r){for(var t=[],o=0;o<e.length;o++){var i=n.call(r,e[o],o,e);i&&t.push(e[o])}return t},dirname:function(e){if(!e||""===e)return"/";if("/"===e.charAt(e.length-1))return e;var n=e.split("/");return n.pop(),n.join("/")+"/"},basename:function(e){if(!e||""===e)return"";var n=e.lastIndexOf("/");return n>=0?e.substr(n+1):e},fromUTF8:function(e){return decodeURIComponent(escape(e))},generateId:function(){return YAHOO.util.Dom.generateId(null,"roxen-")},getISOTimeString:function(e){function n(e){return e<10?"0"+e:e}return ROXEN.isUndefined(e)&&(e=new Date),n(e.getUTCHours())+":"+n(e.getUTCMinutes())+":"+n(e.getUTCSeconds())},hasValue:function(e,n){for(var r=0;r<e.length;r++)if(n[e[r]])return!0;return!1},inArray:function(e,n){for(var r=0;r<e.length;r++)if(e[r]===n)return!0;return!1},log:function(){"undefined"!=typeof console&&console.log&&console.log.apply(console,ROXEN.formatLog(arguments))},info:function(){"undefined"!=typeof console&&console.info&&console.info.apply(console,ROXEN.formatLog(arguments))},warn:function(){"undefined"!=typeof console&&console.warn&&console.warn.apply(console,ROXEN.formatLog(arguments))},error:function(){"undefined"!=typeof console&&console.error&&console.error.apply(console,ROXEN.formatLog(arguments))},formatLog:function(e){return[ROXEN.getISOTimeString()+" test (UTC): "].concat(Array.prototype.slice.call(e))},isArray:YAHOO.lang.isArray,isBoolean:YAHOO.lang.isBoolean,isFunction:YAHOO.lang.isFunction,isNull:YAHOO.lang.isNull,isNumber:YAHOO.lang.isNumber,isObject:YAHOO.lang.isObject,isString:YAHOO.lang.isString,isUndefined:YAHOO.lang.isUndefined,isValue:YAHOO.lang.isValue,isUSASCII:function(e){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<32||r>126)return!1}return!0},ltrim:function(e){return e.replace(/^\s+/g,"")},map:function(e,n,r){for(var t=[],o=0;o<e.length;o++)t.push(n.call(r,e[o],o,e));return t},queryify:function(e){var n=["?"];for(var r in e)if(e.hasOwnProperty(r)&&!ROXEN.isUndefined(e[r]))if(n.length>1&&n.push("&"),n.push(r.toString()),n.push("="),ROXEN.isArray(e[r])){for(var t=[],o=0;o<e[r].length;o++)t.push(ROXEN.escapeURIComponent(e[r][o]));n.push(t.join(","))}else n.push(ROXEN.escapeURIComponent(e[r]));return n.join("")},getQueryVariable:function(e,n){var r=e.split("?");if(r.length<2)return!1;r=r[1];for(var t=r.split("&"),o=0;o<t.length;o++){var i=t[o].split("=");if(i[0]===n)return i[1]}return!1},rtrim:function(e){return e.replace(/\s+$/g,"")},toUTF8:function(e){return unescape(encodeURIComponent(e))},count_inflection:function(e,n,r,t){return 0===e&&t?t:1==e?n:r},trim:function(e){return e.replace(/^\s+|\s+$/g,"")},richtextToPlaintext:function(e){var n=document.createElement("div");e=e.replace(/<\/div>/gi," </div>"),e=e.replace(/<br/gi," <br"),n.innerHTML=e;var r=n.innerText||n.textContent;return r=r.replace(/\r\n/g,"\n"),ROXEN.trim(r)},typeOf:function(e){var n=typeof e;return"object"===n&&(e?ROXEN.isArray(e)&&(n="array"):n="null"),n},substitute:YAHOO.lang.substitute,debug:!1,logger:null,logger_visible:!0,toggle_logger:function(){this.logger_visible?(this.logger.hide(),this.logger_visible=!1):(this.logger.show(),this.logger_visible=!0)},weekStartsOnSunday:function(){var e=["us","cn","jp","ca","za","zw","ke","ph","tw","hk","mx","gt","sv","ni","cr","pa","co","ve","ec","pe","br","bo","cl","ar","il"],n=navigator.language.toLowerCase();if(n.length>=5){var r=n.substr(3,2);if(e.indexOf(r)>=0)return!0}return!1},shortDate:function(e){var n=new Date(1e3*e),r="en-US",t="%b %e, %Y";return YAHOO.util.Date.format(n,{format:t},r).replace(" "," ")},shortDateTime:function(e,n,r){var t;t="number"==typeof e?new Date(1e3*e):e;var o=new Date,i="",a="en-US",u="%b %e, %Y",c=r?"%l:%M %P":"%H:%M",l=31*(t.getMonth()+1)+t.getDate(),f=31*(o.getMonth()+1)+o.getDate();return t.getYear()!=o.getYear()?(i=u,n&&(i+=", "+c)):l<f-1||l>f?(i=u.replace(", %Y",""),i=i.replace(" %Y",""),i=i+", "+c):i=l==f-1?"yesterday, "+c:"today, "+c,YAHOO.util.Date.format(t,{format:i},a)}};e.escape=e.escapeURIComponent,YAHOO.lang.augmentObject(ROXEN,e)}();   Math.uuid=function(){var r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");return function(n,t){var a,o=r,i=[];if(t=t||o.length,n)for(a=0;a<n;a++)i[a]=o[0|Math.random()*t];else{var u;for(i[8]=i[13]=i[18]=i[23]="-",i[14]="4",a=0;a<36;a++)i[a]||(u=0|16*Math.random(),i[a]=o[19==a?3&u|8:15&u])}return i.join("")}}();   ROXEN.config=function(){var n=Math.uuid();return{session:n}}(); - ROXEN.AFS=function(){function e(e){var n=[],a={},t=!1;for(var r in e)if(e.hasOwnProperty(r)){var o=e[r];YAHOO.lang.isString(o)?n.push(r+"="+ROXEN.escapeURIComponent(o)):(a[r]=o,t=!0)}return t&&n.push("__afs="+ROXEN.escapeURIComponent(YAHOO.lang.JSON.stringify(a))),n.join("&")}function n(e){ROXEN.log("ROXEN.AFS: connection error: "+e.status+" "+e.statusText);for(var n=0;n<C.length;n++){var a=C[n];v>2&&ROXEN.log(" AFS calling error callback: "+a.name);try{a(e)}catch(t){if(ROXEN.log("AFS: error in callback "+a.name+": "+t),ROXEN.debug)throw t}}k={},w={},y&&(y=0,E(!0)),F=!1}function a(e){ROXEN.log("ROXEN.AFS: JSON parse error: "+e);for(var n=0;n<C.length;n++){var a=C[n];v>2&&ROXEN.log(" AFS calling error callback: "+a.name);try{a(e)}catch(t){if(ROXEN.log("AFS: error in callback "+a.name+": "+t),ROXEN.debug)throw t}}k={},w={},y&&(y=0,E(!0)),F=!1}function t(e){var n,t,r;if(r=e.getResponseHeader["Content-Type"],r&&!r.match(/application\/json/))return void a(new Error("ContentTypeError"));try{n=YAHOO.lang.JSON.parse(e.responseText)}catch(o){return void a(o)}n._etag=e.getResponseHeader.Etag||e.getResponseHeader.ETag;for(var l=0;l<n.length;l++){var i=n[l],c=i.tag;if(c){v&&ROXEN.log("AFS response: "+i.msg_type+", tag "+c);var s=k[c];if(t=s&&s[0],void 0===s)ROXEN.log("ROXEN.AFS: Warning: Got AFS response with unknown tag: "+i.msg_type);else if(t==-1)v>1&&ROXEN.log(" AFS tagged callback was canceled"),delete k[c];else{if(v>1&&ROXEN.log(" AFS calling tagged callback: "+t.name),ROXEN.debug)t(i);else try{t(i)}catch(o){ROXEN.log("AFS: error in callback "+t.name+": "+o)}delete k[c];var g=s[1];if(g){var O=w[g];O.splice(O.indexOf(c),1)}}}else v&&ROXEN.log("AFS response: "+i.msg_type);for(var u=0;u<T.length;u++){t=T[u],v>2&&ROXEN.log(" AFS calling global callback: "+t.name);try{t(i)}catch(o){if(ROXEN.log("AFS: error in callback "+t.name+": "+o),ROXEN.debug)throw o}}}y>0&&(y--,y||E(!1)),F=!0}function r(e,n,a,t,r){return i(e,"GET",n,0,a,t,r)}function o(e,n,a,t,r,o){ROXEN.isString(a)?(YAHOO.util.Connect.setForm(a),a=void 0):ROXEN.isObject(a)||(a={});var l=[];if(a){var c=0;for(var s in a)a.hasOwnProperty(s)&&(l[c++]=encodeURIComponent(s)+"="+encodeURIComponent(a[s]))}return i(e,"POST",n,l.join("&"),t,r)}function l(a,r,o,l,i,c){if(ROXEN.isObject(r)||(r={}),i&&(l=ROXEN.bind(i,l)),l){var s=++H+"";v&&ROXEN.log("AFS call: "+a+" "+YAHOO.lang.JSON.stringify(r)+", callback "+l.name+", tag "+s),r.tag=s,k[s]=[l,c]}else v&&ROXEN.log("AFS call: "+a+" "+YAHOO.lang.JSON.stringify(r));l&&c&&(w[c]||(w[c]=[]),w[c].push(r.tag)),r[b]=S,y++;for(var g=A+a+"?"+e(r),O=new FormData,u=0;u<o.length;u++)O.append("upload-file-"+u,o[u]);var f=new XMLHttpRequest;f.open("POST",g,!0),f.onreadystatechange=function(){4===f.readyState&&(200===f.status?t(f):(0===f.status||f.status>=400)&&n(f))},f.send(O)}function i(a,r,o,l,i,c,s){if(ROXEN.isObject(o)||(o={}),c&&(i=ROXEN.bind(c,i)),i){var g=++H+"";v&&ROXEN.log("AFS call: "+a+" "+YAHOO.lang.JSON.stringify(o)+", callback "+i.name+", tag "+g),o.tag=g,k[g]=[i,s]}else v&&ROXEN.log("AFS call: "+a+" "+YAHOO.lang.JSON.stringify(o));o[b]=S,y++;var O=A+a+"?"+e(o),u=YAHOO.util.Connect.asyncRequest(r,O,{cache:!1,success:t,failure:n},l);return i&&s&&(w[s]||(w[s]=[]),w[s].push(o.tag)),u}function c(e){var n=w[e];if(n){for(var a=0;a<n.length;a++)k[n[a]][0]=-1;delete w[e]}}function s(){return F}function g(e,n){return n&&(e=ROXEN.bind(n,e)),T.push(e),e}function O(e){for(var n=0;n<T.length;n++)if(T[n]===e){T.splice(n,1);break}}function u(e,n){return n&&(e=ROXEN.bind(n,e)),C.push(e),e}function f(e){for(var n=0;n<C.length;n++)if(C[n]===e){C.splice(n,1);break}}function R(e){h!=-1||ROXEN.isUndefined(e.poll_interval)||(_=e.poll_interval)}function E(e){if(h>=-1&&!d){var n=1e3*(e?m:_);v>2&&ROXEN.log("AFS poll delay "+n+" ms"),d=window.setTimeout(function(){d=void 0,r("poll",{timeout:h,interval:_},R)},n)}}function p(e){e&&(e.actions_prefix&&(A=e.actions_prefix),e.session_var&&(b=e.session_var),e.poll_timeout&&(h=e.poll_timeout)),v&&ROXEN.log("AFS init"),F=!1,y=0,k={},d&&(clearTimeout(d),d=void 0),h>=-1&&!y&&r("poll",{timeout:h,interval:_},R),Y=!0}function N(){return Y}function X(e,n,a){var t={cache:!1,success:function(e){n.call(a,e,"AFS_REQUEST_SUCCESS")},failure:function(e){ROXEN.log("ROXEN.AFS: connection error: "+e.status+" "+e.statusText),n.call(a,e,"AFS_REQUEST_FAILURE")}};return YAHOO.util.Connect.asyncRequest("GET",e,t)}var d,v=parseInt(ROXEN.getQueryVariable(window.location.href,"__afs-debug"),10),S=ROXEN.config.session,A="/actions/",b="session_id",h=-1,_=30,m=30,F=!1,y=0,k={},w={},H=0,T=[],C=[],Y=!1;return{call:r,post:o,post_files:l,abort:c,has_connection:s,add_global_callback:g,remove_global_callback:O,add_error_callback:u,remove_error_callback:f,init:p,initialized:N,request:X}}(); + ROXEN.AFS=function(){function e(e){var n=[],a={},t=!1;for(var r in e)if(e.hasOwnProperty(r)){var o=e[r];YAHOO.lang.isString(o)?n.push(r+"="+ROXEN.escapeURIComponent(o)):(a[r]=o,t=!0)}return t&&n.push("__afs="+ROXEN.escapeURIComponent(YAHOO.lang.JSON.stringify(a))),n.join("&")}function n(e){ROXEN.log("ROXEN.AFS: connection error: "+e.status+" "+e.statusText);for(var n=0;n<C.length;n++){var a=C[n];v>2&&ROXEN.log(" AFS calling error callback: "+a.name);try{a(e)}catch(t){if(ROXEN.log("AFS: error in callback "+a.name+": "+t),ROXEN.debug)throw t}}k={},w={},y&&(y=0,E(!0)),F=!1}function a(e){ROXEN.log("ROXEN.AFS: JSON parse error: "+e);for(var n=0;n<C.length;n++){var a=C[n];v>2&&ROXEN.log(" AFS calling error callback: "+a.name);try{a(e)}catch(t){if(ROXEN.log("AFS: error in callback "+a.name+": "+t),ROXEN.debug)throw t}}k={},w={},y&&(y=0,E(!0)),F=!1}function t(e){var n,t,r;if(r=e.getResponseHeader["Content-Type"],r&&!r.match(/application\/json/))return void a(new Error("ContentTypeError"));try{n=YAHOO.lang.JSON.parse(e.responseText)}catch(o){return void a(o)}n._etag=e.getResponseHeader.Etag||e.getResponseHeader.ETag;for(var l=0;l<n.length;l++){var i=n[l],c=i.tag;if(c){v&&ROXEN.log("AFS response: "+i.msg_type+", tag "+c);var s=k[c];if(t=s&&s[0],void 0===s)ROXEN.log("ROXEN.AFS: Warning: Got AFS response with unknown tag: "+i.msg_type);else if(t==-1)v>1&&ROXEN.log(" AFS tagged callback was canceled"),delete k[c];else{if(v>1&&ROXEN.log(" AFS calling tagged callback: "+t.name),ROXEN.debug)t(i);else try{t(i)}catch(o){ROXEN.log("AFS: error in callback "+t.name+": "+o)}delete k[c];var g=s[1];if(g){var O=w[g];O.splice(O.indexOf(c),1)}}}else v&&ROXEN.log("AFS response: "+i.msg_type);for(var u=0;u<T.length;u++){t=T[u],v>2&&ROXEN.log(" AFS calling global callback: "+t.name);try{t(i)}catch(o){if(ROXEN.log("AFS: error in callback "+t.name+": "+o),ROXEN.debug)throw o}}}y>0&&(y--,y||E(!1)),F=!0}function r(e,n,a,t,r){return i(e,"GET",n,0,a,t,r)}function o(e,n,a,t,r,o){ROXEN.isString(a)?(YAHOO.util.Connect.setForm(a),a=void 0):ROXEN.isObject(a)||(a={});var l=[];if(a){var c=0;for(var s in a)a.hasOwnProperty(s)&&(l[c++]=encodeURIComponent(s)+"="+encodeURIComponent(a[s]))}return i(e,"POST",n,l.join("&"),t,r)}function l(a,r,o,l,i,c){if(ROXEN.isObject(r)||(r={}),i&&(l=ROXEN.bind(i,l)),l){var s=++H+"";v&&ROXEN.log("AFS call: "+a+" "+YAHOO.lang.JSON.stringify(r)+", callback "+l.name+", tag "+s),r.tag=s,k[s]=[l,c]}else v&&ROXEN.log("AFS call: "+a+" "+YAHOO.lang.JSON.stringify(r));l&&c&&(w[c]||(w[c]=[]),w[c].push(r.tag)),r[b]=S,y++;for(var g=A+a+"?"+e(r),O=new FormData,u=0;u<o.length;u++)O.append("upload-file-"+u,o[u],o[u].name);var f=new XMLHttpRequest;f.open("POST",g,!0),f.onreadystatechange=function(){4===f.readyState&&(200===f.status?t(f):(0===f.status||f.status>=400)&&n(f))},f.send(O)}function i(a,r,o,l,i,c,s){if(ROXEN.isObject(o)||(o={}),c&&(i=ROXEN.bind(c,i)),i){var g=++H+"";v&&ROXEN.log("AFS call: "+a+" "+YAHOO.lang.JSON.stringify(o)+", callback "+i.name+", tag "+g),o.tag=g,k[g]=[i,s]}else v&&ROXEN.log("AFS call: "+a+" "+YAHOO.lang.JSON.stringify(o));o[b]=S,y++;var O=A+a+"?"+e(o),u=YAHOO.util.Connect.asyncRequest(r,O,{cache:!1,success:t,failure:n},l);return i&&s&&(w[s]||(w[s]=[]),w[s].push(o.tag)),u}function c(e){var n=w[e];if(n){for(var a=0;a<n.length;a++)k[n[a]][0]=-1;delete w[e]}}function s(){return F}function g(e,n){return n&&(e=ROXEN.bind(n,e)),T.push(e),e}function O(e){for(var n=0;n<T.length;n++)if(T[n]===e){T.splice(n,1);break}}function u(e,n){return n&&(e=ROXEN.bind(n,e)),C.push(e),e}function f(e){for(var n=0;n<C.length;n++)if(C[n]===e){C.splice(n,1);break}}function R(e){h!=-1||ROXEN.isUndefined(e.poll_interval)||(_=e.poll_interval)}function E(e){if(h>=-1&&!d){var n=1e3*(e?m:_);v>2&&ROXEN.log("AFS poll delay "+n+" ms"),d=window.setTimeout(function(){d=void 0,r("poll",{timeout:h,interval:_},R)},n)}}function p(e){e&&(e.actions_prefix&&(A=e.actions_prefix),e.session_var&&(b=e.session_var),e.poll_timeout&&(h=e.poll_timeout)),v&&ROXEN.log("AFS init"),F=!1,y=0,k={},d&&(clearTimeout(d),d=void 0),h>=-1&&!y&&r("poll",{timeout:h,interval:_},R),Y=!0}function N(){return Y}function X(e,n,a){var t={cache:!1,success:function(e){n.call(a,e,"AFS_REQUEST_SUCCESS")},failure:function(e){ROXEN.log("ROXEN.AFS: connection error: "+e.status+" "+e.statusText),n.call(a,e,"AFS_REQUEST_FAILURE")}};return YAHOO.util.Connect.asyncRequest("GET",e,t)}var d,v=parseInt(ROXEN.getQueryVariable(window.location.href,"__afs-debug"),10),S=ROXEN.config.session,A="/actions/",b="session_id",h=-1,_=30,m=30,F=!1,y=0,k={},w={},H=0,T=[],C=[],Y=!1;return{call:r,post:o,post_files:l,abort:c,has_connection:s,add_global_callback:g,remove_global_callback:O,add_error_callback:u,remove_error_callback:f,init:p,initialized:N,request:X}}();   !function(){ROXEN.run={},ROXEN.main=function(n){ROXEN.AFS.init(n)}}();   //# sourceMappingURL=roxen-all.min.js.map