Skip to content
Browse files

update angular to v1.0.5

  • Loading branch information...
1 parent 5e6a990 commit 0d159c1c787cbe6168f45474379bcabfd0f90969 @btford committed
View
1,833 public/js/lib/angular/angular-bootstrap-prettify.js
1,833 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
41 public/js/lib/angular/angular-bootstrap-prettify.min.js
@@ -0,0 +1,41 @@
+/*
+ AngularJS v1.0.5
+ (c) 2010-2012 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(q,k,I){'use strict';function G(c){return c.replace(/\&/g,"&amp;").replace(/\</g,"&lt;").replace(/\>/g,"&gt;").replace(/"/g,"&quot;")}function D(c,e){var b=k.element("<pre>"+e+"</pre>");c.html("");c.append(b.contents());return c}var t={},w={value:{}},L={"angular.js":"http://code.angularjs.org/"+k.version.full+"/angular.min.js","angular-resource.js":"http://code.angularjs.org/"+k.version.full+"/angular-resource.min.js","angular-sanitize.js":"http://code.angularjs.org/"+k.version.full+"/angular-sanitize.min.js",
+"angular-cookies.js":"http://code.angularjs.org/"+k.version.full+"/angular-cookies.min.js"};t.jsFiddle=function(c,e,b){return{terminal:!0,link:function(x,a,r){function d(a,b){return'<input type="hidden" name="'+a+'" value="'+e(b)+'">'}var H={html:"",css:"",js:""};k.forEach(r.jsFiddle.split(" "),function(a,b){var d=a.split(".")[1];H[d]+=d=="html"?b==0?"<div ng-app"+(r.module?'="'+r.module+'"':"")+">\n"+c(a,2):"\n\n\n <\!-- CACHE FILE: "+a+' --\>\n <script type="text/ng-template" id="'+a+'">\n'+c(a,
+4)+" <\/script>\n":c(a)+"\n"});H.html+="</div>\n";D(a,'<form class="jsfiddle" method="post" action="http://jsfiddle.net/api/post/library/pure/" target="_blank">'+d("title","AngularJS Example: ")+d("css",'</style> <\!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ --\> \n<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">\n'+b.angular+(r.resource?b.resource:"")+"<style>\n"+H.css)+d("html",H.html)+d("js",H.js)+'<button class="btn btn-primary"><i class="icon-white icon-pencil"></i> Edit Me</button></form>')}}};
+t.code=function(){return{restrict:"E",terminal:!0}};t.prettyprint=["reindentCode",function(c){return{restrict:"C",terminal:!0,compile:function(e){e.html(q.prettyPrintOne(c(e.html()),I,!0))}}}];t.ngSetText=["getEmbeddedTemplate",function(c){return{restrict:"CA",priority:10,compile:function(e,b){D(e,G(c(b.ngSetText)))}}}];t.ngHtmlWrap=["reindentCode","templateMerge",function(c,e){return{compile:function(b,c){var a={head:"",module:"",body:b.text()};k.forEach((c.ngHtmlWrap||"").split(" "),function(b){if(b){var b=
+L[b]||b,d=b.split(/\./).pop();d=="css"?a.head+='<link rel="stylesheet" href="'+b+'" type="text/css">\n':d=="js"?a.head+='<script src="'+b+'"><\/script>\n':a.module='="'+b+'"'}});D(b,G(e("<!doctype html>\n<html ng-app{{module}}>\n <head>\n{{head:4}} </head>\n <body>\n{{body:4}} </body>\n</html>",a)))}}}];t.ngSetHtml=["getEmbeddedTemplate",function(c){return{restrict:"CA",priority:10,compile:function(e,b){D(e,c(b.ngSetHtml))}}}];t.ngEvalJavascript=["getEmbeddedTemplate",function(c){return{compile:function(e,
+b){var x=c(b.ngEvalJavascript);try{q.execScript?q.execScript(x||'""'):q.eval(x)}catch(a){q.console?q.console.log(x,"\n",a):q.alert(a)}}}}];t.ngEmbedApp=["$templateCache","$browser","$rootScope","$location",function(c,e,b,x){return{terminal:!0,link:function(a,r,d){a=[];a.push(["$provide",function(a){a.value("$templateCache",c);a.value("$anchorScroll",k.noop);a.value("$browser",e);a.provider("$location",function(){this.$get=["$rootScope",function(a){b.$on("$locationChangeSuccess",function(b,d,c){a.$broadcast("$locationChangeSuccess",
+d,c)});return x}];this.html5Mode=k.noop});a.decorator("$timeout",["$rootScope","$delegate",function(a,b){return k.extend(function(d,c){return c&&c>50?setTimeout(function(){a.$apply(d)},c):b.apply(this,arguments)},b)}]);a.decorator("$rootScope",["$delegate",function(a){b.$watch(function(){a.$digest()});return a}])}]);d.ngEmbedApp&&a.push(d.ngEmbedApp);r.bind("click",function(a){a.target.attributes.getNamedItem("ng-click")&&a.preventDefault()});k.bootstrap(r,a)}}}];w.reindentCode=function(){return function(c,
+e){if(!c)return c;for(var b=c.split(/\r?\n/),x=" ".substr(0,e||0),a;b.length&&b[0].match(/^\s*$/);)b.shift();for(;b.length&&b[b.length-1].match(/^\s*$/);)b.pop();var r=999;for(a=0;a<b.length;a++){var d=b[0],k=d.match(/^\s*/)[0];if(k!==d&&k.length<r)r=k.length}for(a=0;a<b.length;a++)b[a]=x+b[a].substring(r);b.push("");return b.join("\n")}};w.templateMerge=["reindentCode",function(c){return function(e,b){return e.replace(/\{\{(\w+)(?:\:(\d+))?\}\}/g,function(e,a,k){e=b[a];k&&(e=c(e,k));return e==
+I?"":e})}}];w.getEmbeddedTemplate=["reindentCode",function(c){return function(e){e=document.getElementById(e);return!e?null:c(k.element(e).html(),0)}}];k.module("bootstrapPrettify",[]).directive(t).factory(w);q.PR_SHOULD_USE_CONTINUATION=!0;(function(){function c(a){function b(i){var a=i.charCodeAt(0);if(a!==92)return a;var l=i.charAt(1);return(a=k[l])?a:"0"<=l&&l<="7"?parseInt(i.substring(1),8):l==="u"||l==="x"?parseInt(i.substring(2),16):i.charCodeAt(1)}function A(i){if(i<32)return(i<16?"\\x0":
+"\\x")+i.toString(16);i=String.fromCharCode(i);return i==="\\"||i==="-"||i==="]"||i==="^"?"\\"+i:i}function M(i){var a=i.substring(1,i.length-1).match(/\\u[0-9A-Fa-f]{4}|\\x[0-9A-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\s\S]|-|[^-\\]/g),i=[],l=a[0]==="^",f=["["];l&&f.push("^");for(var l=l?1:0,g=a.length;l<g;++l){var j=a[l];if(/\\[bdsw]/i.test(j))f.push(j);else{var j=b(j),h;l+2<g&&"-"===a[l+1]?(h=b(a[l+2]),l+=2):h=j;i.push([j,h]);h<65||j>122||(h<65||j>90||i.push([Math.max(65,j)|32,Math.min(h,90)|
+32]),h<97||j>122||i.push([Math.max(97,j)&-33,Math.min(h,122)&-33]))}}i.sort(function(i,a){return i[0]-a[0]||a[1]-i[1]});a=[];g=[];for(l=0;l<i.length;++l)j=i[l],j[0]<=g[1]+1?g[1]=Math.max(g[1],j[1]):a.push(g=j);for(l=0;l<a.length;++l)j=a[l],f.push(A(j[0])),j[1]>j[0]&&(j[1]+1>j[0]&&f.push("-"),f.push(A(j[1])));f.push("]");return f.join("")}function c(i){for(var a=i.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)",
+"g")),f=a.length,b=[],g=0,j=0;g<f;++g){var h=a[g];h==="("?++j:"\\"===h.charAt(0)&&(h=+h.substring(1))&&(h<=j?b[h]=-1:a[g]=A(h))}for(g=1;g<b.length;++g)-1===b[g]&&(b[g]=++d);for(j=g=0;g<f;++g)h=a[g],h==="("?(++j,b[j]||(a[g]="(?:")):"\\"===h.charAt(0)&&(h=+h.substring(1))&&h<=j&&(a[g]="\\"+b[h]);for(g=0;g<f;++g)"^"===a[g]&&"^"!==a[g+1]&&(a[g]="");if(i.ignoreCase&&e)for(g=0;g<f;++g)h=a[g],i=h.charAt(0),h.length>=2&&i==="["?a[g]=M(h):i!=="\\"&&(a[g]=h.replace(/[a-zA-Z]/g,function(a){a=a.charCodeAt(0);
+return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var d=0,e=!1,m=!1,p=0,f=a.length;p<f;++p){var n=a[p];if(n.ignoreCase)m=!0;else if(/[a-z]/i.test(n.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){e=!0;m=!1;break}}for(var k={b:8,t:9,n:10,v:11,f:12,r:13},o=[],p=0,f=a.length;p<f;++p){n=a[p];if(n.global||n.multiline)throw Error(""+n);o.push("(?:"+c(n)+")")}return RegExp(o.join("|"),m?"gi":"g")}function e(a,b){function A(a){switch(a.nodeType){case 1:if(M.test(a.className))break;
+for(var f=a.firstChild;f;f=f.nextSibling)A(f);f=a.nodeName.toLowerCase();if("br"===f||"li"===f)c[m]="\n",e[m<<1]=d++,e[m++<<1|1]=a;break;case 3:case 4:f=a.nodeValue,f.length&&(f=b?f.replace(/\r\n?/g,"\n"):f.replace(/[ \t\r\n]+/g," "),c[m]=f,e[m<<1]=d,d+=f.length,e[m++<<1|1]=a)}}var M=/(?:^|\s)nocode(?:\s|$)/,c=[],d=0,e=[],m=0;A(a);return{sourceCode:c.join("").replace(/\n$/,""),spans:e}}function b(a,b,c,d){b&&(a={sourceCode:b,basePos:a},c(a),d.push.apply(d,a.decorations))}function k(a,d){var A={},
+e;(function(){for(var b=a.concat(d),m=[],p={},f=0,n=b.length;f<n;++f){var k=b[f],o=k[3];if(o)for(var i=o.length;--i>=0;)A[o.charAt(i)]=k;k=k[1];o=""+k;p.hasOwnProperty(o)||(m.push(k),p[o]=null)}m.push(/[\0-\uffff]/);e=c(m)})();var r=d.length,N=function(a){for(var c=a.basePos,B=[c,"pln"],f=0,k=a.sourceCode.match(e)||[],v={},o=0,i=k.length;o<i;++o){var u=k[o],l=v[u],s=void 0,g;if(typeof l==="string")g=!1;else{var j=A[u.charAt(0)];if(j)s=u.match(j[1]),l=j[0];else{for(g=0;g<r;++g)if(j=d[g],s=u.match(j[1])){l=
+j[0];break}s||(l="pln")}if((g=l.length>=5&&"lang-"===l.substring(0,5))&&!(s&&typeof s[1]==="string"))g=!1,l="src";g||(v[u]=l)}j=f;f+=u.length;if(g){g=s[1];var h=u.indexOf(g),E=h+g.length;s[2]&&(E=u.length-s[2].length,h=E-g.length);l=l.substring(5);b(c+j,u.substring(0,h),N,B);b(c+j+h,g,t(l,g),B);b(c+j+E,u.substring(E),N,B)}else B.push(c+j,l)}a.decorations=B};return N}function a(a){var b=[],c=[];a.tripleQuotedStrings?b.push(["str",/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,
+null,"'\""]):a.multiLineStrings?b.push(["str",/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]):b.push(["str",/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]);a.verbatimStrings&&c.push(["str",/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var d=a.hashComments;d&&(a.cStyleComments?(d>1?b.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]):b.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,
+null,"#"]),c.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):b.push(["com",/^#[^\r\n]*/,null,"#"]));a.cStyleComments&&(c.push(["com",/^\/\/[^\r\n]*/,null]),c.push(["com",/^\/\*[\s\S]*?(?:\*\/|$)/,null]));a.regexLiterals&&c.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*(/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/)")]);
+(d=a.types)&&c.push(["typ",d]);a=(""+a.keywords).replace(/^ | $/g,"");a.length&&c.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),null]);b.push(["pln",/^\s+/,null," \r\n\t\u00a0"]);c.push(["lit",/^@[a-z_$][a-z_$@0-9]*/i,null],["typ",/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],["pln",/^[a-z_$][a-z_$@0-9]*/i,null],["lit",/^(?:0x[a-f0-9]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+\-]?\d+)?)[a-z]*/i,null,"0123456789"],["pln",/^\\[\s\S]?/,null],["pun",/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);
+return k(b,c)}function r(a,b,c){function d(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("br"===a.nodeName)e(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)d(a);break;case 3:case 4:if(c){var b=a.nodeValue,f=b.match(r);if(f){var B=b.substring(0,f.index);a.nodeValue=B;(b=b.substring(f.index+f[0].length))&&a.parentNode.insertBefore(m.createTextNode(b),a.nextSibling);e(a);B||a.parentNode.removeChild(a)}}}}function e(a){function b(a,f){var c=f?a.cloneNode(!1):
+a,h=a.parentNode;if(h){var h=b(h,1),d=a.nextSibling;h.appendChild(c);for(var i=d;i;i=d)d=i.nextSibling,h.appendChild(i)}return c}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),c;(c=a.parentNode)&&c.nodeType===1;)a=c;f.push(a)}for(var k=/(?:^|\s)nocode(?:\s|$)/,r=/\r\n?|\n/,m=a.ownerDocument,p=m.createElement("li");a.firstChild;)p.appendChild(a.firstChild);for(var f=[p],n=0;n<f.length;++n)d(f[n]);b===(b|0)&&f[0].setAttribute("value",b);var v=m.createElement("ol");v.className=
+"linenums";for(var b=Math.max(0,b-1|0)||0,n=0,o=f.length;n<o;++n)p=f[n],p.className="L"+(n+b)%10,p.firstChild||p.appendChild(m.createTextNode("\u00a0")),v.appendChild(p);a.appendChild(v)}function d(a,b){for(var c=b.length;--c>=0;){var d=b[c];J.hasOwnProperty(d)?F.console&&console.warn("cannot override language handler %s",d):J[d]=a}}function t(a,b){if(!a||!J.hasOwnProperty(a))a=/^\s*</.test(b)?"default-markup":"default-code";return J[a]}function D(a){var b=a.langExtension;try{var c=e(a.sourceNode,
+a.pre),d=c.sourceCode;a.sourceCode=d;a.spans=c.spans;a.basePos=0;t(b,d)(a);var k=/\bMSIE\s(\d+)/.exec(navigator.userAgent),k=k&&+k[1]<=8,b=/\n/g,r=a.sourceCode,q=r.length,c=0,m=a.spans,p=m.length,d=0,f=a.decorations,n=f.length,v=0;f[n]=q;var o,i;for(i=o=0;i<n;)f[i]!==f[i+2]?(f[o++]=f[i++],f[o++]=f[i++]):i+=2;n=o;for(i=o=0;i<n;){for(var u=f[i],l=f[i+1],s=i+2;s+2<=n&&f[s+1]===l;)s+=2;f[o++]=u;f[o++]=l;i=s}f.length=o;var g=a.sourceNode,j;if(g)j=g.style.display,g.style.display="none";try{for(;d<p;){var h=
+m[d+2]||q,E=f[v+2]||q,s=Math.min(h,E),C=m[d+1],K;if(C.nodeType!==1&&(K=r.substring(c,s))){k&&(K=K.replace(b,"\r"));C.nodeValue=K;var x=C.ownerDocument,w=x.createElement("span");w.className=f[v+1];var z=C.parentNode;z.replaceChild(w,C);w.appendChild(C);c<h&&(m[d+1]=C=x.createTextNode(r.substring(s,h)),z.insertBefore(C,w.nextSibling))}c=s;c>=h&&(d+=2);c>=E&&(v+=2)}}finally{if(g)g.style.display=j}}catch(y){F.console&&console.log(y&&y.stack?y.stack:y)}}var F=q,z=["break,continue,do,else,for,if,return,while"],
+y=[[z,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],w=[y,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],
+G=[y,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],O=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],y=[y,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],
+P=[z,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],Q=[z,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],z=[z,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
+L=/\S/,S=a({keywords:[w,O,y,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+P,Q,z],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),J={};d(S,["default-code"]);d(k([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
+/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);d(k([["pln",/^[\s]+/,null," \t\r\n"],["atv",/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],
+["pun",/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);d(k([],[["atv",/^[\s\S]+/]]),["uq.val"]);d(a({keywords:w,hashComments:!0,cStyleComments:!0,types:R}),["c","cc","cpp","cxx","cyc","m"]);d(a({keywords:"null,true,false"}),["json"]);d(a({keywords:O,hashComments:!0,cStyleComments:!0,
+verbatimStrings:!0,types:R}),["cs"]);d(a({keywords:G,cStyleComments:!0}),["java"]);d(a({keywords:z,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);d(a({keywords:P,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py"]);d(a({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl",
+"pl","pm"]);d(a({keywords:Q,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);d(a({keywords:y,cStyleComments:!0,regexLiterals:!0}),["js"]);d(a({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);d(k([],[["str",/^[\s\S]+/]]),["regex"]);var T=F.PR={createSimpleLexer:k,
+registerLangHandler:d,sourceDecorator:a,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:F.prettyPrintOne=function(a,b,c){var d=document.createElement("div");d.innerHTML="<pre>"+a+"</pre>";d=d.firstChild;c&&r(d,c,!0);D({langExtension:b,numberLines:c,sourceNode:d,pre:1});return d.innerHTML},prettyPrint:F.prettyPrint=
+function(a){function b(){var s;for(var c=F.PR_SHOULD_USE_CONTINUATION?m.now()+250:Infinity;p<d.length&&m.now()<c;p++){var g=d[p],j=g.className;if(v.test(j)&&!o.test(j)){for(var h=!1,e=g.parentNode;e;e=e.parentNode)if(l.test(e.tagName)&&e.className&&v.test(e.className)){h=!0;break}if(!h){g.className+=" prettyprinted";var j=j.match(n),k;if(h=!j){for(var h=g,e=I,q=h.firstChild;q;q=q.nextSibling)var t=q.nodeType,e=t===1?e?h:q:t===3?L.test(q.nodeValue)?h:e:e;h=(k=e===h?I:e)&&u.test(k.tagName)}h&&(j=k.className.match(n));
+j&&(j=j[1]);s=i.test(g.tagName)?1:(h=(h=g.currentStyle)?h.whiteSpace:document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(g,null).getPropertyValue("white-space"):0)&&"pre"===h.substring(0,3),h=s;(e=(e=g.className.match(/\blinenums\b(?::(\d+))?/))?e[1]&&e[1].length?+e[1]:!0:!1)&&r(g,e,h);f={langExtension:j,sourceNode:g,numberLines:e,pre:h};D(f)}}}p<d.length?setTimeout(b,250):a&&a()}for(var c=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),
+document.getElementsByTagName("xmp")],d=[],e=0;e<c.length;++e)for(var k=0,q=c[e].length;k<q;++k)d.push(c[e][k]);var c=null,m=Date;m.now||(m={now:function(){return+new Date}});var p=0,f,n=/\blang(?:uage)?-([\w.]+)(?!\S)/,v=/\bprettyprint\b/,o=/\bprettyprinted\b/,i=/pre|xmp/i,u=/^code$/i,l=/^(?:pre|code|xmp)$/i;b()}};typeof define==="function"&&define.amd&&define("google-code-prettify",[],function(){return T})})()})(window,window.angular);angular.element(document).find("head").append('<style type="text/css">.com{color:#93a1a1;}.lit{color:#195f91;}.pun,.opn,.clo{color:#93a1a1;}.fun{color:#dc322f;}.str,.atv{color:#D14;}.kwd,.linenums .tag{color:#1e347b;}.typ,.atn,.dec,.var{color:teal;}.pln{color:#48484c;}.prettyprint{padding:8px;background-color:#f7f7f9;border:1px solid #e1e1e8;}.prettyprint.linenums{-webkit-box-shadow:inset 40px 0 0 #fbfbfc,inset 41px 0 0 #ececf0;-moz-box-shadow:inset 40px 0 0 #fbfbfc,inset 41px 0 0 #ececf0;box-shadow:inset 40px 0 0 #fbfbfc,inset 41px 0 0 #ececf0;}ol.linenums{margin:0 0 0 33px;}ol.linenums li{padding-left:12px;color:#bebec5;line-height:18px;text-shadow:0 1px 0 #fff;}</style>');
View
166 public/js/lib/angular/angular-bootstrap.js
@@ -0,0 +1,166 @@
+/**
+ * @license AngularJS v1.0.5
+ * (c) 2010-2012 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {
+'use strict';
+
+var directive = {};
+
+directive.dropdownToggle =
+ ['$document', '$location', '$window',
+ function ($document, $location, $window) {
+ var openElement = null, close;
+ return {
+ restrict: 'C',
+ link: function(scope, element, attrs) {
+ scope.$watch(function dropdownTogglePathWatch(){return $location.path();}, function dropdownTogglePathWatchAction() {
+ close && close();
+ });
+
+ element.parent().bind('click', function(event) {
+ close && close();
+ });
+
+ element.bind('click', function(event) {
+ event.preventDefault();
+ event.stopPropagation();
+
+ var iWasOpen = false;
+
+ if (openElement) {
+ iWasOpen = openElement === element;
+ close();
+ }
+
+ if (!iWasOpen){
+ element.parent().addClass('open');
+ openElement = element;
+
+ close = function (event) {
+ event && event.preventDefault();
+ event && event.stopPropagation();
+ $document.unbind('click', close);
+ element.parent().removeClass('open');
+ close = null;
+ openElement = null;
+ }
+
+ $document.bind('click', close);
+ }
+ });
+ }
+ };
+ }];
+
+
+directive.tabbable = function() {
+ return {
+ restrict: 'C',
+ compile: function(element) {
+ var navTabs = angular.element('<ul class="nav nav-tabs"></ul>'),
+ tabContent = angular.element('<div class="tab-content"></div>');
+
+ tabContent.append(element.contents());
+ element.append(navTabs).append(tabContent);
+ },
+ controller: ['$scope', '$element', function($scope, $element) {
+ var navTabs = $element.contents().eq(0),
+ ngModel = $element.controller('ngModel') || {},
+ tabs = [],
+ selectedTab;
+
+ ngModel.$render = function() {
+ var $viewValue = this.$viewValue;
+
+ if (selectedTab ? (selectedTab.value != $viewValue) : $viewValue) {
+ if(selectedTab) {
+ selectedTab.paneElement.removeClass('active');
+ selectedTab.tabElement.removeClass('active');
+ selectedTab = null;
+ }
+ if($viewValue) {
+ for(var i = 0, ii = tabs.length; i < ii; i++) {
+ if ($viewValue == tabs[i].value) {
+ selectedTab = tabs[i];
+ break;
+ }
+ }
+ if (selectedTab) {
+ selectedTab.paneElement.addClass('active');
+ selectedTab.tabElement.addClass('active');
+ }
+ }
+
+ }
+ };
+
+ this.addPane = function(element, attr) {
+ var li = angular.element('<li><a href></a></li>'),
+ a = li.find('a'),
+ tab = {
+ paneElement: element,
+ paneAttrs: attr,
+ tabElement: li
+ };
+
+ tabs.push(tab);
+
+ attr.$observe('value', update)();
+ attr.$observe('title', function(){ update(); a.text(tab.title); })();
+
+ function update() {
+ tab.title = attr.title;
+ tab.value = attr.value || attr.title;
+ if (!ngModel.$setViewValue && (!ngModel.$viewValue || tab == selectedTab)) {
+ // we are not part of angular
+ ngModel.$viewValue = tab.value;
+ }
+ ngModel.$render();
+ }
+
+ navTabs.append(li);
+ li.bind('click', function(event) {
+ event.preventDefault();
+ event.stopPropagation();
+ if (ngModel.$setViewValue) {
+ $scope.$apply(function() {
+ ngModel.$setViewValue(tab.value);
+ ngModel.$render();
+ });
+ } else {
+ // we are not part of angular
+ ngModel.$viewValue = tab.value;
+ ngModel.$render();
+ }
+ });
+
+ return function() {
+ tab.tabElement.remove();
+ for(var i = 0, ii = tabs.length; i < ii; i++ ) {
+ if (tab == tabs[i]) {
+ tabs.splice(i, 1);
+ }
+ }
+ };
+ }
+ }]
+ };
+};
+
+
+directive.tabPane = function() {
+ return {
+ require: '^tabbable',
+ restrict: 'C',
+ link: function(scope, element, attrs, tabsCtrl) {
+ element.bind('$remove', tabsCtrl.addPane(element, attrs));
+ }
+ };
+};
+
+
+angular.module('bootstrap', []).directive(directive);
+
+})(window, window.angular);
View
9 public/js/lib/angular/angular-bootstrap.min.js
@@ -0,0 +1,9 @@
+/*
+ AngularJS v1.0.5
+ (c) 2010-2012 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(n,j){'use strict';j.module("bootstrap",[]).directive({dropdownToggle:["$document","$location","$window",function(h,e){var d=null,a;return{restrict:"C",link:function(g,b){g.$watch(function(){return e.path()},function(){a&&a()});b.parent().bind("click",function(){a&&a()});b.bind("click",function(i){i.preventDefault();i.stopPropagation();i=!1;d&&(i=d===b,a());i||(b.parent().addClass("open"),d=b,a=function(c){c&&c.preventDefault();c&&c.stopPropagation();h.unbind("click",a);b.parent().removeClass("open");
+d=a=null},h.bind("click",a))})}}}],tabbable:function(){return{restrict:"C",compile:function(h){var e=j.element('<ul class="nav nav-tabs"></ul>'),d=j.element('<div class="tab-content"></div>');d.append(h.contents());h.append(e).append(d)},controller:["$scope","$element",function(h,e){var d=e.contents().eq(0),a=e.controller("ngModel")||{},g=[],b;a.$render=function(){var a=this.$viewValue;if(b?b.value!=a:a)if(b&&(b.paneElement.removeClass("active"),b.tabElement.removeClass("active"),b=null),a){for(var c=
+0,d=g.length;c<d;c++)if(a==g[c].value){b=g[c];break}b&&(b.paneElement.addClass("active"),b.tabElement.addClass("active"))}};this.addPane=function(e,c){function l(){f.title=c.title;f.value=c.value||c.title;if(!a.$setViewValue&&(!a.$viewValue||f==b))a.$viewValue=f.value;a.$render()}var k=j.element("<li><a href></a></li>"),m=k.find("a"),f={paneElement:e,paneAttrs:c,tabElement:k};g.push(f);c.$observe("value",l)();c.$observe("title",function(){l();m.text(f.title)})();d.append(k);k.bind("click",function(b){b.preventDefault();
+b.stopPropagation();a.$setViewValue?h.$apply(function(){a.$setViewValue(f.value);a.$render()}):(a.$viewValue=f.value,a.$render())});return function(){f.tabElement.remove();for(var a=0,b=g.length;a<b;a++)f==g[a]&&g.splice(a,1)}}}]}},tabPane:function(){return{require:"^tabbable",restrict:"C",link:function(h,e,d,a){e.bind("$remove",a.addPane(e,d))}}}})})(window,window.angular);
View
14 public/js/lib/angular/angular-cookies.js
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.0.3
+ * @license AngularJS v1.0.5
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
@@ -25,6 +25,18 @@ angular.module('ngCookies', ['ng']).
* this object, new cookies are created/deleted at the end of current $eval.
*
* @example
+ <doc:example>
+ <doc:source>
+ <script>
+ function ExampleController($cookies) {
+ // Retrieving a cookie
+ var favoriteCookie = $cookies.myFavorite;
+ // Setting a cookie
+ $cookies.myFavorite = 'oatmeal';
+ }
+ </script>
+ </doc:source>
+ </doc:example>
*/
factory('$cookies', ['$rootScope', '$browser', function ($rootScope, $browser) {
var cookies = {},
View
2 public/js/lib/angular/angular-cookies.min.js
@@ -1,5 +1,5 @@
/*
- AngularJS v1.0.3
+ AngularJS v1.0.5
(c) 2010-2012 Google, Inc. http://angularjs.org
License: MIT
*/
View
2 public/js/lib/angular/angular-loader.js
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.0.3
+ * @license AngularJS v1.0.5
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
View
2 public/js/lib/angular/angular-loader.min.js
@@ -1,5 +1,5 @@
/*
- AngularJS v1.0.3
+ AngularJS v1.0.5
(c) 2010-2012 Google, Inc. http://angularjs.org
License: MIT
*/
View
1,764 public/js/lib/angular/angular-mocks.js
1,764 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
122 public/js/lib/angular/angular-resource.js
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.0.3
+ * @license AngularJS v1.0.5
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
@@ -12,7 +12,7 @@
* @description
*/
- /**
+/**
* @ngdoc object
* @name ngResource.$resource
* @requires $http
@@ -25,7 +25,9 @@
* the need to interact with the low level {@link ng.$http $http} service.
*
* @param {string} url A parameterized URL template with parameters prefixed by `:` as in
- * `/user/:username`.
+ * `/user/:username`. If you are using a URL with a port number (e.g.
+ * `http://example.com:8080/api`), you'll need to escape the colon character before the port
+ * number, like this: `$resource('http://example.com\\:8080/api')`.
*
* @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in
* `actions` methods.
@@ -67,9 +69,9 @@
*
* Calling these methods invoke an {@link ng.$http} with the specified http method,
* destination and parameters. When the data is returned from the server then the object is an
- * instance of the resource class `save`, `remove` and `delete` actions are available on it as
- * methods with the `$` prefix. This allows you to easily perform CRUD operations (create, read,
- * update, delete) on server-side data like this:
+ * instance of the resource class. The actions `save`, `remove` and `delete` are available on it
+ * as methods with the `$` prefix. This allows you to easily perform CRUD operations (create,
+ * read, update, delete) on server-side data like this:
* <pre>
var User = $resource('/user/:userId', {userId:'@id'});
var user = User.get({userId:123}, function() {
@@ -149,9 +151,9 @@
});
</pre>
*
- * It's worth noting that the success callback for `get`, `query` and other method gets passed
- * in the response that came from the server as well as $http header getter function, so one
- * could rewrite the above example and get access to http headers as:
+ * It's worth noting that the success callback for `get`, `query` and other method gets passed
+ * in the response that came from the server as well as $http header getter function, so one
+ * could rewrite the above example and get access to http headers as:
*
<pre>
var User = $resource('/user/:userId', {userId:'@id'});
@@ -230,51 +232,51 @@ angular.module('ngResource', ['ng']).
return $parse(path)(obj);
};
- /**
- * We need our custom mehtod because encodeURIComponent is too aggressive and doesn't follow
- * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
- * segments:
- * segment = *pchar
- * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
- * pct-encoded = "%" HEXDIG HEXDIG
- * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
- * / "*" / "+" / "," / ";" / "="
- */
- function encodeUriSegment(val) {
- return encodeUriQuery(val, true).
- replace(/%26/gi, '&').
- replace(/%3D/gi, '=').
- replace(/%2B/gi, '+');
- }
-
-
- /**
- * This method is intended for encoding *key* or *value* parts of query component. We need a custom
- * method becuase encodeURIComponent is too agressive and encodes stuff that doesn't have to be
- * encoded per http://tools.ietf.org/html/rfc3986:
- * query = *( pchar / "/" / "?" )
- * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
- * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- * pct-encoded = "%" HEXDIG HEXDIG
- * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
- * / "*" / "+" / "," / ";" / "="
- */
- function encodeUriQuery(val, pctEncodeSpaces) {
- return encodeURIComponent(val).
- replace(/%40/gi, '@').
- replace(/%3A/gi, ':').
- replace(/%24/g, '$').
- replace(/%2C/gi, ',').
- replace((pctEncodeSpaces ? null : /%20/g), '+');
- }
-
- function Route(template, defaults) {
+ /**
+ * We need our custom method because encodeURIComponent is too aggressive and doesn't follow
+ * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
+ * segments:
+ * segment = *pchar
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ * / "*" / "+" / "," / ";" / "="
+ */
+ function encodeUriSegment(val) {
+ return encodeUriQuery(val, true).
+ replace(/%26/gi, '&').
+ replace(/%3D/gi, '=').
+ replace(/%2B/gi, '+');
+ }
+
+
+ /**
+ * This method is intended for encoding *key* or *value* parts of query component. We need a custom
+ * method becuase encodeURIComponent is too agressive and encodes stuff that doesn't have to be
+ * encoded per http://tools.ietf.org/html/rfc3986:
+ * query = *( pchar / "/" / "?" )
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ * / "*" / "+" / "," / ";" / "="
+ */
+ function encodeUriQuery(val, pctEncodeSpaces) {
+ return encodeURIComponent(val).
+ replace(/%40/gi, '@').
+ replace(/%3A/gi, ':').
+ replace(/%24/g, '$').
+ replace(/%2C/gi, ',').
+ replace((pctEncodeSpaces ? null : /%20/g), '+');
+ }
+
+ function Route(template, defaults) {
this.template = template = template + '#';
this.defaults = defaults || {};
var urlParams = this.urlParams = {};
forEach(template.split(/\W/), function(param){
- if (param && template.match(new RegExp("[^\\\\]:" + param + "\\W"))) {
+ if (param && (new RegExp("(^|[^\\\\]):" + param + "\\W").test(template))) {
urlParams[param] = true;
}
});
@@ -295,7 +297,14 @@ angular.module('ngResource', ['ng']).
encodedVal = encodeUriSegment(val);
url = url.replace(new RegExp(":" + urlParam + "(\\W)", "g"), encodedVal + "$1");
} else {
- url = url.replace(new RegExp("/?:" + urlParam + "(\\W)", "g"), '$1');
+ url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W)", "g"), function(match,
+ leadingSlashes, tail) {
+ if (tail.charAt(0) == '/') {
+ return tail;
+ } else {
+ return leadingSlashes + tail;
+ }
+ });
}
});
url = url.replace(/\/?#$/, '');
@@ -331,6 +340,7 @@ angular.module('ngResource', ['ng']).
}
forEach(actions, function(action, name) {
+ action.method = angular.uppercase(action.method);
var hasBody = action.method == 'POST' || action.method == 'PUT' || action.method == 'PATCH';
Resource[name] = function(a1, a2, a3, a4) {
var params = {};
@@ -396,11 +406,6 @@ angular.module('ngResource', ['ng']).
};
- Resource.bind = function(additionalParamDefaults){
- return ResourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions);
- };
-
-
Resource.prototype['$' + name] = function(a1, a2, a3) {
var params = extractParams(this),
success = noop,
@@ -426,6 +431,11 @@ angular.module('ngResource', ['ng']).
Resource[name].call(this, params, data, success, error);
};
});
+
+ Resource.bind = function(additionalParamDefaults){
+ return ResourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions);
+ };
+
return Resource;
}
View
12 public/js/lib/angular/angular-resource.min.js
@@ -1,10 +1,10 @@
/*
- AngularJS v1.0.3
+ AngularJS v1.0.5
(c) 2010-2012 Google, Inc. http://angularjs.org
License: MIT
*/
-(function(A,e,w){'use strict';e.module("ngResource",["ng"]).factory("$resource",["$http","$parse",function(x,y){function k(a,f){return encodeURIComponent(a).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(f?null:/%20/g,"+")}function t(a,f){this.template=a+="#";this.defaults=f||{};var b=this.urlParams={};l(a.split(/\W/),function(d){d&&a.match(RegExp("[^\\\\]:"+d+"\\W"))&&(b[d]=!0)});this.template=a.replace(/\\:/g,":")}function u(a,f,b){function d(b,c){var a=
-{},c=i({},f,c);l(c,function(o,c){var d;o.charAt&&o.charAt(0)=="@"?(d=o.substr(1),d=y(d)(b)):d=o;a[c]=d});return a}function h(a){v(a||{},this)}var e=new t(a),b=i({},z,b);l(b,function(g,c){var k=g.method=="POST"||g.method=="PUT"||g.method=="PATCH";h[c]=function(a,b,c,f){var s={},j,m=p,q=null;switch(arguments.length){case 4:q=f,m=c;case 3:case 2:if(r(b)){if(r(a)){m=a;q=b;break}m=b;q=c}else{s=a;j=b;m=c;break}case 1:r(a)?m=a:k?j=a:s=a;break;case 0:break;default:throw"Expected between 0-4 arguments [params, data, success, error], got "+
-arguments.length+" arguments.";}var n=this instanceof h?this:g.isArray?[]:new h(j);x({method:g.method,url:e.url(i({},d(j,g.params||{}),s)),data:j}).then(function(a){var b=a.data;if(b)g.isArray?(n.length=0,l(b,function(a){n.push(new h(a))})):v(b,n);(m||p)(n,a.headers)},q);return n};h.bind=function(c){return u(a,i({},f,c),b)};h.prototype["$"+c]=function(a,b,f){var g=d(this),e=p,j;switch(arguments.length){case 3:g=a;e=b;j=f;break;case 2:case 1:r(a)?(e=a,j=b):(g=a,e=b||p);case 0:break;default:throw"Expected between 1-3 arguments [params, success, error], got "+
-arguments.length+" arguments.";}h[c].call(this,g,k?this:w,e,j)}});return h}var z={get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}},p=e.noop,l=e.forEach,i=e.extend,v=e.copy,r=e.isFunction;t.prototype={url:function(a){var f=this,b=this.template,d,h,a=a||{};l(this.urlParams,function(g,c){d=a.hasOwnProperty(c)?a[c]:f.defaults[c];e.isDefined(d)&&d!==null?(h=k(d,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+"),
-b=b.replace(RegExp(":"+c+"(\\W)","g"),h+"$1")):b=b.replace(RegExp("/?:"+c+"(\\W)","g"),"$1")});var b=b.replace(/\/?#$/,""),i=[];l(a,function(a,b){f.urlParams[b]||i.push(k(b)+"="+k(a))});i.sort();b=b.replace(/\/*$/,"");return b+(i.length?"?"+i.join("&"):"")}};return u}])})(window,window.angular);
+(function(C,d,w){'use strict';d.module("ngResource",["ng"]).factory("$resource",["$http","$parse",function(x,y){function s(b,e){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(e?null:/%20/g,"+")}function t(b,e){this.template=b+="#";this.defaults=e||{};var a=this.urlParams={};h(b.split(/\W/),function(f){f&&RegExp("(^|[^\\\\]):"+f+"\\W").test(b)&&(a[f]=!0)});this.template=b.replace(/\\:/g,":")}function u(b,e,a){function f(m,a){var b=
+{},a=o({},e,a);h(a,function(a,z){var c;a.charAt&&a.charAt(0)=="@"?(c=a.substr(1),c=y(c)(m)):c=a;b[z]=c});return b}function g(a){v(a||{},this)}var k=new t(b),a=o({},A,a);h(a,function(a,b){a.method=d.uppercase(a.method);var e=a.method=="POST"||a.method=="PUT"||a.method=="PATCH";g[b]=function(b,c,d,B){var j={},i,l=p,q=null;switch(arguments.length){case 4:q=B,l=d;case 3:case 2:if(r(c)){if(r(b)){l=b;q=c;break}l=c;q=d}else{j=b;i=c;l=d;break}case 1:r(b)?l=b:e?i=b:j=b;break;case 0:break;default:throw"Expected between 0-4 arguments [params, data, success, error], got "+
+arguments.length+" arguments.";}var n=this instanceof g?this:a.isArray?[]:new g(i);x({method:a.method,url:k.url(o({},f(i,a.params||{}),j)),data:i}).then(function(b){var c=b.data;if(c)a.isArray?(n.length=0,h(c,function(a){n.push(new g(a))})):v(c,n);(l||p)(n,b.headers)},q);return n};g.prototype["$"+b]=function(a,d,h){var m=f(this),j=p,i;switch(arguments.length){case 3:m=a;j=d;i=h;break;case 2:case 1:r(a)?(j=a,i=d):(m=a,j=d||p);case 0:break;default:throw"Expected between 1-3 arguments [params, success, error], got "+
+arguments.length+" arguments.";}g[b].call(this,m,e?this:w,j,i)}});g.bind=function(d){return u(b,o({},e,d),a)};return g}var A={get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:!0},remove:{method:"DELETE"},"delete":{method:"DELETE"}},p=d.noop,h=d.forEach,o=d.extend,v=d.copy,r=d.isFunction;t.prototype={url:function(b){var e=this,a=this.template,f,g,b=b||{};h(this.urlParams,function(h,c){f=b.hasOwnProperty(c)?b[c]:e.defaults[c];d.isDefined(f)&&f!==null?(g=s(f,!0).replace(/%26/gi,"&").replace(/%3D/gi,
+"=").replace(/%2B/gi,"+"),a=a.replace(RegExp(":"+c+"(\\W)","g"),g+"$1")):a=a.replace(RegExp("(/?):"+c+"(\\W)","g"),function(a,b,c){return c.charAt(0)=="/"?c:b+c})});var a=a.replace(/\/?#$/,""),k=[];h(b,function(a,b){e.urlParams[b]||k.push(s(b)+"="+s(a))});k.sort();a=a.replace(/\/*$/,"");return a+(k.length?"?"+k.join("&"):"")}};return u}])})(window,window.angular);
View
2 public/js/lib/angular/angular-sanitize.js
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.0.3
+ * @license AngularJS v1.0.5
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
View
2 public/js/lib/angular/angular-sanitize.min.js
@@ -1,5 +1,5 @@
/*
- AngularJS v1.0.3
+ AngularJS v1.0.5
(c) 2010-2012 Google, Inc. http://angularjs.org
License: MIT
*/
View
26,195 public/js/lib/angular/angular-scenario.js
26,195 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
594 public/js/lib/angular/angular.js
<
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.0.3
+ * @license AngularJS v1.0.5
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
@@ -55,8 +55,7 @@ if ('i' !== 'I'.toLowerCase()) {
function fromCharCode(code) {return String.fromCharCode(code);}
-var Error = window.Error,
- /** holds major version number for IE or NaN for real browsers */
+var /** holds major version number for IE or NaN for real browsers */
msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]),
jqLite, // delay binding since jQuery could be loaded after us.
jQuery, // delay binding
@@ -97,6 +96,30 @@ var Error = window.Error,
* @param {Object=} context Object to become context (`this`) for the iterator function.
* @returns {Object|Array} Reference to `obj`.
*/
+
+
+/**
+ * @private
+ * @param {*} obj
+ * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, ...)
+ */
+function isArrayLike(obj) {
+ if (!obj || (typeof obj.length !== 'number')) return false;
+
+ // We have on object which has length property. Should we treat it as array?
+ if (typeof obj.hasOwnProperty != 'function' &&
+ typeof obj.constructor != 'function') {
+ // This is here for IE8: it is a bogus object treat it as array;
+ return true;
+ } else {
+ return obj instanceof JQLite || // JQLite
+ (jQuery && obj instanceof jQuery) || // jQuery
+ toString.call(obj) !== '[object Object]' || // some browser native object
+ typeof obj.callee === 'function'; // arguments (on IE8 looks like regular obj)
+ }
+}
+
+
function forEach(obj, iterator, context) {
var key;
if (obj) {
@@ -108,7 +131,7 @@ function forEach(obj, iterator, context) {
}
} else if (obj.forEach && obj.forEach !== forEach) {
obj.forEach(iterator, context);
- } else if (isObject(obj) && isNumber(obj.length)) {
+ } else if (isArrayLike(obj)) {
for (key = 0; key < obj.length; key++)
iterator.call(context, obj[key], key);
} else {
@@ -153,7 +176,7 @@ function reverseParams(iteratorFn) {
/**
* A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric
* characters such as '012ABC'. The reason why we are not using simply a number counter is that
- * the number string gets longer over time, and it can also overflow, where as the the nextId
+ * the number string gets longer over time, and it can also overflow, where as the nextId
* will grow much slower, it is a string, and it will never overflow.
*
* @returns an unique alpha-numeric string
@@ -549,9 +572,7 @@ function copy(source, destination){
} else {
if (source === destination) throw Error("Can't copy equivalent objects or arrays");
if (isArray(source)) {
- while(destination.length) {
- destination.pop();
- }
+ destination.length = 0;
for ( var i = 0; i < source.length; i++) {
destination.push(copy(source[i]));
}
@@ -627,13 +648,15 @@ function equals(o1, o2) {
if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2)) return false;
keySet = {};
for(key in o1) {
- if (key.charAt(0) !== '$' && !isFunction(o1[key]) && !equals(o1[key], o2[key])) {
- return false;
- }
+ if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
+ if (!equals(o1[key], o2[key])) return false;
keySet[key] = true;
}
for(key in o2) {
- if (!keySet[key] && key.charAt(0) !== '$' && !isFunction(o2[key])) return false;
+ if (!keySet[key] &&
+ key.charAt(0) !== '$' &&
+ o2[key] !== undefined &&
+ !isFunction(o2[key])) return false;
}
return true;
}
@@ -760,9 +783,18 @@ function startingTag(element) {
// are not allowed to have children. So we just ignore it.
element.html('');
} catch(e) {}
- return jqLite('<div>').append(element).html().
- match(/^(<[^>]+>)/)[1].
- replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); });
+ // As Per DOM Standards
+ var TEXT_NODE = 3;
+ var elemHtml = jqLite('<div>').append(element).html();
+ try {
+ return element[0].nodeType === TEXT_NODE ? lowercase(elemHtml) :
+ elemHtml.
+ match(/^(<[^>]+>)/)[1].
+ replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); });
+ } catch(e) {
+ return lowercase(elemHtml);
+ }
+
}
@@ -846,7 +878,7 @@ function encodeUriQuery(val, pctEncodeSpaces) {
* Use this directive to auto-bootstrap on application. Only
* one directive can be used per HTML document. The directive
* designates the root of the application and is typically placed
- * ot the root of the page.
+ * at the root of the page.
*
* In the example below if the `ngApp` directive would not be placed
* on the `html` element then the document would not be compiled
@@ -1247,11 +1279,11 @@ function setupModuleLoader(window) {
* - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
*/
var version = {
- full: '1.0.3', // all of these placeholder strings will be replaced by rake's
+ full: '1.0.5', // all of these placeholder strings will be replaced by rake's
major: 1, // compile task
minor: 0,
- dot: 3,
- codeName: 'bouncy-thunder'
+ dot: 5,
+ codeName: 'flatulent-propulsion'
};
@@ -1423,7 +1455,7 @@ function publishExternalAPI(angular){
* - [val()](http://api.jquery.com/val/)
* - [wrap()](http://api.jquery.com/wrap/)
*
- * ## In addtion to the above, Angular privides an additional method to both jQuery and jQuery lite:
+ * ## In addtion to the above, Angular provides additional methods to both jQuery and jQuery lite:
*
* - `controller(name)` - retrieves the controller of the current element or its parent. By default
* retrieves controller associated with the `ngController` directive. If `name` is provided as
@@ -2011,14 +2043,14 @@ forEach({
children: function(element) {
var children = [];
forEach(element.childNodes, function(element){
- if (element.nodeName != '#text')
+ if (element.nodeType === 1)
children.push(element);
});
return children;
},
contents: function(element) {
- return element.childNodes;
+ return element.childNodes || [];
},
append: function(element, node) {
@@ -2081,7 +2113,16 @@ forEach({
},
next: function(element) {
- return element.nextSibling;
+ if (element.nextElementSibling) {
+ return element.nextElementSibling;
+ }
+
+ // IE8 doesn't have nextElementSibling
+ var elm = element.nextSibling;
+ while (elm != null && elm.nodeType !== 1) {
+ elm = elm.nextSibling;
+ }
+ return elm;
},
find: function(element, selector) {
@@ -2419,7 +2460,7 @@ function annotate(fn) {
* This method does not work with code minfication / obfuscation. For this reason the following annotation strategies
* are supported.
*
- * # The `$injector` property
+ * # The `$inject` property
*
* If a function has an `$inject` property and its value is an array of strings, then the strings represent names of
* services to be injected into the function.
@@ -2667,7 +2708,7 @@ function createInjector(modulesToLoad) {
}
function provider(name, provider_) {
- if (isFunction(provider_)) {
+ if (isFunction(provider_) || isArray(provider_)) {
provider_ = providerInjector.instantiate(provider_);
}
if (!provider_.$get) {
@@ -2784,7 +2825,7 @@ function createInjector(modulesToLoad) {
args.push(
locals && locals.hasOwnProperty(key)
? locals[key]
- : getService(key, path)
+ : getService(key)
);
}
if (!fn.$inject) {
@@ -2884,7 +2925,7 @@ function $AnchorScrollProvider() {
}
// does not scroll when user clicks on anchor link that is currently on
- // (no url change, no $locaiton.hash() change), browser native does scroll
+ // (no url change, no $location.hash() change), browser native does scroll
if (autoScrollingEnabled) {
$rootScope.$watch(function autoScrollWatch() {return $location.hash();},
function autoScrollWatchAction() {
@@ -3133,7 +3174,7 @@ function Browser(window, document, $log, $sniffer) {
*/
self.baseHref = function() {
var href = baseElement.attr('href');
- return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : href;
+ return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : '';
};
//////////////////////////////////////////////////////////////
@@ -3172,14 +3213,15 @@ function Browser(window, document, $log, $sniffer) {
} else {
if (isString(value)) {
cookieLength = (rawDocument.cookie = escape(name) + '=' + escape(value) + ';path=' + cookiePath).length + 1;
+
+ // per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:
+ // - 300 cookies
+ // - 20 cookies per unique domain
+ // - 4096 bytes per cookie
if (cookieLength > 4096) {
$log.warn("Cookie '"+ name +"' possibly not set or overflowed because it was too large ("+
cookieLength + " > 4096 bytes)!");
}
- if (lastCookies.length > 20) {
- $log.warn("Cookie '"+ name +"' possibly not set or overflowed because too many cookies " +
- "were already set (" + lastCookies.length + " > 20 )");
- }
}
}
} else {
@@ -3582,7 +3624,8 @@ function $CompileProvider($provide) {
Suffix = 'Directive',
COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,
CLASS_DIRECTIVE_REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/,
- MULTI_ROOT_TEMPLATE_ERROR = 'Template must have exactly one root element. was: ';
+ MULTI_ROOT_TEMPLATE_ERROR = 'Template must have exactly one root element. was: ',
+ urlSanitizationWhitelist = /^\s*(https?|ftp|mailto):/;
/**
@@ -3636,11 +3679,41 @@ function $CompileProvider($provide) {
};
+ /**
+ * @ngdoc function
+ * @name ng.$compileProvider#urlSanitizationWhitelist
+ * @methodOf ng.$compileProvider
+ * @function
+ *
+ * @description
+ * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+ * urls during a[href] sanitization.
+ *
+ * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+ *
+ * Any url about to be assigned to a[href] via data-binding is first normalized and turned into an
+ * absolute url. Afterwards the url is matched against the `urlSanitizationWhitelist` regular
+ * expression. If a match is found the original url is written into the dom. Otherwise the
+ * absolute url is prefixed with `'unsafe:'` string and only then it is written into the DOM.
+ *
+ * @param {RegExp=} regexp New regexp to whitelist urls with.
+ * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+ * chaining otherwise.
+ */
+ this.urlSanitizationWhitelist = function(regexp) {
+ if (isDefined(regexp)) {
+ urlSanitizationWhitelist = regexp;
+ return this;
+ }
+ return urlSanitizationWhitelist;
+ };
+
+
this.$get = [
'$injector', '$interpolate', '$exceptionHandler', '$http', '$templateCache', '$parse',
- '$controller', '$rootScope',
+ '$controller', '$rootScope', '$document',
function($injector, $interpolate, $exceptionHandler, $http, $templateCache, $parse,
- $controller, $rootScope) {
+ $controller, $rootScope, $document) {
var Attributes = function(element, attr) {
this.$$element = element;
@@ -3662,7 +3735,8 @@ function $CompileProvider($provide) {
*/
$set: function(key, value, writeAttr, attrName) {
var booleanKey = getBooleanAttrName(this.$$element[0], key),
- $$observers = this.$$observers;
+ $$observers = this.$$observers,
+ normalizedVal;
if (booleanKey) {
this.$$element.prop(key, value);
@@ -3681,6 +3755,19 @@ function $CompileProvider($provide) {
}
}
+
+ // sanitize a[href] values
+ if (nodeName_(this.$$element[0]) === 'A' && key === 'href') {
+ urlSanitizationNode.setAttribute('href', value);
+
+ // href property always returns normalized absolute url, so we can match against that
+ normalizedVal = urlSanitizationNode.href;
+ if (!normalizedVal.match(urlSanitizationWhitelist)) {
+ this[key] = value = 'unsafe:' + normalizedVal;
+ }
+ }
+
+
if (writeAttr !== false) {
if (value === null || value === undefined) {
this.$$element.removeAttr(attrName);
@@ -3724,7 +3811,8 @@ function $CompileProvider($provide) {
}
};
- var startSymbol = $interpolate.startSymbol(),
+ var urlSanitizationNode = $document[0].createElement('a'),
+ startSymbol = $interpolate.startSymbol(),
endSymbol = $interpolate.endSymbol(),
denormalizeTemplate = (startSymbol == '{{' || endSymbol == '}}')
? identity
@@ -3745,7 +3833,7 @@ function $CompileProvider($provide) {
// We can not compile top level text elements since text nodes can be merged and we will
// not be able to attach scope data to them, so we will wrap them in <span>
forEach($compileNodes, function(node, index){
- if (node.nodeType == 3 /* text node */) {
+ if (node.nodeType == 3 /* text node */ && node.nodeValue.match(/\S+/) /* non-empty */ ) {
$compileNodes[index] = jqLite(node).wrap('<span></span>').parent()[0];
}
});
@@ -3757,7 +3845,14 @@ function $CompileProvider($provide) {
var $linkNode = cloneConnectFn
? JQLitePrototype.clone.call($compileNodes) // IMPORTANT!!!
: $compileNodes;
- $linkNode.data('$scope', scope);
+
+ // Attach scope only to non-text nodes.
+ for(var i = 0, ii = $linkNode.length; i<ii; i++) {
+ var node = $linkNode[i];
+ if (node.nodeType == 1 /* element */ || node.nodeType == 9 /* document */) {
+ $linkNode.eq(i).data('$scope', scope);
+ }
+ }
safeAddClass($linkNode, 'ng-scope');
if (cloneConnectFn) cloneConnectFn($linkNode, scope);
if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode);
@@ -3794,68 +3889,75 @@ function $CompileProvider($provide) {
* @returns {?function} A composite linking function of all of the matched directives or null.
*/
function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority) {
- var linkFns = [],
- nodeLinkFn, childLinkFn, directives, attrs, linkFnFound;
+ var linkFns = [],
+ nodeLinkFn, childLinkFn, directives, attrs, linkFnFound;
- for(var i = 0; i < nodeList.length; i++) {
- attrs = new Attributes();
+ for(var i = 0; i < nodeList.length; i++) {
+ attrs = new Attributes();
- // we must always refer to nodeList[i] since the nodes can be replaced underneath us.
- directives = collectDirectives(nodeList[i], [], attrs, maxPriority);
+ // we must always refer to nodeList[i] since the nodes can be replaced underneath us.
+ directives = collectDirectives(nodeList[i], [], attrs, maxPriority);
- nodeLinkFn = (directives.length)
- ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement)
- : null;
+ nodeLinkFn = (directives.length)
+ ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement)
+ : null;
- childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || !nodeList[i].childNodes.length)
- ? null
- : compileNodes(nodeList[i].childNodes,
- nodeLinkFn ? nodeLinkFn.transclude : transcludeFn);
+ childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || !nodeList[i].childNodes.length)
+ ? null
+ : compileNodes(nodeList[i].childNodes,
+ nodeLinkFn ? nodeLinkFn.transclude : transcludeFn);
- linkFns.push(nodeLinkFn);
- linkFns.push(childLinkFn);
- linkFnFound = (linkFnFound || nodeLinkFn || childLinkFn);
- }
+ linkFns.push(nodeLinkFn);
+ linkFns.push(childLinkFn);
+ linkFnFound = (linkFnFound || nodeLinkFn || childLinkFn);
+ }
- // return a linking function if we have found anything, null otherwise
- return linkFnFound ? compositeLinkFn : null;
+ // return a linking function if we have found anything, null otherwise
+ return linkFnFound ? compositeLinkFn : null;
- function compositeLinkFn(scope, nodeList, $rootElement, boundTranscludeFn) {
- var nodeLinkFn, childLinkFn, node, childScope, childTranscludeFn;
+ function compositeLinkFn(scope, nodeList, $rootElement, boundTranscludeFn) {
+ var nodeLinkFn, childLinkFn, node, childScope, childTranscludeFn, i, ii, n;
- for(var i = 0, n = 0, ii = linkFns.length; i < ii; n++) {
- node = nodeList[n];
- nodeLinkFn = linkFns[i++];
- childLinkFn = linkFns[i++];
+ // copy nodeList so that linking doesn't break due to live list updates.
+ var stableNodeList = [];
+ for (i = 0, ii = nodeList.length; i < ii; i++) {
+ stableNodeList.push(nodeList[i]);
+ }
- if (nodeLinkFn) {
- if (nodeLinkFn.scope) {
- childScope = scope.$new(isObject(nodeLinkFn.scope));
- jqLite(node).data('$scope', childScope);
- } else {
- childScope = scope;
- }
- childTranscludeFn = nodeLinkFn.transclude;
- if (childTranscludeFn || (!boundTranscludeFn && transcludeFn)) {
- nodeLinkFn(childLinkFn, childScope, node, $rootElement,
- (function(transcludeFn) {
- return function(cloneFn) {
- var transcludeScope = scope.$new();
-
- return transcludeFn(transcludeScope, cloneFn).
- bind('$destroy', bind(transcludeScope, transcludeScope.$destroy));
+ for(i = 0, n = 0, ii = linkFns.length; i < ii; n++) {
+ node = stableNodeList[n];
+ nodeLinkFn = linkFns[i++];
+ childLinkFn = linkFns[i++];
+
+ if (nodeLinkFn) {
+ if (nodeLinkFn.scope) {
+ childScope = scope.$new(isObject(nodeLinkFn.scope));
+ jqLite(node).data('$scope', childScope);
+ } else {
+ childScope = scope;
+ }
+ childTranscludeFn = nodeLinkFn.transclude;
+ if (childTranscludeFn || (!boundTranscludeFn && transcludeFn)) {
+ nodeLinkFn(childLinkFn, childScope, node, $rootElement,
+ (function(transcludeFn) {
+ return function(cloneFn) {
+ var transcludeScope = scope.$new();
+ transcludeScope.$$transcluded = true;
+
+ return transcludeFn(transcludeScope, cloneFn).
+ bind('$destroy', bind(transcludeScope, transcludeScope.$destroy));
};
})(childTranscludeFn || transcludeFn)
- );
- } else {
- nodeLinkFn(childLinkFn, childScope, node, undefined, boundTranscludeFn);
- }
- } else if (childLinkFn) {
- childLinkFn(scope, node.childNodes, undefined, boundTranscludeFn);
- }
- }
- }
- }
+ );
+ } else {
+ nodeLinkFn(childLinkFn, childScope, node, undefined, boundTranscludeFn);
+ }
+ } else if (childLinkFn) {
+ childLinkFn(scope, node.childNodes, undefined, boundTranscludeFn);
+ }
+ }
+ }
+ }
/**
@@ -4002,7 +4104,7 @@ function $CompileProvider($provide) {
if (directiveValue == 'element') {
$template = jqLite(compileNode);
$compileNode = templateAttrs.$$element =
- jqLite('<!-- ' + directiveName + ': ' + templateAttrs[directiveName] + ' -->');
+ jqLite(document.createComment(' ' + directiveName + ': ' + templateAttrs[directiveName] + ' '));
compileNode = $compileNode[0];
replaceWith($rootElement, jqLite($template[0]), compileNode);
childTranscludeFn = compile($template, transcludeFn, terminalPriority);
@@ -4146,6 +4248,8 @@ function $CompileProvider($provide) {
lastValue,
parentGet, parentSet;
+ scope.$$isolateBindings[scopeName] = mode + attrName;
+
switch (mode) {
case '@': {
@@ -4356,7 +4460,7 @@ function $CompileProvider($provide) {
}
directives.unshift(derivedSyncDirective);
- afterTemplateNodeLinkFn = applyDirectivesToNode(directives, $compileNode, tAttrs, childTranscludeFn);
+ afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs, childTranscludeFn);
afterTemplateChildLinkFn = compileNodes($compileNode.contents(), childTranscludeFn);
@@ -4436,10 +4540,10 @@ function $CompileProvider($provide) {
function addAttrInterpolateDirective(node, directives, value, name) {
var interpolateFn = $interpolate(value, true);
-
// no interpolation found -> ignore
if (!interpolateFn) return;
+
directives.push({
priority: 100,
compile: valueFn(function attrInterpolateLinkFn(scope, element, attr) {
@@ -4667,11 +4771,12 @@ function $DocumentProvider(){
* the browser console.
*
* In unit tests, if `angular-mocks.js` is loaded, this service is overridden by
- * {@link ngMock.$exceptionHandler mock $exceptionHandler}
+ * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.
*
* @param {Error} exception Exception associated with the error.
* @param {string=} cause optional information about the context in which
* the error was thrown.
+ *
*/
function $ExceptionHandlerProvider() {
this.$get = ['$log', function($log){
@@ -6432,9 +6537,10 @@ function getterFn(path, csp) {
* @param {string} expression String expression to compile.
* @returns {function(context, locals)} a function which represents the compiled expression:
*
- * * `context`: an object against which any expressions embedded in the strings are evaluated
- * against (Topically a scope object).
- * * `locals`: local variables context object, useful for overriding values in `context`.
+ * * `context` – `{object}` – an object against which any expressions embedded in the strings
+ * are evaluated against (tipically a scope object).
+ * * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ * `context`.
*
* The return function also has an `assign` property, if the expression is assignable, which
* allows one to set values to expressions.
@@ -6470,8 +6576,8 @@ function $ParseProvider() {
* interface for interacting with an object that represents the result of an action that is
* performed asynchronously, and may or may not be finished at any given point in time.
*
- * From the perspective of dealing with error handling, deferred and promise apis are to
- * asynchronous programing what `try`, `catch` and `throw` keywords are to synchronous programing.
+ * From the perspective of dealing with error handling, deferred and promise APIs are to
+ * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.
*
* <pre>
* // for the purpose of this example let's assume that variables `$q` and `scope` are
@@ -6505,7 +6611,7 @@ function $ParseProvider() {
*
* At first it might not be obvious why this extra complexity is worth the trouble. The payoff
* comes in the way of
- * [guarantees that promise and deferred apis make](https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md).
+ * [guarantees that promise and deferred APIs make](https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md).
*
* Additionally the promise api allows for composition that is very hard to do with the
* traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.
@@ -6517,7 +6623,7 @@ function $ParseProvider() {
*
* A new instance of deferred is constructed by calling `$q.defer()`.
*
- * The purpose of the deferred object is to expose the associated Promise instance as well as apis
+ * The purpose of the deferred object is to expose the associated Promise instance as well as APIs
* that can be used for signaling the successful or unsuccessful completion of the task.
*
* **Methods**
@@ -6560,7 +6666,7 @@ function $ParseProvider() {
* return result + 1;
* });
*
- * // promiseB will be resolved immediately after promiseA is resolved and it's value will be
+ * // promiseB will be resolved immediately after promiseA is resolved and its value will be
* // the result of promiseA incremented by 1
* </pre>
*
@@ -6581,6 +6687,30 @@ function $ParseProvider() {
* you can treat promises attached to a scope as if they were the resulting values.
* - Q has many more features that $q, but that comes at a cost of bytes. $q is tiny, but contains
* all the important functionality needed for common async tasks.
+ *
+ * # Testing
+ *
+ * <pre>
+ * it('should simulate promise', inject(function($q, $rootScope) {
+ * var deferred = $q.defer();
+ * var promise = deferred.promise;
+ * var resolvedValue;
+ *
+ * promise.then(function(value) { resolvedValue = value; });
+ * expect(resolvedValue).toBeUndefined();
+ *
+ * // Simulate resolving of promise
+ * deferred.resolve(123);
+ * // Note that the 'then' function does not get called synchronously.
+ * // This is because we want the promise API to always be async, whether or not
+ * // it got called synchronously or asynchronously.
+ * expect(resolvedValue).toBeUndefined();
+ *
+ * // Propagate promise resolution to 'then' functions using $apply().
+ * $rootScope.$apply();
+ * expect(resolvedValue).toEqual(123);
+ * });
+ * </pre>
*/
function $QProvider() {
@@ -6746,12 +6876,12 @@ function qFactory(nextTick, exceptionHandler) {
* @methodOf ng.$q
* @description
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.
- * This is useful when you are dealing with on object that might or might not be a promise, or if
+ * This is useful when you are dealing with an object that might or might not be a promise, or if
* the promise comes from a source that can't be trusted.
*
* @param {*} value Value or a promise
* @returns {Promise} Returns a single promise that will be resolved with an array of values,
- * each value coresponding to the promise at the same index in the `promises` array. If any of
+ * each value corresponding to the promise at the same index in the `promises` array. If any of
* the promises is resolved with a rejection, this resulting promise will be resolved with the
* same rejection.
*/
@@ -6813,7 +6943,7 @@ function qFactory(nextTick, exceptionHandler) {
*
* @param {Array.<Promise>} promises An array of promises.
* @returns {Promise} Returns a single promise that will be resolved with an array of values,
- * each value coresponding to the promise at the same index in the `promises` array. If any of
+ * each value corresponding to the promise at the same index in the `promises` array. If any of
* the promises is resolved with a rejection, this resulting promise will be resolved with the
* same rejection.
*/
@@ -6867,8 +6997,13 @@ function $RouteProvider(){
*
* @param {string} path Route path (matched against `$location.path`). If `$location.path`
* contains redundant trailing slash or is missing one, the route will still match and the
- * `$location.path` will be updated to add or drop the trailing slash to exacly match the
+ * `$location.path` will be updated to add or drop the trailing slash to exactly match the
* route definition.
+ *
+ * `path` can contain named groups starting with a colon (`:name`). All characters up to the
+ * next slash are matched and stored in `$routeParams` under the given `name` when the route
+ * matches.
+ *
* @param {Object} route Mapping information to be assigned to `$route.current` on route
* match.
*
@@ -7133,8 +7268,7 @@ function $RouteProvider(){
* instance of the Controller.
*/
- var matcher = switchRouteMatcher,
- forceReload = false,
+ var forceReload = false,
$route = {
routes: routes,
@@ -7162,21 +7296,36 @@ function $RouteProvider(){
/////////////////////////////////////////////////////
+ /**
+ * @param on {string} current url
+ * @param when {string} route when template to match the url against
+ * @return {?Object}
+ */
function switchRouteMatcher(on, when) {
// TODO(i): this code is convoluted and inefficient, we should construct the route matching
// regex only once and then reuse it
- var regex = '^' + when.replace(/([\.\\\(\)\^\$])/g, "\\$1") + '$',
+
+ // Escape regexp special characters.
+ when = '^' + when.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&") + '$';
+ var regex = '',
params = [],
dst = {};
- forEach(when.split(/\W/), function(param) {
- if (param) {
- var paramRegExp = new RegExp(":" + param + "([\\W])");
- if (regex.match(paramRegExp)) {
- regex = regex.replace(paramRegExp, "([^\\/]*)$1");
- params.push(param);
- }
- }
- });
+
+ var re = /:(\w+)/g,
+ paramMatch,
+ lastMatchedIndex = 0;
+
+ while ((paramMatch = re.exec(when)) !== null) {
+ // Find each :param in `when` and replace it with a capturing group.
+ // Append all other sections of when unchanged.
+ regex += when.slice(lastMatchedIndex, paramMatch.index);
+ regex += '([^\\/]*)';
+ params.push(paramMatch[1]);
+ lastMatchedIndex = re.lastIndex;
+ }
+ // Append trailing path part.
+ regex += when.substr(lastMatchedIndex);
+
var match = on.match(new RegExp(regex));
if (match) {
forEach(params, function(name, index) {
@@ -7265,7 +7414,7 @@ function $RouteProvider(){
// Match a route
var params, match;
forEach(routes, function(route, path) {
- if (!match && (params = matcher($location.path(), path))) {
+ if (!match && (params = switchRouteMatcher($location.path(), path))) {
match = inherit(route, {
params: extend({}, $location.search(), params),
pathParams: params});
@@ -7417,7 +7566,7 @@ function $RootScopeProvider(){
expect(scope.greeting).toEqual(undefined);
scope.$watch('name', function() {
- this.greeting = this.salutation + ' ' + this.name + '!';
+ scope.greeting = scope.salutation + ' ' + scope.name + '!';
}); // initialize the watch
expect(scope.greeting).toEqual(undefined);
@@ -7460,8 +7609,10 @@ function $RootScopeProvider(){
this.$$nextSibling = this.$$prevSibling =
this.$$childHead = this.$$childTail = null;
this['this'] = this.$root = this;
+ this.$$destroyed = false;
this.$$asyncQueue = [];
this.$$listeners = {};
+ this.$$isolateBindings = {};
}
/**
@@ -7578,7 +7729,7 @@ function $RootScopeProvider(){
scope.counter = 0;
expect(scope.counter).toEqual(0);
- scope.$watch('name', function(newValue, oldValue) { counter = counter + 1; });
+ scope.$watch('name', function(newValue, oldValue) { scope.counter = scope.counter + 1; });
expect(scope.counter).toEqual(0);
scope.$digest();
@@ -7671,7 +7822,7 @@ function $RootScopeProvider(){
expect(scope.counter).toEqual(0);
scope.$watch('name', function(newValue, oldValue) {
- counter = counter + 1;
+ scope.counter = scope.counter + 1;
});
expect(scope.counter).toEqual(0);
@@ -7793,10 +7944,12 @@ function $RootScopeProvider(){
* perform any necessary cleanup.
*/
$destroy: function() {
- if ($rootScope == this) return; // we can't remove the root node;
+ // we can't destroy the root scope or a scope that has been already destroyed
+ if ($rootScope == this || this.$$destroyed) return;
var parent = this.$parent;
this.$broadcast('$destroy');
+ this.$$destroyed = true;
if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
@@ -7941,10 +8094,6 @@ function $RootScopeProvider(){
* Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for discussion of
* event life cycle.
*
- * @param {string} name Event name to listen on.
- * @param {function(event)} listener Function to call when the event is emitted.
- * @returns {function()} Returns a deregistration function for this listener.
- *
* The event listener function format is: `function(event, args...)`. The `event` object
* passed into the listener has the following attributes:
*
@@ -7955,6 +8104,10 @@ function $RootScopeProvider(){
* propagation (available only for events that were `$emit`-ed).
* - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag to true.
* - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.
+ *
+ * @param {string} name Event name to listen on.
+ * @param {function(event, args...)} listener Function to call when the event is emitted.
+ * @returns {function()} Returns a deregistration function for this listener.
*/
$on: function(name, listener) {
var namedListeners = this.$$listeners[name];
@@ -8132,7 +8285,7 @@ function $RootScopeProvider(){
/**
* function used as an initial value for watchers.
- * because it's uniqueue we can easily tell it apart from other values
+ * because it's unique we can easily tell it apart from other values
*/
function initWatchVal() {}
}];
@@ -8346,7 +8499,7 @@ function $HttpProvider() {
/**
* @ngdoc function
* @name ng.$http
- * @requires $httpBacked
+ * @requires $httpBackend
* @requires $browser
* @requires $cacheFactory
* @requires $rootScope
@@ -8382,8 +8535,7 @@ function $HttpProvider() {
* }).
* error(function(data, status, headers, config) {
* // called asynchronously if an error occurs
- * // or server returns response with status
- * // code outside of the <200, 400) range
+ * // or server returns response with an error status.
* });
* </pre>
*
@@ -8392,6 +8544,10 @@ function $HttpProvider() {
* an object representing the response. See the api signature and type info below for more
* details.
*
+ * A response status code that falls in the [200, 300) range is considered a success status and
+ * will result in the success callback being called. Note that if the response is a redirect,
+ * XMLHttpRequest will transparently follow it, meaning that the error callback will not be
+ * called for such responses.
*
* # Shortcut methods
*
@@ -9040,8 +9196,30 @@ function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument,
// always async
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
- completeRequest(
- callback, status || xhr.status, xhr.responseText, xhr.getAllResponseHeaders());
+ var responseHeaders = xhr.getAllResponseHeaders();
+
+ // TODO(vojta): remove once Firefox 21 gets released.
+ // begin: workaround to overcome Firefox CORS http response headers bug
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=608735
+ // Firefox already patched in nightly. Should land in Firefox 21.
+
+ // CORS "simple response headers" http://www.w3.org/TR/cors/
+ var value,
+ simpleHeaders = ["Cache-Control", "Content-Language", "Content-Type",
+ "Expires", "Last-Modified", "Pragma"];
+ if (!responseHeaders) {
+ responseHeaders = "";
+ forEach(simpleHeaders, function (header) {
+ var value = xhr.getResponseHeader(header);
+ if (value) {
+ responseHeaders += header + ": " + value + "\n";
+ }
+ });
+ }
+ // end of the workaround.
+
+ completeRequest(callback, status || xhr.status, xhr.responseText,
+ responseHeaders);
}
};
@@ -9440,7 +9618,7 @@ function $FilterProvider($provide) {
*/
function filterFilter() {
return function(array, expression) {
- if (!(array instanceof Array)) return array;
+ if (!isArray(array)) return array;
var predicates = [];
predicates.check = function(value) {
for (var j = 0; j < predicates.length; j++) {
@@ -9689,7 +9867,7 @@ function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
fraction += '0';
}
- if (fractionSize) formatedText += decimalSep + fraction.substr(0, fractionSize);
+ if (fractionSize && fractionSize !== "0") formatedText += decimalSep + fraction.substr(0, fractionSize);
}
parts.push(isNegative ? pattern.negPre : pattern.posPre);
@@ -9732,8 +9910,12 @@ function dateStrGetter(name, shortForm) {
}
function timeZoneGetter(date) {
- var offset = date.getTimezoneOffset();
- return padNumber(offset / 60, 2) + padNumber(Math.abs(offset % 60), 2);
+ var zone = -1 * date.getTimezoneOffset();
+ var paddedZone = (zone >= 0) ? "+" : "";
+
+ paddedZone += padNumber(zone / 60, 2) + padNumber(Math.abs(zone % 60), 2);
+
+ return paddedZone;
}
function ampmGetter(date, formats) {
@@ -9819,7 +10001,8 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+
*
* @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or
* number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.SSSZ and it's
- * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ).
+ * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is
+ * specified in the string input, the time is considered to be in the local timezone.
* @param {string=} format Formatting rules (see Description). If not specified,
* `mediumDate` is used.
* @returns {string} Formatted string or the input if input is not recognized as date/millis.
@@ -9839,7 +10022,7 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+
expect(binding("1288323623006 | date:'medium'")).
toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/);
expect(binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).
- toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} \-?\d{4}/);
+ toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/);
expect(binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).
toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/);
});
@@ -10145,7 +10328,7 @@ function limitToFilter(){
orderByFilter.$inject = ['$parse'];
function orderByFilter($parse){
return function(array, sortPredicate, reverseOrder) {
- if (!(array instanceof Array)) return array;
+ if (!isArray(array)) return array;
if (!sortPredicate) return array;
sortPredicate = isArray(sortPredicate) ? sortPredicate: [sortPredicate];
sortPredicate = map(sortPredicate, function(predicate){
@@ -10213,15 +10396,25 @@ function ngDirective(directive) {
*
* The reasoning for this change is to allow easy creation of action links with `ngClick` directive
* without changing the location or causing page reloads, e.g.:
- * <a href="" ng-click="model.$save()">Save</a>
+ * `<a href="" ng-click="model.$save()">Save</a>`
*/
var htmlAnchorDirective = valueFn({
restrict: 'E',
compile: function(element, attr) {
- // turn <a href ng-click="..">link</a> into a link in IE
- // but only if it doesn't have name attribute, in which case it's an anchor
- if (!attr.href) {
- attr.$set('href', '');
+
+ if (msie <= 8) {
+
+ // turn <a href ng-click="..">link</a> into a stylable link in IE
+ // but only if it doesn't have name attribute, in which case it's an anchor
+ if (!attr.href && !attr.name) {
+ attr.$set('href', '');
+ }
+
+ // add a comment node to anchors to workaround IE bug that causes element content to be reset
+ // to new attribute content if attribute is updated with value containing @ and element also
+ // contains value with @
+ // see issue #1949
+ element.append(document.createComment('IE fix'));
}
return function(scope, element) {
@@ -10229,7 +10422,6 @@ var htmlAnchorDirective = valueFn({
// if we have no href url, then don't navigate anywhere.
if (!element.attr('href')) {
event.preventDefault();
- return false; // Needed for opera
}
});
}
@@ -10302,7 +10494,7 @@ var htmlAnchorDirective = valueFn({
it('should execute ng-click but not reload when no href but name specified', function() {
element('#link-5').click();
expect(input('value').val()).toEqual('5');
- expect(element('#link-5').attr('href')).toBe('');
+ expect(element('#link-5').attr('href')).toBe(undefined);
});
it('should only change url when only ng-href', function() {
@@ -10545,8 +10737,9 @@ forEach(['src', 'href'], function(attrName) {
// on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist
// then calling element.setAttribute('src', 'foo') doesn't do anything, so we need
- // to set the property as well to achieve the desired effect
- if (msie) element.prop(attrName, value);
+ // to set the property as well to achieve the desired effect.
+ // we use attr[attrName] value since $set can sanitize the url.
+ if (msie) element.prop(attrName, attr[attrName]);
});
}
};
@@ -10566,13 +10759,13 @@ var nullFormCtrl = {
*
* @property {boolean} $pristine True if user has not interacted with the form yet.
* @property {boolean} $dirty True if user has already interacted with the form.
- * @property {boolean} $valid True if all of the containg forms and controls are valid.
+ * @property {boolean} $valid True if all of the containing forms and controls are valid.
* @property {boolean} $invalid True if at least one containing control or form is invalid.
*
* @property {Object} $error Is an object hash, containing references to all invalid controls or
* forms, where:
*
- * - keys are validation tokens (error names) — such as `REQUIRED`, `URL` or `EMAIL`),
+ * - keys are validation tokens (error names) — such as `required`, `url` or `email`),
* - values are arrays of controls or forms that are invalid with given error.
*
* @description
@@ -10685,7 +10878,7 @@ function FormController(element, attrs) {
* does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a
* sub-group of controls needs to be determined.
*
- * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into
+ * @param {string=} name|ngForm Name of the form. If specified, the form controller will be published into
* related scope, under this name.
*
*/
@@ -10758,12 +10951,12 @@ function FormController(element, attrs) {
</script>
<form name="myForm" ng-controller="Ctrl">
userType: <input name="input" ng-model="userType" required>
- <span class="error" ng-show="myForm.input.$error.REQUIRED">Required!</span><br>
+ <span class="error" ng-show="myForm.input.$error.required">Required!</span><br>
<tt>userType = {{userType}}</tt><br>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br>
<tt>myForm.input.$error = {{myForm.input.$error}}</tt><br>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br>
- <tt>myForm.$error.REQUIRED = {{!!myForm.$error.REQUIRED}}</tt><br>
+ <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>
</form>
</doc:source>
<doc:scenario>
@@ -12251,6 +12444,7 @@ var ngBindHtmlUnsafeDirective = [function() {
function classDirective(name, selector) {
name = 'ngClass' + name;
return ngDirective(function(scope, element, attr) {
+ var oldVal = undefined;
scope.$watch(attr[name], ngClassWatchAction, true);
@@ -12274,13 +12468,14 @@ function classDirective(name, selector) {
}
- function ngClassWatchAction(newVal, oldVal) {
+ function ngClassWatchAction(newVal) {
if (selector === true || scope.$index % 2 === selector) {
if (oldVal && (newVal !== oldVal)) {
removeClass(oldVal);
}