source: trunk/prototype/app/plugins/view/jquerymx-1.0.custom.min.js @ 5136

Revision 5136, 8.2 KB checked in by wmerlotto, 12 years ago (diff)

Ticket #2305 - Enviando alteracoes, desenvolvidas internamente na Prognus, do modulo prototype.

Line 
1(function(i){var x=function(a){return a.replace(/^\/\//,"").replace(/[\/\.]/g,"_")},y=1,e,o,p;isDeferred=function(a){return a&&i.isFunction(a.always)};getDeferreds=function(a){var b=[];if(isDeferred(a))return[a];else for(var c in a)isDeferred(a[c])&&b.push(a[c]);return b};usefulPart=function(a){return i.isArray(a)&&a.length===3&&a[1]==="success"?a[0]:a};e=i.View=function(a,b,c,d){if(typeof c==="function"){d=c;c=undefined}var f=getDeferreds(b);if(f.length){var g=i.Deferred();f.push(p(a,true));i.when.apply(i,
2f).then(function(j){var k=i.makeArray(arguments),l=k.pop()[0];if(isDeferred(b))b=usefulPart(j);else for(var m in b)if(isDeferred(b[m]))b[m]=usefulPart(k.shift());k=l(b,c);g.resolve(k);d&&d(k)});return g.promise()}else{var h;f=typeof d==="function";g=p(a,f);if(f){h=g;g.done(function(j){d(j(b,c))})}else g.done(function(j){h=j(b,c)});return h}};o=function(a,b){if(!a.match(/[^\s]/))throw"$.View ERROR: There is no template or an empty template at "+b;};p=function(a,b){return i.ajax({url:a,dataType:"view",
3async:b})};i.ajaxTransport("view",function(a,b){a=b.url;var c=a.match(/\.[\w\d]+$/),d,f,g,h=a,j,k=function(l){l=d.renderer(g,l);if(e.cache)e.cached[g]=l;return{view:l}};if(f=document.getElementById(a))c=f.type.match(/\/[\d\w]+$/)[0].replace(/^\//,".");if(!c){c=e.ext;h+=e.ext}g=x(h);if(h.match(/^\/\//))h=typeof steal==="undefined"?"/"+h.substr(2):steal.root.join(h.substr(2));d=e.types[c];return{send:function(l,m){if(e.cached[g])return m(200,"success",{view:e.cached[g]});else if(f)m(200,"success",k(f.innerHTML));
4else j=i.ajax({async:b.async,url:h,dataType:"text",error:function(){o("",h);m(404)},success:function(s){o(s,h);m(200,"success",k(s))}})},abort:function(){j&&j.abort()}}});i.extend(e,{hookups:{},hookup:function(a){var b=++y;e.hookups[b]=a;return b},cached:{},cache:true,register:function(a){this.types["."+a.suffix]=a},types:{},ext:".ejs",registerScript:function(a,b,c){return"$.View.preload('"+b+"',"+e.types["."+a].script(b,c)+");"},preload:function(a,b){e.cached[a]=function(c,d){return b.call(c,c,d)}}});
5var t,n,u,v,w,q;t=function(a){var b=i.fn[a];i.fn[a]=function(){var c=i.makeArray(arguments),d,f,g=this;if(u(c)){if(d=v(c)){f=c[d];c[d]=function(h){n.call(g,[h],b);f.call(g,h)};e.apply(e,c);return this}c=e.apply(e,c);if(isDeferred(c)){c.done(function(h){n.call(g,[h],b)});return this}else c=[c]}return n.call(this,c,b)}};n=function(a,b){var c;for(var d in e.hookups)break;if(d){c=e.hookups;e.hookups={};a[0]=i(a[0])}b=b.apply(this,a);d&&w(a[0],c);return b};u=function(a){var b=typeof a[1];return typeof a[0]==
6"string"&&(b=="object"||b=="function")&&!a[1].nodeType&&!a[1].jquery};v=function(a){return typeof a[3]==="function"?3:typeof a[2]==="function"&&2};w=function(a,b){var c,d=0,f,g;a=a.filter(function(){return this.nodeType!=3});a=a.add("[data-view-id]",a);for(c=a.length;d<c;d++)if(a[d].getAttribute&&(f=a[d].getAttribute("data-view-id"))&&(g=b[f])){g(a[d],f);delete b[f];a[d].removeAttribute("data-view-id")}i.extend(e.hookups,b)};q=["prepend","append","after","before","text","html","replaceWith","val"];
7for(var r=0;r<q.length;r++)t(q[r])})(jQuery);
8(function(j){var g={undHash:/_|-/,colons:/::/,words:/([A-Z]+)([A-Z][a-z])/g,lowUp:/([a-z\d])([A-Z])/g,dash:/([a-z\d])([A-Z])/g,replacer:/\{([^\}]+)\}/g,dot:/\./},l=function(a,c,b){return a[c]||b&&(a[c]={})},m=function(a){return(a=typeof a)&&(a=="function"||a=="object")},n=function(a,c,b){a=a?a.split(g.dot):[];var f=a.length;c=j.isArray(c)?c:[c||window];var d,e,h,o=0;if(f==0)return c[0];for(;d=c[o++];){for(h=0;h<f-1&&m(d);h++)d=l(d,a[h],b);if(m(d)){e=l(d,a[h],b);if(e!==undefined){b===false&&delete d[a[h]];
9return e}}}},k=j.String=j.extend(j.String||{},{getObject:n,capitalize:function(a){return a.charAt(0).toUpperCase()+a.substr(1)},camelize:function(a){a=k.classize(a);return a.charAt(0).toLowerCase()+a.substr(1)},classize:function(a,c){a=a.split(g.undHash);for(var b=0;b<a.length;b++)a[b]=k.capitalize(a[b]);return a.join(c||"")},niceName:function(){k.classize(parts[i]," ")},underscore:function(a){return a.replace(g.colons,"/").replace(g.words,"$1_$2").replace(g.lowUp,"$1_$2").replace(g.dash,"_").toLowerCase()},
10sub:function(a,c,b){var f=[];f.push(a.replace(g.replacer,function(d,e){d=n(e,c,typeof b=="boolean"?!b:b);e=typeof d;if((e==="object"||e==="function")&&e!==null){f.push(d);return""}else return""+d}));return f.length<=1?f[0]:f}})})(jQuery);
11(function(f){f.String.rsplit=function(a,e){for(var b=e.exec(a),c=[],d;b!==null;){d=b.index;if(d!==0){c.push(a.substring(0,d));a=a.slice(d)}c.push(b[0]);a=a.slice(b[0].length);b=e.exec(a)}a!==""&&c.push(a);return c}})(jQuery);
12(function(g){var p=function(a){eval(a)},q=function(a){return a.substr(0,a.length-1)},l=g.String.rsplit,j=g.extend,r=g.isArray,m=function(a){return a.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')};escapeHTML=function(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&#34;").replace(/'/g,"&#39;")};EJS=function(a){if(this.constructor!=EJS){var b=new EJS(a);return function(c,e){return b.render(c,e)}}if(typeof a=="function"){this.template={};this.template.process=
13a}else{j(this,EJS.options,a);this.template=s(this.text,this.type,this.name)}};g.EJS=EJS;EJS.prototype={constructor:EJS,render:function(a,b){a=a||{};this._extra_helpers=b;b=new EJS.Helpers(a,b||{});return this.template.process.call(a,a,b)}};EJS.text=function(a){if(typeof a=="string")return a;if(a===null||a===undefined)return"";var b=a.hookup&&function(c,e){a.hookup.call(a,c,e)}||typeof a=="function"&&a||r(a)&&function(c,e){for(var d=0;d<a.length;d++)a[d].hookup?a[d].hookup(c,e):a[d](c,e)};if(b)return"data-view-id='"+
14g.View.hookup(b)+"'";return a.toString?a.toString():""};EJS.clean=function(a){return typeof a=="string"?escapeHTML(a):""};var n=function(a,b,c){b=l(b,/\n/);for(var e=0;e<b.length;e++)t(a,b[e],c)},t=function(a,b,c){a.lines++;b=l(b,a.splitter);for(var e,d=0;d<b.length;d++){e=b[d];e!==null&&c(e,a)}},u=function(a,b){var c={};j(c,{left:a+"%",right:"%"+b,dLeft:a+"%%",dRight:"%%"+b,eeLeft:a+"%==",eLeft:a+"%=",cmnt:a+"%#",cleanLeft:a+"%~",scan:n,lines:0});c.splitter=new RegExp("("+[c.dLeft,c.dRight,c.eeLeft,
15c.eLeft,c.cleanLeft,c.cmnt,c.left,c.right+"\n",c.right,"\n"].join(")|(").replace(/\[/g,"\\[").replace(/\]/g,"\\]")+")");return c},s=function(a,b,c){a=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n");b=b||"<";var e=new EJS.Buffer(["var ___v1ew = [];"],[]),d="",o=function(h){e.push("___v1ew.push(",'"',m(h),'");')},i=null,k=function(){d=""};n(u(b,b==="["?"]":">"),a||"",function(h,f){if(i===null)switch(h){case "\n":d+="\n";o(d);e.cr();k();break;case f.left:case f.eLeft:case f.eeLeft:case f.cleanLeft:case f.cmnt:i=
16h;d.length>0&&o(d);k();break;case f.dLeft:d+=f.left;break;default:d+=h;break}else switch(h){case f.right:switch(i){case f.left:if(d[d.length-1]=="\n"){d=q(d);e.push(d,";");e.cr()}else e.push(d,";");break;case f.cleanLeft:e.push("___v1ew.push(","(jQuery.EJS.clean(",d,")));");break;case f.eLeft:e.push("___v1ew.push(","(jQuery.EJS.text(",d,")));");break;case f.eeLeft:e.push("___v1ew.push(","(jQuery.EJS.text(",d,")));");break}i=null;k();break;case f.dRight:d+=f.right;break;default:d+=h;break}});d.length>
170&&e.push("___v1ew.push(",'"',m(d)+'");');a={out:"try { with(_VIEW) { with (_CONTEXT) {"+e.close()+" return ___v1ew.join('');}}}catch(e){e.lineNumber=null;throw e;}"};p.call(a,"this.process = (function(_CONTEXT,_VIEW){"+a.out+"});\r\n//@ sourceURL="+c+".js");return a};EJS.Buffer=function(a,b){this.line=[];this.script=[];this.post=b;this.push.apply(this,a)};EJS.Buffer.prototype={push:function(){this.line.push.apply(this.line,arguments)},cr:function(){this.script.push(this.line.join(""),"\n");this.line=
18[]},close:function(){if(this.line.length>0){this.script.push(this.line.join(""));this.line=[]}this.post.length&&this.push.apply(this,this.post);this.script.push(";");return this.script.join("")}};EJS.options={type:"<",ext:".ejs"};EJS.Helpers=function(a,b){this._data=a;this._extras=b;j(this,b)};EJS.Helpers.prototype={plugin:function(){var a=g.makeArray(arguments),b=a.shift();return function(c){c=g(c);c[b].apply(c,a)}},view:function(a,b,c){c=c||this._extras;b=b||this._data;return g.View(a,b,c)}};g.View.register({suffix:"ejs",
19script:function(a,b){return"jQuery.EJS(function(_CONTEXT,_VIEW) { "+(new EJS({text:b})).template.out+" })"},renderer:function(a,b){var c=new EJS({text:b,name:a});return function(e,d){return c.render.call(c,e,d)}}})})(jQuery);
Note: See TracBrowser for help on using the repository browser.