From cfc03e3fd478270a4c36caf987019eb2eacbb6af Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sun, 9 Feb 2014 22:18:09 +0100 Subject: [PATCH] Changes for Angular version of JSDE --- .gitignore | 3 + public_html/static/css/openng.css | 4 + public_html/static/js/angular-filters.min.js | 1 + public_html/static/js/angular.min.js | 202 ++++++++++ public_html/static/js/jsde-angular.js | 227 +++++++++++ public_html/static/js/openng.js | 352 +---------------- public_html/static/js/openng.old.js | 360 ++++++++++++++++++ public_html/templates/angular/jsde-error.html | 9 + .../templates/angular/jsde-notification.html | 9 + .../templates/angular/jsde-window.html | 18 + public_html/templates/index.tpl | 50 +-- public_html/templates/nodes/lookup.tpl | 46 ++- sass-watch.sh | 3 + scss/openng.scss | 18 +- 14 files changed, 891 insertions(+), 411 deletions(-) create mode 100644 public_html/static/js/angular-filters.min.js create mode 100644 public_html/static/js/angular.min.js create mode 100644 public_html/static/js/jsde-angular.js create mode 100644 public_html/static/js/openng.old.js create mode 100644 public_html/templates/angular/jsde-error.html create mode 100644 public_html/templates/angular/jsde-notification.html create mode 100644 public_html/templates/angular/jsde-window.html create mode 100755 sass-watch.sh diff --git a/.gitignore b/.gitignore index 189a89b..3b9e13c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ config.json .sass-cache +sasswatch.log +sasswatch.err +sasswatch.pid diff --git a/public_html/static/css/openng.css b/public_html/static/css/openng.css index dd0a93a..7982e3c 100644 --- a/public_html/static/css/openng.css +++ b/public_html/static/css/openng.css @@ -249,3 +249,7 @@ i.notification { width: 40%; text-align: right; font-weight: bold; } +.window-inner .node-lookup form.property-add input { + width: 100%; } +.window-inner .node-lookup form.property-add .property-name input { + text-align: right; } diff --git a/public_html/static/js/angular-filters.min.js b/public_html/static/js/angular-filters.min.js new file mode 100644 index 0000000..86e1721 --- /dev/null +++ b/public_html/static/js/angular-filters.min.js @@ -0,0 +1 @@ +angular.module("frapontillo.ex.filters",[]),angular.module("frapontillo",["ex.filters"]),angular.module("frapontillo.ex.filters").filter("bool",function(){return function(r,i,n){return out=r!==!0?n:i}}),angular.module("frapontillo.ex.filters").filter("default",function(){return function(r,i){return out=null==r||void 0==r||""==r&&!angular.isNumber(r)?i||"":r}}),angular.module("frapontillo.ex.filters").filter("firstNotNull",function(){return function(r){var n=void 0;if(r){var l=r.length-1;for(i=0;l>=i;i++)if(void 0!=r[i])return r[i]}return n}}),angular.module("frapontillo.ex.filters").filter("lastNotNull",function(){return function(r){var n=void 0;if(r){var l=r.length-1;for(i=l;i>=0;i--)if(void 0!=r[i])return r[i]}return n}}),angular.module("frapontillo.ex.filters").filter("max",function(){return function(r){var i=void 0;if(r)for(var n in r)(r[n]>i||void 0==i)&&(i=r[n]);return i}}),angular.module("frapontillo.ex.filters").filter("min",function(){return function(r){var i=void 0;if(r)for(var n in r)(i>r[n]||void 0==i)&&(i=r[n]);return i}}); diff --git a/public_html/static/js/angular.min.js b/public_html/static/js/angular.min.js new file mode 100644 index 0000000..e121c5b --- /dev/null +++ b/public_html/static/js/angular.min.js @@ -0,0 +1,202 @@ +/* + AngularJS v1.2.10 + (c) 2010-2014 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(Z,Q,r){'use strict';function F(b){return function(){var a=arguments[0],c,a="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.2.10/"+(b?b+"/":"")+a;for(c=1;c").append(b).html();try{return 3===b[0].nodeType?x(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/, +function(a,b){return"<"+x(b)})}catch(d){return x(c)}}function Wb(b){try{return decodeURIComponent(b)}catch(a){}}function Xb(b){var a={},c,d;q((b||"").split("&"),function(b){b&&(c=b.split("="),d=Wb(c[0]),B(d)&&(b=B(c[1])?Wb(c[1]):!0,a[d]?K(a[d])?a[d].push(b):a[d]=[a[d],b]:a[d]=b))});return a}function Yb(b){var a=[];q(b,function(b,d){K(b)?q(b,function(b){a.push(wa(d,!0)+(!0===b?"":"="+wa(b,!0)))}):a.push(wa(d,!0)+(!0===b?"":"="+wa(b,!0)))});return a.length?a.join("&"):""}function tb(b){return wa(b, +!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function wa(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,a?"%20":"+")}function Tc(b,a){function c(a){a&&d.push(a)}var d=[b],e,g,f=["ng:app","ng-app","x-ng-app","data-ng-app"],h=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;q(f,function(a){f[a]=!0;c(Q.getElementById(a));a=a.replace(":","\\:");b.querySelectorAll&&(q(b.querySelectorAll("."+a),c),q(b.querySelectorAll("."+ +a+"\\:"),c),q(b.querySelectorAll("["+a+"]"),c))});q(d,function(a){if(!e){var b=h.exec(" "+a.className+" ");b?(e=a,g=(b[2]||"").replace(/\s+/g,",")):q(a.attributes,function(b){!e&&f[b.name]&&(e=a,g=b.value)})}});e&&a(e,g?[g]:[])}function Zb(b,a){var c=function(){b=A(b);if(b.injector()){var c=b[0]===Q?"document":ga(b);throw Oa("btstrpd",c);}a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);a.unshift("ng");c=$b(a);c.invoke(["$rootScope","$rootElement","$compile","$injector","$animate", +function(a,b,c,d,e){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},d=/^NG_DEFER_BOOTSTRAP!/;if(Z&&!d.test(Z.name))return c();Z.name=Z.name.replace(d,"");Ca.resumeBootstrap=function(b){q(b,function(b){a.push(b)});c()}}function db(b,a){a=a||"_";return b.replace(Uc,function(b,d){return(d?a:"")+b.toLowerCase()})}function ub(b,a,c){if(!b)throw Oa("areq",a||"?",c||"required");return b}function Qa(b,a,c){c&&K(b)&&(b=b[b.length-1]);ub(L(b),a,"not a function, got "+(b&&"object"==typeof b? +b.constructor.name||"Object":typeof b));return b}function xa(b,a){if("hasOwnProperty"===b)throw Oa("badname",a);}function vb(b,a,c){if(!a)return b;a=a.split(".");for(var d,e=b,g=a.length,f=0;f "+b;a.removeChild(a.firstChild);zb(this,a.childNodes);A(Q.createDocumentFragment()).append(this)}else zb(this, +b)}function Ab(b){return b.cloneNode(!0)}function Ea(b){ac(b);var a=0;for(b=b.childNodes||[];a=M?(c.preventDefault=null,c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)};c.elem=b;return c}function Fa(b){var a=typeof b,c;"object"==a&&null!==b?"function"==typeof(c=b.$$hashKey)?c=b.$$hashKey():c=== +r&&(c=b.$$hashKey=$a()):c=b;return a+":"+c}function Ta(b){q(b,this.put,this)}function hc(b){var a,c;"function"==typeof b?(a=b.$inject)||(a=[],b.length&&(c=b.toString().replace($c,""),c=c.match(ad),q(c[1].split(bd),function(b){b.replace(cd,function(b,c,d){a.push(d)})})),b.$inject=a):K(b)?(c=b.length-1,Qa(b[c],"fn"),a=b.slice(0,c)):Qa(b,"fn",!0);return a}function $b(b){function a(a){return function(b,c){if(X(b))q(b,Qb(a));else return a(b,c)}}function c(a,b){xa(a,"service");if(L(b)||K(b))b=n.instantiate(b); +if(!b.$get)throw Ua("pget",a);return l[a+h]=b}function d(a,b){return c(a,{$get:b})}function e(a){var b=[],c,d,g,h;q(a,function(a){if(!k.get(a)){k.put(a,!0);try{if(D(a))for(c=Va(a),b=b.concat(e(c.requires)).concat(c._runBlocks),d=c._invokeQueue,g=0,h=d.length;g 4096 bytes)!"));else{if(m.cookie!==J)for(J=m.cookie,d=J.split("; "),V={},g=0;gk&&this.remove(p.key),b},get:function(a){var b=l[a];if(b)return e(b),m[a]},remove:function(a){var b=l[a];b&&(b==n&&(n=b.p),b==p&&(p=b.n),g(b.n,b.p),delete l[a],delete m[a],f--)},removeAll:function(){m={};f=0;l={};n=p=null},destroy:function(){l=h=m=null;delete a[b]},info:function(){return t({},h,{size:f})}}}var a={};b.info=function(){var b={};q(a,function(a,e){b[e]=a.info()});return b};b.get=function(b){return a[b]}; +return b}}function hd(){this.$get=["$cacheFactory",function(b){return b("templates")}]}function jc(b,a){var c={},d="Directive",e=/^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,g=/(([\d\w\-_]+)(?:\:([^;]+))?;?)/,f=/^(on[a-z]+|formaction)$/;this.directive=function m(a,e){xa(a,"directive");D(a)?(ub(e,"directiveFactory"),c.hasOwnProperty(a)||(c[a]=[],b.factory(a+d,["$injector","$exceptionHandler",function(b,d){var e=[];q(c[a],function(c,g){try{var f=b.invoke(c);L(f)?f={compile:$(f)}:!f.compile&&f.link&&(f.compile= +$(f.link));f.priority=f.priority||0;f.index=g;f.name=f.name||a;f.require=f.require||f.controller&&f.name;f.restrict=f.restrict||"A";e.push(f)}catch(m){d(m)}});return e}])),c[a].push(e)):q(a,Qb(m));return this};this.aHrefSanitizationWhitelist=function(b){return B(b)?(a.aHrefSanitizationWhitelist(b),this):a.aHrefSanitizationWhitelist()};this.imgSrcSanitizationWhitelist=function(b){return B(b)?(a.imgSrcSanitizationWhitelist(b),this):a.imgSrcSanitizationWhitelist()};this.$get=["$injector","$interpolate", +"$exceptionHandler","$http","$templateCache","$parse","$controller","$rootScope","$document","$sce","$animate","$$sanitizeUri",function(a,b,l,n,p,s,C,y,E,u,R,H){function v(a,b,c,d,e){a instanceof A||(a=A(a));q(a,function(b,c){3==b.nodeType&&b.nodeValue.match(/\S+/)&&(a[c]=A(b).wrap("").parent()[0])});var g=N(a,b,a,c,d,e);ha(a,"ng-scope");return function(b,c,d){ub(b,"scope");var e=c?Ga.clone.call(a):a;q(d,function(a,b){e.data("$"+b+"Controller",a)});d=0;for(var f=e.length;darguments.length&&(b=a, +a=r);z&&(c=ca);return p(a,b,c)}var I,v,N,u,P,J,ca={},hb;I=c===g?d:Tb(d,new Fb(A(g),d.$attr));v=I.$$element;if(H){var T=/^\s*([@=&])(\??)\s*(\w*)\s*$/;f=A(g);J=e.$new(!0);ia&&ia===H.$$originalDirective?f.data("$isolateScope",J):f.data("$isolateScopeNoTemplate",J);ha(f,"ng-isolate-scope");q(H.scope,function(a,c){var d=a.match(T)||[],g=d[3]||c,f="?"==d[2],d=d[1],m,l,n,p;J.$$isolateBindings[c]=d+g;switch(d){case "@":I.$observe(g,function(a){J[c]=a});I.$$observers[g].$$scope=e;I[g]&&(J[c]=b(I[g])(e)); +break;case "=":if(f&&!I[g])break;l=s(I[g]);p=l.literal?ua:function(a,b){return a===b};n=l.assign||function(){m=J[c]=l(e);throw ja("nonassign",I[g],H.name);};m=J[c]=l(e);J.$watch(function(){var a=l(e);p(a,J[c])||(p(a,m)?n(e,a=J[c]):J[c]=a);return m=a},null,l.literal);break;case "&":l=s(I[g]);J[c]=function(a){return l(e,a)};break;default:throw ja("iscp",H.name,c,a);}})}hb=p&&y;V&&q(V,function(a){var b={$scope:a===H||a.$$isolateScope?J:e,$element:v,$attrs:I,$transclude:hb},c;P=a.controller;"@"==P&&(P= +I[a.name]);c=C(P,b);ca[a.name]=c;z||v.data("$"+a.name+"Controller",c);a.controllerAs&&(b.$scope[a.controllerAs]=c)});f=0;for(N=m.length;fG.priority)break;if(U=G.scope)u=u||G,G.templateUrl||(x("new/isolated scope",H,G,t),X(U)&&(H=G));da=G.name;!G.templateUrl&&G.controller&&(U=G.controller,V=V||{},x("'"+da+"' controller",V[da],G,t),V[da]=G);if(U=G.transclude)T=!0,G.$$tlb||(x("transclusion",p,G,t),p=G),"element"==U?(z=!0,N=G.priority,U=ca(c,Wa,S), +t=d.$$element=A(Q.createComment(" "+da+": "+d[da]+" ")),c=t[0],ib(g,A(va.call(U,0)),c),F=v(U,e,N,f&&f.name,{nonTlbTranscludeDirective:p})):(U=A(Ab(c)).contents(),t.empty(),F=v(U,e));if(G.template)if(x("template",ia,G,t),ia=G,U=L(G.template)?G.template(t,d):G.template,U=Y(U),G.replace){f=G;U=A("
"+ba(U)+"
").contents();c=U[0];if(1!=U.length||1!==c.nodeType)throw ja("tplrt",da,"");ib(g,t,c);na={$attr:{}};U=J(c,[],na);var W=a.splice(M+1,a.length-(M+1));H&&ic(U);a=a.concat(U).concat(W);B(d,na); +na=a.length}else t.html(U);if(G.templateUrl)x("template",ia,G,t),ia=G,G.replace&&(f=G),E=w(a.splice(M,a.length-M),t,d,g,F,m,n,{controllerDirectives:V,newIsolateScopeDirective:H,templateDirective:ia,nonTlbTranscludeDirective:p}),na=a.length;else if(G.compile)try{O=G.compile(t,d,F),L(O)?y(null,O,Wa,S):O&&y(O.pre,O.post,Wa,S)}catch(Z){l(Z,ga(t))}G.terminal&&(E.terminal=!0,N=Math.max(N,G.priority))}E.scope=u&&!0===u.scope;E.transclude=T&&F;return E}function ic(a){for(var b=0,c=a.length;bp.priority)&&-1!=p.restrict.indexOf(g)&&(s&&(p=Sb(p,{$$start:s,$$end:n})),b.push(p),k=p)}catch(v){l(v)}}return k}function B(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;q(a,function(d,e){"$"!=e.charAt(0)&&(b[e]&&(d+=("style"===e?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});q(b,function(b,g){"class"==g?(ha(e,b),a["class"]=(a["class"]?a["class"]+ +" ":"")+b):"style"==g?(e.attr("style",e.attr("style")+";"+b),a.style=(a.style?a.style+";":"")+b):"$"==g.charAt(0)||a.hasOwnProperty(g)||(a[g]=b,d[g]=c[g])})}function w(a,b,c,d,e,g,f,m){var k=[],s,l,C=b[0],y=a.shift(),v=t({},y,{templateUrl:null,transclude:null,replace:null,$$originalDirective:y}),R=L(y.templateUrl)?y.templateUrl(b,c):y.templateUrl;b.empty();n.get(u.getTrustedResourceUrl(R),{cache:p}).success(function(n){var p,E;n=Y(n);if(y.replace){n=A("
"+ba(n)+"
").contents();p=n[0];if(1!= +n.length||1!==p.nodeType)throw ja("tplrt",y.name,R);n={$attr:{}};ib(d,b,p);var u=J(p,[],n);X(y.scope)&&ic(u);a=u.concat(a);B(c,n)}else p=C,b.html(n);a.unshift(v);s=ia(a,p,c,e,b,y,g,f,m);q(d,function(a,c){a==p&&(d[c]=b[0])});for(l=N(b[0].childNodes,e);k.length;){n=k.shift();E=k.shift();var H=k.shift(),ha=k.shift(),u=b[0];E!==C&&(u=Ab(p),ib(H,A(E),u));E=s.transclude?V(n,s.transclude):ha;s(l,n,u,d,E)}k=null}).error(function(a,b,c,d){throw ja("tpload",d.url);});return function(a,b,c,d,e){k?(k.push(b), +k.push(c),k.push(d),k.push(e)):s(l,b,c,d,e)}}function z(a,b){var c=b.priority-a.priority;return 0!==c?c:a.name!==b.name?a.namea.status?b:n.reject(b)}var d={transformRequest:e.transformRequest,transformResponse:e.transformResponse},g=function(a){function b(a){var c;q(a,function(b, +d){L(b)&&(c=b(),null!=c?a[d]=c:delete a[d])})}var c=e.headers,d=t({},a.headers),g,f,c=t({},c.common,c[x(a.method)]);b(c);b(d);a:for(g in c){a=x(g);for(f in d)if(x(f)===a)continue a;d[g]=c[g]}return d}(a);t(d,a);d.headers=g;d.method=Ia(d.method);(a=Gb(d.url)?b.cookies()[d.xsrfCookieName||e.xsrfCookieName]:r)&&(g[d.xsrfHeaderName||e.xsrfHeaderName]=a);var f=[function(a){g=a.headers;var b=oc(a.data,nc(g),a.transformRequest);z(a.data)&&q(g,function(a,b){"content-type"===x(b)&&delete g[b]});z(a.withCredentials)&& +!z(e.withCredentials)&&(a.withCredentials=e.withCredentials);return C(a,b,g).then(c,c)},r],h=n.when(d);for(q(u,function(a){(a.request||a.requestError)&&f.unshift(a.request,a.requestError);(a.response||a.responseError)&&f.push(a.response,a.responseError)});f.length;){a=f.shift();var k=f.shift(),h=h.then(a,k)}h.success=function(a){h.then(function(b){a(b.data,b.status,b.headers,d)});return h};h.error=function(a){h.then(null,function(b){a(b.data,b.status,b.headers,d)});return h};return h}function C(b, +c,g){function f(a,b,c){u&&(200<=a&&300>a?u.put(r,[a,b,mc(c)]):u.remove(r));m(b,a,c);d.$$phase||d.$apply()}function m(a,c,d){c=Math.max(c,0);(200<=c&&300>c?p.resolve:p.reject)({data:a,status:c,headers:nc(d),config:b})}function k(){var a=bb(s.pendingRequests,b);-1!==a&&s.pendingRequests.splice(a,1)}var p=n.defer(),C=p.promise,u,q,r=y(b.url,b.params);s.pendingRequests.push(b);C.then(k,k);(b.cache||e.cache)&&(!1!==b.cache&&"GET"==b.method)&&(u=X(b.cache)?b.cache:X(e.cache)?e.cache:E);if(u)if(q=u.get(r), +B(q)){if(q.then)return q.then(k,k),q;K(q)?m(q[1],q[0],aa(q[2])):m(q,200,{})}else u.put(r,C);z(q)&&a(b.method,r,c,f,g,b.timeout,b.withCredentials,b.responseType);return C}function y(a,b){if(!b)return a;var c=[];Pc(b,function(a,b){null===a||z(a)||(K(a)||(a=[a]),q(a,function(a){X(a)&&(a=qa(a));c.push(wa(b)+"="+wa(a))}))});return a+(-1==a.indexOf("?")?"?":"&")+c.join("&")}var E=c("$http"),u=[];q(g,function(a){u.unshift(D(a)?p.get(a):p.invoke(a))});q(f,function(a,b){var c=D(a)?p.get(a):p.invoke(a);u.splice(b, +0,{response:function(a){return c(n.when(a))},responseError:function(a){return c(n.reject(a))}})});s.pendingRequests=[];(function(a){q(arguments,function(a){s[a]=function(b,c){return s(t(c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){q(arguments,function(a){s[a]=function(b,c,d){return s(t(d||{},{method:a,url:b,data:c}))}})})("post","put");s.defaults=e;return s}]}function nd(b){return 8>=M&&"patch"===x(b)?new ActiveXObject("Microsoft.XMLHTTP"):new Z.XMLHttpRequest}function od(){this.$get= +["$browser","$window","$document",function(b,a,c){return pd(b,nd,b.defer,a.angular.callbacks,c[0])}]}function pd(b,a,c,d,e){function g(a,b){var c=e.createElement("script"),d=function(){c.onreadystatechange=c.onload=c.onerror=null;e.body.removeChild(c);b&&b()};c.type="text/javascript";c.src=a;M&&8>=M?c.onreadystatechange=function(){/loaded|complete/.test(c.readyState)&&d()}:c.onload=c.onerror=function(){d()};e.body.appendChild(c);return d}var f=-1;return function(e,m,k,l,n,p,s,C){function y(){u=f; +H&&H();v&&v.abort()}function E(a,d,e,g){r&&c.cancel(r);H=v=null;d=0===d?e?200:404:d;a(1223==d?204:d,e,g);b.$$completeOutstandingRequest(w)}var u;b.$$incOutstandingRequestCount();m=m||b.url();if("jsonp"==x(e)){var R="_"+(d.counter++).toString(36);d[R]=function(a){d[R].data=a};var H=g(m.replace("JSON_CALLBACK","angular.callbacks."+R),function(){d[R].data?E(l,200,d[R].data):E(l,u||-2);d[R]=Ca.noop})}else{var v=a(e);v.open(e,m,!0);q(n,function(a,b){B(a)&&v.setRequestHeader(b,a)});v.onreadystatechange= +function(){if(v&&4==v.readyState){var a=null,b=null;u!==f&&(a=v.getAllResponseHeaders(),b="response"in v?v.response:v.responseText);E(l,u||v.status,b,a)}};s&&(v.withCredentials=!0);C&&(v.responseType=C);v.send(k||null)}if(0=h&&(n.resolve(s),l(p.$$intervalId),delete e[p.$$intervalId]);C||b.$apply()},f);e[p.$$intervalId]=n;return p} +var e={};d.cancel=function(a){return a&&a.$$intervalId in e?(e[a.$$intervalId].reject("canceled"),clearInterval(a.$$intervalId),delete e[a.$$intervalId],!0):!1};return d}]}function sd(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January February March April May June July August September October November December".split(" "), +SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a",fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(b){return 1===b?"one":"other"}}}}function qc(b){b=b.split("/");for(var a=b.length;a--;)b[a]= +tb(b[a]);return b.join("/")}function rc(b,a,c){b=ya(b,c);a.$$protocol=b.protocol;a.$$host=b.hostname;a.$$port=S(b.port)||td[b.protocol]||null}function sc(b,a,c){var d="/"!==b.charAt(0);d&&(b="/"+b);b=ya(b,c);a.$$path=decodeURIComponent(d&&"/"===b.pathname.charAt(0)?b.pathname.substring(1):b.pathname);a.$$search=Xb(b.search);a.$$hash=decodeURIComponent(b.hash);a.$$path&&"/"!=a.$$path.charAt(0)&&(a.$$path="/"+a.$$path)}function oa(b,a){if(0===a.indexOf(b))return a.substr(b.length)}function Xa(b){var a= +b.indexOf("#");return-1==a?b:b.substr(0,a)}function Hb(b){return b.substr(0,Xa(b).lastIndexOf("/")+1)}function tc(b,a){this.$$html5=!0;a=a||"";var c=Hb(b);rc(b,this,b);this.$$parse=function(a){var e=oa(c,a);if(!D(e))throw Ib("ipthprfx",a,c);sc(e,this,b);this.$$path||(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=Yb(this.$$search),b=this.$$hash?"#"+tb(this.$$hash):"";this.$$url=qc(this.$$path)+(a?"?"+a:"")+b;this.$$absUrl=c+this.$$url.substr(1)};this.$$rewrite=function(d){var e; +if((e=oa(b,d))!==r)return d=e,(e=oa(a,e))!==r?c+(oa("/",e)||e):b+d;if((e=oa(c,d))!==r)return c+e;if(c==d+"/")return c}}function Jb(b,a){var c=Hb(b);rc(b,this,b);this.$$parse=function(d){var e=oa(b,d)||oa(c,d),e="#"==e.charAt(0)?oa(a,e):this.$$html5?e:"";if(!D(e))throw Ib("ihshprfx",d,a);sc(e,this,b);d=this.$$path;var g=/^\/?.*?:(\/.*)/;0===e.indexOf(b)&&(e=e.replace(b,""));g.exec(e)||(d=(e=g.exec(d))?e[1]:d);this.$$path=d;this.$$compose()};this.$$compose=function(){var c=Yb(this.$$search),e=this.$$hash? +"#"+tb(this.$$hash):"";this.$$url=qc(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+(this.$$url?a+this.$$url:"")};this.$$rewrite=function(a){if(Xa(b)==Xa(a))return a}}function uc(b,a){this.$$html5=!0;Jb.apply(this,arguments);var c=Hb(b);this.$$rewrite=function(d){var e;if(b==Xa(d))return d;if(e=oa(c,d))return b+a+e;if(c===d+"/")return c}}function jb(b){return function(){return this[b]}}function vc(b,a){return function(c){if(z(c))return this[b];this[b]=a(c);this.$$compose();return this}}function ud(){var b= +"",a=!1;this.hashPrefix=function(a){return B(a)?(b=a,this):b};this.html5Mode=function(b){return B(b)?(a=b,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,g){function f(a){c.$broadcast("$locationChangeSuccess",h.absUrl(),a)}var h,m=d.baseHref(),k=d.url();a?(m=k.substring(0,k.indexOf("/",k.indexOf("//")+2))+(m||"/"),e=e.history?tc:uc):(m=Xa(k),e=Jb);h=new e(m,"#"+b);h.$$parse(h.$$rewrite(k));g.on("click",function(a){if(!a.ctrlKey&&!a.metaKey&&2!=a.which){for(var b= +A(a.target);"a"!==x(b[0].nodeName);)if(b[0]===g[0]||!(b=b.parent())[0])return;var e=b.prop("href");X(e)&&"[object SVGAnimatedString]"===e.toString()&&(e=ya(e.animVal).href);var f=h.$$rewrite(e);e&&(!b.attr("target")&&f&&!a.isDefaultPrevented())&&(a.preventDefault(),f!=d.url()&&(h.$$parse(f),c.$apply(),Z.angular["ff-684208-preventDefault"]=!0))}});h.absUrl()!=k&&d.url(h.absUrl(),!0);d.onUrlChange(function(a){h.absUrl()!=a&&(c.$evalAsync(function(){var b=h.absUrl();h.$$parse(a);c.$broadcast("$locationChangeStart", +a,b).defaultPrevented?(h.$$parse(b),d.url(b)):f(b)}),c.$$phase||c.$digest())});var l=0;c.$watch(function(){var a=d.url(),b=h.$$replace;l&&a==h.absUrl()||(l++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",h.absUrl(),a).defaultPrevented?h.$$parse(a):(d.url(h.absUrl(),b),f(a))}));h.$$replace=!1;return l});return h}]}function vd(){var b=!0,a=this;this.debugEnabled=function(a){return B(a)?(b=a,this):b};this.$get=["$window",function(c){function d(a){a instanceof Error&&(a.stack?a=a.message&& +-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=c.console||{},e=b[a]||b.log||w;a=!1;try{a=!!e.apply}catch(m){}return a?function(){var a=[];q(arguments,function(b){a.push(d(b))});return e.apply(b,a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){b&&c.apply(a,arguments)}}()}}]}function ea(b, +a){if("constructor"===b)throw za("isecfld",a);return b}function Ya(b,a){if(b){if(b.constructor===b)throw za("isecfn",a);if(b.document&&b.location&&b.alert&&b.setInterval)throw za("isecwindow",a);if(b.children&&(b.nodeName||b.on&&b.find))throw za("isecdom",a);}return b}function kb(b,a,c,d,e){e=e||{};a=a.split(".");for(var g,f=0;1e?wc(d[0],d[1],d[2],d[3],d[4],c,a):function(b,g){var f=0,h;do h=wc(d[f++],d[f++],d[f++],d[f++],d[f++],c,a)(b,g),g=r,b=h;while(fa)for(b in f++,d)d.hasOwnProperty(b)&&!e.hasOwnProperty(b)&&(l--,delete d[b])}else d!==e&&(d=e,f++);return f},function(){b(e,d,c)})},$digest:function(){var d,f,g,h,k=this.$$asyncQueue,l=this.$$postDigestQueue,q,v,r=b,N,V=[],J,A,P;m("$digest");c=null;do{v= +!1;for(N=this;k.length;){try{P=k.shift(),P.scope.$eval(P.expression)}catch(B){p.$$phase=null,e(B)}c=null}a:do{if(h=N.$$watchers)for(q=h.length;q--;)try{if(d=h[q])if((f=d.get(N))!==(g=d.last)&&!(d.eq?ua(f,g):"number"==typeof f&&"number"==typeof g&&isNaN(f)&&isNaN(g)))v=!0,c=d,d.last=d.eq?aa(f):f,d.fn(f,g===n?f:g,N),5>r&&(J=4-r,V[J]||(V[J]=[]),A=L(d.exp)?"fn: "+(d.exp.name||d.exp.toString()):d.exp,A+="; newVal: "+qa(f)+"; oldVal: "+qa(g),V[J].push(A));else if(d===c){v=!1;break a}}catch(t){p.$$phase= +null,e(t)}if(!(h=N.$$childHead||N!==this&&N.$$nextSibling))for(;N!==this&&!(h=N.$$nextSibling);)N=N.$parent}while(N=h);if((v||k.length)&&!r--)throw p.$$phase=null,a("infdig",b,qa(V));}while(v||k.length);for(p.$$phase=null;l.length;)try{l.shift()()}catch(z){e(z)}},$destroy:function(){if(!this.$$destroyed){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;this!==p&&(q(this.$$listenerCount,cb(null,l,this)),a.$$childHead==this&&(a.$$childHead=this.$$nextSibling),a.$$childTail==this&& +(a.$$childTail=this.$$prevSibling),this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling),this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling),this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null)}},$eval:function(a,b){return g(a)(this,b)},$evalAsync:function(a){p.$$phase||p.$$asyncQueue.length||f.defer(function(){p.$$asyncQueue.length&&p.$digest()});this.$$asyncQueue.push({scope:this,expression:a})},$$postDigest:function(a){this.$$postDigestQueue.push(a)}, +$apply:function(a){try{return m("$apply"),this.$eval(a)}catch(b){e(b)}finally{p.$$phase=null;try{p.$digest()}catch(c){throw e(c),c;}}},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);var d=this;do d.$$listenerCount[a]||(d.$$listenerCount[a]=0),d.$$listenerCount[a]++;while(d=d.$parent);var e=this;return function(){c[bb(c,b)]=null;l(e,1,a)}},$emit:function(a,b){var c=[],d,f=this,g=!1,h={name:a,targetScope:f,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented= +!0},defaultPrevented:!1},m=[h].concat(va.call(arguments,1)),k,l;do{d=f.$$listeners[a]||c;h.currentScope=f;k=0;for(l=d.length;kc.msieDocumentMode)throw sa("iequirks"); +var e=aa(fa);e.isEnabled=function(){return b};e.trustAs=d.trustAs;e.getTrusted=d.getTrusted;e.valueOf=d.valueOf;b||(e.trustAs=e.getTrusted=function(a,b){return b},e.valueOf=Ba);e.parseAs=function(b,c){var d=a(c);return d.literal&&d.constant?d:function(a,c){return e.getTrusted(b,d(a,c))}};var g=e.parseAs,f=e.getTrusted,h=e.trustAs;q(fa,function(a,b){var c=x(b);e[Ra("parse_as_"+c)]=function(b){return g(a,b)};e[Ra("get_trusted_"+c)]=function(b){return f(a,b)};e[Ra("trust_as_"+c)]=function(b){return h(a, +b)}});return e}]}function Gd(){this.$get=["$window","$document",function(b,a){var c={},d=S((/android (\d+)/.exec(x((b.navigator||{}).userAgent))||[])[1]),e=/Boxee/i.test((b.navigator||{}).userAgent),g=a[0]||{},f=g.documentMode,h,m=/^(Moz|webkit|O|ms)(?=[A-Z])/,k=g.body&&g.body.style,l=!1,n=!1;if(k){for(var p in k)if(l=m.exec(p)){h=l[0];h=h.substr(0,1).toUpperCase()+h.substr(1);break}h||(h="WebkitOpacity"in k&&"webkit");l=!!("transition"in k||h+"Transition"in k);n=!!("animation"in k||h+"Animation"in +k);!d||l&&n||(l=D(g.body.style.webkitTransition),n=D(g.body.style.webkitAnimation))}return{history:!(!b.history||!b.history.pushState||4>d||e),hashchange:"onhashchange"in b&&(!f||7b;b=Math.abs(b); +var f=b+"",h="",m=[],k=!1;if(-1!==f.indexOf("e")){var l=f.match(/([\d\.]+)e(-?)(\d+)/);l&&"-"==l[2]&&l[3]>e+1?f="0":(h=f,k=!0)}if(k)0b)&&(h=b.toFixed(e));else{f=(f.split(Hc)[1]||"").length;z(e)&&(e=Math.min(Math.max(a.minFrac,f),a.maxFrac));f=Math.pow(10,e);b=Math.round(b*f)/f;b=(""+b).split(Hc);f=b[0];b=b[1]||"";var l=0,n=a.lgSize,p=a.gSize;if(f.length>=n+p)for(l=f.length-n,k=0;kb&&(d="-",b=-b);for(b=""+b;b.length-c)e+=c;0===e&&-12==c&&(e=12);return Mb(e,a,d)}}function lb(b,a){return function(c,d){var e=c["get"+b](),g=Ia(a?"SHORT"+b:b);return d[g][e]}}function Dc(b){function a(a){var b; +if(b=a.match(c)){a=new Date(0);var g=0,f=0,h=b[8]?a.setUTCFullYear:a.setFullYear,m=b[8]?a.setUTCHours:a.setHours;b[9]&&(g=S(b[9]+b[10]),f=S(b[9]+b[11]));h.call(a,S(b[1]),S(b[2])-1,S(b[3]));g=S(b[4]||0)-g;f=S(b[5]||0)-f;h=S(b[6]||0);b=Math.round(1E3*parseFloat("0."+(b[7]||0)));m.call(a,g,f,h,b)}return a}var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,e){var g="",f=[],h,m;e=e||"mediumDate";e=b.DATETIME_FORMATS[e]||e;D(c)&& +(c=Od.test(c)?S(c):a(c));sb(c)&&(c=new Date(c));if(!La(c))return c;for(;e;)(m=Pd.exec(e))?(f=f.concat(va.call(m,1)),e=f.pop()):(f.push(e),e=null);q(f,function(a){h=Qd[a];g+=h?h(c,b.DATETIME_FORMATS):a.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function Kd(){return function(b){return qa(b,!0)}}function Ld(){return function(b,a){if(!K(b)&&!D(b))return b;a=S(a);if(D(b))return a?0<=a?b.slice(0,a):b.slice(a,b.length):"";var c=[],d,e;a>b.length?a=b.length:a<-b.length&&(a=-b.length);0a||37<=a&&40>=a)||k()});if(e.hasEvent("paste"))a.on("paste cut",k)}a.on("change",h);d.$render=function(){a.val(d.$isEmpty(d.$viewValue)?"":d.$viewValue)};var l=c.ngPattern;l&&((e=l.match(/^\/(.*)\/([gim]*)$/))?(l=RegExp(e[1],e[2]),e=function(a){return pa(d,"pattern",d.$isEmpty(a)||l.test(a),a)}):e=function(c){var e=b.$eval(l);if(!e||!e.test)throw F("ngPattern")("noregexp", +l,e,ga(a));return pa(d,"pattern",d.$isEmpty(c)||e.test(c),c)},d.$formatters.push(e),d.$parsers.push(e));if(c.ngMinlength){var n=S(c.ngMinlength);e=function(a){return pa(d,"minlength",d.$isEmpty(a)||a.length>=n,a)};d.$parsers.push(e);d.$formatters.push(e)}if(c.ngMaxlength){var p=S(c.ngMaxlength);e=function(a){return pa(d,"maxlength",d.$isEmpty(a)||a.length<=p,a)};d.$parsers.push(e);d.$formatters.push(e)}}function Nb(b,a){b="ngClass"+b;return function(){return{restrict:"AC",link:function(c,d,e){function g(b){if(!0=== +a||c.$index%2===a){var d=f(b||"");h?ua(b,h)||e.$updateClass(d,f(h)):e.$addClass(d)}h=aa(b)}function f(a){if(K(a))return a.join(" ");if(X(a)){var b=[];q(a,function(a,c){a&&b.push(c)});return b.join(" ")}return a}var h;c.$watch(e[b],g,!0);e.$observe("class",function(a){g(c.$eval(e[b]))});"ngClass"!==b&&c.$watch("$index",function(d,g){var h=d&1;if(h!==g&1){var n=f(c.$eval(e[b]));h===a?e.$addClass(n):e.$removeClass(n)}})}}}}var x=function(b){return D(b)?b.toLowerCase():b},Ia=function(b){return D(b)?b.toUpperCase(): +b},M,A,Da,va=[].slice,Rd=[].push,Ma=Object.prototype.toString,Oa=F("ng"),Ca=Z.angular||(Z.angular={}),Va,Ha,ka=["0","0","0"];M=S((/msie (\d+)/.exec(x(navigator.userAgent))||[])[1]);isNaN(M)&&(M=S((/trident\/.*; rv:(\d+)/.exec(x(navigator.userAgent))||[])[1]));w.$inject=[];Ba.$inject=[];var ba=function(){return String.prototype.trim?function(b){return D(b)?b.trim():b}:function(b){return D(b)?b.replace(/^\s\s*/,"").replace(/\s\s*$/,""):b}}();Ha=9>M?function(b){b=b.nodeName?b:b[0];return b.scopeName&& +"HTML"!=b.scopeName?Ia(b.scopeName+":"+b.nodeName):b.nodeName}:function(b){return b.nodeName?b.nodeName:b[0].nodeName};var Uc=/[A-Z]/g,Sd={full:"1.2.10",major:1,minor:2,dot:10,codeName:"augmented-serendipity"},Sa=O.cache={},eb=O.expando="ng-"+(new Date).getTime(),Yc=1,Jc=Z.document.addEventListener?function(b,a,c){b.addEventListener(a,c,!1)}:function(b,a,c){b.attachEvent("on"+a,c)},Bb=Z.document.removeEventListener?function(b,a,c){b.removeEventListener(a,c,!1)}:function(b,a,c){b.detachEvent("on"+ +a,c)},Wc=/([\:\-\_]+(.))/g,Xc=/^moz([A-Z])/,yb=F("jqLite"),Ga=O.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;"complete"===Q.readyState?setTimeout(a):(this.on("DOMContentLoaded",a),O(Z).on("load",a))},toString:function(){var b=[];q(this,function(a){b.push(""+a)});return"["+b.join(", ")+"]"},eq:function(b){return 0<=b?A(this[b]):A(this[this.length+b])},length:0,push:Rd,sort:[].sort,splice:[].splice},gb={};q("multiple selected checked disabled readOnly required open".split(" "),function(b){gb[x(b)]= +b});var gc={};q("input select option textarea button form details".split(" "),function(b){gc[Ia(b)]=!0});q({data:cc,inheritedData:fb,scope:function(b){return A(b).data("$scope")||fb(b.parentNode||b,["$isolateScope","$scope"])},isolateScope:function(b){return A(b).data("$isolateScope")||A(b).data("$isolateScopeNoTemplate")},controller:dc,injector:function(b){return fb(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Cb,css:function(b,a,c){a=Ra(a);if(B(c))b.style[a]=c;else{var d; +8>=M&&(d=b.currentStyle&&b.currentStyle[a],""===d&&(d="auto"));d=d||b.style[a];8>=M&&(d=""===d?r:d);return d}},attr:function(b,a,c){var d=x(a);if(gb[d])if(B(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));else return b[a]||(b.attributes.getNamedItem(a)||w).specified?d:r;else if(B(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),null===b?r:b},prop:function(b,a,c){if(B(c))b[a]=c;else return b[a]},text:function(){function b(b,d){var e=a[b.nodeType];if(z(d))return e? +b[e]:"";b[e]=d}var a=[];9>M?(a[1]="innerText",a[3]="nodeValue"):a[1]=a[3]="textContent";b.$dv="";return b}(),val:function(b,a){if(z(a)){if("SELECT"===Ha(b)&&b.multiple){var c=[];q(b.options,function(a){a.selected&&c.push(a.value||a.text)});return 0===c.length?null:c}return b.value}b.value=a},html:function(b,a){if(z(a))return b.innerHTML;for(var c=0,d=b.childNodes;c":function(a,c,d,e){return d(a,c)>e(a,c)},"<=":function(a,c,d,e){return d(a,c)<=e(a,c)},">=":function(a,c,d,e){return d(a,c)>=e(a,c)},"&&":function(a,c,d,e){return d(a,c)&&e(a,c)},"||":function(a,c,d,e){return d(a,c)||e(a,c)},"&":function(a,c,d,e){return d(a,c)&e(a,c)},"|":function(a,c,d,e){return e(a,c)(a,c,d(a,c))}, +"!":function(a,c,d){return!d(a,c)}},Wd={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Lb=function(a){this.options=a};Lb.prototype={constructor:Lb,lex:function(a){this.text=a;this.index=0;this.ch=r;this.lastCh=":";this.tokens=[];var c;for(a=[];this.index=a},isWhitespace:function(a){return" "=== +a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdent:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,c,d){d=d||this.index;c=B(c)?"s "+c+"-"+this.index+" ["+this.text.substring(c,d)+"]":" "+d;throw za("lexerr",a,c,this.text);},readNumber:function(){for(var a="",c=this.index;this.index","<=",">="))a=this.binaryFn(a,c.fn,this.relational());return a},additive:function(){for(var a=this.multiplicative(),c;c=this.expect("+","-");)a=this.binaryFn(a,c.fn,this.multiplicative());return a},multiplicative:function(){for(var a=this.unary(),c;c=this.expect("*","/","%");)a=this.binaryFn(a,c.fn,this.unary());return a},unary:function(){var a;return this.expect("+")?this.primary():(a=this.expect("-"))?this.binaryFn(Za.ZERO,a.fn, +this.unary()):(a=this.expect("!"))?this.unaryFn(a.fn,this.unary()):this.primary()},fieldAccess:function(a){var c=this,d=this.expect().text,e=xc(d,this.options,this.text);return t(function(c,d,h){return e(h||a(c,d))},{assign:function(e,f,h){return kb(a(e,h),d,f,c.text,c.options)}})},objectIndex:function(a){var c=this,d=this.expression();this.consume("]");return t(function(e,g){var f=a(e,g),h=d(e,g),m;if(!f)return r;(f=Ya(f[h],c.text))&&(f.then&&c.options.unwrapPromises)&&(m=f,"$$v"in f||(m.$$v=r,m.then(function(a){m.$$v= +a})),f=f.$$v);return f},{assign:function(e,g,f){var h=d(e,f);return Ya(a(e,f),c.text)[h]=g}})},functionCall:function(a,c){var d=[];if(")"!==this.peekToken().text){do d.push(this.expression());while(this.expect(","))}this.consume(")");var e=this;return function(g,f){for(var h=[],m=c?c(g,f):g,k=0;ka.getHours()?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){a=-1*a.getTimezoneOffset();return a=(0<=a?"+":"")+(Mb(Math[0=M&&(c.href||c.name||c.$set("href",""),a.append(Q.createComment("IE fix")));if(!c.href&&!c.xlinkHref&&!c.name)return function(a,c){var g="[object SVGAnimatedString]"===Ma.call(c.prop("href"))?"xlink:href":"href";c.on("click",function(a){c.attr(g)||a.preventDefault()})}}}),Ob={};q(gb,function(a,c){if("multiple"!=a){var d=ma("ng-"+c);Ob[d]=function(){return{priority:100,link:function(a,g,f){a.$watch(f[d],function(a){f.$set(c,!!a)})}}}}});q(["src","srcset","href"],function(a){var c= +ma("ng-"+a);Ob[c]=function(){return{priority:99,link:function(d,e,g){g.$observe(c,function(c){c&&(g.$set(a,c),M&&e.prop(a,g[a]))})}}}});var ob={$addControl:w,$removeControl:w,$setValidity:w,$setDirty:w,$setPristine:w};Ic.$inject=["$element","$attrs","$scope"];var Kc=function(a){return["$timeout",function(c){return{name:"form",restrict:a?"EAC":"E",controller:Ic,compile:function(){return{pre:function(a,e,g,f){if(!g.action){var h=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1};Jc(e[0], +"submit",h);e.on("$destroy",function(){c(function(){Bb(e[0],"submit",h)},0,!1)})}var m=e.parent().controller("form"),k=g.name||g.ngForm;k&&kb(a,k,f,k);if(m)e.on("$destroy",function(){m.$removeControl(f);k&&kb(a,k,r,k);t(f,ob)})}}}}}]},Yd=Kc(),Zd=Kc(!0),$d=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,ae=/^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*$/i,be=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,Lc={text:qb,number:function(a,c,d,e,g,f){qb(a,c,d,e,g,f); +e.$parsers.push(function(a){var c=e.$isEmpty(a);if(c||be.test(a))return e.$setValidity("number",!0),""===a?null:c?a:parseFloat(a);e.$setValidity("number",!1);return r});e.$formatters.push(function(a){return e.$isEmpty(a)?"":""+a});d.min&&(a=function(a){var c=parseFloat(d.min);return pa(e,"min",e.$isEmpty(a)||a>=c,a)},e.$parsers.push(a),e.$formatters.push(a));d.max&&(a=function(a){var c=parseFloat(d.max);return pa(e,"max",e.$isEmpty(a)||a<=c,a)},e.$parsers.push(a),e.$formatters.push(a));e.$formatters.push(function(a){return pa(e, +"number",e.$isEmpty(a)||sb(a),a)})},url:function(a,c,d,e,g,f){qb(a,c,d,e,g,f);a=function(a){return pa(e,"url",e.$isEmpty(a)||$d.test(a),a)};e.$formatters.push(a);e.$parsers.push(a)},email:function(a,c,d,e,g,f){qb(a,c,d,e,g,f);a=function(a){return pa(e,"email",e.$isEmpty(a)||ae.test(a),a)};e.$formatters.push(a);e.$parsers.push(a)},radio:function(a,c,d,e){z(d.name)&&c.attr("name",$a());c.on("click",function(){c[0].checked&&a.$apply(function(){e.$setViewValue(d.value)})});e.$render=function(){c[0].checked= +d.value==e.$viewValue};d.$observe("value",e.$render)},checkbox:function(a,c,d,e){var g=d.ngTrueValue,f=d.ngFalseValue;D(g)||(g=!0);D(f)||(f=!1);c.on("click",function(){a.$apply(function(){e.$setViewValue(c[0].checked)})});e.$render=function(){c[0].checked=e.$viewValue};e.$isEmpty=function(a){return a!==g};e.$formatters.push(function(a){return a===g});e.$parsers.push(function(a){return a?g:f})},hidden:w,button:w,submit:w,reset:w},Mc=["$browser","$sniffer",function(a,c){return{restrict:"E",require:"?ngModel", +link:function(d,e,g,f){f&&(Lc[x(g.type)]||Lc.text)(d,e,g,f,c,a)}}}],nb="ng-valid",mb="ng-invalid",Ja="ng-pristine",pb="ng-dirty",ce=["$scope","$exceptionHandler","$attrs","$element","$parse",function(a,c,d,e,g){function f(a,c){c=c?"-"+db(c,"-"):"";e.removeClass((a?mb:nb)+c).addClass((a?nb:mb)+c)}this.$modelValue=this.$viewValue=Number.NaN;this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$name=d.name;var h=g(d.ngModel), +m=h.assign;if(!m)throw F("ngModel")("nonassign",d.ngModel,ga(e));this.$render=w;this.$isEmpty=function(a){return z(a)||""===a||null===a||a!==a};var k=e.inheritedData("$formController")||ob,l=0,n=this.$error={};e.addClass(Ja);f(!0);this.$setValidity=function(a,c){n[a]!==!c&&(c?(n[a]&&l--,l||(f(!0),this.$valid=!0,this.$invalid=!1)):(f(!1),this.$invalid=!0,this.$valid=!1,l++),n[a]=!c,f(c,a),k.$setValidity(a,c,this))};this.$setPristine=function(){this.$dirty=!1;this.$pristine=!0;e.removeClass(pb).addClass(Ja)}; +this.$setViewValue=function(d){this.$viewValue=d;this.$pristine&&(this.$dirty=!0,this.$pristine=!1,e.removeClass(Ja).addClass(pb),k.$setDirty());q(this.$parsers,function(a){d=a(d)});this.$modelValue!==d&&(this.$modelValue=d,m(a,d),q(this.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}}))};var p=this;a.$watch(function(){var c=h(a);if(p.$modelValue!==c){var d=p.$formatters,e=d.length;for(p.$modelValue=c;e--;)c=d[e](c);p.$viewValue!==c&&(p.$viewValue=c,p.$render())}return c})}],de=function(){return{require:["ngModel", +"^?form"],controller:ce,link:function(a,c,d,e){var g=e[0],f=e[1]||ob;f.$addControl(g);a.$on("$destroy",function(){f.$removeControl(g)})}}},ee=$({require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),Nc=function(){return{require:"?ngModel",link:function(a,c,d,e){if(e){d.required=!0;var g=function(a){if(d.required&&e.$isEmpty(a))e.$setValidity("required",!1);else return e.$setValidity("required",!0),a};e.$formatters.push(g);e.$parsers.unshift(g);d.$observe("required", +function(){g(e.$viewValue)})}}}},fe=function(){return{require:"ngModel",link:function(a,c,d,e){var g=(a=/\/(.*)\//.exec(d.ngList))&&RegExp(a[1])||d.ngList||",";e.$parsers.push(function(a){if(!z(a)){var c=[];a&&q(a.split(g),function(a){a&&c.push(ba(a))});return c}});e.$formatters.push(function(a){return K(a)?a.join(", "):r});e.$isEmpty=function(a){return!a||!a.length}}}},ge=/^(true|false|\d+)$/,he=function(){return{priority:100,compile:function(a,c){return ge.test(c.ngValue)?function(a,c,g){g.$set("value", +a.$eval(g.ngValue))}:function(a,c,g){a.$watch(g.ngValue,function(a){g.$set("value",a)})}}}},ie=ta(function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBind);a.$watch(d.ngBind,function(a){c.text(a==r?"":a)})}),je=["$interpolate",function(a){return function(c,d,e){c=a(d.attr(e.$attr.ngBindTemplate));d.addClass("ng-binding").data("$binding",c);e.$observe("ngBindTemplate",function(a){d.text(a)})}}],ke=["$sce","$parse",function(a,c){return function(d,e,g){e.addClass("ng-binding").data("$binding", +g.ngBindHtml);var f=c(g.ngBindHtml);d.$watch(function(){return(f(d)||"").toString()},function(c){e.html(a.getTrustedHtml(f(d))||"")})}}],le=Nb("",!0),me=Nb("Odd",0),ne=Nb("Even",1),oe=ta({compile:function(a,c){c.$set("ngCloak",r);a.removeClass("ng-cloak")}}),pe=[function(){return{scope:!0,controller:"@",priority:500}}],Oc={};q("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(a){var c=ma("ng-"+ +a);Oc[c]=["$parse",function(d){return{compile:function(e,g){var f=d(g[c]);return function(c,d,e){d.on(x(a),function(a){c.$apply(function(){f(c,{$event:a})})})}}}}]});var qe=["$animate",function(a){return{transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(c,d,e,g,f){var h,m;c.$watch(e.ngIf,function(g){Pa(g)?m||(m=c.$new(),f(m,function(c){c[c.length++]=Q.createComment(" end ngIf: "+e.ngIf+" ");h={clone:c};a.enter(c,d.parent(),d)})):(m&&(m.$destroy(),m=null),h&&(a.leave(wb(h.clone)), +h=null))})}}}],re=["$http","$templateCache","$anchorScroll","$animate","$sce",function(a,c,d,e,g){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:Ca.noop,compile:function(f,h){var m=h.ngInclude||h.src,k=h.onload||"",l=h.autoscroll;return function(f,h,q,r,y){var A=0,u,t,H=function(){u&&(u.$destroy(),u=null);t&&(e.leave(t),t=null)};f.$watch(g.parseAsResourceUrl(m),function(g){var m=function(){!B(l)||l&&!f.$eval(l)||d()},q=++A;g?(a.get(g,{cache:c}).success(function(a){if(q=== +A){var c=f.$new();r.template=a;a=y(c,function(a){H();e.enter(a,null,h,m)});u=c;t=a;u.$emit("$includeContentLoaded");f.$eval(k)}}).error(function(){q===A&&H()}),f.$emit("$includeContentRequested")):(H(),r.template=null)})}}}}],se=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(c,d,e,g){d.html(g.template);a(d.contents())(c)}}}],te=ta({priority:450,compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),ue=ta({terminal:!0,priority:1E3}),ve=["$locale", +"$interpolate",function(a,c){var d=/{}/g;return{restrict:"EA",link:function(e,g,f){var h=f.count,m=f.$attr.when&&g.attr(f.$attr.when),k=f.offset||0,l=e.$eval(m)||{},n={},p=c.startSymbol(),s=c.endSymbol(),r=/^when(Minus)?(.+)$/;q(f,function(a,c){r.test(c)&&(l[x(c.replace("when","").replace("Minus","-"))]=g.attr(f.$attr[c]))});q(l,function(a,e){n[e]=c(a.replace(d,p+h+"-"+k+s))});e.$watch(function(){var c=parseFloat(e.$eval(h));if(isNaN(c))return"";c in l||(c=a.pluralCat(c-k));return n[c](e,g,!0)},function(a){g.text(a)})}}}], +we=["$parse","$animate",function(a,c){var d=F("ngRepeat");return{transclude:"element",priority:1E3,terminal:!0,$$tlb:!0,link:function(e,g,f,h,m){var k=f.ngRepeat,l=k.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/),n,p,s,r,y,t,u={$id:Fa};if(!l)throw d("iexp",k);f=l[1];h=l[2];(l=l[3])?(n=a(l),p=function(a,c,d){t&&(u[t]=a);u[y]=c;u.$index=d;return n(e,u)}):(s=function(a,c){return Fa(c)},r=function(a){return a});l=f.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!l)throw d("iidexp", +f);y=l[3]||l[1];t=l[2];var B={};e.$watchCollection(h,function(a){var f,h,l=g[0],n,u={},z,P,D,x,T,w,F=[];if(rb(a))T=a,n=p||s;else{n=p||r;T=[];for(D in a)a.hasOwnProperty(D)&&"$"!=D.charAt(0)&&T.push(D);T.sort()}z=T.length;h=F.length=T.length;for(f=0;fz;)v.pop().element.remove()}for(;x.length>I;)x.pop()[0].element.remove()}var k;if(!(k=t.match(d)))throw Fe("iexp", +t,ga(f));var l=c(k[2]||k[1]),m=k[4]||k[6],n=k[5],p=c(k[3]||""),q=c(k[2]?k[1]:m),A=c(k[7]),w=k[8]?c(k[8]):null,x=[[{element:f,label:""}]];y&&(a(y)(e),y.removeClass("ng-scope"),y.remove());f.empty();f.on("change",function(){e.$apply(function(){var a,c=A(e)||[],d={},h,k,l,p,t,u,v;if(s)for(k=[],p=0,u=x.length;p@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}'); +//# sourceMappingURL=angular.min.js.map diff --git a/public_html/static/js/jsde-angular.js b/public_html/static/js/jsde-angular.js new file mode 100644 index 0000000..cadb091 --- /dev/null +++ b/public_html/static/js/jsde-angular.js @@ -0,0 +1,227 @@ +var module = angular.module('cryto.jsde', ["frapontillo.ex.filters"]); + +module.factory("manager", function($document, defaultFilter){ + var obj = {}; + + obj.next_z_index = 0; + obj.next_id = 0; + obj.windows = {}; + obj.drag_mode = "none"; + obj.dragged_window = null; + obj.dragged_scope = null; + obj.drag_offset = null; + + obj.disablePageSelection = function() { + angular.element("body") + .attr('unselectable', 'on') + .css('user-select', 'none') + .on('selectstart', false); + }; + + obj.enablePageSelection = function() { + angular.element("body") + .attr('unselectable', 'off') + .css('user-select', 'text') + .off('selectstart'); + }; + + obj.getNextZIndex = function() + { + obj.next_z_index += 1; + return obj.next_z_index - 1; + } + + obj.addWindow = function(scope, element) + { + var id = obj.next_id; + obj.windows[id] = {scope: scope, element: element}; + obj.next_id += 1; + return id; + } + + obj.removeWindow = function(scope, element) + { + delete obj.windows[id]; + } + + obj.setAllUnfocused = function() + { + for(i in obj.windows) + { + obj.windows[i].scope.focused = false; + } + } + + $document.on("mousemove", function(event){ + if(obj.drag_mode == "move") + { + var new_x = event.pageX - obj.drag_offset.x; + var new_y = event.pageY - obj.drag_offset.y; + + obj.dragged_scope.x = new_x; + obj.dragged_scope.y = new_y; + + obj.dragged_scope.$apply(); + } + else if(obj.drag_mode == "resize") + { + var new_width = event.pageX - obj.drag_offset.x; + var new_height = event.pageY - obj.drag_offset.y; + + if(typeof obj.dragged_scope.minWidth !== "undefined" && new_width < obj.dragged_scope.minWidth) + { + new_width = obj.dragged_scope.minWidth; + } + else if(typeof obj.dragged_scope.maxWidth !== "undefined" && new_width > obj.dragged_scope.maxWidth) + { + new_width = obj.dragged_scope.maxWidth; + } + + if(typeof obj.dragged_scope.minHeight !== "undefined" && new_height < obj.dragged_scope.minHeight) + { + new_height = obj.dragged_scope.minHeight; + } + else if(typeof obj.dragged_scope.maxHeight !== "undefined" && new_height > obj.dragged_scope.maxHeight) + { + new_height = obj.dragged_scope.maxHeight; + } + + obj.dragged_scope.width = new_width; + obj.dragged_scope.height = new_height; + + obj.dragged_scope.$apply(); + } + }); + + $document.on("mouseup", function(event){ + if(obj.drag_mode == "move" || obj.drag_mode == "resize") + { + obj.drag_mode = "none"; + obj.drag_offset = null; + obj.enablePageSelection(); + } + }); + + return obj; +}); + +module.directive("jsdeWindow", function(manager, defaultFilter){ + return { + restrict: "E", + transclude: true, + templateUrl: "templates/angular/jsde-window.html", + scope: { + title: "@", + start_width: "@", + start_height: "@", + start_x: "@x", + start_y: "@y", + minWidth: "@", + minHeight: "@", + maxWidth: "@", + maxHeight: "@", + onScroll: "&", + onClose: "&", + visible: "@" + }, + link: function(scope, element, attrs) { + manager.addWindow(scope, element); + + scope.x = scope.start_x; + scope.y = scope.start_y; + + scope.width = scope.start_width; + scope.height = scope.start_height; + + scope.defaults = { + x: 48, + y: 48, + width: 400, + height: 300 + } + + /* Set the initial z-index, this is to prevent glitches when clicking overlapping windows + * in the same starting position */ + element.find(".window-wrapper").css({"z-index": manager.getNextZIndex()}); + + /* Set the initial focus. */ + manager.setAllUnfocused(); + scope.focused = true; + + /* When any part of a window is clicked, it's raised to the top and set to 'focused'. */ + element.on("mousedown", function(){ + element.find(".window-wrapper").css({"z-index": manager.getNextZIndex()}); + manager.setAllUnfocused(); + scope.focused = true; + scope.$apply(); + }); + + element.find(".window-title").on("mousedown", function(event){ + /* Dragging is centrally managed by the JsdeManager, to prevent conflicts where + * two windows are in a 'dragging' state at the same time due to an event not + * firing. Developing for browsers isn't always roses and sunshine... */ + manager.drag_mode = "move"; + manager.dragged_window = element; + manager.dragged_scope = scope; + manager.drag_offset = {x: event.pageX - defaultFilter(scope.x, scope.defaults.x), y: event.pageY - defaultFilter(scope.y, scope.defaults.y)}; + manager.disablePageSelection(); + }); + + element.find(".window-resizer").on("mousedown", function(event){ + /* Dragging is centrally managed by the JsdeManager, to prevent conflicts where + * two windows are in a 'dragging' state at the same time due to an event not + * firing. Developing for browsers isn't always roses and sunshine... */ + manager.drag_mode = "resize"; + manager.dragged_window = element; + manager.dragged_scope = scope; + manager.drag_offset = {x: event.pageX - defaultFilter(scope.width, scope.defaults.width), y: event.pageY - defaultFilter(scope.height, scope.defaults.height)}; + manager.disablePageSelection(); + }); + + element.find(".window-title .window-close a").on("click", function(event){ + scope.$apply(function(){ + scope.visible = false; + scope.onClose(); + }); + }) + + scope.$watch("visible", function(newValue, oldValue){ + if(newValue !== oldValue) + { + if(newValue == true || newValue == "true") /* What the fuck? */ + { + scope.$emit("jsdeWindowOpened"); + console.log("jsdeWindowOpened"); + } + else + { + scope.$emit("jsdeWindowClosed"); + console.log("jsdeWindowClosed"); + } + } + }); + } + } +}); + +module.directive("jsdeNotification", function(){ + return { + restrict: "E", + transclude: true, + templateUrl: "templates/angular/jsde-notification.html", + link: function(scope, element, attrs) { + + } + } +}); + +module.directive("jsdeError", function(){ + return { + restrict: "E", + transclude: true, + templateUrl: "templates/angular/jsde-error.html", + link: function(scope, element, attrs) { + + } + } +}); diff --git a/public_html/static/js/openng.js b/public_html/static/js/openng.js index 30ffee1..90dffc0 100644 --- a/public_html/static/js/openng.js +++ b/public_html/static/js/openng.js @@ -1,353 +1,5 @@ -(function($){ - $.fn.restoreIcon = function() { - return this.removeClass().addClass(this.data("old-class")); - }; -})(jQuery); +var module = angular.module("cryto.openng", ["cryto.jsde"]); -var jsde_creation_hook = function(win) -{ - /* This function is a hook that is called after each creation of - * a JSDE window. */ +module.controller("appController", function($scope){ -} - -var jsde_contents_hook = function(win) -{ - /* This function is a hook that is called after each time - * content is set in a JSDE window. */ - placeHooksForWindow(win); -} - -notification_popups = []; -error_popups = []; -template_cache = {}; - -function hookSubmitEvent(form, callback, error) -{ - /* Hooks a form to be submitted via AJAX, executing the given - * callback if the request succeeds. - * - * form: a jQuery object containing one or more form elements - * callback: the function to run after a successful request - * error: optionally, a callback function to run when the - * request fails - */ - - form.each(function(index){ - var element = $(this); - var method = element.attr("method"); - var target = element.attr("action"); - - if(typeof method !== "undefined") - { - method = method.toUpperCase(); - } - else - { - method = "GET"; - } - - element.submit(function(){ - var submit_button = element.find("button[type=submit]"); - var submit_icon = submit_button.data("submit-icon"); - - if(typeof submit_icon !== "undefined") - { - /* First we will try to replace an existing icon - * in the button. If there is no icon yet, the - * entire contents of the button will be replaced - * with the submission icon. */ - var current_icon = submit_button.find("i"); - - if(current_icon.length == 0) - { - submit_button.html(""); - current_icon = element.find("i"); - } - - current_icon.data("old-class", current_icon.attr("class")).removeClass().addClass(submit_icon); - } - - var formdata = element.serialize(); - console.log(formdata); - - $.ajax({ - type: method, - url: target, - data: formdata, - dataType: "json", - success: function(data, xhr){ console.log(data); callback(element, data, xhr); }, - error: function(data, xhr, err){ if(typeof error !== "undefined") { error(element, data, xhr, err); } /* This handles HTTP errors, NOT application errors! */ } - }); - - return false; - }); - }); -} - -function placeHooksForWindow(win) -{ - console.log(); - $(win._outer).find("form").each(function(){ - var callback = $(this).data("hook-callback"); - var error_callback = $(this).data("hook-error-callback"); - - if(typeof callback !== "undefined") - { - console.log("Hooking", this, "using callback", callback); - hookSubmitEvent($(this), window[callback], window[error_callback]); - } - }); -} - -function callbackNodeCreated(form, data) -{ - if(data.result == "success") - { - spawnNotification(data.message); - var node_id = data.node_id; - - form.getWindow().Close(); - openWindowNodeDetails(node_id); - } - else if(data.result == "error") - { - form.find("button[type=submit] i").restoreIcon(); - - form.find("input, textarea").removeClass("invalid"); - - if(data.errorfields) - { - for(i in data.errorfields) - { - var field_name = data.errorfields[i]; - form.find("input[name=" + field_name + "], textarea[name=" + field_name + "]").addClass("invalid"); - } - } - - spawnError(data.message); - } -} - -function openWindowNodeDetails(id) -{ - new JsdeWindow({ - width: 680, - height: 420, - x: 100, - y: 100, - title: "Node lookup", - contents: "Loading...", - source_url: "/nodes/" + id - }); -} - -/*function callbackNodeCreationFailed(form, data) -{ - form.find("button[type=submit]").restoreIcon(); -}*/ - -function spawnNotification(message) -{ - var popup = spawnPopup(message, "notification"); - notification_popups.push(popup); -} - -function spawnError(message) -{ - var popup = spawnPopup(message, "error"); - error_popups.push(popup); -} - -function spawnPopup(message, template) -{ - var popup = $("#jsde_templates").find(".template_" + template).clone().removeClass("template_notification template_error"); - popup.find(".message").html(message.replace("\n", "
")); - popup.hide(); - popup.prependTo("#notification_area"); - - popup.fadeIn(300).wait(5000).fadeOut(400, $).remove(); - - return popup -} - -function spawnTemplate(name) -{ - if(!template_cache[name]) - { - template_cache[name] = $("*[data-template-name=" + name + "]").first(); - } - - return template_cache[name].clone(); -} - -function SearchCompletionSource(element) -{ - this.element = element; - this.results = []; -} - -SearchCompletionSource.prototype.getItemCount = function() { - return this.results.length; -} - -SearchCompletionSource.prototype.getAll = function() { - return this.results; -} - -SearchCompletionSource.prototype.getItem = function(index) { - return this.results[index]; -} - -SearchCompletionSource.prototype.updateItems = function(query, callback) { - if(typeof this.request !== "undefined") - { - this.request.abort(); - } - - this.request = $.ajax({ - url: "/autocomplete/search/?q=" + escape(query), - dataType: "json", - success: function(result) { this.results = result; callback(); }.bind(this) - }); -} - -SearchCompletionSource.prototype.isInItems = function(query) { - for(i in this.results) - { - if(this.results[i].indexOf(query) > 0) - { - return true; - } - } - - return false; -} - -SearchCompletionSource.prototype.matchesItem = function(index, query) { - return (this.results[index].name.toLowerCase().indexOf(query.toLowerCase()) > -1); -} - -function PropertyNameCompletionSource(element) -{ - this.element = element; - this.results = []; -} - -PropertyNameCompletionSource.prototype.getItemCount = function() { - return this.results.length; -} - -PropertyNameCompletionSource.prototype.getAll = function() { - return this.results; -} - -PropertyNameCompletionSource.prototype.getItem = function(index) { - return this.results[index]; -} - -PropertyNameCompletionSource.prototype.updateItems = function(query, callback) { - if(typeof this.request !== "undefined") - { - this.request.abort(); - } - - this.request = $.ajax({ - url: "/autocomplete/propertyname/?q=" + escape(query), - dataType: "json", - success: function(result) { this.results = result; callback(); }.bind(this) - }); -} - -PropertyNameCompletionSource.prototype.isInItems = function(query) { - for(i in this.results) - { - if(this.results[i].indexOf(query) > 0) - { - return true; - } - } - - return false; -} - - -PropertyNameCompletionSource.prototype.matchesItem = function(index, query) { - console.log("item", this.results[index].value.toLowerCase()); - console.log("query", query.toLowerCase()); - console.log("result", this.results[index].value.toLowerCase().indexOf(query.toLowerCase())); - return (this.results[index].value.toLowerCase().indexOf(query.toLowerCase()) > -1); -} - -$(function(){ - hookSubmitEvent($("#form_search")); - - $("#button_toolbar_addnode").click(function(){ - var win = new JsdeWindow({ - width: 320, - height: 400, - x: 40, - y: 40, - title: "Create new node", - contents: "Loading...", - source_url: "/nodes/create", - callback: function(){ $(win._inner).find("input[name=name]").focus(); }, - noscroll: true - }); - }); - - /* Intro screen */ - new JsdeWindow({ - width: 640, - height: 480, - x: ($(window).width() / 2) - (640 / 2), - y: ($(window).height() / 2) - (480 / 2), - title: "Welcome!", - contents: "Loading...", - source_url: "/intro" - }); - - spawnNotification("Test notification"); - spawnError("Test error"); - - $("body").on("input", ".auto-duplicate input", function(){ - var parent = $(this).closest(".auto-duplicate"); - - if(!parent.data("duplicated")) - { - spawnTemplate(parent.data("template-name")).insertAfter(parent).find("input").val(""); - parent.data("duplicated", true); - } - }); - - autocompleter_search = new AutoCompleter("search"); - - $("#input_search_query").autoComplete(autocompleter_search, SearchCompletionSource, function(data){ - openWindowNodeDetails(data.value); - this.target.val(""); - }); - - autocompleter_propertyname = new AutoCompleter("propertyname"); - - $("body").autoComplete(autocompleter_propertyname, PropertyNameCompletionSource, "input.input-propertyname"); - - $("body").keydown(function(event){ - switch(event.which) - { - case 70: // F - if(event.ctrlKey) - { - $("#input_search_query").focus(); - event.preventDefault(); - } - break; - case 77: // M - if(event.ctrlKey) - { - $("#button_toolbar_addnode").click(); - event.preventDefault(); - } - break; - } - }); }); diff --git a/public_html/static/js/openng.old.js b/public_html/static/js/openng.old.js new file mode 100644 index 0000000..f222c22 --- /dev/null +++ b/public_html/static/js/openng.old.js @@ -0,0 +1,360 @@ +var module = angular.module("cryto.openng", ["cryto.jsde"]); + +module.controller("appController", function(){ + +}); + + +(function($){ + $.fn.restoreIcon = function() { + return this.removeClass().addClass(this.data("old-class")); + }; +})(jQuery); + +var jsde_creation_hook = function(win) +{ + /* This function is a hook that is called after each creation of + * a JSDE window. */ + +} + +var jsde_contents_hook = function(win) +{ + /* This function is a hook that is called after each time + * content is set in a JSDE window. */ + placeHooksForWindow(win); +} + +notification_popups = []; +error_popups = []; +template_cache = {}; + +function hookSubmitEvent(form, callback, error) +{ + /* Hooks a form to be submitted via AJAX, executing the given + * callback if the request succeeds. + * + * form: a jQuery object containing one or more form elements + * callback: the function to run after a successful request + * error: optionally, a callback function to run when the + * request fails + */ + + form.each(function(index){ + var element = $(this); + var method = element.attr("method"); + var target = element.attr("action"); + + if(typeof method !== "undefined") + { + method = method.toUpperCase(); + } + else + { + method = "GET"; + } + + element.submit(function(){ + var submit_button = element.find("button[type=submit]"); + var submit_icon = submit_button.data("submit-icon"); + + if(typeof submit_icon !== "undefined") + { + /* First we will try to replace an existing icon + * in the button. If there is no icon yet, the + * entire contents of the button will be replaced + * with the submission icon. */ + var current_icon = submit_button.find("i"); + + if(current_icon.length == 0) + { + submit_button.html(""); + current_icon = element.find("i"); + } + + current_icon.data("old-class", current_icon.attr("class")).removeClass().addClass(submit_icon); + } + + var formdata = element.serialize(); + console.log(formdata); + + $.ajax({ + type: method, + url: target, + data: formdata, + dataType: "json", + success: function(data, xhr){ console.log(data); callback(element, data, xhr); }, + error: function(data, xhr, err){ if(typeof error !== "undefined") { error(element, data, xhr, err); } /* This handles HTTP errors, NOT application errors! */ } + }); + + return false; + }); + }); +} + +function placeHooksForWindow(win) +{ + console.log(); + $(win._outer).find("form").each(function(){ + var callback = $(this).data("hook-callback"); + var error_callback = $(this).data("hook-error-callback"); + + if(typeof callback !== "undefined") + { + console.log("Hooking", this, "using callback", callback); + hookSubmitEvent($(this), window[callback], window[error_callback]); + } + }); +} + +function callbackNodeCreated(form, data) +{ + if(data.result == "success") + { + spawnNotification(data.message); + var node_id = data.node_id; + + form.getWindow().Close(); + openWindowNodeDetails(node_id); + } + else if(data.result == "error") + { + form.find("button[type=submit] i").restoreIcon(); + + form.find("input, textarea").removeClass("invalid"); + + if(data.errorfields) + { + for(i in data.errorfields) + { + var field_name = data.errorfields[i]; + form.find("input[name=" + field_name + "], textarea[name=" + field_name + "]").addClass("invalid"); + } + } + + spawnError(data.message); + } +} + +function openWindowNodeDetails(id) +{ + new JsdeWindow({ + width: 680, + height: 420, + x: 100, + y: 100, + title: "Node lookup", + contents: "Loading...", + source_url: "/nodes/" + id + }); +} + +/*function callbackNodeCreationFailed(form, data) +{ + form.find("button[type=submit]").restoreIcon(); +}*/ + +function spawnNotification(message) +{ + var popup = spawnPopup(message, "notification"); + notification_popups.push(popup); +} + +function spawnError(message) +{ + var popup = spawnPopup(message, "error"); + error_popups.push(popup); +} + +function spawnPopup(message, template) +{ + var popup = $("#jsde_templates").find(".template_" + template).clone().removeClass("template_notification template_error"); + popup.find(".message").html(message.replace("\n", "
")); + popup.hide(); + popup.prependTo("#notification_area"); + + popup.fadeIn(300).wait(5000).fadeOut(400, $).remove(); + + return popup +} + +function spawnTemplate(name) +{ + if(!template_cache[name]) + { + template_cache[name] = $("*[data-template-name=" + name + "]").first(); + } + + return template_cache[name].clone(); +} + +function SearchCompletionSource(element) +{ + this.element = element; + this.results = []; +} + +SearchCompletionSource.prototype.getItemCount = function() { + return this.results.length; +} + +SearchCompletionSource.prototype.getAll = function() { + return this.results; +} + +SearchCompletionSource.prototype.getItem = function(index) { + return this.results[index]; +} + +SearchCompletionSource.prototype.updateItems = function(query, callback) { + if(typeof this.request !== "undefined") + { + this.request.abort(); + } + + this.request = $.ajax({ + url: "/autocomplete/search/?q=" + escape(query), + dataType: "json", + success: function(result) { this.results = result; callback(); }.bind(this) + }); +} + +SearchCompletionSource.prototype.isInItems = function(query) { + for(i in this.results) + { + if(this.results[i].indexOf(query) > 0) + { + return true; + } + } + + return false; +} + +SearchCompletionSource.prototype.matchesItem = function(index, query) { + return (this.results[index].name.toLowerCase().indexOf(query.toLowerCase()) > -1); +} + +function PropertyNameCompletionSource(element) +{ + this.element = element; + this.results = []; +} + +PropertyNameCompletionSource.prototype.getItemCount = function() { + return this.results.length; +} + +PropertyNameCompletionSource.prototype.getAll = function() { + return this.results; +} + +PropertyNameCompletionSource.prototype.getItem = function(index) { + return this.results[index]; +} + +PropertyNameCompletionSource.prototype.updateItems = function(query, callback) { + if(typeof this.request !== "undefined") + { + this.request.abort(); + } + + this.request = $.ajax({ + url: "/autocomplete/propertyname/?q=" + escape(query), + dataType: "json", + success: function(result) { this.results = result; callback(); }.bind(this) + }); +} + +PropertyNameCompletionSource.prototype.isInItems = function(query) { + for(i in this.results) + { + if(this.results[i].indexOf(query) > 0) + { + return true; + } + } + + return false; +} + + +PropertyNameCompletionSource.prototype.matchesItem = function(index, query) { + console.log("item", this.results[index].value.toLowerCase()); + console.log("query", query.toLowerCase()); + console.log("result", this.results[index].value.toLowerCase().indexOf(query.toLowerCase())); + return (this.results[index].value.toLowerCase().indexOf(query.toLowerCase()) > -1); +} + +$(function(){ + hookSubmitEvent($("#form_search")); + + $("#button_toolbar_addnode").click(function(){ + var win = new JsdeWindow({ + width: 320, + height: 400, + x: 40, + y: 40, + title: "Create new node", + contents: "Loading...", + source_url: "/nodes/create", + callback: function(){ $(win._inner).find("input[name=name]").focus(); }, + noscroll: true + }); + }); + + /* Intro screen */ + new JsdeWindow({ + width: 640, + height: 480, + x: ($(window).width() / 2) - (640 / 2), + y: ($(window).height() / 2) - (480 / 2), + title: "Welcome!", + contents: "Loading...", + source_url: "/intro" + }); + + spawnNotification("Test notification"); + spawnError("Test error"); + + $("body").on("input", ".auto-duplicate input", function(){ + var parent = $(this).closest(".auto-duplicate"); + + if(!parent.data("duplicated")) + { + spawnTemplate(parent.data("template-name")).insertAfter(parent).find("input").val(""); + parent.data("duplicated", true); + } + }); + + autocompleter_search = new AutoCompleter("search"); + + $("#input_search_query").autoComplete(autocompleter_search, SearchCompletionSource, function(data){ + openWindowNodeDetails(data.value); + this.target.val(""); + }); + + autocompleter_propertyname = new AutoCompleter("propertyname"); + + $("body").autoComplete(autocompleter_propertyname, PropertyNameCompletionSource, "input.input-propertyname"); + + $("body").keydown(function(event){ + switch(event.which) + { + case 70: // F + if(event.ctrlKey) + { + $("#input_search_query").focus(); + event.preventDefault(); + } + break; + case 77: // M + if(event.ctrlKey) + { + $("#button_toolbar_addnode").click(); + event.preventDefault(); + } + break; + } + }); +}); diff --git a/public_html/templates/angular/jsde-error.html b/public_html/templates/angular/jsde-error.html new file mode 100644 index 0000000..d646bdd --- /dev/null +++ b/public_html/templates/angular/jsde-error.html @@ -0,0 +1,9 @@ +
+ + + + Error + + + +
diff --git a/public_html/templates/angular/jsde-notification.html b/public_html/templates/angular/jsde-notification.html new file mode 100644 index 0000000..271f764 --- /dev/null +++ b/public_html/templates/angular/jsde-notification.html @@ -0,0 +1,9 @@ +
+ + + + Notification + + + +
diff --git a/public_html/templates/angular/jsde-window.html b/public_html/templates/angular/jsde-window.html new file mode 100644 index 0000000..99cb44a --- /dev/null +++ b/public_html/templates/angular/jsde-window.html @@ -0,0 +1,18 @@ +
+
+ + {{ title }} + +
+ X +
+
+
+
+
+
+
+
+
+
+
diff --git a/public_html/templates/index.tpl b/public_html/templates/index.tpl index 3daaeaf..4997421 100644 --- a/public_html/templates/index.tpl +++ b/public_html/templates/index.tpl @@ -1,13 +1,15 @@ - + openNG + - + +