From 9f919c42f0885e39870195fab8ce2a22621119b7 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 4 Feb 2010 14:02:20 -0800 Subject: better handling of $invalidWidgets --- angular-minified.js | 154 ++++++++++++++++++++++++++-------------------------- 1 file changed, 77 insertions(+), 77 deletions(-) (limited to 'angular-minified.js') diff --git a/angular-minified.js b/angular-minified.js index dc0729d1..27f510c4 100644 --- a/angular-minified.js +++ b/angular-minified.js @@ -2,102 +2,102 @@ function K(){return function(){}}function P(o){return function(){return o}} (function(o,y){function n(){}function L(a,b,c){var d=o.console;switch(arguments.length){case 1:d.log(a);break;case 2:d.log(a,b);break;default:d.log(a,b,c);break}}function ba(a,b,c){var d=o.console;switch(arguments.length){case 1:d.error(a);break;case 2:d.error(a,b);break;default:d.error(a,b,c);break}}function ha(a,b){var c=y.createElement("div");c.className=a;for(var d=a="",e=0;e/g,">")}function Ja(a){if(!a||!a.replace)return a;return a.replace(//g,">").replace(/\"/g,""")}function Ka(a,b){if(!a)throw"Missing this";if(!_.isFunction(b))throw"Missing function";return function(){return b.apply(a,arguments)}}function ka(a){var b=y.createElement("div"); b.appendChild(a);var c=b.innerHTML;b.removeChild(a);return c}function W(a){var b=(""+a).toLowerCase();if(b=="f"||b=="0"||b=="false"||b=="no")a=false;return!!a}function X(a,b){for(var c in a){var d=b[c],e=typeof d;if(e=="undefined")b[c]=M(w(a[c]));else e=="object"&&d.constructor!=array&&c.substring(0,1)!="$"&&X(a[c],d)}}function la(a){this.location=a;this.delay=25;this.setTimeout=function(b,c){o.setTimeout(b,c)};this.Ea=function(b){return b};this.N=a.href}function La(){var a=k.fn;a.scope=function(){for(var b= -this;b&&b.get(0);){var c=b.data("scope");if(c)return c;b=b.parent()}return null};a.controller=function(){return this.data("controller")||R.Jb}}function Ma(a){if(a.Gc=="console"&&!Q){Q=y.createElement("div");Q.id="ng-console";y.getElementsByTagName("body")[0].appendChild(Q);L=function(){ha("ng-console-info",arguments)};console.error=function(){ha("ng-console-error",arguments)}}}function ca(a,b){var c={};p(b,function(d,e){c[e]=_(d).bind(a)});return c}function Na(a,b){var c=new ma(b.server,b.database), -d=new x(a[0],c,h,b.location,b);c=new S(a.find("body"),b.server,b.database);var e=b.database=="$MEMORY"?new da(o):new na(b.server,k.getScript);e=new oa(e,new Y(k(a.body)),function(){d.d()});var f=new pa(e,c),g="/data/"+b.database,h=new Z(function(l,q){e.P("POST",g,l,q)},f,d.anchor);d.k=h;d.Va.push(function(){h.V()});var i=new v({$anchor:d.anchor,$updateView:_(d.d).bind(d),$config:b,$console:o.console,$datastore:ca(h,{load:h.load,loadMany:h.la,loadOrCreate:h.Ha,loadAll:h.Ga,save:h.save,remove:h.remove, -flush:h.V,query:h.Qa,entity:h.G,entities:h.entities,documentCountsByUser:h.xb,userDocumentIdsByEntity:h.sc,join:h.join}),$save:function(l){h.lc(i.w,l,d.anchor)},$window:o,$uid:function(){return""+(new Date).getTime()},$users:f},"ROOT");a.data("scope",i);d.G(i);d.compile();c.bind();(new A(a)).bind();var j=_(ca(i,{updateView:i.d,set:i.h,get:i.get,eval:i.eval})).extend({init:function(){b.location.listen(_(d.fc).bind(d));d.Na();d.Db();d.d();return j},element:a[0],config:b});return j}function G(a,b,c){var d= -_.last(b);p(c,function(e){d[e]=_[e]});m[a]=m[a]||{};p(b,function(e){B(m[a],e)})}function x(a,b,c,d,e){this.F=a;this.location=d;this.k=c;this.anchor={};this.xc=b;this.rb=e||{};this.Va=[]}function S(a,b,c){this.eb=a;this.ea=b;this.ja=c;this.ib=o;this.H=[]}function Z(a,b,c){this.post=a;this.Xa=b;this.K=[];this.fa={$collections:this.K};this.anchor=c;this.R=[]}function T(a,b){return{format:a,parse:b||a}}function qa(a){return""+a}function w(a,b){var c=[];ea(c,a,b?"\n ":null,_([]));return c.join("")}function M(a){try{var b= -new E(a,true),c=b.ca();b.L();return c()}catch(d){ba("fromJson error: ",a,d);throw d;}}function ea(a,b,c,d){if(typeof b=="object"){if(d.include(b)){a.push("RECURSION");return}d.push(b)}var e=typeof b;if(b===null)a.push("null");else if(e==="function")return;else if(e==="boolean")a.push(""+b);else if(e==="number")isNaN(b)?a.push("null"):a.push(""+b);else if(e==="string")return a.push(m.String.quoteUnicode(b));else if(e==="object")if(b instanceof Array){a.push("[");var f=b.length;e=false;for(var g=0;g< -f;g++){var h=b[g];e&&a.push(",");typeof h=="function"||typeof h=="undefined"?a.push("null"):ea(a,h,c,d);e=true}a.push("]")}else if(b instanceof Date)a.push(m.String.quoteUnicode(m.Date.toString(b)));else{a.push("{");c&&a.push(c);e=false;g=c?c+" ":false;h=[];for(var i in b)i.indexOf("$$")!==0&&h.push(i);h.sort();for(i=0;i>2;c=(c&3)<<4|d>>4;g=(d&15)<<2|e>>6;h=e&63;if(isNaN(d))g=h=64;else if(isNaN(e))h=64;b=b+this.B.charAt(f)+this.B.charAt(c)+this.B.charAt(g)+this.B.charAt(h)}return b},Hc:function(a){var b="",c,d,e,f,g,h=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");h>4;d=(d&15)<<4|f>>2;e=(f&3)<<6| +this;b&&b.get(0);){var c=b.data("scope");if(c)return c;b=b.parent()}return null};a.controller=function(){return this.data("controller")||R.Kb}}function Ma(a){if(a.Hc=="console"&&!Q){Q=y.createElement("div");Q.id="ng-console";y.getElementsByTagName("body")[0].appendChild(Q);L=function(){ha("ng-console-info",arguments)};console.error=function(){ha("ng-console-error",arguments)}}}function ca(a,b){var c={};p(b,function(d,e){c[e]=_(d).bind(a)});return c}function Na(a,b){var c=new ma(b.server,b.database), +d=new x(a[0],c,h,b.location,b);c=new S(a.find("body"),b.server,b.database);var e=b.database=="$MEMORY"?new da(o):new na(b.server,k.getScript);e=new oa(e,new Y(k(a.body)),function(){d.d()});var f=new pa(e,c),g="/data/"+b.database,h=new Z(function(l,q){e.P("POST",g,l,q)},f,d.anchor);d.k=h;d.Va.push(function(){h.V()});var i=new v({$anchor:d.anchor,$updateView:_(d.d).bind(d),$config:b,$invalidWidgets:[],$console:o.console,$datastore:ca(h,{load:h.load,loadMany:h.la,loadOrCreate:h.Ha,loadAll:h.Ga,save:h.save, +remove:h.remove,flush:h.V,query:h.Qa,entity:h.G,entities:h.entities,documentCountsByUser:h.yb,userDocumentIdsByEntity:h.tc,join:h.join}),$save:function(l){h.mc(i.q,l,d.anchor)},$window:o,$uid:function(){return""+(new Date).getTime()},$users:f},"ROOT");a.data("scope",i);d.G(i);d.compile();c.bind();(new A(a)).bind();var j=_(ca(i,{updateView:i.d,set:i.i,get:i.get,eval:i.eval})).extend({init:function(){b.location.listen(_(d.gc).bind(d));d.Na();d.Eb();d.d();return j},element:a[0],config:b});return j}function G(a, +b,c){var d=_.last(b);p(c,function(e){d[e]=_[e]});m[a]=m[a]||{};p(b,function(e){B(m[a],e)})}function x(a,b,c,d,e){this.F=a;this.location=d;this.k=c;this.anchor={};this.yc=b;this.sb=e||{};this.Va=[]}function S(a,b,c){this.eb=a;this.ea=b;this.ja=c;this.ib=o;this.H=[]}function Z(a,b,c){this.post=a;this.Xa=b;this.K=[];this.fa={$collections:this.K};this.anchor=c;this.R=[]}function T(a,b){return{format:a,parse:b||a}}function qa(a){return""+a}function w(a,b){var c=[];ea(c,a,b?"\n ":null,_([]));return c.join("")} +function M(a){try{var b=new E(a,true),c=b.ca();b.L();return c()}catch(d){ba("fromJson error: ",a,d);throw d;}}function ea(a,b,c,d){if(typeof b=="object"){if(d.include(b)){a.push("RECURSION");return}d.push(b)}var e=typeof b;if(b===null)a.push("null");else if(e==="function")return;else if(e==="boolean")a.push(""+b);else if(e==="number")isNaN(b)?a.push("null"):a.push(""+b);else if(e==="string")return a.push(m.String.quoteUnicode(b));else if(e==="object")if(b instanceof Array){a.push("[");var f=b.length; +e=false;for(var g=0;g>2;c=(c&3)<<4|d>>4;g=(d&15)<<2|e>>6;h=e&63;if(isNaN(d))g=h=64;else if(isNaN(e))h=64;b=b+this.B.charAt(f)+this.B.charAt(c)+this.B.charAt(g)+this.B.charAt(h)}return b},Ic:function(a){var b="",c,d,e,f,g,h=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");h>4;d=(d&15)<<4|f>>2;e=(f&3)<<6| g;b+=String.fromCharCode(c);if(f!=64)b+=String.fromCharCode(d);if(g!=64)b+=String.fromCharCode(e)}return b=fa.gb(b)},hb:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0;c127&&d<2048)b+=String.fromCharCode(d>>6|192);else{b+=String.fromCharCode(d>>12|224);b+=String.fromCharCode(d>>6&63|128)}b+=String.fromCharCode(d&63|128)}}return b},gb:function(a){for(var b="",c=0,d=c1=c2=0;c191&&d<224){c2=a.charCodeAt(c+1);b+=String.fromCharCode((d&31)<<6|c2&63);c+=2}else{c2=a.charCodeAt(c+1);c3=a.charCodeAt(c+2);b+=String.fromCharCode((d&15)<<12|(c2&63)<<6|c3&63);c+=3}}return b}};if(typeof y.getAttribute=="undefined")y.getAttribute=K();if(typeof Node=="undefined")Node={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10, -DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};o.console||(o.console={log:n,error:n});var Q,V,k=o.jQuery||o.$,p=_.each,B=_.extend,Fa=_.identity,m=o.angular||(o.angular={}),Ga=m.validator||(m.validator={}),r=m.filter||(m.filter={}),ga=m.formatter||(m.formatter={}),O=m.callbacks||(m.callbacks={});m.alert||(m.alert=function(){L(arguments);o.alert.apply(o,arguments)});la.prototype={Ob:function(a){this.Ea=a},watch:function(){var a=this;function b(){if(a.N!==a.location.href){var c=a.location.hash.match(/^#\$iframe_notify=(.*)$/); -if(c){a.N.match(/#/)||(a.N+="#");a.location.href=a.N;c="_iframe_notify_"+c[1];var d=O[c];delete O[c];try{(d||n)()}catch(e){alert(e)}}else{a.Ea(a.location.href);a.N=a.location.href}}a.setTimeout(b,a.delay)}b()},h:function(a){var b=this.location.href;b.match(/#/)||(b+="#");if(b!=a)this.location.href=a;this.Kc=a},get:function(){return o.location.href}};m.startUrlWatcher=function(){var a=new la(o.location);a.watch();return ca(a,{listen:a.Ob,set:a.h,get:a.get})};m.compile=function(a,b){k=o.jQuery;V=k.browser.msie; +DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12};o.console||(o.console={log:n,error:n});var Q,V,k=o.jQuery||o.$,p=_.each,B=_.extend,Fa=_.identity,m=o.angular||(o.angular={}),Ga=m.validator||(m.validator={}),r=m.filter||(m.filter={}),ga=m.formatter||(m.formatter={}),O=m.callbacks||(m.callbacks={});m.alert||(m.alert=function(){L(arguments);o.alert.apply(o,arguments)});la.prototype={Pb:function(a){this.Ea=a},watch:function(){var a=this;function b(){if(a.N!==a.location.href){var c=a.location.hash.match(/^#\$iframe_notify=(.*)$/); +if(c){a.N.match(/#/)||(a.N+="#");a.location.href=a.N;c="_iframe_notify_"+c[1];var d=O[c];delete O[c];try{(d||n)()}catch(e){alert(e)}}else{a.Ea(a.location.href);a.N=a.location.href}}a.setTimeout(b,a.delay)}b()},i:function(a){var b=this.location.href;b.match(/#/)||(b+="#");if(b!=a)this.location.href=a;this.Lc=a},get:function(){return o.location.href}};m.startUrlWatcher=function(){var a=new la(o.location);a.watch();return ca(a,{listen:a.Pb,set:a.i,get:a.get})};m.compile=function(a,b){k=o.jQuery;V=k.browser.msie; b=_({server:"",location:{get:n,set:n,listen:n}}).extend(b||{});Ma(b);La();return Na(k(a),b)};var I={typeOf:function(a){if(a===null)return"null";var b=typeof a;if(b=="object"){if(a instanceof Array)return"array";if(a instanceof Date)return"date";if(a.nodeType==1)return"element"}return b}},aa={},Ha={includeIf:function(a,b,c){var d=_.indexOf(a,b);if(c)d==-1&&a.push(b);else a.splice(d,1);return a},sum:function(a,b){b=m.Function.compile(b);for(var c=0,d=0;d=0&&a.splice(c,1);return b},find:function(a,b,c){if(b){var d=m.Function.compile(b);_.detect(a,function(e){if(d(e)){c=e;return true}});return c}},findById:function(a,b){return m.zc.find(a,function(c){return c.Za==b},null)},filter:function(a,b){var c=[];c.qb=function(j){for(var l=0;l-1;case "object":for(var q in j)if(q.charAt(0)!=="$"&&e(j[q],l))return true;return false;case "array":for(q=0;q=0&&a.splice(c,1);return b},find:function(a,b,c){if(b){var d=m.Function.compile(b);_.detect(a,function(e){if(d(e)){c=e;return true}});return c}},findById:function(a,b){return m.Ac.find(a,function(c){return c.Za==b},null)},filter:function(a,b){var c=[];c.qb=function(j){for(var l=0;l-1;case "object":for(var q in j)if(q.charAt(0)!=="$"&&e(j[q],l))return true;return false;case "array":for(q=0;q=0&&a.splice(d,1);a.unshift((c?"-":"+")+b);return a},orderByDirection:function(a,b,c,d){c=c||"ng-ascend";d=d||"ng-descend";a=a[0]||"";var e=true;if(a.charAt(0)=="-"){a=a.substring(1);e=false}else if(a.charAt(0)=="+")a=a.substring(1);return a==b?e?c:d:""},merge:function(a,b,c){var d=a[b];if(!d){d={};a[b]=d}X(c,d);return a}},Oa={quote:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\f/g, "\\f").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v")+'"'},quoteUnicode:function(a){a=m.String.quote(a);for(var b=[],c=0;c-1;){c< -d&&b.push(a.substr(c,d-c));c=d;d=a.indexOf("}}",d);d=d<0?a.length:d+2;b.push(a.substr(c,d-c));c=d}c!=a.length&&b.push(a.substr(c,a.length-c));return b.length===0?[a]:b};x.Ib=function(a){a=x.aa(a);return a.length>1||x.M(a[0])!==null};x.M=function(a){return(a=a.replace(/\n/gm," ").match(/^\{\{(.*)\}\}$/))?a[1]:null};x.prototype={gc:function(a){var b={};a.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(c,d,e){if(d)b[decodeURIComponent(d)]=decodeURIComponent(e)});return b},Na:function(){var a=this,b=this.location.get()|| -"",c=b.indexOf("#");if(!(c<0)){b=this.gc(b.substring(c+1));p(a.anchor,function(d,e){delete a.anchor[e]});p(b,function(d,e){a.anchor[e]=d})}},fc:function(){this.Na();this.d()},qc:function(){var a=this.location.get()||"",b=a.indexOf("#");if(b>-1)a=a.substring(0,b);a+="#";b="";for(var c in this.anchor){var d=this.anchor[c];if(typeof d==="undefined"||d===null)delete this.anchor[c];else{a+=b+encodeURIComponent(c);if(d!==true)a+="="+encodeURIComponent(d);b="&"}}this.location.set(a);return a},d:function(){(new Date).getTime(); -var a=k(this.F).scope();a.h("$invalidWidgets",[]);a.d();(new Date).getTime();this.qc();_.each(this.Va,function(b){b()})},T:function(a){var b=k(this.F),c=b.find(a);if(b.is(a))c=c.andSelf();return c},Db:function(){this.T("[ng-init]").each(function(){var a=k(this),b=a.scope();try{b.eval(a.attr("ng-init"))}catch(c){alert("EVAL ERROR:\n"+a.attr("ng-init")+"\n"+w(c,true))}})},G:function(a){var b=this;this.T("[ng-entity]").attr("ng-watch",function(){try{var c=k(this);return a.G(c.attr("ng-entity"),b.k)+ -(c.attr("ng-watch")||"")}catch(d){L(d);alert(d)}})},compile:function(){var a=k(this.F);if(this.rb.autoSubmit){var b=this.T(":submit").not("[ng-action]");b.attr("ng-action","$save()");b.not(":disabled").not("ng-bind-attr").attr("ng-bind-attr",'{disabled:"{{$invalidWidgets}}"}')}this.Oa(this.F)(this.F,a.scope(),"");this.T("a[ng-action]").live("click",function(){var c=k(this),d=c.scope();try{d.eval(c.attr("ng-action"));c.removeAttr("ng-error");c.removeClass("ng-exception")}catch(e){c.addClass("ng-exception"); -c.attr("ng-error",w(e,true))}d.get("$updateView")();return false})},pc:function(a,b,c){b=b.concat();var d=b.pop(),e=x.aa(a.nodeValue);if(e.length>1||x.M(e[0])){var f=a.parentNode;if(ia(f)){f.setAttribute("ng-bind-template",a.nodeValue);c.push({path:b,b:function(l){return new N(l,l.getAttribute("ng-bind-template"))}})}else for(var g=0;g2&&a.setAttribute("ng-bind-attr",d)}a.getAttribute||L(a);var j=a.getAttribute("ng-repeat");if(j){a.removeAttribute("ng-repeat");var l=this.Oa(a);d=y.createComment("ng-repeat: "+j);e=a.parentNode;e.insertBefore(d,a);e.removeChild(a);function q(s, -t,z){var J=k(a).clone();J.css("display","");J.attr("ng-repeat-index",""+z);J.data("scope",s);l(J[0],s,t+z+":");return J}c.push({path:b,b:function(s,t,z){return new Ea(k(s),j,q,z)}})}else{a.getAttribute("ng-eval")&&c.push({path:b,b:this.Yb});a.getAttribute("ng-bind")&&c.push({path:b,b:this.Ma});a.getAttribute("ng-bind-attr")&&c.push({path:b,b:this.Ub});a.getAttribute("ng-hide")&&c.push({path:b,b:this.Zb});a.getAttribute("ng-show")&&c.push({path:b,b:this.$b});a.getAttribute("ng-class")&&c.push({path:b, -b:this.Vb});a.getAttribute("ng-class-odd")&&c.push({path:b,b:this.Xb});a.getAttribute("ng-class-even")&&c.push({path:b,b:this.Wb});a.getAttribute("ng-style")&&c.push({path:b,b:this.ac});a.getAttribute("ng-watch")&&c.push({path:b,b:this.bc});d=a.nodeName;if(d=="INPUT"||d=="TEXTAREA"||d=="SELECT"||d=="BUTTON"){var C=this;c.push({path:b,b:function(s,t,z){s.name=z+s.name.split(":").pop();return C.xc.sb(k(s),t)}})}if(d=="OPTION")if(!k("").append(k(a).clone()).html().match(/.*<\/\s*option\s*>/gi))a.value= +a.text;d=a.childNodes;for(e=0;e