code_text
stringlengths
604
999k
repo_name
stringlengths
4
100
file_path
stringlengths
4
873
language
stringclasses
23 values
license
stringclasses
15 values
size
int32
1.02k
999k
//! moment.js locale configuration //! locale : Uzbek [uz] //! author : Sardor Muminov : https://github.com/muminoff ;(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' && typeof require === 'function' ? factory(require('../moment')) : typeof define === 'function' && define.amd ? define(['../moment'], factory) : factory(global.moment) }(this, (function (moment) { 'use strict'; var uz = moment.defineLocale('uz', { months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'), monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'), weekdays : 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'), weekdaysShort : 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'), weekdaysMin : 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'), longDateFormat : { LT : 'HH:mm', LTS : 'HH:mm:ss', L : 'DD/MM/YYYY', LL : 'D MMMM YYYY', LLL : 'D MMMM YYYY HH:mm', LLLL : 'D MMMM YYYY, dddd HH:mm' }, calendar : { sameDay : '[Бугун соат] LT [да]', nextDay : '[Эртага] LT [да]', nextWeek : 'dddd [куни соат] LT [да]', lastDay : '[Кеча соат] LT [да]', lastWeek : '[Утган] dddd [куни соат] LT [да]', sameElse : 'L' }, relativeTime : { future : 'Якин %s ичида', past : 'Бир неча %s олдин', s : 'фурсат', m : 'бир дакика', mm : '%d дакика', h : 'бир соат', hh : '%d соат', d : 'бир кун', dd : '%d кун', M : 'бир ой', MM : '%d ой', y : 'бир йил', yy : '%d йил' }, week : { dow : 1, // Monday is the first day of the week. doy : 7 // The week that contains Jan 4th is the first week of the year. } }); return uz; })));
jainapatel/travellogger
node_modules/moment/locale/uz.js
JavaScript
mit
2,173
/** * @license * Lo-Dash 2.4.1 (Custom Build) lodash.com/license | Underscore.js 1.5.2 underscorejs.org/LICENSE * Build: `lodash -o ./dist/lodash.compat.js` */ ;(function(){function n(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++e<r;)if(n[e]===t)return e;return-1}function t(t,e){var r=typeof e;if(t=t.l,"boolean"==r||null==e)return t[e]?0:-1;"number"!=r&&"string"!=r&&(r="object");var u="number"==r?e:b+e;return t=(t=t[r])&&t[u],"object"==r?t&&-1<n(t,e)?0:-1:t?0:-1}function e(n){var t=this.l,e=typeof n;if("boolean"==e||null==n)t[n]=true;else{"number"!=e&&"string"!=e&&(e="object");var r="number"==e?n:b+n,t=t[e]||(t[e]={});"object"==e?(t[r]||(t[r]=[])).push(n):t[r]=true }}function r(n){return n.charCodeAt(0)}function u(n,t){for(var e=n.m,r=t.m,u=-1,o=e.length;++u<o;){var a=e[u],i=r[u];if(a!==i){if(a>i||typeof a=="undefined")return 1;if(a<i||typeof i=="undefined")return-1}}return n.n-t.n}function o(n){var t=-1,r=n.length,u=n[0],o=n[r/2|0],a=n[r-1];if(u&&typeof u=="object"&&o&&typeof o=="object"&&a&&typeof a=="object")return false;for(u=l(),u["false"]=u["null"]=u["true"]=u.undefined=false,o=l(),o.k=n,o.l=u,o.push=e;++t<r;)o.push(n[t]);return o}function a(n){return"\\"+Y[n] }function i(){return v.pop()||[]}function l(){return y.pop()||{k:null,l:null,m:null,"false":false,n:0,"null":false,number:null,object:null,push:null,string:null,"true":false,undefined:false,o:null}}function f(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function c(n){n.length=0,v.length<w&&v.push(n)}function p(n){var t=n.l;t&&p(t),n.k=n.l=n.m=n.object=n.number=n.string=n.o=null,y.length<w&&y.push(n)}function s(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Array(0>e?0:e);++r<e;)u[r]=n[t+r]; return u}function g(e){function v(n){return n&&typeof n=="object"&&!qe(n)&&we.call(n,"__wrapped__")?n:new y(n)}function y(n,t){this.__chain__=!!t,this.__wrapped__=n}function w(n){function t(){if(r){var n=s(r);je.apply(n,arguments)}if(this instanceof t){var o=nt(e.prototype),n=e.apply(o,n||arguments);return xt(n)?n:o}return e.apply(u,n||arguments)}var e=n[0],r=n[2],u=n[4];return ze(t,n),t}function Y(n,t,e,r,u){if(e){var o=e(n);if(typeof o!="undefined")return o}if(!xt(n))return n;var a=he.call(n);if(!V[a]||!Le.nodeClass&&f(n))return n; var l=Te[a];switch(a){case L:case z:return new l(+n);case W:case M:return new l(n);case J:return o=l(n.source,S.exec(n)),o.lastIndex=n.lastIndex,o}if(a=qe(n),t){var p=!r;r||(r=i()),u||(u=i());for(var g=r.length;g--;)if(r[g]==n)return u[g];o=a?l(n.length):{}}else o=a?s(n):Ye({},n);return a&&(we.call(n,"index")&&(o.index=n.index),we.call(n,"input")&&(o.input=n.input)),t?(r.push(n),u.push(o),(a?Xe:tr)(n,function(n,a){o[a]=Y(n,t,e,r,u)}),p&&(c(r),c(u)),o):o}function nt(n){return xt(n)?Se(n):{}}function tt(n,t,e){if(typeof n!="function")return Ht; if(typeof t=="undefined"||!("prototype"in n))return n;var r=n.__bindData__;if(typeof r=="undefined"&&(Le.funcNames&&(r=!n.name),r=r||!Le.funcDecomp,!r)){var u=be.call(n);Le.funcNames||(r=!A.test(u)),r||(r=B.test(u),ze(n,r))}if(false===r||true!==r&&1&r[1])return n;switch(e){case 1:return function(e){return n.call(t,e)};case 2:return function(e,r){return n.call(t,e,r)};case 3:return function(e,r,u){return n.call(t,e,r,u)};case 4:return function(e,r,u,o){return n.call(t,e,r,u,o)}}return Mt(n,t)}function et(n){function t(){var n=l?a:this; if(u){var h=s(u);je.apply(h,arguments)}return(o||c)&&(h||(h=s(arguments)),o&&je.apply(h,o),c&&h.length<i)?(r|=16,et([e,p?r:-4&r,h,null,a,i])):(h||(h=arguments),f&&(e=n[g]),this instanceof t?(n=nt(e.prototype),h=e.apply(n,h),xt(h)?h:n):e.apply(n,h))}var e=n[0],r=n[1],u=n[2],o=n[3],a=n[4],i=n[5],l=1&r,f=2&r,c=4&r,p=8&r,g=e;return ze(t,n),t}function rt(e,r){var u=-1,a=ht(),i=e?e.length:0,l=i>=_&&a===n,f=[];if(l){var c=o(r);c?(a=t,r=c):l=false}for(;++u<i;)c=e[u],0>a(r,c)&&f.push(c);return l&&p(r),f}function ot(n,t,e,r){r=(r||0)-1; for(var u=n?n.length:0,o=[];++r<u;){var a=n[r];if(a&&typeof a=="object"&&typeof a.length=="number"&&(qe(a)||dt(a))){t||(a=ot(a,t,e));var i=-1,l=a.length,f=o.length;for(o.length+=l;++i<l;)o[f++]=a[i]}else e||o.push(a)}return o}function at(n,t,e,r,u,o){if(e){var a=e(n,t);if(typeof a!="undefined")return!!a}if(n===t)return 0!==n||1/n==1/t;if(n===n&&!(n&&X[typeof n]||t&&X[typeof t]))return false;if(null==n||null==t)return n===t;var l=he.call(n),p=he.call(t);if(l==T&&(l=G),p==T&&(p=G),l!=p)return false;switch(l){case L:case z:return+n==+t; case W:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case J:case M:return n==ie(t)}if(p=l==$,!p){var s=we.call(n,"__wrapped__"),g=we.call(t,"__wrapped__");if(s||g)return at(s?n.__wrapped__:n,g?t.__wrapped__:t,e,r,u,o);if(l!=G||!Le.nodeClass&&(f(n)||f(t)))return false;if(l=!Le.argsObject&&dt(n)?oe:n.constructor,s=!Le.argsObject&&dt(t)?oe:t.constructor,l!=s&&!(jt(l)&&l instanceof l&&jt(s)&&s instanceof s)&&"constructor"in n&&"constructor"in t)return false}for(l=!u,u||(u=i()),o||(o=i()),s=u.length;s--;)if(u[s]==n)return o[s]==t; var h=0,a=true;if(u.push(n),o.push(t),p){if(s=n.length,h=t.length,(a=h==s)||r)for(;h--;)if(p=s,g=t[h],r)for(;p--&&!(a=at(n[p],g,e,r,u,o)););else if(!(a=at(n[h],g,e,r,u,o)))break}else nr(t,function(t,i,l){return we.call(l,i)?(h++,a=we.call(n,i)&&at(n[i],t,e,r,u,o)):void 0}),a&&!r&&nr(n,function(n,t,e){return we.call(e,t)?a=-1<--h:void 0});return u.pop(),o.pop(),l&&(c(u),c(o)),a}function it(n,t,e,r,u){(qe(t)?Dt:tr)(t,function(t,o){var a,i,l=t,f=n[o];if(t&&((i=qe(t))||er(t))){for(l=r.length;l--;)if(a=r[l]==t){f=u[l]; break}if(!a){var c;e&&(l=e(f,t),c=typeof l!="undefined")&&(f=l),c||(f=i?qe(f)?f:[]:er(f)?f:{}),r.push(t),u.push(f),c||it(f,t,e,r,u)}}else e&&(l=e(f,t),typeof l=="undefined"&&(l=t)),typeof l!="undefined"&&(f=l);n[o]=f})}function lt(n,t){return n+de(Fe()*(t-n+1))}function ft(e,r,u){var a=-1,l=ht(),f=e?e.length:0,s=[],g=!r&&f>=_&&l===n,h=u||g?i():s;for(g&&(h=o(h),l=t);++a<f;){var v=e[a],y=u?u(v,a,e):v;(r?!a||h[h.length-1]!==y:0>l(h,y))&&((u||g)&&h.push(y),s.push(v))}return g?(c(h.k),p(h)):u&&c(h),s}function ct(n){return function(t,e,r){var u={}; if(e=v.createCallback(e,r,3),qe(t)){r=-1;for(var o=t.length;++r<o;){var a=t[r];n(u,a,e(a,r,t),t)}}else Xe(t,function(t,r,o){n(u,t,e(t,r,o),o)});return u}}function pt(n,t,e,r,u,o){var a=1&t,i=4&t,l=16&t,f=32&t;if(!(2&t||jt(n)))throw new le;l&&!e.length&&(t&=-17,l=e=false),f&&!r.length&&(t&=-33,f=r=false);var c=n&&n.__bindData__;return c&&true!==c?(c=s(c),c[2]&&(c[2]=s(c[2])),c[3]&&(c[3]=s(c[3])),!a||1&c[1]||(c[4]=u),!a&&1&c[1]&&(t|=8),!i||4&c[1]||(c[5]=o),l&&je.apply(c[2]||(c[2]=[]),e),f&&Ee.apply(c[3]||(c[3]=[]),r),c[1]|=t,pt.apply(null,c)):(1==t||17===t?w:et)([n,t,e,r,u,o]) }function st(){Q.h=F,Q.b=Q.c=Q.g=Q.i="",Q.e="t",Q.j=true;for(var n,t=0;n=arguments[t];t++)for(var e in n)Q[e]=n[e];t=Q.a,Q.d=/^[^,]+/.exec(t)[0],n=ee,t="return function("+t+"){",e=Q;var r="var n,t="+e.d+",E="+e.e+";if(!t)return E;"+e.i+";";e.b?(r+="var u=t.length;n=-1;if("+e.b+"){",Le.unindexedChars&&(r+="if(s(t)){t=t.split('')}"),r+="while(++n<u){"+e.g+";}}else{"):Le.nonEnumArgs&&(r+="var u=t.length;n=-1;if(u&&p(t)){while(++n<u){n+='';"+e.g+";}}else{"),Le.enumPrototypes&&(r+="var G=typeof t=='function';"),Le.enumErrorProps&&(r+="var F=t===k||t instanceof Error;"); var u=[];if(Le.enumPrototypes&&u.push('!(G&&n=="prototype")'),Le.enumErrorProps&&u.push('!(F&&(n=="message"||n=="name"))'),e.j&&e.f)r+="var C=-1,D=B[typeof t]&&v(t),u=D?D.length:0;while(++C<u){n=D[C];",u.length&&(r+="if("+u.join("&&")+"){"),r+=e.g+";",u.length&&(r+="}"),r+="}";else if(r+="for(n in t){",e.j&&u.push("m.call(t, n)"),u.length&&(r+="if("+u.join("&&")+"){"),r+=e.g+";",u.length&&(r+="}"),r+="}",Le.nonEnumShadows){for(r+="if(t!==A){var i=t.constructor,r=t===(i&&i.prototype),f=t===J?I:t===k?j:L.call(t),x=y[f];",k=0;7>k;k++)r+="n='"+e.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",e.j||(r+="||(!x[n]&&t[n]!==A[n])"),r+="){"+e.g+"}"; r+="}"}return(e.b||Le.nonEnumArgs)&&(r+="}"),r+=e.c+";return E",n("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",t+r+"}")(tt,q,ce,we,d,dt,qe,kt,Q.f,pe,X,$e,M,se,he)}function gt(n){return Ve[n]}function ht(){var t=(t=v.indexOf)===zt?n:t;return t}function vt(n){return typeof n=="function"&&ve.test(n)}function yt(n){var t,e;return!n||he.call(n)!=G||(t=n.constructor,jt(t)&&!(t instanceof t))||!Le.argsClass&&dt(n)||!Le.nodeClass&&f(n)?false:Le.ownLast?(nr(n,function(n,t,r){return e=we.call(r,t),false}),false!==e):(nr(n,function(n,t){e=t }),typeof e=="undefined"||we.call(n,e))}function mt(n){return He[n]}function dt(n){return n&&typeof n=="object"&&typeof n.length=="number"&&he.call(n)==T||false}function bt(n,t,e){var r=We(n),u=r.length;for(t=tt(t,e,3);u--&&(e=r[u],false!==t(n[e],e,n)););return n}function _t(n){var t=[];return nr(n,function(n,e){jt(n)&&t.push(e)}),t.sort()}function wt(n){for(var t=-1,e=We(n),r=e.length,u={};++t<r;){var o=e[t];u[n[o]]=o}return u}function jt(n){return typeof n=="function"}function xt(n){return!(!n||!X[typeof n]) }function Ct(n){return typeof n=="number"||n&&typeof n=="object"&&he.call(n)==W||false}function kt(n){return typeof n=="string"||n&&typeof n=="object"&&he.call(n)==M||false}function Et(n){for(var t=-1,e=We(n),r=e.length,u=Zt(r);++t<r;)u[t]=n[e[t]];return u}function Ot(n,t,e){var r=-1,u=ht(),o=n?n.length:0,a=false;return e=(0>e?Be(0,o+e):e)||0,qe(n)?a=-1<u(n,t,e):typeof o=="number"?a=-1<(kt(n)?n.indexOf(t,e):u(n,t,e)):Xe(n,function(n){return++r<e?void 0:!(a=n===t)}),a}function St(n,t,e){var r=true;if(t=v.createCallback(t,e,3),qe(n)){e=-1; for(var u=n.length;++e<u&&(r=!!t(n[e],e,n)););}else Xe(n,function(n,e,u){return r=!!t(n,e,u)});return r}function At(n,t,e){var r=[];if(t=v.createCallback(t,e,3),qe(n)){e=-1;for(var u=n.length;++e<u;){var o=n[e];t(o,e,n)&&r.push(o)}}else Xe(n,function(n,e,u){t(n,e,u)&&r.push(n)});return r}function It(n,t,e){if(t=v.createCallback(t,e,3),!qe(n)){var r;return Xe(n,function(n,e,u){return t(n,e,u)?(r=n,false):void 0}),r}e=-1;for(var u=n.length;++e<u;){var o=n[e];if(t(o,e,n))return o}}function Dt(n,t,e){if(t&&typeof e=="undefined"&&qe(n)){e=-1; for(var r=n.length;++e<r&&false!==t(n[e],e,n););}else Xe(n,t,e);return n}function Nt(n,t,e){var r=n,u=n?n.length:0;if(t=t&&typeof e=="undefined"?t:tt(t,e,3),qe(n))for(;u--&&false!==t(n[u],u,n););else{if(typeof u!="number")var o=We(n),u=o.length;else Le.unindexedChars&&kt(n)&&(r=n.split(""));Xe(n,function(n,e,a){return e=o?o[--u]:--u,t(r[e],e,a)})}return n}function Bt(n,t,e){var r=-1,u=n?n.length:0,o=Zt(typeof u=="number"?u:0);if(t=v.createCallback(t,e,3),qe(n))for(;++r<u;)o[r]=t(n[r],r,n);else Xe(n,function(n,e,u){o[++r]=t(n,e,u) });return o}function Pt(n,t,e){var u=-1/0,o=u;if(typeof t!="function"&&e&&e[t]===n&&(t=null),null==t&&qe(n)){e=-1;for(var a=n.length;++e<a;){var i=n[e];i>o&&(o=i)}}else t=null==t&&kt(n)?r:v.createCallback(t,e,3),Xe(n,function(n,e,r){e=t(n,e,r),e>u&&(u=e,o=n)});return o}function Rt(n,t,e,r){var u=3>arguments.length;if(t=v.createCallback(t,r,4),qe(n)){var o=-1,a=n.length;for(u&&(e=n[++o]);++o<a;)e=t(e,n[o],o,n)}else Xe(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o)});return e}function Ft(n,t,e,r){var u=3>arguments.length; return t=v.createCallback(t,r,4),Nt(n,function(n,r,o){e=u?(u=false,n):t(e,n,r,o)}),e}function Tt(n){var t=-1,e=n?n.length:0,r=Zt(typeof e=="number"?e:0);return Dt(n,function(n){var e=lt(0,++t);r[t]=r[e],r[e]=n}),r}function $t(n,t,e){var r;if(t=v.createCallback(t,e,3),qe(n)){e=-1;for(var u=n.length;++e<u&&!(r=t(n[e],e,n)););}else Xe(n,function(n,e,u){return!(r=t(n,e,u))});return!!r}function Lt(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=-1;for(t=v.createCallback(t,e,3);++o<u&&t(n[o],o,n);)r++ }else if(r=t,null==r||e)return n?n[0]:h;return s(n,0,Pe(Be(0,r),u))}function zt(t,e,r){if(typeof r=="number"){var u=t?t.length:0;r=0>r?Be(0,u+r):r||0}else if(r)return r=Kt(t,e),t[r]===e?r:-1;return n(t,e,r)}function qt(n,t,e){if(typeof t!="number"&&null!=t){var r=0,u=-1,o=n?n.length:0;for(t=v.createCallback(t,e,3);++u<o&&t(n[u],u,n);)r++}else r=null==t||e?1:Be(0,t);return s(n,r)}function Kt(n,t,e,r){var u=0,o=n?n.length:u;for(e=e?v.createCallback(e,r,1):Ht,t=e(t);u<o;)r=u+o>>>1,e(n[r])<t?u=r+1:o=r; return u}function Wt(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=typeof t!="function"&&r&&r[t]===n?null:t,t=false),null!=e&&(e=v.createCallback(e,r,3)),ft(n,t,e)}function Gt(){for(var n=1<arguments.length?arguments:arguments[0],t=-1,e=n?Pt(ar(n,"length")):0,r=Zt(0>e?0:e);++t<e;)r[t]=ar(n,t);return r}function Jt(n,t){var e=-1,r=n?n.length:0,u={};for(t||!r||qe(n[0])||(t=[]);++e<r;){var o=n[e];t?u[o]=t[e]:o&&(u[o[0]]=o[1])}return u}function Mt(n,t){return 2<arguments.length?pt(n,17,s(arguments,2),null,t):pt(n,1,null,null,t) }function Vt(n,t,e){var r,u,o,a,i,l,f,c=0,p=false,s=true;if(!jt(n))throw new le;if(t=Be(0,t)||0,true===e)var g=true,s=false;else xt(e)&&(g=e.leading,p="maxWait"in e&&(Be(t,e.maxWait)||0),s="trailing"in e?e.trailing:s);var v=function(){var e=t-(ir()-a);0<e?l=Ce(v,e):(u&&me(u),e=f,u=l=f=h,e&&(c=ir(),o=n.apply(i,r),l||u||(r=i=null)))},y=function(){l&&me(l),u=l=f=h,(s||p!==t)&&(c=ir(),o=n.apply(i,r),l||u||(r=i=null))};return function(){if(r=arguments,a=ir(),i=this,f=s&&(l||!g),false===p)var e=g&&!l;else{u||g||(c=a); var h=p-(a-c),m=0>=h;m?(u&&(u=me(u)),c=a,o=n.apply(i,r)):u||(u=Ce(y,h))}return m&&l?l=me(l):l||t===p||(l=Ce(v,t)),e&&(m=true,o=n.apply(i,r)),!m||l||u||(r=i=null),o}}function Ht(n){return n}function Ut(n,t,e){var r=true,u=t&&_t(t);t&&(e||u.length)||(null==e&&(e=t),o=y,t=n,n=v,u=_t(t)),false===e?r=false:xt(e)&&"chain"in e&&(r=e.chain);var o=n,a=jt(o);Dt(u,function(e){var u=n[e]=t[e];a&&(o.prototype[e]=function(){var t=this.__chain__,e=this.__wrapped__,a=[e];if(je.apply(a,arguments),a=u.apply(n,a),r||t){if(e===a&&xt(a))return this; a=new o(a),a.__chain__=t}return a})})}function Qt(){}function Xt(n){return function(t){return t[n]}}function Yt(){return this.__wrapped__}e=e?ut.defaults(Z.Object(),e,ut.pick(Z,R)):Z;var Zt=e.Array,ne=e.Boolean,te=e.Date,ee=e.Function,re=e.Math,ue=e.Number,oe=e.Object,ae=e.RegExp,ie=e.String,le=e.TypeError,fe=[],ce=e.Error.prototype,pe=oe.prototype,se=ie.prototype,ge=e._,he=pe.toString,ve=ae("^"+ie(he).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),ye=re.ceil,me=e.clearTimeout,de=re.floor,be=ee.prototype.toString,_e=vt(_e=oe.getPrototypeOf)&&_e,we=pe.hasOwnProperty,je=fe.push,xe=pe.propertyIsEnumerable,Ce=e.setTimeout,ke=fe.splice,Ee=fe.unshift,Oe=function(){try{var n={},t=vt(t=oe.defineProperty)&&t,e=t(n,n,n)&&t }catch(r){}return e}(),Se=vt(Se=oe.create)&&Se,Ae=vt(Ae=Zt.isArray)&&Ae,Ie=e.isFinite,De=e.isNaN,Ne=vt(Ne=oe.keys)&&Ne,Be=re.max,Pe=re.min,Re=e.parseInt,Fe=re.random,Te={};Te[$]=Zt,Te[L]=ne,Te[z]=te,Te[K]=ee,Te[G]=oe,Te[W]=ue,Te[J]=ae,Te[M]=ie;var $e={};$e[$]=$e[z]=$e[W]={constructor:true,toLocaleString:true,toString:true,valueOf:true},$e[L]=$e[M]={constructor:true,toString:true,valueOf:true},$e[q]=$e[K]=$e[J]={constructor:true,toString:true},$e[G]={constructor:true},function(){for(var n=F.length;n--;){var t,e=F[n]; for(t in $e)we.call($e,t)&&!we.call($e[t],e)&&($e[t][e]=false)}}(),y.prototype=v.prototype;var Le=v.support={};!function(){var n=function(){this.x=1},t={0:1,length:1},r=[];n.prototype={valueOf:1,y:1};for(var u in new n)r.push(u);for(u in arguments);Le.argsClass=he.call(arguments)==T,Le.argsObject=arguments.constructor==oe&&!(arguments instanceof Zt),Le.enumErrorProps=xe.call(ce,"message")||xe.call(ce,"name"),Le.enumPrototypes=xe.call(n,"prototype"),Le.funcDecomp=!vt(e.WinRTError)&&B.test(g),Le.funcNames=typeof ee.name=="string",Le.nonEnumArgs=0!=u,Le.nonEnumShadows=!/valueOf/.test(r),Le.ownLast="x"!=r[0],Le.spliceObjects=(fe.splice.call(t,0,1),!t[0]),Le.unindexedChars="xx"!="x"[0]+oe("x")[0]; try{Le.nodeClass=!(he.call(document)==G&&!({toString:0}+""))}catch(o){Le.nodeClass=true}}(1),v.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:I,variable:"",imports:{_:v}},Se||(nt=function(){function n(){}return function(t){if(xt(t)){n.prototype=t;var r=new n;n.prototype=null}return r||e.Object()}}());var ze=Oe?function(n,t){U.value=t,Oe(n,"__bindData__",U)}:Qt;Le.argsClass||(dt=function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&we.call(n,"callee")&&!xe.call(n,"callee")||false });var qe=Ae||function(n){return n&&typeof n=="object"&&typeof n.length=="number"&&he.call(n)==$||false},Ke=st({a:"z",e:"[]",i:"if(!(B[typeof z]))return E",g:"E.push(n)"}),We=Ne?function(n){return xt(n)?Le.enumPrototypes&&typeof n=="function"||Le.nonEnumArgs&&n.length&&dt(n)?Ke(n):Ne(n):[]}:Ke,Ge={a:"g,e,K",i:"e=e&&typeof K=='undefined'?e:d(e,K,3)",b:"typeof u=='number'",v:We,g:"if(e(t[n],n,g)===false)return E"},Je={a:"z,H,l",i:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b<c){t=a[b];if(t&&B[typeof t]){",v:We,g:"if(typeof E[n]=='undefined')E[n]=t[n]",c:"}}"},Me={i:"if(!B[typeof t])return E;"+Ge.i,b:false},Ve={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},He=wt(Ve),Ue=ae("("+We(He).join("|")+")","g"),Qe=ae("["+We(Ve).join("")+"]","g"),Xe=st(Ge),Ye=st(Je,{i:Je.i.replace(";",";if(c>3&&typeof a[c-2]=='function'){var e=d(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){e=a[--c]}"),g:"E[n]=e?e(E[n],t[n]):t[n]"}),Ze=st(Je),nr=st(Ge,Me,{j:false}),tr=st(Ge,Me); jt(/x/)&&(jt=function(n){return typeof n=="function"&&he.call(n)==K});var er=_e?function(n){if(!n||he.call(n)!=G||!Le.argsClass&&dt(n))return false;var t=n.valueOf,e=vt(t)&&(e=_e(t))&&_e(e);return e?n==e||_e(n)==e:yt(n)}:yt,rr=ct(function(n,t,e){we.call(n,e)?n[e]++:n[e]=1}),ur=ct(function(n,t,e){(we.call(n,e)?n[e]:n[e]=[]).push(t)}),or=ct(function(n,t,e){n[e]=t}),ar=Bt,ir=vt(ir=te.now)&&ir||function(){return(new te).getTime()},lr=8==Re(j+"08")?Re:function(n,t){return Re(kt(n)?n.replace(D,""):n,t||0)}; return v.after=function(n,t){if(!jt(t))throw new le;return function(){return 1>--n?t.apply(this,arguments):void 0}},v.assign=Ye,v.at=function(n){var t=arguments,e=-1,r=ot(t,true,false,1),t=t[2]&&t[2][t[1]]===n?1:r.length,u=Zt(t);for(Le.unindexedChars&&kt(n)&&(n=n.split(""));++e<t;)u[e]=n[r[e]];return u},v.bind=Mt,v.bindAll=function(n){for(var t=1<arguments.length?ot(arguments,true,false,1):_t(n),e=-1,r=t.length;++e<r;){var u=t[e];n[u]=pt(n[u],1,null,null,n)}return n},v.bindKey=function(n,t){return 2<arguments.length?pt(t,19,s(arguments,2),null,n):pt(t,3,null,null,n) },v.chain=function(n){return n=new y(n),n.__chain__=true,n},v.compact=function(n){for(var t=-1,e=n?n.length:0,r=[];++t<e;){var u=n[t];u&&r.push(u)}return r},v.compose=function(){for(var n=arguments,t=n.length;t--;)if(!jt(n[t]))throw new le;return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];return t[0]}},v.constant=function(n){return function(){return n}},v.countBy=rr,v.create=function(n,t){var e=nt(n);return t?Ye(e,t):e},v.createCallback=function(n,t,e){var r=typeof n;if(null==n||"function"==r)return tt(n,t,e); if("object"!=r)return Xt(n);var u=We(n),o=u[0],a=n[o];return 1!=u.length||a!==a||xt(a)?function(t){for(var e=u.length,r=false;e--&&(r=at(t[u[e]],n[u[e]],null,true)););return r}:function(n){return n=n[o],a===n&&(0!==a||1/a==1/n)}},v.curry=function(n,t){return t=typeof t=="number"?t:+t||n.length,pt(n,4,null,null,null,t)},v.debounce=Vt,v.defaults=Ze,v.defer=function(n){if(!jt(n))throw new le;var t=s(arguments,1);return Ce(function(){n.apply(h,t)},1)},v.delay=function(n,t){if(!jt(n))throw new le;var e=s(arguments,2); return Ce(function(){n.apply(h,e)},t)},v.difference=function(n){return rt(n,ot(arguments,true,true,1))},v.filter=At,v.flatten=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=typeof t!="function"&&r&&r[t]===n?null:t,t=false),null!=e&&(n=Bt(n,e,r)),ot(n,t)},v.forEach=Dt,v.forEachRight=Nt,v.forIn=nr,v.forInRight=function(n,t,e){var r=[];nr(n,function(n,t){r.push(t,n)});var u=r.length;for(t=tt(t,e,3);u--&&false!==t(r[u--],r[u],n););return n},v.forOwn=tr,v.forOwnRight=bt,v.functions=_t,v.groupBy=ur,v.indexBy=or,v.initial=function(n,t,e){var r=0,u=n?n.length:0; if(typeof t!="number"&&null!=t){var o=u;for(t=v.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return s(n,0,Pe(Be(0,u-r),u))},v.intersection=function(){for(var e=[],r=-1,u=arguments.length,a=i(),l=ht(),f=l===n,s=i();++r<u;){var g=arguments[r];(qe(g)||dt(g))&&(e.push(g),a.push(f&&g.length>=_&&o(r?e[r]:s)))}var f=e[0],h=-1,v=f?f.length:0,y=[];n:for(;++h<v;){var m=a[0],g=f[h];if(0>(m?t(m,g):l(s,g))){for(r=u,(m||s).push(g);--r;)if(m=a[r],0>(m?t(m,g):l(e[r],g)))continue n;y.push(g) }}for(;u--;)(m=a[u])&&p(m);return c(a),c(s),y},v.invert=wt,v.invoke=function(n,t){var e=s(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Zt(typeof o=="number"?o:0);return Dt(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},v.keys=We,v.map=Bt,v.mapValues=function(n,t,e){var r={};return t=v.createCallback(t,e,3),tr(n,function(n,e,u){r[e]=t(n,e,u)}),r},v.max=Pt,v.memoize=function(n,t){if(!jt(n))throw new le;var e=function(){var r=e.cache,u=t?t.apply(this,arguments):b+arguments[0];return we.call(r,u)?r[u]:r[u]=n.apply(this,arguments) };return e.cache={},e},v.merge=function(n){var t=arguments,e=2;if(!xt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3<e&&"function"==typeof t[e-2])var r=tt(t[--e-1],t[e--],2);else 2<e&&"function"==typeof t[e-1]&&(r=t[--e]);for(var t=s(arguments,1,e),u=-1,o=i(),a=i();++u<e;)it(n,t[u],r,o,a);return c(o),c(a),n},v.min=function(n,t,e){var u=1/0,o=u;if(typeof t!="function"&&e&&e[t]===n&&(t=null),null==t&&qe(n)){e=-1;for(var a=n.length;++e<a;){var i=n[e];i<o&&(o=i)}}else t=null==t&&kt(n)?r:v.createCallback(t,e,3),Xe(n,function(n,e,r){e=t(n,e,r),e<u&&(u=e,o=n) });return o},v.omit=function(n,t,e){var r={};if(typeof t!="function"){var u=[];nr(n,function(n,t){u.push(t)});for(var u=rt(u,ot(arguments,true,false,1)),o=-1,a=u.length;++o<a;){var i=u[o];r[i]=n[i]}}else t=v.createCallback(t,e,3),nr(n,function(n,e,u){t(n,e,u)||(r[e]=n)});return r},v.once=function(n){var t,e;if(!jt(n))throw new le;return function(){return t?e:(t=true,e=n.apply(this,arguments),n=null,e)}},v.pairs=function(n){for(var t=-1,e=We(n),r=e.length,u=Zt(r);++t<r;){var o=e[t];u[t]=[o,n[o]]}return u },v.partial=function(n){return pt(n,16,s(arguments,1))},v.partialRight=function(n){return pt(n,32,null,s(arguments,1))},v.pick=function(n,t,e){var r={};if(typeof t!="function")for(var u=-1,o=ot(arguments,true,false,1),a=xt(n)?o.length:0;++u<a;){var i=o[u];i in n&&(r[i]=n[i])}else t=v.createCallback(t,e,3),nr(n,function(n,e,u){t(n,e,u)&&(r[e]=n)});return r},v.pluck=ar,v.property=Xt,v.pull=function(n){for(var t=arguments,e=0,r=t.length,u=n?n.length:0;++e<r;)for(var o=-1,a=t[e];++o<u;)n[o]===a&&(ke.call(n,o--,1),u--); return n},v.range=function(n,t,e){n=+n||0,e=typeof e=="number"?e:+e||1,null==t&&(t=n,n=0);var r=-1;t=Be(0,ye((t-n)/(e||1)));for(var u=Zt(t);++r<t;)u[r]=n,n+=e;return u},v.reject=function(n,t,e){return t=v.createCallback(t,e,3),At(n,function(n,e,r){return!t(n,e,r)})},v.remove=function(n,t,e){var r=-1,u=n?n.length:0,o=[];for(t=v.createCallback(t,e,3);++r<u;)e=n[r],t(e,r,n)&&(o.push(e),ke.call(n,r--,1),u--);return o},v.rest=qt,v.shuffle=Tt,v.sortBy=function(n,t,e){var r=-1,o=qe(t),a=n?n.length:0,f=Zt(typeof a=="number"?a:0); for(o||(t=v.createCallback(t,e,3)),Dt(n,function(n,e,u){var a=f[++r]=l();o?a.m=Bt(t,function(t){return n[t]}):(a.m=i())[0]=t(n,e,u),a.n=r,a.o=n}),a=f.length,f.sort(u);a--;)n=f[a],f[a]=n.o,o||c(n.m),p(n);return f},v.tap=function(n,t){return t(n),n},v.throttle=function(n,t,e){var r=true,u=true;if(!jt(n))throw new le;return false===e?r=false:xt(e)&&(r="leading"in e?e.leading:r,u="trailing"in e?e.trailing:u),H.leading=r,H.maxWait=t,H.trailing=u,Vt(n,t,H)},v.times=function(n,t,e){n=-1<(n=+n)?n:0;var r=-1,u=Zt(n); for(t=tt(t,e,1);++r<n;)u[r]=t(r);return u},v.toArray=function(n){return n&&typeof n.length=="number"?Le.unindexedChars&&kt(n)?n.split(""):s(n):Et(n)},v.transform=function(n,t,e,r){var u=qe(n);if(null==e)if(u)e=[];else{var o=n&&n.constructor;e=nt(o&&o.prototype)}return t&&(t=v.createCallback(t,r,4),(u?Xe:tr)(n,function(n,r,u){return t(e,n,r,u)})),e},v.union=function(){return ft(ot(arguments,true,true))},v.uniq=Wt,v.values=Et,v.where=At,v.without=function(n){return rt(n,s(arguments,1))},v.wrap=function(n,t){return pt(t,16,[n]) },v.xor=function(){for(var n=-1,t=arguments.length;++n<t;){var e=arguments[n];if(qe(e)||dt(e))var r=r?ft(rt(r,e).concat(rt(e,r))):e}return r||[]},v.zip=Gt,v.zipObject=Jt,v.collect=Bt,v.drop=qt,v.each=Dt,v.eachRight=Nt,v.extend=Ye,v.methods=_t,v.object=Jt,v.select=At,v.tail=qt,v.unique=Wt,v.unzip=Gt,Ut(v),v.clone=function(n,t,e,r){return typeof t!="boolean"&&null!=t&&(r=e,e=t,t=false),Y(n,t,typeof e=="function"&&tt(e,r,1))},v.cloneDeep=function(n,t,e){return Y(n,true,typeof t=="function"&&tt(t,e,1))},v.contains=Ot,v.escape=function(n){return null==n?"":ie(n).replace(Qe,gt) },v.every=St,v.find=It,v.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=v.createCallback(t,e,3);++r<u;)if(t(n[r],r,n))return r;return-1},v.findKey=function(n,t,e){var r;return t=v.createCallback(t,e,3),tr(n,function(n,e,u){return t(n,e,u)?(r=e,false):void 0}),r},v.findLast=function(n,t,e){var r;return t=v.createCallback(t,e,3),Nt(n,function(n,e,u){return t(n,e,u)?(r=n,false):void 0}),r},v.findLastIndex=function(n,t,e){var r=n?n.length:0;for(t=v.createCallback(t,e,3);r--;)if(t(n[r],r,n))return r; return-1},v.findLastKey=function(n,t,e){var r;return t=v.createCallback(t,e,3),bt(n,function(n,e,u){return t(n,e,u)?(r=e,false):void 0}),r},v.has=function(n,t){return n?we.call(n,t):false},v.identity=Ht,v.indexOf=zt,v.isArguments=dt,v.isArray=qe,v.isBoolean=function(n){return true===n||false===n||n&&typeof n=="object"&&he.call(n)==L||false},v.isDate=function(n){return n&&typeof n=="object"&&he.call(n)==z||false},v.isElement=function(n){return n&&1===n.nodeType||false},v.isEmpty=function(n){var t=true;if(!n)return t;var e=he.call(n),r=n.length; return e==$||e==M||(Le.argsClass?e==T:dt(n))||e==G&&typeof r=="number"&&jt(n.splice)?!r:(tr(n,function(){return t=false}),t)},v.isEqual=function(n,t,e,r){return at(n,t,typeof e=="function"&&tt(e,r,2))},v.isFinite=function(n){return Ie(n)&&!De(parseFloat(n))},v.isFunction=jt,v.isNaN=function(n){return Ct(n)&&n!=+n},v.isNull=function(n){return null===n},v.isNumber=Ct,v.isObject=xt,v.isPlainObject=er,v.isRegExp=function(n){return n&&X[typeof n]&&he.call(n)==J||false},v.isString=kt,v.isUndefined=function(n){return typeof n=="undefined" },v.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?Be(0,r+e):Pe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},v.mixin=Ut,v.noConflict=function(){return e._=ge,this},v.noop=Qt,v.now=ir,v.parseInt=lr,v.random=function(n,t,e){var r=null==n,u=null==t;return null==e&&(typeof n=="boolean"&&u?(e=n,n=1):u||typeof t!="boolean"||(e=t,u=true)),r&&u&&(t=1),n=+n||0,u?(t=n,n=0):t=+t||0,e||n%1||t%1?(e=Fe(),Pe(n+e*(t-n+parseFloat("1e-"+((e+"").length-1))),t)):lt(n,t)},v.reduce=Rt,v.reduceRight=Ft,v.result=function(n,t){if(n){var e=n[t]; return jt(e)?n[t]():e}},v.runInContext=g,v.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:We(n).length},v.some=$t,v.sortedIndex=Kt,v.template=function(n,t,e){var r=v.templateSettings;n=ie(n||""),e=Ze({},e,r);var u,o=Ze({},e.imports,r.imports),r=We(o),o=Et(o),i=0,l=e.interpolate||N,f="__p+='",l=ae((e.escape||N).source+"|"+l.source+"|"+(l===I?O:N).source+"|"+(e.evaluate||N).source+"|$","g");n.replace(l,function(t,e,r,o,l,c){return r||(r=o),f+=n.slice(i,c).replace(P,a),e&&(f+="'+__e("+e+")+'"),l&&(u=true,f+="';"+l+";\n__p+='"),r&&(f+="'+((__t=("+r+"))==null?'':__t)+'"),i=c+t.length,t }),f+="';",l=e=e.variable,l||(e="obj",f="with("+e+"){"+f+"}"),f=(u?f.replace(x,""):f).replace(C,"$1").replace(E,"$1;"),f="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}";try{var c=ee(r,"return "+f).apply(h,o)}catch(p){throw p.source=f,p}return t?c(t):(c.source=f,c)},v.unescape=function(n){return null==n?"":ie(n).replace(Ue,mt)},v.uniqueId=function(n){var t=++m;return ie(null==n?"":n)+t },v.all=St,v.any=$t,v.detect=It,v.findWhere=It,v.foldl=Rt,v.foldr=Ft,v.include=Ot,v.inject=Rt,Ut(function(){var n={};return tr(v,function(t,e){v.prototype[e]||(n[e]=t)}),n}(),false),v.first=Lt,v.last=function(n,t,e){var r=0,u=n?n.length:0;if(typeof t!="number"&&null!=t){var o=u;for(t=v.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n?n[u-1]:h;return s(n,Be(0,u-r))},v.sample=function(n,t,e){return n&&typeof n.length!="number"?n=Et(n):Le.unindexedChars&&kt(n)&&(n=n.split("")),null==t||e?n?n[lt(0,n.length-1)]:h:(n=Tt(n),n.length=Pe(Be(0,t),n.length),n) },v.take=Lt,v.head=Lt,tr(v,function(n,t){var e="sample"!==t;v.prototype[t]||(v.prototype[t]=function(t,r){var u=this.__chain__,o=n(this.__wrapped__,t,r);return u||null!=t&&(!r||e&&typeof t=="function")?new y(o,u):o})}),v.VERSION="2.4.1",v.prototype.chain=function(){return this.__chain__=true,this},v.prototype.toString=function(){return ie(this.__wrapped__)},v.prototype.value=Yt,v.prototype.valueOf=Yt,Xe(["join","pop","shift"],function(n){var t=fe[n];v.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments); return n?new y(e,n):e}}),Xe(["push","reverse","sort","unshift"],function(n){var t=fe[n];v.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Xe(["concat","slice","splice"],function(n){var t=fe[n];v.prototype[n]=function(){return new y(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Le.spliceObjects||Xe(["pop","shift","splice"],function(n){var t=fe[n],e="splice"==n;v.prototype[n]=function(){var n=this.__chain__,r=this.__wrapped__,u=t.apply(r,arguments);return 0===r.length&&delete r[0],n||e?new y(u,n):u }}),v}var h,v=[],y=[],m=0,d={},b=+new Date+"",_=75,w=40,j=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",x=/\b__p\+='';/g,C=/\b(__p\+=)''\+/g,E=/(__e\(.*?\)|\b__t\))\+'';/g,O=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,S=/\w*$/,A=/^\s*function[ \n\r\t]+\w/,I=/<%=([\s\S]+?)%>/g,D=RegExp("^["+j+"]*0+(?=.$)"),N=/($^)/,B=/\bthis\b/,P=/['\n\r\t\u2028\u2029\\]/g,R="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setTimeout".split(" "),F="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),T="[object Arguments]",$="[object Array]",L="[object Boolean]",z="[object Date]",q="[object Error]",K="[object Function]",W="[object Number]",G="[object Object]",J="[object RegExp]",M="[object String]",V={}; V[K]=false,V[T]=V[$]=V[L]=V[z]=V[W]=V[G]=V[J]=V[M]=true;var H={leading:false,maxWait:0,trailing:false},U={configurable:false,enumerable:false,value:null,writable:false},Q={a:"",b:null,c:"",d:"",e:"",v:null,g:"",h:null,support:null,i:"",j:false},X={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false},Y={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Z=X[typeof window]&&window||this,nt=X[typeof exports]&&exports&&!exports.nodeType&&exports,tt=X[typeof module]&&module&&!module.nodeType&&module,et=tt&&tt.exports===nt&&nt,rt=X[typeof global]&&global; !rt||rt.global!==rt&&rt.window!==rt||(Z=rt);var ut=g();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Z._=ut, define(function(){return ut})):nt&&tt?et?(tt.exports=ut)._=ut:nt._=ut:Z._=ut}).call(this);
sujonvidia/cdnjs
ajax/libs/lodash.js/2.4.1/lodash.compat.min.js
JavaScript
mit
31,341
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpFoundation\Tests; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Request; class RequestTest extends \PHPUnit_Framework_TestCase { /** * @covers Symfony\Component\HttpFoundation\Request::__construct */ public function testConstructor() { $this->testInitialize(); } /** * @covers Symfony\Component\HttpFoundation\Request::initialize */ public function testInitialize() { $request = new Request(); $request->initialize(array('foo' => 'bar')); $this->assertEquals('bar', $request->query->get('foo'), '->initialize() takes an array of query parameters as its first argument'); $request->initialize(array(), array('foo' => 'bar')); $this->assertEquals('bar', $request->request->get('foo'), '->initialize() takes an array of request parameters as its second argument'); $request->initialize(array(), array(), array('foo' => 'bar')); $this->assertEquals('bar', $request->attributes->get('foo'), '->initialize() takes an array of attributes as its third argument'); $request->initialize(array(), array(), array(), array(), array(), array('HTTP_FOO' => 'bar')); $this->assertEquals('bar', $request->headers->get('FOO'), '->initialize() takes an array of HTTP headers as its sixth argument'); } public function testGetLocale() { $request = new Request(); $request->setLocale('pl'); $locale = $request->getLocale(); $this->assertEquals('pl', $locale); } public function testGetUser() { $request = Request::create('http://user_test:password_test@test.com/'); $user = $request->getUser(); $this->assertEquals('user_test', $user); } public function testGetPassword() { $request = Request::create('http://user_test:password_test@test.com/'); $password = $request->getPassword(); $this->assertEquals('password_test', $password); } public function testIsNoCache() { $request = new Request(); $isNoCache = $request->isNoCache(); $this->assertFalse($isNoCache); } public function testGetContentType() { $request = new Request(); $contentType = $request->getContentType(); $this->assertNull($contentType); } public function testSetDefaultLocale() { $request = new Request(); $request->setDefaultLocale('pl'); $locale = $request->getLocale(); $this->assertEquals('pl', $locale); } /** * @covers Symfony\Component\HttpFoundation\Request::create */ public function testCreate() { $request = Request::create('http://test.com/foo?bar=baz'); $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri()); $this->assertEquals('/foo', $request->getPathInfo()); $this->assertEquals('bar=baz', $request->getQueryString()); $this->assertEquals(80, $request->getPort()); $this->assertEquals('test.com', $request->getHttpHost()); $this->assertFalse($request->isSecure()); $request = Request::create('http://test.com/foo', 'GET', array('bar' => 'baz')); $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri()); $this->assertEquals('/foo', $request->getPathInfo()); $this->assertEquals('bar=baz', $request->getQueryString()); $this->assertEquals(80, $request->getPort()); $this->assertEquals('test.com', $request->getHttpHost()); $this->assertFalse($request->isSecure()); $request = Request::create('http://test.com/foo?bar=foo', 'GET', array('bar' => 'baz')); $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri()); $this->assertEquals('/foo', $request->getPathInfo()); $this->assertEquals('bar=baz', $request->getQueryString()); $this->assertEquals(80, $request->getPort()); $this->assertEquals('test.com', $request->getHttpHost()); $this->assertFalse($request->isSecure()); $request = Request::create('https://test.com/foo?bar=baz'); $this->assertEquals('https://test.com/foo?bar=baz', $request->getUri()); $this->assertEquals('/foo', $request->getPathInfo()); $this->assertEquals('bar=baz', $request->getQueryString()); $this->assertEquals(443, $request->getPort()); $this->assertEquals('test.com', $request->getHttpHost()); $this->assertTrue($request->isSecure()); $request = Request::create('test.com:90/foo'); $this->assertEquals('http://test.com:90/foo', $request->getUri()); $this->assertEquals('/foo', $request->getPathInfo()); $this->assertEquals('test.com', $request->getHost()); $this->assertEquals('test.com:90', $request->getHttpHost()); $this->assertEquals(90, $request->getPort()); $this->assertFalse($request->isSecure()); $request = Request::create('https://test.com:90/foo'); $this->assertEquals('https://test.com:90/foo', $request->getUri()); $this->assertEquals('/foo', $request->getPathInfo()); $this->assertEquals('test.com', $request->getHost()); $this->assertEquals('test.com:90', $request->getHttpHost()); $this->assertEquals(90, $request->getPort()); $this->assertTrue($request->isSecure()); $request = Request::create('https://127.0.0.1:90/foo'); $this->assertEquals('https://127.0.0.1:90/foo', $request->getUri()); $this->assertEquals('/foo', $request->getPathInfo()); $this->assertEquals('127.0.0.1', $request->getHost()); $this->assertEquals('127.0.0.1:90', $request->getHttpHost()); $this->assertEquals(90, $request->getPort()); $this->assertTrue($request->isSecure()); $request = Request::create('https://[::1]:90/foo'); $this->assertEquals('https://[::1]:90/foo', $request->getUri()); $this->assertEquals('/foo', $request->getPathInfo()); $this->assertEquals('[::1]', $request->getHost()); $this->assertEquals('[::1]:90', $request->getHttpHost()); $this->assertEquals(90, $request->getPort()); $this->assertTrue($request->isSecure()); $request = Request::create('https://[::1]/foo'); $this->assertEquals('https://[::1]/foo', $request->getUri()); $this->assertEquals('/foo', $request->getPathInfo()); $this->assertEquals('[::1]', $request->getHost()); $this->assertEquals('[::1]', $request->getHttpHost()); $this->assertEquals(443, $request->getPort()); $this->assertTrue($request->isSecure()); $json = '{"jsonrpc":"2.0","method":"echo","id":7,"params":["Hello World"]}'; $request = Request::create('http://example.com/jsonrpc', 'POST', array(), array(), array(), array(), $json); $this->assertEquals($json, $request->getContent()); $this->assertFalse($request->isSecure()); $request = Request::create('http://test.com'); $this->assertEquals('http://test.com/', $request->getUri()); $this->assertEquals('/', $request->getPathInfo()); $this->assertEquals('', $request->getQueryString()); $this->assertEquals(80, $request->getPort()); $this->assertEquals('test.com', $request->getHttpHost()); $this->assertFalse($request->isSecure()); $request = Request::create('http://test.com?test=1'); $this->assertEquals('http://test.com/?test=1', $request->getUri()); $this->assertEquals('/', $request->getPathInfo()); $this->assertEquals('test=1', $request->getQueryString()); $this->assertEquals(80, $request->getPort()); $this->assertEquals('test.com', $request->getHttpHost()); $this->assertFalse($request->isSecure()); $request = Request::create('http://test.com:90/?test=1'); $this->assertEquals('http://test.com:90/?test=1', $request->getUri()); $this->assertEquals('/', $request->getPathInfo()); $this->assertEquals('test=1', $request->getQueryString()); $this->assertEquals(90, $request->getPort()); $this->assertEquals('test.com:90', $request->getHttpHost()); $this->assertFalse($request->isSecure()); $request = Request::create('http://username:password@test.com'); $this->assertEquals('http://test.com/', $request->getUri()); $this->assertEquals('/', $request->getPathInfo()); $this->assertEquals('', $request->getQueryString()); $this->assertEquals(80, $request->getPort()); $this->assertEquals('test.com', $request->getHttpHost()); $this->assertEquals('username', $request->getUser()); $this->assertEquals('password', $request->getPassword()); $this->assertFalse($request->isSecure()); $request = Request::create('http://username@test.com'); $this->assertEquals('http://test.com/', $request->getUri()); $this->assertEquals('/', $request->getPathInfo()); $this->assertEquals('', $request->getQueryString()); $this->assertEquals(80, $request->getPort()); $this->assertEquals('test.com', $request->getHttpHost()); $this->assertEquals('username', $request->getUser()); $this->assertSame('', $request->getPassword()); $this->assertFalse($request->isSecure()); $request = Request::create('http://test.com/?foo'); $this->assertEquals('/?foo', $request->getRequestUri()); $this->assertEquals(array('foo' => ''), $request->query->all()); ## assume rewrite rule: (.*) --> app/app.php ; app/ is a symlink to a symfony web/ directory $request = Request::create('http://test.com/apparthotel-1234', 'GET', array(), array(), array(), array( 'DOCUMENT_ROOT' => '/var/www/www.test.com', 'SCRIPT_FILENAME' => '/var/www/www.test.com/app/app.php', 'SCRIPT_NAME' => '/app/app.php', 'PHP_SELF' => '/app/app.php/apparthotel-1234', )); $this->assertEquals('http://test.com/apparthotel-1234', $request->getUri()); $this->assertEquals('/apparthotel-1234', $request->getPathInfo()); $this->assertEquals('', $request->getQueryString()); $this->assertEquals(80, $request->getPort()); $this->assertEquals('test.com', $request->getHttpHost()); $this->assertFalse($request->isSecure()); } /** * @covers Symfony\Component\HttpFoundation\Request::create */ public function testCreateCheckPrecedence() { // server is used by default $request = Request::create('/', 'DELETE', array(), array(), array(), array( 'HTTP_HOST' => 'example.com', 'HTTPS' => 'on', 'SERVER_PORT' => 443, 'PHP_AUTH_USER' => 'fabien', 'PHP_AUTH_PW' => 'pa$$', 'QUERY_STRING' => 'foo=bar', 'CONTENT_TYPE' => 'application/json', )); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(443, $request->getPort()); $this->assertTrue($request->isSecure()); $this->assertEquals('fabien', $request->getUser()); $this->assertEquals('pa$$', $request->getPassword()); $this->assertEquals('', $request->getQueryString()); $this->assertEquals('application/json', $request->headers->get('CONTENT_TYPE')); // URI has precedence over server $request = Request::create('http://thomas:pokemon@example.net:8080/?foo=bar', 'GET', array(), array(), array(), array( 'HTTP_HOST' => 'example.com', 'HTTPS' => 'on', 'SERVER_PORT' => 443, )); $this->assertEquals('example.net', $request->getHost()); $this->assertEquals(8080, $request->getPort()); $this->assertFalse($request->isSecure()); $this->assertEquals('thomas', $request->getUser()); $this->assertEquals('pokemon', $request->getPassword()); $this->assertEquals('foo=bar', $request->getQueryString()); } public function testDuplicate() { $request = new Request(array('foo' => 'bar'), array('foo' => 'bar'), array('foo' => 'bar'), array(), array(), array('HTTP_FOO' => 'bar')); $dup = $request->duplicate(); $this->assertEquals($request->query->all(), $dup->query->all(), '->duplicate() duplicates a request an copy the current query parameters'); $this->assertEquals($request->request->all(), $dup->request->all(), '->duplicate() duplicates a request an copy the current request parameters'); $this->assertEquals($request->attributes->all(), $dup->attributes->all(), '->duplicate() duplicates a request an copy the current attributes'); $this->assertEquals($request->headers->all(), $dup->headers->all(), '->duplicate() duplicates a request an copy the current HTTP headers'); $dup = $request->duplicate(array('foo' => 'foobar'), array('foo' => 'foobar'), array('foo' => 'foobar'), array(), array(), array('HTTP_FOO' => 'foobar')); $this->assertEquals(array('foo' => 'foobar'), $dup->query->all(), '->duplicate() overrides the query parameters if provided'); $this->assertEquals(array('foo' => 'foobar'), $dup->request->all(), '->duplicate() overrides the request parameters if provided'); $this->assertEquals(array('foo' => 'foobar'), $dup->attributes->all(), '->duplicate() overrides the attributes if provided'); $this->assertEquals(array('foo' => array('foobar')), $dup->headers->all(), '->duplicate() overrides the HTTP header if provided'); } public function testDuplicateWithFormat() { $request = new Request(array(), array(), array('_format' => 'json')); $dup = $request->duplicate(); $this->assertEquals('json', $dup->getRequestFormat()); $this->assertEquals('json', $dup->attributes->get('_format')); $request = new Request(); $request->setRequestFormat('xml'); $dup = $request->duplicate(); $this->assertEquals('xml', $dup->getRequestFormat()); } /** * @covers Symfony\Component\HttpFoundation\Request::getFormat * @covers Symfony\Component\HttpFoundation\Request::setFormat * @dataProvider getFormatToMimeTypeMapProvider */ public function testGetFormatFromMimeType($format, $mimeTypes) { $request = new Request(); foreach ($mimeTypes as $mime) { $this->assertEquals($format, $request->getFormat($mime)); } $request->setFormat($format, $mimeTypes); foreach ($mimeTypes as $mime) { $this->assertEquals($format, $request->getFormat($mime)); } } /** * @covers Symfony\Component\HttpFoundation\Request::getFormat */ public function testGetFormatFromMimeTypeWithParameters() { $request = new Request(); $this->assertEquals('json', $request->getFormat('application/json; charset=utf-8')); } /** * @covers Symfony\Component\HttpFoundation\Request::getMimeType * @dataProvider getFormatToMimeTypeMapProvider */ public function testGetMimeTypeFromFormat($format, $mimeTypes) { if (null !== $format) { $request = new Request(); $this->assertEquals($mimeTypes[0], $request->getMimeType($format)); } } public function getFormatToMimeTypeMapProvider() { return array( array(null, array(null, 'unexistent-mime-type')), array('txt', array('text/plain')), array('js', array('application/javascript', 'application/x-javascript', 'text/javascript')), array('css', array('text/css')), array('json', array('application/json', 'application/x-json')), array('xml', array('text/xml', 'application/xml', 'application/x-xml')), array('rdf', array('application/rdf+xml')), array('atom',array('application/atom+xml')), ); } /** * @covers Symfony\Component\HttpFoundation\Request::getUri */ public function testGetUri() { $server = array(); // Standard Request on non default PORT // http://host:8080/index.php/path/info?query=string $server['HTTP_HOST'] = 'host:8080'; $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '8080'; $server['QUERY_STRING'] = 'query=string'; $server['REQUEST_URI'] = '/index.php/path/info?query=string'; $server['SCRIPT_NAME'] = '/index.php'; $server['PATH_INFO'] = '/path/info'; $server['PATH_TRANSLATED'] = 'redirect:/index.php/path/info'; $server['PHP_SELF'] = '/index_dev.php/path/info'; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; $request = new Request(); $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://host:8080/index.php/path/info?query=string', $request->getUri(), '->getUri() with non default port'); // Use std port number $server['HTTP_HOST'] = 'host'; $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://host/index.php/path/info?query=string', $request->getUri(), '->getUri() with default port'); // Without HOST HEADER unset($server['HTTP_HOST']); $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://servername/index.php/path/info?query=string', $request->getUri(), '->getUri() with default port without HOST_HEADER'); // Request with URL REWRITING (hide index.php) // RewriteCond %{REQUEST_FILENAME} !-f // RewriteRule ^(.*)$ index.php [QSA,L] // http://host:8080/path/info?query=string $server = array(); $server['HTTP_HOST'] = 'host:8080'; $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '8080'; $server['REDIRECT_QUERY_STRING'] = 'query=string'; $server['REDIRECT_URL'] = '/path/info'; $server['SCRIPT_NAME'] = '/index.php'; $server['QUERY_STRING'] = 'query=string'; $server['REQUEST_URI'] = '/path/info?toto=test&1=1'; $server['SCRIPT_NAME'] = '/index.php'; $server['PHP_SELF'] = '/index.php'; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://host:8080/path/info?query=string', $request->getUri(), '->getUri() with rewrite'); // Use std port number // http://host/path/info?query=string $server['HTTP_HOST'] = 'host'; $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://host/path/info?query=string', $request->getUri(), '->getUri() with rewrite and default port'); // Without HOST HEADER unset($server['HTTP_HOST']); $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://servername/path/info?query=string', $request->getUri(), '->getUri() with rewrite, default port without HOST_HEADER'); // With encoded characters $server = array( 'HTTP_HOST' => 'host:8080', 'SERVER_NAME' => 'servername', 'SERVER_PORT' => '8080', 'QUERY_STRING' => 'query=string', 'REQUEST_URI' => '/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', 'SCRIPT_NAME' => '/ba se/index_dev.php', 'PATH_TRANSLATED' => 'redirect:/index.php/foo bar/in+fo', 'PHP_SELF' => '/ba se/index_dev.php/path/info', 'SCRIPT_FILENAME' => '/some/where/ba se/index_dev.php', ); $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals( 'http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri() ); // with user info $server['PHP_AUTH_USER'] = 'fabien'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); $server['PHP_AUTH_PW'] = 'symfony'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://host:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); } /** * @covers Symfony\Component\HttpFoundation\Request::getUriForPath */ public function testGetUriForPath() { $request = Request::create('http://test.com/foo?bar=baz'); $this->assertEquals('http://test.com/some/path', $request->getUriForPath('/some/path')); $request = Request::create('http://test.com:90/foo?bar=baz'); $this->assertEquals('http://test.com:90/some/path', $request->getUriForPath('/some/path')); $request = Request::create('https://test.com/foo?bar=baz'); $this->assertEquals('https://test.com/some/path', $request->getUriForPath('/some/path')); $request = Request::create('https://test.com:90/foo?bar=baz'); $this->assertEquals('https://test.com:90/some/path', $request->getUriForPath('/some/path')); $server = array(); // Standard Request on non default PORT // http://host:8080/index.php/path/info?query=string $server['HTTP_HOST'] = 'host:8080'; $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '8080'; $server['QUERY_STRING'] = 'query=string'; $server['REQUEST_URI'] = '/index.php/path/info?query=string'; $server['SCRIPT_NAME'] = '/index.php'; $server['PATH_INFO'] = '/path/info'; $server['PATH_TRANSLATED'] = 'redirect:/index.php/path/info'; $server['PHP_SELF'] = '/index_dev.php/path/info'; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; $request = new Request(); $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://host:8080/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with non default port'); // Use std port number $server['HTTP_HOST'] = 'host'; $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://host/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with default port'); // Without HOST HEADER unset($server['HTTP_HOST']); $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://servername/index.php/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with default port without HOST_HEADER'); // Request with URL REWRITING (hide index.php) // RewriteCond %{REQUEST_FILENAME} !-f // RewriteRule ^(.*)$ index.php [QSA,L] // http://host:8080/path/info?query=string $server = array(); $server['HTTP_HOST'] = 'host:8080'; $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '8080'; $server['REDIRECT_QUERY_STRING'] = 'query=string'; $server['REDIRECT_URL'] = '/path/info'; $server['SCRIPT_NAME'] = '/index.php'; $server['QUERY_STRING'] = 'query=string'; $server['REQUEST_URI'] = '/path/info?toto=test&1=1'; $server['SCRIPT_NAME'] = '/index.php'; $server['PHP_SELF'] = '/index.php'; $server['SCRIPT_FILENAME'] = '/some/where/index.php'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://host:8080/some/path', $request->getUriForPath('/some/path'), '->getUri() with rewrite'); // Use std port number // http://host/path/info?query=string $server['HTTP_HOST'] = 'host'; $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://host/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite and default port'); // Without HOST HEADER unset($server['HTTP_HOST']); $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '80'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite, default port without HOST_HEADER'); $this->assertEquals('servername', $request->getHttpHost()); // with user info $server['PHP_AUTH_USER'] = 'fabien'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path')); $server['PHP_AUTH_PW'] = 'symfony'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path')); } /** * @covers Symfony\Component\HttpFoundation\Request::getUserInfo */ public function testGetUserInfo() { $request = new Request(); $server['PHP_AUTH_USER'] = 'fabien'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('fabien', $request->getUserInfo()); $server['PHP_AUTH_USER'] = '0'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('0', $request->getUserInfo()); $server['PHP_AUTH_PW'] = '0'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('0:0', $request->getUserInfo()); } /** * @covers Symfony\Component\HttpFoundation\Request::getSchemeAndHttpHost */ public function testGetSchemeAndHttpHost() { $request = new Request(); $server = array(); $server['SERVER_NAME'] = 'servername'; $server['SERVER_PORT'] = '90'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); $server['PHP_AUTH_USER'] = 'fabien'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); $server['PHP_AUTH_USER'] = '0'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); $server['PHP_AUTH_PW'] = '0'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); } /** * @covers Symfony\Component\HttpFoundation\Request::getQueryString * @covers Symfony\Component\HttpFoundation\Request::normalizeQueryString * @dataProvider getQueryStringNormalizationData */ public function testGetQueryString($query, $expectedQuery, $msg) { $request = new Request(); $request->server->set('QUERY_STRING', $query); $this->assertSame($expectedQuery, $request->getQueryString(), $msg); } public function getQueryStringNormalizationData() { return array( array('foo', 'foo', 'works with valueless parameters'), array('foo=', 'foo=', 'includes a dangling equal sign'), array('bar=&foo=bar', 'bar=&foo=bar', '->works with empty parameters'), array('foo=bar&bar=', 'bar=&foo=bar', 'sorts keys alphabetically'), // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded). // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. array('him=John%20Doe&her=Jane+Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes spaces in both encodings "%20" and "+"'), array('foo[]=1&foo[]=2', 'foo%5B%5D=1&foo%5B%5D=2', 'allows array notation'), array('foo=1&foo=2', 'foo=1&foo=2', 'allows repeated parameters'), array('pa%3Dram=foo%26bar%3Dbaz&test=test', 'pa%3Dram=foo%26bar%3Dbaz&test=test', 'works with encoded delimiters'), array('0', '0', 'allows "0"'), array('Jane Doe&John%20Doe', 'Jane%20Doe&John%20Doe', 'normalizes encoding in keys'), array('her=Jane Doe&him=John%20Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes encoding in values'), array('foo=bar&&&test&&', 'foo=bar&test', 'removes unneeded delimiters'), array('formula=e=m*c^2', 'formula=e%3Dm%2Ac%5E2', 'correctly treats only the first "=" as delimiter and the next as value'), // Ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway. // PHP also does not include them when building _GET. array('foo=bar&=a=b&=x=y', 'foo=bar', 'removes params with empty key'), ); } public function testGetQueryStringReturnsNull() { $request = new Request(); $this->assertNull($request->getQueryString(), '->getQueryString() returns null for non-existent query string'); $request->server->set('QUERY_STRING', ''); $this->assertNull($request->getQueryString(), '->getQueryString() returns null for empty query string'); } public function testGetHost() { $request = new Request(); $request->initialize(array('foo' => 'bar')); $this->assertEquals('', $request->getHost(), '->getHost() return empty string if not initialized'); $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.example.com')); $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from Host Header'); // Host header with port number $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.example.com:8080')); $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from Host Header with port number'); // Server values $request->initialize(array(), array(), array(), array(), array(), array('SERVER_NAME' => 'www.example.com')); $this->assertEquals('www.example.com', $request->getHost(), '->getHost() from server name'); $request->initialize(array(), array(), array(), array(), array(), array('SERVER_NAME' => 'www.example.com', 'HTTP_HOST' => 'www.host.com')); $this->assertEquals('www.host.com', $request->getHost(), '->getHost() value from Host header has priority over SERVER_NAME '); } public function testGetPort() { $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( 'HTTP_X_FORWARDED_PROTO' => 'https', 'HTTP_X_FORWARDED_PORT' => '443', )); $port = $request->getPort(); $this->assertEquals(80, $port, 'Without trusted proxies FORWARDED_PROTO and FORWARDED_PORT are ignored.'); Request::setTrustedProxies(array('1.1.1.1')); $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( 'HTTP_X_FORWARDED_PROTO' => 'https', 'HTTP_X_FORWARDED_PORT' => '8443', )); $this->assertEquals(80, $request->getPort(), 'With PROTO and PORT on untrusted connection server value takes precedence.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(8443, $request->getPort(), 'With PROTO and PORT set PORT takes precedence.'); $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( 'HTTP_X_FORWARDED_PROTO' => 'https', )); $this->assertEquals(80, $request->getPort(), 'With only PROTO set getPort() ignores trusted headers on untrusted connection.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(443, $request->getPort(), 'With only PROTO set getPort() defaults to 443.'); $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( 'HTTP_X_FORWARDED_PROTO' => 'http', )); $this->assertEquals(80, $request->getPort(), 'If X_FORWARDED_PROTO is set to HTTP getPort() ignores trusted headers on untrusted connection.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(80, $request->getPort(), 'If X_FORWARDED_PROTO is set to HTTP getPort() returns port of the original request.'); $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( 'HTTP_X_FORWARDED_PROTO' => 'On', )); $this->assertEquals(80, $request->getPort(), 'With only PROTO set and value is On, getPort() ignores trusted headers on untrusted connection.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(443, $request->getPort(), 'With only PROTO set and value is On, getPort() defaults to 443.'); $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( 'HTTP_X_FORWARDED_PROTO' => '1', )); $this->assertEquals(80, $request->getPort(), 'With only PROTO set and value is 1, getPort() ignores trusted headers on untrusted connection.'); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertEquals(443, $request->getPort(), 'With only PROTO set and value is 1, getPort() defaults to 443.'); $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( 'HTTP_X_FORWARDED_PROTO' => 'something-else', )); $port = $request->getPort(); $this->assertEquals(80, $port, 'With only PROTO set and value is not recognized, getPort() defaults to 80.'); Request::setTrustedProxies(array()); } /** * @expectedException \RuntimeException */ public function testGetHostWithFakeHttpHostValue() { $request = new Request(); $request->initialize(array(), array(), array(), array(), array(), array('HTTP_HOST' => 'www.host.com?query=string')); $request->getHost(); } /** * @covers Symfony\Component\HttpFoundation\Request::setMethod * @covers Symfony\Component\HttpFoundation\Request::getMethod */ public function testGetSetMethod() { $request = new Request(); $this->assertEquals('GET', $request->getMethod(), '->getMethod() returns GET if no method is defined'); $request->setMethod('get'); $this->assertEquals('GET', $request->getMethod(), '->getMethod() returns an uppercased string'); $request->setMethod('PURGE'); $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method even if it is not a standard one'); $request->setMethod('POST'); $this->assertEquals('POST', $request->getMethod(), '->getMethod() returns the method POST if no _method is defined'); $request->setMethod('POST'); $request->request->set('_method', 'purge'); $this->assertEquals('POST', $request->getMethod(), '->getMethod() does not return the method from _method if defined and POST but support not enabled'); $request = new Request(); $request->setMethod('POST'); $request->request->set('_method', 'purge'); $this->assertFalse(Request::getHttpMethodParameterOverride(), 'httpMethodParameterOverride should be disabled by default'); Request::enableHttpMethodParameterOverride(); $this->assertTrue(Request::getHttpMethodParameterOverride(), 'httpMethodParameterOverride should be enabled now but it is not'); $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method from _method if defined and POST'); $this->disableHttpMethodParameterOverride(); $request = new Request(); $request->setMethod('POST'); $request->query->set('_method', 'purge'); $this->assertEquals('POST', $request->getMethod(), '->getMethod() does not return the method from _method if defined and POST but support not enabled'); $request = new Request(); $request->setMethod('POST'); $request->query->set('_method', 'purge'); Request::enableHttpMethodParameterOverride(); $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method from _method if defined and POST'); $this->disableHttpMethodParameterOverride(); $request = new Request(); $request->setMethod('POST'); $request->headers->set('X-HTTP-METHOD-OVERRIDE', 'delete'); $this->assertEquals('DELETE', $request->getMethod(), '->getMethod() returns the method from X-HTTP-Method-Override even though _method is set if defined and POST'); $request = new Request(); $request->setMethod('POST'); $request->headers->set('X-HTTP-METHOD-OVERRIDE', 'delete'); $this->assertEquals('DELETE', $request->getMethod(), '->getMethod() returns the method from X-HTTP-Method-Override if defined and POST'); } /** * @dataProvider testGetClientIpsProvider */ public function testGetClientIp($expected, $remoteAddr, $httpForwardedFor, $trustedProxies) { $request = $this->getRequestInstanceForClientIpTests($remoteAddr, $httpForwardedFor, $trustedProxies); $this->assertEquals($expected[0], $request->getClientIp()); Request::setTrustedProxies(array()); } /** * @dataProvider testGetClientIpsProvider */ public function testGetClientIps($expected, $remoteAddr, $httpForwardedFor, $trustedProxies) { $request = $this->getRequestInstanceForClientIpTests($remoteAddr, $httpForwardedFor, $trustedProxies); $this->assertEquals($expected, $request->getClientIps()); Request::setTrustedProxies(array()); } public function testGetClientIpsProvider() { // $expected $remoteAddr $httpForwardedFor $trustedProxies return array( // simple IPv4 array(array('88.88.88.88'), '88.88.88.88', null, null), // trust the IPv4 remote addr array(array('88.88.88.88'), '88.88.88.88', null, array('88.88.88.88')), // simple IPv6 array(array('::1'), '::1', null, null), // trust the IPv6 remote addr array(array('::1'), '::1', null, array('::1')), // forwarded for with remote IPv4 addr not trusted array(array('127.0.0.1'), '127.0.0.1', '88.88.88.88', null), // forwarded for with remote IPv4 addr trusted array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88', array('127.0.0.1')), // forwarded for with remote IPv4 and all FF addrs trusted array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88', array('127.0.0.1', '88.88.88.88')), // forwarded for with remote IPv4 range trusted array(array('88.88.88.88'), '123.45.67.89', '88.88.88.88', array('123.45.67.0/24')), // forwarded for with remote IPv6 addr not trusted array(array('1620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', null), // forwarded for with remote IPv6 addr trusted array(array('2620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3')), // forwarded for with remote IPv6 range trusted array(array('88.88.88.88'), '2a01:198:603:0:396e:4789:8e99:890f', '88.88.88.88', array('2a01:198:603:0::/65')), // multiple forwarded for with remote IPv4 addr trusted array(array('88.88.88.88', '87.65.43.21', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89')), // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted array(array('87.65.43.21', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '88.88.88.88')), // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted but in the middle array(array('88.88.88.88', '127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '87.65.43.21')), // multiple forwarded for with remote IPv4 addr and all reverse proxies trusted array(array('127.0.0.1'), '123.45.67.89', '127.0.0.1, 87.65.43.21, 88.88.88.88', array('123.45.67.89', '87.65.43.21', '88.88.88.88', '127.0.0.1')), // multiple forwarded for with remote IPv6 addr trusted array(array('2620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3')), // multiple forwarded for with remote IPv6 addr and some reverse proxies trusted array(array('3620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3', '2620:0:1cfe:face:b00c::3')), // multiple forwarded for with remote IPv4 addr and some reverse proxies trusted but in the middle array(array('2620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3'), '1620:0:1cfe:face:b00c::3', '4620:0:1cfe:face:b00c::3,3620:0:1cfe:face:b00c::3,2620:0:1cfe:face:b00c::3', array('1620:0:1cfe:face:b00c::3', '3620:0:1cfe:face:b00c::3')), // client IP with port array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88:12345, 127.0.0.1', array('127.0.0.1')), ); } public function testGetContentWorksTwiceInDefaultMode() { $req = new Request(); $this->assertEquals('', $req->getContent()); $this->assertEquals('', $req->getContent()); } public function testGetContentReturnsResource() { $req = new Request(); $retval = $req->getContent(true); $this->assertInternalType('resource', $retval); $this->assertEquals('', fread($retval, 1)); $this->assertTrue(feof($retval)); } /** * @expectedException \LogicException * @dataProvider getContentCantBeCalledTwiceWithResourcesProvider */ public function testGetContentCantBeCalledTwiceWithResources($first, $second) { $req = new Request(); $req->getContent($first); $req->getContent($second); } public function getContentCantBeCalledTwiceWithResourcesProvider() { return array( 'Resource then fetch' => array(true, false), 'Resource then resource' => array(true, true), 'Fetch then resource' => array(false, true), ); } public function provideOverloadedMethods() { return array( array('PUT'), array('DELETE'), array('PATCH'), array('put'), array('delete'), array('patch'), ); } /** * @dataProvider provideOverloadedMethods */ public function testCreateFromGlobals($method) { $normalizedMethod = strtoupper($method); $_GET['foo1'] = 'bar1'; $_POST['foo2'] = 'bar2'; $_COOKIE['foo3'] = 'bar3'; $_FILES['foo4'] = array('bar4'); $_SERVER['foo5'] = 'bar5'; $request = Request::createFromGlobals(); $this->assertEquals('bar1', $request->query->get('foo1'), '::fromGlobals() uses values from $_GET'); $this->assertEquals('bar2', $request->request->get('foo2'), '::fromGlobals() uses values from $_POST'); $this->assertEquals('bar3', $request->cookies->get('foo3'), '::fromGlobals() uses values from $_COOKIE'); $this->assertEquals(array('bar4'), $request->files->get('foo4'), '::fromGlobals() uses values from $_FILES'); $this->assertEquals('bar5', $request->server->get('foo5'), '::fromGlobals() uses values from $_SERVER'); unset($_GET['foo1'], $_POST['foo2'], $_COOKIE['foo3'], $_FILES['foo4'], $_SERVER['foo5']); $_SERVER['REQUEST_METHOD'] = $method; $_SERVER['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'; $request = RequestContentProxy::createFromGlobals(); $this->assertEquals($normalizedMethod, $request->getMethod()); $this->assertEquals('mycontent', $request->request->get('content')); unset($_SERVER['REQUEST_METHOD'], $_SERVER['CONTENT_TYPE']); Request::createFromGlobals(); Request::enableHttpMethodParameterOverride(); $_POST['_method'] = $method; $_POST['foo6'] = 'bar6'; $_SERVER['REQUEST_METHOD'] = 'PoSt'; $request = Request::createFromGlobals(); $this->assertEquals($normalizedMethod, $request->getMethod()); $this->assertEquals('POST', $request->getRealMethod()); $this->assertEquals('bar6', $request->request->get('foo6')); unset($_POST['_method'], $_POST['foo6'], $_SERVER['REQUEST_METHOD']); $this->disableHttpMethodParameterOverride(); } public function testOverrideGlobals() { $request = new Request(); $request->initialize(array('foo' => 'bar')); // as the Request::overrideGlobals really work, it erase $_SERVER, so we must backup it $server = $_SERVER; $request->overrideGlobals(); $this->assertEquals(array('foo' => 'bar'), $_GET); $request->initialize(array(), array('foo' => 'bar')); $request->overrideGlobals(); $this->assertEquals(array('foo' => 'bar'), $_POST); $this->assertArrayNotHasKey('HTTP_X_FORWARDED_PROTO', $_SERVER); $request->headers->set('X_FORWARDED_PROTO', 'https'); Request::setTrustedProxies(array('1.1.1.1')); $this->assertFalse($request->isSecure()); $request->server->set('REMOTE_ADDR', '1.1.1.1'); $this->assertTrue($request->isSecure()); Request::setTrustedProxies(array()); $request->overrideGlobals(); $this->assertArrayHasKey('HTTP_X_FORWARDED_PROTO', $_SERVER); $request->headers->set('CONTENT_TYPE', 'multipart/form-data'); $request->headers->set('CONTENT_LENGTH', 12345); $request->overrideGlobals(); $this->assertArrayHasKey('CONTENT_TYPE', $_SERVER); $this->assertArrayHasKey('CONTENT_LENGTH', $_SERVER); $request->initialize(array('foo' => 'bar', 'baz' => 'foo')); $request->query->remove('baz'); $request->overrideGlobals(); $this->assertEquals(array('foo' => 'bar'), $_GET); $this->assertEquals('foo=bar', $_SERVER['QUERY_STRING']); $this->assertEquals('foo=bar', $request->server->get('QUERY_STRING')); // restore initial $_SERVER array $_SERVER = $server; } public function testGetScriptName() { $request = new Request(); $this->assertEquals('', $request->getScriptName()); $server = array(); $server['SCRIPT_NAME'] = '/index.php'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('/index.php', $request->getScriptName()); $server = array(); $server['ORIG_SCRIPT_NAME'] = '/frontend.php'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('/frontend.php', $request->getScriptName()); $server = array(); $server['SCRIPT_NAME'] = '/index.php'; $server['ORIG_SCRIPT_NAME'] = '/frontend.php'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('/index.php', $request->getScriptName()); } public function testGetBasePath() { $request = new Request(); $this->assertEquals('', $request->getBasePath()); $server = array(); $server['SCRIPT_FILENAME'] = '/some/where/index.php'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('', $request->getBasePath()); $server = array(); $server['SCRIPT_FILENAME'] = '/some/where/index.php'; $server['SCRIPT_NAME'] = '/index.php'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('', $request->getBasePath()); $server = array(); $server['SCRIPT_FILENAME'] = '/some/where/index.php'; $server['PHP_SELF'] = '/index.php'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('', $request->getBasePath()); $server = array(); $server['SCRIPT_FILENAME'] = '/some/where/index.php'; $server['ORIG_SCRIPT_NAME'] = '/index.php'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('', $request->getBasePath()); } public function testGetPathInfo() { $request = new Request(); $this->assertEquals('/', $request->getPathInfo()); $server = array(); $server['REQUEST_URI'] = '/path/info'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('/path/info', $request->getPathInfo()); $server = array(); $server['REQUEST_URI'] = '/path%20test/info'; $request->initialize(array(), array(), array(), array(), array(), $server); $this->assertEquals('/path%20test/info', $request->getPathInfo()); } public function testGetPreferredLanguage() { $request = new Request(); $this->assertNull($request->getPreferredLanguage()); $this->assertNull($request->getPreferredLanguage(array())); $this->assertEquals('fr', $request->getPreferredLanguage(array('fr'))); $this->assertEquals('fr', $request->getPreferredLanguage(array('fr', 'en'))); $this->assertEquals('en', $request->getPreferredLanguage(array('en', 'fr'))); $this->assertEquals('fr-ch', $request->getPreferredLanguage(array('fr-ch', 'fr-fr'))); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); $this->assertEquals('en', $request->getPreferredLanguage(array('en', 'en-us'))); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en'))); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8'); $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en'))); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, fr-fr; q=0.6, fr; q=0.5'); $this->assertEquals('en', $request->getPreferredLanguage(array('fr', 'en'))); } public function testIsXmlHttpRequest() { $request = new Request(); $this->assertFalse($request->isXmlHttpRequest()); $request->headers->set('X-Requested-With', 'XMLHttpRequest'); $this->assertTrue($request->isXmlHttpRequest()); $request->headers->remove('X-Requested-With'); $this->assertFalse($request->isXmlHttpRequest()); } public function testIntlLocale() { if (!extension_loaded('intl')) { $this->markTestSkipped('The intl extension is needed to run this test.'); } $request = new Request(); $request->setDefaultLocale('fr'); $this->assertEquals('fr', $request->getLocale()); $this->assertEquals('fr', \Locale::getDefault()); $request->setLocale('en'); $this->assertEquals('en', $request->getLocale()); $this->assertEquals('en', \Locale::getDefault()); $request->setDefaultLocale('de'); $this->assertEquals('en', $request->getLocale()); $this->assertEquals('en', \Locale::getDefault()); } public function testGetCharsets() { $request = new Request(); $this->assertEquals(array(), $request->getCharsets()); $request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6'); $this->assertEquals(array(), $request->getCharsets()); // testing caching $request = new Request(); $request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6'); $this->assertEquals(array('ISO-8859-1', 'US-ASCII', 'UTF-8', 'ISO-10646-UCS-2'), $request->getCharsets()); $request = new Request(); $request->headers->set('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'); $this->assertEquals(array('ISO-8859-1', 'utf-8', '*'), $request->getCharsets()); } public function testGetEncodings() { $request = new Request(); $this->assertEquals(array(), $request->getEncodings()); $request->headers->set('Accept-Encoding', 'gzip,deflate,sdch'); $this->assertEquals(array(), $request->getEncodings()); // testing caching $request = new Request(); $request->headers->set('Accept-Encoding', 'gzip,deflate,sdch'); $this->assertEquals(array('gzip', 'deflate', 'sdch'), $request->getEncodings()); $request = new Request(); $request->headers->set('Accept-Encoding', 'gzip;q=0.4,deflate;q=0.9,compress;q=0.7'); $this->assertEquals(array('deflate', 'compress', 'gzip'), $request->getEncodings()); } public function testGetAcceptableContentTypes() { $request = new Request(); $this->assertEquals(array(), $request->getAcceptableContentTypes()); $request->headers->set('Accept', 'application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*'); $this->assertEquals(array(), $request->getAcceptableContentTypes()); // testing caching $request = new Request(); $request->headers->set('Accept', 'application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*'); $this->assertEquals(array('application/vnd.wap.wmlscriptc', 'text/vnd.wap.wml', 'application/vnd.wap.xhtml+xml', 'application/xhtml+xml', 'text/html', 'multipart/mixed', '*/*'), $request->getAcceptableContentTypes()); } public function testGetLanguages() { $request = new Request(); $this->assertEquals(array(), $request->getLanguages()); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); $this->assertEquals(array('zh', 'en_US', 'en'), $request->getLanguages()); $this->assertEquals(array('zh', 'en_US', 'en'), $request->getLanguages()); $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.6, en; q=0.8'); $this->assertEquals(array('zh', 'en', 'en_US'), $request->getLanguages()); // Test out of order qvalues $request = new Request(); $request->headers->set('Accept-language', 'zh, en, en-us'); $this->assertEquals(array('zh', 'en', 'en_US'), $request->getLanguages()); // Test equal weighting without qvalues $request = new Request(); $request->headers->set('Accept-language', 'zh; q=0.6, en, en-us; q=0.6'); $this->assertEquals(array('en', 'zh', 'en_US'), $request->getLanguages()); // Test equal weighting with qvalues $request = new Request(); $request->headers->set('Accept-language', 'zh, i-cherokee; q=0.6'); $this->assertEquals(array('zh', 'cherokee'), $request->getLanguages()); } public function testGetRequestFormat() { $request = new Request(); $this->assertEquals('html', $request->getRequestFormat()); $request = new Request(); $this->assertNull($request->getRequestFormat(null)); $request = new Request(); $this->assertNull($request->setRequestFormat('foo')); $this->assertEquals('foo', $request->getRequestFormat(null)); } public function testHasSession() { $request = new Request(); $this->assertFalse($request->hasSession()); $request->setSession(new Session(new MockArraySessionStorage())); $this->assertTrue($request->hasSession()); } public function testGetSession() { $request = new Request(); $request->setSession(new Session(new MockArraySessionStorage())); $this->assertTrue($request->hasSession()); $session = $request->getSession(); $this->assertObjectHasAttribute('storage', $session); $this->assertObjectHasAttribute('flashName', $session); $this->assertObjectHasAttribute('attributeName', $session); } public function testHasPreviousSession() { $request = new Request(); $this->assertFalse($request->hasPreviousSession()); $request->cookies->set('MOCKSESSID', 'foo'); $this->assertFalse($request->hasPreviousSession()); $request->setSession(new Session(new MockArraySessionStorage())); $this->assertTrue($request->hasPreviousSession()); } public function testToString() { $request = new Request(); $request->headers->set('Accept-language', 'zh, en-us; q=0.8, en; q=0.6'); $this->assertContains('Accept-Language: zh, en-us; q=0.8, en; q=0.6', $request->__toString()); } public function testIsMethod() { $request = new Request(); $request->setMethod('POST'); $this->assertTrue($request->isMethod('POST')); $this->assertTrue($request->isMethod('post')); $this->assertFalse($request->isMethod('GET')); $this->assertFalse($request->isMethod('get')); $request->setMethod('GET'); $this->assertTrue($request->isMethod('GET')); $this->assertTrue($request->isMethod('get')); $this->assertFalse($request->isMethod('POST')); $this->assertFalse($request->isMethod('post')); } /** * @dataProvider getBaseUrlData */ public function testGetBaseUrl($uri, $server, $expectedBaseUrl, $expectedPathInfo) { $request = Request::create($uri, 'GET', array(), array(), array(), $server); $this->assertSame($expectedBaseUrl, $request->getBaseUrl(), 'baseUrl'); $this->assertSame($expectedPathInfo, $request->getPathInfo(), 'pathInfo'); } public function getBaseUrlData() { return array( array( '/foo%20bar/', array( 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', 'SCRIPT_NAME' => '/foo bar/app.php', 'PHP_SELF' => '/foo bar/app.php', ), '/foo%20bar', '/', ), array( '/foo%20bar/home', array( 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', 'SCRIPT_NAME' => '/foo bar/app.php', 'PHP_SELF' => '/foo bar/app.php', ), '/foo%20bar', '/home', ), array( '/foo%20bar/app.php/home', array( 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', 'SCRIPT_NAME' => '/foo bar/app.php', 'PHP_SELF' => '/foo bar/app.php', ), '/foo%20bar/app.php', '/home', ), array( '/foo%20bar/app.php/home%3Dbaz', array( 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo bar/app.php', 'SCRIPT_NAME' => '/foo bar/app.php', 'PHP_SELF' => '/foo bar/app.php', ), '/foo%20bar/app.php', '/home%3Dbaz', ), array( '/foo/bar+baz', array( 'SCRIPT_FILENAME' => '/home/John Doe/public_html/foo/app.php', 'SCRIPT_NAME' => '/foo/app.php', 'PHP_SELF' => '/foo/app.php', ), '/foo', '/bar+baz', ), ); } /** * @dataProvider urlencodedStringPrefixData */ public function testUrlencodedStringPrefix($string, $prefix, $expect) { $request = new Request(); $me = new \ReflectionMethod($request, 'getUrlencodedPrefix'); $me->setAccessible(true); $this->assertSame($expect, $me->invoke($request, $string, $prefix)); } public function urlencodedStringPrefixData() { return array( array('foo', 'foo', 'foo'), array('fo%6f', 'foo', 'fo%6f'), array('foo/bar', 'foo', 'foo'), array('fo%6f/bar', 'foo', 'fo%6f'), array('f%6f%6f/bar', 'foo', 'f%6f%6f'), array('%66%6F%6F/bar', 'foo', '%66%6F%6F'), array('fo+o/bar', 'fo+o', 'fo+o'), array('fo%2Bo/bar', 'fo+o', 'fo%2Bo'), ); } private function disableHttpMethodParameterOverride() { $class = new \ReflectionClass('Symfony\\Component\\HttpFoundation\\Request'); $property = $class->getProperty('httpMethodParameterOverride'); $property->setAccessible(true); $property->setValue(false); } private function getRequestInstanceForClientIpTests($remoteAddr, $httpForwardedFor, $trustedProxies) { $request = new Request(); $server = array('REMOTE_ADDR' => $remoteAddr); if (null !== $httpForwardedFor) { $server['HTTP_X_FORWARDED_FOR'] = $httpForwardedFor; } if ($trustedProxies) { Request::setTrustedProxies($trustedProxies); } $request->initialize(array(), array(), array(), array(), array(), $server); return $request; } public function testTrustedProxies() { $request = Request::create('http://example.com/'); $request->server->set('REMOTE_ADDR', '3.3.3.3'); $request->headers->set('X_FORWARDED_FOR', '1.1.1.1, 2.2.2.2'); $request->headers->set('X_FORWARDED_HOST', 'foo.example.com, real.example.com:8080'); $request->headers->set('X_FORWARDED_PROTO', 'https'); $request->headers->set('X_FORWARDED_PORT', 443); $request->headers->set('X_MY_FOR', '3.3.3.3, 4.4.4.4'); $request->headers->set('X_MY_HOST', 'my.example.com'); $request->headers->set('X_MY_PROTO', 'http'); $request->headers->set('X_MY_PORT', 81); // no trusted proxies $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // disabling proxy trusting Request::setTrustedProxies(array()); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // trusted proxy via setTrustedProxies() Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2')); $this->assertEquals('1.1.1.1', $request->getClientIp()); $this->assertEquals('real.example.com', $request->getHost()); $this->assertEquals(443, $request->getPort()); $this->assertTrue($request->isSecure()); // trusted proxy via setTrustedProxies() Request::setTrustedProxies(array('3.3.3.4', '2.2.2.2')); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // check various X_FORWARDED_PROTO header values Request::setTrustedProxies(array('3.3.3.3', '2.2.2.2')); $request->headers->set('X_FORWARDED_PROTO', 'ssl'); $this->assertTrue($request->isSecure()); $request->headers->set('X_FORWARDED_PROTO', 'https, http'); $this->assertTrue($request->isSecure()); // custom header names Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, 'X_MY_FOR'); Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, 'X_MY_HOST'); Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, 'X_MY_PORT'); Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, 'X_MY_PROTO'); $this->assertEquals('4.4.4.4', $request->getClientIp()); $this->assertEquals('my.example.com', $request->getHost()); $this->assertEquals(81, $request->getPort()); $this->assertFalse($request->isSecure()); // disabling via empty header names Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, null); Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, null); Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, null); Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, null); $this->assertEquals('3.3.3.3', $request->getClientIp()); $this->assertEquals('example.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $this->assertFalse($request->isSecure()); // reset Request::setTrustedProxies(array()); Request::setTrustedHeaderName(Request::HEADER_CLIENT_IP, 'X_FORWARDED_FOR'); Request::setTrustedHeaderName(Request::HEADER_CLIENT_HOST, 'X_FORWARDED_HOST'); Request::setTrustedHeaderName(Request::HEADER_CLIENT_PORT, 'X_FORWARDED_PORT'); Request::setTrustedHeaderName(Request::HEADER_CLIENT_PROTO, 'X_FORWARDED_PROTO'); } /** * @expectedException \InvalidArgumentException */ public function testSetTrustedProxiesInvalidHeaderName() { Request::create('http://example.com/'); Request::setTrustedHeaderName('bogus name', 'X_MY_FOR'); } /** * @expectedException \InvalidArgumentException */ public function testGetTrustedProxiesInvalidHeaderName() { Request::create('http://example.com/'); Request::getTrustedHeaderName('bogus name'); } /** * @dataProvider iisRequestUriProvider */ public function testIISRequestUri($headers, $server, $expectedRequestUri) { $request = new Request(); $request->headers->replace($headers); $request->server->replace($server); $this->assertEquals($expectedRequestUri, $request->getRequestUri(), '->getRequestUri() is correct'); $subRequestUri = '/bar/foo'; $subRequest = Request::create($subRequestUri, 'get', array(), array(), array(), $request->server->all()); $this->assertEquals($subRequestUri, $subRequest->getRequestUri(), '->getRequestUri() is correct in sub request'); } public function iisRequestUriProvider() { return array( array( array( 'X_ORIGINAL_URL' => '/foo/bar', ), array(), '/foo/bar', ), array( array( 'X_REWRITE_URL' => '/foo/bar', ), array(), '/foo/bar', ), array( array(), array( 'IIS_WasUrlRewritten' => '1', 'UNENCODED_URL' => '/foo/bar', ), '/foo/bar', ), array( array( 'X_ORIGINAL_URL' => '/foo/bar', ), array( 'HTTP_X_ORIGINAL_URL' => '/foo/bar', ), '/foo/bar', ), array( array( 'X_ORIGINAL_URL' => '/foo/bar', ), array( 'IIS_WasUrlRewritten' => '1', 'UNENCODED_URL' => '/foo/bar', ), '/foo/bar', ), array( array( 'X_ORIGINAL_URL' => '/foo/bar', ), array( 'HTTP_X_ORIGINAL_URL' => '/foo/bar', 'IIS_WasUrlRewritten' => '1', 'UNENCODED_URL' => '/foo/bar', ), '/foo/bar', ), array( array(), array( 'ORIG_PATH_INFO' => '/foo/bar', ), '/foo/bar', ), array( array(), array( 'ORIG_PATH_INFO' => '/foo/bar', 'QUERY_STRING' => 'foo=bar', ), '/foo/bar?foo=bar', ), ); } public function testTrustedHosts() { // create a request $request = Request::create('/'); // no trusted host set -> no host check $request->headers->set('host', 'evil.com'); $this->assertEquals('evil.com', $request->getHost()); // add a trusted domain and all its subdomains Request::setTrustedHosts(array('.*\.?trusted.com$')); // untrusted host $request->headers->set('host', 'evil.com'); try { $request->getHost(); $this->fail('Request::getHost() should throw an exception when host is not trusted.'); } catch (\UnexpectedValueException $e) { $this->assertEquals('Untrusted Host "evil.com"', $e->getMessage()); } // trusted hosts $request->headers->set('host', 'trusted.com'); $this->assertEquals('trusted.com', $request->getHost()); $this->assertEquals(80, $request->getPort()); $request->server->set('HTTPS', true); $request->headers->set('host', 'trusted.com'); $this->assertEquals('trusted.com', $request->getHost()); $this->assertEquals(443, $request->getPort()); $request->server->set('HTTPS', false); $request->headers->set('host', 'trusted.com:8000'); $this->assertEquals('trusted.com', $request->getHost()); $this->assertEquals(8000, $request->getPort()); $request->headers->set('host', 'subdomain.trusted.com'); $this->assertEquals('subdomain.trusted.com', $request->getHost()); // reset request for following tests Request::setTrustedHosts(array()); } public function testFactory() { Request::setFactory(function (array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) { return new NewRequest(); }); $this->assertEquals('foo', Request::create('/')->getFoo()); Request::setFactory(null); } /** * @dataProvider getLongHostNames */ public function testVeryLongHosts($host) { $start = microtime(true); $request = Request::create('/'); $request->headers->set('host', $host); $this->assertEquals($host, $request->getHost()); $this->assertLessThan(1, microtime(true) - $start); } /** * @dataProvider getHostValidities */ public function testHostValidity($host, $isValid, $expectedHost = null, $expectedPort = null) { $request = Request::create('/'); $request->headers->set('host', $host); if ($isValid) { $this->assertSame($expectedHost ?: $host, $request->getHost()); if ($expectedPort) { $this->assertSame($expectedPort, $request->getPort()); } } else { $this->setExpectedException('UnexpectedValueException', 'Invalid Host'); $request->getHost(); } } public function getHostValidities() { return array( array('.a', false), array('a..', false), array('a.', true), array("\xE9", false), array('[::1]', true), array('[::1]:80', true, '[::1]', 80), array(str_repeat('.', 101), false), ); } public function getLongHostNames() { return array( array('a'.str_repeat('.a', 40000)), array(str_repeat(':', 101)), ); } } class RequestContentProxy extends Request { public function getContent($asResource = false) { return http_build_query(array('_method' => 'PUT', 'content' => 'mycontent')); } } class NewRequest extends Request { public function getFoo() { return 'foo'; } }
SolidNoob/holdit
vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
PHP
mit
75,235
<?php /* * This file is part of the Assetic package, an OpenSky project. * * (c) 2010-2012 OpenSky Project Inc * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Assetic\Asset; use Assetic\Util\PathUtils; use Assetic\Filter\FilterInterface; /** * Represents an asset loaded from a file. * * @author Kris Wallsmith <kris.wallsmith@gmail.com> */ class FileAsset extends BaseAsset { private $source; /** * Constructor. * * @param string $source An absolute path * @param array $filters An array of filters * @param string $sourceRoot The source asset root directory * @param string $sourcePath The source asset path * @param array $vars * * @throws \InvalidArgumentException If the supplied root doesn't match the source when guessing the path */ public function __construct($source, $filters = array(), $sourceRoot = null, $sourcePath = null, array $vars = array()) { if (null === $sourceRoot) { $sourceRoot = dirname($source); if (null === $sourcePath) { $sourcePath = basename($source); } } elseif (null === $sourcePath) { if (0 !== strpos($source, $sourceRoot)) { throw new \InvalidArgumentException(sprintf('The source "%s" is not in the root directory "%s"', $source, $sourceRoot)); } $sourcePath = substr($source, strlen($sourceRoot) + 1); } $this->source = $source; parent::__construct($filters, $sourceRoot, $sourcePath, $vars); } public function load(FilterInterface $additionalFilter = null) { $source = PathUtils::resolvePath($this->source, $this->getVars(), $this->getValues()); if (!is_file($source)) { throw new \RuntimeException(sprintf('The source file "%s" does not exist.', $source)); } $this->doLoad(file_get_contents($source), $additionalFilter); } public function getLastModified() { $source = PathUtils::resolvePath($this->source, $this->getVars(), $this->getValues()); if (!is_file($source)) { throw new \RuntimeException(sprintf('The source file "%s" does not exist.', $source)); } return filemtime($source); } }
cruceo/cruceo
vendor/kriswallsmith/assetic/src/Assetic/Asset/FileAsset.php
PHP
mit
2,384
<div class="navbar"> <div class="navbar-inner"> <div class="left sliding"><a href="index.html" class="back link"><i class="icon icon-back"></i><span>Back</span></a></div> <div class="center sliding">Tab Bar</div> <div class="right"><a href="#" class="link open-panel icon-only"><i class="icon icon-bars"></i></a></div> </div> </div> <div class="pages navbar-through"> <div data-page="tabbar" class="page no-toolbar toolbar-fixed"> <div class="toolbar tabbar"> <div class="toolbar-inner"><a href="#tab-1" class="tab-link active"><i class="icon ks-tabbar-icon-1"></i></a><a href="#tab-2" class="tab-link"><i class="icon ks-tabbar-icon-2"><span class="badge bg-red">9</span></i></a><a href="#tab-3" class="tab-link"><i class="icon ks-tabbar-icon-3"></i></a><a href="#tab-4" class="tab-link"><i class="icon ks-tabbar-icon-4"></i></a></div> </div> <div class="page-content"> <div class="tabs"> <div id="tab-1" class="tab active"> <div class="content-block"> <p>This is tab 1 content</p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum mi quis felis scelerisque faucibus. Aliquam ut commodo justo. Mauris vitae pharetra arcu. Sed tincidunt dui et nibh auctor pretium. Nam accumsan fermentum sem. Suspendisse potenti. Nulla sed orci malesuada, pellentesque elit vitae, cursus lorem. Praesent et vehicula sapien, ut rhoncus quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vitae mi nec lorem aliquet venenatis quis nec nibh. Aenean sit amet leo ligula. Fusce in massa et nisl dictum ultricies et vitae dui. Sed sagittis quis diam sed lobortis. Donec in massa pharetra, tristique purus vitae, consequat mauris. Aliquam tellus ante, pharetra in mattis ut, dictum quis erat.</p> <p>Ut ac lobortis lacus, non pellentesque arcu. Quisque sodales sapien malesuada, condimentum nunc at, viverra lacus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vivamus eu pulvinar turpis, id tristique quam. Aenean venenatis molestie diam, sit amet condimentum nisl pretium id. Donec diam tortor, mollis in vehicula id, vehicula consectetur nulla. Quisque posuere rutrum mauris, eu rutrum turpis blandit at. Proin volutpat tortor sit amet metus porttitor accumsan. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut dapibus posuere dictum.</p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum mi quis felis scelerisque faucibus. Aliquam ut commodo justo. Mauris vitae pharetra arcu. Sed tincidunt dui et nibh auctor pretium. Nam accumsan fermentum sem. Suspendisse potenti. Nulla sed orci malesuada, pellentesque elit vitae, cursus lorem. Praesent et vehicula sapien, ut rhoncus quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vitae mi nec lorem aliquet venenatis quis nec nibh. Aenean sit amet leo ligula. Fusce in massa et nisl dictum ultricies et vitae dui. Sed sagittis quis diam sed lobortis. Donec in massa pharetra, tristique purus vitae, consequat mauris. Aliquam tellus ante, pharetra in mattis ut, dictum quis erat.</p> </div> </div> <div id="tab-2" class="tab"> <div class="content-block"> <p>This is tab 2 content</p> <p>Ut ac lobortis lacus, non pellentesque arcu. Quisque sodales sapien malesuada, condimentum nunc at, viverra lacus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vivamus eu pulvinar turpis, id tristique quam. Aenean venenatis molestie diam, sit amet condimentum nisl pretium id. Donec diam tortor, mollis in vehicula id, vehicula consectetur nulla. Quisque posuere rutrum mauris, eu rutrum turpis blandit at. Proin volutpat tortor sit amet metus porttitor accumsan. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut dapibus posuere dictum.</p> <p>Fusce luctus turpis nunc, id porta orci blandit eget. Aenean sodales quam nec diam varius, in ornare ipsum condimentum. Aenean eleifend, nulla sit amet volutpat adipiscing, ligula nulla pharetra risus, vitae consequat leo tortor eu nunc. Vivamus at fringilla metus. Duis neque lectus, sagittis in volutpat a, pretium vel turpis. Nam accumsan auctor libero, quis sodales felis faucibus quis. Etiam vestibulum sed nisl vel aliquet. Aliquam pellentesque leo a lacus ultricies scelerisque. Vestibulum vestibulum fermentum tincidunt. Proin eleifend metus non quam pretium, eu vehicula ipsum egestas. Nam eget nibh enim. Etiam sem leo, pellentesque a elit vel, egestas rhoncus enim. Morbi ultricies adipiscing tortor, vitae condimentum lacus hendrerit nec. Phasellus laoreet leo quis purus elementum, ut fringilla justo eleifend. Nunc ultricies a sapien vitae auctor. Aliquam id erat elementum, laoreet est et, dapibus ligula.</p> <p>Ut ac lobortis lacus, non pellentesque arcu. Quisque sodales sapien malesuada, condimentum nunc at, viverra lacus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Vivamus eu pulvinar turpis, id tristique quam. Aenean venenatis molestie diam, sit amet condimentum nisl pretium id. Donec diam tortor, mollis in vehicula id, vehicula consectetur nulla. Quisque posuere rutrum mauris, eu rutrum turpis blandit at. Proin volutpat tortor sit amet metus porttitor accumsan. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut dapibus posuere dictum.</p> </div> </div> <div id="tab-3" class="tab"> <div class="content-block"> <p>This is tab 3 content</p> <p>Nulla gravida libero eget lobortis iaculis. In sed elit eu nibh adipiscing faucibus. Sed ac accumsan lacus. In ut diam quis turpis fringilla volutpat. In ultrices dignissim consequat. Cras pretium tortor et lorem condimentum posuere. Nulla facilisi. Suspendisse pretium egestas lacus ac laoreet. Mauris rhoncus quis ipsum quis tristique. Vivamus ultricies urna quis nunc egestas, in euismod turpis fringilla. Nam tellus massa, vehicula eu sapien non, dapibus tempor lorem. Fusce placerat orci arcu, eu dignissim enim porttitor vel. Nullam porttitor vel dolor sed feugiat. Suspendisse potenti. Maecenas ac mattis odio. Sed vel ultricies lacus, sed posuere libero.</p> <p>Nulla gravida libero eget lobortis iaculis. In sed elit eu nibh adipiscing faucibus. Sed ac accumsan lacus. In ut diam quis turpis fringilla volutpat. In ultrices dignissim consequat. Cras pretium tortor et lorem condimentum posuere. Nulla facilisi. Suspendisse pretium egestas lacus ac laoreet. Mauris rhoncus quis ipsum quis tristique. Vivamus ultricies urna quis nunc egestas, in euismod turpis fringilla. Nam tellus massa, vehicula eu sapien non, dapibus tempor lorem. Fusce placerat orci arcu, eu dignissim enim porttitor vel. Nullam porttitor vel dolor sed feugiat. Suspendisse potenti. Maecenas ac mattis odio. Sed vel ultricies lacus, sed posuere libero.</p> <p>Nulla gravida libero eget lobortis iaculis. In sed elit eu nibh adipiscing faucibus. Sed ac accumsan lacus. In ut diam quis turpis fringilla volutpat. In ultrices dignissim consequat. Cras pretium tortor et lorem condimentum posuere. Nulla facilisi. Suspendisse pretium egestas lacus ac laoreet. Mauris rhoncus quis ipsum quis tristique. Vivamus ultricies urna quis nunc egestas, in euismod turpis fringilla. Nam tellus massa, vehicula eu sapien non, dapibus tempor lorem. Fusce placerat orci arcu, eu dignissim enim porttitor vel. Nullam porttitor vel dolor sed feugiat. Suspendisse potenti. Maecenas ac mattis odio. Sed vel ultricies lacus, sed posuere libero.</p> </div> </div> <div id="tab-4" class="tab"> <div class="content-block"> <p>This is tab 4 content</p> <p>Fusce luctus turpis nunc, id porta orci blandit eget. Aenean sodales quam nec diam varius, in ornare ipsum condimentum. Aenean eleifend, nulla sit amet volutpat adipiscing, ligula nulla pharetra risus, vitae consequat leo tortor eu nunc. Vivamus at fringilla metus. Duis neque lectus, sagittis in volutpat a, pretium vel turpis. Nam accumsan auctor libero, quis sodales felis faucibus quis. Etiam vestibulum sed nisl vel aliquet. Aliquam pellentesque leo a lacus ultricies scelerisque. Vestibulum vestibulum fermentum tincidunt. Proin eleifend metus non quam pretium, eu vehicula ipsum egestas. Nam eget nibh enim. Etiam sem leo, pellentesque a elit vel, egestas rhoncus enim. Morbi ultricies adipiscing tortor, vitae condimentum lacus hendrerit nec. Phasellus laoreet leo quis purus elementum, ut fringilla justo eleifend. Nunc ultricies a sapien vitae auctor. Aliquam id erat elementum, laoreet est et, dapibus ligula.</p> <p>Fusce luctus turpis nunc, id porta orci blandit eget. Aenean sodales quam nec diam varius, in ornare ipsum condimentum. Aenean eleifend, nulla sit amet volutpat adipiscing, ligula nulla pharetra risus, vitae consequat leo tortor eu nunc. Vivamus at fringilla metus. Duis neque lectus, sagittis in volutpat a, pretium vel turpis. Nam accumsan auctor libero, quis sodales felis faucibus quis. Etiam vestibulum sed nisl vel aliquet. Aliquam pellentesque leo a lacus ultricies scelerisque. Vestibulum vestibulum fermentum tincidunt. Proin eleifend metus non quam pretium, eu vehicula ipsum egestas. Nam eget nibh enim. Etiam sem leo, pellentesque a elit vel, egestas rhoncus enim. Morbi ultricies adipiscing tortor, vitae condimentum lacus hendrerit nec. Phasellus laoreet leo quis purus elementum, ut fringilla justo eleifend. Nunc ultricies a sapien vitae auctor. Aliquam id erat elementum, laoreet est et, dapibus ligula.</p> <p>Fusce luctus turpis nunc, id porta orci blandit eget. Aenean sodales quam nec diam varius, in ornare ipsum condimentum. Aenean eleifend, nulla sit amet volutpat adipiscing, ligula nulla pharetra risus, vitae consequat leo tortor eu nunc. Vivamus at fringilla metus. Duis neque lectus, sagittis in volutpat a, pretium vel turpis. Nam accumsan auctor libero, quis sodales felis faucibus quis. Etiam vestibulum sed nisl vel aliquet. Aliquam pellentesque leo a lacus ultricies scelerisque. Vestibulum vestibulum fermentum tincidunt. Proin eleifend metus non quam pretium, eu vehicula ipsum egestas. Nam eget nibh enim. Etiam sem leo, pellentesque a elit vel, egestas rhoncus enim. Morbi ultricies adipiscing tortor, vitae condimentum lacus hendrerit nec. Phasellus laoreet leo quis purus elementum, ut fringilla justo eleifend. Nunc ultricies a sapien vitae auctor. Aliquam id erat elementum, laoreet est et, dapibus ligula.</p> </div> </div> </div> </div> </div> </div>
wicky-info/Framework7
kitchen-sink-ios/bars-tabbar.html
HTML
mit
10,826
!function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,e,n){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=19)}([function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e;n++)t="0"+t;return t}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(e){n(this,t),this.string=e}return t.prototype.encode=function(){for(var t="110",e=0;e<this.string.length;e++){var n=parseInt(this.string[e]),o=n.toString(2);o=r(o,4-o.length);for(var i=0;i<o.length;i++)t+="0"==o[i]?"100":"110"}return t+="1001",{data:t,text:this.string}},t.prototype.valid=function(){return this.string.search(/^[0-9]+$/)!==-1},t}();e["default"]=o},function(t,e){"use strict";function n(t,e){var n,r={};for(n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);for(n in e)e.hasOwnProperty(n)&&"undefined"!=typeof e[n]&&(r[n]=e[n]);return r}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e){"use strict";function n(t){for(var e=0,n=0;n<t.length;n++){var r=parseInt(t[n]);e+=(n+t.length)%2===0?r:2*r%10+Math.floor(2*r/10)}return(10-e%10)%10}function r(t){for(var e=0,n=[2,3,4,5,6,7],r=0;r<t.length;r++){var o=parseInt(t[t.length-1-r]);e+=n[r%n.length]*o}return(11-e%11)%11}Object.defineProperty(e,"__esModule",{value:!0}),e.mod10=n,e.mod11=r},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={width:2,height:100,format:"auto",displayValue:!0,fontOptions:"",font:"monospace",textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function(){}};e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){return e.height+(e.displayValue&&t.text.length>0?e.fontSize:0)+e.textMargin+e.marginTop+e.marginBottom}function i(t,e,n){if(n.displayValue&&e<t){if("center"==n.textAlign)return Math.floor((t-e)/2);if("left"==n.textAlign)return 0;if("right"==n.textAlign)return Math.floor(t-e)}return 0}function a(t,e,n){for(var r=0;r<t.length;r++){var a=t[r],s=(0,d["default"])(e,a.options),u=f(a.text,s,n),c=a.data.length*s.width;a.width=Math.ceil(Math.max(u,c)),a.height=o(a,s),a.barcodePadding=i(u,c,s)}}function s(t){for(var e=0,n=0;n<t.length;n++)e+=t[n].width;return e}function u(t){for(var e=0,n=0;n<t.length;n++)t[n].height>e&&(e=t[n].height);return e}function f(t,e,n){var r;r="undefined"==typeof n?document.createElement("canvas").getContext("2d"):n,r.font=e.fontOptions+" "+e.fontSize+"px "+e.font;var o=r.measureText(t).width;return o}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var c=n(1),d=r(c);e.getMaximumHeightOfEncodings=u,e.getEncodingHeight=o,e.getBarcodePadding=i,e.calculateEncodingAttributes=a,e.getTotalWidthOfEncodings=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(13);e["default"]={MSI:r.MSI,MSI10:r.MSI10,MSI11:r.MSI11,MSI1010:r.MSI1010,MSI1110:r.MSI1110}},function(t,e){"use strict";function n(t){return t.marginTop=t.marginTop||t.margin,t.marginBottom=t.marginBottom||t.margin,t.marginRight=t.marginRight||t.margin,t.marginLeft=t.marginLeft||t.margin,t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){if("string"==typeof t)return i(t);if(Array.isArray(t)){for(var e=[],n=0;n<t.length;n++)e.push(o(t[n]));return e}if("undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLImageElement)return a(t);if("undefined"!=typeof SVGElement&&t instanceof SVGElement)return{element:t,options:(0,u["default"])(t),renderer:(0,f.getRendererClass)("svg")};if("undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement)return{element:t,options:(0,u["default"])(t),renderer:(0,f.getRendererClass)("canvas")};if(t.getContext)return{element:t,renderer:(0,f.getRendererClass)("canvas")};throw new Error("Not supported type to render on.")}function i(t){var e=document.querySelectorAll(t);if(0===e.length)throw new Error("No element found");for(var n=[],r=0;r<e.length;r++)n.push(o(e[r]));return n}function a(t){var e=document.createElement("canvas");return{element:e,options:(0,u["default"])(t),renderer:(0,f.getRendererClass)("canvas"),afterRender:function(){t.setAttribute("src",e.toDataURL())}}}Object.defineProperty(e,"__esModule",{value:!0});var s=n(14),u=r(s),f=n(17);e["default"]=o},function(t,e){"use strict";function n(t){function e(t){if(Array.isArray(t))for(var r=0;r<t.length;r++)e(t[r]);else t.text=t.text||"",t.data=t.data||"",n.push(t)}var n=[];return e(t),n}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(0),u=r(s),f=n(2),c=function(t){function e(n){o(this,e);var r=i(this,t.call(this,n));return r.string+=(0,f.mod10)(r.string),r}return a(e,t),e}(u["default"]);e["default"]=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(0),u=r(s),f=n(2),c=function(t){function e(n){o(this,e);var r=i(this,t.call(this,n));return r.string+=(0,f.mod10)(r.string),r.string+=(0,f.mod10)(r.string),r}return a(e,t),e}(u["default"]);e["default"]=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(0),u=r(s),f=n(2),c=function(t){function e(n){o(this,e);var r=i(this,t.call(this,n));return r.string+=(0,f.mod11)(r.string),r}return a(e,t),e}(u["default"]);e["default"]=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(0),u=r(s),f=n(2),c=function(t){function e(n){o(this,e);var r=i(this,t.call(this,n));return r.string+=(0,f.mod11)(r.string),r.string+=(0,f.mod10)(r.string),r}return a(e,t),e}(u["default"]);e["default"]=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0}),e.MSI1110=e.MSI1010=e.MSI11=e.MSI10=e.MSI=void 0;var o=n(0),i=r(o),a=n(9),s=r(a),u=n(11),f=r(u),c=n(10),d=r(c),l=n(12),h=r(l);e.MSI=i["default"],e.MSI10=s["default"],e.MSI11=f["default"],e.MSI1010=d["default"],e.MSI1110=h["default"]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){var e={};for(var n in u["default"])u["default"].hasOwnProperty(n)&&(t.hasAttribute("jsbarcode-"+n.toLowerCase())&&(e[n]=t.getAttribute("jsbarcode-"+n.toLowerCase())),t.hasAttribute("data-"+n.toLowerCase())&&(e[n]=t.getAttribute("data-"+n.toLowerCase())));return e.value=t.getAttribute("jsbarcode-value")||t.getAttribute("data-value"),e=(0,a["default"])(e)}Object.defineProperty(e,"__esModule",{value:!0});var i=n(15),a=r(i),s=n(3),u=r(s);e["default"]=o},function(t,e){"use strict";function n(t){var e=["width","height","textMargin","fontSize","margin","marginTop","marginBottom","marginLeft","marginRight"];for(var n in e)e.hasOwnProperty(n)&&(n=e[n],"string"==typeof t[n]&&(t[n]=parseInt(t[n],10)));return"string"==typeof t.displayValue&&(t.displayValue="false"!=t.displayValue),t}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),a=r(i),s=n(4),u=function(){function t(e,n,r){o(this,t),this.canvas=e,this.encodings=n,this.options=r}return t.prototype.render=function(){if(!this.canvas.getContext)throw new Error("The browser does not support canvas.");this.prepareCanvas();for(var t=0;t<this.encodings.length;t++){var e=(0,a["default"])(this.options,this.encodings[t].options);this.drawCanvasBarcode(e,this.encodings[t]),this.drawCanvasText(e,this.encodings[t]),this.moveCanvasDrawing(this.encodings[t])}this.restoreCanvas()},t.prototype.prepareCanvas=function(){var t=this.canvas.getContext("2d");t.save(),(0,s.calculateEncodingAttributes)(this.encodings,this.options,t);var e=(0,s.getTotalWidthOfEncodings)(this.encodings),n=(0,s.getMaximumHeightOfEncodings)(this.encodings);this.canvas.width=e+this.options.marginLeft+this.options.marginRight,this.canvas.height=n,t.clearRect(0,0,this.canvas.width,this.canvas.height),this.options.background&&(t.fillStyle=this.options.background,t.fillRect(0,0,this.canvas.width,this.canvas.height)),t.translate(this.options.marginLeft,0)},t.prototype.drawCanvasBarcode=function(t,e){var n,r=this.canvas.getContext("2d"),o=e.data;n="top"==t.textPosition?t.marginTop+t.fontSize+t.textMargin:t.marginTop,r.fillStyle=t.lineColor;for(var i=0;i<o.length;i++){var a=i*t.width+e.barcodePadding;"1"===o[i]?r.fillRect(a,n,t.width,t.height):o[i]&&r.fillRect(a,n,t.width,t.height*o[i])}},t.prototype.drawCanvasText=function(t,e){var n=this.canvas.getContext("2d"),r=t.fontOptions+" "+t.fontSize+"px "+t.font;if(t.displayValue){var o,i;i="top"==t.textPosition?t.marginTop+t.fontSize-t.textMargin:t.height+t.textMargin+t.marginTop+t.fontSize,n.font=r,"left"==t.textAlign||e.barcodePadding>0?(o=0,n.textAlign="left"):"right"==t.textAlign?(o=e.width-1,n.textAlign="right"):(o=e.width/2,n.textAlign="center"),n.fillText(e.text,o,i)}},t.prototype.moveCanvasDrawing=function(t){var e=this.canvas.getContext("2d");e.translate(t.width,0)},t.prototype.restoreCanvas=function(){var t=this.canvas.getContext("2d");t.restore()},t}();e["default"]=u},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){switch(t){case"canvas":return a["default"];case"svg":return u["default"];default:throw new Error("Invalid rederer")}}Object.defineProperty(e,"__esModule",{value:!0}),e.getRendererClass=void 0;var i=n(16),a=r(i),s=n(18),u=r(s);e.getRendererClass=o},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e,n){var r=document.createElementNS(d,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}function a(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}function s(t,e,n,r,o){var i=document.createElementNS(d,"rect");i.setAttribute("x",t),i.setAttribute("y",e),i.setAttribute("width",n),i.setAttribute("height",r),o.appendChild(i)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(1),f=r(u),c=n(4),d="http://www.w3.org/2000/svg",l=function(){function t(e,n,r){o(this,t),this.svg=e,this.encodings=n,this.options=r}return t.prototype.render=function(){var t=this.options.marginLeft;this.prepareSVG();for(var e=0;e<this.encodings.length;e++){var n=this.encodings[e],r=(0,f["default"])(this.options,n.options),o=i(t,r.marginTop,this.svg);a(o,r),this.drawSvgBarcode(o,r,n),this.drawSVGText(o,r,n),t+=n.width}},t.prototype.prepareSVG=function(){for(;this.svg.firstChild;)this.svg.removeChild(this.firstChild);(0,c.calculateEncodingAttributes)(this.encodings,this.options);var t=(0,c.getTotalWidthOfEncodings)(this.encodings),e=(0,c.getMaximumHeightOfEncodings)(this.encodings),n=t+this.options.marginLeft+this.options.marginRight;this.setSvgAttributes(n,e)},t.prototype.drawSvgBarcode=function(t,e,n){var r,o=n.data;r="top"==e.textPosition?e.fontSize+e.textMargin:0;for(var i=0,a=0,u=0;u<o.length;u++)a=u*e.width+n.barcodePadding,"1"===o[u]?i++:i>0&&(s(a-e.width*i,r,e.width*i,e.height,t),i=0);i>0&&s(a-e.width*(i-1),r,e.width*i,e.height,t)},t.prototype.drawSVGText=function(t,e,n){var r=document.createElementNS(d,"text");if(e.displayValue){var o,i;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),i="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(o=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(o=n.width-1,r.setAttribute("text-anchor","end")):(o=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",o),r.setAttribute("y",i),r.appendChild(document.createTextNode(n.text)),t.appendChild(r)}},t.prototype.setSvgAttributes=function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",d),n.setAttribute("version","1.1"),n.style.transform="translate(0,0)",this.options.background&&(n.style.background=this.options.background)},t}();e["default"]=l},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){w.prototype[e]=w.prototype[e.toUpperCase()]=w.prototype[e.toLowerCase()]=function(n,r){var o=(0,d["default"])(this._options,r),a=t[e],s=i(n,a,o);return this._encodings.push(s),this}}function i(t,e,n){t=""+t;var r=new e(t,n);if(!r.valid()){if(n.valid===m["default"].valid)throw new Error('"'+t+'" is not a valid input.');n.valid(!1)}var o=r.encode();o=(0,h["default"])(o);for(var i=0;i<o.length;i++)o[i].options=(0,d["default"])(n,o[i].options);return o}function a(){return f["default"].CODE128?"CODE128":Object.keys(f["default"])[0]}function s(t,e,n){e=(0,h["default"])(e);for(var r=0;r<e.length;r++)e[r].options=(0,d["default"])(n,e[r].options),(0,g["default"])(e[r].options);(0,g["default"])(n);var o=t.renderer,i=new o(t.element,e,n);i.render(),t.afterRender&&t.afterRender()}var u=n(5),f=r(u),c=n(1),d=r(c),l=n(8),h=r(l),p=n(6),g=r(p),v=n(7),y=r(v),b=n(3),m=r(b),w=function(){},_=function(t,e,n){var r=new w;if("undefined"==typeof t)throw Error("No element to render on was provided.");return r._renderProperties=(0,y["default"])(t),r._encodings=[],r._options=m["default"],"undefined"!=typeof e&&(n=n||{},n.format||(n.format=a()),r.options(n),r[n.format](e,n),r.render()),r};_.getModule=function(t){return f["default"][t]};for(var x in f["default"])f["default"].hasOwnProperty(x)&&o(f["default"],x);w.prototype.options=function(t){return this._options=(0,d["default"])(this._options,t),this},w.prototype.blank=function(t){var e="0".repeat(t);return this._encodings.push({data:e}),this},w.prototype.init=function(){Array.isArray(this._renderProperties)||(this._renderProperties=[this._renderProperties]);var t;for(var e in this._renderProperties){t=this._renderProperties[e];var n=(0,d["default"])(this._options,t.options);"auto"==n.format&&(n.format=a());var r=n.value,o=f["default"][n.format.toUpperCase()],u=i(r,o,n);s(t,u,n)}},w.prototype.render=function(){if(Array.isArray(this._renderProperties))for(var t in this._renderProperties)s(this._renderProperties[t],this._encodings,this._options);else s(this._renderProperties,this._encodings,this._options);return this._options.valid(!0),this},"undefined"!=typeof window&&(window.JsBarcode=_),"undefined"!=typeof jQuery&&(jQuery.fn.JsBarcode=function(t,e){var n=[];return jQuery(this).each(function(){n.push(this)}),_(n,t,e)}),t.exports=_}]);
holtkamp/cdnjs
ajax/libs/jsbarcode/3.3.15/barcodes/JsBarcode.msi.min.js
JavaScript
mit
17,677
define("dojo/cldr/nls/buddhist", { root: //begin v1.x content { "months-format-abbr": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ], "months-format-narrow": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ], "months-format-wide": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ], "months-standAlone-abbr": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ], "months-standAlone-narrow": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ], "months-standAlone-wide": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ], "days-format-abbr": [ "1", "2", "3", "4", "5", "6", "7" ], "days-format-narrow": [ "1", "2", "3", "4", "5", "6", "7" ], "days-format-wide": [ "1", "2", "3", "4", "5", "6", "7" ], "days-standAlone-abbr": [ "1", "2", "3", "4", "5", "6", "7" ], "days-standAlone-narrow": [ "1", "2", "3", "4", "5", "6", "7" ], "days-standAlone-wide": [ "1", "2", "3", "4", "5", "6", "7" ], "quarters-format-abbr": [ "Q1", "Q2", "Q3", "Q4" ], "quarters-format-narrow": [ "1", "2", "3", "4" ], "quarters-format-wide": [ "Q1", "Q2", "Q3", "Q4" ], "quarters-standAlone-abbr": [ "Q1", "Q2", "Q3", "Q4" ], "quarters-standAlone-narrow": [ "1", "2", "3", "4" ], "quarters-standAlone-wide": [ "Q1", "Q2", "Q3", "Q4" ], "dayPeriods-format-abbr-am": "AM", "dayPeriods-format-abbr-pm": "PM", "dayPeriods-format-narrow-am": "AM", "dayPeriods-format-narrow-pm": "PM", "dayPeriods-format-wide-am": "AM", "dayPeriods-format-wide-pm": "PM", "eraNames": [ "BE" ], "eraAbbr": [ "BE" ], "eraNarrow": [ "BE" ], "dateFormat-full": "EEEE, G y MMMM dd", "dateFormat-long": "G y MMMM d", "dateFormat-medium": "G y MMM d", "dateFormat-short": "GGGGG yyyy-MM-dd", "timeFormat-full": "HH:mm:ss zzzz", "timeFormat-long": "HH:mm:ss z", "timeFormat-medium": "HH:mm:ss", "timeFormat-short": "HH:mm", "dateTimeFormat": "{1} {0}", "dateFormatItem-d": "d", "dateFormatItem-Ed": "d E", "dateFormatItem-Gy": "G y", "dateFormatItem-h": "h a", "dateFormatItem-H": "HH", "dateFormatItem-hm": "h:mm a", "dateFormatItem-Hm": "HH:mm", "dateFormatItem-hms": "h:mm:ss a", "dateFormatItem-Hms": "HH:mm:ss", "dateFormatItem-M": "L", "dateFormatItem-Md": "M-d", "dateFormatItem-MEd": "E, M-d", "dateFormatItem-MMM": "LLL", "dateFormatItem-MMMd": "MMM d", "dateFormatItem-MMMEd": "E MMM d", "dateFormatItem-ms": "mm:ss", "dateFormatItem-y": "G y", "dateFormatItem-yM": "GGGGG yyyy-MM", "dateFormatItem-yMd": "GGGGG yyyy-MM-dd", "dateFormatItem-yMEd": "E, GGGGG yyyy-MM-dd", "dateFormatItem-yMMM": "G y MMM", "dateFormatItem-yMMMd": "G y MMM d", "dateFormatItem-yMMMEd": "E, G y MMM d", "dateFormatItem-yQ": "GGGGG yyyy Q", "dateFormatItem-yQQQ": "G y QQQ", "dateTimeFormats-appendItem-Day": "{0} ({2}: {1})", "dateTimeFormats-appendItem-Day-Of-Week": "{0} {1}", "dateTimeFormats-appendItem-Era": "{0} {1}", "dateTimeFormats-appendItem-Hour": "{0} ({2}: {1})", "dateTimeFormats-appendItem-Minute": "{0} ({2}: {1})", "dateTimeFormats-appendItem-Month": "{0} ({2}: {1})", "dateTimeFormats-appendItem-Quarter": "{0} ({2}: {1})", "dateTimeFormats-appendItem-Second": "{0} ({2}: {1})", "dateTimeFormats-appendItem-Timezone": "{0} {1}", "dateTimeFormats-appendItem-Week": "{0} ({2}: {1})", "dateTimeFormats-appendItem-Year": "{0} {1}" } //end v1.x content , "ar": true, "cs": true, "da": true, "de": true, "el": true, "en": true, "en-gb": true, "es": true, "fi": true, "fr": true, "hu": true, "it": true, "ja": true, "ko": true, "nb": true, "nl": true, "pl": true, "pt": true, "pt-pt": true, "ro": true, "ru": true, "sv": true, "th": true, "tr": true, "zh": true, "zh-hant": true });
JimBobSquarePants/cdnjs
ajax/libs/dojo/1.8.0/cldr/nls/buddhist.js.uncompressed.js
JavaScript
mit
4,023
/** * Ink Core. * @module Ink_1 * This module provides the necessary methods to create and load the modules using Ink. */ ;(function(window, document) { 'use strict'; // skip redefinition of Ink core if ('Ink' in window) { return; } // internal data /* * NOTE: * invoke Ink.setPath('Ink', '/Ink/'); before requiring local modules */ var paths = {}; var modules = {}; var modulesLoadOrder = []; var modulesRequested = {}; var pendingRMs = []; var modulesWaitingForDeps = {}; var apply = Function.prototype.apply; // auxiliary fns var isEmptyObject = function(o) { /*jshint unused:false */ if (typeof o !== 'object') { return false; } for (var k in o) { if (o.hasOwnProperty(k)) { return false; } } return true; }; /** * @namespace Ink_1 */ window.Ink = { _checkPendingRequireModules: function() { var I, F, o, dep, mod, cb, pRMs = []; for (I = 0, F = pendingRMs.length; I < F; ++I) { o = pendingRMs[I]; if (!o) { continue; } for (dep in o.left) { if (o.left.hasOwnProperty(dep)) { mod = modules[dep]; if (mod) { o.args[o.left[dep] ] = mod; delete o.left[dep]; --o.remaining; } } } if (o.remaining > 0) { pRMs.push(o); } else { cb = o.cb; if (!cb) { continue; } delete o.cb; // to make sure I won't call this more than once! cb.apply(false, o.args); } } pendingRMs = pRMs; if (pendingRMs.length > 0) { setTimeout( function() { Ink._checkPendingRequireModules(); }, 0 ); } }, /** * Get the full path of a module. * This method looks up the paths given in setPath (and ultimately the default Ink's path). * * @method getPath * @param {String} key Name of the module you want to get the path * @param {Boolean} [noLib] Flag to skip appending 'lib.js' to the returned path. */ getPath: function(key, noLib) { var split = key.split(/[._]/g); var curKey; var i; var root; var path; // Look for Ink.Dom.Element.1, Ink.Dom.Element, Ink.Dom, Ink in this order. for (i = split.length; i >= 0; i -= 1) { curKey = split.slice(0, i + 1).join('.'); // See comment in setPath if (paths[curKey]) { root = curKey; break; } } path = paths[root || 'Ink']; if (!/\/$/.test(path)) { path += '/'; } if (i < split.length) { path += split.slice(i + 1).join('/') + '/'; } if (!noLib) { path += 'lib.js'; } return path; }, /** * Sets the URL path for a namespace. * Use this to customize where requireModules and createModule will load dependencies from. * This can be useful to set your own CDN for dynamic module loading or simply to change your module folder structure * * @method setPath * * @param {String} key Module or namespace * @param {String} rootURI Base URL path and schema to be appended to the module or namespace * * @example * Ink.setPath('Ink', 'http://my-cdn/Ink/'); * Ink.setPath('Lol', 'http://my-cdn/Lol/'); * * // Loads from http://my-cdn/Ink/Dom/Whatever/lib.js * Ink.requireModules(['Ink.Dom.Whatever'], function () { ... }); * // Loads from http://my-cdn/Lol/Whatever/lib.js * Ink.requireModules(['Lol.Whatever'], function () { ... }); */ setPath: function(key, rootURI) { // Replacing version separator with dot because the difference // between a submodule and a version doesn't matter here. // It would also overcomplicate the implementation of getPath paths[key.replace(/_/, '.')] = rootURI; }, /** * Loads a script URL. * This creates a `script` tag in the `head` of the document. * Reports errors by listening to 'error' and 'readystatechange' events. * * @method loadScript * @param {String} uri Can be an external URL or a module name * @param {String} [contentType]='text/javascript' The `type` attribute of the new script tag. */ loadScript: function(uri, contentType) { /*jshint evil:true */ if (uri.indexOf('/') === -1) { uri = this.getPath(uri); } var scriptEl = document.createElement('script'); scriptEl.setAttribute('type', contentType || 'text/javascript'); scriptEl.setAttribute('src', uri); scriptEl.onerror = scriptEl.onreadystatechange = function (err) { err = err || window.event; if (err.type === 'readystatechange' && scriptEl.readyState !== 'loaded') { // if not readyState == 'loaded' it's not an error. return; } Ink.error(['Failed to load script ', uri, '. (', err || 'unspecified error', ')'].join('')); }; // CHECK ON ALL BROWSERS /*if (document.readyState !== 'complete' && !document.body) { document.write( scriptEl.outerHTML ); } else {*/ var aHead = document.getElementsByTagName('head'); if(aHead.length > 0) { aHead[0].appendChild(scriptEl); } //} }, _loadLater: function (dep) { setTimeout(function () { if (modules[dep] || modulesRequested[dep] || modulesWaitingForDeps[dep]) { return; } modulesRequested[dep] = true; Ink.loadScript(dep); }, 0); }, /** * Defines a module namespace. * * @method namespace * @param {String} ns Namespace to define. * @param {Boolean} [returnParentAndKey] Flag to change the return value to an array containing the namespace parent and the namespace key * @return {Object|Array} Returns the created namespace object */ namespace: function(ns, returnParentAndKey) { if (!ns || !ns.length) { return null; } var levels = ns.split('.'); var nsobj = window; var parent; for (var i = 0, f = levels.length; i < f; ++i) { nsobj[ levels[i] ] = nsobj[ levels[i] ] || {}; parent = nsobj; nsobj = nsobj[ levels[i] ]; } if (returnParentAndKey) { return [ parent, levels[i-1] ]; } return nsobj; }, /** * Loads a module. * A synchronous method to get the module from the registry. It assumes the module is defined and loaded already! * * @method getModule * @param {String} mod Module name * @param {Number} [version] Version number of the module * @return {Object|Function} Module object or function, depending how the module is defined */ getModule: function(mod, version) { var key = version ? [mod, '_', version].join('') : mod; return modules[key]; }, /** * Creates a new module. * Use this to wrap your code and benefit from the module loading used throughout the Ink library * * @method createModule * @uses requireModules * @param {String} mod Module name, separated by dots. Like Ink.Dom.Selector, Ink.UI.Modal * @param {Number} version Version number * @param {Array} deps Array of module names which are dependencies of the module being created. The order in which they are passed here will define the order they will be passed to the callback function. * @param {Function} modFn The callback function to be executed when all the dependencies are resolved. The dependencies are passed as arguments, in the same order they were declared. The function itself should return the module. * @sample Ink_1_createModule.html * */ createModule: function(mod, ver, deps, modFn) { // define if (typeof mod !== 'string') { throw new Error('module name must be a string!'); } // validate version correctness if (!(typeof ver === 'number' || (typeof ver === 'string' && ver.length > 0))) { throw new Error('version number missing!'); } var modAll = [mod, '_', ver].join(''); modulesWaitingForDeps[modAll] = true; var cb = function() { //console.log(['createModule(', mod, ', ', ver, ', [', deps.join(', '), '], ', !!modFn, ')'].join('')); // make sure module in not loaded twice if (modules[modAll]) { //console.warn(['Ink.createModule ', modAll, ': module has been defined already.'].join('')); return; } // delete related pending tasks delete modulesRequested[modAll]; delete modulesRequested[mod]; // run module's supplied factory var args = Array.prototype.slice.call(arguments); var moduleContent = modFn.apply(window, args); modulesLoadOrder.push(modAll); // console.log('** loaded module ' + modAll + '**'); // set version if (typeof moduleContent === 'object') { // Dom.Css Dom.Event moduleContent._version = ver; } else if (typeof moduleContent === 'function') { moduleContent.prototype._version = ver; // if constructor moduleContent._version = ver; // if regular function } // add to global namespace... var isInkModule = mod.indexOf('Ink.') === 0; var t; if (isInkModule) { t = Ink.namespace(mod, true); // for mod 'Ink.Dom.Css', t[0] gets 'Ink.Dom' object and t[1] 'Css' } // versioned modules[ modAll ] = moduleContent; // in modules delete modulesWaitingForDeps[ modAll ]; if (isInkModule) { t[0][ t[1] + '_' + ver ] = moduleContent; // in namespace } // unversioned modules[ mod ] = moduleContent; // in modules if (isInkModule) { if (isEmptyObject( t[0][ t[1] ] )) { t[0][ t[1] ] = moduleContent; // in namespace } // else { // console.warn(['Ink.createModule ', modAll, ': module has been defined already with a different version!'].join('')); // } } if (this) { // there may be pending requires expecting this module, check... Ink._checkPendingRequireModules(); } }; this.requireModules(deps, cb); }, /** * Requires modules asynchronously * Use this to get modules, even if they're not loaded yet * * @method requireModules * @param {Array} deps Array of module names. The order in which they are passed here will define the order they will be passed to the callback function. * @param {Function} cbFn The callback function to be executed when all the dependencies are resolved. The dependencies are passed as arguments, in the same order they were declared. * @sample Ink_1_requireModules.html */ requireModules: function(deps, cbFn) { // require //console.log(['requireModules([', deps.join(', '), '], ', !!cbFn, ')'].join('')); var i, f, o, dep, mod; f = deps.length; o = { args: new Array(f), left: {}, remaining: f, cb: cbFn }; if (!(typeof deps === 'object' && deps.length !== undefined)) { throw new Error('Dependency list should be an array!'); } if (typeof cbFn !== 'function') { throw new Error('Callback should be a function!'); } for (i = 0; i < f; ++i) { if (Ink._moduleRenames[deps[i]]) { Ink.warn(deps[i] + ' was renamed to ' + Ink._moduleRenames[deps[i]]); dep = Ink._moduleRenames[deps[i]]; } else { dep = deps[i]; } mod = modules[dep]; if (mod) { o.args[i] = mod; --o.remaining; continue; } else if (!modulesRequested[dep]) { Ink._loadLater(dep); } o.left[dep] = i; } if (o.remaining > 0) { pendingRMs.push(o); } else { cbFn.apply(true, o.args); } }, _moduleRenames: { 'Ink.UI.Aux_1': 'Ink.UI.Common_1' }, /** * Lists loaded module names. * The list is ordered by loaded time (oldest module comes first) * * @method getModulesLoadOrder * @return {Array} returns the order in which modules were resolved and correctly loaded */ getModulesLoadOrder: function() { return modulesLoadOrder.slice(); }, /** * Builds the markup needed to load the modules. * This method builds the script tags needed to load the currently used modules * * @method getModuleScripts * @uses getModulesLoadOrder * @return {String} The script markup */ getModuleScripts: function() { var mlo = this.getModulesLoadOrder(); mlo.unshift('Ink_1'); mlo = mlo.map(function(m) { return ['<scr', 'ipt type="text/javascript" src="', Ink.getModuleURL(m), '"></scr', 'ipt>'].join(''); }); return mlo.join('\n'); }, /** * Creates an Ink.Ext module * * Does exactly the same as createModule but creates the module in the Ink.Ext namespace * * @method createExt * @uses createModule * @param {String} moduleName Extension name * @param {String} version Extension version * @param {Array} dependencies Extension dependencies * @param {Function} modFn Function returning the extension * @sample Ink_1_createExt.html */ createExt: function (moduleName, version, dependencies, modFn) { return Ink.createModule('Ink.Ext.' + moduleName, version, dependencies, modFn); }, /** * Function.prototype.bind alternative. * Creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called. * * @method bind * @param {Function} fn The function * @param {Object} context The value to be passed as the this parameter to the target function when the bound function is called. If used as false, it preserves the original context and just binds the arguments. * @param {Any} [args*] Additional arguments will be sent to the original function as prefix arguments. * @return {Function} * @sample Ink_1_bind.html */ bind: function(fn, context) { var args = Array.prototype.slice.call(arguments, 2); return function() { var innerArgs = Array.prototype.slice.call(arguments); var finalArgs = args.concat(innerArgs); return fn.apply(context === false ? this : context, finalArgs); }; }, /** * Function.prototype.bind alternative for class methods * Creates a new function that, when called, has this k * @method bindMethod * @uses bind * @param {Object} object The object that contains the method to bind * @param {String} methodName The name of the method that will be bound * @param {Any} [args*] Additional arguments will be sent to the new method as prefix arguments. * @return {Function} * @sample Ink_1_bindMethod.html */ bindMethod: function (object, methodName) { return Ink.bind.apply(Ink, [object[methodName], object].concat([].slice.call(arguments, 2))); }, /** * Function.prototype.bind alternative for event handlers. * Same as bind but keeps first argument of the call the original event. * Set "context" to `false` to preserve the original context of the function and just bind the arguments. * * @method bindEvent * @param {Function} fn The function * @param {Object} context The value to be passed as the this parameter to the target * @param {Any} [args*] Additional arguments will be sent to the original function as prefix arguments * @return {Function} * @sample Ink_1_bindEvent.html */ bindEvent: function(fn, context) { var args = Array.prototype.slice.call(arguments, 2); return function(event) { var finalArgs = args.slice(); finalArgs.unshift(event || window.event); return fn.apply(context === false ? this : context, finalArgs); }; }, /** * Alias to document.getElementById * * @method i * @param {String} id Element ID * @return {DOMElement} * @sample Ink_1_i.html */ i: function(id) { if(!id) { throw new Error('Ink.i => id or element must be passed'); } if(typeof(id) === 'string') { return document.getElementById(id); } return id; }, /** * Alias for Ink.Dom.Selector * * @method ss * @uses Ink.Dom.Selector.select * @param {String} rule * @param {DOMElement} [from] * @return {Array} array of DOMElements * @sample Ink_1_ss.html */ ss: function(rule, from) { if(typeof(Ink.Dom) === 'undefined' || typeof(Ink.Dom.Selector) === 'undefined') { throw new Error('This method requires Ink.Dom.Selector'); } return Ink.Dom.Selector.select(rule, (from || document)); }, /** * Alias for Ink.Dom.Selector first result * * @method s * @uses Ink.Dom.Selector.select * @param {String} rule Selector string * @param {DOMElement} [from] Context element. If set to a DOM element, the rule will only look for descendants of this DOM Element. * @return {DOMElement} * @sample Ink_1_s.html */ s: function(rule, from) { if(typeof(Ink.Dom) === 'undefined' || typeof(Ink.Dom.Selector) === 'undefined') { throw new Error('This method requires Ink.Dom.Selector'); } return Ink.Dom.Selector.select(rule, (from || document))[0] || null; }, /** * Extends an object with another * Copy all of the properties in one or more source objects over to the destination object, and return the destination object. It's in-order, so the last source will override properties of the same name in previous arguments. * * @method extendObj * @param {Object} destination The object that will receive the new/updated properties * @param {Object} source The object whose properties will be copied over to the destination object * @param {Object} [args*] Additional source objects. The last source will override properties of the same name in the previous defined sources * @return destination object, enriched with defaults from the sources * @sample Ink_1_extendObj.html */ extendObj: function(destination, source) { if (arguments.length > 2) { source = Ink.extendObj.apply(this, [].slice.call(arguments, 1)); } if (source) { for (var property in source) { if(Object.prototype.hasOwnProperty.call(source, property)) { destination[property] = source[property]; } } } return destination; }, /** * Calls native console.log if available. * * @method log * @param {Any} [args*] Arguments to be evaluated * @sample Ink_1_log.html **/ log: function () { // IE does not have console.log.apply in IE10 emulated mode var console = window.console; if (console && console.log) { apply.call(console.log, console, arguments); } }, /** * Calls native console.warn if available. * * @method warn * @param {Any} [args*] Arguments to be evaluated * @sample Ink_1_warn.html **/ warn: function () { // IE does not have console.log.apply in IE10 emulated mode var console = window.console; if (console && console.warn) { apply.call(console.warn, console, arguments); } }, /** * Calls native console.error if available. * * @method error * @param {Any} [args*] Arguments to be evaluated * @sample Ink_1_error.html **/ error: function () { // IE does not have console.log.apply in IE10 emulated mode var console = window.console; if (console && console.error) { apply.call(console.error, console, arguments); } } }; Ink.setPath('Ink', ('INK_PATH' in window) ? window.INK_PATH : window.location.protocol + '//js.ink.sapo.pt/Ink/'); // TODO for debug - to detect pending stuff /* var failCount = {}; // fail count per module name var maxFails = 3; // times var checkDelta = 0.5; //seconds var tmpTmr = setInterval(function() { var mk = Object.keys(modulesRequested); var l = mk.length; if (l > 0) { // console.log('** waiting for modules: ' + mk.join(', ') + ' **'); for (var i = 0, f = mk.length, k, v; i < f; ++i) { k = mk[i]; v = failCount[k]; failCount[k] = (v === undefined) ? 1 : ++v; if (v >= maxFails) { console.error('** Loading of module ' + k + ' failed! **'); delete modulesRequested[k]; } } } else { // console.log('** Module loads complete. **'); clearInterval(tmpTmr); } }, checkDelta*1000); */ }(window, document)); /** * Cross Browser Ajax requests * @module Ink.Net.Ajax_1 * @version 1 */ Ink.createModule('Ink.Net.Ajax', '1', [], function() { 'use strict'; /** * Creates a new XMLHttpRequest object * * @class Ink.Net.Ajax * @constructor * * @param {String} url Request URL * @param {Object} options Request options * @param {Boolean} [options.asynchronous]=true If false, the request synchronous. * @param {Boolean} [options.cors] Flag to activate CORS. Set this to true if you're doing a cross-origin request * @param {String} [options.method]='POST' HTTP request method. POST by default. * @param {Object|String} [options.parameters] Request parameters to be sent with the request * @param {Number} [options.timeout] Request timeout in seconds * @param {Number} [options.delay] Artificial delay. If the request is completed faster than this delay, wait the remaining time before executing the callbacks * @param {String} [options.postBody] POST request body. If not specified, it's filled with the contents from parameters * @param {String} [options.contentType] Content-type header to be sent. Defaults to 'application/x-www-form-urlencoded' * @param {Object} [options.requestHeaders] Key-value pairs for additional request headers * @param {Function} [options.onComplete] Callback executed after the request is completed, regardless of what happened during the request. * @param {Function} [options.onSuccess] Callback executed if the request is successful (requests with 2xx status codes) * @param {Function} [options.onFailure] Callback executed if the request fails (requests with status codes different from 2xx) * @param {Function} [options.onException] Callback executed if an exception occurs. Receives the exception as a parameter. * @param {Function} [options.onCreate] Callback executed after object initialization but before the request is made * @param {Function} [options.onInit] Callback executed before any initialization * @param {Function} [options.onTimeout] Callback executed if the request times out * @param {Boolean|String} [options.evalJS]=true If the request Content-type header is application/json, evaluates the response and populates responseJSON. Use 'force' if you want to force the response evaluation, no matter what Content-type it's using. * @param {Boolean} [options.sanitizeJSON] Flag to sanitize the content of responseText before evaluation * @param {String} [options.xhrProxy] URI for proxy service hosted on the same server as the web app, that can fetch documents from other domains. The service must pipe all input and output untouched (some input sanitization is allowed, like clearing cookies). e.g., requesting http://example.org/doc can become /proxy/http%3A%2F%2Fexample.org%2Fdoc The proxy service will be used for cross-domain requests, if set, else a network error is returned as exception. * * @sample Ink_Net_Ajax_1.html */ var Ajax = function(url, options){ // start of AjaxMock patch - uncomment to enable it /*var AM = SAPO.Communication.AjaxMock; if (AM && !options.inMock) { if (AM.autoRecordThisUrl && AM.autoRecordThisUrl(url)) { return new AM.Record(url, options); } if (AM.mockThisUrl && AM.mockThisUrl(url)) { return new AM.Play(url, options, true); } }*/ // end of AjaxMock patch this.init(url, options); }; /** * Options for all requests. These can then be overriden for individual ones. */ Ajax.globalOptions = { parameters: {}, requestHeaders: {} }; // IE10 does not need XDomainRequest var xMLHttpRequestWithCredentials = 'XMLHttpRequest' in window && 'withCredentials' in (new XMLHttpRequest()); Ajax.prototype = { init: function(url, userOptions) { if (!url) { throw new Error("WRONG_ARGUMENTS_ERR"); } var options = Ink.extendObj({ asynchronous: true, method: 'POST', parameters: null, timeout: 0, delay: 0, postBody: '', contentType: 'application/x-www-form-urlencoded', requestHeaders: null, onComplete: null, onSuccess: null, onFailure: null, onException: null, onHeaders: null, onCreate: null, onInit: null, onTimeout: null, sanitizeJSON: false, evalJS: true, xhrProxy: '', cors: false, debug: false, useCredentials: false, signRequest: false }, Ajax.globalOptions); if (userOptions && typeof userOptions === 'object') { options = Ink.extendObj(options, userOptions); if (typeof userOptions.parameters === 'object') { options.parameters = Ink.extendObj(Ink.extendObj({}, Ajax.globalOptions.parameters), userOptions.parameters); } else if (userOptions.parameters !== null) { var globalParameters = this.paramsObjToStr(Ajax.globalOptions.parameters); if (globalParameters) { options.parameters = userOptions.parameters + '&' + globalParameters; } } options.requestHeaders = Ink.extendObj({}, Ajax.globalOptions.requestHeaders); options.requestHeaders = Ink.extendObj(options.requestHeaders, userOptions.requestHeaders); } this.options = options; this.safeCall('onInit'); this.url = url; var urlLocation = this._locationFromURL(url); this.isHTTP = this._locationIsHTTP(urlLocation); this.isCrossDomain = this._locationIsCrossDomain(urlLocation, location); this.requestHasBody = options.method.search(/^get|head$/i) < 0; if(this.options.cors) { this.isCrossDomain = false; } this.transport = this.getTransport(); this.request(); }, /** * Returns a location object from an URL * * @method _locationFromUrl * @param url * @private **/ _locationFromURL: function (url) { var urlLocation = document.createElementNS ? document.createElementNS('http://www.w3.org/1999/xhtml', 'a') : document.createElement('a'); urlLocation.href = url; return urlLocation; }, /** * Checks whether a location is HTTP or HTTPS * * @method locationIsHttp * @param urlLocation * @private */ _locationIsHTTP: function (urlLocation) { return urlLocation.protocol.match(/^https?:/i) ? true : false; }, /** * Checks whether a location is cross-domain from another * * @method _locationIsCrossDomain * @param urlLocation {Location} * @param otherLocation {Location} */ _locationIsCrossDomain: function (urlLocation, location) { location = location || window.location; if (!Ajax.prototype._locationIsHTTP(urlLocation) || location.protocol === 'widget:' || typeof window.widget === 'object') { return false; } else { return location.protocol !== urlLocation.protocol || location.host.split(':')[0] !== urlLocation.host.split(':')[0]; } }, /** * Creates the appropriate XMLHttpRequest object * * @method getTransport * @return {Object} XMLHttpRequest object */ getTransport: function() { /*global XDomainRequest:false, ActiveXObject:false */ if (!xMLHttpRequestWithCredentials && this.options.cors && 'XDomainRequest' in window) { this.usingXDomainReq = true; return new XDomainRequest(); } else if (typeof XMLHttpRequest !== 'undefined') { return new XMLHttpRequest(); } else if (typeof ActiveXObject !== 'undefined') { try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { return new ActiveXObject('Microsoft.XMLHTTP'); } } else { return null; } }, /** * Set the necessary headers for an ajax request * * @method setHeaders * @param {String} url The url for the request */ setHeaders: function() { if (this.transport) { try { var headers = { "Accept": "text/javascript,text/xml,application/xml,application/xhtml+xml,text/html,application/json;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1", "Accept-Language": navigator.language, "X-Requested-With": "XMLHttpRequest", "X-Ink-Version": "2" }; if (this.options.cors) { if (!this.options.signRequest) { delete headers['X-Requested-With']; } delete headers['X-Ink-Version']; } if (this.options.requestHeaders && typeof this.options.requestHeaders === 'object') { for(var headerReqName in this.options.requestHeaders) { if (this.options.requestHeaders.hasOwnProperty(headerReqName)) { headers[headerReqName] = this.options.requestHeaders[headerReqName]; } } } if (this.transport.overrideMimeType && (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) { headers.Connection = 'close'; } for (var headerName in headers) { if(headers.hasOwnProperty(headerName)) { this.transport.setRequestHeader(headerName, headers[headerName]); } } } catch(e) {} } }, /** * Converts an object with parameters to a querystring * * @method paramsObjToStr * @param {Object|String} optParams parameters object * @return {String} querystring */ paramsObjToStr: function(optParams) { var k, m, p, a, params = []; if (typeof optParams === 'object') { for (p in optParams){ if (optParams.hasOwnProperty(p)) { a = optParams[p]; if (Object.prototype.toString.call(a) === '[object Array]' && !isNaN(a.length)) { for (k = 0, m = a.length; k < m; k++) { params = params.concat([ encodeURIComponent(p), '[]', '=', encodeURIComponent(a[k]), '&' ]); } } else { params = params.concat([ encodeURIComponent(p), '=', encodeURIComponent(a), '&' ]); } } } if (params.length > 0) { params.pop(); } } else { return optParams; } return params.join(''); }, /** * Set the url parameters for a GET request * * @method setParams */ setParams: function() { var params = null, optParams = this.options.parameters; if(typeof optParams === "object"){ params = this.paramsObjToStr(optParams); } else { params = '' + optParams; } if(params){ if(this.url.indexOf('?') > -1) { this.url = this.url.split('#')[0] + '&' + params; } else { this.url = this.url.split('#')[0] + '?' + params; } } }, /** * Gets an HTTP header from the response * * @method getHeader * @param {String} name Header name * @return {String} header Content */ getHeader: function(name) { if (this.usingXDomainReq && name === 'Content-Type') { return this.transport.contentType; } try{ return this.transport.getResponseHeader(name); } catch(e) { return null; } }, /** * Gets all the HTTP headers from the response * * @method getAllHeaders * @return {String} The headers, each separated by a newline */ getAllHeaders: function() { try { return this.transport.getAllResponseHeaders(); } catch(e) { return null; } }, /** * Sets the response object * * @method getResponse * @return {Object} the response object */ getResponse: function(){ // setup our own stuff var t = this.transport, r = { headerJSON: null, responseJSON: null, getHeader: this.getHeader, getAllHeaders: this.getAllHeaders, request: this, transport: t, timeTaken: new Date() - this.startTime, requestedUrl: this.url }; // setup things expected from the native object r.readyState = t.readyState; try { r.responseText = t.responseText; } catch(e) {} try { r.responseXML = t.responseXML; } catch(e) {} try { r.status = t.status; } catch(e) { r.status = 0; } try { r.statusText = t.statusText; } catch(e) { r.statusText = ''; } return r; }, /** * Aborts the request if still running. No callbacks are called * * @method abort */ abort: function(){ if (this.transport) { clearTimeout(this.delayTimeout); clearTimeout(this.stoTimeout); try { this.transport.abort(); } catch(ex) {} this.finish(); } }, /** * Executes the state changing phase of an ajax request * * @method runStateChange */ runStateChange: function() { var rs = this.transport.readyState; if (rs === 3) { if (this.isHTTP) { this.safeCall('onHeaders'); } } else if (rs === 4 || this.usingXDomainReq) { if (this.options.asynchronous && this.options.delay && (this.startTime + this.options.delay > new Date().getTime())) { this.delayTimeout = setTimeout(Ink.bind(this.runStateChange, this), this.options.delay + this.startTime - new Date().getTime()); return; } var responseJSON, responseContent = this.transport.responseText, response = this.getResponse(), curStatus = this.transport.status; if (this.isHTTP && !this.options.asynchronous) { this.safeCall('onHeaders'); } clearTimeout(this.stoTimeout); if (curStatus === 0) { // Status 0 indicates network error for http requests. // For http less requests, 0 is always returned. if (this.isHTTP) { this.safeCall('onException', this.makeError(18, 'NETWORK_ERR')); } else { curStatus = responseContent ? 200 : 404; } } else if (curStatus === 304) { curStatus = 200; } var isSuccess = this.usingXDomainReq || 200 <= curStatus && curStatus < 300; var headerContentType = this.getHeader('Content-Type') || ''; if (this.options.evalJS && (headerContentType.indexOf("application/json") >= 0 || this.options.evalJS === 'force')){ try { responseJSON = this.evalJSON(responseContent, this.sanitizeJSON); if(responseJSON){ responseContent = response.responseJSON = responseJSON; } } catch(e){ if (isSuccess) { // If the request failed, then this is perhaps an error page // so don't notify error. this.safeCall('onException', e); } } } if (this.usingXDomainReq && headerContentType.indexOf('xml') !== -1 && 'DOMParser' in window) { // http://msdn.microsoft.com/en-us/library/ie/ff975278(v=vs.85).aspx var mimeType; switch (headerContentType) { case 'application/xml': case 'application/xhtml+xml': case 'image/svg+xml': mimeType = headerContentType; break; default: mimeType = 'text/xml'; } var xmlDoc = (new DOMParser()).parseFromString( this.transport.responseText, mimeType); this.transport.responseXML = xmlDoc; response.responseXML = xmlDoc; } if (this.transport.responseXML !== null && response.responseJSON === null && this.transport.responseXML.xml !== ""){ responseContent = this.transport.responseXML; } if (curStatus || this.usingXDomainReq) { if (isSuccess) { this.safeCall('onSuccess', response, responseContent); } else { this.safeCall('onFailure', response, responseContent); } this.safeCall('on'+curStatus, response, responseContent); } this.finish(response, responseContent); } }, /** * Last step after XHR is complete. Call onComplete and cleanup object * * @method finish * @param {Any} response * @param {Any} responseContent */ finish: function(response, responseContent){ if (response) { this.safeCall('onComplete', response, responseContent); } clearTimeout(this.stoTimeout); if (this.transport) { // IE6 sometimes barfs on this one try{ this.transport.onreadystatechange = null; } catch(e){} if (typeof this.transport.destroy === 'function') { // Stuff for Samsung. this.transport.destroy(); } // Let XHR be collected. this.transport = null; } }, /** * Safely calls a callback function. * Verifies that the callback is well defined and traps errors * * @method safeCall * @param {Function} listener */ safeCall: function(listener, first/*, second*/) { function rethrow(exception){ setTimeout(function() { // Rethrow exception so it'll land in // the error console, firebug, whatever. if (exception.message) { exception.message += '\n'+(exception.stacktrace || exception.stack || ''); } throw exception; }, 1); } if (typeof this.options[listener] === 'function') { //SAPO.safeCall(this, this.options[listener], first, second); //return object[listener].apply(object, [].slice.call(arguments, 2)); try { this.options[listener].apply(this, [].slice.call(arguments, 1)); } catch(ex) { rethrow(ex); } } else if (first && window.Error && (first instanceof Error)) { rethrow(first); } }, /** * Sets a new request header for the next http request * * @method setRequestHeader * @param {String} name * @param {String} value */ setRequestHeader: function(name, value){ if (!this.options.requestHeaders) { this.options.requestHeaders = {}; } this.options.requestHeaders[name] = value; }, /** * Executes the request * * @method request */ request: function() { if(this.transport) { var params = null; if(this.requestHasBody) { if(this.options.postBody !== null && this.options.postBody !== '') { params = this.options.postBody; this.setParams(); } else if (this.options.parameters !== null && this.options.parameters !== ''){ params = this.options.parameters; } if (typeof params === "object" && !params.nodeType) { params = this.paramsObjToStr(params); } else if (typeof params !== "object" && params !== null){ params = '' + params; } if(this.options.contentType) { this.setRequestHeader('Content-Type', this.options.contentType); } } else { this.setParams(); } var url = this.url; var method = this.options.method; var crossDomain = this.isCrossDomain; if (crossDomain && this.options.xhrProxy) { this.setRequestHeader('X-Url', url); url = this.options.xhrProxy + encodeURIComponent(url); crossDomain = false; } try { this.transport.open(method, url, this.options.asynchronous); } catch(e) { this.safeCall('onException', e); return this.finish(this.getResponse(), null); } this.setHeaders(); this.safeCall('onCreate'); if(this.options.timeout && !isNaN(this.options.timeout)) { this.stoTimeout = setTimeout(Ink.bind(function() { if(this.options.onTimeout) { this.safeCall('onTimeout'); this.abort(); } }, this), (this.options.timeout * 1000)); } if(this.options.useCredentials && !this.usingXDomainReq) { this.transport.withCredentials = true; } if(this.options.asynchronous && !this.usingXDomainReq) { this.transport.onreadystatechange = Ink.bind(this.runStateChange, this); } else if (this.usingXDomainReq) { this.transport.onload = Ink.bind(this.runStateChange, this); } try { if (crossDomain) { // Need explicit handling because Mozila aborts // the script and Chrome fails silently.per the spec throw this.makeError(18, 'NETWORK_ERR'); } else { this.startTime = new Date().getTime(); this.transport.send(params); } } catch(e) { this.safeCall('onException', e); return this.finish(this.getResponse(), null); } if(!this.options.asynchronous) { this.runStateChange(); } } }, /** * Returns a new exception object that can be thrown * * @method makeError * @param code Error Code * @param message Message * @returns {Object} */ makeError: function(code, message){ if (typeof Error !== 'function') { return {code: code, message: message}; } var e = new Error(message); e.code = code; return e; }, /** * Checks if a given string is valid JSON * * @method isJSON * @param {String} str String to be evaluated * @return {Boolean} True if the string is valid JSON */ isJSON: function(str) { if (typeof str !== "string" || !str){ return false; } str = str.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''); return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); }, /** * Evaluates a given string as JSON * * @method evalJSON * @param {String} str String to be evaluated * @param {Boolean} sanitize Flag to sanitize the content * @return {Object} JSON content as an object */ evalJSON: function(strJSON, sanitize) { if (strJSON && (!sanitize || this.isJSON(strJSON))) { try { if (typeof JSON !== "undefined" && typeof JSON.parse !== 'undefined'){ return JSON.parse(strJSON); } /*jshint evil:true */ return eval('(' + strJSON + ')'); } catch(e) { throw new Error('ERROR: Bad JSON string...'); } } return null; } }; /** * Loads content from a given url through an XMLHttpRequest. * * Shortcut function for simple AJAX use cases. Works with JSON, XML and plain text. * * @method load * @param {String} url Request URL * @param {Function} callback Callback to be executed if the request is successful * @return {Object} XMLHttpRequest object * * @sample Ink_Net_Ajax_load.html */ Ajax.load = function(url, callback){ return new Ajax(url, { method: 'GET', onSuccess: function(response){ callback(response.responseJSON || response.responseText, response); } }); }; /** * Loads content from a given url through an XMLHttpRequest. * Shortcut function for simple AJAX use cases. * * @method ping * @param {String} url Request url * @param {Function} callback Callback to be executed if the request is successful * @return {Object} XMLHttpRequest object */ Ajax.ping = function(url, callback){ return new Ajax(url, { method: 'HEAD', onSuccess: function(response){ if (typeof callback === 'function'){ callback(response); } } }); }; return Ajax; }); /** * Cross Browser JsonP requests * @module Ink.Net.JsonP_1 * @version 1 */ Ink.createModule('Ink.Net.JsonP', '1', [], function() { 'use strict'; /** * Executes a JSONP request * * @class Ink.Net.JsonP * @constructor * * @param {String} uri Request URL * @param {Object} options Request options * @param {Function} options.onSuccess Success callback * @param {Function} [options.onFailure] Failure callback * @param {Object} [options.failureObj] Object to be passed as argument to failure callback * @param {Number} [options.timeout] Timeout for request fail, in seconds. defaults to 10 * @param {Object} [options.params] Object with the parameters and respective values to unfold * @param {String} [options.callbackParam] Parameter to use as callback. defaults to 'jsoncallback' * @param {String} [options.internalCallback] Name of the callback function stored in the Ink.Net.JsonP object. * @param {String} [options.randVar] (Advanced, not recommended unless you know what you're doing) A string to append to the callback name. By default, generate a random number. Use an empty string if you already passed the correct name in the internalCallback option. * * @sample Ink_Net_JsonP_1.html */ var JsonP = function(uri, options) { this.init(uri, options); }; JsonP.prototype = { init: function(uri, options) { this.options = Ink.extendObj( { onSuccess: undefined, onFailure: undefined, failureObj: {}, timeout: 10, params: {}, callbackParam: 'jsoncallback', internalCallback: '_cb', randVar: false }, options || {}); if(this.options.randVar !== false) { this.randVar = this.options.randVar; } else { this.randVar = parseInt(Math.random() * 100000, 10); } this.options.internalCallback += this.randVar; this.uri = uri; // prevent SAPO legacy onComplete - make it onSuccess if(typeof(this.options.onComplete) === 'function') { this.options.onSuccess = this.options.onComplete; } if (typeof this.uri !== 'string') { throw 'Please define an URI'; } if (typeof this.options.onSuccess !== 'function') { throw 'please define a callback function on option onSuccess!'; } Ink.Net.JsonP[this.options.internalCallback] = Ink.bind(function() { window.clearTimeout(this.timeout); delete window.Ink.Net.JsonP[this.options.internalCallback]; this._removeScriptTag(); this.options.onSuccess(arguments[0]); }, this); this._addScriptTag(); }, _addParamsToGet: function(uri, params) { var hasQuestionMark = uri.indexOf('?') !== -1; var sep, pKey, pValue, parts = [uri]; for (pKey in params) { if (params.hasOwnProperty(pKey)) { if (!hasQuestionMark) { sep = '?'; hasQuestionMark = true; } else { sep = '&'; } pValue = params[pKey]; if (typeof pValue !== 'number' && !pValue) { pValue = ''; } parts = parts.concat([sep, pKey, '=', encodeURIComponent(pValue)]); } } return parts.join(''); }, _getScriptContainer: function() { var headEls = document.getElementsByTagName('head'); if (headEls.length === 0) { var scriptEls = document.getElementsByTagName('script'); return scriptEls[0]; } return headEls[0]; }, _addScriptTag: function() { // enrich options will callback and random seed this.options.params[this.options.callbackParam] = 'Ink.Net.JsonP.' + this.options.internalCallback; this.options.params.rnd_seed = this.randVar; this.uri = this._addParamsToGet(this.uri, this.options.params); // create script tag var scriptEl = document.createElement('script'); scriptEl.type = 'text/javascript'; scriptEl.src = this.uri; var scriptCtn = this._getScriptContainer(); scriptCtn.appendChild(scriptEl); this.timeout = setTimeout(Ink.bind(this._requestFailed, this), (this.options.timeout * 1000)); }, _requestFailed : function () { delete Ink.Net.JsonP[this.options.internalCallback]; this._removeScriptTag(); if(typeof this.options.onFailure === 'function'){ this.options.onFailure(this.options.failureObj); } }, _removeScriptTag: function() { var scriptEl; var scriptEls = document.getElementsByTagName('script'); var scriptUri; for (var i = 0, f = scriptEls.length; i < f; ++i) { scriptEl = scriptEls[i]; scriptUri = scriptEl.getAttribute('src') || scriptEl.src; if (scriptUri !== null && scriptUri === this.uri) { scriptEl.parentNode.removeChild(scriptEl); return; } } } }; return JsonP; }); /** * Browser Detection and User Agent sniffing * @module Ink.Dom.Browser_1 * @version 1 */ Ink.createModule('Ink.Dom.Browser', '1', [], function() { 'use strict'; /** * @namespace Ink.Dom.Browser * @version 1 * @static * @example * <script> * Ink.requireModules(['Ink.Dom.Browser_1'],function( InkBrowser ){ * if( InkBrowser.CHROME ){ * console.log( 'This is a CHROME browser.' ); * } * }); * </script> */ var Browser = { /** * True if the browser is Internet Explorer * * @property IE * @type {Boolean} * @public * @static */ IE: false, /** * True if the browser is Gecko based * * @property GECKO * @type {Boolean} * @public * @static */ GECKO: false, /** * True if the browser is Opera * * @property OPERA * @type {Boolean} * @public * @static */ OPERA: false, /** * True if the browser is Safari * * @property SAFARI * @type {Boolean} * @public * @static */ SAFARI: false, /** * True if the browser is Konqueror * * @property KONQUEROR * @type {Boolean} * @public * @static */ KONQUEROR: false, /** * True if browser is Chrome * * @property CHROME * @type {Boolean} * @public * @static */ CHROME: false, /** * The specific browser model. * False if it is unavailable. * * @property model * @type {Boolean|String} * @public * @static */ model: false, /** * The browser version. * False if it is unavailable. * * @property version * @type {Boolean|String} * @public * @static */ version: false, /** * The user agent string. * False if it is unavailable. * * @property userAgent * @type {Boolean|String} * @public * @static */ userAgent: false, /** * The CSS prefix (-moz-, -webkit-, -ms-, ...) * False if it is unavailable * * @property cssPrefix * @type {Boolean|String} * @public * @static */ cssPrefix: false, /** * The DOM prefix (Moz, Webkit, ms, ...) * False if it is unavailable * @property domPrefix * @type {Boolean|String} * @public * @static */ domPrefix: false, /** * Initialization function for the Browser object. * * Is called automatically when this module is loaded, and calls setDimensions, setBrowser and setReferrer. * * @method init * @public */ init: function() { this.detectBrowser(); this.setDimensions(); this.setReferrer(); }, /** * Retrieves and stores window dimensions in this object. Called automatically when this module is loaded. * * @method setDimensions * @public */ setDimensions: function() { //this.windowWidth=window.innerWidth !== null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body !== null ? document.body.clientWidth : null; //this.windowHeight=window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null; var myWidth = 0, myHeight = 0; if ( typeof window.innerWidth=== 'number' ) { myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } this.windowWidth = myWidth; this.windowHeight = myHeight; }, /** * Stores the referrer. Called automatically when this module is loaded. * * @method setReferrer * @public */ setReferrer: function() { if (document.referrer && document.referrer.length) { this.referrer = window.escape(document.referrer); } else { this.referrer = false; } }, /** * Detects the browser and stores the found properties. Called automatically when this module is loaded. * * @method detectBrowser * @public */ detectBrowser: function() { this._sniffUserAgent(navigator.userAgent); }, _sniffUserAgent: function (sAgent) { this.userAgent = sAgent; sAgent = sAgent.toLowerCase(); if (/applewebkit\//.test(sAgent)) { this.cssPrefix = '-webkit-'; this.domPrefix = 'Webkit'; if(/(chrome|crios)\//.test(sAgent)) { // Chrome this.CHROME = true; this.model = 'chrome'; this.version = sAgent.replace(/(.*)chrome\/([^\s]+)(.*)/, "$2"); } else { // Safari this.SAFARI = true; this.model = 'safari'; var rVersion = /version\/([^) ]+)/; if (rVersion.test(sAgent)) { this.version = sAgent.match(rVersion)[1]; } else { this.version = sAgent.replace(/(.*)applewebkit\/([^\s]+)(.*)/, "$2"); } } } else if (/opera/.test(sAgent)) { // Opera this.OPERA = true; this.model = 'opera'; this.version = sAgent.replace(/(.*)opera.([^\s$]+)(.*)/, "$2"); this.cssPrefix = '-o-'; this.domPrefix = 'O'; } else if (/konqueror/.test(sAgent)) { // Konqueroh this.KONQUEROR = true; this.model = 'konqueror'; this.version = sAgent.replace(/(.*)konqueror\/([^;]+);(.*)/, "$2"); this.cssPrefix = '-khtml-'; this.domPrefix = 'Khtml'; } else if (/(msie|trident)/i.test(sAgent)) { // MSIE this.IE = true; this.model = 'ie'; if (/rv:((?:\d|\.)+)/.test(sAgent)) { // IE 11 this.version = sAgent.match(/rv:((?:\d|\.)+)/)[1]; } else { this.version = sAgent.replace(/(.*)\smsie\s([^;]+);(.*)/, "$2"); } this.cssPrefix = '-ms-'; this.domPrefix = 'ms'; } else if (/gecko/.test(sAgent)) { // GECKO // Supports only: // Camino, Chimera, Epiphany, Minefield (firefox 3), Firefox, Firebird, Phoenix, Galeon, // Iceweasel, K-Meleon, SeaMonkey, Netscape, Songbird, Sylera, this.cssPrefix = '-moz-'; this.domPrefix = 'Moz'; this.GECKO = true; var re = /(camino|chimera|epiphany|minefield|firefox|firebird|phoenix|galeon|iceweasel|k\-meleon|seamonkey|netscape|songbird|sylera)/; if(re.test(sAgent)) { this.model = sAgent.match(re)[1]; this.version = sAgent.replace(new RegExp("(.*)"+this.model+"\/([^;\\s$]+)(.*)"), "$2"); } else { // probably is mozilla this.model = 'mozilla'; var reVersion = /(.*)rv:([^)]+)(.*)/; if(reVersion.test(sAgent)) { this.version = sAgent.replace(reVersion, "$2"); } } } }, /** * Debug function which displays browser (and Ink.Dom.Browser) information as an alert message. * * @method debug * @public * @sample Ink_Dom_Browser_1_debug.html */ debug: function() { /*global alert:false */ var str = "known browsers: (ie, gecko, opera, safari, konqueror) \n"; str += [this.IE, this.GECKO, this.OPERA, this.SAFARI, this.KONQUEROR] +"\n"; str += "cssPrefix -> "+this.cssPrefix+"\n"; str += "domPrefix -> "+this.domPrefix+"\n"; str += "model -> "+this.model+"\n"; str += "version -> "+this.version+"\n"; str += "\n"; str += "original UA -> "+this.userAgent; alert(str); } }; Browser.init(); return Browser; }); /** * CSS Utilities and toolbox * @module Ink.Dom.Css_1 * @version 1 */ Ink.createModule( 'Ink.Dom.Css', 1, [], function() { 'use strict'; // getComputedStyle feature detection. var getCs = ("defaultView" in document) && ("getComputedStyle" in document.defaultView) ? document.defaultView.getComputedStyle : window.getComputedStyle; /** * @namespace Ink.Dom.Css * @static */ var Css = { /** * Adds of removes a class. * Depending on addRemState, this method either adds a class if it's true or removes if if false. * * @method addRemoveClassName * @param {DOMElement|string} elm DOM element or element id * @param {string} className class name to add or remove. * @param {boolean} addRemState Whether to add or remove. `true` to add, `false` to remove. * @sample Ink_Dom_Css_addRemoveClassName.html */ addRemoveClassName: function(elm, className, addRemState) { if (addRemState) { return this.addClassName(elm, className); } this.removeClassName(elm, className); }, /** * Adds a class to a given element * * @method addClassName * @param {DOMElement|String} elm DOM element or element id * @param {String|Array} className Classes * @sample Ink_Dom_Css_addClassName.html */ addClassName: function(elm, className) { elm = Ink.i(elm); if (!elm || !className) { return null; } className = ('' + className).split(/[, ]+/); var i = 0; var len = className.length; for (; i < len; i++) { if (typeof elm.classList !== "undefined") { elm.classList.add(className[i]); } else if (!Css.hasClassName(elm, className[i])) { elm.className += (elm.className ? ' ' : '') + className[i]; } } }, /** * Removes a class from a given element * * @method removeClassName * @param {DOMElement|String} elm DOM element or element id * @param {String|Array} className Class names to remove. You can either use a space separated string of classnames, comma-separated list or an array * @sample Ink_Dom_Css_removeClassName.html */ removeClassName: function(elm, className) { elm = Ink.i(elm); if (!elm || !className) { return null; } className = ('' + className).split(/[, ]+/); var i = 0; var len = className.length; if (typeof elm.classList !== "undefined"){ for (; i < len; i++) { elm.classList.remove(className[i]); } } else { var elmClassName = elm.className || ''; var re; for (; i < len; i++) { re = new RegExp("(^|\\s+)" + className[i] + "(\\s+|$)"); elmClassName = elmClassName.replace(re, ' '); } elm.className = (elmClassName .replace(/^\s+/, '') .replace(/\s+$/, '')); } }, /** * Alias to addRemoveClassName. * Utility function, saves many if/elses. * * @method setClassName * @uses addRemoveClassName * @param {DOMElement|String} elm DOM element or element id * @param {String|Array} className Class names to add\remove. Comma separated, space separated or simply an Array * @param {Boolean} [add]=false Flag to switch behavior from removal to addition. true to add, false to remove */ setClassName: function(elm, className, add) { this.addRemoveClassName(elm, className, add || false); }, /** * Checks if an element has a class. * This method verifies if an element has ONE of a list of classes. If the last argument is flagged as true, instead checks if the element has ALL the classes * * @method hasClassName * @param {DOMElement|String} elm DOM element or element id * @param {String|Array} className Class names to test * @param {Boolean} [all]=false If flagged as true, it will check if the element contains ALL the CSS classes * @return {Boolean} true if a given class is applied to a given element * @sample Ink_Dom_Css_hasClassName.html */ hasClassName: function(elm, className, all) { elm = Ink.i(elm); if (!elm || !className) { return false; } className = ('' + className).split(/[, ]+/); var i = 0; var len = className.length; var has; var re; for ( ; i < len; i++) { if (typeof elm.classList !== "undefined"){ has = elm.classList.contains(className[i]); } else { var elmClassName = elm.className; if (elmClassName === className[i]) { has = true; } else { re = new RegExp("(^|\\s)" + className[i] + "(\\s|$)"); has = re.test(elmClassName); } } if (has && !all) { return true; } // return if looking for any class if (!has && all) { return false; } // return if looking for all classes } if (all) { // if we got here, all classes were found so far return true; } else { // if we got here with all == false, no class was found return false; } }, /** * Blinks a class from an element * Add and removes the class from the element with a timeout, so it blinks * * @method blinkClass * @uses addRemoveClassName * @param {DOMElement|String} elm DOM element or element id * @param {String|Array} className Class name(s) to blink * @param {Number} timeout timeout in ms between adding and removing, default 100 ms * @param {Boolean} negate is true, class is removed then added * @sample Ink_Dom_Css_blinkClass.html */ blinkClass: function(element, className, timeout, negate){ element = Ink.i(element); Css.addRemoveClassName(element, className, !negate); setTimeout(function() { Css.addRemoveClassName(element, className, negate); }, Number(timeout) || 100); }, /** * Toggles a class name from a given element * * @method toggleClassName * @param {DOMElement|String} elm DOM element or element id * @param {String} className Class name * @param {Boolean} [forceAdd] Flag to force adding the the classe names if they don't exist yet. * @sample Ink_Dom_Css_toggleClassName.html */ toggleClassName: function(elm, className, forceAdd) { if (elm && className){ if (typeof elm.classList !== "undefined" && !/[, ]/.test(className)){ elm = Ink.i(elm); if (elm !== null){ elm.classList.toggle(className); } return true; } } if (typeof forceAdd !== 'undefined') { if (forceAdd === true) { Css.addClassName(elm, className); } else if (forceAdd === false) { Css.removeClassName(elm, className); } } else { if (Css.hasClassName(elm, className)) { Css.removeClassName(elm, className); } else { Css.addClassName(elm, className); } } }, /** * Sets the opacity of given element * * @method setOpacity * @param {DOMElement|String} elm DOM element or element id * @param {Number} value allows 0 to 1(default mode decimal) or percentage (warning using 0 or 1 will reset to default mode) * @sample Ink_Dom_Css_setOpacity.html */ setOpacity: function(elm, value) { elm = Ink.i(elm); if (elm !== null){ var val = 1; if (!isNaN(Number(value))){ if (value <= 0) { val = 0; } else if (value <= 1) { val = value; } else if (value <= 100) { val = value / 100; } else { val = 1; } } if (typeof elm.style.opacity !== 'undefined') { elm.style.opacity = val; } else { elm.style.filter = "alpha(opacity:"+(val*100|0)+")"; } } }, /** * Converts a css property name to a string in camelcase to be used with CSSStyleDeclaration. * @method _camelCase * @private * @param {String} str String to convert * @return {String} Converted string */ _camelCase: function(str) { return str ? str.replace(/-(\w)/g, function (_, $1) { return $1.toUpperCase(); }) : str; }, /** * Gets the value for an element's style attribute * * @method getStyle * @param {DOMElement|String} elm DOM element or element id * @param {String} style Which css attribute to fetch * @return Style value * @sample Ink_Dom_Css_getStyle.html */ getStyle: function(elm, style) { elm = Ink.i(elm); if (elm !== null && elm.style) { style = style === 'float' ? 'cssFloat': this._camelCase(style); var value = elm.style[style]; if (getCs && (!value || value === 'auto')) { var css = getCs(elm, null); value = css ? css[style] : null; } else if (!value && elm.currentStyle) { value = elm.currentStyle[style]; if (value === 'auto' && (style === 'width' || style === 'height')) { value = elm["offset" + style.charAt(0).toUpperCase() + style.slice(1)] + "px"; } } if (style === 'opacity') { return value ? parseFloat(value, 10) : 1.0; } else if (style === 'borderTopWidth' || style === 'borderBottomWidth' || style === 'borderRightWidth' || style === 'borderLeftWidth' ) { if (value === 'thin') { return '1px'; } else if (value === 'medium') { return '3px'; } else if (value === 'thick') { return '5px'; } } return value === 'auto' ? null : value; } }, /** * Adds CSS rules to an element's style attribute. * * @method setStyle * @param {DOMElement|String} elm DOM element or element id * @param {String} style Which css attribute to set * @sample Ink_Dom_Css_setStyle.html */ setStyle: function(elm, style) { elm = Ink.i(elm); if (elm === null) { return; } if (typeof style === 'string') { elm.style.cssText += '; '+style; if (style.indexOf('opacity') !== -1) { this.setOpacity(elm, style.match(/opacity:\s*(\d?\.?\d*)/)[1]); } } else { for (var prop in style) { if (style.hasOwnProperty(prop)){ if (prop === 'opacity') { this.setOpacity(elm, style[prop]); } else if (prop === 'float' || prop === 'cssFloat') { if (typeof elm.style.styleFloat === 'undefined') { elm.style.cssFloat = style[prop]; } else { elm.style.styleFloat = style[prop]; } } else { elm.style[prop] = style[prop]; } } } } }, /** * Shows an element. * Internally it unsets the display property of an element. You can force a specific display property using forceDisplayProperty * * @method show * @param {DOMElement|String} elm DOM element or element id * @param {String} [forceDisplayProperty] Css display property to apply on show * @sample Ink_Dom_Css_show.html */ show: function(elm, forceDisplayProperty) { elm = Ink.i(elm); if (elm !== null) { elm.style.display = (forceDisplayProperty) ? forceDisplayProperty : ''; } }, /** * Hides an element. * * @method hide * @param {DOMElement|String} elm DOM element or element id * @sample Ink_Dom_Css_hide.html */ hide: function(elm) { elm = Ink.i(elm); if (elm !== null) { elm.style.display = 'none'; } }, /** * Shows or hides an element. * If the show parameter is true, it shows the element. Otherwise, hides it. * * @method showHide * @param {DOMElement|String} elm DOM element or element id * @param {boolean} [show]=false Whether to show or hide `elm`. * @sample Ink_Dom_Css_showHide.html */ showHide: function(elm, show) { elm = Ink.i(elm); if (elm) { elm.style.display = show ? '' : 'none'; } }, /** * Toggles an element visibility. * * @method toggle * @param {DOMElement|String} elm DOM element or element id * @param {Boolean} forceShow Forces showing if element is hidden * @sample Ink_Dom_Css_toggle.html */ toggle: function(elm, forceShow) { elm = Ink.i(elm); if (elm !== null) { if (typeof forceShow !== 'undefined') { if (forceShow === true) { this.show(elm); } else { this.hide(elm); } } else { if (this.getStyle(elm,'display').toLowerCase() === 'none') { this.show(elm); } else { this.hide(elm); } } } }, _getRefTag: function(head){ if (head.firstElementChild) { return head.firstElementChild; } for (var child = head.firstChild; child; child = child.nextSibling){ if (child.nodeType === 1){ return child; } } return null; }, /** * Injects style tags with rules to the page. * * @method appendStyleTag * @param {String} selector The css selector for the rule * @param {String} style The content of the style rule * @param {Object} options Options for the tag * @param {String} [options.type]='text/css' File type * @param {Boolean} [options.force]=false If true, the style tag will be appended to end of head * * @sample Ink_Dom_Css_appendStyleTag.html */ appendStyleTag: function(selector, style, options){ options = Ink.extendObj({ type: 'text/css', force: false }, options || {}); var styles = document.getElementsByTagName("style"), oldStyle = false, setStyle = true, i, l; for (i=0, l=styles.length; i<l; i++) { oldStyle = styles[i].innerHTML; if (oldStyle.indexOf(selector) >= 0) { setStyle = false; } } if (setStyle) { var defStyle = document.createElement("style"), head = document.getElementsByTagName("head")[0], refTag = false, styleStr = ''; defStyle.type = options.type; styleStr += selector +" {"; styleStr += style; styleStr += "} "; if (typeof defStyle.styleSheet !== "undefined") { defStyle.styleSheet.cssText = styleStr; } else { defStyle.appendChild(document.createTextNode(styleStr)); } if (options.force){ head.appendChild(defStyle); } else { refTag = this._getRefTag(head); if (refTag){ head.insertBefore(defStyle, refTag); } } } }, /** * Injects an external link tag. * This method add a stylesheet to the head of a page * * @method appendStylesheet * @param {String} path File path * @param {Object} options Options for the tag * @param {String} [options.media]='screen' Media type * @param {String} [options.type]='text/css' File type * @param {Boolean} [options.force]=false If true, tag will be appended to end of head * @sample Ink_Dom_Css_appendStylesheet.html */ appendStylesheet: function(path, options){ options = Ink.extendObj({ media: 'screen', type: 'text/css', force: false }, options || {}); var refTag, style = document.createElement("link"), head = document.getElementsByTagName("head")[0]; style.media = options.media; style.type = options.type; style.href = path; style.rel = "Stylesheet"; if (options.force){ head.appendChild(style); } else { refTag = this._getRefTag(head); if (refTag){ head.insertBefore(style, refTag); } } }, /** * Injects an external link tag. * Loads CSS via LINK element inclusion in HEAD (skips append if already there) * * Works similarly to appendStylesheet but: * supports optional callback which gets invoked once the CSS has been applied * * @method appendStylesheetCb * @param {String} cssURI URI of the CSS to load, if empty ignores and just calls back directly * @param {Function(cssURI)} [callback] optional callback which will be called once the CSS is loaded * @sample Ink_Dom_Css_appendStylesheetCb.html */ _loadingCSSFiles: {}, _loadedCSSFiles: {}, appendStylesheetCb: function(url, callback) { if (!url) { return callback(url); } if (this._loadedCSSFiles[url]) { return callback(url); } var cbs = this._loadingCSSFiles[url]; if (cbs) { return cbs.push(callback); } this._loadingCSSFiles[url] = [callback]; var linkEl = document.createElement('link'); linkEl.type = 'text/css'; linkEl.rel = 'stylesheet'; linkEl.href = url; var headEl = document.getElementsByTagName('head')[0]; headEl.appendChild(linkEl); var imgEl = document.createElement('img'); /* var _self = this; (function(_url) { imgEl.onerror = function() { //var url = this; var url = _url; _self._loadedCSSFiles[url] = true; var callbacks = _self._loadingCSSFiles[url]; for (var i = 0, f = callbacks.length; i < f; ++i) { callbacks[i](url); } delete _self._loadingCSSFiles[url]; }; })(url); */ imgEl.onerror = Ink.bindEvent(function(event, _url) { //var url = this; var url = _url; this._loadedCSSFiles[url] = true; var callbacks = this._loadingCSSFiles[url]; for (var i = 0, f = callbacks.length; i < f; ++i) { callbacks[i](url); } delete this._loadingCSSFiles[url]; }, this, url); imgEl.src = url; }, /** * Converts decimal to hexadecimal values * Useful to convert colors to their hexadecimal representation. * * @method decToHex * @param {String} dec Either a single decimal value, an rgb(r, g, b) string or an Object with r, g and b properties * @return {String} Hexadecimal value * @sample Ink_Dom_Css_decToHex.html */ decToHex: function(dec) { var normalizeTo2 = function(val) { if (val.length === 1) { val = '0' + val; } val = val.toUpperCase(); return val; }; if (typeof dec === 'object') { var rDec = normalizeTo2(parseInt(dec.r, 10).toString(16)); var gDec = normalizeTo2(parseInt(dec.g, 10).toString(16)); var bDec = normalizeTo2(parseInt(dec.b, 10).toString(16)); return rDec+gDec+bDec; } else { dec += ''; var rgb = dec.match(/\((\d+),\s?(\d+),\s?(\d+)\)/); if (rgb !== null) { return normalizeTo2(parseInt(rgb[1], 10).toString(16)) + normalizeTo2(parseInt(rgb[2], 10).toString(16)) + normalizeTo2(parseInt(rgb[3], 10).toString(16)); } else { return normalizeTo2(parseInt(dec, 10).toString(16)); } } }, /** * Converts hexadecimal values to decimal * Useful to use with CSS colors * * @method hexToDec * @param {String} hex hexadecimal Value with 6, 3, 2 or 1 characters * @return {Number} Object with properties r, g, b if length of number is >= 3 or decimal value instead. * @sample Ink_Dom_Css_hexToDec.html */ hexToDec: function(hex){ if (hex.indexOf('#') === 0) { hex = hex.substr(1); } if (hex.length === 6) { // will return object RGB return { r: parseInt(hex.substr(0,2), 16), g: parseInt(hex.substr(2,2), 16), b: parseInt(hex.substr(4,2), 16) }; } else if (hex.length === 3) { // will return object RGB return { r: parseInt(hex.charAt(0) + hex.charAt(0), 16), g: parseInt(hex.charAt(1) + hex.charAt(1), 16), b: parseInt(hex.charAt(2) + hex.charAt(2), 16) }; } else if (hex.length <= 2) { // will return int return parseInt(hex, 16); } }, /** * Get a single property from a stylesheet. * Use this to obtain the value of a CSS property (searched from loaded CSS documents) * * @method getPropertyFromStylesheet * @param {String} selector a CSS rule. must be an exact match * @param {String} property a CSS property * @return {String} value of the found property, or null if it wasn't matched */ getPropertyFromStylesheet: function(selector, property) { var rule = this.getRuleFromStylesheet(selector); if (rule) { return rule.style[property]; } return null; }, getPropertyFromStylesheet2: function(selector, property) { var rules = this.getRulesFromStylesheet(selector); /* rules.forEach(function(rule) { var x = rule.style[property]; if (x !== null && x !== undefined) { return x; } }); */ var x; for(var i=0, t=rules.length; i < t; i++) { x = rules[i].style[property]; if (x !== null && x !== undefined) { return x; } } return null; }, getRuleFromStylesheet: function(selector) { var sheet, rules, ri, rf, rule; var s = document.styleSheets; if (!s) { return null; } for (var si = 0, sf = document.styleSheets.length; si < sf; ++si) { sheet = document.styleSheets[si]; rules = sheet.rules ? sheet.rules : sheet.cssRules; if (!rules) { return null; } for (ri = 0, rf = rules.length; ri < rf; ++ri) { rule = rules[ri]; if (!rule.selectorText) { continue; } if (rule.selectorText === selector) { return rule; } } } return null; }, getRulesFromStylesheet: function(selector) { var res = []; var sheet, rules, ri, rf, rule; var s = document.styleSheets; if (!s) { return res; } for (var si = 0, sf = document.styleSheets.length; si < sf; ++si) { sheet = document.styleSheets[si]; rules = sheet.rules ? sheet.rules : sheet.cssRules; if (!rules) { return null; } for (ri = 0, rf = rules.length; ri < rf; ++ri) { rule = rules[ri]; if (!rule.selectorText) { continue; } if (rule.selectorText === selector) { res.push(rule); } } } return res; }, getPropertiesFromRule: function(selector) { var rule = this.getRuleFromStylesheet(selector); var props = {}; var prop, i, f; /*if (typeof rule.style.length === 'snumber') { for (i = 0, f = rule.style.length; i < f; ++i) { prop = this._camelCase( rule.style[i] ); props[prop] = rule.style[prop]; } } else { // HANDLES IE 8, FIREFOX RULE JOINING... */ rule = rule.style.cssText; var parts = rule.split(';'); var steps, val, pre, pos; for (i = 0, f = parts.length; i < f; ++i) { if (parts[i].charAt(0) === ' ') { parts[i] = parts[i].substring(1); } steps = parts[i].split(':'); prop = this._camelCase( steps[0].toLowerCase() ); val = steps[1]; if (val) { val = val.substring(1); if (prop === 'padding' || prop === 'margin' || prop === 'borderWidth') { if (prop === 'borderWidth') { pre = 'border'; pos = 'Width'; } else { pre = prop; pos = ''; } if (val.indexOf(' ') !== -1) { val = val.split(' '); props[pre + 'Top' + pos] = val[0]; props[pre + 'Bottom'+ pos] = val[0]; props[pre + 'Left' + pos] = val[1]; props[pre + 'Right' + pos] = val[1]; } else { props[pre + 'Top' + pos] = val; props[pre + 'Bottom'+ pos] = val; props[pre + 'Left' + pos] = val; props[pre + 'Right' + pos] = val; } } else if (prop === 'borderRadius') { if (val.indexOf(' ') !== -1) { val = val.split(' '); props.borderTopLeftRadius = val[0]; props.borderBottomRightRadius = val[0]; props.borderTopRightRadius = val[1]; props.borderBottomLeftRadius = val[1]; } else { props.borderTopLeftRadius = val; props.borderTopRightRadius = val; props.borderBottomLeftRadius = val; props.borderBottomRightRadius = val; } } else { props[prop] = val; } } } //} //console.log(props); return props; }, /** * Change the font size of elements. * Changes the font size of the elements which match the given CSS rule * For this function to work, the CSS file must be in the same domain than the host page, otherwise JS can't access it. * * @method changeFontSize * @param {String} selector CSS selector rule * @param {Number} delta Number of pixels to change on font-size * @param {String} [op] Supported operations are '+' and '*'. defaults to '+' * @param {Number} [minVal] If result gets smaller than minVal, change does not occurr * @param {Number} [maxVal] If result gets bigger than maxVal, change does not occurr */ changeFontSize: function(selector, delta, op, minVal, maxVal) { var that = this; Ink.requireModules(['Ink.Dom.Selector_1'], function(Selector) { var e; if (typeof selector !== 'string') { e = '1st argument must be a CSS selector rule.'; } else if (typeof delta !== 'number') { e = '2nd argument must be a number.'; } else if (op !== undefined && op !== '+' && op !== '*') { e = '3rd argument must be one of "+", "*".'; } else if (minVal !== undefined && (typeof minVal !== 'number' || minVal <= 0)) { e = '4th argument must be a positive number.'; } else if (maxVal !== undefined && (typeof maxVal !== 'number' || maxVal < maxVal)) { e = '5th argument must be a positive number greater than minValue.'; } if (e) { throw new TypeError(e); } var val, el, els = Selector.select(selector); if (minVal === undefined) { minVal = 1; } op = (op === '*') ? function(a,b){return a*b;} : function(a,b){return a+b;}; for (var i = 0, f = els.length; i < f; ++i) { el = els[i]; val = parseFloat( that.getStyle(el, 'fontSize')); val = op(val, delta); if (val < minVal) { continue; } if (typeof maxVal === 'number' && val > maxVal) { continue; } el.style.fontSize = val + 'px'; } }); } }; return Css; }); /** * DOM Traversal and manipulation * @module Ink.Dom.Element_1 * @version 1 */ Ink.createModule('Ink.Dom.Element', 1, [], function() { 'use strict'; var createContextualFragmentSupport = ( typeof document.createRange === 'function' && typeof window.Range.prototype.createContextualFragment === 'function'); var deleteThisTbodyToken = 'Ink.Dom.Element tbody: ' + Math.random(); var browserCreatesTbodies = (function () { var div = document.createElement('div'); div.innerHTML = '<table>'; return div.getElementsByTagName('tbody').length !== 0; }()); function rect(elem){ var dimensions = {}; try { dimensions = elem.getBoundingClientRect(); } catch(e){ dimensions = { top: elem.offsetTop, left: elem.offsetLeft }; } return dimensions; } /** * @namespace Ink.Dom.Element_1 */ var InkElement = { /** * Shortcut for `document.getElementById` * * @method get * @param {String|DOMElement} elm Either an ID of an element, or an element. * @return {DOMElement|null} The DOM element with the given id or null when it was not found * @sample Ink_Dom_Element_1_get.html */ get: function(elm) { if(typeof elm !== 'undefined') { if(typeof elm === 'string') { return document.getElementById(elm); } return elm; } return null; }, /** * Creates a DOM element * * @method create * @param {String} tag tag name * @param {Object} properties object with properties to be set on the element. You can also call other functions in Ink.Dom.Element like this * @sample Ink_Dom_Element_1_create.html */ create: function(tag, properties) { var el = document.createElement(tag); //Ink.extendObj(el, properties); for(var property in properties) { if(properties.hasOwnProperty(property)) { if (property in InkElement) { InkElement[property](el, properties[property]); } else { if(property === 'className' || property === 'class') { el.className = properties.className || properties['class']; } else { el.setAttribute(property, properties[property]); } } } } return el; }, /** * Removes a DOM Element * * @method remove * @param {DOMElement} elm The element to remove * @sample Ink_Dom_Element_1_remove.html */ remove: function(el) { el = Ink.i(el); var parEl; if (el && (parEl = el.parentNode)) { parEl.removeChild(el); } }, /** * Scrolls the window to an element * * @method scrollTo * @param {DOMElement|String} elm Element where to scroll * @sample Ink_Dom_Element_1_scrollTo.html */ scrollTo: function(elm) { elm = InkElement.get(elm); if(elm) { if (elm.scrollIntoView) { return elm.scrollIntoView(); } var elmOffset = {}, elmTop = 0, elmLeft = 0; do { elmTop += elm.offsetTop || 0; elmLeft += elm.offsetLeft || 0; elm = elm.offsetParent; } while(elm); elmOffset = {x: elmLeft, y: elmTop}; window.scrollTo(elmOffset.x, elmOffset.y); } }, /** * Gets the top offset of an element * * @method offsetTop * @uses Ink.Dom.Browser * * @param {DOMElement|String} elm Target element * @return {Number} Offset from the target element to the top of the document * @sample Ink_Dom_Element_1_offsetTop.html */ offsetTop: function(elm) { return InkElement.offset(elm)[1]; }, /** * Gets the left offset of an element * * @method offsetLeft * @uses Ink.Dom.Browser * * @param {DOMElement|String} elm Target element * @return {Number} Offset from the target element to the left of the document * @sample Ink_Dom_Element_1_offsetLeft.html */ offsetLeft: function(elm) { return InkElement.offset(elm)[0]; }, /** * Gets the relative offset of an element * * @method positionedOffset * @param {DOMElement|String} elm Target element * @return {Array} Array with the element offsetleft and offsettop relative to the closest positioned ancestor * @sample Ink_Dom_Element_1_positionedOffset.html */ positionedOffset: function(element) { var valueTop = 0, valueLeft = 0; element = InkElement.get(element); do { valueTop += element.offsetTop || 0; valueLeft += element.offsetLeft || 0; element = element.offsetParent; if (element) { if (element.tagName.toLowerCase() === 'body') { break; } var value = element.style.position; if (!value && element.currentStyle) { value = element.currentStyle.position; } if ((!value || value === 'auto') && typeof getComputedStyle !== 'undefined') { var css = getComputedStyle(element, null); value = css ? css.position : null; } if (value === 'relative' || value === 'absolute') { break; } } } while (element); return [valueLeft, valueTop]; }, /** * Gets the cumulative offset for an element * * Returns the top left position of the element on the page * * @method offset * @uses Ink.Dom.Browser * * @method offset * @param {DOMElement|String} elm Target element * @return {[Number, Number]} Array with pixel distance from the target element to the top left corner of the document * @sample Ink_Dom_Element_1_offset.html */ offset: function(el) { /*jshint boss:true */ el = Ink.i(el); var res = [0, 0]; var doc = el.ownerDocument, docElem = doc.documentElement, box = rect(el), body = doc.body, clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, scrollTop = doc.pageYOffset || docElem.scrollTop || body.scrollTop, scrollLeft = doc.pageXOffset || docElem.scrollLeft || body.scrollLeft, top = box.top + scrollTop - clientTop, left = box.left + scrollLeft - clientLeft; res = [left, top]; return res; }, /** * Gets the scroll of the element * * @method scroll * @param {DOMElement|String} [elm] Target element or document.body * @returns {Array} offset values for x and y scroll * @sample Ink_Dom_Element_1_scroll.html */ scroll: function(elm) { elm = elm ? Ink.i(elm) : document.body; return [ ( ( !window.pageXOffset ) ? elm.scrollLeft : window.pageXOffset ), ( ( !window.pageYOffset ) ? elm.scrollTop : window.pageYOffset ) ]; }, _getPropPx: function(cs, prop) { var n, c; var val = cs.getPropertyValue ? cs.getPropertyValue(prop) : cs[prop]; if (!val) { n = 0; } else { c = val.indexOf('px'); if (c === -1) { n = 0; } else { n = parseFloat(val, 10); } } //console.log([prop, ' "', val, '" ', n].join('')); return n; }, /** * Alias for offset() * * @method offset2 * @deprecated Kept for historic reasons. Use offset() instead. */ offset2: function(el) { return InkElement.offset(el); }, /** * Checks if an element has an attribute * * @method hasAttribute * @param {Object} elm Target element * @param {String} attr Attribute name * @return {Boolean} Boolean based on existance of attribute * @sample Ink_Dom_Element_1_hasAttribute.html */ hasAttribute: function(elm, attr){ elm = Ink.i(elm); return elm.hasAttribute ? elm.hasAttribute(attr) : !!elm.getAttribute(attr); }, /** * Inserts an element right after another * * @method insertAfter * @param {DOMElement} newElm Element to be inserted * @param {DOMElement|String} targetElm Key element * @sample Ink_Dom_Element_1_insertAfter.html */ insertAfter: function(newElm, targetElm) { /*jshint boss:true */ if (targetElm = InkElement.get(targetElm)) { if (targetElm.nextSibling !== null) { targetElm.parentNode.insertBefore(newElm, targetElm.nextSibling); } else { targetElm.parentNode.appendChild(newElm); } } }, /** * Inserts an element before another * * @method insertBefore * @param {DOMElement} newElm Element to be inserted * @param {DOMElement|String} targetElm Key element * @sample Ink_Dom_Element_1_insertBefore.html */ insertBefore: function (newElm, targetElm) { /*jshint boss:true */ if ( (targetElm = InkElement.get(targetElm)) ) { targetElm.parentNode.insertBefore(newElm, targetElm); } }, /** * Inserts an element as the first child of another * * @method insertTop * @param {DOMElement} newElm Element to be inserted * @param {DOMElement|String} targetElm Key element * @sample Ink_Dom_Element_1_insertTop.html */ insertTop: function(newElm,targetElm) { /*jshint boss:true */ if (targetElm = InkElement.get(targetElm)) { if (targetElm.firstChild) { targetElm.insertBefore(newElm, targetElm.firstChild); } else { targetElm.appendChild(newElm); } } }, /** * Inserts an element as the last child of another * * @method insertBottom * @param {DOMElement} newElm Element to be inserted * @param {DOMElement|String} targetElm Key element * @sample Ink_Dom_Element_1_insertBottom.html */ insertBottom: function(newElm, targetElm) { /*jshint boss:true */ targetElm = Ink.i(targetElm); targetElm.appendChild(newElm); }, /** * Retrieves textContent from node * * @method textContent * @param {DOMNode} node Where to retreive text from. Can be any node type. * @return {String} the text * @sample Ink_Dom_Element_1_textContent.html */ textContent: function(node){ node = Ink.i(node); var text, k, cs, m; switch(node && node.nodeType) { case 9: /*DOCUMENT_NODE*/ // IE quirks mode does not have documentElement return InkElement.textContent(node.documentElement || node.body && node.body.parentNode || node.body); case 1: /*ELEMENT_NODE*/ text = node.innerText; if (typeof text !== 'undefined') { return text; } /* falls through */ case 11: /*DOCUMENT_FRAGMENT_NODE*/ text = node.textContent; if (typeof text !== 'undefined') { return text; } if (node.firstChild === node.lastChild) { // Common case: 0 or 1 children return InkElement.textContent(node.firstChild); } text = []; cs = node.childNodes; for (k = 0, m = cs.length; k < m; ++k) { text.push( InkElement.textContent( cs[k] ) ); } return text.join(''); case 3: /*TEXT_NODE*/ case 4: /*CDATA_SECTION_NODE*/ return node.nodeValue; } return ''; }, /** * Replaces text content of a DOM Node * This method removes any child node previously present * * @method setTextContent * @param {DOMNode} node node Target node where the text will be added. * @param {String} text text Text to be added on the node. * @sample Ink_Dom_Element_1_setTextContent.html */ setTextContent: function(node, text){ node = Ink.i(node); switch(node && node.nodeType) { case 1: /*ELEMENT_NODE*/ if ('innerText' in node) { node.innerText = text; break; } /* falls through */ case 11: /*DOCUMENT_FRAGMENT_NODE*/ if ('textContent' in node) { node.textContent = text; break; } /* falls through */ case 9: /*DOCUMENT_NODE*/ while(node.firstChild) { node.removeChild(node.firstChild); } if (text !== '') { var doc = node.ownerDocument || node; node.appendChild(doc.createTextNode(text)); } break; case 3: /*TEXT_NODE*/ case 4: /*CDATA_SECTION_NODE*/ node.nodeValue = text; break; } }, /** * Checks if an element is a link * * @method isLink * @param {DOMNode} node Node to check if it's link * @return {Boolean} * @sample Ink_Dom_Element_1_isLink.html */ isLink: function(element){ var b = element && element.nodeType === 1 && ((/^a|area$/i).test(element.tagName) || element.hasAttributeNS && element.hasAttributeNS('http://www.w3.org/1999/xlink','href')); return !!b; }, /** * Checks if a node is an ancestor of another * * @method isAncestorOf * @param {DOMNode} ancestor Ancestor node * @param {DOMNode} node Descendant node * @return {Boolean} * @sample Ink_Dom_Element_1_isAncestorOf.html */ isAncestorOf: function(ancestor, node){ /*jshint boss:true */ if (!node || !ancestor) { return false; } if (node.compareDocumentPosition) { return (ancestor.compareDocumentPosition(node) & 0x10) !== 0;/*Node.DOCUMENT_POSITION_CONTAINED_BY*/ } while (node = node.parentNode){ if (node === ancestor){ return true; } } return false; }, /** * Checks if a node is descendant of another * * @method descendantOf * @param {DOMNode} node The ancestor * @param {DOMNode} descendant The descendant * @return {Boolean} true if 'descendant' is descendant of 'node' * @sample Ink_Dom_Element_1_descendantOf.html */ descendantOf: function(node, descendant){ return node !== descendant && InkElement.isAncestorOf(node, descendant); }, /** * Get first child element of another * @method firstElementChild * @param {DOMElement} elm Parent node * @return {DOMElement} the Element child * @sample Ink_Dom_Element_1_firstElementChild.html */ firstElementChild: function(elm){ if(!elm) { return null; } if ('firstElementChild' in elm) { return elm.firstElementChild; } var child = elm.firstChild; while(child && child.nodeType !== 1) { child = child.nextSibling; } return child; }, /** * Get the last child element of another * @method lastElementChild * @param {DOMElement} elm Parent node * @return {DOMElement} the Element child * @sample Ink_Dom_Element_1_lastElementChild.html */ lastElementChild: function(elm){ if(!elm) { return null; } if ('lastElementChild' in elm) { return elm.lastElementChild; } var child = elm.lastChild; while(child && child.nodeType !== 1) { child = child.previousSibling; } return child; }, /** * Get the first sibling element after the node * * @method nextElementSibling * @param {DOMNode} node The current node * @return {DOMElement|Null} The first sibling element after node or null if none is found * @sample Ink_Dom_Element_1_nextElementSibling.html */ nextElementSibling: function(node){ var sibling = null; if(!node){ return sibling; } if("nextElementSibling" in node){ return node.nextElementSibling; } else { sibling = node.nextSibling; // 1 === Node.ELEMENT_NODE while(sibling && sibling.nodeType !== 1){ sibling = sibling.nextSibling; } return sibling; } }, /** * Get the first sibling element before the node * * @method previousElementSibling * @param {DOMNode} node The current node * @return {DOMElement|Null} The first element sibling before node or null if none is found * @sample Ink_Dom_Element_1_previousElementSibling.html */ previousElementSibling: function(node){ var sibling = null; if(!node){ return sibling; } if("previousElementSibling" in node){ return node.previousElementSibling; } else { sibling = node.previousSibling; // 1 === Node.ELEMENT_NODE while(sibling && sibling.nodeType !== 1){ sibling = sibling.previousSibling; } return sibling; } }, /** * Get an element's width in pixels. * * @method elementWidth * @param {DOMElement|String} element Target DOM element or target ID * @return {Number} The element's width * @sample Ink_Dom_Element_1_elementWidth.html */ elementWidth: function(element) { if(typeof element === "string") { element = document.getElementById(element); } return element.offsetWidth; }, /** * Get an element's height in pixels. * * @method elementHeight * @param {DOMElement|String} element DOM element or target ID * @return {Number} The element's height * @sample Ink_Dom_Element_1_elementHeight.html */ elementHeight: function(element) { if(typeof element === "string") { element = document.getElementById(element); } return element.offsetHeight; }, /** * Deprecated. Alias for offsetLeft() * * @method elementLeft * @param {DOMElement|String} element DOM element or target ID * @return {Number} Element's left position */ elementLeft: function(element) { return InkElement.offsetLeft(element); }, /** * Deprecated. Alias for offsetTop() * * @method elementTop * @param {DOMElement|string} element Target DOM element or target ID * @return {Number} element's top position */ elementTop: function(element) { return InkElement.offsetTop(element); }, /** * Get an element's dimensions in pixels. * * @method elementDimensions * @param {DOMElement|string} element DOM element or target ID * @return {Array} Array with element's width and height * @sample Ink_Dom_Element_1_elementDimensions.html */ elementDimensions: function(element) { element = Ink.i(element); return [element.offsetWidth, element.offsetHeight]; }, /** * Get the outer dimensions of an element in pixels. * * @method outerDimensions * @uses Ink.Dom.Css * * @param {DOMElement} element Target element * @return {Array} Array with element width and height. * @sample Ink_Dom_Element_1_outerDimensions.html */ outerDimensions: function (element) { var bbox = rect(element); var Css = Ink.getModule('Ink.Dom.Css_1'); var getStyle = Ink.bindMethod(Css, 'getStyle', element); return [ bbox.right - bbox.left + parseFloat(getStyle('marginLeft') || 0) + parseFloat(getStyle('marginRight') || 0), // w bbox.bottom - bbox.top + parseFloat(getStyle('marginTop') || 0) + parseFloat(getStyle('marginBottom') || 0) // h ]; }, /** * Check if an element is inside the viewport * * @method inViewport * @param {DOMElement} element DOM Element * @param {Object} [options] Options object. If you pass a Boolean value here, it is interpreted as `options.partial` * @param {Boolean} [options.partial]=false Return `true` even if it is only partially visible. * @param {Number} [options.margin]=0 Consider a margin all around the viewport with `opts.margin` width a dead zone. * @return {Boolean} * @sample Ink_Dom_Element_1_inViewport.html */ inViewport: function (element, opts) { var dims = rect(Ink.i(element)); if (typeof opts === 'boolean') { opts = {partial: opts, margin: 0}; } opts = Ink.extendObj({ partial: false, margin: 0}, opts || {}); if (opts.partial) { return dims.bottom + opts.margin > 0 && // from the top dims.left - opts.margin < InkElement.viewportWidth() && // from the right dims.top - opts.margin < InkElement.viewportHeight() && // from the bottom dims.right + opts.margin > 0; // from the left } else { return dims.top + opts.margin > 0 && // from the top dims.right - opts.margin < InkElement.viewportWidth() && // from the right dims.bottom - opts.margin < InkElement.viewportHeight() && // from the bottom dims.left + opts.margin > 0; // from the left } }, /** * Check if an element is hidden. * Taken from Mootools Element extras ( https://gist.github.com/cheeaun/73342 ) * Does not take into account visibility:hidden * @method isHidden * @param {DOMElement} element Element to check * @return {Boolean} * @sample Ink_Dom_Element_1_isHidden.html */ isHidden: function (element) { var w = element.offsetWidth, h = element.offsetHeight, force = (element.tagName.toLowerCase() === 'tr'); var Css = Ink.getModule('Ink.Dom.Css_1'); return (w===0 && h===0 && !force) ? true : (w!==0 && h!==0 && !force) ? false : Css.getStyle(element, 'display').toLowerCase() === 'none'; }, /** * Check if an element is visible * * @method isVisible * @uses isHidden * @param {DOMElement} element Element to check * @return {Boolean} * @sample Ink_Dom_Element_1_isVisible.html */ isVisible: function (element) { return !this.isHidden(element); }, /** * Clones an element's position to another * * @method clonePosition * @param {DOMElement} cloneTo element to be position cloned * @param {DOMElement} cloneFrom element to get the cloned position * @return {DOMElement} The element with positionClone * @sample Ink_Dom_Element_1_clonePosition.html */ clonePosition: function(cloneTo, cloneFrom){ var pos = InkElement.offset(cloneFrom); cloneTo.style.left = pos[0]+'px'; cloneTo.style.top = pos[1]+'px'; return cloneTo; }, /** * Text-overflow: ellipsis emulation * Slices off a piece of text at the end of the element and adds the ellipsis so all text fits inside. * * @method ellipsizeText * @param {DOMElement} element Element to modify text content * @param {String} [ellipsis]='\u2026' String to append to the chopped text */ ellipsizeText: function(element/*, ellipsis*/){ if ((element = Ink.i(element))) { element.style.overflow = 'hidden'; element.style.whiteSpace = 'nowrap'; element.style.textOverflow = 'ellipsis'; } }, /** * Finds the closest ancestor element matching your test function * * * @method findUpwardsHaving * @param {DOMElement} element Element to base the search from * @param {Function} boolTest Testing function * @return {DOMElement|false} The matched element or false if did not match * @sample Ink_Dom_Element_1_findUpwardsHaving.html */ findUpwardsHaving: function(element, boolTest) { while (element && element.nodeType === 1) { if (boolTest(element)) { return element; } element = element.parentNode; } return false; }, /** * Finds the closest ancestor by class name * * @method findUpwardsByClass * @uses findUpwardsHaving * @param {DOMElement} element Element to base the search from * @param {String} className Class name to search * @returns {DOMElement|false} The matched element or false if did not match * @sample Ink_Dom_Element_1_findUpwardsByClass.html */ findUpwardsByClass: function(element, className) { var re = new RegExp("(^|\\s)" + className + "(\\s|$)"); var tst = function(el) { var cls = el.className; return cls && re.test(cls); }; return InkElement.findUpwardsHaving(element, tst); }, /** * Finds the closest ancestor by tag name * * @method findUpwardsByTag * @param {DOMElement} element Element to base the search from * @param {String} tag Tag to search * @returns {DOMElement|false} the matched element or false if did not match * @sample Ink_Dom_Element_1_findUpwardsByTag.html */ findUpwardsByTag: function(element, tag) { tag = tag.toUpperCase(); var tst = function(el) { return el.nodeName && el.nodeName.toUpperCase() === tag; }; return InkElement.findUpwardsHaving(element, tst); }, /** * Finds the closest ancestor by id * * @method findUpwardsById * @param {HtmlElement} element Element to base the search from * @param {String} id ID to search * @returns {HtmlElement|false} The matched element or false if did not match * @sample Ink_Dom_Element_1_findUpwardsById.html */ findUpwardsById: function(element, id) { var tst = function(el) { return el.id === id; }; return InkElement.findUpwardsHaving(element, tst); }, /** * Finds the closest ancestor by CSS selector * * @method findUpwardsBySelector * @param {HtmlElement} element Element to base the search from * @param {String} sel CSS selector * @returns {HtmlElement|false} The matched element or false if did not match * @sample Ink_Dom_Element_1_findUpwardsBySelector.html */ findUpwardsBySelector: function(element, sel) { var Selector = Ink.getModule('Ink.Dom.Selector', '1'); if (!Selector) { throw new Error('This method requires Ink.Dom.Selector'); } var tst = function(el) { return Selector.matchesSelector(el, sel); }; return InkElement.findUpwardsHaving(element, tst); }, /** * Gets the trimmed text of an element * * @method getChildrenText * @param {DOMElement} el Element to base the search from * @param {Boolean} [removeIt] Flag to remove the text from the element * @return {String} Text found * @sample Ink_Dom_Element_1_getChildrenText.html */ getChildrenText: function(el, removeIt) { var node, j, part, nodes = el.childNodes, jLen = nodes.length, text = ''; if (!el) { return text; } for (j = 0; j < jLen; ++j) { node = nodes[j]; if (!node) { continue; } if (node.nodeType === 3) { // TEXT NODE part = InkElement._trimString( String(node.data) ); if (part.length > 0) { text += part; if (removeIt) { el.removeChild(node); } } else { el.removeChild(node); } } } return text; }, /** * String trim implementation * Used by getChildrenText * * function _trimString * param {String} text * return {String} trimmed text */ _trimString: function(text) { return (String.prototype.trim) ? text.trim() : text.replace(/^\s*/, '').replace(/\s*$/, ''); }, /** * Gets value of a select element * * @method getSelectValues * @param {DOMElement|String} select element * @return {Array} The selected values * @sample Ink_Dom_Element_1_getSelectValues.html */ getSelectValues: function (select) { var selectEl = Ink.i(select); var values = []; for (var i = 0; i < selectEl.options.length; ++i) { values.push( selectEl.options[i].value ); } return values; }, /* used by fills */ _normalizeData: function(data) { var d, data2 = []; for (var i = 0, f = data.length; i < f; ++i) { d = data[i]; if (!(d instanceof Array)) { // if not array, wraps primitive twice: val -> [val, val] d = [d, d]; } else if (d.length === 1) { // if 1 element array: [val] -> [val, val] d.push(d[0]); } data2.push(d); } return data2; }, /** * Fills a select element with options * * @method fillSelect * @param {DOMElement|String} container Select element which will get filled * @param {Array} data Data to populate the component * @param {Boolean} [skipEmpty] Flag to skip empty option * @param {String|Number} [defaultValue] Initial selected value * * @sample Ink_Dom_Element_1_fillSelect.html */ fillSelect: function(container, data, skipEmpty, defaultValue) { var containerEl = Ink.i(container); if (!containerEl) { return; } containerEl.innerHTML = ''; var d, optionEl; if (!skipEmpty) { // add initial empty option optionEl = document.createElement('option'); optionEl.setAttribute('value', ''); containerEl.appendChild(optionEl); } data = InkElement._normalizeData(data); for (var i = 0, f = data.length; i < f; ++i) { d = data[i]; optionEl = document.createElement('option'); optionEl.setAttribute('value', d[0]); if (d.length > 2) { optionEl.setAttribute('extra', d[2]); } optionEl.appendChild( document.createTextNode(d[1]) ); if (d[0] === defaultValue) { optionEl.setAttribute('selected', 'selected'); } containerEl.appendChild(optionEl); } }, /** * Creates a set of radio buttons from an array of data * * @method fillRadios * @param {DOMElement|String} insertAfterEl Element after which the input elements will be created * @param {String} name Name for the form field ([] is added if not present as a suffix) * @param {Array} data Data to populate the component * @param {Boolean} [skipEmpty] Flag to skip creation of empty options * @param {String|Number} [defaultValue] Initial selected value * @param {String} [splitEl] Name of element to add after each input element (example: 'br') * @return {DOMElement} Wrapper element around the radio buttons */ fillRadios: function(insertAfterEl, name, data, skipEmpty, defaultValue, splitEl) { insertAfterEl = Ink.i(insertAfterEl); var containerEl = document.createElement('span'); InkElement.insertAfter(containerEl, insertAfterEl); data = InkElement._normalizeData(data); /* if (name.substring(name.length - 1) !== ']') { name += '[]'; } */ var d, inputEl; if (!skipEmpty) { // add initial empty option inputEl = document.createElement('input'); inputEl.setAttribute('type', 'radio'); inputEl.setAttribute('name', name); inputEl.setAttribute('value', ''); containerEl.appendChild(inputEl); if (splitEl) { containerEl.appendChild( document.createElement(splitEl) ); } } for (var i = 0; i < data.length; ++i) { d = data[i]; inputEl = document.createElement('input'); inputEl.setAttribute('type', 'radio'); inputEl.setAttribute('name', name); inputEl.setAttribute('value', d[0]); containerEl.appendChild(inputEl); containerEl.appendChild( document.createTextNode(d[1]) ); if (splitEl) { containerEl.appendChild( document.createElement(splitEl) ); } if (d[0] === defaultValue) { inputEl.checked = true; } } return containerEl; }, /** * Creates set of checkbox buttons * * @method fillChecks * @param {DOMElement|String} insertAfterEl Element after which the input elements will be created * @param {String} name Name for the form field ([] is added if not present as a suffix) * @param {Array} data Data to populate the component * @param {Boolean} [skipEmpty] Flag to skip creation of empty options * @param {String|Number} [defaultValue] Initial selected value * @param {String} [splitEl] Name of element to add after each input element (example: 'br') * @return {DOMElement} Wrapper element around the checkboxes */ fillChecks: function(insertAfterEl, name, data, defaultValue, splitEl) { insertAfterEl = Ink.i(insertAfterEl); var containerEl = document.createElement('span'); InkElement.insertAfter(containerEl, insertAfterEl); data = InkElement._normalizeData(data); if (name.substring(name.length - 1) !== ']') { name += '[]'; } var d, inputEl; for (var i = 0; i < data.length; ++i) { d = data[i]; inputEl = document.createElement('input'); inputEl.setAttribute('type', 'checkbox'); inputEl.setAttribute('name', name); inputEl.setAttribute('value', d[0]); containerEl.appendChild(inputEl); containerEl.appendChild( document.createTextNode(d[1]) ); if (splitEl) { containerEl.appendChild( document.createElement(splitEl) ); } if (d[0] === defaultValue) { inputEl.checked = true; } } return containerEl; }, /** * Gets the index of an element relative to a parent * * @method parentIndexOf * @param {DOMElement} parentEl Element to parse * @param {DOMElement} childEl Child Element to look for * @return {Number} The index of the childEl inside parentEl. Returns -1 if it's not a direct child * @sample Ink_Dom_Element_1_parentIndexOf.html */ parentIndexOf: function(parentEl, childEl) { var node, idx = 0; for (var i = 0, f = parentEl.childNodes.length; i < f; ++i) { node = parentEl.childNodes[i]; if (node.nodeType === 1) { // ELEMENT if (node === childEl) { return idx; } ++idx; } } return -1; }, /** * Gets the next siblings of an element * * @method nextSiblings * @param {String|DOMElement} elm Element * @return {Array} Array of next sibling elements * @sample Ink_Dom_Element_1_nextSiblings.html */ nextSiblings: function(elm) { elm = Ink.i(elm); if(typeof(elm) === 'object' && elm !== null && elm.nodeType && elm.nodeType === 1) { var elements = [], siblings = elm.parentNode.children, index = InkElement.parentIndexOf(elm.parentNode, elm); for(var i = ++index, len = siblings.length; i<len; i++) { elements.push(siblings[i]); } return elements; } return []; }, /** * Gets the previous siblings of an element * * @method previousSiblings * @param {String|DOMElement} elm Element * @return {Array} Array of previous sibling elements * @sample Ink_Dom_Element_1_previousSiblings.html */ previousSiblings: function(elm) { elm = Ink.i(elm); if(typeof(elm) === 'object' && elm !== null && elm.nodeType && elm.nodeType === 1) { var elements = [], siblings = elm.parentNode.children, index = InkElement.parentIndexOf(elm.parentNode, elm); for(var i = 0, len = index; i<len; i++) { elements.push(siblings[i]); } return elements; } return []; }, /** * Gets the all siblings of an element * * @method siblings * @param {String|DOMElement} elm Element * @return {Array} Array of sibling elements * @sample Ink_Dom_Element_1_siblings.html */ siblings: function(elm) { elm = Ink.i(elm); if(typeof(elm) === 'object' && elm !== null && elm.nodeType && elm.nodeType === 1) { var elements = [], siblings = elm.parentNode.children; for(var i = 0, len = siblings.length; i<len; i++) { if(elm !== siblings[i]) { elements.push(siblings[i]); } } return elements; } return []; }, /** * Counts the number of children of an element * * @method childElementCount * @param {String|DOMElement} elm element * @return {Number} number of child elements * @sample Ink_Dom_Element_1_childElementCount.html */ childElementCount: function(elm) { elm = Ink.i(elm); if ('childElementCount' in elm) { return elm.childElementCount; } if (!elm) { return 0; } return InkElement.siblings(elm).length + 1; }, _wrapElements: { TABLE: function (div, html) { /* If we don't create a tbody, IE7 does that for us. Adding a tbody with a random string and then filtering for that random string is the only way to avoid double insertion of tbodies. */ if (browserCreatesTbodies) { div.innerHTML = "<table>" + html + "<tbody><tr><td>" + deleteThisTbodyToken + "</tr></td></tbody></table>"; } else { div.innerHTML = "<table>" + html + "</table>"; } return div.firstChild; }, TBODY: function (div, html) { div.innerHTML = '<table><tbody>' + html + '</tbody></table>'; return div.firstChild.getElementsByTagName('tbody')[0]; }, THEAD: function (div, html) { div.innerHTML = '<table><thead>' + html + '</thead><tbody></tbody></table>'; return div.firstChild.getElementsByTagName('thead')[0]; }, TFOOT: function (div, html) { div.innerHTML = '<table><tfoot>' + html + '</tfoot><tbody></tbody></table>'; return div.firstChild.getElementsByTagName('tfoot')[0]; }, TR: function (div, html) { div.innerHTML = '<table><tbody><tr>' + html + '</tr></tbody></table>'; return div.firstChild.firstChild.firstChild; } }, /** * Gets a wrapper DIV with a certain HTML content to be inserted inside another element. * This is necessary for appendHTML,prependHTML functions, because they need a container element to copy the children from. * * Works around IE table quirks * @method _getWrapper * @private * @param elm * @param html */ _getWrapper: function (elm, html) { var nodeName = elm.nodeName && elm.nodeName.toUpperCase(); var wrapper = document.createElement('div'); var wrapFunc = InkElement._wrapElements[nodeName]; if ( !wrapFunc ) { wrapper.innerHTML = html; return wrapper; } // special cases wrapper = wrapFunc(wrapper, html); // worst case: tbody auto-creation even when our HTML has a tbody. if (browserCreatesTbodies && nodeName === 'TABLE') { // terrible case. Deal with tbody creation too. var tds = wrapper.getElementsByTagName('td'); for (var i = 0, len = tds.length; i < len; i++) { if (tds[i].innerHTML === deleteThisTbodyToken) { var tbody = tds[i].parentNode.parentNode; tbody.parentNode.removeChild(tbody); } } } return wrapper; }, /** * Appends HTML to an element. * This method parses the html string and doesn't modify its contents * * @method appendHTML * @param {String|DOMElement} elm Element * @param {String} html Markup string * @sample Ink_Dom_Element_1_appendHTML.html */ appendHTML: function(elm, html){ elm = Ink.i(elm); if(elm !== null) { var wrapper = InkElement._getWrapper(elm, html); while (wrapper.firstChild) { elm.appendChild(wrapper.firstChild); } } }, /** * Prepends HTML to an element. * This method parses the html string and doesn't modify its contents * * @method prependHTML * @param {String|DOMElement} elm Element * @param {String} html Markup string * @sample Ink_Dom_Element_1_prependHTML.html */ prependHTML: function(elm, html){ elm = Ink.i(elm); if(elm !== null) { var wrapper = InkElement._getWrapper(elm, html); while (wrapper.lastChild) { elm.insertBefore(wrapper.lastChild, elm.firstChild); } } }, /** * Sets the inner HTML of an element. * * @method setHTML * @param {String|DOMElement} elm Element * @param {String} html Markup string * @sample Ink_Dom_Element_1_setHTML.html */ setHTML: function (elm, html) { elm = Ink.i(elm); if(elm !== null) { try { elm.innerHTML = html; } catch (e) { // Tables in IE7 while (elm.firstChild) { elm.removeChild(elm.firstChild); } InkElement.appendHTML(elm, html); } } }, /** * Wraps an element inside a container. * * The container may or may not be in the document yet. * * @method wrap * @param {String|DOMElement} target Element to be wrapped * @param {String|DOMElement} container Element to wrap the target * @return Container element * @sample Ink_Dom_Element_1_wrap.html * * @example * before: * * <div id="target"></div> * * call this function to wrap #target with a wrapper div. * * InkElement.wrap('target', InkElement.create('div', {id: 'container'}); * * after: * * <div id="container"><div id="target"></div></div> */ wrap: function (target, container) { target = Ink.i(target); container = Ink.i(container); var nextNode = target.nextSibling; var parent = target.parentNode; container.appendChild(target); if (nextNode !== null) { parent.insertBefore(container, nextNode); } else { parent.appendChild(container); } return container; }, /** * Places an element outside a wrapper. * * @method unwrap * @param {DOMElement} elem The element you're trying to unwrap. This should be an ancestor of the wrapper. * @param {String} [wrapperSelector] CSS Selector for the ancestor. Use this if your wrapper is not the direct parent of elem. * @sample Ink_Dom_Element_1_unwrap.html * * @example * * When you have this: * * <div id="wrapper"> * <div id="unwrapMe"></div> * </div> * * If you do this: * * InkElement.unwrap('unwrapMe'); * * You get this: * * <div id="unwrapMe"></div> * <div id="wrapper"></div> * **/ unwrap: function (elem, wrapperSelector) { elem = Ink.i(elem); var wrapper; if (typeof wrapperSelector === 'string') { wrapper = InkElement.findUpwardsBySelector(elem, wrapperSelector); } else if (typeof wrapperSelector === 'object' && wrapperSelector.tagName) { wrapper = InkElement.findUpwardsHaving(elem, function (ancestor) { return ancestor === wrapperSelector; }); } else { wrapper = elem.parentNode; } if (!wrapper || !wrapper.parentNode) { return; } InkElement.insertBefore(elem, wrapper); }, /** * Replaces an element with another. * * @method replace * @param element The element to be replaced. * @param replacement The new element. * @sample Ink_Dom_Element_1_replace.html * * @example * var newelement1 = InkElement.create('div'); * // ... * replace(Ink.i('element1'), newelement1); */ replace: function (element, replacement) { element = Ink.i(element); if(element !== null) { element.parentNode.replaceChild(replacement, element); } }, /** * Removes direct text children. * Useful to remove nasty layout gaps generated by whitespace on the markup. * * @method removeTextNodeChildren * @param {DOMElement} el Element to remove text from * @sample Ink_Dom_Element_1_removeTextNodeChildren.html */ removeTextNodeChildren: function(el) { el = Ink.i(el); if(el !== null) { var prevEl, toRemove, parent = el; el = el.firstChild; while (el) { toRemove = (el.nodeType === 3); prevEl = el; el = el.nextSibling; if (toRemove) { parent.removeChild(prevEl); } } } }, /** * Creates a documentFragment from an HTML string. * * @method htmlToFragment * @param {String} html HTML string * @return {DocumentFragment} DocumentFragment containing all of the elements from the html string * @sample Ink_Dom_Element_1_htmlToFragment.html */ htmlToFragment: (createContextualFragmentSupport ? function(html){ var range; if(typeof html !== 'string'){ return document.createDocumentFragment(); } range = document.createRange(); // set the context to document.body (firefox does this already, webkit doesn't) range.selectNode(document.body); return range.createContextualFragment(html); } : function (html) { var fragment = document.createDocumentFragment(), tempElement, current; if(typeof html !== 'string'){ return fragment; } tempElement = document.createElement('div'); tempElement.innerHTML = html; // append child removes elements from the original parent while( (current = tempElement.firstChild) ){ // intentional assignment fragment.appendChild(current); } return fragment; }), _camelCase: function(str) { return str ? str.replace(/-(\w)/g, function (_, $1){ return $1.toUpperCase(); }) : str; }, /** * Gets data attributes from an element * * @method data * @param {String|DOMElement} selector Element or CSS selector * @return {Object} Object with the data-* properties. If no data-attributes are present, an empty object is returned. * @sample Ink_Dom_Element_1_data.html */ data: function(selector) { var el; if (typeof selector !== 'object' && typeof selector !== 'string') { throw '[Ink.Dom.Element.data] :: Invalid selector defined'; } if (typeof selector === 'object') { el = selector; } else { var InkDomSelector = Ink.getModule('Ink.Dom.Selector', 1); if (!InkDomSelector) { throw "[Ink.Dom.Element.data] :: this method requires Ink.Dom.Selector - v1"; } el = InkDomSelector.select(selector); if (el.length <= 0) { throw "[Ink.Dom.Element.data] :: Can't find any element with the specified selector"; } el = el[0]; } var dataset = {}; var attrs = el.attributes || []; var curAttr, curAttrName, curAttrValue; if (attrs) { for (var i = 0, total = attrs.length; i < total; ++i) { curAttr = attrs[i]; curAttrName = curAttr.name; curAttrValue = curAttr.value; if (curAttrName && curAttrName.indexOf('data-') === 0) { dataset[InkElement._camelCase(curAttrName.replace('data-', ''))] = curAttrValue; } } } return dataset; }, /** * Move the cursor on an input or textarea element. * @method moveCursorTo * @param {DOMElement} el Input or Textarea element * @param {Number} t Index of the character to move the cursor to * @sample Ink_Dom_Element_1_moveCursorTo.html */ moveCursorTo: function(el, t) { el = Ink.i(el); if(el !== null) { if (el.setSelectionRange) { el.setSelectionRange(t, t); //el.focus(); } else { var range = el.createTextRange(); range.collapse(true); range.moveEnd( 'character', t); range.moveStart('character', t); range.select(); } } }, /** * Get the page's width. * @method pageWidth * @return {Number} Page width in pixels * @sample Ink_Dom_Element_1_pageWidth.html */ pageWidth: function() { var xScroll; if (window.innerWidth && window.scrollMaxX) { xScroll = window.innerWidth + window.scrollMaxX; } else if (document.body.scrollWidth > document.body.offsetWidth){ xScroll = document.body.scrollWidth; } else { xScroll = document.body.offsetWidth; } var windowWidth; if (window.self.innerWidth) { if(document.documentElement.clientWidth){ windowWidth = document.documentElement.clientWidth; } else { windowWidth = window.self.innerWidth; } } else if (document.documentElement && document.documentElement.clientWidth) { windowWidth = document.documentElement.clientWidth; } else if (document.body) { windowWidth = document.body.clientWidth; } if(xScroll < windowWidth){ return xScroll; } else { return windowWidth; } }, /** * Get the page's height. * @method pageHeight * @return {Number} Page height in pixels * @sample Ink_Dom_Element_1_pageHeight.html */ pageHeight: function() { var yScroll; if (window.innerHeight && window.scrollMaxY) { yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight){ yScroll = document.body.scrollHeight; } else { yScroll = document.body.offsetHeight; } var windowHeight; if (window.self.innerHeight) { windowHeight = window.self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { windowHeight = document.documentElement.clientHeight; } else if (document.body) { windowHeight = document.body.clientHeight; } if(yScroll < windowHeight){ return windowHeight; } else { return yScroll; } }, /** * Get the viewport's width. * @method viewportWidth * @return {Number} Viewport width in pixels * @sample Ink_Dom_Element_1_viewportWidth.html */ viewportWidth: function() { if(typeof window.innerWidth !== "undefined") { return window.innerWidth; } if (document.documentElement && typeof document.documentElement.offsetWidth !== "undefined") { return document.documentElement.offsetWidth; } }, /** * Get the viewport's height. * @method viewportHeight * @return {Number} Viewport height in pixels * @sample Ink_Dom_Element_1_viewportHeight.html */ viewportHeight: function() { if (typeof window.innerHeight !== "undefined") { return window.innerHeight; } if (document.documentElement && typeof document.documentElement.offsetHeight !== "undefined") { return document.documentElement.offsetHeight; } }, /** * Get the scroll's width. * @method scrollWidth * @return {Number} Scroll width */ scrollWidth: function() { if (typeof window.self.pageXOffset !== 'undefined') { return window.self.pageXOffset; } if (typeof document.documentElement !== 'undefined' && typeof document.documentElement.scrollLeft !== 'undefined') { return document.documentElement.scrollLeft; } return document.body.scrollLeft; }, /** * Get the scroll's height. * @method scrollHeight * @return {Number} Scroll height */ scrollHeight: function() { if (typeof window.self.pageYOffset !== 'undefined') { return window.self.pageYOffset; } if (typeof document.documentElement !== 'undefined' && typeof document.documentElement.scrollTop !== 'undefined') { return document.documentElement.scrollTop; } return document.body.scrollTop; } }; return InkElement; }); /** * Event management * @module Ink.Dom.Event_1 * @version 1 */ Ink.createModule('Ink.Dom.Event', 1, [], function() { /* jshint asi:true, strict:false, laxcomma:true, eqeqeq:false, laxbreak:true, boss:true, curly:false, expr:true */ /** * @namespace Ink.Dom.Event_1 * @static */ /*! * Bean - copyright (c) Jacob Thornton 2011-2012 * https://github.com/fat/bean * MIT license */ var bean = (function (name, context, definition) { return definition() })('bean', this, function (name, context) { name = name || 'bean' context = context || this var win = window , old = context[name] , namespaceRegex = /[^\.]*(?=\..*)\.|.*/ , nameRegex = /\..*/ , addEvent = 'addEventListener' , removeEvent = 'removeEventListener' , doc = document || {} , root = doc.documentElement || {} , W3C_MODEL = root[addEvent] , eventSupport = W3C_MODEL ? addEvent : 'attachEvent' , ONE = {} // singleton for quick matching making add() do one() , slice = Array.prototype.slice , str2arr = function (s, d) { return s.split(d || ' ') } , isString = function (o) { return typeof o == 'string' } , isFunction = function (o) { return typeof o == 'function' } // events that we consider to be 'native', anything not in this list will // be treated as a custom event , standardNativeEvents = 'click dblclick mouseup mousedown contextmenu ' + // mouse buttons 'mousewheel mousemultiwheel DOMMouseScroll ' + // mouse wheel 'mouseover mouseout mousemove selectstart selectend ' + // mouse movement 'keydown keypress keyup ' + // keyboard 'orientationchange ' + // mobile 'focus blur change reset select submit ' + // form elements 'load unload beforeunload resize move DOMContentLoaded ' + // window 'readystatechange message ' + // window 'error abort scroll ' // misc // element.fireEvent('onXYZ'... is not forgiving if we try to fire an event // that doesn't actually exist, so make sure we only do these on newer browsers , w3cNativeEvents = 'show ' + // mouse buttons 'input invalid ' + // form elements 'touchstart touchmove touchend touchcancel ' + // touch 'gesturestart gesturechange gestureend ' + // gesture 'textinput' + // TextEvent 'readystatechange pageshow pagehide popstate ' + // window 'hashchange offline online ' + // window 'afterprint beforeprint ' + // printing 'dragstart dragenter dragover dragleave drag drop dragend ' + // dnd 'loadstart progress suspend emptied stalled loadmetadata ' + // media 'loadeddata canplay canplaythrough playing waiting seeking ' + // media 'seeked ended durationchange timeupdate play pause ratechange ' + // media 'volumechange cuechange ' + // media 'checking noupdate downloading cached updateready obsolete ' // appcache // convert to a hash for quick lookups , nativeEvents = (function (hash, events, i) { for (i = 0; i < events.length; i++) events[i] && (hash[events[i]] = 1) return hash }({}, str2arr(standardNativeEvents + (W3C_MODEL ? w3cNativeEvents : '')))) // custom events are events that we *fake*, they are not provided natively but // we can use native events to generate them , customEvents = (function () { var isAncestor = 'compareDocumentPosition' in root ? function (element, container) { return container.compareDocumentPosition && (container.compareDocumentPosition(element) & 16) === 16 } : 'contains' in root ? function (element, container) { container = container.nodeType === 9 || container === window ? root : container return container !== element && container.contains(element) } : function (element, container) { while (element = element.parentNode) if (element === container) return 1 return 0 } , check = function (event) { var related = event.relatedTarget return !related ? related == null : (related !== this && related.prefix !== 'xul' && !/document/.test(this.toString()) && !isAncestor(related, this)) } return { mouseenter: { base: 'mouseover', condition: check } , mouseleave: { base: 'mouseout', condition: check } , mousewheel: { base: /Firefox/.test(navigator.userAgent) ? 'DOMMouseScroll' : 'mousewheel' } } }()) // we provide a consistent Event object across browsers by taking the actual DOM // event object and generating a new one from its properties. , Event = (function () { // a whitelist of properties (for different event types) tells us what to check for and copy var commonProps = str2arr('altKey attrChange attrName bubbles cancelable ctrlKey currentTarget ' + 'detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey ' + 'srcElement target timeStamp type view which propertyName') , mouseProps = commonProps.concat(str2arr('button buttons clientX clientY dataTransfer ' + 'fromElement offsetX offsetY pageX pageY screenX screenY toElement')) , mouseWheelProps = mouseProps.concat(str2arr('wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ ' + 'axis')) // 'axis' is FF specific , keyProps = commonProps.concat(str2arr('char charCode key keyCode keyIdentifier ' + 'keyLocation location')) , textProps = commonProps.concat(str2arr('data')) , touchProps = commonProps.concat(str2arr('touches targetTouches changedTouches scale rotation')) , messageProps = commonProps.concat(str2arr('data origin source')) , stateProps = commonProps.concat(str2arr('state')) , overOutRegex = /over|out/ // some event types need special handling and some need special properties, do that all here , typeFixers = [ { // key events reg: /key/i , fix: function (event, newEvent) { newEvent.keyCode = event.keyCode || event.which return keyProps } } , { // mouse events reg: /click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i , fix: function (event, newEvent, type) { newEvent.rightClick = event.which === 3 || event.button === 2 newEvent.pos = { x: 0, y: 0 } if (event.pageX || event.pageY) { newEvent.clientX = event.pageX newEvent.clientY = event.pageY } else if (event.clientX || event.clientY) { newEvent.clientX = event.clientX + doc.body.scrollLeft + root.scrollLeft newEvent.clientY = event.clientY + doc.body.scrollTop + root.scrollTop } if (overOutRegex.test(type)) { newEvent.relatedTarget = event.relatedTarget || event[(type == 'mouseover' ? 'from' : 'to') + 'Element'] } return mouseProps } } , { // mouse wheel events reg: /mouse.*(wheel|scroll)/i , fix: function () { return mouseWheelProps } } , { // TextEvent reg: /^text/i , fix: function () { return textProps } } , { // touch and gesture events reg: /^touch|^gesture/i , fix: function () { return touchProps } } , { // message events reg: /^message$/i , fix: function () { return messageProps } } , { // popstate events reg: /^popstate$/i , fix: function () { return stateProps } } , { // everything else reg: /.*/ , fix: function () { return commonProps } } ] , typeFixerMap = {} // used to map event types to fixer functions (above), a basic cache mechanism , Event = function (event, element, isNative) { if (!arguments.length) return event = event || ((element.ownerDocument || element.document || element).parentWindow || win).event this.originalEvent = event this.isNative = isNative this.isBean = true if (!event) return var type = event.type , target = event.target || event.srcElement , i, l, p, props, fixer this.target = target && target.nodeType === 3 ? target.parentNode : target if (isNative) { // we only need basic augmentation on custom events, the rest expensive & pointless fixer = typeFixerMap[type] if (!fixer) { // haven't encountered this event type before, map a fixer function for it for (i = 0, l = typeFixers.length; i < l; i++) { if (typeFixers[i].reg.test(type)) { // guaranteed to match at least one, last is .* typeFixerMap[type] = fixer = typeFixers[i].fix break } } } props = fixer(event, this, type) for (i = props.length; i--;) { if (!((p = props[i]) in this) && p in event) this[p] = event[p] } } } // preventDefault() and stopPropagation() are a consistent interface to those functions // on the DOM, stop() is an alias for both of them together Event.prototype.preventDefault = function () { if (this.originalEvent.preventDefault) this.originalEvent.preventDefault() else this.originalEvent.returnValue = false } Event.prototype.stopPropagation = function () { if (this.originalEvent.stopPropagation) this.originalEvent.stopPropagation() else this.originalEvent.cancelBubble = true } Event.prototype.stop = function () { this.preventDefault() this.stopPropagation() this.stopped = true } // stopImmediatePropagation() has to be handled internally because we manage the event list for // each element // note that originalElement may be a Bean#Event object in some situations Event.prototype.stopImmediatePropagation = function () { if (this.originalEvent.stopImmediatePropagation) this.originalEvent.stopImmediatePropagation() this.isImmediatePropagationStopped = function () { return true } } Event.prototype.isImmediatePropagationStopped = function () { return this.originalEvent.isImmediatePropagationStopped && this.originalEvent.isImmediatePropagationStopped() } Event.prototype.clone = function (currentTarget) { //TODO: this is ripe for optimisation, new events are *expensive* // improving this will speed up delegated events var ne = new Event(this, this.element, this.isNative) ne.currentTarget = currentTarget return ne } return Event }()) // if we're in old IE we can't do onpropertychange on doc or win so we use doc.documentElement for both , targetElement = function (element, isNative) { return !W3C_MODEL && !isNative && (element === doc || element === win) ? root : element } /** * Bean maintains an internal registry for event listeners. We don't touch elements, objects * or functions to identify them, instead we store everything in the registry. * Each event listener has a RegEntry object, we have one 'registry' for the whole instance. */ , RegEntry = (function () { // each handler is wrapped so we can handle delegation and custom events var wrappedHandler = function (element, fn, condition, args) { var call = function (event, eargs) { return fn.apply(element, args ? slice.call(eargs, event ? 0 : 1).concat(args) : eargs) } , findTarget = function (event, eventElement) { return fn.__beanDel ? fn.__beanDel.ft(event.target, element) : eventElement } , handler = condition ? function (event) { var target = findTarget(event, this) // deleated event if (condition.apply(target, arguments)) { if (event) event.currentTarget = target return call(event, arguments) } } : function (event) { if (fn.__beanDel) event = event.clone(findTarget(event)) // delegated event, fix the fix return call(event, arguments) } handler.__beanDel = fn.__beanDel return handler } , RegEntry = function (element, type, handler, original, namespaces, args, root) { var customType = customEvents[type] , isNative if (type == 'unload') { // self clean-up handler = once(removeListener, element, type, handler, original) } if (customType) { if (customType.condition) { handler = wrappedHandler(element, handler, customType.condition, args) } type = customType.base || type } this.isNative = isNative = nativeEvents[type] && !!element[eventSupport] this.customType = !W3C_MODEL && !isNative && type this.element = element this.type = type this.original = original this.namespaces = namespaces this.eventType = W3C_MODEL || isNative ? type : 'propertychange' this.target = targetElement(element, isNative) this[eventSupport] = !!this.target[eventSupport] this.root = root this.handler = wrappedHandler(element, handler, null, args) } // given a list of namespaces, is our entry in any of them? RegEntry.prototype.inNamespaces = function (checkNamespaces) { var i, j, c = 0 if (!checkNamespaces) return true if (!this.namespaces) return false for (i = checkNamespaces.length; i--;) { for (j = this.namespaces.length; j--;) { if (checkNamespaces[i] == this.namespaces[j]) c++ } } return checkNamespaces.length === c } // match by element, original fn (opt), handler fn (opt) RegEntry.prototype.matches = function (checkElement, checkOriginal, checkHandler) { return this.element === checkElement && (!checkOriginal || this.original === checkOriginal) && (!checkHandler || this.handler === checkHandler) } return RegEntry }()) , registry = (function () { // our map stores arrays by event type, just because it's better than storing // everything in a single array. // uses '$' as a prefix for the keys for safety and 'r' as a special prefix for // rootListeners so we can look them up fast var map = {} // generic functional search of our registry for matching listeners, // `fn` returns false to break out of the loop , forAll = function (element, type, original, handler, root, fn) { var pfx = root ? 'r' : '$' if (!type || type == '*') { // search the whole registry for (var t in map) { if (t.charAt(0) == pfx) { forAll(element, t.substr(1), original, handler, root, fn) } } } else { var i = 0, l, list = map[pfx + type], all = element == '*' if (!list) return for (l = list.length; i < l; i++) { if ((all || list[i].matches(element, original, handler)) && !fn(list[i], list, i, type)) return } } } , has = function (element, type, original, root) { // we're not using forAll here simply because it's a bit slower and this // needs to be fast var i, list = map[(root ? 'r' : '$') + type] if (list) { for (i = list.length; i--;) { if (!list[i].root && list[i].matches(element, original, null)) return true } } return false } , get = function (element, type, original, root) { var entries = [] forAll(element, type, original, null, root, function (entry) { return entries.push(entry) }) return entries } , put = function (entry) { var has = !entry.root && !this.has(entry.element, entry.type, null, false) , key = (entry.root ? 'r' : '$') + entry.type ;(map[key] || (map[key] = [])).push(entry) return has } , del = function (entry) { forAll(entry.element, entry.type, null, entry.handler, entry.root, function (entry, list, i) { list.splice(i, 1) entry.removed = true if (list.length === 0) delete map[(entry.root ? 'r' : '$') + entry.type] return false }) } // dump all entries, used for onunload , entries = function () { var t, entries = [] for (t in map) { if (t.charAt(0) == '$') entries = entries.concat(map[t]) } return entries } return { has: has, get: get, put: put, del: del, entries: entries } }()) // we need a selector engine for delegated events, use querySelectorAll if it exists // but for older browsers we need Qwery, Sizzle or similar , selectorEngine , setSelectorEngine = function (e) { if (!arguments.length) { selectorEngine = doc.querySelectorAll ? function (s, r) { return r.querySelectorAll(s) } : function () { throw new Error('Bean: No selector engine installed') // eeek } } else { selectorEngine = e } } // we attach this listener to each DOM event that we need to listen to, only once // per event type per DOM element , rootListener = function (event, type) { if (!W3C_MODEL && type && event && event.propertyName != '_on' + type) return var listeners = registry.get(this, type || event.type, null, false) , l = listeners.length , i = 0 event = new Event(event, this, true) if (type) event.type = type // iterate through all handlers registered for this type, calling them unless they have // been removed by a previous handler or stopImmediatePropagation() has been called for (; i < l && !event.isImmediatePropagationStopped(); i++) { if (!listeners[i].removed) listeners[i].handler.call(this, event) } } // add and remove listeners to DOM elements , listener = W3C_MODEL ? function (element, type, add) { // new browsers element[add ? addEvent : removeEvent](type, rootListener, false) } : function (element, type, add, custom) { // IE8 and below, use attachEvent/detachEvent and we have to piggy-back propertychange events // to simulate event bubbling etc. var entry if (add) { registry.put(entry = new RegEntry( element , custom || type , function (event) { // handler rootListener.call(element, event, custom) } , rootListener , null , null , true // is root )) if (custom && element['_on' + custom] == null) element['_on' + custom] = 0 entry.target.attachEvent('on' + entry.eventType, entry.handler) } else { entry = registry.get(element, custom || type, rootListener, true)[0] if (entry) { entry.target.detachEvent('on' + entry.eventType, entry.handler) registry.del(entry) } } } , once = function (rm, element, type, fn, originalFn) { // wrap the handler in a handler that does a remove as well return function () { fn.apply(this, arguments) rm(element, type, originalFn) } } , removeListener = function (element, orgType, handler, namespaces) { var type = orgType && orgType.replace(nameRegex, '') , handlers = registry.get(element, type, null, false) , removed = {} , i, l for (i = 0, l = handlers.length; i < l; i++) { if ((!handler || handlers[i].original === handler) && handlers[i].inNamespaces(namespaces)) { // TODO: this is problematic, we have a registry.get() and registry.del() that // both do registry searches so we waste cycles doing this. Needs to be rolled into // a single registry.forAll(fn) that removes while finding, but the catch is that // we'll be splicing the arrays that we're iterating over. Needs extra tests to // make sure we don't screw it up. @rvagg registry.del(handlers[i]) if (!removed[handlers[i].eventType] && handlers[i][eventSupport]) removed[handlers[i].eventType] = { t: handlers[i].eventType, c: handlers[i].type } } } // check each type/element for removed listeners and remove the rootListener where it's no longer needed for (i in removed) { if (!registry.has(element, removed[i].t, null, false)) { // last listener of this type, remove the rootListener listener(element, removed[i].t, false, removed[i].c) } } } // set up a delegate helper using the given selector, wrap the handler function , delegate = function (selector, fn) { //TODO: findTarget (therefore $) is called twice, once for match and once for // setting e.currentTarget, fix this so it's only needed once var findTarget = function (target, root) { var i, array = isString(selector) ? selectorEngine(selector, root) : selector for (; target && target !== root; target = target.parentNode) { for (i = array.length; i--;) { if (array[i] === target) return target } } } , handler = function (e) { var match = findTarget(e.target, this) if (match) fn.apply(match, arguments) } // __beanDel isn't pleasant but it's a private function, not exposed outside of Bean handler.__beanDel = { ft : findTarget // attach it here for customEvents to use too , selector : selector } return handler } , fireListener = W3C_MODEL ? function (isNative, type, element) { // modern browsers, do a proper dispatchEvent() var evt = doc.createEvent(isNative ? 'HTMLEvents' : 'UIEvents') evt[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, win, 1) element.dispatchEvent(evt) } : function (isNative, type, element) { // old browser use onpropertychange, just increment a custom property to trigger the event element = targetElement(element, isNative) isNative ? element.fireEvent('on' + type, doc.createEventObject()) : element['_on' + type]++ } /** * Public API: off(), on(), add(), (remove()), one(), fire(), clone() */ /** * off(element[, eventType(s)[, handler ]]) */ , off = function (element, typeSpec, fn) { var isTypeStr = isString(typeSpec) , k, type, namespaces, i if (isTypeStr && typeSpec.indexOf(' ') > 0) { // off(el, 't1 t2 t3', fn) or off(el, 't1 t2 t3') typeSpec = str2arr(typeSpec) for (i = typeSpec.length; i--;) off(element, typeSpec[i], fn) return element } type = isTypeStr && typeSpec.replace(nameRegex, '') if (type && customEvents[type]) type = customEvents[type].base if (!typeSpec || isTypeStr) { // off(el) or off(el, t1.ns) or off(el, .ns) or off(el, .ns1.ns2.ns3) if (namespaces = isTypeStr && typeSpec.replace(namespaceRegex, '')) namespaces = str2arr(namespaces, '.') removeListener(element, type, fn, namespaces) } else if (isFunction(typeSpec)) { // off(el, fn) removeListener(element, null, typeSpec) } else { // off(el, { t1: fn1, t2, fn2 }) for (k in typeSpec) { if (typeSpec.hasOwnProperty(k)) off(element, k, typeSpec[k]) } } return element } /** * on(element, eventType(s)[, selector], handler[, args ]) */ , on = function(element, events, selector, fn) { var originalFn, type, types, i, args, entry, first //TODO: the undefined check means you can't pass an 'args' argument, fix this perhaps? if (selector === undefined && typeof events == 'object') { //TODO: this can't handle delegated events for (type in events) { if (events.hasOwnProperty(type)) { on.call(this, element, type, events[type]) } } return } if (!isFunction(selector)) { // delegated event originalFn = fn args = slice.call(arguments, 4) fn = delegate(selector, originalFn, selectorEngine) } else { args = slice.call(arguments, 3) fn = originalFn = selector } types = str2arr(events) // special case for one(), wrap in a self-removing handler if (this === ONE) { fn = once(off, element, events, fn, originalFn) } for (i = types.length; i--;) { // add new handler to the registry and check if it's the first for this element/type first = registry.put(entry = new RegEntry( element , types[i].replace(nameRegex, '') // event type , fn , originalFn , str2arr(types[i].replace(namespaceRegex, ''), '.') // namespaces , args , false // not root )) if (entry[eventSupport] && first) { // first event of this type on this element, add root listener listener(element, entry.eventType, true, entry.customType) } } return element } /** * add(element[, selector], eventType(s), handler[, args ]) * * Deprecated: kept (for now) for backward-compatibility */ , add = function (element, events, fn, delfn) { return on.apply( null , !isString(fn) ? slice.call(arguments) : [ element, fn, events, delfn ].concat(arguments.length > 3 ? slice.call(arguments, 5) : []) ) } /** * one(element, eventType(s)[, selector], handler[, args ]) */ , one = function () { return on.apply(ONE, arguments) } /** * fire(element, eventType(s)[, args ]) * * The optional 'args' argument must be an array, if no 'args' argument is provided * then we can use the browser's DOM event system, otherwise we trigger handlers manually */ , fire = function (element, type, args) { var types = str2arr(type) , i, j, l, names, handlers for (i = types.length; i--;) { type = types[i].replace(nameRegex, '') if (names = types[i].replace(namespaceRegex, '')) names = str2arr(names, '.') if (!names && !args && element[eventSupport]) { fireListener(nativeEvents[type], type, element) } else { // non-native event, either because of a namespace, arguments or a non DOM element // iterate over all listeners and manually 'fire' handlers = registry.get(element, type, null, false) args = [false].concat(args) for (j = 0, l = handlers.length; j < l; j++) { if (handlers[j].inNamespaces(names)) { handlers[j].handler.apply(element, args) } } } } return element } /** * clone(dstElement, srcElement[, eventType ]) * * TODO: perhaps for consistency we should allow the same flexibility in type specifiers? */ , clone = function (element, from, type) { var handlers = registry.get(from, type, null, false) , l = handlers.length , i = 0 , args, beanDel for (; i < l; i++) { if (handlers[i].original) { args = [ element, handlers[i].type ] if (beanDel = handlers[i].handler.__beanDel) args.push(beanDel.selector) args.push(handlers[i].original) on.apply(null, args) } } return element } , bean = { 'on' : on , 'add' : add , 'one' : one , 'off' : off , 'remove' : off , 'clone' : clone , 'fire' : fire , 'Event' : Event , 'setSelectorEngine' : setSelectorEngine , 'noConflict' : function () { context[name] = old return this } } // for IE, clean up on unload to avoid leaks if (win.attachEvent) { var cleanup = function () { var i, entries = registry.entries() for (i in entries) { if (entries[i].type && entries[i].type !== 'unload') off(entries[i].element, entries[i].type) } win.detachEvent('onunload', cleanup) win.CollectGarbage && win.CollectGarbage() } win.attachEvent('onunload', cleanup) } // initialize selector engine to internal default (qSA or throw Error) setSelectorEngine(Ink.ss) return bean }); /** * Keep this declaration here and off Bean as it extends the Event * object and some properties are readonly in strict mode */ 'use strict'; var InkEvent = { KEY_BACKSPACE: 8, KEY_TAB: 9, KEY_RETURN: 13, KEY_ESC: 27, KEY_LEFT: 37, KEY_UP: 38, KEY_RIGHT: 39, KEY_DOWN: 40, KEY_DELETE: 46, KEY_HOME: 36, KEY_END: 35, KEY_PAGEUP: 33, KEY_PAGEDOWN: 34, KEY_INSERT: 45, /** * Creates a debounced version of a function. * Returns a function which calls `func`, waiting at least `wait` milliseconds between calls. This is useful for events such as `scroll` or `resize`, which can be triggered too many times per second, slowing down the browser with needless function calls. * * *note:* This does not delay the first function call to the function. * * @method throttle * @param {Function} func Function to call. Arguments and context are both passed. * @param {Number} [wait]=0 Milliseconds to wait between calls. * @sample Ink_Dom_Event_1_throttle.html **/ throttle: function (func, wait) { wait = wait || 0; var lastCall = 0; // Warning: This breaks on Jan 1st 1970 0:00 var timeout; var throttled = function () { var now = +new Date(); var timeDiff = now - lastCall; if (timeDiff >= wait) { lastCall = now; return func.apply(this, [].slice.call(arguments)); } else { var that = this; var args = [].slice.call(arguments); if (!timeout) { timeout = setTimeout(function () { timeout = null; return throttled.apply(that, args); }, wait - timeDiff); } } }; return throttled; }, /** * Gets the event's target element. * * @method element * @param {Object} ev Event object * @return {DOMNode} The target * @sample Ink_Dom_Event_1_element.html */ element: function(ev) { var node = ev.delegationTarget || ev.target || // IE stuff (ev.type === 'mouseout' && ev.fromElement) || (ev.type === 'mouseleave' && ev.fromElement) || (ev.type === 'mouseover' && ev.toElement) || (ev.type === 'mouseenter' && ev.toElement) || ev.srcElement || null; return node && (node.nodeType === 3 || node.nodeType === 4) ? node.parentNode : node; }, /** * Gets the event's related target element. * * @method relatedTarget * @param {Object} ev event object * @return {DOMNode} The related target * @sample Ink_Dom_Event_1_relatedTarget.html */ relatedTarget: function(ev){ var node = ev.relatedTarget || // IE stuff (ev.type === 'mouseout' && ev.toElement) || (ev.type === 'mouseleave' && ev.toElement) || (ev.type === 'mouseover' && ev.fromElement) || (ev.type === 'mouseenter' && ev.fromElement) || null; return node && (node.nodeType === 3 || node.nodeType === 4) ? node.parentNode : node; }, /** * Find closest ancestor element by tag name related to the event target. * Navigate up the DOM tree, looking for a tag with the name `elmTagName`. * * If such tag is not found, `document` is returned. * * @method findElement * @param {Object} ev Event object * @param {String} elmTagName Tag name to find * @param {Boolean} [force]=false Flag to skip returning `document` and to return `false` instead. * @return {DOMElement} the first element which matches given tag name or the document element if the wanted tag is not found * @sample Ink_Dom_Event_1_findElement.html */ findElement: function(ev, elmTagName, force) { var node = this.element(ev); while(true) { if(node.nodeName.toLowerCase() === elmTagName.toLowerCase()) { return node; } else { node = node.parentNode; if(!node) { if(force) { return false; } return document; } if(!node.parentNode){ if(force){ return false; } return document; } } } }, /** * Attaches an event to element * * @method observe * @param {DOMElement|String} element Element id or element * @param {String} eventName Event name * @param {Function} callBack Receives the event object as a parameter. If you're manually firing custom events, check it's eventName property to make sure you're handling the right event. * @param {Boolean} [useCapture] Flag to change event listening from bubbling to capture. * @return {Function} The event handler used. Hang on to this if you want to `stopObserving` later. * @sample Ink_Dom_Event_1_observe.html */ observe: function(element, eventName, callBack, useCapture) { element = Ink.i(element); if(element) { if(element.addEventListener) { element.addEventListener(eventName, callBack, !!useCapture); } else { element.attachEvent('on' + eventName, (callBack = Ink.bind(callBack, element))); } return callBack; } }, /** * Like observe, but listen to the event only once. * * @method observeOnce * @param {DOMElement|String} element Element id or element * @param {String} eventName Event name * @param {Function} callBack Receives the event object as a parameter. If you're manually firing custom events, check it's eventName property to make sure you're handling the right event. * @param {Boolean} [useCapture] Flag to change event listening from bubbling to capture. * @return {Function} The event handler used. Hang on to this if you want to `stopObserving` later. * @sample Ink_Dom_Event_1_observeOnce.html */ observeOnce: function (element, eventName, callBack, useCapture) { var onceBack = function () { InkEvent.stopObserving(element, eventName, onceBack); return callBack(); }; return InkEvent.observe(element, eventName, onceBack, useCapture); }, /** * Attaches an event to a selector or array of elements. * * @method observeMulti * @param {Array|String} elements * @param {String} eventName Event name * @param {Function} callBack Receives the event object as a parameter. If you're manually firing custom events, check it's eventName property to make sure you're handling the right event. * @param {Boolean} [useCapture] Flag change event listening from bubbling to capture. * @return {Function} The used callback. * @sample Ink_Dom_Event_1_observeMulti.html */ observeMulti: function (elements, eventName, callBack, useCapture) { if (typeof elements === 'string') { elements = Ink.ss(elements); } else if ( /* is an element */ elements && elements.nodeType === 1) { elements = [elements]; } if (!elements[0]) { return false; } for (var i = 0, len = elements.length; i < len; i++) { this.observe(elements[i], eventName, callBack, useCapture); } return callBack; }, /** * Observes an event on an element and its descendants matching the selector. * * Requires Ink.Dom.Selector if you need to use a selector. * * @method observeDelegated * @param {DOMElement|String} element Element to observe. * @param {String} eventName Event name to observe. * @param {String} selector Child element selector. When null, finds any element. * @param {Function} callback Callback to be called when the event is fired * @return {Function} The used callback, for ceasing to listen to the event later. * @sample Ink_Dom_Event_1_observeDelegated.html **/ observeDelegated: function (element, eventName, selector, callback) { return InkEvent.observe(element, eventName, function (event) { var fromElement = InkEvent.element(event); if (!fromElement || fromElement === element) { return; } var cursor = fromElement; // Go up the document tree until we hit the element itself. while (cursor !== element && cursor !== document && cursor) { if (Ink.Dom.Selector_1.matchesSelector(cursor, selector)) { event.delegationTarget = cursor; return callback(event); } cursor = cursor.parentNode; } }); }, /** * Removes an event attached to an element. * * @method stopObserving * @param {DOMElement|String} element Element id or element * @param {String} eventName Event name * @param {Function} callBack Callback function * @param {Boolean} [useCapture] Set to true if the event was being observed with useCapture set to true as well. * @sample Ink_Dom_Event_1_stopObserving.html */ stopObserving: function(element, eventName, callBack, useCapture) { element = Ink.i(element); if(element) { if(element.removeEventListener) { element.removeEventListener(eventName, callBack, !!useCapture); } else { element.detachEvent('on' + eventName, callBack); } } }, /** * Stops event propagation and bubbling. * * @method stop * @param {Object} event Event handle * @sample Ink_Dom_Event_1_stop.html */ stop: function(event) { if(event.cancelBubble !== null) { event.cancelBubble = true; } if(event.stopPropagation) { event.stopPropagation(); } if(event.preventDefault) { event.preventDefault(); } if(window.attachEvent) { event.returnValue = false; } if(event.cancel !== null) { event.cancel = true; } }, /** * Stops event propagation. * * @method stopPropagation * @param {Object} event Event handle * @sample Ink_Dom_Event_1_stopPropagation.html */ stopPropagation: function(event) { if(event.cancelBubble !== null) { event.cancelBubble = true; } if(event.stopPropagation) { event.stopPropagation(); } }, /** * Stops event default behaviour. * * @method stopDefault * @param {Object} event Event handle * @sample Ink_Dom_Event_1_stopDefault.html */ stopDefault: function(event) { if(event.preventDefault) { event.preventDefault(); } if(window.attachEvent) { event.returnValue = false; } if(event.cancel !== null) { event.cancel = true; } }, /** * Gets the pointer's coordinates from the event object. * * @method pointer * @param {Object} ev Event object * @return {Object} An object with the mouse X and Y position * @sample Ink_Dom_Event_1_pointer.html */ pointer: function(ev) { return { x: this.pointerX(ev), y: this.pointerY(ev) }; }, /** * Gets the pointer's X coordinate. * * @method pointerX * @param {Object} ev Event object * @return {Number} Mouse X position */ pointerX: function(ev) { return (ev.touches && ev.touches[0] && ev.touches[0].pageX) || (ev.pageX) || (ev.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)); }, /** * Gets the pointer's Y coordinate. * * @method pointerY * @param {Object} ev Event object * @return {Number} Mouse Y position */ pointerY: function(ev) { return (ev.touches && ev.touches[0] && ev.touches[0].pageY) || (ev.pageY) || (ev.clientY + (document.documentElement.scrollTop || document.body.scrollTop)); }, /** * Checks if an event is a left click. * * @method isLeftClick * @param {Object} ev Event object * @return {Boolean} True if the event is a left click * @sample Ink_Dom_Event_1_isLeftClick.html */ isLeftClick: function(ev) { if (window.addEventListener) { if(ev.button === 0){ return true; } else if(ev.type === 'touchend' && ev.button === null){ // [todo] do the above check for pointerEvents too return true; } } else { if(ev.button === 1){ return true; } } return false; }, /** * Checks if an event is a right click. * * @method isRightClick * @param {Object} ev Event object * @return {Boolean} True if the event is a right click * @sample Ink_Dom_Event_1_isRightClick.html */ isRightClick: function(ev) { return (ev.button === 2); }, /** * Checks if an event is a middle click. * * @method isMiddleClick * @param {Object} ev Event object * @return {Boolean} True if the event is a middle click * @sample Ink_Dom_Event_1_isMiddleClick.html */ isMiddleClick: function(ev) { if (window.addEventListener) { return (ev.button === 1); } else { return (ev.button === 4); } return false; }, /** * Gets character from an event. * * @method getCharFromKeyboardEvent * @param {Object} event Keyboard event * @param {Boolean} [changeCasing] If true uppercases, if false lowercases, otherwise keeps casing * @return {String} Character representation of pressed key combination * @sample Ink_Dom_Event_1_getCharFromKeyboardEvent.html */ getCharFromKeyboardEvent: function(event, changeCasing) { var k = event.keyCode; var c = String.fromCharCode(k); var shiftOn = event.shiftKey; if (k >= 65 && k <= 90) { // A-Z if (typeof changeCasing === 'boolean') { shiftOn = changeCasing; } return (shiftOn) ? c : c.toLowerCase(); } else if (k >= 96 && k <= 105) { // numpad digits return String.fromCharCode( 48 + (k-96) ); } switch (k) { case 109: case 189: return '-'; case 107: case 187: return '+'; } return c; }, debug: function(){} }; /** * Lets you attach event listeners to both elements and objects. * http://github.com/fat/bean#on * * @method on * @param {DOMElement|Object} element An HTML DOM element or any JavaScript Object * @param {String} eventType An Event (or multiple events, space separated) to listen to * @param {String} [selector] A CSS DOM Element selector string to bind the listener to child elements matching the selector * @param {Function} [handler] The callback function * @param {Object} [args...] Additional arguments to pass to the callback function when triggered * * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object * @sample Ink_Dom_Event_1_on.html */ /** * Alias for `on` but will only be executed once. * bean.one() is an alias for bean.on() except that the handler will only be executed once and then removed for the event type(s). * http://github.com/fat/bean#one * * @method one * @param {DOMElement|Object} element An HTML DOM element or any JavaScript Object * @param {String} eventType An Event (or multiple events, space separated) to listen to * @param {String} [selector] A CSS DOM Element selector string to bind the listener to child elements matching the selector * @param {Function} [handler] The callback function * @param [args...] Additional arguments to pass to the callback function when triggered * * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object * @sample Ink_Dom_Event_1_one.html */ /** * Removes event handlers. * bean.off() is how you get rid of handlers once you no longer want them active. It's also a good idea to call off on elements before you remove them from your DOM; this gives Bean a chance to clean up some things and prevents memory leaks. * http://github.com/fat/bean#off * * @method off * @param {DOMElement|Object} element An HTML DOM element or any JavaScript Object * @param {String} eventType An Event (or multiple events, space separated) to remove * @param {Function} [handler] The specific callback function to remove * * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object * @sample Ink_Dom_Event_1_off.html */ /** * Clones events from one object to another * bean.clone() is a method for cloning events from one DOM element or object to another. * http://github.com/fat/bean#clone * * @method clone * @param {DOMElement|Object} destElement An HTML DOM element or any JavaScript Object to copy events to * @param {String} srcElement An HTML DOM element or any JavaScript Object to copy events from * @param {String} [eventType] An Event (or multiple events, space separated) to clone * * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object * @sample Ink_Dom_Event_1_clone.html */ /** * Triggers events. * http://github.com/fat/bean#fire * * @method fire * @param {DOMElement|Object} destElement An HTML DOM element or any JavaScript Object fire the event on * @param {String} eventType An Event (or multiple events, space separated) to fire * @param [args...] Additional arguments to pass to the callback function when triggered * * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object * @sample Ink_Dom_Event_1_fire.html */ return Ink.extendObj(InkEvent, bean); }); /** * @module Ink.Dom.FormSerialize_1 * Two way serialization of form data and javascript objects. * Valid applications are ad hoc AJAX/syndicated submission of forms, restoring form values from server side state, etc. */ Ink.createModule('Ink.Dom.FormSerialize', 1, ['Ink.UI.Common_1', 'Ink.Util.Array_1', 'Ink.Dom.Element_1', 'Ink.Dom.Selector_1'], function (Common, InkArray, InkElement, Selector) { 'use strict'; // Check whether something is not a string or a DOM element, but still has length. function isArrayIsh(obj) { return obj != null && (!Common.isDOMElement(obj)) && (InkArray.isArray(obj) || (typeof obj !== 'string' && typeof obj.length === 'number')); } function toArray(obj) { if (isArrayIsh(obj)) { return obj; } else { return [obj]; } } /** * @namespace Ink.Dom.FormSerialize * @static **/ var FormSerialize = { /** * Serializes a form element into a JS object * It turns field names into keys and field values into values. * * note: Multi-select and checkboxes with multiple values will result in arrays * * @method serialize * @param {DOMElement|String} form Form element to extract data * @return {Object} Map of fieldName -> String|String[]|Boolean * @sample Ink_Dom_FormSerialize_serialize.html */ serialize: function(form) { var out = {}; var emptyArrayToken = {}; // A hack so that empty select[multiple] elements appear although empty. var pairs = this.asPairs(form, { elements: true, emptyArray: emptyArrayToken }); if (pairs == null) { return pairs; } InkArray.forEach(pairs, function (pair) { var name = pair[0].replace(/\[\]$/, ''); var value = pair[1]; var el = pair[2]; if (value === emptyArrayToken) { out[name] = []; // It's an empty select[multiple] } else if (!(FormSerialize._resultsInArray(el) || /\[\]$/.test(pair[0]))) { out[name] = value; } else { out[name] = out[name] || []; out[name].push(value); } }); return out; }, /** * Like `serialize`, but returns an array of [fieldName, value] pairs. * * @method asPairs * @param {DOMElement|String} form Form element * @param {Object} [options] Options object, containing: * @param {Boolean} [options.elements] Instead of returning an array of [fieldName, value] pairs, return an array of [fieldName, value, fieldElement] triples. * @param {Boolean} [options.emptyArray] What to emit as the value of an empty select[multiple]. If you don't pass this option, nothing comes out. * * @return Array of [fieldName, value] pairs. **/ asPairs: function (form, options) { var out = []; options = options || {}; function emit(name, val, el) { if (options.elements) { out.push([name, val, el]); } else { out.push([name, val]); } } function serializeEl(el) { if (el.nodeName.toLowerCase() === 'select' && el.multiple) { var didEmit = false; InkArray.forEach(Selector.select('option:checked', el), function (thisOption) { emit(el.name, thisOption.value, el); didEmit = true; }); if (!didEmit && 'emptyArray' in options) { emit(el.name, options.emptyArray, el); } } else { emit(el.name, el.value, el); } } if ((form = Ink.i(form))) { var inputs = InkArray.filter(form.elements, FormSerialize._isSerialized); for (var i = 0, len = inputs.length; i < len; i++) { serializeEl(inputs[i]); } return out; } return null; }, /** * Sets form elements' values with values from an object * * Note: You can't set the values of an input with `type="file"` (browser prohibits it) * * @method fillIn * @param {DOMElement|String} form Form element to be populated * @param {Object|Array} map2 mapping of fields to values contained in fields. Can be a hash (keys as names, strings or arrays for values), or an array of [name, value] pairs. * @sample Ink_Dom_FormSerialize_fillIn.html */ fillIn: function(form, map2) { if (!(form = Ink.i(form))) { return null; } var pairs; if (typeof map2 === 'object' && !isArrayIsh(map2)) { pairs = FormSerialize._objToPairs(map2); } else if (isArrayIsh(map2)) { pairs = map2; } else { return null; } return FormSerialize._fillInPairs(form, pairs); }, _objToPairs: function (obj) { var pairs = []; var val; for (var name in obj) if (obj.hasOwnProperty(name)) { val = toArray(obj[name]); for (var i = 0, len = val.length; i < len; i++) { pairs.push([name, val[i]]); } if (len === 0) { pairs.push([name, []]); } } return pairs; }, _fillInPairs: function (form, pairs) { pairs = InkArray.groupBy(pairs, { key: function (pair) { return pair[0].replace(/\[\]$/, ''); } }); // For each chunk... pairs = InkArray.map(pairs, function (pair) { // Join the items in the chunk by concatenating the values together and leaving the names alone var values = InkArray.reduce(pair, function (left, right) { return [null, left[1].concat([right[1]])]; }, [null, []])[1]; return [pair[0][0], values]; }); var name; var inputs; var values; for (var i = 0, len = pairs.length; i < len; i++) { name = pairs[i][0]; if (name in form) { inputs = form[name]; } else if ((name + '[]') in form) { inputs = form[name + '[]']; name = name + '[]'; } else { continue; } inputs = toArray(inputs); values = pairs[i][1]; FormSerialize._fillInOne(name, inputs, values); } }, _fillInOne: function (name, inputs, values) { var firstOne = inputs[0]; var firstNodeName = firstOne.nodeName.toLowerCase(); var firstType = firstOne.getAttribute('type'); firstType = firstType && firstType.toLowerCase(); var isSelectMulti = firstNodeName === 'select' && InkElement.hasAttribute(firstOne, 'multiple'); if (firstType === 'checkbox' || firstType === 'radio') { FormSerialize._fillInBoolean(inputs, values, 'checked'); } else if (isSelectMulti) { FormSerialize._fillInBoolean(inputs[0].options, values, 'selected'); } else { if (inputs.length !== values.length) { Ink.warn('Form had ' + inputs.length + ' inputs named "' + name + '", but received ' + values.length + ' values.'); } for (var i = 0, len = Math.min(inputs.length, values.length); i < len; i += 1) { inputs[i].value = values[i]; } } }, _fillInBoolean: function (inputs, values, checkAttr /* 'selected' or 'checked' */) { InkArray.forEach(inputs, function (input) { var isChecked = InkArray.inArray(input.value, values); input[checkAttr] = isChecked; }); }, /** * Whether FormSerialize.serialize() should produce an array when looking at this element. * @method _resultsInArray * @private * @param element **/ _resultsInArray: function (element) { var type = element.getAttribute('type'); var nodeName = element.nodeName.toLowerCase(); return type === 'checkbox' || (nodeName === 'select' && InkElement.hasAttribute(element, 'multiple')); }, _isSerialized: function (element) { if (!Common.isDOMElement(element)) { return false; } if (!InkElement.hasAttribute(element, 'name')) { return false; } var nodeName = element.nodeName.toLowerCase(); if (!nodeName || nodeName === 'fieldset') { return false; } if (element.type === 'checkbox' || element.type === 'radio') { return !!element.checked; } return true; } }; return FormSerialize; }); /** * Execute code only when the DOM is loaded. * @module Ink.Dom.Loaded_1 * @version 1 */ Ink.createModule('Ink.Dom.Loaded', 1, [], function() { 'use strict'; /** * @namespace Ink.Dom.Loaded_1 **/ var Loaded = { /** * Callbacks and their contexts. Array of 2-arrays. * * [] * * @attribute _contexts Array * @private * */ _contexts: [], // Callbacks' queue /** * Specify a function to execute when the DOM is fully loaded. * * @method run * @param {Object} [win]=window Window object to attach/add the event * @param {Function} fn Callback function to be executed after the DOM is ready * @public * @sample Ink_Dom_Loaded_run.html */ run: function(win, fn) { if (!fn) { fn = win; win = window; } var context; for (var i = 0, len = this._contexts.length; i < len; i++) { if (this._contexts[i][0] === win) { context = this._contexts[i][1]; break; } } if (!context) { context = { cbQueue: [], win: win, doc: win.document, root: win.document.documentElement, done: false, top: true }; context.handlers = { checkState: Ink.bindEvent(this._checkState, this, context), poll: Ink.bind(this._poll, this, context) }; this._contexts.push( [win, context] // Javascript Objects cannot map different windows to // different values. ); } var ael = context.doc.addEventListener; context.add = ael ? 'addEventListener' : 'attachEvent'; context.rem = ael ? 'removeEventListener' : 'detachEvent'; context.pre = ael ? '' : 'on'; context.det = ael ? 'DOMContentLoaded' : 'onreadystatechange'; context.wet = context.pre + 'load'; var csf = context.handlers.checkState; var alreadyLoaded = ( /complete|interactive|loaded/.test(context.doc.readyState) && context.win.location.toString() !== 'about:blank'); // https://code.google.com/p/chromium/issues/detail?id=32357 if (alreadyLoaded){ setTimeout(Ink.bind(function () { fn.call(context.win, 'lazy'); }, this), 0); } else { context.cbQueue.push(fn); context.doc[context.add]( context.det , csf ); context.win[context.add]( context.wet , csf ); var frameElement = 1; try{ frameElement = context.win.frameElement; } catch(e) {} if ( !ael && context.root && context.root.doScroll ) { // IE HACK try { context.top = !frameElement; } catch(e) { } if (context.top) { this._poll(context); } } } }, /** * Function that will be running the callbacks after the page is loaded * * @method _checkState * @param {Event} event Triggered event * @private */ _checkState: function(event, context) { if ( !event || (event.type === 'readystatechange' && context.doc.readyState !== 'complete')) { return; } var where = (event.type === 'load') ? context.win : context.doc; where[context.rem](context.pre+event.type, context.handlers.checkState, false); this._ready(context); }, /** * Polls the load progress of the page to see if it has already loaded or not * * @method _poll * @private */ /** * * function _poll */ _poll: function(context) { try { context.root.doScroll('left'); } catch(e) { return setTimeout(context.handlers.poll, 50); } this._ready(context); }, /** * Function that runs the callbacks from the queue when the document is ready. * * @method _ready * @private */ _ready: function(context) { if (!context.done) { context.done = true; for (var i = 0; i < context.cbQueue.length; ++i) { context.cbQueue[i].call(context.win); } context.cbQueue = []; } } }; return Loaded; }); /** * CSS selector engine * @module Ink.Dom.Selector_1 * @version 1 */ Ink.createModule('Ink.Dom.Selector', 1, [], function() { /*jshint forin:false, eqnull:true, noempty:false, expr:true, boss:true, maxdepth:false*/ 'use strict'; /*! * Sizzle CSS Selector Engine * Copyright 2013 jQuery Foundation and other contributors * Released under the MIT license * http://sizzlejs.com/ */ var i, cachedruns, Expr, getText, isXML, compile, outermostContext, recompare, sortInput, // Local document vars setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, // Instance-specific data expando = "sizzle" + -(new Date()), preferredDoc = window.document, support = {}, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), hasDuplicate = false, sortOrder = function() { return 0; }, // General-purpose constants strundefined = typeof undefined, MAX_NEGATIVE = 1 << 31, // Array methods arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, // Use a stripped-down indexOf if we can't use a native one indexOf = arr.indexOf || function( elem ) { var i = 0, len = this.length; for ( ; i < len; i++ ) { if ( this[i] === elem ) { return i; } } return -1; }, // Regular expressions // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/css3-syntax/#characters characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", // Loosely modeled on CSS identifier characters // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = characterEncoding.replace( "w", "w#" ), // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors operators = "([*^$|!~]?=)", attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", // Prefer arguments quoted, // then not containing pseudos/brackets, // then attribute selectors/non-parenthetical expressions, // then anything else // These preferences are here to reduce the number of selectors // needing tokenize in the PSEUDO preFilter pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), matchExpr = { "ID": new RegExp( "^#(" + characterEncoding + ")" ), "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), "ATTR": new RegExp( "^" + attributes ), "PSEUDO": new RegExp( "^" + pseudos ), "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), // For use in libraries implementing .is() // We use this for POS matching in `select` "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, rsibling = /[\x20\t\r\n\f]*[+~]/, rnative = /^[^{]+\{\s*\[native code/, // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rescape = /'|\\/g, rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, funescape = function( _, escaped ) { var high = "0x" + escaped - 0x10000; // NaN means non-codepoint return high !== high ? escaped : // BMP codepoint high < 0 ? String.fromCharCode( high + 0x10000 ) : // Supplemental Plane codepoint (surrogate pair) String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }; // Optimize for push.apply( _, NodeList ) try { push.apply( (arr = slice.call( preferredDoc.childNodes )), preferredDoc.childNodes ); // Support: Android<4.0 // Detect silently failing push.apply arr[ preferredDoc.childNodes.length ].nodeType; } catch ( e ) { push = { apply: arr.length ? // Leverage slice if possible function( target, els ) { push_native.apply( target, slice.call(els) ); } : // Support: IE<9 // Otherwise append directly function( target, els ) { var j = target.length, i = 0; // Can't trust NodeList.length while ( (target[j++] = els[i++]) ) {} target.length = j - 1; } }; } /* * For feature detection * @param {Function} fn The function to test for native support */ function isNative( fn ) { return rnative.test( fn + "" ); } /* * Create key-value caches of limited size * @returns {Function(string, Object)} Returns the Object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry */ function createCache() { var cache, keys = []; return (cache = function( key, value ) { // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) if ( keys.push( key += " " ) > Expr.cacheLength ) { // Only keep the most recent entries delete cache[ keys.shift() ]; } return (cache[ key ] = value); }); } /* * Mark a function for special use by Sizzle * @param {Function} fn The function to mark */ function markFunction( fn ) { fn[ expando ] = true; return fn; } /* * Support testing using an element * @param {Function} fn Passed the created div and expects a boolean result */ function assert( fn ) { var div = document.createElement("div"); try { return !!fn( div ); } catch (e) { return false; } finally { // release memory in IE div = null; } } function Sizzle( selector, context, results, seed ) { var match, elem, m, nodeType, // QSA vars i, groups, old, nid, newContext, newSelector; if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { setDocument( context ); } context = context || document; results = results || []; if ( !selector || typeof selector !== "string" ) { return results; } if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { return []; } if ( documentIsHTML && !seed ) { // Shortcuts if ( (match = rquickExpr.exec( selector )) ) { // Speed-up: Sizzle("#ID") if ( (m = match[1]) ) { if ( nodeType === 9 ) { elem = context.getElementById( m ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE, Opera, and Webkit return items // by name instead of ID if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } } else { // Context is not a document if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // Speed-up: Sizzle("TAG") } else if ( match[2] ) { push.apply( results, context.getElementsByTagName( selector ) ); return results; // Speed-up: Sizzle(".CLASS") } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) { push.apply( results, context.getElementsByClassName( m ) ); return results; } } // QSA path if ( support.qsa && !rbuggyQSA.test(selector) ) { old = true; nid = expando; newContext = context; newSelector = nodeType === 9 && selector; // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { groups = tokenize( selector ); if ( (old = context.getAttribute("id")) ) { nid = old.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", nid ); } nid = "[id='" + nid + "'] "; i = groups.length; while ( i-- ) { groups[i] = nid + toSelector( groups[i] ); } newContext = rsibling.test( selector ) && context.parentNode || context; newSelector = groups.join(","); } if ( newSelector ) { try { push.apply( results, newContext.querySelectorAll( newSelector ) ); return results; } catch(qsaError) { } finally { if ( !old ) { context.removeAttribute("id"); } } } } } // All others return select( selector.replace( rtrim, "$1" ), context, results, seed ); } /* * Detect xml * @param {Element|Object} elem An element or a document */ isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; /* * Sets document-related variables once based on the current document * @param {Element|Object} [doc] An element or document object to use to set the document * @returns {Object} Returns the current document */ setDocument = Sizzle.setDocument = function( node ) { var doc = node ? node.ownerDocument || node : preferredDoc; // If no document and documentElement is available, return if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { return document; } // Set our document document = doc; docElem = doc.documentElement; // Support tests documentIsHTML = !isXML( doc ); // Check if getElementsByTagName("*") returns only elements support.getElementsByTagName = assert(function( div ) { div.appendChild( doc.createComment("") ); return !div.getElementsByTagName("*").length; }); // Check if attributes should be retrieved by attribute nodes support.attributes = assert(function( div ) { div.innerHTML = "<select></select>"; var type = typeof div.lastChild.getAttribute("multiple"); // IE8 returns a string for some attributes even when not present return type !== "boolean" && type !== "string"; }); // Check if getElementsByClassName can be trusted support.getElementsByClassName = assert(function( div ) { // Opera can't find a second classname (in 9.6) div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { return false; } // Safari 3.2 caches class attributes and doesn't catch changes div.lastChild.className = "e"; return div.getElementsByClassName("e").length === 2; }); // Check if getElementsByName privileges form controls or returns elements by ID // If so, assume (for broader support) that getElementById returns elements by name support.getByName = assert(function( div ) { // Inject content div.id = expando + 0; // Support: Windows 8 Native Apps // Assigning innerHTML with "name" attributes throws uncatchable exceptions // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx div.appendChild( document.createElement("a") ).setAttribute( "name", expando ); div.appendChild( document.createElement("i") ).setAttribute( "name", expando ); docElem.appendChild( div ); // Test var pass = doc.getElementsByName && // buggy browsers will return fewer than the correct 2 doc.getElementsByName( expando ).length === 2 + // buggy browsers will return more than the correct 0 doc.getElementsByName( expando + 0 ).length; // Cleanup docElem.removeChild( div ); return pass; }); // Support: Webkit<537.32 // Detached nodes confoundingly follow *each other* support.sortDetached = assert(function( div1 ) { return div1.compareDocumentPosition && // Should return 1, but Webkit returns 4 (following) (div1.compareDocumentPosition( document.createElement("div") ) & 1); }); // IE6/7 return modified attributes Expr.attrHandle = assert(function( div ) { div.innerHTML = "<a href='#'></a>"; return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && div.firstChild.getAttribute("href") === "#"; }) ? {} : { "href": function( elem ) { return elem.getAttribute( "href", 2 ); }, "type": function( elem ) { return elem.getAttribute("type"); } }; // ID find and filter if ( support.getByName ) { Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== strundefined && documentIsHTML ) { var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentNode ? [m] : []; } }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute("id") === attrId; }; }; } else { Expr.find["ID"] = function( id, context ) { if ( typeof context.getElementById !== strundefined && documentIsHTML ) { var m = context.getElementById( id ); return m ? m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? [m] : undefined : []; } }; Expr.filter["ID"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); return node && node.value === attrId; }; }; } // Tag Expr.find["TAG"] = support.getElementsByTagName ? function( tag, context ) { if ( typeof context.getElementsByTagName !== strundefined ) { return context.getElementsByTagName( tag ); } } : function( tag, context ) { var elem, tmp = [], i = 0, results = context.getElementsByTagName( tag ); // Filter out possible comments if ( tag === "*" ) { while ( (elem = results[i++]) ) { if ( elem.nodeType === 1 ) { tmp.push( elem ); } } return tmp; } return results; }; // Name Expr.find["NAME"] = support.getByName && function( tag, context ) { if ( typeof context.getElementsByName !== strundefined ) { return context.getElementsByName( name ); } }; // Class Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { return context.getElementsByClassName( className ); } }; // QSA and matchesSelector support // matchesSelector(:active) reports false when true (IE9/Opera 11.5) rbuggyMatches = []; // qSa(:focus) reports false when true (Chrome 21), // no need to also add to buggyMatches since matches checks buggyQSA // A support test would require too much code (would include document ready) rbuggyQSA = [ ":focus" ]; if ( (support.qsa = isNative(doc.querySelectorAll)) ) { // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( div ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explicitly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 div.innerHTML = "<select><option selected=''></option></select>"; // IE8 - Some boolean attributes are not treated correctly if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } }); assert(function( div ) { // Opera 10-12/IE8 - ^= $= *= and empty values // Should not select anything div.innerHTML = "<input type='hidden' i=''/>"; if ( div.querySelectorAll("[i^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here and will not see later tests if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push( ":enabled", ":disabled" ); } // Opera 10-11 does not throw on post-comma invalid pseudos div.querySelectorAll("*,:x"); rbuggyQSA.push(",.*:"); }); } if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector || docElem.mozMatchesSelector || docElem.webkitMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector) )) ) { assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) support.disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead matches.call( div, "[s!='']:x" ); rbuggyMatches.push( "!=", pseudos ); }); } rbuggyQSA = new RegExp( rbuggyQSA.join("|") ); rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); // Element contains another // Purposefully does not implement inclusive descendent // As in, an element does not contain itself contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && ( adown.contains ? adown.contains( bup ) : a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 )); } : function( a, b ) { if ( b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } } return false; }; // Document order sorting sortOrder = docElem.compareDocumentPosition ? function( a, b ) { // Flag for duplicate removal if ( a === b ) { hasDuplicate = true; return 0; } var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b ); if ( compare ) { // Disconnected nodes if ( compare & 1 || (recompare && b.compareDocumentPosition( a ) === compare) ) { // Choose the first element that is related to our preferred document if ( a === doc || contains(preferredDoc, a) ) { return -1; } if ( b === doc || contains(preferredDoc, b) ) { return 1; } // Maintain original order return sortInput ? ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 0; } return compare & 4 ? -1 : 1; } // Not directly comparable, sort on existence of method return a.compareDocumentPosition ? -1 : 1; } : function( a, b ) { var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [ a ], bp = [ b ]; // Exit early if the nodes are identical if ( a === b ) { hasDuplicate = true; return 0; // Parentless nodes are either documents or disconnected } else if ( !aup || !bup ) { return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : 0; // If the nodes are siblings, we can do a quick check } else if ( aup === bup ) { return siblingCheck( a, b ); } // Otherwise we need full lists of their ancestors for comparison cur = a; while ( (cur = cur.parentNode) ) { ap.unshift( cur ); } cur = b; while ( (cur = cur.parentNode) ) { bp.unshift( cur ); } // Walk down the tree looking for a discrepancy while ( ap[i] === bp[i] ) { i++; } return i ? // Do a sibling check if the nodes have a common ancestor siblingCheck( ap[i], bp[i] ) : // Otherwise nodes in our document sort first ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0; }; return document; }; Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); // rbuggyQSA always contains :focus, so no need for an existence check if ( support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) { try { var ret = matches.call( elem, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || support.disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch(e) {} } return Sizzle( expr, document, null, [elem] ).length > 0; }; Sizzle.contains = function( context, elem ) { // Set document vars if needed if ( ( context.ownerDocument || context ) !== document ) { setDocument( context ); } return contains( context, elem ); }; Sizzle.attr = function( elem, name ) { var val; // Set document vars if needed if ( ( elem.ownerDocument || elem ) !== document ) { setDocument( elem ); } if ( documentIsHTML ) { name = name.toLowerCase(); } if ( (val = Expr.attrHandle[ name ]) ) { return val( elem ); } if ( !documentIsHTML || support.attributes ) { return elem.getAttribute( name ); } return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ? name : val && val.specified ? val.value : null; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; // Document sorting and removing duplicates Sizzle.uniqueSort = function( results ) { var elem, duplicates = [], j = 0, i = 0; // Unless we *know* we can detect duplicates, assume their presence hasDuplicate = !support.detectDuplicates; // Compensate for sort limitations recompare = !support.sortDetached; sortInput = !support.sortStable && results.slice( 0 ); results.sort( sortOrder ); if ( hasDuplicate ) { while ( (elem = results[i++]) ) { if ( elem === results[ i ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } return results; }; /* * Checks document order of two siblings * @param {Element} a * @param {Element} b * @returns Returns -1 if a precedes b, 1 if a follows b */ function siblingCheck( a, b ) { var cur = b && a, diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); // Use IE sourceIndex if available on both nodes if ( diff ) { return diff; } // Check if b follows a if ( cur ) { while ( (cur = cur.nextSibling) ) { if ( cur === b ) { return -1; } } } return a ? 1 : -1; } // Returns a function to use in pseudos for input types function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } // Returns a function to use in pseudos for buttons function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } // Returns a function to use in pseudos for positionals function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /* * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( !nodeType ) { // If no nodeType, this is expected to be an array for ( ; (node = elem[i]); i++ ) { // Do not traverse comment nodes ret += getText( node ); } } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements // innerText usage removed for consistency of new lines (see #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { // Traverse its children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes return ret; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, find: {}, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "CHILD": function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 what (child|of-type) 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 4 xn-component of xn+y argument ([+-]?\d*n|) 5 sign of xn-component 6 x of xn-component 7 sign of y-component 8 y of y-component */ match[1] = match[1].toLowerCase(); if ( match[1].slice( 0, 3 ) === "nth" ) { // nth-* requires argument if ( !match[3] ) { Sizzle.error( match[0] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); // other types prohibit arguments } else if ( match[3] ) { Sizzle.error( match[0] ); } return match; }, "PSEUDO": function( match ) { var excess, unquoted = !match[5] && match[2]; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } // Accept quoted arguments as-is if ( match[4] ) { match[2] = match[4]; // Strip excess characters from unquoted arguments } else if ( unquoted && rpseudo.test( unquoted ) && // Get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { // excess is a negative index match[0] = match[0].slice( 0, excess ); match[2] = unquoted.slice( 0, excess ); } // Return only captures needed by the pseudo filter method (type and argument) return match.slice( 0, 3 ); } }, filter: { "TAG": function( nodeName ) { if ( nodeName === "*" ) { return function() { return true; }; } nodeName = nodeName.replace( runescape, funescape ).toLowerCase(); return function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ className + " " ]; return pattern || (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && classCache( className, function( elem ) { return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); }); }, "ATTR": function( name, operator, check ) { return function( elem ) { var result = Sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.slice( -check.length ) === check : operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : false; }; }, "CHILD": function( type, what, argument, first, last ) { var simple = type.slice( 0, 3 ) !== "nth", forward = type.slice( -4 ) !== "last", ofType = what === "of-type"; return first === 1 && last === 0 ? // Shortcut for :nth-*(n) function( elem ) { return !!elem.parentNode; } : function( elem, context, xml ) { var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType; if ( parent ) { // :(first|last|only)-(child|of-type) if ( simple ) { while ( dir ) { node = elem; while ( (node = node[ dir ]) ) { if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { return false; } } // Reverse direction for :only-* (if we haven't yet done so) start = dir = type === "only" && !start && "nextSibling"; } return true; } start = [ forward ? parent.firstChild : parent.lastChild ]; // non-xml :nth-child(...) stores cache data on `parent` if ( forward && useCache ) { // Seek `elem` from a previously-cached index outerCache = parent[ expando ] || (parent[ expando ] = {}); cache = outerCache[ type ] || []; nodeIndex = cache[0] === dirruns && cache[1]; diff = cache[0] === dirruns && cache[2]; node = nodeIndex && parent.childNodes[ nodeIndex ]; while ( (node = ++nodeIndex && node && node[ dir ] || // Fallback to seeking `elem` from the start (diff = nodeIndex = 0) || start.pop()) ) { // When found, cache indexes on `parent` and break if ( node.nodeType === 1 && ++diff && node === elem ) { outerCache[ type ] = [ dirruns, nodeIndex, diff ]; break; } } // Use previously-cached element index if available } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { diff = cache[1]; // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) } else { // Use the same loop as above to seek `elem` from the start while ( (node = ++nodeIndex && node && node[ dir ] || (diff = nodeIndex = 0) || start.pop()) ) { if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { // Cache the index of each encountered element if ( useCache ) { (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; } if ( node === elem ) { break; } } } } // Incorporate the offset, then check against cycle size diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); } }; }, "PSEUDO": function( pseudo, argument ) { // pseudo-class names are case-insensitive // http://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Sizzle.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function // just as Sizzle does if ( fn[ expando ] ) { return fn( argument ); } // But maintain support for old signatures if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? markFunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexOf.call( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { // Potentially complex pseudos "not": markFunction(function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markFunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; // Match elements unmatched by `matcher` while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); return !results.pop(); }; }), "has": markFunction(function( selector ) { return function( elem ) { return Sizzle( selector, elem ).length > 0; }; }), "contains": markFunction(function( text ) { return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; }), // "Whether an element is represented by a :lang() selector // is based solely on the element's language value // being equal to the identifier C, // or beginning with the identifier C immediately followed by "-". // The matching of C against the element's language value is performed case-insensitively. // The identifier C does not have to be a valid language name." // http://www.w3.org/TR/selectors/#lang-pseudo "lang": markFunction( function( lang ) { // lang value must be a valid identifier if ( !ridentifier.test(lang || "") ) { Sizzle.error( "unsupported lang: " + lang ); } lang = lang.replace( runescape, funescape ).toLowerCase(); return function( elem ) { var elemLang; do { if ( (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { elemLang = elemLang.toLowerCase(); return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; } } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); return false; }; }), // Miscellaneous "target": function( elem ) { var hash = window.location && window.location.hash; return hash && hash.slice( 1 ) === elem.id; }, "root": function( elem ) { return elem === docElem; }, "focus": function( elem ) { return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); }, // Boolean properties "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, // Contents "empty": function( elem ) { // http://www.w3.org/TR/selectors/#empty-pseudo // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), // not comment, processing instructions, or others // Thanks to Diego Perini for the nodeName shortcut // Greater than "@" means alpha characters (specifically not starting with "#" or "?") for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { return false; } } return true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, // Element/input types "header": function( elem ) { return rheader.test( elem.nodeName ); }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "text": function( elem ) { var attr; // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // use getAttribute instead to test this case return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); }, // Position-in-collection "first": createPositionalPseudo(function() { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length ) { var i = 0; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length ) { var i = 1; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; // Add button/input type pseudos for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { Expr.pseudos[ i ] = createInputPseudo( i ); } for ( i in { submit: true, reset: true } ) { Expr.pseudos[ i ] = createButtonPseudo( i ); } function tokenize( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first run if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { // Don't consume trailing commas as valid soFar = soFar.slice( match[0].length ) || soFar; } groups.push( tokens = [] ); } matched = false; // Combinators if ( (match = rcombinators.exec( soFar )) ) { matched = match.shift(); tokens.push( { value: matched, // Cast descendant combinators to space type: match[0].replace( rtrim, " " ) } ); soFar = soFar.slice( matched.length ); } // Filters for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || (match = preFilters[ type ]( match ))) ) { matched = match.shift(); tokens.push( { value: matched, type: type, matches: match } ); soFar = soFar.slice( matched.length ); } } if ( !matched ) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); } function toSelector( tokens ) { var i = 0, len = tokens.length, selector = ""; for ( ; i < len; i++ ) { selector += tokens[i].value; } return selector; } function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { return matcher( elem, context, xml ); } } } : // Check against all ancestor/preceding elements function( elem, context, xml ) { var data, cache, outerCache, dirkey = dirruns + " " + doneName; // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching if ( xml ) { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { if ( matcher( elem, context, xml ) ) { return true; } } } } else { while ( (elem = elem[ dir ]) ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || (elem[ expando ] = {}); if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { if ( (data = cache[1]) === true || data === cachedruns ) { return data === true; } } else { cache = outerCache[ dir ] = [ dirkey ]; cache[1] = matcher( elem, context, xml ) || cachedruns; if ( cache[1] === true ) { return true; } } } } } }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || ( seed ? preFilter : preexisting || postFilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } // Apply postFilter if ( postFilter ) { temp = condense( matcherOut, postMap ); postFilter( temp, [], context, xml ); // Un-match failing elements by moving them back to matcherIn i = temp.length; while ( i-- ) { if ( (elem = temp[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } if ( seed ) { if ( postFinder || preFilter ) { if ( postFinder ) { // Get the final matcherOut by condensing this intermediate into postFinder contexts temp = []; i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { // Restore matcherIn since elem is not yet a final match temp.push( (matcherIn[i] = elem) ); } } postFinder( null, (matcherOut = []), temp, xml ); } // Move matched elements from seed to results to keep them synchronized i = matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) && (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { seed[temp] = !(results[temp] = elem); } } } // Add elements to results, through postFinder if defined } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); } function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf.call( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; } else { matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // Return special upon seeing a positional matcher if ( matcher[ expando ] ) { // Find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && toSelector( tokens ) ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { // A counter to specify which element is currently being matched var matcherCachedRuns = 0, bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, expandContext ) { var elem, j, matcher, setMatched = [], matchedCount = 0, i = "0", unmatched = seed && [], outermost = expandContext != null, contextBackup = outermostContext, // We must always have either seed elements or context elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), // Use integer dirruns iff this is the outermost matcher dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); if ( outermost ) { outermostContext = context !== document && context; cachedruns = matcherCachedRuns; } // Add elements passing elementMatchers directly to results // Keep `i` a string if there are no elements so `matchedCount` will be "00" below for ( ; (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { j = 0; while ( (matcher = elementMatchers[j++]) ) { if ( matcher( elem, context, xml ) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; cachedruns = ++matcherCachedRuns; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // Apply set filters to unmatched elements matchedCount += i; if ( bySet && i !== matchedCount ) { j = 0; while ( (matcher = setMatchers[j++]) ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; return bySet ? markFunction( superMatcher ) : superMatcher; } compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[ selector + " " ]; if ( !cached ) { // Generate a function of recursive functions that can be used to check each element if ( !group ) { group = tokenize( selector ); } i = group.length; while ( i-- ) { cached = matcherFromTokens( group[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { elementMatchers.push( cached ); } } // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); } return cached; }; function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results ); } return results; } function select( selector, context, results, seed ) { var i, tokens, token, type, find, match = tokenize( selector ); if ( !seed ) { // Try to minimize operations if there is only one group if ( match.length === 1 ) { // Take a shortcut and set the context if the root selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; if ( !context ) { return results; } selector = selector.slice( tokens.shift().value.length ); } // Fetch a seed set for right-to-left matching i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; while ( i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( runescape, funescape ), rsibling.test( tokens[0].type ) && context.parentNode || context )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && toSelector( tokens ); if ( !selector ) { push.apply( results, seed ); return results; } break; } } } } } // Compile and execute a filtering function // Provide `match` to avoid retokenization if we modified the selector above compile( selector, match )( seed, context, !documentIsHTML, results, rsibling.test( selector ) ); return results; } // Deprecated Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Easy API for creating new setFilters function setFilters() {} setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); // Check sort stability support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; // Initialize with the default document setDocument(); // Always assume the presence of duplicates if sort doesn't // pass them to our comparison function (as in Google Chrome). [0, 0].sort( sortOrder ); support.detectDuplicates = hasDuplicate; // EXPOSE /*if ( typeof define === "function" && define.amd ) { define(function() { return Sizzle; }); } else { window.Sizzle = Sizzle; }*/ // EXPOSE /** * @namespace Ink.Dom.Selector * @static */ /** * Alias for the Sizzle selector engine * * @method select * @param {String} selector CSS selector to search for elements * @param {DOMElement} [context] By default the search is done in the document element. However, you can specify an element as search context * @param {Array} [results] By default this is considered an empty array. But if you want to merge it with other searches you did, pass their result array through here. * @return {Array} Array of resulting DOM Elements * @sample Ink_Dom_Selector_select.html */ /** * Filters elements that match a CSS selector. * * @method matches * @param {String} selector CSS selector to search for elements * @param {Array} matches Elements to be 'matched' with * @return {Array} Elements that matched * @sample Ink_Dom_Selector_matches.html */ /** * Checks if an element matches a given selector * * @method matchesSelector * @param {DOMElement} element Element to test * @param {String} selector CSS selector to test the element with * @return {Boolean} True if element matches the CSS selector * @sample Ink_Dom_Selector_matchesSelector.html */ return { select: Sizzle, matches: Sizzle.matches, matchesSelector: Sizzle.matchesSelector }; }); //( window ); /** * Array Utilities * @module Ink.Util.Array_1 * @version 1 */ Ink.createModule('Ink.Util.Array', '1', [], function() { 'use strict'; var arrayProto = Array.prototype; /** * @namespace Ink.Util.Array_1 */ var InkArray = { /** * Checks if a value is an array * * @method isArray * @param testedObject {Mixed} The object we want to check **/ isArray: Array.isArray || function (testedObject) { return {}.toString.call(testedObject) === '[object Array]'; }, /** * Loops through an array, grouping similar items together. * @method groupBy * @param arr {Array} The input array. * @param [options] {Object} options object, containing: * @param [options.key] {Function} A function which computes the group key by which the items are grouped. * @param [options.pairs] {Boolean} Set to `true` if you want to output an array of `[key, [group...]]` pairs instead of an array of groups. * @return {Array} An array of arrays of chunks. * * @example * * InkArray.groupBy([1, 1, 2, 2, 3, 1]) // -> [ [1, 1], [2, 2], [3], [1] ] * InkArray.groupBy([1.1, 1.2, 2.1], { key: Math.floor }) // -> [ [1.1, 1.2], [2.1] ] * InkArray.groupBy([1.1, 1.2, 2.1], { key: Math.floor, pairs: true }) // -> [ [1, [1.1, 1.2]], [2, [2.1]] ] * **/ groupBy: function (arr, options) { options = options || {}; var ret = []; var latestGroup; function eq(a, b) { return outKey(a) === outKey(b); } function outKey(item) { if (typeof options.key === 'function') { return options.key(item); } else { return item; } } for (var i = 0, len = arr.length; i < len; i++) { latestGroup = [arr[i]]; // Chunkin' while ((i + 1 < len) && eq(arr[i], arr[i + 1])) { latestGroup.push(arr[i + 1]); i++; } if (options.pairs) { ret.push([outKey(arr[i]), latestGroup]); } else { ret.push(latestGroup); } } return ret; }, /** * Replacement for Array.prototype.reduce. * * Produces a single result from a list of values by calling an "aggregator" function. * * Falls back to Array.prototype.reduce if available. * * @method reduce * @param array {Array} Input array to be reduced. * @param callback {Function} `function (previousValue, currentValue, index, all) { return {Mixed} }` to execute for each value. * @param initial {Mixed} Object used as the first argument to the first call of `callback` * * @example * var sum = InkArray.reduce([1, 2, 3], function (a, b) { return a + b; }); // -> 6 */ reduce: function (array, callback, initial) { if (arrayProto.reduce) { return arrayProto.reduce.apply(array, [].slice.call(arguments, 1)); } // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce#Polyfill var t = Object( array ), len = t.length >>> 0, k = 0, value; if ( arguments.length >= 3 ) { value = initial; } else { while ( k < len && !(k in t) ) k++; if ( k >= len ) throw new TypeError('Reduce of empty array with no initial value'); value = t[ k++ ]; } for ( ; k < len ; k++ ) { if ( k in t ) { value = callback( value, t[k], k, t ); } } return value; }, /** * Checks if a value exists in array * * @method inArray * @public * @static * @param {Mixed} value Value to check * @param {Array} arr Array to search in * @return {Boolean} True if value exists in the array * @sample Ink_Util_Array_inArray.html */ inArray: function(value, arr) { if (typeof arr === 'object') { for (var i = 0, f = arr.length; i < f; ++i) { if (arr[i] === value) { return true; } } } return false; }, /** * Sorts an array of objects by an object property * * @method sortMulti * @param {Array} arr Array of objects to sort * @param {String} key Property to sort by * @return {Array|Boolean} False if it's not an array, returns a sorted array if it's an array. * @public * @static * @sample Ink_Util_Array_sortMulti.html */ sortMulti: function(arr, key) { if (typeof arr === 'undefined' || arr.constructor !== Array) { return false; } if (typeof key !== 'string') { return arr.sort(); } if (arr.length > 0) { if (typeof(arr[0][key]) === 'undefined') { return false; } arr.sort(function(a, b){ var x = a[key]; var y = b[key]; return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }); } return arr; }, /** * Gets the indexes of a value in an array * * @method keyValue * @param {String} value Value to search for. * @param {Array} arr Array to run the search in. * @param {Boolean} [first] Flag to stop the search at the first match. It also returns an index number instead of an array of indexes. * @return {Boolean|Number|Array} False for no matches. Array of matches or first match index. * @public * @static * @sample Ink_Util_Array_keyValue.html */ keyValue: function(value, arr, first) { if (typeof value !== 'undefined' && typeof arr === 'object' && this.inArray(value, arr)) { var aKeys = []; for (var i = 0, f = arr.length; i < f; ++i) { if (arr[i] === value) { if (typeof first !== 'undefined' && first === true) { return i; } else { aKeys.push(i); } } } return aKeys; } return false; }, /** * Shuffles an array. * * @method shuffle * @param {Array} arr Array to shuffle * @return {Array|Boolean} Shuffled Array or false if not an array. * @public * @static * @sample Ink_Util_Array_shuffle.html */ shuffle: function(arr) { if (typeof(arr) !== 'undefined' && arr.constructor !== Array) { return false; } var total = arr.length, tmp1 = false, rnd = false; while (total--) { rnd = Math.floor(Math.random() * (total + 1)); tmp1 = arr[total]; arr[total] = arr[rnd]; arr[rnd] = tmp1; } return arr; }, /** * Runs a function through each of the elements of an array * * @method forEach * @param {Array} arr The array to be cycled/iterated * @param {Function} cb The function receives as arguments the value, index and array. * @return {Array} Iterated array. * @public * @static * @sample Ink_Util_Array_forEach.html */ forEach: function(array, callback, context) { if (arrayProto.forEach) { return arrayProto.forEach.call(array, callback, context); } for (var i = 0, len = array.length >>> 0; i < len; i++) { callback.call(context, array[i], i, array); } }, /** * Alias for backwards compatibility. See forEach * * @method each */ each: function () { InkArray.forEach.apply(InkArray, [].slice.call(arguments)); }, /** * Runs a function for each item in the array. * That function will receive each item as an argument and its return value will change the corresponding array item. * @method map * @param {Array} array The array to map over * @param {Function} map The map function. Will take `(item, index, array)` as arguments and `this` will be the `context` argument. * @param {Object} [context] Object to be `this` in the map function. * * @sample Ink_Util_Array_map.html */ map: function (array, callback, context) { if (arrayProto.map) { return arrayProto.map.call(array, callback, context); } var mapped = new Array(len); for (var i = 0, len = array.length >>> 0; i < len; i++) { mapped[i] = callback.call(context, array[i], i, array); } return mapped; }, /** * Filters an array based on a truth test. * This method runs a test function on all the array values and returns a new array with all the values that pass the test. * @method filter * @param {Array} array The array to filter * @param {Function} test A test function taking `(item, index, array)` * @param {Object} [context] Object to be `this` in the test function. * @return {Array} Returns the filtered array * * @sample Ink_Util_Array_filter.html */ filter: function (array, test, context) { if (arrayProto.filter) { return arrayProto.filter.call(array, test, context); } var filtered = [], val = null; for (var i = 0, len = array.length; i < len; i++) { val = array[i]; // it might be mutated if (test.call(context, val, i, array)) { filtered.push(val); } } return filtered; }, /** * Checks if some element in the array passes a truth test * * @method some * @param {Array} arr The array to iterate through * @param {Function} cb The callback to be called on the array's elements. It receives the value, the index and the array as arguments. * @param {Object} context Object of the callback function * @return {Boolean} True if the callback returns true at any point, false otherwise * @public * @static * @sample Ink_Util_Array_some.html */ some: function(arr, cb, context){ if (arr === null){ throw new TypeError('First argument is invalid.'); } var t = Object(arr); var len = t.length >>> 0; if (typeof cb !== "function"){ throw new TypeError('Second argument must be a function.'); } for (var i = 0; i < len; i++) { if (i in t && cb.call(context, t[i], i, t)){ return true; } } return false; }, /** * Compares the values of two arrays and return the matches * * @method intersect * @param {Array} arr1 First array * @param {Array} arr2 Second array * @return {Array} Empty array if one of the arrays is false (or do not intersect) | Array with the intersected values * @public * @static * @sample Ink_Util_Array_intersect.html */ intersect: function(arr1, arr2) { if (!arr1 || !arr2 || arr1 instanceof Array === false || arr2 instanceof Array === false) { return []; } var shared = []; for (var i = 0, I = arr1.length; i<I; ++i) { for (var j = 0, J = arr2.length; j < J; ++j) { if (arr1[i] === arr2[j]) { shared.push(arr1[i]); } } } return shared; }, /** * Converts an array-like object to an array * * @method convert * @param {Array} arr Array to be converted * @return {Array} Array resulting of the conversion * @public * @static * @sample Ink_Util_Array_convert.html */ convert: function(arr) { return arrayProto.slice.call(arr || [], 0); }, /** * Simulates python's range(start, stop, step) function. * * Creates a list with numbers counting from start until stop, using a for loop. *. * The optional step argument defines how to step ahead. You can pass a negative number to count backwards (see the examples below). * * @method range * @param {Number} start The array's first element. * @param {Number} stop Stop counting before this number. * @param {Number} [step=1] Interval between numbers. You can use a negative number to count backwards. * * @sample Ink_Util_Array_1_range.html **/ range: function range(a, b, step) { // From: https://github.com/mcandre/node-range if (!step) { step = 1; } var r = []; var x; if (step > 0) { for (x = a; x < b; x += step) { r.push(x); } } else { for (x = a; x > b; x += step) { r.push(x); } } return r; }, /** * Inserts a value on a specified index * * @method insert * @param {Array} arr Array where the value will be inserted * @param {Number} idx Index of the array where the value should be inserted * @param {Mixed} value Value to be inserted * @public * @static * @sample Ink_Util_Array_insert.html */ insert: function(arr, idx, value) { arr.splice(idx, 0, value); }, /** * Removes a range of values from the array * * @method remove * @param {Array} arr Array where the value will be removed * @param {Number} from Index of the array where the removal will start removing. * @param {Number} rLen Number of items to be removed from the index onwards. * @return {Array} An array with the remaining values * @public * @static * @sample Ink_Util_Array_remove.html */ remove: function(arr, from, rLen){ var output = []; for(var i = 0, iLen = arr.length; i < iLen; i++){ if(i >= from && i < from + rLen){ continue; } output.push(arr[i]); } return output; } }; return InkArray; }); /** * Binary Packing algorithm implementation * @module Ink.Util.BinPack_1 * @version 1 */ Ink.createModule('Ink.Util.BinPack', '1', [], function() { 'use strict'; /*jshint boss:true */ // https://github.com/jakesgordon/bin-packing/ /* Copyright (c) 2011, 2012, 2013 Jake Gordon and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ var Packer = function(w, h) { this.init(w, h); }; Packer.prototype = { init: function(w, h) { this.root = { x: 0, y: 0, w: w, h: h }; }, fit: function(blocks) { var n, node, block; for (n = 0; n < blocks.length; ++n) { block = blocks[n]; if (node = this.findNode(this.root, block.w, block.h)) { block.fit = this.splitNode(node, block.w, block.h); } } }, findNode: function(root, w, h) { if (root.used) { return this.findNode(root.right, w, h) || this.findNode(root.down, w, h); } else if ((w <= root.w) && (h <= root.h)) { return root; } else { return null; } }, splitNode: function(node, w, h) { node.used = true; node.down = { x: node.x, y: node.y + h, w: node.w, h: node.h - h }; node.right = { x: node.x + w, y: node.y, w: node.w - w, h: h }; return node; } }; var GrowingPacker = function() {}; GrowingPacker.prototype = { fit: function(blocks) { var n, node, block, len = blocks.length; var w = len > 0 ? blocks[0].w : 0; var h = len > 0 ? blocks[0].h : 0; this.root = { x: 0, y: 0, w: w, h: h }; for (n = 0; n < len ; n++) { block = blocks[n]; if (node = this.findNode(this.root, block.w, block.h)) { block.fit = this.splitNode(node, block.w, block.h); } else { block.fit = this.growNode(block.w, block.h); } } }, findNode: function(root, w, h) { if (root.used) { return this.findNode(root.right, w, h) || this.findNode(root.down, w, h); } else if ((w <= root.w) && (h <= root.h)) { return root; } else { return null; } }, splitNode: function(node, w, h) { node.used = true; node.down = { x: node.x, y: node.y + h, w: node.w, h: node.h - h }; node.right = { x: node.x + w, y: node.y, w: node.w - w, h: h }; return node; }, growNode: function(w, h) { var canGrowDown = (w <= this.root.w); var canGrowRight = (h <= this.root.h); var shouldGrowRight = canGrowRight && (this.root.h >= (this.root.w + w)); // attempt to keep square-ish by growing right when height is much greater than width var shouldGrowDown = canGrowDown && (this.root.w >= (this.root.h + h)); // attempt to keep square-ish by growing down when width is much greater than height if (shouldGrowRight) { return this.growRight(w, h); } else if (shouldGrowDown) { return this.growDown(w, h); } else if (canGrowRight) { return this.growRight(w, h); } else if (canGrowDown) { return this.growDown(w, h); } else { return null; // need to ensure sensible root starting size to avoid this happening } }, growRight: function(w, h) { this.root = { used: true, x: 0, y: 0, w: this.root.w + w, h: this.root.h, down: this.root, right: { x: this.root.w, y: 0, w: w, h: this.root.h } }; var node; if (node = this.findNode(this.root, w, h)) { return this.splitNode(node, w, h); } else { return null; } }, growDown: function(w, h) { this.root = { used: true, x: 0, y: 0, w: this.root.w, h: this.root.h + h, down: { x: 0, y: this.root.h, w: this.root.w, h: h }, right: this.root }; var node; if (node = this.findNode(this.root, w, h)) { return this.splitNode(node, w, h); } else { return null; } } }; var sorts = { random: function() { return Math.random() - 0.5; }, w: function(a, b) { return b.w - a.w; }, h: function(a, b) { return b.h - a.h; }, a: function(a, b) { return b.area - a.area; }, max: function(a, b) { return Math.max(b.w, b.h) - Math.max(a.w, a.h); }, min: function(a, b) { return Math.min(b.w, b.h) - Math.min(a.w, a.h); }, height: function(a, b) { return sorts.msort(a, b, ['h', 'w']); }, width: function(a, b) { return sorts.msort(a, b, ['w', 'h']); }, area: function(a, b) { return sorts.msort(a, b, ['a', 'h', 'w']); }, maxside: function(a, b) { return sorts.msort(a, b, ['max', 'min', 'h', 'w']); }, msort: function(a, b, criteria) { /* sort by multiple criteria */ var diff, n; for (n = 0; n < criteria.length; ++n) { diff = sorts[ criteria[n] ](a, b); if (diff !== 0) { return diff; } } return 0; } }; // end of Jake's code // aux, used to display blocks in unfitted property var toString = function() { return [this.w, ' x ', this.h].join(''); }; /** * Binary Packing algorithm implementation * * Based on the work of Jake Gordon * * see https://github.com/jakesgordon/bin-packing/ * * @namespace Ink.Util.BinPack * @version 1 * @static */ var BinPack = { /** * @method binPack * @param {Object} o Options * @param {Array} o.blocks Array of items with width and height integer attributes. * @param {Array} [o.dimensions] Flag to fix container dimensions * @param {String} [o.sorter] Sorting function. One of: random, height, width, area, maxside * @return {Object} Returns an object containing container dimensions, filled ratio, fitted blocks, unfitted blocks and all blocks * @static */ binPack: function(o) { var i, f, bl; // calculate area if not there already for (i = 0, f = o.blocks.length; i < f; ++i) { bl = o.blocks[i]; if (! ('area' in bl) ) { bl.area = bl.w * bl.h; } } // apply algorithm var packer = o.dimensions ? new Packer(o.dimensions[0], o.dimensions[1]) : new GrowingPacker(); if (!o.sorter) { o.sorter = 'maxside'; } o.blocks.sort( sorts[ o.sorter ] ); packer.fit(o.blocks); var dims2 = [packer.root.w, packer.root.h]; // layout is done here, generating report data... var fitted = []; var unfitted = []; for (i = 0, f = o.blocks.length; i < f; ++i) { bl = o.blocks[i]; if (bl.fit) { fitted.push(bl); } else { bl.toString = toString; // TO AID SERIALIZATION unfitted.push(bl); } } var area = dims2[0] * dims2[1]; var fit = 0; for (i = 0, f = fitted.length; i < f; ++i) { bl = fitted[i]; fit += bl.area; } return { dimensions: dims2, filled: fit / area, blocks: o.blocks, fitted: fitted, unfitted: unfitted }; } }; return BinPack; }); /** * Cookie Utilities * @module Ink.Util.Cookie_1 * @version 1 */ Ink.createModule('Ink.Util.Cookie', '1', [], function() { 'use strict'; /** * @namespace Ink.Util.Cookie_1 */ var Cookie = { /** * Gets an object with the current page cookies. * * @method get * @param {String} name The cookie name. * @return {String|Object} If the name is specified, it returns the value of that key. Otherwise it returns the full cookie object * @public * @static * @sample Ink_Util_Cookie_get.html */ get: function(name) { var cookie = document.cookie || false; var _Cookie = {}; if(cookie) { cookie = cookie.replace(new RegExp("; ", "g"), ';'); var aCookie = cookie.split(';'); var aItem = []; if(aCookie.length > 0) { for(var i=0; i < aCookie.length; i++) { aItem = aCookie[i].split('='); if(aItem.length === 2) { _Cookie[aItem[0]] = decodeURIComponent(aItem[1]); } aItem = []; } } } if(name) { if(typeof(_Cookie[name]) !== 'undefined') { return _Cookie[name]; } else { return null; } } return _Cookie; }, /** * Sets a cookie. * * @method set * @param {String} name Cookie name. * @param {String} value Cookie value. * @param {Number} [expires] Number of seconds the cookie will be valid for. * @param {String} [path] Path for the cookie. Defaults to '/'. * @param {String} [domain] Domain for the cookie. Defaults to current hostname. * @param {Boolean} [secure] Flag for secure. Default 'false'. * @public * @static * @sample Ink_Util_Cookie_set.html */ set: function(name, value, expires, path, domain, secure) { var sName; if(!name || value===false || typeof(name) === 'undefined' || typeof(value) === 'undefined') { return false; } else { sName = name+'='+encodeURIComponent(value); } var sExpires = false; var sPath = false; var sDomain = false; var sSecure = false; if(expires && typeof(expires) !== 'undefined' && !isNaN(expires)) { var oDate = new Date(); var sDate = (parseInt(Number(oDate.valueOf()), 10) + (Number(parseInt(expires, 10)) * 1000)); var nDate = new Date(sDate); var expiresString = nDate.toGMTString(); var re = new RegExp("([^\\s]+)(\\s\\d\\d)\\s(\\w\\w\\w)\\s(.*)"); expiresString = expiresString.replace(re, "$1$2-$3-$4"); sExpires = 'expires='+expiresString; } else { if(typeof(expires) !== 'undefined' && !isNaN(expires) && Number(parseInt(expires, 10))===0) { sExpires = ''; } else { sExpires = 'expires=Thu, 01-Jan-2037 00:00:01 GMT'; } } if(path && typeof(path) !== 'undefined') { sPath = 'path='+path; } else { sPath = 'path=/'; } if(domain && typeof(domain) !== 'undefined') { sDomain = 'domain='+domain; } else { var portClean = new RegExp(":(.*)"); sDomain = 'domain='+window.location.host; sDomain = sDomain.replace(portClean,""); } if(secure && typeof(secure) !== 'undefined') { sSecure = secure; } else { sSecure = false; } document.cookie = sName+'; '+sExpires+'; '+sPath+'; '+sDomain+'; '+sSecure; }, /** * Deletes a cookie. * * @method remove * @param {String} cookieName Cookie name. * @param {String} [path] Path of the cookie. Defaults to '/'. * @param {String} [domain] Domain of the cookie. Defaults to current hostname. * @public * @static * @sample Ink_Util_Cookie_remove.html */ remove: function(cookieName, path, domain) { //var expiresDate = 'Thu, 01-Jan-1970 00:00:01 GMT'; var sPath = false; var sDomain = false; var expiresDate = -999999999; if(path && typeof(path) !== 'undefined') { sPath = path; } else { sPath = '/'; } if(domain && typeof(domain) !== 'undefined') { sDomain = domain; } else { sDomain = window.location.host; } this.set(cookieName, 'deleted', expiresDate, sPath, sDomain); } }; return Cookie; }); /** * Date utility functions * @module Ink.Util.Date_1 * @version 1 */ Ink.createModule('Ink.Util.Date', '1', [], function() { 'use strict'; /** * @namespace Ink.Util.Date_1 */ var InkDate = { /** * Function that returns the string representation of the month [PT only] * * @method _months * @param {Number} index Month javascript (0 to 11) * @return {String} The month's name * @private * @static * @example * console.log( InkDate._months(0) ); // Result: Janeiro */ _months: function(index){ var _m = ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro']; return _m[index]; }, /** * Function that returns the month [PT only] ( 0 to 11 ) * * @method _iMonth * @param {String} month Month javascript (0 to 11) * @return {Number} The month's number * @private * @static * @example * console.log( InkDate._iMonth('maio') ); // Result: 4 */ _iMonth : function( month ) { if ( Number( month ) ) { return +month - 1; } return { 'janeiro' : 0 , 'jan' : 0 , 'fevereiro' : 1 , 'fev' : 1 , 'março' : 2 , 'mar' : 2 , 'abril' : 3 , 'abr' : 3 , 'maio' : 4 , 'mai' : 4 , 'junho' : 5 , 'jun' : 5 , 'julho' : 6 , 'jul' : 6 , 'agosto' : 7 , 'ago' : 7 , 'setembro' : 8 , 'set' : 8 , 'outubro' : 9 , 'out' : 9 , 'novembro' : 10 , 'nov' : 10 , 'dezembro' : 11 , 'dez' : 11 }[ month.toLowerCase( ) ]; } , /** * Function that returns the representation the day of the week [PT Only] * * @method _wDays * @param {Number} index Week's day index * @return {String} The week's day name * @private * @static * @example * console.log( InkDate._wDays(0) ); // Result: Domingo */ _wDays: function(index){ var _d = ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado']; return _d[index]; }, /** * Function that returns day of the week in javascript 1 to 7 * * @method _iWeek * @param {String} week Week's day name * @return {Number} The week's day index * @private * @static * @example * console.log( InkDate._iWeek('quarta') ); // Result: 3 */ _iWeek: function( week ) { if ( Number( week ) ) { return +week || 7; } return { 'segunda' : 1 , 'seg' : 1 , 'terça' : 2 , 'ter' : 2 , 'quarta' : 3 , 'qua' : 3 , 'quinta' : 4 , 'qui' : 4 , 'sexta' : 5 , 'sex' : 5 , 'sábado' : 6 , 'sáb' : 6 , 'domingo' : 7 , 'dom' : 7 }[ week.toLowerCase( ) ]; }, /** * Function that returns the number of days of a given month (m) on a given year (y) * * @method _daysInMonth * @param {Number} _m Month * @param {Number} _y Year * @return {Number} Number of days of a give month on a given year * @private * @static * @example * console.log( InkDate._daysInMonth(2,2013) ); // Result: 28 */ _daysInMonth: function(_m,_y){ var nDays; if(_m===1 || _m===3 || _m===5 || _m===7 || _m===8 || _m===10 || _m===12) { nDays= 31; } else if ( _m===4 || _m===6 || _m===9 || _m===11) { nDays = 30; } else { if((_y%400===0) || (_y%4===0 && _y%100!==0)) { nDays = 29; } else { nDays = 28; } } return nDays; }, /** * Formats a date object. * This works exactly as php date() function. http://php.net/manual/en/function.date.php * * @method get * @param {String} format The format in which the date it will be formatted. * @param {Date} [_date] The date to format. Can receive unix timestamp or a date object. Defaults to current time. * @return {String} Formatted date * @public * @static * @sample Ink_Util_Date_get.html */ get: function(format, _date){ /*jshint maxcomplexity:65 */ if(typeof(format) === 'undefined' || format === ''){ format = "Y-m-d"; } var iFormat = format.split(""); var result = new Array(iFormat.length); var escapeChar = "\\"; var jsDate; if (typeof(_date) === 'undefined'){ jsDate = new Date(); } else if (typeof(_date)==='number'){ jsDate = new Date(_date*1000); } else { jsDate = new Date(_date); } var jsFirstDay, jsThisDay, jsHour; /* This switch is presented in the same order as in php date function (PHP 5.2.2) */ for (var i = 0; i < iFormat.length; i++) { switch(iFormat[i]) { case escapeChar: result[i] = iFormat[i+1]; i++; break; /* DAY */ case "d": /* Day of the month, 2 digits with leading zeros; ex: 01 to 31 */ var jsDay = jsDate.getDate(); result[i] = (String(jsDay).length > 1) ? jsDay : "0" + jsDay; break; case "D": /* A textual representation of a day, three letters; Seg to Dom */ result[i] = this._wDays(jsDate.getDay()).substring(0, 3); break; case "j": /* Day of the month without leading zeros; ex: 1 to 31 */ result[i] = jsDate.getDate(); break; case "l": /* A full textual representation of the day of the week; Domingo to Sabado */ result[i] = this._wDays(jsDate.getDay()); break; case "N": /* ISO-8601 numeric representation of the day of the week; 1 (Segunda) to 7 (Domingo) */ result[i] = jsDate.getDay() || 7; break; case "S": /* English ordinal suffix for the day of the month, 2 characters; st, nd, rd or th. Works well with j */ var temp = jsDate.getDate(); var suffixes = ["st", "nd", "rd"]; var suffix = ""; if (temp >= 11 && temp <= 13) { result[i] = "th"; } else { result[i] = (suffix = suffixes[String(temp).substr(-1) - 1]) ? (suffix) : ("th"); } break; case "w": /* Numeric representation of the day of the week; 0 (for Sunday) through 6 (for Saturday) */ result[i] = jsDate.getDay(); break; case "z": /* The day of the year (starting from 0); 0 to 365 */ jsFirstDay = Date.UTC(jsDate.getFullYear(), 0, 0); jsThisDay = Date.UTC(jsDate.getFullYear(), jsDate.getMonth(), jsDate.getDate()); result[i] = Math.floor((jsThisDay - jsFirstDay) / (1000 * 60 * 60 * 24)); break; /* WEEK */ case "W": /* ISO-8601 week number of year, weeks starting on Monday; ex: 42 (the 42nd week in the year) */ var jsYearStart = new Date( jsDate.getFullYear( ) , 0 , 1 ); jsFirstDay = jsYearStart.getDay() || 7; var days = Math.floor( ( jsDate - jsYearStart ) / ( 24 * 60 * 60 * 1000 ) + 1 ); result[ i ] = Math.ceil( ( days - ( 8 - jsFirstDay ) ) / 7 ) + 1; break; /* MONTH */ case "F": /* A full textual representation of a month, such as Janeiro or Marco; Janeiro a Dezembro */ result[i] = this._months(jsDate.getMonth()); break; case "m": /* Numeric representation of a month, with leading zeros; 01 to 12 */ var jsMonth = String(jsDate.getMonth() + 1); result[i] = (jsMonth.length > 1) ? jsMonth : "0" + jsMonth; break; case "M": /* A short textual representation of a month, three letters; Jan a Dez */ result[i] = this._months(jsDate.getMonth()).substring(0,3); break; case "n": /* Numeric representation of a month, without leading zeros; 1 a 12 */ result[i] = jsDate.getMonth() + 1; break; case "t": /* Number of days in the given month; ex: 28 */ result[i] = this._daysInMonth(jsDate.getMonth()+1,jsDate.getYear()); break; /* YEAR */ case "L": /* Whether it's a leap year; 1 if it is a leap year, 0 otherwise. */ var jsYear = jsDate.getFullYear(); result[i] = (jsYear % 4) ? false : ( (jsYear % 100) ? true : ( (jsYear % 400) ? false : true ) ); break; case "o": /* ISO-8601 year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. */ throw '"o" not implemented!'; case "Y": /* A full numeric representation of a year, 4 digits; 1999 */ result[i] = jsDate.getFullYear(); break; case "y": /* A two digit representation of a year; 99 */ result[i] = String(jsDate.getFullYear()).substring(2); break; /* TIME */ case "a": /* Lowercase Ante meridiem and Post meridiem; am or pm */ result[i] = (jsDate.getHours() < 12) ? "am" : "pm"; break; case "A": /* Uppercase Ante meridiem and Post meridiem; AM or PM */ result[i] = (jsDate.getHours < 12) ? "AM" : "PM"; break; case "B": /* Swatch Internet time; 000 through 999 */ throw '"B" not implemented!'; case "g": /* 12-hour format of an hour without leading zeros; 1 to 12 */ jsHour = jsDate.getHours(); result[i] = (jsHour <= 12) ? jsHour : (jsHour - 12); break; case "G": /* 24-hour format of an hour without leading zeros; 1 to 23 */ result[i] = String(jsDate.getHours()); break; case "h": /* 12-hour format of an hour with leading zeros; 01 to 12 */ jsHour = String(jsDate.getHours()); jsHour = (jsHour <= 12) ? jsHour : (jsHour - 12); result[i] = (jsHour.length > 1) ? jsHour : "0" + jsHour; break; case "H": /* 24-hour format of an hour with leading zeros; 01 to 24 */ jsHour = String(jsDate.getHours()); result[i] = (jsHour.length > 1) ? jsHour : "0" + jsHour; break; case "i": /* Minutes with leading zeros; 00 to 59 */ var jsMinute = String(jsDate.getMinutes()); result[i] = (jsMinute.length > 1) ? jsMinute : "0" + jsMinute; break; case "s": /* Seconds with leading zeros; 00 to 59; */ var jsSecond = String(jsDate.getSeconds()); result[i] = (jsSecond.length > 1) ? jsSecond : "0" + jsSecond; break; case "u": /* Microseconds */ throw '"u" not implemented!'; /* TIMEZONE */ case "e": /* Timezone identifier */ throw '"e" not implemented!'; case "I": /* "1" if Daylight Savings Time, "0" otherwise. Works only on the northern hemisphere */ jsFirstDay = new Date(jsDate.getFullYear(), 0, 1); result[i] = (jsDate.getTimezoneOffset() !== jsFirstDay.getTimezoneOffset()) ? (1) : (0); break; case "O": /* Difference to Greenwich time (GMT) in hours */ var jsMinZone = jsDate.getTimezoneOffset(); var jsMinutes = jsMinZone % 60; jsHour = String(((jsMinZone - jsMinutes) / 60) * -1); if (jsHour.charAt(0) !== "-") { jsHour = "+" + jsHour; } jsHour = (jsHour.length === 3) ? (jsHour) : (jsHour.replace(/([+\-])(\d)/, "$1" + 0 + "$2")); result[i] = jsHour + jsMinutes + "0"; break; case "P": /* Difference to Greenwich time (GMT) with colon between hours and minutes */ throw '"P" not implemented!'; case "T": /* Timezone abbreviation */ throw '"T" not implemented!'; case "Z": /* Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. */ result[i] = jsDate.getTimezoneOffset() * 60; break; /* FULL DATE/TIME */ case "c": /* ISO 8601 date */ throw '"c" not implemented!'; case "r": /* RFC 2822 formatted date */ var jsDayName = this._wDays(jsDate.getDay()).substr(0, 3); var jsMonthName = this._months(jsDate.getMonth()).substr(0, 3); result[i] = jsDayName + ", " + jsDate.getDate() + " " + jsMonthName + this.get(" Y H:i:s O",jsDate); break; case "U": /* Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) */ result[i] = Math.floor(jsDate.getTime() / 1000); break; default: result[i] = iFormat[i]; } } return result.join(''); }, /** * Creates a date object based on a format string. * This works exactly as php date() function. http://php.net/manual/en/function.date.php * * @method set * @param {String} [format] The format in which the date will be formatted. Defaults to 'Y-m-d' * @param {String} str_date The date formatted. * @return {Date} Date object based on the formatted date and format * @public * @static * @sample Ink_Util_Date_set.html */ set : function( format , str_date ) { if ( typeof str_date === 'undefined' ) { return ; } if ( typeof format === 'undefined' || format === '' ) { format = "Y-m-d"; } var iFormat = format.split(""); var result = new Array( iFormat.length ); var escapeChar = "\\"; var mList; var objIndex = { year : undefined , month : undefined , day : undefined , dayY : undefined , dayW : undefined , week : undefined , hour : undefined , hourD : undefined , min : undefined , sec : undefined , msec : undefined , ampm : undefined , diffM : undefined , diffH : undefined , date : undefined }; var matches = 0; /* This switch is presented in the same order as in php date function (PHP 5.2.2) */ for ( var i = 0; i < iFormat.length; i++) { switch( iFormat[ i ] ) { case escapeChar: result[i] = iFormat[ i + 1 ]; i++; break; /* DAY */ case "d": /* Day of the month, 2 digits with leading zeros; ex: 01 to 31 */ result[ i ] = '(\\d{2})'; objIndex.day = { original : i , match : matches++ }; break; case "j": /* Day of the month without leading zeros; ex: 1 to 31 */ result[ i ] = '(\\d{1,2})'; objIndex.day = { original : i , match : matches++ }; break; case "D": /* A textual representation of a day, three letters; Seg to Dom */ result[ i ] = '([\\wá]{3})'; objIndex.dayW = { original : i , match : matches++ }; break; case "l": /* A full textual representation of the day of the week; Domingo to Sabado */ result[i] = '([\\wá]{5,7})'; objIndex.dayW = { original : i , match : matches++ }; break; case "N": /* ISO-8601 numeric representation of the day of the week; 1 (Segunda) to 7 (Domingo) */ result[ i ] = '(\\d)'; objIndex.dayW = { original : i , match : matches++ }; break; case "w": /* Numeric representation of the day of the week; 0 (for Sunday) through 6 (for Saturday) */ result[ i ] = '(\\d)'; objIndex.dayW = { original : i , match : matches++ }; break; case "S": /* English ordinal suffix for the day of the month, 2 characters; st, nd, rd or th. Works well with j */ result[ i ] = '\\w{2}'; break; case "z": /* The day of the year (starting from 0); 0 to 365 */ result[ i ] = '(\\d{1,3})'; objIndex.dayY = { original : i , match : matches++ }; break; /* WEEK */ case "W": /* ISO-8601 week number of year, weeks starting on Monday; ex: 42 (the 42nd week in the year) */ result[ i ] = '(\\d{1,2})'; objIndex.week = { original : i , match : matches++ }; break; /* MONTH */ case "F": /* A full textual representation of a month, such as Janeiro or Marco; Janeiro a Dezembro */ result[ i ] = '([\\wç]{4,9})'; objIndex.month = { original : i , match : matches++ }; break; case "M": /* A short textual representation of a month, three letters; Jan a Dez */ result[ i ] = '(\\w{3})'; objIndex.month = { original : i , match : matches++ }; break; case "m": /* Numeric representation of a month, with leading zeros; 01 to 12 */ result[ i ] = '(\\d{2})'; objIndex.month = { original : i , match : matches++ }; break; case "n": /* Numeric representation of a month, without leading zeros; 1 a 12 */ result[ i ] = '(\\d{1,2})'; objIndex.month = { original : i , match : matches++ }; break; case "t": /* Number of days in the given month; ex: 28 */ result[ i ] = '\\d{2}'; break; /* YEAR */ case "L": /* Whether it's a leap year; 1 if it is a leap year, 0 otherwise. */ result[ i ] = '\\w{4,5}'; break; case "o": /* ISO-8601 year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. */ throw '"o" not implemented!'; case "Y": /* A full numeric representation of a year, 4 digits; 1999 */ result[ i ] = '(\\d{4})'; objIndex.year = { original : i , match : matches++ }; break; case "y": /* A two digit representation of a year; 99 */ result[ i ] = '(\\d{2})'; if ( typeof objIndex.year === 'undefined' || iFormat[ objIndex.year.original ] !== 'Y' ) { objIndex.year = { original : i , match : matches++ }; } break; /* TIME */ case "a": /* Lowercase Ante meridiem and Post meridiem; am or pm */ result[ i ] = '(am|pm)'; objIndex.ampm = { original : i , match : matches++ }; break; case "A": /* Uppercase Ante meridiem and Post meridiem; AM or PM */ result[ i ] = '(AM|PM)'; objIndex.ampm = { original : i , match : matches++ }; break; case "B": /* Swatch Internet time; 000 through 999 */ throw '"B" not implemented!'; case "g": /* 12-hour format of an hour without leading zeros; 1 to 12 */ result[ i ] = '(\\d{1,2})'; objIndex.hourD = { original : i , match : matches++ }; break; case "G": /* 24-hour format of an hour without leading zeros; 1 to 23 */ result[ i ] = '(\\d{1,2})'; objIndex.hour = { original : i , match : matches++ }; break; case "h": /* 12-hour format of an hour with leading zeros; 01 to 12 */ result[ i ] = '(\\d{2})'; objIndex.hourD = { original : i , match : matches++ }; break; case "H": /* 24-hour format of an hour with leading zeros; 01 to 24 */ result[ i ] = '(\\d{2})'; objIndex.hour = { original : i , match : matches++ }; break; case "i": /* Minutes with leading zeros; 00 to 59 */ result[ i ] = '(\\d{2})'; objIndex.min = { original : i , match : matches++ }; break; case "s": /* Seconds with leading zeros; 00 to 59; */ result[ i ] = '(\\d{2})'; objIndex.sec = { original : i , match : matches++ }; break; case "u": /* Microseconds */ throw '"u" not implemented!'; /* TIMEZONE */ case "e": /* Timezone identifier */ throw '"e" not implemented!'; case "I": /* "1" if Daylight Savings Time, "0" otherwise. Works only on the northern hemisphere */ result[i] = '\\d'; break; case "O": /* Difference to Greenwich time (GMT) in hours */ result[ i ] = '([-+]\\d{4})'; objIndex.diffH = { original : i , match : matches++ }; break; case "P": /* Difference to Greenwich time (GMT) with colon between hours and minutes */ throw '"P" not implemented!'; case "T": /* Timezone abbreviation */ throw '"T" not implemented!'; case "Z": /* Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. */ result[ i ] = '(\\-?\\d{1,5})'; objIndex.diffM = { original : i , match : matches++ }; break; /* FULL DATE/TIME */ case "c": /* ISO 8601 date */ throw '"c" not implemented!'; case "r": /* RFC 2822 formatted date */ result[ i ] = '([\\wá]{3}, \\d{1,2} \\w{3} \\d{4} \\d{2}:\\d{2}:\\d{2} [+\\-]\\d{4})'; objIndex.date = { original : i , match : matches++ }; break; case "U": /* Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) */ result[ i ] = '(\\d{1,13})'; objIndex.date = { original : i , match : matches++ }; break; default: result[ i ] = iFormat[ i ]; } } var pattr = new RegExp( result.join('') ); try { mList = str_date.match( pattr ); if ( !mList ) { return; } } catch ( e ) { return ; } var _haveDatetime = typeof objIndex.date !== 'undefined'; var _haveYear = typeof objIndex.year !== 'undefined'; var _haveYDay = typeof objIndex.dayY !== 'undefined'; var _haveDay = typeof objIndex.day !== 'undefined'; var _haveMonth = typeof objIndex.month !== 'undefined'; var _haveMonthDay = _haveMonth && _haveDay; var _haveOnlyDay = !_haveMonth && _haveDay; var _haveWDay = typeof objIndex.dayW !== 'undefined'; var _haveWeek = typeof objIndex.week !== 'undefined'; var _haveWeekWDay = _haveWeek && _haveWDay; var _haveOnlyWDay = !_haveWeek && _haveWDay; var _validDate = _haveYDay || _haveMonthDay || !_haveYear && _haveOnlyDay || _haveWeekWDay || !_haveYear && _haveOnlyWDay; var _noDate = !_haveYear && !_haveYDay && !_haveDay && !_haveMonth && !_haveWDay && !_haveWeek; var _haveHour12 = typeof objIndex.hourD !== 'undefined' && typeof objIndex.ampm !== 'undefined'; var _haveHour24 = typeof objIndex.hour !== 'undefined'; var _haveHour = _haveHour12 || _haveHour24; var _haveMin = typeof objIndex.min !== 'undefined'; var _haveSec = typeof objIndex.sec !== 'undefined'; var _haveMSec = typeof objIndex.msec !== 'undefined'; var _haveMoreM = !_noDate || _haveHour; var _haveMoreS = _haveMoreM || _haveMin; var _haveDiffM = typeof objIndex.diffM !== 'undefined'; var _haveDiffH = typeof objIndex.diffH !== 'undefined'; //var _haveGMT = _haveDiffM || _haveDiffH; var hour; var min; if ( _haveDatetime ) { if ( iFormat[ objIndex.date.original ] === 'U' ) { return new Date( +mList[ objIndex.date.match + 1 ] * 1000 ); } var dList = mList[ objIndex.date.match + 1 ].match( /\w{3}, (\d{1,2}) (\w{3}) (\d{4}) (\d{2}):(\d{2}):(\d{2}) ([+\-]\d{4})/ ); hour = +dList[ 4 ] + ( +dList[ 7 ].slice( 0 , 3 ) ); min = +dList[ 5 ] + ( dList[ 7 ].slice( 0 , 1 ) + dList[ 7 ].slice( 3 ) ) / 100 * 60; return new Date( dList[ 3 ] , this._iMonth( dList[ 2 ] ) , dList[ 1 ] , hour , min , dList[ 6 ] ); } var _d = new Date( ); var year; var month; var day; var sec; var msec; var gmt; if ( !_validDate && !_noDate ) { return ; } if ( _validDate ) { if ( _haveYear ) { var _y = _d.getFullYear( ) - 50 + ''; year = mList[ objIndex.year.match + 1 ]; if ( iFormat[ objIndex.year.original ] === 'y' ) { year = +_y.slice( 0 , 2 ) + ( year >= ( _y ).slice( 2 ) ? 0 : 1 ) + year; } } else { year = _d.getFullYear(); } if ( _haveYDay ) { month = 0; day = mList[ objIndex.dayY.match + 1 ]; } else if ( _haveDay ) { if ( _haveMonth ) { month = this._iMonth( mList[ objIndex.month.match + 1 ] ); } else { month = _d.getMonth( ); } day = mList[ objIndex.day.match + 1 ]; } else { month = 0; var week; if ( _haveWeek ) { week = mList[ objIndex.week.match + 1 ]; } else { week = this.get( 'W' , _d ); } day = ( week - 2 ) * 7 + ( 8 - ( ( new Date( year , 0 , 1 ) ).getDay( ) || 7 ) ) + this._iWeek( mList[ objIndex.week.match + 1 ] ); } if ( month === 0 && day > 31 ) { var aux = new Date( year , month , day ); month = aux.getMonth( ); day = aux.getDate( ); } } else { year = _d.getFullYear( ); month = _d.getMonth( ); day = _d.getDate( ); } if ( _haveHour12 ) { hour = +mList[ objIndex.hourD.match + 1 ] + ( mList[ objIndex.ampm.match + 1 ] === 'pm' ? 12 : 0 ); } else if ( _haveHour24 ) { hour = mList[ objIndex.hour.match + 1 ]; } else if ( _noDate ) { hour = _d.getHours( ); } else { hour = '00'; } if ( _haveMin ) { min = mList[ objIndex.min.match + 1 ]; } else if ( !_haveMoreM ) { min = _d.getMinutes( ); } else { min = '00'; } if ( _haveSec ) { sec = mList[ objIndex.sec.match + 1 ]; } else if ( !_haveMoreS ) { sec = _d.getSeconds( ); } else { sec = '00'; } if ( _haveMSec ) { msec = mList[ objIndex.msec.match + 1 ]; } else { msec = '000'; } if ( _haveDiffH ) { gmt = mList[ objIndex.diffH.match + 1 ]; } else if ( _haveDiffM ) { gmt = String( -1 * mList[ objIndex.diffM.match + 1 ] / 60 * 100 ).replace( /^(\d)/ , '+$1' ).replace( /(^[\-+])(\d{3}$)/ , '$10$2' ); } else { gmt = '+0000'; } return new Date( year, month, day, hour, min, sec ); } }; return InkDate; }); /** * Dump/Profiling Utilities * @module Ink.Util.Dumper_1 * @version 1 */ Ink.createModule('Ink.Util.Dumper', '1', [], function() { 'use strict'; /** * @namespace Ink.Util.Dumper_1 */ var Dumper = { /** * Hex code for the 'tab' * * @property _tab * @type {String} * @private * @readOnly * @static * */ _tab: '\xA0\xA0\xA0\xA0', /** * Function that returns the argument passed formatted * * @method _formatParam * @param {Mixed} param * @return {String} The argument passed formatted * @private * @static */ _formatParam: function(param) { var formated = ''; switch(typeof(param)) { case 'string': formated = '(string) '+param; break; case 'number': formated = '(number) '+param; break; case 'boolean': formated = '(boolean) '+param; break; case 'object': if(param !== null) { if(param.constructor === Array) { formated = 'Array \n{\n' + this._outputFormat(param, 0) + '\n}'; } else { formated = 'Object \n{\n' + this._outputFormat(param, 0) + '\n}'; } } else { formated = 'null'; } break; default: formated = false; } return formated; }, /** * Function that returns the tabs concatenated * * @method _getTabs * @param {Number} numberOfTabs Number of Tabs * @return {String} Tabs concatenated * @private * @static */ _getTabs: function(numberOfTabs) { var tabs = ''; for(var _i = 0; _i < numberOfTabs; _i++) { tabs += this._tab; } return tabs; }, /** * Function that formats the parameter to display. * * @method _outputFormat * @param {Any} param * @param {Number} dim * @return {String} The parameter passed formatted to displat * @private * @static */ _outputFormat: function(param, dim) { var formated = ''; //var _strVal = false; var _typeof = false; for(var key in param) { if(param[key] !== null) { if(typeof(param[key]) === 'object' && (param[key].constructor === Array || param[key].constructor === Object)) { if(param[key].constructor === Array) { _typeof = 'Array'; } else if(param[key].constructor === Object) { _typeof = 'Object'; } formated += this._tab + this._getTabs(dim) + '[' + key + '] => <b>'+_typeof+'</b>\n'; formated += this._tab + this._getTabs(dim) + '{\n'; formated += this._outputFormat(param[key], dim + 1) + this._tab + this._getTabs(dim) + '}\n'; } else if(param[key].constructor === Function) { continue; } else { formated = formated + this._tab + this._getTabs(dim) + '[' + key + '] => ' + param[key] + '\n'; } } else { formated = formated + this._tab + this._getTabs(dim) + '[' + key + '] => null \n'; } } return formated; }, /** * Prints variable structure. * * @method printDump * @param {Any} param Variable to be dumped. * @param {DOMElement|String} [target] Element to print the dump on. * @public * @static * @sample Ink_Util_Dumper_printDump.html */ printDump: function(param, target) { /*jshint evil:true */ if(!target || typeof(target) === 'undefined') { document.write('<pre>'+this._formatParam(param)+'</pre>'); } else { if(typeof(target) === 'string') { document.getElementById(target).innerHTML = '<pre>' + this._formatParam(param) + '</pre>'; } else if(typeof(target) === 'object') { target.innerHTML = '<pre>'+this._formatParam(param)+'</pre>'; } else { throw "TARGET must be an element or an element ID"; } } }, /** * Get a variable's structure. * * @method returnDump * @param {Any} param Variable to get the structure. * @return {String} The variable's structure. * @public * @static * @sample Ink_Util_Dumper_returnDump.html */ returnDump: function(param) { return this._formatParam(param); }, /** * Alert a variable's structure. * * @method alertDump * @param {Any} param Variable to be dumped. * @public * @static * @sample Ink_Util_Dumper_alertDump.html */ alertDump: function(param) { window.alert(this._formatParam(param).replace(/(<b>)(Array|Object)(<\/b>)/g, "$2")); }, /** * Prints the variable structure to a new window. * * @method windowDump * @param {Any} param Variable to be dumped. * @public * @static * @sample Ink_Util_Dumper_windowDump.html */ windowDump: function(param) { var dumperwindow = 'dumperwindow_'+(Math.random() * 10000); var win = window.open('', dumperwindow, 'width=400,height=300,left=50,top=50,status,menubar,scrollbars,resizable' ); win.document.open(); win.document.write('<pre>'+this._formatParam(param)+'</pre>'); win.document.close(); win.focus(); } }; return Dumper; }); /** * Internationalization Utilities * @module Ink.Util.I18n_1 * @version 1 */ Ink.createModule('Ink.Util.I18n', '1', [], function () { 'use strict'; var pattrText = /\{(?:(\{.*?})|(?:%s:)?(\d+)|(?:%s)?|([\w-]+))}/g; var funcOrVal = function( ret , args ) { if ( typeof ret === 'function' ) { return ret.apply(this, args); } else if (typeof ret !== undefined) { return ret; } else { return ''; } }; /** * You can use this module to internationalize your applications. It roughly emulates GNU gettext's API. * * @class Ink.Util.I18n * @constructor * * @param {Object} dict Object mapping language codes (in the form of `pt_PT`, `pt_BR`, `fr`, `en_US`, etc.) to their `dictionaries` * @param {String} [lang='pt_PT'] language code of the target language * * @sample Ink_Util_I18n_1.html */ var I18n = function( dict , lang , testMode ) { if ( !( this instanceof I18n ) ) { return new I18n( dict , lang , testMode ); } this.reset( ) .lang( lang ) .testMode( testMode ) .append( dict || { } , lang ); }; I18n.prototype = { reset: function( ) { this._dicts = [ ]; this._dict = { }; this._testMode = false; this._lang = this._gLang; return this; }, /** * Adds translation strings for the helper to use. * * @method append * @param {Object} dict Object containing language objects identified by their language code * * @sample Ink_Util_I18n_1_append.html */ append: function( dict ) { this._dicts.push( dict ); this._dict = Ink.extendObj(this._dict , dict[ this._lang ] ); return this; }, /** * Gets or sets the language. * If there are more dictionaries available in cache, they will be loaded. * * @method lang * @param {String} lang Language code to set this instance to. */ lang: function( lang ) { if ( !arguments.length ) { return this._lang; } if ( lang && this._lang !== lang ) { this._lang = lang; this._dict = { }; for ( var i = 0, l = this._dicts.length; i < l; i++ ) { this._dict = Ink.extendObj( this._dict , this._dicts[ i ][ lang ] || { } ); } } return this; }, /** * Sets or unsets test mode. * In test mode, unknown strings are wrapped in `[ ... ]`. This is useful for debugging your application and to make sure all your translation keys are in place. * * @method testMode * @param {Boolean} bool Flag to set the test mode state */ testMode: function( bool ) { if ( !arguments.length ) { return !!this._testMode; } if ( bool !== undefined ) { this._testMode = !!bool; } return this; }, /** * Gest a key from the current dictionary * * @method getKey * @param {String} key * @return {Mixed} The object which happened to be in the current language dictionary on the given key. * * @sample Ink_Util_I18n_1_getKey.html */ getKey: function( key ) { var ret; var gLang = this._gLang; var lang = this._lang; if ( key in this._dict ) { ret = this._dict[ key ]; } else { I18n.langGlobal( lang ); ret = this._gDict[ key ]; I18n.langGlobal( gLang ); } return ret; }, /** * Translates a string. * Given a translation key, return a translated string, with replaced parameters. * When a translated string is not available, the original string is returned unchanged. * * @method text * @param {String} str Key to look for in i18n dictionary (which is returned verbatim if unknown) * @param {Object} [namedParms] Named replacements. Replaces {named} with values in this object. * @param {String} [args] Replacement #1 (replaces first {} and all {1}) * @param {String} [arg2] Replacement #2 (replaces second {} and all {2}) * @param {String} [argn*] Replacement #n (replaces nth {} and all {n}) * * @sample Ink_Util_I18n_1_text.html */ text: function( str /*, replacements...*/ ) { if ( typeof str !== 'string' ) { return; } // Backwards-compat var pars = Array.prototype.slice.call( arguments , 1 ); var idx = 0; var isObj = typeof pars[ 0 ] === 'object'; var original = this.getKey( str ); if ( original === undefined ) { original = this._testMode ? '[' + str + ']' : str; } if ( typeof original === 'number' ) { original += ''; } if (typeof original === 'string') { original = original.replace( pattrText , function( m , $1 , $2 , $3 ) { var ret = $1 ? $1 : $2 ? pars[ $2 - ( isObj ? 0 : 1 ) ] : $3 ? pars[ 0 ][ $3 ] || '' : pars[ (idx++) + ( isObj ? 1 : 0 ) ]; return funcOrVal( ret , [idx].concat(pars) ); }); return original; } return ( typeof original === 'function' ? original.apply( this , pars ) : original instanceof Array ? funcOrVal( original[ pars[ 0 ] ] , pars ) : typeof original === 'object' ? funcOrVal( original[ pars[ 0 ] ] , pars ) : ''); }, /** * Translates and pluralizes text. * Given a singular string, a plural string and a number, translates either the singular or plural string. * * @method ntext * @return {String} * * @param {String} strSin Word to use when count is 1 * @param {String} strPlur Word to use otherwise * @param {Number} count Number which defines which word to use * @param [args*] Extra arguments, to be passed to `text()` * * @sample Ink_Util_I18n_1_ntext.html */ ntext: function( strSin , strPlur , count ) { var pars = Array.prototype.slice.apply( arguments ); var original; if ( pars.length === 2 && typeof strPlur === 'number' ) { original = this.getKey( strSin ); if ( !( original instanceof Array ) ) { return ''; } pars.splice( 0 , 1 ); original = original[ strPlur === 1 ? 0 : 1 ]; } else { pars.splice( 0 , 2 ); original = count === 1 ? strSin : strPlur; } return this.text.apply( this , [ original ].concat( pars ) ); }, /** * Gets the ordinal suffix of a number. * * This works by using transforms (in the form of Objects or Functions) passed into the function or found in the special key `_ordinals` in the active language dictionary. * * @method ordinal * * @param {Number} num Input number * @param {Object|Function} [options]={} Dictionaries for translating. Each of these options' fallback is found in the current language's dictionary. The lookup order is the following: `exceptions`, `byLastDigit`, `default`. Each of these may be either an `Object` or a `Function`. If it's a function, it is called (with `number` and `digit` for any function except for byLastDigit, which is called with the `lastDigit` of the number in question), and if the function returns a string, that is used. If it's an object, the property is looked up using `obj[prop]`. If what is found is a string, it is used directly. * @param {Object|Function} [options.byLastDigit]={} If the language requires the last digit to be considered, mappings of last digits to ordinal suffixes can be created here. * @param {Object|Function} [options.exceptions]={} Map unique, special cases to their ordinal suffixes. * * @returns {String} Ordinal suffix for `num`. * * @sample Ink_Util_I18n_1_ordinal.html **/ ordinal: function( num ) { if ( num === undefined ) { return ''; } var lastDig = +num.toString( ).slice( -1 ); var ordDict = this.getKey( '_ordinals' ); if ( ordDict === undefined ) { return ''; } if ( typeof ordDict === 'string' ) { return ordDict; } var ret; if ( typeof ordDict === 'function' ) { ret = ordDict( num , lastDig ); if ( typeof ret === 'string' ) { return ret; } } if ( 'exceptions' in ordDict ) { ret = typeof ordDict.exceptions === 'function' ? ordDict.exceptions( num , lastDig ) : num in ordDict.exceptions ? funcOrVal( ordDict.exceptions[ num ] , [num , lastDig] ) : undefined; if ( typeof ret === 'string' ) { return ret; } } if ( 'byLastDigit' in ordDict ) { ret = typeof ordDict.byLastDigit === 'function' ? ordDict.byLastDigit( lastDig , num ) : lastDig in ordDict.byLastDigit ? funcOrVal( ordDict.byLastDigit[ lastDig ] , [lastDig , num] ) : undefined; if ( typeof ret === 'string' ) { return ret; } } if ( 'default' in ordDict ) { ret = funcOrVal( ordDict['default'] , [ num , lastDig ] ); if ( typeof ret === 'string' ) { return ret; } } return ''; }, /** * Create an alias. * * Returns an alias to this I18n instance. It contains the I18n methods documented here, but is also a function. If you call it, it just calls `text()`. This is commonly assigned to "_". * * @method alias * @returns {Function} an alias to `text()` on this instance. You can also access the rest of the translation API through this alias. * * @sample Ink_Util_I18n_1_alias.html */ alias: function( ) { var ret = Ink.bind( I18n.prototype.text , this ); ret.ntext = Ink.bind( I18n.prototype.ntext , this ); ret.append = Ink.bind( I18n.prototype.append , this ); ret.ordinal = Ink.bind( I18n.prototype.ordinal , this ); ret.testMode = Ink.bind( I18n.prototype.testMode , this ); return ret; } }; /** * Resets I18n global state (global dictionaries, and default language for instances) * * @method reset * @static * **/ I18n.reset = function( ) { I18n.prototype._gDicts = [ ]; I18n.prototype._gDict = { }; I18n.prototype._gLang = 'pt_PT'; }; I18n.reset( ); /** * Adds a dictionary to be used in all I18n instances for the corresponding language. * * @method appendGlobal * @static * * @param dict {Object} Dictionary to be added * @param lang {String} Language fo the dictionary being added * */ I18n.appendGlobal = function( dict , lang ) { if ( lang ) { if ( !( lang in dict ) ) { var obj = { }; obj[ lang ] = dict; dict = obj; } if ( lang !== I18n.prototype._gLang ) { I18n.langGlobal( lang ); } } I18n.prototype._gDicts.push( dict ); Ink.extendObj( I18n.prototype._gDict , dict[ I18n.prototype._gLang ] ); }; I18n.append = function () { // [3.1.0] remove this alias Ink.warn('Ink.Util.I18n.append() was renamed to appendGlobal().'); return I18n.appendGlobal.apply(I18n, [].slice.call(arguments)); }; /** * Gets or sets the current default language of I18n instances. * * @method langGlobal * @param lang the new language for all I18n instances * * @static * * @return {String} language code */ I18n.langGlobal = function( lang ) { if ( !arguments.length ) { return I18n.prototype._gLang; } if ( lang && I18n.prototype._gLang !== lang ) { I18n.prototype._gLang = lang; I18n.prototype._gDict = { }; for ( var i = 0, l = I18n.prototype._gDicts.length; i < l; i++ ) { Ink.extendObj( I18n.prototype._gDict , I18n.prototype._gDicts[ i ][ lang ] || { } ); } } }; I18n.lang = function () { // [3.1.0] remove this alias Ink.warn('Ink.Util.I18n.lang() was renamed to langGlobal().'); return I18n.langGlobal.apply(I18n, [].slice.call(arguments)); }; return I18n; }); /** * JSON Utilities * @module Ink.Util.Json_1 * @version 1 */ Ink.createModule('Ink.Util.Json', '1', [], function() { 'use strict'; var function_call = Function.prototype.call; var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; function twoDigits(n) { var r = '' + n; if (r.length === 1) { return '0' + r; } else { return r; } } var dateToISOString = Date.prototype.toISOString ? Ink.bind(function_call, Date.prototype.toISOString) : function(date) { // Adapted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString return date.getUTCFullYear() + '-' + twoDigits( date.getUTCMonth() + 1 ) + '-' + twoDigits( date.getUTCDate() ) + 'T' + twoDigits( date.getUTCHours() ) + ':' + twoDigits( date.getUTCMinutes() ) + ':' + twoDigits( date.getUTCSeconds() ) + '.' + String( (date.getUTCMilliseconds()/1000).toFixed(3) ).slice( 2, 5 ) + 'Z'; }; /** * Use this class to convert JSON strings to JavaScript objects * `.parse()` and also to do the opposite operation `.stringify()`. * Internally, the standard JSON implementation is used if available * Otherwise, the functions mimic the standard implementation. * * Here's how to produce JSON from an existing object: * * Ink.requireModules(['Ink.Util.Json_1'], function (Json) { * var obj = { * key1: 'value1', * key2: 'value2', * keyArray: ['arrayValue1', 'arrayValue2', 'arrayValue3'] * }; * Json.stringify(obj); // The above object as a JSON string * }); * * And here is how to parse JSON: * * Ink.requireModules(['Ink.Util.Json_1'], function (Json) { * var source = '{"key": "value", "array": [true, null, false]}'; * Json.parse(source); // The above JSON string as an object * }); * * @namespace Ink.Util.Json_1 * @static * */ var InkJson = { _nativeJSON: window.JSON || null, _convertToUnicode: false, // Escape characters so as to embed them in JSON strings _escape: function (theString) { var _m = { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"': '\\"', '\\': '\\\\' }; if (/["\\\x00-\x1f]/.test(theString)) { theString = theString.replace(/([\x00-\x1f\\"])/g, function(a, b) { var c = _m[b]; if (c) { return c; } c = b.charCodeAt(); return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16); }); } return theString; }, // A character conversion map _toUnicode: function (theString) { if(!this._convertToUnicode) { return this._escape(theString); } else { var unicodeString = ''; var inInt = false; var theUnicode = false; var i = 0; var total = theString.length; while(i < total) { inInt = theString.charCodeAt(i); if( (inInt >= 32 && inInt <= 126) || //(inInt >= 48 && inInt <= 57) || //(inInt >= 65 && inInt <= 90) || //(inInt >= 97 && inInt <= 122) || inInt === 8 || inInt === 9 || inInt === 10 || inInt === 12 || inInt === 13 || inInt === 32 || inInt === 34 || inInt === 47 || inInt === 58 || inInt === 92) { if(inInt === 34 || inInt === 92 || inInt === 47) { theUnicode = '\\'+theString.charAt(i); } else if(inInt === 8) { theUnicode = '\\b'; } else if(inInt === 9) { theUnicode = '\\t'; } else if(inInt === 10) { theUnicode = '\\n'; } else if(inInt === 12) { theUnicode = '\\f'; } else if(inInt === 13) { theUnicode = '\\r'; } else { theUnicode = theString.charAt(i); } } else { if(this._convertToUnicode) { theUnicode = theString.charCodeAt(i).toString(16)+''.toUpperCase(); while (theUnicode.length < 4) { theUnicode = '0' + theUnicode; } theUnicode = '\\u' + theUnicode; } else { theUnicode = theString.charAt(i); } } unicodeString += theUnicode; i++; } return unicodeString; } }, _stringifyValue: function(param) { if (typeof param === 'string') { return '"' + this._toUnicode(param) + '"'; } else if (typeof param === 'number' && (isNaN(param) || !isFinite(param))) { // Unusable numbers go null return 'null'; } else if (typeof param === 'undefined' || param === null) { // And so does undefined return 'null'; } else if (typeof param.toJSON === 'function') { var t = param.toJSON(); if (typeof t === 'string') { return '"' + this._escape(t) + '"'; } else { return this._escape(t.toString()); } } else if (typeof param === 'number' || typeof param === 'boolean') { // These ones' toString methods return valid JSON. return '' + param; } else if (typeof param === 'function') { return 'null'; // match JSON.stringify } else if (param.constructor === Date) { return '"' + this._escape(dateToISOString(param)) + '"'; } else if (param.constructor === Array) { var arrayString = ''; for (var i = 0, len = param.length; i < len; i++) { if (i > 0) { arrayString += ','; } arrayString += this._stringifyValue(param[i]); } return '[' + arrayString + ']'; } else { // Object var objectString = ''; for (var k in param) { if ({}.hasOwnProperty.call(param, k)) { if (objectString !== '') { objectString += ','; } objectString += '"' + this._escape(k) + '": ' + this._stringifyValue(param[k]); } } return '{' + objectString + '}'; } }, /** * Serializes a JSON object into a string. * * @method stringify * @param {Object} input Data to be serialized into JSON * @param {Boolean} convertToUnicode When `true`, converts string contents to unicode \uXXXX * @return {String} Serialized string * * @sample Ink_Util_Json_stringify.html */ stringify: function(input, convertToUnicode) { this._convertToUnicode = !!convertToUnicode; if(!this._convertToUnicode && this._nativeJSON) { return this._nativeJSON.stringify(input); } return this._stringifyValue(input); // And recurse. }, /** * Parses a JSON text through a function * * @method parse * @param text {String} Input string * @param reviver {Function} Function receiving `(key, value)`, and `this`=(containing object), used to walk objects. * * @return {Object} JSON object * * @sample Ink_Util_Json_parse.html */ /* From https://github.com/douglascrockford/JSON-js/blob/master/json.js */ parse: function (text, reviver) { /*jshint evil:true*/ // The parse method takes a text and an optional reviver function, and returns // a JavaScript value if the text is a valid JSON text. var j; function walk(holder, key) { // The walk method is used to recursively walk the resulting structure so // that modifications can be made. var k, v, value = holder[key]; if (value && typeof value === 'object') { for (k in value) { if (Object.prototype.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v; } else { delete value[k]; } } } } return reviver.call(holder, key, value); } // Parsing happens in four stages. In the first stage, we replace certain // Unicode characters with escape sequences. JavaScript handles many characters // incorrectly, either silently deleting them, or treating them as line endings. text = String(text); cx.lastIndex = 0; if (cx.test(text)) { text = text.replace(cx, function (a) { return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }); } // In the second stage, we run the text against regular expressions that look // for non-JSON patterns. We are especially concerned with '()' and 'new' // because they can cause invocation, and '=' because it can cause mutation. // But just to be safe, we want to reject all unexpected forms. // We split the second stage into 4 regexp operations in order to work around // crippling inefficiencies in IE's and Safari's regexp engines. First we // replace the JSON backslash pairs with '@' (a non-JSON character). Second, we // replace all simple value tokens with ']' characters. Third, we delete all // open brackets that follow a colon or comma or that begin the text. Finally, // we look to see that the remaining characters are only whitespace or ']' or // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. if (/^[\],:{}\s]*$/ .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { // In the third stage we use the eval function to compile the text into a // JavaScript structure. The '{' operator is subject to a syntactic ambiguity // in JavaScript: it can begin a block or an object literal. We wrap the text // in parens to eliminate the ambiguity. j = eval('(' + text + ')'); // In the optional fourth stage, we recursively walk the new structure, passing // each name/value pair to a reviver function for possible transformation. return typeof reviver === 'function' ? walk({'': j}, '') : j; } // If the text is not JSON parseable, then a SyntaxError is thrown. throw new SyntaxError('JSON.parse'); } }; return InkJson; }); /** * String Utilities * @module Ink.Util.String_1 * @version 1 */ Ink.createModule('Ink.Util.String', '1', [], function() { 'use strict'; /** * @namespace Ink.Util.String_1 */ var InkUtilString = { /** * List of special chars * * @property _chars * @type {Array} * @private * @readOnly * @static */ _chars: ['&','à','á','â','ã','ä','å','æ','ç','è','é', 'ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô', 'õ','ö','ø','ù','ú','û','ü','ý','þ','ÿ','À', 'Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë', 'Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö', 'Ø','Ù','Ú','Û','Ü','Ý','Þ','€','\"','ß','<', '>','¢','£','¤','¥','¦','§','¨','©','ª','«', '¬','\xad','®','¯','°','±','²','³','´','µ','¶', '·','¸','¹','º','»','¼','½','¾'], /** * List of the special characters' html entities * * @property _entities * @type {Array} * @private * @readOnly * @static */ _entities: ['amp','agrave','aacute','acirc','atilde','auml','aring', 'aelig','ccedil','egrave','eacute','ecirc','euml','igrave', 'iacute','icirc','iuml','eth','ntilde','ograve','oacute', 'ocirc','otilde','ouml','oslash','ugrave','uacute','ucirc', 'uuml','yacute','thorn','yuml','Agrave','Aacute','Acirc', 'Atilde','Auml','Aring','AElig','Ccedil','Egrave','Eacute', 'Ecirc','Euml','Igrave','Iacute','Icirc','Iuml','ETH','Ntilde', 'Ograve','Oacute','Ocirc','Otilde','Ouml','Oslash','Ugrave', 'Uacute','Ucirc','Uuml','Yacute','THORN','euro','quot','szlig', 'lt','gt','cent','pound','curren','yen','brvbar','sect','uml', 'copy','ordf','laquo','not','shy','reg','macr','deg','plusmn', 'sup2','sup3','acute','micro','para','middot','cedil','sup1', 'ordm','raquo','frac14','frac12','frac34'], /** * List of accented chars * * @property _accentedChars * @type {Array} * @private * @readOnly * @static */ _accentedChars:['à','á','â','ã','ä','å', 'è','é','ê','ë', 'ì','í','î','ï', 'ò','ó','ô','õ','ö', 'ù','ú','û','ü', 'ç','ñ', 'À','Á','Â','Ã','Ä','Å', 'È','É','Ê','Ë', 'Ì','Í','Î','Ï', 'Ò','Ó','Ô','Õ','Ö', 'Ù','Ú','Û','Ü', 'Ç','Ñ'], /** * List of the accented chars (above), but without the accents * * @property _accentedRemovedChars * @type {Array} * @private * @readOnly * @static */ _accentedRemovedChars:['a','a','a','a','a','a', 'e','e','e','e', 'i','i','i','i', 'o','o','o','o','o', 'u','u','u','u', 'c','n', 'A','A','A','A','A','A', 'E','E','E','E', 'I','I','I','I', 'O','O','O','O','O', 'U','U','U','U', 'C','N'], /** * Object that contains the basic HTML unsafe chars, as keys, and their HTML entities as values * * @property _htmlUnsafeChars * @type {Object} * @private * @readOnly * @static */ _htmlUnsafeChars:{'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;',"'":'&apos;'}, /** * Capitalizes a word. * If param as more than one word, it converts first letter of all words that have more than 2 letters * * @method ucFirst * @param {String} string String to capitalize. * @param {Boolean} [firstWordOnly]=false Flag to capitalize only the first word. * @return {String} Camel cased string. * @public * @static * @sample Ink_Util_String_ucFirst.html */ ucFirst: function(string, firstWordOnly) { var replacer = firstWordOnly ? /(^|\s)(\w)(\S{2,})/ : /(^|\s)(\w)(\S{2,})/g; return string ? String(string).replace(replacer, function(_, $1, $2, $3){ return $1 + $2.toUpperCase() + $3.toLowerCase(); }) : string; }, /** * Trims whitespace from strings * * @method trim * @param {String} string String to be trimmed * @return {String} Trimmed string * @public * @static * @sample Ink_Util_String_trim.html */ trim: function(string) { if (typeof string === 'string') { return string.replace(/^\s+|\s+$|\n+$/g, ''); } return string; }, /** * Strips HTML tags from strings * * @method stripTags * @param {String} string String to strip tags from. * @param {String} allowed Comma separated list of allowed tags. * @return {String} Stripped string * @public * @static * @sample Ink_Util_String_stripTags.html */ stripTags: function(string, allowed) { if (allowed && typeof allowed === 'string') { var aAllowed = InkUtilString.trim(allowed).split(','); var aNewAllowed = []; var cleanedTag = false; for(var i=0; i < aAllowed.length; i++) { if(InkUtilString.trim(aAllowed[i]) !== '') { cleanedTag = InkUtilString.trim(aAllowed[i].replace(/(<|\>)/g, '').replace(/\s/, '')); aNewAllowed.push('(<'+cleanedTag+'\\s[^>]+>|<(\\s|\\/)?(\\s|\\/)?'+cleanedTag+'>)'); } } var strAllowed = aNewAllowed.join('|'); var reAllowed = new RegExp(strAllowed, "i"); var aFoundTags = string.match(new RegExp("<[^>]*>", "g")); for(var j=0; j < aFoundTags.length; j++) { if(!aFoundTags[j].match(reAllowed)) { string = string.replace((new RegExp(aFoundTags[j], "gm")), ''); } } return string; } else { return string.replace(/<[^\>]+\>/g, ''); } }, /** * Encodes string into HTML entities. * * @method htmlEntitiesEncode * @param {String} string * @return {String} string encoded * @public * @static * @sample Ink_Util_String_htmlEntitiesEncode.html */ htmlEntitiesEncode: function(string) { if (string && string.replace) { var re = false; for (var i = 0; i < InkUtilString._chars.length; i++) { re = new RegExp(InkUtilString._chars[i], "gm"); string = string.replace(re, '&' + InkUtilString._entities[i] + ';'); } } return string; }, /** * Decodes string from HTML entities. * * @method htmlEntitiesDecode * @param {String} string String to be decoded * @return {String} Decoded string * @public * @static * @sample Ink_Util_String_htmlEntitiesDecode.html */ htmlEntitiesDecode: function(string) { if (string && string.replace) { var re = false; for (var i = 0; i < InkUtilString._entities.length; i++) { re = new RegExp("&"+InkUtilString._entities[i]+";", "gm"); string = string.replace(re, InkUtilString._chars[i]); } string = string.replace(/&#[^;]+;?/g, function($0){ if ($0.charAt(2) === 'x') { return String.fromCharCode(parseInt($0.substring(3), 16)); } else { return String.fromCharCode(parseInt($0.substring(2), 10)); } }); } return string; }, /** * Encode a string to UTF-8. * * @method utf8Encode * @param {String} string String to be encoded * @return {String} string UTF-8 encoded string * @public * @static */ utf8Encode: function(string) { /*jshint bitwise:false*/ string = string.replace(/\r\n/g,"\n"); var utfstring = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utfstring += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { utfstring += String.fromCharCode((c >> 6) | 192); utfstring += String.fromCharCode((c & 63) | 128); } else { utfstring += String.fromCharCode((c >> 12) | 224); utfstring += String.fromCharCode(((c >> 6) & 63) | 128); utfstring += String.fromCharCode((c & 63) | 128); } } return utfstring; }, /** * Truncates a string without breaking words. * * @method shortString * @param {String} str String to truncate * @param {Number} n Number of chars of the short string * @return {String} * @public * @static * @sample Ink_Util_String_shortString.html */ shortString: function(str,n) { var words = str.split(' '); var resultstr = ''; for(var i = 0; i < words.length; i++ ){ if((resultstr + words[i] + ' ').length>=n){ resultstr += '&hellip;'; break; } resultstr += words[i] + ' '; } return resultstr; }, /** * Truncates a string, breaking words and adding ... at the end. * * @method truncateString * @param {String} str String to truncate * @param {Number} length Limit for the returned string, ellipsis included. * @return {String} Truncated String * @public * @static * @sample Ink_Util_String_truncateString.html */ truncateString: function(str, length) { if(str.length - 1 > length) { return str.substr(0, length - 1) + "\u2026"; } else { return str; } }, /** * Decodes a string from UTF-8. * * @method utf8Decode * @param {String} string String to be decoded * @return {String} Decoded string * @public * @static */ utf8Decode: function(utfstring) { /*jshint bitwise:false*/ var string = ""; var i = 0, c = 0, c2 = 0, c3 = 0; while ( i < utfstring.length ) { c = utfstring.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if((c > 191) && (c < 224)) { c2 = utfstring.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utfstring.charCodeAt(i+1); c3 = utfstring.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; }, /** * Removes all accented characters from a string. * * @method removeAccentedChars * @param {String} string String to remove accents from * @return {String} String without accented chars * @public * @static * @sample Ink_Util_String_removeAccentedChars.html */ removeAccentedChars: function(string) { var newString = string; var re = false; for (var i = 0; i < InkUtilString._accentedChars.length; i++) { re = new RegExp(InkUtilString._accentedChars[i], "gm"); newString = newString.replace(re, '' + InkUtilString._accentedRemovedChars[i] + ''); } return newString; }, /** * Count the number of occurrences of a specific needle in a haystack * * @method substrCount * @param {String} haystack String to search in * @param {String} needle String to search for * @return {Number} Number of occurrences * @public * @static * @sample Ink_Util_String_substrCount.html */ substrCount: function(haystack,needle) { return haystack ? haystack.split(needle).length - 1 : 0; }, /** * Eval a JSON - We recommend you Ink.Util.Json * * @method evalJSON * @param {String} strJSON JSON string to eval * @param {Boolean} sanitize Flag to sanitize input * @return {Object} JS Object * @public * @static */ evalJSON: function(strJSON, sanitize) { /* jshint evil:true */ if( (typeof sanitize === 'undefined' || sanitize === null) || InkUtilString.isJSON(strJSON)) { try { if(typeof(JSON) !== "undefined" && typeof(JSON.parse) !== 'undefined'){ return JSON.parse(strJSON); } return eval('('+strJSON+')'); } catch(e) { throw new Error('ERROR: Bad JSON string...'); } } }, /** * Checks if a string is a valid JSON object (string encoded) * * @method isJSON * @param {String} str String to check * @return {Boolean} * @public * @static */ isJSON: function(str) { str = str.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''); return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); }, /** * Escapes unsafe html chars as HTML entities * * @method htmlEscapeUnsafe * @param {String} str String to escape * @return {String} Escaped string * @public * @static * @sample Ink_Util_String_htmlEscapeUnsafe.html */ htmlEscapeUnsafe: function(str){ var chars = InkUtilString._htmlUnsafeChars; return str !== null ? String(str).replace(/[<>&'"]/g,function(c){return chars[c];}) : str; }, /** * Normalizes whitespace in string. * String is trimmed and sequences of whitespaces are collapsed. * * @method normalizeWhitespace * @param {String} str String to normalize * @return {String} Normalized string * @public * @static * @sample Ink_Util_String_normalizeWhitespace.html */ normalizeWhitespace: function(str){ return str !== null ? InkUtilString.trim(String(str).replace(/\s+/g,' ')) : str; }, /** * Converts string to unicode. * * @method toUnicode * @param {String} str String to convert * @return {String} Unicoded String * @public * @static * @sample Ink_Util_String_toUnicode.html */ toUnicode: function(str) { if (typeof str === 'string') { var unicodeString = ''; var inInt = false; var theUnicode = false; var total = str.length; var i=0; while(i < total) { inInt = str.charCodeAt(i); if( (inInt >= 32 && inInt <= 126) || inInt === 8 || inInt === 9 || inInt === 10 || inInt === 12 || inInt === 13 || inInt === 32 || inInt === 34 || inInt === 47 || inInt === 58 || inInt === 92) { /* if(inInt == 34 || inInt == 92 || inInt == 47) { theUnicode = '\\'+str.charAt(i); } else { } */ if(inInt === 8) { theUnicode = '\\b'; } else if(inInt === 9) { theUnicode = '\\t'; } else if(inInt === 10) { theUnicode = '\\n'; } else if(inInt === 12) { theUnicode = '\\f'; } else if(inInt === 13) { theUnicode = '\\r'; } else { theUnicode = str.charAt(i); } } else { theUnicode = str.charCodeAt(i).toString(16)+''.toUpperCase(); while (theUnicode.length < 4) { theUnicode = '0' + theUnicode; } theUnicode = '\\u' + theUnicode; } unicodeString += theUnicode; i++; } return unicodeString; } }, /** * Escapes a unicode character. * * @method escape * @param {String} c Character to escape * @return {String} Escaped character. Returns \xXX if hex smaller than 0x100, otherwise \uXXXX * @public * @static * @sample Ink_Util_String_escape.html */ escape: function(c) { var hex = (c).charCodeAt(0).toString(16).split(''); if (hex.length < 3) { while (hex.length < 2) { hex.unshift('0'); } hex.unshift('x'); } else { while (hex.length < 4) { hex.unshift('0'); } hex.unshift('u'); } hex.unshift('\\'); return hex.join(''); }, /** * Unescapes a unicode character escape sequence * * @method unescape * @param {String} es Escape sequence * @return {String} String un-unicoded * @public * @static * @sample Ink_Util_String_unescape.html */ unescape: function(es) { var idx = es.lastIndexOf('0'); idx = idx === -1 ? 2 : Math.min(idx, 2); //console.log(idx); var hexNum = es.substring(idx); //console.log(hexNum); var num = parseInt(hexNum, 16); return String.fromCharCode(num); }, /** * Escapes a string to unicode characters * * @method escapeText * @param {String} txt * @param {Array} [whiteList] Whitelist of characters * @return {String} String escaped to Unicode * @public * @static * @sample Ink_Util_String_escapeText.html */ escapeText: function(txt, whiteList) { if (whiteList === undefined) { whiteList = ['[', ']', '\'', ',']; } var txt2 = []; var c, C; for (var i = 0, f = txt.length; i < f; ++i) { c = txt[i]; C = c.charCodeAt(0); if (C < 32 || C > 126 && whiteList.indexOf(c) === -1) { c = InkUtilString.escape(c); } txt2.push(c); } return txt2.join(''); }, /** * Regex to check escaped strings * * @property escapedCharRegex * @type {Regex} * @public * @readOnly * @static */ escapedCharRegex: /(\\x[0-9a-fA-F]{2})|(\\u[0-9a-fA-F]{4})/g, /** * Unescapes a string * * @method unescapeText * @param {String} txt * @return {String} Unescaped string * @public * @static * @sample Ink_Util_String_unescapeText.html */ unescapeText: function(txt) { /*jshint boss:true */ var m; while (m = InkUtilString.escapedCharRegex.exec(txt)) { m = m[0]; txt = txt.replace(m, InkUtilString.unescape(m)); InkUtilString.escapedCharRegex.lastIndex = 0; } return txt; }, /** * Compares two strings. * * @method strcmp * @param {String} str1 First String * @param {String} str2 Second String * @return {Number} * @public * @static * @sample Ink_Util_String_strcmp.html */ strcmp: function(str1, str2) { return ((str1 === str2) ? 0 : ((str1 > str2) ? 1 : -1)); }, /** * Splits a string into smaller chunks * * @method packetize * @param {String} str String to divide * @param {Number} maxLen Maximum chunk size (in characters) * @return {Array} Chunks of the original string * @public * @static * @sample Ink_Util_String_packetize.html */ packetize: function(str, maxLen) { var len = str.length; var parts = new Array( Math.ceil(len / maxLen) ); var chars = str.split(''); var sz, i = 0; while (len) { sz = Math.min(maxLen, len); parts[i++] = chars.splice(0, sz).join(''); len -= sz; } return parts; } }; return InkUtilString; }); /** * URL Utilities * @module Ink.Util.Url_1 * @version 1 */ Ink.createModule('Ink.Util.Url', '1', [], function() { 'use strict'; /** * @namespace Ink.Util.Url_1 */ var Url = { /** * Auxiliary string for encoding * * @property _keyStr * @type {String} * @readOnly * @private */ _keyStr : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', /** * Gets URL of current page * * @method getUrl * @return Current URL * @public * @static * @sample Ink_Util_Url_getUrl.html */ getUrl: function() { return window.location.href; }, /** * Generates an URL string. * * @method genQueryString * @param {String} uri Base URL * @param {Object} params Object to transform to query string * @return {String} URI with query string set * @public * @static * @sample Ink_Util_Url_genQueryString.html */ genQueryString: function(uri, params) { var hasQuestionMark = uri.indexOf('?') !== -1; var sep, pKey, pValue, parts = [uri]; for (pKey in params) { if (params.hasOwnProperty(pKey)) { if (!hasQuestionMark) { sep = '?'; hasQuestionMark = true; } else { sep = '&'; } pValue = params[pKey]; if (typeof pValue !== 'number' && !pValue) { pValue = ''; } parts = parts.concat([sep, encodeURIComponent(pKey), '=', encodeURIComponent(pValue)]); } } return parts.join(''); }, /** * Gets an object from an URL encoded string. * * @method getQueryString * @param {String} [str] URL String. When not specified it uses the current URL. * @return {Object} Key-Value pair object * @public * @static * @sample Ink_Util_Url_getQueryString.html */ getQueryString: function(str) { var url; if(str && typeof(str) !== 'undefined') { url = str; } else { url = this.getUrl(); } var aParams = {}; if(url.match(/\?(.+)/i)) { var queryStr = url.replace(/^(.*)\?([^\#]+)(\#(.*))?/g, "$2"); if(queryStr.length > 0) { var aQueryStr = queryStr.split(/[;&]/); for(var i=0; i < aQueryStr.length; i++) { var pairVar = aQueryStr[i].split('='); aParams[decodeURIComponent(pairVar[0])] = (typeof(pairVar[1]) !== 'undefined' && pairVar[1]) ? decodeURIComponent(pairVar[1]) : false; } } } return aParams; }, /** * Gets the URL hash value * * @method getAnchor * @param {String} [str] URL String. Defaults to current page URL. * @return {String|Boolean} Hash in the URL. If there's no hash, returns false. * @public * @static * @sample Ink_Util_Url_getAnchor.html */ getAnchor: function(str) { var url; if(str && typeof(str) !== 'undefined') { url = str; } else { url = this.getUrl(); } var anchor = false; if(url.match(/#(.+)/)) { anchor = url.replace(/([^#]+)#(.*)/, "$2"); } return anchor; }, /** * Gets the anchor string of an URL * * @method getAnchorString * @param {String} [string] URL to parse. Defaults to current URL. * @return {Object} Key-value pair object of the URL's hashtag 'variables' * @public * @static * @sample Ink_Util_Url_getAnchorString.html */ getAnchorString: function(string) { var url; if(string && typeof(string) !== 'undefined') { url = string; } else { url = this.getUrl(); } var aParams = {}; if(url.match(/#(.+)/i)) { var anchorStr = url.replace(/^([^#]+)#(.*)?/g, "$2"); if(anchorStr.length > 0) { var aAnchorStr = anchorStr.split(/[;&]/); for(var i=0; i < aAnchorStr.length; i++) { var pairVar = aAnchorStr[i].split('='); aParams[decodeURIComponent(pairVar[0])] = (typeof(pairVar[1]) !== 'undefined' && pairVar[1]) ? decodeURIComponent(pairVar[1]) : false; } } } return aParams; }, /** * Parses URL string into URL parts * * @method parseUrl * @param {String} url URL to be parsed * @return {Object} Parsed URL as a key-value object. * @public * @static * @sample Ink_Util_Url_parseUrl.html */ parseUrl: function(url) { var aURL = {}; if(url && typeof url === 'string') { if(url.match(/^([^:]+):\/\//i)) { var re = /^([^:]+):\/\/([^\/]*)\/?([^\?#]*)\??([^#]*)#?(.*)/i; if(url.match(re)) { aURL.scheme = url.replace(re, "$1"); aURL.host = url.replace(re, "$2"); aURL.path = '/'+url.replace(re, "$3"); aURL.query = url.replace(re, "$4") || false; aURL.fragment = url.replace(re, "$5") || false; } } else { var re1 = new RegExp("^([^\\?]+)\\?([^#]+)#(.*)", "i"); var re2 = new RegExp("^([^\\?]+)\\?([^#]+)#?", "i"); var re3 = new RegExp("^([^\\?]+)\\??", "i"); if(url.match(re1)) { aURL.scheme = false; aURL.host = false; aURL.path = url.replace(re1, "$1"); aURL.query = url.replace(re1, "$2"); aURL.fragment = url.replace(re1, "$3"); } else if(url.match(re2)) { aURL.scheme = false; aURL.host = false; aURL.path = url.replace(re2, "$1"); aURL.query = url.replace(re2, "$2"); aURL.fragment = false; } else if(url.match(re3)) { aURL.scheme = false; aURL.host = false; aURL.path = url.replace(re3, "$1"); aURL.query = false; aURL.fragment = false; } } if(aURL.host) { var regPort = /^(.*?)\\:(\\d+)$/i; // check for port if(aURL.host.match(regPort)) { var tmpHost1 = aURL.host; aURL.host = tmpHost1.replace(regPort, "$1"); aURL.port = tmpHost1.replace(regPort, "$2"); } else { aURL.port = false; } // check for user and pass if(aURL.host.match(/@/i)) { var tmpHost2 = aURL.host; aURL.host = tmpHost2.split('@')[1]; var tmpUserPass = tmpHost2.split('@')[0]; if(tmpUserPass.match(/\:/)) { aURL.user = tmpUserPass.split(':')[0]; aURL.pass = tmpUserPass.split(':')[1]; } else { aURL.user = tmpUserPass; aURL.pass = false; } } } } return aURL; }, /** * Formats an URL object into an URL string. * * @method format * @param urlObj Window.location, a.href, or parseUrl object to format * @return {String} Full URL. */ format: function (urlObj) { var protocol = ''; var host = ''; var path = ''; var frag = ''; var query = ''; if (typeof urlObj.protocol === 'string') { protocol = urlObj.protocol + '//'; // here it comes with the colon } else if (typeof urlObj.scheme === 'string') { protocol = urlObj.scheme + '://'; } host = urlObj.host || urlObj.hostname || ''; path = urlObj.path || ''; if (typeof urlObj.query === 'string') { query = urlObj.query; } else if (typeof urlObj.search === 'string') { query = urlObj.search.replace(/^\?/, ''); } if (typeof urlObj.fragment === 'string') { frag = urlObj.fragment; } else if (typeof urlObj.hash === 'string') { frag = urlObj.hash.replace(/#$/, ''); } return [ protocol, host, path, query && '?' + query, frag && '#' + frag ].join(''); }, /** * Gets the last loaded script element * * @method currentScriptElement * @param {String} [match] String to match against the script src attribute * @return {DOMElement|Boolean} Returns the `script` DOM Element or false if unable to find it. * @public * @static * @sample Ink_Util_Url_currentScriptElement.html */ currentScriptElement: function(match) { var aScripts = document.getElementsByTagName('script'); if(typeof(match) === 'undefined') { if(aScripts.length > 0) { return aScripts[(aScripts.length - 1)]; } else { return false; } } else { var curScript = false; var re = new RegExp(""+match+"", "i"); for(var i=0, total = aScripts.length; i < total; i++) { curScript = aScripts[i]; if(re.test(curScript.src)) { return curScript; } } return false; } }, /* base64Encode: function(string) { /** * --function {String} ? * --Convert a string to BASE 64 * @param {String} string - string to convert * @return base64 encoded string * * if(!SAPO.Utility.String || typeof(SAPO.Utility.String) === 'undefined') { throw "SAPO.Utility.Url.base64Encode depends of SAPO.Utility.String, which has not been referred."; } var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; var input = SAPO.Utility.String.utf8Encode(string); while (i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); } return output; }, base64Decode: function(string) { * --function {String} ? * Decode a BASE 64 encoded string * --param {String} string base64 encoded string * --return string decoded if(!SAPO.Utility.String || typeof(SAPO.Utility.String) === 'undefined') { throw "SAPO.Utility.Url.base64Decode depends of SAPO.Utility.String, which has not been referred."; } var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; var input = string.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i < input.length) { enc1 = this._keyStr.indexOf(input.charAt(i++)); enc2 = this._keyStr.indexOf(input.charAt(i++)); enc3 = this._keyStr.indexOf(input.charAt(i++)); enc4 = this._keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 !== 64) { output = output + String.fromCharCode(chr2); } if (enc4 !== 64) { output = output + String.fromCharCode(chr3); } } output = SAPO.Utility.String.utf8Decode(output); return output; }, */ /** * Debug function ? * * @method _debug * @private * @static */ _debug: function() {} }; return Url; }); /** * Validation Utilities * @module Ink.Util.Validator_1 * @version 1 */ Ink.createModule('Ink.Util.Validator', '1', [], function() { 'use strict'; /** * @namespace Ink.Util.Validator_1 */ var Validator = { /** * List of country codes avaible for the isPhone method * * @property _countryCodes * @type {Array} * @private * @static * @readOnly */ _countryCodes : [ 'AO', 'CV', 'MZ', 'PT' ], /** * International number for portugal * * @property _internacionalPT * @type {Number} * @private * @static * @readOnly * */ _internacionalPT: 351, /** * List of all portuguese number prefixes * * @property _indicativosPT * @type {Object} * @private * @static * @readOnly * */ _indicativosPT: { 21: 'lisboa', 22: 'porto', 231: 'mealhada', 232: 'viseu', 233: 'figueira da foz', 234: 'aveiro', 235: 'arganil', 236: 'pombal', 238: 'seia', 239: 'coimbra', 241: 'abrantes', 242: 'ponte de sôr', 243: 'santarém', 244: 'leiria', 245: 'portalegre', 249: 'torres novas', 251: 'valença', 252: 'vila nova de famalicão', 253: 'braga', 254: 'peso da régua', 255: 'penafiel', 256: 'são joão da madeira', 258: 'viana do castelo', 259: 'vila real', 261: 'torres vedras', 262: 'caldas da raínha', 263: 'vila franca de xira', 265: 'setúbal', 266: 'évora', 268: 'estremoz', 269: 'santiago do cacém', 271: 'guarda', 272: 'castelo branco', 273: 'bragança', 274: 'proença-a-nova', 275: 'covilhã', 276: 'chaves', 277: 'idanha-a-nova', 278: 'mirandela', 279: 'moncorvo', 281: 'tavira', 282: 'portimão', 283: 'odemira', 284: 'beja', 285: 'moura', 286: 'castro verde', 289: 'faro', 291: 'funchal, porto santo', 292: 'corvo, faial, flores, horta, pico', 295: 'angra do heroísmo, graciosa, são jorge, terceira', 296: 'ponta delgada, são miguel, santa maria', 91 : 'rede móvel 91 (Vodafone / Yorn)', 93 : 'rede móvel 93 (Optimus)', 96 : 'rede móvel 96 (TMN)', 92 : 'rede móvel 92 (TODOS)', //925 : 'rede móvel 925 (TMN 925)', //926 : 'rede móvel 926 (TMN 926)', //927 : 'rede móvel 927 (TMN 927)', //922 : 'rede móvel 922 (Phone-ix)', 707: 'número único', 760: 'número único', 800: 'número grátis', 808: 'chamada local', 30: 'voip' }, /** * International number for Cabo Verde * * @property _internacionalCV * @type {Number} * @private * @static * @readOnly */ _internacionalCV: 238, /** * List of all Cabo Verde number prefixes * * @property _indicativosCV * @type {Object} * @private * @static * @readOnly */ _indicativosCV: { 2: 'fixo', 91: 'móvel 91', 95: 'móvel 95', 97: 'móvel 97', 98: 'móvel 98', 99: 'móvel 99' }, /** * International number for Angola * * @property _internacionalAO * @type {Number} * @private * @static * @readOnly */ _internacionalAO: 244, /** * List of all Angola number prefixes * * @property _indicativosAO * @type {Object} * @private * @static * @readOnly */ _indicativosAO: { 2: 'fixo', 91: 'móvel 91', 92: 'móvel 92' }, /** * International number for Mozambique * * @property _internacionalMZ * @type {Number} * @private * @static * @readOnly */ _internacionalMZ: 258, /** * List of all Mozambique number prefixes * * @property _indicativosMZ * @type {Object} * @private * @static * @readOnly */ _indicativosMZ: { 2: 'fixo', 82: 'móvel 82', 84: 'móvel 84' }, /** * International number for Timor * * @property _internacionalTL * @type {Number} * @private * @static * @readOnly */ _internacionalTL: 670, /** * List of all Timor number prefixes * * @property _indicativosTL * @type {Object} * @private * @static * @readOnly */ _indicativosTL: { 3: 'fixo', 7: 'móvel 7' }, /** * Regular expression groups for several groups of characters * * http://en.wikipedia.org/wiki/C0_Controls_and_Basic_Latin * http://en.wikipedia.org/wiki/Plane_%28Unicode%29#Basic_Multilingual_Plane * http://en.wikipedia.org/wiki/ISO_8859-1 * * @property _characterGroups * @type {Object} * @private * @static * @readOnly */ _characterGroups: { numbers: ['0-9'], asciiAlpha: ['a-zA-Z'], latin1Alpha: ['a-zA-Z', '\u00C0-\u00FF'], unicodeAlpha: ['a-zA-Z', '\u00C0-\u00FF', '\u0100-\u1FFF', '\u2C00-\uD7FF'], /* whitespace characters */ space: [' '], dash: ['-'], underscore: ['_'], nicknamePunctuation: ['_.-'], singleLineWhitespace: ['\t '], newline: ['\n'], whitespace: ['\t\n\u000B\f\r\u00A0 '], asciiPunctuation: ['\u0021-\u002F', '\u003A-\u0040', '\u005B-\u0060', '\u007B-\u007E'], latin1Punctuation: ['\u0021-\u002F', '\u003A-\u0040', '\u005B-\u0060', '\u007B-\u007E', '\u00A1-\u00BF', '\u00D7', '\u00F7'], unicodePunctuation: ['\u0021-\u002F', '\u003A-\u0040', '\u005B-\u0060', '\u007B-\u007E', '\u00A1-\u00BF', '\u00D7', '\u00F7', '\u2000-\u206F', '\u2E00-\u2E7F', '\u3000-\u303F'] }, /** * Creates a regular expression for several character groups. * * @method createRegExp * * @param Groups* {Object} * Groups to build regular expressions for. Possible keys are: * * - **numbers**: 0-9 * - **asciiAlpha**: a-z, A-Z * - **latin1Alpha**: asciiAlpha, plus printable characters in latin-1 * - **unicodeAlpha**: unicode alphanumeric characters. * - **space**: ' ', the space character. * - **dash**: dash character. * - **underscore**: underscore character. * - **nicknamePunctuation**: dash, dot, underscore * - **singleLineWhitespace**: space and tab (whitespace which only spans one line). * - **newline**: newline character ('\n') * - **whitespace**: whitespace characters in the ASCII character set. * - **asciiPunctuation**: punctuation characters in the ASCII character set. * - **latin1Punctuation**: punctuation characters in latin-1. * - **unicodePunctuation**: punctuation characters in unicode. * */ createRegExp: function (groups) { var re = '^['; for (var key in groups) if (groups.hasOwnProperty(key)) { if (!(key in Validator._characterGroups)) { throw new Error('group ' + key + ' is not a valid character group'); } else if (groups[key]) { re += Validator._characterGroups[key].join(''); } } if (re === '^[') { // No changes return new RegExp('$^'); // match nothing } return new RegExp(re + ']*?$'); }, /** * Checks if a field has the required groups. * * @method checkCharacterGroups * @param {String} s The validation string * @param {Object} [groups]={} What groups are included. See createRegexp * @sample Ink_Util_Validator_checkCharacterGroups.html */ checkCharacterGroups: function (s, groups) { return Validator.createRegExp(groups).test(s); }, /** * Checks if a field contains unicode printable characters. * * @method unicode * @param {String} s The validation string * @param {Object} [options]={} Optional configuration object. See createRegexp */ unicode: function (s, options) { return Validator.checkCharacterGroups(s, Ink.extendObj({ unicodeAlpha: true}, options)); }, /** * Checks if a field only contains latin-1 alphanumeric characters. * Takes options for allowing singleline whitespace, cross-line whitespace and punctuation. * * @method latin1 * * @param {String} s The validation string * @param {Object} [options]={} Optional configuration object. See createRegexp * @sample Ink_Util_Validator_latin1.html */ latin1: function (s, options) { return Validator.checkCharacterGroups(s, Ink.extendObj({ latin1Alpha: true}, options)); }, /** * Checks if a field only contains only ASCII alphanumeric characters. * Takes options for allowing singleline whitespace, cross-line whitespace and punctuation. * * @method ascii * * @param {String} s The validation string * @param {Object} [options]={} Optional configuration object. See createRegexp * @sample Ink_Util_Validator_ascii.html */ ascii: function (s, options) { return Validator.checkCharacterGroups(s, Ink.extendObj({ asciiAlpha: true}, options)); }, /** * Checks if a number is a valid * * @method number * @param {String} numb The number * @param {Object} [options] Further options * @param [options.decimalSep]='.' Allow decimal separator. * @param [options.thousandSep]="," Strip this character from the number. * @param [options.negative]=false Allow negative numbers. * @param [options.decimalPlaces]=null Maximum number of decimal places. Use `0` for an integer number. * @param [options.max]=null Maximum number * @param [options.min]=null Minimum number * @param [options.returnNumber]=false When this option is true, return the number itself when the value is valid. * @sample Ink_Util_Validator_number.html */ number: function (numb, inOptions) { numb = numb + ''; var options = Ink.extendObj({ decimalSep: '.', thousandSep: '', negative: true, decimalPlaces: null, maxDigits: null, max: null, min: null, returnNumber: false }, inOptions || {}); // smart recursion thing sets up aliases for options. if (options.thousandSep) { numb = numb.replace(new RegExp('\\' + options.thousandSep, 'g'), ''); options.thousandSep = ''; return Validator.number(numb, options); } if (options.negative === false) { options.min = 0; options.negative = true; return Validator.number(numb, options); } if (options.decimalSep !== '.') { numb = numb.replace(new RegExp('\\' + options.decimalSep, 'g'), '.'); } if (!/^(-)?(\d+)?(\.\d+)?$/.test(numb) || numb === '') { return false; // forbidden character found } var split; if (options.decimalSep && numb.indexOf(options.decimalSep) !== -1) { split = numb.split(options.decimalSep); if (options.decimalPlaces !== null && split[1].length > options.decimalPlaces) { return false; } } else { split = ['' + numb, '']; } if (options.maxDigits!== null) { if (split[0].replace(/-/g, '').length > options.maxDigits) { return split; } } // Now look at the actual float var ret = parseFloat(numb); if (options.maxExcl !== null && ret >= options.maxExcl || options.minExcl !== null && ret <= options.minExcl) { return false; } if (options.max !== null && ret > options.max || options.min !== null && ret < options.min) { return false; } if (options.returnNumber) { return ret; } else { return true; } }, /** * Checks if a year is Leap "Bissexto" * * @method _isLeapYear * @param {Number} year Year to be checked * @return {Boolean} True if it is a leap year. * @private * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator._isLeapYear( 2004 ) ); // Result: true * console.log( InkValidator._isLeapYear( 2006 ) ); // Result: false * }); */ _isLeapYear: function(year){ var yearRegExp = /^\d{4}$/; if(yearRegExp.test(year)){ return ((year%4) ? false: ((year%100) ? true : ((year%400)? false : true)) ); } return false; }, /** * Object with the date formats available for validation * * @property _dateParsers * @type {Object} * @private * @static * @readOnly */ _dateParsers: { 'yyyy-mm-dd': {day:5, month:3, year:1, sep: '-', parser: /^(\d{4})(\-)(\d{1,2})(\-)(\d{1,2})$/}, 'yyyy/mm/dd': {day:5, month:3, year:1, sep: '/', parser: /^(\d{4})(\/)(\d{1,2})(\/)(\d{1,2})$/}, 'yy-mm-dd': {day:5, month:3, year:1, sep: '-', parser: /^(\d{2})(\-)(\d{1,2})(\-)(\d{1,2})$/}, 'yy/mm/dd': {day:5, month:3, year:1, sep: '/', parser: /^(\d{2})(\/)(\d{1,2})(\/)(\d{1,2})$/}, 'dd-mm-yyyy': {day:1, month:3, year:5, sep: '-', parser: /^(\d{1,2})(\-)(\d{1,2})(\-)(\d{4})$/}, 'dd/mm/yyyy': {day:1, month:3, year:5, sep: '/', parser: /^(\d{1,2})(\/)(\d{1,2})(\/)(\d{4})$/}, 'dd-mm-yy': {day:1, month:3, year:5, sep: '-', parser: /^(\d{1,2})(\-)(\d{1,2})(\-)(\d{2})$/}, 'dd/mm/yy': {day:1, month:3, year:5, sep: '/', parser: /^(\d{1,2})(\/)(\d{1,2})(\/)(\d{2})$/} }, /** * Gets the number of days in a given month of a given year * * @method _daysInMonth * @param {Number} _m Month (1 to 12) * @param {Number} _y Year * @return {Number} Returns the number of days in a given month of a given year * @private * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator._daysInMonth( 2, 2004 ) ); // Result: 29 * console.log( InkValidator._daysInMonth( 2, 2006 ) ); // Result: 28 * }); */ _daysInMonth: function(_m,_y){ var nDays=0; _m = parseInt(_m, 10); _y = parseInt(_y, 10); if(_m===1 || _m===3 || _m===5 || _m===7 || _m===8 || _m===10 || _m===12) { nDays= 31; } else if ( _m===4 || _m===6 || _m===9 || _m===11) { nDays = 30; } else if (_m===2) { if((_y%400===0) || (_y%4===0 && _y%100!==0)) { nDays = 29; } else { nDays = 28; } } return nDays; }, /** * Checks if a date is valid * * @method _isValidDate * @param {Number} year * @param {Number} month * @param {Number} day * @return {Boolean} True if valid * @private * @static * @example * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){ * console.log( InkValidator._isValidDate( 2004, 2, 29 ) ); // Result: true * console.log( InkValidator._isValidDate( 2006, 2, 29 ) ); // Result: false * }); */ _isValidDate: function(year, month, day){ var yearRegExp = /^\d{4}$/; var validOneOrTwo = /^\d{1,2}$/; if(yearRegExp.test(year) && validOneOrTwo.test(month) && validOneOrTwo.test(day)){ if(month>=1 && month<=12 && day>=1 && this._daysInMonth(month,year)>=day){ return true; } } return false; }, /** * Checks if an email is valid * * @method mail * @param {String} email * @return {Boolean} True if it's valid * @public * @static * @sample Ink_Util_Validator_mail.html */ email: function(email) { var emailValido = new RegExp("^[_a-z0-9-]+((\\.|\\+)[_a-z0-9-]+)*@([\\w]*-?[\\w]*\\.)+[a-z]{2,4}$", "i"); if(!emailValido.test(email)) { return false; } else { return true; } }, /** * Deprecated. Alias for email(). Use it instead. * * @method mail * @public * @static * @private */ mail: function (mail) { return Validator.email(mail); }, /** * Checks if an url is valid * * @method url * @param {String} url URL to be checked * @param {Boolean} [full] If true, validates a full URL (one that should start with 'http') * @return {Boolean} True if valid * @public * @static * @sample Ink_Util_Validator_url.html */ url: function(url, full) { if(typeof full === "undefined" || full === false) { var reHTTP = new RegExp("(^(http\\:\\/\\/|https\\:\\/\\/)(.+))", "i"); if(reHTTP.test(url) === false) { url = 'http://'+url; } } var reUrl = new RegExp("^(http:\\/\\/|https:\\/\\/)([\\w]*(-?[\\w]*)*\\.)+[a-z]{2,4}", "i"); if(reUrl.test(url) === false) { return false; } else { return true; } }, /** * Checks if a phone is valid in Portugal * * @method isPTPhone * @param {Number} phone Phone number to be checked * @return {Boolean} True if it's a valid Portuguese Phone * @public * @static * @sample Ink_Util_Validator_isPTPhone.html */ isPTPhone: function(phone) { phone = phone.toString(); var aInd = []; for(var i in this._indicativosPT) { if(typeof(this._indicativosPT[i]) === 'string') { aInd.push(i); } } var strInd = aInd.join('|'); var re351 = /^(00351|\+351)/; if(re351.test(phone)) { phone = phone.replace(re351, ""); } var reSpecialChars = /(\s|\-|\.)+/g; phone = phone.replace(reSpecialChars, ''); //var reInt = new RegExp("\\d", "i"); var reInt = /[\d]{9}/i; if(phone.length === 9 && reInt.test(phone)) { var reValid = new RegExp("^("+strInd+")"); if(reValid.test(phone)) { return true; } } return false; }, /** * Alias function for isPTPhone * * @method isPortuguesePhone * @param {Number} phone Phone number to be checked * @return {Boolean} True if it's a valid Portuguese Phone * @public * @static */ isPortuguesePhone: function(phone) { return this.isPTPhone(phone); }, /** * Checks if a phone is valid in Cabo Verde * * @method isCVPhone * @param {Number} phone Phone number to be checked * @return {Boolean} True if it's a valid Cape Verdean Phone * @public * @static * @sample Ink_Util_Validator_isCVPhone.html */ isCVPhone: function(phone) { phone = phone.toString(); var aInd = []; for(var i in this._indicativosCV) { if(typeof(this._indicativosCV[i]) === 'string') { aInd.push(i); } } var strInd = aInd.join('|'); var re238 = /^(00238|\+238)/; if(re238.test(phone)) { phone = phone.replace(re238, ""); } var reSpecialChars = /(\s|\-|\.)+/g; phone = phone.replace(reSpecialChars, ''); //var reInt = new RegExp("\\d", "i"); var reInt = /[\d]{7}/i; if(phone.length === 7 && reInt.test(phone)) { var reValid = new RegExp("^("+strInd+")"); if(reValid.test(phone)) { return true; } } return false; }, /** * Checks if a phone is valid in Angola * * @method isAOPhone * @param {Number} phone Phone number to be checked * @return {Boolean} True if it's a valid Angolan Phone * @public * @static * @sample Ink_Util_Validator_isAOPhone.html */ isAOPhone: function(phone) { phone = phone.toString(); var aInd = []; for(var i in this._indicativosAO) { if(typeof(this._indicativosAO[i]) === 'string') { aInd.push(i); } } var strInd = aInd.join('|'); var re244 = /^(00244|\+244)/; if(re244.test(phone)) { phone = phone.replace(re244, ""); } var reSpecialChars = /(\s|\-|\.)+/g; phone = phone.replace(reSpecialChars, ''); //var reInt = new RegExp("\\d", "i"); var reInt = /[\d]{9}/i; if(phone.length === 9 && reInt.test(phone)) { var reValid = new RegExp("^("+strInd+")"); if(reValid.test(phone)) { return true; } } return false; }, /** * Checks if a phone is valid in Mozambique * * @method isMZPhone * @param {Number} phone Phone number to be checked * @return {Boolean} True if it's a valid Mozambican Phone * @public * @static * @sample Ink_Util_Validator_isMZPhone.html */ isMZPhone: function(phone) { phone = phone.toString(); var aInd = []; for(var i in this._indicativosMZ) { if(typeof(this._indicativosMZ[i]) === 'string') { aInd.push(i); } } var strInd = aInd.join('|'); var re258 = /^(00258|\+258)/; if(re258.test(phone)) { phone = phone.replace(re258, ""); } var reSpecialChars = /(\s|\-|\.)+/g; phone = phone.replace(reSpecialChars, ''); //var reInt = new RegExp("\\d", "i"); var reInt = /[\d]{8,9}/i; if((phone.length === 9 || phone.length === 8) && reInt.test(phone)) { var reValid = new RegExp("^("+strInd+")"); if(reValid.test(phone)) { if(phone.indexOf('2') === 0 && phone.length === 8) { return true; } else if(phone.indexOf('8') === 0 && phone.length === 9) { return true; } } } return false; }, /** * Checks if a phone is valid in Timor * * @method isTLPhone * @param {Number} phone Phone number to be checked * @return {Boolean} True if it's a valid phone from Timor-Leste * @public * @static * @sample Ink_Util_Validator_isTLPhone.html */ isTLPhone: function(phone) { phone = phone.toString(); var aInd = []; for(var i in this._indicativosTL) { if(typeof(this._indicativosTL[i]) === 'string') { aInd.push(i); } } var strInd = aInd.join('|'); var re670 = /^(00670|\+670)/; if(re670.test(phone)) { phone = phone.replace(re670, ""); } var reSpecialChars = /(\s|\-|\.)+/g; phone = phone.replace(reSpecialChars, ''); //var reInt = new RegExp("\\d", "i"); var reInt = /[\d]{7}/i; if(phone.length === 7 && reInt.test(phone)) { var reValid = new RegExp("^("+strInd+")"); if(reValid.test(phone)) { return true; } } return false; }, /** * Checks if a number is a phone number. * This method validates the number in all country codes available the ones set in the second param * * @method isPhone * @param {String} phone Phone number to validate * @param {String|Array} [countryCode] Country code or array of countries to validate * @return {Boolean} True if it's a valid phone in any country available * @public * @static * @sample Ink_Util_Validator_isPhone.html */ isPhone: function(){ var index; if(arguments.length===0){ return false; } var phone = arguments[0]; if(arguments.length>1){ if(arguments[1].constructor === Array){ var func; for(index=0; index<arguments[1].length; index++ ){ if(typeof(func=this['is' + arguments[1][index].toUpperCase() + 'Phone'])==='function'){ if(func(phone)){ return true; } } else { throw "Invalid Country Code!"; } } } else if(typeof(this['is' + arguments[1].toUpperCase() + 'Phone'])==='function'){ return this['is' + arguments[1].toUpperCase() + 'Phone'](phone); } else { throw "Invalid Country Code!"; } } else { for(index=0; index<this._countryCodes.length; index++){ if(this['is' + this._countryCodes[index] + 'Phone'](phone)){ return true; } } } return false; }, /** * Validates if a zip code is valid in Portugal * * @method codPostal * @param {Number|String} cp1 * @param {optional Number|String} cp2 * @param {optional Boolean} returnBothResults * @return {Boolean} True if it's a valid zip code * @public * @static * @sample Ink_Util_Validator_codPostal.html */ codPostal: function(cp1,cp2,returnBothResults){ var cPostalSep = /^(\s*\-\s*|\s+)$/; var trim = /^\s+|\s+$/g; var cPostal4 = /^[1-9]\d{3}$/; var cPostal3 = /^\d{3}$/; var parserCPostal = /^(.{4})(.*)(.{3})$/; returnBothResults = !!returnBothResults; cp1 = cp1.replace(trim,''); if(typeof(cp2)!=='undefined'){ cp2 = cp2.replace(trim,''); if(cPostal4.test(cp1) && cPostal3.test(cp2)){ if( returnBothResults === true ){ return [true, true]; } else { return true; } } } else { if(cPostal4.test(cp1) ){ if( returnBothResults === true ){ return [true,false]; } else { return true; } } var cPostal = cp1.match(parserCPostal); if(cPostal!==null && cPostal4.test(cPostal[1]) && cPostalSep.test(cPostal[2]) && cPostal3.test(cPostal[3])){ if( returnBothResults === true ){ return [true,false]; } else { return true; } } } if( returnBothResults === true ){ return [false,false]; } else { return false; } }, /** * Checks if a date is valid in a given format * * @method isDate * @param {String} format Format defined in _dateParsers * @param {String} dateStr Date string * @return {Boolean} True if it's a valid date and in the specified format * @public * @static * @sample Ink_Util_Validator_isDate.html */ isDate: function(format, dateStr){ if(typeof(this._dateParsers[format])==='undefined'){ return false; } var yearIndex = this._dateParsers[format].year; var monthIndex = this._dateParsers[format].month; var dayIndex = this._dateParsers[format].day; var dateParser = this._dateParsers[format].parser; var separator = this._dateParsers[format].sep; /* Trim Deactivated * var trim = /^\w+|\w+$/g; * dateStr = dateStr.replace(trim,""); */ var data = dateStr.match(dateParser); if(data!==null){ /* Trim Deactivated * for(i=1;i<=data.length;i++){ * data[i] = data[i].replace(trim,""); *} */ if(data[2]===data[4] && data[2]===separator){ var _y = ((data[yearIndex].length===2) ? "20" + data[yearIndex].toString() : data[yearIndex] ); if(this._isValidDate(_y,data[monthIndex].toString(),data[dayIndex].toString())){ return true; } } } return false; }, /** * Checks if a string is a valid color * * @method isColor * @param {String} str Color string to be checked * @return {Boolean} True if it's a valid color string * @public * @static * @sample Ink_Util_Validator_isColor.html */ isColor: function(str){ var match, valid = false, keyword = /^[a-zA-Z]+$/, hexa = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, rgb = /^rgb\(\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*\)$/, rgba = /^rgba\(\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*,\s*(1(\.0)?|0(\.[0-9])?)\s*\)$/, hsl = /^hsl\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*\)$/, hsla = /^hsla\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})(%)?\s*,\s*([0-9]{1,3})(%)?\s*,\s*(1(\.0)?|0(\.[0-9])?)\s*\)$/; // rgb(123, 123, 132) 0 to 255 // rgb(123%, 123%, 123%) 0 to 100 // rgba( 4 vals) last val: 0 to 1.0 // hsl(0 to 360, %, %) // hsla( ..., 0 to 1.0) if( keyword.test(str) || hexa.test(str) ){ return true; } var i; // rgb range check if((match = rgb.exec(str)) !== null || (match = rgba.exec(str)) !== null){ i = match.length; while(i--){ // check percentage values if((i===2 || i===4 || i===6) && typeof match[i] !== "undefined" && match[i] !== ""){ if(typeof match[i-1] !== "undefined" && match[i-1] >= 0 && match[i-1] <= 100){ valid = true; } else { return false; } } // check 0 to 255 values if(i===1 || i===3 || i===5 && (typeof match[i+1] === "undefined" || match[i+1] === "")){ if(typeof match[i] !== "undefined" && match[i] >= 0 && match[i] <= 255){ valid = true; } else { return false; } } } } // hsl range check if((match = hsl.exec(str)) !== null || (match = hsla.exec(str)) !== null){ i = match.length; while(i--){ // check percentage values if(i===3 || i===5){ if(typeof match[i-1] !== "undefined" && typeof match[i] !== "undefined" && match[i] !== "" && match[i-1] >= 0 && match[i-1] <= 100){ valid = true; } else { return false; } } // check 0 to 360 value if(i===1){ if(typeof match[i] !== "undefined" && match[i] >= 0 && match[i] <= 360){ valid = true; } else { return false; } } } } return valid; }, /** * Checks if the value is a valid IP. * * @method isIP * @param {String} value Value to be checked * @param {String} ipType Type of IP to be validated. The values are: ipv4, ipv6. By default is ipv4. * @return {Boolean} True if the value is a valid IP address. False if not. * @sample Ink_Util_Validator_isIP.html */ isIP: function( value, ipType ){ if( typeof value !== 'string' ){ return false; } ipType = (ipType || 'ipv4').toLowerCase(); switch( ipType ){ case 'ipv4': return (/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/).test(value); case 'ipv6': return (/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/).test(value); default: return false; } }, /** * Credit Card specifications, to be used in the credit card verification. * * @property _creditCardSpecs * @type {Object} * @private */ _creditCardSpecs: { 'default': { 'length': '13,14,15,16,17,18,19', 'prefix': /^.+/, 'luhn': true }, 'american express': { 'length': '15', 'prefix': /^3[47]/, 'luhn' : true }, 'diners club': { 'length': '14,16', 'prefix': /^36|55|30[0-5]/, 'luhn' : true }, 'discover': { 'length': '16', 'prefix': /^6(?:5|011)/, 'luhn' : true }, 'jcb': { 'length': '15,16', 'prefix': /^3|1800|2131/, 'luhn' : true }, 'maestro': { 'length': '16,18', 'prefix': /^50(?:20|38)|6(?:304|759)/, 'luhn' : true }, 'mastercard': { 'length': '16', 'prefix': /^5[1-5]/, 'luhn' : true }, 'visa': { 'length': '13,16', 'prefix': /^4/, 'luhn' : true } }, /** * Luhn function, to be used when validating credit cards * */ _luhn: function (num){ num = parseInt(num,10); if ( (typeof num !== 'number') && (num % 1 !== 0) ){ // Luhn can only be used on nums! return false; } num = num+''; // Check num length var length = num.length; // Checksum of the card num var i, checksum = 0 ; for (i = length - 1; i >= 0; i -= 2) { // Add up every 2nd digit, starting from the right checksum += parseInt(num.substr(i, 1),10); } for (i = length - 2; i >= 0; i -= 2) { // Add up every 2nd digit doubled, starting from the right var dbl = parseInt(num.substr(i, 1) * 2,10); // Subtract 9 from the dbl where value is greater than 10 checksum += (dbl >= 10) ? (dbl - 9) : dbl; } // If the checksum is a multiple of 10, the number is valid return (checksum % 10 === 0); }, /** * Checks if a number is of a specific credit card type * @method isCreditCard * @param {String} num Number to be validates * @param {String|Array} creditCardType Credit card type. See _creditCardSpecs for the list of supported values. * @return {Boolean} * @sample Ink_Util_Validator_isCreditCard.html */ isCreditCard: function(num, creditCardType){ if ( /\d+/.test(num) === false ){ return false; } if ( typeof creditCardType === 'undefined' ){ creditCardType = 'default'; } else if ( creditCardType instanceof Array ){ var i, ccLength = creditCardType.length; for ( i=0; i < ccLength; i++ ){ // Test each type for validity if (this.isCreditCard(num, creditCardType[i]) ){ return true; } } return false; } // Check card type creditCardType = creditCardType.toLowerCase(); if ( typeof this._creditCardSpecs[creditCardType] === 'undefined' ){ return false; } // Check card number length var length = num.length+''; // Validate the card length by the card type if ( this._creditCardSpecs[creditCardType]['length'].split(",").indexOf(length) === -1 ){ return false; } // Check card number prefix if ( !this._creditCardSpecs[creditCardType]['prefix'].test(num) ){ return false; } // No Luhn check required if (this._creditCardSpecs[creditCardType]['luhn'] === false){ return true; } return this._luhn(num); } }; return Validator; });
2947721120/cuddly-fibula
files/ink/3.0.1/js/ink.js
JavaScript
mit
466,931
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "\u0c06\u0c26\u0c3f\u0c35\u0c3e\u0c30\u0c02", "\u0c38\u0c4b\u0c2e\u0c35\u0c3e\u0c30\u0c02", "\u0c2e\u0c02\u0c17\u0c33\u0c35\u0c3e\u0c30\u0c02", "\u0c2c\u0c41\u0c27\u0c35\u0c3e\u0c30\u0c02", "\u0c17\u0c41\u0c30\u0c41\u0c35\u0c3e\u0c30\u0c02", "\u0c36\u0c41\u0c15\u0c4d\u0c30\u0c35\u0c3e\u0c30\u0c02", "\u0c36\u0c28\u0c3f\u0c35\u0c3e\u0c30\u0c02" ], "MONTH": [ "\u0c1c\u0c28\u0c35\u0c30\u0c3f", "\u0c2b\u0c3f\u0c2c\u0c4d\u0c30\u0c35\u0c30\u0c3f", "\u0c2e\u0c3e\u0c30\u0c4d\u0c1a\u0c3f", "\u0c0e\u0c2a\u0c4d\u0c30\u0c3f\u0c32\u0c4d", "\u0c2e\u0c47", "\u0c1c\u0c42\u0c28\u0c4d", "\u0c1c\u0c41\u0c32\u0c48", "\u0c06\u0c17\u0c38\u0c4d\u0c1f\u0c41", "\u0c38\u0c46\u0c2a\u0c4d\u0c1f\u0c46\u0c02\u0c2c\u0c30\u0c4d", "\u0c05\u0c15\u0c4d\u0c1f\u0c4b\u0c2c\u0c30\u0c4d", "\u0c28\u0c35\u0c02\u0c2c\u0c30\u0c4d", "\u0c21\u0c3f\u0c38\u0c46\u0c02\u0c2c\u0c30\u0c4d" ], "SHORTDAY": [ "\u0c06\u0c26\u0c3f", "\u0c38\u0c4b\u0c2e", "\u0c2e\u0c02\u0c17\u0c33", "\u0c2c\u0c41\u0c27", "\u0c17\u0c41\u0c30\u0c41", "\u0c36\u0c41\u0c15\u0c4d\u0c30", "\u0c36\u0c28\u0c3f" ], "SHORTMONTH": [ "\u0c1c\u0c28", "\u0c2b\u0c3f\u0c2c\u0c4d\u0c30", "\u0c2e\u0c3e\u0c30\u0c4d\u0c1a\u0c3f", "\u0c0f\u0c2a\u0c4d\u0c30\u0c3f", "\u0c2e\u0c47", "\u0c1c\u0c42\u0c28\u0c4d", "\u0c1c\u0c41\u0c32\u0c48", "\u0c06\u0c17", "\u0c38\u0c46\u0c2a\u0c4d\u0c1f\u0c46\u0c02", "\u0c05\u0c15\u0c4d\u0c1f\u0c4b", "\u0c28\u0c35\u0c02", "\u0c21\u0c3f\u0c38\u0c46\u0c02" ], "fullDate": "d MMMM y EEEE", "longDate": "d MMMM y", "medium": "d MMM y h:mm:ss a", "mediumDate": "d MMM y", "mediumTime": "h:mm:ss a", "short": "dd-MM-yy h:mm a", "shortDate": "dd-MM-yy", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u20b9", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4-", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "te", "pluralCat": function(n, opt_precision) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
shallaa/cdnjs
ajax/libs/angular.js/1.3.1/i18n/angular-locale_te.js
JavaScript
mit
2,918
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "pre podne", "popodne" ], "DAY": [ "nedelja", "ponedeljak", "utorak", "sreda", "\u010detvrtak", "petak", "subota" ], "MONTH": [ "januar", "februar", "mart", "april", "maj", "jun", "jul", "avgust", "septembar", "oktobar", "novembar", "decembar" ], "SHORTDAY": [ "ned", "pon", "uto", "sre", "\u010det", "pet", "sub" ], "SHORTMONTH": [ "jan", "feb", "mar", "apr", "maj", "jun", "jul", "avg", "sep", "okt", "nov", "dec" ], "fullDate": "EEEE, dd. MMMM y.", "longDate": "dd. MMMM y.", "medium": "dd.MM.y. HH.mm.ss", "mediumDate": "dd.MM.y.", "mediumTime": "HH.mm.ss", "short": "d.M.yy. HH.mm", "shortDate": "d.M.yy.", "shortTime": "HH.mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "din", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "sr-latn", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (vf.v == 0 && i % 10 == 1 && i % 100 != 11 || vf.f % 10 == 1 && vf.f % 100 != 11) { return PLURAL_CATEGORY.ONE; } if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14) || vf.f % 10 >= 2 && vf.f % 10 <= 4 && (vf.f % 100 < 12 || vf.f % 100 > 14)) { return PLURAL_CATEGORY.FEW; } return PLURAL_CATEGORY.OTHER;} }); }]);
RoryStolzenberg/cdnjs
ajax/libs/angular.js/1.3.2/i18n/angular-locale_sr-latn.js
JavaScript
mit
2,565
//! moment.js locale configuration //! locale : Nepalese [ne] //! author : suvash : https://github.com/suvash ;(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' && typeof require === 'function' ? factory(require('../moment')) : typeof define === 'function' && define.amd ? define(['../moment'], factory) : factory(global.moment) }(this, (function (moment) { 'use strict'; var symbolMap = { '1': '१', '2': '२', '3': '३', '4': '४', '5': '५', '6': '६', '7': '७', '8': '८', '9': '९', '0': '०' }; var numberMap = { '१': '1', '२': '2', '३': '3', '४': '4', '५': '5', '६': '6', '७': '7', '८': '8', '९': '9', '०': '0' }; var ne = moment.defineLocale('ne', { months : 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split('_'), monthsShort : 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split('_'), monthsParseExact : true, weekdays : 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split('_'), weekdaysShort : 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'), weekdaysMin : 'आ._सो._मं._बु._बि._शु._श.'.split('_'), weekdaysParseExact : true, longDateFormat : { LT : 'Aको h:mm बजे', LTS : 'Aको h:mm:ss बजे', L : 'DD/MM/YYYY', LL : 'D MMMM YYYY', LLL : 'D MMMM YYYY, Aको h:mm बजे', LLLL : 'dddd, D MMMM YYYY, Aको h:mm बजे' }, preparse: function (string) { return string.replace(/[१२३४५६७८९०]/g, function (match) { return numberMap[match]; }); }, postformat: function (string) { return string.replace(/\d/g, function (match) { return symbolMap[match]; }); }, meridiemParse: /राति|बिहान|दिउँसो|साँझ/, meridiemHour : function (hour, meridiem) { if (hour === 12) { hour = 0; } if (meridiem === 'राति') { return hour < 4 ? hour : hour + 12; } else if (meridiem === 'बिहान') { return hour; } else if (meridiem === 'दिउँसो') { return hour >= 10 ? hour : hour + 12; } else if (meridiem === 'साँझ') { return hour + 12; } }, meridiem : function (hour, minute, isLower) { if (hour < 3) { return 'राति'; } else if (hour < 12) { return 'बिहान'; } else if (hour < 16) { return 'दिउँसो'; } else if (hour < 20) { return 'साँझ'; } else { return 'राति'; } }, calendar : { sameDay : '[आज] LT', nextDay : '[भोलि] LT', nextWeek : '[आउँदो] dddd[,] LT', lastDay : '[हिजो] LT', lastWeek : '[गएको] dddd[,] LT', sameElse : 'L' }, relativeTime : { future : '%sमा', past : '%s अगाडि', s : 'केही क्षण', m : 'एक मिनेट', mm : '%d मिनेट', h : 'एक घण्टा', hh : '%d घण्टा', d : 'एक दिन', dd : '%d दिन', M : 'एक महिना', MM : '%d महिना', y : 'एक बर्ष', yy : '%d बर्ष' }, week : { dow : 0, // Sunday is the first day of the week. doy : 6 // The week that contains Jan 1st is the first week of the year. } }); return ne; })));
UDPT-2017/project-dhtt
node_modules/db-migrate/node_modules/moment/locale/ne.js
JavaScript
mit
4,200
/* Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang("specialchar","ko",{euro:"유로화 기호",lsquo:"왼쪽 외 따옴표",rsquo:"오른쪽 외 따옴표",ldquo:"왼쪽 쌍 따옴표",rdquo:"오른쪽 쌍 따옴표",ndash:"반각 대시",mdash:"전각 대시",iexcl:"반전된 느낌표",cent:"센트 기호",pound:"파운드화 기호",curren:"커런시 기호",yen:"위안화 기호",brvbar:"Broken bar",sect:"섹션 기호",uml:"분음 부호",copy:"저작권 기호",ordf:"Feminine ordinal indicator",laquo:"왼쪽 쌍꺽쇠 인용 부호",not:"금지 기호",reg:"등록 기호",macr:"장음 기호",deg:"도 기호",sup2:"위첨자 2",sup3:"위첨자 3",acute:"양음 악센트 부호",micro:"마이크로 기호",para:"단락 기호",middot:"가운데 점",cedil:"세디유",sup1:"위첨자 1", ordm:"Masculine ordinal indicator",raquo:"오른쪽 쌍꺽쇠 인용 부호",frac14:"분수 사분의 일",frac12:"분수 이분의 일",frac34:"분수 사분의 삼",iquest:"뒤집힌 물음표",Agrave:"억음 부호가 있는 라틴 대문자 A",Aacute:"양음 악센트 부호가 있는 라틴 대문자 A",Acirc:"곡절 악센트 부호가 있는 라틴 대문자 A",Atilde:"틸데가 있는 라틴 대문자 A",Auml:"분음 기호가 있는 라틴 대문자 A",Aring:"윗고리가 있는 라틴 대문자 A",AElig:"라틴 대문자 Æ",Ccedil:"세디유가 있는 라틴 대문자 C",Egrave:"억음 부호가 있는 라틴 대문자 E",Eacute:"양음 악센트 부호가 있는 라틴 대문자 E",Ecirc:"곡절 악센트 부호가 있는 라틴 대문자 E",Euml:"분음 기호가 있는 라틴 대문자 E",Igrave:"억음 부호가 있는 라틴 대문자 I",Iacute:"양음 악센트 부호가 있는 라틴 대문자 I", Icirc:"곡절 악센트 부호가 있는 라틴 대문자 I",Iuml:"분음 기호가 있는 라틴 대문자 I",ETH:"라틴 대문자 Eth",Ntilde:"틸데가 있는 라틴 대문자 N",Ograve:"억음 부호가 있는 라틴 대문자 O",Oacute:"양음 부호가 있는 라틴 대문자 O",Ocirc:"곡절 악센트 부호가 있는 라틴 대문자 O",Otilde:"틸데가 있는 라틴 대문자 O",Ouml:"분음 기호가 있는 라틴 대문자 O",times:"곱하기 기호",Oslash:"사선이 있는 라틴 대문자 O",Ugrave:"억음 부호가 있는 라틴 대문자 U",Uacute:"양음 부호가 있는 라틴 대문자 U",Ucirc:"곡절 악센트 부호가 있는 라틴 대문자 U",Uuml:"분음 기호가 있는 라틴 대문자 U",Yacute:"양음 부호가 있는 라틴 대문자 Y",THORN:"라틴 대문자 Thorn",szlig:"라틴 소문자 sharp s",agrave:"억음 부호가 있는 라틴 소문자 a",aacute:"양음 부호가 있는 라틴 소문자 a", acirc:"곡절 악센트 부호가 있는 라틴 소문자 a",atilde:"틸데가 있는 라틴 소문자 a",auml:"분음 기호가 있는 라틴 소문자 a",aring:"윗고리가 있는 라틴 소문자 a",aelig:"라틴 소문자 æ",ccedil:"세디유가 있는 라틴 소문자 c",egrave:"억음 부호가 있는 라틴 소문자 e",eacute:"양음 부호가 있는 라틴 소문자 e",ecirc:"곡절 악센트 부호가 있는 라틴 소문자 e",euml:"분음 기호가 있는 라틴 소문자 e",igrave:"억음 부호가 있는 라틴 소문자 i",iacute:"양음 부호가 있는 라틴 소문자 i",icirc:"곡절 악센트 부호가 있는 라틴 소문자 i",iuml:"분음 기호가 있는 라틴 소문자 i",eth:"라틴 소문자 eth",ntilde:"틸데가 있는 라틴 소문자 n",ograve:"억음 부호가 있는 라틴 소문자 o",oacute:"양음 부호가 있는 라틴 소문자 o",ocirc:"곡절 악센트 부호가 있는 라틴 소문자 o", otilde:"틸데가 있는 라틴 소문자 o",ouml:"분음 기호가 있는 라틴 소문자 o",divide:"나누기 기호",oslash:"사선이 있는 라틴 소문자 o",ugrave:"억음 부호가 있는 라틴 소문자 u",uacute:"양음 부호가 있는 라틴 소문자 u",ucirc:"곡절 악센트 부호가 있는 라틴 소문자 u",uuml:"분음 기호가 있는 라틴 소문자 u",yacute:"양음 부호가 있는 라틴 소문자 y",thorn:"라틴 소문자 thorn",yuml:"분음 기호가 있는 라틴 소문자 y",OElig:"라틴 대문합자 OE",oelig:"라틴 소문합자 oe",372:"곡절 악센트 부호가 있는 라틴 대문자 W",374:"곡절 악센트 부호가 있는 라틴 대문자 Y",373:"곡절 악센트 부호가 있는 라틴 소문자 w",375:"곡절 악센트 부호가 있는 라틴 소문자 y",sbquo:"외 아래-9 인용 부호",8219:"외 위쪽-뒤집힌-9 인용 부호",bdquo:"쌍 아래-9 인용 부호",hellip:"수평 생략 부호", trade:"상표 기호",9658:"검정 오른쪽 포인터",bull:"큰 점",rarr:"오른쪽 화살표",rArr:"오른쪽 두 줄 화살표",hArr:"양쪽 두 줄 화살표",diams:"검정 다이아몬드",asymp:"근사"});
q1082121/laravelcms
public/module/AdminLTE/plugins/ckeditor/plugins/specialchar/dialogs/lang/ko.js
JavaScript
mit
4,920
YUI.add('template-base', function (Y, NAME) { /** Virtual rollup of the `template-base` and `template-micro` modules. @module template @main template @since 3.8.0 **/ /** Provides a generic API for using template engines such as Handlebars and `Y.Template.Micro`. @module template @submodule template-base @since 3.8.0 **/ /** Provides a generic API for using template engines such as Handlebars and `Y.Template.Micro`. ### Examples Using with `Y.Template.Micro` (the default template engine): YUI().use('template', function (Y) { var micro = new Y.Template(), html = micro.render('<%= data.message %>', {message: 'hello!'}); // ... }); Using with Handlebars: YUI().use('template-base', 'handlebars', function (Y) { var handlebars = new Y.Template(Y.Handlebars), html = handlebars.render('{{message}}', {message: 'hello!'}); // ... }); @class Template @param {Mixed} [engine=Y.Template.Micro] Template engine to use, such as `Y.Template.Micro` or `Y.Handlebars`. Defaults to `Y.Template.Micro` if not specified. @param {Object} [defaults] Default options to use when instance methods are invoked. @constructor @since 3.8.0 **/ function Template(engine, defaults) { /** Default options. @property {Object} defaults @since 3.8.1 **/ this.defaults = defaults; /** Template engine class. @property {Mixed} engine @since 3.8.0 **/ this.engine = engine || Y.Template.Micro; if (!this.engine) { Y.error('No template engine loaded.'); } } Template.prototype = { /** Compiles a template with the current template engine and returns a compiled template function. @method compile @param {String} text Template text to compile. @param {Object} [options] Options to pass along to the template engine. See template engine docs for options supported by each engine. @return {Function} Compiled template function. @since 3.8.0 **/ compile: function (text, options) { options = options ? Y.merge(this.defaults, options) : this.defaults; return this.engine.compile(text, options); }, /** Precompiles a template with the current template engine and returns a string containing JavaScript source code for the precompiled template. @method precompile @param {String} text Template text to compile. @param {Object} [options] Options to pass along to the template engine. See template engine docs for options supported by each engine. @return {String} Source code for the precompiled template. @since 3.8.0 **/ precompile: function (text, options) { options = options ? Y.merge(this.defaults, options) : this.defaults; return this.engine.precompile(text, options); }, /** Compiles and renders a template with the current template engine in a single step, and returns the rendered result. @method render @param {String} text Template text to render. @param {Object} data Data object to provide when rendering the template. @param {Object} [options] Options to pass along to the template engine. See template engine docs for options supported by each engine. @return {String} Rendered result. @since 3.8.0 **/ render: function (text, data, options) { options = options ? Y.merge(this.defaults, options) : this.defaults; if (this.engine.render) { return this.engine.render(text, data, options); } return this.engine.compile(text, options)(data, options); }, /** Revives a precompiled template function into an executable template function using the current template engine. The precompiled code must already have been evaluated; this method won't evaluate it for you. @method revive @param {Function} precompiled Precompiled template function. @param {Object} [options] Options to pass along to the template engine. See template engine docs for options supported by each engine. @return {Function} Compiled template function. @since 3.8.0 **/ revive: function (precompiled, options) { options = options ? Y.merge(this.defaults, options) : this.defaults; return this.engine.revive ? this.engine.revive(precompiled, options) : precompiled; } }; // Copy existing namespaced properties from Y.Template to the Template function // if Y.Template already exists, then make the function the new Y.Template. // This ensures that other modules can safely add stuff to the Y.Template // namespace even if they're loaded before this one. Y.Template = Y.Template ? Y.mix(Template, Y.Template) : Template; }, '@VERSION@', {"requires": ["yui-base"]});
ljharb/cdnjs
ajax/libs/yui/3.11.0/template-base/template-base-debug.js
JavaScript
mit
4,822
# -*- coding: utf-8 -*- # Open Source Initiative OSI - The MIT License (MIT):Licensing # # The MIT License (MIT) # Copyright (c) 2012 DotCloud Inc (opensource@dotcloud.com) # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies # of the Software, and to permit persons to whom the Software is furnished to do # so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import functools import nose.exc import random import os _tmpfiles = [] def random_ipc_endpoint(): tmpfile = '/tmp/zerorpc_test_socket_{0}.sock'.format( str(random.random())[2:]) _tmpfiles.append(tmpfile) return 'ipc://{0}'.format(tmpfile) def teardown(): global _tmpfiles for tmpfile in _tmpfiles: print 'unlink', tmpfile try: os.unlink(tmpfile) except Exception: pass _tmpfiles = [] def skip(reason): def _skip(test): @functools.wraps(test) def wrap(): raise nose.exc.SkipTest(reason) return wrap return _skip
alekibango/zerorpc-python
tests/testutils.py
Python
mit
1,875
var fs = require('fs'), when = require('when'), path = require('path'), parsePackageJson = require('../require-tree').parsePackageJson; function AppPermissions(appPath) { this.appPath = appPath; this.packagePath = path.join(this.appPath, 'package.json'); } AppPermissions.prototype.read = function () { var self = this, def = when.defer(); this.checkPackageContentsExists() .then(function (exists) { if (!exists) { // If no package.json, return default permissions return def.resolve(AppPermissions.DefaultPermissions); } // Read and parse the package.json self.getPackageContents() .then(function (parsed) { // If no permissions in the package.json then return the default permissions. if (!(parsed.ghost && parsed.ghost.permissions)) { return def.resolve(AppPermissions.DefaultPermissions); } // TODO: Validation on permissions object? def.resolve(parsed.ghost.permissions); }) .otherwise(def.reject); }) .otherwise(def.reject); return def.promise; }; AppPermissions.prototype.checkPackageContentsExists = function () { // Mostly just broken out for stubbing in unit tests var def = when.defer(); fs.exists(this.packagePath, function (exists) { def.resolve(exists); }); return def.promise; }; // Get the contents of the package.json in the appPath root AppPermissions.prototype.getPackageContents = function () { var messages = { errors: [], warns: [] }; return parsePackageJson(this.packagePath, messages) .then(function (parsed) { if (!parsed) { return when.reject(new Error(messages.errors[0].message)); } return parsed; }); }; // Default permissions for an App. AppPermissions.DefaultPermissions = { posts: ['browse', 'read'] }; module.exports = AppPermissions;
aquinault/ghost
core/server/apps/permissions.js
JavaScript
mit
2,127
/* TimelineJS - ver. 2.35.1 - 2014-11-19 Copyright (c) 2012-2013 Northwestern University a project of the Northwestern University Knight Lab, originally created by Zach Wise https://github.com/NUKnightLab/TimelineJS This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ if(typeof VMM!="undefined"){VMM.Language={lang:"it",api:{wikipedia:"it"},date:{month:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],month_abbr:["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"],day:["Domenica","Lunedí","Martedí","Mercoledí","Giovedí","Venerdí","Sabato"],day_abbr:["Dom.","Lun.","Mar.","Mer.","Gio.","Ven.","Sab."]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"d mmm",full:"d mmmm yyyy",time_short:"HH:MM:ss",time_no_seconds_short:"HH:MM",time_no_seconds_small_date:"HH:MM'<br/><small>'d mmmm yyyy'</small>'",full_long:"dddd',' d mmm yyyy 'alle' HH:MM",full_long_small_date:"HH:MM'<br/><small>'dddd',' d mmm yyyy'</small>'"},messages:{loading_timeline:"Caricamento Timeline... ",return_to_title:"Ritorna all'inizio",expand_timeline:"Espandi la Timeline",contract_timeline:"Contrai la Timeline",wikipedia:"Wikipedia, L’enciclopedia libera",loading_content:"Caricamento contenuti",loading:"Caricamento"}}}
dominic/cdnjs
ajax/libs/timelinejs/2.35.1/js/locale/it.js
JavaScript
mit
1,486
/* TimelineJS - ver. 2.26.0 - 2013-09-24 Copyright (c) 2012-2013 Northwestern University a project of the Northwestern University Knight Lab, originally created by Zach Wise https://github.com/NUKnightLab/TimelineJS This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ .vco-storyjs{}.vco-storyjs div *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box} .vco-storyjs h1,.vco-storyjs h2,.vco-storyjs h3,.vco-storyjs h4,.vco-storyjs h5,.vco-storyjs h6,.vco-storyjs p,.vco-storyjs blockquote,.vco-storyjs pre,.vco-storyjs a,.vco-storyjs abbr,.vco-storyjs acronym,.vco-storyjs address,.vco-storyjs cite,.vco-storyjs code,.vco-storyjs del,.vco-storyjs dfn,.vco-storyjs em,.vco-storyjs img,.vco-storyjs q,.vco-storyjs s,.vco-storyjs samp,.vco-storyjs small,.vco-storyjs strike,.vco-storyjs strong,.vco-storyjs sub,.vco-storyjs sup,.vco-storyjs tt,.vco-storyjs var,.vco-storyjs dd,.vco-storyjs dl,.vco-storyjs dt,.vco-storyjs li,.vco-storyjs ol,.vco-storyjs ul,.vco-storyjs fieldset,.vco-storyjs form,.vco-storyjs label,.vco-storyjs legend,.vco-storyjs button,.vco-storyjs table,.vco-storyjs caption,.vco-storyjs tbody,.vco-storyjs tfoot,.vco-storyjs thead,.vco-storyjs tr,.vco-storyjs th,.vco-storyjs td,.vco-storyjs .vco-container,.vco-storyjs .content-container,.vco-storyjs .media,.vco-storyjs .text,.vco-storyjs .vco-slider,.vco-storyjs .slider,.vco-storyjs .date,.vco-storyjs .title,.vco-storyjs .messege,.vco-storyjs .map,.vco-storyjs .credit,.vco-storyjs .caption,.vco-storyjs .vco-feedback,.vco-storyjs .vco-feature,.vco-storyjs .toolbar,.vco-storyjs .marker,.vco-storyjs .dot,.vco-storyjs .line,.vco-storyjs .flag,.vco-storyjs .time,.vco-storyjs .era,.vco-storyjs .major,.vco-storyjs .minor,.vco-storyjs .vco-navigation,.vco-storyjs .start,.vco-storyjs .active{margin:0;padding:0;border:0;font-weight:normal;font-style:normal;font-size:100%;line-height:1;font-family:inherit;width:auto;float:none} .vco-storyjs h1,.vco-storyjs h2,.vco-storyjs h3,.vco-storyjs h4,.vco-storyjs h5,.vco-storyjs h6{clear:none} .vco-storyjs table{border-collapse:collapse;border-spacing:0} .vco-storyjs ol,.vco-storyjs ul{list-style:none} .vco-storyjs q:before,.vco-storyjs q:after,.vco-storyjs blockquote:before,.vco-storyjs blockquote:after{content:""} .vco-storyjs a:focus{outline:thin dotted} .vco-storyjs a:hover,.vco-storyjs a:active{outline:0} .vco-storyjs article,.vco-storyjs aside,.vco-storyjs details,.vco-storyjs figcaption,.vco-storyjs figure,.vco-storyjs footer,.vco-storyjs header,.vco-storyjs hgroup,.vco-storyjs nav,.vco-storyjs section{display:block} .vco-storyjs audio,.vco-storyjs canvas,.vco-storyjs video{display:inline-block;*display:inline;*zoom:1} .vco-storyjs audio:not([controls]){display:none} .vco-storyjs div{max-width:none} .vco-storyjs sub,.vco-storyjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline} .vco-storyjs sup{top:-0.5em} .vco-storyjs sub{bottom:-0.25em} .vco-storyjs img{border:0;-ms-interpolation-mode:bicubic} .vco-storyjs button,.vco-storyjs input,.vco-storyjs select,.vco-storyjs textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle} .vco-storyjs button,.vco-storyjs input{line-height:normal;*overflow:visible} .vco-storyjs button::-moz-focus-inner,.vco-storyjs input::-moz-focus-inner{border:0;padding:0} .vco-storyjs button,.vco-storyjs input[type="button"],.vco-storyjs input[type="reset"],.vco-storyjs input[type="submit"]{cursor:pointer;-webkit-appearance:button} .vco-storyjs input[type="search"]{-webkit-appearance:textfield;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box} .vco-storyjs input[type="search"]::-webkit-search-decoration{-webkit-appearance:none} .vco-storyjs textarea{overflow:auto;vertical-align:top} .vco-storyjs{font-family:"Georgia",Times New Roman,Times,serif;}.vco-storyjs .twitter,.vco-storyjs .vcard,.vco-storyjs .messege,.vco-storyjs .credit,.vco-storyjs .caption,.vco-storyjs .zoom-in,.vco-storyjs .zoom-out,.vco-storyjs .back-home,.vco-storyjs .time-interval div,.vco-storyjs .time-interval-major div,.vco-storyjs .nav-container{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif !important} .vco-storyjs h1.date,.vco-storyjs h2.date,.vco-storyjs h3.date,.vco-storyjs h4.date,.vco-storyjs h5.date,.vco-storyjs h6.date{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif !important} .vco-storyjs .timenav h1,.vco-storyjs .flag-content h1,.vco-storyjs .era h1,.vco-storyjs .timenav h2,.vco-storyjs .flag-content h2,.vco-storyjs .era h2,.vco-storyjs .timenav h3,.vco-storyjs .flag-content h3,.vco-storyjs .era h3,.vco-storyjs .timenav h4,.vco-storyjs .flag-content h4,.vco-storyjs .era h4,.vco-storyjs .timenav h5,.vco-storyjs .flag-content h5,.vco-storyjs .era h5,.vco-storyjs .timenav h6,.vco-storyjs .flag-content h6,.vco-storyjs .era h6{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif !important} .vco-storyjs p,.vco-storyjs blockquote,.vco-storyjs blockquote p,.vco-storyjs .twitter blockquote p{font-family:"Georgia",Times New Roman,Times,serif !important} .vco-storyjs .vco-feature h1,.vco-storyjs .vco-feature h2,.vco-storyjs .vco-feature h3,.vco-storyjs .vco-feature h4,.vco-storyjs .vco-feature h5,.vco-storyjs .vco-feature h6{font-family:"Georgia",Times New Roman,Times,serif} .timeline-tooltip{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif} .thumbnail{background-image:url(timeline.png?v4.4)} @media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (min-device-pixel-ratio:2){.thumbnail{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-size:352px 260px}}.vco-storyjs{font-size:15px;font-weight:normal;line-height:20px;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;}.vco-storyjs p{font-size:15px;font-weight:normal;line-height:20px;margin-bottom:20px;color:#666}.vco-storyjs p small{font-size:12px;line-height:17px} .vco-storyjs p:first-child{margin-top:20px} .vco-storyjs .vco-navigation p{color:#999} .vco-storyjs .vco-feature h3,.vco-storyjs .vco-feature h4,.vco-storyjs .vco-feature h5,.vco-storyjs .vco-feature h6{margin-bottom:15px} .vco-storyjs .vco-feature p{color:#666} .vco-storyjs .vco-feature blockquote,.vco-storyjs .vco-feature blockquote p{color:#000} .vco-storyjs .date a,.vco-storyjs .title a{color:#999} .vco-storyjs .hyphenate{-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;word-wrap:break-word} .vco-storyjs h1,.vco-storyjs h2,.vco-storyjs h3,.vco-storyjs h4,.vco-storyjs h5,.vco-storyjs h6{font-weight:normal;color:#000;text-transform:none}.vco-storyjs h1 a,.vco-storyjs h2 a,.vco-storyjs h3 a,.vco-storyjs h4 a,.vco-storyjs h5 a,.vco-storyjs h6 a{color:#999} .vco-storyjs h1 small,.vco-storyjs h2 small,.vco-storyjs h3 small,.vco-storyjs h4 small,.vco-storyjs h5 small,.vco-storyjs h6 small{color:#999} .vco-storyjs h1.date,.vco-storyjs h2.date,.vco-storyjs h3.date,.vco-storyjs h4.date,.vco-storyjs h5.date,.vco-storyjs h6.date{font-weight:bold} .vco-storyjs h2.start{font-size:36px;line-height:38px;margin-bottom:15px} .vco-storyjs h1{margin-bottom:15px;font-size:32px;line-height:34px}.vco-storyjs h1 small{font-size:18px} .vco-storyjs h2{margin-bottom:15px;font-size:28px;line-height:30px}.vco-storyjs h2 small{font-size:14px;line-height:16px} .vco-storyjs h2.date{font-size:16px;line-height:18px;margin-bottom:3.75px;color:#999} .vco-storyjs h3,.vco-storyjs h4,.vco-storyjs h5,.vco-storyjs h6{line-height:40px}.vco-storyjs h3 .active,.vco-storyjs h4 .active,.vco-storyjs h5 .active,.vco-storyjs h6 .active{color:#08c} .vco-storyjs h3{font-size:28px;line-height:30px}.vco-storyjs h3 small{font-size:14px} .vco-storyjs h4{font-size:20px;line-height:22px}.vco-storyjs h4 small{font-size:12px} .vco-storyjs h5{font-size:16px;line-height:18px} .vco-storyjs h6{font-size:13px;line-height:14px;text-transform:uppercase} .vco-storyjs strong{font-weight:bold;font-style:inherit} .vco-storyjs em{font-style:italic;font-weight:inherit} .vco-storyjs Q{quotes:'„' '“';font-style:italic} .vco-storyjs blockquote,.vco-storyjs blockquote p{font-size:24px;line-height:32px;text-align:left;margin-bottom:6px;padding-top:10px;background-color:#fff;color:#000} .vco-storyjs .credit{color:#999;text-align:right;font-size:10px;line-height:10px;display:block;margin:0 auto;clear:both} .vco-storyjs .caption{text-align:left;margin-top:5px;color:#666;font-size:11px;line-height:14px;clear:both} .vco-storyjs.vco-right-to-left h1,.vco-storyjs.vco-right-to-left h2,.vco-storyjs.vco-right-to-left h3,.vco-storyjs.vco-right-to-left h4,.vco-storyjs.vco-right-to-left h5,.vco-storyjs.vco-right-to-left h6,.vco-storyjs.vco-right-to-left p,.vco-storyjs.vco-right-to-left blockquote,.vco-storyjs.vco-right-to-left pre,.vco-storyjs.vco-right-to-left a,.vco-storyjs.vco-right-to-left abbr,.vco-storyjs.vco-right-to-left acronym,.vco-storyjs.vco-right-to-left address,.vco-storyjs.vco-right-to-left cite,.vco-storyjs.vco-right-to-left code,.vco-storyjs.vco-right-to-left del,.vco-storyjs.vco-right-to-left dfn,.vco-storyjs.vco-right-to-left em,.vco-storyjs.vco-right-to-left img,.vco-storyjs.vco-right-to-left q,.vco-storyjs.vco-right-to-left s,.vco-storyjs.vco-right-to-left samp,.vco-storyjs.vco-right-to-left small,.vco-storyjs.vco-right-to-left strike,.vco-storyjs.vco-right-to-left strong,.vco-storyjs.vco-right-to-left sub,.vco-storyjs.vco-right-to-left sup,.vco-storyjs.vco-right-to-left tt,.vco-storyjs.vco-right-to-left var,.vco-storyjs.vco-right-to-left dd,.vco-storyjs.vco-right-to-left dl,.vco-storyjs.vco-right-to-left dt,.vco-storyjs.vco-right-to-left li,.vco-storyjs.vco-right-to-left ol,.vco-storyjs.vco-right-to-left ul,.vco-storyjs.vco-right-to-left fieldset,.vco-storyjs.vco-right-to-left form,.vco-storyjs.vco-right-to-left label,.vco-storyjs.vco-right-to-left legend,.vco-storyjs.vco-right-to-left button,.vco-storyjs.vco-right-to-left table,.vco-storyjs.vco-right-to-left caption,.vco-storyjs.vco-right-to-left tbody,.vco-storyjs.vco-right-to-left tfoot,.vco-storyjs.vco-right-to-left thead,.vco-storyjs.vco-right-to-left tr,.vco-storyjs.vco-right-to-left th,.vco-storyjs.vco-right-to-left td{direction:rtl} .timeline-tooltip{position:absolute;z-index:205;display:block;visibility:visible;padding:5px;opacity:0;filter:alpha(opacity=0);font-size:15px;font-weight:bold;line-height:20px;font-size:12px;line-height:12px} .timeline-tooltip.in{opacity:.8;filter:alpha(opacity=80)} .timeline-tooltip.top{margin-top:-2px} .timeline-tooltip.right{margin-left:2px} .timeline-tooltip.bottom{margin-top:2px} .timeline-tooltip.left{margin-left:-2px} .timeline-tooltip.top .timeline-tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #000} .timeline-tooltip.left .timeline-tooltip-arrow{top:50%;right:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #000} .timeline-tooltip.bottom .timeline-tooltip-arrow{top:0;left:50%;margin-left:-5px;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #000} .timeline-tooltip.right .timeline-tooltip-arrow{top:50%;left:0;margin-top:-5px;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #000} .timeline-tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px} .timeline-tooltip-arrow{position:absolute;width:0;height:0} .fancybox-wrap,.fancybox-skin,.fancybox-outer,.fancybox-inner,.fancybox-image,.fancybox-wrap iframe,.fancybox-wrap object,.fancybox-nav,.fancybox-nav span,.fancybox-tmp{padding:0;margin:0;border:0;outline:none;vertical-align:top} .fancybox-wrap{position:absolute;top:0;left:0;z-index:8020} .fancybox-skin{position:relative;background:#fff;color:#444;text-shadow:none} .fancybox-opened{z-index:8030} .fancybox-opened .fancybox-skin{-webkit-box-shadow:1px 1px 10px rgba(0,0,0,0.5);-moz-box-shadow:1px 1px 10px rgba(0,0,0,0.5);box-shadow:1px 1px 10px rgba(0,0,0,0.5)} .fancybox-outer,.fancybox-inner{position:relative} .fancybox-inner{overflow:hidden} .fancybox-type-iframe .fancybox-inner{-webkit-overflow-scrolling:touch} .fancybox-error{color:#444;font:14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;margin:0;padding:15px;white-space:nowrap} .fancybox-image,.fancybox-iframe{display:block;width:100%;height:100%} .fancybox-image{max-width:100%;max-height:100%} .fancybox-close,.fancybox-prev span,.fancybox-next span{background-image:url('fancybox_sprite.png')} #fancybox-loading{position:fixed;top:50%;left:50%;margin-top:-14px;margin-left:-14px;background-position:0 -108px;opacity:.8;cursor:pointer;z-index:8060} #fancybox-loading div{width:28px;height:28px;background:url('loading.gif') center center no-repeat} .fancybox-close{position:absolute;top:-18px;right:-18px;width:36px;height:36px;cursor:pointer;z-index:8040} .fancybox-nav{position:absolute;top:0;width:40%;height:100%;cursor:pointer;text-decoration:none;background:transparent url('blank.gif');-webkit-tap-highlight-color:rgba(0,0,0,0);z-index:8040} .fancybox-prev{left:0} .fancybox-next{right:0} .fancybox-nav span{position:absolute;top:50%;width:36px;height:34px;margin-top:-18px;cursor:pointer;z-index:8040;visibility:hidden} .fancybox-prev span{left:10px;background-position:0 -36px} .fancybox-next span{right:10px;background-position:0 -72px} .fancybox-nav:hover span{visibility:visible} .fancybox-tmp{position:absolute;top:-99999px;left:-99999px;visibility:hidden;max-width:99999px;max-height:99999px;overflow:visible !important} .fancybox-lock{overflow:hidden !important;width:auto} .fancybox-lock body{overflow:hidden !important} .fancybox-lock-test{overflow-y:hidden !important} .fancybox-overlay{position:absolute;top:0;left:0;overflow:hidden;display:none;z-index:8010;background:url('overlay.png')} .fancybox-overlay-fixed{position:fixed;bottom:0;right:0} .fancybox-lock .fancybox-overlay{overflow:auto;overflow-y:scroll} .fancybox-title{visibility:hidden;font:normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;position:relative;text-shadow:none;z-index:8050} .fancybox-opened .fancybox-title{visibility:visible} .fancybox-title-float-wrap{position:absolute;bottom:0;right:50%;margin-bottom:-35px;z-index:8050;text-align:center}.fancybox-title-float-wrap .child{display:inline-block;margin-right:-100%;padding:2px 20px;background:transparent;background:rgba(0,0,0,0.8);-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px;text-shadow:0 1px 2px #222;color:#fff;font-weight:bold;line-height:24px;white-space:nowrap} .fancybox-title-outside-wrap{position:relative;margin-top:10px;color:#fff} .fancybox-title-inside-wrap{padding-top:10px} .fancybox-title-over-wrap{position:absolute;bottom:0;left:0;color:#fff;padding:10px;background:#000;background:rgba(0,0,0,0.8)} @media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min--moz-device-pixel-ratio:1.5),only screen and (min-device-pixel-ratio:1.5){#fancybox-loading,.fancybox-close,.fancybox-prev span,.fancybox-next span{background-image:url('fancybox_sprite@2x.png');background-size:44px 152px;} #fancybox-loading div{background-image:url('loading@2x.gif');background-size:24px 24px;}}@media only screen and (max-width:480px),only screen and (max-device-width:480px){.vco-slider .nav-next,.vco-slider .nav-previous{display:none}}@media (max-width:640px){}.vco-skinny .vco-slider .slider-item .content .layout-text-media .text .container{text-align:center !important} .vco-skinny .vco-slider .slider-item .content .layout-text-media h2,.vco-skinny .vco-slider .slider-item .content .layout-text-media h3{display:block !important;width:100% !important;text-align:center !important} .vco-skinny .vco-slider .slider-item .content .content-container{display:block}.vco-skinny .vco-slider .slider-item .content .content-container .text{width:100%;max-width:100%;min-width:120px;display:block}.vco-skinny .vco-slider .slider-item .content .content-container .text .container{display:block;-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;word-wrap:break-word} .vco-skinny .vco-slider .slider-item .content .content-container .media{width:100%;min-width:50%;float:none}.vco-skinny .vco-slider .slider-item .content .content-container .media .media-wrapper{margin-left:0;margin-right:0;width:100%;display:block} .vco-skinny.vco-notouch .vco-slider .nav-previous,.vco-skinny.vco-notouch .vco-slider .nav-next{z-index:203}.vco-skinny.vco-notouch .vco-slider .nav-previous .nav-container .date,.vco-skinny.vco-notouch .vco-slider .nav-next .nav-container .date,.vco-skinny.vco-notouch .vco-slider .nav-previous .nav-container .title,.vco-skinny.vco-notouch .vco-slider .nav-next .nav-container .title{filter:alpha(opacity=1);-khtml-opacity:.01;-moz-opacity:.01;opacity:.01} .vco-skinny.vco-notouch .vco-slider .nav-previous .nav-container .icon,.vco-skinny.vco-notouch .vco-slider .nav-next .nav-container .icon{filter:alpha(opacity=15);-khtml-opacity:.15;-moz-opacity:.15;opacity:.15} .vco-skinny.vco-notouch .vco-slider .nav-previous .icon{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-208px 0;width:24px;height:24px;overflow:hidden;margin-left:10px} .vco-skinny.vco-notouch .vco-slider .nav-next .icon{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-232px 0;width:24px;height:24px;overflow:hidden;margin-left:66px} .vco-skinny.vco-notouch .vco-slider .nav-previous:hover,.vco-skinny.vco-notouch .vco-slider .nav-next:hover{color:#aaa !important;background-color:#333;background-color:rgba(0,0,0,0.65);-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px}.vco-skinny.vco-notouch .vco-slider .nav-previous:hover .nav-container .icon,.vco-skinny.vco-notouch .vco-slider .nav-next:hover .nav-container .icon,.vco-skinny.vco-notouch .vco-slider .nav-previous:hover .nav-container .date,.vco-skinny.vco-notouch .vco-slider .nav-next:hover .nav-container .date,.vco-skinny.vco-notouch .vco-slider .nav-previous:hover .nav-container .title,.vco-skinny.vco-notouch .vco-slider .nav-next:hover .nav-container .title{-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;font-weight:bold;filter:alpha(opacity=100);-khtml-opacity:1;-moz-opacity:1;opacity:1} .vco-skinny.vco-notouch .vco-slider .nav-previous:hover .nav-container .title,.vco-skinny.vco-notouch .vco-slider .nav-next:hover .nav-container .title{padding-bottom:5px} .vco-skinny.vco-notouch .vco-slider .nav-previous:hover .nav-container .date,.vco-skinny.vco-notouch .vco-slider .nav-next:hover .nav-container .date,.vco-skinny.vco-notouch .vco-slider .nav-previous:hover .nav-container .title,.vco-skinny.vco-notouch .vco-slider .nav-next:hover .nav-container .title{padding-left:5px;padding-right:5px} @media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (min-device-pixel-ratio:2){.vco-skinny.vco-notouch .vco-slider .nav-previous .icon{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:-208px 0;width:24px;height:24px;overflow:hidden} .vco-skinny.vco-notouch .vco-slider .nav-next .icon{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:-232px 0;width:24px;height:24px;overflow:hidden}}.vco-slider{width:100%;height:100%;overflow:hidden}.vco-slider .slider-container-mask{text-align:center;width:100%;height:100%;overflow:hidden}.vco-slider .slider-container-mask .slider-container{position:absolute;top:0;left:-2160px;width:100%;height:100%;text-align:center;display:block}.vco-slider .slider-container-mask .slider-container .slider-item-container{display:table-cell;vertical-align:middle} .vco-notouch .vco-slider .nav-previous:hover,.vco-notouch .vco-slider .nav-next:hover{color:#333;cursor:pointer} .vco-notouch .vco-slider .nav-previous:hover .icon{margin-left:10px} .vco-notouch .vco-slider .nav-next:hover .icon{margin-left:66px} .vco-notouch .vco-slider .slider-item .content .content-container .media .media-container .wikipedia h4 a:hover{color:#08c;text-decoration:none} .vco-notouch .vco-slider .slider-item .content .content-container .created-at:hover{filter:alpha(opacity=100);-khtml-opacity:1;-moz-opacity:1;opacity:1} .vco-notouch .vco-slider .slider-item .content .content-container .googleplus .googleplus-content .googleplus-attachments a:hover{text-decoration:none}.vco-notouch .vco-slider .slider-item .content .content-container .googleplus .googleplus-content .googleplus-attachments a:hover h5{text-decoration:underline} .vco-slider img,.vco-slider embed,.vco-slider object,.vco-slider video,.vco-slider iframe{max-width:100%} .vco-slider .nav-previous,.vco-slider .nav-next{position:absolute;top:0;width:100px;color:#dbdbdb;font-size:11px}.vco-slider .nav-previous .nav-container,.vco-slider .nav-next .nav-container{height:100px;width:100px;position:absolute} .vco-slider .nav-previous .icon,.vco-slider .nav-next .icon{margin-top:12px;margin-bottom:15px} .vco-slider .nav-previous .date,.vco-slider .nav-next .date,.vco-slider .nav-previous .title,.vco-slider .nav-next .title{line-height:14px}.vco-slider .nav-previous .date a,.vco-slider .nav-next .date a,.vco-slider .nav-previous .title a,.vco-slider .nav-next .title a{color:#999} .vco-slider .nav-previous .date small,.vco-slider .nav-next .date small,.vco-slider .nav-previous .title small,.vco-slider .nav-next .title small{display:none} .vco-slider .nav-previous .date,.vco-slider .nav-next .date{font-size:13px;line-height:13px;font-weight:bold;text-transform:uppercase;margin-bottom:5px} .vco-slider .nav-previous .title,.vco-slider .nav-next .title{font-size:11px;line-height:13px} .vco-slider .nav-previous{float:left;text-align:left}.vco-slider .nav-previous .icon{margin-left:15px;background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-160px 0;width:24px;height:24px;overflow:hidden} .vco-slider .nav-previous .date,.vco-slider .nav-previous .title{text-align:left;padding-left:15px} .vco-slider .nav-next{float:right;text-align:right}.vco-slider .nav-next .icon{margin-left:61px;background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-184px 0;width:24px;height:24px;overflow:hidden} .vco-slider .nav-next .date,.vco-slider .nav-next .title{text-align:right;padding-right:15px} @media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (min-device-pixel-ratio:2){.vco-slider .nav-previous .icon{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:-160px 0;width:24px;height:24px;overflow:hidden} .vco-slider .nav-next .icon{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:-184px 0;width:24px;height:24px;overflow:hidden}}.vco-slider .slider-item{position:absolute;width:700px;height:100%;padding:0;margin:0;display:table;overflow-y:auto}.vco-slider .slider-item .content{display:table-cell;vertical-align:middle;}.vco-slider .slider-item .content .pad-top .text .container{padding-top:15px} .vco-slider .slider-item .content .pad-right .text .container{padding-right:15px} .vco-slider .slider-item .content .pad-left .text .container{padding-left:30px} .vco-slider .slider-item .content .pad-left .media.text-media .media-wrapper .media-container{border:none;background-color:#fff} .vco-slider .slider-item .content .content-container{display:table;vertical-align:middle;}.vco-slider .slider-item .content .content-container .text{width:40%;max-width:50%;min-width:120px;display:table-cell;vertical-align:middle}.vco-slider .slider-item .content .content-container .text .container{display:table-cell;vertical-align:middle;text-align:left}.vco-slider .slider-item .content .content-container .text .container p{-webkit-hyphens:auto;-moz-hyphens:auto;-ms-hyphens:auto;hyphens:auto;word-wrap:break-word} .vco-slider .slider-item .content .content-container .text .container h2.date{font-size:15px;line-height:15px;font-weight:normal} .vco-slider .slider-item .content .content-container .text .container .slide-tag{font-size:11px;font-weight:bold;color:#fff;background-color:#ccc;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;vertical-align:baseline;white-space:nowrap;line-height:11px;padding:1px 3px 1px;margin-left:7.5px;margin-bottom:7.5px} .vco-slider .slider-item .content .content-container .media{width:100%;min-width:50%;float:left}.vco-slider .slider-item .content .content-container .media .media-wrapper{display:inline-block;margin-left:auto;margin-right:auto}.vco-slider .slider-item .content .content-container .media .media-wrapper .media-container{display:inline-block;line-height:0;padding:0;max-height:100%;}.vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .media-frame,.vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .media-image img{border:1px solid;border-color:#ccc #999 #999 #ccc;background-color:#fff} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .media-frame iframe{background-color:#fff} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .soundcloud{border:0} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .media-image{display:inline-block} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .media-shadow{position:relative;z-index:1;background:#fff} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .media-shadow:before,.vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .media-shadow:after{z-index:-1;position:absolute;content:"";bottom:15px;left:10px;width:50%;top:80%;max-width:300px;background:#999;-webkit-box-shadow:0 15px 10px #999;-moz-box-shadow:0 15px 10px #999;box-shadow:0 15px 10px #999;-webkit-transform:rotate(-2deg);-moz-transform:rotate(-2deg);-ms-transform:rotate(-2deg);-o-transform:rotate(-2deg);transform:rotate(-2deg)} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .media-shadow::after{-webkit-transform:rotate(2deg);-moz-transform:rotate(2deg);-ms-transform:rotate(2deg);-o-transform:rotate(2deg);transform:rotate(2deg);right:10px;left:auto} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .plain-text{display:table}.vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .plain-text .container{display:table-cell;vertical-align:middle;font-size:15px;line-height:20px;color:#666}.vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .plain-text .container p{margin-bottom:20px} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .wikipedia{font-size:15px;line-height:20px;text-align:left;margin-left:auto;margin-right:auto;margin-bottom:15px;clear:both}.vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .wikipedia .wiki-source{margin-bottom:15px;font-size:13px;line-height:19px;font-style:italic} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .wikipedia h4{border-bottom:1px solid #ccc;margin-bottom:5px} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .wikipedia h4 a{color:#000} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .wikipedia p{font-size:13px;line-height:19px} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .map{line-height:normal;z-index:200;text-align:left;background-color:#fff}.vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .map img{max-height:none !important;max-width:none !important;border:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .map .google-map{height:100%;width:100%} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .map .map-attribution{position:absolute;z-index:201;bottom:0;width:100%;overflow:hidden}.vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .map .map-attribution .attribution-text{height:19px;overflow:hidden;-webkit-user-select:none;line-height:19px;margin-right:60px;padding-left:65px;font-family:Arial,sans-serif;font-size:10px;color:#444;white-space:nowrap;color:#fff;text-shadow:1px 1px 1px #333;text-align:center}.vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .map .map-attribution .attribution-text a{color:#fff !important} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .credit{color:#999;text-align:right;display:block;margin:0 auto;margin-top:6px;font-size:10px;line-height:13px} .vco-slider .slider-item .content .content-container .media .media-wrapper .media-container .caption{text-align:left;margin-top:10px;color:#666;font-size:11px;line-height:14px;text-rendering:optimizeLegibility;word-wrap:break-word} .vco-slider .slider-item .content .content-container .media.text-media .media-wrapper .media-container{border:none;background-color:#fff} .vco-slider .slider-item .content .content-container .created-at{width:24px;height:24px;overflow:hidden;margin-left:7.5px;margin-top:2px;display:inline-block;float:right;filter:alpha(opacity=25);-khtml-opacity:.25;-moz-opacity:.25;opacity:.25} .vco-slider .slider-item .content .content-container .storify .created-at{background-repeat:no-repeat;background-position:-328px -96px} .vco-slider .slider-item .content .content-container .twitter .created-at{background-repeat:no-repeat;background-position:-256px -24px} .vco-slider .slider-item .content .content-container .googleplus .googleplus-content{font-size:13px;line-height:19px;margin-bottom:6px;padding-top:10px;background-color:#fff;color:#666}.vco-slider .slider-item .content .content-container .googleplus .googleplus-content p{font-size:13px;line-height:19px} .vco-slider .slider-item .content .content-container .googleplus .googleplus-content .googleplus-title{font-size:24px;line-height:32px;margin-bottom:6px;padding-top:10px;background-color:#fff;color:#000} .vco-slider .slider-item .content .content-container .googleplus .googleplus-content .googleplus-annotation{font-size:15px;line-height:20px;color:#000;border-bottom:1px solid #e3e3e3;padding-bottom:7.5px;margin-bottom:7.5px} .vco-slider .slider-item .content .content-container .googleplus .googleplus-content .googleplus-attachments{border-top:1px solid #e3e3e3;padding-top:15px;margin-top:15px;border-bottom:1px solid #e3e3e3;padding-bottom:15px;margin-bottom:15px;*zoom:1}.vco-slider .slider-item .content .content-container .googleplus .googleplus-content .googleplus-attachments:before,.vco-slider .slider-item .content .content-container .googleplus .googleplus-content .googleplus-attachments:after{display:table;content:""} .vco-slider .slider-item .content .content-container .googleplus .googleplus-content .googleplus-attachments:after{clear:both} .vco-slider .slider-item .content .content-container .googleplus .googleplus-content .googleplus-attachments h5{margin-bottom:5px} .vco-slider .slider-item .content .content-container .googleplus .googleplus-content .googleplus-attachments div{width:50%;padding-left:15px;display:inline-block} .vco-slider .slider-item .content .content-container .googleplus .googleplus-content .googleplus-attachments p{font-size:11px;line-height:14px;margin-bottom:5px} .vco-slider .slider-item .content .content-container .googleplus .googleplus-content .googleplus-attachments img{float:left;display:block;bottom:0;left:0;margin:auto;position:relative;right:0;top:0;width:40%} .vco-slider .slider-item .content .content-container .googleplus .proflinkPrefix{color:#08c} .vco-slider .slider-item .content .content-container .googleplus .created-at{background-repeat:no-repeat;background-position:-208px -72px} .vco-slider .slider-item .content .content-container .twitter,.vco-slider .slider-item .content .content-container .plain-text-quote,.vco-slider .slider-item .content .content-container .storify,.vco-slider .slider-item .content .content-container .googleplus{text-align:left;margin-left:auto;margin-right:auto;margin-bottom:15px;clear:both}.vco-slider .slider-item .content .content-container .twitter blockquote,.vco-slider .slider-item .content .content-container .plain-text-quote blockquote,.vco-slider .slider-item .content .content-container .storify blockquote,.vco-slider .slider-item .content .content-container .googleplus blockquote{color:#666}.vco-slider .slider-item .content .content-container .twitter blockquote p,.vco-slider .slider-item .content .content-container .plain-text-quote blockquote p,.vco-slider .slider-item .content .content-container .storify blockquote p,.vco-slider .slider-item .content .content-container .googleplus blockquote p{font-size:24px;line-height:32px;margin-bottom:6px;padding-top:10px;background-color:#fff;color:#000} .vco-slider .slider-item .content .content-container .twitter blockquote .quote-mark,.vco-slider .slider-item .content .content-container .plain-text-quote blockquote .quote-mark,.vco-slider .slider-item .content .content-container .storify blockquote .quote-mark,.vco-slider .slider-item .content .content-container .googleplus blockquote .quote-mark{color:#666} .vco-slider .slider-item .content .content-container .twitter blockquote{font-size:15px}.vco-slider .slider-item .content .content-container .twitter blockquote p{font-size:24px} .vco-slider .slider-item .content .content-container.layout-text-media .text-media{border-top:1px solid #e3e3e3;padding-top:15px;padding-right:0} .vco-slider .slider-item .content .content-container.layout-text-media.pad-left .text-media{padding-right:15px;padding-top:0;border-right:1px solid #e3e3e3;border-top:0 solid #e3e3e3} .vco-slider .slider-item .content .content-container.layout-text{width:100%}.vco-slider .slider-item .content .content-container.layout-text .text{width:100%;max-width:100%}.vco-slider .slider-item .content .content-container.layout-text .text .container{display:block;vertical-align:middle;padding:0;width:90%;text-align:left;margin-left:auto;margin-right:auto} .vco-slider .slider-item .content .content-container.layout-media{width:100%}.vco-slider .slider-item .content .content-container.layout-media .text{width:100%;height:100%;max-width:100%;display:block;text-align:center}.vco-slider .slider-item .content .content-container.layout-media .text .container{display:block;text-align:center;width:100%;margin-left:none;margin-right:none} .vco-slider .slider-item .content .content-container.layout-media .media{width:100%;min-width:50%;float:none}.vco-slider .slider-item .content .content-container.layout-media .media .media-wrapper .media-container{margin-left:auto;margin-right:auto;line-height:0;padding:0} .vco-slider .slider-item .content .content-container.layout-media .twitter,.vco-slider .slider-item .content .content-container.layout-media .wikipedia,.vco-slider .slider-item .content .content-container.layout-media .googleplus{max-width:70%} .storyjs-embed{background-color:#fff;margin-bottom:20px;border:1px solid #ccc;padding-top:20px;padding-bottom:20px;clear:both;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;-webkit-box-shadow:1px 1px 3px rgba(0,0,0,0.35);-moz-box-shadow:1px 1px 3px rgba(0,0,0,0.35);box-shadow:1px 1px 3px rgba(0,0,0,0.35)} .storyjs-embed.full-embed{overflow:hidden;border:0 !important;padding:0 !important;margin:0 !important;clear:both;-webkit-border-radius:0 !important;-moz-border-radius:0 !important;border-radius:0 !important;-webkit-box-shadow:0 0 0 rgba(0,0,0,0.25) !important;-moz-box-shadow:0 0 0 rgba(0,0,0,0.25) !important;box-shadow:0 0 0 rgba(0,0,0,0.25) !important} .storyjs-embed.sized-embed{overflow:hidden;border:1px solid #ccc;padding-top:7px;padding-bottom:7px;margin:0 !important;clear:both;-webkit-box-shadow:0 0 0 rgba(0,0,0,0.25) !important;-moz-box-shadow:0 0 0 rgba(0,0,0,0.25) !important;box-shadow:0 0 0 rgba(0,0,0,0.25) !important} .vco-storyjs{width:100%;height:100%;padding:0;margin:0;background-color:#fff;position:absolute;z-index:100;clear:both;overflow:hidden;}.vco-storyjs .vmm-clear:before,.vco-storyjs .vmm-clear:after{content:"";display:table} .vco-storyjs .vmm-clear:after{clear:both} .vco-storyjs .vmm-clear{*zoom:1} .vco-storyjs .vco-feature{width:100%}.vco-storyjs .vco-feature .slider,.vco-storyjs .vco-feature .vco-slider{width:100%;float:left;position:relative;z-index:10;padding-top:15px;-webkit-box-shadow:1px 1px 7px rgba(0,0,0,0.3);-moz-box-shadow:1px 1px 7px rgba(0,0,0,0.3);box-shadow:1px 1px 7px rgba(0,0,0,0.3)} .vco-storyjs .vco-feedback{position:absolute;display:table;overflow:hidden;top:0;left:0;z-index:205;width:100%;height:100%} .vco-storyjs div.vco-loading,.vco-storyjs div.vco-explainer{display:table;text-align:center;min-width:100px;margin-top:15px;height:100%;width:100%;background-color:#fff}.vco-storyjs div.vco-loading .vco-loading-container,.vco-storyjs div.vco-explainer .vco-loading-container,.vco-storyjs div.vco-loading .vco-explainer-container,.vco-storyjs div.vco-explainer .vco-explainer-container{display:table-cell;vertical-align:middle}.vco-storyjs div.vco-loading .vco-loading-container .vco-loading-icon,.vco-storyjs div.vco-explainer .vco-loading-container .vco-loading-icon,.vco-storyjs div.vco-loading .vco-explainer-container .vco-loading-icon,.vco-storyjs div.vco-explainer .vco-explainer-container .vco-loading-icon{display:block;background-repeat:no-repeat;vertical-align:middle;margin-left:auto;margin-right:auto;text-align:center;background-image:url(loading.gif?v3.4);width:28px;height:28px} .vco-storyjs div.vco-loading .vco-loading-container .vco-gesture-icon,.vco-storyjs div.vco-explainer .vco-loading-container .vco-gesture-icon,.vco-storyjs div.vco-loading .vco-explainer-container .vco-gesture-icon,.vco-storyjs div.vco-explainer .vco-explainer-container .vco-gesture-icon{display:block;vertical-align:middle;margin-left:auto;margin-right:auto;text-align:center;background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-160px -160px;height:48px;width:48px;height:48px} .vco-storyjs div.vco-loading .vco-loading-container .vco-message,.vco-storyjs div.vco-explainer .vco-loading-container .vco-message,.vco-storyjs div.vco-loading .vco-explainer-container .vco-message,.vco-storyjs div.vco-explainer .vco-explainer-container .vco-message{display:block} .vco-storyjs div.vco-loading .vco-loading-container .vco-message,.vco-storyjs div.vco-explainer .vco-loading-container .vco-message,.vco-storyjs div.vco-loading .vco-explainer-container .vco-message,.vco-storyjs div.vco-explainer .vco-explainer-container .vco-message,.vco-storyjs div.vco-loading .vco-loading-container .vco-message p,.vco-storyjs div.vco-explainer .vco-loading-container .vco-message p,.vco-storyjs div.vco-loading .vco-explainer-container .vco-message p,.vco-storyjs div.vco-explainer .vco-explainer-container .vco-message p{text-align:center;font-size:11px;line-height:13px;text-transform:uppercase;margin-top:7.5px;margin-bottom:7.5px} .vco-storyjs div.vco-explainer{background-color:transparent} .vco-storyjs .vco-bezel{background-color:#333;background-color:rgba(0,0,0,0.8);width:80px;height:50px;padding:50px;padding-top:25px;padding:25px 20px 50px 20px;margin:auto;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px}.vco-storyjs .vco-bezel .vco-message,.vco-storyjs .vco-bezel .vco-message p{color:#fff;font-weight:bold} .vco-storyjs .vco-container.vco-main{position:absolute;top:0;left:0;padding-bottom:3px;width:auto;height:auto;margin:0;clear:both} .vco-storyjs img,.vco-storyjs embed,.vco-storyjs object,.vco-storyjs video,.vco-storyjs iframe{max-width:100%} .vco-storyjs img{max-height:100%;border:1px solid #999} .vco-storyjs a{color:#08c;text-decoration:none} .vco-storyjs a:hover{color:#005580;text-decoration:underline} .vco-storyjs .vcard{float:right;margin-bottom:15px}.vco-storyjs .vcard a{color:#333} .vco-storyjs .vcard a:hover{text-decoration:none}.vco-storyjs .vcard a:hover .fn{text-decoration:underline} .vco-storyjs .vcard .fn,.vco-storyjs .vcard .nickname{padding-left:42px} .vco-storyjs .vcard .fn{display:block;font-weight:bold} .vco-storyjs .vcard .nickname{margin-top:1px;display:block;color:#666} .vco-storyjs .vcard .avatar{float:left;display:block;width:32px;height:32px}.vco-storyjs .vcard .avatar img{-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px} .vco-storyjs .thumbnail{width:24px;height:24px;overflow:hidden;float:left;margin:0;margin-right:1px;margin-top:6px;border:0;padding:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none} .vco-storyjs a.thumbnail:hover{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none} .vco-storyjs .thumbnail.thumb-plaintext{background-repeat:no-repeat;background-position:-280px -48px} .vco-storyjs .thumbnail.thumb-quote{background-repeat:no-repeat;background-position:-232px -48px} .vco-storyjs .thumbnail.thumb-document{background-repeat:no-repeat;background-position:-256px -48px} .vco-storyjs .thumbnail.thumb-photo{background-repeat:no-repeat;background-position:-280px -24px;border:0}.vco-storyjs .thumbnail.thumb-photo img{border:0 none #ccc !important} .vco-storyjs .thumbnail.thumb-twitter{background-repeat:no-repeat;background-position:-256px -24px} .vco-storyjs .thumbnail.thumb-vimeo{background-repeat:no-repeat;background-position:-328px -48px} .vco-storyjs .thumbnail.thumb-vine{background-repeat:no-repeat;background-position:-232px -72px} .vco-storyjs .thumbnail.thumb-youtube{background-repeat:no-repeat;background-position:-328px -72px} .vco-storyjs .thumbnail.thumb-video{background-repeat:no-repeat;background-position:-328px -24px} .vco-storyjs .thumbnail.thumb-audio{background-repeat:no-repeat;background-position:-304px -24px} .vco-storyjs .thumbnail.thumb-map{background-repeat:no-repeat;background-position:-208px -48px} .vco-storyjs .thumbnail.thumb-website{background-repeat:no-repeat;background-position:-232px -24px} .vco-storyjs .thumbnail.thumb-link{background-repeat:no-repeat;background-position:-184px -72px} .vco-storyjs .thumbnail.thumb-wikipedia{background-repeat:no-repeat;background-position:-184px -48px} .vco-storyjs .thumbnail.thumb-storify{background-repeat:no-repeat;background-position:-328px -96px} .vco-storyjs .thumbnail.thumb-googleplus{background-repeat:no-repeat;background-position:-208px -72px} .vco-storyjs thumbnail.thumb-instagram{background-repeat:no-repeat;background-position:-208px -96px} .vco-storyjs thumbnail.thumb-instagram-full{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-232px -96px;width:48px;height:24px} .vco-storyjs .thumb-storify-full{height:12px;background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-280px -96px;width:48px} .vco-storyjs .thumbnail-inline{width:16px;height:14px;overflow:hidden;display:inline-block;margin-right:1px;margin-left:3px;margin-top:2px;filter:alpha(opacity=50);-khtml-opacity:.5;-moz-opacity:.5;opacity:.5} .vco-storyjs .twitter .thumbnail-inline{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-160px -96px} .vco-storyjs .storify .thumbnail-inline{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-184px -96px} .vco-storyjs .googleplus .thumbnail-inline{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-208px -96px} .vco-storyjs .zFront{z-index:204} @media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (min-device-pixel-ratio:2){.vco-storyjs div.vco-loading .vco-loading-container .vco-loading-icon,.vco-storyjs div.vco-explainer .vco-loading-container .vco-loading-icon,.vco-storyjs div.vco-loading .vco-explainer-container .vco-loading-icon,.vco-storyjs div.vco-explainer .vco-explainer-container .vco-loading-icon{background-image:url(loading@2x.gif?v3.4)} .vco-storyjs div.vco-loading .vco-loading-container .vco-gesture-icon,.vco-storyjs div.vco-explainer .vco-loading-container .vco-gesture-icon,.vco-storyjs div.vco-loading .vco-explainer-container .vco-gesture-icon,.vco-storyjs div.vco-explainer .vco-explainer-container .vco-gesture-icon{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:-160px -160px;width:48px;height:48px}}.vco-notouch .vco-navigation .vco-toolbar .zoom-in:hover,.vco-notouch .vco-navigation .vco-toolbar .zoom-out:hover,.vco-notouch .vco-navigation .vco-toolbar .back-home:hover{color:#08c;cursor:pointer;filter:alpha(opacity=100);-khtml-opacity:1;-moz-opacity:1;opacity:1} .vco-notouch .vco-navigation .timenav .content .marker.active:hover{cursor:default}.vco-notouch .vco-navigation .timenav .content .marker.active:hover .flag .flag-content h3,.vco-notouch .vco-navigation .timenav .content .marker.active:hover .flag-small .flag-content h3{color:#08c} .vco-notouch .vco-navigation .timenav .content .marker.active:hover .flag .flag-content h4,.vco-notouch .vco-navigation .timenav .content .marker.active:hover .flag-small .flag-content h4{color:#999} .vco-notouch .vco-navigation .timenav .content .marker:hover .line{z-index:24;background:#999} .vco-notouch .vco-navigation .timenav .content .marker .flag:hover,.vco-notouch .vco-navigation .timenav .content .marker .flag-small:hover{cursor:pointer}.vco-notouch .vco-navigation .timenav .content .marker .flag:hover .flag-content h3,.vco-notouch .vco-navigation .timenav .content .marker .flag-small:hover .flag-content h3{color:#333} .vco-notouch .vco-navigation .timenav .content .marker .flag:hover .flag-content h4,.vco-notouch .vco-navigation .timenav .content .marker .flag-small:hover .flag-content h4{color:#aaa} .vco-notouch .vco-navigation .timenav .content .marker .flag:hover .flag-content .thumbnail,.vco-notouch .vco-navigation .timenav .content .marker .flag-small:hover .flag-content .thumbnail{filter:alpha(opacity=100);-khtml-opacity:1;-moz-opacity:1;opacity:1} .vco-notouch .vco-navigation .timenav .content .marker .flag:hover{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:0 -53px;width:153px;height:53px} .vco-notouch .vco-navigation .timenav .content .marker .flag-small:hover{height:56px;background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:0 -53px;width:153px;height:53px}.vco-notouch .vco-navigation .timenav .content .marker .flag-small:hover .flag-content{height:36px}.vco-notouch .vco-navigation .timenav .content .marker .flag-small:hover .flag-content h3{margin-top:5px} .vco-notouch .vco-navigation .timenav .content .marker .flag-small.flag-small-last:hover{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:0 -109px;width:153px;height:26px;height:26px}.vco-notouch .vco-navigation .timenav .content .marker .flag-small.flag-small-last:hover .flag-content{height:14px}.vco-notouch .vco-navigation .timenav .content .marker .flag-small.flag-small-last:hover .flag-content h3{margin-top:4px} .vco-timeline .vco-navigation{clear:both;cursor:move;width:100%;height:200px;border-top:1px solid #e3e3e3;position:relative}.vco-timeline .vco-navigation .vco-toolbar{position:absolute;top:45px;left:0;z-index:202;background-color:#fff;border:1px solid #ccc;-webkit-box-shadow:1px 1px 0 rgba(0,0,0,0.2);-moz-box-shadow:1px 1px 0 rgba(0,0,0,0.2);box-shadow:1px 1px 0 rgba(0,0,0,0.2)}.vco-timeline .vco-navigation .vco-toolbar .zoom-in,.vco-timeline .vco-navigation .vco-toolbar .zoom-out,.vco-timeline .vco-navigation .vco-toolbar .back-home{font-weight:normal;font-size:10px;line-height:20px;top:0;z-index:202;width:18px;height:18px;color:#333;text-align:center;font-weight:bold;border:1px solid #fff;padding:5px;filter:alpha(opacity=50);-khtml-opacity:.5;-moz-opacity:.5;opacity:.5} .vco-timeline .vco-navigation .vco-toolbar .zoom-in .icon{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-256px 0;width:24px;height:24px} .vco-timeline .vco-navigation .vco-toolbar .zoom-out .icon{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-280px 0;width:24px;height:24px} .vco-timeline .vco-navigation .vco-toolbar .back-home .icon{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-328px 0;width:24px;height:24px} .vco-timeline .vco-navigation .vco-toolbar.touch{-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;background-color:transparent;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.vco-timeline .vco-navigation .vco-toolbar.touch .zoom-in,.vco-timeline .vco-navigation .vco-toolbar.touch .zoom-out,.vco-timeline .vco-navigation .vco-toolbar.touch .back-home{width:40px;height:40px;padding:5px;background-color:#fff;border:1px solid #ccc;-webkit-box-shadow:1px 1px 0 rgba(0,0,0,0.2);-moz-box-shadow:1px 1px 0 rgba(0,0,0,0.2);box-shadow:1px 1px 0 rgba(0,0,0,0.2);-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;filter:alpha(opacity=100);-khtml-opacity:1;-moz-opacity:1;opacity:1} .vco-timeline .vco-navigation .vco-toolbar.touch .zoom-in .icon{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-208px -160px;width:40px;height:40px} .vco-timeline .vco-navigation .vco-toolbar.touch .zoom-out .icon{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-256px -160px;width:40px;height:40px} .vco-timeline .vco-navigation .vco-toolbar.touch .back-home .icon{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-304px -160px;width:40px;height:40px} .vco-timeline .vco-navigation .timenav-background{position:absolute;cursor:move;top:0;left:0;height:150px;width:100%;background-color:#e9e9e9}.vco-timeline .vco-navigation .timenav-background .timenav-interval-background{position:absolute;top:151px;left:0;background:#fff;width:100%;height:49px;-webkit-box-shadow:-1px -1px 7px rgba(0,0,0,0.1);-moz-box-shadow:-1px -1px 7px rgba(0,0,0,0.1);box-shadow:-1px -1px 7px rgba(0,0,0,0.1)}.vco-timeline .vco-navigation .timenav-background .timenav-interval-background .top-highlight{position:absolute;top:-1px;left:0;z-index:30;width:100%;height:1px;background:#fff;filter:alpha(opacity=50);-khtml-opacity:.5;-moz-opacity:.5;opacity:.5;-webkit-box-shadow:1px 1px 5px rgba(0,0,0,0.2);-moz-box-shadow:1px 1px 5px rgba(0,0,0,0.2);box-shadow:1px 1px 5px rgba(0,0,0,0.2)} .vco-timeline .vco-navigation .timenav-background .timenav-line{position:absolute;top:0;left:50%;width:3px;height:150px;background-color:#08c;z-index:1;-webkit-box-shadow:1px 1px 7px rgba(0,0,0,0.3);-moz-box-shadow:1px 1px 7px rgba(0,0,0,0.3);box-shadow:1px 1px 7px rgba(0,0,0,0.3)} .vco-timeline .vco-navigation .timenav-background .timenav-indicator{position:absolute;top:-1px;left:50%;z-index:202;background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-160px -48px;width:24px;height:24px} .vco-timeline .vco-navigation .timenav-background .timenav-tag div{height:50px;display:table}.vco-timeline .vco-navigation .timenav-background .timenav-tag div h3{display:table-cell;vertical-align:middle;padding-left:65px;font-size:15px;color:#d0d0d0;font-weight:bold;text-shadow:0 1px 1px #fff} .vco-timeline .vco-navigation .timenav-background .timenav-tag-size-half{height:25px}.vco-timeline .vco-navigation .timenav-background .timenav-tag-size-half div{height:25px} .vco-timeline .vco-navigation .timenav-background .timenav-tag-size-full{height:50px}.vco-timeline .vco-navigation .timenav-background .timenav-tag-size-full div{height:50px} .vco-timeline .vco-navigation .timenav-background .timenav-tag-row-2,.vco-timeline .vco-navigation .timenav-background .timenav-tag-row-4,.vco-timeline .vco-navigation .timenav-background .timenav-tag-row-6{background:#f1f1f1} .vco-timeline .vco-navigation .timenav-background .timenav-tag-row-1,.vco-timeline .vco-navigation .timenav-background .timenav-tag-row-3,.vco-timeline .vco-navigation .timenav-background .timenav-tag-row-5{background:#e9e9e9} .vco-timeline .vco-navigation .timenav{position:absolute;top:0;left:-250px;z-index:1}.vco-timeline .vco-navigation .timenav .content{position:relative}.vco-timeline .vco-navigation .timenav .content .marker.start{display:none} .vco-timeline .vco-navigation .timenav .content .marker.active .dot{background:#08c;z-index:200} .vco-timeline .vco-navigation .timenav .content .marker.active .line{z-index:199;background:#08c;width:1px}.vco-timeline .vco-navigation .timenav .content .marker.active .line .event-line{background:#08c;filter:alpha(opacity=75);-khtml-opacity:.75;-moz-opacity:.75;opacity:.75} .vco-timeline .vco-navigation .timenav .content .marker.active .flag,.vco-timeline .vco-navigation .timenav .content .marker.active .flag-small{z-index:200}.vco-timeline .vco-navigation .timenav .content .marker.active .flag .flag-content,.vco-timeline .vco-navigation .timenav .content .marker.active .flag-small .flag-content{height:36px}.vco-timeline .vco-navigation .timenav .content .marker.active .flag .flag-content h3,.vco-timeline .vco-navigation .timenav .content .marker.active .flag-small .flag-content h3{color:#08c;margin-top:5px} .vco-timeline .vco-navigation .timenav .content .marker.active .flag .flag-content .thumbnail,.vco-timeline .vco-navigation .timenav .content .marker.active .flag-small .flag-content .thumbnail{filter:alpha(opacity=100);-khtml-opacity:1;-moz-opacity:1;opacity:1} .vco-timeline .vco-navigation .timenav .content .marker.active .flag.row1,.vco-timeline .vco-navigation .timenav .content .marker.active .flag.row2,.vco-timeline .vco-navigation .timenav .content .marker.active .flag.row3,.vco-timeline .vco-navigation .timenav .content .marker.active .flag-small.row1,.vco-timeline .vco-navigation .timenav .content .marker.active .flag-small.row2,.vco-timeline .vco-navigation .timenav .content .marker.active .flag-small.row3{z-index:200} .vco-timeline .vco-navigation .timenav .content .marker.active .flag{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:0 -53px;width:153px;height:53px} .vco-timeline .vco-navigation .timenav .content .marker.active .flag-small{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:0 -109px;width:153px;height:26px;height:26px}.vco-timeline .vco-navigation .timenav .content .marker.active .flag-small .flag-content{height:14px}.vco-timeline .vco-navigation .timenav .content .marker.active .flag-small .flag-content h3{margin-top:4px} .vco-timeline .vco-navigation .timenav .content .marker{position:absolute;top:0;left:150px;display:block}.vco-timeline .vco-navigation .timenav .content .marker .dot{position:absolute;top:150px;left:0;display:block;width:6px;height:6px;background:#333;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;z-index:21} .vco-timeline .vco-navigation .timenav .content .marker .line{position:absolute;top:0;left:3px;width:1px;height:150px;background-color:#ccc;background-color:rgba(204,204,204,0.5);-webkit-box-shadow:1px 0 0 rgba(255,255,255,0.5);-moz-box-shadow:1px 0 0 rgba(255,255,255,0.5);box-shadow:1px 0 0 rgba(255,255,255,0.5);z-index:22}.vco-timeline .vco-navigation .timenav .content .marker .line .event-line{position:absolute;z-index:22;left:0;height:1px;width:1px;background:#08c;filter:alpha(opacity=15);-khtml-opacity:.15;-moz-opacity:.15;opacity:.15} .vco-timeline .vco-navigation .timenav .content .marker .flag,.vco-timeline .vco-navigation .timenav .content .marker .flag-small{position:absolute;top:15px;left:3px;padding:0;display:block;z-index:23;width:153px}.vco-timeline .vco-navigation .timenav .content .marker .flag .flag-content,.vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content{padding:0 7px 2px 6px;overflow:hidden}.vco-timeline .vco-navigation .timenav .content .marker .flag .flag-content h3,.vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content h3{font-weight:bold;font-size:15px;line-height:20px;font-size:11px;line-height:11px;color:#999;margin-bottom:2px}.vco-timeline .vco-navigation .timenav .content .marker .flag .flag-content h3 small,.vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content h3 small{display:none} .vco-timeline .vco-navigation .timenav .content .marker .flag .flag-content h4,.vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content h4{display:none;font-weight:normal;font-size:15px;line-height:20px;margin-top:5px;font-size:10px;line-height:10px;color:#aaa}.vco-timeline .vco-navigation .timenav .content .marker .flag .flag-content h4 small,.vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content h4 small{display:none} .vco-timeline .vco-navigation .timenav .content .marker .flag .flag-content .thumbnail,.vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail{margin-bottom:15px;margin-right:3px;filter:alpha(opacity=50);-khtml-opacity:.5;-moz-opacity:.5;opacity:.5}.vco-timeline .vco-navigation .timenav .content .marker .flag .flag-content .thumbnail img,.vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail img{width:22px;height:22px;max-height:none;max-width:none;border:0;border:1px solid #999;padding:0;margin:0} .vco-timeline .vco-navigation .timenav .content .marker .flag{height:56px;background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:0 0;width:153px;height:53px}.vco-timeline .vco-navigation .timenav .content .marker .flag .flag-content{height:36px}.vco-timeline .vco-navigation .timenav .content .marker .flag .flag-content h3{margin-top:5px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small{height:26px;background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:0 -135px;width:153px;height:26px}.vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content{height:14px}.vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content h3{margin-top:4px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail{width:16px;height:10px;margin-right:1px;margin-top:6px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-plaintext{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-280px -130px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-quote{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-232px -130px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-document{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-256px -130px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-photo{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-280px -120px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-twitter{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-256px -120px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-vimeo{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-328px -130px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-vine{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-160px -120px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-youtube{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-304px -130px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-video{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-328px -120px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-audio{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-304px -120px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-map{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-208px -120px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-website{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-232px -120px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-link{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-232px -120px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-wikipedia{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-184px -120px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-storify{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-184px -130px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content .thumbnail.thumb-googleplus{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-208px -130px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small .flag-content thumbnail.thumb-instagram{background-image:url(timeline.png?v4.4);background-repeat:no-repeat;background-position:-208px -96px} .vco-timeline .vco-navigation .timenav .content .marker .flag.row1{z-index:25;top:48px} .vco-timeline .vco-navigation .timenav .content .marker .flag.row2{z-index:24;top:96px} .vco-timeline .vco-navigation .timenav .content .marker .flag.row3{z-index:23;top:1px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small.row1{z-index:28;top:24px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small.row2{z-index:27;top:48px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small.row3{z-index:26;top:72px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small.row4{z-index:25;top:96px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small.row5{z-index:24;top:120px} .vco-timeline .vco-navigation .timenav .content .marker .flag-small.row6{z-index:23;top:1px} .vco-timeline .vco-navigation .timenav .content .marker .flag.zFront,.vco-timeline .vco-navigation .timenav .content .marker .flag-small.zFront{z-index:201} .vco-timeline .vco-navigation .timenav .content .era{position:absolute;top:138px;left:150px;height:12px;display:block;overflow:hidden}.vco-timeline .vco-navigation .timenav .content .era div{height:50px;width:100%;height:100%;line-height:0;background:#e9e9e9;background:rgba(233,233,233,0.33)}.vco-timeline .vco-navigation .timenav .content .era div h3,.vco-timeline .vco-navigation .timenav .content .era div h4{position:absolute;bottom:1px;padding-left:15px;font-size:15px;font-weight:bold;color:rgba(0,136,204,0.35);text-shadow:0 1px 1px #fff} .vco-timeline .vco-navigation .timenav .content .era1 div{background:#c40;filter:alpha(opacity=10);-khtml-opacity:.1;-moz-opacity:.1;opacity:.1;border-left:1px solid rgba(204,68,0,0.1);border-right:1px solid rgba(255,85,0,0.05)}.vco-timeline .vco-navigation .timenav .content .era1 div h3,.vco-timeline .vco-navigation .timenav .content .era1 div h4{color:rgba(204,68,0,0.35);text-shadow:0 1px 1px #fff} .vco-timeline .vco-navigation .timenav .content .era2 div{background:#c02;filter:alpha(opacity=10);-khtml-opacity:.1;-moz-opacity:.1;opacity:.1;border-left:1px solid rgba(204,0,34,0.1);border-right:1px solid rgba(255,0,43,0.05)}.vco-timeline .vco-navigation .timenav .content .era2 div h3,.vco-timeline .vco-navigation .timenav .content .era2 div h4{color:rgba(204,0,34,0.35);text-shadow:0 1px 1px #fff} .vco-timeline .vco-navigation .timenav .content .era3 div{background:#02c;filter:alpha(opacity=10);-khtml-opacity:.1;-moz-opacity:.1;opacity:.1;border-left:1px solid rgba(0,34,204,0.1);border-right:1px solid rgba(0,43,255,0.05)}.vco-timeline .vco-navigation .timenav .content .era3 div h3,.vco-timeline .vco-navigation .timenav .content .era3 div h4{color:rgba(0,34,204,0.35);text-shadow:0 1px 1px #fff} .vco-timeline .vco-navigation .timenav .content .era4 div{background:#ca0;filter:alpha(opacity=10);-khtml-opacity:.1;-moz-opacity:.1;opacity:.1;border-left:1px solid rgba(204,170,0,0.1);border-right:1px solid rgba(255,213,0,0.05)}.vco-timeline .vco-navigation .timenav .content .era4 div h3,.vco-timeline .vco-navigation .timenav .content .era4 div h4{color:rgba(204,170,0,0.35);text-shadow:0 1px 1px #fff} .vco-timeline .vco-navigation .timenav .content .era5 div{background:#0ca;filter:alpha(opacity=10);-khtml-opacity:.1;-moz-opacity:.1;opacity:.1;border-left:1px solid rgba(0,204,170,0.1);border-right:1px solid rgba(0,255,213,0.05)}.vco-timeline .vco-navigation .timenav .content .era5 div h3,.vco-timeline .vco-navigation .timenav .content .era5 div h4{color:rgba(0,204,170,0.35);text-shadow:0 1px 1px #fff} .vco-timeline .vco-navigation .timenav .content .era6 div{background:#08c;filter:alpha(opacity=10);-khtml-opacity:.1;-moz-opacity:.1;opacity:.1;border-left:1px solid rgba(0,136,204,0.1);border-right:1px solid rgba(0,170,255,0.05)}.vco-timeline .vco-navigation .timenav .content .era6 div h3,.vco-timeline .vco-navigation .timenav .content .era6 div h4{color:rgba(0,136,204,0.35);text-shadow:0 1px 1px #fff} .vco-timeline .vco-navigation .timenav .time{position:absolute;left:0;top:150px;height:50px;background-color:#fff;line-height:0}.vco-timeline .vco-navigation .timenav .time .time-interval-minor{max-width:none;height:6px;white-space:nowrap;position:absolute;top:-2px;left:8px;z-index:10}.vco-timeline .vco-navigation .timenav .time .time-interval-minor .minor{position:relative;top:2px;display:inline-block;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAMCAMAAACdvocfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRFzMzM////040VdgAAAAJ0Uk5T/wDltzBKAAAAEklEQVR42mJgYAQCBopJgAADAAbwADHy2qHzAAAAAElFTkSuQmCC);width:100px;height:6px;background-position:center top;white-space:nowrap;color:#666;margin-top:0;padding-top:0} .vco-timeline .vco-navigation .timenav .time .time-interval{white-space:nowrap;position:absolute;top:5px;left:0}.vco-timeline .vco-navigation .timenav .time .time-interval div{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAMCAMAAACdvocfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRFzMzM////040VdgAAAAJ0Uk5T/wDltzBKAAAAEklEQVR42mJgYAQCBopJgAADAAbwADHy2qHzAAAAAElFTkSuQmCC);background-position:left top;background-repeat:no-repeat;padding-top:6px;position:absolute;height:3px;left:0;display:block;font-weight:normal;font-size:10px;line-height:20px;text-transform:uppercase;text-align:left;text-indent:0;white-space:nowrap;color:#666;margin-left:0;margin-right:0;margin-top:0;z-index:2}.vco-timeline .vco-navigation .timenav .time .time-interval div strong{font-weight:bold;color:#000} .vco-timeline .vco-navigation .timenav .time .time-interval div.era{font-weight:bold;padding-top:0;margin-top:-3px;margin-left:2px;background-image:none} .vco-timeline .vco-navigation .timenav .time .time-interval .era1{color:#c40;filter:alpha(opacity=50);-khtml-opacity:.5;-moz-opacity:.5;opacity:.5} .vco-timeline .vco-navigation .timenav .time .time-interval .era2{color:#c02;filter:alpha(opacity=50);-khtml-opacity:.5;-moz-opacity:.5;opacity:.5} .vco-timeline .vco-navigation .timenav .time .time-interval .era3{color:#02c;filter:alpha(opacity=50);-khtml-opacity:.5;-moz-opacity:.5;opacity:.5} .vco-timeline .vco-navigation .timenav .time .time-interval .era4{color:#ca0;filter:alpha(opacity=50);-khtml-opacity:.5;-moz-opacity:.5;opacity:.5} .vco-timeline .vco-navigation .timenav .time .time-interval .era5{color:#0ca;filter:alpha(opacity=50);-khtml-opacity:.5;-moz-opacity:.5;opacity:.5} .vco-timeline .vco-navigation .timenav .time .time-interval .era6{color:#08c;filter:alpha(opacity=50);-khtml-opacity:.5;-moz-opacity:.5;opacity:.5} .vco-timeline .vco-navigation .timenav .time .time-interval-major{white-space:nowrap;position:absolute;top:5px;left:0}.vco-timeline .vco-navigation .timenav .time .time-interval-major div{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAQAQMAAADtUYf0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoyOTAzRjI3REIzNDcxMUUxQUQ3QUZCOThEODQ1NDhCNyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyOTAzRjI3RUIzNDcxMUUxQUQ3QUZCOThEODQ1NDhCNyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjI5MDNGMjdCQjM0NzExRTFBRDdBRkI5OEQ4NDU0OEI3IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjI5MDNGMjdDQjM0NzExRTFBRDdBRkI5OEQ4NDU0OEI3Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+DPWNfQAAAANQTFRFzMzMylJEJwAAAAtJREFUCB1jYMAPAAAgAAHDvpOtAAAAAElFTkSuQmCC);background-position:left top;background-repeat:no-repeat;padding-top:15px;position:absolute;height:15px;left:0;display:block;font-weight:bold;font-size:12px;line-height:20px;text-transform:uppercase;text-align:left;text-indent:0;white-space:nowrap;color:#333;margin-left:0;margin-right:0;margin-top:1px;z-index:5}.vco-timeline .vco-navigation .timenav .time .time-interval-major div strong{font-weight:bold;color:#000} @media only screen and (-webkit-min-device-pixel-ratio:2),only screen and (min-device-pixel-ratio:2){.vco-notouch .vco-navigation .vco-toolbar .zoom-in .icon{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:-256px 0;width:24px;height:24px} .vco-notouch .vco-navigation .vco-toolbar .zoom-out .icon{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:-280px 0;width:24px;height:24px} .vco-notouch .vco-navigation .vco-toolbar .back-home .icon{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:-328px 0;width:24px;height:24px} .vco-notouch .vco-navigation .vco-toolbar.touch .zoom-in .icon{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:-208px -160px;width:40px;height:40px} .vco-notouch .vco-navigation .vco-toolbar.touch .zoom-out .icon{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:-256px -160px;width:40px;height:40px} .vco-notouch .vco-navigation .vco-toolbar.touch .back-home .icon{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:-304px -160px;width:40px;height:40px} .vco-notouch .vco-navigation .timenav .content .marker .flag:hover{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:0 -53px;width:153px;height:53px} .vco-notouch .vco-navigation .timenav .content .marker .flag-small:hover{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:0 -53px;width:153px;height:53px} .vco-notouch .vco-navigation .timenav .content .marker .flag-small.flag-small-last:hover{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:0 -109px;width:153px;height:26px} .vco-notouch .vco-navigation .timenav-background .timenav-indicator{background-image:url(timeline@2x.png?v4.4);background-size:352px 260px;background-repeat:no-repeat;background-position:-160px -48px;width:24px;height:24px}}@media screen and (-webkit-max-device-pixel-ratio:1){}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (-o-min-device-pixel-ratio:3/2),only screen and (min--moz-device-pixel-ratio:1.5),only screen and (min-device-pixel-ratio:1.5){}@media screen and (max-device-width:480px) and (orientation:portrait){.storyjs-embed.full-embed{height:557px !important;width:320px !important}.storyjs-embed.full-embed .vco-feature{height:356px !important}}@media screen and (max-device-width:480px) and (orientation:landscape){.storyjs-embed.full-embed{height:409px !important;width:480px !important}.storyjs-embed.full-embed .vco-feature{height:208px !important}}@media screen and (min-device-width:481px) and (orientation:portrait){}@media screen and (min-device-width:481px) and (orientation:landscape){}@media (max-width:480px){}@media only screen and (max-width:480px){}
kenwheeler/cdnjs
ajax/libs/timelinejs/2.26.0/css/timeline.css
CSS
mit
74,420
angular.module('ng-token-auth', ['ngCookies']).provider('$auth', function() { var config; config = { apiUrl: '/api', signOutUrl: '/auth/sign_out', emailSignInPath: '/auth/sign_in', emailRegistrationPath: '/auth', confirmationSuccessUrl: window.location.href, passwordResetPath: '/auth/password', passwordUpdatePath: '/auth/password', passwordResetSuccessUrl: window.location.href, tokenValidationPath: '/auth/validate_token', proxyIf: function() { return false; }, proxyUrl: '/proxy', validateOnPageLoad: true, forceHardRedirect: false, tokenFormat: { "access-token": "{{ token }}", "token-type": "Bearer", client: "{{ clientId }}", expiry: "{{ expiry }}", uid: "{{ uid }}" }, parseExpiry: function(headers) { return (parseInt(headers['expiry'], 10) * 1000) || null; }, authProviderPaths: { github: '/auth/github', facebook: '/auth/facebook', google: '/auth/google_oauth2' } }; return { configure: function(params) { return angular.extend(config, params); }, $get: [ '$http', '$q', '$location', '$cookies', '$cookieStore', '$window', '$timeout', '$rootScope', '$interpolate', (function(_this) { return function($http, $q, $location, $cookies, $cookieStore, $window, $timeout, $rootScope, $interpolate) { return { header: null, dfd: null, config: config, user: {}, mustResetPassword: false, listener: null, initialize: function() { this.initializeListeners(); return this.addScopeMethods(); }, initializeListeners: function() { this.listener = this.handlePostMessage.bind(this); if ($window.addEventListener) { return $window.addEventListener("message", this.listener, false); } }, cancel: function(reason) { if (this.t != null) { $timeout.cancel(this.t); } if (this.dfd != null) { this.rejectDfd(reason); } return $timeout(((function(_this) { return function() { return _this.t = null; }; })(this)), 0); }, destroy: function() { this.cancel(); if ($window.removeEventListener) { return $window.removeEventListener("message", this.listener, false); } }, handlePostMessage: function(ev) { var error; if (ev.data.message === 'deliverCredentials') { delete ev.data.message; this.handleValidAuth(ev.data, true); $rootScope.$broadcast('auth:login-success', ev.data); } if (ev.data.message === 'authFailure') { error = { reason: 'unauthorized', errors: [ev.data.error] }; this.cancel(error); return $rootScope.$broadcast('auth:login-error', error); } }, addScopeMethods: function() { $rootScope.user = this.user; $rootScope.authenticate = (function(_this) { return function(provider) { return _this.authenticate(provider); }; })(this); $rootScope.signOut = (function(_this) { return function() { return _this.signOut(); }; })(this); $rootScope.submitRegistration = (function(_this) { return function(params) { return _this.submitRegistration(params); }; })(this); $rootScope.submitLogin = (function(_this) { return function(params) { return _this.submitLogin(params); }; })(this); $rootScope.requestPasswordReset = (function(_this) { return function(params) { return _this.requestPasswordReset(params); }; })(this); $rootScope.updatePassword = (function(_this) { return function(params) { return _this.updatePassword(params); }; })(this); if (config.validateOnPageLoad) { return this.validateUser(); } }, submitRegistration: function(params) { angular.extend(params, { confirm_success_url: config.confirmationSuccessUrl }); return $http.post(this.apiUrl() + config.emailRegistrationPath, params).success(function() { return $rootScope.$broadcast('auth:registration-email-success', params); }).error(function(resp) { return $rootScope.$broadcast('auth:registration-email-error', resp); }); }, submitLogin: function(params) { this.initDfd(); $http.post(this.apiUrl() + config.emailSignInPath, params).success((function(_this) { return function(resp) { _this.handleValidAuth(resp.data); return $rootScope.$broadcast('auth:login-success', _this.user); }; })(this)).error((function(_this) { return function(resp) { _this.rejectDfd({ reason: 'unauthorized', errors: ['Invalid credentials'] }); return $rootScope.$broadcast('auth:login-error', resp); }; })(this)); return this.dfd.promise; }, requestPasswordReset: function(params) { params.redirect_url = config.passwordResetSuccessUrl; return $http.post(this.apiUrl() + config.passwordResetPath, params).success(function() { return $rootScope.$broadcast('auth:password-reset-request-success', params); }).error(function(resp) { return $rootScope.$broadcast('auth:password-reset-request-error', resp); }); }, updatePassword: function(params) { return $http.put(this.apiUrl() + config.passwordUpdatePath, params).success((function(_this) { return function(resp) { $rootScope.$broadcast('auth:password-change-success', resp); return _this.mustResetPassword = false; }; })(this)).error(function(resp) { return $rootScope.$broadcast('auth:password-change-error', resp); }); }, authenticate: function(provider) { if (this.dfd == null) { this.initDfd(); this.openAuthWindow(provider); } return this.dfd.promise; }, openAuthWindow: function(provider) { var authUrl; authUrl = this.buildAuthUrl(provider); if (this.useExternalWindow()) { return this.requestCredentials($window.open(authUrl)); } else { return $location.replace(authUrl); } }, buildAuthUrl: function(provider) { var authUrl; authUrl = config.apiUrl; authUrl += config.authProviderPaths[provider]; authUrl += '?auth_origin_url='; return authUrl += $location.href; }, requestCredentials: function(authWindow) { if (authWindow.closed) { this.cancel({ reason: 'unauthorized', errors: ['User canceled login'] }); return $rootScope.$broadcast('auth:window-closed'); } else { authWindow.postMessage("requestCredentials", "*"); return this.t = $timeout(((function(_this) { return function() { return _this.requestCredentials(authWindow); }; })(this)), 500); } }, resolveDfd: function() { this.dfd.resolve({ id: this.user.id }); return $timeout(((function(_this) { return function() { _this.dfd = null; if (!$rootScope.$$phase) { return $rootScope.$digest(); } }; })(this)), 0); }, validateUser: function() { var clientId, token, uid; if (this.dfd == null) { this.initDfd(); if (!(this.headers && this.user.id)) { if ($location.search().token !== void 0) { token = $location.search().token; clientId = $location.search().client_id; uid = $location.search().uid; this.mustResetPassword = $location.search().reset_password; this.firstTimeLogin = $location.search().account_confirmation_success; this.setAuthHeaders(this.buildAuthHeaders({ token: token, clientId: clientId, uid: uid })); $location.url($location.path() || '/'); } else if ($cookieStore.get('auth_headers')) { this.headers = $cookieStore.get('auth_headers'); } console.log('@-->headers', this.headers); if (this.headers) { this.validateToken(); } else { this.rejectDfd({ reason: 'unauthorized', errors: ['No credentials'] }); $rootScope.$broadcast('auth:invalid'); } } else { this.resolveDfd(); } } return this.dfd.promise; }, validateToken: function() { if (!this.tokenHasExpired()) { return $http.get(this.apiUrl() + config.tokenValidationPath).success((function(_this) { return function(resp) { _this.handleValidAuth(resp.data); if (_this.firstTimeLogin) { $rootScope.$broadcast('auth:email-confirmation-success', _this.user); } if (_this.mustResetPassword) { $rootScope.$broadcast('auth:password-reset-confirm-success', _this.user); } return $rootScope.$broadcast('auth:validation-success', _this.user); }; })(this)).error((function(_this) { return function(data) { if (_this.firstTimeLogin) { $rootScope.$broadcast('auth:email-confirmation-error', data); } if (_this.mustResetPassword) { $rootScope.$broadcast('auth:password-reset-confirm-error', data); } $rootScope.$broadcast('auth:validation-error', data); return _this.rejectDfd({ reason: 'unauthorized', errors: data.errors }); }; })(this)); } else { return this.rejectDfd({ reason: 'unauthorized', errors: ['Expired credentials'] }); } }, tokenHasExpired: function() { var expiry, now; expiry = this.getExpiry(); now = new Date().getTime(); if (this.headers && expiry) { return expiry && expiry < now; } else { return null; } }, getExpiry: function() { return config.parseExpiry(this.headers); }, invalidateTokens: function() { var key, val, _ref; _ref = this.user; for (key in _ref) { val = _ref[key]; delete this.user[key]; } this.headers = null; return delete $cookies['auth_headers']; }, signOut: function() { return $http["delete"](this.apiUrl() + config.signOutUrl).success((function(_this) { return function(resp) { _this.invalidateTokens(); return $rootScope.$broadcast('auth:logout-success'); }; })(this)).error((function(_this) { return function(resp) { return $rootScope.$broadcast('auth:logout-error', resp); }; })(this)); }, handleValidAuth: function(user, setHeader) { if (setHeader == null) { setHeader = false; } if (this.t != null) { $timeout.cancel(this.t); } angular.extend(this.user, user); if (setHeader) { this.setAuthHeaders(this.buildAuthHeaders({ token: this.user.auth_token, clientId: this.user.client_id, uid: this.user.uid })); } return this.resolveDfd(); }, buildAuthHeaders: function(ctx) { var headers, key, val, _ref; headers = {}; _ref = config.tokenFormat; for (key in _ref) { val = _ref[key]; headers[key] = $interpolate(val)(ctx); } return headers; }, setAuthHeaders: function(headers) { this.headers = angular.extend(this.headers || {}, headers); return $cookieStore.put('auth_headers', this.headers); }, useExternalWindow: function() { return !(config.forceHardRedirect || $window.isOldIE()); }, initDfd: function() { return this.dfd = $q.defer(); }, rejectDfd: function(reason) { this.invalidateTokens(); if (this.dfd != null) { this.dfd.reject(reason); return $timeout(((function(_this) { return function() { return _this.dfd = null; }; })(this)), 0); } }, apiUrl: function() { if (config.proxyIf()) { return config.proxyUrl; } else { return config.apiUrl; } } }; }; })(this) ] }; }).config(function($httpProvider) { var httpMethods; $httpProvider.interceptors.push(function($injector) { return { request: function(req) { $injector.invoke(function($http, $auth) { var key, val, _ref; if (req.url.match($auth.config.apiUrl)) { _ref = $auth.headers; for (key in _ref) { val = _ref[key]; req.headers[key] = val; } } return console.log('req headers', req.headers); }); return req; }, response: function(resp) { $injector.invoke(function($http, $auth) { var key, newHeaders, val, _ref; newHeaders = {}; _ref = $auth.config.tokenFormat; for (key in _ref) { val = _ref[key]; if (resp.headers(key)) { newHeaders[key] = resp.headers(key); } } return $auth.setAuthHeaders(newHeaders); }); return resp; } }; }); httpMethods = ['get', 'post', 'put', 'patch', 'delete']; return angular.forEach(httpMethods, function(method) { var _base; if ((_base = $httpProvider.defaults.headers)[method] == null) { _base[method] = method; } return $httpProvider.defaults.headers[method]['If-Modified-Since'] = '0'; }); }).run(function($auth, $window, $rootScope) { return $auth.initialize(); }); window.isOldIE = function() { var nav, out, version; out = false; nav = navigator.userAgent.toLowerCase(); if (nav && nav.indexOf('msie') !== -1) { version = parseInt(nav.split('msie')[1]); if (version < 10) { out = true; } } return out; };
coupang/cdnjs
ajax/libs/ng-token-auth/0.0.18/ng-token-auth.js
JavaScript
mit
17,071
<!DOCTYPE html> <html> <head> <title>CSS white-space property</title> <link rel="Stylesheet" href="http://yui.yahooapis.com/3.3.0/build/cssreset/reset-min.css"> <style> #wrap { margin:30px auto; width:600px; font-family:sans-serif; color:#444; cursor:default; } h1 { font-size:40px; text-align:center; font-weight:bold; margin-bottom:30px; text-shadow:0 0 3px #ddd; } pre { background-color:#eee; margin:10px 0; padding:5px; } p.demo { background-color:orange; width:100px; margin:10px 0; font-family:monospace; } </style> </head> <body> <div id="wrap"> <h1>CSS white-space property</h1> <p> Given this CSS code: </p> <pre> p { width:100px; background-color:orange; margin:10px 0; font-family:monospace; } </pre> <p> and this HTML code: </p> <pre> &lt;p&gt; P A R A G R A P H &lt;/p&gt; </pre> <p> Depending on the white-space property, the resulting presentation will be: </p> <hr> <p> normal </p> <p class="demo" style="white-space:normal"> P A R A G R A P H </p> <hr> <p> nowrap </p> <p class="demo" style="white-space:nowrap"> P A R A G R A P H </p> <hr> <p> pre </p> <p class="demo" style="white-space:pre"> P A R A G R A P H </p> <hr> <p> pre-wrap </p> <p class="demo" style="white-space:pre-wrap"> P A R A G R A P H </p> <hr> <p> pre-line </p> <p class="demo" style="white-space:pre-line"> P A R A G R A P H </p> </div> </body> </html>
beeman00/DompdfBundle
DomPDF/www/test/css_whitespace.html
HTML
mit
1,862
/* TimelineJS - ver. 2.27.1 - 2014-01-06 Copyright (c) 2012-2013 Northwestern University a project of the Northwestern University Knight Lab, originally created by Zach Wise https://github.com/NUKnightLab/TimelineJS This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* Basque/ Euskara LANGUAGE ================================================== */typeof VMM!="undefined"&&(VMM.Language={lang:"eu",api:{wikipedia:"eu"},date:{month:["Urtarrila","Otsaila","Martxoa","Apirila","Maiatza","Ekaina","Uztaila","Abuztua","Iraila","Urria","Azaroa","Abendua"],month_abbr:["Urt.","Ots.","Mar.","Api.","Mai.","Eka.","Uzt.","Abu.","Ira.","Urr.","Aza.","Abe."],day:["Igandea","Astelehena","Asteartea","Asteazkena","Osteguna","Ostirala","Larunbata"],day_abbr:["Iga.","Asl.","Asr.","Asz.","Osg.","Osr.","Lar."]},dateformats:{year:"yyyy",month_short:"mmm",month:"yyyy'(e)ko' mmmm",full_short:"mmm'-'d",full:"yyyy'(e)ko' mmmm'k' d",time_short:"h:MM:SS TT",time_no_seconds_short:"h:MM TT",time_no_seconds_small_date:"h:MM TT'<br /><small>'yyyy'-'mmm'-'d'</small>",full_long:"yyyy'(e)ko' mmmm'ren' d'(e)an,' hh:MM TT'(r)etan'",full_long_small_date:"hh:MM TT'<br /><small>'yyyy'-'mmm'-'d'</small>"},messages:{loading_timeline:"Kronologia kargatzen...",return_to_title:"Titulura itzuli",expand_timeline:"Handiago ikusi",contract_timeline:"Txikiago ikusi",wikipedia:"Wikipedia entziklopedia libretik",loading_content:"Edukia kargatzen",loading:"Kargatzen"}});
tomsoir/cdnjs
ajax/libs/timelinejs/2.27.1/js/locale/eu.js
JavaScript
mit
1,605
/* TimelineJS - ver. 2.35.0 - 2014-11-19 Copyright (c) 2012-2013 Northwestern University a project of the Northwestern University Knight Lab, originally created by Zach Wise https://github.com/NUKnightLab/TimelineJS This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ if(typeof VMM!="undefined"){VMM.Language={lang:"pt",api:{wikipedia:"pt"},date:{month:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],month_abbr:["Jan","Fev","Mar","Abr","Maio","Jun","Jul","Ago","Set","Out","Nov","Dez"],day:["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sabado"],day_abbr:["Dom","Seg","Ter","Qua","Qui","Sex","Sab"]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"mmm d",full:"mmmm d',' yyyy",time_short:"h:MM:ss TT",time_no_seconds_short:"h:MM TT",time_no_seconds_small_date:"h:MM TT'<br/><small>'mmmm d',' yyyy'</small>'",full_long:"mmm d',' yyyy 'at' hh:MM TT",full_long_small_date:"hh:MM TT'<br/><small>mmm d',' yyyy'</small>'"},messages:{loading_timeline:"A carregar a timeline... ",return_to_title:"Voltar ao Título",expand_timeline:"Expandir Timeline",contract_timeline:"Colapsar Timeline",wikipedia:"Wikipedia, A enciclopedia Livre.",loading_content:"A carregar o conteúdo",loading:"A carregar"}}}
jimmybyrum/cdnjs
ajax/libs/timelinejs/2.35.0/js/locale/pt.js
JavaScript
mit
1,463
/* TimelineJS - ver. 2.35.0 - 2014-11-19 Copyright (c) 2012-2013 Northwestern University a project of the Northwestern University Knight Lab, originally created by Zach Wise https://github.com/NUKnightLab/TimelineJS This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ if(typeof VMM!="undefined"){VMM.Language={lang:"no",api:{wikipedia:"no"},date:{month:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],month_abbr:["Jan.","Feb.","Mars","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Des."],day:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"],day_abbr:["Søn.","Man.","Tir.","Ons.","Tor.","Fre.","Lør."]},dateformats:{year:"yyyy",month_short:"mmm",month:"mmmm yyyy",full_short:"d. mmm",full:"d. mmmm',' yyyy",time_short:"HH:MM:ss",time_no_seconds_short:"HH:MM",time_no_seconds_small_date:"HH:MM'<br/><small>'d. mmmm',' yyyy'</small>'",full_long:"dddd',' d. mmm',' yyyy 'kl.' HH:MM",full_long_small_date:"HH:MM'<br/><small>'dddd',' d. mmm',' yyyy'</small>'"},messages:{loading_timeline:"Laster tidslinje... ",return_to_title:"Tilbake til tittel",expand_timeline:"Utvid tidslinje",contract_timeline:"Krymp tidslinje",wikipedia:"Fra Wikipedia, den frie encyklopedi",loading_content:"Laster innhold",loading:"Laster"}}}
jaslernl/cdnjs
ajax/libs/timelinejs/2.35.0/js/locale/no.js
JavaScript
mit
1,472
/*! Dust - Asynchronous Templating - v2.6.1 * http://linkedin.github.io/dustjs/ * Copyright (c) 2015 Aleksander Williams; Released under the MIT License */ (function(root) { var dust = { "version": "2.6.1" }, NONE = 'NONE', ERROR = 'ERROR', WARN = 'WARN', INFO = 'INFO', DEBUG = 'DEBUG', loggingLevels = [DEBUG, INFO, WARN, ERROR, NONE], EMPTY_FUNC = function() {}, logger = {}, originalLog, loggerContext; dust.debugLevel = NONE; dust.config = { whitespace: false, amd: false }; // Directive aliases to minify code dust._aliases = { "write": "w", "end": "e", "map": "m", "render": "r", "reference": "f", "section": "s", "exists": "x", "notexists": "nx", "block": "b", "partial": "p", "helper": "h" }; // Try to find the console in global scope if (root && root.console && root.console.log) { loggerContext = root.console; originalLog = root.console.log; } // robust logger for node.js, modern browsers, and IE <= 9. logger.log = loggerContext ? function() { // Do this for normal browsers if (typeof originalLog === 'function') { logger.log = function() { originalLog.apply(loggerContext, arguments); }; } else { // Do this for IE <= 9 logger.log = function() { var message = Array.prototype.slice.apply(arguments).join(' '); originalLog(message); }; } logger.log.apply(this, arguments); } : function() { /* no op */ }; /** * Log dust debug statements, info statements, warning statements, and errors. * Filters out the messages based on the dust.debuglevel. * This default implementation will print to the console if it exists. * @param {String|Error} message the message to print/throw * @param {String} type the severity of the message(ERROR, WARN, INFO, or DEBUG) * @public */ dust.log = function(message, type) { type = type || INFO; if (dust.debugLevel !== NONE && dust.indexInArray(loggingLevels, type) >= dust.indexInArray(loggingLevels, dust.debugLevel)) { if(!dust.logQueue) { dust.logQueue = []; } dust.logQueue.push({message: message, type: type}); logger.log('[DUST:' + type + ']', message); } }; dust.helpers = {}; dust.cache = {}; dust.register = function(name, tmpl) { if (!name) { return; } dust.cache[name] = tmpl; }; dust.render = function(name, context, callback) { var chunk = new Stub(callback).head; try { dust.load(name, chunk, Context.wrap(context, name)).end(); } catch (err) { chunk.setError(err); } }; dust.stream = function(name, context) { var stream = new Stream(), chunk = stream.head; dust.nextTick(function() { try { dust.load(name, stream.head, Context.wrap(context, name)).end(); } catch (err) { chunk.setError(err); } }); return stream; }; dust.renderSource = function(source, context, callback) { return dust.compileFn(source)(context, callback); }; dust.compileFn = function(source, name) { // name is optional. When name is not provided the template can only be rendered using the callable returned by this function. // If a name is provided the compiled template can also be rendered by name. name = name || null; var tmpl = dust.loadSource(dust.compile(source, name)); return function(context, callback) { var master = callback ? new Stub(callback) : new Stream(); dust.nextTick(function() { if(typeof tmpl === 'function') { tmpl(master.head, Context.wrap(context, name)).end(); } else { dust.log(new Error('Template [' + name + '] cannot be resolved to a Dust function'), ERROR); } }); return master; }; }; dust.load = function(name, chunk, context) { var tmpl = dust.cache[name]; if (tmpl) { return tmpl(chunk, context); } else { if (dust.onLoad) { return chunk.map(function(chunk) { dust.onLoad(name, function(err, src) { if (err) { return chunk.setError(err); } if (!dust.cache[name]) { dust.loadSource(dust.compile(src, name)); } dust.cache[name](chunk, context).end(); }); }); } return chunk.setError(new Error('Template Not Found: ' + name)); } }; dust.loadSource = function(source, path) { return eval(source); }; if (Array.isArray) { dust.isArray = Array.isArray; } else { dust.isArray = function(arr) { return Object.prototype.toString.call(arr) === '[object Array]'; }; } // indexOf shim for arrays for IE <= 8 // source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf dust.indexInArray = function(arr, item, fromIndex) { fromIndex = +fromIndex || 0; if (Array.prototype.indexOf) { return arr.indexOf(item, fromIndex); } else { if ( arr === undefined || arr === null ) { throw new TypeError( 'cannot call method "indexOf" of null' ); } var length = arr.length; // Hack to convert object.length to a UInt32 if (Math.abs(fromIndex) === Infinity) { fromIndex = 0; } if (fromIndex < 0) { fromIndex += length; if (fromIndex < 0) { fromIndex = 0; } } for (;fromIndex < length; fromIndex++) { if (arr[fromIndex] === item) { return fromIndex; } } return -1; } }; dust.nextTick = (function() { return function(callback) { setTimeout(callback,0); }; } )(); dust.isEmpty = function(value) { if (dust.isArray(value) && !value.length) { return true; } if (value === 0) { return false; } return (!value); }; // apply the filter chain and return the output string dust.filter = function(string, auto, filters) { if (filters) { for (var i=0, len=filters.length; i<len; i++) { var name = filters[i]; if (name === 's') { auto = null; } else if (typeof dust.filters[name] === 'function') { string = dust.filters[name](string); } else { dust.log('Invalid filter [' + name + ']', WARN); } } } // by default always apply the h filter, unless asked to unescape with |s if (auto) { string = dust.filters[auto](string); } return string; }; dust.filters = { h: function(value) { return dust.escapeHtml(value); }, j: function(value) { return dust.escapeJs(value); }, u: encodeURI, uc: encodeURIComponent, js: function(value) { return dust.escapeJSON(value); }, jp: function(value) { if (!JSON) {dust.log('JSON is undefined. JSON parse has not been used on [' + value + ']', WARN); return value; } else { return JSON.parse(value); } } }; function Context(stack, global, blocks, templateName) { this.stack = stack; this.global = global; this.blocks = blocks; this.templateName = templateName; } dust.makeBase = function(global) { return new Context(new Stack(), global); }; Context.wrap = function(context, name) { if (context instanceof Context) { return context; } return new Context(new Stack(context), {}, null, name); }; /** * Public API for getting a value from the context. * @method get * @param {string|array} path The path to the value. Supported formats are: * 'key' * 'path.to.key' * '.path.to.key' * ['path', 'to', 'key'] * ['key'] * @param {boolean} [cur=false] Boolean which determines if the search should be limited to the * current context (true), or if get should search in parent contexts as well (false). * @public * @returns {string|object} */ Context.prototype.get = function(path, cur) { if (typeof path === 'string') { if (path[0] === '.') { cur = true; path = path.substr(1); } path = path.split('.'); } return this._get(cur, path); }; /** * Get a value from the context * @method _get * @param {boolean} cur Get only from the current context * @param {array} down An array of each step in the path * @private * @return {string | object} */ Context.prototype._get = function(cur, down) { var ctx = this.stack, i = 1, value, first, len, ctxThis, fn; first = down[0]; len = down.length; if (cur && len === 0) { ctxThis = ctx; ctx = ctx.head; } else { if (!cur) { // Search up the stack for the first value while (ctx) { if (ctx.isObject) { ctxThis = ctx.head; value = ctx.head[first]; if (value !== undefined) { break; } } ctx = ctx.tail; } if (value !== undefined) { ctx = value; } else { ctx = this.global ? this.global[first] : undefined; } } else if (ctx) { // if scope is limited by a leading dot, don't search up the tree if(ctx.head) { ctx = ctx.head[first]; } else { //context's head is empty, value we are searching for is not defined ctx = undefined; } } while (ctx && i < len) { ctxThis = ctx; ctx = ctx[down[i]]; i++; } } // Return the ctx or a function wrapping the application of the context. if (typeof ctx === 'function') { fn = function() { try { return ctx.apply(ctxThis, arguments); } catch (err) { dust.log(err, ERROR); throw err; } }; fn.__dustBody = !!ctx.__dustBody; return fn; } else { if (ctx === undefined) { dust.log('Cannot find the value for reference [{' + down.join('.') + '}] in template [' + this.getTemplateName() + ']'); } return ctx; } }; Context.prototype.getPath = function(cur, down) { return this._get(cur, down); }; Context.prototype.push = function(head, idx, len) { return new Context(new Stack(head, this.stack, idx, len), this.global, this.blocks, this.getTemplateName()); }; Context.prototype.rebase = function(head) { return new Context(new Stack(head), this.global, this.blocks, this.getTemplateName()); }; Context.prototype.current = function() { return this.stack.head; }; Context.prototype.getBlock = function(key, chk, ctx) { if (typeof key === 'function') { var tempChk = new Chunk(); key = key(tempChk, this).data.join(''); } var blocks = this.blocks; if (!blocks) { dust.log('No blocks for context[{' + key + '}] in template [' + this.getTemplateName() + ']', DEBUG); return; } var len = blocks.length, fn; while (len--) { fn = blocks[len][key]; if (fn) { return fn; } } }; Context.prototype.shiftBlocks = function(locals) { var blocks = this.blocks, newBlocks; if (locals) { if (!blocks) { newBlocks = [locals]; } else { newBlocks = blocks.concat([locals]); } return new Context(this.stack, this.global, newBlocks, this.getTemplateName()); } return this; }; Context.prototype.getTemplateName = function() { return this.templateName; }; function Stack(head, tail, idx, len) { this.tail = tail; this.isObject = head && typeof head === 'object'; this.head = head; this.index = idx; this.of = len; } function Stub(callback) { this.head = new Chunk(this); this.callback = callback; this.out = ''; } Stub.prototype.flush = function() { var chunk = this.head; while (chunk) { if (chunk.flushable) { this.out += chunk.data.join(''); //ie7 perf } else if (chunk.error) { this.callback(chunk.error); dust.log('Chunk error [' + chunk.error + '] thrown. Ceasing to render this template.', WARN); this.flush = EMPTY_FUNC; return; } else { return; } chunk = chunk.next; this.head = chunk; } this.callback(null, this.out); }; function Stream() { this.head = new Chunk(this); } Stream.prototype.flush = function() { var chunk = this.head; while(chunk) { if (chunk.flushable) { this.emit('data', chunk.data.join('')); //ie7 perf } else if (chunk.error) { this.emit('error', chunk.error); dust.log('Chunk error [' + chunk.error + '] thrown. Ceasing to render this template.', WARN); this.flush = EMPTY_FUNC; return; } else { return; } chunk = chunk.next; this.head = chunk; } this.emit('end'); }; Stream.prototype.emit = function(type, data) { if (!this.events) { dust.log('No events to emit', INFO); return false; } var handler = this.events[type]; if (!handler) { dust.log('Event type [' + type + '] does not exist', WARN); return false; } if (typeof handler === 'function') { handler(data); } else if (dust.isArray(handler)) { var listeners = handler.slice(0); for (var i = 0, l = listeners.length; i < l; i++) { listeners[i](data); } } else { dust.log('Event Handler [' + handler + '] is not of a type that is handled by emit', WARN); } }; Stream.prototype.on = function(type, callback) { if (!this.events) { this.events = {}; } if (!this.events[type]) { if(callback) { this.events[type] = callback; } else { dust.log('Callback for type [' + type + '] does not exist. Listener not registered.', WARN); } } else if(typeof this.events[type] === 'function') { this.events[type] = [this.events[type], callback]; } else { this.events[type].push(callback); } return this; }; Stream.prototype.pipe = function(stream) { this.on('data', function(data) { try { stream.write(data, 'utf8'); } catch (err) { dust.log(err, ERROR); } }).on('end', function() { try { return stream.end(); } catch (err) { dust.log(err, ERROR); } }).on('error', function(err) { stream.error(err); }); return this; }; function Chunk(root, next, taps) { this.root = root; this.next = next; this.data = []; //ie7 perf this.flushable = false; this.taps = taps; } Chunk.prototype.write = function(data) { var taps = this.taps; if (taps) { data = taps.go(data); } this.data.push(data); return this; }; Chunk.prototype.end = function(data) { if (data) { this.write(data); } this.flushable = true; this.root.flush(); return this; }; Chunk.prototype.map = function(callback) { var cursor = new Chunk(this.root, this.next, this.taps), branch = new Chunk(this.root, cursor, this.taps); this.next = branch; this.flushable = true; try { callback(branch); } catch(e) { dust.log(e, ERROR); branch.setError(e); } return cursor; }; Chunk.prototype.tap = function(tap) { var taps = this.taps; if (taps) { this.taps = taps.push(tap); } else { this.taps = new Tap(tap); } return this; }; Chunk.prototype.untap = function() { this.taps = this.taps.tail; return this; }; Chunk.prototype.render = function(body, context) { return body(this, context); }; Chunk.prototype.reference = function(elem, context, auto, filters) { if (typeof elem === 'function') { // Changed the function calling to use apply with the current context to make sure // that "this" is wat we expect it to be inside the function elem = elem.apply(context.current(), [this, context, null, {auto: auto, filters: filters}]); if (elem instanceof Chunk) { return elem; } } if (!dust.isEmpty(elem)) { return this.write(dust.filter(elem, auto, filters)); } else { return this; } }; Chunk.prototype.section = function(elem, context, bodies, params) { // anonymous functions if (typeof elem === 'function' && !elem.__dustBody) { try { elem = elem.apply(context.current(), [this, context, bodies, params]); } catch(e) { dust.log(e, ERROR); return this.setError(e); } // functions that return chunks are assumed to have handled the body and/or have modified the chunk // use that return value as the current chunk and go to the next method in the chain if (elem instanceof Chunk) { return elem; } } var body = bodies.block, skip = bodies['else']; // a.k.a Inline parameters in the Dust documentations if (params) { context = context.push(params); } /* Dust's default behavior is to enumerate over the array elem, passing each object in the array to the block. When elem resolves to a value or object instead of an array, Dust sets the current context to the value and renders the block one time. */ //non empty array is truthy, empty array is falsy if (dust.isArray(elem)) { if (body) { var len = elem.length, chunk = this; if (len > 0) { // any custom helper can blow up the stack // and store a flattened context, guard defensively if(context.stack.head) { context.stack.head['$len'] = len; } for (var i=0; i<len; i++) { if(context.stack.head) { context.stack.head['$idx'] = i; } chunk = body(chunk, context.push(elem[i], i, len)); } if(context.stack.head) { context.stack.head['$idx'] = undefined; context.stack.head['$len'] = undefined; } return chunk; } else if (skip) { return skip(this, context); } } } else if (elem === true) { // true is truthy but does not change context if (body) { return body(this, context); } } else if (elem || elem === 0) { // everything that evaluates to true are truthy ( e.g. Non-empty strings and Empty objects are truthy. ) // zero is truthy // for anonymous functions that did not returns a chunk, truthiness is evaluated based on the return value if (body) { return body(this, context.push(elem)); } // nonexistent, scalar false value, scalar empty string, null, // undefined are all falsy } else if (skip) { return skip(this, context); } dust.log('Not rendering section (#) block in template [' + context.getTemplateName() + '], because above key was not found', DEBUG); return this; }; Chunk.prototype.exists = function(elem, context, bodies) { var body = bodies.block, skip = bodies['else']; if (!dust.isEmpty(elem)) { if (body) { return body(this, context); } } else if (skip) { return skip(this, context); } dust.log('Not rendering exists (?) block in template [' + context.getTemplateName() + '], because above key was not found', DEBUG); return this; }; Chunk.prototype.notexists = function(elem, context, bodies) { var body = bodies.block, skip = bodies['else']; if (dust.isEmpty(elem)) { if (body) { return body(this, context); } } else if (skip) { return skip(this, context); } dust.log('Not rendering not exists (^) block check in template [' + context.getTemplateName() + '], because above key was found', DEBUG); return this; }; Chunk.prototype.block = function(elem, context, bodies) { var body = bodies.block; if (elem) { body = elem; } if (body) { return body(this, context); } return this; }; Chunk.prototype.partial = function(elem, context, params) { var partialContext; //put the params context second to match what section does. {.} matches the current context without parameters // start with an empty context partialContext = dust.makeBase(context.global); partialContext.blocks = context.blocks; if (context.stack && context.stack.tail){ // grab the stack(tail) off of the previous context if we have it partialContext.stack = context.stack.tail; } if (params){ //put params on partialContext = partialContext.push(params); } if(typeof elem === 'string') { partialContext.templateName = elem; } //reattach the head partialContext = partialContext.push(context.stack.head); var partialChunk; if (typeof elem === 'function') { partialChunk = this.capture(elem, partialContext, function(name, chunk) { partialContext.templateName = partialContext.templateName || name; dust.load(name, chunk, partialContext).end(); }); } else { partialChunk = dust.load(elem, this, partialContext); } return partialChunk; }; Chunk.prototype.helper = function(name, context, bodies, params) { var chunk = this; // handle invalid helpers, similar to invalid filters if(dust.helpers[name]) { try { return dust.helpers[name](chunk, context, bodies, params); } catch(e) { dust.log('Error in ' + name + ' helper: ' + e, ERROR); return chunk.setError(e); } } else { dust.log('Invalid helper [' + name + ']', WARN); return chunk; } }; Chunk.prototype.capture = function(body, context, callback) { return this.map(function(chunk) { var stub = new Stub(function(err, out) { if (err) { chunk.setError(err); } else { callback(out, chunk); } }); body(stub.head, context).end(); }); }; Chunk.prototype.setError = function(err) { this.error = err; this.root.flush(); return this; }; // Chunk aliases for(var f in Chunk.prototype) { if(dust._aliases[f]) { Chunk.prototype[dust._aliases[f]] = Chunk.prototype[f]; } } function Tap(head, tail) { this.head = head; this.tail = tail; } Tap.prototype.push = function(tap) { return new Tap(tap, this); }; Tap.prototype.go = function(value) { var tap = this; while(tap) { value = tap.head(value); tap = tap.tail; } return value; }; var HCHARS = /[&<>"']/, AMP = /&/g, LT = /</g, GT = />/g, QUOT = /\"/g, SQUOT = /\'/g; dust.escapeHtml = function(s) { if (typeof s === "string" || (s && typeof s.toString === "function")) { if (typeof s !== "string") { s = s.toString(); } if (!HCHARS.test(s)) { return s; } return s.replace(AMP,'&amp;').replace(LT,'&lt;').replace(GT,'&gt;').replace(QUOT,'&quot;').replace(SQUOT, '&#39;'); } return s; }; var BS = /\\/g, FS = /\//g, CR = /\r/g, LS = /\u2028/g, PS = /\u2029/g, NL = /\n/g, LF = /\f/g, SQ = /'/g, DQ = /"/g, TB = /\t/g; dust.escapeJs = function(s) { if (typeof s === 'string') { return s .replace(BS, '\\\\') .replace(FS, '\\/') .replace(DQ, '\\"') .replace(SQ, '\\\'') .replace(CR, '\\r') .replace(LS, '\\u2028') .replace(PS, '\\u2029') .replace(NL, '\\n') .replace(LF, '\\f') .replace(TB, '\\t'); } return s; }; dust.escapeJSON = function(o) { if (!JSON) { dust.log('JSON is undefined. JSON stringify has not been used on [' + o + ']', WARN); return o; } else { return JSON.stringify(o) .replace(LS, '\\u2028') .replace(PS, '\\u2029') .replace(LT, '\\u003c'); } }; if (typeof define === "function" && define.amd && define.amd.dust === true) { define("dust.core", function() { return dust; }); } else if (typeof exports === 'object') { module.exports = dust; } else { root.dust = dust; } })((function(){return this;})()); if (typeof define === "function" && define.amd && define.amd.dust === true) { define(["require", "dust.core"], function(require, dust) { dust.onLoad = function(name, cb) { require([name], function() { cb(); }); }; return dust; }); }
kentcdodds/cdnjs
ajax/libs/dustjs-linkedin/2.6.1/dust-core.js
JavaScript
mit
24,746
/* Copyright (c) 2012 HyeonJe Jun (http://github.com/noraesae) * Licensed under the MIT License */ 'use strict'; (function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['jquery'], factory); } else { // Browser globals factory(jQuery); } }(function ($) { // The default settings for the plugin var defaultSettings = { wheelSpeed: 10, wheelPropagation: false, minScrollbarLength: null, useBothWheelAxes: false, useKeyboard: true, suppressScrollX: false, suppressScrollY: false, scrollXMarginOffset: 0, scrollYMarginOffset: 0 }; $.fn.perfectScrollbar = function (suppliedSettings, option) { return this.each(function () { // Use the default settings var settings = $.extend(true, {}, defaultSettings), $this = $(this); if (typeof suppliedSettings === "object") { // But over-ride any supplied $.extend(true, settings, suppliedSettings); } else { // If no settings were supplied, then the first param must be the option option = suppliedSettings; } // Catch options if (option === 'update') { if ($this.data('perfect-scrollbar-update')) { $this.data('perfect-scrollbar-update')(); } return $this; } else if (option === 'destroy') { if ($this.data('perfect-scrollbar-destroy')) { $this.data('perfect-scrollbar-destroy')(); } return $this; } if ($this.data('perfect-scrollbar')) { // if there's already perfect-scrollbar return $this.data('perfect-scrollbar'); } // Or generate new perfectScrollbar // Set class to the container $this.addClass('ps-container'); var $scrollbarXRail = $("<div class='ps-scrollbar-x-rail'></div>").appendTo($this), $scrollbarYRail = $("<div class='ps-scrollbar-y-rail'></div>").appendTo($this), $scrollbarX = $("<div class='ps-scrollbar-x'></div>").appendTo($scrollbarXRail), $scrollbarY = $("<div class='ps-scrollbar-y'></div>").appendTo($scrollbarYRail), scrollbarXActive, scrollbarYActive, containerWidth, containerHeight, contentWidth, contentHeight, scrollbarXWidth, scrollbarXLeft, scrollbarXBottom = parseInt($scrollbarXRail.css('bottom'), 10), scrollbarYHeight, scrollbarYTop, scrollbarYRight = parseInt($scrollbarYRail.css('right'), 10); var updateContentScrollTop = function () { var scrollTop = parseInt(scrollbarYTop * (contentHeight - containerHeight) / (containerHeight - scrollbarYHeight), 10); $this.scrollTop(scrollTop); $scrollbarXRail.css({bottom: scrollbarXBottom - scrollTop}); }; var updateContentScrollLeft = function () { var scrollLeft = parseInt(scrollbarXLeft * (contentWidth - containerWidth) / (containerWidth - scrollbarXWidth), 10); $this.scrollLeft(scrollLeft); $scrollbarYRail.css({right: scrollbarYRight - scrollLeft}); }; var getSettingsAdjustedThumbSize = function (thumbSize) { if (settings.minScrollbarLength) { thumbSize = Math.max(thumbSize, settings.minScrollbarLength); } return thumbSize; }; var updateScrollbarCss = function () { $scrollbarXRail.css({left: $this.scrollLeft(), bottom: scrollbarXBottom - $this.scrollTop(), width: containerWidth, display: settings.suppressScrollX ? "none": "inherit"}); $scrollbarYRail.css({top: $this.scrollTop(), right: scrollbarYRight - $this.scrollLeft(), height: containerHeight, display: settings.suppressScrollY ? "none": "inherit"}); $scrollbarX.css({left: scrollbarXLeft, width: scrollbarXWidth}); $scrollbarY.css({top: scrollbarYTop, height: scrollbarYHeight}); }; var updateBarSizeAndPosition = function () { containerWidth = $this.width(); containerHeight = $this.height(); contentWidth = $this.prop('scrollWidth'); contentHeight = $this.prop('scrollHeight'); if (!settings.suppressScrollX && containerWidth + settings.scrollXMarginOffset < contentWidth) { scrollbarXActive = true; scrollbarXWidth = getSettingsAdjustedThumbSize(parseInt(containerWidth * containerWidth / contentWidth, 10)); scrollbarXLeft = parseInt($this.scrollLeft() * (containerWidth - scrollbarXWidth) / (contentWidth - containerWidth), 10); } else { scrollbarXActive = false; scrollbarXWidth = 0; scrollbarXLeft = 0; $this.scrollLeft(0); } if (!settings.suppressScrollY && containerHeight + settings.scrollYMarginOffset < contentHeight) { scrollbarYActive = true; scrollbarYHeight = getSettingsAdjustedThumbSize(parseInt(containerHeight * containerHeight / contentHeight, 10)); scrollbarYTop = parseInt($this.scrollTop() * (containerHeight - scrollbarYHeight) / (contentHeight - containerHeight), 10); } else { scrollbarYActive = false; scrollbarYHeight = 0; scrollbarYTop = 0; $this.scrollTop(0); } if (scrollbarYTop >= containerHeight - scrollbarYHeight) { scrollbarYTop = containerHeight - scrollbarYHeight; } if (scrollbarXLeft >= containerWidth - scrollbarXWidth) { scrollbarXLeft = containerWidth - scrollbarXWidth; } updateScrollbarCss(); }; var moveBarX = function (currentLeft, deltaX) { var newLeft = currentLeft + deltaX, maxLeft = containerWidth - scrollbarXWidth; if (newLeft < 0) { scrollbarXLeft = 0; } else if (newLeft > maxLeft) { scrollbarXLeft = maxLeft; } else { scrollbarXLeft = newLeft; } $scrollbarXRail.css({left: $this.scrollLeft()}); $scrollbarX.css({left: scrollbarXLeft}); }; var moveBarY = function (currentTop, deltaY) { var newTop = currentTop + deltaY, maxTop = containerHeight - scrollbarYHeight; if (newTop < 0) { scrollbarYTop = 0; } else if (newTop > maxTop) { scrollbarYTop = maxTop; } else { scrollbarYTop = newTop; } $scrollbarYRail.css({top: $this.scrollTop()}); $scrollbarY.css({top: scrollbarYTop}); }; var bindMouseScrollXHandler = function () { var currentLeft, currentPageX; $scrollbarX.bind('mousedown.perfect-scrollbar', function (e) { currentPageX = e.pageX; currentLeft = $scrollbarX.position().left; $scrollbarXRail.addClass('in-scrolling'); e.stopPropagation(); e.preventDefault(); }); $(document).bind('mousemove.perfect-scrollbar', function (e) { if ($scrollbarXRail.hasClass('in-scrolling')) { updateContentScrollLeft(); moveBarX(currentLeft, e.pageX - currentPageX); e.stopPropagation(); e.preventDefault(); } }); $(document).bind('mouseup.perfect-scrollbar', function (e) { if ($scrollbarXRail.hasClass('in-scrolling')) { $scrollbarXRail.removeClass('in-scrolling'); } }); currentLeft = currentPageX = null; }; var bindMouseScrollYHandler = function () { var currentTop, currentPageY; $scrollbarY.bind('mousedown.perfect-scrollbar', function (e) { currentPageY = e.pageY; currentTop = $scrollbarY.position().top; $scrollbarYRail.addClass('in-scrolling'); e.stopPropagation(); e.preventDefault(); }); $(document).bind('mousemove.perfect-scrollbar', function (e) { if ($scrollbarYRail.hasClass('in-scrolling')) { updateContentScrollTop(); moveBarY(currentTop, e.pageY - currentPageY); e.stopPropagation(); e.preventDefault(); } }); $(document).bind('mouseup.perfect-scrollbar', function (e) { if ($scrollbarYRail.hasClass('in-scrolling')) { $scrollbarYRail.removeClass('in-scrolling'); } }); currentTop = currentPageY = null; }; // check if the default scrolling should be prevented. var shouldPreventDefault = function (deltaX, deltaY) { var scrollTop = $this.scrollTop(); if (deltaX === 0) { if (!scrollbarYActive) { return false; } if ((scrollTop === 0 && deltaY > 0) || (scrollTop >= contentHeight - containerHeight && deltaY < 0)) { return !settings.wheelPropagation; } } var scrollLeft = $this.scrollLeft(); if (deltaY === 0) { if (!scrollbarXActive) { return false; } if ((scrollLeft === 0 && deltaX < 0) || (scrollLeft >= contentWidth - containerWidth && deltaX > 0)) { return !settings.wheelPropagation; } } return true; }; // bind handlers var bindMouseWheelHandler = function () { var shouldPrevent = false; $this.bind('mousewheel.perfect-scrollbar', function (e, delta, deltaX, deltaY) { if (!settings.useBothWheelAxes) { // deltaX will only be used for horizontal scrolling and deltaY will // only be used for vertical scrolling - this is the default $this.scrollTop($this.scrollTop() - (deltaY * settings.wheelSpeed)); $this.scrollLeft($this.scrollLeft() + (deltaX * settings.wheelSpeed)); } else if (scrollbarYActive && !scrollbarXActive) { // only vertical scrollbar is active and useBothWheelAxes option is // active, so let's scroll vertical bar using both mouse wheel axes if (deltaY) { $this.scrollTop($this.scrollTop() - (deltaY * settings.wheelSpeed)); } else { $this.scrollTop($this.scrollTop() + (deltaX * settings.wheelSpeed)); } } else if (scrollbarXActive && !scrollbarYActive) { // useBothWheelAxes and only horizontal bar is active, so use both // wheel axes for horizontal bar if (deltaX) { $this.scrollLeft($this.scrollLeft() + (deltaX * settings.wheelSpeed)); } else { $this.scrollLeft($this.scrollLeft() - (deltaY * settings.wheelSpeed)); } } // update bar position updateBarSizeAndPosition(); shouldPrevent = shouldPreventDefault(deltaX, deltaY); if (shouldPrevent) { e.preventDefault(); } }); // fix Firefox scroll problem $this.bind('MozMousePixelScroll.perfect-scrollbar', function (e) { if (shouldPrevent) { e.preventDefault(); } }); }; var bindKeyboardHandler = function () { var hovered = false; $this.bind('mouseenter.perfect-scrollbar', function (e) { hovered = true; }); $this.bind('mouseleave.perfect-scrollbar', function (e) { hovered = false; }); var shouldPrevent = false; $(document).bind('keydown.perfect-scrollbar', function (e) { if (!hovered) { return; } var deltaX = 0, deltaY = 0; switch (e.which) { case 37: // left deltaX = -3; break; case 38: // up deltaY = 3; break; case 39: // right deltaX = 3; break; case 40: // down deltaY = -3; break; default: return; } $this.scrollTop($this.scrollTop() - (deltaY * settings.wheelSpeed)); $this.scrollLeft($this.scrollLeft() + (deltaX * settings.wheelSpeed)); // update bar position updateBarSizeAndPosition(); shouldPrevent = shouldPreventDefault(deltaX, deltaY); if (shouldPrevent) { e.preventDefault(); } }); }; var bindRailClickHandler = function () { var stopPropagation = function (e) { e.stopPropagation(); }; $scrollbarY.bind('click.perfect-scrollbar', stopPropagation); $scrollbarYRail.bind('click.perfect-scrollbar', function (e) { var halfOfScrollbarLength = parseInt(scrollbarYHeight / 2, 10), positionTop = e.pageY - $scrollbarYRail.offset().top - halfOfScrollbarLength, maxPositionTop = containerHeight - scrollbarYHeight, positionRatio = positionTop / maxPositionTop; if (positionRatio < 0) { positionRatio = 0; } else if (positionRatio > 1) { positionRatio = 1; } $this.scrollTop((contentHeight - containerHeight) * positionRatio); // update bar position updateBarSizeAndPosition(); }); $scrollbarX.bind('click.perfect-scrollbar', stopPropagation); $scrollbarXRail.bind('click.perfect-scrollbar', function (e) { var halfOfScrollbarLength = parseInt(scrollbarXWidth / 2, 10), positionLeft = e.pageX - $scrollbarXRail.offset().left - halfOfScrollbarLength, maxPositionLeft = containerWidth - scrollbarXWidth, positionRatio = positionLeft / maxPositionLeft; if (positionRatio < 0) { positionRatio = 0; } else if (positionRatio > 1) { positionRatio = 1; } $this.scrollLeft((contentWidth - containerWidth) * positionRatio); // update bar position updateBarSizeAndPosition(); }); }; // bind mobile touch handler var bindMobileTouchHandler = function () { var applyTouchMove = function (differenceX, differenceY) { $this.scrollTop($this.scrollTop() - differenceY); $this.scrollLeft($this.scrollLeft() - differenceX); // update bar position updateBarSizeAndPosition(); }; var startCoords = {}, startTime = 0, speed = {}, breakingProcess = null, inGlobalTouch = false; $(window).bind("touchstart.perfect-scrollbar", function (e) { inGlobalTouch = true; }); $(window).bind("touchend.perfect-scrollbar", function (e) { inGlobalTouch = false; }); $this.bind("touchstart.perfect-scrollbar", function (e) { var touch = e.originalEvent.targetTouches[0]; startCoords.pageX = touch.pageX; startCoords.pageY = touch.pageY; startTime = (new Date()).getTime(); if (breakingProcess !== null) { clearInterval(breakingProcess); } e.stopPropagation(); }); $this.bind("touchmove.perfect-scrollbar", function (e) { if (!inGlobalTouch && e.originalEvent.targetTouches.length === 1) { var touch = e.originalEvent.targetTouches[0]; var currentCoords = {}; currentCoords.pageX = touch.pageX; currentCoords.pageY = touch.pageY; var differenceX = currentCoords.pageX - startCoords.pageX, differenceY = currentCoords.pageY - startCoords.pageY; applyTouchMove(differenceX, differenceY); startCoords = currentCoords; var currentTime = (new Date()).getTime(); speed.x = differenceX / (currentTime - startTime); speed.y = differenceY / (currentTime - startTime); startTime = currentTime; e.preventDefault(); } }); $this.bind("touchend.perfect-scrollbar", function (e) { clearInterval(breakingProcess); breakingProcess = setInterval(function () { if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) { clearInterval(breakingProcess); return; } applyTouchMove(speed.x * 30, speed.y * 30); speed.x *= 0.8; speed.y *= 0.8; }, 10); }); }; var destroy = function () { $this.unbind('.perfect-scrollbar'); $(window).unbind('.perfect-scrollbar'); $(document).unbind('.perfect-scrollbar'); $this.data('perfect-scrollbar', null); $this.data('perfect-scrollbar-update', null); $this.data('perfect-scrollbar-destroy', null); $scrollbarX.remove(); $scrollbarY.remove(); $scrollbarXRail.remove(); $scrollbarYRail.remove(); // clean all variables $scrollbarX = $scrollbarY = containerWidth = containerHeight = contentWidth = contentHeight = scrollbarXWidth = scrollbarXLeft = scrollbarXBottom = scrollbarYHeight = scrollbarYTop = scrollbarYRight = null; }; var ieSupport = function (version) { $this.addClass('ie').addClass('ie' + version); var bindHoverHandlers = function () { var mouseenter = function () { $(this).addClass('hover'); }; var mouseleave = function () { $(this).removeClass('hover'); }; $this.bind('mouseenter.perfect-scrollbar', mouseenter).bind('mouseleave.perfect-scrollbar', mouseleave); $scrollbarXRail.bind('mouseenter.perfect-scrollbar', mouseenter).bind('mouseleave.perfect-scrollbar', mouseleave); $scrollbarYRail.bind('mouseenter.perfect-scrollbar', mouseenter).bind('mouseleave.perfect-scrollbar', mouseleave); $scrollbarX.bind('mouseenter.perfect-scrollbar', mouseenter).bind('mouseleave.perfect-scrollbar', mouseleave); $scrollbarY.bind('mouseenter.perfect-scrollbar', mouseenter).bind('mouseleave.perfect-scrollbar', mouseleave); }; var fixIe6ScrollbarPosition = function () { updateScrollbarCss = function () { $scrollbarX.css({left: scrollbarXLeft + $this.scrollLeft(), bottom: scrollbarXBottom, width: scrollbarXWidth}); $scrollbarY.css({top: scrollbarYTop + $this.scrollTop(), right: scrollbarYRight, height: scrollbarYHeight}); $scrollbarX.hide().show(); $scrollbarY.hide().show(); }; updateContentScrollTop = function () { var scrollTop = parseInt(scrollbarYTop * contentHeight / containerHeight, 10); $this.scrollTop(scrollTop); $scrollbarX.css({bottom: scrollbarXBottom}); $scrollbarX.hide().show(); }; updateContentScrollLeft = function () { var scrollLeft = parseInt(scrollbarXLeft * contentWidth / containerWidth, 10); $this.scrollLeft(scrollLeft); $scrollbarY.hide().show(); }; }; if (version === 6) { bindHoverHandlers(); fixIe6ScrollbarPosition(); } }; var supportsTouch = (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch); var initialize = function () { var ieMatch = navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/); if (ieMatch && ieMatch[1] === 'msie') { // must be executed at first, because 'ieSupport' may addClass to the container ieSupport(parseInt(ieMatch[2], 10)); } updateBarSizeAndPosition(); bindMouseScrollXHandler(); bindMouseScrollYHandler(); bindRailClickHandler(); if (supportsTouch) { bindMobileTouchHandler(); } if ($this.mousewheel) { bindMouseWheelHandler(); } if (settings.useKeyboard) { bindKeyboardHandler(); } $this.data('perfect-scrollbar', $this); $this.data('perfect-scrollbar-update', updateBarSizeAndPosition); $this.data('perfect-scrollbar-destroy', destroy); }; // initialize initialize(); return $this; }); }; }));
artch/cdnjs
ajax/libs/jquery.perfect-scrollbar/0.4.6/jquery.perfect-scrollbar.js
JavaScript
mit
20,460
// DATA_TEMPLATE: js_data oTest.fnStart( "aoColumns.bVisible" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "All columns are visible by default", null, function () { return $('#example tbody tr:eq(0) td').length == 5; } ); oTest.fnTest( "Can hide one column and it removes td column from DOM", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "bVisible": false }, null, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td').length == 4; } ); oTest.fnTest( "Can hide one column and it removes thead th column from DOM", null, function () { return $('#example thead tr:eq(0) th').length == 4; } ); oTest.fnTest( "Can hide one column and it removes tfoot th column from DOM", null, function () { return $('#example tfoot tr:eq(0) th').length == 4; } ); oTest.fnTest( "The correct tbody column has been hidden", function () { oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { var jqNodes = $('#example tbody tr:eq(0) td'); var bReturn = jqNodes[0].innerHTML == "Gecko" && jqNodes[1].innerHTML == "Gnome" && jqNodes[2].innerHTML == "1.8" && jqNodes[3].innerHTML == "A"; return bReturn; } ); oTest.fnTest( "Can hide multiple columns and it removes td column from DOM", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "bVisible": false }, { "bVisible": false }, null, { "bVisible": false } ] } ); }, function () { return $('#example tbody tr:eq(0) td').length == 2; } ); oTest.fnTest( "Multiple hide - removes thead th column from DOM", null, function () { return $('#example thead tr:eq(0) th').length == 2; } ); oTest.fnTest( "Multiple hide - removes tfoot th column from DOM", null, function () { return $('#example tfoot tr:eq(0) th').length == 2; } ); oTest.fnTest( "Multiple hide - the correct tbody columns have been hidden", function () { oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { var jqNodes = $('#example tbody tr:eq(0) td'); var bReturn = jqNodes[0].innerHTML == "Gecko" && jqNodes[1].innerHTML == "1" return bReturn; } ); oTest.fnComplete(); } );
AlejandroPeq/TFG
production/js/datatables/unit_testing/tests_onhold/2_js/aoColumns.bVisible.js
JavaScript
mit
2,565
tinyMCE.addI18n('km.advlink_dlg',{"target_name":"\u1788\u17d2\u1798\u17c4\u17c7\u1782\u17c4\u179b\u178a\u17c5",classes:"\u1790\u17d2\u1793\u17b6\u1780\u17cb",style:"\u179a\u1785\u1793\u17b6\u1794\u17d0\u1791\u17d2\u1798",id:"\u179b\u179f.","popup_position":"\u1791\u17b8\u178f\u17b6\u17c6\u1784 (X/Y)",langdir:"\u1791\u17b7\u179f\u178a\u17c5\u1797\u17b6\u179f\u17b6","popup_size":"\u1791\u17c6\u17a0\u17c6","popup_dependent":"\u17a2\u17b6\u179f\u17d2\u179a\u17d0\u1799 (Mozilla/Firefox \u178f\u17c2\u1794\u17c9\u17bb\u178e\u17d2\u178e\u17c4\u17c7)","popup_resizable":"\u17b1\u17d2\u1799\u1794\u1784\u17d2\u17a2\u17bd\u1785\u17a2\u17b6\u1785\u1794\u17d2\u178f\u17bc\u179a\u1791\u17c6\u17a0\u17c6\u1794\u17b6\u1793","popup_location":"\u1794\u1784\u17d2\u17a0\u17b6\u1789\u179a\u1794\u17b6\u179a\u1791\u17b8\u178f\u17b6\u17c6\u1784","popup_menubar":"\u1794\u1784\u17d2\u17a0\u17b6\u1789\u179a\u1794\u17b6\u179a\u1798\u17c9\u17ba\u1793\u17bb\u1799","popup_toolbar":"\u1794\u1784\u17d2\u17a0\u17b6\u1789\u179a\u1794\u17b6\u179a\u17a7\u1794\u1780\u179a\u178e\u17cd","popup_statusbar":"\u1794\u1784\u17d2\u17a0\u17b6\u1789\u179a\u1794\u17b6\u179a\u179f\u17d2\u1790\u17b6\u1793\u1797\u17b6\u1796","popup_scrollbars":"\u1794\u1784\u17d2\u17a0\u17b6\u1789\u179a\u1794\u17b6\u179a\u179a\u1798\u17bc\u179a","popup_return":"\u1794\u1789\u17d2\u1785\u17bc\u179b\'return false\'","popup_name":"\u1788\u17d2\u1798\u17c4\u17c7\u1794\u1784\u17d2\u17a2\u17bc\u1785","popup_url":"\u17a2\u17b6\u179f\u178a\u17d2\u178b\u17b6\u1793\u1794\u1784\u17d2\u17a2\u17bd\u1785\u179b\u17c1\u1785\u17a1\u17be\u1784",popup:"\u1794\u1784\u17d2\u17a2\u17bd\u1785\u179b\u17c1\u1785\u17a1\u17be\u1784 Javascript","target_blank":"\u1794\u17be\u1780\u1780\u17d2\u1793\u17bb\u1784\u1794\u1784\u17d2\u17a2\u17bd\u1785\u1790\u17d2\u1798\u17b8","target_top":"\u1794\u17be\u1780\u1780\u17d2\u1793\u17bb\u1784\u179f\u17ca\u17bb\u1798\u179b\u17be (\u1787\u17c6\u1793\u17bd\u179f\u1782\u17d2\u179a\u1794\u17cb\u179f\u17ca\u17bb\u1798\u1791\u17b6\u17c6\u1784\u17a2\u179f\u17cb)","target_parent":"\u1794\u17be\u1780\u1780\u17d2\u1793\u17bb\u1784\u1794\u1784\u17d2\u17a2\u17bd\u1785/\u179f\u17ca\u17bb\u1798\u1798\u17c1","target_same":"\u1794\u17be\u1780\u1780\u17d2\u1793\u17bb\u1784\u1794\u1784\u17d2\u17a2\u17bd\u1785/\u179f\u17ca\u17bb\u1798\u1793\u17c1\u17c7","anchor_names":"\u1799\u17bb\u1790\u17d2\u1780\u17b6","popup_opts":"\u1787\u1798\u17d2\u179a\u17be\u179f\u179b\u17c1\u1785\u17a1\u17be\u1784","advanced_props":"\u179b\u1780\u17d2\u1781\u178e\u17c8\u179f\u1798\u17d2\u1794\u178f\u17d2\u178f\u17b7\u1780\u1798\u17d2\u179a\u17b7\u178f\u1781\u17d2\u1796\u179f\u17cb","event_props":"\u179b\u1780\u17d2\u1781\u178e\u17c8\u179f\u1798\u17d2\u1794\u178f\u17d2\u178f\u17b7\u1796\u17d2\u179a\u17b9\u178f\u17d2\u178f\u17b7\u1780\u17b6\u179a\u178e\u17cd","popup_props":"\u179b\u1780\u17d2\u1781\u178e\u17c8\u179f\u1798\u17d2\u1794\u178f\u17d2\u178f\u17b7\u179b\u17c1\u1785\u17a1\u17be\u1784","general_props":"\u179b\u1780\u17d2\u1781\u178e\u17c8\u179f\u1798\u17d2\u1794\u178f\u17d2\u178f\u17b7\u1791\u17bc\u1791\u17c5","advanced_tab":"\u1780\u1798\u17d2\u179a\u17b7\u178f\u1781\u17d2\u1796\u179f\u17cb","events_tab":"\u1796\u17d2\u179a\u17b9\u178f\u17d2\u178f\u17b7\u1780\u17b6\u179a\u178e\u17cd","popup_tab":"\u179b\u17c1\u1785\u17a1\u17be\u1784","general_tab":"\u1791\u17bc\u1791\u17c5",list:"\u1794\u1789\u17d2\u1787\u17b8\u178f\u17c6\u178e","is_external":"\u17a2\u17b6\u179f\u1799\u178a\u17d2\u178b\u17b6\u1793\u178a\u17c2\u179b\u17a2\u17d2\u1793\u1780\u1794\u17b6\u1793\u1794\u1789\u17d2\u1785\u17bc\u179b\u1791\u17c6\u1793\u1784\u1787\u17b6\u178f\u17c6\u178e\u1791\u17c5\u1780\u17d2\u179a\u17c5, \u178f\u17be\u17a2\u17d2\u1793\u1780\u1785\u1784\u17cb\u179f\u179a\u179f\u17c1\u179a http:// \u1793\u17c5\u178a\u17be\u1798\u17a2\u17b6\u179f\u1799\u178a\u17d2\u178b\u17b6\u1793\u1791\u17c1?","is_email":"\u17a2\u17b6\u179f\u1799\u178a\u17d2\u178b\u17b6\u1793\u178a\u17c2\u179b\u17a2\u17d2\u1793\u1780\u1794\u17b6\u1793\u1794\u1789\u17d2\u1785\u17bc\u179b\u1791\u17c6\u1793\u1784\u1787\u17b6\u17a2\u17b6\u179f\u1799\u178a\u17d2\u178b\u17b6\u1793\u17a2\u17ca\u17b8\u1798\u17c2\u179b, \u178f\u17be\u17a2\u17d2\u1793\u1780\u1785\u1784\u17cb\u179f\u179a\u179f\u17c1\u179a mailto: \u1793\u17c5\u178a\u17be\u1798\u17a2\u17b6\u179f\u1799\u178a\u17d2\u178b\u17b6\u1793\u1791\u17c1?",titlefield:"\u1785\u17c6\u178e\u1784\u1787\u17be\u1784",target:"\u1782\u17c4\u179b\u178a\u17c5",url:"\u17a2\u17b6\u179f\u1799\u178a\u17d2\u178b\u17b6\u1793\u178f\u17c6\u178e",title:"\u1794\u1789\u17d2\u1785\u17bc\u179b/\u1780\u17c2\u179f\u1798\u17d2\u179a\u17bd\u179b\u178f\u17c6\u178e","link_list":"\u1794\u1789\u17d2\u1787\u17b8\u178f\u17c6\u178e",rtl:"\u1796\u17b8\u179f\u17d2\u178f\u17b6\u17c6\u1791\u17c5\u1786\u17d2\u179c\u17c1\u1784",ltr:"\u1796\u17b8\u1786\u17d2\u179c\u17c1\u1784\u1791\u17c5\u179f\u17d2\u178f\u17b6\u17c6",accesskey:"\u1782\u17d2\u179a\u17b6\u1794\u17cb\u1785\u17bb\u1785\u1795\u17d2\u179b\u17bc\u179c\u1780\u17b6\u178f\u17cb",tabindex:"\u1795\u17d2\u1791\u17b6\u17c6\u1784\u179b\u17b7\u1794\u17b7\u1780\u17d2\u179a\u1798",rev:"\u1791\u17c6\u1793\u17b6\u1780\u17cb\u1791\u17c6\u1793\u1784\u1782\u17c4\u179b\u178a\u17c5\u1791\u17c5\u1793\u17b9\u1784\u1791\u17c6\u1796\u17d0\u179a",rel:"\u1791\u17c6\u1793\u17b6\u1780\u17cb\u1791\u17c6\u1793\u1784\u1791\u17c6\u1796\u17d0\u179a\u1791\u17c5\u1793\u17b9\u1784\u1782\u17c4\u179b\u178a\u17c5",mime:"\u1794\u17d2\u179a\u1797\u17c1\u1791 MIME \u1782\u17c4\u179b\u178a\u17c5",encoding:"\u1780\u17b6\u179a\u179c\u17c1\u1785\u1780\u17bc\u178a\u178f\u17bd\u17a2\u1780\u17d2\u179f\u179a\u179a\u1794\u179f\u17cb\u1782\u17c4\u179b\u178a\u17c5",langcode:"\u1780\u17bc\u178a\u1797\u17b6\u179f\u17b6","target_langcode":"\u1797\u17b6\u179f\u17b6\u1782\u17c4\u179b\u178a\u17c5",width:"\u1791\u1791\u17b9\u1784",height:"\u1780\u1798\u17d2\u1796\u179f\u17cb"});
sevab/cdnjs
ajax/libs/tinymce/3.5.8/plugins/advlink/langs/km_dlg.js
JavaScript
mit
5,840
define("ace/mode/java",["require","exports","module","pilot/oop","ace/mode/javascript","ace/tokenizer","ace/mode/java_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/javascript").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/java_highlight_rules").JavaHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/mode/behaviour/cstyle").CstyleBehaviour,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h,this.$behaviour=new i};d.inherits(j,e),function(){this.createWorker=function(a){return null}}.call(j.prototype),b.Mode=j}),define("ace/mode/javascript",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=a("ace/worker/worker_client").WorkerClient,k=a("ace/mode/behaviour/cstyle").CstyleBehaviour,l=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h,this.$behaviour=new k};d.inherits(l,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},this.createWorker=function(a){var b=a.getDocument(),c=new j(["ace","pilot"],"worker-javascript.js","ace/mode/javascript_worker","JavaScriptWorker");c.call("setValue",[b.getValue()]),b.on("change",function(a){a.range={start:a.data.range.start,end:a.data.range.end},c.emit("change",a)}),c.on("jslint",function(b){var c=[];for(var d=0;d<b.data.length;d++){var e=b.data[d];e&&c.push({row:e.line-1,column:e.character-1,text:e.reason,type:"warning",lint:e})}a.setAnnotations(c)}),c.on("narcissus",function(b){a.setAnnotations([b.data])}),c.on("terminate",function(){a.clearAnnotations()});return c}}.call(l.prototype),b.Mode=l}),define("ace/mode/javascript_highlight_rules",["require","exports","module","pilot/oop","pilot/lang","ace/unicode","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/unicode"),g=a("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules,h=a("ace/mode/text_highlight_rules").TextHighlightRules,i=function(){var a=e.arrayToMap("break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|const|yield|import|get|set".split("|")),b=e.arrayToMap("null|Infinity|NaN|undefined".split("|")),c=e.arrayToMap("class|enum|extends|super|export|implements|private|public|interface|package|protected|static".split("|")),d="["+f.packages.L+"\\$_]["+f.packages.L+f.packages.Mn+f.packages.Mc+f.packages.Nd+f.packages.Pc+"\\$_]*\\b";this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},(new g).getStartRule("doc-start"),{token:"comment",merge:!0,regex:"\\/\\*",next:"comment"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",merge:!0,regex:'["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",merge:!0,regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:function(d){return d=="this"?"variable.language":a.hasOwnProperty(d)?"keyword":b.hasOwnProperty(d)?"constant.language":c.hasOwnProperty(d)?"invalid.illegal":d=="debugger"?"invalid.deprecated":"identifier"},regex:d},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",next:"regex_allowed"},{token:"lparen",regex:"[[({]",next:"regex_allowed"},{token:"rparen",regex:"[\\])}]"},{token:"keyword.operator",regex:"\\/=?",next:"regex_allowed"},{token:"comment",regex:"^#!.*$"},{token:"text",regex:"\\s+"}],regex_allowed:[{token:"string.regexp",regex:"\\/(?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*",next:"start"},{token:"text",regex:"\\s+"},{token:"empty",regex:"",next:"start"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",merge:!0,regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",merge:!0,regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",merge:!0,regex:".+"}]},this.embedRules(g,"doc-",[(new g).getEndRule("start")])};d.inherits(i,h),b.JavaScriptHighlightRules=i}),define("ace/mode/doc_comment_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",merge:!0,regex:"\\s+"},{token:"comment.doc",merge:!0,regex:"TODO"},{token:"comment.doc",merge:!0,regex:"[^@\\*]+"},{token:"comment.doc",merge:!0,regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\/\\*(?=\\*)",next:a}},this.getEndRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\*\\/",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){var d=a("ace/range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){return/^\s+$/.test(a)?/^\s*\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""}}).call(e.prototype),b.MatchingBraceOutdent=e}),define("ace/worker/worker_client",["require","exports","module","pilot/oop","pilot/event_emitter"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/event_emitter").EventEmitter,f=function(b,c,d,e){this.callbacks=[];if(a.packaged)var f=this.$guessBasePath(),g=this.$worker=new Worker(f+c);else{var h=this.$normalizePath(a.nameToUrl("ace/worker/worker",null,"_")),g=this.$worker=new Worker(h),i={};for(var j=0;j<b.length;j++){var k=b[j],l=this.$normalizePath(a.nameToUrl(k,null,"_").replace(/.js$/,""));i[k]=l}}this.$worker.postMessage({init:!0,tlns:i,module:d,classname:e}),this.callbackId=1,this.callbacks={};var m=this;this.$worker.onerror=function(a){window.console&&console.log&&console.log(a);throw a},this.$worker.onmessage=function(a){var b=a.data;switch(b.type){case"log":window.console&&console.log&&console.log(b.data);break;case"event":m._dispatchEvent(b.name,{data:b.data});break;case"call":var c=m.callbacks[b.id];c&&(c(b.data),delete m.callbacks[b.id])}}};(function(){d.implement(this,e),this.$normalizePath=function(a){a.match(/^\w+:/)||(a=location.protocol+"//"+location.host+location.pathname+"/"+a);return a},this.$guessBasePath=function(){if(a.aceBaseUrl)return a.aceBaseUrl;var b=document.getElementsByTagName("script");for(var c=0;c<b.length;c++){var d=b[c],e=d.getAttribute("data-ace-base");if(e)return e.replace(/\/*$/,"/");var f=d.src||d.getAttribute("src");if(!f)continue;var g=f.match(/^(?:(.*\/)ace\.js|(.*\/)ace-uncompressed\.js)(?:\?|$)/);if(g)return g[1]||g[2]}return""},this.terminate=function(){this._dispatchEvent("terminate",{}),this.$worker.terminate()},this.send=function(a,b){this.$worker.postMessage({command:a,args:b})},this.call=function(a,b,c){if(c){var d=this.callbackId++;this.callbacks[d]=c,b.push(d)}this.send(a,b)},this.emit=function(a,b){this.$worker.postMessage({event:a,data:b})}}).call(f.prototype),b.WorkerClient=f}),define("ace/mode/behaviour/cstyle",["require","exports","module","pilot/oop","ace/mode/behaviour"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/behaviour").Behaviour,f=function(){this.add("braces","insertion",function(a,b,c,d,e){if(e=="{"){var f=c.getSelectionRange(),g=d.doc.getTextRange(f);return g!==""?{text:"{"+g+"}",selection:!1}:{text:"{}",selection:[1,1]}}if(e=="}"){var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column,h.column+1);if(j=="}"){var k=d.$findOpeningBracket("}",{column:h.column+1,row:h.row});if(k!==null)return{text:"",selection:[1,1]}}}else if(e=="\n"){var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column,h.column+1);if(j=="}"){var l=d.findMatchingBracket({row:h.row,column:h.column+1});if(!l)return!1;var m=this.getNextLineIndent(a,i.substring(0,i.length-1),d.getTabString()),n=this.$getIndent(d.doc.getLine(l.row));return{text:"\n"+m+"\n"+n,selection:[1,m.length,1,m.length]}}}return!1}),this.add("braces","deletion",function(a,b,c,d,e){var f=d.doc.getTextRange(e);if(!e.isMultiLine()&&f=="{"){var g=d.doc.getLine(e.start.row),h=g.substring(e.end.column,e.end.column+1);if(h=="}"){e.end.column++;return e}}return!1}),this.add("parens","insertion",function(a,b,c,d,e){if(e=="("){var f=c.getSelectionRange(),g=d.doc.getTextRange(f);return g!==""?{text:"("+g+")",selection:!1}:{text:"()",selection:[1,1]}}if(e==")"){var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column,h.column+1);if(j==")"){var k=d.$findOpeningBracket(")",{column:h.column+1,row:h.row});if(k!==null)return{text:"",selection:[1,1]}}}return!1}),this.add("parens","deletion",function(a,b,c,d,e){var f=d.doc.getTextRange(e);if(!e.isMultiLine()&&f=="("){var g=d.doc.getLine(e.start.row),h=g.substring(e.start.column+1,e.start.column+2);if(h==")"){e.end.column++;return e}}return!1}),this.add("string_dquotes","insertion",function(a,b,c,d,e){if(e=='"'){var f=c.getSelectionRange(),g=d.doc.getTextRange(f);if(g!=="")return{text:'"'+g+'"',selection:!1};var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column-1,h.column);if(j=="\\")return!1;var k=d.getTokens(f.start.row,f.start.row)[0].tokens,l=0,m,n=-1;for(var o=0;o<k.length;o++){m=k[o],m.type=="string"?n=-1:n<0&&(n=m.value.indexOf('"'));if(m.value.length+l>f.start.column)break;l+=k[o].value.length}if(!m||n<0&&m.type!=="comment"&&(m.type!=="string"||f.start.column!==m.value.length+l-1&&m.value.lastIndexOf('"')===m.value.length-1))return{text:'""',selection:[1,1]};if(m&&m.type==="string"){var p=i.substring(h.column,h.column+1);if(p=='"')return{text:"",selection:[1,1]}}}return!1}),this.add("string_dquotes","deletion",function(a,b,c,d,e){var f=d.doc.getTextRange(e);if(!e.isMultiLine()&&f=='"'){var g=d.doc.getLine(e.start.row),h=g.substring(e.start.column+1,e.start.column+2);if(h=='"'){e.end.column++;return e}}return!1})};d.inherits(f,e),b.CstyleBehaviour=f}),define("ace/mode/java_highlight_rules",["require","exports","module","pilot/oop","pilot/lang","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules,g=a("ace/mode/text_highlight_rules").TextHighlightRules,h=function(){var a=e.arrayToMap("abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while".split("|")),b=e.arrayToMap("null|Infinity|NaN|undefined".split("|")),c=e.arrayToMap("AbstractMethodError|AssertionError|ClassCircularityError|ClassFormatError|Deprecated|EnumConstantNotPresentException|ExceptionInInitializerError|IllegalAccessError|IllegalThreadStateException|InstantiationError|InternalError|NegativeArraySizeException|NoSuchFieldError|Override|Process|ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|SuppressWarnings|TypeNotPresentException|UnknownError|UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|InstantiationException|IndexOutOfBoundsException|ArrayIndexOutOfBoundsException|CloneNotSupportedException|NoSuchFieldException|IllegalArgumentException|NumberFormatException|SecurityException|Void|InheritableThreadLocal|IllegalStateException|InterruptedException|NoSuchMethodException|IllegalAccessException|UnsupportedOperationException|Enum|StrictMath|Package|Compiler|Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|Character|Boolean|StackTraceElement|Appendable|StringBuffer|Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|StackOverflowError|OutOfMemoryError|VirtualMachineError|ArrayStoreException|ClassCastException|LinkageError|NoClassDefFoundError|ClassNotFoundException|RuntimeException|Exception|ThreadDeath|Error|Throwable|System|ClassLoader|Cloneable|Class|CharSequence|Comparable|String|Object".split("|")),d=e.arrayToMap("".split("|"));this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},(new f).getStartRule("doc-start"),{token:"comment",merge:!0,regex:"\\/\\*",next:"comment"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:function(e){return e=="this"?"variable.language":a.hasOwnProperty(e)?"keyword":c.hasOwnProperty(e)?"support.function":d.hasOwnProperty(e)?"support.function":b.hasOwnProperty(e)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",merge:!0,regex:".+"}]},this.embedRules(f,"doc-",[(new f).getEndRule("start")])};d.inherits(h,g),b.JavaHighlightRules=h})
tristen/cdnjs
ajax/libs/ace/0.2.0/mode-java.js
JavaScript
mit
15,234
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "a. m.", "p. m." ], "DAY": [ "domingo", "lunes", "martes", "mi\u00e9rcoles", "jueves", "viernes", "s\u00e1bado" ], "MONTH": [ "enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre" ], "SHORTDAY": [ "dom.", "lun.", "mar.", "mi\u00e9.", "jue.", "vie.", "s\u00e1b." ], "SHORTMONTH": [ "ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sept.", "oct.", "nov.", "dic." ], "fullDate": "EEEE, d 'de' MMMM 'de' y", "longDate": "d 'de' MMMM 'de' y", "medium": "d/M/y H:mm:ss", "mediumDate": "d/M/y", "mediumTime": "H:mm:ss", "short": "d/M/yy H:mm", "shortDate": "d/M/yy", "shortTime": "H:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u20ac", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "es-ea", "pluralCat": function(n, opt_precision) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
JohnKim/cdnjs
ajax/libs/angular.js/1.3.1/i18n/angular-locale_es-ea.js
JavaScript
mit
1,952
;(function(){ // CommonJS require() function require(p){ var path = require.resolve(p) , mod = require.modules[path]; if (!mod) throw new Error('failed to require "' + p + '"'); if (!mod.exports) { mod.exports = {}; mod.call(mod.exports, mod, mod.exports, require.relative(path)); } return mod.exports; } require.modules = {}; require.resolve = function (path){ var orig = path , reg = path + '.js' , index = path + '/index.js'; return require.modules[reg] && reg || require.modules[index] && index || orig; }; require.register = function (path, fn){ require.modules[path] = fn; }; require.relative = function (parent) { return function(p){ if ('.' != p.charAt(0)) return require(p); var path = parent.split('/') , segs = p.split('/'); path.pop(); for (var i = 0; i < segs.length; i++) { var seg = segs[i]; if ('..' == seg) path.pop(); else if ('.' != seg) path.push(seg); } return require(path.join('/')); }; }; require.register("browser/debug.js", function(module, exports, require){ module.exports = function(type){ return function(){ } }; }); // module: browser/debug.js require.register("browser/diff.js", function(module, exports, require){ /* See LICENSE file for terms of use */ /* * Text diff implementation. * * This library supports the following APIS: * JsDiff.diffChars: Character by character diff * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace * JsDiff.diffLines: Line based diff * * JsDiff.diffCss: Diff targeted at CSS content * * These methods are based on the implementation proposed in * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986). * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927 */ var JsDiff = (function() { /*jshint maxparams: 5*/ function clonePath(path) { return { newPos: path.newPos, components: path.components.slice(0) }; } function removeEmpty(array) { var ret = []; for (var i = 0; i < array.length; i++) { if (array[i]) { ret.push(array[i]); } } return ret; } function escapeHTML(s) { var n = s; n = n.replace(/&/g, '&amp;'); n = n.replace(/</g, '&lt;'); n = n.replace(/>/g, '&gt;'); n = n.replace(/"/g, '&quot;'); return n; } var Diff = function(ignoreWhitespace) { this.ignoreWhitespace = ignoreWhitespace; }; Diff.prototype = { diff: function(oldString, newString) { // Handle the identity case (this is due to unrolling editLength == 0 if (newString === oldString) { return [{ value: newString }]; } if (!newString) { return [{ value: oldString, removed: true }]; } if (!oldString) { return [{ value: newString, added: true }]; } newString = this.tokenize(newString); oldString = this.tokenize(oldString); var newLen = newString.length, oldLen = oldString.length; var maxEditLength = newLen + oldLen; var bestPath = [{ newPos: -1, components: [] }]; // Seed editLength = 0 var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) { return bestPath[0].components; } for (var editLength = 1; editLength <= maxEditLength; editLength++) { for (var diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) { var basePath; var addPath = bestPath[diagonalPath-1], removePath = bestPath[diagonalPath+1]; oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; if (addPath) { // No one else is going to attempt to use this value, clear it bestPath[diagonalPath-1] = undefined; } var canAdd = addPath && addPath.newPos+1 < newLen; var canRemove = removePath && 0 <= oldPos && oldPos < oldLen; if (!canAdd && !canRemove) { bestPath[diagonalPath] = undefined; continue; } // Select the diagonal that we want to branch from. We select the prior // path whose position in the new string is the farthest from the origin // and does not pass the bounds of the diff graph if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) { basePath = clonePath(removePath); this.pushComponent(basePath.components, oldString[oldPos], undefined, true); } else { basePath = clonePath(addPath); basePath.newPos++; this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined); } var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath); if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) { return basePath.components; } else { bestPath[diagonalPath] = basePath; } } } }, pushComponent: function(components, value, added, removed) { var last = components[components.length-1]; if (last && last.added === added && last.removed === removed) { // We need to clone here as the component clone operation is just // as shallow array clone components[components.length-1] = {value: this.join(last.value, value), added: added, removed: removed }; } else { components.push({value: value, added: added, removed: removed }); } }, extractCommon: function(basePath, newString, oldString, diagonalPath) { var newLen = newString.length, oldLen = oldString.length, newPos = basePath.newPos, oldPos = newPos - diagonalPath; while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) { newPos++; oldPos++; this.pushComponent(basePath.components, newString[newPos], undefined, undefined); } basePath.newPos = newPos; return oldPos; }, equals: function(left, right) { var reWhitespace = /\S/; if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) { return true; } else { return left === right; } }, join: function(left, right) { return left + right; }, tokenize: function(value) { return value; } }; var CharDiff = new Diff(); var WordDiff = new Diff(true); var WordWithSpaceDiff = new Diff(); WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) { return removeEmpty(value.split(/(\s+|\b)/)); }; var CssDiff = new Diff(true); CssDiff.tokenize = function(value) { return removeEmpty(value.split(/([{}:;,]|\s+)/)); }; var LineDiff = new Diff(); LineDiff.tokenize = function(value) { var retLines = [], lines = value.split(/^/m); for(var i = 0; i < lines.length; i++) { var line = lines[i], lastLine = lines[i - 1]; // Merge lines that may contain windows new lines if (line == '\n' && lastLine && lastLine[lastLine.length - 1] === '\r') { retLines[retLines.length - 1] += '\n'; } else if (line) { retLines.push(line); } } return retLines; }; return { Diff: Diff, diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); }, diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); }, diffWordsWithSpace: function(oldStr, newStr) { return WordWithSpaceDiff.diff(oldStr, newStr); }, diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); }, diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); }, createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) { var ret = []; ret.push('Index: ' + fileName); ret.push('==================================================================='); ret.push('--- ' + fileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader)); ret.push('+++ ' + fileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader)); var diff = LineDiff.diff(oldStr, newStr); if (!diff[diff.length-1].value) { diff.pop(); // Remove trailing newline add } diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier function contextLines(lines) { return lines.map(function(entry) { return ' ' + entry; }); } function eofNL(curRange, i, current) { var last = diff[diff.length-2], isLast = i === diff.length-2, isLastOfType = i === diff.length-3 && (current.added !== last.added || current.removed !== last.removed); // Figure out if this is the last line for the given file and missing NL if (!/\n$/.test(current.value) && (isLast || isLastOfType)) { curRange.push('\\ No newline at end of file'); } } var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1; for (var i = 0; i < diff.length; i++) { var current = diff[i], lines = current.lines || current.value.replace(/\n$/, '').split('\n'); current.lines = lines; if (current.added || current.removed) { if (!oldRangeStart) { var prev = diff[i-1]; oldRangeStart = oldLine; newRangeStart = newLine; if (prev) { curRange = contextLines(prev.lines.slice(-4)); oldRangeStart -= curRange.length; newRangeStart -= curRange.length; } } curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?'+':'-') + entry; })); eofNL(curRange, i, current); if (current.added) { newLine += lines.length; } else { oldLine += lines.length; } } else { if (oldRangeStart) { // Close out any changes that have been output (or join overlapping) if (lines.length <= 8 && i < diff.length-2) { // Overlapping curRange.push.apply(curRange, contextLines(lines)); } else { // end the range and output var contextSize = Math.min(lines.length, 4); ret.push( '@@ -' + oldRangeStart + ',' + (oldLine-oldRangeStart+contextSize) + ' +' + newRangeStart + ',' + (newLine-newRangeStart+contextSize) + ' @@'); ret.push.apply(ret, curRange); ret.push.apply(ret, contextLines(lines.slice(0, contextSize))); if (lines.length <= 4) { eofNL(ret, i, current); } oldRangeStart = 0; newRangeStart = 0; curRange = []; } } oldLine += lines.length; newLine += lines.length; } } return ret.join('\n') + '\n'; }, applyPatch: function(oldStr, uniDiff) { var diffstr = uniDiff.split('\n'); var diff = []; var remEOFNL = false, addEOFNL = false; for (var i = (diffstr[0][0]==='I'?4:0); i < diffstr.length; i++) { if(diffstr[i][0] === '@') { var meh = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/); diff.unshift({ start:meh[3], oldlength:meh[2], oldlines:[], newlength:meh[4], newlines:[] }); } else if(diffstr[i][0] === '+') { diff[0].newlines.push(diffstr[i].substr(1)); } else if(diffstr[i][0] === '-') { diff[0].oldlines.push(diffstr[i].substr(1)); } else if(diffstr[i][0] === ' ') { diff[0].newlines.push(diffstr[i].substr(1)); diff[0].oldlines.push(diffstr[i].substr(1)); } else if(diffstr[i][0] === '\\') { if (diffstr[i-1][0] === '+') { remEOFNL = true; } else if(diffstr[i-1][0] === '-') { addEOFNL = true; } } } var str = oldStr.split('\n'); for (var i = diff.length - 1; i >= 0; i--) { var d = diff[i]; for (var j = 0; j < d.oldlength; j++) { if(str[d.start-1+j] !== d.oldlines[j]) { return false; } } Array.prototype.splice.apply(str,[d.start-1,+d.oldlength].concat(d.newlines)); } if (remEOFNL) { while (!str[str.length-1]) { str.pop(); } } else if (addEOFNL) { str.push(''); } return str.join('\n'); }, convertChangesToXML: function(changes){ var ret = []; for ( var i = 0; i < changes.length; i++) { var change = changes[i]; if (change.added) { ret.push('<ins>'); } else if (change.removed) { ret.push('<del>'); } ret.push(escapeHTML(change.value)); if (change.added) { ret.push('</ins>'); } else if (change.removed) { ret.push('</del>'); } } return ret.join(''); }, // See: http://code.google.com/p/google-diff-match-patch/wiki/API convertChangesToDMP: function(changes){ var ret = [], change; for ( var i = 0; i < changes.length; i++) { change = changes[i]; ret.push([(change.added ? 1 : change.removed ? -1 : 0), change.value]); } return ret; } }; })(); if (typeof module !== 'undefined') { module.exports = JsDiff; } }); // module: browser/diff.js require.register("browser/escape-string-regexp.js", function(module, exports, require){ 'use strict'; var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; module.exports = function (str) { if (typeof str !== 'string') { throw new TypeError('Expected a string'); } return str.replace(matchOperatorsRe, '\\$&'); }; }); // module: browser/escape-string-regexp.js require.register("browser/events.js", function(module, exports, require){ /** * Module exports. */ exports.EventEmitter = EventEmitter; /** * Check if `obj` is an array. */ function isArray(obj) { return '[object Array]' == {}.toString.call(obj); } /** * Event emitter constructor. * * @api public */ function EventEmitter(){}; /** * Adds a listener. * * @api public */ EventEmitter.prototype.on = function (name, fn) { if (!this.$events) { this.$events = {}; } if (!this.$events[name]) { this.$events[name] = fn; } else if (isArray(this.$events[name])) { this.$events[name].push(fn); } else { this.$events[name] = [this.$events[name], fn]; } return this; }; EventEmitter.prototype.addListener = EventEmitter.prototype.on; /** * Adds a volatile listener. * * @api public */ EventEmitter.prototype.once = function (name, fn) { var self = this; function on () { self.removeListener(name, on); fn.apply(this, arguments); }; on.listener = fn; this.on(name, on); return this; }; /** * Removes a listener. * * @api public */ EventEmitter.prototype.removeListener = function (name, fn) { if (this.$events && this.$events[name]) { var list = this.$events[name]; if (isArray(list)) { var pos = -1; for (var i = 0, l = list.length; i < l; i++) { if (list[i] === fn || (list[i].listener && list[i].listener === fn)) { pos = i; break; } } if (pos < 0) { return this; } list.splice(pos, 1); if (!list.length) { delete this.$events[name]; } } else if (list === fn || (list.listener && list.listener === fn)) { delete this.$events[name]; } } return this; }; /** * Removes all listeners for an event. * * @api public */ EventEmitter.prototype.removeAllListeners = function (name) { if (name === undefined) { this.$events = {}; return this; } if (this.$events && this.$events[name]) { this.$events[name] = null; } return this; }; /** * Gets all listeners for a certain event. * * @api public */ EventEmitter.prototype.listeners = function (name) { if (!this.$events) { this.$events = {}; } if (!this.$events[name]) { this.$events[name] = []; } if (!isArray(this.$events[name])) { this.$events[name] = [this.$events[name]]; } return this.$events[name]; }; /** * Emits an event. * * @api public */ EventEmitter.prototype.emit = function (name) { if (!this.$events) { return false; } var handler = this.$events[name]; if (!handler) { return false; } var args = [].slice.call(arguments, 1); if ('function' == typeof handler) { handler.apply(this, args); } else if (isArray(handler)) { var listeners = handler.slice(); for (var i = 0, l = listeners.length; i < l; i++) { listeners[i].apply(this, args); } } else { return false; } return true; }; }); // module: browser/events.js require.register("browser/fs.js", function(module, exports, require){ }); // module: browser/fs.js require.register("browser/glob.js", function(module, exports, require){ }); // module: browser/glob.js require.register("browser/path.js", function(module, exports, require){ }); // module: browser/path.js require.register("browser/progress.js", function(module, exports, require){ /** * Expose `Progress`. */ module.exports = Progress; /** * Initialize a new `Progress` indicator. */ function Progress() { this.percent = 0; this.size(0); this.fontSize(11); this.font('helvetica, arial, sans-serif'); } /** * Set progress size to `n`. * * @param {Number} n * @return {Progress} for chaining * @api public */ Progress.prototype.size = function(n){ this._size = n; return this; }; /** * Set text to `str`. * * @param {String} str * @return {Progress} for chaining * @api public */ Progress.prototype.text = function(str){ this._text = str; return this; }; /** * Set font size to `n`. * * @param {Number} n * @return {Progress} for chaining * @api public */ Progress.prototype.fontSize = function(n){ this._fontSize = n; return this; }; /** * Set font `family`. * * @param {String} family * @return {Progress} for chaining */ Progress.prototype.font = function(family){ this._font = family; return this; }; /** * Update percentage to `n`. * * @param {Number} n * @return {Progress} for chaining */ Progress.prototype.update = function(n){ this.percent = n; return this; }; /** * Draw on `ctx`. * * @param {CanvasRenderingContext2d} ctx * @return {Progress} for chaining */ Progress.prototype.draw = function(ctx){ try { var percent = Math.min(this.percent, 100) , size = this._size , half = size / 2 , x = half , y = half , rad = half - 1 , fontSize = this._fontSize; ctx.font = fontSize + 'px ' + this._font; var angle = Math.PI * 2 * (percent / 100); ctx.clearRect(0, 0, size, size); // outer circle ctx.strokeStyle = '#9f9f9f'; ctx.beginPath(); ctx.arc(x, y, rad, 0, angle, false); ctx.stroke(); // inner circle ctx.strokeStyle = '#eee'; ctx.beginPath(); ctx.arc(x, y, rad - 1, 0, angle, true); ctx.stroke(); // text var text = this._text || (percent | 0) + '%' , w = ctx.measureText(text).width; ctx.fillText( text , x - w / 2 + 1 , y + fontSize / 2 - 1); } catch (ex) {} //don't fail if we can't render progress return this; }; }); // module: browser/progress.js require.register("browser/tty.js", function(module, exports, require){ exports.isatty = function(){ return true; }; exports.getWindowSize = function(){ if ('innerHeight' in global) { return [global.innerHeight, global.innerWidth]; } else { // In a Web Worker, the DOM Window is not available. return [640, 480]; } }; }); // module: browser/tty.js require.register("context.js", function(module, exports, require){ /** * Expose `Context`. */ module.exports = Context; /** * Initialize a new `Context`. * * @api private */ function Context(){} /** * Set or get the context `Runnable` to `runnable`. * * @param {Runnable} runnable * @return {Context} * @api private */ Context.prototype.runnable = function(runnable){ if (0 == arguments.length) return this._runnable; this.test = this._runnable = runnable; return this; }; /** * Set test timeout `ms`. * * @param {Number} ms * @return {Context} self * @api private */ Context.prototype.timeout = function(ms){ if (arguments.length === 0) return this.runnable().timeout(); this.runnable().timeout(ms); return this; }; /** * Set test timeout `enabled`. * * @param {Boolean} enabled * @return {Context} self * @api private */ Context.prototype.enableTimeouts = function (enabled) { this.runnable().enableTimeouts(enabled); return this; }; /** * Set test slowness threshold `ms`. * * @param {Number} ms * @return {Context} self * @api private */ Context.prototype.slow = function(ms){ this.runnable().slow(ms); return this; }; /** * Inspect the context void of `._runnable`. * * @return {String} * @api private */ Context.prototype.inspect = function(){ return JSON.stringify(this, function(key, val){ if ('_runnable' == key) return; if ('test' == key) return; return val; }, 2); }; }); // module: context.js require.register("hook.js", function(module, exports, require){ /** * Module dependencies. */ var Runnable = require('./runnable'); /** * Expose `Hook`. */ module.exports = Hook; /** * Initialize a new `Hook` with the given `title` and callback `fn`. * * @param {String} title * @param {Function} fn * @api private */ function Hook(title, fn) { Runnable.call(this, title, fn); this.type = 'hook'; } /** * Inherit from `Runnable.prototype`. */ function F(){}; F.prototype = Runnable.prototype; Hook.prototype = new F; Hook.prototype.constructor = Hook; /** * Get or set the test `err`. * * @param {Error} err * @return {Error} * @api public */ Hook.prototype.error = function(err){ if (0 == arguments.length) { var err = this._error; this._error = null; return err; } this._error = err; }; }); // module: hook.js require.register("interfaces/bdd.js", function(module, exports, require){ /** * Module dependencies. */ var Suite = require('../suite') , Test = require('../test') , utils = require('../utils') , escapeRe = require('browser/escape-string-regexp'); /** * BDD-style interface: * * describe('Array', function(){ * describe('#indexOf()', function(){ * it('should return -1 when not present', function(){ * * }); * * it('should return the index when present', function(){ * * }); * }); * }); * */ module.exports = function(suite){ var suites = [suite]; suite.on('pre-require', function(context, file, mocha){ /** * Execute before running tests. */ context.before = function(name, fn){ suites[0].beforeAll(name, fn); }; /** * Execute after running tests. */ context.after = function(name, fn){ suites[0].afterAll(name, fn); }; /** * Execute before each test case. */ context.beforeEach = function(name, fn){ suites[0].beforeEach(name, fn); }; /** * Execute after each test case. */ context.afterEach = function(name, fn){ suites[0].afterEach(name, fn); }; /** * Describe a "suite" with the given `title` * and callback `fn` containing nested suites * and/or tests. */ context.describe = context.context = function(title, fn){ var suite = Suite.create(suites[0], title); suite.file = file; suites.unshift(suite); fn.call(suite); suites.shift(); return suite; }; /** * Pending describe. */ context.xdescribe = context.xcontext = context.describe.skip = function(title, fn){ var suite = Suite.create(suites[0], title); suite.pending = true; suites.unshift(suite); fn.call(suite); suites.shift(); }; /** * Exclusive suite. */ context.describe.only = function(title, fn){ var suite = context.describe(title, fn); mocha.grep(suite.fullTitle()); return suite; }; /** * Describe a specification or test-case * with the given `title` and callback `fn` * acting as a thunk. */ context.it = context.specify = function(title, fn){ var suite = suites[0]; if (suite.pending) fn = null; var test = new Test(title, fn); test.file = file; suite.addTest(test); return test; }; /** * Exclusive test-case. */ context.it.only = function(title, fn){ var test = context.it(title, fn); var reString = '^' + escapeRe(test.fullTitle()) + '$'; mocha.grep(new RegExp(reString)); return test; }; /** * Pending test case. */ context.xit = context.xspecify = context.it.skip = function(title){ context.it(title); }; }); }; }); // module: interfaces/bdd.js require.register("interfaces/exports.js", function(module, exports, require){ /** * Module dependencies. */ var Suite = require('../suite') , Test = require('../test'); /** * TDD-style interface: * * exports.Array = { * '#indexOf()': { * 'should return -1 when the value is not present': function(){ * * }, * * 'should return the correct index when the value is present': function(){ * * } * } * }; * */ module.exports = function(suite){ var suites = [suite]; suite.on('require', visit); function visit(obj, file) { var suite; for (var key in obj) { if ('function' == typeof obj[key]) { var fn = obj[key]; switch (key) { case 'before': suites[0].beforeAll(fn); break; case 'after': suites[0].afterAll(fn); break; case 'beforeEach': suites[0].beforeEach(fn); break; case 'afterEach': suites[0].afterEach(fn); break; default: var test = new Test(key, fn); test.file = file; suites[0].addTest(test); } } else { suite = Suite.create(suites[0], key); suites.unshift(suite); visit(obj[key]); suites.shift(); } } } }; }); // module: interfaces/exports.js require.register("interfaces/index.js", function(module, exports, require){ exports.bdd = require('./bdd'); exports.tdd = require('./tdd'); exports.qunit = require('./qunit'); exports.exports = require('./exports'); }); // module: interfaces/index.js require.register("interfaces/qunit.js", function(module, exports, require){ /** * Module dependencies. */ var Suite = require('../suite') , Test = require('../test') , escapeRe = require('browser/escape-string-regexp') , utils = require('../utils'); /** * QUnit-style interface: * * suite('Array'); * * test('#length', function(){ * var arr = [1,2,3]; * ok(arr.length == 3); * }); * * test('#indexOf()', function(){ * var arr = [1,2,3]; * ok(arr.indexOf(1) == 0); * ok(arr.indexOf(2) == 1); * ok(arr.indexOf(3) == 2); * }); * * suite('String'); * * test('#length', function(){ * ok('foo'.length == 3); * }); * */ module.exports = function(suite){ var suites = [suite]; suite.on('pre-require', function(context, file, mocha){ /** * Execute before running tests. */ context.before = function(name, fn){ suites[0].beforeAll(name, fn); }; /** * Execute after running tests. */ context.after = function(name, fn){ suites[0].afterAll(name, fn); }; /** * Execute before each test case. */ context.beforeEach = function(name, fn){ suites[0].beforeEach(name, fn); }; /** * Execute after each test case. */ context.afterEach = function(name, fn){ suites[0].afterEach(name, fn); }; /** * Describe a "suite" with the given `title`. */ context.suite = function(title){ if (suites.length > 1) suites.shift(); var suite = Suite.create(suites[0], title); suite.file = file; suites.unshift(suite); return suite; }; /** * Exclusive test-case. */ context.suite.only = function(title, fn){ var suite = context.suite(title, fn); mocha.grep(suite.fullTitle()); }; /** * Describe a specification or test-case * with the given `title` and callback `fn` * acting as a thunk. */ context.test = function(title, fn){ var test = new Test(title, fn); test.file = file; suites[0].addTest(test); return test; }; /** * Exclusive test-case. */ context.test.only = function(title, fn){ var test = context.test(title, fn); var reString = '^' + escapeRe(test.fullTitle()) + '$'; mocha.grep(new RegExp(reString)); }; /** * Pending test case. */ context.test.skip = function(title){ context.test(title); }; }); }; }); // module: interfaces/qunit.js require.register("interfaces/tdd.js", function(module, exports, require){ /** * Module dependencies. */ var Suite = require('../suite') , Test = require('../test') , escapeRe = require('browser/escape-string-regexp') , utils = require('../utils'); /** * TDD-style interface: * * suite('Array', function(){ * suite('#indexOf()', function(){ * suiteSetup(function(){ * * }); * * test('should return -1 when not present', function(){ * * }); * * test('should return the index when present', function(){ * * }); * * suiteTeardown(function(){ * * }); * }); * }); * */ module.exports = function(suite){ var suites = [suite]; suite.on('pre-require', function(context, file, mocha){ /** * Execute before each test case. */ context.setup = function(name, fn){ suites[0].beforeEach(name, fn); }; /** * Execute after each test case. */ context.teardown = function(name, fn){ suites[0].afterEach(name, fn); }; /** * Execute before the suite. */ context.suiteSetup = function(name, fn){ suites[0].beforeAll(name, fn); }; /** * Execute after the suite. */ context.suiteTeardown = function(name, fn){ suites[0].afterAll(name, fn); }; /** * Describe a "suite" with the given `title` * and callback `fn` containing nested suites * and/or tests. */ context.suite = function(title, fn){ var suite = Suite.create(suites[0], title); suite.file = file; suites.unshift(suite); fn.call(suite); suites.shift(); return suite; }; /** * Pending suite. */ context.suite.skip = function(title, fn) { var suite = Suite.create(suites[0], title); suite.pending = true; suites.unshift(suite); fn.call(suite); suites.shift(); }; /** * Exclusive test-case. */ context.suite.only = function(title, fn){ var suite = context.suite(title, fn); mocha.grep(suite.fullTitle()); }; /** * Describe a specification or test-case * with the given `title` and callback `fn` * acting as a thunk. */ context.test = function(title, fn){ var suite = suites[0]; if (suite.pending) fn = null; var test = new Test(title, fn); test.file = file; suite.addTest(test); return test; }; /** * Exclusive test-case. */ context.test.only = function(title, fn){ var test = context.test(title, fn); var reString = '^' + escapeRe(test.fullTitle()) + '$'; mocha.grep(new RegExp(reString)); }; /** * Pending test case. */ context.test.skip = function(title){ context.test(title); }; }); }; }); // module: interfaces/tdd.js require.register("mocha.js", function(module, exports, require){ /*! * mocha * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca> * MIT Licensed */ /** * Module dependencies. */ var path = require('browser/path') , escapeRe = require('browser/escape-string-regexp') , utils = require('./utils'); /** * Expose `Mocha`. */ exports = module.exports = Mocha; /** * To require local UIs and reporters when running in node. */ if (typeof process !== 'undefined' && typeof process.cwd === 'function') { var join = path.join , cwd = process.cwd(); module.paths.push(cwd, join(cwd, 'node_modules')); } /** * Expose internals. */ exports.utils = utils; exports.interfaces = require('./interfaces'); exports.reporters = require('./reporters'); exports.Runnable = require('./runnable'); exports.Context = require('./context'); exports.Runner = require('./runner'); exports.Suite = require('./suite'); exports.Hook = require('./hook'); exports.Test = require('./test'); /** * Return image `name` path. * * @param {String} name * @return {String} * @api private */ function image(name) { return __dirname + '/../images/' + name + '.png'; } /** * Setup mocha with `options`. * * Options: * * - `ui` name "bdd", "tdd", "exports" etc * - `reporter` reporter instance, defaults to `mocha.reporters.spec` * - `globals` array of accepted globals * - `timeout` timeout in milliseconds * - `bail` bail on the first test failure * - `slow` milliseconds to wait before considering a test slow * - `ignoreLeaks` ignore global leaks * - `grep` string or regexp to filter tests with * * @param {Object} options * @api public */ function Mocha(options) { options = options || {}; this.files = []; this.options = options; this.grep(options.grep); this.suite = new exports.Suite('', new exports.Context); this.ui(options.ui); this.bail(options.bail); this.reporter(options.reporter); if (null != options.timeout) this.timeout(options.timeout); this.useColors(options.useColors) if (options.enableTimeouts !== null) this.enableTimeouts(options.enableTimeouts); if (options.slow) this.slow(options.slow); this.suite.on('pre-require', function (context) { exports.afterEach = context.afterEach || context.teardown; exports.after = context.after || context.suiteTeardown; exports.beforeEach = context.beforeEach || context.setup; exports.before = context.before || context.suiteSetup; exports.describe = context.describe || context.suite; exports.it = context.it || context.test; exports.setup = context.setup || context.beforeEach; exports.suiteSetup = context.suiteSetup || context.before; exports.suiteTeardown = context.suiteTeardown || context.after; exports.suite = context.suite || context.describe; exports.teardown = context.teardown || context.afterEach; exports.test = context.test || context.it; }); } /** * Enable or disable bailing on the first failure. * * @param {Boolean} [bail] * @api public */ Mocha.prototype.bail = function(bail){ if (0 == arguments.length) bail = true; this.suite.bail(bail); return this; }; /** * Add test `file`. * * @param {String} file * @api public */ Mocha.prototype.addFile = function(file){ this.files.push(file); return this; }; /** * Set reporter to `reporter`, defaults to "spec". * * @param {String|Function} reporter name or constructor * @api public */ Mocha.prototype.reporter = function(reporter){ if ('function' == typeof reporter) { this._reporter = reporter; } else { reporter = reporter || 'spec'; var _reporter; try { _reporter = require('./reporters/' + reporter); } catch (err) {}; if (!_reporter) try { _reporter = require(reporter); } catch (err) {}; if (!_reporter && reporter === 'teamcity') console.warn('The Teamcity reporter was moved to a package named ' + 'mocha-teamcity-reporter ' + '(https://npmjs.org/package/mocha-teamcity-reporter).'); if (!_reporter) throw new Error('invalid reporter "' + reporter + '"'); this._reporter = _reporter; } return this; }; /** * Set test UI `name`, defaults to "bdd". * * @param {String} bdd * @api public */ Mocha.prototype.ui = function(name){ name = name || 'bdd'; this._ui = exports.interfaces[name]; if (!this._ui) try { this._ui = require(name); } catch (err) {}; if (!this._ui) throw new Error('invalid interface "' + name + '"'); this._ui = this._ui(this.suite); return this; }; /** * Load registered files. * * @api private */ Mocha.prototype.loadFiles = function(fn){ var self = this; var suite = this.suite; var pending = this.files.length; this.files.forEach(function(file){ file = path.resolve(file); suite.emit('pre-require', global, file, self); suite.emit('require', require(file), file, self); suite.emit('post-require', global, file, self); --pending || (fn && fn()); }); }; /** * Enable growl support. * * @api private */ Mocha.prototype._growl = function(runner, reporter) { var notify = require('growl'); runner.on('end', function(){ var stats = reporter.stats; if (stats.failures) { var msg = stats.failures + ' of ' + runner.total + ' tests failed'; notify(msg, { name: 'mocha', title: 'Failed', image: image('error') }); } else { notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', { name: 'mocha' , title: 'Passed' , image: image('ok') }); } }); }; /** * Add regexp to grep, if `re` is a string it is escaped. * * @param {RegExp|String} re * @return {Mocha} * @api public */ Mocha.prototype.grep = function(re){ this.options.grep = 'string' == typeof re ? new RegExp(escapeRe(re)) : re; return this; }; /** * Invert `.grep()` matches. * * @return {Mocha} * @api public */ Mocha.prototype.invert = function(){ this.options.invert = true; return this; }; /** * Ignore global leaks. * * @param {Boolean} ignore * @return {Mocha} * @api public */ Mocha.prototype.ignoreLeaks = function(ignore){ this.options.ignoreLeaks = !!ignore; return this; }; /** * Enable global leak checking. * * @return {Mocha} * @api public */ Mocha.prototype.checkLeaks = function(){ this.options.ignoreLeaks = false; return this; }; /** * Enable growl support. * * @return {Mocha} * @api public */ Mocha.prototype.growl = function(){ this.options.growl = true; return this; }; /** * Ignore `globals` array or string. * * @param {Array|String} globals * @return {Mocha} * @api public */ Mocha.prototype.globals = function(globals){ this.options.globals = (this.options.globals || []).concat(globals); return this; }; /** * Emit color output. * * @param {Boolean} colors * @return {Mocha} * @api public */ Mocha.prototype.useColors = function(colors){ this.options.useColors = arguments.length && colors != undefined ? colors : true; return this; }; /** * Use inline diffs rather than +/-. * * @param {Boolean} inlineDiffs * @return {Mocha} * @api public */ Mocha.prototype.useInlineDiffs = function(inlineDiffs) { this.options.useInlineDiffs = arguments.length && inlineDiffs != undefined ? inlineDiffs : false; return this; }; /** * Set the timeout in milliseconds. * * @param {Number} timeout * @return {Mocha} * @api public */ Mocha.prototype.timeout = function(timeout){ this.suite.timeout(timeout); return this; }; /** * Set slowness threshold in milliseconds. * * @param {Number} slow * @return {Mocha} * @api public */ Mocha.prototype.slow = function(slow){ this.suite.slow(slow); return this; }; /** * Enable timeouts. * * @param {Boolean} enabled * @return {Mocha} * @api public */ Mocha.prototype.enableTimeouts = function(enabled) { this.suite.enableTimeouts(arguments.length && enabled !== undefined ? enabled : true); return this }; /** * Makes all tests async (accepting a callback) * * @return {Mocha} * @api public */ Mocha.prototype.asyncOnly = function(){ this.options.asyncOnly = true; return this; }; /** * Disable syntax highlighting (in browser). * @returns {Mocha} * @api public */ Mocha.prototype.noHighlighting = function() { this.options.noHighlighting = true; return this; }; /** * Run tests and invoke `fn()` when complete. * * @param {Function} fn * @return {Runner} * @api public */ Mocha.prototype.run = function(fn){ if (this.files.length) this.loadFiles(); var suite = this.suite; var options = this.options; options.files = this.files; var runner = new exports.Runner(suite); var reporter = new this._reporter(runner, options); runner.ignoreLeaks = false !== options.ignoreLeaks; runner.asyncOnly = options.asyncOnly; if (options.grep) runner.grep(options.grep, options.invert); if (options.globals) runner.globals(options.globals); if (options.growl) this._growl(runner, reporter); exports.reporters.Base.useColors = options.useColors; exports.reporters.Base.inlineDiffs = options.useInlineDiffs; return runner.run(fn); }; }); // module: mocha.js require.register("ms.js", function(module, exports, require){ /** * Helpers. */ var s = 1000; var m = s * 60; var h = m * 60; var d = h * 24; var y = d * 365.25; /** * Parse or format the given `val`. * * Options: * * - `long` verbose formatting [false] * * @param {String|Number} val * @param {Object} options * @return {String|Number} * @api public */ module.exports = function(val, options){ options = options || {}; if ('string' == typeof val) return parse(val); return options['long'] ? longFormat(val) : shortFormat(val); }; /** * Parse the given `str` and return milliseconds. * * @param {String} str * @return {Number} * @api private */ function parse(str) { var match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str); if (!match) return; var n = parseFloat(match[1]); var type = (match[2] || 'ms').toLowerCase(); switch (type) { case 'years': case 'year': case 'y': return n * y; case 'days': case 'day': case 'd': return n * d; case 'hours': case 'hour': case 'h': return n * h; case 'minutes': case 'minute': case 'm': return n * m; case 'seconds': case 'second': case 's': return n * s; case 'ms': return n; } } /** * Short format for `ms`. * * @param {Number} ms * @return {String} * @api private */ function shortFormat(ms) { if (ms >= d) return Math.round(ms / d) + 'd'; if (ms >= h) return Math.round(ms / h) + 'h'; if (ms >= m) return Math.round(ms / m) + 'm'; if (ms >= s) return Math.round(ms / s) + 's'; return ms + 'ms'; } /** * Long format for `ms`. * * @param {Number} ms * @return {String} * @api private */ function longFormat(ms) { return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; } /** * Pluralization helper. */ function plural(ms, n, name) { if (ms < n) return; if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; return Math.ceil(ms / n) + ' ' + name + 's'; } }); // module: ms.js require.register("reporters/base.js", function(module, exports, require){ /** * Module dependencies. */ var tty = require('browser/tty') , diff = require('browser/diff') , ms = require('../ms') , utils = require('../utils'); /** * Save timer references to avoid Sinon interfering (see GH-237). */ var Date = global.Date , setTimeout = global.setTimeout , setInterval = global.setInterval , clearTimeout = global.clearTimeout , clearInterval = global.clearInterval; /** * Check if both stdio streams are associated with a tty. */ var isatty = tty.isatty(1) && tty.isatty(2); /** * Expose `Base`. */ exports = module.exports = Base; /** * Enable coloring by default. */ exports.useColors = isatty || (process.env.MOCHA_COLORS !== undefined); /** * Inline diffs instead of +/- */ exports.inlineDiffs = false; /** * Default color map. */ exports.colors = { 'pass': 90 , 'fail': 31 , 'bright pass': 92 , 'bright fail': 91 , 'bright yellow': 93 , 'pending': 36 , 'suite': 0 , 'error title': 0 , 'error message': 31 , 'error stack': 90 , 'checkmark': 32 , 'fast': 90 , 'medium': 33 , 'slow': 31 , 'green': 32 , 'light': 90 , 'diff gutter': 90 , 'diff added': 42 , 'diff removed': 41 }; /** * Default symbol map. */ exports.symbols = { ok: '✓', err: '✖', dot: '․' }; // With node.js on Windows: use symbols available in terminal default fonts if ('win32' == process.platform) { exports.symbols.ok = '\u221A'; exports.symbols.err = '\u00D7'; exports.symbols.dot = '.'; } /** * Color `str` with the given `type`, * allowing colors to be disabled, * as well as user-defined color * schemes. * * @param {String} type * @param {String} str * @return {String} * @api private */ var color = exports.color = function(type, str) { if (!exports.useColors) return str; return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m'; }; /** * Expose term window size, with some * defaults for when stderr is not a tty. */ exports.window = { width: isatty ? process.stdout.getWindowSize ? process.stdout.getWindowSize(1)[0] : tty.getWindowSize()[1] : 75 }; /** * Expose some basic cursor interactions * that are common among reporters. */ exports.cursor = { hide: function(){ isatty && process.stdout.write('\u001b[?25l'); }, show: function(){ isatty && process.stdout.write('\u001b[?25h'); }, deleteLine: function(){ isatty && process.stdout.write('\u001b[2K'); }, beginningOfLine: function(){ isatty && process.stdout.write('\u001b[0G'); }, CR: function(){ if (isatty) { exports.cursor.deleteLine(); exports.cursor.beginningOfLine(); } else { process.stdout.write('\r'); } } }; /** * Outut the given `failures` as a list. * * @param {Array} failures * @api public */ exports.list = function(failures){ console.error(); failures.forEach(function(test, i){ // format var fmt = color('error title', ' %s) %s:\n') + color('error message', ' %s') + color('error stack', '\n%s\n'); // msg var err = test.err , message = err.message || '' , stack = err.stack || message , index = stack.indexOf(message) + message.length , msg = stack.slice(0, index) , actual = err.actual , expected = err.expected , escape = true; // uncaught if (err.uncaught) { msg = 'Uncaught ' + msg; } // explicitly show diff if (err.showDiff && sameType(actual, expected)) { escape = false; err.actual = actual = utils.stringify(actual); err.expected = expected = utils.stringify(expected); } // actual / expected diff if (err.showDiff && 'string' == typeof actual && 'string' == typeof expected) { fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n'); var match = message.match(/^([^:]+): expected/); msg = '\n ' + color('error message', match ? match[1] : msg); if (exports.inlineDiffs) { msg += inlineDiff(err, escape); } else { msg += unifiedDiff(err, escape); } } // indent stack trace without msg stack = stack.slice(index ? index + 1 : index) .replace(/^/gm, ' '); console.error(fmt, (i + 1), test.fullTitle(), msg, stack); }); }; /** * Initialize a new `Base` reporter. * * All other reporters generally * inherit from this reporter, providing * stats such as test duration, number * of tests passed / failed etc. * * @param {Runner} runner * @api public */ function Base(runner) { var self = this , stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 } , failures = this.failures = []; if (!runner) return; this.runner = runner; runner.stats = stats; runner.on('start', function(){ stats.start = new Date; }); runner.on('suite', function(suite){ stats.suites = stats.suites || 0; suite.root || stats.suites++; }); runner.on('test end', function(test){ stats.tests = stats.tests || 0; stats.tests++; }); runner.on('pass', function(test){ stats.passes = stats.passes || 0; var medium = test.slow() / 2; test.speed = test.duration > test.slow() ? 'slow' : test.duration > medium ? 'medium' : 'fast'; stats.passes++; }); runner.on('fail', function(test, err){ stats.failures = stats.failures || 0; stats.failures++; test.err = err; failures.push(test); }); runner.on('end', function(){ stats.end = new Date; stats.duration = new Date - stats.start; }); runner.on('pending', function(){ stats.pending++; }); } /** * Output common epilogue used by many of * the bundled reporters. * * @api public */ Base.prototype.epilogue = function(){ var stats = this.stats; var tests; var fmt; console.log(); // passes fmt = color('bright pass', ' ') + color('green', ' %d passing') + color('light', ' (%s)'); console.log(fmt, stats.passes || 0, ms(stats.duration)); // pending if (stats.pending) { fmt = color('pending', ' ') + color('pending', ' %d pending'); console.log(fmt, stats.pending); } // failures if (stats.failures) { fmt = color('fail', ' %d failing'); console.error(fmt, stats.failures); Base.list(this.failures); console.error(); } console.log(); }; /** * Pad the given `str` to `len`. * * @param {String} str * @param {String} len * @return {String} * @api private */ function pad(str, len) { str = String(str); return Array(len - str.length + 1).join(' ') + str; } /** * Returns an inline diff between 2 strings with coloured ANSI output * * @param {Error} Error with actual/expected * @return {String} Diff * @api private */ function inlineDiff(err, escape) { var msg = errorDiff(err, 'WordsWithSpace', escape); // linenos var lines = msg.split('\n'); if (lines.length > 4) { var width = String(lines.length).length; msg = lines.map(function(str, i){ return pad(++i, width) + ' |' + ' ' + str; }).join('\n'); } // legend msg = '\n' + color('diff removed', 'actual') + ' ' + color('diff added', 'expected') + '\n\n' + msg + '\n'; // indent msg = msg.replace(/^/gm, ' '); return msg; } /** * Returns a unified diff between 2 strings * * @param {Error} Error with actual/expected * @return {String} Diff * @api private */ function unifiedDiff(err, escape) { var indent = ' '; function cleanUp(line) { if (escape) { line = escapeInvisibles(line); } if (line[0] === '+') return indent + colorLines('diff added', line); if (line[0] === '-') return indent + colorLines('diff removed', line); if (line.match(/\@\@/)) return null; if (line.match(/\\ No newline/)) return null; else return indent + line; } function notBlank(line) { return line != null; } msg = diff.createPatch('string', err.actual, err.expected); var lines = msg.split('\n').splice(4); return '\n ' + colorLines('diff added', '+ expected') + ' ' + colorLines('diff removed', '- actual') + '\n\n' + lines.map(cleanUp).filter(notBlank).join('\n'); } /** * Return a character diff for `err`. * * @param {Error} err * @return {String} * @api private */ function errorDiff(err, type, escape) { var actual = escape ? escapeInvisibles(err.actual) : err.actual; var expected = escape ? escapeInvisibles(err.expected) : err.expected; return diff['diff' + type](actual, expected).map(function(str){ if (str.added) return colorLines('diff added', str.value); if (str.removed) return colorLines('diff removed', str.value); return str.value; }).join(''); } /** * Returns a string with all invisible characters in plain text * * @param {String} line * @return {String} * @api private */ function escapeInvisibles(line) { return line.replace(/\t/g, '<tab>') .replace(/\r/g, '<CR>') .replace(/\n/g, '<LF>\n'); } /** * Color lines for `str`, using the color `name`. * * @param {String} name * @param {String} str * @return {String} * @api private */ function colorLines(name, str) { return str.split('\n').map(function(str){ return color(name, str); }).join('\n'); } /** * Check that a / b have the same type. * * @param {Object} a * @param {Object} b * @return {Boolean} * @api private */ function sameType(a, b) { a = Object.prototype.toString.call(a); b = Object.prototype.toString.call(b); return a == b; } }); // module: reporters/base.js require.register("reporters/doc.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base') , utils = require('../utils'); /** * Expose `Doc`. */ exports = module.exports = Doc; /** * Initialize a new `Doc` reporter. * * @param {Runner} runner * @api public */ function Doc(runner) { Base.call(this, runner); var self = this , stats = this.stats , total = runner.total , indents = 2; function indent() { return Array(indents).join(' '); } runner.on('suite', function(suite){ if (suite.root) return; ++indents; console.log('%s<section class="suite">', indent()); ++indents; console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title)); console.log('%s<dl>', indent()); }); runner.on('suite end', function(suite){ if (suite.root) return; console.log('%s</dl>', indent()); --indents; console.log('%s</section>', indent()); --indents; }); runner.on('pass', function(test){ console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title)); var code = utils.escape(utils.clean(test.fn.toString())); console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code); }); runner.on('fail', function(test, err){ console.log('%s <dt class="error">%s</dt>', indent(), utils.escape(test.title)); var code = utils.escape(utils.clean(test.fn.toString())); console.log('%s <dd class="error"><pre><code>%s</code></pre></dd>', indent(), code); console.log('%s <dd class="error">%s</dd>', indent(), utils.escape(err)); }); } }); // module: reporters/doc.js require.register("reporters/dot.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base') , color = Base.color; /** * Expose `Dot`. */ exports = module.exports = Dot; /** * Initialize a new `Dot` matrix test reporter. * * @param {Runner} runner * @api public */ function Dot(runner) { Base.call(this, runner); var self = this , stats = this.stats , width = Base.window.width * .75 | 0 , n = -1; runner.on('start', function(){ process.stdout.write('\n '); }); runner.on('pending', function(test){ if (++n % width == 0) process.stdout.write('\n '); process.stdout.write(color('pending', Base.symbols.dot)); }); runner.on('pass', function(test){ if (++n % width == 0) process.stdout.write('\n '); if ('slow' == test.speed) { process.stdout.write(color('bright yellow', Base.symbols.dot)); } else { process.stdout.write(color(test.speed, Base.symbols.dot)); } }); runner.on('fail', function(test, err){ if (++n % width == 0) process.stdout.write('\n '); process.stdout.write(color('fail', Base.symbols.dot)); }); runner.on('end', function(){ console.log(); self.epilogue(); }); } /** * Inherit from `Base.prototype`. */ function F(){}; F.prototype = Base.prototype; Dot.prototype = new F; Dot.prototype.constructor = Dot; }); // module: reporters/dot.js require.register("reporters/html-cov.js", function(module, exports, require){ /** * Module dependencies. */ var JSONCov = require('./json-cov') , fs = require('browser/fs'); /** * Expose `HTMLCov`. */ exports = module.exports = HTMLCov; /** * Initialize a new `JsCoverage` reporter. * * @param {Runner} runner * @api public */ function HTMLCov(runner) { var jade = require('jade') , file = __dirname + '/templates/coverage.jade' , str = fs.readFileSync(file, 'utf8') , fn = jade.compile(str, { filename: file }) , self = this; JSONCov.call(this, runner, false); runner.on('end', function(){ process.stdout.write(fn({ cov: self.cov , coverageClass: coverageClass })); }); } /** * Return coverage class for `n`. * * @return {String} * @api private */ function coverageClass(n) { if (n >= 75) return 'high'; if (n >= 50) return 'medium'; if (n >= 25) return 'low'; return 'terrible'; } }); // module: reporters/html-cov.js require.register("reporters/html.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base') , utils = require('../utils') , Progress = require('../browser/progress') , escape = utils.escape; /** * Save timer references to avoid Sinon interfering (see GH-237). */ var Date = global.Date , setTimeout = global.setTimeout , setInterval = global.setInterval , clearTimeout = global.clearTimeout , clearInterval = global.clearInterval; /** * Expose `HTML`. */ exports = module.exports = HTML; /** * Stats template. */ var statsTemplate = '<ul id="mocha-stats">' + '<li class="progress"><canvas width="40" height="40"></canvas></li>' + '<li class="passes"><a href="#">passes:</a> <em>0</em></li>' + '<li class="failures"><a href="#">failures:</a> <em>0</em></li>' + '<li class="duration">duration: <em>0</em>s</li>' + '</ul>'; /** * Initialize a new `HTML` reporter. * * @param {Runner} runner * @api public */ function HTML(runner) { Base.call(this, runner); var self = this , stats = this.stats , total = runner.total , stat = fragment(statsTemplate) , items = stat.getElementsByTagName('li') , passes = items[1].getElementsByTagName('em')[0] , passesLink = items[1].getElementsByTagName('a')[0] , failures = items[2].getElementsByTagName('em')[0] , failuresLink = items[2].getElementsByTagName('a')[0] , duration = items[3].getElementsByTagName('em')[0] , canvas = stat.getElementsByTagName('canvas')[0] , report = fragment('<ul id="mocha-report"></ul>') , stack = [report] , progress , ctx , root = document.getElementById('mocha'); if (canvas.getContext) { var ratio = window.devicePixelRatio || 1; canvas.style.width = canvas.width; canvas.style.height = canvas.height; canvas.width *= ratio; canvas.height *= ratio; ctx = canvas.getContext('2d'); ctx.scale(ratio, ratio); progress = new Progress; } if (!root) return error('#mocha div missing, add it to your document'); // pass toggle on(passesLink, 'click', function(){ unhide(); var name = /pass/.test(report.className) ? '' : ' pass'; report.className = report.className.replace(/fail|pass/g, '') + name; if (report.className.trim()) hideSuitesWithout('test pass'); }); // failure toggle on(failuresLink, 'click', function(){ unhide(); var name = /fail/.test(report.className) ? '' : ' fail'; report.className = report.className.replace(/fail|pass/g, '') + name; if (report.className.trim()) hideSuitesWithout('test fail'); }); root.appendChild(stat); root.appendChild(report); if (progress) progress.size(40); runner.on('suite', function(suite){ if (suite.root) return; // suite var url = self.suiteURL(suite); var el = fragment('<li class="suite"><h1><a href="%s">%s</a></h1></li>', url, escape(suite.title)); // container stack[0].appendChild(el); stack.unshift(document.createElement('ul')); el.appendChild(stack[0]); }); runner.on('suite end', function(suite){ if (suite.root) return; stack.shift(); }); runner.on('fail', function(test, err){ if ('hook' == test.type) runner.emit('test end', test); }); runner.on('test end', function(test){ // TODO: add to stats var percent = stats.tests / this.total * 100 | 0; if (progress) progress.update(percent).draw(ctx); // update stats var ms = new Date - stats.start; text(passes, stats.passes); text(failures, stats.failures); text(duration, (ms / 1000).toFixed(2)); // test if ('passed' == test.state) { var url = self.testURL(test); var el = fragment('<li class="test pass %e"><h2>%e<span class="duration">%ems</span> <a href="%s" class="replay">‣</a></h2></li>', test.speed, test.title, test.duration, url); } else if (test.pending) { var el = fragment('<li class="test pass pending"><h2>%e</h2></li>', test.title); } else { var el = fragment('<li class="test fail"><h2>%e <a href="?grep=%e" class="replay">‣</a></h2></li>', test.title, encodeURIComponent(test.fullTitle())); var str = test.err.stack || test.err.toString(); // FF / Opera do not add the message if (!~str.indexOf(test.err.message)) { str = test.err.message + '\n' + str; } // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we // check for the result of the stringifying. if ('[object Error]' == str) str = test.err.message; // Safari doesn't give you a stack. Let's at least provide a source line. if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) { str += "\n(" + test.err.sourceURL + ":" + test.err.line + ")"; } el.appendChild(fragment('<pre class="error">%e</pre>', str)); } // toggle code // TODO: defer if (!test.pending) { var h2 = el.getElementsByTagName('h2')[0]; on(h2, 'click', function(){ pre.style.display = 'none' == pre.style.display ? 'block' : 'none'; }); var pre = fragment('<pre><code>%e</code></pre>', utils.clean(test.fn.toString())); el.appendChild(pre); pre.style.display = 'none'; } // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack. if (stack[0]) stack[0].appendChild(el); }); } /** * Provide suite URL * * @param {Object} [suite] */ HTML.prototype.suiteURL = function(suite){ return '?grep=' + encodeURIComponent(suite.fullTitle()); }; /** * Provide test URL * * @param {Object} [test] */ HTML.prototype.testURL = function(test){ return '?grep=' + encodeURIComponent(test.fullTitle()); }; /** * Display error `msg`. */ function error(msg) { document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg)); } /** * Return a DOM fragment from `html`. */ function fragment(html) { var args = arguments , div = document.createElement('div') , i = 1; div.innerHTML = html.replace(/%([se])/g, function(_, type){ switch (type) { case 's': return String(args[i++]); case 'e': return escape(args[i++]); } }); return div.firstChild; } /** * Check for suites that do not have elements * with `classname`, and hide them. */ function hideSuitesWithout(classname) { var suites = document.getElementsByClassName('suite'); for (var i = 0; i < suites.length; i++) { var els = suites[i].getElementsByClassName(classname); if (0 == els.length) suites[i].className += ' hidden'; } } /** * Unhide .hidden suites. */ function unhide() { var els = document.getElementsByClassName('suite hidden'); for (var i = 0; i < els.length; ++i) { els[i].className = els[i].className.replace('suite hidden', 'suite'); } } /** * Set `el` text to `str`. */ function text(el, str) { if (el.textContent) { el.textContent = str; } else { el.innerText = str; } } /** * Listen on `event` with callback `fn`. */ function on(el, event, fn) { if (el.addEventListener) { el.addEventListener(event, fn, false); } else { el.attachEvent('on' + event, fn); } } }); // module: reporters/html.js require.register("reporters/index.js", function(module, exports, require){ exports.Base = require('./base'); exports.Dot = require('./dot'); exports.Doc = require('./doc'); exports.TAP = require('./tap'); exports.JSON = require('./json'); exports.HTML = require('./html'); exports.List = require('./list'); exports.Min = require('./min'); exports.Spec = require('./spec'); exports.Nyan = require('./nyan'); exports.XUnit = require('./xunit'); exports.Markdown = require('./markdown'); exports.Progress = require('./progress'); exports.Landing = require('./landing'); exports.JSONCov = require('./json-cov'); exports.HTMLCov = require('./html-cov'); exports.JSONStream = require('./json-stream'); }); // module: reporters/index.js require.register("reporters/json-cov.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base'); /** * Expose `JSONCov`. */ exports = module.exports = JSONCov; /** * Initialize a new `JsCoverage` reporter. * * @param {Runner} runner * @param {Boolean} output * @api public */ function JSONCov(runner, output) { var self = this , output = 1 == arguments.length ? true : output; Base.call(this, runner); var tests = [] , failures = [] , passes = []; runner.on('test end', function(test){ tests.push(test); }); runner.on('pass', function(test){ passes.push(test); }); runner.on('fail', function(test){ failures.push(test); }); runner.on('end', function(){ var cov = global._$jscoverage || {}; var result = self.cov = map(cov); result.stats = self.stats; result.tests = tests.map(clean); result.failures = failures.map(clean); result.passes = passes.map(clean); if (!output) return; process.stdout.write(JSON.stringify(result, null, 2 )); }); } /** * Map jscoverage data to a JSON structure * suitable for reporting. * * @param {Object} cov * @return {Object} * @api private */ function map(cov) { var ret = { instrumentation: 'node-jscoverage' , sloc: 0 , hits: 0 , misses: 0 , coverage: 0 , files: [] }; for (var filename in cov) { var data = coverage(filename, cov[filename]); ret.files.push(data); ret.hits += data.hits; ret.misses += data.misses; ret.sloc += data.sloc; } ret.files.sort(function(a, b) { return a.filename.localeCompare(b.filename); }); if (ret.sloc > 0) { ret.coverage = (ret.hits / ret.sloc) * 100; } return ret; } /** * Map jscoverage data for a single source file * to a JSON structure suitable for reporting. * * @param {String} filename name of the source file * @param {Object} data jscoverage coverage data * @return {Object} * @api private */ function coverage(filename, data) { var ret = { filename: filename, coverage: 0, hits: 0, misses: 0, sloc: 0, source: {} }; data.source.forEach(function(line, num){ num++; if (data[num] === 0) { ret.misses++; ret.sloc++; } else if (data[num] !== undefined) { ret.hits++; ret.sloc++; } ret.source[num] = { source: line , coverage: data[num] === undefined ? '' : data[num] }; }); ret.coverage = ret.hits / ret.sloc * 100; return ret; } /** * Return a plain-object representation of `test` * free of cyclic properties etc. * * @param {Object} test * @return {Object} * @api private */ function clean(test) { return { title: test.title , fullTitle: test.fullTitle() , duration: test.duration } } }); // module: reporters/json-cov.js require.register("reporters/json-stream.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base') , color = Base.color; /** * Expose `List`. */ exports = module.exports = List; /** * Initialize a new `List` test reporter. * * @param {Runner} runner * @api public */ function List(runner) { Base.call(this, runner); var self = this , stats = this.stats , total = runner.total; runner.on('start', function(){ console.log(JSON.stringify(['start', { total: total }])); }); runner.on('pass', function(test){ console.log(JSON.stringify(['pass', clean(test)])); }); runner.on('fail', function(test, err){ console.log(JSON.stringify(['fail', clean(test)])); }); runner.on('end', function(){ process.stdout.write(JSON.stringify(['end', self.stats])); }); } /** * Return a plain-object representation of `test` * free of cyclic properties etc. * * @param {Object} test * @return {Object} * @api private */ function clean(test) { return { title: test.title , fullTitle: test.fullTitle() , duration: test.duration } } }); // module: reporters/json-stream.js require.register("reporters/json.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base') , cursor = Base.cursor , color = Base.color; /** * Expose `JSON`. */ exports = module.exports = JSONReporter; /** * Initialize a new `JSON` reporter. * * @param {Runner} runner * @api public */ function JSONReporter(runner) { var self = this; Base.call(this, runner); var tests = [] , pending = [] , failures = [] , passes = []; runner.on('test end', function(test){ tests.push(test); }); runner.on('pass', function(test){ passes.push(test); }); runner.on('fail', function(test){ failures.push(test); }); runner.on('pending', function(test){ pending.push(test); }); runner.on('end', function(){ var obj = { stats: self.stats, tests: tests.map(clean), pending: pending.map(clean), failures: failures.map(clean), passes: passes.map(clean) }; runner.testResults = obj; process.stdout.write(JSON.stringify(obj, null, 2)); }); } /** * Return a plain-object representation of `test` * free of cyclic properties etc. * * @param {Object} test * @return {Object} * @api private */ function clean(test) { return { title: test.title, fullTitle: test.fullTitle(), duration: test.duration, err: errorJSON(test.err || {}) } } /** * Transform `error` into a JSON object. * @param {Error} err * @return {Object} */ function errorJSON(err) { var res = {}; Object.getOwnPropertyNames(err).forEach(function(key) { res[key] = err[key]; }, err); return res; } }); // module: reporters/json.js require.register("reporters/landing.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base') , cursor = Base.cursor , color = Base.color; /** * Expose `Landing`. */ exports = module.exports = Landing; /** * Airplane color. */ Base.colors.plane = 0; /** * Airplane crash color. */ Base.colors['plane crash'] = 31; /** * Runway color. */ Base.colors.runway = 90; /** * Initialize a new `Landing` reporter. * * @param {Runner} runner * @api public */ function Landing(runner) { Base.call(this, runner); var self = this , stats = this.stats , width = Base.window.width * .75 | 0 , total = runner.total , stream = process.stdout , plane = color('plane', '✈') , crashed = -1 , n = 0; function runway() { var buf = Array(width).join('-'); return ' ' + color('runway', buf); } runner.on('start', function(){ stream.write('\n '); cursor.hide(); }); runner.on('test end', function(test){ // check if the plane crashed var col = -1 == crashed ? width * ++n / total | 0 : crashed; // show the crash if ('failed' == test.state) { plane = color('plane crash', '✈'); crashed = col; } // render landing strip stream.write('\u001b[4F\n\n'); stream.write(runway()); stream.write('\n '); stream.write(color('runway', Array(col).join('⋅'))); stream.write(plane) stream.write(color('runway', Array(width - col).join('⋅') + '\n')); stream.write(runway()); stream.write('\u001b[0m'); }); runner.on('end', function(){ cursor.show(); console.log(); self.epilogue(); }); } /** * Inherit from `Base.prototype`. */ function F(){}; F.prototype = Base.prototype; Landing.prototype = new F; Landing.prototype.constructor = Landing; }); // module: reporters/landing.js require.register("reporters/list.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base') , cursor = Base.cursor , color = Base.color; /** * Expose `List`. */ exports = module.exports = List; /** * Initialize a new `List` test reporter. * * @param {Runner} runner * @api public */ function List(runner) { Base.call(this, runner); var self = this , stats = this.stats , n = 0; runner.on('start', function(){ console.log(); }); runner.on('test', function(test){ process.stdout.write(color('pass', ' ' + test.fullTitle() + ': ')); }); runner.on('pending', function(test){ var fmt = color('checkmark', ' -') + color('pending', ' %s'); console.log(fmt, test.fullTitle()); }); runner.on('pass', function(test){ var fmt = color('checkmark', ' '+Base.symbols.dot) + color('pass', ' %s: ') + color(test.speed, '%dms'); cursor.CR(); console.log(fmt, test.fullTitle(), test.duration); }); runner.on('fail', function(test, err){ cursor.CR(); console.log(color('fail', ' %d) %s'), ++n, test.fullTitle()); }); runner.on('end', self.epilogue.bind(self)); } /** * Inherit from `Base.prototype`. */ function F(){}; F.prototype = Base.prototype; List.prototype = new F; List.prototype.constructor = List; }); // module: reporters/list.js require.register("reporters/markdown.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base') , utils = require('../utils'); /** * Expose `Markdown`. */ exports = module.exports = Markdown; /** * Initialize a new `Markdown` reporter. * * @param {Runner} runner * @api public */ function Markdown(runner) { Base.call(this, runner); var self = this , stats = this.stats , level = 0 , buf = ''; function title(str) { return Array(level).join('#') + ' ' + str; } function indent() { return Array(level).join(' '); } function mapTOC(suite, obj) { var ret = obj; obj = obj[suite.title] = obj[suite.title] || { suite: suite }; suite.suites.forEach(function(suite){ mapTOC(suite, obj); }); return ret; } function stringifyTOC(obj, level) { ++level; var buf = ''; var link; for (var key in obj) { if ('suite' == key) continue; if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n'; if (key) buf += Array(level).join(' ') + link; buf += stringifyTOC(obj[key], level); } --level; return buf; } function generateTOC(suite) { var obj = mapTOC(suite, {}); return stringifyTOC(obj, 0); } generateTOC(runner.suite); runner.on('suite', function(suite){ ++level; var slug = utils.slug(suite.fullTitle()); buf += '<a name="' + slug + '"></a>' + '\n'; buf += title(suite.title) + '\n'; }); runner.on('suite end', function(suite){ --level; }); runner.on('pass', function(test){ var code = utils.clean(test.fn.toString()); buf += test.title + '.\n'; buf += '\n```js\n'; buf += code + '\n'; buf += '```\n\n'; }); runner.on('end', function(){ process.stdout.write('# TOC\n'); process.stdout.write(generateTOC(runner.suite)); process.stdout.write(buf); }); } }); // module: reporters/markdown.js require.register("reporters/min.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base'); /** * Expose `Min`. */ exports = module.exports = Min; /** * Initialize a new `Min` minimal test reporter (best used with --watch). * * @param {Runner} runner * @api public */ function Min(runner) { Base.call(this, runner); runner.on('start', function(){ // clear screen process.stdout.write('\u001b[2J'); // set cursor position process.stdout.write('\u001b[1;3H'); }); runner.on('end', this.epilogue.bind(this)); } /** * Inherit from `Base.prototype`. */ function F(){}; F.prototype = Base.prototype; Min.prototype = new F; Min.prototype.constructor = Min; }); // module: reporters/min.js require.register("reporters/nyan.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base') , color = Base.color; /** * Expose `Dot`. */ exports = module.exports = NyanCat; /** * Initialize a new `Dot` matrix test reporter. * * @param {Runner} runner * @api public */ function NyanCat(runner) { Base.call(this, runner); var self = this , stats = this.stats , width = Base.window.width * .75 | 0 , rainbowColors = this.rainbowColors = self.generateColors() , colorIndex = this.colorIndex = 0 , numerOfLines = this.numberOfLines = 4 , trajectories = this.trajectories = [[], [], [], []] , nyanCatWidth = this.nyanCatWidth = 11 , trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth) , scoreboardWidth = this.scoreboardWidth = 5 , tick = this.tick = 0 , n = 0; runner.on('start', function(){ Base.cursor.hide(); self.draw(); }); runner.on('pending', function(test){ self.draw(); }); runner.on('pass', function(test){ self.draw(); }); runner.on('fail', function(test, err){ self.draw(); }); runner.on('end', function(){ Base.cursor.show(); for (var i = 0; i < self.numberOfLines; i++) write('\n'); self.epilogue(); }); } /** * Draw the nyan cat * * @api private */ NyanCat.prototype.draw = function(){ this.appendRainbow(); this.drawScoreboard(); this.drawRainbow(); this.drawNyanCat(); this.tick = !this.tick; }; /** * Draw the "scoreboard" showing the number * of passes, failures and pending tests. * * @api private */ NyanCat.prototype.drawScoreboard = function(){ var stats = this.stats; var colors = Base.colors; function draw(color, n) { write(' '); write('\u001b[' + color + 'm' + n + '\u001b[0m'); write('\n'); } draw(colors.green, stats.passes); draw(colors.fail, stats.failures); draw(colors.pending, stats.pending); write('\n'); this.cursorUp(this.numberOfLines); }; /** * Append the rainbow. * * @api private */ NyanCat.prototype.appendRainbow = function(){ var segment = this.tick ? '_' : '-'; var rainbowified = this.rainbowify(segment); for (var index = 0; index < this.numberOfLines; index++) { var trajectory = this.trajectories[index]; if (trajectory.length >= this.trajectoryWidthMax) trajectory.shift(); trajectory.push(rainbowified); } }; /** * Draw the rainbow. * * @api private */ NyanCat.prototype.drawRainbow = function(){ var self = this; this.trajectories.forEach(function(line, index) { write('\u001b[' + self.scoreboardWidth + 'C'); write(line.join('')); write('\n'); }); this.cursorUp(this.numberOfLines); }; /** * Draw the nyan cat * * @api private */ NyanCat.prototype.drawNyanCat = function() { var self = this; var startWidth = this.scoreboardWidth + this.trajectories[0].length; var color = '\u001b[' + startWidth + 'C'; var padding = ''; write(color); write('_,------,'); write('\n'); write(color); padding = self.tick ? ' ' : ' '; write('_|' + padding + '/\\_/\\ '); write('\n'); write(color); padding = self.tick ? '_' : '__'; var tail = self.tick ? '~' : '^'; var face; write(tail + '|' + padding + this.face() + ' '); write('\n'); write(color); padding = self.tick ? ' ' : ' '; write(padding + '"" "" '); write('\n'); this.cursorUp(this.numberOfLines); }; /** * Draw nyan cat face. * * @return {String} * @api private */ NyanCat.prototype.face = function() { var stats = this.stats; if (stats.failures) { return '( x .x)'; } else if (stats.pending) { return '( o .o)'; } else if(stats.passes) { return '( ^ .^)'; } else { return '( - .-)'; } }; /** * Move cursor up `n`. * * @param {Number} n * @api private */ NyanCat.prototype.cursorUp = function(n) { write('\u001b[' + n + 'A'); }; /** * Move cursor down `n`. * * @param {Number} n * @api private */ NyanCat.prototype.cursorDown = function(n) { write('\u001b[' + n + 'B'); }; /** * Generate rainbow colors. * * @return {Array} * @api private */ NyanCat.prototype.generateColors = function(){ var colors = []; for (var i = 0; i < (6 * 7); i++) { var pi3 = Math.floor(Math.PI / 3); var n = (i * (1.0 / 6)); var r = Math.floor(3 * Math.sin(n) + 3); var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3); var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3); colors.push(36 * r + 6 * g + b + 16); } return colors; }; /** * Apply rainbow to the given `str`. * * @param {String} str * @return {String} * @api private */ NyanCat.prototype.rainbowify = function(str){ var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length]; this.colorIndex += 1; return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m'; }; /** * Stdout helper. */ function write(string) { process.stdout.write(string); } /** * Inherit from `Base.prototype`. */ function F(){}; F.prototype = Base.prototype; NyanCat.prototype = new F; NyanCat.prototype.constructor = NyanCat; }); // module: reporters/nyan.js require.register("reporters/progress.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base') , cursor = Base.cursor , color = Base.color; /** * Expose `Progress`. */ exports = module.exports = Progress; /** * General progress bar color. */ Base.colors.progress = 90; /** * Initialize a new `Progress` bar test reporter. * * @param {Runner} runner * @param {Object} options * @api public */ function Progress(runner, options) { Base.call(this, runner); var self = this , options = options || {} , stats = this.stats , width = Base.window.width * .50 | 0 , total = runner.total , complete = 0 , max = Math.max , lastN = -1; // default chars options.open = options.open || '['; options.complete = options.complete || '▬'; options.incomplete = options.incomplete || Base.symbols.dot; options.close = options.close || ']'; options.verbose = false; // tests started runner.on('start', function(){ console.log(); cursor.hide(); }); // tests complete runner.on('test end', function(){ complete++; var incomplete = total - complete , percent = complete / total , n = width * percent | 0 , i = width - n; if (lastN === n && !options.verbose) { // Don't re-render the line if it hasn't changed return; } lastN = n; cursor.CR(); process.stdout.write('\u001b[J'); process.stdout.write(color('progress', ' ' + options.open)); process.stdout.write(Array(n).join(options.complete)); process.stdout.write(Array(i).join(options.incomplete)); process.stdout.write(color('progress', options.close)); if (options.verbose) { process.stdout.write(color('progress', ' ' + complete + ' of ' + total)); } }); // tests are complete, output some stats // and the failures if any runner.on('end', function(){ cursor.show(); console.log(); self.epilogue(); }); } /** * Inherit from `Base.prototype`. */ function F(){}; F.prototype = Base.prototype; Progress.prototype = new F; Progress.prototype.constructor = Progress; }); // module: reporters/progress.js require.register("reporters/spec.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base') , cursor = Base.cursor , color = Base.color; /** * Expose `Spec`. */ exports = module.exports = Spec; /** * Initialize a new `Spec` test reporter. * * @param {Runner} runner * @api public */ function Spec(runner) { Base.call(this, runner); var self = this , stats = this.stats , indents = 0 , n = 0; function indent() { return Array(indents).join(' ') } runner.on('start', function(){ console.log(); }); runner.on('suite', function(suite){ ++indents; console.log(color('suite', '%s%s'), indent(), suite.title); }); runner.on('suite end', function(suite){ --indents; if (1 == indents) console.log(); }); runner.on('pending', function(test){ var fmt = indent() + color('pending', ' - %s'); console.log(fmt, test.title); }); runner.on('pass', function(test){ if ('fast' == test.speed) { var fmt = indent() + color('checkmark', ' ' + Base.symbols.ok) + color('pass', ' %s '); cursor.CR(); console.log(fmt, test.title); } else { var fmt = indent() + color('checkmark', ' ' + Base.symbols.ok) + color('pass', ' %s ') + color(test.speed, '(%dms)'); cursor.CR(); console.log(fmt, test.title, test.duration); } }); runner.on('fail', function(test, err){ cursor.CR(); console.log(indent() + color('fail', ' %d) %s'), ++n, test.title); }); runner.on('end', self.epilogue.bind(self)); } /** * Inherit from `Base.prototype`. */ function F(){}; F.prototype = Base.prototype; Spec.prototype = new F; Spec.prototype.constructor = Spec; }); // module: reporters/spec.js require.register("reporters/tap.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base') , cursor = Base.cursor , color = Base.color; /** * Expose `TAP`. */ exports = module.exports = TAP; /** * Initialize a new `TAP` reporter. * * @param {Runner} runner * @api public */ function TAP(runner) { Base.call(this, runner); var self = this , stats = this.stats , n = 1 , passes = 0 , failures = 0; runner.on('start', function(){ var total = runner.grepTotal(runner.suite); console.log('%d..%d', 1, total); }); runner.on('test end', function(){ ++n; }); runner.on('pending', function(test){ console.log('ok %d %s # SKIP -', n, title(test)); }); runner.on('pass', function(test){ passes++; console.log('ok %d %s', n, title(test)); }); runner.on('fail', function(test, err){ failures++; console.log('not ok %d %s', n, title(test)); if (err.stack) console.log(err.stack.replace(/^/gm, ' ')); }); runner.on('end', function(){ console.log('# tests ' + (passes + failures)); console.log('# pass ' + passes); console.log('# fail ' + failures); }); } /** * Return a TAP-safe title of `test` * * @param {Object} test * @return {String} * @api private */ function title(test) { return test.fullTitle().replace(/#/g, ''); } }); // module: reporters/tap.js require.register("reporters/xunit.js", function(module, exports, require){ /** * Module dependencies. */ var Base = require('./base') , utils = require('../utils') , escape = utils.escape; /** * Save timer references to avoid Sinon interfering (see GH-237). */ var Date = global.Date , setTimeout = global.setTimeout , setInterval = global.setInterval , clearTimeout = global.clearTimeout , clearInterval = global.clearInterval; /** * Expose `XUnit`. */ exports = module.exports = XUnit; /** * Initialize a new `XUnit` reporter. * * @param {Runner} runner * @api public */ function XUnit(runner) { Base.call(this, runner); var stats = this.stats , tests = [] , self = this; runner.on('pending', function(test){ tests.push(test); }); runner.on('pass', function(test){ tests.push(test); }); runner.on('fail', function(test){ tests.push(test); }); runner.on('end', function(){ console.log(tag('testsuite', { name: 'Mocha Tests' , tests: stats.tests , failures: stats.failures , errors: stats.failures , skipped: stats.tests - stats.failures - stats.passes , timestamp: (new Date).toUTCString() , time: (stats.duration / 1000) || 0 }, false)); tests.forEach(test); console.log('</testsuite>'); }); } /** * Inherit from `Base.prototype`. */ function F(){}; F.prototype = Base.prototype; XUnit.prototype = new F; XUnit.prototype.constructor = XUnit; /** * Output tag for the given `test.` */ function test(test) { var attrs = { classname: test.parent.fullTitle() , name: test.title , time: (test.duration / 1000) || 0 }; if ('failed' == test.state) { var err = test.err; console.log(tag('testcase', attrs, false, tag('failure', {}, false, cdata(escape(err.message) + "\n" + err.stack)))); } else if (test.pending) { console.log(tag('testcase', attrs, false, tag('skipped', {}, true))); } else { console.log(tag('testcase', attrs, true) ); } } /** * HTML tag helper. */ function tag(name, attrs, close, content) { var end = close ? '/>' : '>' , pairs = [] , tag; for (var key in attrs) { pairs.push(key + '="' + escape(attrs[key]) + '"'); } tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end; if (content) tag += content + '</' + name + end; return tag; } /** * Return cdata escaped CDATA `str`. */ function cdata(str) { return '<![CDATA[' + escape(str) + ']]>'; } }); // module: reporters/xunit.js require.register("runnable.js", function(module, exports, require){ /** * Module dependencies. */ var EventEmitter = require('browser/events').EventEmitter , debug = require('browser/debug')('mocha:runnable') , milliseconds = require('./ms'); /** * Save timer references to avoid Sinon interfering (see GH-237). */ var Date = global.Date , setTimeout = global.setTimeout , setInterval = global.setInterval , clearTimeout = global.clearTimeout , clearInterval = global.clearInterval; /** * Object#toString(). */ var toString = Object.prototype.toString; /** * Expose `Runnable`. */ module.exports = Runnable; /** * Initialize a new `Runnable` with the given `title` and callback `fn`. * * @param {String} title * @param {Function} fn * @api private */ function Runnable(title, fn) { this.title = title; this.fn = fn; this.async = fn && fn.length; this.sync = ! this.async; this._timeout = 2000; this._slow = 75; this._enableTimeouts = true; this.timedOut = false; } /** * Inherit from `EventEmitter.prototype`. */ function F(){}; F.prototype = EventEmitter.prototype; Runnable.prototype = new F; Runnable.prototype.constructor = Runnable; /** * Set & get timeout `ms`. * * @param {Number|String} ms * @return {Runnable|Number} ms or self * @api private */ Runnable.prototype.timeout = function(ms){ if (0 == arguments.length) return this._timeout; if (ms === 0) this._enableTimeouts = false; if ('string' == typeof ms) ms = milliseconds(ms); debug('timeout %d', ms); this._timeout = ms; if (this.timer) this.resetTimeout(); return this; }; /** * Set & get slow `ms`. * * @param {Number|String} ms * @return {Runnable|Number} ms or self * @api private */ Runnable.prototype.slow = function(ms){ if (0 === arguments.length) return this._slow; if ('string' == typeof ms) ms = milliseconds(ms); debug('timeout %d', ms); this._slow = ms; return this; }; /** * Set and & get timeout `enabled`. * * @param {Boolean} enabled * @return {Runnable|Boolean} enabled or self * @api private */ Runnable.prototype.enableTimeouts = function(enabled){ if (arguments.length === 0) return this._enableTimeouts; debug('enableTimeouts %s', enabled); this._enableTimeouts = enabled; return this; }; /** * Return the full title generated by recursively * concatenating the parent's full title. * * @return {String} * @api public */ Runnable.prototype.fullTitle = function(){ return this.parent.fullTitle() + ' ' + this.title; }; /** * Clear the timeout. * * @api private */ Runnable.prototype.clearTimeout = function(){ clearTimeout(this.timer); }; /** * Inspect the runnable void of private properties. * * @return {String} * @api private */ Runnable.prototype.inspect = function(){ return JSON.stringify(this, function(key, val){ if ('_' == key[0]) return; if ('parent' == key) return '#<Suite>'; if ('ctx' == key) return '#<Context>'; return val; }, 2); }; /** * Reset the timeout. * * @api private */ Runnable.prototype.resetTimeout = function(){ var self = this; var ms = this.timeout() || 1e9; if (!this._enableTimeouts) return; this.clearTimeout(); this.timer = setTimeout(function(){ if (!self._enableTimeouts) return; self.callback(new Error('timeout of ' + ms + 'ms exceeded')); self.timedOut = true; }, ms); }; /** * Whitelist these globals for this test run * * @api private */ Runnable.prototype.globals = function(arr){ var self = this; this._allowedGlobals = arr; }; /** * Run the test and invoke `fn(err)`. * * @param {Function} fn * @api private */ Runnable.prototype.run = function(fn){ var self = this , start = new Date , ctx = this.ctx , finished , emitted; // Some times the ctx exists but it is not runnable if (ctx && ctx.runnable) ctx.runnable(this); // called multiple times function multiple(err) { if (emitted) return; emitted = true; self.emit('error', err || new Error('done() called multiple times')); } // finished function done(err) { var ms = self.timeout(); if (self.timedOut) return; if (finished) return multiple(err); self.clearTimeout(); self.duration = new Date - start; finished = true; if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded'); fn(err); } // for .resetTimeout() this.callback = done; // explicit async with `done` argument if (this.async) { this.resetTimeout(); try { this.fn.call(ctx, function(err){ if (err instanceof Error || toString.call(err) === "[object Error]") return done(err); if (null != err) { if (Object.prototype.toString.call(err) === '[object Object]') { return done(new Error('done() invoked with non-Error: ' + JSON.stringify(err))); } else { return done(new Error('done() invoked with non-Error: ' + err)); } } done(); }); } catch (err) { done(err); } return; } if (this.asyncOnly) { return done(new Error('--async-only option in use without declaring `done()`')); } // sync or promise-returning try { if (this.pending) { done(); } else { callFn(this.fn); } } catch (err) { done(err); } function callFn(fn) { var result = fn.call(ctx); if (result && typeof result.then === 'function') { self.resetTimeout(); result .then(function() { done() }, function(reason) { done(reason || new Error('Promise rejected with no or falsy reason')) }); } else { done(); } } }; }); // module: runnable.js require.register("runner.js", function(module, exports, require){ /** * Module dependencies. */ var EventEmitter = require('browser/events').EventEmitter , debug = require('browser/debug')('mocha:runner') , Test = require('./test') , utils = require('./utils') , filter = utils.filter , keys = utils.keys; /** * Non-enumerable globals. */ var globals = [ 'setTimeout', 'clearTimeout', 'setInterval', 'clearInterval', 'XMLHttpRequest', 'Date' ]; /** * Expose `Runner`. */ module.exports = Runner; /** * Initialize a `Runner` for the given `suite`. * * Events: * * - `start` execution started * - `end` execution complete * - `suite` (suite) test suite execution started * - `suite end` (suite) all tests (and sub-suites) have finished * - `test` (test) test execution started * - `test end` (test) test completed * - `hook` (hook) hook execution started * - `hook end` (hook) hook complete * - `pass` (test) test passed * - `fail` (test, err) test failed * - `pending` (test) test pending * * @api public */ function Runner(suite) { var self = this; this._globals = []; this._abort = false; this.suite = suite; this.total = suite.total(); this.failures = 0; this.on('test end', function(test){ self.checkGlobals(test); }); this.on('hook end', function(hook){ self.checkGlobals(hook); }); this.grep(/.*/); this.globals(this.globalProps().concat(extraGlobals())); } /** * Wrapper for setImmediate, process.nextTick, or browser polyfill. * * @param {Function} fn * @api private */ Runner.immediately = global.setImmediate || process.nextTick; /** * Inherit from `EventEmitter.prototype`. */ function F(){}; F.prototype = EventEmitter.prototype; Runner.prototype = new F; Runner.prototype.constructor = Runner; /** * Run tests with full titles matching `re`. Updates runner.total * with number of tests matched. * * @param {RegExp} re * @param {Boolean} invert * @return {Runner} for chaining * @api public */ Runner.prototype.grep = function(re, invert){ debug('grep %s', re); this._grep = re; this._invert = invert; this.total = this.grepTotal(this.suite); return this; }; /** * Returns the number of tests matching the grep search for the * given suite. * * @param {Suite} suite * @return {Number} * @api public */ Runner.prototype.grepTotal = function(suite) { var self = this; var total = 0; suite.eachTest(function(test){ var match = self._grep.test(test.fullTitle()); if (self._invert) match = !match; if (match) total++; }); return total; }; /** * Return a list of global properties. * * @return {Array} * @api private */ Runner.prototype.globalProps = function() { var props = utils.keys(global); // non-enumerables for (var i = 0; i < globals.length; ++i) { if (~utils.indexOf(props, globals[i])) continue; props.push(globals[i]); } return props; }; /** * Allow the given `arr` of globals. * * @param {Array} arr * @return {Runner} for chaining * @api public */ Runner.prototype.globals = function(arr){ if (0 == arguments.length) return this._globals; debug('globals %j', arr); this._globals = this._globals.concat(arr); return this; }; /** * Check for global variable leaks. * * @api private */ Runner.prototype.checkGlobals = function(test){ if (this.ignoreLeaks) return; var ok = this._globals; var globals = this.globalProps(); var leaks; if (test) { ok = ok.concat(test._allowedGlobals || []); } if(this.prevGlobalsLength == globals.length) return; this.prevGlobalsLength = globals.length; leaks = filterLeaks(ok, globals); this._globals = this._globals.concat(leaks); if (leaks.length > 1) { this.fail(test, new Error('global leaks detected: ' + leaks.join(', ') + '')); } else if (leaks.length) { this.fail(test, new Error('global leak detected: ' + leaks[0])); } }; /** * Fail the given `test`. * * @param {Test} test * @param {Error} err * @api private */ Runner.prototype.fail = function(test, err){ ++this.failures; test.state = 'failed'; if ('string' == typeof err) { err = new Error('the string "' + err + '" was thrown, throw an Error :)'); } this.emit('fail', test, err); }; /** * Fail the given `hook` with `err`. * * Hook failures work in the following pattern: * - If bail, then exit * - Failed `before` hook skips all tests in a suite and subsuites, * but jumps to corresponding `after` hook * - Failed `before each` hook skips remaining tests in a * suite and jumps to corresponding `after each` hook, * which is run only once * - Failed `after` hook does not alter * execution order * - Failed `after each` hook skips remaining tests in a * suite and subsuites, but executes other `after each` * hooks * * @param {Hook} hook * @param {Error} err * @api private */ Runner.prototype.failHook = function(hook, err){ this.fail(hook, err); if (this.suite.bail()) { this.emit('end'); } }; /** * Run hook `name` callbacks and then invoke `fn()`. * * @param {String} name * @param {Function} function * @api private */ Runner.prototype.hook = function(name, fn){ var suite = this.suite , hooks = suite['_' + name] , self = this , timer; function next(i) { var hook = hooks[i]; if (!hook) return fn(); if (self.failures && suite.bail()) return fn(); self.currentRunnable = hook; hook.ctx.currentTest = self.test; self.emit('hook', hook); hook.on('error', function(err){ self.failHook(hook, err); }); hook.run(function(err){ hook.removeAllListeners('error'); var testError = hook.error(); if (testError) self.fail(self.test, testError); if (err) { self.failHook(hook, err); // stop executing hooks, notify callee of hook err return fn(err); } self.emit('hook end', hook); delete hook.ctx.currentTest; next(++i); }); } Runner.immediately(function(){ next(0); }); }; /** * Run hook `name` for the given array of `suites` * in order, and callback `fn(err, errSuite)`. * * @param {String} name * @param {Array} suites * @param {Function} fn * @api private */ Runner.prototype.hooks = function(name, suites, fn){ var self = this , orig = this.suite; function next(suite) { self.suite = suite; if (!suite) { self.suite = orig; return fn(); } self.hook(name, function(err){ if (err) { var errSuite = self.suite; self.suite = orig; return fn(err, errSuite); } next(suites.pop()); }); } next(suites.pop()); }; /** * Run hooks from the top level down. * * @param {String} name * @param {Function} fn * @api private */ Runner.prototype.hookUp = function(name, fn){ var suites = [this.suite].concat(this.parents()).reverse(); this.hooks(name, suites, fn); }; /** * Run hooks from the bottom up. * * @param {String} name * @param {Function} fn * @api private */ Runner.prototype.hookDown = function(name, fn){ var suites = [this.suite].concat(this.parents()); this.hooks(name, suites, fn); }; /** * Return an array of parent Suites from * closest to furthest. * * @return {Array} * @api private */ Runner.prototype.parents = function(){ var suite = this.suite , suites = []; while (suite = suite.parent) suites.push(suite); return suites; }; /** * Run the current test and callback `fn(err)`. * * @param {Function} fn * @api private */ Runner.prototype.runTest = function(fn){ var test = this.test , self = this; if (this.asyncOnly) test.asyncOnly = true; try { test.on('error', function(err){ self.fail(test, err); }); test.run(fn); } catch (err) { fn(err); } }; /** * Run tests in the given `suite` and invoke * the callback `fn()` when complete. * * @param {Suite} suite * @param {Function} fn * @api private */ Runner.prototype.runTests = function(suite, fn){ var self = this , tests = suite.tests.slice() , test; function hookErr(err, errSuite, after) { // before/after Each hook for errSuite failed: var orig = self.suite; // for failed 'after each' hook start from errSuite parent, // otherwise start from errSuite itself self.suite = after ? errSuite.parent : errSuite; if (self.suite) { // call hookUp afterEach self.hookUp('afterEach', function(err2, errSuite2) { self.suite = orig; // some hooks may fail even now if (err2) return hookErr(err2, errSuite2, true); // report error suite fn(errSuite); }); } else { // there is no need calling other 'after each' hooks self.suite = orig; fn(errSuite); } } function next(err, errSuite) { // if we bail after first err if (self.failures && suite._bail) return fn(); if (self._abort) return fn(); if (err) return hookErr(err, errSuite, true); // next test test = tests.shift(); // all done if (!test) return fn(); // grep var match = self._grep.test(test.fullTitle()); if (self._invert) match = !match; if (!match) return next(); // pending if (test.pending) { self.emit('pending', test); self.emit('test end', test); return next(); } // execute test and hook(s) self.emit('test', self.test = test); self.hookDown('beforeEach', function(err, errSuite){ if (err) return hookErr(err, errSuite, false); self.currentRunnable = self.test; self.runTest(function(err){ test = self.test; if (err) { self.fail(test, err); self.emit('test end', test); return self.hookUp('afterEach', next); } test.state = 'passed'; self.emit('pass', test); self.emit('test end', test); self.hookUp('afterEach', next); }); }); } this.next = next; next(); }; /** * Run the given `suite` and invoke the * callback `fn()` when complete. * * @param {Suite} suite * @param {Function} fn * @api private */ Runner.prototype.runSuite = function(suite, fn){ var total = this.grepTotal(suite) , self = this , i = 0; debug('run suite %s', suite.fullTitle()); if (!total) return fn(); this.emit('suite', this.suite = suite); function next(errSuite) { if (errSuite) { // current suite failed on a hook from errSuite if (errSuite == suite) { // if errSuite is current suite // continue to the next sibling suite return done(); } else { // errSuite is among the parents of current suite // stop execution of errSuite and all sub-suites return done(errSuite); } } if (self._abort) return done(); var curr = suite.suites[i++]; if (!curr) return done(); self.runSuite(curr, next); } function done(errSuite) { self.suite = suite; self.hook('afterAll', function(){ self.emit('suite end', suite); fn(errSuite); }); } this.hook('beforeAll', function(err){ if (err) return done(); self.runTests(suite, next); }); }; /** * Handle uncaught exceptions. * * @param {Error} err * @api private */ Runner.prototype.uncaught = function(err){ if (err) { debug('uncaught exception %s', err !== function () { return this; }.call(err) ? err : ( err.message || err )); } else { debug('uncaught undefined exception'); err = new Error('Caught undefined error, did you throw without specifying what?'); } err.uncaught = true; var runnable = this.currentRunnable; if (!runnable) return; var wasAlreadyDone = runnable.state; this.fail(runnable, err); runnable.clearTimeout(); if (wasAlreadyDone) return; // recover from test if ('test' == runnable.type) { this.emit('test end', runnable); this.hookUp('afterEach', this.next); return; } // bail on hooks this.emit('end'); }; /** * Run the root suite and invoke `fn(failures)` * on completion. * * @param {Function} fn * @return {Runner} for chaining * @api public */ Runner.prototype.run = function(fn){ var self = this , fn = fn || function(){}; function uncaught(err){ self.uncaught(err); } debug('start'); // callback this.on('end', function(){ debug('end'); process.removeListener('uncaughtException', uncaught); fn(self.failures); }); // run suites this.emit('start'); this.runSuite(this.suite, function(){ debug('finished running'); self.emit('end'); }); // uncaught exception process.on('uncaughtException', uncaught); return this; }; /** * Cleanly abort execution * * @return {Runner} for chaining * @api public */ Runner.prototype.abort = function(){ debug('aborting'); this._abort = true; }; /** * Filter leaks with the given globals flagged as `ok`. * * @param {Array} ok * @param {Array} globals * @return {Array} * @api private */ function filterLeaks(ok, globals) { return filter(globals, function(key){ // Firefox and Chrome exposes iframes as index inside the window object if (/^d+/.test(key)) return false; // in firefox // if runner runs in an iframe, this iframe's window.getInterface method not init at first // it is assigned in some seconds if (global.navigator && /^getInterface/.test(key)) return false; // an iframe could be approached by window[iframeIndex] // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak if (global.navigator && /^\d+/.test(key)) return false; // Opera and IE expose global variables for HTML element IDs (issue #243) if (/^mocha-/.test(key)) return false; var matched = filter(ok, function(ok){ if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]); return key == ok; }); return matched.length == 0 && (!global.navigator || 'onerror' !== key); }); } /** * Array of globals dependent on the environment. * * @return {Array} * @api private */ function extraGlobals() { if (typeof(process) === 'object' && typeof(process.version) === 'string') { var nodeVersion = process.version.split('.').reduce(function(a, v) { return a << 8 | v; }); // 'errno' was renamed to process._errno in v0.9.11. if (nodeVersion < 0x00090B) { return ['errno']; } } return []; } }); // module: runner.js require.register("suite.js", function(module, exports, require){ /** * Module dependencies. */ var EventEmitter = require('browser/events').EventEmitter , debug = require('browser/debug')('mocha:suite') , milliseconds = require('./ms') , utils = require('./utils') , Hook = require('./hook'); /** * Expose `Suite`. */ exports = module.exports = Suite; /** * Create a new `Suite` with the given `title` * and parent `Suite`. When a suite with the * same title is already present, that suite * is returned to provide nicer reporter * and more flexible meta-testing. * * @param {Suite} parent * @param {String} title * @return {Suite} * @api public */ exports.create = function(parent, title){ var suite = new Suite(title, parent.ctx); suite.parent = parent; if (parent.pending) suite.pending = true; title = suite.fullTitle(); parent.addSuite(suite); return suite; }; /** * Initialize a new `Suite` with the given * `title` and `ctx`. * * @param {String} title * @param {Context} ctx * @api private */ function Suite(title, parentContext) { this.title = title; var context = function() {}; context.prototype = parentContext; this.ctx = new context(); this.suites = []; this.tests = []; this.pending = false; this._beforeEach = []; this._beforeAll = []; this._afterEach = []; this._afterAll = []; this.root = !title; this._timeout = 2000; this._enableTimeouts = true; this._slow = 75; this._bail = false; } /** * Inherit from `EventEmitter.prototype`. */ function F(){}; F.prototype = EventEmitter.prototype; Suite.prototype = new F; Suite.prototype.constructor = Suite; /** * Return a clone of this `Suite`. * * @return {Suite} * @api private */ Suite.prototype.clone = function(){ var suite = new Suite(this.title); debug('clone'); suite.ctx = this.ctx; suite.timeout(this.timeout()); suite.enableTimeouts(this.enableTimeouts()); suite.slow(this.slow()); suite.bail(this.bail()); return suite; }; /** * Set timeout `ms` or short-hand such as "2s". * * @param {Number|String} ms * @return {Suite|Number} for chaining * @api private */ Suite.prototype.timeout = function(ms){ if (0 == arguments.length) return this._timeout; if (ms === 0) this._enableTimeouts = false; if ('string' == typeof ms) ms = milliseconds(ms); debug('timeout %d', ms); this._timeout = parseInt(ms, 10); return this; }; /** * Set timeout `enabled`. * * @param {Boolean} enabled * @return {Suite|Boolean} self or enabled * @api private */ Suite.prototype.enableTimeouts = function(enabled){ if (arguments.length === 0) return this._enableTimeouts; debug('enableTimeouts %s', enabled); this._enableTimeouts = enabled; return this; }; /** * Set slow `ms` or short-hand such as "2s". * * @param {Number|String} ms * @return {Suite|Number} for chaining * @api private */ Suite.prototype.slow = function(ms){ if (0 === arguments.length) return this._slow; if ('string' == typeof ms) ms = milliseconds(ms); debug('slow %d', ms); this._slow = ms; return this; }; /** * Sets whether to bail after first error. * * @parma {Boolean} bail * @return {Suite|Number} for chaining * @api private */ Suite.prototype.bail = function(bail){ if (0 == arguments.length) return this._bail; debug('bail %s', bail); this._bail = bail; return this; }; /** * Run `fn(test[, done])` before running tests. * * @param {Function} fn * @return {Suite} for chaining * @api private */ Suite.prototype.beforeAll = function(title, fn){ if (this.pending) return this; if ('function' === typeof title) { fn = title; title = fn.name; } title = '"before all" hook' + (title ? ': ' + title : ''); var hook = new Hook(title, fn); hook.parent = this; hook.timeout(this.timeout()); hook.enableTimeouts(this.enableTimeouts()); hook.slow(this.slow()); hook.ctx = this.ctx; this._beforeAll.push(hook); this.emit('beforeAll', hook); return this; }; /** * Run `fn(test[, done])` after running tests. * * @param {Function} fn * @return {Suite} for chaining * @api private */ Suite.prototype.afterAll = function(title, fn){ if (this.pending) return this; if ('function' === typeof title) { fn = title; title = fn.name; } title = '"after all" hook' + (title ? ': ' + title : ''); var hook = new Hook(title, fn); hook.parent = this; hook.timeout(this.timeout()); hook.enableTimeouts(this.enableTimeouts()); hook.slow(this.slow()); hook.ctx = this.ctx; this._afterAll.push(hook); this.emit('afterAll', hook); return this; }; /** * Run `fn(test[, done])` before each test case. * * @param {Function} fn * @return {Suite} for chaining * @api private */ Suite.prototype.beforeEach = function(title, fn){ if (this.pending) return this; if ('function' === typeof title) { fn = title; title = fn.name; } title = '"before each" hook' + (title ? ': ' + title : ''); var hook = new Hook(title, fn); hook.parent = this; hook.timeout(this.timeout()); hook.enableTimeouts(this.enableTimeouts()); hook.slow(this.slow()); hook.ctx = this.ctx; this._beforeEach.push(hook); this.emit('beforeEach', hook); return this; }; /** * Run `fn(test[, done])` after each test case. * * @param {Function} fn * @return {Suite} for chaining * @api private */ Suite.prototype.afterEach = function(title, fn){ if (this.pending) return this; if ('function' === typeof title) { fn = title; title = fn.name; } title = '"after each" hook' + (title ? ': ' + title : ''); var hook = new Hook(title, fn); hook.parent = this; hook.timeout(this.timeout()); hook.enableTimeouts(this.enableTimeouts()); hook.slow(this.slow()); hook.ctx = this.ctx; this._afterEach.push(hook); this.emit('afterEach', hook); return this; }; /** * Add a test `suite`. * * @param {Suite} suite * @return {Suite} for chaining * @api private */ Suite.prototype.addSuite = function(suite){ suite.parent = this; suite.timeout(this.timeout()); suite.enableTimeouts(this.enableTimeouts()); suite.slow(this.slow()); suite.bail(this.bail()); this.suites.push(suite); this.emit('suite', suite); return this; }; /** * Add a `test` to this suite. * * @param {Test} test * @return {Suite} for chaining * @api private */ Suite.prototype.addTest = function(test){ test.parent = this; test.timeout(this.timeout()); test.enableTimeouts(this.enableTimeouts()); test.slow(this.slow()); test.ctx = this.ctx; this.tests.push(test); this.emit('test', test); return this; }; /** * Return the full title generated by recursively * concatenating the parent's full title. * * @return {String} * @api public */ Suite.prototype.fullTitle = function(){ if (this.parent) { var full = this.parent.fullTitle(); if (full) return full + ' ' + this.title; } return this.title; }; /** * Return the total number of tests. * * @return {Number} * @api public */ Suite.prototype.total = function(){ return utils.reduce(this.suites, function(sum, suite){ return sum + suite.total(); }, 0) + this.tests.length; }; /** * Iterates through each suite recursively to find * all tests. Applies a function in the format * `fn(test)`. * * @param {Function} fn * @return {Suite} * @api private */ Suite.prototype.eachTest = function(fn){ utils.forEach(this.tests, fn); utils.forEach(this.suites, function(suite){ suite.eachTest(fn); }); return this; }; }); // module: suite.js require.register("test.js", function(module, exports, require){ /** * Module dependencies. */ var Runnable = require('./runnable'); /** * Expose `Test`. */ module.exports = Test; /** * Initialize a new `Test` with the given `title` and callback `fn`. * * @param {String} title * @param {Function} fn * @api private */ function Test(title, fn) { Runnable.call(this, title, fn); this.pending = !fn; this.type = 'test'; } /** * Inherit from `Runnable.prototype`. */ function F(){}; F.prototype = Runnable.prototype; Test.prototype = new F; Test.prototype.constructor = Test; }); // module: test.js require.register("utils.js", function(module, exports, require){ /** * Module dependencies. */ var fs = require('browser/fs') , path = require('browser/path') , basename = path.basename , exists = fs.existsSync || path.existsSync , glob = require('browser/glob') , join = path.join , debug = require('browser/debug')('mocha:watch'); /** * Ignored directories. */ var ignore = ['node_modules', '.git']; /** * Escape special characters in the given string of html. * * @param {String} html * @return {String} * @api private */ exports.escape = function(html){ return String(html) .replace(/&/g, '&amp;') .replace(/"/g, '&quot;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;'); }; /** * Array#forEach (<=IE8) * * @param {Array} array * @param {Function} fn * @param {Object} scope * @api private */ exports.forEach = function(arr, fn, scope){ for (var i = 0, l = arr.length; i < l; i++) fn.call(scope, arr[i], i); }; /** * Array#map (<=IE8) * * @param {Array} array * @param {Function} fn * @param {Object} scope * @api private */ exports.map = function(arr, fn, scope){ var result = []; for (var i = 0, l = arr.length; i < l; i++) result.push(fn.call(scope, arr[i], i)); return result; }; /** * Array#indexOf (<=IE8) * * @parma {Array} arr * @param {Object} obj to find index of * @param {Number} start * @api private */ exports.indexOf = function(arr, obj, start){ for (var i = start || 0, l = arr.length; i < l; i++) { if (arr[i] === obj) return i; } return -1; }; /** * Array#reduce (<=IE8) * * @param {Array} array * @param {Function} fn * @param {Object} initial value * @api private */ exports.reduce = function(arr, fn, val){ var rval = val; for (var i = 0, l = arr.length; i < l; i++) { rval = fn(rval, arr[i], i, arr); } return rval; }; /** * Array#filter (<=IE8) * * @param {Array} array * @param {Function} fn * @api private */ exports.filter = function(arr, fn){ var ret = []; for (var i = 0, l = arr.length; i < l; i++) { var val = arr[i]; if (fn(val, i, arr)) ret.push(val); } return ret; }; /** * Object.keys (<=IE8) * * @param {Object} obj * @return {Array} keys * @api private */ exports.keys = Object.keys || function(obj) { var keys = [] , has = Object.prototype.hasOwnProperty // for `window` on <=IE8 for (var key in obj) { if (has.call(obj, key)) { keys.push(key); } } return keys; }; /** * Watch the given `files` for changes * and invoke `fn(file)` on modification. * * @param {Array} files * @param {Function} fn * @api private */ exports.watch = function(files, fn){ var options = { interval: 100 }; files.forEach(function(file){ debug('file %s', file); fs.watchFile(file, options, function(curr, prev){ if (prev.mtime < curr.mtime) fn(file); }); }); }; /** * Ignored files. */ function ignored(path){ return !~ignore.indexOf(path); } /** * Lookup files in the given `dir`. * * @return {Array} * @api private */ exports.files = function(dir, ext, ret){ ret = ret || []; ext = ext || ['js']; var re = new RegExp('\\.(' + ext.join('|') + ')$'); fs.readdirSync(dir) .filter(ignored) .forEach(function(path){ path = join(dir, path); if (fs.statSync(path).isDirectory()) { exports.files(path, ext, ret); } else if (path.match(re)) { ret.push(path); } }); return ret; }; /** * Compute a slug from the given `str`. * * @param {String} str * @return {String} * @api private */ exports.slug = function(str){ return str .toLowerCase() .replace(/ +/g, '-') .replace(/[^-\w]/g, ''); }; /** * Strip the function definition from `str`, * and re-indent for pre whitespace. */ exports.clean = function(str) { str = str .replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, '') .replace(/^function *\(.*\) *{|\(.*\) *=> *{?/, '') .replace(/\s+\}$/, ''); var spaces = str.match(/^\n?( *)/)[1].length , tabs = str.match(/^\n?(\t*)/)[1].length , re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm'); str = str.replace(re, ''); return exports.trim(str); }; /** * Trim the given `str`. * * @param {String} str * @return {String} * @api private */ exports.trim = function(str){ return str.replace(/^\s+|\s+$/g, ''); }; /** * Parse the given `qs`. * * @param {String} qs * @return {Object} * @api private */ exports.parseQuery = function(qs){ return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair){ var i = pair.indexOf('=') , key = pair.slice(0, i) , val = pair.slice(++i); obj[key] = decodeURIComponent(val); return obj; }, {}); }; /** * Highlight the given string of `js`. * * @param {String} js * @return {String} * @api private */ function highlight(js) { return js .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>') .replace(/('.*?')/gm, '<span class="string">$1</span>') .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>') .replace(/(\d+)/gm, '<span class="number">$1</span>') .replace(/\bnew[ \t]+(\w+)/gm, '<span class="keyword">new</span> <span class="init">$1</span>') .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '<span class="keyword">$1</span>') } /** * Highlight the contents of tag `name`. * * @param {String} name * @api private */ exports.highlightTags = function(name) { var code = document.getElementById('mocha').getElementsByTagName(name); for (var i = 0, len = code.length; i < len; ++i) { code[i].innerHTML = highlight(code[i].innerHTML); } }; /** * Stringify `obj`. * * @param {Object} obj * @return {String} * @api private */ exports.stringify = function(obj) { if (obj instanceof RegExp) return obj.toString(); return JSON.stringify(exports.canonicalize(obj), null, 2).replace(/,(\n|$)/g, '$1'); }; /** * Return a new object that has the keys in sorted order. * @param {Object} obj * @param {Array} [stack] * @return {Object} * @api private */ exports.canonicalize = function(obj, stack) { stack = stack || []; if (exports.indexOf(stack, obj) !== -1) return '[Circular]'; var canonicalizedObj; if ({}.toString.call(obj) === '[object Array]') { stack.push(obj); canonicalizedObj = exports.map(obj, function (item) { return exports.canonicalize(item, stack); }); stack.pop(); } else if (typeof obj === 'object' && obj !== null) { stack.push(obj); canonicalizedObj = {}; exports.forEach(exports.keys(obj).sort(), function (key) { canonicalizedObj[key] = exports.canonicalize(obj[key], stack); }); stack.pop(); } else { canonicalizedObj = obj; } return canonicalizedObj; }; /** * Lookup file names at the given `path`. */ exports.lookupFiles = function lookupFiles(path, extensions, recursive) { var files = []; var re = new RegExp('\\.(' + extensions.join('|') + ')$'); if (!exists(path)) { if (exists(path + '.js')) { path += '.js'; } else { files = glob.sync(path); if (!files.length) throw new Error("cannot resolve path (or pattern) '" + path + "'"); return files; } } try { var stat = fs.statSync(path); if (stat.isFile()) return path; } catch (ignored) { return; } fs.readdirSync(path).forEach(function(file){ file = join(path, file); try { var stat = fs.statSync(file); if (stat.isDirectory()) { if (recursive) { files = files.concat(lookupFiles(file, extensions, recursive)); } return; } } catch (ignored) { return; } if (!stat.isFile() || !re.test(file) || basename(file)[0] === '.') return; files.push(file); }); return files; }; }); // module: utils.js // The global object is "self" in Web Workers. var global = (function() { return this; })(); /** * Save timer references to avoid Sinon interfering (see GH-237). */ var Date = global.Date; var setTimeout = global.setTimeout; var setInterval = global.setInterval; var clearTimeout = global.clearTimeout; var clearInterval = global.clearInterval; /** * Node shims. * * These are meant only to allow * mocha.js to run untouched, not * to allow running node code in * the browser. */ var process = {}; process.exit = function(status){}; process.stdout = {}; var uncaughtExceptionHandlers = []; var originalOnerrorHandler = global.onerror; /** * Remove uncaughtException listener. * Revert to original onerror handler if previously defined. */ process.removeListener = function(e, fn){ if ('uncaughtException' == e) { if (originalOnerrorHandler) { global.onerror = originalOnerrorHandler; } else { global.onerror = function() {}; } var i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn); if (i != -1) { uncaughtExceptionHandlers.splice(i, 1); } } }; /** * Implements uncaughtException listener. */ process.on = function(e, fn){ if ('uncaughtException' == e) { global.onerror = function(err, url, line){ fn(new Error(err + ' (' + url + ':' + line + ')')); return true; }; uncaughtExceptionHandlers.push(fn); } }; /** * Expose mocha. */ var Mocha = global.Mocha = require('mocha'), mocha = global.mocha = new Mocha({ reporter: 'html' }); // The BDD UI is registered by default, but no UI will be functional in the // browser without an explicit call to the overridden `mocha.ui` (see below). // Ensure that this default UI does not expose its methods to the global scope. mocha.suite.removeAllListeners('pre-require'); var immediateQueue = [] , immediateTimeout; function timeslice() { var immediateStart = new Date().getTime(); while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) { immediateQueue.shift()(); } if (immediateQueue.length) { immediateTimeout = setTimeout(timeslice, 0); } else { immediateTimeout = null; } } /** * High-performance override of Runner.immediately. */ Mocha.Runner.immediately = function(callback) { immediateQueue.push(callback); if (!immediateTimeout) { immediateTimeout = setTimeout(timeslice, 0); } }; /** * Function to allow assertion libraries to throw errors directly into mocha. * This is useful when running tests in a browser because window.onerror will * only receive the 'message' attribute of the Error. */ mocha.throwError = function(err) { Mocha.utils.forEach(uncaughtExceptionHandlers, function (fn) { fn(err); }); throw err; }; /** * Override ui to ensure that the ui functions are initialized. * Normally this would happen in Mocha.prototype.loadFiles. */ mocha.ui = function(ui){ Mocha.prototype.ui.call(this, ui); this.suite.emit('pre-require', global, null, this); return this; }; /** * Setup mocha with the given setting options. */ mocha.setup = function(opts){ if ('string' == typeof opts) opts = { ui: opts }; for (var opt in opts) this[opt](opts[opt]); return this; }; /** * Run mocha, returning the Runner. */ mocha.run = function(fn){ var options = mocha.options; mocha.globals('location'); var query = Mocha.utils.parseQuery(global.location.search || ''); if (query.grep) mocha.grep(query.grep); if (query.invert) mocha.invert(); return Mocha.prototype.run.call(mocha, function(err){ // The DOM Document is not available in Web Workers. var document = global.document; if (document && document.getElementById('mocha') && options.noHighlighting !== true) { Mocha.utils.highlightTags('code'); } if (fn) fn(err); }); }; /** * Expose the process shim. */ Mocha.process = process; })();
zhangbg/cdnjs
ajax/libs/mocha/1.21.5/mocha.js
JavaScript
mit
130,867
/* http://lesscss.org/ dark theme Ported to CodeMirror by Peter Kroon */ .cm-s-lesser-dark { line-height: 1.3em; } .cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; } .cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/ .cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; } .cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/ .cm-s-lesser-dark.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/ .cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; } .cm-s-lesser-dark .CodeMirror-linenumber { color: #777; } .cm-s-lesser-dark span.cm-keyword { color: #599eff; } .cm-s-lesser-dark span.cm-atom { color: #C2B470; } .cm-s-lesser-dark span.cm-number { color: #B35E4D; } .cm-s-lesser-dark span.cm-def {color: white;} .cm-s-lesser-dark span.cm-variable { color:#D9BF8C; } .cm-s-lesser-dark span.cm-variable-2 { color: #669199; } .cm-s-lesser-dark span.cm-variable-3 { color: white; } .cm-s-lesser-dark span.cm-property {color: #92A75C;} .cm-s-lesser-dark span.cm-operator {color: #92A75C;} .cm-s-lesser-dark span.cm-comment { color: #666; } .cm-s-lesser-dark span.cm-string { color: #BCD279; } .cm-s-lesser-dark span.cm-string-2 {color: #f50;} .cm-s-lesser-dark span.cm-meta { color: #738C73; } .cm-s-lesser-dark span.cm-qualifier {color: #555;} .cm-s-lesser-dark span.cm-builtin { color: #ff9e59; } .cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; } .cm-s-lesser-dark span.cm-tag { color: #669199; } .cm-s-lesser-dark span.cm-attribute {color: #00c;} .cm-s-lesser-dark span.cm-header {color: #a0a;} .cm-s-lesser-dark span.cm-quote {color: #090;} .cm-s-lesser-dark span.cm-hr {color: #999;} .cm-s-lesser-dark span.cm-link {color: #00c;} .cm-s-lesser-dark span.cm-error { color: #9d1e15; } .cm-s-lesser-dark .CodeMirror-activeline-background {background: #3C3A3A !important;} .cm-s-lesser-dark .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;}
boneskull/cdnjs
ajax/libs/codemirror/4.1.0/theme/lesser-dark.css
CSS
mit
2,061
/*! handlebars v1.3.0 Copyright (C) 2011 by Yehuda Katz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @license */ /* exported Handlebars */ var Handlebars = (function() { // handlebars/safe-string.js var __module4__ = (function() { "use strict"; var __exports__; // Build out our basic SafeString type function SafeString(string) { this.string = string; } SafeString.prototype.toString = function() { return "" + this.string; }; __exports__ = SafeString; return __exports__; })(); // handlebars/utils.js var __module3__ = (function(__dependency1__) { "use strict"; var __exports__ = {}; /*jshint -W004 */ var SafeString = __dependency1__; var escape = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" }; var badChars = /[&<>"'`]/g; var possible = /[&<>"'`]/; function escapeChar(chr) { return escape[chr] || "&amp;"; } function extend(obj, value) { for(var key in value) { if(Object.prototype.hasOwnProperty.call(value, key)) { obj[key] = value[key]; } } } __exports__.extend = extend;var toString = Object.prototype.toString; __exports__.toString = toString; // Sourced from lodash // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt var isFunction = function(value) { return typeof value === 'function'; }; // fallback for older versions of Chrome and Safari if (isFunction(/x/)) { isFunction = function(value) { return typeof value === 'function' && toString.call(value) === '[object Function]'; }; } var isFunction; __exports__.isFunction = isFunction; var isArray = Array.isArray || function(value) { return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false; }; __exports__.isArray = isArray; function escapeExpression(string) { // don't escape SafeStrings, since they're already safe if (string instanceof SafeString) { return string.toString(); } else if (!string && string !== 0) { return ""; } // Force a string conversion as this will be done by the append regardless and // the regex test will do this transparently behind the scenes, causing issues if // an object's to string has escaped characters in it. string = "" + string; if(!possible.test(string)) { return string; } return string.replace(badChars, escapeChar); } __exports__.escapeExpression = escapeExpression;function isEmpty(value) { if (!value && value !== 0) { return true; } else if (isArray(value) && value.length === 0) { return true; } else { return false; } } __exports__.isEmpty = isEmpty; return __exports__; })(__module4__); // handlebars/exception.js var __module5__ = (function() { "use strict"; var __exports__; var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; function Exception(message, node) { var line; if (node && node.firstLine) { line = node.firstLine; message += ' - ' + line + ':' + node.firstColumn; } var tmp = Error.prototype.constructor.call(this, message); // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work. for (var idx = 0; idx < errorProps.length; idx++) { this[errorProps[idx]] = tmp[errorProps[idx]]; } if (line) { this.lineNumber = line; this.column = node.firstColumn; } } Exception.prototype = new Error(); __exports__ = Exception; return __exports__; })(); // handlebars/base.js var __module2__ = (function(__dependency1__, __dependency2__) { "use strict"; var __exports__ = {}; var Utils = __dependency1__; var Exception = __dependency2__; var VERSION = "1.3.0"; __exports__.VERSION = VERSION;var COMPILER_REVISION = 4; __exports__.COMPILER_REVISION = COMPILER_REVISION; var REVISION_CHANGES = { 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it 2: '== 1.0.0-rc.3', 3: '== 1.0.0-rc.4', 4: '>= 1.0.0' }; __exports__.REVISION_CHANGES = REVISION_CHANGES; var isArray = Utils.isArray, isFunction = Utils.isFunction, toString = Utils.toString, objectType = '[object Object]'; function HandlebarsEnvironment(helpers, partials) { this.helpers = helpers || {}; this.partials = partials || {}; registerDefaultHelpers(this); } __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = { constructor: HandlebarsEnvironment, logger: logger, log: log, registerHelper: function(name, fn, inverse) { if (toString.call(name) === objectType) { if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); } Utils.extend(this.helpers, name); } else { if (inverse) { fn.not = inverse; } this.helpers[name] = fn; } }, registerPartial: function(name, str) { if (toString.call(name) === objectType) { Utils.extend(this.partials, name); } else { this.partials[name] = str; } } }; function registerDefaultHelpers(instance) { instance.registerHelper('helperMissing', function(arg) { if(arguments.length === 2) { return undefined; } else { throw new Exception("Missing helper: '" + arg + "'"); } }); instance.registerHelper('blockHelperMissing', function(context, options) { var inverse = options.inverse || function() {}, fn = options.fn; if (isFunction(context)) { context = context.call(this); } if(context === true) { return fn(this); } else if(context === false || context == null) { return inverse(this); } else if (isArray(context)) { if(context.length > 0) { return instance.helpers.each(context, options); } else { return inverse(this); } } else { return fn(context); } }); instance.registerHelper('each', function(context, options) { var fn = options.fn, inverse = options.inverse; var i = 0, ret = "", data; if (isFunction(context)) { context = context.call(this); } if (options.data) { data = createFrame(options.data); } if(context && typeof context === 'object') { if (isArray(context)) { for(var j = context.length; i<j; i++) { if (data) { data.index = i; data.first = (i === 0); data.last = (i === (context.length-1)); } ret = ret + fn(context[i], { data: data }); } } else { for(var key in context) { if(context.hasOwnProperty(key)) { if(data) { data.key = key; data.index = i; data.first = (i === 0); } ret = ret + fn(context[key], {data: data}); i++; } } } } if(i === 0){ ret = inverse(this); } return ret; }); instance.registerHelper('if', function(conditional, options) { if (isFunction(conditional)) { conditional = conditional.call(this); } // Default behavior is to render the positive path if the value is truthy and not empty. // The `includeZero` option may be set to treat the condtional as purely not empty based on the // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative. if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) { return options.inverse(this); } else { return options.fn(this); } }); instance.registerHelper('unless', function(conditional, options) { return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash}); }); instance.registerHelper('with', function(context, options) { if (isFunction(context)) { context = context.call(this); } if (!Utils.isEmpty(context)) return options.fn(context); }); instance.registerHelper('log', function(context, options) { var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1; instance.log(level, context); }); } var logger = { methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' }, // State enum DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, level: 3, // can be overridden in the host environment log: function(level, obj) { if (logger.level <= level) { var method = logger.methodMap[level]; if (typeof console !== 'undefined' && console[method]) { console[method].call(console, obj); } } } }; __exports__.logger = logger; function log(level, obj) { logger.log(level, obj); } __exports__.log = log;var createFrame = function(object) { var obj = {}; Utils.extend(obj, object); return obj; }; __exports__.createFrame = createFrame; return __exports__; })(__module3__, __module5__); // handlebars/runtime.js var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) { "use strict"; var __exports__ = {}; var Utils = __dependency1__; var Exception = __dependency2__; var COMPILER_REVISION = __dependency3__.COMPILER_REVISION; var REVISION_CHANGES = __dependency3__.REVISION_CHANGES; function checkRevision(compilerInfo) { var compilerRevision = compilerInfo && compilerInfo[0] || 1, currentRevision = COMPILER_REVISION; if (compilerRevision !== currentRevision) { if (compilerRevision < currentRevision) { var runtimeVersions = REVISION_CHANGES[currentRevision], compilerVersions = REVISION_CHANGES[compilerRevision]; throw new Exception("Template was precompiled with an older version of Handlebars than the current runtime. "+ "Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+")."); } else { // Use the embedded version info since the runtime doesn't know about this revision yet throw new Exception("Template was precompiled with a newer version of Handlebars than the current runtime. "+ "Please update your runtime to a newer version ("+compilerInfo[1]+")."); } } } __exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial function template(templateSpec, env) { if (!env) { throw new Exception("No environment passed to template"); } // Note: Using env.VM references rather than local var references throughout this section to allow // for external users to override these as psuedo-supported APIs. var invokePartialWrapper = function(partial, name, context, helpers, partials, data) { var result = env.VM.invokePartial.apply(this, arguments); if (result != null) { return result; } if (env.compile) { var options = { helpers: helpers, partials: partials, data: data }; partials[name] = env.compile(partial, { data: data !== undefined }, env); return partials[name](context, options); } else { throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode"); } }; // Just add water var container = { escapeExpression: Utils.escapeExpression, invokePartial: invokePartialWrapper, programs: [], program: function(i, fn, data) { var programWrapper = this.programs[i]; if(data) { programWrapper = program(i, fn, data); } else if (!programWrapper) { programWrapper = this.programs[i] = program(i, fn); } return programWrapper; }, merge: function(param, common) { var ret = param || common; if (param && common && (param !== common)) { ret = {}; Utils.extend(ret, common); Utils.extend(ret, param); } return ret; }, programWithDepth: env.VM.programWithDepth, noop: env.VM.noop, compilerInfo: null }; return function(context, options) { options = options || {}; var namespace = options.partial ? options : env, helpers, partials; if (!options.partial) { helpers = options.helpers; partials = options.partials; } var result = templateSpec.call( container, namespace, context, helpers, partials, options.data); if (!options.partial) { env.VM.checkRevision(container.compilerInfo); } return result; }; } __exports__.template = template;function programWithDepth(i, fn, data /*, $depth */) { var args = Array.prototype.slice.call(arguments, 3); var prog = function(context, options) { options = options || {}; return fn.apply(this, [context, options.data || data].concat(args)); }; prog.program = i; prog.depth = args.length; return prog; } __exports__.programWithDepth = programWithDepth;function program(i, fn, data) { var prog = function(context, options) { options = options || {}; return fn(context, options.data || data); }; prog.program = i; prog.depth = 0; return prog; } __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data) { var options = { partial: true, helpers: helpers, partials: partials, data: data }; if(partial === undefined) { throw new Exception("The partial " + name + " could not be found"); } else if(partial instanceof Function) { return partial(context, options); } } __exports__.invokePartial = invokePartial;function noop() { return ""; } __exports__.noop = noop; return __exports__; })(__module3__, __module5__, __module2__); // handlebars.runtime.js var __module1__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) { "use strict"; var __exports__; /*globals Handlebars: true */ var base = __dependency1__; // Each of these augment the Handlebars object. No need to setup here. // (This is done to easily share code between commonjs and browse envs) var SafeString = __dependency2__; var Exception = __dependency3__; var Utils = __dependency4__; var runtime = __dependency5__; // For compatibility and usage outside of module systems, make the Handlebars object a namespace var create = function() { var hb = new base.HandlebarsEnvironment(); Utils.extend(hb, base); hb.SafeString = SafeString; hb.Exception = Exception; hb.Utils = Utils; hb.VM = runtime; hb.template = function(spec) { return runtime.template(spec, hb); }; return hb; }; var Handlebars = create(); Handlebars.create = create; __exports__ = Handlebars; return __exports__; })(__module2__, __module4__, __module5__, __module3__, __module6__); // handlebars/compiler/ast.js var __module7__ = (function(__dependency1__) { "use strict"; var __exports__; var Exception = __dependency1__; function LocationInfo(locInfo){ locInfo = locInfo || {}; this.firstLine = locInfo.first_line; this.firstColumn = locInfo.first_column; this.lastColumn = locInfo.last_column; this.lastLine = locInfo.last_line; } var AST = { ProgramNode: function(statements, inverseStrip, inverse, locInfo) { var inverseLocationInfo, firstInverseNode; if (arguments.length === 3) { locInfo = inverse; inverse = null; } else if (arguments.length === 2) { locInfo = inverseStrip; inverseStrip = null; } LocationInfo.call(this, locInfo); this.type = "program"; this.statements = statements; this.strip = {}; if(inverse) { firstInverseNode = inverse[0]; if (firstInverseNode) { inverseLocationInfo = { first_line: firstInverseNode.firstLine, last_line: firstInverseNode.lastLine, last_column: firstInverseNode.lastColumn, first_column: firstInverseNode.firstColumn }; this.inverse = new AST.ProgramNode(inverse, inverseStrip, inverseLocationInfo); } else { this.inverse = new AST.ProgramNode(inverse, inverseStrip); } this.strip.right = inverseStrip.left; } else if (inverseStrip) { this.strip.left = inverseStrip.right; } }, MustacheNode: function(rawParams, hash, open, strip, locInfo) { LocationInfo.call(this, locInfo); this.type = "mustache"; this.strip = strip; // Open may be a string parsed from the parser or a passed boolean flag if (open != null && open.charAt) { // Must use charAt to support IE pre-10 var escapeFlag = open.charAt(3) || open.charAt(2); this.escaped = escapeFlag !== '{' && escapeFlag !== '&'; } else { this.escaped = !!open; } if (rawParams instanceof AST.SexprNode) { this.sexpr = rawParams; } else { // Support old AST API this.sexpr = new AST.SexprNode(rawParams, hash); } this.sexpr.isRoot = true; // Support old AST API that stored this info in MustacheNode this.id = this.sexpr.id; this.params = this.sexpr.params; this.hash = this.sexpr.hash; this.eligibleHelper = this.sexpr.eligibleHelper; this.isHelper = this.sexpr.isHelper; }, SexprNode: function(rawParams, hash, locInfo) { LocationInfo.call(this, locInfo); this.type = "sexpr"; this.hash = hash; var id = this.id = rawParams[0]; var params = this.params = rawParams.slice(1); // a mustache is an eligible helper if: // * its id is simple (a single part, not `this` or `..`) var eligibleHelper = this.eligibleHelper = id.isSimple; // a mustache is definitely a helper if: // * it is an eligible helper, and // * it has at least one parameter or hash segment this.isHelper = eligibleHelper && (params.length || hash); // if a mustache is an eligible helper but not a definite // helper, it is ambiguous, and will be resolved in a later // pass or at runtime. }, PartialNode: function(partialName, context, strip, locInfo) { LocationInfo.call(this, locInfo); this.type = "partial"; this.partialName = partialName; this.context = context; this.strip = strip; }, BlockNode: function(mustache, program, inverse, close, locInfo) { LocationInfo.call(this, locInfo); if(mustache.sexpr.id.original !== close.path.original) { throw new Exception(mustache.sexpr.id.original + " doesn't match " + close.path.original, this); } this.type = 'block'; this.mustache = mustache; this.program = program; this.inverse = inverse; this.strip = { left: mustache.strip.left, right: close.strip.right }; (program || inverse).strip.left = mustache.strip.right; (inverse || program).strip.right = close.strip.left; if (inverse && !program) { this.isInverse = true; } }, ContentNode: function(string, locInfo) { LocationInfo.call(this, locInfo); this.type = "content"; this.string = string; }, HashNode: function(pairs, locInfo) { LocationInfo.call(this, locInfo); this.type = "hash"; this.pairs = pairs; }, IdNode: function(parts, locInfo) { LocationInfo.call(this, locInfo); this.type = "ID"; var original = "", dig = [], depth = 0; for(var i=0,l=parts.length; i<l; i++) { var part = parts[i].part; original += (parts[i].separator || '') + part; if (part === ".." || part === "." || part === "this") { if (dig.length > 0) { throw new Exception("Invalid path: " + original, this); } else if (part === "..") { depth++; } else { this.isScoped = true; } } else { dig.push(part); } } this.original = original; this.parts = dig; this.string = dig.join('.'); this.depth = depth; // an ID is simple if it only has one part, and that part is not // `..` or `this`. this.isSimple = parts.length === 1 && !this.isScoped && depth === 0; this.stringModeValue = this.string; }, PartialNameNode: function(name, locInfo) { LocationInfo.call(this, locInfo); this.type = "PARTIAL_NAME"; this.name = name.original; }, DataNode: function(id, locInfo) { LocationInfo.call(this, locInfo); this.type = "DATA"; this.id = id; }, StringNode: function(string, locInfo) { LocationInfo.call(this, locInfo); this.type = "STRING"; this.original = this.string = this.stringModeValue = string; }, IntegerNode: function(integer, locInfo) { LocationInfo.call(this, locInfo); this.type = "INTEGER"; this.original = this.integer = integer; this.stringModeValue = Number(integer); }, BooleanNode: function(bool, locInfo) { LocationInfo.call(this, locInfo); this.type = "BOOLEAN"; this.bool = bool; this.stringModeValue = bool === "true"; }, CommentNode: function(comment, locInfo) { LocationInfo.call(this, locInfo); this.type = "comment"; this.comment = comment; } }; // Must be exported as an object rather than the root of the module as the jison lexer // most modify the object to operate properly. __exports__ = AST; return __exports__; })(__module5__); // handlebars/compiler/parser.js var __module9__ = (function() { "use strict"; var __exports__; /* jshint ignore:start */ /* Jison generated parser */ var handlebars = (function(){ var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"root":3,"statements":4,"EOF":5,"program":6,"simpleInverse":7,"statement":8,"openInverse":9,"closeBlock":10,"openBlock":11,"mustache":12,"partial":13,"CONTENT":14,"COMMENT":15,"OPEN_BLOCK":16,"sexpr":17,"CLOSE":18,"OPEN_INVERSE":19,"OPEN_ENDBLOCK":20,"path":21,"OPEN":22,"OPEN_UNESCAPED":23,"CLOSE_UNESCAPED":24,"OPEN_PARTIAL":25,"partialName":26,"partial_option0":27,"sexpr_repetition0":28,"sexpr_option0":29,"dataName":30,"param":31,"STRING":32,"INTEGER":33,"BOOLEAN":34,"OPEN_SEXPR":35,"CLOSE_SEXPR":36,"hash":37,"hash_repetition_plus0":38,"hashSegment":39,"ID":40,"EQUALS":41,"DATA":42,"pathSegments":43,"SEP":44,"$accept":0,"$end":1}, terminals_: {2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",35:"OPEN_SEXPR",36:"CLOSE_SEXPR",40:"ID",41:"EQUALS",42:"DATA",44:"SEP"}, productions_: [0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[37,1],[39,3],[26,1],[26,1],[26,1],[30,2],[21,1],[43,3],[43,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[38,1],[38,2]], performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { var $0 = $$.length - 1; switch (yystate) { case 1: return new yy.ProgramNode($$[$0-1], this._$); break; case 2: return new yy.ProgramNode([], this._$); break; case 3:this.$ = new yy.ProgramNode([], $$[$0-1], $$[$0], this._$); break; case 4:this.$ = new yy.ProgramNode($$[$0-2], $$[$0-1], $$[$0], this._$); break; case 5:this.$ = new yy.ProgramNode($$[$0-1], $$[$0], [], this._$); break; case 6:this.$ = new yy.ProgramNode($$[$0], this._$); break; case 7:this.$ = new yy.ProgramNode([], this._$); break; case 8:this.$ = new yy.ProgramNode([], this._$); break; case 9:this.$ = [$$[$0]]; break; case 10: $$[$0-1].push($$[$0]); this.$ = $$[$0-1]; break; case 11:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1].inverse, $$[$0-1], $$[$0], this._$); break; case 12:this.$ = new yy.BlockNode($$[$0-2], $$[$0-1], $$[$0-1].inverse, $$[$0], this._$); break; case 13:this.$ = $$[$0]; break; case 14:this.$ = $$[$0]; break; case 15:this.$ = new yy.ContentNode($$[$0], this._$); break; case 16:this.$ = new yy.CommentNode($$[$0], this._$); break; case 17:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); break; case 18:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); break; case 19:this.$ = {path: $$[$0-1], strip: stripFlags($$[$0-2], $$[$0])}; break; case 20:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); break; case 21:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], stripFlags($$[$0-2], $$[$0]), this._$); break; case 22:this.$ = new yy.PartialNode($$[$0-2], $$[$0-1], stripFlags($$[$0-3], $$[$0]), this._$); break; case 23:this.$ = stripFlags($$[$0-1], $$[$0]); break; case 24:this.$ = new yy.SexprNode([$$[$0-2]].concat($$[$0-1]), $$[$0], this._$); break; case 25:this.$ = new yy.SexprNode([$$[$0]], null, this._$); break; case 26:this.$ = $$[$0]; break; case 27:this.$ = new yy.StringNode($$[$0], this._$); break; case 28:this.$ = new yy.IntegerNode($$[$0], this._$); break; case 29:this.$ = new yy.BooleanNode($$[$0], this._$); break; case 30:this.$ = $$[$0]; break; case 31:$$[$0-1].isHelper = true; this.$ = $$[$0-1]; break; case 32:this.$ = new yy.HashNode($$[$0], this._$); break; case 33:this.$ = [$$[$0-2], $$[$0]]; break; case 34:this.$ = new yy.PartialNameNode($$[$0], this._$); break; case 35:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0], this._$), this._$); break; case 36:this.$ = new yy.PartialNameNode(new yy.IntegerNode($$[$0], this._$)); break; case 37:this.$ = new yy.DataNode($$[$0], this._$); break; case 38:this.$ = new yy.IdNode($$[$0], this._$); break; case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2]; break; case 40:this.$ = [{part: $$[$0]}]; break; case 43:this.$ = []; break; case 44:$$[$0-1].push($$[$0]); break; case 47:this.$ = [$$[$0]]; break; case 48:$$[$0-1].push($$[$0]); break; } }, table: [{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:29,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:30,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:31,21:24,30:25,40:[1,28],42:[1,27],43:26},{21:33,26:32,32:[1,34],33:[1,35],40:[1,28],43:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,40:[1,28],42:[1,27],43:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,43],24:[2,43],28:43,32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],42:[2,43]},{18:[2,25],24:[2,25],36:[2,25]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],42:[2,38],44:[1,44]},{21:45,40:[1,28],43:26},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],42:[2,40],44:[2,40]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,41],21:50,27:49,40:[1,28],43:26},{18:[2,34],40:[2,34]},{18:[2,35],40:[2,35]},{18:[2,36],40:[2,36]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,40:[1,28],43:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,45],21:56,24:[2,45],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:[1,61],36:[2,45],37:55,38:62,39:63,40:[1,64],42:[1,27],43:26},{40:[1,65]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],42:[2,37]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,66]},{18:[2,42]},{18:[1,67]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24],36:[2,24]},{18:[2,44],24:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],42:[2,44]},{18:[2,46],24:[2,46],36:[2,46]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],35:[2,26],36:[2,26],40:[2,26],42:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],35:[2,27],36:[2,27],40:[2,27],42:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],35:[2,28],36:[2,28],40:[2,28],42:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],35:[2,29],36:[2,29],40:[2,29],42:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],42:[2,30]},{17:68,21:24,30:25,40:[1,28],42:[1,27],43:26},{18:[2,32],24:[2,32],36:[2,32],39:69,40:[1,70]},{18:[2,47],24:[2,47],36:[2,47],40:[2,47]},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[1,71],42:[2,40],44:[2,40]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],42:[2,39],44:[2,39]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{36:[1,72]},{18:[2,48],24:[2,48],36:[2,48],40:[2,48]},{41:[1,71]},{21:56,30:60,31:73,32:[1,57],33:[1,58],34:[1,59],35:[1,61],40:[1,28],42:[1,27],43:26},{18:[2,31],24:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],42:[2,31]},{18:[2,33],24:[2,33],36:[2,33],40:[2,33]}], defaultActions: {3:[2,2],16:[2,1],50:[2,42]}, parseError: function parseError(str, hash) { throw new Error(str); }, parse: function parse(input) { var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; this.lexer.setInput(input); this.lexer.yy = this.yy; this.yy.lexer = this.lexer; this.yy.parser = this; if (typeof this.lexer.yylloc == "undefined") this.lexer.yylloc = {}; var yyloc = this.lexer.yylloc; lstack.push(yyloc); var ranges = this.lexer.options && this.lexer.options.ranges; if (typeof this.yy.parseError === "function") this.parseError = this.yy.parseError; function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } function lex() { var token; token = self.lexer.lex() || 1; if (typeof token !== "number") { token = self.symbols_[token] || token; } return token; } var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol == "undefined") { symbol = lex(); } action = table[state] && table[state][symbol]; } if (typeof action === "undefined" || !action.length || !action[0]) { var errStr = ""; if (!recovering) { expected = []; for (p in table[state]) if (this.terminals_[p] && p > 2) { expected.push("'" + this.terminals_[p] + "'"); } if (this.lexer.showPosition) { errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; } else { errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); } this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); } } if (action[0] instanceof Array && action.length > 1) { throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); } switch (action[0]) { case 1: stack.push(symbol); vstack.push(this.lexer.yytext); lstack.push(this.lexer.yylloc); stack.push(action[1]); symbol = null; if (!preErrorSymbol) { yyleng = this.lexer.yyleng; yytext = this.lexer.yytext; yylineno = this.lexer.yylineno; yyloc = this.lexer.yylloc; if (recovering > 0) recovering--; } else { symbol = preErrorSymbol; preErrorSymbol = null; } break; case 2: len = this.productions_[action[1]][1]; yyval.$ = vstack[vstack.length - len]; yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column}; if (ranges) { yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; } r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); if (typeof r !== "undefined") { return r; } if (len) { stack = stack.slice(0, -1 * len * 2); vstack = vstack.slice(0, -1 * len); lstack = lstack.slice(0, -1 * len); } stack.push(this.productions_[action[1]][0]); vstack.push(yyval.$); lstack.push(yyval._$); newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); break; case 3: return true; } } return true; } }; function stripFlags(open, close) { return { left: open.charAt(2) === '~', right: close.charAt(0) === '~' || close.charAt(1) === '~' }; } /* Jison generated lexer */ var lexer = (function(){ var lexer = ({EOF:1, parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); } else { throw new Error(str); } }, setInput:function (input) { this._input = input; this._more = this._less = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0}; if (this.options.ranges) this.yylloc.range = [0,0]; this.offset = 0; return this; }, input:function () { var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; } else { this.yylloc.last_column++; } if (this.options.ranges) this.yylloc.range[1]++; this._input = this._input.slice(1); return ch; }, unput:function (ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length-len-1); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length-1); this.matched = this.matched.substr(0, this.matched.length-1); if (lines.length-1) this.yylineno -= lines.length-1; var r = this.yylloc.range; this.yylloc = {first_line: this.yylloc.first_line, last_line: this.yylineno+1, first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length: this.yylloc.first_column - len }; if (this.options.ranges) { this.yylloc.range = [r[0], r[0] + this.yyleng - len]; } return this; }, more:function () { this._more = true; return this; }, less:function (n) { this.unput(this.match.slice(n)); }, pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, upcomingInput:function () { var next = this.match; if (next.length < 20) { next += this._input.substr(0, 20-next.length); } return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); }, showPosition:function () { var pre = this.pastInput(); var c = new Array(pre.length + 1).join("-"); return pre + this.upcomingInput() + "\n" + c+"^"; }, next:function () { if (this.done) { return this.EOF; } if (!this._input) this.done = true; var token, match, tempMatch, index, col, lines; if (!this._more) { this.yytext = ''; this.match = ''; } var rules = this._currentRules(); for (var i=0;i < rules.length; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (!this.options.flex) break; } } if (match) { lines = match[0].match(/(?:\r\n?|\n).*/g); if (lines) this.yylineno += lines.length; this.yylloc = {first_line: this.yylloc.last_line, last_line: this.yylineno+1, first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length}; this.yytext += match[0]; this.match += match[0]; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset += this.yyleng]; } this._more = false; this._input = this._input.slice(match[0].length); this.matched += match[0]; token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]); if (this.done && this._input) this.done = false; if (token) return token; else return; } if (this._input === "") { return this.EOF; } else { return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), {text: "", token: null, line: this.yylineno}); } }, lex:function lex() { var r = this.next(); if (typeof r !== 'undefined') { return r; } else { return this.lex(); } }, begin:function begin(condition) { this.conditionStack.push(condition); }, popState:function popState() { return this.conditionStack.pop(); }, _currentRules:function _currentRules() { return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; }, topState:function () { return this.conditionStack[this.conditionStack.length-2]; }, pushState:function begin(condition) { this.begin(condition); }}); lexer.options = {}; lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { function strip(start, end) { return yy_.yytext = yy_.yytext.substr(start, yy_.yyleng-end); } var YYSTATE=YY_START switch($avoiding_name_collisions) { case 0: if(yy_.yytext.slice(-2) === "\\\\") { strip(0,1); this.begin("mu"); } else if(yy_.yytext.slice(-1) === "\\") { strip(0,1); this.begin("emu"); } else { this.begin("mu"); } if(yy_.yytext) return 14; break; case 1:return 14; break; case 2: this.popState(); return 14; break; case 3:strip(0,4); this.popState(); return 15; break; case 4:return 35; break; case 5:return 36; break; case 6:return 25; break; case 7:return 16; break; case 8:return 20; break; case 9:return 19; break; case 10:return 19; break; case 11:return 23; break; case 12:return 22; break; case 13:this.popState(); this.begin('com'); break; case 14:strip(3,5); this.popState(); return 15; break; case 15:return 22; break; case 16:return 41; break; case 17:return 40; break; case 18:return 40; break; case 19:return 44; break; case 20:// ignore whitespace break; case 21:this.popState(); return 24; break; case 22:this.popState(); return 18; break; case 23:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 32; break; case 24:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 32; break; case 25:return 42; break; case 26:return 34; break; case 27:return 34; break; case 28:return 33; break; case 29:return 40; break; case 30:yy_.yytext = strip(1,2); return 40; break; case 31:return 'INVALID'; break; case 32:return 5; break; } }; lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/]; lexer.conditions = {"mu":{"rules":[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[3],"inclusive":false},"INITIAL":{"rules":[0,1,32],"inclusive":true}}; return lexer;})() parser.lexer = lexer; function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; return new Parser; })();__exports__ = handlebars; /* jshint ignore:end */ return __exports__; })(); // handlebars/compiler/base.js var __module8__ = (function(__dependency1__, __dependency2__) { "use strict"; var __exports__ = {}; var parser = __dependency1__; var AST = __dependency2__; __exports__.parser = parser; function parse(input) { // Just return if an already-compile AST was passed in. if(input.constructor === AST.ProgramNode) { return input; } parser.yy = AST; return parser.parse(input); } __exports__.parse = parse; return __exports__; })(__module9__, __module7__); // handlebars/compiler/compiler.js var __module10__ = (function(__dependency1__) { "use strict"; var __exports__ = {}; var Exception = __dependency1__; function Compiler() {} __exports__.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a // function in a context. This is necessary for mustache compatibility, which // requires that context functions in blocks are evaluated by blockHelperMissing, // and then proceed as if the resulting value was provided to blockHelperMissing. Compiler.prototype = { compiler: Compiler, disassemble: function() { var opcodes = this.opcodes, opcode, out = [], params, param; for (var i=0, l=opcodes.length; i<l; i++) { opcode = opcodes[i]; if (opcode.opcode === 'DECLARE') { out.push("DECLARE " + opcode.name + "=" + opcode.value); } else { params = []; for (var j=0; j<opcode.args.length; j++) { param = opcode.args[j]; if (typeof param === "string") { param = "\"" + param.replace("\n", "\\n") + "\""; } params.push(param); } out.push(opcode.opcode + " " + params.join(" ")); } } return out.join("\n"); }, equals: function(other) { var len = this.opcodes.length; if (other.opcodes.length !== len) { return false; } for (var i = 0; i < len; i++) { var opcode = this.opcodes[i], otherOpcode = other.opcodes[i]; if (opcode.opcode !== otherOpcode.opcode || opcode.args.length !== otherOpcode.args.length) { return false; } for (var j = 0; j < opcode.args.length; j++) { if (opcode.args[j] !== otherOpcode.args[j]) { return false; } } } len = this.children.length; if (other.children.length !== len) { return false; } for (i = 0; i < len; i++) { if (!this.children[i].equals(other.children[i])) { return false; } } return true; }, guid: 0, compile: function(program, options) { this.opcodes = []; this.children = []; this.depths = {list: []}; this.options = options; // These changes will propagate to the other compiler components var knownHelpers = this.options.knownHelpers; this.options.knownHelpers = { 'helperMissing': true, 'blockHelperMissing': true, 'each': true, 'if': true, 'unless': true, 'with': true, 'log': true }; if (knownHelpers) { for (var name in knownHelpers) { this.options.knownHelpers[name] = knownHelpers[name]; } } return this.accept(program); }, accept: function(node) { var strip = node.strip || {}, ret; if (strip.left) { this.opcode('strip'); } ret = this[node.type](node); if (strip.right) { this.opcode('strip'); } return ret; }, program: function(program) { var statements = program.statements; for(var i=0, l=statements.length; i<l; i++) { this.accept(statements[i]); } this.isSimple = l === 1; this.depths.list = this.depths.list.sort(function(a, b) { return a - b; }); return this; }, compileProgram: function(program) { var result = new this.compiler().compile(program, this.options); var guid = this.guid++, depth; this.usePartial = this.usePartial || result.usePartial; this.children[guid] = result; for(var i=0, l=result.depths.list.length; i<l; i++) { depth = result.depths.list[i]; if(depth < 2) { continue; } else { this.addDepth(depth - 1); } } return guid; }, block: function(block) { var mustache = block.mustache, program = block.program, inverse = block.inverse; if (program) { program = this.compileProgram(program); } if (inverse) { inverse = this.compileProgram(inverse); } var sexpr = mustache.sexpr; var type = this.classifySexpr(sexpr); if (type === "helper") { this.helperSexpr(sexpr, program, inverse); } else if (type === "simple") { this.simpleSexpr(sexpr); // now that the simple mustache is resolved, we need to // evaluate it by executing `blockHelperMissing` this.opcode('pushProgram', program); this.opcode('pushProgram', inverse); this.opcode('emptyHash'); this.opcode('blockValue'); } else { this.ambiguousSexpr(sexpr, program, inverse); // now that the simple mustache is resolved, we need to // evaluate it by executing `blockHelperMissing` this.opcode('pushProgram', program); this.opcode('pushProgram', inverse); this.opcode('emptyHash'); this.opcode('ambiguousBlockValue'); } this.opcode('append'); }, hash: function(hash) { var pairs = hash.pairs, pair, val; this.opcode('pushHash'); for(var i=0, l=pairs.length; i<l; i++) { pair = pairs[i]; val = pair[1]; if (this.options.stringParams) { if(val.depth) { this.addDepth(val.depth); } this.opcode('getContext', val.depth || 0); this.opcode('pushStringParam', val.stringModeValue, val.type); if (val.type === 'sexpr') { // Subexpressions get evaluated and passed in // in string params mode. this.sexpr(val); } } else { this.accept(val); } this.opcode('assignToHash', pair[0]); } this.opcode('popHash'); }, partial: function(partial) { var partialName = partial.partialName; this.usePartial = true; if(partial.context) { this.ID(partial.context); } else { this.opcode('push', 'depth0'); } this.opcode('invokePartial', partialName.name); this.opcode('append'); }, content: function(content) { this.opcode('appendContent', content.string); }, mustache: function(mustache) { this.sexpr(mustache.sexpr); if(mustache.escaped && !this.options.noEscape) { this.opcode('appendEscaped'); } else { this.opcode('append'); } }, ambiguousSexpr: function(sexpr, program, inverse) { var id = sexpr.id, name = id.parts[0], isBlock = program != null || inverse != null; this.opcode('getContext', id.depth); this.opcode('pushProgram', program); this.opcode('pushProgram', inverse); this.opcode('invokeAmbiguous', name, isBlock); }, simpleSexpr: function(sexpr) { var id = sexpr.id; if (id.type === 'DATA') { this.DATA(id); } else if (id.parts.length) { this.ID(id); } else { // Simplified ID for `this` this.addDepth(id.depth); this.opcode('getContext', id.depth); this.opcode('pushContext'); } this.opcode('resolvePossibleLambda'); }, helperSexpr: function(sexpr, program, inverse) { var params = this.setupFullMustacheParams(sexpr, program, inverse), name = sexpr.id.parts[0]; if (this.options.knownHelpers[name]) { this.opcode('invokeKnownHelper', params.length, name); } else if (this.options.knownHelpersOnly) { throw new Exception("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr); } else { this.opcode('invokeHelper', params.length, name, sexpr.isRoot); } }, sexpr: function(sexpr) { var type = this.classifySexpr(sexpr); if (type === "simple") { this.simpleSexpr(sexpr); } else if (type === "helper") { this.helperSexpr(sexpr); } else { this.ambiguousSexpr(sexpr); } }, ID: function(id) { this.addDepth(id.depth); this.opcode('getContext', id.depth); var name = id.parts[0]; if (!name) { this.opcode('pushContext'); } else { this.opcode('lookupOnContext', id.parts[0]); } for(var i=1, l=id.parts.length; i<l; i++) { this.opcode('lookup', id.parts[i]); } }, DATA: function(data) { this.options.data = true; if (data.id.isScoped || data.id.depth) { throw new Exception('Scoped data references are not supported: ' + data.original, data); } this.opcode('lookupData'); var parts = data.id.parts; for(var i=0, l=parts.length; i<l; i++) { this.opcode('lookup', parts[i]); } }, STRING: function(string) { this.opcode('pushString', string.string); }, INTEGER: function(integer) { this.opcode('pushLiteral', integer.integer); }, BOOLEAN: function(bool) { this.opcode('pushLiteral', bool.bool); }, comment: function() {}, // HELPERS opcode: function(name) { this.opcodes.push({ opcode: name, args: [].slice.call(arguments, 1) }); }, declare: function(name, value) { this.opcodes.push({ opcode: 'DECLARE', name: name, value: value }); }, addDepth: function(depth) { if(depth === 0) { return; } if(!this.depths[depth]) { this.depths[depth] = true; this.depths.list.push(depth); } }, classifySexpr: function(sexpr) { var isHelper = sexpr.isHelper; var isEligible = sexpr.eligibleHelper; var options = this.options; // if ambiguous, we can possibly resolve the ambiguity now if (isEligible && !isHelper) { var name = sexpr.id.parts[0]; if (options.knownHelpers[name]) { isHelper = true; } else if (options.knownHelpersOnly) { isEligible = false; } } if (isHelper) { return "helper"; } else if (isEligible) { return "ambiguous"; } else { return "simple"; } }, pushParams: function(params) { var i = params.length, param; while(i--) { param = params[i]; if(this.options.stringParams) { if(param.depth) { this.addDepth(param.depth); } this.opcode('getContext', param.depth || 0); this.opcode('pushStringParam', param.stringModeValue, param.type); if (param.type === 'sexpr') { // Subexpressions get evaluated and passed in // in string params mode. this.sexpr(param); } } else { this[param.type](param); } } }, setupFullMustacheParams: function(sexpr, program, inverse) { var params = sexpr.params; this.pushParams(params); this.opcode('pushProgram', program); this.opcode('pushProgram', inverse); if (sexpr.hash) { this.hash(sexpr.hash); } else { this.opcode('emptyHash'); } return params; } }; function precompile(input, options, env) { if (input == null || (typeof input !== 'string' && input.constructor !== env.AST.ProgramNode)) { throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input); } options = options || {}; if (!('data' in options)) { options.data = true; } var ast = env.parse(input); var environment = new env.Compiler().compile(ast, options); return new env.JavaScriptCompiler().compile(environment, options); } __exports__.precompile = precompile;function compile(input, options, env) { if (input == null || (typeof input !== 'string' && input.constructor !== env.AST.ProgramNode)) { throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input); } options = options || {}; if (!('data' in options)) { options.data = true; } var compiled; function compileInput() { var ast = env.parse(input); var environment = new env.Compiler().compile(ast, options); var templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true); return env.template(templateSpec); } // Template is only compiled on first use and cached after that point. return function(context, options) { if (!compiled) { compiled = compileInput(); } return compiled.call(this, context, options); }; } __exports__.compile = compile; return __exports__; })(__module5__); // handlebars/compiler/javascript-compiler.js var __module11__ = (function(__dependency1__, __dependency2__) { "use strict"; var __exports__; var COMPILER_REVISION = __dependency1__.COMPILER_REVISION; var REVISION_CHANGES = __dependency1__.REVISION_CHANGES; var log = __dependency1__.log; var Exception = __dependency2__; function Literal(value) { this.value = value; } function JavaScriptCompiler() {} JavaScriptCompiler.prototype = { // PUBLIC API: You can override these methods in a subclass to provide // alternative compiled forms for name lookup and buffering semantics nameLookup: function(parent, name /* , type*/) { var wrap, ret; if (parent.indexOf('depth') === 0) { wrap = true; } if (/^[0-9]+$/.test(name)) { ret = parent + "[" + name + "]"; } else if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) { ret = parent + "." + name; } else { ret = parent + "['" + name + "']"; } if (wrap) { return '(' + parent + ' && ' + ret + ')'; } else { return ret; } }, compilerInfo: function() { var revision = COMPILER_REVISION, versions = REVISION_CHANGES[revision]; return "this.compilerInfo = ["+revision+",'"+versions+"'];\n"; }, appendToBuffer: function(string) { if (this.environment.isSimple) { return "return " + string + ";"; } else { return { appendToBuffer: true, content: string, toString: function() { return "buffer += " + string + ";"; } }; } }, initializeBuffer: function() { return this.quotedString(""); }, namespace: "Handlebars", // END PUBLIC API compile: function(environment, options, context, asObject) { this.environment = environment; this.options = options || {}; log('debug', this.environment.disassemble() + "\n\n"); this.name = this.environment.name; this.isChild = !!context; this.context = context || { programs: [], environments: [], aliases: { } }; this.preamble(); this.stackSlot = 0; this.stackVars = []; this.registers = { list: [] }; this.hashes = []; this.compileStack = []; this.inlineStack = []; this.compileChildren(environment, options); var opcodes = environment.opcodes, opcode; this.i = 0; for(var l=opcodes.length; this.i<l; this.i++) { opcode = opcodes[this.i]; if(opcode.opcode === 'DECLARE') { this[opcode.name] = opcode.value; } else { this[opcode.opcode].apply(this, opcode.args); } // Reset the stripNext flag if it was not set by this operation. if (opcode.opcode !== this.stripNext) { this.stripNext = false; } } // Flush any trailing content that might be pending. this.pushSource(''); if (this.stackSlot || this.inlineStack.length || this.compileStack.length) { throw new Exception('Compile completed with content left on stack'); } return this.createFunctionContext(asObject); }, preamble: function() { var out = []; if (!this.isChild) { var namespace = this.namespace; var copies = "helpers = this.merge(helpers, " + namespace + ".helpers);"; if (this.environment.usePartial) { copies = copies + " partials = this.merge(partials, " + namespace + ".partials);"; } if (this.options.data) { copies = copies + " data = data || {};"; } out.push(copies); } else { out.push(''); } if (!this.environment.isSimple) { out.push(", buffer = " + this.initializeBuffer()); } else { out.push(""); } // track the last context pushed into place to allow skipping the // getContext opcode when it would be a noop this.lastContext = 0; this.source = out; }, createFunctionContext: function(asObject) { var locals = this.stackVars.concat(this.registers.list); if(locals.length > 0) { this.source[1] = this.source[1] + ", " + locals.join(", "); } // Generate minimizer alias mappings if (!this.isChild) { for (var alias in this.context.aliases) { if (this.context.aliases.hasOwnProperty(alias)) { this.source[1] = this.source[1] + ', ' + alias + '=' + this.context.aliases[alias]; } } } if (this.source[1]) { this.source[1] = "var " + this.source[1].substring(2) + ";"; } // Merge children if (!this.isChild) { this.source[1] += '\n' + this.context.programs.join('\n') + '\n'; } if (!this.environment.isSimple) { this.pushSource("return buffer;"); } var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; for(var i=0, l=this.environment.depths.list.length; i<l; i++) { params.push("depth" + this.environment.depths.list[i]); } // Perform a second pass over the output to merge content when possible var source = this.mergeSource(); if (!this.isChild) { source = this.compilerInfo()+source; } if (asObject) { params.push(source); return Function.apply(this, params); } else { var functionSource = 'function ' + (this.name || '') + '(' + params.join(',') + ') {\n ' + source + '}'; log('debug', functionSource + "\n\n"); return functionSource; } }, mergeSource: function() { // WARN: We are not handling the case where buffer is still populated as the source should // not have buffer append operations as their final action. var source = '', buffer; for (var i = 0, len = this.source.length; i < len; i++) { var line = this.source[i]; if (line.appendToBuffer) { if (buffer) { buffer = buffer + '\n + ' + line.content; } else { buffer = line.content; } } else { if (buffer) { source += 'buffer += ' + buffer + ';\n '; buffer = undefined; } source += line + '\n '; } } return source; }, // [blockValue] // // On stack, before: hash, inverse, program, value // On stack, after: return value of blockHelperMissing // // The purpose of this opcode is to take a block of the form // `{{#foo}}...{{/foo}}`, resolve the value of `foo`, and // replace it on the stack with the result of properly // invoking blockHelperMissing. blockValue: function() { this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; var params = ["depth0"]; this.setupParams(0, params); this.replaceStack(function(current) { params.splice(1, 0, current); return "blockHelperMissing.call(" + params.join(", ") + ")"; }); }, // [ambiguousBlockValue] // // On stack, before: hash, inverse, program, value // Compiler value, before: lastHelper=value of last found helper, if any // On stack, after, if no lastHelper: same as [blockValue] // On stack, after, if lastHelper: value ambiguousBlockValue: function() { this.context.aliases.blockHelperMissing = 'helpers.blockHelperMissing'; var params = ["depth0"]; this.setupParams(0, params); var current = this.topStack(); params.splice(1, 0, current); this.pushSource("if (!" + this.lastHelper + ") { " + current + " = blockHelperMissing.call(" + params.join(", ") + "); }"); }, // [appendContent] // // On stack, before: ... // On stack, after: ... // // Appends the string value of `content` to the current buffer appendContent: function(content) { if (this.pendingContent) { content = this.pendingContent + content; } if (this.stripNext) { content = content.replace(/^\s+/, ''); } this.pendingContent = content; }, // [strip] // // On stack, before: ... // On stack, after: ... // // Removes any trailing whitespace from the prior content node and flags // the next operation for stripping if it is a content node. strip: function() { if (this.pendingContent) { this.pendingContent = this.pendingContent.replace(/\s+$/, ''); } this.stripNext = 'strip'; }, // [append] // // On stack, before: value, ... // On stack, after: ... // // Coerces `value` to a String and appends it to the current buffer. // // If `value` is truthy, or 0, it is coerced into a string and appended // Otherwise, the empty string is appended append: function() { // Force anything that is inlined onto the stack so we don't have duplication // when we examine local this.flushInline(); var local = this.popStack(); this.pushSource("if(" + local + " || " + local + " === 0) { " + this.appendToBuffer(local) + " }"); if (this.environment.isSimple) { this.pushSource("else { " + this.appendToBuffer("''") + " }"); } }, // [appendEscaped] // // On stack, before: value, ... // On stack, after: ... // // Escape `value` and append it to the buffer appendEscaped: function() { this.context.aliases.escapeExpression = 'this.escapeExpression'; this.pushSource(this.appendToBuffer("escapeExpression(" + this.popStack() + ")")); }, // [getContext] // // On stack, before: ... // On stack, after: ... // Compiler value, after: lastContext=depth // // Set the value of the `lastContext` compiler value to the depth getContext: function(depth) { if(this.lastContext !== depth) { this.lastContext = depth; } }, // [lookupOnContext] // // On stack, before: ... // On stack, after: currentContext[name], ... // // Looks up the value of `name` on the current context and pushes // it onto the stack. lookupOnContext: function(name) { this.push(this.nameLookup('depth' + this.lastContext, name, 'context')); }, // [pushContext] // // On stack, before: ... // On stack, after: currentContext, ... // // Pushes the value of the current context onto the stack. pushContext: function() { this.pushStackLiteral('depth' + this.lastContext); }, // [resolvePossibleLambda] // // On stack, before: value, ... // On stack, after: resolved value, ... // // If the `value` is a lambda, replace it on the stack by // the return value of the lambda resolvePossibleLambda: function() { this.context.aliases.functionType = '"function"'; this.replaceStack(function(current) { return "typeof " + current + " === functionType ? " + current + ".apply(depth0) : " + current; }); }, // [lookup] // // On stack, before: value, ... // On stack, after: value[name], ... // // Replace the value on the stack with the result of looking // up `name` on `value` lookup: function(name) { this.replaceStack(function(current) { return current + " == null || " + current + " === false ? " + current + " : " + this.nameLookup(current, name, 'context'); }); }, // [lookupData] // // On stack, before: ... // On stack, after: data, ... // // Push the data lookup operator lookupData: function() { this.pushStackLiteral('data'); }, // [pushStringParam] // // On stack, before: ... // On stack, after: string, currentContext, ... // // This opcode is designed for use in string mode, which // provides the string value of a parameter along with its // depth rather than resolving it immediately. pushStringParam: function(string, type) { this.pushStackLiteral('depth' + this.lastContext); this.pushString(type); // If it's a subexpression, the string result // will be pushed after this opcode. if (type !== 'sexpr') { if (typeof string === 'string') { this.pushString(string); } else { this.pushStackLiteral(string); } } }, emptyHash: function() { this.pushStackLiteral('{}'); if (this.options.stringParams) { this.push('{}'); // hashContexts this.push('{}'); // hashTypes } }, pushHash: function() { if (this.hash) { this.hashes.push(this.hash); } this.hash = {values: [], types: [], contexts: []}; }, popHash: function() { var hash = this.hash; this.hash = this.hashes.pop(); if (this.options.stringParams) { this.push('{' + hash.contexts.join(',') + '}'); this.push('{' + hash.types.join(',') + '}'); } this.push('{\n ' + hash.values.join(',\n ') + '\n }'); }, // [pushString] // // On stack, before: ... // On stack, after: quotedString(string), ... // // Push a quoted version of `string` onto the stack pushString: function(string) { this.pushStackLiteral(this.quotedString(string)); }, // [push] // // On stack, before: ... // On stack, after: expr, ... // // Push an expression onto the stack push: function(expr) { this.inlineStack.push(expr); return expr; }, // [pushLiteral] // // On stack, before: ... // On stack, after: value, ... // // Pushes a value onto the stack. This operation prevents // the compiler from creating a temporary variable to hold // it. pushLiteral: function(value) { this.pushStackLiteral(value); }, // [pushProgram] // // On stack, before: ... // On stack, after: program(guid), ... // // Push a program expression onto the stack. This takes // a compile-time guid and converts it into a runtime-accessible // expression. pushProgram: function(guid) { if (guid != null) { this.pushStackLiteral(this.programExpression(guid)); } else { this.pushStackLiteral(null); } }, // [invokeHelper] // // On stack, before: hash, inverse, program, params..., ... // On stack, after: result of helper invocation // // Pops off the helper's parameters, invokes the helper, // and pushes the helper's return value onto the stack. // // If the helper is not found, `helperMissing` is called. invokeHelper: function(paramSize, name, isRoot) { this.context.aliases.helperMissing = 'helpers.helperMissing'; this.useRegister('helper'); var helper = this.lastHelper = this.setupHelper(paramSize, name, true); var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context'); var lookup = 'helper = ' + helper.name + ' || ' + nonHelper; if (helper.paramsInit) { lookup += ',' + helper.paramsInit; } this.push( '(' + lookup + ',helper ' + '? helper.call(' + helper.callParams + ') ' + ': helperMissing.call(' + helper.helperMissingParams + '))'); // Always flush subexpressions. This is both to prevent the compounding size issue that // occurs when the code has to be duplicated for inlining and also to prevent errors // due to the incorrect options object being passed due to the shared register. if (!isRoot) { this.flushInline(); } }, // [invokeKnownHelper] // // On stack, before: hash, inverse, program, params..., ... // On stack, after: result of helper invocation // // This operation is used when the helper is known to exist, // so a `helperMissing` fallback is not required. invokeKnownHelper: function(paramSize, name) { var helper = this.setupHelper(paramSize, name); this.push(helper.name + ".call(" + helper.callParams + ")"); }, // [invokeAmbiguous] // // On stack, before: hash, inverse, program, params..., ... // On stack, after: result of disambiguation // // This operation is used when an expression like `{{foo}}` // is provided, but we don't know at compile-time whether it // is a helper or a path. // // This operation emits more code than the other options, // and can be avoided by passing the `knownHelpers` and // `knownHelpersOnly` flags at compile-time. invokeAmbiguous: function(name, helperCall) { this.context.aliases.functionType = '"function"'; this.useRegister('helper'); this.emptyHash(); var helper = this.setupHelper(0, name, helperCall); var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper'); var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context'); var nextStack = this.nextStack(); if (helper.paramsInit) { this.pushSource(helper.paramsInit); } this.pushSource('if (helper = ' + helperName + ') { ' + nextStack + ' = helper.call(' + helper.callParams + '); }'); this.pushSource('else { helper = ' + nonHelper + '; ' + nextStack + ' = typeof helper === functionType ? helper.call(' + helper.callParams + ') : helper; }'); }, // [invokePartial] // // On stack, before: context, ... // On stack after: result of partial invocation // // This operation pops off a context, invokes a partial with that context, // and pushes the result of the invocation back. invokePartial: function(name) { var params = [this.nameLookup('partials', name, 'partial'), "'" + name + "'", this.popStack(), "helpers", "partials"]; if (this.options.data) { params.push("data"); } this.context.aliases.self = "this"; this.push("self.invokePartial(" + params.join(", ") + ")"); }, // [assignToHash] // // On stack, before: value, hash, ... // On stack, after: hash, ... // // Pops a value and hash off the stack, assigns `hash[key] = value` // and pushes the hash back onto the stack. assignToHash: function(key) { var value = this.popStack(), context, type; if (this.options.stringParams) { type = this.popStack(); context = this.popStack(); } var hash = this.hash; if (context) { hash.contexts.push("'" + key + "': " + context); } if (type) { hash.types.push("'" + key + "': " + type); } hash.values.push("'" + key + "': (" + value + ")"); }, // HELPERS compiler: JavaScriptCompiler, compileChildren: function(environment, options) { var children = environment.children, child, compiler; for(var i=0, l=children.length; i<l; i++) { child = children[i]; compiler = new this.compiler(); var index = this.matchExistingProgram(child); if (index == null) { this.context.programs.push(''); // Placeholder to prevent name conflicts for nested children index = this.context.programs.length; child.index = index; child.name = 'program' + index; this.context.programs[index] = compiler.compile(child, options, this.context); this.context.environments[index] = child; } else { child.index = index; child.name = 'program' + index; } } }, matchExistingProgram: function(child) { for (var i = 0, len = this.context.environments.length; i < len; i++) { var environment = this.context.environments[i]; if (environment && environment.equals(child)) { return i; } } }, programExpression: function(guid) { this.context.aliases.self = "this"; if(guid == null) { return "self.noop"; } var child = this.environment.children[guid], depths = child.depths.list, depth; var programParams = [child.index, child.name, "data"]; for(var i=0, l = depths.length; i<l; i++) { depth = depths[i]; if(depth === 1) { programParams.push("depth0"); } else { programParams.push("depth" + (depth - 1)); } } return (depths.length === 0 ? "self.program(" : "self.programWithDepth(") + programParams.join(", ") + ")"; }, register: function(name, val) { this.useRegister(name); this.pushSource(name + " = " + val + ";"); }, useRegister: function(name) { if(!this.registers[name]) { this.registers[name] = true; this.registers.list.push(name); } }, pushStackLiteral: function(item) { return this.push(new Literal(item)); }, pushSource: function(source) { if (this.pendingContent) { this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))); this.pendingContent = undefined; } if (source) { this.source.push(source); } }, pushStack: function(item) { this.flushInline(); var stack = this.incrStack(); if (item) { this.pushSource(stack + " = " + item + ";"); } this.compileStack.push(stack); return stack; }, replaceStack: function(callback) { var prefix = '', inline = this.isInline(), stack, createdStack, usedLiteral; // If we are currently inline then we want to merge the inline statement into the // replacement statement via ',' if (inline) { var top = this.popStack(true); if (top instanceof Literal) { // Literals do not need to be inlined stack = top.value; usedLiteral = true; } else { // Get or create the current stack name for use by the inline createdStack = !this.stackSlot; var name = !createdStack ? this.topStackName() : this.incrStack(); prefix = '(' + this.push(name) + ' = ' + top + '),'; stack = this.topStack(); } } else { stack = this.topStack(); } var item = callback.call(this, stack); if (inline) { if (!usedLiteral) { this.popStack(); } if (createdStack) { this.stackSlot--; } this.push('(' + prefix + item + ')'); } else { // Prevent modification of the context depth variable. Through replaceStack if (!/^stack/.test(stack)) { stack = this.nextStack(); } this.pushSource(stack + " = (" + prefix + item + ");"); } return stack; }, nextStack: function() { return this.pushStack(); }, incrStack: function() { this.stackSlot++; if(this.stackSlot > this.stackVars.length) { this.stackVars.push("stack" + this.stackSlot); } return this.topStackName(); }, topStackName: function() { return "stack" + this.stackSlot; }, flushInline: function() { var inlineStack = this.inlineStack; if (inlineStack.length) { this.inlineStack = []; for (var i = 0, len = inlineStack.length; i < len; i++) { var entry = inlineStack[i]; if (entry instanceof Literal) { this.compileStack.push(entry); } else { this.pushStack(entry); } } } }, isInline: function() { return this.inlineStack.length; }, popStack: function(wrapped) { var inline = this.isInline(), item = (inline ? this.inlineStack : this.compileStack).pop(); if (!wrapped && (item instanceof Literal)) { return item.value; } else { if (!inline) { if (!this.stackSlot) { throw new Exception('Invalid stack pop'); } this.stackSlot--; } return item; } }, topStack: function(wrapped) { var stack = (this.isInline() ? this.inlineStack : this.compileStack), item = stack[stack.length - 1]; if (!wrapped && (item instanceof Literal)) { return item.value; } else { return item; } }, quotedString: function(str) { return '"' + str .replace(/\\/g, '\\\\') .replace(/"/g, '\\"') .replace(/\n/g, '\\n') .replace(/\r/g, '\\r') .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4 .replace(/\u2029/g, '\\u2029') + '"'; }, setupHelper: function(paramSize, name, missingParams) { var params = [], paramsInit = this.setupParams(paramSize, params, missingParams); var foundHelper = this.nameLookup('helpers', name, 'helper'); return { params: params, paramsInit: paramsInit, name: foundHelper, callParams: ["depth0"].concat(params).join(", "), helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ") }; }, setupOptions: function(paramSize, params) { var options = [], contexts = [], types = [], param, inverse, program; options.push("hash:" + this.popStack()); if (this.options.stringParams) { options.push("hashTypes:" + this.popStack()); options.push("hashContexts:" + this.popStack()); } inverse = this.popStack(); program = this.popStack(); // Avoid setting fn and inverse if neither are set. This allows // helpers to do a check for `if (options.fn)` if (program || inverse) { if (!program) { this.context.aliases.self = "this"; program = "self.noop"; } if (!inverse) { this.context.aliases.self = "this"; inverse = "self.noop"; } options.push("inverse:" + inverse); options.push("fn:" + program); } for(var i=0; i<paramSize; i++) { param = this.popStack(); params.push(param); if(this.options.stringParams) { types.push(this.popStack()); contexts.push(this.popStack()); } } if (this.options.stringParams) { options.push("contexts:[" + contexts.join(",") + "]"); options.push("types:[" + types.join(",") + "]"); } if(this.options.data) { options.push("data:data"); } return options; }, // the params and contexts arguments are passed in arrays // to fill in setupParams: function(paramSize, params, useRegister) { var options = '{' + this.setupOptions(paramSize, params).join(',') + '}'; if (useRegister) { this.useRegister('options'); params.push('options'); return 'options=' + options; } else { params.push(options); return ''; } } }; var reservedWords = ( "break else new var" + " case finally return void" + " catch for switch while" + " continue function this with" + " default if throw" + " delete in try" + " do instanceof typeof" + " abstract enum int short" + " boolean export interface static" + " byte extends long super" + " char final native synchronized" + " class float package throws" + " const goto private transient" + " debugger implements protected volatile" + " double import public let yield" ).split(" "); var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {}; for(var i=0, l=reservedWords.length; i<l; i++) { compilerWords[reservedWords[i]] = true; } JavaScriptCompiler.isValidJavaScriptVariableName = function(name) { if(!JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name)) { return true; } return false; }; __exports__ = JavaScriptCompiler; return __exports__; })(__module2__, __module5__); // handlebars.js var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) { "use strict"; var __exports__; /*globals Handlebars: true */ var Handlebars = __dependency1__; // Compiler imports var AST = __dependency2__; var Parser = __dependency3__.parser; var parse = __dependency3__.parse; var Compiler = __dependency4__.Compiler; var compile = __dependency4__.compile; var precompile = __dependency4__.precompile; var JavaScriptCompiler = __dependency5__; var _create = Handlebars.create; var create = function() { var hb = _create(); hb.compile = function(input, options) { return compile(input, options, hb); }; hb.precompile = function (input, options) { return precompile(input, options, hb); }; hb.AST = AST; hb.Compiler = Compiler; hb.JavaScriptCompiler = JavaScriptCompiler; hb.Parser = Parser; hb.parse = parse; return hb; }; Handlebars = create(); Handlebars.create = create; __exports__ = Handlebars; return __exports__; })(__module1__, __module7__, __module8__, __module10__, __module11__); return __module0__; })();
bfg-repo-cleaner-demos/jsdelivr-bfg-cleaned
files/handlebarsjs/1.3.0/handlebars.js
JavaScript
mit
89,667
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "prie\u0161piet", "popiet" ], "DAY": [ "sekmadienis", "pirmadienis", "antradienis", "tre\u010diadienis", "ketvirtadienis", "penktadienis", "\u0161e\u0161tadienis" ], "MONTH": [ "sausis", "vasaris", "kovas", "balandis", "gegu\u017e\u0117", "bir\u017eelis", "liepa", "rugpj\u016btis", "rugs\u0117jis", "spalis", "lapkritis", "gruodis" ], "SHORTDAY": [ "Sk", "Pr", "An", "Tr", "Kt", "Pn", "\u0160t" ], "SHORTMONTH": [ "Saus.", "Vas.", "Kov.", "Bal.", "Geg.", "Bir.", "Liep.", "Rugp.", "Rugs.", "Spal.", "Lapkr.", "Gruod." ], "fullDate": "y 'm'. MMMM d 'd'., EEEE", "longDate": "y 'm'. MMMM d 'd'.", "medium": "y MMM d HH:mm:ss", "mediumDate": "y MMM d", "mediumTime": "HH:mm:ss", "short": "yyyy-MM-dd HH:mm", "shortDate": "yyyy-MM-dd", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "Lt", "DECIMAL_SEP": ",", "GROUP_SEP": "\u00a0", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "lt", "pluralCat": function (n) { if (n % 10 == 1 && (n % 100 < 11 || n % 100 > 19)) { return PLURAL_CATEGORY.ONE; } if (n == (n | 0) && n % 10 >= 2 && n % 10 <= 9 && (n % 100 < 11 || n % 100 > 19)) { return PLURAL_CATEGORY.FEW; } return PLURAL_CATEGORY.OTHER;} }); }]);
BenHNet/AngularPlayground
app/Clean/lib/angular/i18n/angular-locale_lt.js
JavaScript
mit
2,223
var baseClone = require('../internal/baseClone'), bindCallback = require('../internal/bindCallback'), isIterateeCall = require('../internal/isIterateeCall'); /** * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned, * otherwise they are assigned by reference. If `customizer` is provided it's * invoked to produce the cloned values. If `customizer` returns `undefined` * cloning is handled by the method instead. The `customizer` is bound to * `thisArg` and invoked with up to three argument; (value [, index|key, object]). * * **Note:** This method is loosely based on the * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm). * The enumerable properties of `arguments` objects and objects created by * constructors other than `Object` are cloned to plain `Object` objects. An * empty object is returned for uncloneable values such as functions, DOM nodes, * Maps, Sets, and WeakMaps. * * @static * @memberOf _ * @category Lang * @param {*} value The value to clone. * @param {boolean} [isDeep] Specify a deep clone. * @param {Function} [customizer] The function to customize cloning values. * @param {*} [thisArg] The `this` binding of `customizer`. * @returns {*} Returns the cloned value. * @example * * var users = [ * { 'user': 'barney' }, * { 'user': 'fred' } * ]; * * var shallow = _.clone(users); * shallow[0] === users[0]; * // => true * * var deep = _.clone(users, true); * deep[0] === users[0]; * // => false * * // using a customizer callback * var el = _.clone(document.body, function(value) { * if (_.isElement(value)) { * return value.cloneNode(false); * } * }); * * el === document.body * // => false * el.nodeName * // => BODY * el.childNodes.length; * // => 0 */ function clone(value, isDeep, customizer, thisArg) { if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) { isDeep = false; } else if (typeof isDeep == 'function') { thisArg = customizer; customizer = isDeep; isDeep = false; } return typeof customizer == 'function' ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 3)) : baseClone(value, isDeep); } module.exports = clone;
ernbrn/anglerjs
node_modules/karma/node_modules/lodash/lang/clone.js
JavaScript
mit
2,296
require 'sprockets/asset' require 'sprockets/bower' require 'sprockets/cache' require 'sprockets/configuration' require 'sprockets/digest_utils' require 'sprockets/errors' require 'sprockets/loader' require 'sprockets/path_digest_utils' require 'sprockets/path_dependency_utils' require 'sprockets/path_utils' require 'sprockets/resolve' require 'sprockets/server' require 'sprockets/loader' require 'sprockets/uri_tar' module Sprockets # `Base` class for `Environment` and `Cached`. class Base include PathUtils, PathDependencyUtils, PathDigestUtils, DigestUtils include Configuration include Server include Resolve, Loader include Bower # Get persistent cache store attr_reader :cache # Set persistent cache store # # The cache store must implement a pair of getters and # setters. Either `get(key)`/`set(key, value)`, # `[key]`/`[key]=value`, `read(key)`/`write(key, value)`. def cache=(cache) @cache = Cache.new(cache, logger) end # Return an `Cached`. Must be implemented by the subclass. def cached raise NotImplementedError end alias_method :index, :cached # Internal: Compute digest for path. # # path - String filename or directory path. # # Returns a String digest or nil. def file_digest(path) if stat = self.stat(path) # Caveat: Digests are cached by the path's current mtime. Its possible # for a files contents to have changed and its mtime to have been # negligently reset thus appearing as if the file hasn't changed on # disk. Also, the mtime is only read to the nearest second. It's # also possible the file was updated more than once in a given second. key = UnloadedAsset.new(path, self).file_digest_key(stat.mtime.to_i) cache.fetch(key) do self.stat_digest(path, stat) end end end # Find asset by logical path or expanded path. def find_asset(path, options = {}) uri, _ = resolve(path, options.merge(compat: false)) if uri load(uri) end end def find_all_linked_assets(path, options = {}) return to_enum(__method__, path, options) unless block_given? asset = find_asset(path, options) return unless asset yield asset stack = asset.links.to_a while uri = stack.shift yield asset = load(uri) stack = asset.links.to_a + stack end nil end # Preferred `find_asset` shorthand. # # environment['application.js'] # def [](*args) find_asset(*args) end # Pretty inspect def inspect "#<#{self.class}:0x#{object_id.to_s(16)} " + "root=#{root.to_s.inspect}, " + "paths=#{paths.inspect}>" end def compress_from_root(uri) URITar.new(uri, self).compress end def expand_from_root(uri) URITar.new(uri, self).expand end end end
project-anacapa/anacapa-grader-alpha
vendor/bundle/ruby/2.0.0/gems/sprockets-3.6.0/lib/sprockets/base.rb
Ruby
mit
2,954
namespace mathTests.simdTests { const { Float32x4, Int32x4, Int16x8, Int8x16, Uint32x4, Uint16x8, Uint8x16, Bool32x4, Bool16x8, Bool8x16 } = adone.math.simd; const a0 = Float32x4(0, 1, 2, 3); const a1 = Int32x4(0, 1, 2, 3); const a2 = Int16x8(0, 1, 2, 3, 4, 5, 6, 7); const a3 = Int8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); const a4 = Uint32x4(0, 1, 2, 3); const a5 = Uint16x8(0, 1, 2, 3, 4, 5, 6, 7); const a6 = Uint8x16(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); const a7 = Bool32x4(true, true, true, true); const a8 = Bool16x8(true, true, true, true, true, true, true, true); const a9 = Bool8x16(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true); Float32x4.length; Float32x4.name; Float32x4.arguments; Float32x4.caller; Float32x4.prototype; Float32x4.extractLane(a0, 3); Float32x4.swizzle(a0, 0, 1, 2, 3); Float32x4.shuffle(a0, a0, 0, 1, 2, 3); Float32x4.check(a0); Float32x4.splat(1); Float32x4.replaceLane(a0, 3, 1); Float32x4.select(Bool32x4.splat(true), a0, a0); Float32x4.equal(a0, a0); Float32x4.notEqual(a0, a0); Float32x4.lessThan(a0, a0); Float32x4.lessThanOrEqual(a0, a0); Float32x4.greaterThan(a0, a0); Float32x4.greaterThanOrEqual(a0, a0); Float32x4.add(a0, a0); Float32x4.sub(a0, a0); Float32x4.mul(a0, a0); Float32x4.div(a0, a0); Float32x4.neg(a0); Float32x4.abs(a0); Float32x4.min(a0, a0); Float32x4.max(a0, a0); Float32x4.minNum(a0, a0); Float32x4.maxNum(a0, a0); Float32x4.reciprocalApproximation(a0, a0); Float32x4.reciprocalSqrtApproximation(a0); Float32x4.sqrt(a0); Float32x4.load(new Float32Array(16), 0); Float32x4.load1(new Float32Array(16), 0); Float32x4.load2(new Float32Array(16), 0); Float32x4.load3(new Float32Array(16), 0); Float32x4.store(new Float32Array(16), 1, a0); Float32x4.store1(new Float32Array(16), 1, a0); Float32x4.store2(new Float32Array(16), 1, a0); Float32x4.store3(new Float32Array(16), 1, a0); Float32x4.fromInt32x4(Int32x4.splat(0)); Float32x4.fromUint32x4(Uint32x4.splat(0)); Float32x4.fromInt32x4Bits(Int32x4.splat(0)); Float32x4.fromInt16x8Bits(Int16x8.splat(0)); Float32x4.fromInt8x16Bits(Int8x16.splat(0)); Float32x4.fromUint32x4Bits(Uint32x4.splat(0)); Float32x4.fromUint16x8Bits(Uint16x8.splat(0)); Float32x4.fromUint8x16Bits(Uint8x16.splat(0)); Int32x4.length; Int32x4.name; Int32x4.arguments; Int32x4.caller; Int32x4.prototype; Int32x4.extractLane(a1, 3); Int32x4.swizzle(a1, 0, 1, 2, 3); Int32x4.shuffle(a1, a1, 0, 1, 2, 3); Int32x4.check(a1); Int32x4.splat(1); Int32x4.replaceLane(a1, 3, 1); Int32x4.select(Bool32x4.splat(true), a1, a1); Int32x4.equal(a1, a1); Int32x4.notEqual(a1, a1); Int32x4.lessThan(a1, a1); Int32x4.lessThanOrEqual(a1, a1); Int32x4.greaterThan(a1, a1); Int32x4.greaterThanOrEqual(a1, a1); Int32x4.and(a1, a1); Int32x4.or(a1, a1); Int32x4.xor(a1, a1); Int32x4.not(a1, a1); Int32x4.add(a1, a1); Int32x4.sub(a1, a1); Int32x4.mul(a1, a1); Int32x4.neg(a1); Int32x4.shiftLeftByScalar(a1, 1); Int32x4.shiftRightByScalar(a1, 1); Int32x4.load(new Int32Array(16), 0); Int32x4.load1(new Int32Array(16), 0); Int32x4.load2(new Int32Array(16), 0); Int32x4.load3(new Int32Array(16), 0); Int32x4.store(new Int32Array(16), 1, a1); Int32x4.store1(new Int32Array(16), 1, a1); Int32x4.store2(new Int32Array(16), 1, a1); Int32x4.store3(new Int32Array(16), 1, a1); Int32x4.fromFloat32x4(Float32x4.splat(0)); Int32x4.fromUint32x4(Uint32x4.splat(0)); Int32x4.fromFloat32x4Bits(Float32x4.splat(0)); Int32x4.fromInt16x8Bits(Int16x8.splat(0)); Int32x4.fromInt8x16Bits(Int8x16.splat(0)); Int32x4.fromUint32x4Bits(Uint32x4.splat(0)); Int32x4.fromUint16x8Bits(Uint16x8.splat(0)); Int32x4.fromUint8x16Bits(Uint8x16.splat(0)); Int16x8.length; Int16x8.name; Int16x8.arguments; Int16x8.caller; Int16x8.prototype; Int16x8.extractLane(a2, 7); Int16x8.swizzle(a2, 0, 1, 2, 3, 4, 5, 6, 7); Int16x8.shuffle(a2, a2, 0, 1, 2, 3, 4, 5, 6, 7); Int16x8.check(a2); Int16x8.splat(1); Int16x8.replaceLane(a2, 7, 1); Int16x8.select(Bool16x8.splat(true), a2, a2); Int16x8.equal(a2, a2); Int16x8.notEqual(a2, a2); Int16x8.lessThan(a2, a2); Int16x8.lessThanOrEqual(a2, a2); Int16x8.greaterThan(a2, a2); Int16x8.greaterThanOrEqual(a2, a2); Int16x8.and(a2, a2); Int16x8.or(a2, a2); Int16x8.xor(a2, a2); Int16x8.not(a2, a2); Int16x8.add(a2, a2); Int16x8.sub(a2, a2); Int16x8.mul(a2, a2); Int16x8.neg(a2); Int16x8.shiftLeftByScalar(a2, 1); Int16x8.shiftRightByScalar(a2, 1); Int16x8.addSaturate(a2, a2); Int16x8.subSaturate(a2, a2); Int16x8.load(new Int16Array(16), 0); Int16x8.store(new Int16Array(16), 1, a2); Int16x8.fromUint16x8(Uint16x8.splat(0)); Int16x8.fromFloat32x4Bits(Float32x4.splat(0)); Int16x8.fromInt32x4Bits(Int32x4.splat(0)); Int16x8.fromInt8x16Bits(Int8x16.splat(0)); Int16x8.fromUint32x4Bits(Uint32x4.splat(0)); Int16x8.fromUint16x8Bits(Uint16x8.splat(0)); Int16x8.fromUint8x16Bits(Uint8x16.splat(0)); Int8x16.length; Int8x16.name; Int8x16.arguments; Int8x16.caller; Int8x16.prototype; Int8x16.extractLane(a3, 15); Int8x16.swizzle(a3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); Int8x16.shuffle(a3, a3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); Int8x16.check(a3); Int8x16.splat(1); Int8x16.replaceLane(a3, 15, 1); Int8x16.select(Bool8x16.splat(true), a3, a3); Int8x16.equal(a3, a3); Int8x16.notEqual(a3, a3); Int8x16.lessThan(a3, a3); Int8x16.lessThanOrEqual(a3, a3); Int8x16.greaterThan(a3, a3); Int8x16.greaterThanOrEqual(a3, a3); Int8x16.and(a3, a3); Int8x16.or(a3, a3); Int8x16.xor(a3, a3); Int8x16.not(a3, a3); Int8x16.add(a3, a3); Int8x16.sub(a3, a3); Int8x16.mul(a3, a3); Int8x16.neg(a3); Int8x16.shiftLeftByScalar(a3, 1); Int8x16.shiftRightByScalar(a3, 1); Int8x16.addSaturate(a3, a3); Int8x16.subSaturate(a3, a3); Int8x16.load(new Int8Array(16), 0); Int8x16.store(new Int8Array(16), 1, a3); Int8x16.fromUint8x16(Uint8x16.splat(0)); Int8x16.fromFloat32x4Bits(Float32x4.splat(0)); Int8x16.fromInt32x4Bits(Int32x4.splat(0)); Int8x16.fromInt16x8Bits(Int16x8.splat(0)); Int8x16.fromUint32x4Bits(Uint32x4.splat(0)); Int8x16.fromUint16x8Bits(Uint16x8.splat(0)); Int8x16.fromUint8x16Bits(Uint8x16.splat(0)); Uint32x4.length; Uint32x4.name; Uint32x4.arguments; Uint32x4.caller; Uint32x4.prototype; Uint32x4.extractLane(a4, 3); Uint32x4.swizzle(a4, 0, 1, 2, 3); Uint32x4.shuffle(a4, a4, 0, 1, 2, 3); Uint32x4.check(a4); Uint32x4.splat(1); Uint32x4.replaceLane(a4, 3, 1); Uint32x4.select(Bool32x4.splat(true), a4, a4); Uint32x4.equal(a4, a4); Uint32x4.notEqual(a4, a4); Uint32x4.lessThan(a4, a4); Uint32x4.lessThanOrEqual(a4, a4); Uint32x4.greaterThan(a4, a4); Uint32x4.greaterThanOrEqual(a4, a4); Uint32x4.and(a4, a4); Uint32x4.or(a4, a4); Uint32x4.xor(a4, a4); Uint32x4.not(a4, a4); Uint32x4.add(a4, a4); Uint32x4.sub(a4, a4); Uint32x4.mul(a4, a4); Uint32x4.shiftLeftByScalar(a4, 1); Uint32x4.shiftRightByScalar(a4, 1); Uint32x4.load(new Uint32Array(16), 0); Uint32x4.load1(new Uint32Array(16), 0); Uint32x4.load2(new Uint32Array(16), 0); Uint32x4.load3(new Uint32Array(16), 0); Uint32x4.store(new Uint32Array(16), 1, a4); Uint32x4.store1(new Uint32Array(16), 1, a4); Uint32x4.store2(new Uint32Array(16), 1, a4); Uint32x4.store3(new Uint32Array(16), 1, a4); Uint32x4.fromFloat32x4(Float32x4.splat(0)); Uint32x4.fromInt32x4(Int32x4.splat(0)); Uint32x4.fromFloat32x4Bits(Float32x4.splat(0)); Uint32x4.fromInt32x4Bits(Int32x4.splat(0)); Uint32x4.fromInt16x8Bits(Int16x8.splat(0)); Uint32x4.fromInt8x16Bits(Int8x16.splat(0)); Uint32x4.fromUint16x8Bits(Uint16x8.splat(0)); Uint32x4.fromUint8x16Bits(Uint8x16.splat(0)); Uint16x8.length; Uint16x8.name; Uint16x8.arguments; Uint16x8.caller; Uint16x8.prototype; Uint16x8.extractLane(a5, 7); Uint16x8.swizzle(a5, 0, 1, 2, 3, 4, 5, 6, 7); Uint16x8.shuffle(a5, a5, 0, 1, 2, 3, 4, 5, 6, 7); Uint16x8.check(a5); Uint16x8.splat(1); Uint16x8.replaceLane(a5, 7, 1); Uint16x8.select(Bool16x8.splat(true), a5, a5); Uint16x8.equal(a5, a5); Uint16x8.notEqual(a5, a5); Uint16x8.lessThan(a5, a5); Uint16x8.lessThanOrEqual(a5, a5); Uint16x8.greaterThan(a5, a5); Uint16x8.greaterThanOrEqual(a5, a5); Uint16x8.and(a5, a5); Uint16x8.or(a5, a5); Uint16x8.xor(a5, a5); Uint16x8.not(a5, a5); Uint16x8.add(a5, a5); Uint16x8.sub(a5, a5); Uint16x8.mul(a5, a5); Uint16x8.shiftLeftByScalar(a5, 1); Uint16x8.shiftRightByScalar(a5, 1); Uint16x8.addSaturate(a5, a5); Uint16x8.subSaturate(a5, a5); Uint16x8.load(new Uint16Array(16), 0); Uint16x8.store(new Uint16Array(16), 1, a5); Uint16x8.fromInt16x8(Int16x8.splat(0)); Uint16x8.fromFloat32x4Bits(Float32x4.splat(0)); Uint16x8.fromInt32x4Bits(Int32x4.splat(0)); Uint16x8.fromInt16x8Bits(Int16x8.splat(0)); Uint16x8.fromInt8x16Bits(Int8x16.splat(0)); Uint16x8.fromUint32x4Bits(Uint32x4.splat(0)); Uint16x8.fromUint8x16Bits(Uint8x16.splat(0)); Uint8x16.length; Uint8x16.name; Uint8x16.arguments; Uint8x16.caller; Uint8x16.prototype; Uint8x16.extractLane(a6, 15); Uint8x16.swizzle(a6, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); Uint8x16.shuffle(a6, a6, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); Uint8x16.check(a6); Uint8x16.splat(1); Uint8x16.replaceLane(a6, 15, 1); Uint8x16.select(Bool8x16.splat(true), a6, a6); Uint8x16.equal(a6, a6); Uint8x16.notEqual(a6, a6); Uint8x16.lessThan(a6, a6); Uint8x16.lessThanOrEqual(a6, a6); Uint8x16.greaterThan(a6, a6); Uint8x16.greaterThanOrEqual(a6, a6); Uint8x16.and(a6, a6); Uint8x16.or(a6, a6); Uint8x16.xor(a6, a6); Uint8x16.not(a6, a6); Uint8x16.add(a6, a6); Uint8x16.sub(a6, a6); Uint8x16.mul(a6, a6); Uint8x16.shiftLeftByScalar(a6, 1); Uint8x16.shiftRightByScalar(a6, 1); Uint8x16.addSaturate(a6, a6); Uint8x16.subSaturate(a6, a6); Uint8x16.load(new Uint8Array(16), 0); Uint8x16.store(new Uint8Array(16), 1, a6); Uint8x16.fromInt8x16(Int8x16.splat(0)); Uint8x16.fromFloat32x4Bits(Float32x4.splat(0)); Uint8x16.fromInt32x4Bits(Int32x4.splat(0)); Uint8x16.fromInt16x8Bits(Int16x8.splat(0)); Uint8x16.fromInt8x16Bits(Int8x16.splat(0)); Uint8x16.fromUint32x4Bits(Uint32x4.splat(0)); Uint8x16.fromUint16x8Bits(Uint16x8.splat(0)); Bool32x4.length; Bool32x4.name; Bool32x4.arguments; Bool32x4.caller; Bool32x4.prototype; Bool32x4.extractLane(a7, 3); Bool32x4.check(a7); Bool32x4.splat(true); Bool32x4.replaceLane(a7, 3, true); Bool32x4.allTrue(a7); Bool32x4.anyTrue(a7); Bool32x4.and(a7, a7); Bool32x4.or(a7, a7); Bool32x4.xor(a7, a7); Bool32x4.not(a7, a7); Bool16x8.length; Bool16x8.name; Bool16x8.arguments; Bool16x8.caller; Bool16x8.prototype; Bool16x8.extractLane(a8, 7); Bool16x8.check(a8); Bool16x8.splat(true); Bool16x8.replaceLane(a8, 7, true); Bool16x8.allTrue(a8); Bool16x8.anyTrue(a8); Bool16x8.and(a8, a8); Bool16x8.or(a8, a8); Bool16x8.xor(a8, a8); Bool16x8.not(a8, a8); Bool8x16.length; Bool8x16.name; Bool8x16.arguments; Bool8x16.caller; Bool8x16.prototype; Bool8x16.extractLane(a9, 15); Bool8x16.check(a9); Bool8x16.splat(true); Bool8x16.replaceLane(a9, 15, true); Bool8x16.allTrue(a9); Bool8x16.anyTrue(a9); Bool8x16.and(a9, a9); Bool8x16.or(a9, a9); Bool8x16.xor(a9, a9); Bool8x16.not(a9, a9); }
one-pieces/DefinitelyTyped
types/adone/test/glosses/math/simd.ts
TypeScript
mit
12,345
/** * @ngdoc object * @name ui.router.util.$resolve * * @requires $q * @requires $injector * * @description * Manages resolution of (acyclic) graphs of promises. */ $Resolve.$inject = ['$q', '$injector']; function $Resolve( $q, $injector) { var VISIT_IN_PROGRESS = 1, VISIT_DONE = 2, NOTHING = {}, NO_DEPENDENCIES = [], NO_LOCALS = NOTHING, NO_PARENT = extend($q.when(NOTHING), { $$promises: NOTHING, $$values: NOTHING }); /** * @ngdoc function * @name ui.router.util.$resolve#study * @methodOf ui.router.util.$resolve * * @description * Studies a set of invocables that are likely to be used multiple times. * <pre> * $resolve.study(invocables)(locals, parent, self) * </pre> * is equivalent to * <pre> * $resolve.resolve(invocables, locals, parent, self) * </pre> * but the former is more efficient (in fact `resolve` just calls `study` * internally). * * @param {object} invocables Invocable objects * @return {function} a function to pass in locals, parent and self */ this.study = function (invocables) { if (!isObject(invocables)) throw new Error("'invocables' must be an object"); // Perform a topological sort of invocables to build an ordered plan var plan = [], cycle = [], visited = {}; function visit(value, key) { if (visited[key] === VISIT_DONE) return; cycle.push(key); if (visited[key] === VISIT_IN_PROGRESS) { cycle.splice(0, cycle.indexOf(key)); throw new Error("Cyclic dependency: " + cycle.join(" -> ")); } visited[key] = VISIT_IN_PROGRESS; if (isString(value)) { plan.push(key, [ function() { return $injector.get(value); }], NO_DEPENDENCIES); } else { var params = $injector.annotate(value); forEach(params, function (param) { if (param !== key && invocables.hasOwnProperty(param)) visit(invocables[param], param); }); plan.push(key, value, params); } cycle.pop(); visited[key] = VISIT_DONE; } forEach(invocables, visit); invocables = cycle = visited = null; // plan is all that's required function isResolve(value) { return isObject(value) && value.then && value.$$promises; } return function (locals, parent, self) { if (isResolve(locals) && self === undefined) { self = parent; parent = locals; locals = null; } if (!locals) locals = NO_LOCALS; else if (!isObject(locals)) { throw new Error("'locals' must be an object"); } if (!parent) parent = NO_PARENT; else if (!isResolve(parent)) { throw new Error("'parent' must be a promise returned by $resolve.resolve()"); } // To complete the overall resolution, we have to wait for the parent // promise and for the promise for each invokable in our plan. var resolution = $q.defer(), result = resolution.promise, promises = result.$$promises = {}, values = extend({}, locals), wait = 1 + plan.length/3, merged = false; function done() { // Merge parent values we haven't got yet and publish our own $$values if (!--wait) { if (!merged) merge(values, parent.$$values); result.$$values = values; result.$$promises = true; // keep for isResolve() resolution.resolve(values); } } function fail(reason) { result.$$failure = reason; resolution.reject(reason); } // Short-circuit if parent has already failed if (isDefined(parent.$$failure)) { fail(parent.$$failure); return result; } // Merge parent values if the parent has already resolved, or merge // parent promises and wait if the parent resolve is still in progress. if (parent.$$values) { merged = merge(values, parent.$$values); done(); } else { extend(promises, parent.$$promises); parent.then(done, fail); } // Process each invocable in the plan, but ignore any where a local of the same name exists. for (var i=0, ii=plan.length; i<ii; i+=3) { if (locals.hasOwnProperty(plan[i])) done(); else invoke(plan[i], plan[i+1], plan[i+2]); } function invoke(key, invocable, params) { // Create a deferred for this invocation. Failures will propagate to the resolution as well. var invocation = $q.defer(), waitParams = 0; function onfailure(reason) { invocation.reject(reason); fail(reason); } // Wait for any parameter that we have a promise for (either from parent or from this // resolve; in that case study() will have made sure it's ordered before us in the plan). forEach(params, function (dep) { if (promises.hasOwnProperty(dep) && !locals.hasOwnProperty(dep)) { waitParams++; promises[dep].then(function (result) { values[dep] = result; if (!(--waitParams)) proceed(); }, onfailure); } }); if (!waitParams) proceed(); function proceed() { if (isDefined(result.$$failure)) return; try { invocation.resolve($injector.invoke(invocable, self, values)); invocation.promise.then(function (result) { values[key] = result; done(); }, onfailure); } catch (e) { onfailure(e); } } // Publish promise synchronously; invocations further down in the plan may depend on it. promises[key] = invocation.promise; } return result; }; }; /** * @ngdoc function * @name ui.router.util.$resolve#resolve * @methodOf ui.router.util.$resolve * * @description * Resolves a set of invocables. An invocable is a function to be invoked via * `$injector.invoke()`, and can have an arbitrary number of dependencies. * An invocable can either return a value directly, * or a `$q` promise. If a promise is returned it will be resolved and the * resulting value will be used instead. Dependencies of invocables are resolved * (in this order of precedence) * * - from the specified `locals` * - from another invocable that is part of this `$resolve` call * - from an invocable that is inherited from a `parent` call to `$resolve` * (or recursively * - from any ancestor `$resolve` of that parent). * * The return value of `$resolve` is a promise for an object that contains * (in this order of precedence) * * - any `locals` (if specified) * - the resolved return values of all injectables * - any values inherited from a `parent` call to `$resolve` (if specified) * * The promise will resolve after the `parent` promise (if any) and all promises * returned by injectables have been resolved. If any invocable * (or `$injector.invoke`) throws an exception, or if a promise returned by an * invocable is rejected, the `$resolve` promise is immediately rejected with the * same error. A rejection of a `parent` promise (if specified) will likewise be * propagated immediately. Once the `$resolve` promise has been rejected, no * further invocables will be called. * * Cyclic dependencies between invocables are not permitted and will caues `$resolve` * to throw an error. As a special case, an injectable can depend on a parameter * with the same name as the injectable, which will be fulfilled from the `parent` * injectable of the same name. This allows inherited values to be decorated. * Note that in this case any other injectable in the same `$resolve` with the same * dependency would see the decorated value, not the inherited value. * * Note that missing dependencies -- unlike cyclic dependencies -- will cause an * (asynchronous) rejection of the `$resolve` promise rather than a (synchronous) * exception. * * Invocables are invoked eagerly as soon as all dependencies are available. * This is true even for dependencies inherited from a `parent` call to `$resolve`. * * As a special case, an invocable can be a string, in which case it is taken to * be a service name to be passed to `$injector.get()`. This is supported primarily * for backwards-compatibility with the `resolve` property of `$routeProvider` * routes. * * @param {object} invocables functions to invoke or * `$injector` services to fetch. * @param {object} locals values to make available to the injectables * @param {object} parent a promise returned by another call to `$resolve`. * @param {object} self the `this` for the invoked methods * @return {object} Promise for an object that contains the resolved return value * of all invocables, as well as any inherited and local values. */ this.resolve = function (invocables, locals, parent, self) { return this.study(invocables)(locals, parent, self); }; } angular.module('ui.router.util').service('$resolve', $Resolve);
frangucc/gamify
www/famo/bower_components/angular-ui-router/src/resolve.js
JavaScript
mit
9,276
(function (root, factory) { if (typeof define === 'function' && define.amd) { define(['wavesurfer'], factory); } else { root.WaveSurfer.Timeline = factory(root.WaveSurfer); } }(this, function (WaveSurfer) { 'use strict'; WaveSurfer.Timeline = { init: function (params) { this.params = params; var wavesurfer = this.wavesurfer = params.wavesurfer; if (!this.wavesurfer) { throw Error('No WaveSurfer intance provided'); } var drawer = this.drawer = this.wavesurfer.drawer; this.container = 'string' == typeof params.container ? document.querySelector(params.container) : params.container; if (!this.container) { throw Error('No container for WaveSurfer timeline'); } this.width = drawer.width; this.height = this.params.height || 20; this.notchPercentHeight = this.params.notchPercentHeight || 90; this.primaryColor = this.params.primaryColor || '#000'; this.secondaryColor = this.params.secondaryColor || '#c0c0c0'; this.primaryFontColor = this.params.primaryFontColor || '#000'; this.secondaryFontColor = this.params.secondaryFontColor || '#000'; this.fontFamily = this.params.fontFamily || 'Arial'; this.fontSize = this.params.fontSize || 10; this.createWrapper(); this.createCanvas(); this.render(); wavesurfer.drawer.wrapper.onscroll = this.updateScroll.bind(this); wavesurfer.on('redraw', this.render.bind(this)); }, createWrapper: function () { var wsParams = this.wavesurfer.params; this.wrapper = this.container.appendChild( document.createElement('wave') ); this.drawer.style(this.wrapper, { display: 'block', position: 'relative', userSelect: 'none', webkitUserSelect: 'none', height: this.height + 'px' }); if (wsParams.fillParent || wsParams.scrollParent) { this.drawer.style(this.wrapper, { width: '100%', overflowX: 'hidden', overflowY: 'hidden' }); } var my = this; this.wrapper.addEventListener('click', function (e) { e.preventDefault(); var relX = 'offsetX' in e ? e.offsetX : e.layerX; my.fireEvent('click', (relX / my.wrapper.scrollWidth) || 0); }); }, createCanvas: function () { var canvas = this.canvas = this.wrapper.appendChild( document.createElement('canvas') ); this.timeCc = canvas.getContext('2d'); this.wavesurfer.drawer.style(canvas, { position: 'absolute', zIndex: 4 }); }, render: function () { this.updateCanvasStyle(); this.drawTimeCanvas(); }, updateCanvasStyle: function () { var width = Math.round(this.drawer.wrapper.scrollWidth / this.wavesurfer.params.pixelRatio); this.canvas.width = width; this.canvas.height = this.height; this.canvas.style.width = width + 'px'; }, drawTimeCanvas: function() { var backend = this.wavesurfer.backend, wsParams = this.wavesurfer.params, duration = backend.getDuration(); if (wsParams.fillParent && !wsParams.scrollParent) { var width = this.drawer.getWidth(); var pixelsPerSecond = width/duration; } else { var width = backend.getDuration() * wsParams.minPxPerSec; var pixelsPerSecond = wsParams.minPxPerSec; } pixelsPerSecond = pixelsPerSecond / wsParams.pixelRatio; if (duration > 0) { var curPixel = 0, curSeconds = 0, totalSeconds = parseInt(duration, 10) + 1, timeInterval = (pixelsPerSecond < 10) ? 10 : 1, formatTime = function(seconds) { if (seconds/60 > 1) { var minutes = parseInt(seconds / 60), seconds = parseInt(seconds % 60); seconds = (seconds < 10) ? '0' + seconds : seconds; return '' + minutes + ':' + seconds; } else { return seconds; } }; var height1 = this.height - 4, height2 = (this.height * (this.notchPercentHeight / 100.0)) - 4; for (var i = 0; i < totalSeconds/timeInterval; i++) { if (i % 10 == 0) { this.timeCc.fillStyle = this.primaryColor; this.timeCc.fillRect(curPixel, 0, 1, height1); this.timeCc.font = this.fontSize + 'px ' + this.fontFamily; this.timeCc.fillStyle = this.primaryFontColor; this.timeCc.fillText(formatTime(curSeconds), curPixel + 5, height1); } else if (i % 10 == 5) { this.timeCc.fillStyle = this.secondaryColor; this.timeCc.fillRect(curPixel, 0, 1, height1); this.timeCc.font = this.fontSize + 'px ' + this.fontFamily; this.timeCc.fillStyle = this.secondaryFontColor; this.timeCc.fillText(formatTime(curSeconds), curPixel + 5, height1); } else { this.timeCc.fillStyle = this.secondaryColor; this.timeCc.fillRect(curPixel, 0, 1, height2); } curSeconds += timeInterval; curPixel += pixelsPerSecond * timeInterval; } } }, updateScroll: function(e){ this.wrapper.scrollLeft = e.target.scrollLeft; } }; WaveSurfer.util.extend(WaveSurfer.Timeline, WaveSurfer.Observer); return WaveSurfer.Timeline; }));
pvnr0082t/cdnjs
ajax/libs/wavesurfer.js/1.0.2/plugin/wavesurfer.timeline.js
JavaScript
mit
6,460
/** * @license * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt */ // @version 0.5.0 window.WebComponents=window.WebComponents||{},function(e){var t=e.flags||{},n="webcomponents.js",r=document.querySelector('script[src*="'+n+'"]'),t={};if(!t.noOpts){if(location.search.slice(1).split("&").forEach(function(e){e=e.split("="),e[0]&&(t[e[0]]=e[1]||!0)}),r)for(var o,i=0;o=r.attributes[i];i++)"src"!==o.name&&(t[o.name]=o.value||!0);if(t.log){var a=t.log.split(",");t.log={},a.forEach(function(e){t.log[e]=!0})}else t.log={}}t.shadow=t.shadow||t.shadowdom||t.polyfill,t.shadow="native"===t.shadow?!1:t.shadow||!HTMLElement.prototype.createShadowRoot,t.register&&(window.CustomElements=window.CustomElements||{flags:{}},window.CustomElements.flags.register=t.register),e.flags=t}(WebComponents),"undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.prototype={set:function(t,n){var r=t[this.name];return r&&r[0]===t?r[1]=n:e(t,this.name,{value:[t,n],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=n}(),function(e){function t(e){_.push(e),w||(w=!0,h(r))}function n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function r(){w=!1;var e=_;_=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var n=e.takeRecords();o(e),n.length&&(e.callback_(n,e),t=!0)}),t&&r()}function o(e){e.nodes_.forEach(function(t){var n=v.get(t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function i(e,t){for(var n=e;n;n=n.parentNode){var r=v.get(n);if(r)for(var o=0;o<r.length;o++){var i=r[o],a=i.options;if(n===e||a.subtree){var s=t(a);s&&i.enqueue(s)}}}}function a(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++E}function s(e,t){this.type=e,this.target=t,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function d(e){var t=new s(e.type,e.target);return t.addedNodes=e.addedNodes.slice(),t.removedNodes=e.removedNodes.slice(),t.previousSibling=e.previousSibling,t.nextSibling=e.nextSibling,t.attributeName=e.attributeName,t.attributeNamespace=e.attributeNamespace,t.oldValue=e.oldValue,t}function c(e,t){return y=new s(e,t)}function u(e){return M?M:(M=d(y),M.oldValue=e,M)}function l(){y=M=void 0}function f(e){return e===M||e===y}function m(e,t){return e===t?e:M&&f(e)?M:null}function p(e,t,n){this.observer=e,this.target=t,this.options=n,this.transientObservedNodes=[]}var h,v=new WeakMap;if(/Trident/.test(navigator.userAgent))h=setTimeout;else if(window.setImmediate)h=window.setImmediate;else{var g=[],b=String(Math.random());window.addEventListener("message",function(e){if(e.data===b){var t=g;g=[],t.forEach(function(e){e()})}}),h=function(e){g.push(e),window.postMessage(b,"*")}}var w=!1,_=[],E=0;a.prototype={observe:function(e,t){if(e=n(e),!t.childList&&!t.attributes&&!t.characterData||t.attributeOldValue&&!t.attributes||t.attributeFilter&&t.attributeFilter.length&&!t.attributes||t.characterDataOldValue&&!t.characterData)throw new SyntaxError;var r=v.get(e);r||v.set(e,r=[]);for(var o,i=0;i<r.length;i++)if(r[i].observer===this){o=r[i],o.removeListeners(),o.options=t;break}o||(o=new p(this,e,t),r.push(o),this.nodes_.push(e)),o.addListeners()},disconnect:function(){this.nodes_.forEach(function(e){for(var t=v.get(e),n=0;n<t.length;n++){var r=t[n];if(r.observer===this){r.removeListeners(),t.splice(n,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}};var y,M;p.prototype={enqueue:function(e){var n=this.observer.records_,r=n.length;if(n.length>0){var o=n[r-1],i=m(o,e);if(i)return void(n[r-1]=i)}else t(this.observer);n[r]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=v.get(e);t||v.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=v.get(e),n=0;n<t.length;n++)if(t[n]===this){t.splice(n,1);break}},this)},handleEvent:function(e){switch(e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,n=e.relatedNode.namespaceURI,r=e.target,o=new c("attributes",r);o.attributeName=t,o.attributeNamespace=n;var a=e.attrChange===MutationEvent.ADDITION?null:e.prevValue;i(r,function(e){return!e.attributes||e.attributeFilter&&e.attributeFilter.length&&-1===e.attributeFilter.indexOf(t)&&-1===e.attributeFilter.indexOf(n)?void 0:e.attributeOldValue?u(a):o});break;case"DOMCharacterDataModified":var r=e.target,o=c("characterData",r),a=e.prevValue;i(r,function(e){return e.characterData?e.characterDataOldValue?u(a):o:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeInserted":var s,d,r=e.relatedNode,f=e.target;"DOMNodeInserted"===e.type?(s=[f],d=[]):(s=[],d=[f]);var m=f.previousSibling,p=f.nextSibling,o=c("childList",r);o.addedNodes=s,o.removedNodes=d,o.previousSibling=m,o.nextSibling=p,i(r,function(e){return e.childList?o:void 0})}l()}},e.JsMutationObserver=a,e.MutationObserver||(e.MutationObserver=a)}(this),window.HTMLImports=window.HTMLImports||{flags:{}},function(e){function t(e,t){t=t||p,r(function(){i(e,t)},t)}function n(e){return"complete"===e.readyState||e.readyState===g}function r(e,t){if(n(t))e&&e();else{var o=function(){("complete"===t.readyState||t.readyState===g)&&(t.removeEventListener(b,o),r(e,t))};t.addEventListener(b,o)}}function o(e){e.target.__loaded=!0}function i(e,t){function n(){s==d&&e&&e()}function r(e){o(e),s++,n()}var i=t.querySelectorAll("link[rel=import]"),s=0,d=i.length;if(d)for(var c,u=0;d>u&&(c=i[u]);u++)a(c)?r.call(c,{target:c}):(c.addEventListener("load",r),c.addEventListener("error",r));else n()}function a(e){return l?e.__loaded||e.import&&"loading"!==e.import.readyState:e.__importParsed}function s(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)d(t)&&c(t)}function d(e){return"link"===e.localName&&"import"===e.rel}function c(e){var t=e.import;t?o({target:e}):(e.addEventListener("load",o),e.addEventListener("error",o))}var u="import",l=Boolean(u in document.createElement("link")),f=Boolean(window.ShadowDOMPolyfill),m=function(e){return f?ShadowDOMPolyfill.wrapIfNeeded(e):e},p=m(document),h={get:function(){var e=HTMLImports.currentScript||document.currentScript||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null);return m(e)},configurable:!0};Object.defineProperty(document,"_currentScript",h),Object.defineProperty(p,"_currentScript",h);var v=/Trident/.test(navigator.userAgent),g=v?"complete":"interactive",b="readystatechange";l&&(new MutationObserver(function(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)t.addedNodes&&s(t.addedNodes)}).observe(document.head,{childList:!0}),function(){if("loading"===document.readyState)for(var e,t=document.querySelectorAll("link[rel=import]"),n=0,r=t.length;r>n&&(e=t[n]);n++)c(e)}()),t(function(){HTMLImports.ready=!0,HTMLImports.readyTime=(new Date).getTime(),p.dispatchEvent(new CustomEvent("HTMLImportsLoaded",{bubbles:!0}))}),e.IMPORT_LINK_TYPE=u,e.useNative=l,e.rootDocument=p,e.whenReady=t,e.isIE=v}(HTMLImports),function(e){var t=[],n=function(e){t.push(e)},r=function(){t.forEach(function(t){t(e)})};e.addModule=n,e.initializeModules=r}(HTMLImports),HTMLImports.addModule(function(e){var t=/(url\()([^)]*)(\))/g,n=/(@import[\s]+(?!url\())([^;]*)(;)/g,r={resolveUrlsInStyle:function(e){var t=e.ownerDocument,n=t.createElement("a");return e.textContent=this.resolveUrlsInCssText(e.textContent,n),e},resolveUrlsInCssText:function(e,r){var o=this.replaceUrls(e,r,t);return o=this.replaceUrls(o,r,n)},replaceUrls:function(e,t,n){return e.replace(n,function(e,n,r,o){var i=r.replace(/["']/g,"");return t.href=i,i=t.href,n+"'"+i+"'"+o})}};e.path=r}),HTMLImports.addModule(function(e){xhr={async:!0,ok:function(e){return e.status>=200&&e.status<300||304===e.status||0===e.status},load:function(t,n,r){var o=new XMLHttpRequest;return(e.flags.debug||e.flags.bust)&&(t+="?"+Math.random()),o.open("GET",t,xhr.async),o.addEventListener("readystatechange",function(){if(4===o.readyState){var e=o.getResponseHeader("Location"),t=null;if(e)var t="/"===e.substr(0,1)?location.origin+e:e;n.call(r,!xhr.ok(o)&&o,o.response||o.responseText,t)}}),o.send(),o},loadDocument:function(e,t,n){this.load(e,t,n).responseType="document"}},e.xhr=xhr}),HTMLImports.addModule(function(e){var t=e.xhr,n=e.flags,r=function(e,t){this.cache={},this.onload=e,this.oncomplete=t,this.inflight=0,this.pending={}};r.prototype={addNodes:function(e){this.inflight+=e.length;for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)this.require(t);this.checkDone()},addNode:function(e){this.inflight++,this.require(e),this.checkDone()},require:function(e){var t=e.src||e.href;e.__nodeUrl=t,this.dedupe(t,e)||this.fetch(t,e)},dedupe:function(e,t){if(this.pending[e])return this.pending[e].push(t),!0;return this.cache[e]?(this.onload(e,t,this.cache[e]),this.tail(),!0):(this.pending[e]=[t],!1)},fetch:function(e,r){if(n.load&&console.log("fetch",e,r),e.match(/^data:/)){var o=e.split(","),i=o[0],a=o[1];a=i.indexOf(";base64")>-1?atob(a):decodeURIComponent(a),setTimeout(function(){this.receive(e,r,null,a)}.bind(this),0)}else{var s=function(t,n,o){this.receive(e,r,t,n,o)}.bind(this);t.load(e,s)}},receive:function(e,t,n,r,o){this.cache[e]=r;for(var i,a=this.pending[e],s=0,d=a.length;d>s&&(i=a[s]);s++)this.onload(e,i,r,n,o),this.tail();this.pending[e]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}},e.Loader=r}),HTMLImports.addModule(function(e){var t=function(e){this.addCallback=e,this.mo=new MutationObserver(this.handler.bind(this))};t.prototype={handler:function(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)"childList"===t.type&&t.addedNodes.length&&this.addedNodes(t.addedNodes)},addedNodes:function(e){this.addCallback&&this.addCallback(e);for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)t.children&&t.children.length&&this.addedNodes(t.children)},observe:function(e){this.mo.observe(e,{childList:!0,subtree:!0})}},e.Observer=t}),HTMLImports.addModule(function(e){function t(e){return"link"===e.localName&&e.rel===u}function n(e){var t=r(e);return"data:text/javascript;charset=utf-8,"+encodeURIComponent(t)}function r(e){return e.textContent+o(e)}function o(e){var t=e.ownerDocument;t.__importedScripts=t.__importedScripts||0;var n=e.ownerDocument.baseURI,r=t.__importedScripts?"-"+t.__importedScripts:"";return t.__importedScripts++,"\n//# sourceURL="+n+r+".js\n"}function i(e){var t=e.ownerDocument.createElement("style");return t.textContent=e.textContent,a.resolveUrlsInStyle(t),t}var a=e.path,s=e.rootDocument,d=e.flags,c=e.isIE,u=e.IMPORT_LINK_TYPE,l="link[rel="+u+"]",f={documentSelectors:l,importsSelectors:[l,"link[rel=stylesheet]","style","script:not([type])",'script[type="text/javascript"]'].join(","),map:{link:"parseLink",script:"parseScript",style:"parseStyle"},dynamicElements:[],parseNext:function(){var e=this.nextToParse();e&&this.parse(e)},parse:function(e){if(this.isParsed(e))return void(d.parse&&console.log("[%s] is already parsed",e.localName));var t=this[this.map[e.localName]];t&&(this.markParsing(e),t.call(this,e))},parseDynamic:function(e,t){this.dynamicElements.push(e),t||this.parseNext()},markParsing:function(e){d.parse&&console.log("parsing",e),this.parsingElement=e},markParsingComplete:function(e){e.__importParsed=!0,this.markDynamicParsingComplete(e),e.__importElement&&(e.__importElement.__importParsed=!0,this.markDynamicParsingComplete(e.__importElement)),this.parsingElement=null,d.parse&&console.log("completed",e)},markDynamicParsingComplete:function(e){var t=this.dynamicElements.indexOf(e);t>=0&&this.dynamicElements.splice(t,1)},parseImport:function(e){if(HTMLImports.__importsParsingHook&&HTMLImports.__importsParsingHook(e),e.import&&(e.import.__importParsed=!0),this.markParsingComplete(e),e.dispatchEvent(e.__resource&&!e.__error?new CustomEvent("load",{bubbles:!1}):new CustomEvent("error",{bubbles:!1})),e.__pending)for(var t;e.__pending.length;)t=e.__pending.shift(),t&&t({target:e});this.parseNext()},parseLink:function(e){t(e)?this.parseImport(e):(e.href=e.href,this.parseGeneric(e))},parseStyle:function(e){var t=e;e=i(e),e.__importElement=t,this.parseGeneric(e)},parseGeneric:function(e){this.trackElement(e),this.addElementToDocument(e)},rootImportForElement:function(e){for(var t=e;t.ownerDocument.__importLink;)t=t.ownerDocument.__importLink;return t},addElementToDocument:function(e){for(var t=this.rootImportForElement(e.__importElement||e),n=t.__insertedElements=t.__insertedElements||0,r=t.nextElementSibling,o=0;n>o;o++)r=r&&r.nextElementSibling;t.parentNode.insertBefore(e,r)},trackElement:function(e,t){var n=this,r=function(r){t&&t(r),n.markParsingComplete(e),n.parseNext()};if(e.addEventListener("load",r),e.addEventListener("error",r),c&&"style"===e.localName){var o=!1;if(-1==e.textContent.indexOf("@import"))o=!0;else if(e.sheet){o=!0;for(var i,a=e.sheet.cssRules,s=a?a.length:0,d=0;s>d&&(i=a[d]);d++)i.type===CSSRule.IMPORT_RULE&&(o=o&&Boolean(i.styleSheet))}o&&e.dispatchEvent(new CustomEvent("load",{bubbles:!1}))}},parseScript:function(t){var r=document.createElement("script");r.__importElement=t,r.src=t.src?t.src:n(t),e.currentScript=t,this.trackElement(r,function(){r.parentNode.removeChild(r),e.currentScript=null}),this.addElementToDocument(r)},nextToParse:function(){return this._mayParse=[],!this.parsingElement&&(this.nextToParseInDoc(s)||this.nextToParseDynamic())},nextToParseInDoc:function(e,n){if(e&&this._mayParse.indexOf(e)<0){this._mayParse.push(e);for(var r,o=e.querySelectorAll(this.parseSelectorsForNode(e)),i=0,a=o.length;a>i&&(r=o[i]);i++)if(!this.isParsed(r))return this.hasResource(r)?t(r)?this.nextToParseInDoc(r.import,r):r:void 0}return n},nextToParseDynamic:function(){return this.dynamicElements[0]},parseSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===s?this.documentSelectors:this.importsSelectors},isParsed:function(e){return e.__importParsed},needsDynamicParsing:function(e){return this.dynamicElements.indexOf(e)>=0},hasResource:function(e){return t(e)&&void 0===e.import?!1:!0}};e.parser=f,e.IMPORT_SELECTOR=l}),HTMLImports.addModule(function(e){function t(e){return n(e,i)}function n(e,t){return"link"===e.localName&&e.getAttribute("rel")===t}function r(e,t){var n=document.implementation.createHTMLDocument(i);n._URL=t;var r=n.createElement("base");r.setAttribute("href",t),n.baseURI||(n.baseURI=t);var o=n.createElement("meta");return o.setAttribute("charset","utf-8"),n.head.appendChild(o),n.head.appendChild(r),n.body.innerHTML=e,window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(n),n}var o=e.flags,i=e.IMPORT_LINK_TYPE,a=e.IMPORT_SELECTOR,s=e.rootDocument,d=e.Loader,c=e.Observer,u=e.parser,l={documents:{},documentPreloadSelectors:a,importsPreloadSelectors:[a].join(","),loadNode:function(e){f.addNode(e)},loadSubtree:function(e){var t=this.marshalNodes(e);f.addNodes(t)},marshalNodes:function(e){return e.querySelectorAll(this.loadSelectorsForNode(e))},loadSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===s?this.documentPreloadSelectors:this.importsPreloadSelectors},loaded:function(e,n,i,a,s){if(o.load&&console.log("loaded",e,n),n.__resource=i,n.__error=a,t(n)){var d=this.documents[e];void 0===d&&(d=a?null:r(i,s||e),d&&(d.__importLink=n,this.bootDocument(d)),this.documents[e]=d),n.import=d}u.parseNext()},bootDocument:function(e){this.loadSubtree(e),this.observer.observe(e),u.parseNext()},loadedAll:function(){u.parseNext()}},f=new d(l.loaded.bind(l),l.loadedAll.bind(l));if(l.observer=new c,!document.baseURI){var m={get:function(){var e=document.querySelector("base");return e?e.href:window.location.href},configurable:!0};Object.defineProperty(document,"baseURI",m),Object.defineProperty(s,"baseURI",m)}e.importer=l,e.importLoader=f}),HTMLImports.addModule(function(e){var t=e.parser,n=e.importer,r={added:function(e){for(var r,o,i,a=0,s=e.length;s>a&&(i=e[a]);a++)r||(r=i.ownerDocument,o=t.isParsed(r)),loading=this.shouldLoadNode(i),loading&&n.loadNode(i),this.shouldParseNode(i)&&o&&t.parseDynamic(i,loading)},shouldLoadNode:function(e){return 1===e.nodeType&&o.call(e,n.loadSelectorsForNode(e))},shouldParseNode:function(e){return 1===e.nodeType&&o.call(e,t.parseSelectorsForNode(e))}};n.observer.addCallback=r.added.bind(r);var o=HTMLElement.prototype.matches||HTMLElement.prototype.matchesSelector||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector}),function(e){function t(){HTMLImports.importer.bootDocument(n)}if(initializeModules=e.initializeModules,!e.useNative){"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){var n=document.createEvent("HTMLEvents");return n.initEvent(e,t.bubbles===!1?!1:!0,t.cancelable===!1?!1:!0,t.detail),n}),initializeModules();var n=e.rootDocument;"complete"===document.readyState||"interactive"===document.readyState&&!window.attachEvent?t():document.addEventListener("DOMContentLoaded",t)}}(HTMLImports),window.CustomElements=window.CustomElements||{flags:{}},function(e){var t=e.flags,n=[],r=function(e){n.push(e)},o=function(){n.forEach(function(t){t(e)})};e.addModule=r,e.initializeModules=o,e.hasNative=Boolean(document.registerElement),e.useNative=!t.register&&e.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||HTMLImports.useNative)}(CustomElements),CustomElements.addModule(function(e){function t(e,t){n(e,function(e){return t(e)?!0:void r(e,t)}),r(e,t)}function n(e,t,r){var o=e.firstElementChild;if(!o)for(o=e.firstChild;o&&o.nodeType!==Node.ELEMENT_NODE;)o=o.nextSibling;for(;o;)t(o,r)!==!0&&n(o,t,r),o=o.nextElementSibling;return null}function r(e,n){for(var r=e.shadowRoot;r;)t(r,n),r=r.olderShadowRoot}function o(e,t){a=[],i(e,t),a=null}function i(e,t){if(e=wrap(e),!(a.indexOf(e)>=0)){a.push(e);for(var n,r=e.querySelectorAll("link[rel="+s+"]"),o=0,d=r.length;d>o&&(n=r[o]);o++)n.import&&i(n.import,t);t(e)}}var a,s=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none";e.forDocumentTree=o,e.forSubtree=t}),CustomElements.addModule(function(e){function t(e){return n(e)||r(e)}function n(t){return e.upgrade(t)?!0:void s(t)}function r(e){_(e,function(e){return n(e)?!0:void 0})}function o(e){s(e),f(e)&&_(e,function(e){s(e)})}function i(e){L.push(e),M||(M=!0,setTimeout(a))}function a(){M=!1;for(var e,t=L,n=0,r=t.length;r>n&&(e=t[n]);n++)e();L=[]}function s(e){y?i(function(){d(e)}):d(e)}function d(e){e.__upgraded__&&(e.attachedCallback||e.detachedCallback)&&!e.__attached&&f(e)&&(e.__attached=!0,e.attachedCallback&&e.attachedCallback())}function c(e){u(e),_(e,function(e){u(e)})}function u(e){y?i(function(){l(e)}):l(e)}function l(e){e.__upgraded__&&(e.attachedCallback||e.detachedCallback)&&e.__attached&&!f(e)&&(e.__attached=!1,e.detachedCallback&&e.detachedCallback())}function f(e){for(var t=e,n=wrap(document);t;){if(t==n)return!0;t=t.parentNode||t.host}}function m(e){if(e.shadowRoot&&!e.shadowRoot.__watched){w.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)v(t),t=t.olderShadowRoot}}function p(e){if(w.dom){var n=e[0];if(n&&"childList"===n.type&&n.addedNodes&&n.addedNodes){for(var r=n.addedNodes[0];r&&r!==document&&!r.host;)r=r.parentNode;var o=r&&(r.URL||r._URL||r.host&&r.host.localName)||"";o=o.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",e.length,o||"")}e.forEach(function(e){"childList"===e.type&&(N(e.addedNodes,function(e){e.localName&&t(e)}),N(e.removedNodes,function(e){e.localName&&c(e)}))}),w.dom&&console.groupEnd()}function h(e){for(e=wrap(e),e||(e=wrap(document));e.parentNode;)e=e.parentNode;var t=e.__observer;t&&(p(t.takeRecords()),a())}function v(e){if(!e.__observer){var t=new MutationObserver(p);t.observe(e,{childList:!0,subtree:!0}),e.__observer=t}}function g(e){e=wrap(e),w.dom&&console.group("upgradeDocument: ",e.baseURI.split("/").pop()),t(e),v(e),w.dom&&console.groupEnd()}function b(e){E(e,g)}var w=e.flags,_=e.forSubtree,E=e.forDocumentTree,y=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;e.hasPolyfillMutations=y;var M=!1,L=[],N=Array.prototype.forEach.call.bind(Array.prototype.forEach),T=Element.prototype.createShadowRoot;Element.prototype.createShadowRoot=function(){var e=T.call(this);return CustomElements.watchShadow(this),e},e.watchShadow=m,e.upgradeDocumentTree=b,e.upgradeSubtree=r,e.upgradeAll=t,e.attachedNode=o,e.takeRecords=h}),CustomElements.addModule(function(e){function t(t){if(!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var r=t.getAttribute("is"),o=e.getRegisteredDefinition(r||t.localName);if(o){if(r&&o.tag==t.localName)return n(t,o);if(!r&&!o.extends)return n(t,o)}}}function n(t,n){return a.upgrade&&console.group("upgrade:",t.localName),n.is&&t.setAttribute("is",n.is),r(t,n),t.__upgraded__=!0,i(t),e.attachedNode(t),e.upgradeSubtree(t),a.upgrade&&console.groupEnd(),t}function r(e,t){Object.__proto__?e.__proto__=t.prototype:(o(e,t.prototype,t.native),e.__proto__=t.prototype)}function o(e,t,n){for(var r={},o=t;o!==n&&o!==HTMLElement.prototype;){for(var i,a=Object.getOwnPropertyNames(o),s=0;i=a[s];s++)r[i]||(Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(o,i)),r[i]=1);o=Object.getPrototypeOf(o)}}function i(e){e.createdCallback&&e.createdCallback()}var a=e.flags;e.upgrade=t,e.upgradeWithDefinition=n,e.implementPrototype=r}),CustomElements.addModule(function(e){function t(t,r){var d=r||{};if(!t)throw new Error("document.registerElement: first argument `name` must not be empty");if(t.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(t)+"'.");if(o(t))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(t)+"'. The type name is invalid.");if(c(t))throw new Error("DuplicateDefinitionError: a type with name '"+String(t)+"' is already registered");return d.prototype||(d.prototype=Object.create(HTMLElement.prototype)),d.__name=t.toLowerCase(),d.lifecycle=d.lifecycle||{},d.ancestry=i(d.extends),a(d),s(d),n(d.prototype),u(d.__name,d),d.ctor=l(d),d.ctor.prototype=d.prototype,d.prototype.constructor=d.ctor,e.ready&&v(document),d.ctor}function n(e){if(!e.setAttribute._polyfilled){var t=e.setAttribute;e.setAttribute=function(e,n){r.call(this,e,n,t)};var n=e.removeAttribute;e.removeAttribute=function(e){r.call(this,e,null,n)},e.setAttribute._polyfilled=!0}}function r(e,t,n){e=e.toLowerCase();var r=this.getAttribute(e);n.apply(this,arguments);var o=this.getAttribute(e);this.attributeChangedCallback&&o!==r&&this.attributeChangedCallback(e,r,o)}function o(e){for(var t=0;t<E.length;t++)if(e===E[t])return!0}function i(e){var t=c(e);return t?i(t.extends).concat([t]):[]}function a(e){for(var t,n=e.extends,r=0;t=e.ancestry[r];r++)n=t.is&&t.tag;e.tag=n||e.__name,n&&(e.is=e.__name)}function s(e){if(!Object.__proto__){var t=HTMLElement.prototype;if(e.is){var n=document.createElement(e.tag),r=Object.getPrototypeOf(n);r===e.prototype&&(t=r)}for(var o,i=e.prototype;i&&i!==t;)o=Object.getPrototypeOf(i),i.__proto__=o,i=o;e.native=t}}function d(e){return b(L(e.tag),e)}function c(e){return e?y[e.toLowerCase()]:void 0}function u(e,t){y[e]=t}function l(e){return function(){return d(e)}}function f(e,t,n){return e===M?m(t,n):N(e,t)}function m(e,t){var n=c(t||e);if(n){if(e==n.tag&&t==n.is)return new n.ctor;if(!t&&!n.is)return new n.ctor}var r;return t?(r=m(e),r.setAttribute("is",t),r):(r=L(e),e.indexOf("-")>=0&&w(r,HTMLElement),r)}function p(e){var t=T.call(this,e);return g(t),t}var h,v=e.upgradeDocumentTree,g=e.upgrade,b=e.upgradeWithDefinition,w=e.implementPrototype,_=e.useNative,E=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],y={},M="http://www.w3.org/1999/xhtml",L=document.createElement.bind(document),N=document.createElementNS.bind(document),T=Node.prototype.cloneNode;h=Object.__proto__||_?function(e,t){return e instanceof t}:function(e,t){for(var n=e;n;){if(n===t.prototype)return!0;n=n.__proto__}return!1},document.registerElement=t,document.createElement=m,document.createElementNS=f,Node.prototype.cloneNode=p,e.registry=y,e.instanceof=h,e.reservedTagList=E,e.getRegisteredDefinition=c,document.register=document.registerElement}),function(e){function t(){i(wrap(document)),window.HTMLImports&&(HTMLImports.__importsParsingHook=function(e){i(wrap(e.import))}),CustomElements.ready=!0,setTimeout(function(){CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}var n=e.useNative,r=e.initializeModules;if(n){var o=function(){};e.watchShadow=o,e.upgrade=o,e.upgradeAll=o,e.upgradeDocumentTree=o,e.upgradeSubtree=o,e.takeRecords=o,e.instanceof=function(e,t){return e instanceof t}}else r();var i=e.upgradeDocumentTree;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){return e}),"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){t=t||{};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),n},window.CustomEvent.prototype=window.Event.prototype),"complete"===document.readyState||e.flags.eager)t();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var a=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(a,t)}else t()}(window.CustomElements),function(){var e=document.createElement("style");e.textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n";var t=document.querySelector("head");t.insertBefore(e,t.firstChild)}(window.WebComponents);
xeodou/cdnjs
ajax/libs/webcomponentsjs/0.5.0/webcomponents-lite.min.js
JavaScript
mit
27,597
.cke_dialog{visibility:visible}.cke_dialog_body{z-index:1;background:#eaeaea;border:1px solid #b2b2b2;border-bottom-color:#999;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;-moz-box-shadow:0 0 3px rgba(0,0,0,.15);-webkit-box-shadow:0 0 3px rgba(0,0,0,.15);box-shadow:0 0 3px rgba(0,0,0,.15)}.cke_dialog strong{font-weight:700}.cke_dialog_title{font-weight:700;font-size:13px;cursor:move;position:relative;color:#474747;text-shadow:0 1px 0 rgba(255,255,255,.75);border-bottom:1px solid #999;padding:6px 10px;-moz-border-radius:2px 2px 0 0;-webkit-border-radius:2px 2px 0 0;border-radius:2px 2px 0 0;-moz-box-shadow:0 1px 0 #fff inset;-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset;background:#cfd1cf;background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#cfd1cf));background-image:-moz-linear-gradient(top,#f5f5f5,#cfd1cf);background-image:-webkit-linear-gradient(top,#f5f5f5,#cfd1cf);background-image:-o-linear-gradient(top,#f5f5f5,#cfd1cf);background-image:-ms-linear-gradient(top,#f5f5f5,#cfd1cf);background-image:linear-gradient(top,#f5f5f5,#cfd1cf);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#f5f5f5', endColorstr='#cfd1cf')}.cke_dialog_contents{background-color:#fff;overflow:auto;padding:15px 10px 5px;margin-top:30px;border-top:1px solid #bfbfbf;-moz-border-radius:0 0 3px 3px;-webkit-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px}.cke_dialog_contents_body{overflow:auto;padding:17px 10px 5px;margin-top:22px}.cke_dialog_footer{text-align:right;position:relative;border:0;outline:#bfbfbf solid 1px;-moz-box-shadow:0 1px 0 #fff inset;-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset;-moz-border-radius:0 0 2px 2px;-webkit-border-radius:0 0 2px 2px;border-radius:0 0 2px 2px;background:#cfd1cf;background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#cfd1cf));background-image:-moz-linear-gradient(top,#ebebeb,#cfd1cf);background-image:-webkit-linear-gradient(top,#ebebeb,#cfd1cf);background-image:-o-linear-gradient(top,#ebebeb,#cfd1cf);background-image:-ms-linear-gradient(top,#ebebeb,#cfd1cf);background-image:linear-gradient(top,#ebebeb,#cfd1cf);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#ebebeb', endColorstr='#cfd1cf')}.cke_rtl .cke_dialog_footer{text-align:left}.cke_hc .cke_dialog_footer{outline:0;border-top:1px solid #fff}.cke_dialog .cke_resizer{margin-top:22px}.cke_dialog .cke_resizer_rtl{margin-left:5px}.cke_dialog .cke_resizer_ltr{margin-right:5px}.cke_dialog_tabs{height:24px;display:inline-block;margin:5px 0 0;position:absolute;z-index:2;left:10px}.cke_rtl .cke_dialog_tabs{right:10px}a.cke_dialog_tab{height:16px;padding:4px 8px;margin-right:3px;display:inline-block;cursor:pointer;line-height:16px;outline:0;color:#595959;border:1px solid #bfbfbf;-moz-border-radius:3px 3px 0 0;-webkit-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;background:#d4d4d4;background-image:-webkit-gradient(linear,left top,left bottom,from(#fafafa),to(#ededed));background-image:-moz-linear-gradient(top,#fafafa,#ededed);background-image:-webkit-linear-gradient(top,#fafafa,#ededed);background-image:-o-linear-gradient(top,#fafafa,#ededed);background-image:-ms-linear-gradient(top,#fafafa,#ededed);background-image:linear-gradient(top,#fafafa,#ededed);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#fafafa', endColorstr='#ededed')}.cke_rtl a.cke_dialog_tab{margin-right:0;margin-left:3px}a.cke_dialog_tab:hover{background:#ebebeb;background:-moz-linear-gradient(top,#ebebeb 0,#dfdfdf 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#ebebeb),color-stop(100%,#dfdfdf));background:-webkit-linear-gradient(top,#ebebeb 0,#dfdfdf 100%);background:-o-linear-gradient(top,#ebebeb 0,#dfdfdf 100%);background:-ms-linear-gradient(top,#ebebeb 0,#dfdfdf 100%);background:linear-gradient(to bottom,#ebebeb 0,#dfdfdf 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ebebeb', endColorstr='#dfdfdf', GradientType=0)}a.cke_dialog_tab_selected{background:#fff;color:#383838;border-bottom-color:#fff;cursor:default;filter:none}a.cke_dialog_tab_selected:hover{background:#ededed;background:-moz-linear-gradient(top,#ededed 0,#fff 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#ededed),color-stop(100%,#fff));background:-webkit-linear-gradient(top,#ededed 0,#fff 100%);background:-o-linear-gradient(top,#ededed 0,#fff 100%);background:-ms-linear-gradient(top,#ededed 0,#fff 100%);background:linear-gradient(to bottom,#ededed 0,#fff 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#ffffff', GradientType=0)}.cke_hc a.cke_dialog_tab:hover,.cke_hc a.cke_dialog_tab_selected{border:3px solid;padding:2px 6px}a.cke_dialog_tab_disabled{color:#bababa;cursor:default}.cke_single_page .cke_dialog_tabs{display:none}.cke_single_page .cke_dialog_contents{padding-top:5px;margin-top:0;border-top:0}.cke_dialog_close_button{background-image:url(images/close.png);background-repeat:no-repeat;background-position:50%;position:absolute;cursor:pointer;text-align:center;height:20px;width:20px;z-index:5;opacity:.8;filter:alpha(opacity=80)}.cke_dialog_close_button:hover{opacity:1;filter:alpha(opacity=100)}.cke_hidpi .cke_dialog_close_button{background-image:url(images/hidpi/close.png);background-size:16px}.cke_dialog_close_button span{display:none}.cke_hc .cke_dialog_close_button span{display:inline;cursor:pointer;font-weight:700;position:relative;top:3px}.cke_ltr .cke_dialog_close_button{right:5px}.cke_rtl .cke_dialog_close_button{left:6px}.cke_dialog_close_button{top:4px}div.cke_disabled .cke_dialog_ui_labeled_content div *{background-color:#ddd;cursor:default}.cke_dialog_ui_hbox table,.cke_dialog_ui_vbox table{margin:auto}.cke_dialog_ui_vbox_child{padding:5px 0}.cke_dialog_ui_hbox{width:100%}.cke_dialog_ui_hbox_child,.cke_dialog_ui_hbox_first,.cke_dialog_ui_hbox_last{vertical-align:top}.cke_ltr .cke_dialog_ui_hbox_child,.cke_ltr .cke_dialog_ui_hbox_first{padding-right:10px}.cke_rtl .cke_dialog_ui_hbox_child,.cke_rtl .cke_dialog_ui_hbox_first{padding-left:10px}.cke_ltr .cke_dialog_footer_buttons .cke_dialog_ui_hbox_child,.cke_ltr .cke_dialog_footer_buttons .cke_dialog_ui_hbox_first{padding-right:5px}.cke_rtl .cke_dialog_footer_buttons .cke_dialog_ui_hbox_child,.cke_rtl .cke_dialog_footer_buttons .cke_dialog_ui_hbox_first{padding-left:5px;padding-right:0}.cke_hc div.cke_dialog_ui_input_file,.cke_hc div.cke_dialog_ui_input_password,.cke_hc div.cke_dialog_ui_input_select,.cke_hc div.cke_dialog_ui_input_text,.cke_hc div.cke_dialog_ui_input_textarea{border:1px solid}textarea.cke_dialog_ui_input_textarea{overflow:auto;resize:none}input.cke_dialog_ui_input_password,input.cke_dialog_ui_input_text,textarea.cke_dialog_ui_input_textarea{background-color:#fff;border:1px solid #c9cccf;border-top-color:#aeb3b9;padding:4px 6px;outline:0;width:100%;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;-moz-box-shadow:0 1px 2px rgba(0,0,0,.15) inset;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.15) inset;box-shadow:0 1px 2px rgba(0,0,0,.15) inset}input.cke_dialog_ui_input_password:hover,input.cke_dialog_ui_input_text:hover,textarea.cke_dialog_ui_input_textarea:hover{border:1px solid #aeb3b9;border-top-color:#a0a6ad}input.cke_dialog_ui_input_password:focus,input.cke_dialog_ui_input_text:focus,select.cke_dialog_ui_input_select:focus,textarea.cke_dialog_ui_input_textarea:focus{outline:0;border:1px solid #139ff7;border-top-color:#1392e9}a.cke_dialog_ui_button{display:inline-block;padding:4px 0;margin:0;text-align:center;color:#333;vertical-align:middle;cursor:pointer;border:1px solid #b6b6b6;border-bottom-color:#999;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;-moz-box-shadow:0 1px 0 rgba(255,255,255,.5),0 0 2px rgba(255,255,255,.15) inset,0 1px 0 rgba(255,255,255,.15) inset;-webkit-box-shadow:0 1px 0 rgba(255,255,255,.5),0 0 2px rgba(255,255,255,.15) inset,0 1px 0 rgba(255,255,255,.15) inset;box-shadow:0 1px 0 rgba(255,255,255,.5),0 0 2px rgba(255,255,255,.15) inset,0 1px 0 rgba(255,255,255,.15) inset;background:#e4e4e4;background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#e4e4e4));background-image:-moz-linear-gradient(top,#fff,#e4e4e4);background-image:-webkit-linear-gradient(top,#fff,#e4e4e4);background-image:-o-linear-gradient(top,#fff,#e4e4e4);background-image:-ms-linear-gradient(top,#fff,#e4e4e4);background-image:linear-gradient(top,#fff,#e4e4e4);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#ffffff', endColorstr='#e4e4e4')}span.cke_dialog_ui_button{padding:0 10px}a.cke_dialog_ui_button:hover{border-color:#9e9e9e;background:#ccc;background:-webkit-gradient(linear,left top,left bottom,from(#f2f2f2),to(#ccc)) #ccc;background:-moz-linear-gradient(top,#f2f2f2,#ccc) #ccc;background:-webkit-linear-gradient(top,#f2f2f2,#ccc) #ccc;background:-o-linear-gradient(top,#f2f2f2,#ccc) #ccc;background:-ms-linear-gradient(top,#f2f2f2,#ccc) #ccc;background:linear-gradient(top,#f2f2f2,#ccc) #ccc;filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#f2f2f2', endColorstr='#cccccc')}a.cke_dialog_ui_button:active,a.cke_dialog_ui_button:focus{border-color:#969696;outline:0;-moz-box-shadow:0 0 6px rgba(0,0,0,.4) inset;-webkit-box-shadow:0 0 6px rgba(0,0,0,.4) inset;box-shadow:0 0 6px rgba(0,0,0,.4) inset}.cke_hc a.cke_dialog_ui_button:active,.cke_hc a.cke_dialog_ui_button:focus,.cke_hc a.cke_dialog_ui_button:hover{border:3px solid;padding-top:1px;padding-bottom:1px}.cke_hc a.cke_dialog_ui_button:active span,.cke_hc a.cke_dialog_ui_button:focus span,.cke_hc a.cke_dialog_ui_button:hover span{padding-left:10px;padding-right:10px}.cke_dialog_footer_buttons a.cke_dialog_ui_button span{color:inherit;font-size:12px;font-weight:700;line-height:18px;padding:0 12px}a.cke_dialog_ui_button_ok{color:#fff;text-shadow:0 -1px 0 #55830c;border-color:#62a60a #62a60a #4d9200;background:#69b10b;background-image:-webkit-gradient(linear,0 0,0 100%,from(#9ad717),to(#69b10b));background-image:-webkit-linear-gradient(top,#9ad717,#69b10b);background-image:-o-linear-gradient(top,#9ad717,#69b10b);background-image:linear-gradient(to bottom,#9ad717,#69b10b);background-image:-moz-linear-gradient(top,#9ad717,#69b10b);filter:progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#9ad717', endColorstr='#69b10b')}a.cke_dialog_ui_button_ok:hover{border-color:#5b9909 #5b9909 #478500;background:#88be14;background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#88be14),color-stop(100%,#5d9c0a));background:-webkit-linear-gradient(top,#88be14 0,#5d9c0a 100%);background:-o-linear-gradient(top,#88be14 0,#5d9c0a 100%);background:linear-gradient(to bottom,#88be14 0,#5d9c0a 100%);background:-moz-linear-gradient(top,#88be14 0,#5d9c0a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#88be14', endColorstr='#5d9c0a', GradientType=0)}a.cke_dialog_ui_button span{text-shadow:0 1px 0 #fff}a.cke_dialog_ui_button_ok span{text-shadow:0 -1px 0 #55830c}span.cke_dialog_ui_button{cursor:pointer}a.cke_dialog_ui_button_cancel:active,a.cke_dialog_ui_button_cancel:focus,a.cke_dialog_ui_button_ok:active,a.cke_dialog_ui_button_ok:focus{border-width:2px;padding:3px 0}a.cke_dialog_ui_button_ok:active,a.cke_dialog_ui_button_ok:focus{border-color:#568c0a}a.cke_dialog_ui_button_cancel:active span,a.cke_dialog_ui_button_cancel:focus span,a.cke_dialog_ui_button_ok:active span,a.cke_dialog_ui_button_ok:focus span{padding:0 11px}.cke_dialog_footer_buttons{display:inline-table;margin:5px;width:auto;position:relative;vertical-align:middle}div.cke_dialog_ui_input_select{display:table}select.cke_dialog_ui_input_select{height:25px;line-height:25px;background-color:#fff;border:1px solid #c9cccf;border-top-color:#aeb3b9;padding:3px 3px 3px 6px;outline:0;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;-moz-box-shadow:0 1px 2px rgba(0,0,0,.15) inset;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.15) inset;box-shadow:0 1px 2px rgba(0,0,0,.15) inset}.cke_dialog_ui_input_file{width:100%;height:25px}.cke_hc .cke_dialog_ui_labeled_content input:focus,.cke_hc .cke_dialog_ui_labeled_content select:focus,.cke_hc .cke_dialog_ui_labeled_content textarea:focus{outline:dotted 1px}.cke_dialog .cke_dark_background{background-color:#dedede}.cke_dialog .cke_light_background{background-color:#ebebeb}.cke_dialog .cke_centered{text-align:center}.cke_dialog a.cke_btn_reset{float:right;background:url(images/refresh.png) top left no-repeat;width:16px;height:16px;border:1px;font-size:1px}.cke_hidpi .cke_dialog a.cke_btn_reset{background-size:16px;background-image:url(images/hidpi/refresh.png)}.cke_rtl .cke_dialog a.cke_btn_reset{float:left}.cke_dialog a.cke_btn_locked,.cke_dialog a.cke_btn_unlocked{float:left;width:16px;height:16px;background-repeat:no-repeat;border:none;font-size:1px}.cke_dialog a.cke_btn_locked .cke_icon{display:none}.cke_rtl .cke_dialog a.cke_btn_locked,.cke_rtl .cke_dialog a.cke_btn_unlocked{float:right}.cke_dialog a.cke_btn_locked{background-image:url(images/lock.png)}.cke_dialog a.cke_btn_unlocked{background-image:url(images/lock-open.png)}.cke_hidpi .cke_dialog a.cke_btn_locked,.cke_hidpi .cke_dialog a.cke_btn_unlocked{background-size:16px}.cke_hidpi .cke_dialog a.cke_btn_locked{background-image:url(images/hidpi/lock.png)}.cke_hidpi .cke_dialog a.cke_btn_unlocked{background-image:url(images/hidpi/lock-open.png)}.cke_dialog .cke_btn_over{border:1px outset;cursor:pointer}.cke_dialog .ImagePreviewBox{border:2px ridge #000;overflow:scroll;height:200px;width:300px;padding:2px;background-color:#fff}.cke_dialog .ImagePreviewBox table td{white-space:normal}.cke_dialog .ImagePreviewLoader{position:absolute;white-space:normal;overflow:hidden;height:160px;width:230px;margin:2px;padding:2px;opacity:.9;filter:alpha(opacity=90);background-color:#e4e4e4}.cke_dialog .FlashPreviewBox{white-space:normal;border:2px ridge #000;overflow:auto;height:160px;width:390px;padding:2px;background-color:#fff}.cke_dialog .cke_pastetext{width:346px;height:170px}.cke_dialog .cke_pastetext textarea{width:340px;height:170px;resize:none}.cke_dialog iframe.cke_pasteframe{width:346px;height:130px;background-color:#fff;border:1px solid #aeb3b9;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px}.cke_dialog .cke_hand{cursor:pointer}.cke_disabled{color:#a0a0a0}.cke_dialog_body .cke_label{display:none}.cke_dialog_body label{display:inline;margin-bottom:auto;cursor:default}.cke_dialog_body label.cke_required{font-weight:700}a.cke_smile{overflow:hidden;display:block;text-align:center;padding:.3em 0}a.cke_smile img{vertical-align:middle}a.cke_specialchar{cursor:inherit;display:block;height:1.25em;padding:.2em .3em;text-align:center}a.cke_smile,a.cke_specialchar{border:1px solid transparent}a.cke_smile:active,a.cke_smile:focus,a.cke_smile:hover,a.cke_specialchar:active,a.cke_specialchar:focus,a.cke_specialchar:hover{background:#fff;outline:0}a.cke_smile:hover,a.cke_specialchar:hover{border-color:#888}a.cke_smile:active,a.cke_smile:focus,a.cke_specialchar:active,a.cke_specialchar:focus{border-color:#139ff7}.cke_dialog_contents a.colorChooser{display:block;margin-top:6px;margin-left:10px;width:80px}.cke_rtl .cke_dialog_contents a.colorChooser{margin-right:10px}.cke_btn_over,.cke_dialog_ui_checkbox_input:focus,.cke_dialog_ui_radio_input:focus{outline:#696969 dotted 1px}.cke_iframe_shim{display:block;position:absolute;top:0;left:0;z-index:-1;filter:alpha(opacity=0);width:100%;height:100%}
IonicaBizauKitchen/cdnjs
ajax/libs/ckeditor/4.4.5/skins/moono/dialog.min.css
CSS
mit
15,719
/* Solarized theme for code-mirror http://ethanschoonover.com/solarized */ /* Solarized color pallet http://ethanschoonover.com/solarized/img/solarized-palette.png */ .solarized.base03 { color: #002b36; } .solarized.base02 { color: #073642; } .solarized.base01 { color: #586e75; } .solarized.base00 { color: #657b83; } .solarized.base0 { color: #839496; } .solarized.base1 { color: #93a1a1; } .solarized.base2 { color: #eee8d5; } .solarized.base3 { color: #fdf6e3; } .solarized.solar-yellow { color: #b58900; } .solarized.solar-orange { color: #cb4b16; } .solarized.solar-red { color: #dc322f; } .solarized.solar-magenta { color: #d33682; } .solarized.solar-violet { color: #6c71c4; } .solarized.solar-blue { color: #268bd2; } .solarized.solar-cyan { color: #2aa198; } .solarized.solar-green { color: #859900; } /* Color scheme for code-mirror */ .cm-s-solarized { line-height: 1.45em; color-profile: sRGB; rendering-intent: auto; } .cm-s-solarized.cm-s-dark { color: #839496; background-color: #002b36; text-shadow: #002b36 0 1px; } .cm-s-solarized.cm-s-light { background-color: #fdf6e3; color: #657b83; text-shadow: #eee8d5 0 1px; } .cm-s-solarized .CodeMirror-widget { text-shadow: none; } .cm-s-solarized .cm-keyword { color: #cb4b16 } .cm-s-solarized .cm-atom { color: #d33682; } .cm-s-solarized .cm-number { color: #d33682; } .cm-s-solarized .cm-def { color: #2aa198; } .cm-s-solarized .cm-variable { color: #268bd2; } .cm-s-solarized .cm-variable-2 { color: #b58900; } .cm-s-solarized .cm-variable-3 { color: #6c71c4; } .cm-s-solarized .cm-property { color: #2aa198; } .cm-s-solarized .cm-operator {color: #6c71c4;} .cm-s-solarized .cm-comment { color: #586e75; font-style:italic; } .cm-s-solarized .cm-string { color: #859900; } .cm-s-solarized .cm-string-2 { color: #b58900; } .cm-s-solarized .cm-meta { color: #859900; } .cm-s-solarized .cm-qualifier { color: #b58900; } .cm-s-solarized .cm-builtin { color: #d33682; } .cm-s-solarized .cm-bracket { color: #cb4b16; } .cm-s-solarized .CodeMirror-matchingbracket { color: #859900; } .cm-s-solarized .CodeMirror-nonmatchingbracket { color: #dc322f; } .cm-s-solarized .cm-tag { color: #93a1a1 } .cm-s-solarized .cm-attribute { color: #2aa198; } .cm-s-solarized .cm-header { color: #586e75; } .cm-s-solarized .cm-quote { color: #93a1a1; } .cm-s-solarized .cm-hr { color: transparent; border-top: 1px solid #586e75; display: block; } .cm-s-solarized .cm-link { color: #93a1a1; cursor: pointer; } .cm-s-solarized .cm-special { color: #6c71c4; } .cm-s-solarized .cm-em { color: #999; text-decoration: underline; text-decoration-style: dotted; } .cm-s-solarized .cm-strong { color: #eee; } .cm-s-solarized .cm-tab:before { content: "➤"; /*visualize tab character*/ color: #586e75; position:absolute; } .cm-s-solarized .cm-error, .cm-s-solarized .cm-invalidchar { color: #586e75; border-bottom: 1px dotted #dc322f; } .cm-s-solarized.cm-s-dark .CodeMirror-selected { background: #073642; } .cm-s-solarized.cm-s-light .CodeMirror-selected { background: #eee8d5; } /* Editor styling */ /* Little shadow on the view-port of the buffer view */ .cm-s-solarized.CodeMirror { -moz-box-shadow: inset 7px 0 12px -6px #000; -webkit-box-shadow: inset 7px 0 12px -6px #000; box-shadow: inset 7px 0 12px -6px #000; } /* Gutter border and some shadow from it */ .cm-s-solarized .CodeMirror-gutters { border-right: 1px solid; } /* Gutter colors and line number styling based of color scheme (dark / light) */ /* Dark */ .cm-s-solarized.cm-s-dark .CodeMirror-gutters { background-color: #002b36; border-color: #00232c; } .cm-s-solarized.cm-s-dark .CodeMirror-linenumber { text-shadow: #021014 0 -1px; } /* Light */ .cm-s-solarized.cm-s-light .CodeMirror-gutters { background-color: #fdf6e3; border-color: #eee8d5; } /* Common */ .cm-s-solarized .CodeMirror-linenumber { color: #586e75; padding: 0 5px; } .cm-s-solarized .CodeMirror-gutter .CodeMirror-gutter-text { color: #586e75; } .cm-s-solarized .CodeMirror-lines .CodeMirror-cursor { border-left: 1px solid #819090; } /* Active line. Negative margin compensates left padding of the text in the view-port */ .cm-s-solarized.cm-s-dark .CodeMirror-activeline-background { background: rgba(255, 255, 255, 0.10); } .cm-s-solarized.cm-s-light .CodeMirror-activeline-background { background: rgba(0, 0, 0, 0.10); }
AbsoluteMSTR/cdnjs
ajax/libs/codemirror/4.2.0/theme/solarized.css
CSS
mit
4,411
/* Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang("a11yhelp","mn",{title:"Accessibility Instructions",contents:"Help Contents. To close this dialog press ESC.",legend:[{name:"Ерөнхий",items:[{name:"Editor Toolbar",legend:"Press ${toolbarFocus} to navigate to the toolbar. Move to the next and previous toolbar group with TAB and SHIFT-TAB. Move to the next and previous toolbar button with RIGHT ARROW or LEFT ARROW. Press SPACE or ENTER to activate the toolbar button."},{name:"Editor Dialog",legend:"Inside a dialog, press TAB to navigate to next dialog field, press SHIFT + TAB to move to previous field, press ENTER to submit dialog, press ESC to cancel dialog. For dialogs that have multiple tab pages, press ALT + F10 to navigate to tab-list. Then move to next tab with TAB OR RIGTH ARROW. Move to previous tab with SHIFT + TAB or LEFT ARROW. Press SPACE or ENTER to select the tab page."}, {name:"Editor Context Menu",legend:"Press ${contextMenu} or APPLICATION KEY to open context-menu. Then move to next menu option with TAB or DOWN ARROW. Move to previous option with SHIFT+TAB or UP ARROW. Press SPACE or ENTER to select the menu option. Open sub-menu of current option with SPACE or ENTER or RIGHT ARROW. Go back to parent menu item with ESC or LEFT ARROW. Close context menu with ESC."},{name:"Editor List Box",legend:"Inside a list-box, move to next list item with TAB OR DOWN ARROW. Move to previous list item with SHIFT + TAB or UP ARROW. Press SPACE or ENTER to select the list option. Press ESC to close the list-box."}, {name:"Editor Element Path Bar",legend:"Press ${elementsPathFocus} to navigate to the elements path bar. Move to next element button with TAB or RIGHT ARROW. Move to previous button with SHIFT+TAB or LEFT ARROW. Press SPACE or ENTER to select the element in editor."}]},{name:"Commands",items:[{name:" Undo command",legend:"Press ${undo}"},{name:" Redo command",legend:"Press ${redo}"},{name:" Bold command",legend:"Press ${bold}"},{name:" Italic command",legend:"Press ${italic}"},{name:" Underline command", legend:"Press ${underline}"},{name:" Link command",legend:"Press ${link}"},{name:" Toolbar Collapse command",legend:"Press ${toolbarCollapse}"},{name:" Access previous focus space command",legend:"Press ${accessPreviousSpace} to access the closest unreachable focus space before the caret, for example: two adjacent HR elements. Repeat the key combination to reach distant focus spaces."},{name:" Access next focus space command",legend:"Press ${accessNextSpace} to access the closest unreachable focus space after the caret, for example: two adjacent HR elements. Repeat the key combination to reach distant focus spaces."}, {name:" Accessibility Help",legend:"Press ${a11yHelp}"}]}],backspace:"Backspace",tab:"Tab",enter:"Enter",shift:"Shift",ctrl:"Ctrl",alt:"Alt",pause:"Pause",capslock:"Caps Lock",escape:"Escape",pageUp:"Page Up",pageDown:"Page Down",end:"End",home:"Home",leftArrow:"Left Arrow",upArrow:"Up Arrow",rightArrow:"Right Arrow",downArrow:"Down Arrow",insert:"Insert","delete":"Delete",leftWindowKey:"Left Windows key",rightWindowKey:"Right Windows key",selectKey:"Select key",numpad0:"Numpad 0",numpad1:"Numpad 1", numpad2:"Numpad 2",numpad3:"Numpad 3",numpad4:"Numpad 4",numpad5:"Numpad 5",numpad6:"Numpad 6",numpad7:"Numpad 7",numpad8:"Numpad 8",numpad9:"Numpad 9",multiply:"Multiply",add:"Add",subtract:"Subtract",decimalPoint:"Decimal Point",divide:"Divide",f1:"F1",f2:"F2",f3:"F3",f4:"F4",f5:"F5",f6:"F6",f7:"F7",f8:"F8",f9:"F9",f10:"F10",f11:"F11",f12:"F12",numLock:"Num Lock",scrollLock:"Scroll Lock",semiColon:"Semicolon",equalSign:"Equal Sign",comma:"Comma",dash:"Dash",period:"Period",forwardSlash:"Forward Slash", graveAccent:"Grave Accent",openBracket:"Open Bracket",backSlash:"Backslash",closeBracket:"Close Bracket",singleQuote:"Single Quote"});
ruiaraujo/cdnjs
ajax/libs/ckeditor/4.4.1/plugins/a11yhelp/dialogs/lang/mn.js
JavaScript
mit
3,956
var isObject = require('./isObject'); /** `Object#toString` result references. */ var funcTag = '[object Function]'; /** Used for native method references. */ var objectProto = Object.prototype; /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objToString = objectProto.toString; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in older versions of Chrome and Safari which return 'function' for regexes // and Safari 8 which returns 'object' for typed array constructors. return isObject(value) && objToString.call(value) == funcTag; } module.exports = isFunction;
wheeyls/sadistic-timer
node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-regenerator/node_modules/babel-types/node_modules/lodash/lang/isFunction.js
JavaScript
mit
1,058
var isObject = require('./isObject'); /** `Object#toString` result references. */ var funcTag = '[object Function]'; /** Used for native method references. */ var objectProto = Object.prototype; /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objToString = objectProto.toString; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in older versions of Chrome and Safari which return 'function' for regexes // and Safari 8 which returns 'object' for typed array constructors. return isObject(value) && objToString.call(value) == funcTag; } module.exports = isFunction;
as110/as110.github.io
node_modules/grunt-jscs/node_modules/jscs/node_modules/lodash/lang/isFunction.js
JavaScript
mit
1,058
!function(a){"use strict";var b=function(a,b){return void 0===b&&(b=0),Math.round(a*Math.pow(10,b))/Math.pow(10,b)},c=function(b,c,d){var e=c;c.nodeType&&(e=a.data(c,"wsjPicker")||a.data(c,"wsjPicker",{})),b?a.extend(!0,e,d):a.extend(e,d)},d=function(b,c){var d,e,f,g=this,h=b.find("img").eq(0),i=0,j=100,k=100,l=0,m=100,n=100,o=0,p=0,q=new Array,r=function(a){for(var b=0;b<q.length;b++)q[b].call(g,g,a)},s=function(c){var f=b.offset();d={l:0|f.left,t:0|f.top},clearTimeout(e),e=setTimeout(function(){v.call(g,c)},0),a(document).on("mousemove",t).on("mouseup",u),c.preventDefault()},t=function(a){return clearTimeout(e),e=setTimeout(function(){v.call(g,a)},0),a.stopPropagation(),a.preventDefault(),!1},u=function(b){return a(document).off("mouseup",u).off("mousemove",t),b.stopPropagation(),b.preventDefault(),!1},v=function(a){var c=a.pageX-d.l,e=a.pageY-d.t,f=b.w,h=b.h;0>c?c=0:c>f&&(c=f),0>e?e=0:e>h&&(e=h),x.call(g,"xy",{x:c/f*k+i,y:e/h*n+l})},w=function(){var a=0,c=0,d=b.w,e=b.h,g=h.w,i=h.h;clearTimeout(f),f=setTimeout(function(){k>0&&(a=o==j?d:o/k*d|0),n>0&&(c=p==m?e:p/n*e|0),g>=d?a=(d>>1)-(g>>1):a-=g>>1,i>=e?c=(e>>1)-(i>>1):c-=i>>1,h.css({left:a+"px",top:c+"px"})},0)},x=function(a,b,c){var d=void 0!==b;if(!d)switch((void 0===a||null==a)&&(a="xy"),a.toLowerCase()){case"x":return o;case"y":return p;case"xy":default:return{x:o,y:p}}if(null==c||c!=g){var e,f,h=!1;switch(null==a&&(a="xy"),a.toLowerCase()){case"x":e=b&&(b.x&&0|b.x||0|b)||0;break;case"y":f=b&&(b.y&&0|b.y||0|b)||0;break;case"xy":default:e=b&&b.x&&0|b.x||0,f=b&&b.y&&0|b.y||0}null!=e&&(i>e?e=i:e>j&&(e=j),o!=e&&(o=e,h=!0)),null!=f&&(l>f?f=l:f>m&&(f=m),p!=f&&(p=f,h=!0)),h&&r.call(g,c||g)}},y=function(a,b){var c=void 0!==b;if(!c)switch((void 0===a||null==a)&&(a="all"),a.toLowerCase()){case"minx":return i;case"maxx":return j;case"rangex":return{minX:i,maxX:j,rangeX:k};case"miny":return l;case"maxy":return m;case"rangey":return{minY:l,maxY:m,rangeY:n};case"all":default:return{minX:i,maxX:j,rangeX:k,minY:l,maxY:m,rangeY:n}}var d,e,f,g;switch(null==a&&(a="all"),a.toLowerCase()){case"minx":d=b&&(b.minX&&0|b.minX||0|b)||0;break;case"maxx":e=b&&(b.maxX&&0|b.maxX||0|b)||0;break;case"rangex":d=b&&b.minX&&0|b.minX||0,e=b&&b.maxX&&0|b.maxX||0;break;case"miny":f=b&&(b.minY&&0|b.minY||0|b)||0;break;case"maxy":g=b&&(b.maxY&&0|b.maxY||0|b)||0;break;case"rangey":f=b&&b.minY&&0|b.minY||0,g=b&&b.maxY&&0|b.maxY||0;break;case"all":default:d=b&&b.minX&&0|b.minX||0,e=b&&b.maxX&&0|b.maxX||0,f=b&&b.minY&&0|b.minY||0,g=b&&b.maxY&&0|b.maxY||0}null!=d&&i!=d&&(i=d,k=j-i),null!=e&&j!=e&&(j=e,k=j-i),null!=f&&l!=f&&(l=f,n=m-l),null!=g&&m!=g&&(m=g,n=m-l)},z=function(b){a.isFunction(b)&&q.push(b)},A=function(b){if(a.isFunction(b))for(var c;-1!=(c=a.inArray(b,q));)q.splice(c,1)},B=function(){a(document).off("mouseup",u).off("mousemove",t),b.off("mousedown",s),b=null,h=null,q=null};a.extend(!0,g,{val:x,range:y,bind:z,unbind:A,destroy:B}),h.src=c.arrow&&c.arrow.image,h.w=c.arrow&&c.arrow.width||h.width(),h.h=c.arrow&&c.arrow.height||h.height(),b.w=c.map&&c.map.width||b.width(),b.h=c.map&&c.map.height||b.height(),b.on("mousedown",s),z.call(g,w)},e=function(a,d,e,f){var g=this,h=a.find("td.Text input"),i=h.eq(3),j=h.eq(4),k=h.eq(5),l=h.length>7?h.eq(6):null,m=h.eq(0),n=h.eq(1),o=h.eq(2),p=h.eq(h.length>7?7:6),q=h.length>7?h.eq(8):null,r=function(a){if(""!=a.target.value||a.target==p.get(0)||(null==e||a.target==e.get(0))&&null!=e){if(!u(a))return a;switch(a.target){case i.get(0):switch(a.keyCode){case 38:return i.val(v.call(g,(i.val()<<0)+1,0,255)),d.val("r",i.val(),a.target),!1;case 40:return i.val(v.call(g,(i.val()<<0)-1,0,255)),d.val("r",i.val(),a.target),!1}break;case j.get(0):switch(a.keyCode){case 38:return j.val(v.call(g,(j.val()<<0)+1,0,255)),d.val("g",j.val(),a.target),!1;case 40:return j.val(v.call(g,(j.val()<<0)-1,0,255)),d.val("g",j.val(),a.target),!1}break;case k.get(0):switch(a.keyCode){case 38:return k.val(v.call(g,(k.val()<<0)+1,0,255)),d.val("b",k.val(),a.target),!1;case 40:return k.val(v.call(g,(k.val()<<0)-1,0,255)),d.val("b",k.val(),a.target),!1}break;case l&&l.get(0):switch(a.keyCode){case 38:return l.val(v.call(g,parseFloat(l.val())+1,0,100)),d.val("a",b(255*l.val()/100,f),a.target),!1;case 40:return l.val(v.call(g,parseFloat(l.val())-1,0,100)),d.val("a",b(255*l.val()/100,f),a.target),!1}break;case m.get(0):switch(a.keyCode){case 38:return m.val(v.call(g,(m.val()<<0)+1,0,360)),d.val("h",m.val(),a.target),!1;case 40:return m.val(v.call(g,(m.val()<<0)-1,0,360)),d.val("h",m.val(),a.target),!1}break;case n.get(0):switch(a.keyCode){case 38:return n.val(v.call(g,(n.val()<<0)+1,0,100)),d.val("s",n.val(),a.target),!1;case 40:return n.val(v.call(g,(n.val()<<0)-1,0,100)),d.val("s",n.val(),a.target),!1}break;case o.get(0):switch(a.keyCode){case 38:return o.val(v.call(g,(o.val()<<0)+1,0,100)),d.val("v",o.val(),a.target),!1;case 40:return o.val(v.call(g,(o.val()<<0)-1,0,100)),d.val("v",o.val(),a.target),!1}}}},s=function(a){if(""!=a.target.value||a.target==p.get(0)||(null==e||a.target==e.get(0))&&null!=e){if(!u(a))return a;switch(a.target){case i.get(0):i.val(v.call(g,i.val(),0,255)),d.val("r",i.val(),a.target);break;case j.get(0):j.val(v.call(g,j.val(),0,255)),d.val("g",j.val(),a.target);break;case k.get(0):k.val(v.call(g,k.val(),0,255)),d.val("b",k.val(),a.target);break;case l&&l.get(0):l.val(v.call(g,l.val(),0,100)),d.val("a",b(255*l.val()/100,f),a.target);break;case m.get(0):m.val(v.call(g,m.val(),0,360)),d.val("h",m.val(),a.target);break;case n.get(0):n.val(v.call(g,n.val(),0,100)),d.val("s",n.val(),a.target);break;case o.get(0):o.val(v.call(g,o.val(),0,100)),d.val("v",o.val(),a.target);break;case p.get(0):p.val(p.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),e&&e.val(p.val()),d.val("hex",""!=p.val()?p.val():null,a.target);break;case e&&e.get(0):e.val(e.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),p.val(e.val()),d.val("hex",""!=e.val()?e.val():null,a.target);break;case q&&q.get(0):q.val(q.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2)),d.val("a",null!=q.val()?parseInt(q.val(),16):null,a.target)}}},t=function(a){if(null!=d.val())switch(a.target){case i.get(0):i.val(d.val("r"));break;case j.get(0):j.val(d.val("g"));break;case k.get(0):k.val(d.val("b"));break;case l&&l.get(0):l.val(b(100*d.val("a")/255,f));break;case m.get(0):m.val(d.val("h"));break;case n.get(0):n.val(d.val("s"));break;case o.get(0):o.val(d.val("v"));break;case p.get(0):case e&&e.get(0):p.val(d.val("hex")),e&&e.val(d.val("hex"));break;case q&&q.get(0):q.val(d.val("ahex").substring(6))}},u=function(a){switch(a.keyCode){case 9:case 16:case 29:case 37:case 39:return!1;case"c".charCodeAt():case"v".charCodeAt():if(a.ctrlKey)return!1}return!0},v=function(a,b,c){return""==a||isNaN(a)?b:a>c?c:b>a?b:a},w=function(a,c){var d=a.val("all");c!=i.get(0)&&i.val(null!=d?d.r:""),c!=j.get(0)&&j.val(null!=d?d.g:""),c!=k.get(0)&&k.val(null!=d?d.b:""),l&&c!=l.get(0)&&l.val(null!=d?b(100*d.a/255,f):""),c!=m.get(0)&&m.val(null!=d?d.h:""),c!=n.get(0)&&n.val(null!=d?d.s:""),c!=o.get(0)&&o.val(null!=d?d.v:""),c!=p.get(0)&&(e&&c!=e.get(0)||!e)&&p.val(null!=d?d.hex:""),e&&c!=e.get(0)&&c!=p.get(0)&&e.val(null!=d?d.hex:""),q&&c!=q.get(0)&&q.val(null!=d?d.ahex.substring(6):"")},x=function(){i.add(j).add(k).add(l).add(m).add(n).add(o).add(p).add(e).add(q).off("keyup",s).off("blur",t),i.add(j).add(k).add(l).add(m).add(n).add(o).off("keydown",r),d.off(w),i=null,j=null,k=null,l=null,m=null,n=null,o=null,p=null,q=null};c(!0,g,{destroy:x}),i.add(j).add(k).add(l).add(m).add(n).add(o).add(p).add(e).add(q).on("keyup",s).on("blur",t),i.add(j).add(k).add(l).add(m).add(n).add(o).on("keydown",r),d.bind(w)};a.wsjPicker={List:[],Color:function(b){var d,e,f,g,i,j,k,l=this,m=new Array,n=function(a){for(var b=0;b<m.length;b++)m[b].call(l,l,a)},o=function(a,b,c){var m=void 0!==b;if(!m){if((void 0===a||null==a||""==a)&&(a="all"),null==d)return null;switch(a.toLowerCase()){case"ahex":return h.rgbaToHex({r:d,g:e,b:f,a:g});case"hex":return o("ahex").substring(0,6);case"all":return{r:d,g:e,b:f,a:g,h:i,s:j,v:k,hex:o.call(l,"hex"),ahex:o.call(l,"ahex")};default:for(var p={},q=0;q<a.length;q++)switch(a.charAt(q)){case"r":1==a.length?p=d:p.r=d;break;case"g":1==a.length?p=e:p.g=e;break;case"b":1==a.length?p=f:p.b=f;break;case"a":1==a.length?p=g:p.a=g;break;case"h":1==a.length?p=i:p.h=i;break;case"s":1==a.length?p=j:p.s=j;break;case"v":1==a.length?p=k:p.v=k}return p=={}?o.call(l,"all"):p}}if(null==c||c!=l){var r=!1;if(null==a&&(a=""),null==b)return null!=d&&(d=null,r=!0),null!=e&&(e=null,r=!0),null!=f&&(f=null,r=!0),null!=g&&(g=null,r=!0),null!=i&&(i=null,r=!0),null!=j&&(j=null,r=!0),null!=k&&(k=null,r=!0),void(r&&n.call(l,c||l));switch(a.toLowerCase()){case"ahex":case"hex":var p=h.hexToRgba(b&&(b.ahex||b.hex)||b||"00000000");o.call(l,"rgba",{r:p.r,g:p.g,b:p.b,a:"ahex"==a?p.a:null!=g?g:255},c);break;default:if(b&&(null!=b.ahex||null!=b.hex))return void o.call(l,"ahex",b.ahex||b.hex||"00000000",c);var s={},t=!1,u=!1;void 0!==b.r&&-1==!a.indexOf("r")&&(a+="r"),void 0!==b.g&&-1==!a.indexOf("g")&&(a+="g"),void 0!==b.b&&-1==!a.indexOf("b")&&(a+="b"),void 0!==b.a&&-1==!a.indexOf("a")&&(a+="a"),void 0!==b.h&&-1==!a.indexOf("h")&&(a+="h"),void 0!==b.s&&-1==!a.indexOf("s")&&(a+="s"),void 0!==b.v&&-1==!a.indexOf("v")&&(a+="v");for(var q=0;q<a.length;q++)switch(a.charAt(q)){case"r":if(u)continue;t=!0,s.r=b&&b.r&&0|b.r||b&&0|b||0,s.r<0?s.r=0:s.r>255&&(s.r=255),d!=s.r&&(d=s.r,r=!0);break;case"g":if(u)continue;t=!0,s.g=b&&b.g&&0|b.g||b&&0|b||0,s.g<0?s.g=0:s.g>255&&(s.g=255),e!=s.g&&(e=s.g,r=!0);break;case"b":if(u)continue;t=!0,s.b=b&&b.b&&0|b.b||b&&0|b||0,s.b<0?s.b=0:s.b>255&&(s.b=255),f!=s.b&&(f=s.b,r=!0);break;case"a":s.a=b&&null!=b.a?0|b.a:null!=b?0|b:255,s.a<0?s.a=0:s.a>255&&(s.a=255),g!=s.a&&(g=s.a,r=!0);break;case"h":if(t)continue;u=!0,s.h=b&&b.h&&0|b.h||b&&0|b||0,s.h<0?s.h=0:s.h>360&&(s.h=360),i!=s.h&&(i=s.h,r=!0);break;case"s":if(t)continue;u=!0,s.s=b&&null!=b.s?0|b.s:null!=b?0|b:100,s.s<0?s.s=0:s.s>100&&(s.s=100),j!=s.s&&(j=s.s,r=!0);break;case"v":if(t)continue;u=!0,s.v=b&&null!=b.v?0|b.v:null!=b?0|b:100,s.v<0?s.v=0:s.v>100&&(s.v=100),k!=s.v&&(k=s.v,r=!0)}if(r){if(t){d=d||0,e=e||0,f=f||0;var p=h.rgbToHsv({r:d,g:e,b:f});i=p.h,j=p.s,k=p.v}else if(u){i=i||0,j=null!=j?j:100,k=null!=k?k:100;var p=h.hsvToRgb({h:i,s:j,v:k});d=p.r,e=p.g,f=p.b}g=null!=g?g:255,n.call(l,c||l)}}}},p=function(b){a.isFunction(b)&&m.push(b)},q=function(b){if(a.isFunction(b))for(var c;-1!=(c=a.inArray(b,m));)m.splice(c,1)},r=function(){m=null};c(!0,l,{val:o,bind:p,unbind:q,destroy:r}),b&&(null!=b.ahex?o("ahex",b):null!=b.hex?o((null!=b.a?"a":"")+"hex",null!=b.a?{ahex:b.hex+h.intToHex(b.a)}:b):null!=b.r&&null!=b.g&&null!=b.b?o("rgb"+(null!=b.a?"a":""),b):null!=b.h&&null!=b.s&&null!=b.v&&o("hsv"+(null!=b.a?"a":""),b))},ColorMethods:{hexToRgba:function(a){if(a=this.validateHex(a),""==a)return{r:null,g:null,b:null,a:null};var b="00",c="00",d="00",e="255";return 6==a.length&&(a+="ff"),a.length>6?(b=a.substring(0,2),c=a.substring(2,4),d=a.substring(4,6),e=a.substring(6,a.length)):(a.length>4&&(b=a.substring(4,a.length),a=a.substring(0,4)),a.length>2&&(c=a.substring(2,a.length),a=a.substring(0,2)),a.length>0&&(d=a.substring(0,a.length))),{r:this.hexToInt(b),g:this.hexToInt(c),b:this.hexToInt(d),a:this.hexToInt(e)}},validateHex:function(a){return a=a.toLowerCase().replace(/[^a-f0-9]/g,""),a.length>8&&(a=a.substring(0,8)),a},rgbaToHex:function(a){return this.intToHex(a.r)+this.intToHex(a.g)+this.intToHex(a.b)+this.intToHex(a.a)},intToHex:function(a){var b=(0|a).toString(16);return 1==b.length&&(b="0"+b),b.toLowerCase()},hexToInt:function(a){return parseInt(a,16)},rgbToHsv:function(a){var b,c=a.r/255,d=a.g/255,e=a.b/255,f={h:0,s:0,v:0},g=0,h=0;return c>=d&&c>=e?(h=c,g=d>e?e:d):d>=e&&d>=c?(h=d,g=c>e?e:c):(h=e,g=d>c?c:d),f.v=h,f.s=h?(h-g)/h:0,f.s?(b=h-g,f.h=c==h?(d-e)/b:d==h?2+(e-c)/b:4+(c-d)/b,f.h=parseInt(60*f.h),f.h<0&&(f.h+=360)):f.h=0,f.s=100*f.s|0,f.v=100*f.v|0,f},hsvToRgb:function(a){var b={r:0,g:0,b:0,a:100},c=a.h,d=a.s,e=a.v;if(0==d)b.r=b.g=b.b=0==e?0:255*e/100|0;else{360==c&&(c=0),c/=60,d/=100,e/=100;var f=0|c,g=c-f,h=e*(1-d),i=e*(1-d*g),j=e*(1-d*(1-g));switch(f){case 0:b.r=e,b.g=j,b.b=h;break;case 1:b.r=i,b.g=e,b.b=h;break;case 2:b.r=h,b.g=e,b.b=j;break;case 3:b.r=h,b.g=i,b.b=e;break;case 4:b.r=j,b.g=h,b.b=e;break;case 5:b.r=e,b.g=h,b.b=i}b.r=255*b.r|0,b.g=255*b.g|0,b.b=255*b.b|0}return b}}};var f=a.wsjPicker.Color,g=a.wsjPicker.List,h=a.wsjPicker.ColorMethods;a.fn.wsjPicker=function(h){var j=arguments;return this.each(function(){var k=this,l=a.extend(!0,{},a.fn.wsjPicker.defaults,h);l.window.liveUpdate=!1;var m=null,n=null,o=null,p=null,q=null,r=null,s=null,t=null,u=null,v=null,w=null,x=null,y=null,z=null,A=null,B=null,C=null,D=null,E=null,F=null,G=function(a){var b,c,d=hb.active,e=(fb.clientPath,d.val("hex"));switch(l.color.mode=a,a){case"h":if(setTimeout(function(){O.call(k,n,"transparent"),Q.call(k,p,0),R.call(k,p,100),Q.call(k,q,260),R.call(k,q,100),O.call(k,o,"transparent"),Q.call(k,s,0),R.call(k,s,100),Q.call(k,t,260),R.call(k,t,100),Q.call(k,u,260),R.call(k,u,100),Q.call(k,v,260),R.call(k,v,100),Q.call(k,x,260),R.call(k,x,100)},0),y.range("all",{minX:0,maxX:100,minY:0,maxY:100}),z.range("rangeY",{minY:0,maxY:360}),null==d.val("ahex"))break;y.val("xy",{x:d.val("s"),y:100-d.val("v")},y),z.val("y",360-d.val("h"),z);break;case"s":if(setTimeout(function(){O.call(k,n,"transparent"),Q.call(k,p,-260),Q.call(k,q,-520),Q.call(k,s,-260),Q.call(k,t,-520),Q.call(k,x,260),R.call(k,x,100)},0),y.range("all",{minX:0,maxX:360,minY:0,maxY:100}),z.range("rangeY",{minY:0,maxY:100}),null==d.val("ahex"))break;y.val("xy",{x:d.val("h"),y:100-d.val("v")},y),z.val("y",100-d.val("s"),z);break;case"v":if(setTimeout(function(){O.call(k,n,"000000"),Q.call(k,p,-780),Q.call(k,q,260),O.call(k,o,e),Q.call(k,s,-520),Q.call(k,t,260),R.call(k,t,100),Q.call(k,x,260),R.call(k,x,100)},0),y.range("all",{minX:0,maxX:360,minY:0,maxY:100}),z.range("rangeY",{minY:0,maxY:100}),null==d.val("ahex"))break;y.val("xy",{x:d.val("h"),y:100-d.val("s")},y),z.val("y",100-d.val("v"),z);break;case"r":if(b=-1040,c=-780,y.range("all",{minX:0,maxX:255,minY:0,maxY:255}),z.range("rangeY",{minY:0,maxY:255}),null==d.val("ahex"))break;y.val("xy",{x:d.val("b"),y:255-d.val("g")},y),z.val("y",255-d.val("r"),z);break;case"g":if(b=-1560,c=-1820,y.range("all",{minX:0,maxX:255,minY:0,maxY:255}),z.range("rangeY",{minY:0,maxY:255}),null==d.val("ahex"))break;y.val("xy",{x:d.val("b"),y:255-d.val("r")},y),z.val("y",255-d.val("g"),z);break;case"b":if(b=-2080,c=-2860,y.range("all",{minX:0,maxX:255,minY:0,maxY:255}),z.range("rangeY",{minY:0,maxY:255}),null==d.val("ahex"))break;y.val("xy",{x:d.val("r"),y:255-d.val("g")},y),z.val("y",255-d.val("b"),z);break;case"a":if(setTimeout(function(){O.call(k,n,"transparent"),Q.call(k,p,-260),Q.call(k,q,-520),Q.call(k,s,260),Q.call(k,t,260),R.call(k,t,100),Q.call(k,x,0),R.call(k,x,100)},0),y.range("all",{minX:0,maxX:360,minY:0,maxY:100}),z.range("rangeY",{minY:0,maxY:255}),null==d.val("ahex"))break;y.val("xy",{x:d.val("h"),y:100-d.val("v")},y),z.val("y",255-d.val("a"),z);break;default:throw"Invalid Mode"}switch(a){case"h":break;case"s":case"v":case"a":setTimeout(function(){R.call(k,p,100),R.call(k,s,100),Q.call(k,u,260),R.call(k,u,100),Q.call(k,v,260),R.call(k,v,100)},0);break;case"r":case"g":case"b":setTimeout(function(){O.call(k,n,"transparent"),O.call(k,o,"transparent"),R.call(k,s,100),R.call(k,p,100),Q.call(k,p,b),Q.call(k,q,b-260),Q.call(k,s,c-780),Q.call(k,t,c-520),Q.call(k,u,c),Q.call(k,v,c-260),Q.call(k,x,260),R.call(k,x,100)},0)}null!=d.val("ahex")&&H.call(k,d)},H=function(a,b){(null==b||b!=z&&b!=y)&&K.call(k,a,b),setTimeout(function(){L.call(k,a),M.call(k,a),N.call(k,a)},0)},I=function(a,b){var c=hb.active;if(b==y||null!=c.val()){var d=a.val("all");switch(l.color.mode){case"h":c.val("sv",{s:d.x,v:100-d.y},b);break;case"s":case"a":c.val("hv",{h:d.x,v:100-d.y},b);break;case"v":c.val("hs",{h:d.x,s:100-d.y},b);break;case"r":c.val("gb",{g:255-d.y,b:d.x},b);break;case"g":c.val("rb",{r:255-d.y,b:d.x},b);break;case"b":c.val("rg",{r:d.x,g:255-d.y},b)}}},J=function(a,b){var c=hb.active;if(b==z||null!=c.val())switch(l.color.mode){case"h":c.val("h",{h:360-a.val("y")},b);break;case"s":c.val("s",{s:100-a.val("y")},b);break;case"v":c.val("v",{v:100-a.val("y")},b);break;case"r":c.val("r",{r:255-a.val("y")},b);break;case"g":c.val("g",{g:255-a.val("y")},b);break;case"b":c.val("b",{b:255-a.val("y")},b);break;case"a":c.val("a",255-a.val("y"),b)}},K=function(a,b){if(b!=y)switch(l.color.mode){case"h":var c=a.val("sv");y.val("xy",{x:null!=c?c.s:100,y:100-(null!=c?c.v:100)},b);break;case"s":case"a":var d=a.val("hv");y.val("xy",{x:d&&d.h||0,y:100-(null!=d?d.v:100)},b);break;case"v":var e=a.val("hs");y.val("xy",{x:e&&e.h||0,y:100-(null!=e?e.s:100)},b);break;case"r":var f=a.val("bg");y.val("xy",{x:f&&f.b||0,y:255-(f&&f.g||0)},b);break;case"g":var g=a.val("br");y.val("xy",{x:g&&g.b||0,y:255-(g&&g.r||0)},b);break;case"b":var h=a.val("rg");y.val("xy",{x:h&&h.r||0,y:255-(h&&h.g||0)},b)}if(b!=z)switch(l.color.mode){case"h":z.val("y",360-(a.val("h")||0),b);break;case"s":var i=a.val("s");z.val("y",100-(null!=i?i:100),b);break;case"v":var j=a.val("v");z.val("y",100-(null!=j?j:100),b);break;case"r":z.val("y",255-(a.val("r")||0),b);break;case"g":z.val("y",255-(a.val("g")||0),b);break;case"b":z.val("y",255-(a.val("b")||0),b);break;case"a":var k=a.val("a");z.val("y",255-(null!=k?k:255),b)}},L=function(a){try{var c=a.val("all");B.css({backgroundColor:c&&"#"+c.hex||"transparent"}),R.call(k,B,c&&b(100*c.a/255,4)||0)}catch(d){}},M=function(a){switch(l.color.mode){case"h":O.call(k,n,new f({h:a.val("h")||0,s:100,v:100}).val("hex"));break;case"s":case"a":var c=a.val("s");R.call(k,q,100-(null!=c?c:100));break;case"v":var d=a.val("v");R.call(k,p,null!=d?d:100);break;case"r":R.call(k,q,b((a.val("r")||0)/255*100,4));break;case"g":R.call(k,q,b((a.val("g")||0)/255*100,4));break;case"b":R.call(k,q,b((a.val("b")||0)/255*100))}var e=a.val("a");R.call(k,r,b(100*(255-(e||0))/255,4))},N=function(a){switch(l.color.mode){case"h":var c=a.val("a");R.call(k,w,b(100*(255-(c||0))/255,4));break;case"s":var d=a.val("hva"),e=new f({h:d&&d.h||0,s:100,v:null!=d?d.v:100});O.call(k,o,e.val("hex")),R.call(k,t,100-(null!=d?d.v:100)),R.call(k,w,b(100*(255-(d&&d.a||0))/255,4));break;case"v":var g=a.val("hsa"),h=new f({h:g&&g.h||0,s:null!=g?g.s:100,v:100});O.call(k,o,h.val("hex")),R.call(k,w,b(100*(255-(g&&g.a||0))/255,4));break;case"r":case"g":case"b":var i=0,j=0,m=a.val("rgba");"r"==l.color.mode?(i=m&&m.b||0,j=m&&m.g||0):"g"==l.color.mode?(i=m&&m.b||0,j=m&&m.r||0):"b"==l.color.mode&&(i=m&&m.r||0,j=m&&m.g||0);var n=j>i?i:j;R.call(k,t,i>j?b((i-j)/(255-j)*100,4):0),R.call(k,u,j>i?b((j-i)/(255-i)*100,4):0),R.call(k,v,b(n/255*100,4)),R.call(k,w,b(100*(255-(m&&m.a||0))/255,4));break;case"a":var c=a.val("a");O.call(k,o,a.val("hex")||"000000"),R.call(k,w,null!=c?0:100),R.call(k,x,null!=c?100:0)}},O=function(a,b){a.css({backgroundColor:b&&6==b.length&&"#"+b||"transparent"})},P=function(a,b){a.css({backgroundImage:"url('"+b+"')"})},Q=function(a,b){a.css({top:b+"px"})},R=function(a,c){a.css({visibility:c>0?"visible":"hidden"}),c>0&&100>c?a.css({opacity:b(c/100,4)}):(0==c||100==c)&&a.css({opacity:""})},S=function(){hb.active.val("ahex",hb.current.val("ahex"))},T=function(){hb.current.val("ahex",hb.active.val("ahex"))},U=function(a){m.find('input[type="radio"]:not([value="'+a.target.value+'"])').prop("checked",!1),G.call(k,a.target.value)},V=function(){S.call(k)},W=function(){S.call(k),a.isFunction(ab)&&ab.call(k,hb.active,E)},X=function(){T.call(k),a.isFunction($)&&$.call(k,hb.active,D)},Y=function(a){var c=a.val("hex");C.css({backgroundColor:c&&"#"+c||"transparent"}),R.call(k,C,b(100*(a.val("a")||0)/255,4))},Z=function(b){return hb.active.val("ahex",a(this).attr("title")||null,b.target),!1},$=a.isFunction(j[1])&&j[1]||null,_=a.isFunction(j[2])&&j[2]||null,ab=a.isFunction(j[3])&&j[3]||null,bb=function(){hb.current.val("ahex",hb.active.val("ahex"))},cb=function(){},db=function(){var c=l.window;m=a(k),m.addClass("jPicker Container"),m.get(0).onselectstart=function(a){return"input"!==a.target.nodeName.toLowerCase()?!1:void 0};var g=hb.active.val("all");c.alphaPrecision<0?c.alphaPrecision=0:c.alphaPrecision>2&&(c.alphaPrecision=2);var h='<table class="jPicker" cellpadding="0" cellspacing="0"><tbody><tr><td rowspan="9"><div class="Map"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><img src="'+fb.clientPath+fb.colorMap.arrow.file+'" class="Arrow"/></div></td><td rowspan="9"><div class="Bar"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><span class="Map4">&nbsp;</span><span class="Map5">&nbsp;</span><span class="Map6">&nbsp;</span><img src="'+fb.clientPath+fb.colorBar.arrow.file+'" class="Arrow"/></div></td><td colspan="2" class="Preview">'+gb.text.newColor+'<div><span class="Active" title="'+gb.tooltips.colors.newColor+'">&nbsp;</span><span class="Current" title="'+gb.tooltips.colors.currentColor+'">&nbsp;</span></div>'+gb.text.currentColor+'</td><td rowspan="9" class="Button"><input type="button" class="Ok" value="'+gb.text.ok+'" title="'+gb.tooltips.buttons.ok+'"/><input type="button" class="Cancel" value="'+gb.text.cancel+'" title="'+gb.tooltips.buttons.cancel+'"/><hr/><div class="Grid">&nbsp;</div></td></tr><tr class="Hue"><td class="Radio"><label><input type="radio" aria-label="'+gb.tooltips.hue.radio+'" class="hue-radio" value="h"'+("h"==l.color.mode?' checked="checked"':"")+'/>H:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=g?g.h:"")+'" title="'+gb.tooltips.hue.textbox+'"/>&nbsp;&deg;</td></tr><tr class="Saturation"><td class="Radio"><label><input type="radio" aria-label="'+gb.tooltips.saturation.radio+'" value="s"'+("s"==l.color.mode?' checked="checked"':"")+'/>S:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=g?g.s:"")+'" title="'+gb.tooltips.saturation.textbox+'"/>&nbsp;%</td></tr><tr class="Value"><td class="Radio"><label><input type="radio" aria-label="'+gb.tooltips.value.radio+'" value="v"'+("v"==l.color.mode?' checked="checked"':"")+'/>V:</label><br/><br/></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=g?g.v:"")+'" title="'+gb.tooltips.value.textbox+'"/>&nbsp;%<br/><br/></td></tr><tr class="Red"><td class="Radio"><label><input type="radio" aria-label="'+gb.tooltips.red.radio+'" value="r"'+("r"==l.color.mode?' checked="checked"':"")+'/>R:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=g?g.r:"")+'" title="'+gb.tooltips.red.textbox+'"/></td></tr><tr class="Green"><td class="Radio"><label><input type="radio" title="'+gb.tooltips.green.radio+'" value="g"'+("g"==l.color.mode?' checked="checked"':"")+'/>G:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=g?g.g:"")+'" title="'+gb.tooltips.green.textbox+'"/></td></tr><tr class="Blue"><td class="Radio"><label><input type="radio" aria-label="'+gb.tooltips.blue.radio+'" value="b"'+("b"==l.color.mode?' checked="checked"':"")+'/>B:</label></td><td class="Text"><input type="text" maxlength="3" value="'+(null!=g?g.b:"")+'" title="'+gb.tooltips.blue.textbox+'"/></td></tr><tr class="Alpha"><td class="Radio"><label><input aria-label="'+gb.tooltips.alpha.radio+'" class="alpha-radio" type="radio" value="a"'+("a"==l.color.mode?' checked="checked"':"")+'/>A:</label></td><td class="Text"><input type="text" maxlength="'+(3+c.alphaPrecision)+'" value="'+(null!=g?b(100*g.a/255,c.alphaPrecision):"")+'" title="'+gb.tooltips.alpha.textbox+'"/>&nbsp;%</td></tr><tr class="Hex"><td colspan="2" class="Text"><label>#:<input aria-label="'+gb.tooltips.hex.textbox+'" type="text" maxlength="6" class="Hex" value="'+(null!=g?g.hex:"")+'"/></label><input type="text" maxlength="2" class="AHex" value="'+(null!=g?g.ahex.substring(6):"")+'" title="'+gb.tooltips.hex.alpha+'"/></td></tr></tbody></table>';m=a(k),m.html(h);var i=m.find("tbody").eq(0);n=i.find("div.Map").eq(0),o=i.find("div.Bar").eq(0);var j=n.find("span"),K=o.find("span");p=j.filter(".Map1").eq(0),q=j.filter(".Map2").eq(0),r=j.filter(".Map3").eq(0),s=K.filter(".Map1").eq(0),t=K.filter(".Map2").eq(0),u=K.filter(".Map3").eq(0),v=K.filter(".Map4").eq(0),w=K.filter(".Map5").eq(0),x=K.filter(".Map6").eq(0),y=new d(n,{map:{width:fb.colorMap.width,height:fb.colorMap.height},arrow:{image:fb.clientPath+fb.colorMap.arrow.file,width:fb.colorMap.arrow.width,height:fb.colorMap.arrow.height}}),y.bind(I),z=new d(o,{map:{width:fb.colorBar.width,height:fb.colorBar.height},arrow:{image:fb.clientPath+fb.colorBar.arrow.file,width:fb.colorBar.arrow.width,height:fb.colorBar.arrow.height}}),z.bind(J),A=new e(i,hb.active,null,c.alphaPrecision);var L=null!=g?g.hex:null,M=i.find(".Preview"),N=i.find(".Button");if(B=M.find(".Active").eq(0).css({backgroundColor:L&&"#"+L||"transparent"}),C=M.find(".Current").eq(0).css({backgroundColor:L&&"#"+L||"transparent"}).on("click",V),R.call(k,C,b(100*hb.current.val("a"))/255,4),D=N.find(".Ok").eq(0).on("click",X),E=N.find(".Cancel").eq(0).on("click",W),F=N.find(".Grid").eq(0),setTimeout(function(){P.call(k,p,fb.clientPath+"Maps.png"),P.call(k,q,fb.clientPath+"Maps.png"),P.call(k,r,fb.clientPath+"map-opacity.png"),P.call(k,s,fb.clientPath+"Bars.png"),P.call(k,t,fb.clientPath+"Bars.png"),P.call(k,u,fb.clientPath+"Bars.png"),P.call(k,v,fb.clientPath+"Bars.png"),P.call(k,w,fb.clientPath+"bar-opacity.png"),P.call(k,x,fb.clientPath+"AlphaBar.png"),P.call(k,M.find("div").eq(0),fb.clientPath+"preview-opacity.png")},0),i.find("td.Radio input").on("click",U),hb.quickList&&hb.quickList.length>0){var O,Q="";for(O=0;O<hb.quickList.length;O++){"string"==(typeof hb.quickList[O]).toString().toLowerCase()&&(hb.quickList[O]=new f({hex:hb.quickList[O]}));var S=hb.quickList[O].val("a"),T=hb.quickList[O].val("ahex");!c.alphaSupport&&T&&(T=T.substring(0,6)+"ff");var $=hb.quickList[O].val("hex");Q+='<span class="QuickColor"'+(T&&' title="#'+T+'"'||"")+' style="background-color:'+($&&"#"+$||"")+";"+($?"":"background-image:url("+fb.clientPath+"NoColor.png)")+(c.alphaSupport&&S&&255>S?";opacity:"+b(S/255,4)+";filter:Alpha(opacity="+b(S/2.55,4)+")":"")+'">&nbsp;</span>'}P.call(k,F,fb.clientPath+"bar-opacity.png"),F.html(Q),F.find(".QuickColor").on("click",Z)}G.call(k,l.color.mode),hb.active.bind(H),a.isFunction(_)&&hb.active.bind(_),hb.current.bind(Y),bb.call(k)},eb=function(){var b=a.data(k,"wsjPicker")||k;for(m.find("td.Radio input").off("click",U),C.off("click",V),E.off("click",W),D.off("click",X),m.find(".QuickColor").off("click",Z),n=null,o=null,p=null,q=null,r=null,s=null,t=null,u=null,v=null,w=null,x=null,y.destroy(),y=null,z.destroy(),z=null,A.destroy(),A=null,B=null,C=null,D=null,E=null,F=null,$=null,ab=null,_=null,m.html(""),i=0;i<g.length;i++)if(g[i]==b){g.splice(i,1);break}},fb=l.images,gb=l.localization,hb={active:new f("string"==(typeof l.color.active).toString().toLowerCase()?{ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}:{ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),current:new f("string"==(typeof l.color.active).toString().toLowerCase()?{ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}:{ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),quickList:l.color.quickList};c(!1,k,{commitCallback:$,liveCallback:_,cancelCallback:ab,color:hb,setColorMode:function(b){a('input[type="radio"][value="'+b+'"]',m).prop("checked",!0).triggerHandler("click")},settings:l,show:bb,hide:cb,destroy:eb}),g.push(a.data(k,"wsjPicker")||k),setTimeout(function(){db.call(k)},0)})},a.fn.wsjPicker.defaults={window:{liveUpdate:!0,alphaSupport:!1,alphaPrecision:0},color:{mode:"h",active:new f({ahex:"#000000ff"}),quickList:[new f({h:360,s:33,v:100}),new f({h:360,s:66,v:100}),new f({h:360,s:100,v:100}),new f({h:360,s:100,v:75}),new f({h:360,s:100,v:50}),new f({h:180,s:0,v:100}),new f({h:30,s:33,v:100}),new f({h:30,s:66,v:100}),new f({h:30,s:100,v:100}),new f({h:30,s:100,v:75}),new f({h:30,s:100,v:50}),new f({h:180,s:0,v:90}),new f({h:60,s:33,v:100}),new f({h:60,s:66,v:100}),new f({h:60,s:100,v:100}),new f({h:60,s:100,v:75}),new f({h:60,s:100,v:50}),new f({h:180,s:0,v:80}),new f({h:90,s:33,v:100}),new f({h:90,s:66,v:100}),new f({h:90,s:100,v:100}),new f({h:90,s:100,v:75}),new f({h:90,s:100,v:50}),new f({h:180,s:0,v:70}),new f({h:120,s:33,v:100}),new f({h:120,s:66,v:100}),new f({h:120,s:100,v:100}),new f({h:120,s:100,v:75}),new f({h:120,s:100,v:50}),new f({h:180,s:0,v:60}),new f({h:150,s:33,v:100}),new f({h:150,s:66,v:100}),new f({h:150,s:100,v:100}),new f({h:150,s:100,v:75}),new f({h:150,s:100,v:50}),new f({h:180,s:0,v:50}),new f({h:180,s:33,v:100}),new f({h:180,s:66,v:100}),new f({h:180,s:100,v:100}),new f({h:180,s:100,v:75}),new f({h:180,s:100,v:50}),new f({h:180,s:0,v:40}),new f({h:210,s:33,v:100}),new f({h:210,s:66,v:100}),new f({h:210,s:100,v:100}),new f({h:210,s:100,v:75}),new f({h:210,s:100,v:50}),new f({h:180,s:0,v:30}),new f({h:240,s:33,v:100}),new f({h:240,s:66,v:100}),new f({h:240,s:100,v:100}),new f({h:240,s:100,v:75}),new f({h:240,s:100,v:50}),new f({h:180,s:0,v:20}),new f({h:270,s:33,v:100}),new f({h:270,s:66,v:100}),new f({h:270,s:100,v:100}),new f({h:270,s:100,v:75}),new f({h:270,s:100,v:50}),new f({h:180,s:0,v:10}),new f({h:300,s:33,v:100}),new f({h:300,s:66,v:100}),new f({h:300,s:100,v:100}),new f({h:300,s:100,v:75}),new f({h:300,s:100,v:50}),new f({h:180,s:0,v:0}),new f({h:330,s:33,v:100}),new f({h:330,s:66,v:100}),new f({h:330,s:100,v:100}),new f({h:330,s:100,v:75}),new f({h:330,s:100,v:50}),new f({h:180,s:0,v:0})]},images:{clientPath:"/jPicker/images/",colorMap:{width:256,height:256,arrow:{file:"mappoint.gif",width:15,height:15}},colorBar:{width:20,height:256,arrow:{file:"rangearrows.gif",width:20,height:7}}},localization:{text:{title:"Drag Markers To Pick A Color",newColor:"new",currentColor:"current",ok:"OK",cancel:"Cancel"},tooltips:{colors:{newColor:"New Color - Press &ldquo;OK&rdquo; To Commit",currentColor:"Click To Revert To Original Color"},buttons:{ok:"Commit To This Color Selection",cancel:"Cancel And Revert To Original Color"},hue:{radio:"Set To &ldquo;Hue&rdquo; Color Mode",textbox:"Enter A &ldquo;Hue&rdquo; Value (0-360&deg;)"},saturation:{radio:"Set To &ldquo;Saturation&rdquo; Color Mode",textbox:"Enter A &ldquo;Saturation&rdquo; Value (0-100%)"},value:{radio:"Set To &ldquo;Value&rdquo; Color Mode",textbox:"Enter A &ldquo;Value&rdquo; Value (0-100%)"},red:{radio:"Set To &ldquo;Red&rdquo; Color Mode",textbox:"Enter A &ldquo;Red&rdquo; Value (0-255)"},green:{radio:"Set To &ldquo;Green&rdquo; Color Mode",textbox:"Enter A &ldquo;Green&rdquo; Value (0-255)"},blue:{radio:"Set To &ldquo;Blue&rdquo; Color Mode",textbox:"Enter A &ldquo;Blue&rdquo; Value (0-255)"},alpha:{radio:"Set To &ldquo;Alpha&rdquo; Color Mode",textbox:"Enter A &ldquo;Alpha&rdquo; Value (0-100)"},hex:{textbox:"Enter A &ldquo;Hex&rdquo; Color Value (#000000-#ffffff)",alpha:"Enter A &ldquo;Alpha&rdquo; Value (#00-#ff)"}}}}}(jQuery,"1.1.6wsmod"),webshims.register("color-picker",function(a,b,c,d,e,f){"use strict";var g=b.picker;g.commonColorInit=function(b){var c=b.popover;c.element.on({wspopovershow:function(){b.element.triggerHandler("wsupdatevalue"),g._genericSetFocus.call(b,a("input.Hex",c.element))}})},g.color.showPickerContent=function(){var c,d=a('<div class="ws-jpicker" />');a.fn.wsjPicker.defaults.images.clientPath=b.cfg.basePath+"jpicker/images/";var e,f={setPicker:function(b){var c=a(b.orig).data("colormode")||"h";b.alpha&&b.alpha.length?d.removeClass("no-alpha-picker"):(d.addClass("no-alpha-picker"),"a"==c&&(c="h")),c!=e.settings.color.mode&&e.setColorMode(c)},setInputColor:function(b){var c,d=e.color.active.val(),f="#"+d.hex;return b.alpha.length&&(c=b.alpha.prop("value"),b.alpha.prop("value",d.a/(255/(b.alpha.prop("max")||1)))),a(b.orig).data("colormode",e.settings.color.mode),g._actions.changeInput(f,b.popover,b),b.alpha.length&&c!=b.alpha.prop("value")&&b.alpha.trigger("input").trigger("change"),f }},h=function(a,b){b==c&&f[a]&&f[a](b)},i=function(){e=d.data("wsjPicker"),e||(d.empty().wsjPicker({},function(){c&&h("setInputColor",c)},!1,function(a){c&&g._actions.cancel("#"+a.val().hex,c.popover,c)}),e=d.data("wsjPicker"))},j=function(a){i(),a!=c&&(c&&c.popover.hide(),c=a,a.popover.contentElement.html(d),h("setPicker",a))};return function(b){b._popoverinit||(g.commonInit(b,b.popover),g.commonColorInit(b));var c=b.parseValue();j(b),c+=b.alpha&&b.alpha.length?a.wsjPicker.ColorMethods.intToHex((b.alpha.prop("value")||1)*(255/(b.alpha.prop("max")||1))):"ff",e.color.active.val("ahex",c),e.color.current.val("ahex",c),b._popoverinit=!0}}(),f&&f._types&&-1==a.inArray("color",f._types)&&b.error('[type="color"] used without adding it to the types config.'),d.createElement("img").src=b.cfg.basePath+"jpicker/images/Maps.png"});
aaqibrasheed/cdnjs
ajax/libs/webshim/1.14.6-RC1/minified/shims/color-picker.js
JavaScript
mit
33,039
IntlPolyfill.__addLocaleData({locale:"sg",date:{ca:["gregory","buddhist","chinese","coptic","dangi","ethioaa","ethiopic","generic","hebrew","indian","islamic","islamicc","japanese","persian","roc"],hourNo0:true,hour12:false,formats:{medium:"{1} {0}",availableFormats:{"E":"ccc",EHm:"E HH:mm",EHms:"E HH:mm:ss",Ed:"d, E",Ehm:"E h:mm a",Ehms:"E h:mm:ss a",Gy:"G y",GyMMM:"G y MMM",GyMMMEd:"G y MMM d, E",GyMMMd:"G y MMM d","H":"HH",Hm:"HH:mm",Hms:"HH:mm:ss",Hmsv:"HH:mm:ss v",Hmv:"HH:mm v","M":"M",MEd:"MM-dd, E",MMM:"MMM",MMMEd:"E d MMM",MMMMEd:"E d MMMM",MMMMd:"d MMMM",MMMd:"d MMM",MMd:"d/MM",MMdd:"dd/MM",Md:"d/M","d":"d","h":"h a",hm:"h:mm a",hms:"h:mm:ss a",hmsv:"h:mm:ss a v",hmv:"h:mm a v",ms:"m:ss","y":"y",yM:"M/y",yMEd:"E d/M/y",yMMM:"MMM y",yMMMEd:"E d MMM y",yMMMM:"MMMM y",yMMMd:"y MMM d",yMd:"y-MM-dd",yQQQ:"QQQ y",yQQQQ:"QQQQ y"},dateFormats:{full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM, y",short:"d/M/y"},timeFormats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"}},calendars:{buddhist:{months:{narrow:["N","F","M","N","B","F","L","K","M","N","N","K"],short:["Nye","Ful","Mbä","Ngu","Bêl","Fön","Len","Kük","Mvu","Ngb","Nab","Kak"],long:["Nyenye","Fulundïgi","Mbängü","Ngubùe","Bêläwü","Föndo","Lengua","Kükürü","Mvuka","Ngberere","Nabändüru","Kakauka"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},eras:{narrow:["BE"],short:["BE"],long:["BE"]},dayPeriods:{am:"ND",pm:"LK"}},chinese:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],short:["M01","M02","M03","M04","M05","M06","M07","M08","M09","M10","M11","M12"],long:["M01","M02","M03","M04","M05","M06","M07","M08","M09","M10","M11","M12"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},dayPeriods:{am:"ND",pm:"LK"}},coptic:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12","13"],short:["Tout","Baba","Hator","Kiahk","Toba","Amshir","Baramhat","Baramouda","Bashans","Paona","Epep","Mesra","Nasie"],long:["Tout","Baba","Hator","Kiahk","Toba","Amshir","Baramhat","Baramouda","Bashans","Paona","Epep","Mesra","Nasie"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},eras:{narrow:["ERA0","ERA1"],short:["ERA0","ERA1"],long:["ERA0","ERA1"]},dayPeriods:{am:"ND",pm:"LK"}},dangi:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],short:["M01","M02","M03","M04","M05","M06","M07","M08","M09","M10","M11","M12"],long:["M01","M02","M03","M04","M05","M06","M07","M08","M09","M10","M11","M12"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},dayPeriods:{am:"ND",pm:"LK"}},ethiopic:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12","13"],short:["Meskerem","Tekemt","Hedar","Tahsas","Ter","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehasse","Pagumen"],long:["Meskerem","Tekemt","Hedar","Tahsas","Ter","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehasse","Pagumen"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},eras:{narrow:["ERA0","ERA1"],short:["ERA0","ERA1"],long:["ERA0","ERA1"]},dayPeriods:{am:"ND",pm:"LK"}},ethioaa:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12","13"],short:["Meskerem","Tekemt","Hedar","Tahsas","Ter","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehasse","Pagumen"],long:["Meskerem","Tekemt","Hedar","Tahsas","Ter","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehasse","Pagumen"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},eras:{narrow:["ERA0"],short:["ERA0"],long:["ERA0"]},dayPeriods:{am:"ND",pm:"LK"}},generic:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],short:["M01","M02","M03","M04","M05","M06","M07","M08","M09","M10","M11","M12"],long:["M01","M02","M03","M04","M05","M06","M07","M08","M09","M10","M11","M12"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},eras:{narrow:["ERA0","ERA1"],short:["ERA0","ERA1"],long:["ERA0","ERA1"]},dayPeriods:{am:"ND",pm:"LK"}},gregory:{months:{narrow:["N","F","M","N","B","F","L","K","M","N","N","K"],short:["Nye","Ful","Mbä","Ngu","Bêl","Fön","Len","Kük","Mvu","Ngb","Nab","Kak"],long:["Nyenye","Fulundïgi","Mbängü","Ngubùe","Bêläwü","Föndo","Lengua","Kükürü","Mvuka","Ngberere","Nabändüru","Kakauka"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},eras:{narrow:["KnK","NpK","BCE","CE"],short:["KnK","NpK","BCE","CE"],long:["Kôzo na Krîstu","Na pekô tî Krîstu","BCE","CE"]},dayPeriods:{am:"ND",pm:"LK"}},hebrew:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12","13","7"],short:["Tishri","Heshvan","Kislev","Tevet","Shevat","Adar I","Adar","Nisan","Iyar","Sivan","Tamuz","Av","Elul","Adar II"],long:["Tishri","Heshvan","Kislev","Tevet","Shevat","Adar I","Adar","Nisan","Iyar","Sivan","Tamuz","Av","Elul","Adar II"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},eras:{narrow:["AM"],short:["AM"],long:["AM"]},dayPeriods:{am:"ND",pm:"LK"}},indian:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],short:["Chaitra","Vaisakha","Jyaistha","Asadha","Sravana","Bhadra","Asvina","Kartika","Agrahayana","Pausa","Magha","Phalguna"],long:["Chaitra","Vaisakha","Jyaistha","Asadha","Sravana","Bhadra","Asvina","Kartika","Agrahayana","Pausa","Magha","Phalguna"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},eras:{narrow:["Saka"],short:["Saka"],long:["Saka"]},dayPeriods:{am:"ND",pm:"LK"}},islamic:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],short:["Muh.","Saf.","Rab. I","Rab. II","Jum. I","Jum. II","Raj.","Sha.","Ram.","Shaw.","Dhuʻl-Q.","Dhuʻl-H."],long:["Muharram","Safar","Rabiʻ I","Rabiʻ II","Jumada I","Jumada II","Rajab","Shaʻban","Ramadan","Shawwal","Dhuʻl-Qiʻdah","Dhuʻl-Hijjah"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},eras:{narrow:["AH"],short:["AH"],long:["AH"]},dayPeriods:{am:"ND",pm:"LK"}},islamicc:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],short:["Muh.","Saf.","Rab. I","Rab. II","Jum. I","Jum. II","Raj.","Sha.","Ram.","Shaw.","Dhuʻl-Q.","Dhuʻl-H."],long:["Muharram","Safar","Rabiʻ I","Rabiʻ II","Jumada I","Jumada II","Rajab","Shaʻban","Ramadan","Shawwal","Dhuʻl-Qiʻdah","Dhuʻl-Hijjah"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},eras:{narrow:["AH"],short:["AH"],long:["AH"]},dayPeriods:{am:"ND",pm:"LK"}},japanese:{months:{narrow:["N","F","M","N","B","F","L","K","M","N","N","K"],short:["Nye","Ful","Mbä","Ngu","Bêl","Fön","Len","Kük","Mvu","Ngb","Nab","Kak"],long:["Nyenye","Fulundïgi","Mbängü","Ngubùe","Bêläwü","Föndo","Lengua","Kükürü","Mvuka","Ngberere","Nabändüru","Kakauka"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},eras:{narrow:["Taika (645-650)","Hakuchi (650-671)","Hakuhō (672-686)","Shuchō (686-701)","Taihō (701-704)","Keiun (704-708)","Wadō (708-715)","Reiki (715-717)","Yōrō (717-724)","Jinki (724-729)","Tempyō (729-749)","Tempyō-kampō (749-749)","Tempyō-shōhō (749-757)","Tempyō-hōji (757-765)","Temphō-jingo (765-767)","Jingo-keiun (767-770)","Hōki (770-780)","Ten-ō (781-782)","Enryaku (782-806)","Daidō (806-810)","Kōnin (810-824)","Tenchō (824-834)","Jōwa (834-848)","Kajō (848-851)","Ninju (851-854)","Saiko (854-857)","Tennan (857-859)","Jōgan (859-877)","Genkei (877-885)","Ninna (885-889)","Kampyō (889-898)","Shōtai (898-901)","Engi (901-923)","Enchō (923-931)","Shōhei (931-938)","Tengyō (938-947)","Tenryaku (947-957)","Tentoku (957-961)","Ōwa (961-964)","Kōhō (964-968)","Anna (968-970)","Tenroku (970-973)","Ten-en (973-976)","Jōgen (976-978)","Tengen (978-983)","Eikan (983-985)","Kanna (985-987)","Ei-en (987-989)","Eiso (989-990)","Shōryaku (990-995)","Chōtoku (995-999)","Chōhō (999-1004)","Kankō (1004-1012)","Chōwa (1012-1017)","Kannin (1017-1021)","Jian (1021-1024)","Manju (1024-1028)","Chōgen (1028-1037)","Chōryaku (1037-1040)","Chōkyū (1040-1044)","Kantoku (1044-1046)","Eishō (1046-1053)","Tengi (1053-1058)","Kōhei (1058-1065)","Jiryaku (1065-1069)","Enkyū (1069-1074)","Shōho (1074-1077)","Shōryaku (1077-1081)","Eiho (1081-1084)","Ōtoku (1084-1087)","Kanji (1087-1094)","Kaho (1094-1096)","Eichō (1096-1097)","Shōtoku (1097-1099)","Kōwa (1099-1104)","Chōji (1104-1106)","Kashō (1106-1108)","Tennin (1108-1110)","Ten-ei (1110-1113)","Eikyū (1113-1118)","Gen-ei (1118-1120)","Hoan (1120-1124)","Tenji (1124-1126)","Daiji (1126-1131)","Tenshō (1131-1132)","Chōshō (1132-1135)","Hoen (1135-1141)","Eiji (1141-1142)","Kōji (1142-1144)","Tenyō (1144-1145)","Kyūan (1145-1151)","Ninpei (1151-1154)","Kyūju (1154-1156)","Hogen (1156-1159)","Heiji (1159-1160)","Eiryaku (1160-1161)","Ōho (1161-1163)","Chōkan (1163-1165)","Eiman (1165-1166)","Nin-an (1166-1169)","Kaō (1169-1171)","Shōan (1171-1175)","Angen (1175-1177)","Jishō (1177-1181)","Yōwa (1181-1182)","Juei (1182-1184)","Genryuku (1184-1185)","Bunji (1185-1190)","Kenkyū (1190-1199)","Shōji (1199-1201)","Kennin (1201-1204)","Genkyū (1204-1206)","Ken-ei (1206-1207)","Shōgen (1207-1211)","Kenryaku (1211-1213)","Kenpō (1213-1219)","Shōkyū (1219-1222)","Jōō (1222-1224)","Gennin (1224-1225)","Karoku (1225-1227)","Antei (1227-1229)","Kanki (1229-1232)","Jōei (1232-1233)","Tempuku (1233-1234)","Bunryaku (1234-1235)","Katei (1235-1238)","Ryakunin (1238-1239)","En-ō (1239-1240)","Ninji (1240-1243)","Kangen (1243-1247)","Hōji (1247-1249)","Kenchō (1249-1256)","Kōgen (1256-1257)","Shōka (1257-1259)","Shōgen (1259-1260)","Bun-ō (1260-1261)","Kōchō (1261-1264)","Bun-ei (1264-1275)","Kenji (1275-1278)","Kōan (1278-1288)","Shōō (1288-1293)","Einin (1293-1299)","Shōan (1299-1302)","Kengen (1302-1303)","Kagen (1303-1306)","Tokuji (1306-1308)","Enkei (1308-1311)","Ōchō (1311-1312)","Shōwa (1312-1317)","Bunpō (1317-1319)","Genō (1319-1321)","Genkyō (1321-1324)","Shōchū (1324-1326)","Kareki (1326-1329)","Gentoku (1329-1331)","Genkō (1331-1334)","Kemmu (1334-1336)","Engen (1336-1340)","Kōkoku (1340-1346)","Shōhei (1346-1370)","Kentoku (1370-1372)","Bunchũ (1372-1375)","Tenju (1375-1379)","Kōryaku (1379-1381)","Kōwa (1381-1384)","Genchũ (1384-1392)","Meitoku (1384-1387)","Kakei (1387-1389)","Kōō (1389-1390)","Meitoku (1390-1394)","Ōei (1394-1428)","Shōchō (1428-1429)","Eikyō (1429-1441)","Kakitsu (1441-1444)","Bun-an (1444-1449)","Hōtoku (1449-1452)","Kyōtoku (1452-1455)","Kōshō (1455-1457)","Chōroku (1457-1460)","Kanshō (1460-1466)","Bunshō (1466-1467)","Ōnin (1467-1469)","Bunmei (1469-1487)","Chōkyō (1487-1489)","Entoku (1489-1492)","Meiō (1492-1501)","Bunki (1501-1504)","Eishō (1504-1521)","Taiei (1521-1528)","Kyōroku (1528-1532)","Tenmon (1532-1555)","Kōji (1555-1558)","Eiroku (1558-1570)","Genki (1570-1573)","Tenshō (1573-1592)","Bunroku (1592-1596)","Keichō (1596-1615)","Genwa (1615-1624)","Kan-ei (1624-1644)","Shōho (1644-1648)","Keian (1648-1652)","Shōō (1652-1655)","Meiryaku (1655-1658)","Manji (1658-1661)","Kanbun (1661-1673)","Enpō (1673-1681)","Tenwa (1681-1684)","Jōkyō (1684-1688)","Genroku (1688-1704)","Hōei (1704-1711)","Shōtoku (1711-1716)","Kyōhō (1716-1736)","Genbun (1736-1741)","Kanpō (1741-1744)","Enkyō (1744-1748)","Kan-en (1748-1751)","Hōryaku (1751-1764)","Meiwa (1764-1772)","An-ei (1772-1781)","Tenmei (1781-1789)","Kansei (1789-1801)","Kyōwa (1801-1804)","Bunka (1804-1818)","Bunsei (1818-1830)","Tenpō (1830-1844)","Kōka (1844-1848)","Kaei (1848-1854)","Ansei (1854-1860)","Man-en (1860-1861)","Bunkyū (1861-1864)","Genji (1864-1865)","Keiō (1865-1868)","M","T","S","H"],short:["Taika (645-650)","Hakuchi (650-671)","Hakuhō (672-686)","Shuchō (686-701)","Taihō (701-704)","Keiun (704-708)","Wadō (708-715)","Reiki (715-717)","Yōrō (717-724)","Jinki (724-729)","Tempyō (729-749)","Tempyō-kampō (749-749)","Tempyō-shōhō (749-757)","Tempyō-hōji (757-765)","Temphō-jingo (765-767)","Jingo-keiun (767-770)","Hōki (770-780)","Ten-ō (781-782)","Enryaku (782-806)","Daidō (806-810)","Kōnin (810-824)","Tenchō (824-834)","Jōwa (834-848)","Kajō (848-851)","Ninju (851-854)","Saiko (854-857)","Tennan (857-859)","Jōgan (859-877)","Genkei (877-885)","Ninna (885-889)","Kampyō (889-898)","Shōtai (898-901)","Engi (901-923)","Enchō (923-931)","Shōhei (931-938)","Tengyō (938-947)","Tenryaku (947-957)","Tentoku (957-961)","Ōwa (961-964)","Kōhō (964-968)","Anna (968-970)","Tenroku (970-973)","Ten-en (973-976)","Jōgen (976-978)","Tengen (978-983)","Eikan (983-985)","Kanna (985-987)","Ei-en (987-989)","Eiso (989-990)","Shōryaku (990-995)","Chōtoku (995-999)","Chōhō (999-1004)","Kankō (1004-1012)","Chōwa (1012-1017)","Kannin (1017-1021)","Jian (1021-1024)","Manju (1024-1028)","Chōgen (1028-1037)","Chōryaku (1037-1040)","Chōkyū (1040-1044)","Kantoku (1044-1046)","Eishō (1046-1053)","Tengi (1053-1058)","Kōhei (1058-1065)","Jiryaku (1065-1069)","Enkyū (1069-1074)","Shōho (1074-1077)","Shōryaku (1077-1081)","Eiho (1081-1084)","Ōtoku (1084-1087)","Kanji (1087-1094)","Kaho (1094-1096)","Eichō (1096-1097)","Shōtoku (1097-1099)","Kōwa (1099-1104)","Chōji (1104-1106)","Kashō (1106-1108)","Tennin (1108-1110)","Ten-ei (1110-1113)","Eikyū (1113-1118)","Gen-ei (1118-1120)","Hoan (1120-1124)","Tenji (1124-1126)","Daiji (1126-1131)","Tenshō (1131-1132)","Chōshō (1132-1135)","Hoen (1135-1141)","Eiji (1141-1142)","Kōji (1142-1144)","Tenyō (1144-1145)","Kyūan (1145-1151)","Ninpei (1151-1154)","Kyūju (1154-1156)","Hogen (1156-1159)","Heiji (1159-1160)","Eiryaku (1160-1161)","Ōho (1161-1163)","Chōkan (1163-1165)","Eiman (1165-1166)","Nin-an (1166-1169)","Kaō (1169-1171)","Shōan (1171-1175)","Angen (1175-1177)","Jishō (1177-1181)","Yōwa (1181-1182)","Juei (1182-1184)","Genryuku (1184-1185)","Bunji (1185-1190)","Kenkyū (1190-1199)","Shōji (1199-1201)","Kennin (1201-1204)","Genkyū (1204-1206)","Ken-ei (1206-1207)","Shōgen (1207-1211)","Kenryaku (1211-1213)","Kenpō (1213-1219)","Shōkyū (1219-1222)","Jōō (1222-1224)","Gennin (1224-1225)","Karoku (1225-1227)","Antei (1227-1229)","Kanki (1229-1232)","Jōei (1232-1233)","Tempuku (1233-1234)","Bunryaku (1234-1235)","Katei (1235-1238)","Ryakunin (1238-1239)","En-ō (1239-1240)","Ninji (1240-1243)","Kangen (1243-1247)","Hōji (1247-1249)","Kenchō (1249-1256)","Kōgen (1256-1257)","Shōka (1257-1259)","Shōgen (1259-1260)","Bun-ō (1260-1261)","Kōchō (1261-1264)","Bun-ei (1264-1275)","Kenji (1275-1278)","Kōan (1278-1288)","Shōō (1288-1293)","Einin (1293-1299)","Shōan (1299-1302)","Kengen (1302-1303)","Kagen (1303-1306)","Tokuji (1306-1308)","Enkei (1308-1311)","Ōchō (1311-1312)","Shōwa (1312-1317)","Bunpō (1317-1319)","Genō (1319-1321)","Genkyō (1321-1324)","Shōchū (1324-1326)","Kareki (1326-1329)","Gentoku (1329-1331)","Genkō (1331-1334)","Kemmu (1334-1336)","Engen (1336-1340)","Kōkoku (1340-1346)","Shōhei (1346-1370)","Kentoku (1370-1372)","Bunchū (1372-1375)","Tenju (1375-1379)","Kōryaku (1379-1381)","Kōwa (1381-1384)","Genchū (1384-1392)","Meitoku (1384-1387)","Kakei (1387-1389)","Kōō (1389-1390)","Meitoku (1390-1394)","Ōei (1394-1428)","Shōchō (1428-1429)","Eikyō (1429-1441)","Kakitsu (1441-1444)","Bun-an (1444-1449)","Hōtoku (1449-1452)","Kyōtoku (1452-1455)","Kōshō (1455-1457)","Chōroku (1457-1460)","Kanshō (1460-1466)","Bunshō (1466-1467)","Ōnin (1467-1469)","Bunmei (1469-1487)","Chōkyō (1487-1489)","Entoku (1489-1492)","Meiō (1492-1501)","Bunki (1501-1504)","Eishō (1504-1521)","Taiei (1521-1528)","Kyōroku (1528-1532)","Tenmon (1532-1555)","Kōji (1555-1558)","Eiroku (1558-1570)","Genki (1570-1573)","Tenshō (1573-1592)","Bunroku (1592-1596)","Keichō (1596-1615)","Genwa (1615-1624)","Kan-ei (1624-1644)","Shōho (1644-1648)","Keian (1648-1652)","Shōō (1652-1655)","Meiryaku (1655-1658)","Manji (1658-1661)","Kanbun (1661-1673)","Enpō (1673-1681)","Tenwa (1681-1684)","Jōkyō (1684-1688)","Genroku (1688-1704)","Hōei (1704-1711)","Shōtoku (1711-1716)","Kyōhō (1716-1736)","Genbun (1736-1741)","Kanpō (1741-1744)","Enkyō (1744-1748)","Kan-en (1748-1751)","Hōryaku (1751-1764)","Meiwa (1764-1772)","An-ei (1772-1781)","Tenmei (1781-1789)","Kansei (1789-1801)","Kyōwa (1801-1804)","Bunka (1804-1818)","Bunsei (1818-1830)","Tenpō (1830-1844)","Kōka (1844-1848)","Kaei (1848-1854)","Ansei (1854-1860)","Man-en (1860-1861)","Bunkyū (1861-1864)","Genji (1864-1865)","Keiō (1865-1868)","Meiji","Taishō","Shōwa","Heisei"],long:["Taika (645-650)","Hakuchi (650-671)","Hakuhō (672-686)","Shuchō (686-701)","Taihō (701-704)","Keiun (704-708)","Wadō (708-715)","Reiki (715-717)","Yōrō (717-724)","Jinki (724-729)","Tempyō (729-749)","Tempyō-kampō (749-749)","Tempyō-shōhō (749-757)","Tempyō-hōji (757-765)","Temphō-jingo (765-767)","Jingo-keiun (767-770)","Hōki (770-780)","Ten-ō (781-782)","Enryaku (782-806)","Daidō (806-810)","Kōnin (810-824)","Tenchō (824-834)","Jōwa (834-848)","Kajō (848-851)","Ninju (851-854)","Saiko (854-857)","Tennan (857-859)","Jōgan (859-877)","Genkei (877-885)","Ninna (885-889)","Kampyō (889-898)","Shōtai (898-901)","Engi (901-923)","Enchō (923-931)","Shōhei (931-938)","Tengyō (938-947)","Tenryaku (947-957)","Tentoku (957-961)","Ōwa (961-964)","Kōhō (964-968)","Anna (968-970)","Tenroku (970-973)","Ten-en (973-976)","Jōgen (976-978)","Tengen (978-983)","Eikan (983-985)","Kanna (985-987)","Ei-en (987-989)","Eiso (989-990)","Shōryaku (990-995)","Chōtoku (995-999)","Chōhō (999-1004)","Kankō (1004-1012)","Chōwa (1012-1017)","Kannin (1017-1021)","Jian (1021-1024)","Manju (1024-1028)","Chōgen (1028-1037)","Chōryaku (1037-1040)","Chōkyū (1040-1044)","Kantoku (1044-1046)","Eishō (1046-1053)","Tengi (1053-1058)","Kōhei (1058-1065)","Jiryaku (1065-1069)","Enkyū (1069-1074)","Shōho (1074-1077)","Shōryaku (1077-1081)","Eiho (1081-1084)","Ōtoku (1084-1087)","Kanji (1087-1094)","Kaho (1094-1096)","Eichō (1096-1097)","Shōtoku (1097-1099)","Kōwa (1099-1104)","Chōji (1104-1106)","Kashō (1106-1108)","Tennin (1108-1110)","Ten-ei (1110-1113)","Eikyū (1113-1118)","Gen-ei (1118-1120)","Hoan (1120-1124)","Tenji (1124-1126)","Daiji (1126-1131)","Tenshō (1131-1132)","Chōshō (1132-1135)","Hoen (1135-1141)","Eiji (1141-1142)","Kōji (1142-1144)","Tenyō (1144-1145)","Kyūan (1145-1151)","Ninpei (1151-1154)","Kyūju (1154-1156)","Hogen (1156-1159)","Heiji (1159-1160)","Eiryaku (1160-1161)","Ōho (1161-1163)","Chōkan (1163-1165)","Eiman (1165-1166)","Nin-an (1166-1169)","Kaō (1169-1171)","Shōan (1171-1175)","Angen (1175-1177)","Jishō (1177-1181)","Yōwa (1181-1182)","Juei (1182-1184)","Genryuku (1184-1185)","Bunji (1185-1190)","Kenkyū (1190-1199)","Shōji (1199-1201)","Kennin (1201-1204)","Genkyū (1204-1206)","Ken-ei (1206-1207)","Shōgen (1207-1211)","Kenryaku (1211-1213)","Kenpō (1213-1219)","Shōkyū (1219-1222)","Jōō (1222-1224)","Gennin (1224-1225)","Karoku (1225-1227)","Antei (1227-1229)","Kanki (1229-1232)","Jōei (1232-1233)","Tempuku (1233-1234)","Bunryaku (1234-1235)","Katei (1235-1238)","Ryakunin (1238-1239)","En-ō (1239-1240)","Ninji (1240-1243)","Kangen (1243-1247)","Hōji (1247-1249)","Kenchō (1249-1256)","Kōgen (1256-1257)","Shōka (1257-1259)","Shōgen (1259-1260)","Bun-ō (1260-1261)","Kōchō (1261-1264)","Bun-ei (1264-1275)","Kenji (1275-1278)","Kōan (1278-1288)","Shōō (1288-1293)","Einin (1293-1299)","Shōan (1299-1302)","Kengen (1302-1303)","Kagen (1303-1306)","Tokuji (1306-1308)","Enkei (1308-1311)","Ōchō (1311-1312)","Shōwa (1312-1317)","Bunpō (1317-1319)","Genō (1319-1321)","Genkyō (1321-1324)","Shōchū (1324-1326)","Kareki (1326-1329)","Gentoku (1329-1331)","Genkō (1331-1334)","Kemmu (1334-1336)","Engen (1336-1340)","Kōkoku (1340-1346)","Shōhei (1346-1370)","Kentoku (1370-1372)","Bunchū (1372-1375)","Tenju (1375-1379)","Kōryaku (1379-1381)","Kōwa (1381-1384)","Genchū (1384-1392)","Meitoku (1384-1387)","Kakei (1387-1389)","Kōō (1389-1390)","Meitoku (1390-1394)","Ōei (1394-1428)","Shōchō (1428-1429)","Eikyō (1429-1441)","Kakitsu (1441-1444)","Bun-an (1444-1449)","Hōtoku (1449-1452)","Kyōtoku (1452-1455)","Kōshō (1455-1457)","Chōroku (1457-1460)","Kanshō (1460-1466)","Bunshō (1466-1467)","Ōnin (1467-1469)","Bunmei (1469-1487)","Chōkyō (1487-1489)","Entoku (1489-1492)","Meiō (1492-1501)","Bunki (1501-1504)","Eishō (1504-1521)","Taiei (1521-1528)","Kyōroku (1528-1532)","Tenmon (1532-1555)","Kōji (1555-1558)","Eiroku (1558-1570)","Genki (1570-1573)","Tenshō (1573-1592)","Bunroku (1592-1596)","Keichō (1596-1615)","Genwa (1615-1624)","Kan-ei (1624-1644)","Shōho (1644-1648)","Keian (1648-1652)","Shōō (1652-1655)","Meiryaku (1655-1658)","Manji (1658-1661)","Kanbun (1661-1673)","Enpō (1673-1681)","Tenwa (1681-1684)","Jōkyō (1684-1688)","Genroku (1688-1704)","Hōei (1704-1711)","Shōtoku (1711-1716)","Kyōhō (1716-1736)","Genbun (1736-1741)","Kanpō (1741-1744)","Enkyō (1744-1748)","Kan-en (1748-1751)","Hōryaku (1751-1764)","Meiwa (1764-1772)","An-ei (1772-1781)","Tenmei (1781-1789)","Kansei (1789-1801)","Kyōwa (1801-1804)","Bunka (1804-1818)","Bunsei (1818-1830)","Tenpō (1830-1844)","Kōka (1844-1848)","Kaei (1848-1854)","Ansei (1854-1860)","Man-en (1860-1861)","Bunkyū (1861-1864)","Genji (1864-1865)","Keiō (1865-1868)","Meiji","Taishō","Shōwa","Heisei"]},dayPeriods:{am:"ND",pm:"LK"}},persian:{months:{narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],short:["Farvardin","Ordibehesht","Khordad","Tir","Mordad","Shahrivar","Mehr","Aban","Azar","Dey","Bahman","Esfand"],long:["Farvardin","Ordibehesht","Khordad","Tir","Mordad","Shahrivar","Mehr","Aban","Azar","Dey","Bahman","Esfand"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},eras:{narrow:["AP"],short:["AP"],long:["AP"]},dayPeriods:{am:"ND",pm:"LK"}},roc:{months:{narrow:["N","F","M","N","B","F","L","K","M","N","N","K"],short:["Nye","Ful","Mbä","Ngu","Bêl","Fön","Len","Kük","Mvu","Ngb","Nab","Kak"],long:["Nyenye","Fulundïgi","Mbängü","Ngubùe","Bêläwü","Föndo","Lengua","Kükürü","Mvuka","Ngberere","Nabändüru","Kakauka"]},days:{narrow:["K","S","T","S","K","P","Y"],short:["Bk1","Bk2","Bk3","Bk4","Bk5","Lâp","Lây"],long:["Bikua-ôko","Bïkua-ûse","Bïkua-ptâ","Bïkua-usïö","Bïkua-okü","Lâpôsö","Lâyenga"]},eras:{narrow:["Before R.O.C.","R.O.C."],short:["Before R.O.C.","R.O.C."],long:["Before R.O.C.","R.O.C."]},dayPeriods:{am:"ND",pm:"LK"}}}},number:{nu:["latn"],patterns:{decimal:{positivePattern:"{number}",negativePattern:"-{number}"},currency:{positivePattern:"{currency}{number}",negativePattern:"{currency}-{number}"},percent:{positivePattern:"{number}%",negativePattern:"-{number}%"}},symbols:{latn:{decimal:",",group:".",nan:"NaN",percent:"%",infinity:"∞"}},currencies:{AUD:"A$",BRL:"R$",CAD:"CA$",CNY:"CN¥",EUR:"€",GBP:"£",HKD:"HK$",ILS:"₪",INR:"₹",JPY:"JP¥",KRW:"₩",MXN:"MX$",NZD:"NZ$",TWD:"NT$",USD:"US$",VND:"₫",XAF:"FCFA",XCD:"EC$",XOF:"CFA",XPF:"CFPF"}}});
terry408911/TerryBlog
node_modules/intl/locale-data/jsonp/sg.js
JavaScript
mit
24,796
/** * AddOnManager.js * * Released under LGPL License. * Copyright (c) 1999-2015 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ /** * This class handles the loading of themes/plugins or other add-ons and their language packs. * * @class tinymce.AddOnManager */ define("tinymce/AddOnManager", [ "tinymce/dom/ScriptLoader", "tinymce/util/Tools" ], function(ScriptLoader, Tools) { var each = Tools.each; function AddOnManager() { var self = this; self.items = []; self.urls = {}; self.lookup = {}; } AddOnManager.prototype = { /** * Returns the specified add on by the short name. * * @method get * @param {String} name Add-on to look for. * @return {tinymce.Theme/tinymce.Plugin} Theme or plugin add-on instance or undefined. */ get: function(name) { if (this.lookup[name]) { return this.lookup[name].instance; } return undefined; }, dependencies: function(name) { var result; if (this.lookup[name]) { result = this.lookup[name].dependencies; } return result || []; }, /** * Loads a language pack for the specified add-on. * * @method requireLangPack * @param {String} name Short name of the add-on. * @param {String} languages Optional comma or space separated list of languages to check if it matches the name. */ requireLangPack: function(name, languages) { var language = AddOnManager.language; if (language && AddOnManager.languageLoad !== false) { if (languages) { languages = ',' + languages + ','; // Load short form sv.js or long form sv_SE.js if (languages.indexOf(',' + language.substr(0, 2) + ',') != -1) { language = language.substr(0, 2); } else if (languages.indexOf(',' + language + ',') == -1) { return; } } ScriptLoader.ScriptLoader.add(this.urls[name] + '/langs/' + language + '.js'); } }, /** * Adds a instance of the add-on by it's short name. * * @method add * @param {String} id Short name/id for the add-on. * @param {tinymce.Theme/tinymce.Plugin} addOn Theme or plugin to add. * @return {tinymce.Theme/tinymce.Plugin} The same theme or plugin instance that got passed in. * @example * // Create a simple plugin * tinymce.create('tinymce.plugins.TestPlugin', { * TestPlugin: function(ed, url) { * ed.on('click', function(e) { * ed.windowManager.alert('Hello World!'); * }); * } * }); * * // Register plugin using the add method * tinymce.PluginManager.add('test', tinymce.plugins.TestPlugin); * * // Initialize TinyMCE * tinymce.init({ * ... * plugins: '-test' // Init the plugin but don't try to load it * }); */ add: function(id, addOn, dependencies) { this.items.push(addOn); this.lookup[id] = {instance: addOn, dependencies: dependencies}; return addOn; }, createUrl: function(baseUrl, dep) { if (typeof dep === "object") { return dep; } return {prefix: baseUrl.prefix, resource: dep, suffix: baseUrl.suffix}; }, /** * Add a set of components that will make up the add-on. Using the url of the add-on name as the base url. * This should be used in development mode. A new compressor/javascript munger process will ensure that the * components are put together into the plugin.js file and compressed correctly. * * @method addComponents * @param {String} pluginName name of the plugin to load scripts from (will be used to get the base url for the plugins). * @param {Array} scripts Array containing the names of the scripts to load. */ addComponents: function(pluginName, scripts) { var pluginUrl = this.urls[pluginName]; each(scripts, function(script) { ScriptLoader.ScriptLoader.add(pluginUrl + "/" + script); }); }, /** * Loads an add-on from a specific url. * * @method load * @param {String} name Short name of the add-on that gets loaded. * @param {String} addOnUrl URL to the add-on that will get loaded. * @param {function} callback Optional callback to execute ones the add-on is loaded. * @param {Object} scope Optional scope to execute the callback in. * @example * // Loads a plugin from an external URL * tinymce.PluginManager.load('myplugin', '/some/dir/someplugin/plugin.js'); * * // Initialize TinyMCE * tinymce.init({ * ... * plugins: '-myplugin' // Don't try to load it again * }); */ load: function(name, addOnUrl, callback, scope) { var self = this, url = addOnUrl; function loadDependencies() { var dependencies = self.dependencies(name); each(dependencies, function(dep) { var newUrl = self.createUrl(addOnUrl, dep); self.load(newUrl.resource, newUrl, undefined, undefined); }); if (callback) { if (scope) { callback.call(scope); } else { callback.call(ScriptLoader); } } } if (self.urls[name]) { return; } if (typeof addOnUrl === "object") { url = addOnUrl.prefix + addOnUrl.resource + addOnUrl.suffix; } if (url.indexOf('/') !== 0 && url.indexOf('://') == -1) { url = AddOnManager.baseURL + '/' + url; } self.urls[name] = url.substring(0, url.lastIndexOf('/')); if (self.lookup[name]) { loadDependencies(); } else { ScriptLoader.ScriptLoader.add(url, loadDependencies, scope); } } }; AddOnManager.PluginManager = new AddOnManager(); AddOnManager.ThemeManager = new AddOnManager(); return AddOnManager; }); /** * TinyMCE theme class. * * @class tinymce.Theme */ /** * This method is responsible for rendering/generating the overall user interface with toolbars, buttons, iframe containers etc. * * @method renderUI * @param {Object} obj Object parameter containing the targetNode DOM node that will be replaced visually with an editor instance. * @return {Object} an object with items like iframeContainer, editorContainer, sizeContainer, deltaWidth, deltaHeight. */ /** * Plugin base class, this is a pseudo class that describes how a plugin is to be created for TinyMCE. The methods below are all optional. * * @class tinymce.Plugin * @example * tinymce.PluginManager.add('example', function(editor, url) { * // Add a button that opens a window * editor.addButton('example', { * text: 'My button', * icon: false, * onclick: function() { * // Open window * editor.windowManager.open({ * title: 'Example plugin', * body: [ * {type: 'textbox', name: 'title', label: 'Title'} * ], * onsubmit: function(e) { * // Insert content when the window form is submitted * editor.insertContent('Title: ' + e.data.title); * } * }); * } * }); * * // Adds a menu item to the tools menu * editor.addMenuItem('example', { * text: 'Example plugin', * context: 'tools', * onclick: function() { * // Open window with a specific url * editor.windowManager.open({ * title: 'TinyMCE site', * url: 'http://www.tinymce.com', * width: 800, * height: 600, * buttons: [{ * text: 'Close', * onclick: 'close' * }] * }); * } * }); * }); */
hognogi/cherryplum-blog
client/res/admin/js/plugins/tinymce/classes/AddOnManager.js
JavaScript
mit
7,575
/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var Q = require('q'), shell = require('shelljs'), versions = require('./versions'); var XCODEBUILD_MIN_VERSION = '6.0.0'; var XCODEBUILD_NOT_FOUND_MESSAGE = 'Please install version ' + XCODEBUILD_MIN_VERSION + ' or greater from App Store'; var IOS_DEPLOY_MIN_VERSION = '1.8.3'; var IOS_DEPLOY_NOT_FOUND_MESSAGE = 'Please download, build and install version ' + IOS_DEPLOY_MIN_VERSION + ' or greater' + ' from https://github.com/phonegap/ios-deploy into your path, or do \'npm install -g ios-deploy\''; /** * Checks if xcode util is available * @return {Promise} Returns a promise either resolved with xcode version or rejected */ module.exports.run = module.exports.check_xcodebuild = function () { return checkTool('xcodebuild', XCODEBUILD_MIN_VERSION, XCODEBUILD_NOT_FOUND_MESSAGE); }; /** * Checks if ios-deploy util is available * @return {Promise} Returns a promise either resolved with ios-deploy version or rejected */ module.exports.check_ios_deploy = function () { return checkTool('ios-deploy', IOS_DEPLOY_MIN_VERSION, IOS_DEPLOY_NOT_FOUND_MESSAGE); }; module.exports.check_os = function () { // Build iOS apps available for OSX platform only, so we reject on others platforms return process.platform === 'darwin' ? Q.resolve(process.platform) : Q.reject('Cordova tooling for iOS requires Apple OS X'); }; /** * Checks if specific tool is available. * @param {String} tool Tool name to check. Known tools are 'xcodebuild' and 'ios-deploy' * @param {Number} minVersion Min allowed tool version. * @param {String} message Message that will be used to reject promise. * @return {Promise} Returns a promise either resolved with tool version or rejected */ function checkTool (tool, minVersion, message) { // Check whether tool command is available at all var tool_command = shell.which(tool); if (!tool_command) { return Q.reject(tool + ' was not found. ' + (message || '')); } // check if tool version is greater than specified one return versions.get_tool_version(tool).then(function (version) { version = version.trim(); return versions.compareVersions(version, minVersion) >= 0 ? Q.resolve(version) : Q.reject('Cordova needs ' + tool + ' version ' + minVersion + ' or greater, you have version ' + version + '. ' + (message || '')); }); } /** * Object that represents one of requirements for current platform. * @param {String} id The unique identifier for this requirements. * @param {String} name The name of requirements. Human-readable field. * @param {Boolean} isFatal Marks the requirement as fatal. If such requirement will fail * next requirements' checks will be skipped. */ var Requirement = function (id, name, isFatal) { this.id = id; this.name = name; this.installed = false; this.metadata = {}; this.isFatal = isFatal || false; }; /** * Methods that runs all checks one by one and returns a result of checks * as an array of Requirement objects. This method intended to be used by cordova-lib check_reqs method * * @return Promise<Requirement[]> Array of requirements. Due to implementation, promise is always fulfilled. */ module.exports.check_all = function() { var requirements = [ new Requirement('os', 'Apple OS X', true), new Requirement('xcode', 'Xcode'), new Requirement('ios-deploy', 'ios-deploy') ]; var result = []; var fatalIsHit = false; var checkFns = [ module.exports.check_os, module.exports.check_xcodebuild, module.exports.check_ios_deploy ]; // Then execute requirement checks one-by-one return checkFns.reduce(function (promise, checkFn, idx) { return promise.then(function () { // If fatal requirement is failed, // we don't need to check others if (fatalIsHit) return Q(); var requirement = requirements[idx]; return checkFn() .then(function (version) { requirement.installed = true; requirement.metadata.version = version; result.push(requirement); }, function (err) { if (requirement.isFatal) fatalIsHit = true; requirement.metadata.reason = err; result.push(requirement); }); }); }, Q()) .then(function () { // When chain is completed, return requirements array to upstream API return result; }); };
JudahGabriel/Chavah
Chavah.iOS/cordova/platforms/ios/cordova/lib/check_reqs.js
JavaScript
mit
5,492
/* Plugin for Cycle2; Copyright (c) 2012 M. Alsup; v20140314 */ (function(e){"use strict";function t(t,i,n){var s,o=t.API.getComponent("pager");o.each(function(){var o=e(this);if(i.pagerTemplate){var c=t.API.tmpl(i.pagerTemplate,i,t,n[0]);s=e(c).appendTo(o)}else s=o.children().eq(t.slideCount-1);s.on(t.pagerEvent,function(e){t.pagerEventBubble||e.preventDefault(),t.API.page(o,e.currentTarget)})})}function i(e,t){var i=this.opts();if(!i.busy||i.manualTrump){var n=e.children().index(t),s=n,o=s>i.currSlide;i.currSlide!=s&&(i.nextSlide=s,i.API.prepareTx(!0,o),i.API.trigger("cycle-pager-activated",[i,e,t]))}}e.extend(e.fn.cycle.defaults,{pager:"> .cycle-pager",pagerActiveClass:"cycle-pager-active",pagerEvent:"click.cycle",pagerEventBubble:void 0,pagerTemplate:"<span>&bull;</span>"}),e(document).on("cycle-bootstrap",function(e,i,n){n.buildPagerLink=t}),e(document).on("cycle-slide-added",function(e,t,n,s){t.pager&&(t.API.buildPagerLink(t,n,s),t.API.page=i)}),e(document).on("cycle-slide-removed",function(t,i,n){if(i.pager){var s=i.API.getComponent("pager");s.each(function(){var t=e(this);e(t.children()[n]).remove()})}}),e(document).on("cycle-update-view",function(t,i){var n;i.pager&&(n=i.API.getComponent("pager"),n.each(function(){e(this).children().removeClass(i.pagerActiveClass).eq(i.currSlide).addClass(i.pagerActiveClass)}))}),e(document).on("cycle-destroyed",function(e,t){var i=t.API.getComponent("pager");i&&(i.children().off(t.pagerEvent),t.pagerTemplate&&i.empty())})})(jQuery);
jtblin/jsdelivr
files/cycle2/20140314/jquery.cycle2.pager.min.js
JavaScript
mit
1,500
/* Snowfall jquery plugin Version 1.5 Oct 5th 2011 Added collecting snow! Uses the canvas element to collect snow. In order to initialize snow collection use the following $(document).snowfall({collection : 'element'}); element = any valid jquery selector. The plugin then creates a canvas above every element that matches the selector, and collects the snow. If there are a varrying amount of elements the flakes get assigned a random one on start they will collide. Version 1.4 Dec 8th 2010 Fixed issues (I hope) with scroll bars flickering due to snow going over the edge of the screen. Added round snowflakes via css, will not work for any version of IE. - Thanks to Luke Barker of http://www.infinite-eye.com/ Added shadows as an option via css again will not work with IE. The idea behind shadows, is to show flakes on lighter colored web sites - Thanks Yutt Version 1.3.1 Nov 25th 2010 Updated script that caused flakes not to show at all if plugin was initialized with no options, also added the fixes that Han Bongers suggested Developed by Jason Brown for any bugs or questions email me at loktar69@hotmail info on the plugin is located on Somethinghitme.com values for snow options are flakeCount, flakeColor, flakeIndex, minSize, maxSize, minSpeed, maxSpeed, round, true or false, makes the snowflakes rounded if the browser supports it. shadow true or false, gives the snowflakes a shadow if the browser supports it. Example Usage : $(document).snowfall({flakeCount : 100, maxSpeed : 10}); -or- $('#element').snowfall({flakeCount : 800, maxSpeed : 5, maxSize : 5}); -or with defaults- $(document).snowfall(); - To clear - $('#element').snowfall('clear'); */ (function($){ $.snowfall = function(element, options){ var defaults = { flakeCount : 35, flakeColor : '#ffffff', flakeIndex: 999999, minSize : 1, maxSize : 2, minSpeed : 1, maxSpeed : 5, round : false, shadow : false, collection : false, collectionHeight : 40 }, options = $.extend(defaults, options), random = function random(min, max){ return Math.round(min + Math.random()*(max-min)); }; $(element).data("snowfall", this); // Snow flake object function Flake(_x, _y, _size, _speed, _id) { // Flake properties this.id = _id; this.x = _x; this.y = _y; this.size = _size; this.speed = _speed; this.step = 0; this.stepSize = random(1,10) / 100; if(options.collection){ this.target = canvasCollection[random(0,canvasCollection.length-1)]; } var flakeMarkup = $(document.createElement("div")).attr({'class': 'snowfall-flakes', 'id' : 'flake-' + this.id}).css({'width' : this.size, 'height' : this.size, 'background' : options.flakeColor, 'position' : 'absolute', 'top' : this.y, 'left' : this.x, 'fontSize' : 0, 'zIndex' : options.flakeIndex}); if($(element).get(0).tagName === $(document).get(0).tagName){ $('body').append(flakeMarkup); element = $('body'); }else{ $(element).append(flakeMarkup); } this.element = document.getElementById('flake-' + this.id); // Update function, used to update the snow flakes, and checks current snowflake against bounds this.update = function(){ this.y += this.speed; if(this.y > (elHeight) - (this.size + 6)){ this.reset(); } this.element.style.top = this.y + 'px'; this.element.style.left = this.x + 'px'; this.step += this.stepSize; this.x += Math.cos(this.step); // Pileup check if(options.collection){ if(this.x > this.target.x && this.x < this.target.width + this.target.x && this.y > this.target.y && this.y < this.target.height + this.target.y){ var ctx = this.target.element.getContext("2d"), curX = this.x - this.target.x, curY = this.y - this.target.y, colData = this.target.colData; if(colData[parseInt(curX)][parseInt(curY+this.speed+this.size)] !== undefined || curY+this.speed+this.size > this.target.height){ if(curY+this.speed+this.size > this.target.height){ while(curY+this.speed+this.size > this.target.height && this.speed > 0){ this.speed *= .5; } ctx.fillStyle = "#fff"; if(colData[parseInt(curX)][parseInt(curY+this.speed+this.size)] == undefined){ colData[parseInt(curX)][parseInt(curY+this.speed+this.size)] = 1; ctx.fillRect(curX, (curY)+this.speed+this.size, this.size, this.size); }else{ colData[parseInt(curX)][parseInt(curY+this.speed)] = 1; ctx.fillRect(curX, curY+this.speed, this.size, this.size); } this.reset(); }else{ // flow to the sides this.speed = 1; this.stepSize = 0; if(parseInt(curX)+1 < this.target.width && colData[parseInt(curX)+1][parseInt(curY)+1] == undefined ){ // go left this.x++; }else if(parseInt(curX)-1 > 0 && colData[parseInt(curX)-1][parseInt(curY)+1] == undefined ){ // go right this.x--; }else{ //stop ctx.fillStyle = "#fff"; ctx.fillRect(curX, curY, this.size, this.size); colData[parseInt(curX)][parseInt(curY)] = 1; this.reset(); } } } } } if(this.x > (elWidth) - widthOffset || this.x < widthOffset){ this.reset(); } } // Resets the snowflake once it reaches one of the bounds set this.reset = function(){ this.y = 0; this.x = random(widthOffset, elWidth - widthOffset); this.stepSize = random(1,10) / 100; this.size = random((options.minSize * 100), (options.maxSize * 100)) / 100; this.speed = random(options.minSpeed, options.maxSpeed); } } // Private vars var flakes = [], flakeId = 0, i = 0, elHeight = $(element).height(), elWidth = $(element).width(), widthOffset = 0, snowTimeout = 0; // Collection Piece ****************************** if(options.collection !== false){ var testElem = document.createElement('canvas'); if(!!(testElem.getContext && testElem.getContext('2d'))){ var canvasCollection = [], elements = $(options.collection), collectionHeight = options.collectionHeight; for(var i =0; i < elements.length; i++){ var bounds = elements[i].getBoundingClientRect(), canvas = document.createElement('canvas'), collisionData = []; if(bounds.top-collectionHeight > 0){ document.body.appendChild(canvas); canvas.style.position = 'absolute'; canvas.height = collectionHeight; canvas.width = bounds.width; canvas.style.left = bounds.left; canvas.style.top = bounds.top-collectionHeight; for(var w = 0; w < bounds.width/options.minSize; w+=options.minSize){ collisionData[w] = []; } canvasCollection.push({element :canvas, x : bounds.left, y : bounds.top-collectionHeight, width : bounds.width, height: collectionHeight, colData : collisionData}); } } }else{ // Canvas element isnt supported options.collection = false; } } // ************************************************ // This will reduce the horizontal scroll bar from displaying, when the effect is applied to the whole page if($(element).get(0).tagName === $(document).get(0).tagName){ widthOffset = 25; } // Bind the window resize event so we can get the innerHeight again $(window).bind("resize", function(){ elHeight = $(element).height(); elWidth = $(element).width(); }); // initialize the flakes for(i = 0; i < options.flakeCount; i+=1){ flakeId = flakes.length; flakes.push(new Flake(random(widthOffset,elWidth - widthOffset), random(0, elHeight), random((options.minSize * 100), (options.maxSize * 100)) / 100, random(options.minSpeed, options.maxSpeed), flakeId)); } // This adds the style to make the snowflakes round via border radius property if(options.round){ $('.snowfall-flakes').css({'-moz-border-radius' : options.maxSize, '-webkit-border-radius' : options.maxSize, 'border-radius' : options.maxSize}); } // This adds shadows just below the snowflake so they pop a bit on lighter colored web pages if(options.shadow){ $('.snowfall-flakes').css({'-moz-box-shadow' : '1px 1px 1px #555', '-webkit-box-shadow' : '1px 1px 1px #555', 'box-shadow' : '1px 1px 1px #555'}); } // this controls flow of the updating snow function snow(){ for( i = 0; i < flakes.length; i += 1){ flakes[i].update(); } snowTimeout = setTimeout(function(){snow()}, 30); } snow(); // Public Methods // clears the snowflakes this.clear = function(){ $(element).children('.snowfall-flakes').remove(); flakes = []; clearTimeout(snowTimeout); }; }; // Initialize the options and the plugin $.fn.snowfall = function(options){ if(typeof(options) == "object" || options == undefined){ return this.each(function(i){ (new $.snowfall(this, options)); }); }else if (typeof(options) == "string") { return this.each(function(i){ var snow = $(this).data('snowfall'); if(snow){ snow.clear(); } }); } }; })(jQuery);
2947721120/garrulous-octo-rutabaga
files/jquery.snowfall/1.5/snowfall.jquery.js
JavaScript
mit
9,817
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "a.m.", "p.m." ], "DAY": [ "Jumapiri", "Jumatatu", "Jumanne", "Jumatano", "Murwa wa Kanne", "Murwa wa Katano", "Jumamosi" ], "ERANAMES": [ "Imberi ya Kuuza Kwa", "Muhiga Kuvita Kuuza" ], "ERAS": [ "BC", "AD" ], "FIRSTDAYOFWEEK": 0, "MONTH": [ "Januari", "Februari", "Machi", "Aprili", "Mei", "Juni", "Julai", "Agosti", "Septemba", "Oktoba", "Novemba", "Desemba" ], "SHORTDAY": [ "J2", "J3", "J4", "J5", "Al", "Ij", "J1" ], "SHORTMONTH": [ "Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Ago", "Sep", "Okt", "Nov", "Des" ], "STANDALONEMONTH": [ "Januari", "Februari", "Machi", "Aprili", "Mei", "Juni", "Julai", "Agosti", "Septemba", "Oktoba", "Novemba", "Desemba" ], "WEEKENDRANGE": [ 5, 6 ], "fullDate": "EEEE, d MMMM y", "longDate": "d MMMM y", "medium": "d MMM y h:mm:ss a", "mediumDate": "d MMM y", "mediumTime": "h:mm:ss a", "short": "dd/MM/y h:mm a", "shortDate": "dd/MM/y", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "Ksh", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4-\u00a0", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "luy-ke", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
holtkamp/cdnjs
ajax/libs/angular-i18n/1.5.0-rc.0/angular-locale_luy-ke.js
JavaScript
mit
2,721
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "\u05e4\u05d0\u05e8\u05de\u05d9\u05d8\u05d0\u05d2", "\u05e0\u05d0\u05db\u05de\u05d9\u05d8\u05d0\u05d2" ], "DAY": [ "\u05d6\u05d5\u05e0\u05d8\u05d9\u05e7", "\u05de\u05d0\u05b8\u05e0\u05d8\u05d9\u05e7", "\u05d3\u05d9\u05e0\u05e1\u05d8\u05d9\u05e7", "\u05de\u05d9\u05d8\u05d5\u05d5\u05d0\u05da", "\u05d3\u05d0\u05e0\u05e2\u05e8\u05e9\u05d8\u05d9\u05e7", "\u05e4\u05bf\u05e8\u05f2\u05b7\u05d8\u05d9\u05e7", "\u05e9\u05d1\u05ea" ], "ERANAMES": [ "BCE", "CE" ], "ERAS": [ "BCE", "CE" ], "FIRSTDAYOFWEEK": 0, "MONTH": [ "\u05d9\u05d0\u05b7\u05e0\u05d5\u05d0\u05b7\u05e8", "\u05e4\u05bf\u05e2\u05d1\u05e8\u05d5\u05d0\u05b7\u05e8", "\u05de\u05e2\u05e8\u05e5", "\u05d0\u05b7\u05e4\u05bc\u05e8\u05d9\u05dc", "\u05de\u05d9\u05d9", "\u05d9\u05d5\u05e0\u05d9", "\u05d9\u05d5\u05dc\u05d9", "\u05d0\u05d5\u05d9\u05d2\u05d5\u05e1\u05d8", "\u05e1\u05e2\u05e4\u05bc\u05d8\u05e2\u05de\u05d1\u05e2\u05e8", "\u05d0\u05e7\u05d8\u05d0\u05d1\u05e2\u05e8", "\u05e0\u05d0\u05d5\u05d5\u05e2\u05de\u05d1\u05e2\u05e8", "\u05d3\u05e2\u05e6\u05e2\u05de\u05d1\u05e2\u05e8" ], "SHORTDAY": [ "\u05d6\u05d5\u05e0\u05d8\u05d9\u05e7", "\u05de\u05d0\u05b8\u05e0\u05d8\u05d9\u05e7", "\u05d3\u05d9\u05e0\u05e1\u05d8\u05d9\u05e7", "\u05de\u05d9\u05d8\u05d5\u05d5\u05d0\u05da", "\u05d3\u05d0\u05e0\u05e2\u05e8\u05e9\u05d8\u05d9\u05e7", "\u05e4\u05bf\u05e8\u05f2\u05b7\u05d8\u05d9\u05e7", "\u05e9\u05d1\u05ea" ], "SHORTMONTH": [ "\u05d9\u05d0\u05b7\u05e0\u05d5\u05d0\u05b7\u05e8", "\u05e4\u05bf\u05e2\u05d1\u05e8\u05d5\u05d0\u05b7\u05e8", "\u05de\u05e2\u05e8\u05e5", "\u05d0\u05b7\u05e4\u05bc\u05e8\u05d9\u05dc", "\u05de\u05d9\u05d9", "\u05d9\u05d5\u05e0\u05d9", "\u05d9\u05d5\u05dc\u05d9", "\u05d0\u05d5\u05d9\u05d2\u05d5\u05e1\u05d8", "\u05e1\u05e2\u05e4\u05bc\u05d8\u05e2\u05de\u05d1\u05e2\u05e8", "\u05d0\u05e7\u05d8\u05d0\u05d1\u05e2\u05e8", "\u05e0\u05d0\u05d5\u05d5\u05e2\u05de\u05d1\u05e2\u05e8", "\u05d3\u05e2\u05e6\u05e2\u05de\u05d1\u05e2\u05e8" ], "STANDALONEMONTH": [ "\u05d9\u05d0\u05b7\u05e0\u05d5\u05d0\u05b7\u05e8", "\u05e4\u05bf\u05e2\u05d1\u05e8\u05d5\u05d0\u05b7\u05e8", "\u05de\u05e2\u05e8\u05e5", "\u05d0\u05b7\u05e4\u05bc\u05e8\u05d9\u05dc", "\u05de\u05d9\u05d9", "\u05d9\u05d5\u05e0\u05d9", "\u05d9\u05d5\u05dc\u05d9", "\u05d0\u05d5\u05d9\u05d2\u05d5\u05e1\u05d8", "\u05e1\u05e2\u05e4\u05bc\u05d8\u05e2\u05de\u05d1\u05e2\u05e8", "\u05d0\u05e7\u05d8\u05d0\u05d1\u05e2\u05e8", "\u05e0\u05d0\u05d5\u05d5\u05e2\u05de\u05d1\u05e2\u05e8", "\u05d3\u05e2\u05e6\u05e2\u05de\u05d1\u05e2\u05e8" ], "WEEKENDRANGE": [ 5, 6 ], "fullDate": "EEEE, d\u05d8\u05df MMMM y", "longDate": "d\u05d8\u05df MMMM y", "medium": "d\u05d8\u05df MMM y HH:mm:ss", "mediumDate": "d\u05d8\u05df MMM y", "mediumTime": "HH:mm:ss", "short": "dd/MM/yy HH:mm", "shortDate": "dd/MM/yy", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "$", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-\u00a4\u00a0", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "yi-001", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
jackgao2016/angular.js
src/ngLocale/angular-locale_yi-001.js
JavaScript
mit
4,569
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "\u0628.\u0646", "\u062f.\u0646" ], "DAY": [ "\u06cc\u06d5\u06a9\u0634\u06d5\u0645\u0645\u06d5", "\u062f\u0648\u0648\u0634\u06d5\u0645\u0645\u06d5", "\u0633\u06ce\u0634\u06d5\u0645\u0645\u06d5", "\u0686\u0648\u0627\u0631\u0634\u06d5\u0645\u0645\u06d5", "\u067e\u06ce\u0646\u062c\u0634\u06d5\u0645\u0645\u06d5", "\u06be\u06d5\u06cc\u0646\u06cc", "\u0634\u06d5\u0645\u0645\u06d5" ], "ERANAMES": [ "\u067e\u06ce\u0634 \u0632\u0627\u06cc\u06cc\u0646", "\u0632\u0627\u06cc\u06cc\u0646\u06cc" ], "ERAS": [ "\u067e\u06ce\u0634 \u0632\u0627\u06cc\u06cc\u06cc\u0646", "\u0632" ], "FIRSTDAYOFWEEK": 5, "MONTH": [ "\u06a9\u0627\u0646\u0648\u0648\u0646\u06cc \u062f\u0648\u0648\u06d5\u0645", "\u0634\u0648\u0628\u0627\u062a", "\u0626\u0627\u0632\u0627\u0631", "\u0646\u06cc\u0633\u0627\u0646", "\u0626\u0627\u06cc\u0627\u0631", "\u062d\u0648\u0632\u06d5\u06cc\u0631\u0627\u0646", "\u062a\u06d5\u0645\u0648\u0648\u0632", "\u0626\u0627\u0628", "\u0626\u06d5\u06cc\u0644\u0648\u0648\u0644", "\u062a\u0634\u0631\u06cc\u0646\u06cc \u06cc\u06d5\u06a9\u06d5\u0645", "\u062a\u0634\u0631\u06cc\u0646\u06cc \u062f\u0648\u0648\u06d5\u0645", "\u06a9\u0627\u0646\u0648\u0646\u06cc \u06cc\u06d5\u06a9\u06d5\u0645" ], "SHORTDAY": [ "\u06cc\u06d5\u06a9\u0634\u06d5\u0645\u0645\u06d5", "\u062f\u0648\u0648\u0634\u06d5\u0645\u0645\u06d5", "\u0633\u06ce\u0634\u06d5\u0645\u0645\u06d5", "\u0686\u0648\u0627\u0631\u0634\u06d5\u0645\u0645\u06d5", "\u067e\u06ce\u0646\u062c\u0634\u06d5\u0645\u0645\u06d5", "\u06be\u06d5\u06cc\u0646\u06cc", "\u0634\u06d5\u0645\u0645\u06d5" ], "SHORTMONTH": [ "\u06a9\u0627\u0646\u0648\u0648\u0646\u06cc \u062f\u0648\u0648\u06d5\u0645", "\u0634\u0648\u0628\u0627\u062a", "\u0626\u0627\u0632\u0627\u0631", "\u0646\u06cc\u0633\u0627\u0646", "\u0626\u0627\u06cc\u0627\u0631", "\u062d\u0648\u0632\u06d5\u06cc\u0631\u0627\u0646", "\u062a\u06d5\u0645\u0648\u0648\u0632", "\u0626\u0627\u0628", "\u0626\u06d5\u06cc\u0644\u0648\u0648\u0644", "\u062a\u0634\u0631\u06cc\u0646\u06cc \u06cc\u06d5\u06a9\u06d5\u0645", "\u062a\u0634\u0631\u06cc\u0646\u06cc \u062f\u0648\u0648\u06d5\u0645", "\u06a9\u0627\u0646\u0648\u0646\u06cc \u06cc\u06d5\u06a9\u06d5\u0645" ], "STANDALONEMONTH": [ "\u06a9\u0627\u0646\u0648\u0648\u0646\u06cc \u062f\u0648\u0648\u06d5\u0645", "\u0634\u0648\u0628\u0627\u062a", "\u0626\u0627\u0632\u0627\u0631", "\u0646\u06cc\u0633\u0627\u0646", "\u0626\u0627\u06cc\u0627\u0631", "\u062d\u0648\u0632\u06d5\u06cc\u0631\u0627\u0646", "\u062a\u06d5\u0645\u0648\u0648\u0632", "\u0626\u0627\u0628", "\u0626\u06d5\u06cc\u0644\u0648\u0648\u0644", "\u062a\u0634\u0631\u06cc\u0646\u06cc \u06cc\u06d5\u06a9\u06d5\u0645", "\u062a\u0634\u0631\u06cc\u0646\u06cc \u062f\u0648\u0648\u06d5\u0645", "\u06a9\u0627\u0646\u0648\u0646\u06cc \u06cc\u06d5\u06a9\u06d5\u0645" ], "WEEKENDRANGE": [ 4, 5 ], "fullDate": "y MMMM d, EEEE", "longDate": "d\u06cc MMMM\u06cc y", "medium": "y MMM d HH:mm:ss", "mediumDate": "y MMM d", "mediumTime": "HH:mm:ss", "short": "y-MM-dd HH:mm", "shortDate": "y-MM-dd", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "Rial", "DECIMAL_SEP": "\u066b", "GROUP_SEP": "\u066c", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-\u00a4\u00a0", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "ckb-ir", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
him2him2/cdnjs
ajax/libs/angular.js/1.5.0-rc.0/i18n/angular-locale_ckb-ir.js
JavaScript
mit
4,832
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], "ERANAMES": [ "Before Christ", "Anno Domini" ], "ERAS": [ "BC", "AD" ], "FIRSTDAYOFWEEK": 0, "MONTH": [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], "SHORTDAY": [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], "SHORTMONTH": [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], "STANDALONEMONTH": [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], "WEEKENDRANGE": [ 5, 6 ], "fullDate": "EEEE, MMMM d, y", "longDate": "MMMM d, y", "medium": "MMM d, y h:mm:ss a", "mediumDate": "MMM d, y", "mediumTime": "h:mm:ss a", "short": "M/d/yy h:mm a", "shortDate": "M/d/yy", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "$", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-\u00a4", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "en-mp", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
sufuf3/cdnjs
ajax/libs/angular.js/1.5.0-rc.0/i18n/angular-locale_en-mp.js
JavaScript
mit
2,689
/*! bignumber.js v1.5.0 https://github.com/MikeMcl/bignumber.js/LICENCE */ (function(n){"use strict";function i(n,t){var c,l,a,b,w,p,s=this;if(!(s instanceof i))return new i(n,t);if(n instanceof i)if(u=0,t!==c)n+="";else{s.s=n.s;s.e=n.e;s.c=(n=n.c)?n.slice():n;return}if(typeof n!="string"&&(n=(a=typeof n=="number"||Object.prototype.toString.call(n)=="[object Number]")&&n===0&&1/n<0?"-0":n+""),p=n,t===c&&g.test(n))s.s=n.charAt(0)=="-"?(n=n.slice(1),-1):1;else{if(t==10)return k(n,e,r);if(n=rt.call(n).replace(/^\+(?!-)/,""),s.s=n.charAt(0)=="-"?(n=n.replace(/^-(?!-)/,""),-1):1,t!=null?t!=(t|0)&&y||(o=!(t>=2&&t<65))?(f(t,2),w=g.test(n)):(b="["+d.slice(0,t=t|0)+"]+",n=n.replace(/\.$/,"").replace(/^\./,"0."),(w=new RegExp("^"+b+"(?:\\."+b+")?$",t<37?"i":"").test(n))?(a&&(n.replace(/^0\.0*|\./,"").length>15&&f(p,0),a=!a),n=tt(n,10,t,s.s)):n!="Infinity"&&n!="NaN"&&(f(p,1,t),n="NaN")):w=g.test(n),!w){s.c=s.e=null;n!="Infinity"&&(n!="NaN"&&f(p,3),s.s=null);u=0;return}}for((c=n.indexOf("."))>-1&&(n=n.replace(".","")),(l=n.search(/e/i))>0?(c<0&&(c=l),c+=+n.slice(l+1),n=n.substring(0,l)):c<0&&(c=n.length),l=0;n.charAt(l)=="0";l++);if(t=n.length,a&&t>15&&n.slice(l).length>15&&f(p,0),u=0,(c-=l+1)>h)s.c=s.e=null;else if(l==t||c<v)s.c=[s.e=0];else{for(;n.charAt(--t)=="0";);for(s.e=c,s.c=[],c=0;l<=t;s.c[c++]=+n.charAt(l++));}}function f(n,t,i,r,f,e){if(y){var c,s=["new BigNumber","cmp","div","eq","gt","gte","lt","lte","minus","mod","plus","times","toFr"][u?u<0?-u:u:1/u<0?1:0]+"()",h=o?" out of range":" not a"+(f?" non-zero":"n")+" integer";h=([s+" number type has more than 15 significant digits",s+" not a base "+i+" number",s+" base"+h,s+" not a number"][t]||i+"() "+t+(e?" not a boolean or binary digit":h+(r?" or not ["+(o?" negative, positive":" integer, integer")+" ]":"")))+": "+n;o=u=0;c=new Error(h);c.name="BigNumber Error";throw c;}}function tt(n,t,r,u){function h(n,i){var u,e=0,s=n.length,o,f=[0];for(i=i||r;e<s;e++){for(o=f.length,u=0;u<o;f[u]*=i,u++);for(f[0]+=d.indexOf(n.charAt(e)),u=0;u<f.length;u++)f[u]>t-1&&(f[u+1]==null&&(f[u+1]=0),f[u+1]+=f[u]/t^0,f[u]%=t)}return f.reverse()}function o(n){for(var t=0,r=n.length,i="";t<r;i+=d.charAt(n[t++]));return i}var e,c,l,f,s,a;if(r<37&&(n=n.toLowerCase()),(e=n.indexOf("."))>-1)if(e=n.length-e-1,c=h(new i(r).pow(e).toF(),10),f=n.split("."),l=h(f[1]),f=h(f[0]),a=it(l,c,l.length-c.length,u,t,f[f.length-1]&1),s=a.c,e=a.e){for(;++e;s.unshift(0));n=o(f)+"."+o(s)}else s[0]?f[e=f.length-1]<t-1?(++f[e],n=o(f)):n=new i(o(f),t).plus(p).toS(t):n=o(f);else n=o(h(n));return n}function it(n,t,r,u,f,o){var y,d,k,w,a,rt=t.slice(),g=y=t.length,ut=n.length,s=n.slice(0,y),c=s.length,l=new i(p),nt=l.c=[],tt=0,it=e+(l.e=r)+1;for(l.s=u,u=it<0?0:it;c++<y;s.push(0));rt.unshift(0);do{for(k=0;k<f;k++){if(y!=(c=s.length))w=y>c?1:-1;else for(a=-1,w=0;++a<y;)if(t[a]!=s[a]){w=t[a]>s[a]?1:-1;break}if(w<0){for(d=c==y?t:rt;c;){if(s[--c]<d[c]){for(a=c;a&&!s[--a];s[a]=f-1);--s[a];s[c]+=f}s[c]-=d[c]}for(;!s[0];s.shift());}else break}nt[tt++]=w?k:++k;s[0]&&w?s[c]=n[g]||0:s=[n[g]]}while((g++<ut||s[0]!=null)&&u--);return nt[0]||tt==1||(--l.e,nt.shift()),tt>it&&b(l,e,f,o,s[0]!=null),l.e>h?l.c=l.e=null:l.e<v&&(l.c=[l.e=0]),l}function w(n,t,r){var u=t-(n=new i(n)).e,f=n.c;if(!f)return n.toS();for(f.length>++t&&b(n,u,10),u=f[0]==0?u+1:r?t:n.e+u+1;f.length<u;f.push(0));return u=n.e,r==1||r==2&&(--t<u||u<=c)?(n.s<0&&f[0]?"-":"")+(f.length>1?(f.splice(1,0,"."),f.join("")):f[0])+(u<0?"e":"e+")+u:n.toS()}function b(n,t,i,u,f){var e=n.c,s=n.s<0,c=i/2,o=n.e+t+1,h=e[o],l=f||o<0||e[o+1]!=null;if(f=r<4?(h!=null||l)&&(r==0||r==2&&!s||r==3&&s):h>c||h==c&&(r==4||l||r==6&&(e[o-1]&1||!t&&u)||r==7&&!s||r==8&&s),o<1||!e[0])return e.length=0,e.push(0),f?(e[0]=1,n.e=-t):n.e=0,n;if(e.length=o--,f)for(--i;++e[o]>i;)e[o]=0,o--||(++n.e,e.unshift(1));for(o=e.length;!e[--o];e.pop());return n}function k(n,t,u){var f=r;return r=u,n=new i(n),n.c&&b(n,t,10),r=f,n}var s=1e9,nt=1e6,e=20,r=4,c=-7,a=21,v=-s,h=s,y=!0,l=parseInt,t=i.prototype,d="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",o,u=0,g=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,rt=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},p=i(1);i.ROUND_UP=0;i.ROUND_DOWN=1;i.ROUND_CEIL=2;i.ROUND_FLOOR=3;i.ROUND_HALF_UP=4;i.ROUND_HALF_DOWN=5;i.ROUND_HALF_EVEN=6;i.ROUND_HALF_CEIL=7;i.ROUND_HALF_FLOOR=8;i.config=function(){var n,t,g=0,p={},d=arguments,k=d[0],w="config",i=function(n,t,i){return!((o=n<t||n>i)||l(n)!=n&&n!==0)},b=k&&typeof k=="object"?function(){if(k.hasOwnProperty(t))return(n=k[t])!=null}:function(){if(d.length>g)return(n=d[g++])!=null};return b(t="DECIMAL_PLACES")&&(i(n,0,s)?e=n|0:f(n,t,w)),p[t]=e,b(t="ROUNDING_MODE")&&(i(n,0,8)?r=n|0:f(n,t,w)),p[t]=r,b(t="EXPONENTIAL_AT")&&(i(n,-s,s)?c=-(a=~~(n<0?-n:+n)):!o&&n&&i(n[0],-s,0)&&i(n[1],0,s)?(c=~~n[0],a=~~n[1]):f(n,t,w,1)),p[t]=[c,a],b(t="RANGE")&&(i(n,-s,s)&&~~n?v=-(h=~~(n<0?-n:+n)):!o&&n&&i(n[0],-s,-1)&&i(n[1],1,s)?(v=~~n[0],h=~~n[1]):f(n,t,w,1,1)),p[t]=[v,h],b(t="ERRORS")&&(n===!!n||n===1||n===0?l=(o=u=0,y=!!n)?parseInt:parseFloat:f(n,t,w,0,0,1)),p[t]=y,p};t.abs=t.absoluteValue=function(){var n=new i(this);return n.s<0&&(n.s=1),n};t.ceil=function(){return k(this,0,2)};t.comparedTo=t.cmp=function(n,t){var f,l=this,e=l.c,o=(u=-u,n=new i(n,t)).c,r=l.s,c=n.s,s=l.e,h=n.e;if(!r||!c)return null;if(f=e&&!e[0],t=o&&!o[0],f||t)return f?t?0:-c:r;if(r!=c)return r;if(f=r<0,t=s==h,!e||!o)return t?0:!e^f?1:-1;if(!t)return s>h^f?1:-1;for(r=-1,c=(s=e.length)<(h=o.length)?s:h;++r<c;)if(e[r]!=o[r])return e[r]>o[r]^f?1:-1;return s==h?0:s>h^f?1:-1};t.decimalPlaces=t.dp=function(){var n;return this.c?(n=this.c.length-this.e-1,n<0?0:n):null};t.dividedBy=t.div=function(n,t){var r=this.c,o=this.e,s=this.s,f=(u=2,n=new i(n,t)).c,h=n.e,c=n.s,e=s==c?1:-1;return!o&&(!r||!r[0])||!h&&(!f||!f[0])?new i(!s||!c||(r?f&&r[0]==f[0]:!f)?NaN:r&&r[0]==0||!f?e*0:e/0):it(r,f,o-h,e,10)};t.equals=t.eq=function(n,t){return u=3,this.cmp(n,t)===0};t.floor=function(){return k(this,0,3)};t.greaterThan=t.gt=function(n,t){return u=4,this.cmp(n,t)>0};t.greaterThanOrEqualTo=t.gte=function(n,t){return u=5,(t=this.cmp(n,t))==1||t===0};t.isFinite=t.isF=function(){return!!this.c};t.isNaN=function(){return!this.s};t.isNegative=t.isNeg=function(){return this.s<0};t.isZero=t.isZ=function(){return!!this.c&&this.c[0]==0};t.lessThan=t.lt=function(n,t){return u=6,this.cmp(n,t)<0};t.lessThanOrEqualTo=t.lte=function(n,t){return u=7,(t=this.cmp(n,t))==-1||t===0};t.minus=function(n,t){var h,l,a,y,c=this,o=c.s;if(t=(u=8,n=new i(n,t)).s,!o||!t)return new i(NaN);if(o!=t)return n.s=-t,c.plus(n);var f=c.c,p=c.e,e=n.c,s=n.e;if(!p||!s){if(!f||!e)return f?(n.s=-t,n):new i(e?c:NaN);if(!f[0]||!e[0])return e[0]?(n.s=-t,n):new i(f[0]?c:r==3?-0:0)}if(f=f.slice(),o=p-s){for(h=(y=o<0)?(o=-o,f):(s=p,e),h.reverse(),t=o;t--;h.push(0));h.reverse()}else for(a=((y=f.length<e.length)?f:e).length,o=t=0;t<a;t++)if(f[t]!=e[t]){y=f[t]<e[t];break}if(y&&(h=f,f=e,e=h,n.s=-n.s),(t=-((a=f.length)-e.length))>0)for(;t--;f[a++]=0);for(t=e.length;t>o;){if(f[--t]<e[t]){for(l=t;l&&!f[--l];f[l]=9);--f[l];f[t]+=10}f[t]-=e[t]}for(;f[--a]==0;f.pop());for(;f[0]==0;f.shift(),--s);return(s<v||!f[0])&&(f[0]||(n.s=r==3?-1:1),f=[s=0]),n.c=f,n.e=s,n};t.modulo=t.mod=function(n,t){var f=this,h=f.c,c=(u=9,n=new i(n,t)).c,o=f.s,s=n.s;return(t=!o||!s||c&&!c[0],t||h&&!h[0])?new i(t?NaN:f):(f.s=n.s=1,t=n.cmp(f)==1,f.s=o,n.s=s,t?new i(f):(o=e,s=r,e=0,r=1,f=f.div(n),e=o,r=s,this.minus(f.times(n))))};t.negated=t.neg=function(){var n=new i(this);return n.s=-n.s||null,n};t.plus=function(n,t){var o,c=this,f=c.s;if(t=(u=10,n=new i(n,t)).s,!f||!t)return new i(NaN);if(f!=t)return n.s=-t,c.minus(n);var l=c.e,r=c.c,s=n.e,e=n.c;if(!l||!s){if(!r||!e)return new i(f/0);if(!r[0]||!e[0])return e[0]?n:new i(r[0]?c:f*0)}if(r=r.slice(),f=l-s){for(o=f>0?(s=l,e):(f=-f,r),o.reverse();f--;o.push(0));o.reverse()}for(r.length-e.length<0&&(o=e,e=r,r=o),f=e.length,t=0;f;t=(r[--f]=r[f]+e[f]+t)/10^0,r[f]%=10);for(t&&(r.unshift(t),++s>h&&(r=s=null)),f=r.length;r[--f]==0;r.pop());return n.c=r,n.e=s,n};t.toPower=t.pow=function(n){var t=n*0==0?n|0:n,r=new i(this),u=new i(p);if(((o=n<-nt||n>nt)&&(t=n/0)||l(n)!=n&&n!==0&&!(t=NaN))&&!f(n,"exponent","pow")||!t)return new i(Math.pow(r.toS(),t));for(t=t<0?-t:t;;){if(t&1&&(u=u.times(r)),t>>=1,!t)break;r=r.times(r)}return n<0?p.div(u):u};t.round=function(n,t){return n=n==null||((o=n<0||n>s)||l(n)!=n)&&!f(n,"decimal places","round")?0:n|0,t=t==null||((o=t<0||t>8)||l(t)!=t&&t!==0)&&!f(t,"mode","round")?r:t|0,k(this,n,t)};t.squareRoot=t.sqrt=function(){var o,u,c,s,h=this,n=h.c,t=h.s,f=h.e,l=e,a=r,v=new i("0.5");if(t!==1||!n||!n[0])return new i(!t||t<0&&(!n||n[0])?NaN:n?h:1/0);for(t=Math.sqrt(h.toS()),r=1,t==0||t==1/0?(o=n.join(""),o.length+f&1||(o+="0"),u=new i(Math.sqrt(o)+""),u.c||(u.c=[1]),u.e=((f+1)/2|0)-(f<0||f&1)):u=new i(o=t.toString()),c=u.e,t=c+(e+=4),t<3&&(t=0),f=t;;)if(s=u,u=v.times(s.plus(h.div(s))),s.c.slice(0,t).join("")===u.c.slice(0,t).join(""))if(n=u.c,t=t-(o&&u.e<c),n[t]==9&&n[t-1]==9&&n[t-2]==9&&(n[t-3]==9||o&&n[t-3]==4)){if(o&&n[t-3]==9&&(s=u.round(l,0),s.times(s).eq(h)))return r=a,e=l,s;e+=4;t+=4;o=""}else{if(!n[f]&&!n[f-1]&&!n[f-2]&&(!n[f-3]||n[f-3]==5)&&(n.length>f-2&&(n.length=f-2),!u.times(u).eq(h))){while(n.length<f-3)n.push(0);n[f-3]++}return r=a,b(u,e=l,10),u}};t.times=function(n,t){var f,l=this,e=l.c,o=(u=11,n=new i(n,t)).c,s=l.e,r=n.e,c=l.s;if(n.s=c==(t=n.s)?1:-1,!s&&(!e||!e[0])||!r&&(!o||!o[0]))return new i(!c||!t||e&&!e[0]&&!o||o&&!o[0]&&!e?NaN:!e||!o?n.s/0:n.s*0);for(n.e=s+r,(c=e.length)<(t=o.length)&&(f=e,e=o,o=f,r=c,c=t,t=r),r=c+t,f=[];r--;f.push(0));for(s=t-1;s>-1;s--){for(t=0,r=c+s;r>s;t=f[r]+o[s]*e[r-s-1]+t,f[r--]=t%10|0,t=t/10|0);t&&(f[r]=(f[r]+t)%10)}for(t&&++n.e,f[0]||f.shift(),r=f.length;!f[--r];f.pop());return n.c=n.e>h?n.e=null:n.e<v?[n.e=0]:f,n};t.toExponential=t.toE=function(n){return w(this,(n==null||((o=n<0||n>s)||l(n)!=n&&n!==0)&&!f(n,"decimal places","toE"))&&this.c?this.c.length-1:n|0,1)};t.toFixed=t.toF=function(n){var u,t,r,i=this;return n==null||((o=n<0||n>s)||l(n)!=n&&n!==0)&&!f(n,"decimal places","toF")||(r=i.e+(n|0)),u=c,n=a,c=-(a=1/0),r==t?t=i.toS():(t=w(i,r),i.s<0&&i.c&&(i.c[0]?t.indexOf("-")<0&&(t="-"+t):t=t.replace(/^-/,""))),c=u,a=n,t};t.toFraction=t.toFr=function(n){var k,nt,c,l,t,s,d,a=l=new i(p),v=c=new i("0"),w=this,g=w.c,tt=h,it=e,rt=r,b=new i(p);if(!g)return w.toS();for(d=b.e=g.length-w.e-1,(n==null||(!(u=12,s=new i(n)).s||(o=s.cmp(a)<0||!s.c)||y&&s.e<s.c.length-1)&&!f(n,"max denominator","toFr")||(n=s).cmp(b)>0)&&(n=d>0?b:a),h=1/0,s=new i(g.join("")),e=0,r=1;;){if(k=s.div(b),t=l.plus(k.times(v)),t.cmp(n)==1)break;l=v;v=t;a=c.plus(k.times(t=a));c=t;b=s.minus(k.times(t=b));s=t}return t=n.minus(l).div(v),c=c.plus(t.times(a)),l=l.plus(t.times(v)),c.s=a.s=w.s,e=d*2,r=rt,nt=a.div(v).minus(w).abs().cmp(c.div(l).minus(w).abs())<1?[a.toS(),v.toS()]:[c.toS(),l.toS()],h=tt,e=it,nt};t.toPrecision=t.toP=function(n){return n==null||((o=n<1||n>s)||l(n)!=n)&&!f(n,"precision","toP")?this.toS():w(this,--n|0,2)};t.toString=t.toS=function(n){var u,t,e,r=this,i=r.e;if(i===null)t=r.s?"Infinity":"NaN";else{if(n===u&&(i<=c||i>=a))return w(r,r.c.length-1,1);if(t=r.c.join(""),i<0){for(;++i;t="0"+t);t="0."+t}else if(e=t.length,i>0)if(++i>e)for(i-=e;i--;t+="0");else i<e&&(t=t.slice(0,i)+"."+t.slice(i));else if(u=t.charAt(0),e>1)t=u+"."+t.slice(1);else if(u=="0")return u;if(n!=null)if((o=!(n>=2&&n<65))||n!=(n|0)&&y)f(n,"base","toS");else if(t=tt(t,n|0,10,r.s),t=="0")return t}return r.s<0?"-"+t:t};t.toNumber=t.toN=function(){var n=this;return+n||(n.s?0*n.s:NaN)};t.valueOf=t.toJSON=function(){return this.toS()};typeof module!="undefined"&&module.exports?module.exports=i:typeof define=="function"&&define.amd?define(function(){return i}):n.BigNumber=i})(this)
hasantayyar/cdnjs
ajax/libs/bignumber.js/1.5.0/bignumber.min.js
JavaScript
mit
11,714
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "\u0628.\u0646", "\u062f.\u0646" ], "DAY": [ "\u06cc\u06d5\u06a9\u0634\u06d5\u0645\u0645\u06d5", "\u062f\u0648\u0648\u0634\u06d5\u0645\u0645\u06d5", "\u0633\u06ce\u0634\u06d5\u0645\u0645\u06d5", "\u0686\u0648\u0627\u0631\u0634\u06d5\u0645\u0645\u06d5", "\u067e\u06ce\u0646\u062c\u0634\u06d5\u0645\u0645\u06d5", "\u06be\u06d5\u06cc\u0646\u06cc", "\u0634\u06d5\u0645\u0645\u06d5" ], "ERANAMES": [ "\u067e\u06ce\u0634 \u0632\u0627\u06cc\u06cc\u0646", "\u0632\u0627\u06cc\u06cc\u0646\u06cc" ], "ERAS": [ "\u067e\u06ce\u0634 \u0632\u0627\u06cc\u06cc\u06cc\u0646", "\u0632" ], "FIRSTDAYOFWEEK": 5, "MONTH": [ "\u06a9\u0627\u0646\u0648\u0648\u0646\u06cc \u062f\u0648\u0648\u06d5\u0645", "\u0634\u0648\u0628\u0627\u062a", "\u0626\u0627\u0632\u0627\u0631", "\u0646\u06cc\u0633\u0627\u0646", "\u0626\u0627\u06cc\u0627\u0631", "\u062d\u0648\u0632\u06d5\u06cc\u0631\u0627\u0646", "\u062a\u06d5\u0645\u0648\u0648\u0632", "\u0626\u0627\u0628", "\u0626\u06d5\u06cc\u0644\u0648\u0648\u0644", "\u062a\u0634\u0631\u06cc\u0646\u06cc \u06cc\u06d5\u06a9\u06d5\u0645", "\u062a\u0634\u0631\u06cc\u0646\u06cc \u062f\u0648\u0648\u06d5\u0645", "\u06a9\u0627\u0646\u0648\u0646\u06cc \u06cc\u06d5\u06a9\u06d5\u0645" ], "SHORTDAY": [ "\u06cc\u06d5\u06a9\u0634\u06d5\u0645\u0645\u06d5", "\u062f\u0648\u0648\u0634\u06d5\u0645\u0645\u06d5", "\u0633\u06ce\u0634\u06d5\u0645\u0645\u06d5", "\u0686\u0648\u0627\u0631\u0634\u06d5\u0645\u0645\u06d5", "\u067e\u06ce\u0646\u062c\u0634\u06d5\u0645\u0645\u06d5", "\u06be\u06d5\u06cc\u0646\u06cc", "\u0634\u06d5\u0645\u0645\u06d5" ], "SHORTMONTH": [ "\u06a9\u0627\u0646\u0648\u0648\u0646\u06cc \u062f\u0648\u0648\u06d5\u0645", "\u0634\u0648\u0628\u0627\u062a", "\u0626\u0627\u0632\u0627\u0631", "\u0646\u06cc\u0633\u0627\u0646", "\u0626\u0627\u06cc\u0627\u0631", "\u062d\u0648\u0632\u06d5\u06cc\u0631\u0627\u0646", "\u062a\u06d5\u0645\u0648\u0648\u0632", "\u0626\u0627\u0628", "\u0626\u06d5\u06cc\u0644\u0648\u0648\u0644", "\u062a\u0634\u0631\u06cc\u0646\u06cc \u06cc\u06d5\u06a9\u06d5\u0645", "\u062a\u0634\u0631\u06cc\u0646\u06cc \u062f\u0648\u0648\u06d5\u0645", "\u06a9\u0627\u0646\u0648\u0646\u06cc \u06cc\u06d5\u06a9\u06d5\u0645" ], "STANDALONEMONTH": [ "\u06a9\u0627\u0646\u0648\u0648\u0646\u06cc \u062f\u0648\u0648\u06d5\u0645", "\u0634\u0648\u0628\u0627\u062a", "\u0626\u0627\u0632\u0627\u0631", "\u0646\u06cc\u0633\u0627\u0646", "\u0626\u0627\u06cc\u0627\u0631", "\u062d\u0648\u0632\u06d5\u06cc\u0631\u0627\u0646", "\u062a\u06d5\u0645\u0648\u0648\u0632", "\u0626\u0627\u0628", "\u0626\u06d5\u06cc\u0644\u0648\u0648\u0644", "\u062a\u0634\u0631\u06cc\u0646\u06cc \u06cc\u06d5\u06a9\u06d5\u0645", "\u062a\u0634\u0631\u06cc\u0646\u06cc \u062f\u0648\u0648\u06d5\u0645", "\u06a9\u0627\u0646\u0648\u0646\u06cc \u06cc\u06d5\u06a9\u06d5\u0645" ], "WEEKENDRANGE": [ 4, 5 ], "fullDate": "y MMMM d, EEEE", "longDate": "d\u06cc MMMM\u06cc y", "medium": "y MMM d HH:mm:ss", "mediumDate": "y MMM d", "mediumTime": "HH:mm:ss", "short": "y-MM-dd HH:mm", "shortDate": "y-MM-dd", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "din", "DECIMAL_SEP": "\u066b", "GROUP_SEP": "\u066c", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-\u00a4\u00a0", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "ckb", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
sashberd/cdnjs
ajax/libs/angular-i18n/1.5.0-rc.1/angular-locale_ckb.js
JavaScript
mit
4,828
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "am", "pm" ], "DAY": [ "\u0b30\u0b2c\u0b3f\u0b2c\u0b3e\u0b30", "\u0b38\u0b4b\u0b2e\u0b2c\u0b3e\u0b30", "\u0b2e\u0b19\u0b4d\u0b17\u0b33\u0b2c\u0b3e\u0b30", "\u0b2c\u0b41\u0b27\u0b2c\u0b3e\u0b30", "\u0b17\u0b41\u0b30\u0b41\u0b2c\u0b3e\u0b30", "\u0b36\u0b41\u0b15\u0b4d\u0b30\u0b2c\u0b3e\u0b30", "\u0b36\u0b28\u0b3f\u0b2c\u0b3e\u0b30" ], "ERANAMES": [ "BCE", "CE" ], "ERAS": [ "BCE", "CE" ], "FIRSTDAYOFWEEK": 6, "MONTH": [ "\u0b1c\u0b3e\u0b28\u0b41\u0b06\u0b30\u0b40", "\u0b2b\u0b47\u0b2c\u0b43\u0b06\u0b30\u0b40", "\u0b2e\u0b3e\u0b30\u0b4d\u0b1a\u0b4d\u0b1a", "\u0b05\u0b2a\u0b4d\u0b30\u0b47\u0b32", "\u0b2e\u0b07", "\u0b1c\u0b41\u0b28", "\u0b1c\u0b41\u0b32\u0b3e\u0b07", "\u0b05\u0b17\u0b37\u0b4d\u0b1f", "\u0b38\u0b47\u0b2a\u0b4d\u0b1f\u0b47\u0b2e\u0b4d\u0b2c\u0b30", "\u0b05\u0b15\u0b4d\u0b1f\u0b4b\u0b2c\u0b30", "\u0b28\u0b2d\u0b47\u0b2e\u0b4d\u0b2c\u0b30", "\u0b21\u0b3f\u0b38\u0b47\u0b2e\u0b4d\u0b2c\u0b30" ], "SHORTDAY": [ "\u0b30\u0b2c\u0b3f", "\u0b38\u0b4b\u0b2e", "\u0b2e\u0b19\u0b4d\u0b17\u0b33", "\u0b2c\u0b41\u0b27", "\u0b17\u0b41\u0b30\u0b41", "\u0b36\u0b41\u0b15\u0b4d\u0b30", "\u0b36\u0b28\u0b3f" ], "SHORTMONTH": [ "\u0b1c\u0b3e\u0b28\u0b41\u0b06\u0b30\u0b40", "\u0b2b\u0b47\u0b2c\u0b43\u0b06\u0b30\u0b40", "\u0b2e\u0b3e\u0b30\u0b4d\u0b1a\u0b4d\u0b1a", "\u0b05\u0b2a\u0b4d\u0b30\u0b47\u0b32", "\u0b2e\u0b07", "\u0b1c\u0b41\u0b28", "\u0b1c\u0b41\u0b32\u0b3e\u0b07", "\u0b05\u0b17\u0b37\u0b4d\u0b1f", "\u0b38\u0b47\u0b2a\u0b4d\u0b1f\u0b47\u0b2e\u0b4d\u0b2c\u0b30", "\u0b05\u0b15\u0b4d\u0b1f\u0b4b\u0b2c\u0b30", "\u0b28\u0b2d\u0b47\u0b2e\u0b4d\u0b2c\u0b30", "\u0b21\u0b3f\u0b38\u0b47\u0b2e\u0b4d\u0b2c\u0b30" ], "STANDALONEMONTH": [ "\u0b1c\u0b3e\u0b28\u0b41\u0b06\u0b30\u0b40", "\u0b2b\u0b47\u0b2c\u0b43\u0b06\u0b30\u0b40", "\u0b2e\u0b3e\u0b30\u0b4d\u0b1a\u0b4d\u0b1a", "\u0b05\u0b2a\u0b4d\u0b30\u0b47\u0b32", "\u0b2e\u0b07", "\u0b1c\u0b41\u0b28", "\u0b1c\u0b41\u0b32\u0b3e\u0b07", "\u0b05\u0b17\u0b37\u0b4d\u0b1f", "\u0b38\u0b47\u0b2a\u0b4d\u0b1f\u0b47\u0b2e\u0b4d\u0b2c\u0b30", "\u0b05\u0b15\u0b4d\u0b1f\u0b4b\u0b2c\u0b30", "\u0b28\u0b2d\u0b47\u0b2e\u0b4d\u0b2c\u0b30", "\u0b21\u0b3f\u0b38\u0b47\u0b2e\u0b4d\u0b2c\u0b30" ], "WEEKENDRANGE": [ 6, 6 ], "fullDate": "EEEE, d MMMM y", "longDate": "d MMMM y", "medium": "d MMM y h:mm:ss a", "mediumDate": "d MMM y", "mediumTime": "h:mm:ss a", "short": "d-M-yy h:mm a", "shortDate": "d-M-yy", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u20b9", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 2, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 2, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-\u00a4\u00a0", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "or-in", "pluralCat": function(n, opt_precision) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
dc-js/cdnjs
ajax/libs/angular-i18n/1.4.9/angular-locale_or-in.js
JavaScript
mit
3,804
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi" ], "ERANAMES": [ "avant J\u00e9sus-Christ", "apr\u00e8s J\u00e9sus-Christ" ], "ERAS": [ "av. J.-C.", "ap. J.-C." ], "FIRSTDAYOFWEEK": 0, "MONTH": [ "janvier", "f\u00e9vrier", "mars", "avril", "mai", "juin", "juillet", "ao\u00fbt", "septembre", "octobre", "novembre", "d\u00e9cembre" ], "SHORTDAY": [ "dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam." ], "SHORTMONTH": [ "janv.", "f\u00e9vr.", "mars", "avr.", "mai", "juin", "juil.", "ao\u00fbt", "sept.", "oct.", "nov.", "d\u00e9c." ], "STANDALONEMONTH": [ "Janvier", "F\u00e9vrier", "Mars", "Avril", "Mai", "Juin", "Juillet", "Ao\u00fbt", "Septembre", "Octobre", "Novembre", "D\u00e9cembre" ], "WEEKENDRANGE": [ 5, 6 ], "fullDate": "EEEE d MMMM y", "longDate": "d MMMM y", "medium": "d MMM y HH:mm:ss", "mediumDate": "d MMM y", "mediumTime": "HH:mm:ss", "short": "dd/MM/y HH:mm", "shortDate": "dd/MM/y", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u20ac", "DECIMAL_SEP": ",", "GROUP_SEP": "\u00a0", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "fr-yt", "pluralCat": function(n, opt_precision) { var i = n | 0; if (i == 0 || i == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
bootcdn/cdnjs
ajax/libs/angular-i18n/1.5.0-rc.0/angular-locale_fr-yt.js
JavaScript
mit
2,436
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "PG", "PTG" ], "DAY": [ "Ahad", "Isnin", "Selasa", "Rabu", "Khamis", "Jumaat", "Sabtu" ], "ERANAMES": [ "S.M.", "TM" ], "ERAS": [ "S.M.", "TM" ], "FIRSTDAYOFWEEK": 0, "MONTH": [ "Januari", "Februari", "Mac", "April", "Mei", "Jun", "Julai", "Ogos", "September", "Oktober", "November", "Disember" ], "SHORTDAY": [ "Ahd", "Isn", "Sel", "Rab", "Kha", "Jum", "Sab" ], "SHORTMONTH": [ "Jan", "Feb", "Mac", "Apr", "Mei", "Jun", "Jul", "Ogo", "Sep", "Okt", "Nov", "Dis" ], "STANDALONEMONTH": [ "Januari", "Februari", "Mac", "April", "Mei", "Jun", "Julai", "Ogos", "September", "Oktober", "November", "Disember" ], "WEEKENDRANGE": [ 5, 6 ], "fullDate": "dd MMMM y", "longDate": "d MMMM y", "medium": "d MMM y h:mm:ss a", "mediumDate": "d MMM y", "mediumTime": "h:mm:ss a", "short": "d/MM/yy h:mm a", "shortDate": "d/MM/yy", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "$", "DECIMAL_SEP": ",", "GROUP_SEP": ".", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-\u00a4\u00a0", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "ms-latn-bn", "pluralCat": function(n, opt_precision) { return PLURAL_CATEGORY.OTHER;} }); }]);
extend1994/cdnjs
ajax/libs/angular-i18n/1.5.0-rc.1/angular-locale_ms-latn-bn.js
JavaScript
mit
2,218
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], "ERANAMES": [ "Before Christ", "Anno Domini" ], "ERAS": [ "BC", "AD" ], "FIRSTDAYOFWEEK": 0, "MONTH": [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], "SHORTDAY": [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], "SHORTMONTH": [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], "STANDALONEMONTH": [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], "WEEKENDRANGE": [ 5, 6 ], "fullDate": "EEEE, d MMMM y", "longDate": "d MMMM y", "medium": "d MMM y h:mm:ss a", "mediumDate": "d MMM y", "mediumTime": "h:mm:ss a", "short": "dd/MM/y h:mm a", "shortDate": "dd/MM/y", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "Nfk", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-\u00a4", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "en-er", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
jonathantneal/cdnjs
ajax/libs/angular.js/1.5.0-rc.1/i18n/angular-locale_en-er.js
JavaScript
mit
2,689
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "\u092a\u0942\u0930\u094d\u0935\u093e\u0939\u094d\u0928", "\u0905\u092a\u0930\u093e\u0939\u094d\u0928" ], "DAY": [ "\u0906\u0907\u0924\u092c\u093e\u0930", "\u0938\u094b\u092e\u092c\u093e\u0930", "\u092e\u0919\u094d\u0917\u0932\u092c\u093e\u0930", "\u092c\u0941\u0927\u092c\u093e\u0930", "\u092c\u093f\u0939\u093f\u092c\u093e\u0930", "\u0936\u0941\u0915\u094d\u0930\u092c\u093e\u0930", "\u0936\u0928\u093f\u092c\u093e\u0930" ], "ERANAMES": [ "\u0908\u0938\u093e \u092a\u0942\u0930\u094d\u0935", "\u0938\u0928\u094d" ], "ERAS": [ "\u0908\u0938\u093e \u092a\u0942\u0930\u094d\u0935", "\u0938\u0928\u094d" ], "FIRSTDAYOFWEEK": 6, "MONTH": [ "\u091c\u0928\u0935\u0930\u0940", "\u092b\u0947\u092c\u094d\u0930\u0941\u0905\u0930\u0940", "\u092e\u093e\u0930\u094d\u091a", "\u0905\u092a\u094d\u0930\u093f\u0932", "\u092e\u0908", "\u091c\u0941\u0928", "\u091c\u0941\u0932\u093e\u0908", "\u0905\u0917\u0938\u094d\u091f", "\u0938\u0947\u092a\u094d\u091f\u0947\u092e\u094d\u092c\u0930", "\u0905\u0915\u094d\u091f\u094b\u092c\u0930", "\u0928\u094b\u092d\u0947\u092e\u094d\u092c\u0930", "\u0921\u093f\u0938\u0947\u092e\u094d\u092c\u0930" ], "SHORTDAY": [ "\u0906\u0907\u0924", "\u0938\u094b\u092e", "\u092e\u0919\u094d\u0917\u0932", "\u092c\u0941\u0927", "\u092c\u093f\u0939\u0940", "\u0936\u0941\u0915\u094d\u0930", "\u0936\u0928\u093f" ], "SHORTMONTH": [ "\u091c\u0928\u0935\u0930\u0940", "\u092b\u0947\u092c\u094d\u0930\u0941\u0905\u0930\u0940", "\u092e\u093e\u0930\u094d\u091a", "\u0905\u092a\u094d\u0930\u093f\u0932", "\u092e\u0947", "\u091c\u0941\u0928", "\u091c\u0941\u0932\u093e\u0908", "\u0905\u0917\u0938\u094d\u091f", "\u0938\u0947\u092a\u094d\u091f\u0947\u092e\u094d\u092c\u0930", "\u0905\u0915\u094d\u091f\u094b\u092c\u0930", "\u0928\u094b\u092d\u0947\u092e\u094d\u092c\u0930", "\u0921\u093f\u0938\u0947\u092e\u094d\u092c\u0930" ], "STANDALONEMONTH": [ "\u091c\u0928\u0935\u0930\u0940", "\u092b\u0947\u092c\u094d\u0930\u0941\u0905\u0930\u0940", "\u092e\u093e\u0930\u094d\u091a", "\u0905\u092a\u094d\u0930\u093f\u0932", "\u092e\u0947", "\u091c\u0941\u0928", "\u091c\u0941\u0932\u093e\u0908", "\u0905\u0917\u0938\u094d\u091f", "\u0938\u0947\u092a\u094d\u091f\u0947\u092e\u094d\u092c\u0930", "\u0905\u0915\u094d\u091f\u094b\u092c\u0930", "\u0928\u094b\u092d\u0947\u092e\u094d\u092c\u0930", "\u0921\u093f\u0938\u0947\u092e\u094d\u092c\u0930" ], "WEEKENDRANGE": [ 6, 6 ], "fullDate": "y MMMM d, EEEE", "longDate": "y MMMM d", "medium": "y MMM d HH:mm:ss", "mediumDate": "y MMM d", "mediumTime": "HH:mm:ss", "short": "y-MM-dd HH:mm", "shortDate": "y-MM-dd", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u20b9", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-\u00a4\u00a0", "negSuf": "", "posPre": "\u00a4\u00a0", "posSuf": "" } ] }, "id": "ne-in", "pluralCat": function(n, opt_precision) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
sajochiu/cdnjs
ajax/libs/angular.js/1.5.0-rc.1/i18n/angular-locale_ne-in.js
JavaScript
mit
4,000
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "AM", "PM" ], "DAY": [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], "ERANAMES": [ "Before Christ", "Anno Domini" ], "ERAS": [ "BC", "AD" ], "FIRSTDAYOFWEEK": 0, "MONTH": [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], "SHORTDAY": [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], "SHORTMONTH": [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], "STANDALONEMONTH": [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], "WEEKENDRANGE": [ 5, 6 ], "fullDate": "EEEE, d MMMM y", "longDate": "d MMMM y", "medium": "d MMM y h:mm:ss a", "mediumDate": "d MMM y", "mediumTime": "h:mm:ss a", "short": "dd/MM/y h:mm a", "shortDate": "dd/MM/y", "shortTime": "h:mm a" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "$", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-\u00a4", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "en-bb", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
voronianski/cdnjs
ajax/libs/angular.js/1.5.0-rc.0/i18n/angular-locale_en-bb.js
JavaScript
mit
2,687
// Twig.js v0.3 // Copyright (c) 2011-2012 John Roepke // Available under the BSD 2-Clause License // https://github.com/justjohn/twig.js var Twig=function(a){function b(a,b){var c=Object.prototype.toString.call(b).slice(8,-1);return b!==undefined&&b!==null&&c===a}function c(b,c){var d,e,f="/",g=[],h;if(b.url)d=b.url;else{if(!b.path)throw new a.Error("Cannot extend an inline template.");d=b.path}e=d.split(f),e.pop(),e=e.concat(c.split(f));while(e.length>0)h=e.shift(),h!="."&&(h==".."&&g.length>0&&g[g.length-1]!=".."?g.pop():g.push(h));return g.join(f)}return"use strict",a.trace=!1,a.debug=!1,a.cache=!0,a.Error=function(a){this.message=a,this.name="TwigException",this.type="TwigException"},a.Error.prototype.toString=function(){return this.name+": "+this.message},a.log={trace:function(){a.trace&&console&&console.log(Array.prototype.slice.call(arguments))},debug:function(){a.debug&&console&&console.log(Array.prototype.slice.call(arguments))}},a.token={},a.token.type={output:"output",logic:"logic",comment:"comment",raw:"raw"},a.token.definitions={output:{type:a.token.type.output,open:"{{",close:"}}"},logic:{type:a.token.type.logic,open:"{%",close:"%}"},comment:{type:a.token.type.comment,open:"{#",close:"#}"}},a.token.strings=['"',"'"],a.token.findStart=function(b){var c={position:null,def:null},d,e,f;for(d in a.token.definitions)a.token.definitions.hasOwnProperty(d)&&(e=a.token.definitions[d],f=b.indexOf(e.open),a.log.trace("Twig.token.findStart: ","Searching for ",e.open," found at ",f),f>=0&&(c.position===null||f<c.position)&&(c.position=f,c.def=e));return c},a.token.findEnd=function(b,c,d){var e=null,f=!1,g=0,h=null,i=null,j=null,k=null,l=null,m=null,n,o;while(!f){h=null,i=null,j=b.indexOf(c.close,g);if(!(j>=0))throw new a.Error("Unable to find closing bracket '"+c.close+"'"+" opened near template position "+d);e=j,f=!0,o=a.token.strings.length;for(n=0;n<o;n+=1)l=b.indexOf(a.token.strings[n],g),l>0&&l<j&&(h===null||l<h)&&(h=l,i=a.token.strings[n]);if(h!==null){k=h+1,e=null,f=!1;for(;;){m=b.indexOf(i,k);if(m<0)throw"Unclosed string in template";if(b.substr(m-1,1)!=="\\"){g=m+1;break}k=m+1}}}return e},a.tokenize=function(b){var c=[],d=0,e=null,f=null;while(b.length>0)e=a.token.findStart(b),a.log.trace("Twig.tokenize: ","Found token: ",e),e.position!==null?(e.position>0&&c.push({type:a.token.type.raw,value:b.substring(0,e.position)}),b=b.substr(e.position+e.def.open.length),d+=e.position+e.def.open.length,f=a.token.findEnd(b,e.def,d),a.log.trace("Twig.tokenize: ","Token ends at ",f),c.push({type:e.def.type,value:b.substring(0,f).trim()}),b=b.substr(f+e.def.close.length),d+=f+e.def.close.length):(c.push({type:a.token.type.raw,value:b}),b="");return c},a.compile=function(b){var c=[],d=[],e=[],f=null,g=null,h=null,i=null,j=null,k=null,l=null,m=null,n=null;while(b.length>0){f=b.shift(),a.log.trace("Compiling token ",f);switch(f.type){case a.token.type.raw:d.length>0?e.push(f):c.push(f);break;case a.token.type.logic:g=a.logic.compile.apply(this,[f]),l=g.type,m=a.logic.handler[l].open,n=a.logic.handler[l].next,a.log.trace("Twig.compile: ","Compiled logic token to ",g," next is: ",n," open is : ",m);if(m!==undefined&&!m){i=d.pop(),j=a.logic.handler[i.type];if(j.next.indexOf(l)<0)throw new Error(l+" not expected after a "+i.type);i.output=i.output||[],i.output=i.output.concat(e),e=[],k={type:a.token.type.logic,token:i},d.length>0?e.push(k):c.push(k)}n!==undefined&&n.length>0?(a.log.trace("Twig.compile: ","Pushing ",g," to logic stack."),d.length>0&&(i=d.pop(),i.output=i.output||[],i.output=i.output.concat(e),d.push(i),e=[]),d.push(g)):m!==undefined&&m&&(k={type:a.token.type.logic,token:g},d.length>0?e.push(k):c.push(k));break;case a.token.type.comment:break;case a.token.type.output:a.expression.compile.apply(this,[f]),d.length>0?e.push(f):c.push(f)}a.log.trace("Twig.compile: "," Output: ",c," Logic Stack: ",d," Pending Output: ",e)}if(d.length>0)throw h=d.pop(),new Error("Unable to find an end tag for "+h.type+", expecting one of "+h.next.join(", "));return c},a.parse=function(b,c){var d=[],e=!0,f=this;return c=c||{},b.forEach(function(b){a.log.debug("Twig.parse: ","Parsing token: ",b);switch(b.type){case a.token.type.raw:d.push(b.value);break;case a.token.type.logic:var g=b.token,h=a.logic.parse.apply(f,[g,c,e]);h.chain!==undefined&&(e=h.chain),h.context!==undefined&&(c=h.context),h.output!==undefined&&d.push(h.output);break;case a.token.type.comment:break;case a.token.type.output:d.push(a.expression.parse.apply(f,[b.stack,c]))}}),d.join("")},a.prepare=function(b){var c,d;return a.log.debug("Twig.prepare: ","Tokenizing ",b),d=a.tokenize.apply(this,[b]),a.log.debug("Twig.prepare: ","Compiling ",d),c=a.compile.apply(this,[d]),a.log.debug("Twig.prepare: ","Compiled ",c),c},a.Templates={registry:{}},a.validateId=function(b){if(b==="prototype")throw new a.Error(b+" is not a valid twig identifier");if(a.Templates.registry.hasOwnProperty(b))throw new a.Error("There is already a template with the ID "+b);return!0},a.Templates.save=function(b){if(b.id===undefined)throw new a.Error("Unable to save template with no id");a.Templates.registry[b.id]=b},a.Templates.load=function(b){return a.Templates.registry.hasOwnProperty(b)?a.Templates.registry[b]:null},a.Templates.loadRemote=function(b,c,d){var e=c.id,f=c.method,g=c.async,h=c.precompiled,i=null;g===undefined&&(g=!0),e===undefined&&(e=b);if(a.cache&&a.Templates.registry.hasOwnProperty(e))return d(a.Templates.registry[e]),a.Templates.registry[e];if(f=="ajax"){if(typeof XMLHttpRequest=="undefined")throw new Error("Unsupported platform: Unable to do remote requests because there is no XMLHTTPRequest implementation");var j=new XMLHttpRequest;j.onreadystatechange=function(){var c=null;j.readyState==4&&(a.log.debug("Got template ",j.responseText),h===!0?c=JSON.parse(j.responseText):c=j.responseText,i=new a.Template({data:c,id:e,url:b}),d&&d(i))},j.open("GET",b,g),j.send()}else(function(){var c=require("fs"),f=null;g===!0?c.readFile(b,"utf8",function(c,f){h===!0&&(f=JSON.parse(f)),i=new a.Template({data:f,id:e,path:b}),d&&d(i)}):(f=c.readFileSync(b,"utf8"),h===!0&&(f=JSON.parse(f)),i=new a.Template({data:f,id:e,path:b}),d&&d(i))})();if(g===!1)return i},a.Template=function(d){var e=d.data,f=d.id,g=d.blocks,h=d.path,i=d.url;this.id=f,this.path=h,this.url=i,this.reset=function(){a.log.debug("Twig.Template.reset","Reseting template "+this.id),this.blocks={},this.child={blocks:g||{}},this.extend=null},this.reset(),b("String",e)?this.tokens=a.prepare.apply(this,[e]):this.tokens=e,this.render=function(b,d){d=d||{};var e=this,f,g=d.output=="blocks";return e.reset(),d.blocks&&(this.blocks=d.blocks),this.importBlocks=function(d,f){var g=c(e,d),h=a.Templates.loadRemote(g,{method:e.url?"ajax":"fs",async:!1,id:g}),i;f=f||!1,h.render(b),Object.keys(h.blocks).forEach(function(a){if(f||e.blocks[a]===undefined)e.blocks[a]=h.blocks[a]})},f=a.parse.apply(this,[this.tokens,b]),this.extend?(i=c(this,this.extend),this.parent=a.Templates.loadRemote(i,{method:this.url?"ajax":"fs",async:!1,id:i}),this.parent.render(b,{blocks:this.blocks})):g===!0?this.blocks:f},this.compile=function(b){return a.compiler.compile(this,b)},f!==undefined&&a.Templates.save(this)},a}(Twig||{});(function(){"use strict",Array.prototype.indexOf||(Array.prototype.indexOf=function(a){if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(c===0)return-1;var d=0;arguments.length>0&&(d=Number(arguments[1]),d!==d?d=0:d!==0&&d!==Infinity&&d!==-Infinity&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var e=d>=0?d:Math.max(c-Math.abs(d),0);for(;e<c;e++)if(e in b&&b[e]===a)return e;return-1}),Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c,d;if(this==null)throw new TypeError(" this is null or not defined");var e=Object(this),f=e.length>>>0;if({}.toString.call(a)!="[object Function]")throw new TypeError(a+" is not a function");b&&(c=b),d=0;while(d<f){var g;d in e&&(g=e[d],a.call(c,g,d,e)),d++}}),Object.keys||(Object.keys=function(a){if(a!==Object(a))throw new TypeError("Object.keys called on non-object");var b=[],c;for(c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c);return b})})();var Twig=function(a){a.lib={};var b=function(){function a(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}function c(a,b){for(var c=[];b>0;c[--b]=a);return c.join("")}var d=function(){return d.cache.hasOwnProperty(arguments[0])||(d.cache[arguments[0]]=d.parse(arguments[0])),d.format.call(null,d.cache[arguments[0]],arguments)};return d.format=function(d,e){var f=1,g=d.length,h="",i,j=[],k,l,m,n,o,p;for(k=0;k<g;k++){h=a(d[k]);if(h==="string")j.push(d[k]);else if(h==="array"){m=d[k];if(m[2]){i=e[f];for(l=0;l<m[2].length;l++){if(!i.hasOwnProperty(m[2][l]))throw b('[sprintf] property "%s" does not exist',m[2][l]);i=i[m[2][l]]}}else m[1]?i=e[m[1]]:i=e[f++];if(/[^s]/.test(m[8])&&a(i)!="number")throw b("[sprintf] expecting number but found %s",a(i));switch(m[8]){case"b":i=i.toString(2);break;case"c":i=String.fromCharCode(i);break;case"d":i=parseInt(i,10);break;case"e":i=m[7]?i.toExponential(m[7]):i.toExponential();break;case"f":i=m[7]?parseFloat(i).toFixed(m[7]):parseFloat(i);break;case"o":i=i.toString(8);break;case"s":i=(i=String(i))&&m[7]?i.substring(0,m[7]):i;break;case"u":i=Math.abs(i);break;case"x":i=i.toString(16);break;case"X":i=i.toString(16).toUpperCase()}i=/[def]/.test(m[8])&&m[3]&&i>=0?"+"+i:i,o=m[4]?m[4]=="0"?"0":m[4].charAt(1):" ",p=m[6]-String(i).length,n=m[6]?c(o,p):"",j.push(m[5]?i+n:n+i)}}return j.join("")},d.cache={},d.parse=function(a){var b=a,c=[],d=[],e=0;while(b){if((c=/^[^\x25]+/.exec(b))!==null)d.push(c[0]);else if((c=/^\x25{2}/.exec(b))!==null)d.push("%");else{if((c=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(b))===null)throw"[sprintf] huh?";if(c[2]){e|=1;var f=[],g=c[2],h=[];if((h=/^([a-z_][a-z_\d]*)/i.exec(g))===null)throw"[sprintf] huh?";f.push(h[1]);while((g=g.substring(h[0].length))!=="")if((h=/^\.([a-z_][a-z_\d]*)/i.exec(g))!==null)f.push(h[1]);else{if((h=/^\[(\d+)\]/.exec(g))===null)throw"[sprintf] huh?";f.push(h[1])}c[2]=f}else e|=2;if(e===3)throw"[sprintf] mixing positional and named placeholders is not (yet) supported";d.push(c)}b=b.substring(c[0].length)}return d},d}(),c=function(a,c){return c.unshift(a),b.apply(null,c)};return a.lib.sprintf=b,a.lib.vsprintf=c,function(){function f(a){return(a=Math.abs(a)%100)%10==1&&a!=11?"st":a%10==2&&a!=12?"nd":a%10==3&&a!=13?"rd":"th"}function g(a){var b=new Date(a.getFullYear()+1,0,4);return(b-a)/864e5<7&&(a.getDay()+6)%7<(b.getDay()+6)%7?b.getFullYear():a.getMonth()>0||a.getDate()>=4?a.getFullYear():a.getFullYear()-((a.getDay()+6)%7-a.getDate()>2?1:0)}function h(a){var b=new Date(g(a),0,4);return b.setDate(b.getDate()-(b.getDay()+6)%7),parseInt((a-b)/6048e5)+1}var a={toString:function(){return"jPaq - A fully customizable JavaScript/JScript library created by Christopher West."}},b="Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(","),c="Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),d="Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),e="January,February,March,April,May,June,July,August,September,October,November,December".split(",");Date.prototype.setFromString=function(a){var b;if(b=a.match(/^([0-9]{4})\-([0-9]{2})\-([0-9]{2})T([0-9]{2})\:([0-9]{2})\:([0-9]{2})(\+|\-)([0-9]{2}):([0-9]{2})$/))this.setFullYear(parseInt(b[1],10),parseInt(b[2],10)-1,parseInt(b[3],10)),this.setHours(parseInt(b[4],10)),this.setMinutes(parseInt(b[5],10)),this.setSeconds(parseInt(b[6],10)),this.setMinutes(this.getMinutes()-parseInt(b[7]+b[8],10)*60-parseInt(b[7]+b[9],10)-this.getTimezoneOffset());else if(b=a.match(/^([0-9]{4})\-([0-9]{2})\-([0-9]{2})\s([0-9]{2})\:([0-9]{2})\:?([0-9]{2})?$/))this.setFullYear(parseInt(b[1],10),parseInt(b[2],10)-1,parseInt(b[3],10)),this.setHours(parseInt(b[4],10)),this.setMinutes(parseInt(b[5],10)),b[6]&&this.setSeconds(parseInt(b[6],10))||this.setSeconds(0);else{if(!(b=a.match(/^([0-9]{4})\-([0-9]{2})\-([0-9]{2})$/)))throw new Error("Invalid string format");this.setFullYear(parseInt(b[1],10),parseInt(b[2],10)-1,parseInt(b[3],10)),this.setHours(0),this.setMinutes(0),this.setSeconds(0)}return this},Date.prototype.format=function(a){if(typeof a!="string"||/^\s*$/.test(a))return this+"";var i=new Date(this.getFullYear(),0,1),j=this;return a.replace(/[dDjlNSwzWFmMntLoYyaABgGhHisu]/g,function(a){switch(a){case"d":return("0"+j.getDate()).replace(/^.+(..)$/,"$1");case"D":return b[j.getDay()];case"j":return j.getDate();case"l":return c[j.getDay()];case"N":return(j.getDay()+6)%7+1;case"S":return f(j.getDate());case"w":return j.getDay();case"z":return Math.ceil((i-j)/864e5);case"W":return("0"+h(j)).replace(/^.(..)$/,"$1");case"F":return e[j.getMonth()];case"m":return("0"+(j.getMonth()+1)).replace(/^.+(..)$/,"$1");case"M":return d[j.getMonth()];case"n":return j.getMonth()+1;case"t":return(new Date(j.getFullYear(),j.getMonth()+1,-1)).getDate();case"L":return(new Date(j.getFullYear(),1,29)).getDate()==29?1:0;case"o":return g(j);case"Y":return j.getFullYear();case"y":return(j.getFullYear()+"").replace(/^.+(..)$/,"$1");case"a":return j.getHours()<12?"am":"pm";case"A":return j.getHours()<12?"AM":"PM";case"B":return Math.floor(((j.getUTCHours()+1)%24+j.getUTCMinutes()/60+j.getUTCSeconds()/3600)*1e3/24);case"g":return j.getHours()%12!=0?j.getHours()%12:12;case"G":return j.getHours();case"h":return("0"+(j.getHours()%12!=0?j.getHours()%12:12)).replace(/^.+(..)$/,"$1");case"H":return("0"+j.getHours()).replace(/^.+(..)$/,"$1");case"i":return("0"+j.getMinutes()).replace(/^.+(..)$/,"$1");case"s":return("0"+j.getSeconds()).replace(/^.+(..)$/,"$1");case"u":return j.getMilliseconds()}})}}(),a.lib.strip_tags=function(a,b){b=(((b||"")+"").toLowerCase().match(/<[a-z][a-z0-9]*>/g)||[]).join("");var c=/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,d=/<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;return a.replace(d,"").replace(c,function(a,c){return b.indexOf("<"+c.toLowerCase()+">")>-1?a:""})},a.lib.strtotime=function(a,b){var c,d,e,f,g="";a=a.replace(/\s{2,}|^\s|\s$/g," "),a=a.replace(/[\t\r\n]/g,"");if(a==="now")return b===null||isNaN(b)?(new Date).getTime()/1e3|0:b|0;if(!isNaN(g=Date.parse(a)))return g/1e3|0;b?b=new Date(b*1e3):b=new Date,a=a.toLowerCase();var h={day:{sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},mon:["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"]},i=function(a){var c=a[2]&&a[2]==="ago",d=(d=a[0]==="last"?-1:1)*(c?-1:1);switch(a[0]){case"last":case"next":switch(a[1].substring(0,3)){case"yea":b.setFullYear(b.getFullYear()+d);break;case"wee":b.setDate(b.getDate()+d*7);break;case"day":b.setDate(b.getDate()+d);break;case"hou":b.setHours(b.getHours()+d);break;case"min":b.setMinutes(b.getMinutes()+d);break;case"sec":b.setSeconds(b.getSeconds()+d);break;case"mon":if(a[1]==="month"){b.setMonth(b.getMonth()+d);break};default:var e=h.day[a[1].substring(0,3)];if(typeof e!="undefined"){var f=e-b.getDay();f===0?f=7*d:f>0?a[0]==="last"&&(f-=7):a[0]==="next"&&(f+=7),b.setDate(b.getDate()+f),b.setHours(0,0,0,0)}}break;default:if(!/\d+/.test(a[0]))return!1;d*=parseInt(a[0],10);switch(a[1].substring(0,3)){case"yea":b.setFullYear(b.getFullYear()+d);break;case"mon":b.setMonth(b.getMonth()+d);break;case"wee":b.setDate(b.getDate()+d*7);break;case"day":b.setDate(b.getDate()+d);break;case"hou":b.setHours(b.getHours()+d);break;case"min":b.setMinutes(b.getMinutes()+d);break;case"sec":b.setSeconds(b.getSeconds()+d)}}return!0};e=a.match(/^(\d{2,4}-\d{2}-\d{2})(?:\s(\d{1,2}:\d{2}(:\d{2})?)?(?:\.(\d+))?)?$/);if(e!==null)return e[2]?e[3]||(e[2]+=":00"):e[2]="00:00:00",f=e[1].split(/-/g),f[1]=h.mon[f[1]-1]||f[1],f[0]=+f[0],f[0]=f[0]>=0&&f[0]<=69?"20"+(f[0]<10?"0"+f[0]:f[0]+""):f[0]>=70&&f[0]<=99?"19"+f[0]:f[0]+"",parseInt(this.strtotime(f[2]+" "+f[1]+" "+f[0]+" "+e[2])+(e[4]?e[4]/1e3:""),10);var j="([+-]?\\d+\\s(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?|sun\\.?|sunday|mon\\.?|monday|tue\\.?|tuesday|wed\\.?|wednesday|thu\\.?|thursday|fri\\.?|friday|sat\\.?|saturday)|(last|next)\\s(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?|sun\\.?|sunday|mon\\.?|monday|tue\\.?|tuesday|wed\\.?|wednesday|thu\\.?|thursday|fri\\.?|friday|sat\\.?|saturday))(\\sago)?";e=a.match(new RegExp(j,"gi"));if(e===null)return!1;for(c=0,d=e.length;c<d;c++)if(!i(e[c].split(" ")))return!1;return b.getTime()/1e3|0},a.lib.is=function(a,b){var c=Object.prototype.toString.call(b).slice(8,-1);return b!==undefined&&b!==null&&c===a},a}(Twig||{}),Twig=function(a){"use strict",a.logic={},a.logic.type={if_:"Twig.logic.type.if",endif:"Twig.logic.type.endif",for_:"Twig.logic.type.for",endfor:"Twig.logic.type.endfor",else_:"Twig.logic.type.else",elseif:"Twig.logic.type.elseif",set:"Twig.logic.type.set",filter:"Twig.logic.type.filter",endfilter:"Twig.logic.type.endfilter",block:"Twig.logic.type.block",endblock:"Twig.logic.type.endblock",extends_:"Twig.logic.type.extends",use:"Twig.logic.type.use"},a.logic.definitions=[{type:a.logic.type.if_,regex:/^if\s+([^\s].+)$/,next:[a.logic.type.else_,a.logic.type.elseif,a.logic.type.endif],open:!0,compile:function(b){var c=b.match[1];return b.stack=a.expression.compile.apply(this,[{type:a.expression.type.expression,value:c}]).stack,delete b.match,b},parse:function(b,c,d){var e="",f=a.expression.parse.apply(this,[b.stack,c]);return d=!0,f&&(d=!1,e=a.parse.apply(this,[b.output,c])),{chain:d,output:e}}},{type:a.logic.type.elseif,regex:/^elseif\s+([^\s].*)$/,next:[a.logic.type.else_,a.logic.type.elseif,a.logic.type.endif],open:!1,compile:function(b){var c=b.match[1];return b.stack=a.expression.compile.apply(this,[{type:a.expression.type.expression,value:c}]).stack,delete b.match,b},parse:function(b,c,d){var e="";return d&&a.expression.parse.apply(this,[b.stack,c])===!0&&(d=!1,e=a.parse.apply(this,[b.output,c])),{chain:d,output:e}}},{type:a.logic.type.else_,regex:/^else$/,next:[a.logic.type.endif,a.logic.type.endfor],open:!1,parse:function(b,c,d){var e="";return d&&(e=a.parse.apply(this,[b.output,c])),{chain:d,output:e}}},{type:a.logic.type.endif,regex:/^endif$/,next:[],open:!1},{type:a.logic.type.for_,regex:/^for\s+([a-zA-Z0-9_,\s]+)\s+in\s+([^\s].+)$/,next:[a.logic.type.else_,a.logic.type.endfor],open:!0,compile:function(b){var c=b.match[1],d=b.match[2],e=null,f=null;b.key_var=null,b.value_var=null;if(c.indexOf(",")>=0){e=c.split(",");if(e.length!==2)throw new a.Error("Invalid expression in for loop: "+c);b.key_var=e[0].trim(),b.value_var=e[1].trim()}else b.value_var=c;return f=a.expression.compile.apply(this,[{type:a.expression.type.expression,value:d}]).stack,b.expression=f,delete b.match,b},parse:function(b,c,d){var e=a.expression.parse.apply(this,[b.expression,c]),f=[],g,h,i=this;return e instanceof Array?(g=0,e.forEach(function(d){var h=e.length;c[b.value_var]=d,b.key_var&&(c[b.key_var]=g),c.loop={index:g+1,index0:g,revindex:h-g,revindex0:h-g-1,first:g===0,last:g===h-1,length:h,parent:c},f.push(a.parse.apply(i,[b.output,c])),g+=1})):e instanceof Object&&(e._keys!==undefined?h=e._keys:h=Object.keys(e),h.forEach(function(d){if(d==="_keys")return;e.hasOwnProperty(d)&&(c[b.value_var]=e[d],b.key_var&&(c[b.key_var]=d),f.push(a.parse.apply(i,[b.output,c])))})),d=f.length===0,{chain:d,output:f.join("")}}},{type:a.logic.type.endfor,regex:/^endfor$/,next:[],open:!1},{type:a.logic.type.set,regex:/^set\s+([a-zA-Z0-9_,\s]+)\s*=\s*(.+)$/,next:[],open:!0,compile:function(b){var c=b.match[1].trim(),d=b.match[2],e=a.expression.compile.apply(this,[{type:a.expression.type.expression,value:d}]).stack;return b.key=c,b.expression=e,delete b.match,b},parse:function(b,c,d){var e=a.expression.parse.apply(this,[b.expression,c]),f=b.key;return c[f]=e,{chain:d,context:c}}},{type:a.logic.type.filter,regex:/^filter\s+(.+)$/,next:[a.logic.type.endfilter],open:!0,compile:function(b){var c="|"+b.match[1].trim();return b.stack=a.expression.compile.apply(this,[{type:a.expression.type.expression,value:c}]).stack,delete b.match,b},parse:function(b,c,d){var e=a.parse.apply(this,[b.output,c]),f=[{type:a.expression.type.string,value:e}].concat(b.stack),g=a.expression.parse.apply(this,[f,c]);return{chain:d,output:g}}},{type:a.logic.type.endfilter,regex:/^endfilter$/,next:[],open:!1},{type:a.logic.type.block,regex:/^block\s+([a-zA-Z0-9_]+)$/,next:[a.logic.type.endblock],open:!0,compile:function(a){return a.block=a.match[1].trim(),delete a.match,a},parse:function(b,c,d){var e="",f="";return this.blocks[b.block]===undefined&&(e=a.expression.parse.apply(this,[{type:a.expression.type.string,value:a.parse.apply(this,[b.output,c])},c]),this.blocks[b.block]=e),this.extend===null&&(this.child.blocks[b.block]?f=this.child.blocks[b.block]:f=this.blocks[b.block]),{chain:d,output:f}}},{type:a.logic.type.endblock,regex:/^endblock$/,next:[],open:!1},{type:a.logic.type.extends_,regex:/^extends\s+(.+)$/,next:[],open:!0,compile:function(b){var c=b.match[1].trim();return delete b.match,b.stack=a.expression.compile.apply(this,[{type:a.expression.type.expression,value:c}]).stack,b},parse:function(b,c,d){var e=a.expression.parse.apply(this,[b.stack,c]);return this.extend=e,{chain:d,output:""}}},{type:a.logic.type.use,regex:/^use\s+(.+)$/,next:[],open:!0,compile:function(b){var c=b.match[1].trim();return delete b.match,b.stack=a.expression.compile.apply(this,[{type:a.expression.type.expression,value:c}]).stack,b},parse:function(b,c,d){var e=a.expression.parse.apply(this,[b.stack,c]);return this.importBlocks(e),{chain:d,output:""}}}],a.logic.handler={},a.logic.extendType=function(b,c){c=c||"Twig.logic.type"+b,a.logic.type[b]=c},a.logic.extend=function(b){if(!b.type)throw new a.Error("Unable to extend logic definition. No type provided for "+b);if(a.logic.type[b.type])throw new a.Error("Unable to extend logic definitions. Type "+b.type+" is already defined.");a.logic.extendType(b.type),a.logic.handler[b.type]=b};while(a.logic.definitions.length>0)a.logic.extend(a.logic.definitions.shift());return a.logic.compile=function(b){var c=b.value.trim(),d=a.logic.tokenize.apply(this,[c]),e=a.logic.handler[d.type];return e.compile&&(d=e.compile.apply(this,[d]),a.log.trace("Twig.logic.compile: ","Compiled logic token to ",d)),d},a.logic.tokenize=function(b){var c={},d=null,e=null,f=null,g=null,h=null,i=null;b=b.trim();for(d in a.logic.handler)if(a.logic.handler.hasOwnProperty(d)){e=a.logic.handler[d].type,f=a.logic.handler[d].regex,g=[],f instanceof Array?g=f:g.push(f);while(g.length>0){h=g.shift(),i=h.exec(b.trim());if(i!==null)return c.type=e,c.match=i,a.log.trace("Twig.logic.tokenize: ","Matched a ",e," regular expression of ",i),c}}throw new a.Error("Unable to parse '"+b.trim()+"'")},a.logic.parse=function(b,c,d){var e="",f;return c=c||{},a.log.debug("Twig.logic.parse: ","Parsing logic token ",b),f=a.logic.handler[b.type],f.parse&&(e=f.parse.apply(this,[b,c,d])),e},a}(Twig||{}),Twig=function(a){"use strict",a.expression={},a.expression.reservedWords=["true","false"],a.expression.type={comma:"Twig.expression.type.comma",expression:"Twig.expression.type.expression",operator:"Twig.expression.type.operator",string:"Twig.expression.type.string",bool:"Twig.expression.type.bool",array:{start:"Twig.expression.type.array.start",end:"Twig.expression.type.array.end"},object:{start:"Twig.expression.type.object.start",end:"Twig.expression.type.object.end"},parameter:{start:"Twig.expression.type.parameter.start",end:"Twig.expression.type.parameter.end"},key:{period:"Twig.expression.type.key.period",brackets:"Twig.expression.type.key.brackets"},filter:"Twig.expression.type.filter",_function:"Twig.expression.type._function",variable:"Twig.expression.type.variable",number:"Twig.expression.type.number",test:"Twig.expression.type.test"},a.expression.set={operations:[a.expression.type.filter,a.expression.type.operator,a.expression.type.array.end,a.expression.type.object.end,a.expression.type.parameter.end,a.expression.type.comma,a.expression.type.test],expressions:[a.expression.type._function,a.expression.type.expression,a.expression.type.bool,a.expression.type.string,a.expression.type.variable,a.expression.type.number,a.expression.type.array.start,a.expression.type.object.start]},a.expression.fn={compile:{push:function(a,b,c){c.push(a)},push_both:function(a,b,c){c.push(a),b.push(a)}},parse:{push:function(a,b,c){b.push(a)},push_value:function(a,b,c){b.push(a.value)}}},a.expression.definitions=[{type:a.expression.type.test,regex:/^is\s+(not)?\s*([a-zA-Z_][a-zA-Z0-9_]*)/,next:a.expression.set.operations.concat([a.expression.type.parameter.start]),compile:function(a,b,c){a.filter=a.match[2],a.modifier=a.match[1],delete a.match,delete a.value,c.push(a)},parse:function(b,c,d){var e=c.pop(),f=b.params&&a.expression.parse.apply(this,[b.params,d]),g=a.test(b.filter,e,f);b.modifier=="not"?c.push(!g):c.push(g)}},{type:a.expression.type.comma,regex:/^,/,next:a.expression.set.expressions,compile:function(b,c,d){var e=c.length-1,f;for(;e>=0;e--){f=c.pop();if(f.type===a.expression.type.object.start||f.type===a.expression.type.parameter.start||f.type===a.expression.type.array.start){c.push(f);break}d.push(f)}d.push(b)}},{type:a.expression.type.expression,regex:/^\(([^\)]+)\)/,next:a.expression.set.operations.concat([a.expression.type.key.period]),compile:function(b,c,d){b.value=b.match[1];var e=a.expression.compile(b).stack;while(e.length>0)d.push(e.shift())}},{type:a.expression.type.operator,regex:/(^[\+\-~%\?\:]|^[!=]==?|^[!<>]=?|^\|\||^&&|^\*\*?|^\/\/?|^and\s+|^or\s+|^in\s+|^not in\s+|^not\s+)/,next:a.expression.set.expressions,compile:function(b,c,d){delete b.match,b.value=b.value.trim();var e=b.value,f=a.expression.operator.lookup(e,b);a.log.trace("Twig.expression.compile: ","Operator: ",f," from ",e);while(c.length>0&&c[c.length-1].type==a.expression.type.operator&&(f.associativity===a.expression.operator.leftToRight&&f.precidence>=c[c.length-1].precidence||f.associativity===a.expression.operator.rightToLeft&&f.precidence>c[c.length-1].precidence)){var g=c.pop();d.push(g)}if(e===":"){if(!c[c.length-1]||c[c.length-1].value!=="?"){var h=d.pop();if(h.type!==a.expression.type.string)throw new a.Error("Unexpected value before ':' of "+h.type+" = "+h.value);b.key=h.value,d.push(b);return}}else c.push(f)},parse:function(b,c,d){b.key?c.push(b):a.expression.operator.parse(b.value,c)}},{type:a.expression.type.string,regex:/^(["'])(?:(?=(\\?))\2.)*?\1/,next:a.expression.set.operations,compile:function(b,c,d){var e=b.value;e.substring(0,1)==='"'?e=e.replace('\\"','"'):e=e.replace("\\'","'"),b.value=e.substring(1,e.length-1),a.log.trace("Twig.expression.compile: ","String value: ",b.value),d.push(b)},parse:a.expression.fn.parse.push_value},{type:a.expression.type.parameter.start,regex:/^\(/,next:a.expression.set.expressions.concat([a.expression.type.parameter.end]),compile:a.expression.fn.compile.push_both,parse:a.expression.fn.parse.push},{type:a.expression.type.parameter.end,regex:/^\)/,next:a.expression.set.operations,compile:function(b,c,d){var e;e=c.pop();while(c.length>0&&e.type!=a.expression.type.parameter.start)d.push(e),e=c.pop();var f=[];while(b.type!==a.expression.type.parameter.start)f.unshift(b),b=d.pop();f.unshift(b),b=d.pop();if(b.type!==a.expression.type._function&&b.type!==a.expression.type.filter&&b.type!==a.expression.type.test&&b.type!==a.expression.type.key.brackets&&b.type!==a.expression.type.key.period)throw new a.Error("Expected filter or function before parameters, got "+b.type);b.params=f,d.push(b)},parse:function(b,c,d){var e=[],f=!1,g=null;while(c.length>0){g=c.pop();if(g&&g.type&&g.type==a.expression.type.parameter.start){f=!0;break}e.unshift(g)}if(!f)throw new a.Error("Expected end of parameter set.");c.push(e)}},{type:a.expression.type.array.start,regex:/^\[/,next:a.expression.set.expressions.concat([a.expression.type.array.end]),compile:a.expression.fn.compile.push_both,parse:a.expression.fn.parse.push},{type:a.expression.type.array.end,regex:/^\]/,next:a.expression.set.operations.concat([a.expression.type.key.period,a.expression.type.key.brackets]),compile:function(b,c,d){var e=c.length-1,f;for(;e>=0;e--){f=c.pop();if(f.type===a.expression.type.array.start)break;d.push(f)}d.push(b)},parse:function(b,c,d){var e=[],f=!1,g=null;while(c.length>0){g=c.pop();if(g.type&&g.type==a.expression.type.array.start){f=!0;break}e.unshift(g)}if(!f)throw new a.Error("Expected end of array.");c.push(e)}},{type:a.expression.type.object.start,regex:/^\{/,next:a.expression.set.expressions.concat([a.expression.type.object.end]),compile:a.expression.fn.compile.push_both,parse:a.expression.fn.parse.push},{type:a.expression.type.object.end,regex:/^\}/,next:a.expression.set.operations.concat([a.expression.type.key.period,a.expression.type.key.brackets]),compile:function(b,c,d){var e=c.length-1,f;for(;e>=0;e--){f=c.pop();if(f.type===a.expression.type.object.start)break;d.push(f)}d.push(b)},parse:function(b,c,d){var e={},f=!1,g=null,h=null,i=null;while(c.length>0){g=c.pop();if(g.type&&g.type===a.expression.type.object.start){f=!0;break}if(g.type&&g.type===a.expression.type.operator&&g.key){if(i===null)throw new a.Error("Expected value for key "+g.key+" in object definition. Got "+g);e[g.key]=i,e._keys===undefined&&(e._keys=[]),e._keys.unshift(g.key),i=null}else i=g}if(!f)throw new a.Error("Unexpected end of object.");c.push(e)}},{type:a.expression.type.filter,regex:/^\|\s?([a-zA-Z_][a-zA-Z0-9_\-]*)/,next:a.expression.set.operations.concat([a.expression.type.key.period,a.expression.type.key.brackets,a.expression.type.parameter.start]),compile:function(a,b,c){a.value=a.match[1],c.push(a)},parse:function(b,c,d){var e=c.pop(),f=b.params&&a.expression.parse.apply(this,[b.params,d]);c.push(a.filter(b.value,e,f))}},{type:a.expression.type._function,regex:/^([a-zA-Z_][a-zA-Z0-9_]*)\s*\(/,next:a.expression.type.parameter.start,transform:function(a,b){return"("},compile:function(a,b,c){var d=a.match[1];a.fn=d,delete a.match,delete a.value,c.push(a)},parse:function(b,c,d){var e=b.params&&a.expression.parse.apply(this,[b.params,d]),f=b.fn,g;if(a.functions[f])g=a.functions[f].apply(this,e);else{if(typeof d[f]!="function")throw new a.Error(f+" function does not exist and is not defined in the context");g=d[f].apply(d,e)}c.push(g)}},{type:a.expression.type.variable,regex:/^[a-zA-Z_][a-zA-Z0-9_]*/,next:a.expression.set.operations.concat([a.expression.type.key.period,a.expression.type.key.brackets,a.expression.type.parameter.start]),compile:a.expression.fn.compile.push,validate:function(b,c){return a.expression.reservedWords.indexOf(b[0])==-1},parse:function(b,c,d){var e=a.expression.resolve(d[b.value],d);c.push(e)}},{type:a.expression.type.key.period,regex:/^\.([a-zA-Z_][a-zA-Z0-9_]*)/,next:a.expression.set.operations.concat([a.expression.type.key.period,a.expression.type.key.brackets,a.expression.type.parameter.start]),compile:function(a,b,c){a.key=a.match[1],delete a.match,delete a.value,c.push(a)},parse:function(b,c,d){var e=b.params&&a.expression.parse.apply(this,[b.params,d]),f=b.key,g=c.pop(),h;if(g===null||g===undefined)throw new a.Error("Can't access a key "+f+" on an undefined object.");h=g[f],c.push(a.expression.resolve(h,g,e))}},{type:a.expression.type.key.brackets,regex:/^\[([^\]]*)\]/,next:a.expression.set.operations.concat([a.expression.type.key.period,a.expression.type.key.brackets,a.expression.type.parameter.start]),compile:function(b,c,d){var e=b.match[1];delete b.value,delete b.match,b.stack=a.expression.compile({value:e}).stack,d.push(b)},parse:function(b,c,d){var e=b.params&&a.expression.parse.apply(this,[b.params,d]),f=a.expression.parse.apply(this,[b.stack,d]),g=c.pop(),h;if(!g.hasOwnProperty(f))throw new a.Error("Model doesn't provide the key "+f);h=g[f],c.push(a.expression.resolve(h,g,e))}},{type:a.expression.type.number,regex:/^\-?\d+(\.\d+)?/,next:a.expression.set.operations,compile:function(a,b,c){a.value=Number(a.value),c.push(a)},parse:a.expression.fn.parse.push_value},{type:a.expression.type.bool,regex:/^(true|false)/,next:a.expression.set.operations,compile:function(a,b,c){a.value=a.match[0]=="true",delete a.match,c.push(a)},parse:a.expression.fn.parse.push_value}],a.expression.resolve=function(a,b,c){return typeof a=="function"?a.apply(b,c||[]):a},a.expression.handler={},a.expression.extendType=function(b){a.expression.type[b]="Twig.expression.type."+b},a.expression.extend=function(b){if(!b.type)throw new a.Error("Unable to extend logic definition. No type provided for "+b);a.expression.handler[b.type]=b};while(a.expression.definitions.length>0)a.expression.extend(a.expression.definitions.shift());return a.expression.tokenize=function(b){var c=[],d=0,e=null,f,g,h,i,j,k=[],l;l=function(){var b=Array.prototype.slice.apply(arguments),g=b.pop(),h=b.pop();return a.log.trace("Twig.expression.tokenize","Matched a ",f," regular expression of ",b),e&&e.indexOf (f)<0?(k.push(f+" cannot follow a "+c[c.length-1].type+" at template:"+d+" near '"+b[0].substring(0,20)+"...'"),b[0]):a.expression.handler[f].validate&&!a.expression.handler[f].validate(b,c)?b[0]:(k=[],c.push({type:f,value:b[0],match:b}),j=!0,e=i,d+=b[0].length,a.expression.handler[f].transform?a.expression.handler[f].transform(b,c):"")},a.log.debug("Twig.expression.tokenize","Tokenizing expression ",b);while(b.length>0){b=b.trim();for(f in a.expression.handler)if(a.expression.handler.hasOwnProperty(f)){i=a.expression.handler[f].next,g=a.expression.handler[f].regex,g instanceof Array?h=g:h=[g],j=!1;while(h.length>0)g=h.pop(),b=b.replace(g,l);if(j)break}if(!j)throw k.length>0?new a.Error(k.join(" OR ")):new a.Error("Unable to parse '"+b+"' at template position"+d)}return a.log.trace("Twig.expression.tokenize","Tokenized to ",c),c},a.expression.compile=function(b){var c=b.value,d=a.expression.tokenize(c),e=null,f=[],g=[],h=null;a.log.trace("Twig.expression.compile: ","Compiling ",c);while(d.length>0)e=d.shift(),h=a.expression.handler[e.type],a.log.trace("Twig.expression.compile: ","Compiling ",e),h.compile&&h.compile(e,g,f),a.log.trace("Twig.expression.compile: ","Stack is",g),a.log.trace("Twig.expression.compile: ","Output is",f);while(g.length>0)f.push(g.pop());return a.log.trace("Twig.expression.compile: ","Final output is",f),b.stack=f,delete b.value,b},a.expression.parse=function(b,c){var d=this;b instanceof Array||(b=[b]);var e=[],f=null;return b.forEach(function(b){f=a.expression.handler[b.type],f.parse&&f.parse.apply(d,[b,e,c])}),e.pop()},a}(Twig||{}),Twig=function(a){"use strict",a.expression.operator={leftToRight:"leftToRight",rightToLeft:"rightToLeft"},a.expression.operator.lookup=function(b,c){switch(b){case"not in":case"in":c.precidence=20,c.associativity=a.expression.operator.leftToRight;break;case",":c.precidence=18,c.associativity=a.expression.operator.leftToRight;break;case"?":case":":c.precidence=16,c.associativity=a.expression.operator.rightToLeft;break;case"or":case"||":c.precidence=14,c.associativity=a.expression.operator.leftToRight;break;case"and":case"&&":c.precidence=13,c.associativity=a.expression.operator.leftToRight;break;case"==":case"!=":c.precidence=9,c.associativity=a.expression.operator.leftToRight;break;case"<":case"<=":case">":case">=":c.precidence=8,c.associativity=a.expression.operator.leftToRight;break;case"~":case"+":case"-":c.precidence=6,c.associativity=a.expression.operator.leftToRight;break;case"//":case"**":case"*":case"/":case"%":c.precidence=5,c.associativity=a.expression.operator.leftToRight;break;case"not":c.precidence=3,c.associativity=a.expression.operator.rightToLeft;break;default:throw new a.Error(b+" is an unknown operator.")}return c.operator=b,c},a.expression.operator.parse=function(c,d){a.log.trace("Twig.expression.operator.parse: ","Handling ",c);var e,f,g;switch(c){case":":break;case"?":g=d.pop(),f=d.pop(),e=d.pop(),e?d.push(f):d.push(g);break;case"+":f=parseFloat(d.pop()),e=parseFloat(d.pop()),d.push(e+f);break;case"-":f=parseFloat(d.pop()),e=parseFloat(d.pop()),d.push(e-f);break;case"*":f=parseFloat(d.pop()),e=parseFloat(d.pop()),d.push(e*f);break;case"/":f=parseFloat(d.pop()),e=parseFloat(d.pop()),d.push(e/f);break;case"//":f=parseFloat(d.pop()),e=parseFloat(d.pop()),d.push(parseInt(e/f));break;case"%":f=parseFloat(d.pop()),e=parseFloat(d.pop()),d.push(e%f);break;case"~":f=d.pop(),e=d.pop(),d.push((e!==undefined?e.toString():"")+(f!==undefined?f.toString():""));break;case"not":case"!":d.push(!d.pop());break;case"<":f=d.pop(),e=d.pop(),d.push(e<f);break;case"<=":f=d.pop(),e=d.pop(),d.push(e<=f);break;case">":f=d.pop(),e=d.pop(),d.push(e>f);break;case">=":f=d.pop(),e=d.pop(),d.push(e>=f);break;case"===":f=d.pop(),e=d.pop(),d.push(e===f);break;case"==":f=d.pop(),e=d.pop(),d.push(e==f);break;case"!==":f=d.pop(),e=d.pop(),d.push(e!==f);break;case"!=":f=d.pop(),e=d.pop(),d.push(e!=f);break;case"or":case"||":f=d.pop(),e=d.pop(),d.push(e||f);break;case"and":case"&&":f=d.pop(),e=d.pop(),d.push(e&&f);break;case"**":f=d.pop(),e=d.pop(),d.push(Math.pow(e,f));break;case"not in":f=d.pop(),e=d.pop(),d.push(!b(e,f));break;case"in":f=d.pop(),e=d.pop(),d.push(b(e,f));break;default:throw new a.Error(c+" is an unknown operator.")}};var b=function(a,b){if(b.indexOf!=undefined)return b.indexOf(a)>-1;var c;for(c in b)if(b.hasOwnProperty(c)&&b[c]===a)return!0;return!1};return a}(Twig||{}),Twig=function(a){function b(a,b){var c=Object.prototype.toString.call(b).slice(8,-1);return b!==undefined&&b!==null&&c===a}return a.filters={upper:function(a){return a.toUpperCase()},lower:function(a){return a.toLowerCase()},capitalize:function(a){return a.substr(0,1).toUpperCase()+a.substr(1)},title:function(a){return a.replace(/(^|\s)([a-z])/g,function(a,b,c){return b+c.toUpperCase()})},length:function(a){if(a instanceof Array||typeof a=="string")return a.length;if(a instanceof Object)return a._keys===undefined?Object.keys(a).length:a._keys.length},reverse:function(a){if(b("Array",a))return a.reverse();if(b("String",a))return a.split("").reverse().join("");var c=a._keys||Object.keys(a).reverse();return a._keys=c,a},sort:function(a){if(b("Array",a))return a.sort();if(a instanceof Object){delete a._keys;var c=Object.keys(a),d=c.sort(function(b,c){return a[b]>a[c]});return a._keys=d,a}},keys:function(a){var b=a._keys||Object.keys(a),c=[];return b.forEach(function(b){if(b==="_keys")return;a.hasOwnProperty(b)&&c.push(b)}),c},url_encode:function(a){return encodeURIComponent(a)},join:function(a,b){var c="",d=[],e=null;return b&&b[0]&&(c=b[0]),a instanceof Array?d=a:(e=a._keys||Object.keys(a),e.forEach(function(b){if(b==="_keys")return;a.hasOwnProperty(b)&&d.push(a[b])})),d.join(c)},"default":function(b,c){if(c===undefined||c.length!==1)throw new a.Error("default filter expects one argument");return b===undefined||b===null||b===""?c[0]:b},json_encode:function(a){return delete a._keys,JSON.stringify(a)},merge:function(b,c){var d=[],e=0,f=[];b instanceof Array?c.forEach(function(a){a instanceof Array||(d={})}):d={},d instanceof Array||(d._keys=[]),b instanceof Array?b.forEach(function(a){d._keys&&d._keys.unshift(e),d[e]=a,e++}):(f=b._keys||Object.keys(b),f.forEach(function(a){d[a]=b[a],d._keys.push(a);var c=parseInt(a,10);!isNaN(c)&&c>=e&&(e=c+1)})),c.forEach(function(a){a instanceof Array?a.forEach(function(a){d._keys&&d._keys.push(e),d[e]=a,e++}):(f=a._keys||Object.keys(a),f.forEach(function(b){d[b]||d._keys.unshift(b),d[b]=a[b];var c=parseInt(b,10);!isNaN(c)&&c>=e&&(e=c+1)}))});if(c.length===0)throw new a.Error("Filter merge expects at least one parameter");return d},date:function(a,b){var c=new Date(a);return c.getDate()===NaN&&c.setFromString(a),c.format(b[0])},replace:function(a,b){var c=b[0],d;for(d in c)c.hasOwnProperty(d)&&d!=="_keys"&&(a=a.replace(d,c[d]));return a},format:function(b,c){return a.lib.vsprintf(b,c)},striptags:function(b){return a.lib.strip_tags(b)}},a.filter=function(b,c,d){if(!a.filters[b])throw"Unable to find filter "+b;return a.filters[b](c,d)},a.filter.extend=function(b,c){a.filters[b]=c},a}(Twig||{}),Twig=function(a){function b(a,b){var c=Object.prototype.toString.call(b).slice(8,-1);return b!==undefined&&b!==null&&c===a}return a.functions={range:function(a,b,c){var d=[],e,f,g,h=c||1,i=!1;!isNaN(a)&&!isNaN(b)?(e=parseInt(a),f=parseInt(b)):isNaN(a)&&isNaN(b)?(i=!0,e=a.charCodeAt(0),f=b.charCodeAt(0)):(e=isNaN(a)?0:a,f=isNaN(b)?0:b),g=e>f?!1:!0;if(g)while(e<=f)d.push(i?String.fromCharCode(e):e),e+=h;else while(e>=f)d.push(i?String.fromCharCode(e):e),e-=h;return d},cycle:function(a,b){var c=b%a.length;return a[c]},date:function(b,c){var d;if(b==undefined)d=new Date;else if(a.lib.is("Date",b))d=b;else if(a.lib.is("String",b))d=new Date(a.lib.strtotime(b)*1e3);else{if(!a.lib.is("Number",b))throw new a.Error("Unable to parse date "+b);d=new Date(b*1e3)}return d}},a._function=function(b,c,d){if(!a.functions[b])throw"Unable to find function "+b;return a.functions[b](c,d)},a._function.extend=function(b,c){a.functions[b]=c},a}(Twig||{}),Twig=function(a){return"use strict",a.tests={empty:function(a){if(a===null||a===undefined)return!0;if(typeof a=="number")return!1;if(a.length&&a.length>0)return!1;for(var b in a)if(a.hasOwnProperty(b))return!1;return!0},odd:function(a){return a%2===1},even:function(a){return a%2===0},divisibleby:function(a,b){return a%b[0]===0},defined:function(a){return a!==undefined},none:function(a){return a===null},sameas:function(a,b){return a===b[0]}},a.test=function(b,c,d){if(!a.tests[b])throw"Test "+b+" is not defined.";return a.tests[b](c,d)},a.test.extend=function(b,c){a.tests[b]=c},a}(Twig||{}),Twig=function(a){return"use strict",a.exports={},a.exports.twig=function(c){"use strict";var d=c.id;d&&a.validateId(d),c.debug!==undefined&&(a.debug=c.debug),c.trace!==undefined&&(a.trace=c.trace);if(c.data!==undefined)return new a.Template({data:c.data,module:c.module,id:d});if(c.ref!==undefined){if(c.id!==undefined)throw new Error("Both ref and id cannot be set on a twig.js template.");return a.Templates.load(c.ref)}if(c.href!==undefined)return a.Templates.loadRemote(c.href,{id:d,module:c.module,precompiled:c.precompiled,method:"ajax",async:c.async},c.load);if(c.path!==undefined)return a.Templates.loadRemote(c.path,{id:d,module:c.module,precompiled:c.precompiled,method:"fs",async:c.async},c.load)},a.exports.extendFilter=function(b,c){a.filter.extend(b,c)},a.exports.extendFunction=function(b,c){a._function.extend(b,c)},a.exports.extendTest=function(b,c){a.test.extend(b,c)},a.exports.extendTag=function(b){a.logic.extend(b)},a.exports.compile=function(b,c){var d=c.filename,e="/",f=c.filename,g;return g=new a.Template({data:b,path:f,id:d}),function(a){return g.render(a)}},a.exports.renderFile=function(b,c,d){"function"==typeof c&&(d=c,c={}),a.exports.twig({path:b,load:function(a){d(null,a.render(c))}})},a.exports.__express=a.exports.renderFile,a.exports.cache=function(b){a.cache=b},a}(Twig||{}),Twig=function(a){return a.compiler={module:{}},a.compiler.compile=function(b,c){var d=JSON.stringify(b.tokens),e=b.id,f;if(c.module){if(a.compiler.module[c.module]===undefined)throw new a.Error("Unable to find module type "+c.module);f=a.compiler.module[c.module](e,d,c.twig)}else f=a.compiler.wrap(e,d);return f},a.compiler.module={amd:function(b,c,d){return'define(["'+d+'"], function (Twig) {\n\tvar twig = Twig.twig;\n'+a.compiler.wrap(b,c)+"\n\treturn templates;\n});"},node:function(b,c){return'var twig = require("twig").twig;\nexports.template = '+a.compiler.wrap(b,c)},cjs2:function(b,c,d){return'module.declare([{ twig: "'+d+'" }], function (require, exports, module) {\n'+'\tvar twig = require("twig").twig;\n'+"\texports.template = "+a.compiler.wrap(b,c)+"\n});"}},a.compiler.wrap=function(a,b){return'twig({id:"'+a.replace('"','\\"')+'", data:'+b+", precompiled: true});\n"},a}(Twig||{});typeof module!="undefined"&&module.declare?module.declare([],function(a,b,c){for(key in Twig.exports)Twig.exports.hasOwnProperty(key)&&(b[key]=Twig.exports[key])}):typeof module!="undefined"&&module.exports?module.exports=Twig.exports:(window.twig=Twig.exports.twig,window.Twig=Twig.exports);
bergie/cdnjs
ajax/libs/twig.js/0.4.2/twig.min.js
JavaScript
mit
43,897
!function(){function t(t,n){var e=t.split("."),r=T;e[0]in r||!r.execScript||r.execScript("var "+e[0]);for(var i;e.length&&(i=e.shift());)e.length||void 0===n?r=r[i]?r[i]:r[i]={}:r[i]=n}function n(t,n){function e(){}e.prototype=n.prototype,t.M=n.prototype,t.prototype=new e,t.prototype.constructor=t,t.N=function(t,e,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return n.prototype[e].apply(t,i)}}function e(t,n){null!=t&&this.a.apply(this,arguments)}function r(t){t.b=""}function i(t,n){t.sort(n||a)}function a(t,n){return t>n?1:n>t?-1:0}function l(t){var n,e=[],r=0;for(n in t)e[r++]=t[n];return e}function o(t,n){this.b=t,this.a={};for(var e=0;e<n.length;e++){var r=n[e];this.a[r.b]=r}}function u(t){return t=l(t.a),i(t,function(t,n){return t.b-n.b}),t}function s(t,n){switch(this.b=t,this.g=!!n.G,this.a=n.c,this.j=n.type,this.h=!1,this.a){case k:case J:case K:case L:case O:case Y:case U:this.h=!0}this.f=n.defaultValue}function f(){this.a={},this.f=this.i().a,this.b=this.g=null}function c(t,n){for(var e=u(t.i()),r=0;r<e.length;r++){var i=e[r],a=i.b;if(null!=n.a[a]){t.b&&delete t.b[i.b];var l=11==i.a||10==i.a;if(i.g)for(var i=p(n,a)||[],o=0;o<i.length;o++){var s=t,f=a,h=l?i[o].clone():i[o];s.a[f]||(s.a[f]=[]),s.a[f].push(h),s.b&&delete s.b[f]}else i=p(n,a),l?(l=p(t,a))?c(l,i):m(t,a,i.clone()):m(t,a,i)}}}function p(t,n){var e=t.a[n];if(null==e)return null;if(t.g){if(!(n in t.b)){var r=t.g,i=t.f[n];if(null!=e)if(i.g){for(var a=[],l=0;l<e.length;l++)a[l]=r.b(i,e[l]);e=a}else e=r.b(i,e);return t.b[n]=e}return t.b[n]}return e}function h(t,n,e){var r=p(t,n);return t.f[n].g?r[e||0]:r}function g(t,n){var e;if(null!=t.a[n])e=h(t,n,void 0);else t:{if(e=t.f[n],void 0===e.f){var r=e.j;if(r===Boolean)e.f=!1;else if(r===Number)e.f=0;else{if(r!==String){e=new r;break t}e.f=e.h?"0":""}}e=e.f}return e}function b(t,n){return t.f[n].g?null!=t.a[n]?t.a[n].length:0:null!=t.a[n]?1:0}function m(t,n,e){t.a[n]=e,t.b&&(t.b[n]=e)}function y(t,n){var e,r=[];for(e in n)0!=e&&r.push(new s(e,n[e]));return new o(t,r)}/* Protocol Buffer 2 Copyright 2008 Google Inc. All other code copyright its respective owners. Copyright (C) 2010 The Libphonenumber Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function v(){f.call(this)}function d(){f.call(this)}function _(){f.call(this)}function S(){}function w(){}function A(){}/* Copyright (C) 2010 The Libphonenumber Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function N(){this.a={}}function x(t,n){if(null==n)return null;n=n.toUpperCase();var e=t.a[n];if(null==e){if(e=tt[n],null==e)return null;e=(new A).a(_.i(),e),t.a[n]=e}return e}function j(t){return t=X[t],null==t?"ZZ":t[0]}function E(t){this.H=RegExp(" "),this.B="",this.m=new e,this.v="",this.h=new e,this.u=new e,this.j=!0,this.w=this.o=this.D=!1,this.F=N.b(),this.s=0,this.b=new e,this.A=!1,this.l="",this.a=new e,this.f=[],this.C=t,this.J=this.g=R(this,this.C)}function R(t,n){var e;if(null!=n&&isNaN(n)&&n.toUpperCase()in tt){if(e=x(t.F,n),null==e)throw"Invalid region code: "+n;e=g(e,10)}else e=0;return e=x(t.F,j(e)),null!=e?e:at}function $(t){for(var n=t.f.length,e=0;n>e;++e){var i=t.f[e],a=g(i,1);if(t.v==a)return!1;var l;l=t;var o=i,u=g(o,1);if(-1!=u.indexOf("|"))l=!1;else{u=u.replace(lt,"\\d"),u=u.replace(ot,"\\d"),r(l.m);var s;s=l;var o=g(o,2),f="999999999999999".match(u)[0];f.length<s.a.b.length?s="":(s=f.replace(new RegExp(u,"g"),o),s=s.replace(RegExp("9","g")," ")),0<s.length?(l.m.a(s),l=!0):l=!1}if(l)return t.v=a,t.A=st.test(h(i,4)),t.s=0,!0}return t.j=!1}function C(t,n){for(var e=[],r=n.length-3,i=t.f.length,a=0;i>a;++a){var l=t.f[a];0==b(l,3)?e.push(t.f[a]):(l=h(l,3,Math.min(r,b(l,3)-1)),0==n.search(l)&&e.push(t.f[a]))}t.f=e}function F(t,n){t.h.a(n);var e=n;if(rt.test(e)||1==t.h.b.length&&et.test(e)){var i,e=n;"+"==e?(i=e,t.u.a(e)):(i=nt[e],t.u.a(i),t.a.a(i)),n=i}else t.j=!1,t.D=!0;if(!t.j){if(!t.D)if(H(t)){if(V(t))return B(t)}else if(0<t.l.length&&(e=t.a.toString(),r(t.a),t.a.a(t.l),t.a.a(e),e=t.b.toString(),i=e.lastIndexOf(t.l),r(t.b),t.b.a(e.substring(0,i))),t.l!=G(t))return t.b.a(" "),B(t);return t.h.toString()}switch(t.u.b.length){case 0:case 1:case 2:return t.h.toString();case 3:if(!H(t))return t.l=G(t),P(t);t.w=!0;default:return t.w?(V(t)&&(t.w=!1),t.b.toString()+t.a.toString()):0<t.f.length?(e=q(t,n),i=I(t),0<i.length?i:(C(t,t.a.toString()),$(t)?M(t):t.j?D(t,e):t.h.toString())):P(t)}}function B(t){return t.j=!0,t.w=!1,t.f=[],t.s=0,r(t.m),t.v="",P(t)}function I(t){for(var n=t.a.toString(),e=t.f.length,r=0;e>r;++r){var i=t.f[r],a=g(i,1);if(new RegExp("^(?:"+a+")$").test(n))return t.A=st.test(h(i,4)),n=n.replace(new RegExp(a,"g"),h(i,2)),D(t,n)}return""}function D(t,n){var e=t.b.b.length;return t.A&&e>0&&" "!=t.b.toString().charAt(e-1)?t.b+" "+n:t.b+n}function P(t){var n=t.a.toString();if(3<=n.length){for(var e=t.o&&0<b(t.g,20)?p(t.g,20)||[]:p(t.g,19)||[],r=e.length,i=0;r>i;++i){var a,l=e[i];(a=null==t.g.a[12]||t.o||h(l,6))||(a=g(l,4),a=0==a.length||it.test(a)),a&&ut.test(g(l,2))&&t.f.push(l)}return C(t,n),n=I(t),0<n.length?n:$(t)?M(t):t.h.toString()}return D(t,n)}function M(t){var n=t.a.toString(),e=n.length;if(e>0){for(var r="",i=0;e>i;i++)r=q(t,n.charAt(i));return t.j?D(t,r):t.h.toString()}return t.b.toString()}function G(t){var n,e=t.a.toString(),i=0;return 1!=h(t.g,10)?n=!1:(n=t.a.toString(),n="1"==n.charAt(0)&&"0"!=n.charAt(1)&&"1"!=n.charAt(1)),n?(i=1,t.b.a("1").a(" "),t.o=!0):null!=t.g.a[15]&&(n=new RegExp("^(?:"+h(t.g,15)+")"),n=e.match(n),null!=n&&null!=n[0]&&0<n[0].length&&(t.o=!0,i=n[0].length,t.b.a(e.substring(0,i)))),r(t.a),t.a.a(e.substring(i)),e.substring(0,i)}function H(t){var n=t.u.toString(),e=new RegExp("^(?:\\+|"+h(t.g,11)+")"),e=n.match(e);return null!=e&&null!=e[0]&&0<e[0].length?(t.o=!0,e=e[0].length,r(t.a),t.a.a(n.substring(e)),r(t.b),t.b.a(n.substring(0,e)),"+"!=n.charAt(0)&&t.b.a(" "),!0):!1}function V(t){if(0==t.a.b.length)return!1;var n,i=new e;t:{if(n=t.a.toString(),0!=n.length&&"0"!=n.charAt(0))for(var a,l=n.length,o=1;3>=o&&l>=o;++o)if(a=parseInt(n.substring(0,o),10),a in X){i.a(n.substring(o)),n=a;break t}n=0}return 0==n?!1:(r(t.a),t.a.a(i.toString()),i=j(n),"001"==i?t.g=x(t.F,""+n):i!=t.C&&(t.g=R(t,i)),t.b.a(""+n).a(" "),t.l="",!0)}function q(t,n){var e=t.m.toString();if(0<=e.substring(t.s).search(t.H)){var i=e.search(t.H),e=e.replace(t.H,n);return r(t.m),t.m.a(e),t.s=i,e.substring(0,t.s+1)}return 1==t.f.length&&(t.j=!1),t.v="",t.h.toString()}var T=this;e.prototype.b="",e.prototype.set=function(t){this.b=""+t},e.prototype.a=function(t,n,e){if(this.b+=String(t),null!=n)for(var r=1;r<arguments.length;r++)this.b+=arguments[r];return this},e.prototype.toString=function(){return this.b};var U=1,Y=2,k=3,J=4,K=6,L=16,O=18;f.prototype.set=function(t,n){m(this,t.b,n)},f.prototype.clone=function(){var t=new this.constructor;return t!=this&&(t.a={},t.b&&(t.b={}),c(t,this)),t};var Z;n(v,f);var z;n(d,f);var Q;n(_,f),v.prototype.i=function(){return Z||(Z=y(v,{0:{name:"NumberFormat",I:"i18n.phonenumbers.NumberFormat"},1:{name:"pattern",required:!0,c:9,type:String},2:{name:"format",required:!0,c:9,type:String},3:{name:"leading_digits_pattern",G:!0,c:9,type:String},4:{name:"national_prefix_formatting_rule",c:9,type:String},6:{name:"national_prefix_optional_when_formatting",c:8,type:Boolean},5:{name:"domestic_carrier_code_formatting_rule",c:9,type:String}})),Z},v.ctor=v,v.ctor.i=v.prototype.i,d.prototype.i=function(){return z||(z=y(d,{0:{name:"PhoneNumberDesc",I:"i18n.phonenumbers.PhoneNumberDesc"},2:{name:"national_number_pattern",c:9,type:String},3:{name:"possible_number_pattern",c:9,type:String},6:{name:"example_number",c:9,type:String},7:{name:"national_number_matcher_data",c:12,type:String},8:{name:"possible_number_matcher_data",c:12,type:String}})),z},d.ctor=d,d.ctor.i=d.prototype.i,_.prototype.i=function(){return Q||(Q=y(_,{0:{name:"PhoneMetadata",I:"i18n.phonenumbers.PhoneMetadata"},1:{name:"general_desc",c:11,type:d},2:{name:"fixed_line",c:11,type:d},3:{name:"mobile",c:11,type:d},4:{name:"toll_free",c:11,type:d},5:{name:"premium_rate",c:11,type:d},6:{name:"shared_cost",c:11,type:d},7:{name:"personal_number",c:11,type:d},8:{name:"voip",c:11,type:d},21:{name:"pager",c:11,type:d},25:{name:"uan",c:11,type:d},27:{name:"emergency",c:11,type:d},28:{name:"voicemail",c:11,type:d},24:{name:"no_international_dialling",c:11,type:d},9:{name:"id",required:!0,c:9,type:String},10:{name:"country_code",c:5,type:Number},11:{name:"international_prefix",c:9,type:String},17:{name:"preferred_international_prefix",c:9,type:String},12:{name:"national_prefix",c:9,type:String},13:{name:"preferred_extn_prefix",c:9,type:String},15:{name:"national_prefix_for_parsing",c:9,type:String},16:{name:"national_prefix_transform_rule",c:9,type:String},18:{name:"same_mobile_and_fixed_line_pattern",c:8,defaultValue:!1,type:Boolean},19:{name:"number_format",G:!0,c:11,type:v},20:{name:"intl_number_format",G:!0,c:11,type:v},22:{name:"main_country_for_code",c:8,defaultValue:!1,type:Boolean},23:{name:"leading_digits",c:9,type:String},26:{name:"leading_zero_possible",c:8,defaultValue:!1,type:Boolean}})),Q},_.ctor=_,_.ctor.i=_.prototype.i,S.prototype.a=function(t){throw new t.b,Error("Unimplemented")},S.prototype.b=function(t,n){if(11==t.a||10==t.a)return n instanceof f?n:this.a(t.j.prototype.i(),n);if(14==t.a){if("string"==typeof n&&W.test(n)){var e=Number(n);if(e>0)return e}return n}if(!t.h)return n;if(e=t.j,e===String){if("number"==typeof n)return String(n)}else if(e===Number&&"string"==typeof n&&("Infinity"===n||"-Infinity"===n||"NaN"===n||W.test(n)))return Number(n);return n};var W=/^-?[0-9]+$/;n(w,S),w.prototype.a=function(t,n){var e=new t.b;return e.g=this,e.a=n,e.b={},e},n(A,w),A.prototype.b=function(t,n){return 8==t.a?!!n:S.prototype.b.apply(this,arguments)},A.prototype.a=function(t,n){return A.M.a.call(this,t,n)};/* Copyright (C) 2010 The Libphonenumber Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var X={507:["PA"]},tt={PA:[null,[null,null,"[1-9]\\d{6,7}","\\d{7,8}"],[null,null,"(?:1(?:0[0-8]|1[49]|2[37]|3[0137]|4[147]|5[05]|6[58]|7[0167]|8[58]|9[139])|2(?:[0235679]\\d|1[0-7]|4[04-9]|8[028])|3(?:[09]\\d|1[014-7]|2[0-3]|3[03]|4[03-57]|55|6[068]|7[06-8]|8[06-9])|4(?:3[013-69]|4\\d|7[0-589])|5(?:[01]\\d|2[0-7]|[56]0|79)|7(?:0[09]|2[0-267]|3[06]|[469]0|5[06-9]|7[0-24-79]|8[7-9])|8(?:09|[34]\\d|5[0134]|8[02])|9(?:0[6-9]|1[016-8]|2[036-8]|3[3679]|40|5[0489]|6[06-9]|7[046-9]|8[36-8]|9[1-9]))\\d{4}","\\d{7}",null,null,"2001234"],[null,null,"(?:1[16]1|21[89]|8(?:1[01]|7[23]))\\d{4}|6(?:[024-9]\\d|1[0-5]|3[0-24-9])\\d{5}","\\d{7,8}",null,null,"60012345"],[null,null,"80[09]\\d{4}","\\d{7}",null,null,"8001234"],[null,null,"(?:779|8(?:55|60|7[78])|9(?:00|81))\\d{4}","\\d{7}",null,null,"8601234"],[null,null,"NA","NA"],[null,null,"NA","NA"],[null,null,"NA","NA"],"PA",507,"00",null,null,null,null,null,null,null,[[null,"(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],[null,"(\\d{4})(\\d{4})","$1-$2",["6"]]],null,[null,null,"NA","NA"],null,null,[null,null,"NA","NA"],[null,null,"NA","NA"],null,null,[null,null,"NA","NA"]]};N.b=function(){return N.a?N.a:N.a=new N};var nt={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"},et=RegExp("[++]+"),rt=RegExp("([0-90-9٠-٩۰-۹])"),it=/^\(?\$1\)?$/,at=new _;m(at,11,"NA");var lt=/\[([^\[\]])*\]/g,ot=/\d(?=[^,}][^,}])/g,ut=RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*)+$"),st=/[- ]/;E.prototype.K=function(){this.B="",r(this.h),r(this.u),r(this.m),this.s=0,this.v="",r(this.b),this.l="",r(this.a),this.j=!0,this.w=this.o=this.D=!1,this.f=[],this.A=!1,this.g!=this.J&&(this.g=R(this,this.C))},E.prototype.L=function(t){return this.B=F(this,t)},t("Cleave.AsYouTypeFormatter",E),t("Cleave.AsYouTypeFormatter.prototype.inputDigit",E.prototype.L),t("Cleave.AsYouTypeFormatter.prototype.clear",E.prototype.K)}.call("object"==typeof global&&global?global:window);
brix/cdnjs
ajax/libs/cleave.js/0.7.14/addons/cleave-phone.pa.js
JavaScript
mit
13,681
!function(){function t(t,n){var e=t.split("."),r=q;e[0]in r||!r.execScript||r.execScript("var "+e[0]);for(var i;e.length&&(i=e.shift());)e.length||void 0===n?r=r[i]?r[i]:r[i]={}:r[i]=n}function n(t,n){function e(){}e.prototype=n.prototype,t.M=n.prototype,t.prototype=new e,t.prototype.constructor=t,t.N=function(t,e,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return n.prototype[e].apply(t,i)}}function e(t,n){null!=t&&this.a.apply(this,arguments)}function r(t){t.b=""}function i(t,n){t.sort(n||a)}function a(t,n){return t>n?1:n>t?-1:0}function l(t){var n,e=[],r=0;for(n in t)e[r++]=t[n];return e}function o(t,n){this.b=t,this.a={};for(var e=0;e<n.length;e++){var r=n[e];this.a[r.b]=r}}function u(t){return t=l(t.a),i(t,function(t,n){return t.b-n.b}),t}function s(t,n){switch(this.b=t,this.g=!!n.G,this.a=n.c,this.j=n.type,this.h=!1,this.a){case k:case J:case K:case L:case O:case Y:case T:this.h=!0}this.f=n.defaultValue}function f(){this.a={},this.f=this.i().a,this.b=this.g=null}function c(t,n){for(var e=u(t.i()),r=0;r<e.length;r++){var i=e[r],a=i.b;if(null!=n.a[a]){t.b&&delete t.b[i.b];var l=11==i.a||10==i.a;if(i.g)for(var i=p(n,a)||[],o=0;o<i.length;o++){var s=t,f=a,h=l?i[o].clone():i[o];s.a[f]||(s.a[f]=[]),s.a[f].push(h),s.b&&delete s.b[f]}else i=p(n,a),l?(l=p(t,a))?c(l,i):m(t,a,i.clone()):m(t,a,i)}}}function p(t,n){var e=t.a[n];if(null==e)return null;if(t.g){if(!(n in t.b)){var r=t.g,i=t.f[n];if(null!=e)if(i.g){for(var a=[],l=0;l<e.length;l++)a[l]=r.b(i,e[l]);e=a}else e=r.b(i,e);return t.b[n]=e}return t.b[n]}return e}function h(t,n,e){var r=p(t,n);return t.f[n].g?r[e||0]:r}function g(t,n){var e;if(null!=t.a[n])e=h(t,n,void 0);else t:{if(e=t.f[n],void 0===e.f){var r=e.j;if(r===Boolean)e.f=!1;else if(r===Number)e.f=0;else{if(r!==String){e=new r;break t}e.f=e.h?"0":""}}e=e.f}return e}function b(t,n){return t.f[n].g?null!=t.a[n]?t.a[n].length:0:null!=t.a[n]?1:0}function m(t,n,e){t.a[n]=e,t.b&&(t.b[n]=e)}function y(t,n){var e,r=[];for(e in n)0!=e&&r.push(new s(e,n[e]));return new o(t,r)}/* Protocol Buffer 2 Copyright 2008 Google Inc. All other code copyright its respective owners. Copyright (C) 2010 The Libphonenumber Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function v(){f.call(this)}function d(){f.call(this)}function _(){f.call(this)}function S(){}function w(){}function A(){}/* Copyright (C) 2010 The Libphonenumber Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function x(){this.a={}}function N(t,n){if(null==n)return null;n=n.toUpperCase();var e=t.a[n];if(null==e){if(e=tt[n],null==e)return null;e=(new A).a(_.i(),e),t.a[n]=e}return e}function $(t){return t=X[t],null==t?"ZZ":t[0]}function j(t){this.H=RegExp(" "),this.B="",this.m=new e,this.v="",this.h=new e,this.u=new e,this.j=!0,this.w=this.o=this.D=!1,this.F=x.b(),this.s=0,this.b=new e,this.A=!1,this.l="",this.a=new e,this.f=[],this.C=t,this.J=this.g=E(this,this.C)}function E(t,n){var e;if(null!=n&&isNaN(n)&&n.toUpperCase()in tt){if(e=N(t.F,n),null==e)throw"Invalid region code: "+n;e=g(e,10)}else e=0;return e=N(t.F,$(e)),null!=e?e:at}function R(t){for(var n=t.f.length,e=0;n>e;++e){var i=t.f[e],a=g(i,1);if(t.v==a)return!1;var l;l=t;var o=i,u=g(o,1);if(-1!=u.indexOf("|"))l=!1;else{u=u.replace(lt,"\\d"),u=u.replace(ot,"\\d"),r(l.m);var s;s=l;var o=g(o,2),f="999999999999999".match(u)[0];f.length<s.a.b.length?s="":(s=f.replace(new RegExp(u,"g"),o),s=s.replace(RegExp("9","g")," ")),0<s.length?(l.m.a(s),l=!0):l=!1}if(l)return t.v=a,t.A=st.test(h(i,4)),t.s=0,!0}return t.j=!1}function C(t,n){for(var e=[],r=n.length-3,i=t.f.length,a=0;i>a;++a){var l=t.f[a];0==b(l,3)?e.push(t.f[a]):(l=h(l,3,Math.min(r,b(l,3)-1)),0==n.search(l)&&e.push(t.f[a]))}t.f=e}function F(t,n){t.h.a(n);var e=n;if(rt.test(e)||1==t.h.b.length&&et.test(e)){var i,e=n;"+"==e?(i=e,t.u.a(e)):(i=nt[e],t.u.a(i),t.a.a(i)),n=i}else t.j=!1,t.D=!0;if(!t.j){if(!t.D)if(H(t)){if(P(t))return B(t)}else if(0<t.l.length&&(e=t.a.toString(),r(t.a),t.a.a(t.l),t.a.a(e),e=t.b.toString(),i=e.lastIndexOf(t.l),r(t.b),t.b.a(e.substring(0,i))),t.l!=G(t))return t.b.a(" "),B(t);return t.h.toString()}switch(t.u.b.length){case 0:case 1:case 2:return t.h.toString();case 3:if(!H(t))return t.l=G(t),U(t);t.w=!0;default:return t.w?(P(t)&&(t.w=!1),t.b.toString()+t.a.toString()):0<t.f.length?(e=V(t,n),i=I(t),0<i.length?i:(C(t,t.a.toString()),R(t)?M(t):t.j?D(t,e):t.h.toString())):U(t)}}function B(t){return t.j=!0,t.w=!1,t.f=[],t.s=0,r(t.m),t.v="",U(t)}function I(t){for(var n=t.a.toString(),e=t.f.length,r=0;e>r;++r){var i=t.f[r],a=g(i,1);if(new RegExp("^(?:"+a+")$").test(n))return t.A=st.test(h(i,4)),n=n.replace(new RegExp(a,"g"),h(i,2)),D(t,n)}return""}function D(t,n){var e=t.b.b.length;return t.A&&e>0&&" "!=t.b.toString().charAt(e-1)?t.b+" "+n:t.b+n}function U(t){var n=t.a.toString();if(3<=n.length){for(var e=t.o&&0<b(t.g,20)?p(t.g,20)||[]:p(t.g,19)||[],r=e.length,i=0;r>i;++i){var a,l=e[i];(a=null==t.g.a[12]||t.o||h(l,6))||(a=g(l,4),a=0==a.length||it.test(a)),a&&ut.test(g(l,2))&&t.f.push(l)}return C(t,n),n=I(t),0<n.length?n:R(t)?M(t):t.h.toString()}return D(t,n)}function M(t){var n=t.a.toString(),e=n.length;if(e>0){for(var r="",i=0;e>i;i++)r=V(t,n.charAt(i));return t.j?D(t,r):t.h.toString()}return t.b.toString()}function G(t){var n,e=t.a.toString(),i=0;return 1!=h(t.g,10)?n=!1:(n=t.a.toString(),n="1"==n.charAt(0)&&"0"!=n.charAt(1)&&"1"!=n.charAt(1)),n?(i=1,t.b.a("1").a(" "),t.o=!0):null!=t.g.a[15]&&(n=new RegExp("^(?:"+h(t.g,15)+")"),n=e.match(n),null!=n&&null!=n[0]&&0<n[0].length&&(t.o=!0,i=n[0].length,t.b.a(e.substring(0,i)))),r(t.a),t.a.a(e.substring(i)),e.substring(0,i)}function H(t){var n=t.u.toString(),e=new RegExp("^(?:\\+|"+h(t.g,11)+")"),e=n.match(e);return null!=e&&null!=e[0]&&0<e[0].length?(t.o=!0,e=e[0].length,r(t.a),t.a.a(n.substring(e)),r(t.b),t.b.a(n.substring(0,e)),"+"!=n.charAt(0)&&t.b.a(" "),!0):!1}function P(t){if(0==t.a.b.length)return!1;var n,i=new e;t:{if(n=t.a.toString(),0!=n.length&&"0"!=n.charAt(0))for(var a,l=n.length,o=1;3>=o&&l>=o;++o)if(a=parseInt(n.substring(0,o),10),a in X){i.a(n.substring(o)),n=a;break t}n=0}return 0==n?!1:(r(t.a),t.a.a(i.toString()),i=$(n),"001"==i?t.g=N(t.F,""+n):i!=t.C&&(t.g=E(t,i)),t.b.a(""+n).a(" "),t.l="",!0)}function V(t,n){var e=t.m.toString();if(0<=e.substring(t.s).search(t.H)){var i=e.search(t.H),e=e.replace(t.H,n);return r(t.m),t.m.a(e),t.s=i,e.substring(0,t.s+1)}return 1==t.f.length&&(t.j=!1),t.v="",t.h.toString()}var q=this;e.prototype.b="",e.prototype.set=function(t){this.b=""+t},e.prototype.a=function(t,n,e){if(this.b+=String(t),null!=n)for(var r=1;r<arguments.length;r++)this.b+=arguments[r];return this},e.prototype.toString=function(){return this.b};var T=1,Y=2,k=3,J=4,K=6,L=16,O=18;f.prototype.set=function(t,n){m(this,t.b,n)},f.prototype.clone=function(){var t=new this.constructor;return t!=this&&(t.a={},t.b&&(t.b={}),c(t,this)),t};var Z;n(v,f);var z;n(d,f);var Q;n(_,f),v.prototype.i=function(){return Z||(Z=y(v,{0:{name:"NumberFormat",I:"i18n.phonenumbers.NumberFormat"},1:{name:"pattern",required:!0,c:9,type:String},2:{name:"format",required:!0,c:9,type:String},3:{name:"leading_digits_pattern",G:!0,c:9,type:String},4:{name:"national_prefix_formatting_rule",c:9,type:String},6:{name:"national_prefix_optional_when_formatting",c:8,type:Boolean},5:{name:"domestic_carrier_code_formatting_rule",c:9,type:String}})),Z},v.ctor=v,v.ctor.i=v.prototype.i,d.prototype.i=function(){return z||(z=y(d,{0:{name:"PhoneNumberDesc",I:"i18n.phonenumbers.PhoneNumberDesc"},2:{name:"national_number_pattern",c:9,type:String},3:{name:"possible_number_pattern",c:9,type:String},6:{name:"example_number",c:9,type:String},7:{name:"national_number_matcher_data",c:12,type:String},8:{name:"possible_number_matcher_data",c:12,type:String}})),z},d.ctor=d,d.ctor.i=d.prototype.i,_.prototype.i=function(){return Q||(Q=y(_,{0:{name:"PhoneMetadata",I:"i18n.phonenumbers.PhoneMetadata"},1:{name:"general_desc",c:11,type:d},2:{name:"fixed_line",c:11,type:d},3:{name:"mobile",c:11,type:d},4:{name:"toll_free",c:11,type:d},5:{name:"premium_rate",c:11,type:d},6:{name:"shared_cost",c:11,type:d},7:{name:"personal_number",c:11,type:d},8:{name:"voip",c:11,type:d},21:{name:"pager",c:11,type:d},25:{name:"uan",c:11,type:d},27:{name:"emergency",c:11,type:d},28:{name:"voicemail",c:11,type:d},24:{name:"no_international_dialling",c:11,type:d},9:{name:"id",required:!0,c:9,type:String},10:{name:"country_code",c:5,type:Number},11:{name:"international_prefix",c:9,type:String},17:{name:"preferred_international_prefix",c:9,type:String},12:{name:"national_prefix",c:9,type:String},13:{name:"preferred_extn_prefix",c:9,type:String},15:{name:"national_prefix_for_parsing",c:9,type:String},16:{name:"national_prefix_transform_rule",c:9,type:String},18:{name:"same_mobile_and_fixed_line_pattern",c:8,defaultValue:!1,type:Boolean},19:{name:"number_format",G:!0,c:11,type:v},20:{name:"intl_number_format",G:!0,c:11,type:v},22:{name:"main_country_for_code",c:8,defaultValue:!1,type:Boolean},23:{name:"leading_digits",c:9,type:String},26:{name:"leading_zero_possible",c:8,defaultValue:!1,type:Boolean}})),Q},_.ctor=_,_.ctor.i=_.prototype.i,S.prototype.a=function(t){throw new t.b,Error("Unimplemented")},S.prototype.b=function(t,n){if(11==t.a||10==t.a)return n instanceof f?n:this.a(t.j.prototype.i(),n);if(14==t.a){if("string"==typeof n&&W.test(n)){var e=Number(n);if(e>0)return e}return n}if(!t.h)return n;if(e=t.j,e===String){if("number"==typeof n)return String(n)}else if(e===Number&&"string"==typeof n&&("Infinity"===n||"-Infinity"===n||"NaN"===n||W.test(n)))return Number(n);return n};var W=/^-?[0-9]+$/;n(w,S),w.prototype.a=function(t,n){var e=new t.b;return e.g=this,e.a=n,e.b={},e},n(A,w),A.prototype.b=function(t,n){return 8==t.a?!!n:S.prototype.b.apply(this,arguments)},A.prototype.a=function(t,n){return A.M.a.call(this,t,n)};/* Copyright (C) 2010 The Libphonenumber Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var X={380:["UA"]},tt={UA:[null,[null,null,"[3-9]\\d{8}","\\d{5,9}"],[null,null,"(?:3[1-8]|4[13-8]|5[1-7]|6[12459])\\d{7}","\\d{5,9}",null,null,"311234567"],[null,null,"(?:39|50|6[36-8]|73|9[1-9])\\d{7}","\\d{9}",null,null,"391234567"],[null,null,"800\\d{6}","\\d{9}",null,null,"800123456"],[null,null,"900\\d{6}","\\d{9}",null,null,"900123456"],[null,null,"NA","NA"],[null,null,"NA","NA"],[null,null,"89\\d{7}","\\d{9}",null,null,"891234567"],"UA",380,"00","0",null,null,"0",null,"0~0",null,[[null,"([3-9]\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[38]9|4(?:[45][0-5]|87)|5(?:0|6[37]|7[37])|6[36-8]|73|9[1-9]","[38]9|4(?:[45][0-5]|87)|5(?:0|6(?:3[14-7]|7)|7[37])|6[36-8]|73|9[1-9]"],"0$1"],[null,"([3-689]\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["3[1-8]2|4[13678]2|5(?:[12457]2|6[24])|6(?:[49]2|[12][29]|5[24])|8[0-8]|90","3(?:[1-46-8]2[013-9]|52)|4(?:[1378]2|62[013-9])|5(?:[12457]2|6[24])|6(?:[49]2|[12][29]|5[24])|8[0-8]|90"],"0$1"],[null,"([3-6]\\d{3})(\\d{5})","$1 $2",["3(?:5[013-9]|[1-46-8])|4(?:[137][013-9]|6|[45][6-9]|8[4-6])|5(?:[1245][013-9]|6[0135-9]|3|7[4-6])|6(?:[49][013-9]|5[0135-9]|[12][13-8])","3(?:5[013-9]|[1-46-8](?:22|[013-9]))|4(?:[137][013-9]|6(?:[013-9]|22)|[45][6-9]|8[4-6])|5(?:[1245][013-9]|6(?:3[02389]|[015689])|3|7[4-6])|6(?:[49][013-9]|5[0135-9]|[12][13-8])"],"0$1"]],null,[null,null,"NA","NA"],null,null,[null,null,"NA","NA"],[null,null,"NA","NA"],null,null,[null,null,"NA","NA"]]};x.b=function(){return x.a?x.a:x.a=new x};var nt={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"},et=RegExp("[++]+"),rt=RegExp("([0-90-9٠-٩۰-۹])"),it=/^\(?\$1\)?$/,at=new _;m(at,11,"NA");var lt=/\[([^\[\]])*\]/g,ot=/\d(?=[^,}][^,}])/g,ut=RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*)+$"),st=/[- ]/;j.prototype.K=function(){this.B="",r(this.h),r(this.u),r(this.m),this.s=0,this.v="",r(this.b),this.l="",r(this.a),this.j=!0,this.w=this.o=this.D=!1,this.f=[],this.A=!1,this.g!=this.J&&(this.g=E(this,this.C))},j.prototype.L=function(t){return this.B=F(this,t)},t("Cleave.AsYouTypeFormatter",j),t("Cleave.AsYouTypeFormatter.prototype.inputDigit",j.prototype.L),t("Cleave.AsYouTypeFormatter.prototype.clear",j.prototype.K)}.call("object"==typeof global&&global?global:window);
pvnr0082t/cdnjs
ajax/libs/cleave.js/0.7.21/addons/cleave-phone.ua.js
JavaScript
mit
13,966
!function(){function t(t,n){var e=t.split("."),r=T;e[0]in r||!r.execScript||r.execScript("var "+e[0]);for(var i;e.length&&(i=e.shift());)e.length||void 0===n?r=r[i]?r[i]:r[i]={}:r[i]=n}function n(t,n){function e(){}e.prototype=n.prototype,t.M=n.prototype,t.prototype=new e,t.prototype.constructor=t,t.N=function(t,e,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return n.prototype[e].apply(t,i)}}function e(t,n){null!=t&&this.a.apply(this,arguments)}function r(t){t.b=""}function i(t,n){t.sort(n||a)}function a(t,n){return t>n?1:n>t?-1:0}function l(t){var n,e=[],r=0;for(n in t)e[r++]=t[n];return e}function o(t,n){this.b=t,this.a={};for(var e=0;e<n.length;e++){var r=n[e];this.a[r.b]=r}}function u(t){return t=l(t.a),i(t,function(t,n){return t.b-n.b}),t}function s(t,n){switch(this.b=t,this.g=!!n.G,this.a=n.c,this.j=n.type,this.h=!1,this.a){case k:case J:case K:case L:case O:case Y:case U:this.h=!0}this.f=n.defaultValue}function f(){this.a={},this.f=this.i().a,this.b=this.g=null}function c(t,n){for(var e=u(t.i()),r=0;r<e.length;r++){var i=e[r],a=i.b;if(null!=n.a[a]){t.b&&delete t.b[i.b];var l=11==i.a||10==i.a;if(i.g)for(var i=p(n,a)||[],o=0;o<i.length;o++){var s=t,f=a,h=l?i[o].clone():i[o];s.a[f]||(s.a[f]=[]),s.a[f].push(h),s.b&&delete s.b[f]}else i=p(n,a),l?(l=p(t,a))?c(l,i):m(t,a,i.clone()):m(t,a,i)}}}function p(t,n){var e=t.a[n];if(null==e)return null;if(t.g){if(!(n in t.b)){var r=t.g,i=t.f[n];if(null!=e)if(i.g){for(var a=[],l=0;l<e.length;l++)a[l]=r.b(i,e[l]);e=a}else e=r.b(i,e);return t.b[n]=e}return t.b[n]}return e}function h(t,n,e){var r=p(t,n);return t.f[n].g?r[e||0]:r}function g(t,n){var e;if(null!=t.a[n])e=h(t,n,void 0);else t:{if(e=t.f[n],void 0===e.f){var r=e.j;if(r===Boolean)e.f=!1;else if(r===Number)e.f=0;else{if(r!==String){e=new r;break t}e.f=e.h?"0":""}}e=e.f}return e}function b(t,n){return t.f[n].g?null!=t.a[n]?t.a[n].length:0:null!=t.a[n]?1:0}function m(t,n,e){t.a[n]=e,t.b&&(t.b[n]=e)}function y(t,n){var e,r=[];for(e in n)0!=e&&r.push(new s(e,n[e]));return new o(t,r)}/* Protocol Buffer 2 Copyright 2008 Google Inc. All other code copyright its respective owners. Copyright (C) 2010 The Libphonenumber Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function v(){f.call(this)}function _(){f.call(this)}function d(){f.call(this)}function S(){}function A(){}function w(){}/* Copyright (C) 2010 The Libphonenumber Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function N(){this.a={}}function x(t,n){if(null==n)return null;n=n.toUpperCase();var e=t.a[n];if(null==e){if(e=tt[n],null==e)return null;e=(new w).a(d.i(),e),t.a[n]=e}return e}function j(t){return t=X[t],null==t?"ZZ":t[0]}function C(t){this.H=RegExp(" "),this.B="",this.m=new e,this.v="",this.h=new e,this.u=new e,this.j=!0,this.w=this.o=this.D=!1,this.F=N.b(),this.s=0,this.b=new e,this.A=!1,this.l="",this.a=new e,this.f=[],this.C=t,this.J=this.g=E(this,this.C)}function E(t,n){var e;if(null!=n&&isNaN(n)&&n.toUpperCase()in tt){if(e=x(t.F,n),null==e)throw"Invalid region code: "+n;e=g(e,10)}else e=0;return e=x(t.F,j(e)),null!=e?e:at}function R(t){for(var n=t.f.length,e=0;n>e;++e){var i=t.f[e],a=g(i,1);if(t.v==a)return!1;var l;l=t;var o=i,u=g(o,1);if(-1!=u.indexOf("|"))l=!1;else{u=u.replace(lt,"\\d"),u=u.replace(ot,"\\d"),r(l.m);var s;s=l;var o=g(o,2),f="999999999999999".match(u)[0];f.length<s.a.b.length?s="":(s=f.replace(new RegExp(u,"g"),o),s=s.replace(RegExp("9","g")," ")),0<s.length?(l.m.a(s),l=!0):l=!1}if(l)return t.v=a,t.A=st.test(h(i,4)),t.s=0,!0}return t.j=!1}function F(t,n){for(var e=[],r=n.length-3,i=t.f.length,a=0;i>a;++a){var l=t.f[a];0==b(l,3)?e.push(t.f[a]):(l=h(l,3,Math.min(r,b(l,3)-1)),0==n.search(l)&&e.push(t.f[a]))}t.f=e}function $(t,n){t.h.a(n);var e=n;if(rt.test(e)||1==t.h.b.length&&et.test(e)){var i,e=n;"+"==e?(i=e,t.u.a(e)):(i=nt[e],t.u.a(i),t.a.a(i)),n=i}else t.j=!1,t.D=!0;if(!t.j){if(!t.D)if(H(t)){if(P(t))return B(t)}else if(0<t.l.length&&(e=t.a.toString(),r(t.a),t.a.a(t.l),t.a.a(e),e=t.b.toString(),i=e.lastIndexOf(t.l),r(t.b),t.b.a(e.substring(0,i))),t.l!=G(t))return t.b.a(" "),B(t);return t.h.toString()}switch(t.u.b.length){case 0:case 1:case 2:return t.h.toString();case 3:if(!H(t))return t.l=G(t),V(t);t.w=!0;default:return t.w?(P(t)&&(t.w=!1),t.b.toString()+t.a.toString()):0<t.f.length?(e=q(t,n),i=I(t),0<i.length?i:(F(t,t.a.toString()),R(t)?M(t):t.j?D(t,e):t.h.toString())):V(t)}}function B(t){return t.j=!0,t.w=!1,t.f=[],t.s=0,r(t.m),t.v="",V(t)}function I(t){for(var n=t.a.toString(),e=t.f.length,r=0;e>r;++r){var i=t.f[r],a=g(i,1);if(new RegExp("^(?:"+a+")$").test(n))return t.A=st.test(h(i,4)),n=n.replace(new RegExp(a,"g"),h(i,2)),D(t,n)}return""}function D(t,n){var e=t.b.b.length;return t.A&&e>0&&" "!=t.b.toString().charAt(e-1)?t.b+" "+n:t.b+n}function V(t){var n=t.a.toString();if(3<=n.length){for(var e=t.o&&0<b(t.g,20)?p(t.g,20)||[]:p(t.g,19)||[],r=e.length,i=0;r>i;++i){var a,l=e[i];(a=null==t.g.a[12]||t.o||h(l,6))||(a=g(l,4),a=0==a.length||it.test(a)),a&&ut.test(g(l,2))&&t.f.push(l)}return F(t,n),n=I(t),0<n.length?n:R(t)?M(t):t.h.toString()}return D(t,n)}function M(t){var n=t.a.toString(),e=n.length;if(e>0){for(var r="",i=0;e>i;i++)r=q(t,n.charAt(i));return t.j?D(t,r):t.h.toString()}return t.b.toString()}function G(t){var n,e=t.a.toString(),i=0;return 1!=h(t.g,10)?n=!1:(n=t.a.toString(),n="1"==n.charAt(0)&&"0"!=n.charAt(1)&&"1"!=n.charAt(1)),n?(i=1,t.b.a("1").a(" "),t.o=!0):null!=t.g.a[15]&&(n=new RegExp("^(?:"+h(t.g,15)+")"),n=e.match(n),null!=n&&null!=n[0]&&0<n[0].length&&(t.o=!0,i=n[0].length,t.b.a(e.substring(0,i)))),r(t.a),t.a.a(e.substring(i)),e.substring(0,i)}function H(t){var n=t.u.toString(),e=new RegExp("^(?:\\+|"+h(t.g,11)+")"),e=n.match(e);return null!=e&&null!=e[0]&&0<e[0].length?(t.o=!0,e=e[0].length,r(t.a),t.a.a(n.substring(e)),r(t.b),t.b.a(n.substring(0,e)),"+"!=n.charAt(0)&&t.b.a(" "),!0):!1}function P(t){if(0==t.a.b.length)return!1;var n,i=new e;t:{if(n=t.a.toString(),0!=n.length&&"0"!=n.charAt(0))for(var a,l=n.length,o=1;3>=o&&l>=o;++o)if(a=parseInt(n.substring(0,o),10),a in X){i.a(n.substring(o)),n=a;break t}n=0}return 0==n?!1:(r(t.a),t.a.a(i.toString()),i=j(n),"001"==i?t.g=x(t.F,""+n):i!=t.C&&(t.g=E(t,i)),t.b.a(""+n).a(" "),t.l="",!0)}function q(t,n){var e=t.m.toString();if(0<=e.substring(t.s).search(t.H)){var i=e.search(t.H),e=e.replace(t.H,n);return r(t.m),t.m.a(e),t.s=i,e.substring(0,t.s+1)}return 1==t.f.length&&(t.j=!1),t.v="",t.h.toString()}var T=this;e.prototype.b="",e.prototype.set=function(t){this.b=""+t},e.prototype.a=function(t,n,e){if(this.b+=String(t),null!=n)for(var r=1;r<arguments.length;r++)this.b+=arguments[r];return this},e.prototype.toString=function(){return this.b};var U=1,Y=2,k=3,J=4,K=6,L=16,O=18;f.prototype.set=function(t,n){m(this,t.b,n)},f.prototype.clone=function(){var t=new this.constructor;return t!=this&&(t.a={},t.b&&(t.b={}),c(t,this)),t};var Z;n(v,f);var z;n(_,f);var Q;n(d,f),v.prototype.i=function(){return Z||(Z=y(v,{0:{name:"NumberFormat",I:"i18n.phonenumbers.NumberFormat"},1:{name:"pattern",required:!0,c:9,type:String},2:{name:"format",required:!0,c:9,type:String},3:{name:"leading_digits_pattern",G:!0,c:9,type:String},4:{name:"national_prefix_formatting_rule",c:9,type:String},6:{name:"national_prefix_optional_when_formatting",c:8,type:Boolean},5:{name:"domestic_carrier_code_formatting_rule",c:9,type:String}})),Z},v.ctor=v,v.ctor.i=v.prototype.i,_.prototype.i=function(){return z||(z=y(_,{0:{name:"PhoneNumberDesc",I:"i18n.phonenumbers.PhoneNumberDesc"},2:{name:"national_number_pattern",c:9,type:String},3:{name:"possible_number_pattern",c:9,type:String},6:{name:"example_number",c:9,type:String},7:{name:"national_number_matcher_data",c:12,type:String},8:{name:"possible_number_matcher_data",c:12,type:String}})),z},_.ctor=_,_.ctor.i=_.prototype.i,d.prototype.i=function(){return Q||(Q=y(d,{0:{name:"PhoneMetadata",I:"i18n.phonenumbers.PhoneMetadata"},1:{name:"general_desc",c:11,type:_},2:{name:"fixed_line",c:11,type:_},3:{name:"mobile",c:11,type:_},4:{name:"toll_free",c:11,type:_},5:{name:"premium_rate",c:11,type:_},6:{name:"shared_cost",c:11,type:_},7:{name:"personal_number",c:11,type:_},8:{name:"voip",c:11,type:_},21:{name:"pager",c:11,type:_},25:{name:"uan",c:11,type:_},27:{name:"emergency",c:11,type:_},28:{name:"voicemail",c:11,type:_},24:{name:"no_international_dialling",c:11,type:_},9:{name:"id",required:!0,c:9,type:String},10:{name:"country_code",c:5,type:Number},11:{name:"international_prefix",c:9,type:String},17:{name:"preferred_international_prefix",c:9,type:String},12:{name:"national_prefix",c:9,type:String},13:{name:"preferred_extn_prefix",c:9,type:String},15:{name:"national_prefix_for_parsing",c:9,type:String},16:{name:"national_prefix_transform_rule",c:9,type:String},18:{name:"same_mobile_and_fixed_line_pattern",c:8,defaultValue:!1,type:Boolean},19:{name:"number_format",G:!0,c:11,type:v},20:{name:"intl_number_format",G:!0,c:11,type:v},22:{name:"main_country_for_code",c:8,defaultValue:!1,type:Boolean},23:{name:"leading_digits",c:9,type:String},26:{name:"leading_zero_possible",c:8,defaultValue:!1,type:Boolean}})),Q},d.ctor=d,d.ctor.i=d.prototype.i,S.prototype.a=function(t){throw new t.b,Error("Unimplemented")},S.prototype.b=function(t,n){if(11==t.a||10==t.a)return n instanceof f?n:this.a(t.j.prototype.i(),n);if(14==t.a){if("string"==typeof n&&W.test(n)){var e=Number(n);if(e>0)return e}return n}if(!t.h)return n;if(e=t.j,e===String){if("number"==typeof n)return String(n)}else if(e===Number&&"string"==typeof n&&("Infinity"===n||"-Infinity"===n||"NaN"===n||W.test(n)))return Number(n);return n};var W=/^-?[0-9]+$/;n(A,S),A.prototype.a=function(t,n){var e=new t.b;return e.g=this,e.a=n,e.b={},e},n(w,A),w.prototype.b=function(t,n){return 8==t.a?!!n:S.prototype.b.apply(this,arguments)},w.prototype.a=function(t,n){return w.M.a.call(this,t,n)};/* Copyright (C) 2010 The Libphonenumber Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var X={238:["CV"]},tt={CV:[null,[null,null,"[259]\\d{6}","\\d{7}"],[null,null,"2(?:2[1-7]|3[0-8]|4[12]|5[1256]|6\\d|7[1-3]|8[1-5])\\d{4}","\\d{7}",null,null,"2211234"],[null,null,"(?:9\\d|59)\\d{5}","\\d{7}",null,null,"9911234"],[null,null,"NA","NA"],[null,null,"NA","NA"],[null,null,"NA","NA"],[null,null,"NA","NA"],[null,null,"NA","NA"],"CV",238,"0",null,null,null,null,null,null,null,[[null,"(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3"]],null,[null,null,"NA","NA"],null,null,[null,null,"NA","NA"],[null,null,"NA","NA"],null,null,[null,null,"NA","NA"]]};N.b=function(){return N.a?N.a:N.a=new N};var nt={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"},et=RegExp("[++]+"),rt=RegExp("([0-90-9٠-٩۰-۹])"),it=/^\(?\$1\)?$/,at=new d;m(at,11,"NA");var lt=/\[([^\[\]])*\]/g,ot=/\d(?=[^,}][^,}])/g,ut=RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*)+$"),st=/[- ]/;C.prototype.K=function(){this.B="",r(this.h),r(this.u),r(this.m),this.s=0,this.v="",r(this.b),this.l="",r(this.a),this.j=!0,this.w=this.o=this.D=!1,this.f=[],this.A=!1,this.g!=this.J&&(this.g=E(this,this.C))},C.prototype.L=function(t){return this.B=$(this,t)},t("Cleave.AsYouTypeFormatter",C),t("Cleave.AsYouTypeFormatter.prototype.inputDigit",C.prototype.L),t("Cleave.AsYouTypeFormatter.prototype.clear",C.prototype.K)}.call("object"==typeof global&&global?global:window);
jonobr1/cdnjs
ajax/libs/cleave.js/0.7.20/addons/cleave-phone.cv.js
JavaScript
mit
13,110
!function(){function t(t,n){var e=t.split("."),r=q;e[0]in r||!r.execScript||r.execScript("var "+e[0]);for(var i;e.length&&(i=e.shift());)e.length||void 0===n?r=r[i]?r[i]:r[i]={}:r[i]=n}function n(t,n){function e(){}e.prototype=n.prototype,t.M=n.prototype,t.prototype=new e,t.prototype.constructor=t,t.N=function(t,e,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return n.prototype[e].apply(t,i)}}function e(t,n){null!=t&&this.a.apply(this,arguments)}function r(t){t.b=""}function i(t,n){t.sort(n||a)}function a(t,n){return t>n?1:n>t?-1:0}function l(t){var n,e=[],r=0;for(n in t)e[r++]=t[n];return e}function o(t,n){this.b=t,this.a={};for(var e=0;e<n.length;e++){var r=n[e];this.a[r.b]=r}}function u(t){return t=l(t.a),i(t,function(t,n){return t.b-n.b}),t}function s(t,n){switch(this.b=t,this.g=!!n.G,this.a=n.c,this.j=n.type,this.h=!1,this.a){case Y:case k:case J:case K:case O:case U:case T:this.h=!0}this.f=n.defaultValue}function f(){this.a={},this.f=this.i().a,this.b=this.g=null}function c(t,n){for(var e=u(t.i()),r=0;r<e.length;r++){var i=e[r],a=i.b;if(null!=n.a[a]){t.b&&delete t.b[i.b];var l=11==i.a||10==i.a;if(i.g)for(var i=p(n,a)||[],o=0;o<i.length;o++){var s=t,f=a,h=l?i[o].clone():i[o];s.a[f]||(s.a[f]=[]),s.a[f].push(h),s.b&&delete s.b[f]}else i=p(n,a),l?(l=p(t,a))?c(l,i):m(t,a,i.clone()):m(t,a,i)}}}function p(t,n){var e=t.a[n];if(null==e)return null;if(t.g){if(!(n in t.b)){var r=t.g,i=t.f[n];if(null!=e)if(i.g){for(var a=[],l=0;l<e.length;l++)a[l]=r.b(i,e[l]);e=a}else e=r.b(i,e);return t.b[n]=e}return t.b[n]}return e}function h(t,n,e){var r=p(t,n);return t.f[n].g?r[e||0]:r}function g(t,n){var e;if(null!=t.a[n])e=h(t,n,void 0);else t:{if(e=t.f[n],void 0===e.f){var r=e.j;if(r===Boolean)e.f=!1;else if(r===Number)e.f=0;else{if(r!==String){e=new r;break t}e.f=e.h?"0":""}}e=e.f}return e}function b(t,n){return t.f[n].g?null!=t.a[n]?t.a[n].length:0:null!=t.a[n]?1:0}function m(t,n,e){t.a[n]=e,t.b&&(t.b[n]=e)}function y(t,n){var e,r=[];for(e in n)0!=e&&r.push(new s(e,n[e]));return new o(t,r)}/* Protocol Buffer 2 Copyright 2008 Google Inc. All other code copyright its respective owners. Copyright (C) 2010 The Libphonenumber Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function v(){f.call(this)}function _(){f.call(this)}function d(){f.call(this)}function S(){}function A(){}function w(){}/* Copyright (C) 2010 The Libphonenumber Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function N(){this.a={}}function x(t,n){if(null==n)return null;n=n.toUpperCase();var e=t.a[n];if(null==e){if(e=tt[n],null==e)return null;e=(new w).a(d.i(),e),t.a[n]=e}return e}function j(t){return t=X[t],null==t?"ZZ":t[0]}function B(t){this.H=RegExp(" "),this.B="",this.m=new e,this.v="",this.h=new e,this.u=new e,this.j=!0,this.w=this.o=this.D=!1,this.F=N.b(),this.s=0,this.b=new e,this.A=!1,this.l="",this.a=new e,this.f=[],this.C=t,this.J=this.g=E(this,this.C)}function E(t,n){var e;if(null!=n&&isNaN(n)&&n.toUpperCase()in tt){if(e=x(t.F,n),null==e)throw"Invalid region code: "+n;e=g(e,10)}else e=0;return e=x(t.F,j(e)),null!=e?e:at}function F(t){for(var n=t.f.length,e=0;n>e;++e){var i=t.f[e],a=g(i,1);if(t.v==a)return!1;var l;l=t;var o=i,u=g(o,1);if(-1!=u.indexOf("|"))l=!1;else{u=u.replace(lt,"\\d"),u=u.replace(ot,"\\d"),r(l.m);var s;s=l;var o=g(o,2),f="999999999999999".match(u)[0];f.length<s.a.b.length?s="":(s=f.replace(new RegExp(u,"g"),o),s=s.replace(RegExp("9","g")," ")),0<s.length?(l.m.a(s),l=!0):l=!1}if(l)return t.v=a,t.A=st.test(h(i,4)),t.s=0,!0}return t.j=!1}function R(t,n){for(var e=[],r=n.length-3,i=t.f.length,a=0;i>a;++a){var l=t.f[a];0==b(l,3)?e.push(t.f[a]):(l=h(l,3,Math.min(r,b(l,3)-1)),0==n.search(l)&&e.push(t.f[a]))}t.f=e}function C(t,n){t.h.a(n);var e=n;if(rt.test(e)||1==t.h.b.length&&et.test(e)){var i,e=n;"+"==e?(i=e,t.u.a(e)):(i=nt[e],t.u.a(i),t.a.a(i)),n=i}else t.j=!1,t.D=!0;if(!t.j){if(!t.D)if(P(t)){if(H(t))return I(t)}else if(0<t.l.length&&(e=t.a.toString(),r(t.a),t.a.a(t.l),t.a.a(e),e=t.b.toString(),i=e.lastIndexOf(t.l),r(t.b),t.b.a(e.substring(0,i))),t.l!=L(t))return t.b.a(" "),I(t);return t.h.toString()}switch(t.u.b.length){case 0:case 1:case 2:return t.h.toString();case 3:if(!P(t))return t.l=L(t),$(t);t.w=!0;default:return t.w?(H(t)&&(t.w=!1),t.b.toString()+t.a.toString()):0<t.f.length?(e=V(t,n),i=D(t),0<i.length?i:(R(t,t.a.toString()),F(t)?G(t):t.j?M(t,e):t.h.toString())):$(t)}}function I(t){return t.j=!0,t.w=!1,t.f=[],t.s=0,r(t.m),t.v="",$(t)}function D(t){for(var n=t.a.toString(),e=t.f.length,r=0;e>r;++r){var i=t.f[r],a=g(i,1);if(new RegExp("^(?:"+a+")$").test(n))return t.A=st.test(h(i,4)),n=n.replace(new RegExp(a,"g"),h(i,2)),M(t,n)}return""}function M(t,n){var e=t.b.b.length;return t.A&&e>0&&" "!=t.b.toString().charAt(e-1)?t.b+" "+n:t.b+n}function $(t){var n=t.a.toString();if(3<=n.length){for(var e=t.o&&0<b(t.g,20)?p(t.g,20)||[]:p(t.g,19)||[],r=e.length,i=0;r>i;++i){var a,l=e[i];(a=null==t.g.a[12]||t.o||h(l,6))||(a=g(l,4),a=0==a.length||it.test(a)),a&&ut.test(g(l,2))&&t.f.push(l)}return R(t,n),n=D(t),0<n.length?n:F(t)?G(t):t.h.toString()}return M(t,n)}function G(t){var n=t.a.toString(),e=n.length;if(e>0){for(var r="",i=0;e>i;i++)r=V(t,n.charAt(i));return t.j?M(t,r):t.h.toString()}return t.b.toString()}function L(t){var n,e=t.a.toString(),i=0;return 1!=h(t.g,10)?n=!1:(n=t.a.toString(),n="1"==n.charAt(0)&&"0"!=n.charAt(1)&&"1"!=n.charAt(1)),n?(i=1,t.b.a("1").a(" "),t.o=!0):null!=t.g.a[15]&&(n=new RegExp("^(?:"+h(t.g,15)+")"),n=e.match(n),null!=n&&null!=n[0]&&0<n[0].length&&(t.o=!0,i=n[0].length,t.b.a(e.substring(0,i)))),r(t.a),t.a.a(e.substring(i)),e.substring(0,i)}function P(t){var n=t.u.toString(),e=new RegExp("^(?:\\+|"+h(t.g,11)+")"),e=n.match(e);return null!=e&&null!=e[0]&&0<e[0].length?(t.o=!0,e=e[0].length,r(t.a),t.a.a(n.substring(e)),r(t.b),t.b.a(n.substring(0,e)),"+"!=n.charAt(0)&&t.b.a(" "),!0):!1}function H(t){if(0==t.a.b.length)return!1;var n,i=new e;t:{if(n=t.a.toString(),0!=n.length&&"0"!=n.charAt(0))for(var a,l=n.length,o=1;3>=o&&l>=o;++o)if(a=parseInt(n.substring(0,o),10),a in X){i.a(n.substring(o)),n=a;break t}n=0}return 0==n?!1:(r(t.a),t.a.a(i.toString()),i=j(n),"001"==i?t.g=x(t.F,""+n):i!=t.C&&(t.g=E(t,i)),t.b.a(""+n).a(" "),t.l="",!0)}function V(t,n){var e=t.m.toString();if(0<=e.substring(t.s).search(t.H)){var i=e.search(t.H),e=e.replace(t.H,n);return r(t.m),t.m.a(e),t.s=i,e.substring(0,t.s+1)}return 1==t.f.length&&(t.j=!1),t.v="",t.h.toString()}var q=this;e.prototype.b="",e.prototype.set=function(t){this.b=""+t},e.prototype.a=function(t,n,e){if(this.b+=String(t),null!=n)for(var r=1;r<arguments.length;r++)this.b+=arguments[r];return this},e.prototype.toString=function(){return this.b};var T=1,U=2,Y=3,k=4,J=6,K=16,O=18;f.prototype.set=function(t,n){m(this,t.b,n)},f.prototype.clone=function(){var t=new this.constructor;return t!=this&&(t.a={},t.b&&(t.b={}),c(t,this)),t};var Z;n(v,f);var z;n(_,f);var Q;n(d,f),v.prototype.i=function(){return Z||(Z=y(v,{0:{name:"NumberFormat",I:"i18n.phonenumbers.NumberFormat"},1:{name:"pattern",required:!0,c:9,type:String},2:{name:"format",required:!0,c:9,type:String},3:{name:"leading_digits_pattern",G:!0,c:9,type:String},4:{name:"national_prefix_formatting_rule",c:9,type:String},6:{name:"national_prefix_optional_when_formatting",c:8,type:Boolean},5:{name:"domestic_carrier_code_formatting_rule",c:9,type:String}})),Z},v.ctor=v,v.ctor.i=v.prototype.i,_.prototype.i=function(){return z||(z=y(_,{0:{name:"PhoneNumberDesc",I:"i18n.phonenumbers.PhoneNumberDesc"},2:{name:"national_number_pattern",c:9,type:String},3:{name:"possible_number_pattern",c:9,type:String},6:{name:"example_number",c:9,type:String},7:{name:"national_number_matcher_data",c:12,type:String},8:{name:"possible_number_matcher_data",c:12,type:String}})),z},_.ctor=_,_.ctor.i=_.prototype.i,d.prototype.i=function(){return Q||(Q=y(d,{0:{name:"PhoneMetadata",I:"i18n.phonenumbers.PhoneMetadata"},1:{name:"general_desc",c:11,type:_},2:{name:"fixed_line",c:11,type:_},3:{name:"mobile",c:11,type:_},4:{name:"toll_free",c:11,type:_},5:{name:"premium_rate",c:11,type:_},6:{name:"shared_cost",c:11,type:_},7:{name:"personal_number",c:11,type:_},8:{name:"voip",c:11,type:_},21:{name:"pager",c:11,type:_},25:{name:"uan",c:11,type:_},27:{name:"emergency",c:11,type:_},28:{name:"voicemail",c:11,type:_},24:{name:"no_international_dialling",c:11,type:_},9:{name:"id",required:!0,c:9,type:String},10:{name:"country_code",c:5,type:Number},11:{name:"international_prefix",c:9,type:String},17:{name:"preferred_international_prefix",c:9,type:String},12:{name:"national_prefix",c:9,type:String},13:{name:"preferred_extn_prefix",c:9,type:String},15:{name:"national_prefix_for_parsing",c:9,type:String},16:{name:"national_prefix_transform_rule",c:9,type:String},18:{name:"same_mobile_and_fixed_line_pattern",c:8,defaultValue:!1,type:Boolean},19:{name:"number_format",G:!0,c:11,type:v},20:{name:"intl_number_format",G:!0,c:11,type:v},22:{name:"main_country_for_code",c:8,defaultValue:!1,type:Boolean},23:{name:"leading_digits",c:9,type:String},26:{name:"leading_zero_possible",c:8,defaultValue:!1,type:Boolean}})),Q},d.ctor=d,d.ctor.i=d.prototype.i,S.prototype.a=function(t){throw new t.b,Error("Unimplemented")},S.prototype.b=function(t,n){if(11==t.a||10==t.a)return n instanceof f?n:this.a(t.j.prototype.i(),n);if(14==t.a){if("string"==typeof n&&W.test(n)){var e=Number(n);if(e>0)return e}return n}if(!t.h)return n;if(e=t.j,e===String){if("number"==typeof n)return String(n)}else if(e===Number&&"string"==typeof n&&("Infinity"===n||"-Infinity"===n||"NaN"===n||W.test(n)))return Number(n);return n};var W=/^-?[0-9]+$/;n(A,S),A.prototype.a=function(t,n){var e=new t.b;return e.g=this,e.a=n,e.b={},e},n(w,A),w.prototype.b=function(t,n){return 8==t.a?!!n:S.prototype.b.apply(this,arguments)},w.prototype.a=function(t,n){return w.M.a.call(this,t,n)};/* Copyright (C) 2010 The Libphonenumber Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var X={590:["GP","BL","MF"]},tt={BL:[null,[null,null,"[56]\\d{8}","\\d{9}"],[null,null,"590(?:2[7-9]|5[12]|87)\\d{4}","\\d{9}",null,null,"590271234"],[null,null,"690(?:0[0-7]|[1-9]\\d)\\d{4}","\\d{9}",null,null,"690301234"],[null,null,"NA","NA"],[null,null,"NA","NA"],[null,null,"NA","NA"],[null,null,"NA","NA"],[null,null,"NA","NA"],"BL",590,"00","0",null,null,"0",null,null,null,null,null,[null,null,"NA","NA"],null,null,[null,null,"NA","NA"],[null,null,"NA","NA"],null,null,[null,null,"NA","NA"]]};N.b=function(){return N.a?N.a:N.a=new N};var nt={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"},et=RegExp("[++]+"),rt=RegExp("([0-90-9٠-٩۰-۹])"),it=/^\(?\$1\)?$/,at=new d;m(at,11,"NA");var lt=/\[([^\[\]])*\]/g,ot=/\d(?=[^,}][^,}])/g,ut=RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*)+$"),st=/[- ]/;B.prototype.K=function(){this.B="",r(this.h),r(this.u),r(this.m),this.s=0,this.v="",r(this.b),this.l="",r(this.a),this.j=!0,this.w=this.o=this.D=!1,this.f=[],this.A=!1,this.g!=this.J&&(this.g=E(this,this.C))},B.prototype.L=function(t){return this.B=C(this,t)},t("Cleave.AsYouTypeFormatter",B),t("Cleave.AsYouTypeFormatter.prototype.inputDigit",B.prototype.L),t("Cleave.AsYouTypeFormatter.prototype.clear",B.prototype.K)}.call("object"==typeof global&&global?global:window);
sufuf3/cdnjs
ajax/libs/cleave.js/0.7.17/addons/cleave-phone.bl.js
JavaScript
mit
13,062
!function(){function t(t,n){var e=t.split("."),r=q;e[0]in r||!r.execScript||r.execScript("var "+e[0]);for(var i;e.length&&(i=e.shift());)e.length||void 0===n?r=r[i]?r[i]:r[i]={}:r[i]=n}function n(t,n){function e(){}e.prototype=n.prototype,t.M=n.prototype,t.prototype=new e,t.prototype.constructor=t,t.N=function(t,e,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return n.prototype[e].apply(t,i)}}function e(t,n){null!=t&&this.a.apply(this,arguments)}function r(t){t.b=""}function i(t,n){t.sort(n||a)}function a(t,n){return t>n?1:n>t?-1:0}function l(t){var n,e=[],r=0;for(n in t)e[r++]=t[n];return e}function o(t,n){this.b=t,this.a={};for(var e=0;e<n.length;e++){var r=n[e];this.a[r.b]=r}}function u(t){return t=l(t.a),i(t,function(t,n){return t.b-n.b}),t}function s(t,n){switch(this.b=t,this.g=!!n.G,this.a=n.c,this.j=n.type,this.h=!1,this.a){case Y:case k:case J:case L:case O:case U:case T:this.h=!0}this.f=n.defaultValue}function f(){this.a={},this.f=this.i().a,this.b=this.g=null}function c(t,n){for(var e=u(t.i()),r=0;r<e.length;r++){var i=e[r],a=i.b;if(null!=n.a[a]){t.b&&delete t.b[i.b];var l=11==i.a||10==i.a;if(i.g)for(var i=p(n,a)||[],o=0;o<i.length;o++){var s=t,f=a,h=l?i[o].clone():i[o];s.a[f]||(s.a[f]=[]),s.a[f].push(h),s.b&&delete s.b[f]}else i=p(n,a),l?(l=p(t,a))?c(l,i):m(t,a,i.clone()):m(t,a,i)}}}function p(t,n){var e=t.a[n];if(null==e)return null;if(t.g){if(!(n in t.b)){var r=t.g,i=t.f[n];if(null!=e)if(i.g){for(var a=[],l=0;l<e.length;l++)a[l]=r.b(i,e[l]);e=a}else e=r.b(i,e);return t.b[n]=e}return t.b[n]}return e}function h(t,n,e){var r=p(t,n);return t.f[n].g?r[e||0]:r}function g(t,n){var e;if(null!=t.a[n])e=h(t,n,void 0);else t:{if(e=t.f[n],void 0===e.f){var r=e.j;if(r===Boolean)e.f=!1;else if(r===Number)e.f=0;else{if(r!==String){e=new r;break t}e.f=e.h?"0":""}}e=e.f}return e}function b(t,n){return t.f[n].g?null!=t.a[n]?t.a[n].length:0:null!=t.a[n]?1:0}function m(t,n,e){t.a[n]=e,t.b&&(t.b[n]=e)}function y(t,n){var e,r=[];for(e in n)0!=e&&r.push(new s(e,n[e]));return new o(t,r)}/* Protocol Buffer 2 Copyright 2008 Google Inc. All other code copyright its respective owners. Copyright (C) 2010 The Libphonenumber Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function v(){f.call(this)}function d(){f.call(this)}function _(){f.call(this)}function S(){}function w(){}function A(){}/* Copyright (C) 2010 The Libphonenumber Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ function N(){this.a={}}function x(t,n){if(null==n)return null;n=n.toUpperCase();var e=t.a[n];if(null==e){if(e=tt[n],null==e)return null;e=(new A).a(_.i(),e),t.a[n]=e}return e}function j(t){return t=X[t],null==t?"ZZ":t[0]}function E(t){this.H=RegExp(" "),this.B="",this.m=new e,this.v="",this.h=new e,this.u=new e,this.j=!0,this.w=this.o=this.D=!1,this.F=N.b(),this.s=0,this.b=new e,this.A=!1,this.l="",this.a=new e,this.f=[],this.C=t,this.J=this.g=D(this,this.C)}function D(t,n){var e;if(null!=n&&isNaN(n)&&n.toUpperCase()in tt){if(e=x(t.F,n),null==e)throw"Invalid region code: "+n;e=g(e,10)}else e=0;return e=x(t.F,j(e)),null!=e?e:at}function R(t){for(var n=t.f.length,e=0;n>e;++e){var i=t.f[e],a=g(i,1);if(t.v==a)return!1;var l;l=t;var o=i,u=g(o,1);if(-1!=u.indexOf("|"))l=!1;else{u=u.replace(lt,"\\d"),u=u.replace(ot,"\\d"),r(l.m);var s;s=l;var o=g(o,2),f="999999999999999".match(u)[0];f.length<s.a.b.length?s="":(s=f.replace(new RegExp(u,"g"),o),s=s.replace(RegExp("9","g")," ")),0<s.length?(l.m.a(s),l=!0):l=!1}if(l)return t.v=a,t.A=st.test(h(i,4)),t.s=0,!0}return t.j=!1}function $(t,n){for(var e=[],r=n.length-3,i=t.f.length,a=0;i>a;++a){var l=t.f[a];0==b(l,3)?e.push(t.f[a]):(l=h(l,3,Math.min(r,b(l,3)-1)),0==n.search(l)&&e.push(t.f[a]))}t.f=e}function C(t,n){t.h.a(n);var e=n;if(rt.test(e)||1==t.h.b.length&&et.test(e)){var i,e=n;"+"==e?(i=e,t.u.a(e)):(i=nt[e],t.u.a(i),t.a.a(i)),n=i}else t.j=!1,t.D=!0;if(!t.j){if(!t.D)if(H(t)){if(P(t))return F(t)}else if(0<t.l.length&&(e=t.a.toString(),r(t.a),t.a.a(t.l),t.a.a(e),e=t.b.toString(),i=e.lastIndexOf(t.l),r(t.b),t.b.a(e.substring(0,i))),t.l!=G(t))return t.b.a(" "),F(t);return t.h.toString()}switch(t.u.b.length){case 0:case 1:case 2:return t.h.toString();case 3:if(!H(t))return t.l=G(t),K(t);t.w=!0;default:return t.w?(P(t)&&(t.w=!1),t.b.toString()+t.a.toString()):0<t.f.length?(e=V(t,n),i=B(t),0<i.length?i:($(t,t.a.toString()),R(t)?M(t):t.j?I(t,e):t.h.toString())):K(t)}}function F(t){return t.j=!0,t.w=!1,t.f=[],t.s=0,r(t.m),t.v="",K(t)}function B(t){for(var n=t.a.toString(),e=t.f.length,r=0;e>r;++r){var i=t.f[r],a=g(i,1);if(new RegExp("^(?:"+a+")$").test(n))return t.A=st.test(h(i,4)),n=n.replace(new RegExp(a,"g"),h(i,2)),I(t,n)}return""}function I(t,n){var e=t.b.b.length;return t.A&&e>0&&" "!=t.b.toString().charAt(e-1)?t.b+" "+n:t.b+n}function K(t){var n=t.a.toString();if(3<=n.length){for(var e=t.o&&0<b(t.g,20)?p(t.g,20)||[]:p(t.g,19)||[],r=e.length,i=0;r>i;++i){var a,l=e[i];(a=null==t.g.a[12]||t.o||h(l,6))||(a=g(l,4),a=0==a.length||it.test(a)),a&&ut.test(g(l,2))&&t.f.push(l)}return $(t,n),n=B(t),0<n.length?n:R(t)?M(t):t.h.toString()}return I(t,n)}function M(t){var n=t.a.toString(),e=n.length;if(e>0){for(var r="",i=0;e>i;i++)r=V(t,n.charAt(i));return t.j?I(t,r):t.h.toString()}return t.b.toString()}function G(t){var n,e=t.a.toString(),i=0;return 1!=h(t.g,10)?n=!1:(n=t.a.toString(),n="1"==n.charAt(0)&&"0"!=n.charAt(1)&&"1"!=n.charAt(1)),n?(i=1,t.b.a("1").a(" "),t.o=!0):null!=t.g.a[15]&&(n=new RegExp("^(?:"+h(t.g,15)+")"),n=e.match(n),null!=n&&null!=n[0]&&0<n[0].length&&(t.o=!0,i=n[0].length,t.b.a(e.substring(0,i)))),r(t.a),t.a.a(e.substring(i)),e.substring(0,i)}function H(t){var n=t.u.toString(),e=new RegExp("^(?:\\+|"+h(t.g,11)+")"),e=n.match(e);return null!=e&&null!=e[0]&&0<e[0].length?(t.o=!0,e=e[0].length,r(t.a),t.a.a(n.substring(e)),r(t.b),t.b.a(n.substring(0,e)),"+"!=n.charAt(0)&&t.b.a(" "),!0):!1}function P(t){if(0==t.a.b.length)return!1;var n,i=new e;t:{if(n=t.a.toString(),0!=n.length&&"0"!=n.charAt(0))for(var a,l=n.length,o=1;3>=o&&l>=o;++o)if(a=parseInt(n.substring(0,o),10),a in X){i.a(n.substring(o)),n=a;break t}n=0}return 0==n?!1:(r(t.a),t.a.a(i.toString()),i=j(n),"001"==i?t.g=x(t.F,""+n):i!=t.C&&(t.g=D(t,i)),t.b.a(""+n).a(" "),t.l="",!0)}function V(t,n){var e=t.m.toString();if(0<=e.substring(t.s).search(t.H)){var i=e.search(t.H),e=e.replace(t.H,n);return r(t.m),t.m.a(e),t.s=i,e.substring(0,t.s+1)}return 1==t.f.length&&(t.j=!1),t.v="",t.h.toString()}var q=this;e.prototype.b="",e.prototype.set=function(t){this.b=""+t},e.prototype.a=function(t,n,e){if(this.b+=String(t),null!=n)for(var r=1;r<arguments.length;r++)this.b+=arguments[r];return this},e.prototype.toString=function(){return this.b};var T=1,U=2,Y=3,k=4,J=6,L=16,O=18;f.prototype.set=function(t,n){m(this,t.b,n)},f.prototype.clone=function(){var t=new this.constructor;return t!=this&&(t.a={},t.b&&(t.b={}),c(t,this)),t};var Z;n(v,f);var z;n(d,f);var Q;n(_,f),v.prototype.i=function(){return Z||(Z=y(v,{0:{name:"NumberFormat",I:"i18n.phonenumbers.NumberFormat"},1:{name:"pattern",required:!0,c:9,type:String},2:{name:"format",required:!0,c:9,type:String},3:{name:"leading_digits_pattern",G:!0,c:9,type:String},4:{name:"national_prefix_formatting_rule",c:9,type:String},6:{name:"national_prefix_optional_when_formatting",c:8,type:Boolean},5:{name:"domestic_carrier_code_formatting_rule",c:9,type:String}})),Z},v.ctor=v,v.ctor.i=v.prototype.i,d.prototype.i=function(){return z||(z=y(d,{0:{name:"PhoneNumberDesc",I:"i18n.phonenumbers.PhoneNumberDesc"},2:{name:"national_number_pattern",c:9,type:String},3:{name:"possible_number_pattern",c:9,type:String},6:{name:"example_number",c:9,type:String},7:{name:"national_number_matcher_data",c:12,type:String},8:{name:"possible_number_matcher_data",c:12,type:String}})),z},d.ctor=d,d.ctor.i=d.prototype.i,_.prototype.i=function(){return Q||(Q=y(_,{0:{name:"PhoneMetadata",I:"i18n.phonenumbers.PhoneMetadata"},1:{name:"general_desc",c:11,type:d},2:{name:"fixed_line",c:11,type:d},3:{name:"mobile",c:11,type:d},4:{name:"toll_free",c:11,type:d},5:{name:"premium_rate",c:11,type:d},6:{name:"shared_cost",c:11,type:d},7:{name:"personal_number",c:11,type:d},8:{name:"voip",c:11,type:d},21:{name:"pager",c:11,type:d},25:{name:"uan",c:11,type:d},27:{name:"emergency",c:11,type:d},28:{name:"voicemail",c:11,type:d},24:{name:"no_international_dialling",c:11,type:d},9:{name:"id",required:!0,c:9,type:String},10:{name:"country_code",c:5,type:Number},11:{name:"international_prefix",c:9,type:String},17:{name:"preferred_international_prefix",c:9,type:String},12:{name:"national_prefix",c:9,type:String},13:{name:"preferred_extn_prefix",c:9,type:String},15:{name:"national_prefix_for_parsing",c:9,type:String},16:{name:"national_prefix_transform_rule",c:9,type:String},18:{name:"same_mobile_and_fixed_line_pattern",c:8,defaultValue:!1,type:Boolean},19:{name:"number_format",G:!0,c:11,type:v},20:{name:"intl_number_format",G:!0,c:11,type:v},22:{name:"main_country_for_code",c:8,defaultValue:!1,type:Boolean},23:{name:"leading_digits",c:9,type:String},26:{name:"leading_zero_possible",c:8,defaultValue:!1,type:Boolean}})),Q},_.ctor=_,_.ctor.i=_.prototype.i,S.prototype.a=function(t){throw new t.b,Error("Unimplemented")},S.prototype.b=function(t,n){if(11==t.a||10==t.a)return n instanceof f?n:this.a(t.j.prototype.i(),n);if(14==t.a){if("string"==typeof n&&W.test(n)){var e=Number(n);if(e>0)return e}return n}if(!t.h)return n;if(e=t.j,e===String){if("number"==typeof n)return String(n)}else if(e===Number&&"string"==typeof n&&("Infinity"===n||"-Infinity"===n||"NaN"===n||W.test(n)))return Number(n);return n};var W=/^-?[0-9]+$/;n(w,S),w.prototype.a=function(t,n){var e=new t.b;return e.g=this,e.a=n,e.b={},e},n(A,w),A.prototype.b=function(t,n){return 8==t.a?!!n:S.prototype.b.apply(this,arguments)},A.prototype.a=function(t,n){return A.M.a.call(this,t,n)};/* Copyright (C) 2010 The Libphonenumber Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ var X={45:["DK"]},tt={DK:[null,[null,null,"[2-9]\\d{7}","\\d{8}"],[null,null,"(?:[2-7]\\d|8[126-9]|9[1-36-9])\\d{6}","\\d{8}",null,null,"32123456"],[null,null,"(?:[2-7]\\d|8[126-9]|9[1-36-9])\\d{6}","\\d{8}",null,null,"20123456"],[null,null,"80\\d{6}","\\d{8}",null,null,"80123456"],[null,null,"90\\d{6}","\\d{8}",null,null,"90123456"],[null,null,"NA","NA"],[null,null,"NA","NA"],[null,null,"NA","NA"],"DK",45,"00",null,null,null,null,null,null,1,[[null,"(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4"]],null,[null,null,"NA","NA"],null,null,[null,null,"NA","NA"],[null,null,"NA","NA"],null,null,[null,null,"NA","NA"]]};N.b=function(){return N.a?N.a:N.a=new N};var nt={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"},et=RegExp("[++]+"),rt=RegExp("([0-90-9٠-٩۰-۹])"),it=/^\(?\$1\)?$/,at=new _;m(at,11,"NA");var lt=/\[([^\[\]])*\]/g,ot=/\d(?=[^,}][^,}])/g,ut=RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*)+$"),st=/[- ]/;E.prototype.K=function(){this.B="",r(this.h),r(this.u),r(this.m),this.s=0,this.v="",r(this.b),this.l="",r(this.a),this.j=!0,this.w=this.o=this.D=!1,this.f=[],this.A=!1,this.g!=this.J&&(this.g=D(this,this.C))},E.prototype.L=function(t){return this.B=C(this,t)},t("Cleave.AsYouTypeFormatter",E),t("Cleave.AsYouTypeFormatter.prototype.inputDigit",E.prototype.L),t("Cleave.AsYouTypeFormatter.prototype.clear",E.prototype.K)}.call("object"==typeof global&&global?global:window);
jdh8/cdnjs
ajax/libs/cleave.js/0.7.16/addons/cleave-phone.dk.js
JavaScript
mit
13,181
/* * /MathJax/extensions/TeX/autobold.js * * Copyright (c) 2009-2015 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ MathJax.Extension["TeX/autobold"]={version:"2.5.0"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var a=MathJax.InputJax.TeX;a.prefilterHooks.Add(function(d){var c=d.script.parentNode.insertBefore(document.createElement("span"),d.script);c.visibility="hidden";c.style.fontFamily="Times, serif";c.appendChild(document.createTextNode("ABCXYZabcxyz"));var b=c.offsetWidth;c.style.fontWeight="bold";if(b&&c.offsetWidth===b){d.math="\\boldsymbol{"+d.math+"}"}c.parentNode.removeChild(c)});MathJax.Hub.Startup.signal.Post("TeX autobold Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/autobold.js");
zimbatm/cdnjs
ajax/libs/mathjax/2.5.3/extensions/TeX/autobold.js
JavaScript
mit
1,290
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * CodeIgniter * * An open source application development framework for PHP 5.1.6 or newer * * @package CodeIgniter * @author ExpressionEngine Dev Team * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. * @license http://codeigniter.com/user_guide/license.html * @link http://codeigniter.com * @since Version 1.0 * @filesource */ // ------------------------------------------------------------------------ /** * CodeIgniter Text Helpers * * @package CodeIgniter * @subpackage Helpers * @category Helpers * @author ExpressionEngine Dev Team * @link http://codeigniter.com/user_guide/helpers/text_helper.html */ // ------------------------------------------------------------------------ /** * Word Limiter * * Limits a string to X number of words. * * @access public * @param string * @param integer * @param string the end character. Usually an ellipsis * @return string */ if ( ! function_exists('word_limiter')) { function word_limiter($str, $limit = 100, $end_char = '&#8230;') { if (trim($str) == '') { return $str; } preg_match('/^\s*+(?:\S++\s*+){1,'.(int) $limit.'}/', $str, $matches); if (strlen($str) == strlen($matches[0])) { $end_char = ''; } return rtrim($matches[0]).$end_char; } } // ------------------------------------------------------------------------ /** * Character Limiter * * Limits the string based on the character count. Preserves complete words * so the character count may not be exactly as specified. * * @access public * @param string * @param integer * @param string the end character. Usually an ellipsis * @return string */ if ( ! function_exists('character_limiter')) { function character_limiter($str, $n = 500, $end_char = '&#8230;') { if (strlen($str) < $n) { return $str; } $str = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str)); if (strlen($str) <= $n) { return $str; } $out = ""; foreach (explode(' ', trim($str)) as $val) { $out .= $val.' '; if (strlen($out) >= $n) { $out = trim($out); return (strlen($out) == strlen($str)) ? $out : $out.$end_char; } } } } // ------------------------------------------------------------------------ /** * High ASCII to Entities * * Converts High ascii text and MS Word special characters to character entities * * @access public * @param string * @return string */ if ( ! function_exists('ascii_to_entities')) { function ascii_to_entities($str) { $count = 1; $out = ''; $temp = array(); for ($i = 0, $s = strlen($str); $i < $s; $i++) { $ordinal = ord($str[$i]); if ($ordinal < 128) { /* If the $temp array has a value but we have moved on, then it seems only fair that we output that entity and restart $temp before continuing. -Paul */ if (count($temp) == 1) { $out .= '&#'.array_shift($temp).';'; $count = 1; } $out .= $str[$i]; } else { if (count($temp) == 0) { $count = ($ordinal < 224) ? 2 : 3; } $temp[] = $ordinal; if (count($temp) == $count) { $number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64); $out .= '&#'.$number.';'; $count = 1; $temp = array(); } } } return $out; } } // ------------------------------------------------------------------------ /** * Entities to ASCII * * Converts character entities back to ASCII * * @access public * @param string * @param bool * @return string */ if ( ! function_exists('entities_to_ascii')) { function entities_to_ascii($str, $all = TRUE) { if (preg_match_all('/\&#(\d+)\;/', $str, $matches)) { for ($i = 0, $s = count($matches['0']); $i < $s; $i++) { $digits = $matches['1'][$i]; $out = ''; if ($digits < 128) { $out .= chr($digits); } elseif ($digits < 2048) { $out .= chr(192 + (($digits - ($digits % 64)) / 64)); $out .= chr(128 + ($digits % 64)); } else { $out .= chr(224 + (($digits - ($digits % 4096)) / 4096)); $out .= chr(128 + ((($digits % 4096) - ($digits % 64)) / 64)); $out .= chr(128 + ($digits % 64)); } $str = str_replace($matches['0'][$i], $out, $str); } } if ($all) { $str = str_replace(array("&amp;", "&lt;", "&gt;", "&quot;", "&apos;", "&#45;"), array("&","<",">","\"", "'", "-"), $str); } return $str; } } // ------------------------------------------------------------------------ /** * Word Censoring Function * * Supply a string and an array of disallowed words and any * matched words will be converted to #### or to the replacement * word you've submitted. * * @access public * @param string the text string * @param string the array of censoered words * @param string the optional replacement value * @return string */ if ( ! function_exists('word_censor')) { function word_censor($str, $censored, $replacement = '') { if ( ! is_array($censored)) { return $str; } $str = ' '.$str.' '; // \w, \b and a few others do not match on a unicode character // set for performance reasons. As a result words like über // will not match on a word boundary. Instead, we'll assume that // a bad word will be bookeneded by any of these characters. $delim = '[-_\'\"`(){}<>\[\]|!?@#%&,.:;^~*+=\/ 0-9\n\r\t]'; foreach ($censored as $badword) { if ($replacement != '') { $str = preg_replace("/({$delim})(".str_replace('\*', '\w*?', preg_quote($badword, '/')).")({$delim})/i", "\\1{$replacement}\\3", $str); } else { $str = preg_replace("/({$delim})(".str_replace('\*', '\w*?', preg_quote($badword, '/')).")({$delim})/ie", "'\\1'.str_repeat('#', strlen('\\2')).'\\3'", $str); } } return trim($str); } } // ------------------------------------------------------------------------ /** * Code Highlighter * * Colorizes code strings * * @access public * @param string the text string * @return string */ if ( ! function_exists('highlight_code')) { function highlight_code($str) { // The highlight string function encodes and highlights // brackets so we need them to start raw $str = str_replace(array('&lt;', '&gt;'), array('<', '>'), $str); // Replace any existing PHP tags to temporary markers so they don't accidentally // break the string out of PHP, and thus, thwart the highlighting. $str = str_replace(array('<?', '?>', '<%', '%>', '\\', '</script>'), array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), $str); // The highlight_string function requires that the text be surrounded // by PHP tags, which we will remove later $str = '<?php '.$str.' ?>'; // <? // All the magic happens here, baby! $str = highlight_string($str, TRUE); // Prior to PHP 5, the highligh function used icky <font> tags // so we'll replace them with <span> tags. if (abs(PHP_VERSION) < 5) { $str = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $str); $str = preg_replace('#color="(.*?)"#', 'style="color: \\1"', $str); } // Remove our artificially added PHP, and the syntax highlighting that came with it $str = preg_replace('/<span style="color: #([A-Z0-9]+)">&lt;\?php(&nbsp;| )/i', '<span style="color: #$1">', $str); $str = preg_replace('/(<span style="color: #[A-Z0-9]+">.*?)\?&gt;<\/span>\n<\/span>\n<\/code>/is', "$1</span>\n</span>\n</code>", $str); $str = preg_replace('/<span style="color: #[A-Z0-9]+"\><\/span>/i', '', $str); // Replace our markers back to PHP tags. $str = str_replace(array('phptagopen', 'phptagclose', 'asptagopen', 'asptagclose', 'backslashtmp', 'scriptclose'), array('&lt;?', '?&gt;', '&lt;%', '%&gt;', '\\', '&lt;/script&gt;'), $str); return $str; } } // ------------------------------------------------------------------------ /** * Phrase Highlighter * * Highlights a phrase within a text string * * @access public * @param string the text string * @param string the phrase you'd like to highlight * @param string the openging tag to precede the phrase with * @param string the closing tag to end the phrase with * @return string */ if ( ! function_exists('highlight_phrase')) { function highlight_phrase($str, $phrase, $tag_open = '<strong>', $tag_close = '</strong>') { if ($str == '') { return ''; } if ($phrase != '') { return preg_replace('/('.preg_quote($phrase, '/').')/i', $tag_open."\\1".$tag_close, $str); } return $str; } } // ------------------------------------------------------------------------ /** * Convert Accented Foreign Characters to ASCII * * @access public * @param string the text string * @return string */ if ( ! function_exists('convert_accented_characters')) { function convert_accented_characters($str) { if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php')) { include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'); } elseif (is_file(APPPATH.'config/foreign_chars.php')) { include(APPPATH.'config/foreign_chars.php'); } if ( ! isset($foreign_characters)) { return $str; } return preg_replace(array_keys($foreign_characters), array_values($foreign_characters), $str); } } // ------------------------------------------------------------------------ /** * Word Wrap * * Wraps text at the specified character. Maintains the integrity of words. * Anything placed between {unwrap}{/unwrap} will not be word wrapped, nor * will URLs. * * @access public * @param string the text string * @param integer the number of characters to wrap at * @return string */ if ( ! function_exists('word_wrap')) { function word_wrap($str, $charlim = '76') { // Se the character limit if ( ! is_numeric($charlim)) $charlim = 76; // Reduce multiple spaces $str = preg_replace("| +|", " ", $str); // Standardize newlines if (strpos($str, "\r") !== FALSE) { $str = str_replace(array("\r\n", "\r"), "\n", $str); } // If the current word is surrounded by {unwrap} tags we'll // strip the entire chunk and replace it with a marker. $unwrap = array(); if (preg_match_all("|(\{unwrap\}.+?\{/unwrap\})|s", $str, $matches)) { for ($i = 0; $i < count($matches['0']); $i++) { $unwrap[] = $matches['1'][$i]; $str = str_replace($matches['1'][$i], "{{unwrapped".$i."}}", $str); } } // Use PHP's native function to do the initial wordwrap. // We set the cut flag to FALSE so that any individual words that are // too long get left alone. In the next step we'll deal with them. $str = wordwrap($str, $charlim, "\n", FALSE); // Split the string into individual lines of text and cycle through them $output = ""; foreach (explode("\n", $str) as $line) { // Is the line within the allowed character count? // If so we'll join it to the output and continue if (strlen($line) <= $charlim) { $output .= $line."\n"; continue; } $temp = ''; while ((strlen($line)) > $charlim) { // If the over-length word is a URL we won't wrap it if (preg_match("!\[url.+\]|://|wwww.!", $line)) { break; } // Trim the word down $temp .= substr($line, 0, $charlim-1); $line = substr($line, $charlim-1); } // If $temp contains data it means we had to split up an over-length // word into smaller chunks so we'll add it back to our current line if ($temp != '') { $output .= $temp."\n".$line; } else { $output .= $line; } $output .= "\n"; } // Put our markers back if (count($unwrap) > 0) { foreach ($unwrap as $key => $val) { $output = str_replace("{{unwrapped".$key."}}", $val, $output); } } // Remove the unwrap tags $output = str_replace(array('{unwrap}', '{/unwrap}'), '', $output); return $output; } } // ------------------------------------------------------------------------ /** * Ellipsize String * * This function will strip tags from a string, split it at its max_length and ellipsize * * @param string string to ellipsize * @param integer max length of string * @param mixed int (1|0) or float, .5, .2, etc for position to split * @param string ellipsis ; Default '...' * @return string ellipsized string */ if ( ! function_exists('ellipsize')) { function ellipsize($str, $max_length, $position = 1, $ellipsis = '&hellip;') { // Strip tags $str = trim(strip_tags($str)); // Is the string long enough to ellipsize? if (strlen($str) <= $max_length) { return $str; } $beg = substr($str, 0, floor($max_length * $position)); $position = ($position > 1) ? 1 : $position; if ($position === 1) { $end = substr($str, 0, -($max_length - strlen($beg))); } else { $end = substr($str, -($max_length - strlen($beg))); } return $beg.$ellipsis.$end; } } /* End of file text_helper.php */ /* Location: ./system/helpers/text_helper.php */
chrisnager/jaunt
system/helpers/text_helper.php
PHP
mit
13,134
/** * Highlight elements as you scroll * @module Ink.UI.Spy_1 * @version 1 */ Ink.createModule('Ink.UI.Spy', '1', ['Ink.UI.Common_1','Ink.Dom.Event_1','Ink.Dom.Css_1','Ink.Dom.Element_1','Ink.Dom.Selector_1'], function(Common, Event, Css, Element, Selector ) { 'use strict'; // Maps a spy target (EG a menu with links inside) to spied instances. var spyTargets = [ // [target, [spied, spied, spied...]], ... ]; function targetIndex(target) { for (var i = 0, len = spyTargets.length; i < len; i++) { if (spyTargets[i][0] === target) { return i; } } return null; } function addSpied(spied, target) { var index = targetIndex(target); if (index === null) { spyTargets.push([target, [spied]]); } else { spyTargets[index][1].push(spied); } } var observingOnScroll = false; function observeOnScroll() { if (!observingOnScroll) { observingOnScroll = true; Event.observe(document, 'scroll', Event.throttle(onScroll, 300)); } } function onScroll() { for (var i = 0, len = spyTargets.length; i < len; i++) { onScrollForTarget(spyTargets[i][0], spyTargets[i][1]); } } function onScrollForTarget(target, spied) { var activeEl = findActiveElement(spied); // This selector finds li's to deactivate var toDeactivate = Selector.select('li.active', target); for (var i = 0, total = toDeactivate.length; i < total; i++) { Css.removeClassName(toDeactivate[i], 'active'); } if (activeEl === null) { return; } // The link which should be activated has a "href" ending with "#" + name or id of the element var menuLinkSelector = 'a[href$="#' + (activeEl.name || activeEl.id) + '"]'; var toActivate = Selector.select(menuLinkSelector, target); for (i = 0, total = toActivate.length; i < total; i++) { Css.addClassName(Element.findUpwardsByTag(toActivate[i], 'li'), 'active'); } } function findActiveElement(spied) { /* * Find the element above the top of the screen, but closest to it. * _____ * |_____| element 1 (active element) * * ------------------------ * | _____ | * | | | element 2 | * | | | | * | |_____| | * ------- Viewport ------- */ // Remember that getBoundingClientRect returns coordinates // relative to the top left corner of the screen. // // So checking if it's < 0 is used to tell if // the element is above the top of the screen. var closest = -Infinity; var closestIndex; var bBox; for( var i = 0, total = spied.length; i < total; i++ ){ bBox = spied[i].getBoundingClientRect(); if (bBox.top <= 0 && bBox.top > closest) { closest = bBox.top; closestIndex = i; } } if (closestIndex === undefined) { return null; } else { return spied[closestIndex]; } } /** * Spy is an UI component which tells the user which section is currently visible. * Spy can be used to highlight a menu item for the section which is visible to the user. * You need two things: A menu element (which contains your links inside `li` tags), and an element containing your section's content. * The links must be inside `li` tags. These will get the 'active' class, to signal which item is currently visible. In your CSS you need to add styling for this class. * To use Ink.UI.Spy for more than one section, loop through your sections (as you see in the sample below), or just load `autoload.js` and set add the `data-spy="true"` attribute to your sections. * The currently visible element's corresponding link in the menu gets the 'visible' class added to it. * * @class Ink.UI.Spy * @constructor * @version 1 * @param {String|DOMElement} selector * @param {Object} [options] Options * @param {DOMElement|String} options.target Target menu where the spy will highlight the right option. * * @sample Ink_UI_Spy_1.html */ var Spy = function( selector, options ){ this._element = Common.elOrSelector( selector, 'Ink.UI.Spy_1: Section element' ); /** * Setting default options and - if needed - overriding it with the data attributes */ this._options = Ink.extendObj({ target: undefined, activeClass: 'active' // [todo] Spy#_options.activeClass }, Element.data( this._element ) ); /** * In case options have been defined when creating the instance, they've precedence */ this._options = Ink.extendObj(this._options,options || {}); this._options.target = Common.elOrSelector( this._options.target, 'Ink.UI.Spy_1: Target element' ); this._init(); }; Spy.prototype = { /** * Init function called by the constructor * * @method _init * @private */ _init: function() { addSpied(this._element, this._options.target); observeOnScroll(); onScroll(); Common.registerInstance(this, this._element); } }; return Spy; });
Rbeuque74/cdnjs
ajax/libs/ink/3.0.1/js/ink.spy.js
JavaScript
mit
5,662
'use strict'; module.exports = function generate_anyOf(it, $keyword) { var out = ' '; var $lvl = it.level; var $dataLvl = it.dataLevel; var $schema = it.schema[$keyword]; var $schemaPath = it.schemaPath + it.util.getProperty($keyword); var $errSchemaPath = it.errSchemaPath + '/' + $keyword; var $breakOnError = !it.opts.allErrors; var $data = 'data' + ($dataLvl || ''); var $valid = 'valid' + $lvl; var $errs = 'errs__' + $lvl; var $it = it.util.copy(it); var $closingBraces = ''; $it.level++; var $nextValid = 'valid' + $it.level; var $noEmptySchema = $schema.every(function($sch) { return it.util.schemaHasRules($sch, it.RULES.all); }); if ($noEmptySchema) { var $currentBaseId = $it.baseId; out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; '; var $wasComposite = it.compositeRule; it.compositeRule = $it.compositeRule = true; var arr1 = $schema; if (arr1) { var $sch, $i = -1, l1 = arr1.length - 1; while ($i < l1) { $sch = arr1[$i += 1]; $it.schema = $sch; $it.schemaPath = $schemaPath + '[' + $i + ']'; $it.errSchemaPath = $errSchemaPath + '/' + $i; out += ' ' + (it.validate($it)) + ' '; $it.baseId = $currentBaseId; out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { '; $closingBraces += '}'; } } it.compositeRule = $it.compositeRule = $wasComposite; out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ if (it.createErrors !== false) { out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; if (it.opts.messages !== false) { out += ' , message: \'should match some schema in anyOf\' '; } if (it.opts.verbose) { out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; } out += ' } '; } else { out += ' {} '; } out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; if (it.opts.allErrors) { out += ' } '; } out = it.util.cleanUpCode(out); } else { if ($breakOnError) { out += ' if (true) { '; } } return out; }
rootulp/exercism
typescript/hamming/node_modules/ajv/lib/dotjs/anyOf.js
JavaScript
mit
2,583
#include "hash.h" inline uint32_t ROTL32 ( uint32_t x, int8_t r ) { return (x << r) | (x >> (32 - r)); } unsigned int MurmurHash3(unsigned int nHashSeed, const std::vector<unsigned char>& vDataToHash) { // The following is MurmurHash3 (x86_32), see http://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp uint32_t h1 = nHashSeed; const uint32_t c1 = 0xcc9e2d51; const uint32_t c2 = 0x1b873593; const int nblocks = vDataToHash.size() / 4; //---------- // body const uint32_t * blocks = (const uint32_t *)(&vDataToHash[0] + nblocks*4); for(int i = -nblocks; i; i++) { uint32_t k1 = blocks[i]; k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; h1 = ROTL32(h1,13); h1 = h1*5+0xe6546b64; } //---------- // tail const uint8_t * tail = (const uint8_t*)(&vDataToHash[0] + nblocks*4); uint32_t k1 = 0; switch(vDataToHash.size() & 3) { case 3: k1 ^= tail[2] << 16; case 2: k1 ^= tail[1] << 8; case 1: k1 ^= tail[0]; k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; }; //---------- // finalization h1 ^= vDataToHash.size(); h1 ^= h1 >> 16; h1 *= 0x85ebca6b; h1 ^= h1 >> 13; h1 *= 0xc2b2ae35; h1 ^= h1 >> 16; return h1; }
bitcrystal/bitcrystal_v20_last_branch_new
src/hash.cpp
C++
mit
1,330
/* The MIT License */ .dropzone, .dropzone *, .dropzone-previews, .dropzone-previews * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .dropzone { position: relative; border: 1px solid rgba(0,0,0,0.08); background: rgba(0,0,0,0.02); padding: 1em; } .dropzone.dz-clickable { cursor: pointer; } .dropzone.dz-clickable .dz-message, .dropzone.dz-clickable .dz-message span { cursor: pointer; } .dropzone.dz-clickable * { cursor: default; } .dropzone .dz-message { opacity: 1; -ms-filter: none; filter: none; } .dropzone.dz-drag-hover { border-color: rgba(0,0,0,0.15); background: rgba(0,0,0,0.04); } .dropzone.dz-started .dz-message { display: none; } .dropzone .dz-preview, .dropzone-previews .dz-preview { background: rgba(255,255,255,0.8); position: relative; display: inline-block; margin: 17px; vertical-align: top; border: 1px solid #acacac; padding: 6px 6px 6px 6px; } .dropzone .dz-preview.dz-file-preview [data-dz-thumbnail], .dropzone-previews .dz-preview.dz-file-preview [data-dz-thumbnail] { display: none; } .dropzone .dz-preview .dz-details, .dropzone-previews .dz-preview .dz-details { width: 100px; height: 100px; position: relative; background: #ebebeb; padding: 5px; margin-bottom: 22px; } .dropzone .dz-preview .dz-details .dz-filename, .dropzone-previews .dz-preview .dz-details .dz-filename { overflow: hidden; height: 100%; } .dropzone .dz-preview .dz-details img, .dropzone-previews .dz-preview .dz-details img { position: absolute; top: 0; left: 0; width: 100px; height: 100px; } .dropzone .dz-preview .dz-details .dz-size, .dropzone-previews .dz-preview .dz-details .dz-size { position: absolute; bottom: -28px; left: 3px; height: 28px; line-height: 28px; } .dropzone .dz-preview.dz-error .dz-error-mark, .dropzone-previews .dz-preview.dz-error .dz-error-mark { display: block; } .dropzone .dz-preview.dz-success .dz-success-mark, .dropzone-previews .dz-preview.dz-success .dz-success-mark { display: block; } .dropzone .dz-preview:hover .dz-details img, .dropzone-previews .dz-preview:hover .dz-details img { display: none; } .dropzone .dz-preview .dz-success-mark, .dropzone-previews .dz-preview .dz-success-mark, .dropzone .dz-preview .dz-error-mark, .dropzone-previews .dz-preview .dz-error-mark { display: none; position: absolute; width: 40px; height: 40px; font-size: 30px; text-align: center; right: -10px; top: -10px; } .dropzone .dz-preview .dz-success-mark, .dropzone-previews .dz-preview .dz-success-mark { color: #8cc657; } .dropzone .dz-preview .dz-error-mark, .dropzone-previews .dz-preview .dz-error-mark { color: #ee162d; } .dropzone .dz-preview .dz-progress, .dropzone-previews .dz-preview .dz-progress { position: absolute; top: 100px; left: 6px; right: 6px; height: 6px; background: #d7d7d7; display: none; } .dropzone .dz-preview .dz-progress .dz-upload, .dropzone-previews .dz-preview .dz-progress .dz-upload { position: absolute; top: 0; bottom: 0; left: 0; width: 0%; background-color: #8cc657; } .dropzone .dz-preview.dz-processing .dz-progress, .dropzone-previews .dz-preview.dz-processing .dz-progress { display: block; } .dropzone .dz-preview .dz-error-message, .dropzone-previews .dz-preview .dz-error-message { display: none; position: absolute; top: -5px; left: -20px; background: rgba(245,245,245,0.8); padding: 8px 10px; color: #800; min-width: 140px; max-width: 500px; z-index: 500; } .dropzone .dz-preview:hover.dz-error .dz-error-message, .dropzone-previews .dz-preview:hover.dz-error .dz-error-message { display: block; }
LSleutsky/cdnjs
ajax/libs/dropzone/3.6.2/css/basic.css
CSS
mit
3,681
/*! * Bootstrap v3.0.3 (http://getbootstrap.com) * Copyright 2013 Twitter, Inc. * Licensed under http://www.apache.org/licenses/LICENSE-2.0 */ if("undefined"==typeof jQuery)throw new Error("Bootstrap requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]}}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(jQuery),+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one(a.support.transition.end,c).emulateTransitionEnd(150):c())};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),"string"==typeof b&&e[b].call(d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){"loadingText"==a?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]'),b=!0;if(a.length){var c=this.$element.find("input");"radio"===c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?b=!1:a.find(".active").removeClass("active")),b&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}b&&this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof c&&c;e||d.data("bs.button",e=new b(this,f)),"toggle"==c?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){return this.sliding?void 0:this.slide("next")},b.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(!e.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")})),a.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(j),j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(600)}else{if(this.$element.trigger(j),j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")}return f&&this.cycle(),this}};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),g="string"==typeof c?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),"number"==typeof c?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c,d=a(this),e=a(d.attr("data-target")||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),d.data()),g=d.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=d.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b=a.Event("show.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])}}},b.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?(this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350),void 0):d.call(this)}}},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c);e||d.data("bs.collapse",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c,d=a(this),e=d.attr("data-target")||b.preventDefault()||(c=d.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":d.data(),i=d.attr("data-parent"),j=i&&a(i);g&&g.transitioning||(j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(d).addClass("collapsed"),d[f.hasClass("in")?"addClass":"removeClass"]("collapsed")),f.collapse(h)})}(jQuery),+function(a){"use strict";function b(){a(d).remove(),a(e).each(function(b){var d=c(a(this));d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown")),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown"))})}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}var d=".dropdown-backdrop",e="[data-toggle=dropdown]",f=function(b){a(b).on("click.bs.dropdown",this.toggle)};f.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){if("ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b),f.trigger(d=a.Event("show.bs.dropdown")),d.isDefaultPrevented())return;f.toggleClass("open").trigger("shown.bs.dropdown"),e.focus()}return!1}},f.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var f=c(d),g=f.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&f.find(e).focus(),d.click();var h=a("[role=menu] li:not(.divider):visible a",f);if(h.length){var i=h.index(h.filter(":focus"));38==b.keyCode&&i>0&&i--,40==b.keyCode&&i<h.length-1&&i++,~i||(i=0),h.eq(i).focus()}}}};var g=a.fn.dropdown;a.fn.dropdown=function(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new f(this)),"string"==typeof b&&d[b].call(c)})},a.fn.dropdown.Constructor=f,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=g,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",e,f.prototype.toggle).on("keydown.bs.dropdown.data-api",e+", [role=menu]",f.prototype.keydown)}(jQuery),+function(a){"use strict";var b=function(b,c){this.options=c,this.$element=a(b),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.load(this.options.remote)};b.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},b.prototype.toggle=function(a){return this[this.isShown?"hide":"show"](a)},b.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.$element.on("click.dismiss.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show(),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one(a.support.transition.end,function(){c.$element.focus().trigger(e)}).emulateTransitionEnd(300):c.$element.focus().trigger(e)}))},b.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one(a.support.transition.end,a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},b.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.focus()},this))},b.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},b.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden.bs.modal")})},b.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},b.prototype.backdrop=function(b){var c=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var d=a.support.transition&&c;if(this.$backdrop=a('<div class="modal-backdrop '+c+'" />').appendTo(document.body),this.$element.on("click.dismiss.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),d&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;d?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),"object"==typeof c&&c);f||e.data("bs.modal",f=new b(this,g)),"string"==typeof c?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focus",i="hover"==g?"mouseleave":"blur";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show),void 0):c.show()},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide),void 0):c.hide()},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(b),b.isDefaultPrevented())return;var c=this.tip();this.setContent(),this.options.animation&&c.addClass("fade");var d="function"==typeof this.options.placement?this.options.placement.call(this,c[0],this.$element[0]):this.options.placement,e=/\s?auto?\s?/i,f=e.test(d);f&&(d=d.replace(e,"")||"top"),c.detach().css({top:0,left:0,display:"block"}).addClass(d),this.options.container?c.appendTo(this.options.container):c.insertAfter(this.$element);var g=this.getPosition(),h=c[0].offsetWidth,i=c[0].offsetHeight;if(f){var j=this.$element.parent(),k=d,l=document.documentElement.scrollTop||document.body.scrollTop,m="body"==this.options.container?window.innerWidth:j.outerWidth(),n="body"==this.options.container?window.innerHeight:j.outerHeight(),o="body"==this.options.container?0:j.offset().left;d="bottom"==d&&g.top+g.height+i-l>n?"top":"top"==d&&g.top-l-i<0?"bottom":"right"==d&&g.right+h>m?"left":"left"==d&&g.left-h<o?"right":d,c.removeClass(k).addClass(d)}var p=this.getCalculatedOffset(d,g,h,i);this.applyPlacement(p,d),this.$element.trigger("shown.bs."+this.type)}},b.prototype.applyPlacement=function(a,b){var c,d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),a.top=a.top+g,a.left=a.left+h,d.offset(a).addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;if("top"==b&&j!=f&&(c=!0,a.top=a.top+f-j),/bottom|top/.test(b)){var k=0;a.left<0&&(k=-2*a.left,a.left=0,d.offset(a),i=d[0].offsetWidth,j=d[0].offsetHeight),this.replaceArrow(k-e+i,i,"left")}else this.replaceArrow(j-f,j,"top");c&&d.offset(a)},b.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},b.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach()}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one(a.support.transition.end,b).emulateTransitionEnd(150):b(),this.$element.trigger("hidden.bs."+this.type),this)},b.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},b.prototype.hasContent=function(){return this.getTitle()},b.prototype.getPosition=function(){var b=this.$element[0];return a.extend({},"function"==typeof b.getBoundingClientRect?b.getBoundingClientRect():{width:b.offsetWidth,height:b.offsetHeight},this.$element.offset())},b.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},b.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},b.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},b.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},b.prototype.enable=function(){this.enabled=!0},b.prototype.disable=function(){this.enabled=!1},b.prototype.toggleEnabled=function(){this.enabled=!this.enabled},b.prototype.toggle=function(b){var c=b?a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;c.tip().hasClass("in")?c.leave(c):c.enter(c)},b.prototype.destroy=function(){this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof c&&c;e||d.data("bs.tooltip",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=c,this}}(jQuery),+function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");b.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof c&&c;e||d.data("bs.popover",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery),+function(a){"use strict";function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,d=c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(b>=d)return g!=(a=f.last()[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},b.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),f.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),"string"==typeof c&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(this.$element.is(":visible")){var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top()),"function"==typeof h&&(h=f.bottom());var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=c-h?"bottom":null!=g&&g>=d?"top":!1;this.affixed!==i&&(this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin="bottom"==i?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),"bottom"==i&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()}))}};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof c&&c;e||d.data("bs.affix",e=new b(this,f)),"string"==typeof c&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(jQuery);
kirkytullins/tickets
Scripts/bootstrap.min.js
JavaScript
mit
27,822
<!DOCTYPE html> <html> <!-- Copyright 2008 The Closure Library Authors. All Rights Reserved. Use of this source code is governed by the Apache License, Version 2.0. See the COPYING file for details. --> <!-- --> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Closure Unit Tests - goog.net.MultiIframeLoadMonitor</title> <script src="../base.js"></script> <script> goog.require('goog.dom'); goog.require('goog.events'); goog.require('goog.net.MultiIframeLoadMonitor'); goog.require('goog.testing.AsyncTestCase'); goog.require('goog.testing.jsunit'); </script> </head> <body> <div id="frame_parent"></div> <script> var TEST_FRAME_SRCS = ['iframeloadmonitor_test_frame.html', 'iframeloadmonitor_test_frame2.html', 'iframeloadmonitor_test_frame3.html']; // Create a new test case. var iframeLoaderTestCase = new goog.testing.AsyncTestCase(document.title); iframeLoaderTestCase.stepTimeout = 4 * 1000; // How many multpile frames finished loading iframeLoaderTestCase.multipleComplete_ = 0; iframeLoaderTestCase.numMonitors = 0; iframeLoaderTestCase.disposeCalled = 0; /** Sets up the test environment, adds tests and sets up the worker pools. */ iframeLoaderTestCase.setUpPage = function() { this.log('Setting tests up'); iframeLoaderTestCase.waitForAsync('loading iframes'); var dom = goog.dom.getDomHelper(); // Load multiple with callback var frame1 = dom.createDom('iframe'); var frame2 = dom.createDom('iframe'); var multiMonitor = new goog.net.MultiIframeLoadMonitor( [frame1, frame2], goog.bind(this.multipleCallback, this)); this.log('Loading frames at: ' + TEST_FRAME_SRCS[0] + ' and ' + TEST_FRAME_SRCS[1]); // Make sure they don't look loaded yet. assertEquals(0, this.multipleComplete_); var frameParent = dom.getElement('frame_parent'); dom.appendChild(frameParent, frame1); frame1.src = TEST_FRAME_SRCS[0]; dom.appendChild(frameParent, frame2); frame2.src = TEST_FRAME_SRCS[1]; // Load multiple with callback and content check var frame3 = dom.createDom('iframe'); var frame4 = dom.createDom('iframe'); var multiMonitor = new goog.net.MultiIframeLoadMonitor( [frame3, frame4], goog.bind(this.multipleContentCallback, this), true); this.log('Loading frames with content check at: ' + TEST_FRAME_SRCS[1] + ' and ' + TEST_FRAME_SRCS[2]); dom.appendChild(frameParent, frame3); frame3.src = TEST_FRAME_SRCS[1]; dom.appendChild(frameParent, frame4); frame4.src = TEST_FRAME_SRCS[2]; }; /** Callback for the multiple frame load test case */ iframeLoaderTestCase.multipleCallback = function() { this.log('multiple frames finished loading'); this.multipleComplete_++; this.multipleCompleteNoContent_ = true; this.callbacksComplete(); }; /** Callback for the multiple frame with content load test case */ iframeLoaderTestCase.multipleContentCallback = function() { this.log('multiple frames with content finished loading'); this.multipleComplete_++; this.multipleCompleteContent_ = true; this.callbacksComplete(); }; /** Checks if all the load callbacks are done*/ iframeLoaderTestCase.callbacksComplete = function() { if (this.multipleComplete_ == 2) { iframeLoaderTestCase.continueTesting(); } } /** Tests the results. */ iframeLoaderTestCase.addNewTest('testResults', function() { this.log('getting test results'); assertTrue(this.multipleCompleteNoContent_); assertTrue(this.multipleCompleteContent_); }); iframeLoaderTestCase.fakeLoadMonitor = function() { // Replaces IframeLoadMonitor with a fake version that just tracks // instantiations/disposals this.loadMonitorConstructor = goog.net.IframeLoadMonitor; var that = this; goog.net.IframeLoadMonitor = function() { that.numMonitors++; return { isLoaded: function() { return false; }, dispose: function() { that.disposeCalled++; }, attachEvent: function() {} }; } goog.net.IframeLoadMonitor.LOAD_EVENT = 'ifload'; }; iframeLoaderTestCase.unfakeLoadMonitor = function() { goog.net.IframeLoadMonitor = this.loadMonitorConstructor; }; iframeLoaderTestCase.addNewTest('stopMonitoring', function() { // create two unloaded frames, make sure that load monitors are loaded // behind the scenes, then make sure they are disposed properly. this.fakeLoadMonitor(); var dom = goog.dom.getDomHelper(); var frames = [dom.createDom('iframe'), dom.createDom('iframe')]; var multiMonitor = new goog.net.MultiIframeLoadMonitor( frames, function() { fail("should not invoke callback for unloaded rames"); }); assertEquals(frames.length, this.numMonitors); assertEquals(0, this.disposeCalled); multiMonitor.stopMonitoring(); assertEquals(frames.length, this.disposeCalled); this.unfakeLoadMonitor(); }); /** Standalone Closure Test Runner. */ G_testRunner.initialize(iframeLoaderTestCase); </script> </body> </html>
satgod/appinventor
appinventor/lib/closure-library/closure/goog/net/multiiframeloadmonitor_test.html
HTML
mit
5,125
/** * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'a11yhelp', 'sq', { title: 'Udhëzimet e Qasjes', contents: 'Përmbajtja ndihmëse. Për ta mbyllur dialogun shtyp ESC.', legend: [ { name: 'Të përgjithshme', items: [ { name: 'Shiriti i Redaktuesit', legend: 'Press ${toolbarFocus} to navigate to the toolbar. Move to the next and previous toolbar group with TAB and SHIFT-TAB. Move to the next and previous toolbar button with RIGHT ARROW or LEFT ARROW. Press SPACE or ENTER to activate the toolbar button.' // MISSING }, { name: 'Dialogu i Redaktuesit', legend: 'Inside a dialog, press TAB to navigate to next dialog field, press SHIFT + TAB to move to previous field, press ENTER to submit dialog, press ESC to cancel dialog. For dialogs that have multiple tab pages, press ALT + F10 to navigate to tab-list. Then move to next tab with TAB OR RIGTH ARROW. Move to previous tab with SHIFT + TAB or LEFT ARROW. Press SPACE or ENTER to select the tab page.' // MISSING }, { name: 'Editor Context Menu', // MISSING legend: 'Press ${contextMenu} or APPLICATION KEY to open context-menu. Then move to next menu option with TAB or DOWN ARROW. Move to previous option with SHIFT+TAB or UP ARROW. Press SPACE or ENTER to select the menu option. Open sub-menu of current option with SPACE or ENTER or RIGHT ARROW. Go back to parent menu item with ESC or LEFT ARROW. Close context menu with ESC.' // MISSING }, { name: 'Editor List Box', // MISSING legend: 'Inside a list-box, move to next list item with TAB OR DOWN ARROW. Move to previous list item with SHIFT + TAB or UP ARROW. Press SPACE or ENTER to select the list option. Press ESC to close the list-box.' // MISSING }, { name: 'Editor Element Path Bar', // MISSING legend: 'Press ${elementsPathFocus} to navigate to the elements path bar. Move to next element button with TAB or RIGHT ARROW. Move to previous button with SHIFT+TAB or LEFT ARROW. Press SPACE or ENTER to select the element in editor.' // MISSING } ] }, { name: 'Komandat', items: [ { name: 'Rikthe komandën', legend: 'Shtyp ${undo}' }, { name: 'Ribëj komandën', legend: 'Shtyp ${redo}' }, { name: 'Komanda e trashjes së tekstit', legend: 'Shtyp ${bold}' }, { name: 'Komanda kursive', legend: 'Shtyp ${italic}' }, { name: 'Komanda e nënvijëzimit', legend: 'Shtyp ${underline}' }, { name: 'Komanda e Nyjes', legend: 'Shtyp ${link}' }, { name: ' Toolbar Collapse command', // MISSING legend: 'Shtyp ${toolbarCollapse}' }, { name: ' Access previous focus space command', // MISSING legend: 'Press ${accessPreviousSpace} to access the closest unreachable focus space before the caret, for example: two adjacent HR elements. Repeat the key combination to reach distant focus spaces.' // MISSING }, { name: ' Access next focus space command', // MISSING legend: 'Press ${accessNextSpace} to access the closest unreachable focus space after the caret, for example: two adjacent HR elements. Repeat the key combination to reach distant focus spaces.' // MISSING }, { name: 'Ndihmë Qasjeje', legend: 'Shtyp ${a11yHelp}' } ] } ] });
sancospi/jsdelivr
files/ckeditor/4.3.0/plugins/a11yhelp/dialogs/lang/sq.js
JavaScript
mit
3,379
/* =========================================================== * google-select.js v1.0.0 * http://todc.github.com/google-bootstrap * =========================================================== */ !function ($) { "use strict"; // jshint ;_; /* CLASS DEFINITION * ================ */ var GSelect = function (element) { var $el = $(element); $el.hide(); var $container = $('<div>').addClass('btn-group'); var $btn = $('<a>', { text: 'Select...'}).addClass('btn g-select'); var $menu = $('<ul>').addClass('g-select-dropdown scrollable'); $btn.addClass($el.attr('class')); $.each(element.options, function(i, opt) { var $menuItem = $('<li>', { text: opt.text }); $menuItem.data('val', opt.value ? opt.value : opt.text); $menu.append( $menuItem ); }); $el.after($container); $container.append($btn); $btn.after($menu); $.each($menu.children(), function(i, menuItem) { $(menuItem).click(function() { $btn.text($(this).text()); $el.val($(this).data('val')).change(); }) }) $btn.gSelectDropdown(); } GSelect.prototype = { constructor: GSelect , toggle: function (e) { } } /* DROPDOWN PLUGIN DEFINITION * ========================== */ $.fn.gSelect = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('gSelect') if (!data) $this.data('gSelect', (data = new GSelect(this))) if (typeof option == 'string') data[option].call($this) }) } $.fn.gSelect.Constructor = GSelect /* APPLY TO STANDARD DROPDOWN ELEMENTS * =================================== */ /* $(function () { $('html').on('click.dropdown.data-api', clearMenus) $('body') .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle) }) */ }(window.jQuery);
ramda/jsdelivr
files/bootstrap.todc/2.2.1/js/google-select.js
JavaScript
mit
1,961
'use strict'; /** * @ngdoc directive * @name a * @restrict E * * @description * Modifies the default behavior of the html A tag so that the default action is prevented when * the href attribute is empty. * * This change permits the easy creation of action links with the `ngClick` directive * without changing the location or causing page reloads, e.g.: * `<a href="" ng-click="list.addItem()">Add Item</a>` */ var htmlAnchorDirective = valueFn({ restrict: 'E', compile: function(element, attr) { 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')); } if (!attr.href && !attr.xlinkHref && !attr.name) { return function(scope, element) { // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute. var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ? 'xlink:href' : 'href'; element.on('click', function(event){ // if we have no href url, then don't navigate anywhere. if (!element.attr(href)) { event.preventDefault(); } }); }; } } });
lrlopez/angular.js
src/ng/directive/a.js
JavaScript
mit
1,640
'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; function getDecimals(n) { n = n + ''; var i = n.indexOf('.'); return (i == -1) ? 0 : n.length - i - 1; } function getVF(n, opt_precision) { var v = opt_precision; if (undefined === v) { v = Math.min(getDecimals(n), 3); } var base = Math.pow(10, v); var f = ((n * base) | 0) % base; return {v: v, f: f}; } $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "dopoledne", "odpoledne" ], "DAY": [ "ned\u011ble", "pond\u011bl\u00ed", "\u00fater\u00fd", "st\u0159eda", "\u010dtvrtek", "p\u00e1tek", "sobota" ], "ERANAMES": [ "p\u0159. n. l.", "n. l." ], "ERAS": [ "p\u0159. n. l.", "n. l." ], "FIRSTDAYOFWEEK": 0, "MONTH": [ "ledna", "\u00fanora", "b\u0159ezna", "dubna", "kv\u011btna", "\u010dervna", "\u010dervence", "srpna", "z\u00e1\u0159\u00ed", "\u0159\u00edjna", "listopadu", "prosince" ], "SHORTDAY": [ "ne", "po", "\u00fat", "st", "\u010dt", "p\u00e1", "so" ], "SHORTMONTH": [ "led", "\u00fano", "b\u0159e", "dub", "kv\u011b", "\u010dvn", "\u010dvc", "srp", "z\u00e1\u0159", "\u0159\u00edj", "lis", "pro" ], "STANDALONEMONTH": [ "leden", "\u00fanor", "b\u0159ezen", "duben", "kv\u011bten", "\u010derven", "\u010dervenec", "srpen", "z\u00e1\u0159\u00ed", "\u0159\u00edjen", "listopad", "prosinec" ], "WEEKENDRANGE": [ 5, 6 ], "fullDate": "EEEE d. MMMM y", "longDate": "d. MMMM y", "medium": "d. M. y H:mm:ss", "mediumDate": "d. M. y", "mediumTime": "H:mm:ss", "short": "dd.MM.yy H:mm", "shortDate": "dd.MM.yy", "shortTime": "H:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "K\u010d", "DECIMAL_SEP": ",", "GROUP_SEP": "\u00a0", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } ] }, "id": "cs", "pluralCat": function(n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } if (i >= 2 && i <= 4 && vf.v == 0) { return PLURAL_CATEGORY.FEW; } if (vf.v != 0) { return PLURAL_CATEGORY.MANY; } return PLURAL_CATEGORY.OTHER;} }); }]);
pvnr0082t/cdnjs
ajax/libs/angular-i18n/1.4.9/angular-locale_cs.js
JavaScript
mit
3,030
/*! UIkit 2.0.0 | http://www.getuikit.com | (c) 2013 YOOtheme | MIT License */ .uk-sortable{padding:0;list-style:none}.uk-sortable-list{margin:0;padding-left:40px;list-style:none}.uk-sortable-list-dragged{position:absolute;z-index:1040;padding-left:0;pointer-events:none}.uk-sortable-item{margin-bottom:10px;padding:5px;background:#f5f5f5;border-radius:4px;border:1px solid rgba(0,0,0,.06);text-shadow:0 1px 0 #fff}.uk-sortable-placeholder{-moz-box-sizing:border-box;box-sizing:border-box;margin-bottom:10px;border:1px dashed #ddd}.uk-sortable-empty{min-height:40px}.uk-sortable-handle{display:inline-block;font-size:18px;color:#ddd;vertical-align:middle}.uk-sortable-handle:hover{cursor:move}.uk-sortable-handle:after{content:"\f0c9";font-family:FontAwesome}.uk-sortable-moving{cursor:move}[data-sortable-action=toggle]{display:inline-block;color:#999;visibility:hidden}[data-sortable-action=toggle]:hover{color:#444;cursor:pointer}[data-sortable-action=toggle]:after{content:"\f147";font-family:FontAwesome}.uk-parent>.uk-sortable-item [data-sortable-action=toggle]{visibility:visible}.uk-collapsed>.uk-sortable-item [data-sortable-action=toggle]:after{content:"\f196"}.uk-collapsed .uk-sortable-list{display:none}
aFarkas/cdnjs
ajax/libs/uikit/2.0.0/addons/css/sortable.almost-flat.min.css
CSS
mit
1,218
YUI.add('anim-curve', function(Y) { /** * Adds support for the <code>curve</code> property for the <code>to</code> * attribute. A curve is zero or more control points and an end point. * @module anim * @submodule anim-curve * @for Anim */ Y.Anim.behaviors.curve = { set: function(anim, att, from, to, elapsed, duration, fn) { from = from.slice.call(from); to = to.slice.call(to); var t = fn(elapsed, 0, 100, duration) / 100; to.unshift(from); anim._node.setXY(Y.Anim.getBezier(to, t)); }, get: function(anim, att) { return anim._node.getXY(); } }; /** * Get the current position of the animated element based on t. * Each point is an array of "x" and "y" values (0 = x, 1 = y) * At least 2 points are required (start and end). * First point is start. Last point is end. * Additional control points are optional. * @method getBezier * @static * @param {Array} points An array containing Bezier points * @param {Number} t A number between 0 and 1 which is the basis for determining current position * @return {Array} An array containing int x and y member data */ Y.Anim.getBezier = function(points, t) { var n = points.length; var tmp = []; for (var i = 0; i < n; ++i){ tmp[i] = [points[i][0], points[i][1]]; // save input } for (var j = 1; j < n; ++j) { for (i = 0; i < n - j; ++i) { tmp[i][0] = (1 - t) * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0]; tmp[i][1] = (1 - t) * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1]; } } return [ tmp[0][0], tmp[0][1] ]; }; }, '@VERSION@' ,{requires:['anim-base', 'node-screen']});
vuonghuuphuc/cdnjs
ajax/libs/yui/3.0.0beta1m2/anim/anim-curve.js
JavaScript
mit
1,698
(function(e){"function"==typeof define&&define.amd?define(["jquery","moment"],e):e(jQuery,moment)})(function(e,t){var n="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),i="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_");(t.defineLocale||t.lang).call(t,"es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,t){return/-MMM-/.test(t)?i[e.month()]:n[e.month()]},weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"Do_Lu_Ma_Mi_Ju_Vi_Sá".split("_"),longDateFormat:{LT:"H:mm",LTS:"LT:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY LT",LLLL:"dddd, D [de] MMMM [de] YYYY LT"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}}),e.fullCalendar.datepickerLang("es","es",{closeText:"Cerrar",prevText:"&#x3C;Ant",nextText:"Sig&#x3E;",currentText:"Hoy",monthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],monthNamesShort:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],dayNames:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],dayNamesShort:["dom","lun","mar","mié","jue","vie","sáb"],dayNamesMin:["D","L","M","X","J","V","S"],weekHeader:"Sm",dateFormat:"dd/mm/yy",firstDay:1,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""}),e.fullCalendar.lang("es",{defaultButtonText:{month:"Mes",week:"Semana",day:"Día",list:"Agenda"},allDayHtml:"Todo<br/>el día",eventLimitText:"más"})});
andyinabox/cdnjs
ajax/libs/fullcalendar/2.2.4/lang/es.js
JavaScript
mit
2,241
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Acl\Tests\Domain; use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity; class RoleSecurityIdentityTest extends \PHPUnit_Framework_TestCase { public function testConstructor() { $id = new RoleSecurityIdentity('ROLE_FOO'); $this->assertEquals('ROLE_FOO', $id->getRole()); } public function testConstructorWithRoleInstance() { $id = new RoleSecurityIdentity(new Role('ROLE_FOO')); $this->assertEquals('ROLE_FOO', $id->getRole()); } /** * @dataProvider getCompareData */ public function testEquals($id1, $id2, $equal) { if ($equal) { $this->assertTrue($id1->equals($id2)); } else { $this->assertFalse($id1->equals($id2)); } } public function getCompareData() { return array( array(new RoleSecurityIdentity('ROLE_FOO'), new RoleSecurityIdentity('ROLE_FOO'), true), array(new RoleSecurityIdentity('ROLE_FOO'), new RoleSecurityIdentity(new Role('ROLE_FOO')), true), array(new RoleSecurityIdentity('ROLE_USER'), new RoleSecurityIdentity('ROLE_FOO'), false), array(new RoleSecurityIdentity('ROLE_FOO'), new UserSecurityIdentity('ROLE_FOO', 'Foo'), false), ); } }
maitredjims/Symfony2_OCPlatform
vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Tests/Domain/RoleSecurityIdentityTest.php
PHP
mit
1,663
/*! jQuery v3.1.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/animatedSelector,-effects/Tween,-deprecated | (c) jQuery Foundation | jquery.org/license */ !function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/animatedSelector,-effects/Tween,-deprecated",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c<b?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:h,sort:c.sort,splice:c.splice},r.extend=r.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||r.isFunction(g)||(g={}),h===i&&(g=this,h--);h<i;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=r.isArray(d)))?(e?(e=!1,f=c&&r.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return!(!a||"[object Object]"!==k.call(a))&&(!(b=e(a))||(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n))},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;d<c;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;f<g;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,f=0,h=[];if(w(a))for(d=a.length;f<d;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;if("string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a))return d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"!==c&&!r.isWindow(a)&&("array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=c<0?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function ra(){}ra.prototype=d.filters=d.pseudos,d.setFilters=new ra,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=Q.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=R.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(P," ")}),h=h.slice(c.length));for(g in d.filter)!(e=V[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function sa(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e);return!1}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}return!1}}function ua(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d<e;d++)ga(a,b[d],c);return c}function wa(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;h<i;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i<f;i++)if(c=d.relative[a[i].type])m=[ta(ua(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;e<f;e++)if(d.relative[a[e].type])break;return xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i<e&&ya(a.slice(i,e)),e<f&&ya(a=a.slice(e)),e<f&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):C.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b<d;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;b<d;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a<c;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;d<e;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/[^\x20\t\r\n\f]+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){r.each(b,function(b,c){r.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==r.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return r.each(arguments,function(a,b){var c;while((c=r.inArray(b,f,c))>-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b<f)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,M,e),g(f,c,N,e)):(f++,j.call(a,g(f,c,M,e),g(f,c,N,e),g(f,c,M,c.notifyWith))):(d!==M&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1, holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h<i;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},T=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function U(){this.expando=r.expando+U.uid++}U.uid=1,U.prototype={cache:function(a){var b=a[this.expando];return b||(b={},T(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){r.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(K)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var V=new U,W=new U,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Y=/[A-Z]/g;function Z(a){return"true"===a||"false"!==a&&("null"===a?null:a===+a+""?+a:X.test(a)?JSON.parse(a):a)}function $(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Y,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c=Z(c)}catch(e){}W.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return W.hasData(a)||V.hasData(a)},data:function(a,b,c){return W.access(a,b,c)},removeData:function(a,b){W.remove(a,b)},_data:function(a,b,c){return V.access(a,b,c)},_removeData:function(a,b){V.remove(a,b)}}),r.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=W.get(f),1===f.nodeType&&!V.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),$(f,d,e[d])));V.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){W.set(this,a)}):S(this,function(b){var c;if(f&&void 0===b){if(c=W.get(f,a),void 0!==c)return c;if(c=$(f,a),void 0!==c)return c}else this.each(function(){W.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?r.queue(this[0],a):void 0===b?this:this.each(function(){var c=r.queue(this,a,b);r._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&r.dequeue(this,a)})},dequeue:function(a){return this.each(function(){r.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=r.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=V.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var _=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,aa=new RegExp("^(?:([+-])=|)("+_+")([a-z%]*)$","i"),ba=["Top","Right","Bottom","Left"],ca=function(a,b){return a=b||a,"none"===a.style.display||""===a.style.display&&r.contains(a.ownerDocument,a)&&"none"===r.css(a,"display")},da=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};function ea(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return r.css(a,b,"")},i=h(),j=c&&c[3]||(r.cssNumber[b]?"":"px"),k=(r.cssNumber[b]||"px"!==j&&+i)&&aa.exec(r.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,r.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var fa={};function ga(a){var b,c=a.ownerDocument,d=a.nodeName,e=fa[d];return e?e:(b=c.body.appendChild(c.createElement(d)),e=r.css(b,"display"),b.parentNode.removeChild(b),"none"===e&&(e="block"),fa[d]=e,e)}function ha(a,b){for(var c,d,e=[],f=0,g=a.length;f<g;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=V.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&ca(d)&&(e[f]=ga(d))):"none"!==c&&(e[f]="none",V.set(d,"display",c)));for(f=0;f<g;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ha(this,!0)},hide:function(){return ha(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){ca(this)?r(this).show():r(this).hide()})}});var ia=/^(?:checkbox|radio)$/i,ja=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,ka=/^$|\/(?:java|ecma)script/i,la={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};la.optgroup=la.option,la.tbody=la.tfoot=la.colgroup=la.caption=la.thead,la.th=la.td;function ma(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function na(a,b){for(var c=0,d=a.length;c<d;c++)V.set(a[c],"globalEval",!b||V.get(b[c],"globalEval"))}var oa=/<|&#?\w+;/;function pa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;n<o;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(oa.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ja.exec(f)||["",""])[1].toLowerCase(),i=la[h]||la._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=ma(l.appendChild(f),"script"),j&&na(g),c){k=0;while(f=g[k++])ka.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var qa=d.documentElement,ra=/^key/,sa=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ta=/^([^.]*)(?:\.(.+)|)/;function ua(){return!0}function va(){return!1}function wa(){try{return d.activeElement}catch(a){}}function xa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)xa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=va;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(qa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=ta.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c<arguments.length;c++)i[c]=arguments[c];if(b.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,b)!==!1){h=r.event.handlers.call(this,b,j),c=0;while((f=h[c++])&&!b.isPropagationStopped()){b.currentTarget=f.elem,d=0;while((g=f.handlers[d++])&&!b.isImmediatePropagationStopped())b.rnamespace&&!b.rnamespace.test(g.namespace)||(b.handleObj=g,b.data=g.data,e=((r.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(b.result=e)===!1&&(b.preventDefault(),b.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,b),b.result}},handlers:function(a,b){var c,d,e,f,g,h=[],i=b.delegateCount,j=a.target;if(i&&j.nodeType&&!("click"===a.type&&a.button>=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c<i;c++)d=b[c],e=d.selector+" ",void 0===g[e]&&(g[e]=d.needsContext?r(e,this).index(j)>-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i<b.length&&h.push({elem:j,handlers:b.slice(i)}),h},addProp:function(a,b){Object.defineProperty(r.Event.prototype,a,{enumerable:!0,configurable:!0,get:r.isFunction(b)?function(){if(this.originalEvent)return b(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[a]},set:function(b){Object.defineProperty(this,a,{enumerable:!0,configurable:!0,writable:!0,value:b})}})},fix:function(a){return a[r.expando]?a:new r.Event(a)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==wa()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===wa()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&r.nodeName(this,"input"))return this.click(),!1},_default:function(a){return r.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},r.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},r.Event=function(a,b){return this instanceof r.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ua:va,this.target=a.target&&3===a.target.nodeType?a.target.parentNode:a.target,this.currentTarget=a.currentTarget,this.relatedTarget=a.relatedTarget):this.type=a,b&&r.extend(this,b),this.timeStamp=a&&a.timeStamp||r.now(),void(this[r.expando]=!0)):new r.Event(a,b)},r.Event.prototype={constructor:r.Event,isDefaultPrevented:va,isPropagationStopped:va,isImmediatePropagationStopped:va,isSimulated:!1,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ua,a&&!this.isSimulated&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ua,a&&!this.isSimulated&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ua,a&&!this.isSimulated&&a.stopImmediatePropagation(),this.stopPropagation()}},r.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(a){var b=a.button;return null==a.which&&ra.test(a.type)?null!=a.charCode?a.charCode:a.keyCode:!a.which&&void 0!==b&&sa.test(a.type)?1&b?1:2&b?3:4&b?2:0:a.which}},r.event.addProp),r.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){r.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||r.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),r.fn.extend({on:function(a,b,c,d){return xa(this,a,b,c,d)},one:function(a,b,c,d){return xa(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,r(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=va),this.each(function(){r.event.remove(this,a,c,b)})}});var ya=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,za=/<script|<style|<link/i,Aa=/checked\s*(?:[^=]|=\s*.checked.)/i,Ba=/^true\/(.*)/,Ca=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function Da(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Ea(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Fa(a){var b=Ba.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ga(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c<d;c++)r.event.add(b,e,j[e][c])}W.hasData(a)&&(h=W.access(a),i=r.extend({},h),W.set(b,i))}}function Ha(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ia.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ia(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&Aa.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ia(f,b,c,d)});if(m&&(e=pa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(ma(e,"script"),Ea),i=h.length;l<m;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,ma(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Fa),l=0;l<i;l++)j=h[l],ka.test(j.type||"")&&!V.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Ca,""),k))}return a}function Ja(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(ma(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&na(ma(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(ya,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=ma(h),f=ma(a),d=0,e=f.length;d<e;d++)Ha(f[d],g[d]);if(b)if(c)for(f=f||ma(a),g=g||ma(h),d=0,e=f.length;d<e;d++)Ga(f[d],g[d]);else Ga(a,h);return g=ma(h,"script"),g.length>0&&na(g,!i&&ma(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ja(this,a,!0)},remove:function(a){return Ja(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.appendChild(a)}})},prepend:function(){return Ia(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Da(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ia(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(ma(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!za.test(a)&&!la[(ja.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c<d;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(ma(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ia(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(ma(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;g<=f;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var Ka=/^margin/,La=new RegExp("^("+_+")(?!px)[a-z%]+$","i"),Ma=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",qa.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,qa.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Na(a,b,c){var d,e,f,g,h=a.style;return c=c||Ma(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&La.test(g)&&Ka.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function Oa(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Pa=/^(none|table(?!-c[ea]).+)/,Qa={position:"absolute",visibility:"hidden",display:"block"},Ra={letterSpacing:"0",fontWeight:"400"},Sa=["Webkit","Moz","ms"],Ta=d.createElement("div").style;function Ua(a){if(a in Ta)return a;var b=a[0].toUpperCase()+a.slice(1),c=Sa.length;while(c--)if(a=Sa[c]+b,a in Ta)return a}function Va(a,b,c){var d=aa.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Wa(a,b,c,d,e){var f,g=0;for(f=c===(d?"border":"content")?4:"width"===b?1:0;f<4;f+=2)"margin"===c&&(g+=r.css(a,c+ba[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+ba[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+ba[f]+"Width",!0,e))):(g+=r.css(a,"padding"+ba[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+ba[f]+"Width",!0,e)));return g}function Xa(a,b,c){var d,e=!0,f=Ma(a),g="border-box"===r.css(a,"boxSizing",!1,f);if(a.getClientRects().length&&(d=a.getBoundingClientRect()[b]),d<=0||null==d){if(d=Na(a,b,f),(d<0||null==d)&&(d=a.style[b]),La.test(d))return d;e=g&&(o.boxSizingReliable()||d===a.style[b]),d=parseFloat(d)||0}return d+Wa(a,b,c||(g?"border":"content"),e,f)+"px"}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Na(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=a.style;return b=r.cssProps[h]||(r.cssProps[h]=Ua(h)||h),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=aa.exec(c))&&e[1]&&(c=ea(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b);return b=r.cssProps[h]||(r.cssProps[h]=Ua(h)||h),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Na(a,b,d)),"normal"===e&&b in Ra&&(e=Ra[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){if(c)return!Pa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?Xa(a,b,d):da(a,Qa,function(){return Xa(a,b,d)})},set:function(a,c,d){var e,f=d&&Ma(a),g=d&&Wa(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=aa.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Va(a,c,g)}}}),r.cssHooks.marginLeft=Oa(o.reliableMarginLeft,function(a,b){if(b)return(parseFloat(Na(a,"marginLeft"))||a.getBoundingClientRect().left-da(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px"}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];d<4;d++)e[a+ba[d]+b]=f[d]||f[d-2]||f[0];return e}},Ka.test(a)||(r.cssHooks[a+b].set=Va)}),r.fn.extend({css:function(a,b){return S(this,function(a,b,c){var d,e,f={},g=0;if(r.isArray(b)){for(d=Ma(a),e=b.length;g<e;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}}),r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",o.checkOn=""!==a.value,o.optSelected=c.selected,a=d.createElement("input"),a.value="t",a.type="radio",o.radioValue="t"===a.value}();var Ya,Za=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return S(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?Ya:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),Ya={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=Za[b]||r.find.attr;Za[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=Za[g],Za[g]=e,e=null!=c(a,b,d)?g:null,Za[g]=f),e}});var $a=/^(?:input|select|textarea|button)$/i,_a=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):$a.test(a.nodeName)||_a.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function ab(a){var b=a.match(K)||[];return b.join(" ")}function bb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,bb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=bb(c),d=1===c.nodeType&&" "+ab(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=ab(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,bb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=bb(c),d=1===c.nodeType&&" "+ab(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=ab(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,bb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=bb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+ab(bb(c))+" ").indexOf(b)>-1)return!0;return!1}});var cb=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(cb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:ab(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d<i;d++)if(c=e[d],(c.selected||d===f)&&!c.disabled&&(!c.parentNode.disabled||!r.nodeName(c.parentNode,"optgroup"))){if(b=r(c).val(),g)return b;h.push(b)}return h},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var db=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!db.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,db.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var eb=/\[\]$/,fb=/\r?\n/g,gb=/^(?:submit|button|image|reset|file)$/i,hb=/^(?:input|select|textarea|keygen)/i;function ib(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||eb.test(a)?d(a,e):ib(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d); });else if(c||"object"!==r.type(b))d(a,b);else for(e in b)ib(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)ib(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&hb.test(this.nodeName)&&!gb.test(a)&&(this.checked||!ia.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(fb,"\r\n")}}):{name:b.name,value:c.replace(fb,"\r\n")}}).get()}}),r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="<form></form><form></form>",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if("string"!=typeof a)return[];"boolean"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(""),e=b.createElement("base"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=B.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=pa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))};function jb(a){return r.isWindow(a)?a:9===a.nodeType&&a.defaultView}r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,"position"),l=r(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=r.css(a,"top"),i=r.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&&(b=b.call(a,c,r.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),d.width||d.height?(e=f.ownerDocument,c=jb(e),b=e.documentElement,{top:d.top+c.pageYOffset-b.clientTop,left:d.left+c.pageXOffset-b.clientLeft}):d):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===r.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),r.nodeName(a[0],"html")||(d=a.offset()),d={top:d.top+r.css(a[0],"borderTopWidth",!0),left:d.left+r.css(a[0],"borderLeftWidth",!0)}),{top:b.top-d.top-r.css(c,"marginTop",!0),left:b.left-d.left-r.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===r.css(a,"position"))a=a.offsetParent;return a||qa})}}),r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;r.fn[a]=function(d){return S(this,function(a,d,e){var f=jb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each(["top","left"],function(a,b){r.cssHooks[b]=Oa(o.pixelPosition,function(a,c){if(c)return c=Na(a,b),La.test(c)?r(a).position()[b]+"px":c})}),r.each({Height:"height",Width:"width"},function(a,b){r.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||"boolean"!=typeof e),h=c||(e===!0||f===!0?"margin":"border");return S(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf("outer")?b["inner"+a]:b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),"function"==typeof define&&define.amd&&define("jquery",[],function(){return r});var kb=a.jQuery,lb=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=lb),b&&a.jQuery===r&&(a.jQuery=kb),r},b||(a.jQuery=a.$=r),r});
teihoata/llamas
WebApp/wwwroot/lib/jquery/dist/jquery.slim.min.js
JavaScript
mit
69,309
/*! * Jade - nodes - Tag * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca> * MIT Licensed */ /** * Module dependencies. */ var Attrs = require('./attrs'), Block = require('./block'), inlineTags = require('../inline-tags'); /** * Initialize a `Tag` node with the given tag `name` and optional `block`. * * @param {String} name * @param {Block} block * @api public */ var Tag = module.exports = function Tag(name, block) { this.name = name; this.attrs = []; this.block = block || new Block; }; /** * Inherit from `Attrs`. */ Tag.prototype.__proto__ = Attrs.prototype; /** * Clone this tag. * * @return {Tag} * @api private */ Tag.prototype.clone = function(){ var clone = new Tag(this.name, this.block.clone()); clone.line = this.line; clone.attrs = this.attrs; clone.textOnly = this.textOnly; return clone; }; /** * Check if this tag is an inline tag. * * @return {Boolean} * @api private */ Tag.prototype.isInline = function(){ return ~inlineTags.indexOf(this.name); }; /** * Check if this tag's contents can be inlined. Used for pretty printing. * * @return {Boolean} * @api private */ Tag.prototype.canInline = function(){ var nodes = this.block.nodes; function isInline(node){ // Recurse if the node is a block if (node.isBlock) return node.nodes.every(isInline); return node.isText || (node.isInline && node.isInline()); } // Empty tag if (!nodes.length) return true; // Text-only or inline-only tag if (1 == nodes.length) return isInline(nodes[0]); // Multi-line inline-only tag if (this.block.nodes.every(isInline)) { for (var i = 1, len = nodes.length; i < len; ++i) { if (nodes[i-1].isText && nodes[i].isText) return false; } return true; } // Mixed tag return false; };
mabuodeh/image-interact-js
node_modules/jade/lib/nodes/tag.js
JavaScript
mit
1,828
<!DOCTYPE html> <html> <head> <meta charset='utf-8'> <title>listing directory {directory}</title> <style>{style}</style> <script> function $(id){ var el = 'string' == typeof id ? document.getElementById(id) : id; el.on = function(event, fn){ if ('content loaded' == event) { event = window.attachEvent ? "load" : "DOMContentLoaded"; } el.addEventListener ? el.addEventListener(event, fn, false) : el.attachEvent("on" + event, fn); }; el.all = function(selector){ return $(el.querySelectorAll(selector)); }; el.each = function(fn){ for (var i = 0, len = el.length; i < len; ++i) { fn($(el[i]), i); } }; el.getClasses = function(){ return this.getAttribute('class').split(/\s+/); }; el.addClass = function(name){ var classes = this.getAttribute('class'); el.setAttribute('class', classes ? classes + ' ' + name : name); }; el.removeClass = function(name){ var classes = this.getClasses().filter(function(curr){ return curr != name; }); this.setAttribute('class', classes); }; return el; } function search() { var str = $('search').value , links = $('files').all('a'); links.each(function(link){ var text = link.textContent; if ('..' == text) return; if (str.length && ~text.indexOf(str)) { link.addClass('highlight'); } else { link.removeClass('highlight'); } }); } $(window).on('content loaded', function(){ $('search').on('keyup', search); }); </script> </head> <body class="directory"> <input id="search" type="text" placeholder="Search" autocomplete="off" /> <div id="wrapper"> <h1>{linked-path}</h1> {files} </div> </body> </html>
rachelelle/module
node_modules/grunt-contrib-connect/node_modules/connect/lib/public/directory.html
HTML
mit
2,085
<?php /** * @package Akismet */ class Akismet_Widget extends WP_Widget { function __construct() { parent::__construct( 'akismet_widget', __( 'Akismet Widget' ), array( 'description' => __( 'Display the number of spam comments Akismet has caught' ) ) ); if ( is_active_widget( false, false, $this->id_base ) ) { add_action( 'wp_head', array( $this, 'css' ) ); } } function css() { ?> <style type="text/css"> .a-stats { width: auto; } .a-stats a { background: #7CA821; background-image:-moz-linear-gradient(0% 100% 90deg,#5F8E14,#7CA821); background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#7CA821),to(#5F8E14)); border: 1px solid #5F8E14; border-radius:3px; color: #CFEA93; cursor: pointer; display: block; font-weight: normal; height: 100%; -moz-border-radius:3px; padding: 7px 0 8px; text-align: center; text-decoration: none; -webkit-border-radius:3px; width: 100%; } .a-stats a:hover { text-decoration: none; background-image:-moz-linear-gradient(0% 100% 90deg,#6F9C1B,#659417); background-image:-webkit-gradient(linear,0% 0,0% 100%,from(#659417),to(#6F9C1B)); } .a-stats .count { color: #FFF; display: block; font-size: 15px; line-height: 16px; padding: 0 13px; white-space: nowrap; } </style> <?php } function form( $instance ) { if ( $instance ) { $title = esc_attr( $instance['title'] ); } else { $title = __( 'Spam Blocked' ); } ?> <p> <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /> </p> <?php } function update( $new_instance, $old_instance ) { $instance['title'] = strip_tags( $new_instance['title'] ); return $instance; } function widget( $args, $instance ) { $count = get_option( 'akismet_spam_count' ); echo $args['before_widget']; if ( ! empty( $instance['title'] ) ) { echo $args['before_title']; echo esc_html( $instance['title'] ); echo $args['after_title']; } ?> <div class="a-stats"> <a href="http://akismet.com" target="_blank" title=""><?php printf( _n( '<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>', '<strong class="count">%1$s spam</strong> blocked by <strong>Akismet</strong>', $count ), number_format_i18n( $count ) ); ?></a> </div> <?php echo $args['after_widget']; } } function akismet_register_widgets() { register_widget( 'Akismet_Widget' ); } add_action( 'widgets_init', 'akismet_register_widgets' );
CodeForKids/websitesByKids
subdomains/pa/wp-content/plugins/akismet/widget.php
PHP
mit
2,618
/* Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'flash', 'cs', { access: 'Přístup ke skriptu', accessAlways: 'Vždy', accessNever: 'Nikdy', accessSameDomain: 'Ve stejné doméně', alignAbsBottom: 'Zcela dolů', alignAbsMiddle: 'Doprostřed', alignBaseline: 'Na účaří', alignTextTop: 'Na horní okraj textu', bgcolor: 'Barva pozadí', chkFull: 'Povolit celoobrazovkový režim', chkLoop: 'Opakování', chkMenu: 'Nabídka Flash', chkPlay: 'Automatické spuštění', flashvars: 'Proměnné pro Flash', hSpace: 'Horizontální mezera', properties: 'Vlastnosti Flashe', propertiesTab: 'Vlastnosti', quality: 'Kvalita', qualityAutoHigh: 'Vysoká - auto', qualityAutoLow: 'Nízká - auto', qualityBest: 'Nejlepší', qualityHigh: 'Vysoká', qualityLow: 'Nejnižší', qualityMedium: 'Střední', scale: 'Zobrazit', scaleAll: 'Zobrazit vše', scaleFit: 'Přizpůsobit', scaleNoBorder: 'Bez okraje', title: 'Vlastnosti Flashe', vSpace: 'Vertikální mezera', validateHSpace: 'Zadaná horizontální mezera musí být číslo.', validateSrc: 'Zadejte prosím URL odkazu', validateVSpace: 'Zadaná vertikální mezera musí být číslo.', windowMode: 'Režim okna', windowModeOpaque: 'Neprůhledné', windowModeTransparent: 'Průhledné', windowModeWindow: 'Okno' });
akkumar/jsdelivr
files/ckeditor/4.3.0/plugins/flash/lang/cs.js
JavaScript
mit
1,428
/** * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or http://ckeditor.com/license */ /** * @fileOverview Defines the {@link CKEDITOR.lang} object, for the * Vietnamese language. */ /**#@+ @type String @example */ /** * Contains the dictionary of language entries. * @namespace */ CKEDITOR.lang[ 'vi' ] = { // ARIA description. editor: 'Bộ soạn thảo văn bản có định dạng', editorPanel: 'Rich Text Editor panel', // MISSING // Common messages and labels. common: { // Screenreader titles. Please note that screenreaders are not always capable // of reading non-English words. So be careful while translating it. editorHelp: 'Nhấn ALT + 0 để được giúp đỡ', browseServer: 'Duyệt máy chủ', url: 'URL', protocol: 'Giao thức', upload: 'Tải lên', uploadSubmit: 'Tải lên máy chủ', image: 'Hình ảnh', flash: 'Flash', form: 'Biểu mẫu', checkbox: 'Nút kiểm', radio: 'Nút chọn', textField: 'Trường văn bản', textarea: 'Vùng văn bản', hiddenField: 'Trường ẩn', button: 'Nút', select: 'Ô chọn', imageButton: 'Nút hình ảnh', notSet: '<không thiết lập>', id: 'Định danh', name: 'Tên', langDir: 'Hướng ngôn ngữ', langDirLtr: 'Trái sang phải (LTR)', langDirRtl: 'Phải sang trái (RTL)', langCode: 'Mã ngôn ngữ', longDescr: 'Mô tả URL', cssClass: 'Lớp Stylesheet', advisoryTitle: 'Nhan đề hướng dẫn', cssStyle: 'Kiểu (style)', ok: 'Đồng ý', cancel: 'Bỏ qua', close: 'Đóng', preview: 'Xem trước', resize: 'Kéo rê để thay đổi kích cỡ', generalTab: 'Tab chung', advancedTab: 'Tab mở rộng', validateNumberFailed: 'Giá trị này không phải là số.', confirmNewPage: 'Mọi thay đổi không được lưu lại, nội dung này sẽ bị mất. Bạn có chắc chắn muốn tải một trang mới?', confirmCancel: 'Một vài tùy chọn đã bị thay đổi. Bạn có chắc chắn muốn đóng hộp thoại?', options: 'Tùy chọn', target: 'Đích đến', targetNew: 'Cửa sổ mới (_blank)', targetTop: 'Cửa sổ trên cùng (_top)', targetSelf: 'Tại trang (_self)', targetParent: 'Cửa sổ cha (_parent)', langDirLTR: 'Trái sang phải (LTR)', langDirRTL: 'Phải sang trái (RTL)', styles: 'Kiểu', cssClasses: 'Lớp CSS', width: 'Chiều rộng', height: 'chiều cao', align: 'Vị trí', alignLeft: 'Trái', alignRight: 'Phải', alignCenter: 'Giữa', alignTop: 'Trên', alignMiddle: 'Giữa', alignBottom: 'Dưới', invalidValue : 'Giá trị không hợp lệ.', invalidHeight: 'Chiều cao phải là số nguyên.', invalidWidth: 'Chiều rộng phải là số nguyên.', invalidCssLength: 'Giá trị quy định cho trường "%1" phải là một số dương có hoặc không có một đơn vị đo CSS hợp lệ (px, %, in, cm, mm, em, ex, pt, hoặc pc).', invalidHtmlLength: 'Giá trị quy định cho trường "%1" phải là một số dương có hoặc không có một đơn vị đo HTML hợp lệ (px hoặc %).', invalidInlineStyle: 'Giá trị quy định cho kiểu nội tuyến phải bao gồm một hoặc nhiều dữ liệu với định dạng "tên:giá trị", cách nhau bằng dấu chấm phẩy.', cssLengthTooltip: 'Nhập một giá trị theo pixel hoặc một số với một đơn vị CSS hợp lệ (px, %, in, cm, mm, em, ex, pt, hoặc pc).', // Put the voice-only part of the label in the span. unavailable: '%1<span class="cke_accessibility">, không có</span>' } };
cedricbousmanne/jsdelivr
files/ckeditor/4.3.0/lang/vi.js
JavaScript
mit
3,722
function similar_text (first, second, percent) { // http://kevin.vanzonneveld.net // + original by: Rafał Kukawski (http://blog.kukawski.pl) // + bugfixed by: Chris McMacken // + added percent parameter by: Markus Padourek (taken from http://www.kevinhq.com/2012/06/php-similartext-function-in-javascript_16.html) // * example 1: similar_text('Hello World!', 'Hello phpjs!'); // * returns 1: 7 // * example 2: similar_text('Hello World!', null); // * returns 2: 0 // * example 3: similar_text('Hello World!', null, 1); // * returns 3: 58.33 // * bugfixed by: Jarkko Rantavuori based on findings in stackoverflow (http://stackoverflow.com/questions/14136349/how-does-similar-text-work) if (first === null || second === null || typeof first === 'undefined' || typeof second === 'undefined') { return 0; } first += ''; second += ''; var pos1 = 0, pos2 = 0, max = 0, firstLength = first.length, secondLength = second.length, p, q, l, sum; max = 0; for (p = 0; p < firstLength; p++) { for (q = 0; q < secondLength; q++) { for (l = 0; (p + l < firstLength) && (q + l < secondLength) && (first.charAt(p + l) === second.charAt(q + l)); l++); if (l > max) { max = l; pos1 = p; pos2 = q; } } } sum = max; if (sum) { if (pos1 && pos2) { sum += this.similar_text(first.substr(0, pos1), second.substr(0, pos2)); } if ((pos1 + max < firstLength) && (pos2 + max < secondLength)) { sum += this.similar_text(first.substr(pos1 + max, firstLength - pos1 - max), second.substr(pos2 + max, secondLength - pos2 - max)); } } if (!percent) { return sum; } else { return (sum * 200) / (firstLength + secondLength); } }
as-com/jsdelivr-squashed
files/phpjs/0.1/strings/similar_text.js
JavaScript
mit
1,801
/* * angular-ui-bootstrap * http://angular-ui.github.io/bootstrap/ * Version: 1.2.5 - 2016-03-20 * License: MIT */angular.module("ui.bootstrap", ["ui.bootstrap.tpls", "ui.bootstrap.collapse","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.isClass","ui.bootstrap.position","ui.bootstrap.datepicker","ui.bootstrap.debounce","ui.bootstrap.dropdown","ui.bootstrap.stackedMap","ui.bootstrap.modal","ui.bootstrap.paging","ui.bootstrap.pager","ui.bootstrap.pagination","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.timepicker","ui.bootstrap.typeahead"]); angular.module("ui.bootstrap.tpls", ["uib/template/accordion/accordion-group.html","uib/template/accordion/accordion.html","uib/template/alert/alert.html","uib/template/carousel/carousel.html","uib/template/carousel/slide.html","uib/template/datepicker/datepicker.html","uib/template/datepicker/day.html","uib/template/datepicker/month.html","uib/template/datepicker/popup.html","uib/template/datepicker/year.html","uib/template/modal/backdrop.html","uib/template/modal/window.html","uib/template/pager/pager.html","uib/template/pagination/pagination.html","uib/template/tooltip/tooltip-html-popup.html","uib/template/tooltip/tooltip-popup.html","uib/template/tooltip/tooltip-template-popup.html","uib/template/popover/popover-html.html","uib/template/popover/popover-template.html","uib/template/popover/popover.html","uib/template/progressbar/bar.html","uib/template/progressbar/progress.html","uib/template/progressbar/progressbar.html","uib/template/rating/rating.html","uib/template/tabs/tab.html","uib/template/tabs/tabset.html","uib/template/timepicker/timepicker.html","uib/template/typeahead/typeahead-match.html","uib/template/typeahead/typeahead-popup.html"]); angular.module('ui.bootstrap.collapse', []) .directive('uibCollapse', ['$animate', '$q', '$parse', '$injector', function($animate, $q, $parse, $injector) { var $animateCss = $injector.has('$animateCss') ? $injector.get('$animateCss') : null; return { link: function(scope, element, attrs) { var expandingExpr = $parse(attrs.expanding), expandedExpr = $parse(attrs.expanded), collapsingExpr = $parse(attrs.collapsing), collapsedExpr = $parse(attrs.collapsed); if (!scope.$eval(attrs.uibCollapse)) { element.addClass('in') .addClass('collapse') .attr('aria-expanded', true) .attr('aria-hidden', false) .css({height: 'auto'}); } function expand() { if (element.hasClass('collapse') && element.hasClass('in')) { return; } $q.resolve(expandingExpr(scope)) .then(function() { element.removeClass('collapse') .addClass('collapsing') .attr('aria-expanded', true) .attr('aria-hidden', false); if ($animateCss) { $animateCss(element, { addClass: 'in', easing: 'ease', to: { height: element[0].scrollHeight + 'px' } }).start()['finally'](expandDone); } else { $animate.addClass(element, 'in', { to: { height: element[0].scrollHeight + 'px' } }).then(expandDone); } }); } function expandDone() { element.removeClass('collapsing') .addClass('collapse') .css({height: 'auto'}); expandedExpr(scope); } function collapse() { if (!element.hasClass('collapse') && !element.hasClass('in')) { return collapseDone(); } $q.resolve(collapsingExpr(scope)) .then(function() { element // IMPORTANT: The height must be set before adding "collapsing" class. // Otherwise, the browser attempts to animate from height 0 (in // collapsing class) to the given height here. .css({height: element[0].scrollHeight + 'px'}) // initially all panel collapse have the collapse class, this removal // prevents the animation from jumping to collapsed state .removeClass('collapse') .addClass('collapsing') .attr('aria-expanded', false) .attr('aria-hidden', true); if ($animateCss) { $animateCss(element, { removeClass: 'in', to: {height: '0'} }).start()['finally'](collapseDone); } else { $animate.removeClass(element, 'in', { to: {height: '0'} }).then(collapseDone); } }); } function collapseDone() { element.css({height: '0'}); // Required so that collapse works when animation is disabled element.removeClass('collapsing') .addClass('collapse'); collapsedExpr(scope); } scope.$watch(attrs.uibCollapse, function(shouldCollapse) { if (shouldCollapse) { collapse(); } else { expand(); } }); } }; }]); angular.module('ui.bootstrap.accordion', ['ui.bootstrap.collapse']) .constant('uibAccordionConfig', { closeOthers: true }) .controller('UibAccordionController', ['$scope', '$attrs', 'uibAccordionConfig', function($scope, $attrs, accordionConfig) { // This array keeps track of the accordion groups this.groups = []; // Ensure that all the groups in this accordion are closed, unless close-others explicitly says not to this.closeOthers = function(openGroup) { var closeOthers = angular.isDefined($attrs.closeOthers) ? $scope.$eval($attrs.closeOthers) : accordionConfig.closeOthers; if (closeOthers) { angular.forEach(this.groups, function(group) { if (group !== openGroup) { group.isOpen = false; } }); } }; // This is called from the accordion-group directive to add itself to the accordion this.addGroup = function(groupScope) { var that = this; this.groups.push(groupScope); groupScope.$on('$destroy', function(event) { that.removeGroup(groupScope); }); }; // This is called from the accordion-group directive when to remove itself this.removeGroup = function(group) { var index = this.groups.indexOf(group); if (index !== -1) { this.groups.splice(index, 1); } }; }]) // The accordion directive simply sets up the directive controller // and adds an accordion CSS class to itself element. .directive('uibAccordion', function() { return { controller: 'UibAccordionController', controllerAs: 'accordion', transclude: true, templateUrl: function(element, attrs) { return attrs.templateUrl || 'uib/template/accordion/accordion.html'; } }; }) // The accordion-group directive indicates a block of html that will expand and collapse in an accordion .directive('uibAccordionGroup', function() { return { require: '^uibAccordion', // We need this directive to be inside an accordion transclude: true, // It transcludes the contents of the directive into the template replace: true, // The element containing the directive will be replaced with the template templateUrl: function(element, attrs) { return attrs.templateUrl || 'uib/template/accordion/accordion-group.html'; }, scope: { heading: '@', // Interpolate the heading attribute onto this scope panelClass: '@?', // Ditto with panelClass isOpen: '=?', isDisabled: '=?' }, controller: function() { this.setHeading = function(element) { this.heading = element; }; }, link: function(scope, element, attrs, accordionCtrl) { accordionCtrl.addGroup(scope); scope.openClass = attrs.openClass || 'panel-open'; scope.panelClass = attrs.panelClass || 'panel-default'; scope.$watch('isOpen', function(value) { element.toggleClass(scope.openClass, !!value); if (value) { accordionCtrl.closeOthers(scope); } }); scope.toggleOpen = function($event) { if (!scope.isDisabled) { if (!$event || $event.which === 32) { scope.isOpen = !scope.isOpen; } } }; var id = 'accordiongroup-' + scope.$id + '-' + Math.floor(Math.random() * 10000); scope.headingId = id + '-tab'; scope.panelId = id + '-panel'; } }; }) // Use accordion-heading below an accordion-group to provide a heading containing HTML .directive('uibAccordionHeading', function() { return { transclude: true, // Grab the contents to be used as the heading template: '', // In effect remove this element! replace: true, require: '^uibAccordionGroup', link: function(scope, element, attrs, accordionGroupCtrl, transclude) { // Pass the heading to the accordion-group controller // so that it can be transcluded into the right place in the template // [The second parameter to transclude causes the elements to be cloned so that they work in ng-repeat] accordionGroupCtrl.setHeading(transclude(scope, angular.noop)); } }; }) // Use in the accordion-group template to indicate where you want the heading to be transcluded // You must provide the property on the accordion-group controller that will hold the transcluded element .directive('uibAccordionTransclude', function() { return { require: '^uibAccordionGroup', link: function(scope, element, attrs, controller) { scope.$watch(function() { return controller[attrs.uibAccordionTransclude]; }, function(heading) { if (heading) { var elem = angular.element(element[0].querySelector('[uib-accordion-header]')); elem.html(''); elem.append(heading); } }); } }; }); angular.module('ui.bootstrap.alert', []) .controller('UibAlertController', ['$scope', '$attrs', '$interpolate', '$timeout', function($scope, $attrs, $interpolate, $timeout) { $scope.closeable = !!$attrs.close; var dismissOnTimeout = angular.isDefined($attrs.dismissOnTimeout) ? $interpolate($attrs.dismissOnTimeout)($scope.$parent) : null; if (dismissOnTimeout) { $timeout(function() { $scope.close(); }, parseInt(dismissOnTimeout, 10)); } }]) .directive('uibAlert', function() { return { controller: 'UibAlertController', controllerAs: 'alert', templateUrl: function(element, attrs) { return attrs.templateUrl || 'uib/template/alert/alert.html'; }, transclude: true, replace: true, scope: { type: '@', close: '&' } }; }); angular.module('ui.bootstrap.buttons', []) .constant('uibButtonConfig', { activeClass: 'active', toggleEvent: 'click' }) .controller('UibButtonsController', ['uibButtonConfig', function(buttonConfig) { this.activeClass = buttonConfig.activeClass || 'active'; this.toggleEvent = buttonConfig.toggleEvent || 'click'; }]) .directive('uibBtnRadio', ['$parse', function($parse) { return { require: ['uibBtnRadio', 'ngModel'], controller: 'UibButtonsController', controllerAs: 'buttons', link: function(scope, element, attrs, ctrls) { var buttonsCtrl = ctrls[0], ngModelCtrl = ctrls[1]; var uncheckableExpr = $parse(attrs.uibUncheckable); element.find('input').css({display: 'none'}); //model -> UI ngModelCtrl.$render = function() { element.toggleClass(buttonsCtrl.activeClass, angular.equals(ngModelCtrl.$modelValue, scope.$eval(attrs.uibBtnRadio))); }; //ui->model element.on(buttonsCtrl.toggleEvent, function() { if (attrs.disabled) { return; } var isActive = element.hasClass(buttonsCtrl.activeClass); if (!isActive || angular.isDefined(attrs.uncheckable)) { scope.$apply(function() { ngModelCtrl.$setViewValue(isActive ? null : scope.$eval(attrs.uibBtnRadio)); ngModelCtrl.$render(); }); } }); if (attrs.uibUncheckable) { scope.$watch(uncheckableExpr, function(uncheckable) { attrs.$set('uncheckable', uncheckable ? '' : undefined); }); } } }; }]) .directive('uibBtnCheckbox', function() { return { require: ['uibBtnCheckbox', 'ngModel'], controller: 'UibButtonsController', controllerAs: 'button', link: function(scope, element, attrs, ctrls) { var buttonsCtrl = ctrls[0], ngModelCtrl = ctrls[1]; element.find('input').css({display: 'none'}); function getTrueValue() { return getCheckboxValue(attrs.btnCheckboxTrue, true); } function getFalseValue() { return getCheckboxValue(attrs.btnCheckboxFalse, false); } function getCheckboxValue(attribute, defaultValue) { return angular.isDefined(attribute) ? scope.$eval(attribute) : defaultValue; } //model -> UI ngModelCtrl.$render = function() { element.toggleClass(buttonsCtrl.activeClass, angular.equals(ngModelCtrl.$modelValue, getTrueValue())); }; //ui->model element.on(buttonsCtrl.toggleEvent, function() { if (attrs.disabled) { return; } scope.$apply(function() { ngModelCtrl.$setViewValue(element.hasClass(buttonsCtrl.activeClass) ? getFalseValue() : getTrueValue()); ngModelCtrl.$render(); }); }); } }; }); angular.module('ui.bootstrap.carousel', []) .controller('UibCarouselController', ['$scope', '$element', '$interval', '$timeout', '$animate', function($scope, $element, $interval, $timeout, $animate) { var self = this, slides = self.slides = $scope.slides = [], SLIDE_DIRECTION = 'uib-slideDirection', currentIndex = $scope.active, currentInterval, isPlaying, bufferedTransitions = []; var destroyed = false; self.addSlide = function(slide, element) { slides.push({ slide: slide, element: element }); slides.sort(function(a, b) { return +a.slide.index > +b.slide.index; }); //if this is the first slide or the slide is set to active, select it if (slide.index === $scope.active || slides.length === 1 && !angular.isNumber($scope.active)) { if ($scope.$currentTransition) { $scope.$currentTransition = null; } currentIndex = slide.index; $scope.active = slide.index; setActive(currentIndex); self.select(slides[findSlideIndex(slide)]); if (slides.length === 1) { $scope.play(); } } }; self.getCurrentIndex = function() { for (var i = 0; i < slides.length; i++) { if (slides[i].slide.index === currentIndex) { return i; } } }; self.next = $scope.next = function() { var newIndex = (self.getCurrentIndex() + 1) % slides.length; if (newIndex === 0 && $scope.noWrap()) { $scope.pause(); return; } return self.select(slides[newIndex], 'next'); }; self.prev = $scope.prev = function() { var newIndex = self.getCurrentIndex() - 1 < 0 ? slides.length - 1 : self.getCurrentIndex() - 1; if ($scope.noWrap() && newIndex === slides.length - 1) { $scope.pause(); return; } return self.select(slides[newIndex], 'prev'); }; self.removeSlide = function(slide) { var index = findSlideIndex(slide); var bufferedIndex = bufferedTransitions.indexOf(slides[index]); if (bufferedIndex !== -1) { bufferedTransitions.splice(bufferedIndex, 1); } //get the index of the slide inside the carousel slides.splice(index, 1); if (slides.length > 0 && currentIndex === index) { if (index >= slides.length) { currentIndex = slides.length - 1; $scope.active = currentIndex; setActive(currentIndex); self.select(slides[slides.length - 1]); } else { currentIndex = index; $scope.active = currentIndex; setActive(currentIndex); self.select(slides[index]); } } else if (currentIndex > index) { currentIndex--; $scope.active = currentIndex; } //clean the active value when no more slide if (slides.length === 0) { currentIndex = null; $scope.active = null; clearBufferedTransitions(); } }; /* direction: "prev" or "next" */ self.select = $scope.select = function(nextSlide, direction) { var nextIndex = findSlideIndex(nextSlide.slide); //Decide direction if it's not given if (direction === undefined) { direction = nextIndex > self.getCurrentIndex() ? 'next' : 'prev'; } //Prevent this user-triggered transition from occurring if there is already one in progress if (nextSlide.slide.index !== currentIndex && !$scope.$currentTransition) { goNext(nextSlide.slide, nextIndex, direction); } else if (nextSlide && nextSlide.slide.index !== currentIndex && $scope.$currentTransition) { bufferedTransitions.push(slides[nextIndex]); } }; /* Allow outside people to call indexOf on slides array */ $scope.indexOfSlide = function(slide) { return +slide.slide.index; }; $scope.isActive = function(slide) { return $scope.active === slide.slide.index; }; $scope.pause = function() { if (!$scope.noPause) { isPlaying = false; resetTimer(); } }; $scope.play = function() { if (!isPlaying) { isPlaying = true; restartTimer(); } }; $scope.$on('$destroy', function() { destroyed = true; resetTimer(); }); $scope.$watch('noTransition', function(noTransition) { $animate.enabled($element, !noTransition); }); $scope.$watch('interval', restartTimer); $scope.$watchCollection('slides', resetTransition); $scope.$watch('active', function(index) { if (angular.isNumber(index) && currentIndex !== index) { for (var i = 0; i < slides.length; i++) { if (slides[i].slide.index === index) { index = i; break; } } var slide = slides[index]; if (slide) { currentIndex = index; setActive(index); self.select(slides[index]); } } }); function clearBufferedTransitions() { while (bufferedTransitions.length) { bufferedTransitions.shift(); } } function getSlideByIndex(index) { for (var i = 0, l = slides.length; i < l; ++i) { if (slides[i].index === index) { return slides[i]; } } } function setActive(index) { for (var i = 0; i < slides.length; i++) { slides[i].slide.active = i === index; } } function goNext(slide, index, direction) { if (destroyed) { return; } angular.extend(slide, {direction: direction}); angular.extend(slides[currentIndex].slide || {}, {direction: direction}); if ($animate.enabled($element) && !$scope.$currentTransition && slides[index].element && self.slides.length > 1) { slides[index].element.data(SLIDE_DIRECTION, slide.direction); var currentIdx = self.getCurrentIndex(); if (angular.isNumber(currentIdx) && slides[currentIdx].element) { slides[currentIdx].element.data(SLIDE_DIRECTION, slide.direction); } $scope.$currentTransition = true; $animate.on('addClass', slides[index].element, function(element, phase) { if (phase === 'close') { $scope.$currentTransition = null; $animate.off('addClass', element); if (bufferedTransitions.length) { var nextSlide = bufferedTransitions.pop().slide; var nextIndex = nextSlide.index; var nextDirection = nextIndex > self.getCurrentIndex() ? 'next' : 'prev'; clearBufferedTransitions(); goNext(nextSlide, nextIndex, nextDirection); } } }); } $scope.active = slide.index; currentIndex = slide.index; setActive(index); //every time you change slides, reset the timer restartTimer(); } function findSlideIndex(slide) { for (var i = 0; i < slides.length; i++) { if (slides[i].slide === slide) { return i; } } } function resetTimer() { if (currentInterval) { $interval.cancel(currentInterval); currentInterval = null; } } function resetTransition(slides) { if (!slides.length) { $scope.$currentTransition = null; clearBufferedTransitions(); } } function restartTimer() { resetTimer(); var interval = +$scope.interval; if (!isNaN(interval) && interval > 0) { currentInterval = $interval(timerFn, interval); } } function timerFn() { var interval = +$scope.interval; if (isPlaying && !isNaN(interval) && interval > 0 && slides.length) { $scope.next(); } else { $scope.pause(); } } }]) .directive('uibCarousel', function() { return { transclude: true, replace: true, controller: 'UibCarouselController', controllerAs: 'carousel', templateUrl: function(element, attrs) { return attrs.templateUrl || 'uib/template/carousel/carousel.html'; }, scope: { active: '=', interval: '=', noTransition: '=', noPause: '=', noWrap: '&' } }; }) .directive('uibSlide', function() { return { require: '^uibCarousel', transclude: true, replace: true, templateUrl: function(element, attrs) { return attrs.templateUrl || 'uib/template/carousel/slide.html'; }, scope: { actual: '=?', index: '=?' }, link: function (scope, element, attrs, carouselCtrl) { carouselCtrl.addSlide(scope, element); //when the scope is destroyed then remove the slide from the current slides array scope.$on('$destroy', function() { carouselCtrl.removeSlide(scope); }); } }; }) .animation('.item', ['$animateCss', function($animateCss) { var SLIDE_DIRECTION = 'uib-slideDirection'; function removeClass(element, className, callback) { element.removeClass(className); if (callback) { callback(); } } return { beforeAddClass: function(element, className, done) { if (className === 'active') { var stopped = false; var direction = element.data(SLIDE_DIRECTION); var directionClass = direction === 'next' ? 'left' : 'right'; var removeClassFn = removeClass.bind(this, element, directionClass + ' ' + direction, done); element.addClass(direction); $animateCss(element, {addClass: directionClass}) .start() .done(removeClassFn); return function() { stopped = true; }; } done(); }, beforeRemoveClass: function (element, className, done) { if (className === 'active') { var stopped = false; var direction = element.data(SLIDE_DIRECTION); var directionClass = direction === 'next' ? 'left' : 'right'; var removeClassFn = removeClass.bind(this, element, directionClass, done); $animateCss(element, {addClass: directionClass}) .start() .done(removeClassFn); return function() { stopped = true; }; } done(); } }; }]); angular.module('ui.bootstrap.dateparser', []) .service('uibDateParser', ['$log', '$locale', 'dateFilter', 'orderByFilter', function($log, $locale, dateFilter, orderByFilter) { // Pulled from https://github.com/mbostock/d3/blob/master/src/format/requote.js var SPECIAL_CHARACTERS_REGEXP = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; var localeId; var formatCodeToRegex; this.init = function() { localeId = $locale.id; this.parsers = {}; this.formatters = {}; formatCodeToRegex = [ { key: 'yyyy', regex: '\\d{4}', apply: function(value) { this.year = +value; }, formatter: function(date) { var _date = new Date(); _date.setFullYear(Math.abs(date.getFullYear())); return dateFilter(_date, 'yyyy'); } }, { key: 'yy', regex: '\\d{2}', apply: function(value) { this.year = +value + 2000; }, formatter: function(date) { var _date = new Date(); _date.setFullYear(Math.abs(date.getFullYear())); return dateFilter(_date, 'yy'); } }, { key: 'y', regex: '\\d{1,4}', apply: function(value) { this.year = +value; }, formatter: function(date) { var _date = new Date(); _date.setFullYear(Math.abs(date.getFullYear())); return dateFilter(_date, 'y'); } }, { key: 'M!', regex: '0?[1-9]|1[0-2]', apply: function(value) { this.month = value - 1; }, formatter: function(date) { var value = date.getMonth(); if (/^[0-9]$/.test(value)) { return dateFilter(date, 'MM'); } return dateFilter(date, 'M'); } }, { key: 'MMMM', regex: $locale.DATETIME_FORMATS.MONTH.join('|'), apply: function(value) { this.month = $locale.DATETIME_FORMATS.MONTH.indexOf(value); }, formatter: function(date) { return dateFilter(date, 'MMMM'); } }, { key: 'MMM', regex: $locale.DATETIME_FORMATS.SHORTMONTH.join('|'), apply: function(value) { this.month = $locale.DATETIME_FORMATS.SHORTMONTH.indexOf(value); }, formatter: function(date) { return dateFilter(date, 'MMM'); } }, { key: 'MM', regex: '0[1-9]|1[0-2]', apply: function(value) { this.month = value - 1; }, formatter: function(date) { return dateFilter(date, 'MM'); } }, { key: 'M', regex: '[1-9]|1[0-2]', apply: function(value) { this.month = value - 1; }, formatter: function(date) { return dateFilter(date, 'M'); } }, { key: 'd!', regex: '[0-2]?[0-9]{1}|3[0-1]{1}', apply: function(value) { this.date = +value; }, formatter: function(date) { var value = date.getDate(); if (/^[1-9]$/.test(value)) { return dateFilter(date, 'dd'); } return dateFilter(date, 'd'); } }, { key: 'dd', regex: '[0-2][0-9]{1}|3[0-1]{1}', apply: function(value) { this.date = +value; }, formatter: function(date) { return dateFilter(date, 'dd'); } }, { key: 'd', regex: '[1-2]?[0-9]{1}|3[0-1]{1}', apply: function(value) { this.date = +value; }, formatter: function(date) { return dateFilter(date, 'd'); } }, { key: 'EEEE', regex: $locale.DATETIME_FORMATS.DAY.join('|'), formatter: function(date) { return dateFilter(date, 'EEEE'); } }, { key: 'EEE', regex: $locale.DATETIME_FORMATS.SHORTDAY.join('|'), formatter: function(date) { return dateFilter(date, 'EEE'); } }, { key: 'HH', regex: '(?:0|1)[0-9]|2[0-3]', apply: function(value) { this.hours = +value; }, formatter: function(date) { return dateFilter(date, 'HH'); } }, { key: 'hh', regex: '0[0-9]|1[0-2]', apply: function(value) { this.hours = +value; }, formatter: function(date) { return dateFilter(date, 'hh'); } }, { key: 'H', regex: '1?[0-9]|2[0-3]', apply: function(value) { this.hours = +value; }, formatter: function(date) { return dateFilter(date, 'H'); } }, { key: 'h', regex: '[0-9]|1[0-2]', apply: function(value) { this.hours = +value; }, formatter: function(date) { return dateFilter(date, 'h'); } }, { key: 'mm', regex: '[0-5][0-9]', apply: function(value) { this.minutes = +value; }, formatter: function(date) { return dateFilter(date, 'mm'); } }, { key: 'm', regex: '[0-9]|[1-5][0-9]', apply: function(value) { this.minutes = +value; }, formatter: function(date) { return dateFilter(date, 'm'); } }, { key: 'sss', regex: '[0-9][0-9][0-9]', apply: function(value) { this.milliseconds = +value; }, formatter: function(date) { return dateFilter(date, 'sss'); } }, { key: 'ss', regex: '[0-5][0-9]', apply: function(value) { this.seconds = +value; }, formatter: function(date) { return dateFilter(date, 'ss'); } }, { key: 's', regex: '[0-9]|[1-5][0-9]', apply: function(value) { this.seconds = +value; }, formatter: function(date) { return dateFilter(date, 's'); } }, { key: 'a', regex: $locale.DATETIME_FORMATS.AMPMS.join('|'), apply: function(value) { if (this.hours === 12) { this.hours = 0; } if (value === 'PM') { this.hours += 12; } }, formatter: function(date) { return dateFilter(date, 'a'); } }, { key: 'Z', regex: '[+-]\\d{4}', apply: function(value) { var matches = value.match(/([+-])(\d{2})(\d{2})/), sign = matches[1], hours = matches[2], minutes = matches[3]; this.hours += toInt(sign + hours); this.minutes += toInt(sign + minutes); }, formatter: function(date) { return dateFilter(date, 'Z'); } }, { key: 'ww', regex: '[0-4][0-9]|5[0-3]', formatter: function(date) { return dateFilter(date, 'ww'); } }, { key: 'w', regex: '[0-9]|[1-4][0-9]|5[0-3]', formatter: function(date) { return dateFilter(date, 'w'); } }, { key: 'GGGG', regex: $locale.DATETIME_FORMATS.ERANAMES.join('|').replace(/\s/g, '\\s'), formatter: function(date) { return dateFilter(date, 'GGGG'); } }, { key: 'GGG', regex: $locale.DATETIME_FORMATS.ERAS.join('|'), formatter: function(date) { return dateFilter(date, 'GGG'); } }, { key: 'GG', regex: $locale.DATETIME_FORMATS.ERAS.join('|'), formatter: function(date) { return dateFilter(date, 'GG'); } }, { key: 'G', regex: $locale.DATETIME_FORMATS.ERAS.join('|'), formatter: function(date) { return dateFilter(date, 'G'); } } ]; }; this.init(); function createParser(format, func) { var map = [], regex = format.split(''); // check for literal values var quoteIndex = format.indexOf('\''); if (quoteIndex > -1) { var inLiteral = false; format = format.split(''); for (var i = quoteIndex; i < format.length; i++) { if (inLiteral) { if (format[i] === '\'') { if (i + 1 < format.length && format[i+1] === '\'') { // escaped single quote format[i+1] = '$'; regex[i+1] = ''; } else { // end of literal regex[i] = ''; inLiteral = false; } } format[i] = '$'; } else { if (format[i] === '\'') { // start of literal format[i] = '$'; regex[i] = ''; inLiteral = true; } } } format = format.join(''); } angular.forEach(formatCodeToRegex, function(data) { var index = format.indexOf(data.key); if (index > -1) { format = format.split(''); regex[index] = '(' + data.regex + ')'; format[index] = '$'; // Custom symbol to define consumed part of format for (var i = index + 1, n = index + data.key.length; i < n; i++) { regex[i] = ''; format[i] = '$'; } format = format.join(''); map.push({ index: index, key: data.key, apply: data[func], matcher: data.regex }); } }); return { regex: new RegExp('^' + regex.join('') + '$'), map: orderByFilter(map, 'index') }; } this.filter = function(date, format) { if (!angular.isDate(date) || isNaN(date) || !format) { return ''; } format = $locale.DATETIME_FORMATS[format] || format; if ($locale.id !== localeId) { this.init(); } if (!this.formatters[format]) { this.formatters[format] = createParser(format, 'formatter'); } var parser = this.formatters[format], map = parser.map; var _format = format; return map.reduce(function(str, mapper, i) { var match = _format.match(new RegExp('(.*)' + mapper.key)); if (match && angular.isString(match[1])) { str += match[1]; _format = _format.replace(match[1] + mapper.key, ''); } var endStr = i === map.length - 1 ? _format : ''; if (mapper.apply) { return str + mapper.apply.call(null, date) + endStr; } return str + endStr; }, ''); }; this.parse = function(input, format, baseDate) { if (!angular.isString(input) || !format) { return input; } format = $locale.DATETIME_FORMATS[format] || format; format = format.replace(SPECIAL_CHARACTERS_REGEXP, '\\$&'); if ($locale.id !== localeId) { this.init(); } if (!this.parsers[format]) { this.parsers[format] = createParser(format, 'apply'); } var parser = this.parsers[format], regex = parser.regex, map = parser.map, results = input.match(regex), tzOffset = false; if (results && results.length) { var fields, dt; if (angular.isDate(baseDate) && !isNaN(baseDate.getTime())) { fields = { year: baseDate.getFullYear(), month: baseDate.getMonth(), date: baseDate.getDate(), hours: baseDate.getHours(), minutes: baseDate.getMinutes(), seconds: baseDate.getSeconds(), milliseconds: baseDate.getMilliseconds() }; } else { if (baseDate) { $log.warn('dateparser:', 'baseDate is not a valid date'); } fields = { year: 1900, month: 0, date: 1, hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }; } for (var i = 1, n = results.length; i < n; i++) { var mapper = map[i - 1]; if (mapper.matcher === 'Z') { tzOffset = true; } if (mapper.apply) { mapper.apply.call(fields, results[i]); } } var datesetter = tzOffset ? Date.prototype.setUTCFullYear : Date.prototype.setFullYear; var timesetter = tzOffset ? Date.prototype.setUTCHours : Date.prototype.setHours; if (isValid(fields.year, fields.month, fields.date)) { if (angular.isDate(baseDate) && !isNaN(baseDate.getTime()) && !tzOffset) { dt = new Date(baseDate); datesetter.call(dt, fields.year, fields.month, fields.date); timesetter.call(dt, fields.hours, fields.minutes, fields.seconds, fields.milliseconds); } else { dt = new Date(0); datesetter.call(dt, fields.year, fields.month, fields.date); timesetter.call(dt, fields.hours || 0, fields.minutes || 0, fields.seconds || 0, fields.milliseconds || 0); } } return dt; } }; // Check if date is valid for specific month (and year for February). // Month: 0 = Jan, 1 = Feb, etc function isValid(year, month, date) { if (date < 1) { return false; } if (month === 1 && date > 28) { return date === 29 && (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0); } if (month === 3 || month === 5 || month === 8 || month === 10) { return date < 31; } return true; } function toInt(str) { return parseInt(str, 10); } this.toTimezone = toTimezone; this.fromTimezone = fromTimezone; this.timezoneToOffset = timezoneToOffset; this.addDateMinutes = addDateMinutes; this.convertTimezoneToLocal = convertTimezoneToLocal; function toTimezone(date, timezone) { return date && timezone ? convertTimezoneToLocal(date, timezone) : date; } function fromTimezone(date, timezone) { return date && timezone ? convertTimezoneToLocal(date, timezone, true) : date; } //https://github.com/angular/angular.js/blob/4daafd3dbe6a80d578f5a31df1bb99c77559543e/src/Angular.js#L1207 function timezoneToOffset(timezone, fallback) { var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000; return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset; } function addDateMinutes(date, minutes) { date = new Date(date.getTime()); date.setMinutes(date.getMinutes() + minutes); return date; } function convertTimezoneToLocal(date, timezone, reverse) { reverse = reverse ? -1 : 1; var timezoneOffset = timezoneToOffset(timezone, date.getTimezoneOffset()); return addDateMinutes(date, reverse * (timezoneOffset - date.getTimezoneOffset())); } }]); // Avoiding use of ng-class as it creates a lot of watchers when a class is to be applied to // at most one element. angular.module('ui.bootstrap.isClass', []) .directive('uibIsClass', [ '$animate', function ($animate) { // 11111111 22222222 var ON_REGEXP = /^\s*([\s\S]+?)\s+on\s+([\s\S]+?)\s*$/; // 11111111 22222222 var IS_REGEXP = /^\s*([\s\S]+?)\s+for\s+([\s\S]+?)\s*$/; var dataPerTracked = {}; return { restrict: 'A', compile: function (tElement, tAttrs) { var linkedScopes = []; var instances = []; var expToData = {}; var lastActivated = null; var onExpMatches = tAttrs.uibIsClass.match(ON_REGEXP); var onExp = onExpMatches[2]; var expsStr = onExpMatches[1]; var exps = expsStr.split(','); return linkFn; function linkFn(scope, element, attrs) { linkedScopes.push(scope); instances.push({ scope: scope, element: element }); exps.forEach(function (exp, k) { addForExp(exp, scope); }); scope.$on('$destroy', removeScope); } function addForExp(exp, scope) { var matches = exp.match(IS_REGEXP); var clazz = scope.$eval(matches[1]); var compareWithExp = matches[2]; var data = expToData[exp]; if (!data) { var watchFn = function (compareWithVal) { var newActivated = null; instances.some(function (instance) { var thisVal = instance.scope.$eval(onExp); if (thisVal === compareWithVal) { newActivated = instance; return true; } }); if (data.lastActivated !== newActivated) { if (data.lastActivated) { $animate.removeClass(data.lastActivated.element, clazz); } if (newActivated) { $animate.addClass(newActivated.element, clazz); } data.lastActivated = newActivated; } }; expToData[exp] = data = { lastActivated: null, scope: scope, watchFn: watchFn, compareWithExp: compareWithExp, watcher: scope.$watch(compareWithExp, watchFn) }; } data.watchFn(scope.$eval(compareWithExp)); } function removeScope(e) { var removedScope = e.targetScope; var index = linkedScopes.indexOf(removedScope); linkedScopes.splice(index, 1); instances.splice(index, 1); if (linkedScopes.length) { var newWatchScope = linkedScopes[0]; angular.forEach(expToData, function (data) { if (data.scope === removedScope) { data.watcher = newWatchScope.$watch(data.compareWithExp, data.watchFn); data.scope = newWatchScope; } }); } else { expToData = {}; } } } }; }]); angular.module('ui.bootstrap.position', []) /** * A set of utility methods for working with the DOM. * It is meant to be used where we need to absolute-position elements in * relation to another element (this is the case for tooltips, popovers, * typeahead suggestions etc.). */ .factory('$uibPosition', ['$document', '$window', function($document, $window) { /** * Used by scrollbarWidth() function to cache scrollbar's width. * Do not access this variable directly, use scrollbarWidth() instead. */ var SCROLLBAR_WIDTH; var OVERFLOW_REGEX = { normal: /(auto|scroll)/, hidden: /(auto|scroll|hidden)/ }; var PLACEMENT_REGEX = { auto: /\s?auto?\s?/i, primary: /^(top|bottom|left|right)$/, secondary: /^(top|bottom|left|right|center)$/, vertical: /^(top|bottom)$/ }; return { /** * Provides a raw DOM element from a jQuery/jQLite element. * * @param {element} elem - The element to convert. * * @returns {element} A HTML element. */ getRawNode: function(elem) { return elem.nodeName ? elem : elem[0] || elem; }, /** * Provides a parsed number for a style property. Strips * units and casts invalid numbers to 0. * * @param {string} value - The style value to parse. * * @returns {number} A valid number. */ parseStyle: function(value) { value = parseFloat(value); return isFinite(value) ? value : 0; }, /** * Provides the closest positioned ancestor. * * @param {element} element - The element to get the offest parent for. * * @returns {element} The closest positioned ancestor. */ offsetParent: function(elem) { elem = this.getRawNode(elem); var offsetParent = elem.offsetParent || $document[0].documentElement; function isStaticPositioned(el) { return ($window.getComputedStyle(el).position || 'static') === 'static'; } while (offsetParent && offsetParent !== $document[0].documentElement && isStaticPositioned(offsetParent)) { offsetParent = offsetParent.offsetParent; } return offsetParent || $document[0].documentElement; }, /** * Provides the scrollbar width, concept from TWBS measureScrollbar() * function in https://github.com/twbs/bootstrap/blob/master/js/modal.js * * @returns {number} The width of the browser scollbar. */ scrollbarWidth: function() { if (angular.isUndefined(SCROLLBAR_WIDTH)) { var scrollElem = angular.element('<div class="uib-position-scrollbar-measure"></div>'); $document.find('body').append(scrollElem); SCROLLBAR_WIDTH = scrollElem[0].offsetWidth - scrollElem[0].clientWidth; SCROLLBAR_WIDTH = isFinite(SCROLLBAR_WIDTH) ? SCROLLBAR_WIDTH : 0; scrollElem.remove(); } return SCROLLBAR_WIDTH; }, /** * Checks to see if the element is scrollable. * * @param {element} elem - The element to check. * @param {boolean=} [includeHidden=false] - Should scroll style of 'hidden' be considered, * default is false. * * @returns {boolean} Whether the element is scrollable. */ isScrollable: function(elem, includeHidden) { elem = this.getRawNode(elem); var overflowRegex = includeHidden ? OVERFLOW_REGEX.hidden : OVERFLOW_REGEX.normal; var elemStyle = $window.getComputedStyle(elem); return overflowRegex.test(elemStyle.overflow + elemStyle.overflowY + elemStyle.overflowX); }, /** * Provides the closest scrollable ancestor. * A port of the jQuery UI scrollParent method: * https://github.com/jquery/jquery-ui/blob/master/ui/scroll-parent.js * * @param {element} elem - The element to find the scroll parent of. * @param {boolean=} [includeHidden=false] - Should scroll style of 'hidden' be considered, * default is false. * * @returns {element} A HTML element. */ scrollParent: function(elem, includeHidden) { elem = this.getRawNode(elem); var overflowRegex = includeHidden ? OVERFLOW_REGEX.hidden : OVERFLOW_REGEX.normal; var documentEl = $document[0].documentElement; var elemStyle = $window.getComputedStyle(elem); var excludeStatic = elemStyle.position === 'absolute'; var scrollParent = elem.parentElement || documentEl; if (scrollParent === documentEl || elemStyle.position === 'fixed') { return documentEl; } while (scrollParent.parentElement && scrollParent !== documentEl) { var spStyle = $window.getComputedStyle(scrollParent); if (excludeStatic && spStyle.position !== 'static') { excludeStatic = false; } if (!excludeStatic && overflowRegex.test(spStyle.overflow + spStyle.overflowY + spStyle.overflowX)) { break; } scrollParent = scrollParent.parentElement; } return scrollParent; }, /** * Provides read-only equivalent of jQuery's position function: * http://api.jquery.com/position/ - distance to closest positioned * ancestor. Does not account for margins by default like jQuery position. * * @param {element} elem - The element to caclulate the position on. * @param {boolean=} [includeMargins=false] - Should margins be accounted * for, default is false. * * @returns {object} An object with the following properties: * <ul> * <li>**width**: the width of the element</li> * <li>**height**: the height of the element</li> * <li>**top**: distance to top edge of offset parent</li> * <li>**left**: distance to left edge of offset parent</li> * </ul> */ position: function(elem, includeMagins) { elem = this.getRawNode(elem); var elemOffset = this.offset(elem); if (includeMagins) { var elemStyle = $window.getComputedStyle(elem); elemOffset.top -= this.parseStyle(elemStyle.marginTop); elemOffset.left -= this.parseStyle(elemStyle.marginLeft); } var parent = this.offsetParent(elem); var parentOffset = {top: 0, left: 0}; if (parent !== $document[0].documentElement) { parentOffset = this.offset(parent); parentOffset.top += parent.clientTop - parent.scrollTop; parentOffset.left += parent.clientLeft - parent.scrollLeft; } return { width: Math.round(angular.isNumber(elemOffset.width) ? elemOffset.width : elem.offsetWidth), height: Math.round(angular.isNumber(elemOffset.height) ? elemOffset.height : elem.offsetHeight), top: Math.round(elemOffset.top - parentOffset.top), left: Math.round(elemOffset.left - parentOffset.left) }; }, /** * Provides read-only equivalent of jQuery's offset function: * http://api.jquery.com/offset/ - distance to viewport. Does * not account for borders, margins, or padding on the body * element. * * @param {element} elem - The element to calculate the offset on. * * @returns {object} An object with the following properties: * <ul> * <li>**width**: the width of the element</li> * <li>**height**: the height of the element</li> * <li>**top**: distance to top edge of viewport</li> * <li>**right**: distance to bottom edge of viewport</li> * </ul> */ offset: function(elem) { elem = this.getRawNode(elem); var elemBCR = elem.getBoundingClientRect(); return { width: Math.round(angular.isNumber(elemBCR.width) ? elemBCR.width : elem.offsetWidth), height: Math.round(angular.isNumber(elemBCR.height) ? elemBCR.height : elem.offsetHeight), top: Math.round(elemBCR.top + ($window.pageYOffset || $document[0].documentElement.scrollTop)), left: Math.round(elemBCR.left + ($window.pageXOffset || $document[0].documentElement.scrollLeft)) }; }, /** * Provides offset distance to the closest scrollable ancestor * or viewport. Accounts for border and scrollbar width. * * Right and bottom dimensions represent the distance to the * respective edge of the viewport element. If the element * edge extends beyond the viewport, a negative value will be * reported. * * @param {element} elem - The element to get the viewport offset for. * @param {boolean=} [useDocument=false] - Should the viewport be the document element instead * of the first scrollable element, default is false. * @param {boolean=} [includePadding=true] - Should the padding on the offset parent element * be accounted for, default is true. * * @returns {object} An object with the following properties: * <ul> * <li>**top**: distance to the top content edge of viewport element</li> * <li>**bottom**: distance to the bottom content edge of viewport element</li> * <li>**left**: distance to the left content edge of viewport element</li> * <li>**right**: distance to the right content edge of viewport element</li> * </ul> */ viewportOffset: function(elem, useDocument, includePadding) { elem = this.getRawNode(elem); includePadding = includePadding !== false ? true : false; var elemBCR = elem.getBoundingClientRect(); var offsetBCR = {top: 0, left: 0, bottom: 0, right: 0}; var offsetParent = useDocument ? $document[0].documentElement : this.scrollParent(elem); var offsetParentBCR = offsetParent.getBoundingClientRect(); offsetBCR.top = offsetParentBCR.top + offsetParent.clientTop; offsetBCR.left = offsetParentBCR.left + offsetParent.clientLeft; if (offsetParent === $document[0].documentElement) { offsetBCR.top += $window.pageYOffset; offsetBCR.left += $window.pageXOffset; } offsetBCR.bottom = offsetBCR.top + offsetParent.clientHeight; offsetBCR.right = offsetBCR.left + offsetParent.clientWidth; if (includePadding) { var offsetParentStyle = $window.getComputedStyle(offsetParent); offsetBCR.top += this.parseStyle(offsetParentStyle.paddingTop); offsetBCR.bottom -= this.parseStyle(offsetParentStyle.paddingBottom); offsetBCR.left += this.parseStyle(offsetParentStyle.paddingLeft); offsetBCR.right -= this.parseStyle(offsetParentStyle.paddingRight); } return { top: Math.round(elemBCR.top - offsetBCR.top), bottom: Math.round(offsetBCR.bottom - elemBCR.bottom), left: Math.round(elemBCR.left - offsetBCR.left), right: Math.round(offsetBCR.right - elemBCR.right) }; }, /** * Provides an array of placement values parsed from a placement string. * Along with the 'auto' indicator, supported placement strings are: * <ul> * <li>top: element on top, horizontally centered on host element.</li> * <li>top-left: element on top, left edge aligned with host element left edge.</li> * <li>top-right: element on top, lerightft edge aligned with host element right edge.</li> * <li>bottom: element on bottom, horizontally centered on host element.</li> * <li>bottom-left: element on bottom, left edge aligned with host element left edge.</li> * <li>bottom-right: element on bottom, right edge aligned with host element right edge.</li> * <li>left: element on left, vertically centered on host element.</li> * <li>left-top: element on left, top edge aligned with host element top edge.</li> * <li>left-bottom: element on left, bottom edge aligned with host element bottom edge.</li> * <li>right: element on right, vertically centered on host element.</li> * <li>right-top: element on right, top edge aligned with host element top edge.</li> * <li>right-bottom: element on right, bottom edge aligned with host element bottom edge.</li> * </ul> * A placement string with an 'auto' indicator is expected to be * space separated from the placement, i.e: 'auto bottom-left' If * the primary and secondary placement values do not match 'top, * bottom, left, right' then 'top' will be the primary placement and * 'center' will be the secondary placement. If 'auto' is passed, true * will be returned as the 3rd value of the array. * * @param {string} placement - The placement string to parse. * * @returns {array} An array with the following values * <ul> * <li>**[0]**: The primary placement.</li> * <li>**[1]**: The secondary placement.</li> * <li>**[2]**: If auto is passed: true, else undefined.</li> * </ul> */ parsePlacement: function(placement) { var autoPlace = PLACEMENT_REGEX.auto.test(placement); if (autoPlace) { placement = placement.replace(PLACEMENT_REGEX.auto, ''); } placement = placement.split('-'); placement[0] = placement[0] || 'top'; if (!PLACEMENT_REGEX.primary.test(placement[0])) { placement[0] = 'top'; } placement[1] = placement[1] || 'center'; if (!PLACEMENT_REGEX.secondary.test(placement[1])) { placement[1] = 'center'; } if (autoPlace) { placement[2] = true; } else { placement[2] = false; } return placement; }, /** * Provides coordinates for an element to be positioned relative to * another element. Passing 'auto' as part of the placement parameter * will enable smart placement - where the element fits. i.e: * 'auto left-top' will check to see if there is enough space to the left * of the hostElem to fit the targetElem, if not place right (same for secondary * top placement). Available space is calculated using the viewportOffset * function. * * @param {element} hostElem - The element to position against. * @param {element} targetElem - The element to position. * @param {string=} [placement=top] - The placement for the targetElem, * default is 'top'. 'center' is assumed as secondary placement for * 'top', 'left', 'right', and 'bottom' placements. Available placements are: * <ul> * <li>top</li> * <li>top-right</li> * <li>top-left</li> * <li>bottom</li> * <li>bottom-left</li> * <li>bottom-right</li> * <li>left</li> * <li>left-top</li> * <li>left-bottom</li> * <li>right</li> * <li>right-top</li> * <li>right-bottom</li> * </ul> * @param {boolean=} [appendToBody=false] - Should the top and left values returned * be calculated from the body element, default is false. * * @returns {object} An object with the following properties: * <ul> * <li>**top**: Value for targetElem top.</li> * <li>**left**: Value for targetElem left.</li> * <li>**placement**: The resolved placement.</li> * </ul> */ positionElements: function(hostElem, targetElem, placement, appendToBody) { hostElem = this.getRawNode(hostElem); targetElem = this.getRawNode(targetElem); // need to read from prop to support tests. var targetWidth = angular.isDefined(targetElem.offsetWidth) ? targetElem.offsetWidth : targetElem.prop('offsetWidth'); var targetHeight = angular.isDefined(targetElem.offsetHeight) ? targetElem.offsetHeight : targetElem.prop('offsetHeight'); placement = this.parsePlacement(placement); var hostElemPos = appendToBody ? this.offset(hostElem) : this.position(hostElem); var targetElemPos = {top: 0, left: 0, placement: ''}; if (placement[2]) { var viewportOffset = this.viewportOffset(hostElem, appendToBody); var targetElemStyle = $window.getComputedStyle(targetElem); var adjustedSize = { width: targetWidth + Math.round(Math.abs(this.parseStyle(targetElemStyle.marginLeft) + this.parseStyle(targetElemStyle.marginRight))), height: targetHeight + Math.round(Math.abs(this.parseStyle(targetElemStyle.marginTop) + this.parseStyle(targetElemStyle.marginBottom))) }; placement[0] = placement[0] === 'top' && adjustedSize.height > viewportOffset.top && adjustedSize.height <= viewportOffset.bottom ? 'bottom' : placement[0] === 'bottom' && adjustedSize.height > viewportOffset.bottom && adjustedSize.height <= viewportOffset.top ? 'top' : placement[0] === 'left' && adjustedSize.width > viewportOffset.left && adjustedSize.width <= viewportOffset.right ? 'right' : placement[0] === 'right' && adjustedSize.width > viewportOffset.right && adjustedSize.width <= viewportOffset.left ? 'left' : placement[0]; placement[1] = placement[1] === 'top' && adjustedSize.height - hostElemPos.height > viewportOffset.bottom && adjustedSize.height - hostElemPos.height <= viewportOffset.top ? 'bottom' : placement[1] === 'bottom' && adjustedSize.height - hostElemPos.height > viewportOffset.top && adjustedSize.height - hostElemPos.height <= viewportOffset.bottom ? 'top' : placement[1] === 'left' && adjustedSize.width - hostElemPos.width > viewportOffset.right && adjustedSize.width - hostElemPos.width <= viewportOffset.left ? 'right' : placement[1] === 'right' && adjustedSize.width - hostElemPos.width > viewportOffset.left && adjustedSize.width - hostElemPos.width <= viewportOffset.right ? 'left' : placement[1]; if (placement[1] === 'center') { if (PLACEMENT_REGEX.vertical.test(placement[0])) { var xOverflow = hostElemPos.width / 2 - targetWidth / 2; if (viewportOffset.left + xOverflow < 0 && adjustedSize.width - hostElemPos.width <= viewportOffset.right) { placement[1] = 'left'; } else if (viewportOffset.right + xOverflow < 0 && adjustedSize.width - hostElemPos.width <= viewportOffset.left) { placement[1] = 'right'; } } else { var yOverflow = hostElemPos.height / 2 - adjustedSize.height / 2; if (viewportOffset.top + yOverflow < 0 && adjustedSize.height - hostElemPos.height <= viewportOffset.bottom) { placement[1] = 'top'; } else if (viewportOffset.bottom + yOverflow < 0 && adjustedSize.height - hostElemPos.height <= viewportOffset.top) { placement[1] = 'bottom'; } } } } switch (placement[0]) { case 'top': targetElemPos.top = hostElemPos.top - targetHeight; break; case 'bottom': targetElemPos.top = hostElemPos.top + hostElemPos.height; break; case 'left': targetElemPos.left = hostElemPos.left - targetWidth; break; case 'right': targetElemPos.left = hostElemPos.left + hostElemPos.width; break; } switch (placement[1]) { case 'top': targetElemPos.top = hostElemPos.top; break; case 'bottom': targetElemPos.top = hostElemPos.top + hostElemPos.height - targetHeight; break; case 'left': targetElemPos.left = hostElemPos.left; break; case 'right': targetElemPos.left = hostElemPos.left + hostElemPos.width - targetWidth; break; case 'center': if (PLACEMENT_REGEX.vertical.test(placement[0])) { targetElemPos.left = hostElemPos.left + hostElemPos.width / 2 - targetWidth / 2; } else { targetElemPos.top = hostElemPos.top + hostElemPos.height / 2 - targetHeight / 2; } break; } targetElemPos.top = Math.round(targetElemPos.top); targetElemPos.left = Math.round(targetElemPos.left); targetElemPos.placement = placement[1] === 'center' ? placement[0] : placement[0] + '-' + placement[1]; return targetElemPos; }, /** * Provides a way for positioning tooltip & dropdown * arrows when using placement options beyond the standard * left, right, top, or bottom. * * @param {element} elem - The tooltip/dropdown element. * @param {string} placement - The placement for the elem. */ positionArrow: function(elem, placement) { elem = this.getRawNode(elem); var innerElem = elem.querySelector('.tooltip-inner, .popover-inner'); if (!innerElem) { return; } var isTooltip = angular.element(innerElem).hasClass('tooltip-inner'); var arrowElem = isTooltip ? elem.querySelector('.tooltip-arrow') : elem.querySelector('.arrow'); if (!arrowElem) { return; } var arrowCss = { top: '', bottom: '', left: '', right: '' }; placement = this.parsePlacement(placement); if (placement[1] === 'center') { // no adjustment necessary - just reset styles angular.element(arrowElem).css(arrowCss); return; } var borderProp = 'border-' + placement[0] + '-width'; var borderWidth = $window.getComputedStyle(arrowElem)[borderProp]; var borderRadiusProp = 'border-'; if (PLACEMENT_REGEX.vertical.test(placement[0])) { borderRadiusProp += placement[0] + '-' + placement[1]; } else { borderRadiusProp += placement[1] + '-' + placement[0]; } borderRadiusProp += '-radius'; var borderRadius = $window.getComputedStyle(isTooltip ? innerElem : elem)[borderRadiusProp]; switch (placement[0]) { case 'top': arrowCss.bottom = isTooltip ? '0' : '-' + borderWidth; break; case 'bottom': arrowCss.top = isTooltip ? '0' : '-' + borderWidth; break; case 'left': arrowCss.right = isTooltip ? '0' : '-' + borderWidth; break; case 'right': arrowCss.left = isTooltip ? '0' : '-' + borderWidth; break; } arrowCss[placement[1]] = borderRadius; angular.element(arrowElem).css(arrowCss); } }; }]); angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootstrap.isClass', 'ui.bootstrap.position']) .value('$datepickerSuppressError', false) .value('uibDatepickerAttributeWarning', true) .constant('uibDatepickerConfig', { datepickerMode: 'day', formatDay: 'dd', formatMonth: 'MMMM', formatYear: 'yyyy', formatDayHeader: 'EEE', formatDayTitle: 'MMMM yyyy', formatMonthTitle: 'yyyy', maxDate: null, maxMode: 'year', minDate: null, minMode: 'day', ngModelOptions: {}, shortcutPropagation: false, showWeeks: true, yearColumns: 5, yearRows: 4 }) .controller('UibDatepickerController', ['$scope', '$attrs', '$parse', '$interpolate', '$locale', '$log', 'dateFilter', 'uibDatepickerConfig', '$datepickerSuppressError', 'uibDatepickerAttributeWarning', 'uibDateParser', function($scope, $attrs, $parse, $interpolate, $locale, $log, dateFilter, datepickerConfig, $datepickerSuppressError, datepickerAttributeWarning, dateParser) { var self = this, ngModelCtrl = { $setViewValue: angular.noop }, // nullModelCtrl; ngModelOptions = {}, watchListeners = [], optionsUsed = !!$attrs.datepickerOptions; // Modes chain this.modes = ['day', 'month', 'year']; if (optionsUsed) { [ 'customClass', 'dateDisabled', 'datepickerMode', 'formatDay', 'formatDayHeader', 'formatDayTitle', 'formatMonth', 'formatMonthTitle', 'formatYear', 'initDate', 'maxDate', 'maxMode', 'minDate', 'minMode', 'showWeeks', 'shortcutPropagation', 'startingDay', 'yearColumns', 'yearRows' ].forEach(function(key) { switch (key) { case 'customClass': case 'dateDisabled': $scope[key] = $scope.datepickerOptions[key] || angular.noop; break; case 'datepickerMode': $scope.datepickerMode = angular.isDefined($scope.datepickerOptions.datepickerMode) ? $scope.datepickerOptions.datepickerMode : datepickerConfig.datepickerMode; break; case 'formatDay': case 'formatDayHeader': case 'formatDayTitle': case 'formatMonth': case 'formatMonthTitle': case 'formatYear': self[key] = angular.isDefined($scope.datepickerOptions[key]) ? $interpolate($scope.datepickerOptions[key])($scope.$parent) : datepickerConfig[key]; break; case 'showWeeks': case 'shortcutPropagation': case 'yearColumns': case 'yearRows': self[key] = angular.isDefined($scope.datepickerOptions[key]) ? $scope.datepickerOptions[key] : datepickerConfig[key]; break; case 'startingDay': if (angular.isDefined($scope.datepickerOptions.startingDay)) { self.startingDay = $scope.datepickerOptions.startingDay; } else if (angular.isNumber(datepickerConfig.startingDay)) { self.startingDay = datepickerConfig.startingDay; } else { self.startingDay = ($locale.DATETIME_FORMATS.FIRSTDAYOFWEEK + 8) % 7; } break; case 'maxDate': case 'minDate': if ($scope.datepickerOptions[key]) { $scope.$watch(function() { return $scope.datepickerOptions[key]; }, function(value) { if (value) { if (angular.isDate(value)) { self[key] = dateParser.fromTimezone(new Date(value), ngModelOptions.timezone); } else { self[key] = new Date(dateFilter(value, 'medium')); } } else { self[key] = null; } self.refreshView(); }); } else { self[key] = datepickerConfig[key] ? dateParser.fromTimezone(new Date(datepickerConfig[key]), ngModelOptions.timezone) : null; } break; case 'maxMode': case 'minMode': if ($scope.datepickerOptions[key]) { $scope.$watch(function() { return $scope.datepickerOptions[key]; }, function(value) { self[key] = $scope[key] = angular.isDefined(value) ? value : datepickerOptions[key]; if (key === 'minMode' && self.modes.indexOf($scope.datepickerOptions.datepickerMode) < self.modes.indexOf(self[key]) || key === 'maxMode' && self.modes.indexOf($scope.datepickerOptions.datepickerMode) > self.modes.indexOf(self[key])) { $scope.datepickerMode = self[key]; $scope.datepickerOptions.datepickerMode = self[key]; } }); } else { self[key] = $scope[key] = datepickerConfig[key] || null; } break; case 'initDate': if ($scope.datepickerOptions.initDate) { self.activeDate = dateParser.fromTimezone($scope.datepickerOptions.initDate, ngModelOptions.timezone) || new Date(); $scope.$watch(function() { return $scope.datepickerOptions.initDate; }, function(initDate) { if (initDate && (ngModelCtrl.$isEmpty(ngModelCtrl.$modelValue) || ngModelCtrl.$invalid)) { self.activeDate = dateParser.fromTimezone(initDate, ngModelOptions.timezone); self.refreshView(); } }); } else { self.activeDate = new Date(); } } }); } else { // Interpolated configuration attributes angular.forEach(['formatDay', 'formatMonth', 'formatYear', 'formatDayHeader', 'formatDayTitle', 'formatMonthTitle'], function(key) { self[key] = angular.isDefined($attrs[key]) ? $interpolate($attrs[key])($scope.$parent) : datepickerConfig[key]; if (angular.isDefined($attrs[key]) && datepickerAttributeWarning) { $log.warn('uib-datepicker ' + key + ' attribute usage is deprecated, use datepicker-options attribute instead'); } }); // Evaled configuration attributes angular.forEach(['showWeeks', 'yearRows', 'yearColumns', 'shortcutPropagation'], function(key) { self[key] = angular.isDefined($attrs[key]) ? $scope.$parent.$eval($attrs[key]) : datepickerConfig[key]; if (angular.isDefined($attrs[key]) && datepickerAttributeWarning) { $log.warn('uib-datepicker ' + key + ' attribute usage is deprecated, use datepicker-options attribute instead'); } }); angular.forEach(['dateDisabled', 'customClass'], function(key) { if (angular.isDefined($attrs[key]) && datepickerAttributeWarning) { $log.warn('uib-datepicker ' + key + ' attribute usage is deprecated, use datepicker-options attribute instead'); } }); if (angular.isDefined($attrs.startingDay)) { if (datepickerAttributeWarning) { $log.warn('uib-datepicker startingDay attribute usage is deprecated, use datepicker-options attribute instead'); } self.startingDay = $scope.$parent.$eval($attrs.startingDay); } else if (angular.isNumber(datepickerConfig.startingDay)) { self.startingDay = datepickerConfig.startingDay; } else { self.startingDay = ($locale.DATETIME_FORMATS.FIRSTDAYOFWEEK + 8) % 7; } // Watchable date attributes angular.forEach(['minDate', 'maxDate'], function(key) { if ($attrs[key]) { if (datepickerAttributeWarning) { $log.warn('uib-datepicker ' + key + ' attribute usage is deprecated, use datepicker-options attribute instead'); } watchListeners.push($scope.$parent.$watch($attrs[key], function(value) { if (value) { if (angular.isDate(value)) { self[key] = dateParser.fromTimezone(new Date(value), ngModelOptions.timezone); } else { self[key] = new Date(dateFilter(value, 'medium')); } } else { self[key] = null; } self.refreshView(); })); } else { self[key] = datepickerConfig[key] ? dateParser.fromTimezone(new Date(datepickerConfig[key]), ngModelOptions.timezone) : null; } }); angular.forEach(['minMode', 'maxMode'], function(key) { if ($attrs[key]) { if (datepickerAttributeWarning) { $log.warn('uib-datepicker ' + key + ' attribute usage is deprecated, use datepicker-options attribute instead'); } watchListeners.push($scope.$parent.$watch($attrs[key], function(value) { self[key] = $scope[key] = angular.isDefined(value) ? value : $attrs[key]; if (key === 'minMode' && self.modes.indexOf($scope.datepickerMode) < self.modes.indexOf(self[key]) || key === 'maxMode' && self.modes.indexOf($scope.datepickerMode) > self.modes.indexOf(self[key])) { $scope.datepickerMode = self[key]; } })); } else { self[key] = $scope[key] = datepickerConfig[key] || null; } }); if (angular.isDefined($attrs.initDate)) { if (datepickerAttributeWarning) { $log.warn('uib-datepicker initDate attribute usage is deprecated, use datepicker-options attribute instead'); } var initDate = dateParser.fromTimezone($scope.$parent.$eval($attrs.initDate), ngModelOptions.timezone); this.activeDate = !isNaN(initDate) ? initDate : new Date(); watchListeners.push($scope.$parent.$watch($attrs.initDate, function(initDate) { if (initDate && (ngModelCtrl.$isEmpty(ngModelCtrl.$modelValue) || ngModelCtrl.$invalid)) { initDate = dateParser.fromTimezone(initDate, ngModelOptions.timezone); self.activeDate = !isNaN(initDate) ? initDate : new Date(); self.refreshView(); } })); } else { this.activeDate = new Date(); } if ($attrs.datepickerMode && datepickerAttributeWarning) { $log.warn('uib-datepicker datepickerMode attribute usage is deprecated, use datepicker-options attribute instead'); } $scope.datepickerMode = $scope.datepickerMode || datepickerConfig.datepickerMode; } $scope.uniqueId = 'datepicker-' + $scope.$id + '-' + Math.floor(Math.random() * 10000); $scope.disabled = angular.isDefined($attrs.disabled) || false; if (angular.isDefined($attrs.ngDisabled)) { watchListeners.push($scope.$parent.$watch($attrs.ngDisabled, function(disabled) { $scope.disabled = disabled; self.refreshView(); })); } $scope.isActive = function(dateObject) { if (self.compare(dateObject.date, self.activeDate) === 0) { $scope.activeDateId = dateObject.uid; return true; } return false; }; this.init = function(ngModelCtrl_) { ngModelCtrl = ngModelCtrl_; ngModelOptions = ngModelCtrl_.$options || datepickerConfig.ngModelOptions; this.activeDate = ngModelCtrl.$modelValue ? dateParser.fromTimezone(new Date(ngModelCtrl.$modelValue), ngModelOptions.timezone) : dateParser.fromTimezone(new Date(), ngModelOptions.timezone); ngModelCtrl.$render = function() { self.render(); }; }; this.render = function() { if (ngModelCtrl.$viewValue) { var date = new Date(ngModelCtrl.$viewValue), isValid = !isNaN(date); if (isValid) { this.activeDate = dateParser.fromTimezone(date, ngModelOptions.timezone); } else if (!$datepickerSuppressError) { $log.error('Datepicker directive: "ng-model" value must be a Date object'); } } this.refreshView(); }; this.refreshView = function() { if (this.element) { $scope.selectedDt = null; this._refreshView(); if ($scope.activeDt) { $scope.activeDateId = $scope.activeDt.uid; } var date = ngModelCtrl.$viewValue ? new Date(ngModelCtrl.$viewValue) : null; date = dateParser.fromTimezone(date, ngModelOptions.timezone); ngModelCtrl.$setValidity('dateDisabled', !date || this.element && !this.isDisabled(date)); } }; this.createDateObject = function(date, format) { var model = ngModelCtrl.$viewValue ? new Date(ngModelCtrl.$viewValue) : null; model = dateParser.fromTimezone(model, ngModelOptions.timezone); var today = new Date(); today = dateParser.fromTimezone(today, ngModelOptions.timezone); var time = this.compare(date, today); var dt = { date: date, label: dateParser.filter(date, format), selected: model && this.compare(date, model) === 0, disabled: this.isDisabled(date), past: time < 0, current: time === 0, future: time > 0, customClass: this.customClass(date) || null }; if (model && this.compare(date, model) === 0) { $scope.selectedDt = dt; } if (self.activeDate && this.compare(dt.date, self.activeDate) === 0) { $scope.activeDt = dt; } return dt; }; this.isDisabled = function(date) { return $scope.disabled || this.minDate && this.compare(date, this.minDate) < 0 || this.maxDate && this.compare(date, this.maxDate) > 0 || $scope.dateDisabled && $scope.dateDisabled({date: date, mode: $scope.datepickerMode}); }; this.customClass = function(date) { return $scope.customClass({date: date, mode: $scope.datepickerMode}); }; // Split array into smaller arrays this.split = function(arr, size) { var arrays = []; while (arr.length > 0) { arrays.push(arr.splice(0, size)); } return arrays; }; $scope.select = function(date) { if ($scope.datepickerMode === self.minMode) { var dt = ngModelCtrl.$viewValue ? dateParser.fromTimezone(new Date(ngModelCtrl.$viewValue), ngModelOptions.timezone) : new Date(0, 0, 0, 0, 0, 0, 0); dt.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); dt = dateParser.toTimezone(dt, ngModelOptions.timezone); ngModelCtrl.$setViewValue(dt); ngModelCtrl.$render(); } else { self.activeDate = date; setMode(self.modes[self.modes.indexOf($scope.datepickerMode) - 1]); $scope.$emit('uib:datepicker.mode'); } }; $scope.move = function(direction) { var year = self.activeDate.getFullYear() + direction * (self.step.years || 0), month = self.activeDate.getMonth() + direction * (self.step.months || 0); self.activeDate.setFullYear(year, month, 1); self.refreshView(); }; $scope.toggleMode = function(direction) { direction = direction || 1; if ($scope.datepickerMode === self.maxMode && direction === 1 || $scope.datepickerMode === self.minMode && direction === -1) { return; } setMode(self.modes[self.modes.indexOf($scope.datepickerMode) + direction]); $scope.$emit('uib:datepicker.mode'); }; // Key event mapper $scope.keys = { 13: 'enter', 32: 'space', 33: 'pageup', 34: 'pagedown', 35: 'end', 36: 'home', 37: 'left', 38: 'up', 39: 'right', 40: 'down' }; var focusElement = function() { self.element[0].focus(); }; // Listen for focus requests from popup directive $scope.$on('uib:datepicker.focus', focusElement); $scope.keydown = function(evt) { var key = $scope.keys[evt.which]; if (!key || evt.shiftKey || evt.altKey || $scope.disabled) { return; } evt.preventDefault(); if (!self.shortcutPropagation) { evt.stopPropagation(); } if (key === 'enter' || key === 'space') { if (self.isDisabled(self.activeDate)) { return; // do nothing } $scope.select(self.activeDate); } else if (evt.ctrlKey && (key === 'up' || key === 'down')) { $scope.toggleMode(key === 'up' ? 1 : -1); } else { self.handleKeyDown(key, evt); self.refreshView(); } }; $scope.$on("$destroy", function() { //Clear all watch listeners on destroy while (watchListeners.length) { watchListeners.shift()(); } }); function setMode(mode) { $scope.datepickerMode = mode; if (optionsUsed) { $scope.datepickerOptions.datepickerMode = mode; } } }]) .controller('UibDaypickerController', ['$scope', '$element', 'dateFilter', function(scope, $element, dateFilter) { var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; this.step = { months: 1 }; this.element = $element; function getDaysInMonth(year, month) { return month === 1 && year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0) ? 29 : DAYS_IN_MONTH[month]; } this.init = function(ctrl) { angular.extend(ctrl, this); scope.showWeeks = ctrl.showWeeks; ctrl.refreshView(); }; this.getDates = function(startDate, n) { var dates = new Array(n), current = new Date(startDate), i = 0, date; while (i < n) { date = new Date(current); dates[i++] = date; current.setDate(current.getDate() + 1); } return dates; }; this._refreshView = function() { var year = this.activeDate.getFullYear(), month = this.activeDate.getMonth(), firstDayOfMonth = new Date(this.activeDate); firstDayOfMonth.setFullYear(year, month, 1); var difference = this.startingDay - firstDayOfMonth.getDay(), numDisplayedFromPreviousMonth = difference > 0 ? 7 - difference : - difference, firstDate = new Date(firstDayOfMonth); if (numDisplayedFromPreviousMonth > 0) { firstDate.setDate(-numDisplayedFromPreviousMonth + 1); } // 42 is the number of days on a six-week calendar var days = this.getDates(firstDate, 42); for (var i = 0; i < 42; i ++) { days[i] = angular.extend(this.createDateObject(days[i], this.formatDay), { secondary: days[i].getMonth() !== month, uid: scope.uniqueId + '-' + i }); } scope.labels = new Array(7); for (var j = 0; j < 7; j++) { scope.labels[j] = { abbr: dateFilter(days[j].date, this.formatDayHeader), full: dateFilter(days[j].date, 'EEEE') }; } scope.title = dateFilter(this.activeDate, this.formatDayTitle); scope.rows = this.split(days, 7); if (scope.showWeeks) { scope.weekNumbers = []; var thursdayIndex = (4 + 7 - this.startingDay) % 7, numWeeks = scope.rows.length; for (var curWeek = 0; curWeek < numWeeks; curWeek++) { scope.weekNumbers.push( getISO8601WeekNumber(scope.rows[curWeek][thursdayIndex].date)); } } }; this.compare = function(date1, date2) { var _date1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate()); var _date2 = new Date(date2.getFullYear(), date2.getMonth(), date2.getDate()); _date1.setFullYear(date1.getFullYear()); _date2.setFullYear(date2.getFullYear()); return _date1 - _date2; }; function getISO8601WeekNumber(date) { var checkDate = new Date(date); checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); // Thursday var time = checkDate.getTime(); checkDate.setMonth(0); // Compare with Jan 1 checkDate.setDate(1); return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; } this.handleKeyDown = function(key, evt) { var date = this.activeDate.getDate(); if (key === 'left') { date = date - 1; } else if (key === 'up') { date = date - 7; } else if (key === 'right') { date = date + 1; } else if (key === 'down') { date = date + 7; } else if (key === 'pageup' || key === 'pagedown') { var month = this.activeDate.getMonth() + (key === 'pageup' ? - 1 : 1); this.activeDate.setMonth(month, 1); date = Math.min(getDaysInMonth(this.activeDate.getFullYear(), this.activeDate.getMonth()), date); } else if (key === 'home') { date = 1; } else if (key === 'end') { date = getDaysInMonth(this.activeDate.getFullYear(), this.activeDate.getMonth()); } this.activeDate.setDate(date); }; }]) .controller('UibMonthpickerController', ['$scope', '$element', 'dateFilter', function(scope, $element, dateFilter) { this.step = { years: 1 }; this.element = $element; this.init = function(ctrl) { angular.extend(ctrl, this); ctrl.refreshView(); }; this._refreshView = function() { var months = new Array(12), year = this.activeDate.getFullYear(), date; for (var i = 0; i < 12; i++) { date = new Date(this.activeDate); date.setFullYear(year, i, 1); months[i] = angular.extend(this.createDateObject(date, this.formatMonth), { uid: scope.uniqueId + '-' + i }); } scope.title = dateFilter(this.activeDate, this.formatMonthTitle); scope.rows = this.split(months, 3); }; this.compare = function(date1, date2) { var _date1 = new Date(date1.getFullYear(), date1.getMonth()); var _date2 = new Date(date2.getFullYear(), date2.getMonth()); _date1.setFullYear(date1.getFullYear()); _date2.setFullYear(date2.getFullYear()); return _date1 - _date2; }; this.handleKeyDown = function(key, evt) { var date = this.activeDate.getMonth(); if (key === 'left') { date = date - 1; } else if (key === 'up') { date = date - 3; } else if (key === 'right') { date = date + 1; } else if (key === 'down') { date = date + 3; } else if (key === 'pageup' || key === 'pagedown') { var year = this.activeDate.getFullYear() + (key === 'pageup' ? - 1 : 1); this.activeDate.setFullYear(year); } else if (key === 'home') { date = 0; } else if (key === 'end') { date = 11; } this.activeDate.setMonth(date); }; }]) .controller('UibYearpickerController', ['$scope', '$element', 'dateFilter', function(scope, $element, dateFilter) { var columns, range; this.element = $element; function getStartingYear(year) { return parseInt((year - 1) / range, 10) * range + 1; } this.yearpickerInit = function() { columns = this.yearColumns; range = this.yearRows * columns; this.step = { years: range }; }; this._refreshView = function() { var years = new Array(range), date; for (var i = 0, start = getStartingYear(this.activeDate.getFullYear()); i < range; i++) { date = new Date(this.activeDate); date.setFullYear(start + i, 0, 1); years[i] = angular.extend(this.createDateObject(date, this.formatYear), { uid: scope.uniqueId + '-' + i }); } scope.title = [years[0].label, years[range - 1].label].join(' - '); scope.rows = this.split(years, columns); scope.columns = columns; }; this.compare = function(date1, date2) { return date1.getFullYear() - date2.getFullYear(); }; this.handleKeyDown = function(key, evt) { var date = this.activeDate.getFullYear(); if (key === 'left') { date = date - 1; } else if (key === 'up') { date = date - columns; } else if (key === 'right') { date = date + 1; } else if (key === 'down') { date = date + columns; } else if (key === 'pageup' || key === 'pagedown') { date += (key === 'pageup' ? - 1 : 1) * range; } else if (key === 'home') { date = getStartingYear(this.activeDate.getFullYear()); } else if (key === 'end') { date = getStartingYear(this.activeDate.getFullYear()) + range - 1; } this.activeDate.setFullYear(date); }; }]) .directive('uibDatepicker', function() { return { replace: true, templateUrl: function(element, attrs) { return attrs.templateUrl || 'uib/template/datepicker/datepicker.html'; }, scope: { datepickerMode: '=?', datepickerOptions: '=?', dateDisabled: '&', customClass: '&', shortcutPropagation: '&?' }, require: ['uibDatepicker', '^ngModel'], controller: 'UibDatepickerController', controllerAs: 'datepicker', link: function(scope, element, attrs, ctrls) { var datepickerCtrl = ctrls[0], ngModelCtrl = ctrls[1]; datepickerCtrl.init(ngModelCtrl); } }; }) .directive('uibDaypicker', function() { return { replace: true, templateUrl: function(element, attrs) { return attrs.templateUrl || 'uib/template/datepicker/day.html'; }, require: ['^uibDatepicker', 'uibDaypicker'], controller: 'UibDaypickerController', link: function(scope, element, attrs, ctrls) { var datepickerCtrl = ctrls[0], daypickerCtrl = ctrls[1]; daypickerCtrl.init(datepickerCtrl); } }; }) .directive('uibMonthpicker', function() { return { replace: true, templateUrl: function(element, attrs) { return attrs.templateUrl || 'uib/template/datepicker/month.html'; }, require: ['^uibDatepicker', 'uibMonthpicker'], controller: 'UibMonthpickerController', link: function(scope, element, attrs, ctrls) { var datepickerCtrl = ctrls[0], monthpickerCtrl = ctrls[1]; monthpickerCtrl.init(datepickerCtrl); } }; }) .directive('uibYearpicker', function() { return { replace: true, templateUrl: function(element, attrs) { return attrs.templateUrl || 'uib/template/datepicker/year.html'; }, require: ['^uibDatepicker', 'uibYearpicker'], controller: 'UibYearpickerController', link: function(scope, element, attrs, ctrls) { var ctrl = ctrls[0]; angular.extend(ctrl, ctrls[1]); ctrl.yearpickerInit(); ctrl.refreshView(); } }; }) .value('uibDatepickerPopupAttributeWarning', true) .constant('uibDatepickerPopupConfig', { altInputFormats: [], appendToBody: false, clearText: 'Clear', closeOnDateSelection: true, closeText: 'Done', currentText: 'Today', datepickerPopup: 'yyyy-MM-dd', datepickerPopupTemplateUrl: 'uib/template/datepicker/popup.html', datepickerTemplateUrl: 'uib/template/datepicker/datepicker.html', html5Types: { date: 'yyyy-MM-dd', 'datetime-local': 'yyyy-MM-ddTHH:mm:ss.sss', 'month': 'yyyy-MM' }, onOpenFocus: true, showButtonBar: true, placement: 'auto bottom-left' }) .controller('UibDatepickerPopupController', ['$scope', '$element', '$attrs', '$compile', '$log', '$parse', '$window', '$document', '$rootScope', '$uibPosition', 'dateFilter', 'uibDateParser', 'uibDatepickerPopupConfig', '$timeout', 'uibDatepickerConfig', 'uibDatepickerPopupAttributeWarning', function($scope, $element, $attrs, $compile, $log, $parse, $window, $document, $rootScope, $position, dateFilter, dateParser, datepickerPopupConfig, $timeout, datepickerConfig, datepickerPopupAttributeWarning) { var cache = {}, isHtml5DateInput = false; var dateFormat, closeOnDateSelection, appendToBody, onOpenFocus, datepickerPopupTemplateUrl, datepickerTemplateUrl, popupEl, datepickerEl, scrollParentEl, ngModel, ngModelOptions, $popup, altInputFormats, watchListeners = []; $scope.watchData = {}; this.init = function(_ngModel_) { ngModel = _ngModel_; ngModelOptions = _ngModel_.$options || datepickerConfig.ngModelOptions; closeOnDateSelection = angular.isDefined($attrs.closeOnDateSelection) ? $scope.$parent.$eval($attrs.closeOnDateSelection) : datepickerPopupConfig.closeOnDateSelection; appendToBody = angular.isDefined($attrs.datepickerAppendToBody) ? $scope.$parent.$eval($attrs.datepickerAppendToBody) : datepickerPopupConfig.appendToBody; onOpenFocus = angular.isDefined($attrs.onOpenFocus) ? $scope.$parent.$eval($attrs.onOpenFocus) : datepickerPopupConfig.onOpenFocus; datepickerPopupTemplateUrl = angular.isDefined($attrs.datepickerPopupTemplateUrl) ? $attrs.datepickerPopupTemplateUrl : datepickerPopupConfig.datepickerPopupTemplateUrl; datepickerTemplateUrl = angular.isDefined($attrs.datepickerTemplateUrl) ? $attrs.datepickerTemplateUrl : datepickerPopupConfig.datepickerTemplateUrl; altInputFormats = angular.isDefined($attrs.altInputFormats) ? $scope.$parent.$eval($attrs.altInputFormats) : datepickerPopupConfig.altInputFormats; $scope.showButtonBar = angular.isDefined($attrs.showButtonBar) ? $scope.$parent.$eval($attrs.showButtonBar) : datepickerPopupConfig.showButtonBar; if (datepickerPopupConfig.html5Types[$attrs.type]) { dateFormat = datepickerPopupConfig.html5Types[$attrs.type]; isHtml5DateInput = true; } else { dateFormat = $attrs.uibDatepickerPopup || datepickerPopupConfig.datepickerPopup; $attrs.$observe('uibDatepickerPopup', function(value, oldValue) { var newDateFormat = value || datepickerPopupConfig.datepickerPopup; // Invalidate the $modelValue to ensure that formatters re-run // FIXME: Refactor when PR is merged: https://github.com/angular/angular.js/pull/10764 if (newDateFormat !== dateFormat) { dateFormat = newDateFormat; ngModel.$modelValue = null; if (!dateFormat) { throw new Error('uibDatepickerPopup must have a date format specified.'); } } }); } if (!dateFormat) { throw new Error('uibDatepickerPopup must have a date format specified.'); } if (isHtml5DateInput && $attrs.uibDatepickerPopup) { throw new Error('HTML5 date input types do not support custom formats.'); } // popup element used to display calendar popupEl = angular.element('<div uib-datepicker-popup-wrap><div uib-datepicker></div></div>'); $scope.ngModelOptions = angular.copy(ngModelOptions); $scope.ngModelOptions.timezone = null; if ($scope.ngModelOptions.updateOnDefault === true) { $scope.ngModelOptions.updateOn = $scope.ngModelOptions.updateOn ? $scope.ngModelOptions.updateOn + ' default' : 'default'; } popupEl.attr({ 'ng-model': 'date', 'ng-model-options': 'ngModelOptions', 'ng-change': 'dateSelection(date)', 'template-url': datepickerPopupTemplateUrl }); // datepicker element datepickerEl = angular.element(popupEl.children()[0]); datepickerEl.attr('template-url', datepickerTemplateUrl); if (isHtml5DateInput) { if ($attrs.type === 'month') { datepickerEl.attr('datepicker-mode', '"month"'); datepickerEl.attr('min-mode', 'month'); } } if ($scope.datepickerOptions) { datepickerEl.attr('datepicker-options', 'datepickerOptions'); } angular.forEach(['minMode', 'maxMode', 'datepickerMode', 'shortcutPropagation'], function(key) { if ($attrs[key]) { if (datepickerPopupAttributeWarning) { $log.warn('uib-datepicker settings via uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); } var getAttribute = $parse($attrs[key]); var propConfig = { get: function() { return getAttribute($scope.$parent); } }; datepickerEl.attr(cameltoDash(key), 'watchData.' + key); // Propagate changes from datepicker to outside if (key === 'datepickerMode') { var setAttribute = getAttribute.assign; propConfig.set = function(v) { setAttribute($scope.$parent, v); }; } Object.defineProperty($scope.watchData, key, propConfig); } }); angular.forEach(['minDate', 'maxDate', 'initDate'], function(key) { if ($attrs[key]) { if (datepickerPopupAttributeWarning) { $log.warn('uib-datepicker settings via uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); } var getAttribute = $parse($attrs[key]); watchListeners.push($scope.$parent.$watch(getAttribute, function(value) { if (key === 'minDate' || key === 'maxDate') { if (value === null) { cache[key] = null; } else if (angular.isDate(value)) { cache[key] = dateParser.fromTimezone(new Date(value), ngModelOptions.timezone); } else { cache[key] = new Date(dateFilter(value, 'medium')); } $scope.watchData[key] = value === null ? null : cache[key]; } else { var date = value ? new Date(value) : new Date(); $scope.watchData[key] = dateParser.fromTimezone(date, ngModelOptions.timezone); } })); datepickerEl.attr(cameltoDash(key), 'watchData.' + key); } }); if ($attrs.dateDisabled) { if (datepickerPopupAttributeWarning) { $log.warn('uib-datepicker settings via uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); } datepickerEl.attr('date-disabled', 'dateDisabled({ date: date, mode: mode })'); } angular.forEach(['formatDay', 'formatMonth', 'formatYear', 'formatDayHeader', 'formatDayTitle', 'formatMonthTitle', 'showWeeks', 'startingDay', 'yearRows', 'yearColumns'], function(key) { if (angular.isDefined($attrs[key])) { if (datepickerPopupAttributeWarning) { $log.warn('uib-datepicker settings via uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); } datepickerEl.attr(cameltoDash(key), $attrs[key]); } }); if ($attrs.customClass) { if (datepickerPopupAttributeWarning) { $log.warn('uib-datepicker settings via uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead'); } datepickerEl.attr('custom-class', 'customClass({ date: date, mode: mode })'); } if (!isHtml5DateInput) { // Internal API to maintain the correct ng-invalid-[key] class ngModel.$$parserName = 'date'; ngModel.$validators.date = validator; ngModel.$parsers.unshift(parseDate); ngModel.$formatters.push(function(value) { if (ngModel.$isEmpty(value)) { $scope.date = value; return value; } $scope.date = dateParser.fromTimezone(value, ngModelOptions.timezone); if (angular.isNumber($scope.date)) { $scope.date = new Date($scope.date); } return dateParser.filter($scope.date, dateFormat); }); } else { ngModel.$formatters.push(function(value) { $scope.date = dateParser.fromTimezone(value, ngModelOptions.timezone); return value; }); } // Detect changes in the view from the text box ngModel.$viewChangeListeners.push(function() { $scope.date = parseDateString(ngModel.$viewValue); }); $element.on('keydown', inputKeydownBind); $popup = $compile(popupEl)($scope); // Prevent jQuery cache memory leak (template is now redundant after linking) popupEl.remove(); if (appendToBody) { $document.find('body').append($popup); } else { $element.after($popup); } $scope.$on('$destroy', function() { if ($scope.isOpen === true) { if (!$rootScope.$$phase) { $scope.$apply(function() { $scope.isOpen = false; }); } } $popup.remove(); $element.off('keydown', inputKeydownBind); $document.off('click', documentClickBind); if (scrollParentEl) { scrollParentEl.off('scroll', positionPopup); } angular.element($window).off('resize', positionPopup); //Clear all watch listeners on destroy while (watchListeners.length) { watchListeners.shift()(); } }); }; $scope.getText = function(key) { return $scope[key + 'Text'] || datepickerPopupConfig[key + 'Text']; }; $scope.isDisabled = function(date) { if (date === 'today') { date = dateParser.fromTimezone(new Date(), ngModelOptions.timezone); } if ($scope.datepickerOptions) { return $scope.datepickerOptions && $scope.datepickerOptions.minDate && $scope.compare(date, $scope.datepickerOptions.minDate) < 0 || $scope.datepickerOptions.maxDate && $scope.compare(date, $scope.datepickerOptions.maxDate) > 0; } return $scope.watchData.minDate && $scope.compare(date, cache.minDate) < 0 || $scope.watchData.maxDate && $scope.compare(date, cache.maxDate) > 0; }; $scope.compare = function(date1, date2) { return new Date(date1.getFullYear(), date1.getMonth(), date1.getDate()) - new Date(date2.getFullYear(), date2.getMonth(), date2.getDate()); }; // Inner change $scope.dateSelection = function(dt) { if (angular.isDefined(dt)) { $scope.date = dt; } var date = $scope.date ? dateParser.filter($scope.date, dateFormat) : null; // Setting to NULL is necessary for form validators to function $element.val(date); ngModel.$setViewValue(date); if (closeOnDateSelection) { $scope.isOpen = false; $element[0].focus(); } }; $scope.keydown = function(evt) { if (evt.which === 27) { evt.stopPropagation(); $scope.isOpen = false; $element[0].focus(); } }; $scope.select = function(date, evt) { evt.stopPropagation(); if (date === 'today') { var today = new Date(); if (angular.isDate($scope.date)) { date = new Date($scope.date); date.setFullYear(today.getFullYear(), today.getMonth(), today.getDate()); } else { date = new Date(today.setHours(0, 0, 0, 0)); } } $scope.dateSelection(date); }; $scope.close = function(evt) { evt.stopPropagation(); $scope.isOpen = false; $element[0].focus(); }; $scope.disabled = angular.isDefined($attrs.disabled) || false; if ($attrs.ngDisabled) { watchListeners.push($scope.$parent.$watch($parse($attrs.ngDisabled), function(disabled) { $scope.disabled = disabled; })); } $scope.$watch('isOpen', function(value) { if (value) { if (!$scope.disabled) { $timeout(function() { positionPopup(); if (onOpenFocus) { $scope.$broadcast('uib:datepicker.focus'); } $document.on('click', documentClickBind); var placement = $attrs.popupPlacement ? $attrs.popupPlacement : datepickerPopupConfig.placement; if (appendToBody || $position.parsePlacement(placement)[2]) { scrollParentEl = scrollParentEl || angular.element($position.scrollParent($element)); if (scrollParentEl) { scrollParentEl.on('scroll', positionPopup); } } else { scrollParentEl = null; } angular.element($window).on('resize', positionPopup); }, 0, false); } else { $scope.isOpen = false; } } else { $document.off('click', documentClickBind); if (scrollParentEl) { scrollParentEl.off('scroll', positionPopup); } angular.element($window).off('resize', positionPopup); } }); function cameltoDash(string) { return string.replace(/([A-Z])/g, function($1) { return '-' + $1.toLowerCase(); }); } function parseDateString(viewValue) { var date = dateParser.parse(viewValue, dateFormat, $scope.date); if (isNaN(date)) { for (var i = 0; i < altInputFormats.length; i++) { date = dateParser.parse(viewValue, altInputFormats[i], $scope.date); if (!isNaN(date)) { return date; } } } return date; } function parseDate(viewValue) { if (angular.isNumber(viewValue)) { // presumably timestamp to date object viewValue = new Date(viewValue); } if (!viewValue) { return null; } if (angular.isDate(viewValue) && !isNaN(viewValue)) { return viewValue; } if (angular.isString(viewValue)) { var date = parseDateString(viewValue); if (!isNaN(date)) { return dateParser.toTimezone(date, ngModelOptions.timezone); } } return ngModel.$options && ngModel.$options.allowInvalid ? viewValue : undefined; } function validator(modelValue, viewValue) { var value = modelValue || viewValue; if (!$attrs.ngRequired && !value) { return true; } if (angular.isNumber(value)) { value = new Date(value); } if (!value) { return true; } if (angular.isDate(value) && !isNaN(value)) { return true; } if (angular.isString(value)) { return !isNaN(parseDateString(viewValue)); } return false; } function documentClickBind(event) { if (!$scope.isOpen && $scope.disabled) { return; } var popup = $popup[0]; var dpContainsTarget = $element[0].contains(event.target); // The popup node may not be an element node // In some browsers (IE) only element nodes have the 'contains' function var popupContainsTarget = popup.contains !== undefined && popup.contains(event.target); if ($scope.isOpen && !(dpContainsTarget || popupContainsTarget)) { $scope.$apply(function() { $scope.isOpen = false; }); } } function inputKeydownBind(evt) { if (evt.which === 27 && $scope.isOpen) { evt.preventDefault(); evt.stopPropagation(); $scope.$apply(function() { $scope.isOpen = false; }); $element[0].focus(); } else if (evt.which === 40 && !$scope.isOpen) { evt.preventDefault(); evt.stopPropagation(); $scope.$apply(function() { $scope.isOpen = true; }); } } function positionPopup() { if ($scope.isOpen) { var dpElement = angular.element($popup[0].querySelector('.uib-datepicker-popup')); var placement = $attrs.popupPlacement ? $attrs.popupPlacement : datepickerPopupConfig.placement; var position = $position.positionElements($element, dpElement, placement, appendToBody); dpElement.css({top: position.top + 'px', left: position.left + 'px'}); if (dpElement.hasClass('uib-position-measure')) { dpElement.removeClass('uib-position-measure'); } } } $scope.$on('uib:datepicker.mode', function() { $timeout(positionPopup, 0, false); }); }]) .directive('uibDatepickerPopup', function() { return { require: ['ngModel', 'uibDatepickerPopup'], controller: 'UibDatepickerPopupController', scope: { datepickerOptions: '=?', isOpen: '=?', currentText: '@', clearText: '@', closeText: '@', dateDisabled: '&', customClass: '&' }, link: function(scope, element, attrs, ctrls) { var ngModel = ctrls[0], ctrl = ctrls[1]; ctrl.init(ngModel); } }; }) .directive('uibDatepickerPopupWrap', function() { return { replace: true, transclude: true, templateUrl: function(element, attrs) { return attrs.templateUrl || 'uib/template/datepicker/popup.html'; } }; }); angular.module('ui.bootstrap.debounce', []) /** * A helper, internal service that debounces a function */ .factory('$$debounce', ['$timeout', function($timeout) { return function(callback, debounceTime) { var timeoutPromise; return function() { var self = this; var args = Array.prototype.slice.call(arguments); if (timeoutPromise) { $timeout.cancel(timeoutPromise); } timeoutPromise = $timeout(function() { callback.apply(self, args); }, debounceTime); }; }; }]); angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position']) .constant('uibDropdownConfig', { appendToOpenClass: 'uib-dropdown-open', openClass: 'open' }) .service('uibDropdownService', ['$document', '$rootScope', function($document, $rootScope) { var openScope = null; this.open = function(dropdownScope) { if (!openScope) { $document.on('click', closeDropdown); $document.on('keydown', keybindFilter); } if (openScope && openScope !== dropdownScope) { openScope.isOpen = false; } openScope = dropdownScope; }; this.close = function(dropdownScope) { if (openScope === dropdownScope) { openScope = null; $document.off('click', closeDropdown); $document.off('keydown', keybindFilter); } }; var closeDropdown = function(evt) { // This method may still be called during the same mouse event that // unbound this event handler. So check openScope before proceeding. if (!openScope) { return; } if (evt && openScope.getAutoClose() === 'disabled') { return; } if (evt && evt.which === 3) { return; } var toggleElement = openScope.getToggleElement(); if (evt && toggleElement && toggleElement[0].contains(evt.target)) { return; } var dropdownElement = openScope.getDropdownElement(); if (evt && openScope.getAutoClose() === 'outsideClick' && dropdownElement && dropdownElement[0].contains(evt.target)) { return; } openScope.isOpen = false; if (!$rootScope.$$phase) { openScope.$apply(); } }; var keybindFilter = function(evt) { if (evt.which === 27) { openScope.focusToggleElement(); closeDropdown(); } else if (openScope.isKeynavEnabled() && [38, 40].indexOf(evt.which) !== -1 && openScope.isOpen) { evt.preventDefault(); evt.stopPropagation(); openScope.focusDropdownEntry(evt.which); } }; }]) .controller('UibDropdownController', ['$scope', '$element', '$attrs', '$parse', 'uibDropdownConfig', 'uibDropdownService', '$animate', '$uibPosition', '$document', '$compile', '$templateRequest', function($scope, $element, $attrs, $parse, dropdownConfig, uibDropdownService, $animate, $position, $document, $compile, $templateRequest) { var self = this, scope = $scope.$new(), // create a child scope so we are not polluting original one templateScope, appendToOpenClass = dropdownConfig.appendToOpenClass, openClass = dropdownConfig.openClass, getIsOpen, setIsOpen = angular.noop, toggleInvoker = $attrs.onToggle ? $parse($attrs.onToggle) : angular.noop, appendToBody = false, appendTo = null, keynavEnabled = false, selectedOption = null, body = $document.find('body'); $element.addClass('dropdown'); this.init = function() { if ($attrs.isOpen) { getIsOpen = $parse($attrs.isOpen); setIsOpen = getIsOpen.assign; $scope.$watch(getIsOpen, function(value) { scope.isOpen = !!value; }); } if (angular.isDefined($attrs.dropdownAppendTo)) { var appendToEl = $parse($attrs.dropdownAppendTo)(scope); if (appendToEl) { appendTo = angular.element(appendToEl); } } appendToBody = angular.isDefined($attrs.dropdownAppendToBody); keynavEnabled = angular.isDefined($attrs.keyboardNav); if (appendToBody && !appendTo) { appendTo = body; } if (appendTo && self.dropdownMenu) { appendTo.append(self.dropdownMenu); $element.on('$destroy', function handleDestroyEvent() { self.dropdownMenu.remove(); }); } }; this.toggle = function(open) { scope.isOpen = arguments.length ? !!open : !scope.isOpen; if (angular.isFunction(setIsOpen)) { setIsOpen(scope, scope.isOpen); } return scope.isOpen; }; // Allow other directives to watch status this.isOpen = function() { return scope.isOpen; }; scope.getToggleElement = function() { return self.toggleElement; }; scope.getAutoClose = function() { return $attrs.autoClose || 'always'; //or 'outsideClick' or 'disabled' }; scope.getElement = function() { return $element; }; scope.isKeynavEnabled = function() { return keynavEnabled; }; scope.focusDropdownEntry = function(keyCode) { var elems = self.dropdownMenu ? //If append to body is used. angular.element(self.dropdownMenu).find('a') : $element.find('ul').eq(0).find('a'); switch (keyCode) { case 40: { if (!angular.isNumber(self.selectedOption)) { self.selectedOption = 0; } else { self.selectedOption = self.selectedOption === elems.length - 1 ? self.selectedOption : self.selectedOption + 1; } break; } case 38: { if (!angular.isNumber(self.selectedOption)) { self.selectedOption = elems.length - 1; } else { self.selectedOption = self.selectedOption === 0 ? 0 : self.selectedOption - 1; } break; } } elems[self.selectedOption].focus(); }; scope.getDropdownElement = function() { return self.dropdownMenu; }; scope.focusToggleElement = function() { if (self.toggleElement) { self.toggleElement[0].focus(); } }; scope.$watch('isOpen', function(isOpen, wasOpen) { if (appendTo && self.dropdownMenu) { var pos = $position.positionElements($element, self.dropdownMenu, 'bottom-left', true), css, rightalign; css = { top: pos.top + 'px', display: isOpen ? 'block' : 'none' }; rightalign = self.dropdownMenu.hasClass('dropdown-menu-right'); if (!rightalign) { css.left = pos.left + 'px'; css.right = 'auto'; } else { css.left = 'auto'; css.right = window.innerWidth - (pos.left + $element.prop('offsetWidth')) + 'px'; } // Need to adjust our positioning to be relative to the appendTo container // if it's not the body element if (!appendToBody) { var appendOffset = $position.offset(appendTo); css.top = pos.top - appendOffset.top + 'px'; if (!rightalign) { css.left = pos.left - appendOffset.left + 'px'; } else { css.right = window.innerWidth - (pos.left - appendOffset.left + $element.prop('offsetWidth')) + 'px'; } } self.dropdownMenu.css(css); } var openContainer = appendTo ? appendTo : $element; var hasOpenClass = openContainer.hasClass(appendTo ? appendToOpenClass : openClass); if (hasOpenClass === !isOpen) { $animate[isOpen ? 'addClass' : 'removeClass'](openContainer, appendTo ? appendToOpenClass : openClass).then(function() { if (angular.isDefined(isOpen) && isOpen !== wasOpen) { toggleInvoker($scope, { open: !!isOpen }); } }); } if (isOpen) { if (self.dropdownMenuTemplateUrl) { $templateRequest(self.dropdownMenuTemplateUrl).then(function(tplContent) { templateScope = scope.$new(); $compile(tplContent.trim())(templateScope, function(dropdownElement) { var newEl = dropdownElement; self.dropdownMenu.replaceWith(newEl); self.dropdownMenu = newEl; }); }); } scope.focusToggleElement(); uibDropdownService.open(scope); } else { if (self.dropdownMenuTemplateUrl) { if (templateScope) { templateScope.$destroy(); } var newEl = angular.element('<ul class="dropdown-menu"></ul>'); self.dropdownMenu.replaceWith(newEl); self.dropdownMenu = newEl; } uibDropdownService.close(scope); self.selectedOption = null; } if (angular.isFunction(setIsOpen)) { setIsOpen($scope, isOpen); } }); $scope.$on('$locationChangeSuccess', function() { if (scope.getAutoClose() !== 'disabled') { scope.isOpen = false; } }); }]) .directive('uibDropdown', function() { return { controller: 'UibDropdownController', link: function(scope, element, attrs, dropdownCtrl) { dropdownCtrl.init(); } }; }) .directive('uibDropdownMenu', function() { return { restrict: 'A', require: '?^uibDropdown', link: function(scope, element, attrs, dropdownCtrl) { if (!dropdownCtrl || angular.isDefined(attrs.dropdownNested)) { return; } element.addClass('dropdown-menu'); var tplUrl = attrs.templateUrl; if (tplUrl) { dropdownCtrl.dropdownMenuTemplateUrl = tplUrl; } if (!dropdownCtrl.dropdownMenu) { dropdownCtrl.dropdownMenu = element; } } }; }) .directive('uibDropdownToggle', function() { return { require: '?^uibDropdown', link: function(scope, element, attrs, dropdownCtrl) { if (!dropdownCtrl) { return; } element.addClass('dropdown-toggle'); dropdownCtrl.toggleElement = element; var toggleDropdown = function(event) { event.preventDefault(); if (!element.hasClass('disabled') && !attrs.disabled) { scope.$apply(function() { dropdownCtrl.toggle(); }); } }; element.bind('click', toggleDropdown); // WAI-ARIA element.attr({ 'aria-haspopup': true, 'aria-expanded': false }); scope.$watch(dropdownCtrl.isOpen, function(isOpen) { element.attr('aria-expanded', !!isOpen); }); scope.$on('$destroy', function() { element.unbind('click', toggleDropdown); }); } }; }); angular.module('ui.bootstrap.stackedMap', []) /** * A helper, internal data structure that acts as a map but also allows getting / removing * elements in the LIFO order */ .factory('$$stackedMap', function() { return { createNew: function() { var stack = []; return { add: function(key, value) { stack.push({ key: key, value: value }); }, get: function(key) { for (var i = 0; i < stack.length; i++) { if (key === stack[i].key) { return stack[i]; } } }, keys: function() { var keys = []; for (var i = 0; i < stack.length; i++) { keys.push(stack[i].key); } return keys; }, top: function() { return stack[stack.length - 1]; }, remove: function(key) { var idx = -1; for (var i = 0; i < stack.length; i++) { if (key === stack[i].key) { idx = i; break; } } return stack.splice(idx, 1)[0]; }, removeTop: function() { return stack.splice(stack.length - 1, 1)[0]; }, length: function() { return stack.length; } }; } }; }); angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap']) /** * A helper, internal data structure that stores all references attached to key */ .factory('$$multiMap', function() { return { createNew: function() { var map = {}; return { entries: function() { return Object.keys(map).map(function(key) { return { key: key, value: map[key] }; }); }, get: function(key) { return map[key]; }, hasKey: function(key) { return !!map[key]; }, keys: function() { return Object.keys(map); }, put: function(key, value) { if (!map[key]) { map[key] = []; } map[key].push(value); }, remove: function(key, value) { var values = map[key]; if (!values) { return; } var idx = values.indexOf(value); if (idx !== -1) { values.splice(idx, 1); } if (!values.length) { delete map[key]; } } }; } }; }) /** * Pluggable resolve mechanism for the modal resolve resolution * Supports UI Router's $resolve service */ .provider('$uibResolve', function() { var resolve = this; this.resolver = null; this.setResolver = function(resolver) { this.resolver = resolver; }; this.$get = ['$injector', '$q', function($injector, $q) { var resolver = resolve.resolver ? $injector.get(resolve.resolver) : null; return { resolve: function(invocables, locals, parent, self) { if (resolver) { return resolver.resolve(invocables, locals, parent, self); } var promises = []; angular.forEach(invocables, function(value) { if (angular.isFunction(value) || angular.isArray(value)) { promises.push($q.resolve($injector.invoke(value))); } else if (angular.isString(value)) { promises.push($q.resolve($injector.get(value))); } else { promises.push($q.resolve(value)); } }); return $q.all(promises).then(function(resolves) { var resolveObj = {}; var resolveIter = 0; angular.forEach(invocables, function(value, key) { resolveObj[key] = resolves[resolveIter++]; }); return resolveObj; }); } }; }]; }) /** * A helper directive for the $modal service. It creates a backdrop element. */ .directive('uibModalBackdrop', ['$animate', '$injector', '$uibModalStack', function($animate, $injector, $modalStack) { return { replace: true, templateUrl: 'uib/template/modal/backdrop.html', compile: function(tElement, tAttrs) { tElement.addClass(tAttrs.backdropClass); return linkFn; } }; function linkFn(scope, element, attrs) { if (attrs.modalInClass) { $animate.addClass(element, attrs.modalInClass); scope.$on($modalStack.NOW_CLOSING_EVENT, function(e, setIsAsync) { var done = setIsAsync(); if (scope.modalOptions.animation) { $animate.removeClass(element, attrs.modalInClass).then(done); } else { done(); } }); } } }]) .directive('uibModalWindow', ['$uibModalStack', '$q', '$animateCss', '$document', function($modalStack, $q, $animateCss, $document) { return { scope: { index: '@' }, replace: true, transclude: true, templateUrl: function(tElement, tAttrs) { return tAttrs.templateUrl || 'uib/template/modal/window.html'; }, link: function(scope, element, attrs) { element.addClass(attrs.windowClass || ''); element.addClass(attrs.windowTopClass || ''); scope.size = attrs.size; scope.close = function(evt) { var modal = $modalStack.getTop(); if (modal && modal.value.backdrop && modal.value.backdrop !== 'static' && evt.target === evt.currentTarget) { evt.preventDefault(); evt.stopPropagation(); $modalStack.dismiss(modal.key, 'backdrop click'); } }; // moved from template to fix issue #2280 element.on('click', scope.close); // This property is only added to the scope for the purpose of detecting when this directive is rendered. // We can detect that by using this property in the template associated with this directive and then use // {@link Attribute#$observe} on it. For more details please see {@link TableColumnResize}. scope.$isRendered = true; // Deferred object that will be resolved when this modal is render. var modalRenderDeferObj = $q.defer(); // Observe function will be called on next digest cycle after compilation, ensuring that the DOM is ready. // In order to use this way of finding whether DOM is ready, we need to observe a scope property used in modal's template. attrs.$observe('modalRender', function(value) { if (value === 'true') { modalRenderDeferObj.resolve(); } }); modalRenderDeferObj.promise.then(function() { var animationPromise = null; if (attrs.modalInClass) { animationPromise = $animateCss(element, { addClass: attrs.modalInClass }).start(); scope.$on($modalStack.NOW_CLOSING_EVENT, function(e, setIsAsync) { var done = setIsAsync(); $animateCss(element, { removeClass: attrs.modalInClass }).start().then(done); }); } $q.when(animationPromise).then(function() { // Notify {@link $modalStack} that modal is rendered. var modal = $modalStack.getTop(); if (modal) { $modalStack.modalRendered(modal.key); } /** * If something within the freshly-opened modal already has focus (perhaps via a * directive that causes focus). then no need to try and focus anything. */ if (!($document[0].activeElement && element[0].contains($document[0].activeElement))) { var inputWithAutofocus = element[0].querySelector('[autofocus]'); /** * Auto-focusing of a freshly-opened modal element causes any child elements * with the autofocus attribute to lose focus. This is an issue on touch * based devices which will show and then hide the onscreen keyboard. * Attempts to refocus the autofocus element via JavaScript will not reopen * the onscreen keyboard. Fixed by updated the focusing logic to only autofocus * the modal element if the modal does not contain an autofocus element. */ if (inputWithAutofocus) { inputWithAutofocus.focus(); } else { element[0].focus(); } } }); }); } }; }]) .directive('uibModalAnimationClass', function() { return { compile: function(tElement, tAttrs) { if (tAttrs.modalAnimation) { tElement.addClass(tAttrs.uibModalAnimationClass); } } }; }) .directive('uibModalTransclude', function() { return { link: function(scope, element, attrs, controller, transclude) { transclude(scope.$parent, function(clone) { element.empty(); element.append(clone); }); } }; }) .factory('$uibModalStack', ['$animate', '$animateCss', '$document', '$compile', '$rootScope', '$q', '$$multiMap', '$$stackedMap', function($animate, $animateCss, $document, $compile, $rootScope, $q, $$multiMap, $$stackedMap) { var OPENED_MODAL_CLASS = 'modal-open'; var backdropDomEl, backdropScope; var openedWindows = $$stackedMap.createNew(); var openedClasses = $$multiMap.createNew(); var $modalStack = { NOW_CLOSING_EVENT: 'modal.stack.now-closing' }; //Modal focus behavior var tabableSelector = 'a[href], area[href], input:not([disabled]), ' + 'button:not([disabled]),select:not([disabled]), textarea:not([disabled]), ' + 'iframe, object, embed, *[tabindex], *[contenteditable=true]'; function isVisible(element) { return !!(element.offsetWidth || element.offsetHeight || element.getClientRects().length); } function backdropIndex() { var topBackdropIndex = -1; var opened = openedWindows.keys(); for (var i = 0; i < opened.length; i++) { if (openedWindows.get(opened[i]).value.backdrop) { topBackdropIndex = i; } } return topBackdropIndex; } $rootScope.$watch(backdropIndex, function(newBackdropIndex) { if (backdropScope) { backdropScope.index = newBackdropIndex; } }); function removeModalWindow(modalInstance, elementToReceiveFocus) { var modalWindow = openedWindows.get(modalInstance).value; var appendToElement = modalWindow.appendTo; //clean up the stack openedWindows.remove(modalInstance); removeAfterAnimate(modalWindow.modalDomEl, modalWindow.modalScope, function() { var modalBodyClass = modalWindow.openedClass || OPENED_MODAL_CLASS; openedClasses.remove(modalBodyClass, modalInstance); appendToElement.toggleClass(modalBodyClass, openedClasses.hasKey(modalBodyClass)); toggleTopWindowClass(true); }, modalWindow.closedDeferred); checkRemoveBackdrop(); //move focus to specified element if available, or else to body if (elementToReceiveFocus && elementToReceiveFocus.focus) { elementToReceiveFocus.focus(); } else if (appendToElement.focus) { appendToElement.focus(); } } // Add or remove "windowTopClass" from the top window in the stack function toggleTopWindowClass(toggleSwitch) { var modalWindow; if (openedWindows.length() > 0) { modalWindow = openedWindows.top().value; modalWindow.modalDomEl.toggleClass(modalWindow.windowTopClass || '', toggleSwitch); } } function checkRemoveBackdrop() { //remove backdrop if no longer needed if (backdropDomEl && backdropIndex() === -1) { var backdropScopeRef = backdropScope; removeAfterAnimate(backdropDomEl, backdropScope, function() { backdropScopeRef = null; }); backdropDomEl = undefined; backdropScope = undefined; } } function removeAfterAnimate(domEl, scope, done, closedDeferred) { var asyncDeferred; var asyncPromise = null; var setIsAsync = function() { if (!asyncDeferred) { asyncDeferred = $q.defer(); asyncPromise = asyncDeferred.promise; } return function asyncDone() { asyncDeferred.resolve(); }; }; scope.$broadcast($modalStack.NOW_CLOSING_EVENT, setIsAsync); // Note that it's intentional that asyncPromise might be null. // That's when setIsAsync has not been called during the // NOW_CLOSING_EVENT broadcast. return $q.when(asyncPromise).then(afterAnimating); function afterAnimating() { if (afterAnimating.done) { return; } afterAnimating.done = true; $animate.leave(domEl).then(function() { domEl.remove(); if (closedDeferred) { closedDeferred.resolve(); } }); scope.$destroy(); if (done) { done(); } } } $document.on('keydown', keydownListener); $rootScope.$on('$destroy', function() { $document.off('keydown', keydownListener); }); function keydownListener(evt) { if (evt.isDefaultPrevented()) { return evt; } var modal = openedWindows.top(); if (modal) { switch (evt.which) { case 27: { if (modal.value.keyboard) { evt.preventDefault(); $rootScope.$apply(function() { $modalStack.dismiss(modal.key, 'escape key press'); }); } break; } case 9: { var list = $modalStack.loadFocusElementList(modal); var focusChanged = false; if (evt.shiftKey) { if ($modalStack.isFocusInFirstItem(evt, list) || $modalStack.isModalFocused(evt, modal)) { focusChanged = $modalStack.focusLastFocusableElement(list); } } else { if ($modalStack.isFocusInLastItem(evt, list)) { focusChanged = $modalStack.focusFirstFocusableElement(list); } } if (focusChanged) { evt.preventDefault(); evt.stopPropagation(); } break; } } } } $modalStack.open = function(modalInstance, modal) { var modalOpener = $document[0].activeElement, modalBodyClass = modal.openedClass || OPENED_MODAL_CLASS; toggleTopWindowClass(false); openedWindows.add(modalInstance, { deferred: modal.deferred, renderDeferred: modal.renderDeferred, closedDeferred: modal.closedDeferred, modalScope: modal.scope, backdrop: modal.backdrop, keyboard: modal.keyboard, openedClass: modal.openedClass, windowTopClass: modal.windowTopClass, animation: modal.animation, appendTo: modal.appendTo }); openedClasses.put(modalBodyClass, modalInstance); var appendToElement = modal.appendTo, currBackdropIndex = backdropIndex(); if (!appendToElement.length) { throw new Error('appendTo element not found. Make sure that the element passed is in DOM.'); } if (currBackdropIndex >= 0 && !backdropDomEl) { backdropScope = $rootScope.$new(true); backdropScope.modalOptions = modal; backdropScope.index = currBackdropIndex; backdropDomEl = angular.element('<div uib-modal-backdrop="modal-backdrop"></div>'); backdropDomEl.attr('backdrop-class', modal.backdropClass); if (modal.animation) { backdropDomEl.attr('modal-animation', 'true'); } $compile(backdropDomEl)(backdropScope); $animate.enter(backdropDomEl, appendToElement); } var angularDomEl = angular.element('<div uib-modal-window="modal-window"></div>'); angularDomEl.attr({ 'template-url': modal.windowTemplateUrl, 'window-class': modal.windowClass, 'window-top-class': modal.windowTopClass, 'size': modal.size, 'index': openedWindows.length() - 1, 'animate': 'animate' }).html(modal.content); if (modal.animation) { angularDomEl.attr('modal-animation', 'true'); } $animate.enter($compile(angularDomEl)(modal.scope), appendToElement) .then(function() { if (!modal.scope.$$uibDestructionScheduled) { $animate.addClass(appendToElement, modalBodyClass); } }); openedWindows.top().value.modalDomEl = angularDomEl; openedWindows.top().value.modalOpener = modalOpener; }; function broadcastClosing(modalWindow, resultOrReason, closing) { return !modalWindow.value.modalScope.$broadcast('modal.closing', resultOrReason, closing).defaultPrevented; } $modalStack.close = function(modalInstance, result) { var modalWindow = openedWindows.get(modalInstance); if (modalWindow && broadcastClosing(modalWindow, result, true)) { modalWindow.value.modalScope.$$uibDestructionScheduled = true; modalWindow.value.deferred.resolve(result); removeModalWindow(modalInstance, modalWindow.value.modalOpener); return true; } return !modalWindow; }; $modalStack.dismiss = function(modalInstance, reason) { var modalWindow = openedWindows.get(modalInstance); if (modalWindow && broadcastClosing(modalWindow, reason, false)) { modalWindow.value.modalScope.$$uibDestructionScheduled = true; modalWindow.value.deferred.reject(reason); removeModalWindow(modalInstance, modalWindow.value.modalOpener); return true; } return !modalWindow; }; $modalStack.dismissAll = function(reason) { var topModal = this.getTop(); while (topModal && this.dismiss(topModal.key, reason)) { topModal = this.getTop(); } }; $modalStack.getTop = function() { return openedWindows.top(); }; $modalStack.modalRendered = function(modalInstance) { var modalWindow = openedWindows.get(modalInstance); if (modalWindow) { modalWindow.value.renderDeferred.resolve(); } }; $modalStack.focusFirstFocusableElement = function(list) { if (list.length > 0) { list[0].focus(); return true; } return false; }; $modalStack.focusLastFocusableElement = function(list) { if (list.length > 0) { list[list.length - 1].focus(); return true; } return false; }; $modalStack.isModalFocused = function(evt, modalWindow) { if (evt && modalWindow) { var modalDomEl = modalWindow.value.modalDomEl; if (modalDomEl && modalDomEl.length) { return (evt.target || evt.srcElement) === modalDomEl[0]; } } return false; }; $modalStack.isFocusInFirstItem = function(evt, list) { if (list.length > 0) { return (evt.target || evt.srcElement) === list[0]; } return false; }; $modalStack.isFocusInLastItem = function(evt, list) { if (list.length > 0) { return (evt.target || evt.srcElement) === list[list.length - 1]; } return false; }; $modalStack.loadFocusElementList = function(modalWindow) { if (modalWindow) { var modalDomE1 = modalWindow.value.modalDomEl; if (modalDomE1 && modalDomE1.length) { var elements = modalDomE1[0].querySelectorAll(tabableSelector); return elements ? Array.prototype.filter.call(elements, function(element) { return isVisible(element); }) : elements; } } }; return $modalStack; }]) .provider('$uibModal', function() { var $modalProvider = { options: { animation: true, backdrop: true, //can also be false or 'static' keyboard: true }, $get: ['$rootScope', '$q', '$document', '$templateRequest', '$controller', '$uibResolve', '$uibModalStack', function ($rootScope, $q, $document, $templateRequest, $controller, $uibResolve, $modalStack) { var $modal = {}; function getTemplatePromise(options) { return options.template ? $q.when(options.template) : $templateRequest(angular.isFunction(options.templateUrl) ? options.templateUrl() : options.templateUrl); } var promiseChain = null; $modal.getPromiseChain = function() { return promiseChain; }; $modal.open = function(modalOptions) { var modalResultDeferred = $q.defer(); var modalOpenedDeferred = $q.defer(); var modalClosedDeferred = $q.defer(); var modalRenderDeferred = $q.defer(); //prepare an instance of a modal to be injected into controllers and returned to a caller var modalInstance = { result: modalResultDeferred.promise, opened: modalOpenedDeferred.promise, closed: modalClosedDeferred.promise, rendered: modalRenderDeferred.promise, close: function (result) { return $modalStack.close(modalInstance, result); }, dismiss: function (reason) { return $modalStack.dismiss(modalInstance, reason); } }; //merge and clean up options modalOptions = angular.extend({}, $modalProvider.options, modalOptions); modalOptions.resolve = modalOptions.resolve || {}; modalOptions.appendTo = modalOptions.appendTo || $document.find('body').eq(0); //verify options if (!modalOptions.template && !modalOptions.templateUrl) { throw new Error('One of template or templateUrl options is required.'); } var templateAndResolvePromise = $q.all([getTemplatePromise(modalOptions), $uibResolve.resolve(modalOptions.resolve, {}, null, null)]); function resolveWithTemplate() { return templateAndResolvePromise; } // Wait for the resolution of the existing promise chain. // Then switch to our own combined promise dependency (regardless of how the previous modal fared). // Then add to $modalStack and resolve opened. // Finally clean up the chain variable if no subsequent modal has overwritten it. var samePromise; samePromise = promiseChain = $q.all([promiseChain]) .then(resolveWithTemplate, resolveWithTemplate) .then(function resolveSuccess(tplAndVars) { var providedScope = modalOptions.scope || $rootScope; var modalScope = providedScope.$new(); modalScope.$close = modalInstance.close; modalScope.$dismiss = modalInstance.dismiss; modalScope.$on('$destroy', function() { if (!modalScope.$$uibDestructionScheduled) { modalScope.$dismiss('$uibUnscheduledDestruction'); } }); var ctrlInstance, ctrlInstantiate, ctrlLocals = {}; //controllers if (modalOptions.controller) { ctrlLocals.$scope = modalScope; ctrlLocals.$uibModalInstance = modalInstance; angular.forEach(tplAndVars[1], function(value, key) { ctrlLocals[key] = value; }); // the third param will make the controller instantiate later,private api // @see https://github.com/angular/angular.js/blob/master/src/ng/controller.js#L126 ctrlInstantiate = $controller(modalOptions.controller, ctrlLocals, true); if (modalOptions.controllerAs) { ctrlInstance = ctrlInstantiate.instance; if (modalOptions.bindToController) { ctrlInstance.$close = modalScope.$close; ctrlInstance.$dismiss = modalScope.$dismiss; angular.extend(ctrlInstance, providedScope); } ctrlInstance = ctrlInstantiate(); modalScope[modalOptions.controllerAs] = ctrlInstance; } else { ctrlInstance = ctrlInstantiate(); } if (angular.isFunction(ctrlInstance.$onInit)) { ctrlInstance.$onInit(); } } $modalStack.open(modalInstance, { scope: modalScope, deferred: modalResultDeferred, renderDeferred: modalRenderDeferred, closedDeferred: modalClosedDeferred, content: tplAndVars[0], animation: modalOptions.animation, backdrop: modalOptions.backdrop, keyboard: modalOptions.keyboard, backdropClass: modalOptions.backdropClass, windowTopClass: modalOptions.windowTopClass, windowClass: modalOptions.windowClass, windowTemplateUrl: modalOptions.windowTemplateUrl, size: modalOptions.size, openedClass: modalOptions.openedClass, appendTo: modalOptions.appendTo }); modalOpenedDeferred.resolve(true); }, function resolveError(reason) { modalOpenedDeferred.reject(reason); modalResultDeferred.reject(reason); })['finally'](function() { if (promiseChain === samePromise) { promiseChain = null; } }); return modalInstance; }; return $modal; } ] }; return $modalProvider; }); angular.module('ui.bootstrap.paging', []) /** * Helper internal service for generating common controller code between the * pager and pagination components */ .factory('uibPaging', ['$parse', function($parse) { return { create: function(ctrl, $scope, $attrs) { ctrl.setNumPages = $attrs.numPages ? $parse($attrs.numPages).assign : angular.noop; ctrl.ngModelCtrl = { $setViewValue: angular.noop }; // nullModelCtrl ctrl._watchers = []; ctrl.init = function(ngModelCtrl, config) { ctrl.ngModelCtrl = ngModelCtrl; ctrl.config = config; ngModelCtrl.$render = function() { ctrl.render(); }; if ($attrs.itemsPerPage) { ctrl._watchers.push($scope.$parent.$watch($attrs.itemsPerPage, function(value) { ctrl.itemsPerPage = parseInt(value, 10); $scope.totalPages = ctrl.calculateTotalPages(); ctrl.updatePage(); })); } else { ctrl.itemsPerPage = config.itemsPerPage; } $scope.$watch('totalItems', function(newTotal, oldTotal) { if (angular.isDefined(newTotal) || newTotal !== oldTotal) { $scope.totalPages = ctrl.calculateTotalPages(); ctrl.updatePage(); } }); }; ctrl.calculateTotalPages = function() { var totalPages = ctrl.itemsPerPage < 1 ? 1 : Math.ceil($scope.totalItems / ctrl.itemsPerPage); return Math.max(totalPages || 0, 1); }; ctrl.render = function() { $scope.page = parseInt(ctrl.ngModelCtrl.$viewValue, 10) || 1; }; $scope.selectPage = function(page, evt) { if (evt) { evt.preventDefault(); } var clickAllowed = !$scope.ngDisabled || !evt; if (clickAllowed && $scope.page !== page && page > 0 && page <= $scope.totalPages) { if (evt && evt.target) { evt.target.blur(); } ctrl.ngModelCtrl.$setViewValue(page); ctrl.ngModelCtrl.$render(); } }; $scope.getText = function(key) { return $scope[key + 'Text'] || ctrl.config[key + 'Text']; }; $scope.noPrevious = function() { return $scope.page === 1; }; $scope.noNext = function() { return $scope.page === $scope.totalPages; }; ctrl.updatePage = function() { ctrl.setNumPages($scope.$parent, $scope.totalPages); // Readonly variable if ($scope.page > $scope.totalPages) { $scope.selectPage($scope.totalPages); } else { ctrl.ngModelCtrl.$render(); } }; $scope.$on('$destroy', function() { while (ctrl._watchers.length) { ctrl._watchers.shift()(); } }); } }; }]); angular.module('ui.bootstrap.pager', ['ui.bootstrap.paging']) .controller('UibPagerController', ['$scope', '$attrs', 'uibPaging', 'uibPagerConfig', function($scope, $attrs, uibPaging, uibPagerConfig) { $scope.align = angular.isDefined($attrs.align) ? $scope.$parent.$eval($attrs.align) : uibPagerConfig.align; uibPaging.create(this, $scope, $attrs); }]) .constant('uibPagerConfig', { itemsPerPage: 10, previousText: '« Previous', nextText: 'Next »', align: true }) .directive('uibPager', ['uibPagerConfig', function(uibPagerConfig) { return { scope: { totalItems: '=', previousText: '@', nextText: '@', ngDisabled: '=' }, require: ['uibPager', '?ngModel'], controller: 'UibPagerController', controllerAs: 'pager', templateUrl: function(element, attrs) { return attrs.templateUrl || 'uib/template/pager/pager.html'; }, replace: true, link: function(scope, element, attrs, ctrls) { var paginationCtrl = ctrls[0], ngModelCtrl = ctrls[1]; if (!ngModelCtrl) { return; // do nothing if no ng-model } paginationCtrl.init(ngModelCtrl, uibPagerConfig); } }; }]); angular.module('ui.bootstrap.pagination', ['ui.bootstrap.paging']) .controller('UibPaginationController', ['$scope', '$attrs', '$parse', 'uibPaging', 'uibPaginationConfig', function($scope, $attrs, $parse, uibPaging, uibPaginationConfig) { var ctrl = this; // Setup configuration parameters var maxSize = angular.isDefined($attrs.maxSize) ? $scope.$parent.$eval($attrs.maxSize) : uibPaginationConfig.maxSize, rotate = angular.isDefined($attrs.rotate) ? $scope.$parent.$eval($attrs.rotate) : uibPaginationConfig.rotate, forceEllipses = angular.isDefined($attrs.forceEllipses) ? $scope.$parent.$eval($attrs.forceEllipses) : uibPaginationConfig.forceEllipses, boundaryLinkNumbers = angular.isDefined($attrs.boundaryLinkNumbers) ? $scope.$parent.$eval($attrs.boundaryLinkNumbers) : uibPaginationConfig.boundaryLinkNumbers, pageLabel = angular.isDefined($attrs.pageLabel) ? function(idx) { return $scope.$parent.$eval($attrs.pageLabel, {$page: idx}); } : angular.identity; $scope.boundaryLinks = angular.isDefined($attrs.boundaryLinks) ? $scope.$parent.$eval($attrs.boundaryLinks) : uibPaginationConfig.boundaryLinks; $scope.directionLinks = angular.isDefined($attrs.directionLinks) ? $scope.$parent.$eval($attrs.directionLinks) : uibPaginationConfig.directionLinks; uibPaging.create(this, $scope, $attrs); if ($attrs.maxSize) { ctrl._watchers.push($scope.$parent.$watch($parse($attrs.maxSize), function(value) { maxSize = parseInt(value, 10); ctrl.render(); })); } // Create page object used in template function makePage(number, text, isActive) { return { number: number, text: text, active: isActive }; } function getPages(currentPage, totalPages) { var pages = []; // Default page limits var startPage = 1, endPage = totalPages; var isMaxSized = angular.isDefined(maxSize) && maxSize < totalPages; // recompute if maxSize if (isMaxSized) { if (rotate) { // Current page is displayed in the middle of the visible ones startPage = Math.max(currentPage - Math.floor(maxSize / 2), 1); endPage = startPage + maxSize - 1; // Adjust if limit is exceeded if (endPage > totalPages) { endPage = totalPages; startPage = endPage - maxSize + 1; } } else { // Visible pages are paginated with maxSize startPage = (Math.ceil(currentPage / maxSize) - 1) * maxSize + 1; // Adjust last page if limit is exceeded endPage = Math.min(startPage + maxSize - 1, totalPages); } } // Add page number links for (var number = startPage; number <= endPage; number++) { var page = makePage(number, pageLabel(number), number === currentPage); pages.push(page); } // Add links to move between page sets if (isMaxSized && maxSize > 0 && (!rotate || forceEllipses || boundaryLinkNumbers)) { if (startPage > 1) { if (!boundaryLinkNumbers || startPage > 3) { //need ellipsis for all options unless range is too close to beginning var previousPageSet = makePage(startPage - 1, '...', false); pages.unshift(previousPageSet); } if (boundaryLinkNumbers) { if (startPage === 3) { //need to replace ellipsis when the buttons would be sequential var secondPageLink = makePage(2, '2', false); pages.unshift(secondPageLink); } //add the first page var firstPageLink = makePage(1, '1', false); pages.unshift(firstPageLink); } } if (endPage < totalPages) { if (!boundaryLinkNumbers || endPage < totalPages - 2) { //need ellipsis for all options unless range is too close to end var nextPageSet = makePage(endPage + 1, '...', false); pages.push(nextPageSet); } if (boundaryLinkNumbers) { if (endPage === totalPages - 2) { //need to replace ellipsis when the buttons would be sequential var secondToLastPageLink = makePage(totalPages - 1, totalPages - 1, false); pages.push(secondToLastPageLink); } //add the last page var lastPageLink = makePage(totalPages, totalPages, false); pages.push(lastPageLink); } } } return pages; } var originalRender = this.render; this.render = function() { originalRender(); if ($scope.page > 0 && $scope.page <= $scope.totalPages) { $scope.pages = getPages($scope.page, $scope.totalPages); } }; }]) .constant('uibPaginationConfig', { itemsPerPage: 10, boundaryLinks: false, boundaryLinkNumbers: false, directionLinks: true, firstText: 'First', previousText: 'Previous', nextText: 'Next', lastText: 'Last', rotate: true, forceEllipses: false }) .directive('uibPagination', ['$parse', 'uibPaginationConfig', function($parse, uibPaginationConfig) { return { scope: { totalItems: '=', firstText: '@', previousText: '@', nextText: '@', lastText: '@', ngDisabled:'=' }, require: ['uibPagination', '?ngModel'], controller: 'UibPaginationController', controllerAs: 'pagination', templateUrl: function(element, attrs) { return attrs.templateUrl || 'uib/template/pagination/pagination.html'; }, replace: true, link: function(scope, element, attrs, ctrls) { var paginationCtrl = ctrls[0], ngModelCtrl = ctrls[1]; if (!ngModelCtrl) { return; // do nothing if no ng-model } paginationCtrl.init(ngModelCtrl, uibPaginationConfig); } }; }]); /** * The following features are still outstanding: animation as a * function, placement as a function, inside, support for more triggers than * just mouse enter/leave, html tooltips, and selector delegation. */ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.stackedMap']) /** * The $tooltip service creates tooltip- and popover-like directives as well as * houses global options for them. */ .provider('$uibTooltip', function() { // The default options tooltip and popover. var defaultOptions = { placement: 'top', placementClassPrefix: '', animation: true, popupDelay: 0, popupCloseDelay: 0, useContentExp: false }; // Default hide triggers for each show trigger var triggerMap = { 'mouseenter': 'mouseleave', 'click': 'click', 'outsideClick': 'outsideClick', 'focus': 'blur', 'none': '' }; // The options specified to the provider globally. var globalOptions = {}; /** * `options({})` allows global configuration of all tooltips in the * application. * * var app = angular.module( 'App', ['ui.bootstrap.tooltip'], function( $tooltipProvider ) { * // place tooltips left instead of top by default * $tooltipProvider.options( { placement: 'left' } ); * }); */ this.options = function(value) { angular.extend(globalOptions, value); }; /** * This allows you to extend the set of trigger mappings available. E.g.: * * $tooltipProvider.setTriggers( 'openTrigger': 'closeTrigger' ); */ this.setTriggers = function setTriggers(triggers) { angular.extend(triggerMap, triggers); }; /** * This is a helper function for translating camel-case to snake_case. */ function snake_case(name) { var regexp = /[A-Z]/g; var separator = '-'; return name.replace(regexp, function(letter, pos) { return (pos ? separator : '') + letter.toLowerCase(); }); } /** * Returns the actual instance of the $tooltip service. * TODO support multiple triggers */ this.$get = ['$window', '$compile', '$timeout', '$document', '$uibPosition', '$interpolate', '$rootScope', '$parse', '$$stackedMap', function($window, $compile, $timeout, $document, $position, $interpolate, $rootScope, $parse, $$stackedMap) { var openedTooltips = $$stackedMap.createNew(); $document.on('keypress', keypressListener); $rootScope.$on('$destroy', function() { $document.off('keypress', keypressListener); }); function keypressListener(e) { if (e.which === 27) { var last = openedTooltips.top(); if (last) { last.value.close(); openedTooltips.removeTop(); last = null; } } } return function $tooltip(ttType, prefix, defaultTriggerShow, options) { options = angular.extend({}, defaultOptions, globalOptions, options); /** * Returns an object of show and hide triggers. * * If a trigger is supplied, * it is used to show the tooltip; otherwise, it will use the `trigger` * option passed to the `$tooltipProvider.options` method; else it will * default to the trigger supplied to this directive factory. * * The hide trigger is based on the show trigger. If the `trigger` option * was passed to the `$tooltipProvider.options` method, it will use the * mapped trigger from `triggerMap` or the passed trigger if the map is * undefined; otherwise, it uses the `triggerMap` value of the show * trigger; else it will just use the show trigger. */ function getTriggers(trigger) { var show = (trigger || options.trigger || defaultTriggerShow).split(' '); var hide = show.map(function(trigger) { return triggerMap[trigger] || trigger; }); return { show: show, hide: hide }; } var directiveName = snake_case(ttType); var startSym = $interpolate.startSymbol(); var endSym = $interpolate.endSymbol(); var template = '<div '+ directiveName + '-popup '+ 'title="' + startSym + 'title' + endSym + '" '+ (options.useContentExp ? 'content-exp="contentExp()" ' : 'content="' + startSym + 'content' + endSym + '" ') + 'placement="' + startSym + 'placement' + endSym + '" '+ 'popup-class="' + startSym + 'popupClass' + endSym + '" '+ 'animation="animation" ' + 'is-open="isOpen"' + 'origin-scope="origScope" ' + 'class="uib-position-measure"' + '>' + '</div>'; return { compile: function(tElem, tAttrs) { var tooltipLinker = $compile(template); return function link(scope, element, attrs, tooltipCtrl) { var tooltip; var tooltipLinkedScope; var transitionTimeout; var showTimeout; var hideTimeout; var positionTimeout; var appendToBody = angular.isDefined(options.appendToBody) ? options.appendToBody : false; var triggers = getTriggers(undefined); var hasEnableExp = angular.isDefined(attrs[prefix + 'Enable']); var ttScope = scope.$new(true); var repositionScheduled = false; var isOpenParse = angular.isDefined(attrs[prefix + 'IsOpen']) ? $parse(attrs[prefix + 'IsOpen']) : false; var contentParse = options.useContentExp ? $parse(attrs[ttType]) : false; var observers = []; var lastPlacement; var positionTooltip = function() { // check if tooltip exists and is not empty if (!tooltip || !tooltip.html()) { return; } if (!positionTimeout) { positionTimeout = $timeout(function() { var ttPosition = $position.positionElements(element, tooltip, ttScope.placement, appendToBody); tooltip.css({ top: ttPosition.top + 'px', left: ttPosition.left + 'px' }); if (!tooltip.hasClass(ttPosition.placement.split('-')[0])) { tooltip.removeClass(lastPlacement.split('-')[0]); tooltip.addClass(ttPosition.placement.split('-')[0]); } if (!tooltip.hasClass(options.placementClassPrefix + ttPosition.placement)) { tooltip.removeClass(options.placementClassPrefix + lastPlacement); tooltip.addClass(options.placementClassPrefix + ttPosition.placement); } // first time through tt element will have the // uib-position-measure class or if the placement // has changed we need to position the arrow. if (tooltip.hasClass('uib-position-measure')) { $position.positionArrow(tooltip, ttPosition.placement); tooltip.removeClass('uib-position-measure'); } else if (lastPlacement !== ttPosition.placement) { $position.positionArrow(tooltip, ttPosition.placement); } lastPlacement = ttPosition.placement; positionTimeout = null; }, 0, false); } }; // Set up the correct scope to allow transclusion later ttScope.origScope = scope; // By default, the tooltip is not open. // TODO add ability to start tooltip opened ttScope.isOpen = false; openedTooltips.add(ttScope, { close: hide }); function toggleTooltipBind() { if (!ttScope.isOpen) { showTooltipBind(); } else { hideTooltipBind(); } } // Show the tooltip with delay if specified, otherwise show it immediately function showTooltipBind() { if (hasEnableExp && !scope.$eval(attrs[prefix + 'Enable'])) { return; } cancelHide(); prepareTooltip(); if (ttScope.popupDelay) { // Do nothing if the tooltip was already scheduled to pop-up. // This happens if show is triggered multiple times before any hide is triggered. if (!showTimeout) { showTimeout = $timeout(show, ttScope.popupDelay, false); } } else { show(); } } function hideTooltipBind() { cancelShow(); if (ttScope.popupCloseDelay) { if (!hideTimeout) { hideTimeout = $timeout(hide, ttScope.popupCloseDelay, false); } } else { hide(); } } // Show the tooltip popup element. function show() { cancelShow(); cancelHide(); // Don't show empty tooltips. if (!ttScope.content) { return angular.noop; } createTooltip(); // And show the tooltip. ttScope.$evalAsync(function() { ttScope.isOpen = true; assignIsOpen(true); positionTooltip(); }); } function cancelShow() { if (showTimeout) { $timeout.cancel(showTimeout); showTimeout = null; } if (positionTimeout) { $timeout.cancel(positionTimeout); positionTimeout = null; } } // Hide the tooltip popup element. function hide() { if (!ttScope) { return; } // First things first: we don't show it anymore. ttScope.$evalAsync(function() { if (ttScope) { ttScope.isOpen = false; assignIsOpen(false); // And now we remove it from the DOM. However, if we have animation, we // need to wait for it to expire beforehand. // FIXME: this is a placeholder for a port of the transitions library. // The fade transition in TWBS is 150ms. if (ttScope.animation) { if (!transitionTimeout) { transitionTimeout = $timeout(removeTooltip, 150, false); } } else { removeTooltip(); } } }); } function cancelHide() { if (hideTimeout) { $timeout.cancel(hideTimeout); hideTimeout = null; } if (transitionTimeout) { $timeout.cancel(transitionTimeout); transitionTimeout = null; } } function createTooltip() { // There can only be one tooltip element per directive shown at once. if (tooltip) { return; } tooltipLinkedScope = ttScope.$new(); tooltip = tooltipLinker(tooltipLinkedScope, function(tooltip) { if (appendToBody) { $document.find('body').append(tooltip); } else { element.after(tooltip); } }); prepObservers(); } function removeTooltip() { cancelShow(); cancelHide(); unregisterObservers(); if (tooltip) { tooltip.remove(); tooltip = null; } if (tooltipLinkedScope) { tooltipLinkedScope.$destroy(); tooltipLinkedScope = null; } } /** * Set the initial scope values. Once * the tooltip is created, the observers * will be added to keep things in sync. */ function prepareTooltip() { ttScope.title = attrs[prefix + 'Title']; if (contentParse) { ttScope.content = contentParse(scope); } else { ttScope.content = attrs[ttType]; } ttScope.popupClass = attrs[prefix + 'Class']; ttScope.placement = angular.isDefined(attrs[prefix + 'Placement']) ? attrs[prefix + 'Placement'] : options.placement; var placement = $position.parsePlacement(ttScope.placement); lastPlacement = placement[1] ? placement[0] + '-' + placement[1] : placement[0]; var delay = parseInt(attrs[prefix + 'PopupDelay'], 10); var closeDelay = parseInt(attrs[prefix + 'PopupCloseDelay'], 10); ttScope.popupDelay = !isNaN(delay) ? delay : options.popupDelay; ttScope.popupCloseDelay = !isNaN(closeDelay) ? closeDelay : options.popupCloseDelay; } function assignIsOpen(isOpen) { if (isOpenParse && angular.isFunction(isOpenParse.assign)) { isOpenParse.assign(scope, isOpen); } } ttScope.contentExp = function() { return ttScope.content; }; /** * Observe the relevant attributes. */ attrs.$observe('disabled', function(val) { if (val) { cancelShow(); } if (val && ttScope.isOpen) { hide(); } }); if (isOpenParse) { scope.$watch(isOpenParse, function(val) { if (ttScope && !val === ttScope.isOpen) { toggleTooltipBind(); } }); } function prepObservers() { observers.length = 0; if (contentParse) { observers.push( scope.$watch(contentParse, function(val) { ttScope.content = val; if (!val && ttScope.isOpen) { hide(); } }) ); observers.push( tooltipLinkedScope.$watch(function() { if (!repositionScheduled) { repositionScheduled = true; tooltipLinkedScope.$$postDigest(function() { repositionScheduled = false; if (ttScope && ttScope.isOpen) { positionTooltip(); } }); } }) ); } else { observers.push( attrs.$observe(ttType, function(val) { ttScope.content = val; if (!val && ttScope.isOpen) { hide(); } else { positionTooltip(); } }) ); } observers.push( attrs.$observe(prefix + 'Title', function(val) { ttScope.title = val; if (ttScope.isOpen) { positionTooltip(); } }) ); observers.push( attrs.$observe(prefix + 'Placement', function(val) { ttScope.placement = val ? val : options.placement; var placement = $position.parsePlacement(ttScope.placement); lastPlacement = placement[1] ? placement[0] + '-' + placement[1] : placement[0]; if (ttScope.isOpen) { positionTooltip(); } }) ); } function unregisterObservers() { if (observers.length) { angular.forEach(observers, function(observer) { observer(); }); observers.length = 0; } } // hide tooltips/popovers for outsideClick trigger function bodyHideTooltipBind(e) { if (!ttScope || !ttScope.isOpen || !tooltip) { return; } // make sure the tooltip/popover link or tool tooltip/popover itself were not clicked if (!element[0].contains(e.target) && !tooltip[0].contains(e.target)) { hideTooltipBind(); } } var unregisterTriggers = function() { triggers.show.forEach(function(trigger) { if (trigger === 'outsideClick') { element.off('click', toggleTooltipBind); } else { element.off(trigger, showTooltipBind); element.off(trigger, toggleTooltipBind); } }); triggers.hide.forEach(function(trigger) { if (trigger === 'outsideClick') { $document.off('click', bodyHideTooltipBind); } else { element.off(trigger, hideTooltipBind); } }); }; function prepTriggers() { var val = attrs[prefix + 'Trigger']; unregisterTriggers(); triggers = getTriggers(val); if (triggers.show !== 'none') { triggers.show.forEach(function(trigger, idx) { if (trigger === 'outsideClick') { element.on('click', toggleTooltipBind); $document.on('click', bodyHideTooltipBind); } else if (trigger === triggers.hide[idx]) { element.on(trigger, toggleTooltipBind); } else if (trigger) { element.on(trigger, showTooltipBind); element.on(triggers.hide[idx], hideTooltipBind); } element.on('keypress', function(e) { if (e.which === 27) { hideTooltipBind(); } }); }); } } prepTriggers(); var animation = scope.$eval(attrs[prefix + 'Animation']); ttScope.animation = angular.isDefined(animation) ? !!animation : options.animation; var appendToBodyVal; var appendKey = prefix + 'AppendToBody'; if (appendKey in attrs && attrs[appendKey] === undefined) { appendToBodyVal = true; } else { appendToBodyVal = scope.$eval(attrs[appendKey]); } appendToBody = angular.isDefined(appendToBodyVal) ? appendToBodyVal : appendToBody; // Make sure tooltip is destroyed and removed. scope.$on('$destroy', function onDestroyTooltip() { unregisterTriggers(); removeTooltip(); openedTooltips.remove(ttScope); ttScope = null; }); }; } }; }; }]; }) // This is mostly ngInclude code but with a custom scope .directive('uibTooltipTemplateTransclude', [ '$animate', '$sce', '$compile', '$templateRequest', function ($animate, $sce, $compile, $templateRequest) { return { link: function(scope, elem, attrs) { var origScope = scope.$eval(attrs.tooltipTemplateTranscludeScope); var changeCounter = 0, currentScope, previousElement, currentElement; var cleanupLastIncludeContent = function() { if (previousElement) { previousElement.remove(); previousElement = null; } if (currentScope) { currentScope.$destroy(); currentScope = null; } if (currentElement) { $animate.leave(currentElement).then(function() { previousElement = null; }); previousElement = currentElement; currentElement = null; } }; scope.$watch($sce.parseAsResourceUrl(attrs.uibTooltipTemplateTransclude), function(src) { var thisChangeId = ++changeCounter; if (src) { //set the 2nd param to true to ignore the template request error so that the inner //contents and scope can be cleaned up. $templateRequest(src, true).then(function(response) { if (thisChangeId !== changeCounter) { return; } var newScope = origScope.$new(); var template = response; var clone = $compile(template)(newScope, function(clone) { cleanupLastIncludeContent(); $animate.enter(clone, elem); }); currentScope = newScope; currentElement = clone; currentScope.$emit('$includeContentLoaded', src); }, function() { if (thisChangeId === changeCounter) { cleanupLastIncludeContent(); scope.$emit('$includeContentError', src); } }); scope.$emit('$includeContentRequested', src); } else { cleanupLastIncludeContent(); } }); scope.$on('$destroy', cleanupLastIncludeContent); } }; }]) /** * Note that it's intentional that these classes are *not* applied through $animate. * They must not be animated as they're expected to be present on the tooltip on * initialization. */ .directive('uibTooltipClasses', ['$uibPosition', function($uibPosition) { return { restrict: 'A', link: function(scope, element, attrs) { // need to set the primary position so the // arrow has space during position measure. // tooltip.positionTooltip() if (scope.placement) { // // There are no top-left etc... classes // // in TWBS, so we need the primary position. var position = $uibPosition.parsePlacement(scope.placement); element.addClass(position[0]); } if (scope.popupClass) { element.addClass(scope.popupClass); } if (scope.animation()) { element.addClass(attrs.tooltipAnimationClass); } } }; }]) .directive('uibTooltipPopup', function() { return { replace: true, scope: { content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, templateUrl: 'uib/template/tooltip/tooltip-popup.html' }; }) .directive('uibTooltip', [ '$uibTooltip', function($uibTooltip) { return $uibTooltip('uibTooltip', 'tooltip', 'mouseenter'); }]) .directive('uibTooltipTemplatePopup', function() { return { replace: true, scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&', originScope: '&' }, templateUrl: 'uib/template/tooltip/tooltip-template-popup.html' }; }) .directive('uibTooltipTemplate', ['$uibTooltip', function($uibTooltip) { return $uibTooltip('uibTooltipTemplate', 'tooltip', 'mouseenter', { useContentExp: true }); }]) .directive('uibTooltipHtmlPopup', function() { return { replace: true, scope: { contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, templateUrl: 'uib/template/tooltip/tooltip-html-popup.html' }; }) .directive('uibTooltipHtml', ['$uibTooltip', function($uibTooltip) { return $uibTooltip('uibTooltipHtml', 'tooltip', 'mouseenter', { useContentExp: true }); }]); /** * The following features are still outstanding: popup delay, animation as a * function, placement as a function, inside, support for more triggers than * just mouse enter/leave, and selector delegatation. */ angular.module('ui.bootstrap.popover', ['ui.bootstrap.tooltip']) .directive('uibPopoverTemplatePopup', function() { return { replace: true, scope: { title: '@', contentExp: '&', placement: '@', popupClass: '@', animation: '&', isOpen: '&', originScope: '&' }, templateUrl: 'uib/template/popover/popover-template.html' }; }) .directive('uibPopoverTemplate', ['$uibTooltip', function($uibTooltip) { return $uibTooltip('uibPopoverTemplate', 'popover', 'click', { useContentExp: true }); }]) .directive('uibPopoverHtmlPopup', function() { return { replace: true, scope: { contentExp: '&', title: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, templateUrl: 'uib/template/popover/popover-html.html' }; }) .directive('uibPopoverHtml', ['$uibTooltip', function($uibTooltip) { return $uibTooltip('uibPopoverHtml', 'popover', 'click', { useContentExp: true }); }]) .directive('uibPopoverPopup', function() { return { replace: true, scope: { title: '@', content: '@', placement: '@', popupClass: '@', animation: '&', isOpen: '&' }, templateUrl: 'uib/template/popover/popover.html' }; }) .directive('uibPopover', ['$uibTooltip', function($uibTooltip) { return $uibTooltip('uibPopover', 'popover', 'click'); }]); angular.module('ui.bootstrap.progressbar', []) .constant('uibProgressConfig', { animate: true, max: 100 }) .controller('UibProgressController', ['$scope', '$attrs', 'uibProgressConfig', function($scope, $attrs, progressConfig) { var self = this, animate = angular.isDefined($attrs.animate) ? $scope.$parent.$eval($attrs.animate) : progressConfig.animate; this.bars = []; $scope.max = getMaxOrDefault(); this.addBar = function(bar, element, attrs) { if (!animate) { element.css({'transition': 'none'}); } this.bars.push(bar); bar.max = getMaxOrDefault(); bar.title = attrs && angular.isDefined(attrs.title) ? attrs.title : 'progressbar'; bar.$watch('value', function(value) { bar.recalculatePercentage(); }); bar.recalculatePercentage = function() { var totalPercentage = self.bars.reduce(function(total, bar) { bar.percent = +(100 * bar.value / bar.max).toFixed(2); return total + bar.percent; }, 0); if (totalPercentage > 100) { bar.percent -= totalPercentage - 100; } }; bar.$on('$destroy', function() { element = null; self.removeBar(bar); }); }; this.removeBar = function(bar) { this.bars.splice(this.bars.indexOf(bar), 1); this.bars.forEach(function (bar) { bar.recalculatePercentage(); }); }; //$attrs.$observe('maxParam', function(maxParam) { $scope.$watch('maxParam', function(maxParam) { self.bars.forEach(function(bar) { bar.max = getMaxOrDefault(); bar.recalculatePercentage(); }); }); function getMaxOrDefault () { return angular.isDefined($scope.maxParam) ? $scope.maxParam : progressConfig.max; } }]) .directive('uibProgress', function() { return { replace: true, transclude: true, controller: 'UibProgressController', require: 'uibProgress', scope: { maxParam: '=?max' }, templateUrl: 'uib/template/progressbar/progress.html' }; }) .directive('uibBar', function() { return { replace: true, transclude: true, require: '^uibProgress', scope: { value: '=', type: '@' }, templateUrl: 'uib/template/progressbar/bar.html', link: function(scope, element, attrs, progressCtrl) { progressCtrl.addBar(scope, element, attrs); } }; }) .directive('uibProgressbar', function() { return { replace: true, transclude: true, controller: 'UibProgressController', scope: { value: '=', maxParam: '=?max', type: '@' }, templateUrl: 'uib/template/progressbar/progressbar.html', link: function(scope, element, attrs, progressCtrl) { progressCtrl.addBar(scope, angular.element(element.children()[0]), {title: attrs.title}); } }; }); angular.module('ui.bootstrap.rating', []) .constant('uibRatingConfig', { max: 5, stateOn: null, stateOff: null, enableReset: true, titles : ['one', 'two', 'three', 'four', 'five'] }) .controller('UibRatingController', ['$scope', '$attrs', 'uibRatingConfig', function($scope, $attrs, ratingConfig) { var ngModelCtrl = { $setViewValue: angular.noop }, self = this; this.init = function(ngModelCtrl_) { ngModelCtrl = ngModelCtrl_; ngModelCtrl.$render = this.render; ngModelCtrl.$formatters.push(function(value) { if (angular.isNumber(value) && value << 0 !== value) { value = Math.round(value); } return value; }); this.stateOn = angular.isDefined($attrs.stateOn) ? $scope.$parent.$eval($attrs.stateOn) : ratingConfig.stateOn; this.stateOff = angular.isDefined($attrs.stateOff) ? $scope.$parent.$eval($attrs.stateOff) : ratingConfig.stateOff; this.enableReset = angular.isDefined($attrs.enableReset) ? $scope.$parent.$eval($attrs.enableReset) : ratingConfig.enableReset; var tmpTitles = angular.isDefined($attrs.titles) ? $scope.$parent.$eval($attrs.titles) : ratingConfig.titles; this.titles = angular.isArray(tmpTitles) && tmpTitles.length > 0 ? tmpTitles : ratingConfig.titles; var ratingStates = angular.isDefined($attrs.ratingStates) ? $scope.$parent.$eval($attrs.ratingStates) : new Array(angular.isDefined($attrs.max) ? $scope.$parent.$eval($attrs.max) : ratingConfig.max); $scope.range = this.buildTemplateObjects(ratingStates); }; this.buildTemplateObjects = function(states) { for (var i = 0, n = states.length; i < n; i++) { states[i] = angular.extend({ index: i }, { stateOn: this.stateOn, stateOff: this.stateOff, title: this.getTitle(i) }, states[i]); } return states; }; this.getTitle = function(index) { if (index >= this.titles.length) { return index + 1; } return this.titles[index]; }; $scope.rate = function(value) { if (!$scope.readonly && value >= 0 && value <= $scope.range.length) { var newViewValue = self.enableReset && ngModelCtrl.$viewValue === value ? 0 : value; ngModelCtrl.$setViewValue(newViewValue); ngModelCtrl.$render(); } }; $scope.enter = function(value) { if (!$scope.readonly) { $scope.value = value; } $scope.onHover({value: value}); }; $scope.reset = function() { $scope.value = ngModelCtrl.$viewValue; $scope.onLeave(); }; $scope.onKeydown = function(evt) { if (/(37|38|39|40)/.test(evt.which)) { evt.preventDefault(); evt.stopPropagation(); $scope.rate($scope.value + (evt.which === 38 || evt.which === 39 ? 1 : -1)); } }; this.render = function() { $scope.value = ngModelCtrl.$viewValue; $scope.title = self.getTitle($scope.value - 1); }; }]) .directive('uibRating', function() { return { require: ['uibRating', 'ngModel'], scope: { readonly: '=?readOnly', onHover: '&', onLeave: '&' }, controller: 'UibRatingController', templateUrl: 'uib/template/rating/rating.html', replace: true, link: function(scope, element, attrs, ctrls) { var ratingCtrl = ctrls[0], ngModelCtrl = ctrls[1]; ratingCtrl.init(ngModelCtrl); } }; }); angular.module('ui.bootstrap.tabs', []) .controller('UibTabsetController', ['$scope', function ($scope) { var ctrl = this, oldIndex; ctrl.tabs = []; ctrl.select = function(index, evt) { if (!destroyed) { var previousIndex = findTabIndex(oldIndex); var previousSelected = ctrl.tabs[previousIndex]; if (previousSelected) { previousSelected.tab.onDeselect({ $event: evt }); previousSelected.tab.active = false; } var selected = ctrl.tabs[index]; if (selected) { selected.tab.onSelect({ $event: evt }); selected.tab.active = true; ctrl.active = selected.index; oldIndex = selected.index; } else if (!selected && angular.isNumber(oldIndex)) { ctrl.active = null; oldIndex = null; } } }; ctrl.addTab = function addTab(tab) { ctrl.tabs.push({ tab: tab, index: tab.index }); ctrl.tabs.sort(function(t1, t2) { if (t1.index > t2.index) { return 1; } if (t1.index < t2.index) { return -1; } return 0; }); if (tab.index === ctrl.active || !angular.isNumber(ctrl.active) && ctrl.tabs.length === 1) { var newActiveIndex = findTabIndex(tab.index); ctrl.select(newActiveIndex); } }; ctrl.removeTab = function removeTab(tab) { var index = findTabIndex(tab.index); if (tab.index === ctrl.active) { var newActiveTabIndex = index === ctrl.tabs.length - 1 ? index - 1 : index + 1 % ctrl.tabs.length; ctrl.select(newActiveTabIndex); } ctrl.tabs.splice(index, 1); }; $scope.$watch('tabset.active', function(val) { if (angular.isNumber(val) && val !== oldIndex) { ctrl.select(findTabIndex(val)); } }); var destroyed; $scope.$on('$destroy', function() { destroyed = true; }); function findTabIndex(index) { for (var i = 0; i < ctrl.tabs.length; i++) { if (ctrl.tabs[i].index === index) { return i; } } } }]) .directive('uibTabset', function() { return { transclude: true, replace: true, scope: {}, bindToController: { active: '=?', type: '@' }, controller: 'UibTabsetController', controllerAs: 'tabset', templateUrl: function(element, attrs) { return attrs.templateUrl || 'uib/template/tabs/tabset.html'; }, link: function(scope, element, attrs) { scope.vertical = angular.isDefined(attrs.vertical) ? scope.$parent.$eval(attrs.vertical) : false; scope.justified = angular.isDefined(attrs.justified) ? scope.$parent.$eval(attrs.justified) : false; if (angular.isUndefined(attrs.active)) { scope.active = 0; } } }; }) .directive('uibTab', ['$parse', function($parse) { return { require: '^uibTabset', replace: true, templateUrl: function(element, attrs) { return attrs.templateUrl || 'uib/template/tabs/tab.html'; }, transclude: true, scope: { heading: '@', index: '=?', classes: '@?', onSelect: '&select', //This callback is called in contentHeadingTransclude //once it inserts the tab's content into the dom onDeselect: '&deselect' }, controller: function() { //Empty controller so other directives can require being 'under' a tab }, controllerAs: 'tab', link: function(scope, elm, attrs, tabsetCtrl, transclude) { scope.disabled = false; if (attrs.disable) { scope.$parent.$watch($parse(attrs.disable), function(value) { scope.disabled = !! value; }); } if (angular.isUndefined(attrs.index)) { if (tabsetCtrl.tabs && tabsetCtrl.tabs.length) { scope.index = Math.max.apply(null, tabsetCtrl.tabs.map(function(t) { return t.index; })) + 1; } else { scope.index = 0; } } if (angular.isUndefined(attrs.classes)) { scope.classes = ''; } scope.select = function(evt) { if (!scope.disabled) { var index; for (var i = 0; i < tabsetCtrl.tabs.length; i++) { if (tabsetCtrl.tabs[i].tab === scope) { index = i; break; } } tabsetCtrl.select(index, evt); } }; tabsetCtrl.addTab(scope); scope.$on('$destroy', function() { tabsetCtrl.removeTab(scope); }); //We need to transclude later, once the content container is ready. //when this link happens, we're inside a tab heading. scope.$transcludeFn = transclude; } }; }]) .directive('uibTabHeadingTransclude', function() { return { restrict: 'A', require: '^uibTab', link: function(scope, elm) { scope.$watch('headingElement', function updateHeadingElement(heading) { if (heading) { elm.html(''); elm.append(heading); } }); } }; }) .directive('uibTabContentTransclude', function() { return { restrict: 'A', require: '^uibTabset', link: function(scope, elm, attrs) { var tab = scope.$eval(attrs.uibTabContentTransclude).tab; //Now our tab is ready to be transcluded: both the tab heading area //and the tab content area are loaded. Transclude 'em both. tab.$transcludeFn(tab.$parent, function(contents) { angular.forEach(contents, function(node) { if (isTabHeading(node)) { //Let tabHeadingTransclude know. tab.headingElement = node; } else { elm.append(node); } }); }); } }; function isTabHeading(node) { return node.tagName && ( node.hasAttribute('uib-tab-heading') || node.hasAttribute('data-uib-tab-heading') || node.hasAttribute('x-uib-tab-heading') || node.tagName.toLowerCase() === 'uib-tab-heading' || node.tagName.toLowerCase() === 'data-uib-tab-heading' || node.tagName.toLowerCase() === 'x-uib-tab-heading' || node.tagName.toLowerCase() === 'uib:tab-heading' ); } }); angular.module('ui.bootstrap.timepicker', []) .constant('uibTimepickerConfig', { hourStep: 1, minuteStep: 1, secondStep: 1, showMeridian: true, showSeconds: false, meridians: null, readonlyInput: false, mousewheel: true, arrowkeys: true, showSpinners: true, templateUrl: 'uib/template/timepicker/timepicker.html' }) .controller('UibTimepickerController', ['$scope', '$element', '$attrs', '$parse', '$log', '$locale', 'uibTimepickerConfig', function($scope, $element, $attrs, $parse, $log, $locale, timepickerConfig) { var selected = new Date(), watchers = [], ngModelCtrl = { $setViewValue: angular.noop }, // nullModelCtrl meridians = angular.isDefined($attrs.meridians) ? $scope.$parent.$eval($attrs.meridians) : timepickerConfig.meridians || $locale.DATETIME_FORMATS.AMPMS, padHours = angular.isDefined($attrs.padHours) ? $scope.$parent.$eval($attrs.padHours) : true; $scope.tabindex = angular.isDefined($attrs.tabindex) ? $attrs.tabindex : 0; $element.removeAttr('tabindex'); this.init = function(ngModelCtrl_, inputs) { ngModelCtrl = ngModelCtrl_; ngModelCtrl.$render = this.render; ngModelCtrl.$formatters.unshift(function(modelValue) { return modelValue ? new Date(modelValue) : null; }); var hoursInputEl = inputs.eq(0), minutesInputEl = inputs.eq(1), secondsInputEl = inputs.eq(2); var mousewheel = angular.isDefined($attrs.mousewheel) ? $scope.$parent.$eval($attrs.mousewheel) : timepickerConfig.mousewheel; if (mousewheel) { this.setupMousewheelEvents(hoursInputEl, minutesInputEl, secondsInputEl); } var arrowkeys = angular.isDefined($attrs.arrowkeys) ? $scope.$parent.$eval($attrs.arrowkeys) : timepickerConfig.arrowkeys; if (arrowkeys) { this.setupArrowkeyEvents(hoursInputEl, minutesInputEl, secondsInputEl); } $scope.readonlyInput = angular.isDefined($attrs.readonlyInput) ? $scope.$parent.$eval($attrs.readonlyInput) : timepickerConfig.readonlyInput; this.setupInputEvents(hoursInputEl, minutesInputEl, secondsInputEl); }; var hourStep = timepickerConfig.hourStep; if ($attrs.hourStep) { watchers.push($scope.$parent.$watch($parse($attrs.hourStep), function(value) { hourStep = +value; })); } var minuteStep = timepickerConfig.minuteStep; if ($attrs.minuteStep) { watchers.push($scope.$parent.$watch($parse($attrs.minuteStep), function(value) { minuteStep = +value; })); } var min; watchers.push($scope.$parent.$watch($parse($attrs.min), function(value) { var dt = new Date(value); min = isNaN(dt) ? undefined : dt; })); var max; watchers.push($scope.$parent.$watch($parse($attrs.max), function(value) { var dt = new Date(value); max = isNaN(dt) ? undefined : dt; })); var disabled = false; if ($attrs.ngDisabled) { watchers.push($scope.$parent.$watch($parse($attrs.ngDisabled), function(value) { disabled = value; })); } $scope.noIncrementHours = function() { var incrementedSelected = addMinutes(selected, hourStep * 60); return disabled || incrementedSelected > max || incrementedSelected < selected && incrementedSelected < min; }; $scope.noDecrementHours = function() { var decrementedSelected = addMinutes(selected, -hourStep * 60); return disabled || decrementedSelected < min || decrementedSelected > selected && decrementedSelected > max; }; $scope.noIncrementMinutes = function() { var incrementedSelected = addMinutes(selected, minuteStep); return disabled || incrementedSelected > max || incrementedSelected < selected && incrementedSelected < min; }; $scope.noDecrementMinutes = function() { var decrementedSelected = addMinutes(selected, -minuteStep); return disabled || decrementedSelected < min || decrementedSelected > selected && decrementedSelected > max; }; $scope.noIncrementSeconds = function() { var incrementedSelected = addSeconds(selected, secondStep); return disabled || incrementedSelected > max || incrementedSelected < selected && incrementedSelected < min; }; $scope.noDecrementSeconds = function() { var decrementedSelected = addSeconds(selected, -secondStep); return disabled || decrementedSelected < min || decrementedSelected > selected && decrementedSelected > max; }; $scope.noToggleMeridian = function() { if (selected.getHours() < 12) { return disabled || addMinutes(selected, 12 * 60) > max; } return disabled || addMinutes(selected, -12 * 60) < min; }; var secondStep = timepickerConfig.secondStep; if ($attrs.secondStep) { watchers.push($scope.$parent.$watch($parse($attrs.secondStep), function(value) { secondStep = +value; })); } $scope.showSeconds = timepickerConfig.showSeconds; if ($attrs.showSeconds) { watchers.push($scope.$parent.$watch($parse($attrs.showSeconds), function(value) { $scope.showSeconds = !!value; })); } // 12H / 24H mode $scope.showMeridian = timepickerConfig.showMeridian; if ($attrs.showMeridian) { watchers.push($scope.$parent.$watch($parse($attrs.showMeridian), function(value) { $scope.showMeridian = !!value; if (ngModelCtrl.$error.time) { // Evaluate from template var hours = getHoursFromTemplate(), minutes = getMinutesFromTemplate(); if (angular.isDefined(hours) && angular.isDefined(minutes)) { selected.setHours(hours); refresh(); } } else { updateTemplate(); } })); } // Get $scope.hours in 24H mode if valid function getHoursFromTemplate() { var hours = +$scope.hours; var valid = $scope.showMeridian ? hours > 0 && hours < 13 : hours >= 0 && hours < 24; if (!valid) { return undefined; } if ($scope.showMeridian) { if (hours === 12) { hours = 0; } if ($scope.meridian === meridians[1]) { hours = hours + 12; } } return hours; } function getMinutesFromTemplate() { var minutes = +$scope.minutes; return minutes >= 0 && minutes < 60 ? minutes : undefined; } function getSecondsFromTemplate() { var seconds = +$scope.seconds; return seconds >= 0 && seconds < 60 ? seconds : undefined; } function pad(value, noPad) { if (value === null) { return ''; } return angular.isDefined(value) && value.toString().length < 2 && !noPad ? '0' + value : value.toString(); } // Respond on mousewheel spin this.setupMousewheelEvents = function(hoursInputEl, minutesInputEl, secondsInputEl) { var isScrollingUp = function(e) { if (e.originalEvent) { e = e.originalEvent; } //pick correct delta variable depending on event var delta = e.wheelDelta ? e.wheelDelta : -e.deltaY; return e.detail || delta > 0; }; hoursInputEl.bind('mousewheel wheel', function(e) { if (!disabled) { $scope.$apply(isScrollingUp(e) ? $scope.incrementHours() : $scope.decrementHours()); } e.preventDefault(); }); minutesInputEl.bind('mousewheel wheel', function(e) { if (!disabled) { $scope.$apply(isScrollingUp(e) ? $scope.incrementMinutes() : $scope.decrementMinutes()); } e.preventDefault(); }); secondsInputEl.bind('mousewheel wheel', function(e) { if (!disabled) { $scope.$apply(isScrollingUp(e) ? $scope.incrementSeconds() : $scope.decrementSeconds()); } e.preventDefault(); }); }; // Respond on up/down arrowkeys this.setupArrowkeyEvents = function(hoursInputEl, minutesInputEl, secondsInputEl) { hoursInputEl.bind('keydown', function(e) { if (!disabled) { if (e.which === 38) { // up e.preventDefault(); $scope.incrementHours(); $scope.$apply(); } else if (e.which === 40) { // down e.preventDefault(); $scope.decrementHours(); $scope.$apply(); } } }); minutesInputEl.bind('keydown', function(e) { if (!disabled) { if (e.which === 38) { // up e.preventDefault(); $scope.incrementMinutes(); $scope.$apply(); } else if (e.which === 40) { // down e.preventDefault(); $scope.decrementMinutes(); $scope.$apply(); } } }); secondsInputEl.bind('keydown', function(e) { if (!disabled) { if (e.which === 38) { // up e.preventDefault(); $scope.incrementSeconds(); $scope.$apply(); } else if (e.which === 40) { // down e.preventDefault(); $scope.decrementSeconds(); $scope.$apply(); } } }); }; this.setupInputEvents = function(hoursInputEl, minutesInputEl, secondsInputEl) { if ($scope.readonlyInput) { $scope.updateHours = angular.noop; $scope.updateMinutes = angular.noop; $scope.updateSeconds = angular.noop; return; } var invalidate = function(invalidHours, invalidMinutes, invalidSeconds) { ngModelCtrl.$setViewValue(null); ngModelCtrl.$setValidity('time', false); if (angular.isDefined(invalidHours)) { $scope.invalidHours = invalidHours; } if (angular.isDefined(invalidMinutes)) { $scope.invalidMinutes = invalidMinutes; } if (angular.isDefined(invalidSeconds)) { $scope.invalidSeconds = invalidSeconds; } }; $scope.updateHours = function() { var hours = getHoursFromTemplate(), minutes = getMinutesFromTemplate(); ngModelCtrl.$setDirty(); if (angular.isDefined(hours) && angular.isDefined(minutes)) { selected.setHours(hours); selected.setMinutes(minutes); if (selected < min || selected > max) { invalidate(true); } else { refresh('h'); } } else { invalidate(true); } }; hoursInputEl.bind('blur', function(e) { ngModelCtrl.$setTouched(); if ($scope.hours === null || $scope.hours === '') { invalidate(true); } else if (!$scope.invalidHours && $scope.hours < 10) { $scope.$apply(function() { $scope.hours = pad($scope.hours, !padHours); }); } }); $scope.updateMinutes = function() { var minutes = getMinutesFromTemplate(), hours = getHoursFromTemplate(); ngModelCtrl.$setDirty(); if (angular.isDefined(minutes) && angular.isDefined(hours)) { selected.setHours(hours); selected.setMinutes(minutes); if (selected < min || selected > max) { invalidate(undefined, true); } else { refresh('m'); } } else { invalidate(undefined, true); } }; minutesInputEl.bind('blur', function(e) { ngModelCtrl.$setTouched(); if ($scope.minutes === null) { invalidate(undefined, true); } else if (!$scope.invalidMinutes && $scope.minutes < 10) { $scope.$apply(function() { $scope.minutes = pad($scope.minutes); }); } }); $scope.updateSeconds = function() { var seconds = getSecondsFromTemplate(); ngModelCtrl.$setDirty(); if (angular.isDefined(seconds)) { selected.setSeconds(seconds); refresh('s'); } else { invalidate(undefined, undefined, true); } }; secondsInputEl.bind('blur', function(e) { if (!$scope.invalidSeconds && $scope.seconds < 10) { $scope.$apply( function() { $scope.seconds = pad($scope.seconds); }); } }); }; this.render = function() { var date = ngModelCtrl.$viewValue; if (isNaN(date)) { ngModelCtrl.$setValidity('time', false); $log.error('Timepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.'); } else { if (date) { selected = date; } if (selected < min || selected > max) { ngModelCtrl.$setValidity('time', false); $scope.invalidHours = true; $scope.invalidMinutes = true; } else { makeValid(); } updateTemplate(); } }; // Call internally when we know that model is valid. function refresh(keyboardChange) { makeValid(); ngModelCtrl.$setViewValue(new Date(selected)); updateTemplate(keyboardChange); } function makeValid() { ngModelCtrl.$setValidity('time', true); $scope.invalidHours = false; $scope.invalidMinutes = false; $scope.invalidSeconds = false; } function updateTemplate(keyboardChange) { if (!ngModelCtrl.$modelValue) { $scope.hours = null; $scope.minutes = null; $scope.seconds = null; $scope.meridian = meridians[0]; } else { var hours = selected.getHours(), minutes = selected.getMinutes(), seconds = selected.getSeconds(); if ($scope.showMeridian) { hours = hours === 0 || hours === 12 ? 12 : hours % 12; // Convert 24 to 12 hour system } $scope.hours = keyboardChange === 'h' ? hours : pad(hours, !padHours); if (keyboardChange !== 'm') { $scope.minutes = pad(minutes); } $scope.meridian = selected.getHours() < 12 ? meridians[0] : meridians[1]; if (keyboardChange !== 's') { $scope.seconds = pad(seconds); } $scope.meridian = selected.getHours() < 12 ? meridians[0] : meridians[1]; } } function addSecondsToSelected(seconds) { selected = addSeconds(selected, seconds); refresh(); } function addMinutes(selected, minutes) { return addSeconds(selected, minutes*60); } function addSeconds(date, seconds) { var dt = new Date(date.getTime() + seconds * 1000); var newDate = new Date(date); newDate.setHours(dt.getHours(), dt.getMinutes(), dt.getSeconds()); return newDate; } $scope.showSpinners = angular.isDefined($attrs.showSpinners) ? $scope.$parent.$eval($attrs.showSpinners) : timepickerConfig.showSpinners; $scope.incrementHours = function() { if (!$scope.noIncrementHours()) { addSecondsToSelected(hourStep * 60 * 60); } }; $scope.decrementHours = function() { if (!$scope.noDecrementHours()) { addSecondsToSelected(-hourStep * 60 * 60); } }; $scope.incrementMinutes = function() { if (!$scope.noIncrementMinutes()) { addSecondsToSelected(minuteStep * 60); } }; $scope.decrementMinutes = function() { if (!$scope.noDecrementMinutes()) { addSecondsToSelected(-minuteStep * 60); } }; $scope.incrementSeconds = function() { if (!$scope.noIncrementSeconds()) { addSecondsToSelected(secondStep); } }; $scope.decrementSeconds = function() { if (!$scope.noDecrementSeconds()) { addSecondsToSelected(-secondStep); } }; $scope.toggleMeridian = function() { var minutes = getMinutesFromTemplate(), hours = getHoursFromTemplate(); if (!$scope.noToggleMeridian()) { if (angular.isDefined(minutes) && angular.isDefined(hours)) { addSecondsToSelected(12 * 60 * (selected.getHours() < 12 ? 60 : -60)); } else { $scope.meridian = $scope.meridian === meridians[0] ? meridians[1] : meridians[0]; } } }; $scope.blur = function() { ngModelCtrl.$setTouched(); }; $scope.$on('$destroy', function() { while (watchers.length) { watchers.shift()(); } }); }]) .directive('uibTimepicker', ['uibTimepickerConfig', function(uibTimepickerConfig) { return { require: ['uibTimepicker', '?^ngModel'], controller: 'UibTimepickerController', controllerAs: 'timepicker', replace: true, scope: {}, templateUrl: function(element, attrs) { return attrs.templateUrl || uibTimepickerConfig.templateUrl; }, link: function(scope, element, attrs, ctrls) { var timepickerCtrl = ctrls[0], ngModelCtrl = ctrls[1]; if (ngModelCtrl) { timepickerCtrl.init(ngModelCtrl, element.find('input')); } } }; }]); angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.debounce', 'ui.bootstrap.position']) /** * A helper service that can parse typeahead's syntax (string provided by users) * Extracted to a separate service for ease of unit testing */ .factory('uibTypeaheadParser', ['$parse', function($parse) { // 00000111000000000000022200000000000000003333333333333330000000000044000 var TYPEAHEAD_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+([\s\S]+?)$/; return { parse: function(input) { var match = input.match(TYPEAHEAD_REGEXP); if (!match) { throw new Error( 'Expected typeahead specification in form of "_modelValue_ (as _label_)? for _item_ in _collection_"' + ' but got "' + input + '".'); } return { itemName: match[3], source: $parse(match[4]), viewMapper: $parse(match[2] || match[1]), modelMapper: $parse(match[1]) }; } }; }]) .controller('UibTypeaheadController', ['$scope', '$element', '$attrs', '$compile', '$parse', '$q', '$timeout', '$document', '$window', '$rootScope', '$$debounce', '$uibPosition', 'uibTypeaheadParser', function(originalScope, element, attrs, $compile, $parse, $q, $timeout, $document, $window, $rootScope, $$debounce, $position, typeaheadParser) { var HOT_KEYS = [9, 13, 27, 38, 40]; var eventDebounceTime = 200; var modelCtrl, ngModelOptions; //SUPPORTED ATTRIBUTES (OPTIONS) //minimal no of characters that needs to be entered before typeahead kicks-in var minLength = originalScope.$eval(attrs.typeaheadMinLength); if (!minLength && minLength !== 0) { minLength = 1; } originalScope.$watch(attrs.typeaheadMinLength, function (newVal) { minLength = !newVal && newVal !== 0 ? 1 : newVal; }); //minimal wait time after last character typed before typeahead kicks-in var waitTime = originalScope.$eval(attrs.typeaheadWaitMs) || 0; //should it restrict model values to the ones selected from the popup only? var isEditable = originalScope.$eval(attrs.typeaheadEditable) !== false; originalScope.$watch(attrs.typeaheadEditable, function (newVal) { isEditable = newVal !== false; }); //binding to a variable that indicates if matches are being retrieved asynchronously var isLoadingSetter = $parse(attrs.typeaheadLoading).assign || angular.noop; //a callback executed when a match is selected var onSelectCallback = $parse(attrs.typeaheadOnSelect); //should it select highlighted popup value when losing focus? var isSelectOnBlur = angular.isDefined(attrs.typeaheadSelectOnBlur) ? originalScope.$eval(attrs.typeaheadSelectOnBlur) : false; //binding to a variable that indicates if there were no results after the query is completed var isNoResultsSetter = $parse(attrs.typeaheadNoResults).assign || angular.noop; var inputFormatter = attrs.typeaheadInputFormatter ? $parse(attrs.typeaheadInputFormatter) : undefined; var appendToBody = attrs.typeaheadAppendToBody ? originalScope.$eval(attrs.typeaheadAppendToBody) : false; var appendTo = attrs.typeaheadAppendTo ? originalScope.$eval(attrs.typeaheadAppendTo) : null; var focusFirst = originalScope.$eval(attrs.typeaheadFocusFirst) !== false; //If input matches an item of the list exactly, select it automatically var selectOnExact = attrs.typeaheadSelectOnExact ? originalScope.$eval(attrs.typeaheadSelectOnExact) : false; //binding to a variable that indicates if dropdown is open var isOpenSetter = $parse(attrs.typeaheadIsOpen).assign || angular.noop; var showHint = originalScope.$eval(attrs.typeaheadShowHint) || false; //INTERNAL VARIABLES //model setter executed upon match selection var parsedModel = $parse(attrs.ngModel); var invokeModelSetter = $parse(attrs.ngModel + '($$$p)'); var $setModelValue = function(scope, newValue) { if (angular.isFunction(parsedModel(originalScope)) && ngModelOptions && ngModelOptions.$options && ngModelOptions.$options.getterSetter) { return invokeModelSetter(scope, {$$$p: newValue}); } return parsedModel.assign(scope, newValue); }; //expressions used by typeahead var parserResult = typeaheadParser.parse(attrs.uibTypeahead); var hasFocus; //Used to avoid bug in iOS webview where iOS keyboard does not fire //mousedown & mouseup events //Issue #3699 var selected; //create a child scope for the typeahead directive so we are not polluting original scope //with typeahead-specific data (matches, query etc.) var scope = originalScope.$new(); var offDestroy = originalScope.$on('$destroy', function() { scope.$destroy(); }); scope.$on('$destroy', offDestroy); // WAI-ARIA var popupId = 'typeahead-' + scope.$id + '-' + Math.floor(Math.random() * 10000); element.attr({ 'aria-autocomplete': 'list', 'aria-expanded': false, 'aria-owns': popupId }); var inputsContainer, hintInputElem; //add read-only input to show hint if (showHint) { inputsContainer = angular.element('<div></div>'); inputsContainer.css('position', 'relative'); element.after(inputsContainer); hintInputElem = element.clone(); hintInputElem.attr('placeholder', ''); hintInputElem.attr('tabindex', '-1'); hintInputElem.val(''); hintInputElem.css({ 'position': 'absolute', 'top': '0px', 'left': '0px', 'border-color': 'transparent', 'box-shadow': 'none', 'opacity': 1, 'background': 'none 0% 0% / auto repeat scroll padding-box border-box rgb(255, 255, 255)', 'color': '#999' }); element.css({ 'position': 'relative', 'vertical-align': 'top', 'background-color': 'transparent' }); inputsContainer.append(hintInputElem); hintInputElem.after(element); } //pop-up element used to display matches var popUpEl = angular.element('<div uib-typeahead-popup></div>'); popUpEl.attr({ id: popupId, matches: 'matches', active: 'activeIdx', select: 'select(activeIdx, evt)', 'move-in-progress': 'moveInProgress', query: 'query', position: 'position', 'assign-is-open': 'assignIsOpen(isOpen)', debounce: 'debounceUpdate' }); //custom item template if (angular.isDefined(attrs.typeaheadTemplateUrl)) { popUpEl.attr('template-url', attrs.typeaheadTemplateUrl); } if (angular.isDefined(attrs.typeaheadPopupTemplateUrl)) { popUpEl.attr('popup-template-url', attrs.typeaheadPopupTemplateUrl); } var resetHint = function() { if (showHint) { hintInputElem.val(''); } }; var resetMatches = function() { scope.matches = []; scope.activeIdx = -1; element.attr('aria-expanded', false); resetHint(); }; var getMatchId = function(index) { return popupId + '-option-' + index; }; // Indicate that the specified match is the active (pre-selected) item in the list owned by this typeahead. // This attribute is added or removed automatically when the `activeIdx` changes. scope.$watch('activeIdx', function(index) { if (index < 0) { element.removeAttr('aria-activedescendant'); } else { element.attr('aria-activedescendant', getMatchId(index)); } }); var inputIsExactMatch = function(inputValue, index) { if (scope.matches.length > index && inputValue) { return inputValue.toUpperCase() === scope.matches[index].label.toUpperCase(); } return false; }; var getMatchesAsync = function(inputValue, evt) { var locals = {$viewValue: inputValue}; isLoadingSetter(originalScope, true); isNoResultsSetter(originalScope, false); $q.when(parserResult.source(originalScope, locals)).then(function(matches) { //it might happen that several async queries were in progress if a user were typing fast //but we are interested only in responses that correspond to the current view value var onCurrentRequest = inputValue === modelCtrl.$viewValue; if (onCurrentRequest && hasFocus) { if (matches && matches.length > 0) { scope.activeIdx = focusFirst ? 0 : -1; isNoResultsSetter(originalScope, false); scope.matches.length = 0; //transform labels for (var i = 0; i < matches.length; i++) { locals[parserResult.itemName] = matches[i]; scope.matches.push({ id: getMatchId(i), label: parserResult.viewMapper(scope, locals), model: matches[i] }); } scope.query = inputValue; //position pop-up with matches - we need to re-calculate its position each time we are opening a window //with matches as a pop-up might be absolute-positioned and position of an input might have changed on a page //due to other elements being rendered recalculatePosition(); element.attr('aria-expanded', true); //Select the single remaining option if user input matches if (selectOnExact && scope.matches.length === 1 && inputIsExactMatch(inputValue, 0)) { if (angular.isNumber(scope.debounceUpdate) || angular.isObject(scope.debounceUpdate)) { $$debounce(function() { scope.select(0, evt); }, angular.isNumber(scope.debounceUpdate) ? scope.debounceUpdate : scope.debounceUpdate['default']); } else { scope.select(0, evt); } } if (showHint) { var firstLabel = scope.matches[0].label; if (angular.isString(inputValue) && inputValue.length > 0 && firstLabel.slice(0, inputValue.length).toUpperCase() === inputValue.toUpperCase()) { hintInputElem.val(inputValue + firstLabel.slice(inputValue.length)); } else { hintInputElem.val(''); } } } else { resetMatches(); isNoResultsSetter(originalScope, true); } } if (onCurrentRequest) { isLoadingSetter(originalScope, false); } }, function() { resetMatches(); isLoadingSetter(originalScope, false); isNoResultsSetter(originalScope, true); }); }; // bind events only if appendToBody params exist - performance feature if (appendToBody) { angular.element($window).on('resize', fireRecalculating); $document.find('body').on('scroll', fireRecalculating); } // Declare the debounced function outside recalculating for // proper debouncing var debouncedRecalculate = $$debounce(function() { // if popup is visible if (scope.matches.length) { recalculatePosition(); } scope.moveInProgress = false; }, eventDebounceTime); // Default progress type scope.moveInProgress = false; function fireRecalculating() { if (!scope.moveInProgress) { scope.moveInProgress = true; scope.$digest(); } debouncedRecalculate(); } // recalculate actual position and set new values to scope // after digest loop is popup in right position function recalculatePosition() { scope.position = appendToBody ? $position.offset(element) : $position.position(element); scope.position.top += element.prop('offsetHeight'); } //we need to propagate user's query so we can higlight matches scope.query = undefined; //Declare the timeout promise var outside the function scope so that stacked calls can be cancelled later var timeoutPromise; var scheduleSearchWithTimeout = function(inputValue) { timeoutPromise = $timeout(function() { getMatchesAsync(inputValue); }, waitTime); }; var cancelPreviousTimeout = function() { if (timeoutPromise) { $timeout.cancel(timeoutPromise); } }; resetMatches(); scope.assignIsOpen = function (isOpen) { isOpenSetter(originalScope, isOpen); }; scope.select = function(activeIdx, evt) { //called from within the $digest() cycle var locals = {}; var model, item; selected = true; locals[parserResult.itemName] = item = scope.matches[activeIdx].model; model = parserResult.modelMapper(originalScope, locals); $setModelValue(originalScope, model); modelCtrl.$setValidity('editable', true); modelCtrl.$setValidity('parse', true); onSelectCallback(originalScope, { $item: item, $model: model, $label: parserResult.viewMapper(originalScope, locals), $event: evt }); resetMatches(); //return focus to the input element if a match was selected via a mouse click event // use timeout to avoid $rootScope:inprog error if (scope.$eval(attrs.typeaheadFocusOnSelect) !== false) { $timeout(function() { element[0].focus(); }, 0, false); } }; //bind keyboard events: arrows up(38) / down(40), enter(13) and tab(9), esc(27) element.on('keydown', function(evt) { //typeahead is open and an "interesting" key was pressed if (scope.matches.length === 0 || HOT_KEYS.indexOf(evt.which) === -1) { return; } /** * if there's nothing selected (i.e. focusFirst) and enter or tab is hit * or * shift + tab is pressed to bring focus to the previous element * then clear the results */ if (scope.activeIdx === -1 && (evt.which === 9 || evt.which === 13) || evt.which === 9 && !!evt.shiftKey) { resetMatches(); scope.$digest(); return; } evt.preventDefault(); var target; switch (evt.which) { case 9: case 13: scope.$apply(function () { if (angular.isNumber(scope.debounceUpdate) || angular.isObject(scope.debounceUpdate)) { $$debounce(function() { scope.select(scope.activeIdx, evt); }, angular.isNumber(scope.debounceUpdate) ? scope.debounceUpdate : scope.debounceUpdate['default']); } else { scope.select(scope.activeIdx, evt); } }); break; case 27: evt.stopPropagation(); resetMatches(); originalScope.$digest(); break; case 38: scope.activeIdx = (scope.activeIdx > 0 ? scope.activeIdx : scope.matches.length) - 1; scope.$digest(); target = popUpEl.find('li')[scope.activeIdx]; target.parentNode.scrollTop = target.offsetTop; break; case 40: scope.activeIdx = (scope.activeIdx + 1) % scope.matches.length; scope.$digest(); target = popUpEl.find('li')[scope.activeIdx]; target.parentNode.scrollTop = target.offsetTop; break; } }); element.bind('focus', function (evt) { hasFocus = true; if (minLength === 0 && !modelCtrl.$viewValue) { $timeout(function() { getMatchesAsync(modelCtrl.$viewValue, evt); }, 0); } }); element.bind('blur', function(evt) { if (isSelectOnBlur && scope.matches.length && scope.activeIdx !== -1 && !selected) { selected = true; scope.$apply(function() { if (angular.isObject(scope.debounceUpdate) && angular.isNumber(scope.debounceUpdate.blur)) { $$debounce(function() { scope.select(scope.activeIdx, evt); }, scope.debounceUpdate.blur); } else { scope.select(scope.activeIdx, evt); } }); } if (!isEditable && modelCtrl.$error.editable) { modelCtrl.$viewValue = ''; // Reset validity as we are clearing modelCtrl.$setValidity('editable', true); modelCtrl.$setValidity('parse', true); element.val(''); } hasFocus = false; selected = false; }); // Keep reference to click handler to unbind it. var dismissClickHandler = function(evt) { // Issue #3973 // Firefox treats right click as a click on document if (element[0] !== evt.target && evt.which !== 3 && scope.matches.length !== 0) { resetMatches(); if (!$rootScope.$$phase) { originalScope.$digest(); } } }; $document.on('click', dismissClickHandler); originalScope.$on('$destroy', function() { $document.off('click', dismissClickHandler); if (appendToBody || appendTo) { $popup.remove(); } if (appendToBody) { angular.element($window).off('resize', fireRecalculating); $document.find('body').off('scroll', fireRecalculating); } // Prevent jQuery cache memory leak popUpEl.remove(); if (showHint) { inputsContainer.remove(); } }); var $popup = $compile(popUpEl)(scope); if (appendToBody) { $document.find('body').append($popup); } else if (appendTo) { angular.element(appendTo).eq(0).append($popup); } else { element.after($popup); } this.init = function(_modelCtrl, _ngModelOptions) { modelCtrl = _modelCtrl; ngModelOptions = _ngModelOptions; scope.debounceUpdate = modelCtrl.$options && $parse(modelCtrl.$options.debounce)(originalScope); //plug into $parsers pipeline to open a typeahead on view changes initiated from DOM //$parsers kick-in on all the changes coming from the view as well as manually triggered by $setViewValue modelCtrl.$parsers.unshift(function(inputValue) { hasFocus = true; if (minLength === 0 || inputValue && inputValue.length >= minLength) { if (waitTime > 0) { cancelPreviousTimeout(); scheduleSearchWithTimeout(inputValue); } else { getMatchesAsync(inputValue); } } else { isLoadingSetter(originalScope, false); cancelPreviousTimeout(); resetMatches(); } if (isEditable) { return inputValue; } if (!inputValue) { // Reset in case user had typed something previously. modelCtrl.$setValidity('editable', true); return null; } modelCtrl.$setValidity('editable', false); return undefined; }); modelCtrl.$formatters.push(function(modelValue) { var candidateViewValue, emptyViewValue; var locals = {}; // The validity may be set to false via $parsers (see above) if // the model is restricted to selected values. If the model // is set manually it is considered to be valid. if (!isEditable) { modelCtrl.$setValidity('editable', true); } if (inputFormatter) { locals.$model = modelValue; return inputFormatter(originalScope, locals); } //it might happen that we don't have enough info to properly render input value //we need to check for this situation and simply return model value if we can't apply custom formatting locals[parserResult.itemName] = modelValue; candidateViewValue = parserResult.viewMapper(originalScope, locals); locals[parserResult.itemName] = undefined; emptyViewValue = parserResult.viewMapper(originalScope, locals); return candidateViewValue !== emptyViewValue ? candidateViewValue : modelValue; }); }; }]) .directive('uibTypeahead', function() { return { controller: 'UibTypeaheadController', require: ['ngModel', '^?ngModelOptions', 'uibTypeahead'], link: function(originalScope, element, attrs, ctrls) { ctrls[2].init(ctrls[0], ctrls[1]); } }; }) .directive('uibTypeaheadPopup', ['$$debounce', function($$debounce) { return { scope: { matches: '=', query: '=', active: '=', position: '&', moveInProgress: '=', select: '&', assignIsOpen: '&', debounce: '&' }, replace: true, templateUrl: function(element, attrs) { return attrs.popupTemplateUrl || 'uib/template/typeahead/typeahead-popup.html'; }, link: function(scope, element, attrs) { scope.templateUrl = attrs.templateUrl; scope.isOpen = function() { var isDropdownOpen = scope.matches.length > 0; scope.assignIsOpen({ isOpen: isDropdownOpen }); return isDropdownOpen; }; scope.isActive = function(matchIdx) { return scope.active === matchIdx; }; scope.selectActive = function(matchIdx) { scope.active = matchIdx; }; scope.selectMatch = function(activeIdx, evt) { var debounce = scope.debounce(); if (angular.isNumber(debounce) || angular.isObject(debounce)) { $$debounce(function() { scope.select({activeIdx: activeIdx, evt: evt}); }, angular.isNumber(debounce) ? debounce : debounce['default']); } else { scope.select({activeIdx: activeIdx, evt: evt}); } }; } }; }]) .directive('uibTypeaheadMatch', ['$templateRequest', '$compile', '$parse', function($templateRequest, $compile, $parse) { return { scope: { index: '=', match: '=', query: '=' }, link: function(scope, element, attrs) { var tplUrl = $parse(attrs.templateUrl)(scope.$parent) || 'uib/template/typeahead/typeahead-match.html'; $templateRequest(tplUrl).then(function(tplContent) { var tplEl = angular.element(tplContent.trim()); element.replaceWith(tplEl); $compile(tplEl)(scope); }); } }; }]) .filter('uibTypeaheadHighlight', ['$sce', '$injector', '$log', function($sce, $injector, $log) { var isSanitizePresent; isSanitizePresent = $injector.has('$sanitize'); function escapeRegexp(queryToEscape) { // Regex: capture the whole query string and replace it with the string that will be used to match // the results, for example if the capture is "a" the result will be \a return queryToEscape.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1'); } function containsHtml(matchItem) { return /<.*>/g.test(matchItem); } return function(matchItem, query) { if (!isSanitizePresent && containsHtml(matchItem)) { $log.warn('Unsafe use of typeahead please use ngSanitize'); // Warn the user about the danger } matchItem = query ? ('' + matchItem).replace(new RegExp(escapeRegexp(query), 'gi'), '<strong>$&</strong>') : matchItem; // Replaces the capture string with a the same string inside of a "strong" tag if (!isSanitizePresent) { matchItem = $sce.trustAsHtml(matchItem); // If $sanitize is not present we pack the string in a $sce object for the ng-bind-html directive } return matchItem; }; }]); angular.module("uib/template/accordion/accordion-group.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/accordion/accordion-group.html", "<div class=\"panel\" ng-class=\"panelClass || 'panel-default'\">\n" + " <div role=\"tab\" id=\"{{::headingId}}\" aria-selected=\"{{isOpen}}\" class=\"panel-heading\" ng-keypress=\"toggleOpen($event)\">\n" + " <h4 class=\"panel-title\">\n" + " <a role=\"button\" data-toggle=\"collapse\" href aria-expanded=\"{{isOpen}}\" aria-controls=\"{{::panelId}}\" tabindex=\"0\" class=\"accordion-toggle\" ng-click=\"toggleOpen()\" uib-accordion-transclude=\"heading\"><span uib-accordion-header ng-class=\"{'text-muted': isDisabled}\">{{heading}}</span></a>\n" + " </h4>\n" + " </div>\n" + " <div id=\"{{::panelId}}\" aria-labelledby=\"{{::headingId}}\" aria-hidden=\"{{!isOpen}}\" role=\"tabpanel\" class=\"panel-collapse collapse\" uib-collapse=\"!isOpen\">\n" + " <div class=\"panel-body\" ng-transclude></div>\n" + " </div>\n" + "</div>\n" + ""); }]); angular.module("uib/template/accordion/accordion.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/accordion/accordion.html", "<div role=\"tablist\" class=\"panel-group\" ng-transclude></div>"); }]); angular.module("uib/template/alert/alert.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/alert/alert.html", "<div class=\"alert\" ng-class=\"['alert-' + (type || 'warning'), closeable ? 'alert-dismissible' : null]\" role=\"alert\">\n" + " <button ng-show=\"closeable\" type=\"button\" class=\"close\" ng-click=\"close({$event: $event})\">\n" + " <span aria-hidden=\"true\">&times;</span>\n" + " <span class=\"sr-only\">Close</span>\n" + " </button>\n" + " <div ng-transclude></div>\n" + "</div>\n" + ""); }]); angular.module("uib/template/carousel/carousel.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/carousel/carousel.html", "<div ng-mouseenter=\"pause()\" ng-mouseleave=\"play()\" class=\"carousel\" ng-swipe-right=\"prev()\" ng-swipe-left=\"next()\">\n" + " <div class=\"carousel-inner\" ng-transclude></div>\n" + " <a role=\"button\" href class=\"left carousel-control\" ng-click=\"prev()\" ng-show=\"slides.length > 1\">\n" + " <span aria-hidden=\"true\" class=\"glyphicon glyphicon-chevron-left\"></span>\n" + " <span class=\"sr-only\">previous</span>\n" + " </a>\n" + " <a role=\"button\" href class=\"right carousel-control\" ng-click=\"next()\" ng-show=\"slides.length > 1\">\n" + " <span aria-hidden=\"true\" class=\"glyphicon glyphicon-chevron-right\"></span>\n" + " <span class=\"sr-only\">next</span>\n" + " </a>\n" + " <ol class=\"carousel-indicators\" ng-show=\"slides.length > 1\">\n" + " <li ng-repeat=\"slide in slides | orderBy:indexOfSlide track by $index\" ng-class=\"{ active: isActive(slide) }\" ng-click=\"select(slide)\">\n" + " <span class=\"sr-only\">slide {{ $index + 1 }} of {{ slides.length }}<span ng-if=\"isActive(slide)\">, currently active</span></span>\n" + " </li>\n" + " </ol>\n" + "</div>\n" + ""); }]); angular.module("uib/template/carousel/slide.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/carousel/slide.html", "<div ng-class=\"{\n" + " 'active': active\n" + " }\" class=\"item text-center\" ng-transclude></div>\n" + ""); }]); angular.module("uib/template/datepicker/datepicker.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/datepicker/datepicker.html", "<div class=\"uib-datepicker\" ng-switch=\"datepickerMode\" role=\"application\" ng-keydown=\"keydown($event)\">\n" + " <uib-daypicker ng-switch-when=\"day\" tabindex=\"0\"></uib-daypicker>\n" + " <uib-monthpicker ng-switch-when=\"month\" tabindex=\"0\"></uib-monthpicker>\n" + " <uib-yearpicker ng-switch-when=\"year\" tabindex=\"0\"></uib-yearpicker>\n" + "</div>\n" + ""); }]); angular.module("uib/template/datepicker/day.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/datepicker/day.html", "<table class=\"uib-daypicker\" role=\"grid\" aria-labelledby=\"{{::uniqueId}}-title\" aria-activedescendant=\"{{activeDateId}}\">\n" + " <thead>\n" + " <tr>\n" + " <th><button type=\"button\" class=\"btn btn-default btn-sm pull-left uib-left\" ng-click=\"move(-1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-left\"></i></button></th>\n" + " <th colspan=\"{{::5 + showWeeks}}\"><button id=\"{{::uniqueId}}-title\" role=\"heading\" aria-live=\"assertive\" aria-atomic=\"true\" type=\"button\" class=\"btn btn-default btn-sm uib-title\" ng-click=\"toggleMode()\" ng-disabled=\"datepickerMode === maxMode\" tabindex=\"-1\"><strong>{{title}}</strong></button></th>\n" + " <th><button type=\"button\" class=\"btn btn-default btn-sm pull-right uib-right\" ng-click=\"move(1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-right\"></i></button></th>\n" + " </tr>\n" + " <tr>\n" + " <th ng-if=\"showWeeks\" class=\"text-center\"></th>\n" + " <th ng-repeat=\"label in ::labels track by $index\" class=\"text-center\"><small aria-label=\"{{::label.full}}\">{{::label.abbr}}</small></th>\n" + " </tr>\n" + " </thead>\n" + " <tbody>\n" + " <tr class=\"uib-weeks\" ng-repeat=\"row in rows track by $index\">\n" + " <td ng-if=\"showWeeks\" class=\"text-center h6\"><em>{{ weekNumbers[$index] }}</em></td>\n" + " <td ng-repeat=\"dt in row\" class=\"uib-day text-center\" role=\"gridcell\"\n" + " id=\"{{::dt.uid}}\"\n" + " ng-class=\"::dt.customClass\">\n" + " <button type=\"button\" class=\"btn btn-default btn-sm\"\n" + " uib-is-class=\"\n" + " 'btn-info' for selectedDt,\n" + " 'active' for activeDt\n" + " on dt\"\n" + " ng-click=\"select(dt.date)\"\n" + " ng-disabled=\"::dt.disabled\"\n" + " tabindex=\"-1\"><span ng-class=\"::{'text-muted': dt.secondary, 'text-info': dt.current}\">{{::dt.label}}</span></button>\n" + " </td>\n" + " </tr>\n" + " </tbody>\n" + "</table>\n" + ""); }]); angular.module("uib/template/datepicker/month.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/datepicker/month.html", "<table class=\"uib-monthpicker\" role=\"grid\" aria-labelledby=\"{{::uniqueId}}-title\" aria-activedescendant=\"{{activeDateId}}\">\n" + " <thead>\n" + " <tr>\n" + " <th><button type=\"button\" class=\"btn btn-default btn-sm pull-left uib-left\" ng-click=\"move(-1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-left\"></i></button></th>\n" + " <th><button id=\"{{::uniqueId}}-title\" role=\"heading\" aria-live=\"assertive\" aria-atomic=\"true\" type=\"button\" class=\"btn btn-default btn-sm uib-title\" ng-click=\"toggleMode()\" ng-disabled=\"datepickerMode === maxMode\" tabindex=\"-1\"><strong>{{title}}</strong></button></th>\n" + " <th><button type=\"button\" class=\"btn btn-default btn-sm pull-right uib-right\" ng-click=\"move(1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-right\"></i></button></th>\n" + " </tr>\n" + " </thead>\n" + " <tbody>\n" + " <tr class=\"uib-months\" ng-repeat=\"row in rows track by $index\">\n" + " <td ng-repeat=\"dt in row\" class=\"uib-month text-center\" role=\"gridcell\"\n" + " id=\"{{::dt.uid}}\"\n" + " ng-class=\"::dt.customClass\">\n" + " <button type=\"button\" class=\"btn btn-default\"\n" + " uib-is-class=\"\n" + " 'btn-info' for selectedDt,\n" + " 'active' for activeDt\n" + " on dt\"\n" + " ng-click=\"select(dt.date)\"\n" + " ng-disabled=\"::dt.disabled\"\n" + " tabindex=\"-1\"><span ng-class=\"::{'text-info': dt.current}\">{{::dt.label}}</span></button>\n" + " </td>\n" + " </tr>\n" + " </tbody>\n" + "</table>\n" + ""); }]); angular.module("uib/template/datepicker/popup.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/datepicker/popup.html", "<div>\n" + " <ul class=\"uib-datepicker-popup dropdown-menu uib-position-measure\" dropdown-nested ng-if=\"isOpen\" ng-keydown=\"keydown($event)\" ng-click=\"$event.stopPropagation()\">\n" + " <li ng-transclude></li>\n" + " <li ng-if=\"showButtonBar\" class=\"uib-button-bar\">\n" + " <span class=\"btn-group pull-left\">\n" + " <button type=\"button\" class=\"btn btn-sm btn-info uib-datepicker-current\" ng-click=\"select('today', $event)\" ng-disabled=\"isDisabled('today')\">{{ getText('current') }}</button>\n" + " <button type=\"button\" class=\"btn btn-sm btn-danger uib-clear\" ng-click=\"select(null, $event)\">{{ getText('clear') }}</button>\n" + " </span>\n" + " <button type=\"button\" class=\"btn btn-sm btn-success pull-right uib-close\" ng-click=\"close($event)\">{{ getText('close') }}</button>\n" + " </li>\n" + " </ul>\n" + "</div>\n" + ""); }]); angular.module("uib/template/datepicker/year.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/datepicker/year.html", "<table class=\"uib-yearpicker\" role=\"grid\" aria-labelledby=\"{{::uniqueId}}-title\" aria-activedescendant=\"{{activeDateId}}\">\n" + " <thead>\n" + " <tr>\n" + " <th><button type=\"button\" class=\"btn btn-default btn-sm pull-left uib-left\" ng-click=\"move(-1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-left\"></i></button></th>\n" + " <th colspan=\"{{::columns - 2}}\"><button id=\"{{::uniqueId}}-title\" role=\"heading\" aria-live=\"assertive\" aria-atomic=\"true\" type=\"button\" class=\"btn btn-default btn-sm uib-title\" ng-click=\"toggleMode()\" ng-disabled=\"datepickerMode === maxMode\" tabindex=\"-1\"><strong>{{title}}</strong></button></th>\n" + " <th><button type=\"button\" class=\"btn btn-default btn-sm pull-right uib-right\" ng-click=\"move(1)\" tabindex=\"-1\"><i class=\"glyphicon glyphicon-chevron-right\"></i></button></th>\n" + " </tr>\n" + " </thead>\n" + " <tbody>\n" + " <tr class=\"uib-years\" ng-repeat=\"row in rows track by $index\">\n" + " <td ng-repeat=\"dt in row\" class=\"uib-year text-center\" role=\"gridcell\"\n" + " id=\"{{::dt.uid}}\"\n" + " ng-class=\"::dt.customClass\">\n" + " <button type=\"button\" class=\"btn btn-default\"\n" + " uib-is-class=\"\n" + " 'btn-info' for selectedDt,\n" + " 'active' for activeDt\n" + " on dt\"\n" + " ng-click=\"select(dt.date)\"\n" + " ng-disabled=\"::dt.disabled\"\n" + " tabindex=\"-1\"><span ng-class=\"::{'text-info': dt.current}\">{{::dt.label}}</span></button>\n" + " </td>\n" + " </tr>\n" + " </tbody>\n" + "</table>\n" + ""); }]); angular.module("uib/template/modal/backdrop.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/modal/backdrop.html", "<div class=\"modal-backdrop\"\n" + " uib-modal-animation-class=\"fade\"\n" + " modal-in-class=\"in\"\n" + " ng-style=\"{'z-index': 1040 + (index && 1 || 0) + index*10}\"\n" + "></div>\n" + ""); }]); angular.module("uib/template/modal/window.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/modal/window.html", "<div modal-render=\"{{$isRendered}}\" tabindex=\"-1\" role=\"dialog\" class=\"modal\"\n" + " uib-modal-animation-class=\"fade\"\n" + " modal-in-class=\"in\"\n" + " ng-style=\"{'z-index': 1050 + index*10, display: 'block'}\">\n" + " <div class=\"modal-dialog {{size ? 'modal-' + size : ''}}\"><div class=\"modal-content\" uib-modal-transclude></div></div>\n" + "</div>\n" + ""); }]); angular.module("uib/template/pager/pager.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/pager/pager.html", "<ul class=\"pager\">\n" + " <li ng-class=\"{disabled: noPrevious()||ngDisabled, previous: align}\"><a href ng-click=\"selectPage(page - 1, $event)\">{{::getText('previous')}}</a></li>\n" + " <li ng-class=\"{disabled: noNext()||ngDisabled, next: align}\"><a href ng-click=\"selectPage(page + 1, $event)\">{{::getText('next')}}</a></li>\n" + "</ul>\n" + ""); }]); angular.module("uib/template/pagination/pager.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/pagination/pager.html", "<ul class=\"pager\">\n" + " <li ng-class=\"{disabled: noPrevious()||ngDisabled, previous: align}\"><a href ng-click=\"selectPage(page - 1, $event)\">{{::getText('previous')}}</a></li>\n" + " <li ng-class=\"{disabled: noNext()||ngDisabled, next: align}\"><a href ng-click=\"selectPage(page + 1, $event)\">{{::getText('next')}}</a></li>\n" + "</ul>\n" + ""); }]); angular.module("uib/template/pagination/pagination.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/pagination/pagination.html", "<ul class=\"pagination\">\n" + " <li ng-if=\"::boundaryLinks\" ng-class=\"{disabled: noPrevious()||ngDisabled}\" class=\"pagination-first\"><a href ng-click=\"selectPage(1, $event)\">{{::getText('first')}}</a></li>\n" + " <li ng-if=\"::directionLinks\" ng-class=\"{disabled: noPrevious()||ngDisabled}\" class=\"pagination-prev\"><a href ng-click=\"selectPage(page - 1, $event)\">{{::getText('previous')}}</a></li>\n" + " <li ng-repeat=\"page in pages track by $index\" ng-class=\"{active: page.active,disabled: ngDisabled&&!page.active}\" class=\"pagination-page\"><a href ng-click=\"selectPage(page.number, $event)\">{{page.text}}</a></li>\n" + " <li ng-if=\"::directionLinks\" ng-class=\"{disabled: noNext()||ngDisabled}\" class=\"pagination-next\"><a href ng-click=\"selectPage(page + 1, $event)\">{{::getText('next')}}</a></li>\n" + " <li ng-if=\"::boundaryLinks\" ng-class=\"{disabled: noNext()||ngDisabled}\" class=\"pagination-last\"><a href ng-click=\"selectPage(totalPages, $event)\">{{::getText('last')}}</a></li>\n" + "</ul>\n" + ""); }]); angular.module("uib/template/tooltip/tooltip-html-popup.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/tooltip/tooltip-html-popup.html", "<div class=\"tooltip\"\n" + " tooltip-animation-class=\"fade\"\n" + " uib-tooltip-classes\n" + " ng-class=\"{ in: isOpen() }\">\n" + " <div class=\"tooltip-arrow\"></div>\n" + " <div class=\"tooltip-inner\" ng-bind-html=\"contentExp()\"></div>\n" + "</div>\n" + ""); }]); angular.module("uib/template/tooltip/tooltip-popup.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/tooltip/tooltip-popup.html", "<div class=\"tooltip\"\n" + " tooltip-animation-class=\"fade\"\n" + " uib-tooltip-classes\n" + " ng-class=\"{ in: isOpen() }\">\n" + " <div class=\"tooltip-arrow\"></div>\n" + " <div class=\"tooltip-inner\" ng-bind=\"content\"></div>\n" + "</div>\n" + ""); }]); angular.module("uib/template/tooltip/tooltip-template-popup.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/tooltip/tooltip-template-popup.html", "<div class=\"tooltip\"\n" + " tooltip-animation-class=\"fade\"\n" + " uib-tooltip-classes\n" + " ng-class=\"{ in: isOpen() }\">\n" + " <div class=\"tooltip-arrow\"></div>\n" + " <div class=\"tooltip-inner\"\n" + " uib-tooltip-template-transclude=\"contentExp()\"\n" + " tooltip-template-transclude-scope=\"originScope()\"></div>\n" + "</div>\n" + ""); }]); angular.module("uib/template/popover/popover-html.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/popover/popover-html.html", "<div class=\"popover\"\n" + " tooltip-animation-class=\"fade\"\n" + " uib-tooltip-classes\n" + " ng-class=\"{ in: isOpen() }\">\n" + " <div class=\"arrow\"></div>\n" + "\n" + " <div class=\"popover-inner\">\n" + " <h3 class=\"popover-title\" ng-bind=\"title\" ng-if=\"title\"></h3>\n" + " <div class=\"popover-content\" ng-bind-html=\"contentExp()\"></div>\n" + " </div>\n" + "</div>\n" + ""); }]); angular.module("uib/template/popover/popover-template.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/popover/popover-template.html", "<div class=\"popover\"\n" + " tooltip-animation-class=\"fade\"\n" + " uib-tooltip-classes\n" + " ng-class=\"{ in: isOpen() }\">\n" + " <div class=\"arrow\"></div>\n" + "\n" + " <div class=\"popover-inner\">\n" + " <h3 class=\"popover-title\" ng-bind=\"title\" ng-if=\"title\"></h3>\n" + " <div class=\"popover-content\"\n" + " uib-tooltip-template-transclude=\"contentExp()\"\n" + " tooltip-template-transclude-scope=\"originScope()\"></div>\n" + " </div>\n" + "</div>\n" + ""); }]); angular.module("uib/template/popover/popover.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/popover/popover.html", "<div class=\"popover\"\n" + " tooltip-animation-class=\"fade\"\n" + " uib-tooltip-classes\n" + " ng-class=\"{ in: isOpen() }\">\n" + " <div class=\"arrow\"></div>\n" + "\n" + " <div class=\"popover-inner\">\n" + " <h3 class=\"popover-title\" ng-bind=\"title\" ng-if=\"title\"></h3>\n" + " <div class=\"popover-content\" ng-bind=\"content\"></div>\n" + " </div>\n" + "</div>\n" + ""); }]); angular.module("uib/template/progressbar/bar.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/progressbar/bar.html", "<div class=\"progress-bar\" ng-class=\"type && 'progress-bar-' + type\" role=\"progressbar\" aria-valuenow=\"{{value}}\" aria-valuemin=\"0\" aria-valuemax=\"{{max}}\" ng-style=\"{width: (percent < 100 ? percent : 100) + '%'}\" aria-valuetext=\"{{percent | number:0}}%\" aria-labelledby=\"{{::title}}\" ng-transclude></div>\n" + ""); }]); angular.module("uib/template/progressbar/progress.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/progressbar/progress.html", "<div class=\"progress\" ng-transclude aria-labelledby=\"{{::title}}\"></div>"); }]); angular.module("uib/template/progressbar/progressbar.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/progressbar/progressbar.html", "<div class=\"progress\">\n" + " <div class=\"progress-bar\" ng-class=\"type && 'progress-bar-' + type\" role=\"progressbar\" aria-valuenow=\"{{value}}\" aria-valuemin=\"0\" aria-valuemax=\"{{max}}\" ng-style=\"{width: (percent < 100 ? percent : 100) + '%'}\" aria-valuetext=\"{{percent | number:0}}%\" aria-labelledby=\"{{::title}}\" ng-transclude></div>\n" + "</div>\n" + ""); }]); angular.module("uib/template/rating/rating.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/rating/rating.html", "<span ng-mouseleave=\"reset()\" ng-keydown=\"onKeydown($event)\" tabindex=\"0\" role=\"slider\" aria-valuemin=\"0\" aria-valuemax=\"{{range.length}}\" aria-valuenow=\"{{value}}\" aria-valuetext=\"{{title}}\">\n" + " <span ng-repeat-start=\"r in range track by $index\" class=\"sr-only\">({{ $index < value ? '*' : ' ' }})</span>\n" + " <i ng-repeat-end ng-mouseenter=\"enter($index + 1)\" ng-click=\"rate($index + 1)\" class=\"glyphicon\" ng-class=\"$index < value && (r.stateOn || 'glyphicon-star') || (r.stateOff || 'glyphicon-star-empty')\" ng-attr-title=\"{{r.title}}\"></i>\n" + "</span>\n" + ""); }]); angular.module("uib/template/tabs/tab.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/tabs/tab.html", "<li ng-class=\"[{active: active, disabled: disabled}, classes]\" class=\"uib-tab nav-item\">\n" + " <a href ng-click=\"select($event)\" class=\"nav-link\" uib-tab-heading-transclude>{{heading}}</a>\n" + "</li>\n" + ""); }]); angular.module("uib/template/tabs/tabset.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/tabs/tabset.html", "<div>\n" + " <ul class=\"nav nav-{{tabset.type || 'tabs'}}\" ng-class=\"{'nav-stacked': vertical, 'nav-justified': justified}\" ng-transclude></ul>\n" + " <div class=\"tab-content\">\n" + " <div class=\"tab-pane\"\n" + " ng-repeat=\"tab in tabset.tabs\"\n" + " ng-class=\"{active: tabset.active === tab.index}\"\n" + " uib-tab-content-transclude=\"tab\">\n" + " </div>\n" + " </div>\n" + "</div>\n" + ""); }]); angular.module("uib/template/timepicker/timepicker.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/timepicker/timepicker.html", "<table class=\"uib-timepicker\">\n" + " <tbody>\n" + " <tr class=\"text-center\" ng-show=\"::showSpinners\">\n" + " <td class=\"uib-increment hours\"><a ng-click=\"incrementHours()\" ng-class=\"{disabled: noIncrementHours()}\" class=\"btn btn-link\" ng-disabled=\"noIncrementHours()\" tabindex=\"{{::tabindex}}\"><span class=\"glyphicon glyphicon-chevron-up\"></span></a></td>\n" + " <td>&nbsp;</td>\n" + " <td class=\"uib-increment minutes\"><a ng-click=\"incrementMinutes()\" ng-class=\"{disabled: noIncrementMinutes()}\" class=\"btn btn-link\" ng-disabled=\"noIncrementMinutes()\" tabindex=\"{{::tabindex}}\"><span class=\"glyphicon glyphicon-chevron-up\"></span></a></td>\n" + " <td ng-show=\"showSeconds\">&nbsp;</td>\n" + " <td ng-show=\"showSeconds\" class=\"uib-increment seconds\"><a ng-click=\"incrementSeconds()\" ng-class=\"{disabled: noIncrementSeconds()}\" class=\"btn btn-link\" ng-disabled=\"noIncrementSeconds()\" tabindex=\"{{::tabindex}}\"><span class=\"glyphicon glyphicon-chevron-up\"></span></a></td>\n" + " <td ng-show=\"showMeridian\"></td>\n" + " </tr>\n" + " <tr>\n" + " <td class=\"form-group uib-time hours\" ng-class=\"{'has-error': invalidHours}\">\n" + " <input style=\"width:50px;\" type=\"text\" placeholder=\"HH\" ng-model=\"hours\" ng-change=\"updateHours()\" class=\"form-control text-center\" ng-readonly=\"::readonlyInput\" maxlength=\"2\" tabindex=\"{{::tabindex}}\" ng-disabled=\"noIncrementHours()\" ng-blur=\"blur()\">\n" + " </td>\n" + " <td class=\"uib-separator\">:</td>\n" + " <td class=\"form-group uib-time minutes\" ng-class=\"{'has-error': invalidMinutes}\">\n" + " <input style=\"width:50px;\" type=\"text\" placeholder=\"MM\" ng-model=\"minutes\" ng-change=\"updateMinutes()\" class=\"form-control text-center\" ng-readonly=\"::readonlyInput\" maxlength=\"2\" tabindex=\"{{::tabindex}}\" ng-disabled=\"noIncrementMinutes()\" ng-blur=\"blur()\">\n" + " </td>\n" + " <td ng-show=\"showSeconds\" class=\"uib-separator\">:</td>\n" + " <td class=\"form-group uib-time seconds\" ng-class=\"{'has-error': invalidSeconds}\" ng-show=\"showSeconds\">\n" + " <input style=\"width:50px;\" type=\"text\" placeholder=\"SS\" ng-model=\"seconds\" ng-change=\"updateSeconds()\" class=\"form-control text-center\" ng-readonly=\"readonlyInput\" maxlength=\"2\" tabindex=\"{{::tabindex}}\" ng-disabled=\"noIncrementSeconds()\" ng-blur=\"blur()\">\n" + " </td>\n" + " <td ng-show=\"showMeridian\" class=\"uib-time am-pm\"><button type=\"button\" ng-class=\"{disabled: noToggleMeridian()}\" class=\"btn btn-default text-center\" ng-click=\"toggleMeridian()\" ng-disabled=\"noToggleMeridian()\" tabindex=\"{{::tabindex}}\">{{meridian}}</button></td>\n" + " </tr>\n" + " <tr class=\"text-center\" ng-show=\"::showSpinners\">\n" + " <td class=\"uib-decrement hours\"><a ng-click=\"decrementHours()\" ng-class=\"{disabled: noDecrementHours()}\" class=\"btn btn-link\" ng-disabled=\"noDecrementHours()\" tabindex=\"{{::tabindex}}\"><span class=\"glyphicon glyphicon-chevron-down\"></span></a></td>\n" + " <td>&nbsp;</td>\n" + " <td class=\"uib-decrement minutes\"><a ng-click=\"decrementMinutes()\" ng-class=\"{disabled: noDecrementMinutes()}\" class=\"btn btn-link\" ng-disabled=\"noDecrementMinutes()\" tabindex=\"{{::tabindex}}\"><span class=\"glyphicon glyphicon-chevron-down\"></span></a></td>\n" + " <td ng-show=\"showSeconds\">&nbsp;</td>\n" + " <td ng-show=\"showSeconds\" class=\"uib-decrement seconds\"><a ng-click=\"decrementSeconds()\" ng-class=\"{disabled: noDecrementSeconds()}\" class=\"btn btn-link\" ng-disabled=\"noDecrementSeconds()\" tabindex=\"{{::tabindex}}\"><span class=\"glyphicon glyphicon-chevron-down\"></span></a></td>\n" + " <td ng-show=\"showMeridian\"></td>\n" + " </tr>\n" + " </tbody>\n" + "</table>\n" + ""); }]); angular.module("uib/template/typeahead/typeahead-match.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/typeahead/typeahead-match.html", "<a href\n" + " tabindex=\"-1\"\n" + " ng-bind-html=\"match.label | uibTypeaheadHighlight:query\"\n" + " ng-attr-title=\"{{match.label}}\"></a>\n" + ""); }]); angular.module("uib/template/typeahead/typeahead-popup.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("uib/template/typeahead/typeahead-popup.html", "<ul class=\"dropdown-menu\" ng-show=\"isOpen() && !moveInProgress\" ng-style=\"{top: position().top+'px', left: position().left+'px'}\" role=\"listbox\" aria-hidden=\"{{!isOpen()}}\">\n" + " <li ng-repeat=\"match in matches track by $index\" ng-class=\"{active: isActive($index) }\" ng-mouseenter=\"selectActive($index)\" ng-click=\"selectMatch($index, $event)\" role=\"option\" id=\"{{::match.id}}\">\n" + " <div uib-typeahead-match index=\"$index\" match=\"match\" query=\"query\" template-url=\"templateUrl\"></div>\n" + " </li>\n" + "</ul>\n" + ""); }]); angular.module('ui.bootstrap.carousel').run(function() {!angular.$$csp().noInlineStyle && !angular.$$uibCarouselCss && angular.element(document).find('head').prepend('<style type="text/css">.ng-animate.item:not(.left):not(.right){-webkit-transition:0s ease-in-out left;transition:0s ease-in-out left}</style>'); angular.$$uibCarouselCss = true; }); angular.module('ui.bootstrap.position').run(function() {!angular.$$csp().noInlineStyle && !angular.$$uibPositionCss && angular.element(document).find('head').prepend('<style type="text/css">.uib-position-measure{display:block !important;visibility:hidden !important;position:absolute !important;top:-9999px !important;left:-9999px !important;}.uib-position-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll;}</style>'); angular.$$uibPositionCss = true; }); angular.module('ui.bootstrap.datepicker').run(function() {!angular.$$csp().noInlineStyle && !angular.$$uibDatepickerCss && angular.element(document).find('head').prepend('<style type="text/css">.uib-datepicker .uib-title{width:100%;}.uib-day button,.uib-month button,.uib-year button{min-width:100%;}.uib-datepicker-popup.dropdown-menu{display:block;float:none;margin:0;}.uib-button-bar{padding:10px 9px 2px;}.uib-left,.uib-right{width:100%}</style>'); angular.$$uibDatepickerCss = true; }); angular.module('ui.bootstrap.tooltip').run(function() {!angular.$$csp().noInlineStyle && !angular.$$uibTooltipCss && angular.element(document).find('head').prepend('<style type="text/css">[uib-tooltip-popup].tooltip.top-left > .tooltip-arrow,[uib-tooltip-popup].tooltip.top-right > .tooltip-arrow,[uib-tooltip-popup].tooltip.bottom-left > .tooltip-arrow,[uib-tooltip-popup].tooltip.bottom-right > .tooltip-arrow,[uib-tooltip-popup].tooltip.left-top > .tooltip-arrow,[uib-tooltip-popup].tooltip.left-bottom > .tooltip-arrow,[uib-tooltip-popup].tooltip.right-top > .tooltip-arrow,[uib-tooltip-popup].tooltip.right-bottom > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.top-left > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.top-right > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.bottom-left > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.bottom-right > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.left-top > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.left-bottom > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.right-top > .tooltip-arrow,[uib-tooltip-html-popup].tooltip.right-bottom > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.top-left > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.top-right > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.bottom-left > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.bottom-right > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.left-top > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.left-bottom > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.right-top > .tooltip-arrow,[uib-tooltip-template-popup].tooltip.right-bottom > .tooltip-arrow,[uib-popover-popup].popover.top-left > .arrow,[uib-popover-popup].popover.top-right > .arrow,[uib-popover-popup].popover.bottom-left > .arrow,[uib-popover-popup].popover.bottom-right > .arrow,[uib-popover-popup].popover.left-top > .arrow,[uib-popover-popup].popover.left-bottom > .arrow,[uib-popover-popup].popover.right-top > .arrow,[uib-popover-popup].popover.right-bottom > .arrow,[uib-popover-html-popup].popover.top-left > .arrow,[uib-popover-html-popup].popover.top-right > .arrow,[uib-popover-html-popup].popover.bottom-left > .arrow,[uib-popover-html-popup].popover.bottom-right > .arrow,[uib-popover-html-popup].popover.left-top > .arrow,[uib-popover-html-popup].popover.left-bottom > .arrow,[uib-popover-html-popup].popover.right-top > .arrow,[uib-popover-html-popup].popover.right-bottom > .arrow,[uib-popover-template-popup].popover.top-left > .arrow,[uib-popover-template-popup].popover.top-right > .arrow,[uib-popover-template-popup].popover.bottom-left > .arrow,[uib-popover-template-popup].popover.bottom-right > .arrow,[uib-popover-template-popup].popover.left-top > .arrow,[uib-popover-template-popup].popover.left-bottom > .arrow,[uib-popover-template-popup].popover.right-top > .arrow,[uib-popover-template-popup].popover.right-bottom > .arrow{top:auto;bottom:auto;left:auto;right:auto;margin:0;}[uib-popover-popup].popover,[uib-popover-html-popup].popover,[uib-popover-template-popup].popover{display:block !important;}</style>'); angular.$$uibTooltipCss = true; }); angular.module('ui.bootstrap.timepicker').run(function() {!angular.$$csp().noInlineStyle && !angular.$$uibTimepickerCss && angular.element(document).find('head').prepend('<style type="text/css">.uib-time input{width:50px;}</style>'); angular.$$uibTimepickerCss = true; }); angular.module('ui.bootstrap.typeahead').run(function() {!angular.$$csp().noInlineStyle && !angular.$$uibTypeaheadCss && angular.element(document).find('head').prepend('<style type="text/css">[uib-typeahead-popup].dropdown-menu{display:block;}</style>'); angular.$$uibTypeaheadCss = true; });
tonytomov/cdnjs
ajax/libs/angular-ui-bootstrap/1.2.5/ui-bootstrap-tpls.js
JavaScript
mit
262,969
/*! * FullCalendar v2.3.1 * Docs & License: http://fullcalendar.io/ * (c) 2015 Adam Shaw */ (function(t){"function"==typeof define&&define.amd?define(["jquery","moment"],t):"object"==typeof exports?module.exports=t(require("jquery"),require("moment")):t(jQuery,moment)})(function(t,e){function n(){var e,n,i,r,s,o=Array.prototype.slice.call(arguments),l={};for(e=0;Pe.length>e;e++){for(n=Pe[e],i=null,r=0;o.length>r;r++)s=o[r][n],t.isPlainObject(s)?i=t.extend(i||{},s):null!=s&&(i=null);null!==i&&(l[n]=i)}return o.unshift({}),o.push(l),t.extend.apply(t,o)}function i(e){var n,i={views:e.views||{}};return t.each(e,function(e,r){"views"!=e&&(t.isPlainObject(r)&&!/(time|duration|interval)$/i.test(e)&&-1==t.inArray(e,Pe)?(n=null,t.each(r,function(t,r){/^(month|week|day|default|basic(Week|Day)?|agenda(Week|Day)?)$/.test(t)?(i.views[t]||(i.views[t]={}),i.views[t][e]=r):(n||(n={}),n[t]=r)}),n&&(i[e]=n)):i[e]=r)}),i}function r(t,e){e.left&&t.css({"border-left-width":1,"margin-left":e.left-1}),e.right&&t.css({"border-right-width":1,"margin-right":e.right-1})}function s(t){t.css({"margin-left":"","margin-right":"","border-left-width":"","border-right-width":""})}function o(){t("body").addClass("fc-not-allowed")}function l(){t("body").removeClass("fc-not-allowed")}function a(e,n,i){var r=Math.floor(n/e.length),s=Math.floor(n-r*(e.length-1)),o=[],l=[],a=[],c=0;u(e),e.each(function(n,i){var u=n===e.length-1?s:r,d=t(i).outerHeight(!0);u>d?(o.push(i),l.push(d),a.push(t(i).height())):c+=d}),i&&(n-=c,r=Math.floor(n/o.length),s=Math.floor(n-r*(o.length-1))),t(o).each(function(e,n){var i=e===o.length-1?s:r,u=l[e],c=a[e],d=i-(u-c);i>u&&t(n).height(d)})}function u(t){t.height("")}function c(e){var n=0;return e.find("> *").each(function(e,i){var r=t(i).outerWidth();r>n&&(n=r)}),n++,e.width(n),n}function d(t,e){return t.height(e).addClass("fc-scroller"),t[0].scrollHeight-1>t[0].clientHeight?!0:(h(t),!1)}function h(t){t.height("").removeClass("fc-scroller")}function f(e){var n=e.css("position"),i=e.parents().filter(function(){var e=t(this);return/(auto|scroll)/.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==n&&i.length?i:t(e[0].ownerDocument||document)}function g(t){var e=t.offset();return{left:e.left,right:e.left+t.outerWidth(),top:e.top,bottom:e.top+t.outerHeight()}}function p(t){var e=t.offset(),n=v(t),i=e.left+E(t,"border-left-width")+n.left,r=e.top+E(t,"border-top-width")+n.top;return{left:i,right:i+t[0].clientWidth,top:r,bottom:r+t[0].clientHeight}}function m(t){var e=t.offset(),n=e.left+E(t,"border-left-width")+E(t,"padding-left"),i=e.top+E(t,"border-top-width")+E(t,"padding-top");return{left:n,right:n+t.width(),top:i,bottom:i+t.height()}}function v(t){var e=t.innerWidth()-t[0].clientWidth,n={left:0,right:0,top:0,bottom:t.innerHeight()-t[0].clientHeight};return y()&&"rtl"==t.css("direction")?n.left=e:n.right=e,n}function y(){return null===Ve&&(Ve=w()),Ve}function w(){var e=t("<div><div/></div>").css({position:"absolute",top:-1e3,left:0,border:0,padding:0,overflow:"scroll",direction:"rtl"}).appendTo("body"),n=e.children(),i=n.offset().left>e.offset().left;return e.remove(),i}function E(t,e){return parseFloat(t.css(e))||0}function S(t){return 1==t.which&&!t.ctrlKey}function b(t,e){var n={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)};return n.left<n.right&&n.top<n.bottom?n:!1}function D(t,e){return{left:Math.min(Math.max(t.left,e.left),e.right),top:Math.min(Math.max(t.top,e.top),e.bottom)}}function C(t){return{left:(t.left+t.right)/2,top:(t.top+t.bottom)/2}}function T(t,e){return{left:t.left-e.left,top:t.top-e.top}}function H(t,e){var n,i,r,s,o=t.start,l=t.end,a=e.start,u=e.end;return l>a&&u>o?(o>=a?(n=o.clone(),r=!0):(n=a.clone(),r=!1),u>=l?(i=l.clone(),s=!0):(i=u.clone(),s=!1),{start:n,end:i,isStart:r,isEnd:s}):void 0}function x(t,n){return e.duration({days:t.clone().stripTime().diff(n.clone().stripTime(),"days"),ms:t.time()-n.time()})}function R(t,n){return e.duration({days:t.clone().stripTime().diff(n.clone().stripTime(),"days")})}function k(t,n,i){return e.duration(Math.round(t.diff(n,i,!0)),i)}function M(t,e){var n,i,r;for(n=0;Ye.length>n&&(i=Ye[n],r=F(i,t,e),!(r>=1&&U(r)));n++);return i}function F(t,n,i){return null!=i?i.diff(n,t,!0):e.isDuration(n)?n.as(t):n.end.diff(n.start,t,!0)}function z(t){return Boolean(t.hours()||t.minutes()||t.seconds()||t.milliseconds())}function G(t){return"[object Date]"===Object.prototype.toString.call(t)||t instanceof Date}function L(t){return/^\d+\:\d+(?:\:\d+\.?(?:\d{3})?)?$/.test(t)}function _(t){var e=function(){};return e.prototype=t,new e}function P(t,e){for(var n in t)A(t,n)&&(e[n]=t[n])}function V(t,e){var n,i,r=["constructor","toString","valueOf"];for(n=0;r.length>n;n++)i=r[n],t[i]!==Object.prototype[i]&&(e[i]=t[i])}function A(t,e){return Ie.call(t,e)}function O(e){return/undefined|null|boolean|number|string/.test(t.type(e))}function N(e,n,i){if(t.isFunction(e)&&(e=[e]),e){var r,s;for(r=0;e.length>r;r++)s=e[r].apply(n,i)||s;return s}}function B(){for(var t=0;arguments.length>t;t++)if(void 0!==arguments[t])return arguments[t]}function Y(t){return(t+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#039;").replace(/"/g,"&quot;").replace(/\n/g,"<br />")}function I(t){return t.replace(/&.*?;/g,"")}function W(e){var n=[];return t.each(e,function(t,e){null!=e&&n.push(t+":"+e)}),n.join(";")}function Z(t){return t.charAt(0).toUpperCase()+t.slice(1)}function j(t,e){return t-e}function U(t){return 0===t%1}function q(t,e){var n=t[e];return function(){return n.apply(t,arguments)}}function $(t,e){var n,i,r,s,o=function(){var l=+new Date-s;e>l&&l>0?n=setTimeout(o,e-l):(n=null,t.apply(r,i),n||(r=i=null))};return function(){r=this,i=arguments,s=+new Date,n||(n=setTimeout(o,e))}}function X(n,i,r){var s,o,l,a,u=n[0],c=1==n.length&&"string"==typeof u;return e.isMoment(u)?(a=e.apply(null,n),Q(u,a)):G(u)||void 0===u?a=e.apply(null,n):(s=!1,o=!1,c?We.test(u)?(u+="-01",n=[u],s=!0,o=!0):(l=Ze.exec(u))&&(s=!l[5],o=!0):t.isArray(u)&&(o=!0),a=i||s?e.utc.apply(e,n):e.apply(null,n),s?(a._ambigTime=!0,a._ambigZone=!0):r&&(o?a._ambigZone=!0:c&&(a.utcOffset?a.utcOffset(u):a.zone(u)))),a._fullCalendar=!0,a}function K(t,n){var i,r,s=!1,o=!1,l=t.length,a=[];for(i=0;l>i;i++)r=t[i],e.isMoment(r)||(r=Le.moment.parseZone(r)),s=s||r._ambigTime,o=o||r._ambigZone,a.push(r);for(i=0;l>i;i++)r=a[i],n||!s||r._ambigTime?o&&!r._ambigZone&&(a[i]=r.clone().stripZone()):a[i]=r.clone().stripTime();return a}function Q(t,e){t._ambigTime?e._ambigTime=!0:e._ambigTime&&(e._ambigTime=!1),t._ambigZone?e._ambigZone=!0:e._ambigZone&&(e._ambigZone=!1)}function J(t,e){t.year(e[0]||0).month(e[1]||0).date(e[2]||0).hours(e[3]||0).minutes(e[4]||0).seconds(e[5]||0).milliseconds(e[6]||0)}function te(t,e){return Ue.format.call(t,e)}function ee(t,e){return ne(t,le(e))}function ne(t,e){var n,i="";for(n=0;e.length>n;n++)i+=ie(t,e[n]);return i}function ie(t,e){var n,i;return"string"==typeof e?e:(n=e.token)?qe[n]?qe[n](t):te(t,n):e.maybe&&(i=ne(t,e.maybe),i.match(/[1-9]/))?i:""}function re(t,e,n,i,r){var s;return t=Le.moment.parseZone(t),e=Le.moment.parseZone(e),s=(t.localeData||t.lang).call(t),n=s.longDateFormat(n)||n,i=i||" - ",se(t,e,le(n),i,r)}function se(t,e,n,i,r){var s,o,l,a,u="",c="",d="",h="",f="";for(o=0;n.length>o&&(s=oe(t,e,n[o]),s!==!1);o++)u+=s;for(l=n.length-1;l>o&&(s=oe(t,e,n[l]),s!==!1);l--)c=s+c;for(a=o;l>=a;a++)d+=ie(t,n[a]),h+=ie(e,n[a]);return(d||h)&&(f=r?h+i+d:d+i+h),u+f+c}function oe(t,e,n){var i,r;return"string"==typeof n?n:(i=n.token)&&(r=$e[i.charAt(0)],r&&t.isSame(e,r))?te(t,i):!1}function le(t){return t in Xe?Xe[t]:Xe[t]=ae(t)}function ae(t){for(var e,n=[],i=/\[([^\]]*)\]|\(([^\)]*)\)|(LTS|LT|(\w)\4*o?)|([^\w\[\(]+)/g;e=i.exec(t);)e[1]?n.push(e[1]):e[2]?n.push({maybe:ae(e[2])}):e[3]?n.push({token:e[3]}):e[5]&&n.push(e[5]);return n}function ue(){}function ce(t,e){return t||e?t&&e?t.grid===e.grid&&t.row===e.row&&t.col===e.col:!1:!0}function de(t){var e=fe(t);return"background"===e||"inverse-background"===e}function he(t){return"inverse-background"===fe(t)}function fe(t){return B((t.source||{}).rendering,t.rendering)}function ge(t){var e,n,i={};for(e=0;t.length>e;e++)n=t[e],(i[n._id]||(i[n._id]=[])).push(n);return i}function pe(t,e){return t.eventStartMS-e.eventStartMS}function me(t,e){return t.eventStartMS-e.eventStartMS||e.eventDurationMS-t.eventDurationMS||e.event.allDay-t.event.allDay||(t.event.title||"").localeCompare(e.event.title)}function ve(n){var i,r,s,o,l=Le.dataAttrPrefix;return l&&(l+="-"),i=n.data(l+"event")||null,i&&(i="object"==typeof i?t.extend({},i):{},r=i.start,null==r&&(r=i.time),s=i.duration,o=i.stick,delete i.start,delete i.time,delete i.duration,delete i.stick),null==r&&(r=n.data(l+"start")),null==r&&(r=n.data(l+"time")),null==s&&(s=n.data(l+"duration")),null==o&&(o=n.data(l+"stick")),r=null!=r?e.duration(r):null,s=null!=s?e.duration(s):null,o=Boolean(o),{eventProps:i,startTime:r,duration:s,stick:o}}function ye(t,e){var n,i;for(n=0;e.length>n;n++)if(i=e[n],i.leftCol<=t.rightCol&&i.rightCol>=t.leftCol)return!0;return!1}function we(t,e){return t.leftCol-e.leftCol}function Ee(t){var e,n,i;if(t.sort(me),e=Se(t),be(e),n=e[0]){for(i=0;n.length>i;i++)De(n[i]);for(i=0;n.length>i;i++)Ce(n[i],0,0)}}function Se(t){var e,n,i,r=[];for(e=0;t.length>e;e++){for(n=t[e],i=0;r.length>i&&Te(n,r[i]).length;i++);n.level=i,(r[i]||(r[i]=[])).push(n)}return r}function be(t){var e,n,i,r,s;for(e=0;t.length>e;e++)for(n=t[e],i=0;n.length>i;i++)for(r=n[i],r.forwardSegs=[],s=e+1;t.length>s;s++)Te(r,t[s],r.forwardSegs)}function De(t){var e,n,i=t.forwardSegs,r=0;if(void 0===t.forwardPressure){for(e=0;i.length>e;e++)n=i[e],De(n),r=Math.max(r,1+n.forwardPressure);t.forwardPressure=r}}function Ce(t,e,n){var i,r=t.forwardSegs;if(void 0===t.forwardCoord)for(r.length?(r.sort(xe),Ce(r[0],e+1,n),t.forwardCoord=r[0].backwardCoord):t.forwardCoord=1,t.backwardCoord=t.forwardCoord-(t.forwardCoord-n)/(e+1),i=0;r.length>i;i++)Ce(r[i],0,t.forwardCoord)}function Te(t,e,n){n=n||[];for(var i=0;e.length>i;i++)He(t,e[i])&&n.push(e[i]);return n}function He(t,e){return t.bottom>e.top&&t.top<e.bottom}function xe(t,e){return e.forwardPressure-t.forwardPressure||(t.backwardCoord||0)-(e.backwardCoord||0)||me(t,e)}function Re(n,i){function r(){j?l()&&(c(),a()):s()}function s(){U=B.theme?"ui":"fc",n.addClass("fc"),B.isRTL?n.addClass("fc-rtl"):n.addClass("fc-ltr"),B.theme?n.addClass("ui-widget"):n.addClass("fc-unthemed"),j=t("<div class='fc-view-container'/>").prependTo(n),W=N.header=new Fe(N,B),Z=W.render(),Z&&n.prepend(Z),a(B.defaultView),B.handleWindowResize&&(K=$(h,B.windowResizeDelay),t(window).resize(K))}function o(){q&&q.removeElement(),W.destroy(),j.remove(),n.removeClass("fc fc-ltr fc-rtl fc-unthemed ui-widget"),K&&t(window).unbind("resize",K)}function l(){return n.is(":visible")}function a(e){ie++,q&&e&&q.type!==e&&(W.deactivateButton(q.type),G(),q.removeElement(),q=N.view=null),!q&&e&&(q=N.view=ne[e]||(ne[e]=N.instantiateView(e)),q.setElement(t("<div class='fc-view fc-"+e+"-view' />").appendTo(j)),W.activateButton(e)),q&&(Q=q.massageCurrentDate(Q),q.isDisplayed&&Q.isWithin(q.intervalStart,q.intervalEnd)||l()&&(G(),q.display(Q),L(),E(),S(),m())),L(),ie--}function u(t){return l()?(t&&d(),ie++,q.updateSize(!0),ie--,!0):void 0}function c(){l()&&d()}function d(){X="number"==typeof B.contentHeight?B.contentHeight:"number"==typeof B.height?B.height-(Z?Z.outerHeight(!0):0):Math.round(j.width()/Math.max(B.aspectRatio,.5))}function h(t){!ie&&t.target===window&&q.start&&u(!0)&&q.trigger("windowResize",ee)}function f(){p(),v()}function g(){l()&&(G(),q.displayEvents(re),L())}function p(){G(),q.clearEvents(),L()}function m(){!B.lazyFetching||J(q.start,q.end)?v():g()}function v(){te(q.start,q.end)}function y(t){re=t,g()}function w(){g()}function E(){W.updateTitle(q.title)}function S(){var t=N.getNow();t.isWithin(q.intervalStart,q.intervalEnd)?W.disableButton("today"):W.enableButton("today")}function b(t,e){t=N.moment(t),e=e?N.moment(e):t.hasTime()?t.clone().add(N.defaultTimedEventDuration):t.clone().add(N.defaultAllDayEventDuration),q.select({start:t,end:e})}function D(){q&&q.unselect()}function C(){Q=q.computePrevDate(Q),a()}function T(){Q=q.computeNextDate(Q),a()}function H(){Q.add(-1,"years"),a()}function x(){Q.add(1,"years"),a()}function R(){Q=N.getNow(),a()}function k(t){Q=N.moment(t),a()}function M(t){Q.add(e.duration(t)),a()}function F(t,e){var n;e=e||"day",n=N.getViewSpec(e)||N.getUnitViewSpec(e),Q=t,a(n?n.type:null)}function z(){return Q.clone()}function G(){j.css({width:"100%",height:j.height(),overflow:"hidden"})}function L(){j.css({width:"",height:"",overflow:""})}function P(){return N}function V(){return q}function A(t,e){return void 0===e?B[t]:(("height"==t||"contentHeight"==t||"aspectRatio"==t)&&(B[t]=e,u(!0)),void 0)}function O(t,e){return B[t]?B[t].apply(e||ee,Array.prototype.slice.call(arguments,2)):void 0}var N=this;N.initOptions(i||{});var B=this.options;N.render=r,N.destroy=o,N.refetchEvents=f,N.reportEvents=y,N.reportEventChange=w,N.rerenderEvents=g,N.changeView=a,N.select=b,N.unselect=D,N.prev=C,N.next=T,N.prevYear=H,N.nextYear=x,N.today=R,N.gotoDate=k,N.incrementDate=M,N.zoomTo=F,N.getDate=z,N.getCalendar=P,N.getView=V,N.option=A,N.trigger=O;var Y=_(Me(B.lang));if(B.monthNames&&(Y._months=B.monthNames),B.monthNamesShort&&(Y._monthsShort=B.monthNamesShort),B.dayNames&&(Y._weekdays=B.dayNames),B.dayNamesShort&&(Y._weekdaysShort=B.dayNamesShort),null!=B.firstDay){var I=_(Y._week);I.dow=B.firstDay,Y._week=I}Y._fullCalendar_weekCalc=function(t){return"function"==typeof t?t:"local"===t?t:"iso"===t||"ISO"===t?"ISO":void 0}(B.weekNumberCalculation),N.defaultAllDayEventDuration=e.duration(B.defaultAllDayEventDuration),N.defaultTimedEventDuration=e.duration(B.defaultTimedEventDuration),N.moment=function(){var t;return"local"===B.timezone?(t=Le.moment.apply(null,arguments),t.hasTime()&&t.local()):t="UTC"===B.timezone?Le.moment.utc.apply(null,arguments):Le.moment.parseZone.apply(null,arguments),"_locale"in t?t._locale=Y:t._lang=Y,t},N.getIsAmbigTimezone=function(){return"local"!==B.timezone&&"UTC"!==B.timezone},N.rezoneDate=function(t){return N.moment(t.toArray())},N.getNow=function(){var t=B.now;return"function"==typeof t&&(t=t()),N.moment(t)},N.getEventEnd=function(t){return t.end?t.end.clone():N.getDefaultEventEnd(t.allDay,t.start)},N.getDefaultEventEnd=function(t,e){var n=e.clone();return t?n.stripTime().add(N.defaultAllDayEventDuration):n.add(N.defaultTimedEventDuration),N.getIsAmbigTimezone()&&n.stripZone(),n},N.humanizeDuration=function(t){return(t.locale||t.lang).call(t,B.lang).humanize()},ze.call(N,B);var W,Z,j,U,q,X,K,Q,J=N.isFetchNeeded,te=N.fetchEvents,ee=n[0],ne={},ie=0,re=[];Q=null!=B.defaultDate?N.moment(B.defaultDate):N.getNow(),N.getSuggestedViewHeight=function(){return void 0===X&&c(),X},N.isHeightAuto=function(){return"auto"===B.contentHeight||"auto"===B.height}}function ke(e){t.each(fn,function(t,n){null==e[t]&&(e[t]=n(e))})}function Me(t){var n=e.localeData||e.langData;return n.call(e,t)||n.call(e,"en")}function Fe(e,n){function i(){var e=n.header;return f=n.theme?"ui":"fc",e?g=t("<div class='fc-toolbar'/>").append(s("left")).append(s("right")).append(s("center")).append('<div class="fc-clear"/>'):void 0}function r(){g.remove()}function s(i){var r=t('<div class="fc-'+i+'"/>'),s=n.header[i];return s&&t.each(s.split(" "),function(){var i,s=t(),o=!0;t.each(this.split(","),function(i,r){var l,a,u,c,d,h,g,m,v;"title"==r?(s=s.add(t("<h2>&nbsp;</h2>")),o=!1):(l=e.getViewSpec(r),l?(a=function(){e.changeView(r)},p.push(r),u=l.buttonTextOverride,c=l.buttonTextDefault):e[r]&&(a=function(){e[r]()},u=(e.overrides.buttonText||{})[r],c=n.buttonText[r]),a&&(d=n.themeButtonIcons[r],h=n.buttonIcons[r],g=u?Y(u):d&&n.theme?"<span class='ui-icon ui-icon-"+d+"'></span>":h&&!n.theme?"<span class='fc-icon fc-icon-"+h+"'></span>":Y(c),m=["fc-"+r+"-button",f+"-button",f+"-state-default"],v=t('<button type="button" class="'+m.join(" ")+'">'+g+"</button>").click(function(){v.hasClass(f+"-state-disabled")||(a(),(v.hasClass(f+"-state-active")||v.hasClass(f+"-state-disabled"))&&v.removeClass(f+"-state-hover"))}).mousedown(function(){v.not("."+f+"-state-active").not("."+f+"-state-disabled").addClass(f+"-state-down")}).mouseup(function(){v.removeClass(f+"-state-down")}).hover(function(){v.not("."+f+"-state-active").not("."+f+"-state-disabled").addClass(f+"-state-hover")},function(){v.removeClass(f+"-state-hover").removeClass(f+"-state-down")}),s=s.add(v)))}),o&&s.first().addClass(f+"-corner-left").end().last().addClass(f+"-corner-right").end(),s.length>1?(i=t("<div/>"),o&&i.addClass("fc-button-group"),i.append(s),r.append(i)):r.append(s)}),r}function o(t){g.find("h2").text(t)}function l(t){g.find(".fc-"+t+"-button").addClass(f+"-state-active")}function a(t){g.find(".fc-"+t+"-button").removeClass(f+"-state-active")}function u(t){g.find(".fc-"+t+"-button").attr("disabled","disabled").addClass(f+"-state-disabled")}function c(t){g.find(".fc-"+t+"-button").removeAttr("disabled").removeClass(f+"-state-disabled")}function d(){return p}var h=this;h.render=i,h.destroy=r,h.updateTitle=o,h.activateButton=l,h.deactivateButton=a,h.disableButton=u,h.enableButton=c,h.getViewsWithButtons=d;var f,g=t(),p=[]}function ze(n){function i(t,e){return!W||t.clone().stripZone()<W.clone().stripZone()||e.clone().stripZone()>Z.clone().stripZone()}function r(t,e){W=t,Z=e,te=[];var n=++K,i=X.length;Q=i;for(var r=0;i>r;r++)s(X[r],n)}function s(e,n){o(e,function(i){var r,s,o,l=t.isArray(e.events);if(n==K){if(i)for(r=0;i.length>r;r++)s=i[r],o=l?s:E(s,e),o&&te.push.apply(te,T(o));Q--,Q||q(te)}})}function o(e,i){var r,s,l=Le.sourceFetchers;for(r=0;l.length>r;r++){if(s=l[r].call(I,e,W.clone(),Z.clone(),n.timezone,i),s===!0)return;if("object"==typeof s)return o(s,i),void 0}var a=e.events;if(a)t.isFunction(a)?(y(),a.call(I,W.clone(),Z.clone(),n.timezone,function(t){i(t),w()})):t.isArray(a)?i(a):i();else{var u=e.url;if(u){var c,d=e.success,h=e.error,f=e.complete;c=t.isFunction(e.data)?e.data():e.data;var g=t.extend({},c||{}),p=B(e.startParam,n.startParam),m=B(e.endParam,n.endParam),v=B(e.timezoneParam,n.timezoneParam);p&&(g[p]=W.format()),m&&(g[m]=Z.format()),n.timezone&&"local"!=n.timezone&&(g[v]=n.timezone),y(),t.ajax(t.extend({},gn,e,{data:g,success:function(e){e=e||[];var n=N(d,this,arguments);t.isArray(n)&&(e=n),i(e)},error:function(){N(h,this,arguments),i()},complete:function(){N(f,this,arguments),w()}}))}else i()}}function l(t){var e=a(t);e&&(X.push(e),Q++,s(e,K))}function a(e){var n,i,r=Le.sourceNormalizers;if(t.isFunction(e)||t.isArray(e)?n={events:e}:"string"==typeof e?n={url:e}:"object"==typeof e&&(n=t.extend({},e)),n){for(n.className?"string"==typeof n.className&&(n.className=n.className.split(/\s+/)):n.className=[],t.isArray(n.events)&&(n.origArray=n.events,n.events=t.map(n.events,function(t){return E(t,n)})),i=0;r.length>i;i++)r[i].call(I,n);return n}}function u(e){X=t.grep(X,function(t){return!c(t,e)}),te=t.grep(te,function(t){return!c(t.source,e)}),q(te)}function c(t,e){return t&&e&&d(t)==d(e)}function d(t){return("object"==typeof t?t.origArray||t.googleCalendarId||t.url||t.events:null)||t}function h(t){t.start=I.moment(t.start),t.end=t.end?I.moment(t.end):null,H(t,f(t)),q(te)}function f(e){var n={};return t.each(e,function(t,e){g(t)&&void 0!==e&&O(e)&&(n[t]=e)}),n}function g(t){return!/^_|^(id|allDay|start|end)$/.test(t)}function p(t,e){var n,i,r,s=E(t);if(s){for(n=T(s),i=0;n.length>i;i++)r=n[i],r.source||(e&&($.events.push(r),r.source=$),te.push(r));return q(te),n}return[]}function m(e){var n,i;for(null==e?e=function(){return!0}:t.isFunction(e)||(n=e+"",e=function(t){return t._id==n}),te=t.grep(te,e,!0),i=0;X.length>i;i++)t.isArray(X[i].events)&&(X[i].events=t.grep(X[i].events,e,!0));q(te)}function v(e){return t.isFunction(e)?t.grep(te,e):null!=e?(e+="",t.grep(te,function(t){return t._id==e})):te}function y(){J++||j("loading",null,!0,U())}function w(){--J||j("loading",null,!1,U())}function E(i,r){var s,o,l,a={};if(n.eventDataTransform&&(i=n.eventDataTransform(i)),r&&r.eventDataTransform&&(i=r.eventDataTransform(i)),t.extend(a,i),r&&(a.source=r),a._id=i._id||(void 0===i.id?"_fc"+pn++:i.id+""),a.className=i.className?"string"==typeof i.className?i.className.split(/\s+/):i.className:[],s=i.start||i.date,o=i.end,L(s)&&(s=e.duration(s)),L(o)&&(o=e.duration(o)),i.dow||e.isDuration(s)||e.isDuration(o))a.start=s?e.duration(s):null,a.end=o?e.duration(o):null,a._recurring=!0;else{if(s&&(s=I.moment(s),!s.isValid()))return!1;o&&(o=I.moment(o),o.isValid()||(o=null)),l=i.allDay,void 0===l&&(l=B(r?r.allDayDefault:void 0,n.allDayDefault)),S(s,o,l,a)}return a}function S(t,e,n,i){i.start=t,i.end=e,i.allDay=n,b(i),Ge(i)}function b(t){D(t),t.end&&!t.end.isAfter(t.start)&&(t.end=null),t.end||(t.end=n.forceEventDuration?I.getDefaultEventEnd(t.allDay,t.start):null)}function D(t){null==t.allDay&&(t.allDay=!(t.start.hasTime()||t.end&&t.end.hasTime())),t.allDay?(t.start.stripTime(),t.end&&t.end.stripTime()):(t.start.hasTime()||(t.start=I.rezoneDate(t.start)),t.end&&!t.end.hasTime()&&(t.end=I.rezoneDate(t.end)))}function C(e){var n;return e.end||(n=e.allDay,null==n&&(n=!e.start.hasTime()),e=t.extend({},e),e.end=I.getDefaultEventEnd(n,e.start)),e}function T(e,n,i){var r,s,o,l,a,u,c,d,h,f=[];if(n=n||W,i=i||Z,e)if(e._recurring){if(s=e.dow)for(r={},o=0;s.length>o;o++)r[s[o]]=!0;for(l=n.clone().stripTime();l.isBefore(i);)(!r||r[l.day()])&&(a=e.start,u=e.end,c=l.clone(),d=null,a&&(c=c.time(a)),u&&(d=l.clone().time(u)),h=t.extend({},e),S(c,d,!a&&!u,h),f.push(h)),l.add(1,"days")}else f.push(e);return f}function H(e,n,i){function r(t,e){return i?k(t,e,i):n.allDay?R(t,e):x(t,e)}var s,o,l,a,u,c,d={};return n=n||{},n.start||(n.start=e.start.clone()),void 0===n.end&&(n.end=e.end?e.end.clone():null),null==n.allDay&&(n.allDay=e.allDay),b(n),s={start:e._start.clone(),end:e._end?e._end.clone():I.getDefaultEventEnd(e._allDay,e._start),allDay:n.allDay},b(s),o=null!==e._end&&null===n.end,l=r(n.start,s.start),n.end?(a=r(n.end,s.end),u=a.subtract(l)):u=null,t.each(n,function(t,e){g(t)&&void 0!==e&&(d[t]=e)}),c=M(v(e._id),o,n.allDay,l,u,d),{dateDelta:l,durationDelta:u,undo:c}}function M(e,n,i,r,s,o){var l=I.getIsAmbigTimezone(),a=[];return r&&!r.valueOf()&&(r=null),s&&!s.valueOf()&&(s=null),t.each(e,function(e,u){var c,d;c={start:u.start.clone(),end:u.end?u.end.clone():null,allDay:u.allDay},t.each(o,function(t){c[t]=u[t]}),d={start:u._start,end:u._end,allDay:i},b(d),n?d.end=null:s&&!d.end&&(d.end=I.getDefaultEventEnd(d.allDay,d.start)),r&&(d.start.add(r),d.end&&d.end.add(r)),s&&d.end.add(s),l&&!d.allDay&&(r||s)&&(d.start.stripZone(),d.end&&d.end.stripZone()),t.extend(u,o,d),Ge(u),a.push(function(){t.extend(u,c),Ge(u)})}),function(){for(var t=0;a.length>t;t++)a[t]()}}function F(e){var i,r=n.businessHours,s={className:"fc-nonbusiness",start:"09:00",end:"17:00",dow:[1,2,3,4,5],rendering:"inverse-background"},o=I.getView();return r&&(i=t.extend({},s,"object"==typeof r?r:{})),i?(e&&(i.start=null,i.end=null),T(E(i),o.start,o.end)):[]}function z(t,e){var i=e.source||{},r=B(e.constraint,i.constraint,n.eventConstraint),s=B(e.overlap,i.overlap,n.eventOverlap);return t=C(t),P(t,r,s,e)}function G(t){return P(t,n.selectConstraint,n.selectOverlap)}function _(e,n){var i,r;return n&&(i=t.extend({},n,e),r=T(E(i))[0]),r?z(e,r):(e=C(e),G(e))}function P(e,n,i,r){var s,o,l,a,u,c;if(e=t.extend({},e),e.start=e.start.clone().stripZone(),e.end=e.end.clone().stripZone(),null!=n){for(s=V(n),o=!1,a=0;s.length>a;a++)if(A(s[a],e)){o=!0;break}if(!o)return!1}for(l=I.getPeerEvents(r,e),a=0;l.length>a;a++)if(u=l[a],Y(u,e)){if(i===!1)return!1;if("function"==typeof i&&!i(u,r))return!1;if(r){if(c=B(u.overlap,(u.source||{}).overlap),c===!1)return!1;if("function"==typeof c&&!c(r,u))return!1}}return!0}function V(t){return"businessHours"===t?F():"object"==typeof t?T(E(t)):v(t)}function A(t,e){var n=t.start.clone().stripZone(),i=I.getEventEnd(t).stripZone();return e.start>=n&&i>=e.end}function Y(t,e){var n=t.start.clone().stripZone(),i=I.getEventEnd(t).stripZone();return i>e.start&&e.end>n}var I=this;I.isFetchNeeded=i,I.fetchEvents=r,I.addEventSource=l,I.removeEventSource=u,I.updateEvent=h,I.renderEvent=p,I.removeEvents=m,I.clientEvents=v,I.mutateEvent=H,I.normalizeEventRange=b,I.normalizeEventRangeTimes=D,I.ensureVisibleEventRange=C;var W,Z,j=I.trigger,U=I.getView,q=I.reportEvents,$={events:[]},X=[$],K=0,Q=0,J=0,te=[];t.each((n.events?[n.events]:[]).concat(n.eventSources||[]),function(t,e){var n=a(e);n&&X.push(n)}),I.getBusinessHoursEvents=F,I.isEventRangeAllowed=z,I.isSelectionRangeAllowed=G,I.isExternalDropRangeAllowed=_,I.getEventCache=function(){return te}}function Ge(t){t._allDay=t.allDay,t._start=t.start.clone(),t._end=t.end?t.end.clone():null}var Le=t.fullCalendar={version:"2.3.1"},_e=Le.views={};t.fn.fullCalendar=function(e){var n=Array.prototype.slice.call(arguments,1),i=this;return this.each(function(r,s){var o,l=t(s),a=l.data("fullCalendar");"string"==typeof e?a&&t.isFunction(a[e])&&(o=a[e].apply(a,n),r||(i=o),"destroy"===e&&l.removeData("fullCalendar")):a||(a=new Le.CalendarBase(l,e),l.data("fullCalendar",a),a.render())}),i};var Pe=["header","buttonText","buttonIcons","themeButtonIcons"];Le.intersectionToSeg=H,Le.applyAll=N,Le.debounce=$,Le.isInt=U,Le.htmlEscape=Y,Le.cssToStr=W,Le.proxy=q,Le.getClientRect=p,Le.getContentRect=m,Le.getScrollbarWidths=v;var Ve=null;Le.computeIntervalUnit=M,Le.durationHasTime=z;var Ae,Oe,Ne,Be=["sun","mon","tue","wed","thu","fri","sat"],Ye=["year","month","week","day","hour","minute","second","millisecond"],Ie={}.hasOwnProperty,We=/^\s*\d{4}-\d\d$/,Ze=/^\s*\d{4}-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?)?$/,je=e.fn,Ue=t.extend({},je);Le.moment=function(){return X(arguments)},Le.moment.utc=function(){var t=X(arguments,!0);return t.hasTime()&&t.utc(),t},Le.moment.parseZone=function(){return X(arguments,!0,!0)},je.clone=function(){var t=Ue.clone.apply(this,arguments);return Q(this,t),this._fullCalendar&&(t._fullCalendar=!0),t},je.week=je.weeks=function(t){var e=(this._locale||this._lang)._fullCalendar_weekCalc;return null==t&&"function"==typeof e?e(this):"ISO"===e?Ue.isoWeek.apply(this,arguments):Ue.week.apply(this,arguments)},je.time=function(t){if(!this._fullCalendar)return Ue.time.apply(this,arguments);if(null==t)return e.duration({hours:this.hours(),minutes:this.minutes(),seconds:this.seconds(),milliseconds:this.milliseconds()});this._ambigTime=!1,e.isDuration(t)||e.isMoment(t)||(t=e.duration(t));var n=0;return e.isDuration(t)&&(n=24*Math.floor(t.asDays())),this.hours(n+t.hours()).minutes(t.minutes()).seconds(t.seconds()).milliseconds(t.milliseconds())},je.stripTime=function(){var t;return this._ambigTime||(t=this.toArray(),this.utc(),Oe(this,t.slice(0,3)),this._ambigTime=!0,this._ambigZone=!0),this},je.hasTime=function(){return!this._ambigTime},je.stripZone=function(){var t,e;return this._ambigZone||(t=this.toArray(),e=this._ambigTime,this.utc(),Oe(this,t),this._ambigTime=e||!1,this._ambigZone=!0),this},je.hasZone=function(){return!this._ambigZone},je.local=function(){var t=this.toArray(),e=this._ambigZone;return Ue.local.apply(this,arguments),this._ambigTime=!1,this._ambigZone=!1,e&&Ne(this,t),this},je.utc=function(){return Ue.utc.apply(this,arguments),this._ambigTime=!1,this._ambigZone=!1,this},t.each(["zone","utcOffset"],function(t,e){Ue[e]&&(je[e]=function(t){return null!=t&&(this._ambigTime=!1,this._ambigZone=!1),Ue[e].apply(this,arguments)})}),je.format=function(){return this._fullCalendar&&arguments[0]?ee(this,arguments[0]):this._ambigTime?te(this,"YYYY-MM-DD"):this._ambigZone?te(this,"YYYY-MM-DD[T]HH:mm:ss"):Ue.format.apply(this,arguments)},je.toISOString=function(){return this._ambigTime?te(this,"YYYY-MM-DD"):this._ambigZone?te(this,"YYYY-MM-DD[T]HH:mm:ss"):Ue.toISOString.apply(this,arguments)},je.isWithin=function(t,e){var n=K([this,t,e]);return n[0]>=n[1]&&n[0]<n[2]},je.isSame=function(t,e){var n;return this._fullCalendar?e?(n=K([this,t],!0),Ue.isSame.call(n[0],n[1],e)):(t=Le.moment.parseZone(t),Ue.isSame.call(this,t)&&Boolean(this._ambigTime)===Boolean(t._ambigTime)&&Boolean(this._ambigZone)===Boolean(t._ambigZone)):Ue.isSame.apply(this,arguments)},t.each(["isBefore","isAfter"],function(t,e){je[e]=function(t,n){var i;return this._fullCalendar?(i=K([this,t]),Ue[e].call(i[0],i[1],n)):Ue[e].apply(this,arguments)}}),Ae="_d"in e()&&"updateOffset"in e,Oe=Ae?function(t,n){t._d.setTime(Date.UTC.apply(Date,n)),e.updateOffset(t,!1)}:J,Ne=Ae?function(t,n){t._d.setTime(+new Date(n[0]||0,n[1]||0,n[2]||0,n[3]||0,n[4]||0,n[5]||0,n[6]||0)),e.updateOffset(t,!1)}:J;var qe={t:function(t){return te(t,"a").charAt(0)},T:function(t){return te(t,"A").charAt(0)}};Le.formatRange=re;var $e={Y:"year",M:"month",D:"day",d:"day",A:"second",a:"second",T:"second",t:"second",H:"second",h:"second",m:"second",s:"second"},Xe={};Le.Class=ue,ue.extend=function(t){var e,n=this;return t=t||{},A(t,"constructor")&&(e=t.constructor),"function"!=typeof e&&(e=t.constructor=function(){n.apply(this,arguments)}),e.prototype=_(n.prototype),P(t,e.prototype),V(t,e.prototype),P(n,e),e},ue.mixin=function(t){P(t.prototype||t,this.prototype)};var Ke=ue.extend({isHidden:!0,options:null,el:null,documentMousedownProxy:null,margin:10,constructor:function(t){this.options=t||{}},show:function(){this.isHidden&&(this.el||this.render(),this.el.show(),this.position(),this.isHidden=!1,this.trigger("show"))},hide:function(){this.isHidden||(this.el.hide(),this.isHidden=!0,this.trigger("hide"))},render:function(){var e=this,n=this.options;this.el=t('<div class="fc-popover"/>').addClass(n.className||"").css({top:0,left:0}).append(n.content).appendTo(n.parentEl),this.el.on("click",".fc-close",function(){e.hide()}),n.autoHide&&t(document).on("mousedown",this.documentMousedownProxy=q(this,"documentMousedown"))},documentMousedown:function(e){this.el&&!t(e.target).closest(this.el).length&&this.hide()},destroy:function(){this.hide(),this.el&&(this.el.remove(),this.el=null),t(document).off("mousedown",this.documentMousedownProxy)},position:function(){var e,n,i,r,s,o=this.options,l=this.el.offsetParent().offset(),a=this.el.outerWidth(),u=this.el.outerHeight(),c=t(window),d=f(this.el);r=o.top||0,s=void 0!==o.left?o.left:void 0!==o.right?o.right-a:0,d.is(window)||d.is(document)?(d=c,e=0,n=0):(i=d.offset(),e=i.top,n=i.left),e+=c.scrollTop(),n+=c.scrollLeft(),o.viewportConstrain!==!1&&(r=Math.min(r,e+d.outerHeight()-u-this.margin),r=Math.max(r,e+this.margin),s=Math.min(s,n+d.outerWidth()-a-this.margin),s=Math.max(s,n+this.margin)),this.el.css({top:r-l.top,left:s-l.left})},trigger:function(t){this.options[t]&&this.options[t].apply(this,Array.prototype.slice.call(arguments,1))}}),Qe=ue.extend({grid:null,rowCoords:null,colCoords:null,containerEl:null,bounds:null,constructor:function(t){this.grid=t},build:function(){this.rowCoords=this.grid.computeRowCoords(),this.colCoords=this.grid.computeColCoords(),this.computeBounds()},clear:function(){this.rowCoords=null,this.colCoords=null},getCell:function(e,n){var i,r,s,o=this.rowCoords,l=o.length,a=this.colCoords,u=a.length,c=null,d=null;if(this.inBounds(e,n)){for(i=0;l>i;i++)if(r=o[i],n>=r.top&&r.bottom>n){c=i;break}for(i=0;u>i;i++)if(r=a[i],e>=r.left&&r.right>e){d=i;break}if(null!==c&&null!==d)return s=this.grid.getCell(c,d),s.grid=this.grid,t.extend(s,o[c],a[d]),s}return null},computeBounds:function(){this.bounds=this.containerEl?p(this.containerEl):null},inBounds:function(t,e){var n=this.bounds;return n?t>=n.left&&n.right>t&&e>=n.top&&n.bottom>e:!0}}),Je=ue.extend({coordMaps:null,constructor:function(t){this.coordMaps=t},build:function(){var t,e=this.coordMaps;for(t=0;e.length>t;t++)e[t].build()},getCell:function(t,e){var n,i=this.coordMaps,r=null;for(n=0;i.length>n&&!r;n++)r=i[n].getCell(t,e);return r},clear:function(){var t,e=this.coordMaps;for(t=0;e.length>t;t++)e[t].clear()}}),tn=Le.DragListener=ue.extend({options:null,isListening:!1,isDragging:!1,originX:null,originY:null,mousemoveProxy:null,mouseupProxy:null,subjectEl:null,subjectHref:null,scrollEl:null,scrollBounds:null,scrollTopVel:null,scrollLeftVel:null,scrollIntervalId:null,scrollHandlerProxy:null,scrollSensitivity:30,scrollSpeed:200,scrollIntervalMs:50,constructor:function(t){t=t||{},this.options=t,this.subjectEl=t.subjectEl },mousedown:function(t){S(t)&&(t.preventDefault(),this.startListening(t),this.options.distance||this.startDrag(t))},startListening:function(e){var n;this.isListening||(e&&this.options.scroll&&(n=f(t(e.target)),n.is(window)||n.is(document)||(this.scrollEl=n,this.scrollHandlerProxy=$(q(this,"scrollHandler"),100),this.scrollEl.on("scroll",this.scrollHandlerProxy))),t(document).on("mousemove",this.mousemoveProxy=q(this,"mousemove")).on("mouseup",this.mouseupProxy=q(this,"mouseup")).on("selectstart",this.preventDefault),e?(this.originX=e.pageX,this.originY=e.pageY):(this.originX=0,this.originY=0),this.isListening=!0,this.listenStart(e))},listenStart:function(t){this.trigger("listenStart",t)},mousemove:function(t){var e,n,i=t.pageX-this.originX,r=t.pageY-this.originY;this.isDragging||(e=this.options.distance||1,n=i*i+r*r,n>=e*e&&this.startDrag(t)),this.isDragging&&this.drag(i,r,t)},startDrag:function(t){this.isListening||this.startListening(),this.isDragging||(this.isDragging=!0,this.dragStart(t))},dragStart:function(t){var e=this.subjectEl;this.trigger("dragStart",t),(this.subjectHref=e?e.attr("href"):null)&&e.removeAttr("href")},drag:function(t,e,n){this.trigger("drag",t,e,n),this.updateScroll(n)},mouseup:function(t){this.stopListening(t)},stopDrag:function(t){this.isDragging&&(this.stopScrolling(),this.dragStop(t),this.isDragging=!1)},dragStop:function(t){var e=this;this.trigger("dragStop",t),setTimeout(function(){e.subjectHref&&e.subjectEl.attr("href",e.subjectHref)},0)},stopListening:function(e){this.stopDrag(e),this.isListening&&(this.scrollEl&&(this.scrollEl.off("scroll",this.scrollHandlerProxy),this.scrollHandlerProxy=null),t(document).off("mousemove",this.mousemoveProxy).off("mouseup",this.mouseupProxy).off("selectstart",this.preventDefault),this.mousemoveProxy=null,this.mouseupProxy=null,this.isListening=!1,this.listenStop(e))},listenStop:function(t){this.trigger("listenStop",t)},trigger:function(t){this.options[t]&&this.options[t].apply(this,Array.prototype.slice.call(arguments,1))},preventDefault:function(t){t.preventDefault()},computeScrollBounds:function(){var t=this.scrollEl;this.scrollBounds=t?g(t):null},updateScroll:function(t){var e,n,i,r,s=this.scrollSensitivity,o=this.scrollBounds,l=0,a=0;o&&(e=(s-(t.pageY-o.top))/s,n=(s-(o.bottom-t.pageY))/s,i=(s-(t.pageX-o.left))/s,r=(s-(o.right-t.pageX))/s,e>=0&&1>=e?l=-1*e*this.scrollSpeed:n>=0&&1>=n&&(l=n*this.scrollSpeed),i>=0&&1>=i?a=-1*i*this.scrollSpeed:r>=0&&1>=r&&(a=r*this.scrollSpeed)),this.setScrollVel(l,a)},setScrollVel:function(t,e){this.scrollTopVel=t,this.scrollLeftVel=e,this.constrainScrollVel(),!this.scrollTopVel&&!this.scrollLeftVel||this.scrollIntervalId||(this.scrollIntervalId=setInterval(q(this,"scrollIntervalFunc"),this.scrollIntervalMs))},constrainScrollVel:function(){var t=this.scrollEl;0>this.scrollTopVel?0>=t.scrollTop()&&(this.scrollTopVel=0):this.scrollTopVel>0&&t.scrollTop()+t[0].clientHeight>=t[0].scrollHeight&&(this.scrollTopVel=0),0>this.scrollLeftVel?0>=t.scrollLeft()&&(this.scrollLeftVel=0):this.scrollLeftVel>0&&t.scrollLeft()+t[0].clientWidth>=t[0].scrollWidth&&(this.scrollLeftVel=0)},scrollIntervalFunc:function(){var t=this.scrollEl,e=this.scrollIntervalMs/1e3;this.scrollTopVel&&t.scrollTop(t.scrollTop()+this.scrollTopVel*e),this.scrollLeftVel&&t.scrollLeft(t.scrollLeft()+this.scrollLeftVel*e),this.constrainScrollVel(),this.scrollTopVel||this.scrollLeftVel||this.stopScrolling()},stopScrolling:function(){this.scrollIntervalId&&(clearInterval(this.scrollIntervalId),this.scrollIntervalId=null,this.scrollStop())},scrollHandler:function(){this.scrollIntervalId||this.scrollStop()},scrollStop:function(){}}),en=tn.extend({coordMap:null,origCell:null,cell:null,coordAdjust:null,constructor:function(t,e){tn.prototype.constructor.call(this,e),this.coordMap=t},listenStart:function(t){var e,n,i,r=this.subjectEl;tn.prototype.listenStart.apply(this,arguments),this.computeCoords(),t?(n={left:t.pageX,top:t.pageY},i=n,r&&(e=g(r),i=D(i,e)),this.origCell=this.getCell(i.left,i.top),r&&this.options.subjectCenter&&(this.origCell&&(e=b(this.origCell,e)||e),i=C(e)),this.coordAdjust=T(i,n)):(this.origCell=null,this.coordAdjust=null)},computeCoords:function(){this.coordMap.build(),this.computeScrollBounds()},dragStart:function(t){var e;tn.prototype.dragStart.apply(this,arguments),e=this.getCell(t.pageX,t.pageY),e&&this.cellOver(e)},drag:function(t,e,n){var i;tn.prototype.drag.apply(this,arguments),i=this.getCell(n.pageX,n.pageY),ce(i,this.cell)||(this.cell&&this.cellOut(),i&&this.cellOver(i))},dragStop:function(){this.cellDone(),tn.prototype.dragStop.apply(this,arguments)},cellOver:function(t){this.cell=t,this.trigger("cellOver",t,ce(t,this.origCell),this.origCell)},cellOut:function(){this.cell&&(this.trigger("cellOut",this.cell),this.cellDone(),this.cell=null)},cellDone:function(){this.cell&&this.trigger("cellDone",this.cell)},listenStop:function(){tn.prototype.listenStop.apply(this,arguments),this.origCell=this.cell=null,this.coordMap.clear()},scrollStop:function(){tn.prototype.scrollStop.apply(this,arguments),this.computeCoords()},getCell:function(t,e){return this.coordAdjust&&(t+=this.coordAdjust.left,e+=this.coordAdjust.top),this.coordMap.getCell(t,e)}}),nn=ue.extend({options:null,sourceEl:null,el:null,parentEl:null,top0:null,left0:null,mouseY0:null,mouseX0:null,topDelta:null,leftDelta:null,mousemoveProxy:null,isFollowing:!1,isHidden:!1,isAnimating:!1,constructor:function(e,n){this.options=n=n||{},this.sourceEl=e,this.parentEl=n.parentEl?t(n.parentEl):e.parent()},start:function(e){this.isFollowing||(this.isFollowing=!0,this.mouseY0=e.pageY,this.mouseX0=e.pageX,this.topDelta=0,this.leftDelta=0,this.isHidden||this.updatePosition(),t(document).on("mousemove",this.mousemoveProxy=q(this,"mousemove")))},stop:function(e,n){function i(){this.isAnimating=!1,r.destroyEl(),this.top0=this.left0=null,n&&n()}var r=this,s=this.options.revertDuration;this.isFollowing&&!this.isAnimating&&(this.isFollowing=!1,t(document).off("mousemove",this.mousemoveProxy),e&&s&&!this.isHidden?(this.isAnimating=!0,this.el.animate({top:this.top0,left:this.left0},{duration:s,complete:i})):i())},getEl:function(){var t=this.el;return t||(this.sourceEl.width(),t=this.el=this.sourceEl.clone().css({position:"absolute",visibility:"",display:this.isHidden?"none":"",margin:0,right:"auto",bottom:"auto",width:this.sourceEl.width(),height:this.sourceEl.height(),opacity:this.options.opacity||"",zIndex:this.options.zIndex}).appendTo(this.parentEl)),t},destroyEl:function(){this.el&&(this.el.remove(),this.el=null)},updatePosition:function(){var t,e;this.getEl(),null===this.top0&&(this.sourceEl.width(),t=this.sourceEl.offset(),e=this.el.offsetParent().offset(),this.top0=t.top-e.top,this.left0=t.left-e.left),this.el.css({top:this.top0+this.topDelta,left:this.left0+this.leftDelta})},mousemove:function(t){this.topDelta=t.pageY-this.mouseY0,this.leftDelta=t.pageX-this.mouseX0,this.isHidden||this.updatePosition()},hide:function(){this.isHidden||(this.isHidden=!0,this.el&&this.el.hide())},show:function(){this.isHidden&&(this.isHidden=!1,this.updatePosition(),this.getEl().show())}}),rn=ue.extend({view:null,isRTL:null,cellHtml:"<td/>",constructor:function(t){this.view=t,this.isRTL=t.opt("isRTL")},rowHtml:function(t,e){var n,i,r=this.getHtmlRenderer("cell",t),s="";for(e=e||0,n=0;this.colCnt>n;n++)i=this.getCell(e,n),s+=r(i);return s=this.bookendCells(s,t,e),"<tr>"+s+"</tr>"},bookendCells:function(t,e,n){var i=this.getHtmlRenderer("intro",e)(n||0),r=this.getHtmlRenderer("outro",e)(n||0),s=this.isRTL?r:i,o=this.isRTL?i:r;return"string"==typeof t?s+t+o:t.prepend(s).append(o)},getHtmlRenderer:function(t,e){var n,i,r,s,o=this.view;return n=t+"Html",e&&(i=e+Z(t)+"Html"),i&&(s=o[i])?r=o:i&&(s=this[i])?r=this:(s=o[n])?r=o:(s=this[n])&&(r=this),"function"==typeof s?function(){return s.apply(r,arguments)||""}:function(){return s||""}}}),sn=Le.Grid=rn.extend({start:null,end:null,rowCnt:0,colCnt:0,rowData:null,colData:null,el:null,coordMap:null,elsByFill:null,externalDragStartProxy:null,colHeadFormat:null,eventTimeFormat:null,displayEventTime:null,displayEventEnd:null,cellDuration:null,largeUnit:null,constructor:function(){rn.apply(this,arguments),this.coordMap=new Qe(this),this.elsByFill={},this.externalDragStartProxy=q(this,"externalDragStart")},computeColHeadFormat:function(){},computeEventTimeFormat:function(){return this.view.opt("smallTimeFormat")},computeDisplayEventTime:function(){return!0},computeDisplayEventEnd:function(){return!0},setRange:function(t){var e,n,i=this.view;this.start=t.start.clone(),this.end=t.end.clone(),this.rowData=[],this.colData=[],this.updateCells(),this.colHeadFormat=i.opt("columnFormat")||this.computeColHeadFormat(),this.eventTimeFormat=i.opt("eventTimeFormat")||i.opt("timeFormat")||this.computeEventTimeFormat(),e=i.opt("displayEventTime"),null==e&&(e=this.computeDisplayEventTime()),n=i.opt("displayEventEnd"),null==n&&(n=this.computeDisplayEventEnd()),this.displayEventTime=e,this.displayEventEnd=n},updateCells:function(){},rangeToSegs:function(){},diffDates:function(t,e){return this.largeUnit?k(t,e,this.largeUnit):x(t,e)},getCell:function(e,n){var i;return null==n&&("number"==typeof e?(n=e%this.colCnt,e=Math.floor(e/this.colCnt)):(n=e.col,e=e.row)),i={row:e,col:n},t.extend(i,this.getRowData(e),this.getColData(n)),t.extend(i,this.computeCellRange(i)),i},computeCellRange:function(t){var e=this.computeCellDate(t);return{start:e,end:e.clone().add(this.cellDuration)}},computeCellDate:function(){},getRowData:function(t){return this.rowData[t]||{}},getColData:function(t){return this.colData[t]||{}},getRowEl:function(){},getColEl:function(){},getCellDayEl:function(t){return this.getColEl(t.col)||this.getRowEl(t.row)},computeRowCoords:function(){var t,e,n,i=[];for(t=0;this.rowCnt>t;t++)e=this.getRowEl(t),n=e.offset().top,i.push({top:n,bottom:n+e.outerHeight()});return i},computeColCoords:function(){var t,e,n,i=[];for(t=0;this.colCnt>t;t++)e=this.getColEl(t),n=e.offset().left,i.push({left:n,right:n+e.outerWidth()});return i},setElement:function(e){var n=this;this.el=e,e.on("mousedown",function(e){t(e.target).is(".fc-event-container *, .fc-more")||t(e.target).closest(".fc-popover").length||n.dayMousedown(e)}),this.bindSegHandlers(),this.bindGlobalHandlers()},removeElement:function(){this.unbindGlobalHandlers(),this.el.remove()},renderSkeleton:function(){},renderDates:function(){},destroyDates:function(){},bindGlobalHandlers:function(){t(document).on("dragstart sortstart",this.externalDragStartProxy)},unbindGlobalHandlers:function(){t(document).off("dragstart sortstart",this.externalDragStartProxy)},dayMousedown:function(t){var e,n,i=this,r=this.view,s=r.opt("selectable"),a=new en(this.coordMap,{scroll:r.opt("dragScroll"),dragStart:function(){r.unselect()},cellOver:function(t,r,l){l&&(e=r?t:null,s&&(n=i.computeSelection(l,t),n?i.renderSelection(n):o()))},cellOut:function(){e=null,n=null,i.destroySelection(),l()},listenStop:function(t){e&&r.trigger("dayClick",i.getCellDayEl(e),e.start,t),n&&r.reportSelection(n,t),l()}});a.mousedown(t)},renderRangeHelper:function(t,e){var n=this.fabricateHelperEvent(t,e);this.renderHelper(n,e)},fabricateHelperEvent:function(t,e){var n=e?_(e.event):{};return n.start=t.start.clone(),n.end=t.end?t.end.clone():null,n.allDay=null,this.view.calendar.normalizeEventRange(n),n.className=(n.className||[]).concat("fc-helper"),e||(n.editable=!1),n},renderHelper:function(){},destroyHelper:function(){},renderSelection:function(t){this.renderHighlight(t)},destroySelection:function(){this.destroyHighlight()},computeSelection:function(t,e){var n,i=[t.start,t.end,e.start,e.end];return i.sort(j),n={start:i[0].clone(),end:i[3].clone()},this.view.calendar.isSelectionRangeAllowed(n)?n:null},renderHighlight:function(t){this.renderFill("highlight",this.rangeToSegs(t))},destroyHighlight:function(){this.destroyFill("highlight")},highlightSegClasses:function(){return["fc-highlight"]},renderFill:function(){},destroyFill:function(t){var e=this.elsByFill[t];e&&(e.remove(),delete this.elsByFill[t])},renderFillSegEls:function(e,n){var i,r=this,s=this[e+"SegEl"],o="",l=[];if(n.length){for(i=0;n.length>i;i++)o+=this.fillSegHtml(e,n[i]);t(o).each(function(e,i){var o=n[e],a=t(i);s&&(a=s.call(r,o,a)),a&&(a=t(a),a.is(r.fillSegTag)&&(o.el=a,l.push(o)))})}return l},fillSegTag:"div",fillSegHtml:function(t,e){var n=this[t+"SegClasses"],i=this[t+"SegCss"],r=n?n.call(this,e):[],s=W(i?i.call(this,e):{});return"<"+this.fillSegTag+(r.length?' class="'+r.join(" ")+'"':"")+(s?' style="'+s+'"':"")+" />"},headHtml:function(){return'<div class="fc-row '+this.view.widgetHeaderClass+'">'+"<table>"+"<thead>"+this.rowHtml("head")+"</thead>"+"</table>"+"</div>"},headCellHtml:function(t){var e=this.view,n=t.start;return'<th class="fc-day-header '+e.widgetHeaderClass+" fc-"+Be[n.day()]+'">'+Y(n.format(this.colHeadFormat))+"</th>"},bgCellHtml:function(t){var e=this.view,n=t.start,i=this.getDayClasses(n);return i.unshift("fc-day",e.widgetContentClass),'<td class="'+i.join(" ")+'"'+' data-date="'+n.format("YYYY-MM-DD")+'"'+"></td>"},getDayClasses:function(t){var e=this.view,n=e.calendar.getNow().stripTime(),i=["fc-"+Be[t.day()]];return 1==e.intervalDuration.as("months")&&t.month()!=e.intervalStart.month()&&i.push("fc-other-month"),t.isSame(n,"day")?i.push("fc-today",e.highlightStateClass):n>t?i.push("fc-past"):i.push("fc-future"),i}});sn.mixin({mousedOverSeg:null,isDraggingSeg:!1,isResizingSeg:!1,isDraggingExternal:!1,segs:null,renderEvents:function(t){var e,n,i=this.eventsToSegs(t),r=[],s=[];for(e=0;i.length>e;e++)n=i[e],de(n.event)?r.push(n):s.push(n);r=this.renderBgSegs(r)||r,s=this.renderFgSegs(s)||s,this.segs=r.concat(s)},destroyEvents:function(){this.triggerSegMouseout(),this.destroyFgSegs(),this.destroyBgSegs(),this.segs=null},getEventSegs:function(){return this.segs||[]},renderFgSegs:function(){},destroyFgSegs:function(){},renderFgSegEls:function(e,n){var i,r=this.view,s="",o=[];if(e.length){for(i=0;e.length>i;i++)s+=this.fgSegHtml(e[i],n);t(s).each(function(n,i){var s=e[n],l=r.resolveEventEl(s.event,t(i));l&&(l.data("fc-seg",s),s.el=l,o.push(s))})}return o},fgSegHtml:function(){},renderBgSegs:function(t){return this.renderFill("bgEvent",t)},destroyBgSegs:function(){this.destroyFill("bgEvent")},bgEventSegEl:function(t,e){return this.view.resolveEventEl(t.event,e)},bgEventSegClasses:function(t){var e=t.event,n=e.source||{};return["fc-bgevent"].concat(e.className,n.className||[])},bgEventSegCss:function(t){var e=this.view,n=t.event,i=n.source||{};return{"background-color":n.backgroundColor||n.color||i.backgroundColor||i.color||e.opt("eventBackgroundColor")||e.opt("eventColor")}},businessHoursSegClasses:function(){return["fc-nonbusiness","fc-bgevent"]},bindSegHandlers:function(){var e=this,n=this.view;t.each({mouseenter:function(t,n){e.triggerSegMouseover(t,n)},mouseleave:function(t,n){e.triggerSegMouseout(t,n)},click:function(t,e){return n.trigger("eventClick",this,t.event,e)},mousedown:function(i,r){t(r.target).is(".fc-resizer")&&n.isEventResizable(i.event)?e.segResizeMousedown(i,r,t(r.target).is(".fc-start-resizer")):n.isEventDraggable(i.event)&&e.segDragMousedown(i,r)}},function(n,i){e.el.on(n,".fc-event-container > *",function(n){var r=t(this).data("fc-seg");return!r||e.isDraggingSeg||e.isResizingSeg?void 0:i.call(this,r,n)})})},triggerSegMouseover:function(t,e){this.mousedOverSeg||(this.mousedOverSeg=t,this.view.trigger("eventMouseover",t.el[0],t.event,e))},triggerSegMouseout:function(t,e){e=e||{},this.mousedOverSeg&&(t=t||this.mousedOverSeg,this.mousedOverSeg=null,this.view.trigger("eventMouseout",t.el[0],t.event,e))},segDragMousedown:function(t,e){var n,i=this,r=this.view,s=r.calendar,a=t.el,u=t.event,c=new nn(t.el,{parentEl:r.el,opacity:r.opt("dragOpacity"),revertDuration:r.opt("dragRevertDuration"),zIndex:2}),d=new en(r.coordMap,{distance:5,scroll:r.opt("dragScroll"),subjectEl:a,subjectCenter:!0,listenStart:function(t){c.hide(),c.start(t)},dragStart:function(e){i.triggerSegMouseout(t,e),i.segDragStart(t,e),r.hideEvent(u)},cellOver:function(e,l,a){t.cell&&(a=t.cell),n=i.computeEventDrop(a,e,u),n&&!s.isEventRangeAllowed(n,u)&&(o(),n=null),n&&r.renderDrag(n,t)?c.hide():c.show(),l&&(n=null)},cellOut:function(){r.destroyDrag(),c.show(),n=null},cellDone:function(){l()},dragStop:function(e){c.stop(!n,function(){r.destroyDrag(),r.showEvent(u),i.segDragStop(t,e),n&&r.reportEventDrop(u,n,this.largeUnit,a,e)})},listenStop:function(){c.stop()}});d.mousedown(e)},segDragStart:function(t,e){this.isDraggingSeg=!0,this.view.trigger("eventDragStart",t.el[0],t.event,e,{})},segDragStop:function(t,e){this.isDraggingSeg=!1,this.view.trigger("eventDragStop",t.el[0],t.event,e,{})},computeEventDrop:function(t,e,n){var i,r,s=this.view.calendar,o=t.start,l=e.start;return o.hasTime()===l.hasTime()?(i=this.diffDates(l,o),n.allDay&&z(i)?(r={start:n.start.clone(),end:s.getEventEnd(n),allDay:!1},s.normalizeEventRangeTimes(r)):r={start:n.start.clone(),end:n.end?n.end.clone():null,allDay:n.allDay},r.start.add(i),r.end&&r.end.add(i)):r={start:l.clone(),end:null,allDay:!l.hasTime()},r},applyDragOpacity:function(t){var e=this.view.opt("dragOpacity");null!=e&&t.each(function(t,n){n.style.opacity=e})},externalDragStart:function(e,n){var i,r,s=this.view;s.opt("droppable")&&(i=t((n?n.item:null)||e.target),r=s.opt("dropAccept"),(t.isFunction(r)?r.call(i[0],i):i.is(r))&&(this.isDraggingExternal||this.listenToExternalDrag(i,e,n)))},listenToExternalDrag:function(t,e,n){var i,r,s=this,a=ve(t);i=new en(this.coordMap,{listenStart:function(){s.isDraggingExternal=!0},cellOver:function(t){r=s.computeExternalDrop(t,a),r?s.renderDrag(r):o()},cellOut:function(){r=null,s.destroyDrag(),l()},dragStop:function(){s.destroyDrag(),l(),r&&s.view.reportExternalDrop(a,r,t,e,n)},listenStop:function(){s.isDraggingExternal=!1}}),i.startDrag(e)},computeExternalDrop:function(t,e){var n={start:t.start.clone(),end:null};return e.startTime&&!n.start.hasTime()&&n.start.time(e.startTime),e.duration&&(n.end=n.start.clone().add(e.duration)),this.view.calendar.isExternalDropRangeAllowed(n,e.eventProps)?n:null},renderDrag:function(){},destroyDrag:function(){},segResizeMousedown:function(t,e,n){var i,r,s=this,a=this.view,u=a.calendar,c=t.el,d=t.event,h=u.getEventEnd(d);i=new en(this.coordMap,{distance:5,scroll:a.opt("dragScroll"),subjectEl:c,dragStart:function(e){s.triggerSegMouseout(t,e),s.segResizeStart(t,e)},cellOver:function(e,i,l){r=n?s.computeEventStartResize(l,e,d):s.computeEventEndResize(l,e,d),r&&(u.isEventRangeAllowed(r,d)?r.start.isSame(d.start)&&r.end.isSame(h)&&(r=null):(o(),r=null)),r&&(a.hideEvent(d),s.renderEventResize(r,t))},cellOut:function(){r=null},cellDone:function(){s.destroyEventResize(),a.showEvent(d),l()},dragStop:function(e){s.segResizeStop(t,e),r&&a.reportEventResize(d,r,this.largeUnit,c,e)}}),i.mousedown(e)},segResizeStart:function(t,e){this.isResizingSeg=!0,this.view.trigger("eventResizeStart",t.el[0],t.event,e,{})},segResizeStop:function(t,e){this.isResizingSeg=!1,this.view.trigger("eventResizeStop",t.el[0],t.event,e,{})},computeEventStartResize:function(t,e,n){return this.computeEventResize("start",t,e,n)},computeEventEndResize:function(t,e,n){return this.computeEventResize("end",t,e,n)},computeEventResize:function(t,e,n,i){var r,s,o=this.view.calendar,l=this.diffDates(n[t],e[t]);return r={start:i.start.clone(),end:o.getEventEnd(i),allDay:i.allDay},r.allDay&&z(l)&&(r.allDay=!1,o.normalizeEventRangeTimes(r)),r[t].add(l),r.start.isBefore(r.end)||(s=i.allDay?o.defaultAllDayEventDuration:o.defaultTimedEventDuration,this.cellDuration&&s>this.cellDuration&&(s=this.cellDuration),"start"==t?r.start=r.end.clone().subtract(s):r.end=r.start.clone().add(s)),r},renderEventResize:function(){},destroyEventResize:function(){},getEventTimeText:function(t,e,n){return null==e&&(e=this.eventTimeFormat),null==n&&(n=this.displayEventEnd),this.displayEventTime&&t.start.hasTime()?n&&t.end?this.view.formatRange(t,e):t.start.format(e):""},getSegClasses:function(t,e,n){var i=t.event,r=["fc-event",t.isStart?"fc-start":"fc-not-start",t.isEnd?"fc-end":"fc-not-end"].concat(i.className,i.source?i.source.className:[]);return e&&r.push("fc-draggable"),n&&r.push("fc-resizable"),r},getEventSkinCss:function(t){var e=this.view,n=t.source||{},i=t.color,r=n.color,s=e.opt("eventColor");return{"background-color":t.backgroundColor||i||n.backgroundColor||r||e.opt("eventBackgroundColor")||s,"border-color":t.borderColor||i||n.borderColor||r||e.opt("eventBorderColor")||s,color:t.textColor||n.textColor||e.opt("eventTextColor")}},eventsToSegs:function(t,e){var n,i=this.eventsToRanges(t),r=[];for(n=0;i.length>n;n++)r.push.apply(r,this.eventRangeToSegs(i[n],e));return r},eventsToRanges:function(e){var n=this,i=ge(e),r=[];return t.each(i,function(t,e){e.length&&r.push.apply(r,he(e[0])?n.eventsToInverseRanges(e):n.eventsToNormalRanges(e))}),r},eventsToNormalRanges:function(t){var e,n,i,r,s=this.view.calendar,o=[];for(e=0;t.length>e;e++)n=t[e],i=n.start.clone().stripZone(),r=s.getEventEnd(n).stripZone(),o.push({event:n,start:i,end:r,eventStartMS:+i,eventDurationMS:r-i});return o},eventsToInverseRanges:function(t){var e,n,i=this.view,r=i.start.clone().stripZone(),s=i.end.clone().stripZone(),o=this.eventsToNormalRanges(t),l=[],a=t[0],u=r;for(o.sort(pe),e=0;o.length>e;e++)n=o[e],n.start>u&&l.push({event:a,start:u,end:n.start}),u=n.end;return s>u&&l.push({event:a,start:u,end:s}),l},eventRangeToSegs:function(t,e){var n,i,r;for(n=e?e(t):this.rangeToSegs(t),i=0;n.length>i;i++)r=n[i],r.event=t.event,r.eventStartMS=t.eventStartMS,r.eventDurationMS=t.eventDurationMS;return n}}),Le.compareSegs=me,Le.dataAttrPrefix="";var on=sn.extend({numbersVisible:!1,bottomCoordPadding:0,breakOnWeeks:null,cellDates:null,dayToCellOffsets:null,rowEls:null,dayEls:null,helperEls:null,constructor:function(){sn.apply(this,arguments),this.cellDuration=e.duration(1,"day")},renderDates:function(t){var e,n,i,r=this.view,s=this.rowCnt,o=this.colCnt,l=s*o,a="";for(e=0;s>e;e++)a+=this.dayRowHtml(e,t);for(this.el.html(a),this.rowEls=this.el.find(".fc-row"),this.dayEls=this.el.find(".fc-day"),n=0;l>n;n++)i=this.getCell(n),r.trigger("dayRender",null,i.start,this.dayEls.eq(n))},destroyDates:function(){this.destroySegPopover()},renderBusinessHours:function(){var t=this.view.calendar.getBusinessHoursEvents(!0),e=this.eventsToSegs(t);this.renderFill("businessHours",e,"bgevent")},dayRowHtml:function(t,e){var n=this.view,i=["fc-row","fc-week",n.widgetContentClass];return e&&i.push("fc-rigid"),'<div class="'+i.join(" ")+'">'+'<div class="fc-bg">'+"<table>"+this.rowHtml("day",t)+"</table>"+"</div>"+'<div class="fc-content-skeleton">'+"<table>"+(this.numbersVisible?"<thead>"+this.rowHtml("number",t)+"</thead>":"")+"</table>"+"</div>"+"</div>"},dayCellHtml:function(t){return this.bgCellHtml(t)},computeColHeadFormat:function(){return this.rowCnt>1?"ddd":this.colCnt>1?this.view.opt("dayOfMonthFormat"):"dddd"},computeEventTimeFormat:function(){return this.view.opt("extraSmallTimeFormat")},computeDisplayEventEnd:function(){return 1==this.colCnt},updateCells:function(){var t,e,n,i;if(this.updateCellDates(),t=this.cellDates,this.breakOnWeeks){for(e=t[0].day(),i=1;t.length>i&&t[i].day()!=e;i++);n=Math.ceil(t.length/i)}else n=1,i=t.length;this.rowCnt=n,this.colCnt=i},updateCellDates:function(){for(var t=this.view,e=this.start.clone(),n=[],i=-1,r=[];e.isBefore(this.end);)t.isHiddenDay(e)?r.push(i+.5):(i++,r.push(i),n.push(e.clone())),e.add(1,"days");this.cellDates=n,this.dayToCellOffsets=r},computeCellDate:function(t){var e=this.colCnt,n=t.row*e+(this.isRTL?e-t.col-1:t.col);return this.cellDates[n].clone()},getRowEl:function(t){return this.rowEls.eq(t)},getColEl:function(t){return this.dayEls.eq(t)},getCellDayEl:function(t){return this.dayEls.eq(t.row*this.colCnt+t.col)},computeRowCoords:function(){var t=sn.prototype.computeRowCoords.call(this);return t[t.length-1].bottom+=this.bottomCoordPadding,t},rangeToSegs:function(t){var e,n,i,r,s,o,l,a,u,c,d=this.isRTL,h=this.rowCnt,f=this.colCnt,g=[];for(t=this.view.computeDayRange(t),e=this.dateToCellOffset(t.start),n=this.dateToCellOffset(t.end.subtract(1,"days")),i=0;h>i;i++)r=i*f,s=r+f-1,a=Math.max(r,e),u=Math.min(s,n),a=Math.ceil(a),u=Math.floor(u),u>=a&&(o=a===e,l=u===n,a-=r,u-=r,c={row:i,isStart:o,isEnd:l},d?(c.leftCol=f-u-1,c.rightCol=f-a-1):(c.leftCol=a,c.rightCol=u),g.push(c));return g},dateToCellOffset:function(t){var e=this.dayToCellOffsets,n=t.diff(this.start,"days");return 0>n?e[0]-1:n>=e.length?e[e.length-1]+1:e[n]},renderDrag:function(t,e){return this.renderHighlight(this.view.calendar.ensureVisibleEventRange(t)),e&&!e.el.closest(this.el).length?(this.renderRangeHelper(t,e),this.applyDragOpacity(this.helperEls),!0):void 0},destroyDrag:function(){this.destroyHighlight(),this.destroyHelper()},renderEventResize:function(t,e){this.renderHighlight(t),this.renderRangeHelper(t,e)},destroyEventResize:function(){this.destroyHighlight(),this.destroyHelper()},renderHelper:function(e,n){var i,r=[],s=this.eventsToSegs([e]);s=this.renderFgSegEls(s),i=this.renderSegRows(s),this.rowEls.each(function(e,s){var o,l=t(s),a=t('<div class="fc-helper-skeleton"><table/></div>');o=n&&n.row===e?n.el.position().top:l.find(".fc-content-skeleton tbody").position().top,a.css("top",o).find("table").append(i[e].tbodyEl),l.append(a),r.push(a[0])}),this.helperEls=t(r)},destroyHelper:function(){this.helperEls&&(this.helperEls.remove(),this.helperEls=null)},fillSegTag:"td",renderFill:function(e,n,i){var r,s,o,l=[];for(n=this.renderFillSegEls(e,n),r=0;n.length>r;r++)s=n[r],o=this.renderFillRow(e,s,i),this.rowEls.eq(s.row).append(o),l.push(o[0]);return this.elsByFill[e]=t(l),n},renderFillRow:function(e,n,i){var r,s,o=this.colCnt,l=n.leftCol,a=n.rightCol+1;return i=i||e.toLowerCase(),r=t('<div class="fc-'+i+'-skeleton">'+"<table><tr/></table>"+"</div>"),s=r.find("tr"),l>0&&s.append('<td colspan="'+l+'"/>'),s.append(n.el.attr("colspan",a-l)),o>a&&s.append('<td colspan="'+(o-a)+'"/>'),this.bookendCells(s,e),r}});on.mixin({rowStructs:null,destroyEvents:function(){this.destroySegPopover(),sn.prototype.destroyEvents.apply(this,arguments)},getEventSegs:function(){return sn.prototype.getEventSegs.call(this).concat(this.popoverSegs||[])},renderBgSegs:function(e){var n=t.grep(e,function(t){return t.event.allDay});return sn.prototype.renderBgSegs.call(this,n)},renderFgSegs:function(e){var n;return e=this.renderFgSegEls(e),n=this.rowStructs=this.renderSegRows(e),this.rowEls.each(function(e,i){t(i).find(".fc-content-skeleton > table").append(n[e].tbodyEl)}),e},destroyFgSegs:function(){for(var t,e=this.rowStructs||[];t=e.pop();)t.tbodyEl.remove();this.rowStructs=null},renderSegRows:function(t){var e,n,i=[];for(e=this.groupSegRows(t),n=0;e.length>n;n++)i.push(this.renderSegRow(n,e[n]));return i},fgSegHtml:function(t,e){var n,i,r=this.view,s=t.event,o=r.isEventDraggable(s),l=!e&&s.allDay&&t.isStart&&r.isEventResizableFromStart(s),a=!e&&s.allDay&&t.isEnd&&r.isEventResizableFromEnd(s),u=this.getSegClasses(t,o,l||a),c=W(this.getEventSkinCss(s)),d="";return u.unshift("fc-day-grid-event","fc-h-event"),t.isStart&&(n=this.getEventTimeText(s),n&&(d='<span class="fc-time">'+Y(n)+"</span>")),i='<span class="fc-title">'+(Y(s.title||"")||"&nbsp;")+"</span>",'<a class="'+u.join(" ")+'"'+(s.url?' href="'+Y(s.url)+'"':"")+(c?' style="'+c+'"':"")+">"+'<div class="fc-content">'+(this.isRTL?i+" "+d:d+" "+i)+"</div>"+(l?'<div class="fc-resizer fc-start-resizer" />':"")+(a?'<div class="fc-resizer fc-end-resizer" />':"")+"</a>"},renderSegRow:function(e,n){function i(e){for(;e>o;)c=(v[r-1]||[])[o],c?c.attr("rowspan",parseInt(c.attr("rowspan")||1,10)+1):(c=t("<td/>"),l.append(c)),m[r][o]=c,v[r][o]=c,o++}var r,s,o,l,a,u,c,d=this.colCnt,h=this.buildSegLevels(n),f=Math.max(1,h.length),g=t("<tbody/>"),p=[],m=[],v=[];for(r=0;f>r;r++){if(s=h[r],o=0,l=t("<tr/>"),p.push([]),m.push([]),v.push([]),s)for(a=0;s.length>a;a++){for(u=s[a],i(u.leftCol),c=t('<td class="fc-event-container"/>').append(u.el),u.leftCol!=u.rightCol?c.attr("colspan",u.rightCol-u.leftCol+1):v[r][o]=c;u.rightCol>=o;)m[r][o]=c,p[r][o]=u,o++;l.append(c)}i(d),this.bookendCells(l,"eventSkeleton"),g.append(l)}return{row:e,tbodyEl:g,cellMatrix:m,segMatrix:p,segLevels:h,segs:n}},buildSegLevels:function(t){var e,n,i,r=[];for(t.sort(me),e=0;t.length>e;e++){for(n=t[e],i=0;r.length>i&&ye(n,r[i]);i++);n.level=i,(r[i]||(r[i]=[])).push(n)}for(i=0;r.length>i;i++)r[i].sort(we);return r},groupSegRows:function(t){var e,n=[];for(e=0;this.rowCnt>e;e++)n.push([]);for(e=0;t.length>e;e++)n[t[e].row].push(t[e]);return n}}),on.mixin({segPopover:null,popoverSegs:null,destroySegPopover:function(){this.segPopover&&this.segPopover.hide()},limitRows:function(t){var e,n,i=this.rowStructs||[];for(e=0;i.length>e;e++)this.unlimitRow(e),n=t?"number"==typeof t?t:this.computeRowLevelLimit(e):!1,n!==!1&&this.limitRow(e,n)},computeRowLevelLimit:function(e){function n(e,n){s=Math.max(s,t(n).outerHeight())}var i,r,s,o=this.rowEls.eq(e),l=o.height(),a=this.rowStructs[e].tbodyEl.children();for(i=0;a.length>i;i++)if(r=a.eq(i).removeClass("fc-limited"),s=0,r.find("> td > :first-child").each(n),r.position().top+s>l)return i;return!1},limitRow:function(e,n){function i(i){for(;i>D;)r=E.getCell(e,D),c=E.getCellSegs(r,n),c.length&&(f=o[n-1][D],w=E.renderMoreLink(r,c),y=t("<div/>").append(w),f.append(y),b.push(y[0])),D++}var r,s,o,l,a,u,c,d,h,f,g,p,m,v,y,w,E=this,S=this.rowStructs[e],b=[],D=0;if(n&&S.segLevels.length>n){for(s=S.segLevels[n-1],o=S.cellMatrix,l=S.tbodyEl.children().slice(n).addClass("fc-limited").get(),a=0;s.length>a;a++){for(u=s[a],i(u.leftCol),h=[],d=0;u.rightCol>=D;)r=this.getCell(e,D),c=this.getCellSegs(r,n),h.push(c),d+=c.length,D++;if(d){for(f=o[n-1][u.leftCol],g=f.attr("rowspan")||1,p=[],m=0;h.length>m;m++)v=t('<td class="fc-more-cell"/>').attr("rowspan",g),c=h[m],r=this.getCell(e,u.leftCol+m),w=this.renderMoreLink(r,[u].concat(c)),y=t("<div/>").append(w),v.append(y),p.push(v[0]),b.push(v[0]);f.addClass("fc-limited").after(t(p)),l.push(f[0])}}i(this.colCnt),S.moreEls=t(b),S.limitedEls=t(l)}},unlimitRow:function(t){var e=this.rowStructs[t];e.moreEls&&(e.moreEls.remove(),e.moreEls=null),e.limitedEls&&(e.limitedEls.removeClass("fc-limited"),e.limitedEls=null)},renderMoreLink:function(e,n){var i=this,r=this.view;return t('<a class="fc-more"/>').text(this.getMoreLinkText(n.length)).on("click",function(s){var o=r.opt("eventLimitClick"),l=e.start,a=t(this),u=i.getCellDayEl(e),c=i.getCellSegs(e),d=i.resliceDaySegs(c,l),h=i.resliceDaySegs(n,l);"function"==typeof o&&(o=r.trigger("eventLimitClick",null,{date:l,dayEl:u,moreEl:a,segs:d,hiddenSegs:h},s)),"popover"===o?i.showSegPopover(e,a,d):"string"==typeof o&&r.calendar.zoomTo(l,o)})},showSegPopover:function(t,e,n){var i,r,s=this,o=this.view,l=e.parent();i=1==this.rowCnt?o.el:this.rowEls.eq(t.row),r={className:"fc-more-popover",content:this.renderSegPopoverContent(t,n),parentEl:this.el,top:i.offset().top,autoHide:!0,viewportConstrain:o.opt("popoverViewportConstrain"),hide:function(){s.segPopover.destroy(),s.segPopover=null,s.popoverSegs=null}},this.isRTL?r.right=l.offset().left+l.outerWidth()+1:r.left=l.offset().left-1,this.segPopover=new Ke(r),this.segPopover.show()},renderSegPopoverContent:function(e,n){var i,r=this.view,s=r.opt("theme"),o=e.start.format(r.opt("dayPopoverFormat")),l=t('<div class="fc-header '+r.widgetHeaderClass+'">'+'<span class="fc-close '+(s?"ui-icon ui-icon-closethick":"fc-icon fc-icon-x")+'"></span>'+'<span class="fc-title">'+Y(o)+"</span>"+'<div class="fc-clear"/>'+"</div>"+'<div class="fc-body '+r.widgetContentClass+'">'+'<div class="fc-event-container"></div>'+"</div>"),a=l.find(".fc-event-container");for(n=this.renderFgSegEls(n,!0),this.popoverSegs=n,i=0;n.length>i;i++)n[i].cell=e,a.append(n[i].el);return l},resliceDaySegs:function(e,n){var i=t.map(e,function(t){return t.event}),r=n.clone().stripTime(),s=r.clone().add(1,"days"),o={start:r,end:s};return e=this.eventsToSegs(i,function(t){var e=H(t,o);return e?[e]:[]}),e.sort(me),e},getMoreLinkText:function(t){var e=this.view.opt("eventLimitText"); return"function"==typeof e?e(t):"+"+t+" "+e},getCellSegs:function(t,e){for(var n,i=this.rowStructs[t.row].segMatrix,r=e||0,s=[];i.length>r;)n=i[r][t.col],n&&s.push(n),r++;return s}});var ln=sn.extend({slotDuration:null,snapDuration:null,minTime:null,maxTime:null,axisFormat:null,dayEls:null,slatEls:null,slatTops:null,helperEl:null,businessHourSegs:null,constructor:function(){sn.apply(this,arguments),this.processOptions()},renderDates:function(){this.el.html(this.renderHtml()),this.dayEls=this.el.find(".fc-day"),this.slatEls=this.el.find(".fc-slats tr")},renderBusinessHours:function(){var t=this.view.calendar.getBusinessHoursEvents();this.businessHourSegs=this.renderFill("businessHours",this.eventsToSegs(t),"bgevent")},renderHtml:function(){return'<div class="fc-bg"><table>'+this.rowHtml("slotBg")+"</table>"+"</div>"+'<div class="fc-slats">'+"<table>"+this.slatRowHtml()+"</table>"+"</div>"},slotBgCellHtml:function(t){return this.bgCellHtml(t)},slatRowHtml:function(){for(var t,n,i,r=this.view,s=this.isRTL,o="",l=0===this.slotDuration.asMinutes()%15,a=e.duration(+this.minTime);this.maxTime>a;)t=this.start.clone().time(a),n=t.minutes(),i='<td class="fc-axis fc-time '+r.widgetContentClass+'" '+r.axisStyleAttr()+">"+(l&&n?"":"<span>"+Y(t.format(this.axisFormat))+"</span>")+"</td>",o+="<tr "+(n?'class="fc-minor"':"")+">"+(s?"":i)+'<td class="'+r.widgetContentClass+'"/>'+(s?i:"")+"</tr>",a.add(this.slotDuration);return o},processOptions:function(){var t=this.view,n=t.opt("slotDuration"),i=t.opt("snapDuration");n=e.duration(n),i=i?e.duration(i):n,this.slotDuration=n,this.snapDuration=i,this.cellDuration=i,this.minTime=e.duration(t.opt("minTime")),this.maxTime=e.duration(t.opt("maxTime")),this.axisFormat=t.opt("axisFormat")||t.opt("smallTimeFormat")},computeColHeadFormat:function(){return this.colCnt>1?this.view.opt("dayOfMonthFormat"):"dddd"},computeEventTimeFormat:function(){return this.view.opt("noMeridiemTimeFormat")},computeDisplayEventEnd:function(){return!0},updateCells:function(){var t,e=this.view,n=[];for(t=this.start.clone();t.isBefore(this.end);)n.push({day:t.clone()}),t.add(1,"day"),t=e.skipHiddenDays(t);this.isRTL&&n.reverse(),this.colData=n,this.colCnt=n.length,this.rowCnt=Math.ceil((this.maxTime-this.minTime)/this.snapDuration)},computeCellDate:function(t){var e=this.computeSnapTime(t.row);return this.view.calendar.rezoneDate(t.day).time(e)},getColEl:function(t){return this.dayEls.eq(t)},computeSnapTime:function(t){return e.duration(this.minTime+this.snapDuration*t)},rangeToSegs:function(t){var e,n,i,r,s=this.colCnt,o=[];for(t={start:t.start.clone().stripZone(),end:t.end.clone().stripZone()},n=0;s>n;n++)i=this.colData[n].day,r={start:i.clone().time(this.minTime),end:i.clone().time(this.maxTime)},e=H(t,r),e&&(e.col=n,o.push(e));return o},updateSize:function(t){this.computeSlatTops(),t&&this.updateSegVerticals()},computeRowCoords:function(){var t,e,n=this.el.offset().top,i=[];for(t=0;this.rowCnt>t;t++)e={top:n+this.computeTimeTop(this.computeSnapTime(t))},t>0&&(i[t-1].bottom=e.top),i.push(e);return e.bottom=e.top+this.computeTimeTop(this.computeSnapTime(t)),i},computeDateTop:function(t,n){return this.computeTimeTop(e.duration(t.clone().stripZone()-n.clone().stripTime()))},computeTimeTop:function(t){var e,n,i,r,s=(t-this.minTime)/this.slotDuration;return s=Math.max(0,s),s=Math.min(this.slatEls.length,s),e=Math.floor(s),n=s-e,i=this.slatTops[e],n?(r=this.slatTops[e+1],i+(r-i)*n):i},computeSlatTops:function(){var e,n=[];this.slatEls.each(function(i,r){e=t(r).position().top,n.push(e)}),n.push(e+this.slatEls.last().outerHeight()),this.slatTops=n},renderDrag:function(t,e){return e?(this.renderRangeHelper(t,e),this.applyDragOpacity(this.helperEl),!0):(this.renderHighlight(this.view.calendar.ensureVisibleEventRange(t)),void 0)},destroyDrag:function(){this.destroyHelper(),this.destroyHighlight()},renderEventResize:function(t,e){this.renderRangeHelper(t,e)},destroyEventResize:function(){this.destroyHelper()},renderHelper:function(e,n){var i,r,s,o,l=this.eventsToSegs([e]);for(l=this.renderFgSegEls(l),i=this.renderSegTable(l),r=0;l.length>r;r++)s=l[r],n&&n.col===s.col&&(o=n.el,s.el.css({left:o.css("left"),right:o.css("right"),"margin-left":o.css("margin-left"),"margin-right":o.css("margin-right")}));this.helperEl=t('<div class="fc-helper-skeleton"/>').append(i).appendTo(this.el)},destroyHelper:function(){this.helperEl&&(this.helperEl.remove(),this.helperEl=null)},renderSelection:function(t){this.view.opt("selectHelper")?this.renderRangeHelper(t):this.renderHighlight(t)},destroySelection:function(){this.destroyHelper(),this.destroyHighlight()},renderFill:function(e,n,i){var r,s,o,l,a,u,c,d,h,f;if(n.length){for(n=this.renderFillSegEls(e,n),r=this.groupSegCols(n),i=i||e.toLowerCase(),s=t('<div class="fc-'+i+'-skeleton">'+"<table><tr/></table>"+"</div>"),o=s.find("tr"),l=0;r.length>l;l++)if(a=r[l],u=t("<td/>").appendTo(o),a.length)for(c=t('<div class="fc-'+i+'-container"/>').appendTo(u),d=this.colData[l].day,h=0;a.length>h;h++)f=a[h],c.append(f.el.css({top:this.computeDateTop(f.start,d),bottom:-this.computeDateTop(f.end,d)}));this.bookendCells(o,e),this.el.append(s),this.elsByFill[e]=s}return n}});ln.mixin({eventSkeletonEl:null,renderFgSegs:function(e){return e=this.renderFgSegEls(e),this.el.append(this.eventSkeletonEl=t('<div class="fc-content-skeleton"/>').append(this.renderSegTable(e))),e},destroyFgSegs:function(){this.eventSkeletonEl&&(this.eventSkeletonEl.remove(),this.eventSkeletonEl=null)},renderSegTable:function(e){var n,i,r,s,o,l,a=t("<table><tr/></table>"),u=a.find("tr");for(n=this.groupSegCols(e),this.computeSegVerticals(e),s=0;n.length>s;s++){for(o=n[s],Ee(o),l=t('<div class="fc-event-container"/>'),i=0;o.length>i;i++)r=o[i],r.el.css(this.generateSegPositionCss(r)),30>r.bottom-r.top&&r.el.addClass("fc-short"),l.append(r.el);u.append(t("<td/>").append(l))}return this.bookendCells(u,"eventSkeleton"),a},updateSegVerticals:function(){var t,e=(this.segs||[]).concat(this.businessHourSegs||[]);for(this.computeSegVerticals(e),t=0;e.length>t;t++)e[t].el.css(this.generateSegVerticalCss(e[t]))},computeSegVerticals:function(t){var e,n;for(e=0;t.length>e;e++)n=t[e],n.top=this.computeDateTop(n.start,n.start),n.bottom=this.computeDateTop(n.end,n.start)},fgSegHtml:function(t,e){var n,i,r,s=this.view,o=t.event,l=s.isEventDraggable(o),a=!e&&t.isStart&&s.isEventResizableFromStart(o),u=!e&&t.isEnd&&s.isEventResizableFromEnd(o),c=this.getSegClasses(t,l,a||u),d=W(this.getEventSkinCss(o));return c.unshift("fc-time-grid-event","fc-v-event"),s.isMultiDayEvent(o)?(t.isStart||t.isEnd)&&(n=this.getEventTimeText(t),i=this.getEventTimeText(t,"LT"),r=this.getEventTimeText(t,null,!1)):(n=this.getEventTimeText(o),i=this.getEventTimeText(o,"LT"),r=this.getEventTimeText(o,null,!1)),'<a class="'+c.join(" ")+'"'+(o.url?' href="'+Y(o.url)+'"':"")+(d?' style="'+d+'"':"")+">"+'<div class="fc-content">'+(n?'<div class="fc-time" data-start="'+Y(r)+'"'+' data-full="'+Y(i)+'"'+">"+"<span>"+Y(n)+"</span>"+"</div>":"")+(o.title?'<div class="fc-title">'+Y(o.title)+"</div>":"")+"</div>"+'<div class="fc-bg"/>'+(u?'<div class="fc-resizer fc-end-resizer" />':"")+"</a>"},generateSegPositionCss:function(t){var e,n,i=this.view.opt("slotEventOverlap"),r=t.backwardCoord,s=t.forwardCoord,o=this.generateSegVerticalCss(t);return i&&(s=Math.min(1,r+2*(s-r))),this.isRTL?(e=1-s,n=r):(e=r,n=1-s),o.zIndex=t.level+1,o.left=100*e+"%",o.right=100*n+"%",i&&t.forwardPressure&&(o[this.isRTL?"marginLeft":"marginRight"]=20),o},generateSegVerticalCss:function(t){return{top:t.top,bottom:-t.bottom}},groupSegCols:function(t){var e,n=[];for(e=0;this.colCnt>e;e++)n.push([]);for(e=0;t.length>e;e++)n[t[e].col].push(t[e]);return n}});var an=Le.View=ue.extend({type:null,name:null,title:null,calendar:null,options:null,coordMap:null,el:null,isDisplayed:!1,isSkeletonRendered:!1,isEventsRendered:!1,start:null,end:null,intervalStart:null,intervalEnd:null,intervalDuration:null,intervalUnit:null,isSelected:!1,scrollerEl:null,scrollTop:null,widgetHeaderClass:null,widgetContentClass:null,highlightStateClass:null,nextDayThreshold:null,isHiddenDayHash:null,documentMousedownProxy:null,constructor:function(t,n,i,r){this.calendar=t,this.type=this.name=n,this.options=i,this.intervalDuration=r||e.duration(1,"day"),this.nextDayThreshold=e.duration(this.opt("nextDayThreshold")),this.initThemingProps(),this.initHiddenDays(),this.documentMousedownProxy=q(this,"documentMousedown"),this.initialize()},initialize:function(){},opt:function(t){return this.options[t]},trigger:function(t,e){var n=this.calendar;return n.trigger.apply(n,[t,e||this].concat(Array.prototype.slice.call(arguments,2),[this]))},setDate:function(t){this.setRange(this.computeRange(t))},setRange:function(e){t.extend(this,e),this.updateTitle()},computeRange:function(t){var e,n,i=M(this.intervalDuration),r=t.clone().startOf(i),s=r.clone().add(this.intervalDuration);return/year|month|week|day/.test(i)?(r.stripTime(),s.stripTime()):(r.hasTime()||(r=this.calendar.rezoneDate(r)),s.hasTime()||(s=this.calendar.rezoneDate(s))),e=r.clone(),e=this.skipHiddenDays(e),n=s.clone(),n=this.skipHiddenDays(n,-1,!0),{intervalUnit:i,intervalStart:r,intervalEnd:s,start:e,end:n}},computePrevDate:function(t){return this.massageCurrentDate(t.clone().startOf(this.intervalUnit).subtract(this.intervalDuration),-1)},computeNextDate:function(t){return this.massageCurrentDate(t.clone().startOf(this.intervalUnit).add(this.intervalDuration))},massageCurrentDate:function(t,e){return 1>=this.intervalDuration.as("days")&&this.isHiddenDay(t)&&(t=this.skipHiddenDays(t,e),t.startOf("day")),t},updateTitle:function(){this.title=this.computeTitle()},computeTitle:function(){return this.formatRange({start:this.intervalStart,end:this.intervalEnd},this.opt("titleFormat")||this.computeTitleFormat(),this.opt("titleRangeSeparator"))},computeTitleFormat:function(){return"year"==this.intervalUnit?"YYYY":"month"==this.intervalUnit?this.opt("monthYearFormat"):this.intervalDuration.as("days")>1?"ll":"LL"},formatRange:function(t,e,n){var i=t.end;return i.hasTime()||(i=i.clone().subtract(1)),re(t.start,i,e,n,this.opt("isRTL"))},setElement:function(t){this.el=t,this.bindGlobalHandlers()},removeElement:function(){this.clear(),this.isSkeletonRendered&&(this.destroySkeleton(),this.isSkeletonRendered=!1),this.unbindGlobalHandlers(),this.el.remove()},display:function(t){var e=null;this.isDisplayed&&(e=this.queryScroll()),this.clear(),this.setDate(t),this.render(),this.updateSize(),this.renderBusinessHours(),this.isDisplayed=!0,e=this.computeInitialScroll(e),this.forceScroll(e),this.triggerRender()},clear:function(){this.isDisplayed&&(this.unselect(),this.clearEvents(),this.triggerDestroy(),this.destroyBusinessHours(),this.destroy(),this.isDisplayed=!1)},render:function(){this.isSkeletonRendered||(this.renderSkeleton(),this.isSkeletonRendered=!0),this.renderDates()},destroy:function(){this.destroyDates()},renderSkeleton:function(){},destroySkeleton:function(){},renderDates:function(){},destroyDates:function(){},renderBusinessHours:function(){},destroyBusinessHours:function(){},triggerRender:function(){this.trigger("viewRender",this,this,this.el)},triggerDestroy:function(){this.trigger("viewDestroy",this,this,this.el)},bindGlobalHandlers:function(){t(document).on("mousedown",this.documentMousedownProxy)},unbindGlobalHandlers:function(){t(document).off("mousedown",this.documentMousedownProxy)},initThemingProps:function(){var t=this.opt("theme")?"ui":"fc";this.widgetHeaderClass=t+"-widget-header",this.widgetContentClass=t+"-widget-content",this.highlightStateClass=t+"-state-highlight"},updateSize:function(t){var e;t&&(e=this.queryScroll()),this.updateHeight(),this.updateWidth(),t&&this.setScroll(e)},updateWidth:function(){},updateHeight:function(){var t=this.calendar;this.setHeight(t.getSuggestedViewHeight(),t.isHeightAuto())},setHeight:function(){},computeScrollerHeight:function(t){var e,n,i=this.scrollerEl;return e=this.el.add(i),e.css({position:"relative",left:-1}),n=this.el.outerHeight()-i.height(),e.css({position:"",left:""}),t-n},computeInitialScroll:function(){return 0},queryScroll:function(){return this.scrollerEl?this.scrollerEl.scrollTop():void 0},setScroll:function(t){return this.scrollerEl?this.scrollerEl.scrollTop(t):void 0},forceScroll:function(t){var e=this;this.setScroll(t),setTimeout(function(){e.setScroll(t)},0)},displayEvents:function(t){var e=this.queryScroll();this.clearEvents(),this.renderEvents(t),this.isEventsRendered=!0,this.setScroll(e),this.triggerEventRender()},clearEvents:function(){this.isEventsRendered&&(this.triggerEventDestroy(),this.destroyEvents(),this.isEventsRendered=!1)},renderEvents:function(){},destroyEvents:function(){},triggerEventRender:function(){this.renderedEventSegEach(function(t){this.trigger("eventAfterRender",t.event,t.event,t.el)}),this.trigger("eventAfterAllRender")},triggerEventDestroy:function(){this.renderedEventSegEach(function(t){this.trigger("eventDestroy",t.event,t.event,t.el)})},resolveEventEl:function(e,n){var i=this.trigger("eventRender",e,e,n);return i===!1?n=null:i&&i!==!0&&(n=t(i)),n},showEvent:function(t){this.renderedEventSegEach(function(t){t.el.css("visibility","")},t)},hideEvent:function(t){this.renderedEventSegEach(function(t){t.el.css("visibility","hidden")},t)},renderedEventSegEach:function(t,e){var n,i=this.getEventSegs();for(n=0;i.length>n;n++)e&&i[n].event._id!==e._id||i[n].el&&t.call(this,i[n])},getEventSegs:function(){return[]},isEventDraggable:function(t){var e=t.source||{};return B(t.startEditable,e.startEditable,this.opt("eventStartEditable"),t.editable,e.editable,this.opt("editable"))},reportEventDrop:function(t,e,n,i,r){var s=this.calendar,o=s.mutateEvent(t,e,n),l=function(){o.undo(),s.reportEventChange()};this.triggerEventDrop(t,o.dateDelta,l,i,r),s.reportEventChange()},triggerEventDrop:function(t,e,n,i,r){this.trigger("eventDrop",i[0],t,e,n,r,{})},reportExternalDrop:function(e,n,i,r,s){var o,l,a=e.eventProps;a&&(o=t.extend({},a,n),l=this.calendar.renderEvent(o,e.stick)[0]),this.triggerExternalDrop(l,n,i,r,s)},triggerExternalDrop:function(t,e,n,i,r){this.trigger("drop",n[0],e.start,i,r),t&&this.trigger("eventReceive",null,t)},renderDrag:function(){},destroyDrag:function(){},isEventResizableFromStart:function(t){return this.opt("eventResizableFromStart")&&this.isEventResizable(t)},isEventResizableFromEnd:function(t){return this.isEventResizable(t)},isEventResizable:function(t){var e=t.source||{};return B(t.durationEditable,e.durationEditable,this.opt("eventDurationEditable"),t.editable,e.editable,this.opt("editable"))},reportEventResize:function(t,e,n,i,r){var s=this.calendar,o=s.mutateEvent(t,e,n),l=function(){o.undo(),s.reportEventChange()};this.triggerEventResize(t,o.durationDelta,l,i,r),s.reportEventChange()},triggerEventResize:function(t,e,n,i,r){this.trigger("eventResize",i[0],t,e,n,r,{})},select:function(t,e){this.unselect(e),this.renderSelection(t),this.reportSelection(t,e)},renderSelection:function(){},reportSelection:function(t,e){this.isSelected=!0,this.trigger("select",null,t.start,t.end,e)},unselect:function(t){this.isSelected&&(this.isSelected=!1,this.destroySelection(),this.trigger("unselect",null,t))},destroySelection:function(){},documentMousedown:function(e){var n;this.isSelected&&this.opt("unselectAuto")&&S(e)&&(n=this.opt("unselectCancel"),n&&t(e.target).closest(n).length||this.unselect(e))},initHiddenDays:function(){var e,n=this.opt("hiddenDays")||[],i=[],r=0;for(this.opt("weekends")===!1&&n.push(0,6),e=0;7>e;e++)(i[e]=-1!==t.inArray(e,n))||r++;if(!r)throw"invalid hiddenDays";this.isHiddenDayHash=i},isHiddenDay:function(t){return e.isMoment(t)&&(t=t.day()),this.isHiddenDayHash[t]},skipHiddenDays:function(t,e,n){var i=t.clone();for(e=e||1;this.isHiddenDayHash[(i.day()+(n?e:0)+7)%7];)i.add(e,"days");return i},computeDayRange:function(t){var e,n=t.start.clone().stripTime(),i=t.end,r=null;return i&&(r=i.clone().stripTime(),e=+i.time(),e&&e>=this.nextDayThreshold&&r.add(1,"days")),(!i||n>=r)&&(r=n.clone().add(1,"days")),{start:n,end:r}},isMultiDayEvent:function(t){var e=this.computeDayRange(t);return e.end.diff(e.start,"days")>1}}),un=Le.Calendar=Le.CalendarBase=ue.extend({dirDefaults:null,langDefaults:null,overrides:null,options:null,viewSpecCache:null,view:null,header:null,constructor:Re,initOptions:function(t){var e,r,s,o;t=i(t),e=t.lang,r=cn[e],r||(e=un.defaults.lang,r=cn[e]||{}),s=B(t.isRTL,r.isRTL,un.defaults.isRTL),o=s?un.rtlDefaults:{},this.dirDefaults=o,this.langDefaults=r,this.overrides=t,this.options=n(un.defaults,o,r,t),ke(this.options),this.viewSpecCache={}},getViewSpec:function(t){var e=this.viewSpecCache;return e[t]||(e[t]=this.buildViewSpec(t))},getUnitViewSpec:function(e){var n,i,r;if(-1!=t.inArray(e,Ye))for(n=this.header.getViewsWithButtons(),t.each(Le.views,function(t){n.push(t)}),i=0;n.length>i;i++)if(r=this.getViewSpec(n[i]),r&&r.singleUnit==e)return r},buildViewSpec:function(t){for(var i,r,s,o,l,a,u=this.overrides.views||{},c=[],d=[],h=t;h&&!i;)r=_e[h]||{},s=u[h]||{},o=o||s.duration||r.duration,h=s.type||r.type,"function"==typeof r?(i=r,c.unshift(i.defaults||{})):c.unshift(r),d.unshift(s);return i?(a={"class":i,type:t},o&&(o=e.duration(o),o.valueOf()||(o=null)),o&&(a.duration=o,l=M(o),1===o.as(l)&&(a.singleUnit=l,d.unshift(u[l]||{}))),a.defaults=n.apply(null,c),a.overrides=n.apply(null,d),this.buildViewSpecOptions(a),this.buildViewSpecButtonText(a,t),a):void 0},buildViewSpecOptions:function(t){t.options=n(un.defaults,t.defaults,this.dirDefaults,this.langDefaults,this.overrides,t.overrides),ke(t.options)},buildViewSpecButtonText:function(t,e){function n(n){var i=n.buttonText||{};return i[e]||(t.singleUnit?i[t.singleUnit]:null)}t.buttonTextOverride=n(this.overrides)||t.overrides.buttonText,t.buttonTextDefault=n(this.langDefaults)||n(this.dirDefaults)||t.defaults.buttonText||n(un.defaults)||(t.duration?this.humanizeDuration(t.duration):null)||e},instantiateView:function(t){var e=this.getViewSpec(t);return new e["class"](this,t,e.options,e.duration)},isValidViewType:function(t){return Boolean(this.getViewSpec(t))}});un.defaults={titleRangeSeparator:" — ",monthYearFormat:"MMMM YYYY",defaultTimedEventDuration:"02:00:00",defaultAllDayEventDuration:{days:1},forceEventDuration:!1,nextDayThreshold:"09:00:00",defaultView:"month",aspectRatio:1.35,header:{left:"title",center:"",right:"today prev,next"},weekends:!0,weekNumbers:!1,weekNumberTitle:"W",weekNumberCalculation:"local",lazyFetching:!0,startParam:"start",endParam:"end",timezoneParam:"timezone",timezone:!1,isRTL:!1,buttonText:{prev:"prev",next:"next",prevYear:"prev year",nextYear:"next year",year:"year",today:"today",month:"month",week:"week",day:"day"},buttonIcons:{prev:"left-single-arrow",next:"right-single-arrow",prevYear:"left-double-arrow",nextYear:"right-double-arrow"},theme:!1,themeButtonIcons:{prev:"circle-triangle-w",next:"circle-triangle-e",prevYear:"seek-prev",nextYear:"seek-next"},dragOpacity:.75,dragRevertDuration:500,dragScroll:!0,unselectAuto:!0,dropAccept:"*",eventLimit:!1,eventLimitText:"more",eventLimitClick:"popover",dayPopoverFormat:"LL",handleWindowResize:!0,windowResizeDelay:200},un.englishDefaults={dayPopoverFormat:"dddd, MMMM D"},un.rtlDefaults={header:{left:"next,prev today",center:"",right:"title"},buttonIcons:{prev:"right-single-arrow",next:"left-single-arrow",prevYear:"right-double-arrow",nextYear:"left-double-arrow"},themeButtonIcons:{prev:"circle-triangle-e",next:"circle-triangle-w",nextYear:"seek-prev",prevYear:"seek-next"}};var cn=Le.langs={};Le.datepickerLang=function(e,n,i){var r=cn[e]||(cn[e]={});r.isRTL=i.isRTL,r.weekNumberTitle=i.weekHeader,t.each(dn,function(t,e){r[t]=e(i)}),t.datepicker&&(t.datepicker.regional[n]=t.datepicker.regional[e]=i,t.datepicker.regional.en=t.datepicker.regional[""],t.datepicker.setDefaults(i))},Le.lang=function(e,i){var r,s;r=cn[e]||(cn[e]={}),i&&(r=cn[e]=n(r,i)),s=Me(e),t.each(hn,function(t,e){null==r[t]&&(r[t]=e(s,r))}),un.defaults.lang=e};var dn={buttonText:function(t){return{prev:I(t.prevText),next:I(t.nextText),today:I(t.currentText)}},monthYearFormat:function(t){return t.showMonthAfterYear?"YYYY["+t.yearSuffix+"] MMMM":"MMMM YYYY["+t.yearSuffix+"]"}},hn={dayOfMonthFormat:function(t,e){var n=t.longDateFormat("l");return n=n.replace(/^Y+[^\w\s]*|[^\w\s]*Y+$/g,""),e.isRTL?n+=" ddd":n="ddd "+n,n},mediumTimeFormat:function(t){return t.longDateFormat("LT").replace(/\s*a$/i,"a")},smallTimeFormat:function(t){return t.longDateFormat("LT").replace(":mm","(:mm)").replace(/(\Wmm)$/,"($1)").replace(/\s*a$/i,"a")},extraSmallTimeFormat:function(t){return t.longDateFormat("LT").replace(":mm","(:mm)").replace(/(\Wmm)$/,"($1)").replace(/\s*a$/i,"t")},hourFormat:function(t){return t.longDateFormat("LT").replace(":mm","").replace(/(\Wmm)$/,"").replace(/\s*a$/i,"a")},noMeridiemTimeFormat:function(t){return t.longDateFormat("LT").replace(/\s*a$/i,"")}},fn={smallDayDateFormat:function(t){return t.isRTL?"D dd":"dd D"},weekFormat:function(t){return t.isRTL?"w[ "+t.weekNumberTitle+"]":"["+t.weekNumberTitle+" ]w"},smallWeekFormat:function(t){return t.isRTL?"w["+t.weekNumberTitle+"]":"["+t.weekNumberTitle+"]w"}};Le.lang("en",un.englishDefaults),Le.sourceNormalizers=[],Le.sourceFetchers=[];var gn={dataType:"json",cache:!1},pn=1;un.prototype.getPeerEvents=function(t){var e,n,i=this.getEventCache(),r=[];for(e=0;i.length>e;e++)n=i[e],t&&t._id===n._id||r.push(n);return r};var mn=_e.basic=an.extend({dayGrid:null,dayNumbersVisible:!1,weekNumbersVisible:!1,weekNumberWidth:null,headRowEl:null,initialize:function(){this.dayGrid=new on(this),this.coordMap=this.dayGrid.coordMap},setRange:function(t){an.prototype.setRange.call(this,t),this.dayGrid.breakOnWeeks=/year|month|week/.test(this.intervalUnit),this.dayGrid.setRange(t)},computeRange:function(t){var e=an.prototype.computeRange.call(this,t);return/year|month/.test(e.intervalUnit)&&(e.start.startOf("week"),e.start=this.skipHiddenDays(e.start),e.end.weekday()&&(e.end.add(1,"week").startOf("week"),e.end=this.skipHiddenDays(e.end,-1,!0))),e},render:function(){this.dayNumbersVisible=this.dayGrid.rowCnt>1,this.weekNumbersVisible=this.opt("weekNumbers"),this.dayGrid.numbersVisible=this.dayNumbersVisible||this.weekNumbersVisible,this.el.addClass("fc-basic-view").html(this.renderHtml()),this.headRowEl=this.el.find("thead .fc-row"),this.scrollerEl=this.el.find(".fc-day-grid-container"),this.dayGrid.coordMap.containerEl=this.scrollerEl,this.dayGrid.setElement(this.el.find(".fc-day-grid")),this.dayGrid.renderDates(this.hasRigidRows())},destroy:function(){this.dayGrid.destroyDates(),this.dayGrid.removeElement()},renderBusinessHours:function(){this.dayGrid.renderBusinessHours()},renderHtml:function(){return'<table><thead class="fc-head"><tr><td class="'+this.widgetHeaderClass+'">'+this.dayGrid.headHtml()+"</td>"+"</tr>"+"</thead>"+'<tbody class="fc-body">'+"<tr>"+'<td class="'+this.widgetContentClass+'">'+'<div class="fc-day-grid-container">'+'<div class="fc-day-grid"/>'+"</div>"+"</td>"+"</tr>"+"</tbody>"+"</table>"},headIntroHtml:function(){return this.weekNumbersVisible?'<th class="fc-week-number '+this.widgetHeaderClass+'" '+this.weekNumberStyleAttr()+">"+"<span>"+Y(this.opt("weekNumberTitle"))+"</span>"+"</th>":void 0},numberIntroHtml:function(t){return this.weekNumbersVisible?'<td class="fc-week-number" '+this.weekNumberStyleAttr()+">"+"<span>"+this.dayGrid.getCell(t,0).start.format("w")+"</span>"+"</td>":void 0},dayIntroHtml:function(){return this.weekNumbersVisible?'<td class="fc-week-number '+this.widgetContentClass+'" '+this.weekNumberStyleAttr()+"></td>":void 0},introHtml:function(){return this.weekNumbersVisible?'<td class="fc-week-number" '+this.weekNumberStyleAttr()+"></td>":void 0},numberCellHtml:function(t){var e,n=t.start;return this.dayNumbersVisible?(e=this.dayGrid.getDayClasses(n),e.unshift("fc-day-number"),'<td class="'+e.join(" ")+'" data-date="'+n.format()+'">'+n.date()+"</td>"):"<td/>"},weekNumberStyleAttr:function(){return null!==this.weekNumberWidth?'style="width:'+this.weekNumberWidth+'px"':""},hasRigidRows:function(){var t=this.opt("eventLimit");return t&&"number"!=typeof t},updateWidth:function(){this.weekNumbersVisible&&(this.weekNumberWidth=c(this.el.find(".fc-week-number")))},setHeight:function(t,e){var n,i=this.opt("eventLimit");h(this.scrollerEl),s(this.headRowEl),this.dayGrid.destroySegPopover(),i&&"number"==typeof i&&this.dayGrid.limitRows(i),n=this.computeScrollerHeight(t),this.setGridHeight(n,e),i&&"number"!=typeof i&&this.dayGrid.limitRows(i),!e&&d(this.scrollerEl,n)&&(r(this.headRowEl,v(this.scrollerEl)),n=this.computeScrollerHeight(t),this.scrollerEl.height(n))},setGridHeight:function(t,e){e?u(this.dayGrid.rowEls):a(this.dayGrid.rowEls,t,!0)},renderEvents:function(t){this.dayGrid.renderEvents(t),this.updateHeight()},getEventSegs:function(){return this.dayGrid.getEventSegs()},destroyEvents:function(){this.dayGrid.destroyEvents()},renderDrag:function(t,e){return this.dayGrid.renderDrag(t,e)},destroyDrag:function(){this.dayGrid.destroyDrag()},renderSelection:function(t){this.dayGrid.renderSelection(t)},destroySelection:function(){this.dayGrid.destroySelection()}}),vn=_e.month=mn.extend({computeRange:function(t){var e,n=mn.prototype.computeRange.call(this,t);return this.isFixedWeeks()&&(e=Math.ceil(n.end.diff(n.start,"weeks",!0)),n.end.add(6-e,"weeks")),n},setGridHeight:function(t,e){e=e||"variable"===this.opt("weekMode"),e&&(t*=this.rowCnt/6),a(this.dayGrid.rowEls,t,!e)},isFixedWeeks:function(){var t=this.opt("weekMode");return t?"fixed"===t:this.opt("fixedWeekCount")}});vn.duration={months:1},vn.defaults={fixedWeekCount:!0},_e.basicWeek={type:"basic",duration:{weeks:1}},_e.basicDay={type:"basic",duration:{days:1}};var yn={allDaySlot:!0,allDayText:"all-day",scrollTime:"06:00:00",slotDuration:"00:30:00",minTime:"00:00:00",maxTime:"24:00:00",slotEventOverlap:!0},wn=5,En=_e.agenda=an.extend({timeGrid:null,dayGrid:null,axisWidth:null,noScrollRowEls:null,bottomRuleEl:null,bottomRuleHeight:null,initialize:function(){this.timeGrid=new ln(this),this.opt("allDaySlot")?(this.dayGrid=new on(this),this.coordMap=new Je([this.dayGrid.coordMap,this.timeGrid.coordMap])):this.coordMap=this.timeGrid.coordMap},setRange:function(t){an.prototype.setRange.call(this,t),this.timeGrid.setRange(t),this.dayGrid&&this.dayGrid.setRange(t)},render:function(){this.el.addClass("fc-agenda-view").html(this.renderHtml()),this.scrollerEl=this.el.find(".fc-time-grid-container"),this.timeGrid.coordMap.containerEl=this.scrollerEl,this.timeGrid.setElement(this.el.find(".fc-time-grid")),this.timeGrid.renderDates(),this.bottomRuleEl=t('<hr class="fc-divider '+this.widgetHeaderClass+'"/>').appendTo(this.timeGrid.el),this.dayGrid&&(this.dayGrid.setElement(this.el.find(".fc-day-grid")),this.dayGrid.renderDates(),this.dayGrid.bottomCoordPadding=this.dayGrid.el.next("hr").outerHeight()),this.noScrollRowEls=this.el.find(".fc-row:not(.fc-scroller *)")},destroy:function(){this.timeGrid.destroyDates(),this.timeGrid.removeElement(),this.dayGrid&&(this.dayGrid.destroyDates(),this.dayGrid.removeElement())},renderBusinessHours:function(){this.timeGrid.renderBusinessHours(),this.dayGrid&&this.dayGrid.renderBusinessHours()},renderHtml:function(){return'<table><thead class="fc-head"><tr><td class="'+this.widgetHeaderClass+'">'+this.timeGrid.headHtml()+"</td>"+"</tr>"+"</thead>"+'<tbody class="fc-body">'+"<tr>"+'<td class="'+this.widgetContentClass+'">'+(this.dayGrid?'<div class="fc-day-grid"/><hr class="fc-divider '+this.widgetHeaderClass+'"/>':"")+'<div class="fc-time-grid-container">'+'<div class="fc-time-grid"/>'+"</div>"+"</td>"+"</tr>"+"</tbody>"+"</table>"},headIntroHtml:function(){var t,e;return this.opt("weekNumbers")?(t=this.timeGrid.getCell(0).start,e=t.format(this.opt("smallWeekFormat")),'<th class="fc-axis fc-week-number '+this.widgetHeaderClass+'" '+this.axisStyleAttr()+">"+"<span>"+Y(e)+"</span>"+"</th>"):'<th class="fc-axis '+this.widgetHeaderClass+'" '+this.axisStyleAttr()+"></th>"},dayIntroHtml:function(){return'<td class="fc-axis '+this.widgetContentClass+'" '+this.axisStyleAttr()+">"+"<span>"+(this.opt("allDayHtml")||Y(this.opt("allDayText")))+"</span>"+"</td>"},slotBgIntroHtml:function(){return'<td class="fc-axis '+this.widgetContentClass+'" '+this.axisStyleAttr()+"></td>"},introHtml:function(){return'<td class="fc-axis" '+this.axisStyleAttr()+"></td>"},axisStyleAttr:function(){return null!==this.axisWidth?'style="width:'+this.axisWidth+'px"':""},updateSize:function(t){this.timeGrid.updateSize(t),an.prototype.updateSize.call(this,t)},updateWidth:function(){this.axisWidth=c(this.el.find(".fc-axis"))},setHeight:function(t,e){var n,i;null===this.bottomRuleHeight&&(this.bottomRuleHeight=this.bottomRuleEl.outerHeight()),this.bottomRuleEl.hide(),this.scrollerEl.css("overflow",""),h(this.scrollerEl),s(this.noScrollRowEls),this.dayGrid&&(this.dayGrid.destroySegPopover(),n=this.opt("eventLimit"),n&&"number"!=typeof n&&(n=wn),n&&this.dayGrid.limitRows(n)),e||(i=this.computeScrollerHeight(t),d(this.scrollerEl,i)?(r(this.noScrollRowEls,v(this.scrollerEl)),i=this.computeScrollerHeight(t),this.scrollerEl.height(i)):(this.scrollerEl.height(i).css("overflow","hidden"),this.bottomRuleEl.show()))},computeInitialScroll:function(){var t=e.duration(this.opt("scrollTime")),n=this.timeGrid.computeTimeTop(t);return n=Math.ceil(n),n&&n++,n},renderEvents:function(t){var e,n,i=[],r=[],s=[];for(n=0;t.length>n;n++)t[n].allDay?i.push(t[n]):r.push(t[n]);e=this.timeGrid.renderEvents(r),this.dayGrid&&(s=this.dayGrid.renderEvents(i)),this.updateHeight()},getEventSegs:function(){return this.timeGrid.getEventSegs().concat(this.dayGrid?this.dayGrid.getEventSegs():[])},destroyEvents:function(){this.timeGrid.destroyEvents(),this.dayGrid&&this.dayGrid.destroyEvents()},renderDrag:function(t,e){return t.start.hasTime()?this.timeGrid.renderDrag(t,e):this.dayGrid?this.dayGrid.renderDrag(t,e):void 0},destroyDrag:function(){this.timeGrid.destroyDrag(),this.dayGrid&&this.dayGrid.destroyDrag()},renderSelection:function(t){t.start.hasTime()||t.end.hasTime()?this.timeGrid.renderSelection(t):this.dayGrid&&this.dayGrid.renderSelection(t)},destroySelection:function(){this.timeGrid.destroySelection(),this.dayGrid&&this.dayGrid.destroySelection()}});return En.defaults=yn,_e.agendaWeek={type:"agenda",duration:{weeks:1}},_e.agendaDay={type:"agenda",duration:{days:1}},Le});
simudream/cdnjs
ajax/libs/fullcalendar/2.3.1/fullcalendar.min.js
JavaScript
mit
94,715
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/event-touch/event-touch.js']) { __coverage__['build/event-touch/event-touch.js'] = {"path":"build/event-touch/event-touch.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0,0],"14":[0,0],"15":[0,0],"16":[0,0]},"f":{"1":0,"2":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":42}}},"2":{"name":"(anonymous_2)","line":32,"loc":{"start":{"line":32,"column":36},"end":{"line":32,"column":72}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":171,"column":45}},"2":{"start":{"line":16,"column":0},"end":{"line":20,"column":21}},"3":{"start":{"line":32,"column":0},"end":{"line":115,"column":2}},"4":{"start":{"line":34,"column":4},"end":{"line":34,"column":37}},"5":{"start":{"line":37,"column":4},"end":{"line":53,"column":5}},"6":{"start":{"line":46,"column":8},"end":{"line":46,"column":26}},"7":{"start":{"line":47,"column":8},"end":{"line":47,"column":24}},"8":{"start":{"line":49,"column":8},"end":{"line":52,"column":9}},"9":{"start":{"line":50,"column":12},"end":{"line":50,"column":30}},"10":{"start":{"line":51,"column":12},"end":{"line":51,"column":105}},"11":{"start":{"line":55,"column":4},"end":{"line":74,"column":5}},"12":{"start":{"line":65,"column":8},"end":{"line":65,"column":32}},"13":{"start":{"line":67,"column":8},"end":{"line":73,"column":9}},"14":{"start":{"line":68,"column":12},"end":{"line":68,"column":36}},"15":{"start":{"line":69,"column":12},"end":{"line":69,"column":67}},"16":{"start":{"line":71,"column":12},"end":{"line":71,"column":97}},"17":{"start":{"line":76,"column":4},"end":{"line":102,"column":5}},"18":{"start":{"line":93,"column":8},"end":{"line":93,"column":33}},"19":{"start":{"line":95,"column":8},"end":{"line":101,"column":9}},"20":{"start":{"line":96,"column":12},"end":{"line":96,"column":37}},"21":{"start":{"line":97,"column":12},"end":{"line":97,"column":67}},"22":{"start":{"line":99,"column":12},"end":{"line":99,"column":98}},"23":{"start":{"line":104,"column":4},"end":{"line":106,"column":5}},"24":{"start":{"line":105,"column":8},"end":{"line":105,"column":31}},"25":{"start":{"line":108,"column":4},"end":{"line":110,"column":5}},"26":{"start":{"line":109,"column":8},"end":{"line":109,"column":37}},"27":{"start":{"line":112,"column":4},"end":{"line":114,"column":5}},"28":{"start":{"line":113,"column":8},"end":{"line":113,"column":41}},"29":{"start":{"line":119,"column":0},"end":{"line":132,"column":1}},"30":{"start":{"line":120,"column":4},"end":{"line":131,"column":7}},"31":{"start":{"line":135,"column":0},"end":{"line":156,"column":1}},"32":{"start":{"line":136,"column":4},"end":{"line":136,"column":37}},"33":{"start":{"line":137,"column":4},"end":{"line":137,"column":33}},"34":{"start":{"line":138,"column":4},"end":{"line":138,"column":35}},"35":{"start":{"line":139,"column":4},"end":{"line":139,"column":39}},"36":{"start":{"line":144,"column":5},"end":{"line":156,"column":1}},"37":{"start":{"line":145,"column":4},"end":{"line":145,"column":40}},"38":{"start":{"line":146,"column":4},"end":{"line":146,"column":36}},"39":{"start":{"line":147,"column":4},"end":{"line":147,"column":39}},"40":{"start":{"line":148,"column":4},"end":{"line":148,"column":43}},"41":{"start":{"line":152,"column":4},"end":{"line":152,"column":36}},"42":{"start":{"line":153,"column":4},"end":{"line":153,"column":32}},"43":{"start":{"line":154,"column":4},"end":{"line":154,"column":35}},"44":{"start":{"line":155,"column":4},"end":{"line":155,"column":39}},"45":{"start":{"line":168,"column":0},"end":{"line":168,"column":35}}},"branchMap":{"1":{"line":37,"type":"if","locations":[{"start":{"line":37,"column":4},"end":{"line":37,"column":4}},{"start":{"line":37,"column":4},"end":{"line":37,"column":4}}]},"2":{"line":55,"type":"if","locations":[{"start":{"line":55,"column":4},"end":{"line":55,"column":4}},{"start":{"line":55,"column":4},"end":{"line":55,"column":4}}]},"3":{"line":69,"type":"binary-expr","locations":[{"start":{"line":69,"column":23},"end":{"line":69,"column":33}},{"start":{"line":69,"column":37},"end":{"line":69,"column":66}}]},"4":{"line":71,"type":"binary-expr","locations":[{"start":{"line":71,"column":36},"end":{"line":71,"column":44}},{"start":{"line":71,"column":48},"end":{"line":71,"column":96}}]},"5":{"line":76,"type":"if","locations":[{"start":{"line":76,"column":4},"end":{"line":76,"column":4}},{"start":{"line":76,"column":4},"end":{"line":76,"column":4}}]},"6":{"line":97,"type":"binary-expr","locations":[{"start":{"line":97,"column":23},"end":{"line":97,"column":33}},{"start":{"line":97,"column":37},"end":{"line":97,"column":66}}]},"7":{"line":99,"type":"binary-expr","locations":[{"start":{"line":99,"column":37},"end":{"line":99,"column":45}},{"start":{"line":99,"column":49},"end":{"line":99,"column":97}}]},"8":{"line":104,"type":"if","locations":[{"start":{"line":104,"column":4},"end":{"line":104,"column":4}},{"start":{"line":104,"column":4},"end":{"line":104,"column":4}}]},"9":{"line":108,"type":"if","locations":[{"start":{"line":108,"column":4},"end":{"line":108,"column":4}},{"start":{"line":108,"column":4},"end":{"line":108,"column":4}}]},"10":{"line":112,"type":"if","locations":[{"start":{"line":112,"column":4},"end":{"line":112,"column":4}},{"start":{"line":112,"column":4},"end":{"line":112,"column":4}}]},"11":{"line":119,"type":"if","locations":[{"start":{"line":119,"column":0},"end":{"line":119,"column":0}},{"start":{"line":119,"column":0},"end":{"line":119,"column":0}}]},"12":{"line":135,"type":"if","locations":[{"start":{"line":135,"column":0},"end":{"line":135,"column":0}},{"start":{"line":135,"column":0},"end":{"line":135,"column":0}}]},"13":{"line":135,"type":"binary-expr","locations":[{"start":{"line":135,"column":5},"end":{"line":135,"column":8}},{"start":{"line":135,"column":13},"end":{"line":135,"column":34}},{"start":{"line":135,"column":40},"end":{"line":135,"column":73}}]},"14":{"line":135,"type":"binary-expr","locations":[{"start":{"line":135,"column":42},"end":{"line":135,"column":53}},{"start":{"line":135,"column":57},"end":{"line":135,"column":72}}]},"15":{"line":144,"type":"if","locations":[{"start":{"line":144,"column":5},"end":{"line":144,"column":5}},{"start":{"line":144,"column":5},"end":{"line":144,"column":5}}]},"16":{"line":144,"type":"binary-expr","locations":[{"start":{"line":144,"column":9},"end":{"line":144,"column":12}},{"start":{"line":144,"column":17},"end":{"line":144,"column":52}}]}},"code":["(function () { YUI.add('event-touch', function (Y, NAME) {","","/**","Adds touch event facade normalization properties (touches, changedTouches, targetTouches etc.) to the DOM event facade. Adds","touch events to the DOM events whitelist. ","","@example"," YUI().use('event-touch', function (Y) {"," Y.one('#myDiv').on('touchstart', function(e) {"," ..."," });"," });","@module event","@submodule event-touch"," */","var SCALE = \"scale\","," ROTATION = \"rotation\","," IDENTIFIER = \"identifier\","," win = Y.config.win,"," GESTURE_MAP = {};","","/**"," * Adds touch event facade normalization properties to the DOM event facade"," *"," * @method _touch"," * @for DOMEventFacade"," * @private"," * @param ev {Event} the DOM event"," * @param currentTarget {HTMLElement} the element the listener was attached to"," * @param wrapper {Event.Custom} the custom event wrapper for this DOM event"," */","Y.DOMEventFacade.prototype._touch = function(e, currentTarget, wrapper) {",""," var i,l, etCached, et,touchCache;","",""," if (e.touches) {",""," /**"," * Array of individual touch events for touch points that are still in"," * contact with the touch surface."," *"," * @property touches"," * @type {DOMEventFacade[]}"," */"," this.touches = [];"," touchCache = {};",""," for (i = 0, l = e.touches.length; i < l; ++i) {"," et = e.touches[i];"," touchCache[Y.stamp(et)] = this.touches[i] = new Y.DOMEventFacade(et, currentTarget, wrapper);"," }"," }",""," if (e.targetTouches) {",""," /**"," * Array of individual touch events still in contact with the touch"," * surface and whose `touchstart` event occurred inside the same taregt"," * element as the current target element."," *"," * @property targetTouches"," * @type {DOMEventFacade[]}"," */"," this.targetTouches = [];",""," for (i = 0, l = e.targetTouches.length; i < l; ++i) {"," et = e.targetTouches[i];"," etCached = touchCache && touchCache[Y.stamp(et, true)];",""," this.targetTouches[i] = etCached || new Y.DOMEventFacade(et, currentTarget, wrapper);"," "," }"," }",""," if (e.changedTouches) {",""," /**"," An array of event-specific touch events.",""," For `touchstart`, the touch points that became active with the current"," event.",""," For `touchmove`, the touch points that have changed since the last"," event."," "," For `touchend`, the touch points that have been removed from the touch"," surface.",""," @property changedTouches"," @type {DOMEventFacade[]}"," **/"," this.changedTouches = [];",""," for (i = 0, l = e.changedTouches.length; i < l; ++i) {"," et = e.changedTouches[i];"," etCached = touchCache && touchCache[Y.stamp(et, true)];",""," this.changedTouches[i] = etCached || new Y.DOMEventFacade(et, currentTarget, wrapper);"," "," }"," }",""," if (SCALE in e) {"," this[SCALE] = e[SCALE];"," }",""," if (ROTATION in e) {"," this[ROTATION] = e[ROTATION];"," }",""," if (IDENTIFIER in e) {"," this[IDENTIFIER] = e[IDENTIFIER];"," }","};","","//Adding MSPointer events to whitelisted DOM Events. MSPointer event payloads","//have the same properties as mouse events.","if (Y.Node.DOM_EVENTS) {"," Y.mix(Y.Node.DOM_EVENTS, {"," touchstart:1,"," touchmove:1,"," touchend:1,"," touchcancel:1,"," gesturestart:1,"," gesturechange:1,"," gestureend:1,"," MSPointerDown:1, "," MSPointerUp:1,"," MSPointerMove:1"," });","}","","//Add properties to Y.EVENT.GESTURE_MAP based on feature detection.","if ((win && (\"ontouchstart\" in win)) && !(Y.UA.chrome && Y.UA.chrome < 6)) {"," GESTURE_MAP.start = \"touchstart\";"," GESTURE_MAP.end = \"touchend\";"," GESTURE_MAP.move = \"touchmove\";"," GESTURE_MAP.cancel = \"touchcancel\";","}","","","","else if (win && (\"msPointerEnabled\" in win.navigator)) {"," GESTURE_MAP.start = \"MSPointerDown\";"," GESTURE_MAP.end = \"MSPointerUp\";"," GESTURE_MAP.move = \"MSPointerMove\";"," GESTURE_MAP.cancel = \"MSPointerCancel\";","}","","else {"," GESTURE_MAP.start = \"mousedown\";"," GESTURE_MAP.end = \"mouseup\";"," GESTURE_MAP.move = \"mousemove\";"," GESTURE_MAP.cancel = \"mousecancel\";","}","","/**"," * A object literal with keys \"start\", \"end\", and \"move\". The value for each key is a"," * string representing the event for that environment. For touch environments, the respective"," * values are \"touchstart\", \"touchend\" and \"touchmove\". Mouse and MSPointer environments are also"," * supported via feature detection."," *"," * @property _GESTURE_MAP"," * @type Object"," * @static"," */","Y.Event._GESTURE_MAP = GESTURE_MAP;","","","}, '@VERSION@', {\"requires\": [\"node-base\"]});","","}());"]}; } var __cov_Z8bDBh_pqbHA6UGgxTBUmA = __coverage__['build/event-touch/event-touch.js']; __cov_Z8bDBh_pqbHA6UGgxTBUmA.s['1']++;YUI.add('event-touch',function(Y,NAME){__cov_Z8bDBh_pqbHA6UGgxTBUmA.f['1']++;__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['2']++;var SCALE='scale',ROTATION='rotation',IDENTIFIER='identifier',win=Y.config.win,GESTURE_MAP={};__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['3']++;Y.DOMEventFacade.prototype._touch=function(e,currentTarget,wrapper){__cov_Z8bDBh_pqbHA6UGgxTBUmA.f['2']++;__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['4']++;var i,l,etCached,et,touchCache;__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['5']++;if(e.touches){__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['1'][0]++;__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['6']++;this.touches=[];__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['7']++;touchCache={};__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['8']++;for(i=0,l=e.touches.length;i<l;++i){__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['9']++;et=e.touches[i];__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['10']++;touchCache[Y.stamp(et)]=this.touches[i]=new Y.DOMEventFacade(et,currentTarget,wrapper);}}else{__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['1'][1]++;}__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['11']++;if(e.targetTouches){__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['2'][0]++;__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['12']++;this.targetTouches=[];__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['13']++;for(i=0,l=e.targetTouches.length;i<l;++i){__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['14']++;et=e.targetTouches[i];__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['15']++;etCached=(__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['3'][0]++,touchCache)&&(__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['3'][1]++,touchCache[Y.stamp(et,true)]);__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['16']++;this.targetTouches[i]=(__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['4'][0]++,etCached)||(__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['4'][1]++,new Y.DOMEventFacade(et,currentTarget,wrapper));}}else{__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['2'][1]++;}__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['17']++;if(e.changedTouches){__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['5'][0]++;__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['18']++;this.changedTouches=[];__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['19']++;for(i=0,l=e.changedTouches.length;i<l;++i){__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['20']++;et=e.changedTouches[i];__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['21']++;etCached=(__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['6'][0]++,touchCache)&&(__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['6'][1]++,touchCache[Y.stamp(et,true)]);__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['22']++;this.changedTouches[i]=(__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['7'][0]++,etCached)||(__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['7'][1]++,new Y.DOMEventFacade(et,currentTarget,wrapper));}}else{__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['5'][1]++;}__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['23']++;if(SCALE in e){__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['8'][0]++;__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['24']++;this[SCALE]=e[SCALE];}else{__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['8'][1]++;}__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['25']++;if(ROTATION in e){__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['9'][0]++;__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['26']++;this[ROTATION]=e[ROTATION];}else{__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['9'][1]++;}__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['27']++;if(IDENTIFIER in e){__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['10'][0]++;__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['28']++;this[IDENTIFIER]=e[IDENTIFIER];}else{__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['10'][1]++;}};__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['29']++;if(Y.Node.DOM_EVENTS){__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['11'][0]++;__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['30']++;Y.mix(Y.Node.DOM_EVENTS,{touchstart:1,touchmove:1,touchend:1,touchcancel:1,gesturestart:1,gesturechange:1,gestureend:1,MSPointerDown:1,MSPointerUp:1,MSPointerMove:1});}else{__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['11'][1]++;}__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['31']++;if((__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['13'][0]++,win)&&(__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['13'][1]++,'ontouchstart'in win)&&(__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['13'][2]++,!((__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['14'][0]++,Y.UA.chrome)&&(__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['14'][1]++,Y.UA.chrome<6)))){__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['12'][0]++;__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['32']++;GESTURE_MAP.start='touchstart';__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['33']++;GESTURE_MAP.end='touchend';__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['34']++;GESTURE_MAP.move='touchmove';__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['35']++;GESTURE_MAP.cancel='touchcancel';}else{__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['12'][1]++;__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['36']++;if((__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['16'][0]++,win)&&(__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['16'][1]++,'msPointerEnabled'in win.navigator)){__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['15'][0]++;__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['37']++;GESTURE_MAP.start='MSPointerDown';__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['38']++;GESTURE_MAP.end='MSPointerUp';__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['39']++;GESTURE_MAP.move='MSPointerMove';__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['40']++;GESTURE_MAP.cancel='MSPointerCancel';}else{__cov_Z8bDBh_pqbHA6UGgxTBUmA.b['15'][1]++;__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['41']++;GESTURE_MAP.start='mousedown';__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['42']++;GESTURE_MAP.end='mouseup';__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['43']++;GESTURE_MAP.move='mousemove';__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['44']++;GESTURE_MAP.cancel='mousecancel';}}__cov_Z8bDBh_pqbHA6UGgxTBUmA.s['45']++;Y.Event._GESTURE_MAP=GESTURE_MAP;},'@VERSION@',{'requires':['node-base']});
brunoksato/cdnjs
ajax/libs/yui/3.10.0/event-touch/event-touch-coverage.js
JavaScript
mit
17,217
if (typeof _yuitest_coverage == "undefined"){ _yuitest_coverage = {}; _yuitest_coverline = function(src, line){ var coverage = _yuitest_coverage[src]; if (!coverage.lines[line]){ coverage.calledLines++; } coverage.lines[line]++; }; _yuitest_coverfunc = function(src, name, line){ var coverage = _yuitest_coverage[src], funcId = name + ":" + line; if (!coverage.functions[funcId]){ coverage.calledFunctions++; } coverage.functions[funcId]++; }; } _yuitest_coverage["build/tabview-base/tabview-base.js"] = { lines: {}, functions: {}, coveredLines: 0, calledLines: 0, coveredFunctions: 0, calledFunctions: 0, path: "build/tabview-base/tabview-base.js", code: [] }; _yuitest_coverage["build/tabview-base/tabview-base.js"].code=["YUI.add('tabview-base', function (Y, NAME) {","","var getClassName = Y.ClassNameManager.getClassName,"," TABVIEW = 'tabview',"," TAB = 'tab',"," CONTENT = 'content',"," PANEL = 'panel',"," SELECTED = 'selected',"," EMPTY_OBJ = {},"," DOT = '.',",""," _classNames = {"," tabview: getClassName(TABVIEW),"," tabviewPanel: getClassName(TABVIEW, PANEL),"," tabviewList: getClassName(TABVIEW, 'list'),"," tab: getClassName(TAB),"," tabLabel: getClassName(TAB, 'label'),"," tabPanel: getClassName(TAB, PANEL),"," selectedTab: getClassName(TAB, SELECTED),"," selectedPanel: getClassName(TAB, PANEL, SELECTED)"," },",""," _queries = {"," tabview: DOT + _classNames.tabview,"," tabviewList: '> ul',"," tab: '> ul > li',"," tabLabel: '> ul > li > a ',"," tabviewPanel: '> div',"," tabPanel: '> div > div',"," selectedTab: '> ul > ' + DOT + _classNames.selectedTab,"," selectedPanel: '> div ' + DOT + _classNames.selectedPanel"," },",""," TabviewBase = function(config) {"," this.init.apply(this, arguments);"," };","","TabviewBase.NAME = 'tabviewBase';","TabviewBase._queries = _queries;","TabviewBase._classNames = _classNames;","","Y.mix(TabviewBase.prototype, {"," init: function(config) {"," config = config || EMPTY_OBJ;"," this._node = config.host || Y.one(config.node);",""," this.refresh();"," },",""," initClassNames: function(index) {"," Y.Object.each(_queries, function(query, name) {"," // this === tabview._node"," if (_classNames[name]) {"," var result = this.all(query);"," "," if (index !== undefined) {"," result = result.item(index);"," }",""," if (result) {"," result.addClass(_classNames[name]);"," }"," }"," }, this._node);",""," this._node.addClass(_classNames.tabview);"," },",""," _select: function(index) {"," var node = this._node,"," oldItem = node.one(_queries.selectedTab),"," oldContent = node.one(_queries.selectedPanel),"," newItem = node.all(_queries.tab).item(index),"," newContent = node.all(_queries.tabPanel).item(index);",""," if (oldItem) {"," oldItem.removeClass(_classNames.selectedTab);"," }",""," if (oldContent) {"," oldContent.removeClass(_classNames.selectedPanel);"," }",""," if (newItem) {"," newItem.addClass(_classNames.selectedTab);"," }",""," if (newContent) {"," newContent.addClass(_classNames.selectedPanel);"," }"," },",""," initState: function() {"," var node = this._node,"," activeNode = node.one(_queries.selectedTab),"," activeIndex = activeNode ?"," node.all(_queries.tab).indexOf(activeNode) : 0;",""," this._select(activeIndex);"," },",""," // collapse extra space between list-items"," _scrubTextNodes: function() {"," this._node.one(_queries.tabviewList).get('childNodes').each(function(node) {"," if (node.get('nodeType') === 3) { // text node"," node.remove();"," }"," });"," },",""," // base renderer only enlivens existing markup"," refresh: function() {"," this._scrubTextNodes();"," this.initClassNames();"," this.initState();"," this.initEvents();"," },",""," tabEventName: 'click',",""," initEvents: function() {"," // TODO: detach prefix for delegate?"," // this._node.delegate('tabview|' + this.tabEventName),"," this._node.delegate(this.tabEventName,"," this.onTabEvent,"," _queries.tab,"," this"," );"," },",""," onTabEvent: function(e) {"," e.preventDefault();"," this._select(this._node.all(_queries.tab).indexOf(e.currentTarget));"," },",""," destroy: function() {"," this._node.detach(this.tabEventName);"," }","});","","Y.TabviewBase = TabviewBase;","","","}, '@VERSION@', {\"requires\": [\"node-event-delegate\", \"classnamemanager\", \"skin-sam-tabview\"]});"]; _yuitest_coverage["build/tabview-base/tabview-base.js"].lines = {"1":0,"3":0,"35":0,"38":0,"39":0,"40":0,"42":0,"44":0,"45":0,"47":0,"51":0,"53":0,"54":0,"56":0,"57":0,"60":0,"61":0,"66":0,"70":0,"76":0,"77":0,"80":0,"81":0,"84":0,"85":0,"88":0,"89":0,"94":0,"99":0,"104":0,"105":0,"106":0,"113":0,"114":0,"115":0,"116":0,"124":0,"132":0,"133":0,"137":0,"141":0}; _yuitest_coverage["build/tabview-base/tabview-base.js"].functions = {"TabviewBase:34":0,"init:43":0,"(anonymous 2):51":0,"initClassNames:50":0,"_select:69":0,"initState:93":0,"(anonymous 3):104":0,"_scrubTextNodes:103":0,"refresh:112":0,"initEvents:121":0,"onTabEvent:131":0,"destroy:136":0,"(anonymous 1):1":0}; _yuitest_coverage["build/tabview-base/tabview-base.js"].coveredLines = 41; _yuitest_coverage["build/tabview-base/tabview-base.js"].coveredFunctions = 13; _yuitest_coverline("build/tabview-base/tabview-base.js", 1); YUI.add('tabview-base', function (Y, NAME) { _yuitest_coverfunc("build/tabview-base/tabview-base.js", "(anonymous 1)", 1); _yuitest_coverline("build/tabview-base/tabview-base.js", 3); var getClassName = Y.ClassNameManager.getClassName, TABVIEW = 'tabview', TAB = 'tab', CONTENT = 'content', PANEL = 'panel', SELECTED = 'selected', EMPTY_OBJ = {}, DOT = '.', _classNames = { tabview: getClassName(TABVIEW), tabviewPanel: getClassName(TABVIEW, PANEL), tabviewList: getClassName(TABVIEW, 'list'), tab: getClassName(TAB), tabLabel: getClassName(TAB, 'label'), tabPanel: getClassName(TAB, PANEL), selectedTab: getClassName(TAB, SELECTED), selectedPanel: getClassName(TAB, PANEL, SELECTED) }, _queries = { tabview: DOT + _classNames.tabview, tabviewList: '> ul', tab: '> ul > li', tabLabel: '> ul > li > a ', tabviewPanel: '> div', tabPanel: '> div > div', selectedTab: '> ul > ' + DOT + _classNames.selectedTab, selectedPanel: '> div ' + DOT + _classNames.selectedPanel }, TabviewBase = function(config) { _yuitest_coverfunc("build/tabview-base/tabview-base.js", "TabviewBase", 34); _yuitest_coverline("build/tabview-base/tabview-base.js", 35); this.init.apply(this, arguments); }; _yuitest_coverline("build/tabview-base/tabview-base.js", 38); TabviewBase.NAME = 'tabviewBase'; _yuitest_coverline("build/tabview-base/tabview-base.js", 39); TabviewBase._queries = _queries; _yuitest_coverline("build/tabview-base/tabview-base.js", 40); TabviewBase._classNames = _classNames; _yuitest_coverline("build/tabview-base/tabview-base.js", 42); Y.mix(TabviewBase.prototype, { init: function(config) { _yuitest_coverfunc("build/tabview-base/tabview-base.js", "init", 43); _yuitest_coverline("build/tabview-base/tabview-base.js", 44); config = config || EMPTY_OBJ; _yuitest_coverline("build/tabview-base/tabview-base.js", 45); this._node = config.host || Y.one(config.node); _yuitest_coverline("build/tabview-base/tabview-base.js", 47); this.refresh(); }, initClassNames: function(index) { _yuitest_coverfunc("build/tabview-base/tabview-base.js", "initClassNames", 50); _yuitest_coverline("build/tabview-base/tabview-base.js", 51); Y.Object.each(_queries, function(query, name) { // this === tabview._node _yuitest_coverfunc("build/tabview-base/tabview-base.js", "(anonymous 2)", 51); _yuitest_coverline("build/tabview-base/tabview-base.js", 53); if (_classNames[name]) { _yuitest_coverline("build/tabview-base/tabview-base.js", 54); var result = this.all(query); _yuitest_coverline("build/tabview-base/tabview-base.js", 56); if (index !== undefined) { _yuitest_coverline("build/tabview-base/tabview-base.js", 57); result = result.item(index); } _yuitest_coverline("build/tabview-base/tabview-base.js", 60); if (result) { _yuitest_coverline("build/tabview-base/tabview-base.js", 61); result.addClass(_classNames[name]); } } }, this._node); _yuitest_coverline("build/tabview-base/tabview-base.js", 66); this._node.addClass(_classNames.tabview); }, _select: function(index) { _yuitest_coverfunc("build/tabview-base/tabview-base.js", "_select", 69); _yuitest_coverline("build/tabview-base/tabview-base.js", 70); var node = this._node, oldItem = node.one(_queries.selectedTab), oldContent = node.one(_queries.selectedPanel), newItem = node.all(_queries.tab).item(index), newContent = node.all(_queries.tabPanel).item(index); _yuitest_coverline("build/tabview-base/tabview-base.js", 76); if (oldItem) { _yuitest_coverline("build/tabview-base/tabview-base.js", 77); oldItem.removeClass(_classNames.selectedTab); } _yuitest_coverline("build/tabview-base/tabview-base.js", 80); if (oldContent) { _yuitest_coverline("build/tabview-base/tabview-base.js", 81); oldContent.removeClass(_classNames.selectedPanel); } _yuitest_coverline("build/tabview-base/tabview-base.js", 84); if (newItem) { _yuitest_coverline("build/tabview-base/tabview-base.js", 85); newItem.addClass(_classNames.selectedTab); } _yuitest_coverline("build/tabview-base/tabview-base.js", 88); if (newContent) { _yuitest_coverline("build/tabview-base/tabview-base.js", 89); newContent.addClass(_classNames.selectedPanel); } }, initState: function() { _yuitest_coverfunc("build/tabview-base/tabview-base.js", "initState", 93); _yuitest_coverline("build/tabview-base/tabview-base.js", 94); var node = this._node, activeNode = node.one(_queries.selectedTab), activeIndex = activeNode ? node.all(_queries.tab).indexOf(activeNode) : 0; _yuitest_coverline("build/tabview-base/tabview-base.js", 99); this._select(activeIndex); }, // collapse extra space between list-items _scrubTextNodes: function() { _yuitest_coverfunc("build/tabview-base/tabview-base.js", "_scrubTextNodes", 103); _yuitest_coverline("build/tabview-base/tabview-base.js", 104); this._node.one(_queries.tabviewList).get('childNodes').each(function(node) { _yuitest_coverfunc("build/tabview-base/tabview-base.js", "(anonymous 3)", 104); _yuitest_coverline("build/tabview-base/tabview-base.js", 105); if (node.get('nodeType') === 3) { // text node _yuitest_coverline("build/tabview-base/tabview-base.js", 106); node.remove(); } }); }, // base renderer only enlivens existing markup refresh: function() { _yuitest_coverfunc("build/tabview-base/tabview-base.js", "refresh", 112); _yuitest_coverline("build/tabview-base/tabview-base.js", 113); this._scrubTextNodes(); _yuitest_coverline("build/tabview-base/tabview-base.js", 114); this.initClassNames(); _yuitest_coverline("build/tabview-base/tabview-base.js", 115); this.initState(); _yuitest_coverline("build/tabview-base/tabview-base.js", 116); this.initEvents(); }, tabEventName: 'click', initEvents: function() { // TODO: detach prefix for delegate? // this._node.delegate('tabview|' + this.tabEventName), _yuitest_coverfunc("build/tabview-base/tabview-base.js", "initEvents", 121); _yuitest_coverline("build/tabview-base/tabview-base.js", 124); this._node.delegate(this.tabEventName, this.onTabEvent, _queries.tab, this ); }, onTabEvent: function(e) { _yuitest_coverfunc("build/tabview-base/tabview-base.js", "onTabEvent", 131); _yuitest_coverline("build/tabview-base/tabview-base.js", 132); e.preventDefault(); _yuitest_coverline("build/tabview-base/tabview-base.js", 133); this._select(this._node.all(_queries.tab).indexOf(e.currentTarget)); }, destroy: function() { _yuitest_coverfunc("build/tabview-base/tabview-base.js", "destroy", 136); _yuitest_coverline("build/tabview-base/tabview-base.js", 137); this._node.detach(this.tabEventName); } }); _yuitest_coverline("build/tabview-base/tabview-base.js", 141); Y.TabviewBase = TabviewBase; }, '@VERSION@', {"requires": ["node-event-delegate", "classnamemanager", "skin-sam-tabview"]});
DaneTheory/cdnjs
ajax/libs/yui/3.7.0/tabview-base/tabview-base-coverage.js
JavaScript
mit
13,613
<!DOCTYPE html> <!-- Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license --> <!--[if IE 8]><html class="ie8"><![endif]--> <!--[if gt IE 8]><html><![endif]--> <!--[if !IE]><!--><html><!--<![endif]--> <head> <meta charset="utf-8"> <title>Toolbar Configurator</title> <script src="../../ckeditor.js"></script> <script> if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) CKEDITOR.tools.enableHtml5Elements( document ); </script> <link rel="stylesheet" href="lib/codemirror/codemirror.css"> <link rel="stylesheet" href="lib/codemirror/show-hint.css"> <link rel="stylesheet" href="lib/codemirror/neo.css"> <link rel="stylesheet" href="css/fontello.css"> <link rel="stylesheet" href="../css/samples.css"> </head> <body id="toolbar"> <nav class="navigation-a"> <div class="grid-container"> <ul class="navigation-a-left grid-width-70"> <li><a href="http://ckeditor.com">Project Homepage</a></li> <li><a href="http://dev.ckeditor.com/">I found a bug</a></li> <li><a href="http://github.com/ckeditor/ckeditor-dev" class="icon-pos-right icon-navigation-a-github">Fork CKEditor on GitHub</a></li> </ul> <ul class="navigation-a-right grid-width-30"> <li><a href="http://ckeditor.com/blog-list">CKEditor Blog</a></li> </ul> </div> </nav> <header class="header-a"> <div class="grid-container"> <h1 class="header-a-logo grid-width-30"> <a href="../index.html"><img src="../img/logo.png" alt="CKEditor Logo"></a> </h1> <nav class="navigation-b grid-width-70"> <ul> <li><a href="../index.html" class="button-a">Start</a></li> <li><a href="index.html" class="button-a button-a-background">Toolbar configurator</a></li> </ul> </nav> </div> </header> <main> <div class="adjoined-top"> <div class="grid-container"> <div class="content grid-width-100"> <div class="grid-container-nested"> <h1 class="grid-width-60"> Toolbar Configurator <a href="#help-content" type="button" title="Configurator help" id="help" class="button-a button-a-background button-a-no-text icon-pos-left icon-question-mark">Help</a> </h1> <div class="grid-width-40 grid-switch-magic"> <div class="switch"> <span class="balloon-a balloon-a-se">Select configurator type</span> <input type="radio" name="radio" data-num="1" id="radio-basic" /> <input type="radio" name="radio" data-num="2" id="radio-advanced" /> <label data-for="1" for="radio-basic">Basic</label> <span class="switch-inner"> <span class="handler"></span> </span> <label data-for="2" for="radio-advanced">Advanced</label> </div> </div> </div> </div> </div> </div> <div class="adjoined-bottom"> <div class="grid-container"> <div class="grid-width-100"> <div class="editors-container"> <div id="editor-basic"></div> <div id="editor-advanced"></div> </div> </div> </div> </div> <div class="grid-container configurator"> <div class="content grid-width-100"> <div class="configurator"> <div> <div id="toolbarModifierWrapper"></div> </div> </div> </div> </div> <div id="help-content"> <div class="grid-container"> <div class="grid-width-100"> <h2>What Am I Doing Here?</h2> <div class="grid-container grid-container-nested"> <div class="basic"> <div class="grid-width-50"> <p>Arrange <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbarGroups">toolbar groups</a>, toggle <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-removeButtons">button visibility</a> according to your needs and get your toolbar configuration.</p> <p>You can replace the content of the <a href="../../config.js"><code>config.js</code></a> file with the generated configuration. If you already set some configuration options you will need to merge both configurations.</p> </div> <div class="grid-width-50"> <p>Read more about different ways of <a href="http://docs.ckeditor.com/#!/guide/dev_configuration">setting configuration</a> and do not forget about <strong>clearing browser cache</strong>.</p> <p>Arranging toolbar groups is the recommended way of configuring the toolbar, but if you need more freedom you can use the <a href="#advanced">advanced configurator</a>.</p> </div> </div> <div class="advanced" style="display: none;"> <div class="grid-width-50"> <p>With this code editor you can edit your <a href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-toolbar">toolbar configuration</a> live.</p> <p>You can replace the content of the <a href="../../config.js"><code>config.js</code></a> file with the generated configuration. If you already set some configuration options you will need to merge both configurations.</p> </div> <div class="grid-width-50"> <p>Read more about different ways of <a href="http://docs.ckeditor.com/#!/guide/dev_configuration">setting configuration</a> and do not forget about <strong>clearing browser cache</strong>.</p> </div> </div> </div> <p class="grid-container grid-container-nested"> <button type="button" class="help-content-close grid-width-100 button-a button-a-background">Got it. Let's play!</button> </p> </div> </div> </div> </main> <footer class="footer-a grid-container"> <p class="grid-width-100"> CKEditor &ndash; The text editor for the Internet &ndash; <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p class="grid-width-100" id="copy"> Copyright &copy; 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> &ndash; Frederico Knabben. All rights reserved. </p> </footer> <script src="lib/codemirror/codemirror.js"></script> <script src="lib/codemirror/javascript.js"></script> <script src="lib/codemirror/show-hint.js"></script> <script src="js/fulltoolbareditor.js"></script> <script src="js/abstracttoolbarmodifier.js"></script> <script src="js/toolbarmodifier.js"></script> <script src="js/toolbartextmodifier.js"></script> <script src="../js/sf.js"></script> <script> ( function() { 'use strict'; var mode = ( window.location.hash.substr( 1 ) === 'advanced' ) ? 'advanced' : 'basic', configuratorSection = CKEDITOR.document.findOne( 'main > .grid-container.configurator' ), basicInstruction = CKEDITOR.document.findOne( '#help-content .basic' ), advancedInstruction = CKEDITOR.document.findOne( '#help-content .advanced' ), // Configurator mode switcher. modeSwitchBasic = CKEDITOR.document.getById( 'radio-basic' ), modeSwitchAdvanced = CKEDITOR.document.getById( 'radio-advanced' ); // Initial setup function updateSwitcher() { if ( mode === 'advanced' ) { modeSwitchAdvanced.$.checked = true; } else { modeSwitchBasic.$.checked = true; } } updateSwitcher(); CKEDITOR.document.getWindow().on( 'hashchange', function( e ) { var hash = window.location.hash.substr( 1 ); if ( !( hash === 'advanced' || hash === 'basic' ) ) { return; } mode = hash; onToolbarsDone( mode ); } ); CKEDITOR.document.getWindow().on( 'resize', function() { updateToolbar( ( mode === 'basic' ? toolbarModifier : toolbarTextModifier )[ 'editorInstance' ] ); } ); function onRefresh( modifier ) { modifier = modifier || this; if ( mode === 'basic' && modifier instanceof ToolbarConfigurator.ToolbarTextModifier ) { return; } // CodeMirror container becomes visible, so we need to refresh and to avoid rendering problems. if ( mode === 'advanced' && modifier instanceof ToolbarConfigurator.ToolbarTextModifier ) { modifier.codeContainer.refresh(); } updateToolbar( modifier.editorInstance ); } function updateToolbar( editor ) { var editorContainer = editor.container; // Not always editor is loaded. if ( !editorContainer ) { return; } var displayStyle = editorContainer.getStyle( 'display' ); editorContainer.setStyle( 'display', 'block' ); var newHeight = editorContainer.getSize( 'height' ); var newMarginTop = parseInt( editorContainer.getComputedStyle( 'margin-top' ), 10 ); newMarginTop = ( isNaN( newMarginTop ) ? 0 : Number( newMarginTop ) ); var newMarginBottom = parseInt( editorContainer.getComputedStyle( 'margin-bottom' ), 10 ); newMarginBottom = ( isNaN( newMarginBottom ) ? 0 : Number( newMarginBottom ) ); var result = newHeight + newMarginTop + newMarginBottom; editorContainer.setStyle( 'display', displayStyle ); editor.container.getAscendant( 'div' ).setStyle( 'height', result + 'px' ); } var toolbarModifier = new ToolbarConfigurator.ToolbarModifier( 'editor-basic' ); var done = 0; toolbarModifier.init( onToolbarInit ); toolbarModifier.onRefresh = onRefresh; CKEDITOR.document.getById( 'toolbarModifierWrapper' ).append( toolbarModifier.mainContainer ); var toolbarTextModifier = new ToolbarConfigurator.ToolbarTextModifier( 'editor-advanced' ); toolbarTextModifier.init( onToolbarInit ); toolbarTextModifier.onRefresh = onRefresh; function onToolbarInit() { if ( ++done === 2 ) { onToolbarsDone(); positionSticky.watch( CKEDITOR.document.findOne( '.toolbar' ), function() { return mode === 'advanced'; } ); } } function onToolbarsDone() { if ( mode === 'basic' ) { toggleModeBasic( false ); } else { toggleModeAdvanced( false ); } updateSwitcher(); setTimeout( function() { CKEDITOR.document.findOne( '.editors-container' ).addClass( 'active' ); CKEDITOR.document.findOne( '#toolbarModifierWrapper' ).addClass( 'active' ); }, 200 ); } CKEDITOR.document.getById( 'toolbarModifierWrapper' ).append( toolbarTextModifier.mainContainer ); function toogleModeSwitch( onElement, offElement, onModifier, offModifier ) { onElement.addClass( 'fancy-button-active' ); offElement.removeClass( 'fancy-button-active' ); onModifier.showUI(); offModifier.hideUI(); } function toggleModeBasic( callOnRefresh ) { callOnRefresh = ( callOnRefresh !== false ); mode = 'basic'; window.location.hash = '#basic'; toogleModeSwitch( modeSwitchBasic, modeSwitchAdvanced, toolbarModifier, toolbarTextModifier ); configuratorSection.removeClass( 'freed-width' ); basicInstruction.show(); advancedInstruction.hide(); callOnRefresh && onRefresh( toolbarModifier ); } function toggleModeAdvanced( callOnRefresh ) { callOnRefresh = ( callOnRefresh !== false ); mode = 'advanced'; window.location.hash = '#advanced'; toogleModeSwitch( modeSwitchAdvanced, modeSwitchBasic, toolbarTextModifier, toolbarModifier ); configuratorSection.addClass( 'freed-width' ); advancedInstruction.show(); basicInstruction.hide(); callOnRefresh && onRefresh( toolbarTextModifier ); } modeSwitchBasic.on( 'click', toggleModeBasic ); modeSwitchAdvanced.on( 'click', toggleModeAdvanced ); // // Position:sticky for the toolbar. // // Will make elements behave like they were styled with position:sticky. var positionSticky = { // Store object: { // element: CKEDITOR.dom.element, // Element which will float. // placeholder: CKEDITOR.dom.element, // Placeholder which is place to prevent page bounce. // isFixed: boolean // Whether element float now. // } watched: [], active: [], staticContainer: null, init: function() { var element = CKEDITOR.dom.element.createFromHtml( '<div class="staticContainer">' + '<div class="grid-container" >' + '<div class="grid-width-100">' + '<div class="inner"></div>' + '</div>' + '</div>' + '</div>' ); this.staticContainer = element.findOne( '.inner' ); CKEDITOR.document.getBody().append( element ); }, watch: function( element, preventFunc ) { this.watched.push( { element: element, placeholder: new CKEDITOR.dom.element( 'div' ), isFixed: false, preventFunc: preventFunc } ); }, checkAll: function() { for ( var i = 0; i < this.watched.length; i++ ) { this.check( this.watched[ i ] ); } }, check: function( element ) { var isFixed = element.isFixed; var shouldBeFixed = this.shouldBeFixed( element ); // Nothing to be done. if ( isFixed === shouldBeFixed ) { return; } var placeholder = element.placeholder; if ( isFixed ) { // Unfixing. element.element.insertBefore( placeholder ); placeholder.remove(); element.element.removeStyle( 'margin' ); this.active.splice( CKEDITOR.tools.indexOf( this.active, element ), 1 ); } else { // Fixing. placeholder.setStyle( 'width', element.element.getSize( 'width' ) + 'px' ); placeholder.setStyle( 'height', element.element.getSize( 'height' ) + 'px' ); placeholder.setStyle( 'margin-bottom', element.element.getComputedStyle( 'margin-bottom' ) ); placeholder.setStyle( 'display', element.element.getComputedStyle( 'display' ) ); placeholder.insertAfter( element.element ); this.staticContainer.append( element.element ); this.active.push( element ); } element.isFixed = !element.isFixed; }, shouldBeFixed: function( element ) { if ( element.preventFunc && element.preventFunc() ) { return false; } // If element is already fixed we are checking it's placeholder. var related = ( element.isFixed ? element.placeholder : element.element ), clientRect = related.$.getBoundingClientRect(), staticHeight = this.staticContainer.getSize('height' ), elemHeight = element.element.getSize( 'height' ); if ( element.isFixed ) { return ( clientRect.top + elemHeight < staticHeight ); } else { return ( clientRect.top < staticHeight ); } } }; positionSticky.init(); CKEDITOR.document.getWindow().on( 'scroll', new CKEDITOR.tools.eventsBuffer( 100, positionSticky.checkAll, positionSticky ).input ); // Make the toolbar sticky. positionSticky.watch( CKEDITOR.document.findOne( '.editors-container' ) ); // Help button and help-content. ( function() { var helpButton = CKEDITOR.document.getById( 'help' ), helpContent = CKEDITOR.document.getById( 'help-content' ); // Don't show help button on IE8 because it's unsupported by Pico Modal. if ( CKEDITOR.env.ie && CKEDITOR.env.version == 8 ) { helpButton.hide(); } else { // Display help modal when the button is clicked. helpButton.on( 'click', function( evt ) { SF.modal( { // Clone modal content from DOM. content: helpContent.getHtml(), afterCreate: function( modal ) { // Enable modal content button to close the modal. new CKEDITOR.dom.element( modal.modalElem() ).findOne( '.help-content-close' ).once( 'click', modal.close ); } } ).show(); } ); } } )(); } )(); </script> </body> </html>
restaandy/sia
aset/plugins/ckeditor/samples/toolbarconfigurator/index.html
HTML
mit
15,003
.CodeMirror-simplescroll-horizontal div,.CodeMirror-simplescroll-vertical div{position:absolute;background:#ccc;-moz-box-sizing:border-box;box-sizing:border-box;border:1px solid #bbb;border-radius:2px}.CodeMirror-simplescroll-horizontal,.CodeMirror-simplescroll-vertical{position:absolute;z-index:6;background:#eee}.CodeMirror-simplescroll-horizontal{bottom:0;left:0;height:8px}.CodeMirror-simplescroll-horizontal div{bottom:0;height:100%}.CodeMirror-simplescroll-vertical{right:0;top:0;width:8px}.CodeMirror-simplescroll-vertical div{right:0;width:100%}.CodeMirror-overlayscroll .CodeMirror-gutter-filler,.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler{display:none}.CodeMirror-overlayscroll-horizontal div,.CodeMirror-overlayscroll-vertical div{position:absolute;background:#bcd;border-radius:3px}.CodeMirror-overlayscroll-horizontal,.CodeMirror-overlayscroll-vertical{position:absolute;z-index:6}.CodeMirror-overlayscroll-horizontal{bottom:0;left:0;height:6px}.CodeMirror-overlayscroll-horizontal div{bottom:0;height:100%}.CodeMirror-overlayscroll-vertical{right:0;top:0;width:6px}.CodeMirror-overlayscroll-vertical div{right:0;width:100%}
abbychau/cdnjs
ajax/libs/codemirror/4.10.0/addon/scroll/simplescrollbars.min.css
CSS
mit
1,149
if (typeof _yuitest_coverage == "undefined"){ _yuitest_coverage = {}; _yuitest_coverline = function(src, line){ var coverage = _yuitest_coverage[src]; if (!coverage.lines[line]){ coverage.calledLines++; } coverage.lines[line]++; }; _yuitest_coverfunc = function(src, name, line){ var coverage = _yuitest_coverage[src], funcId = name + ":" + line; if (!coverage.functions[funcId]){ coverage.calledFunctions++; } coverage.functions[funcId]++; }; } _yuitest_coverage["build/button-core/button-core.js"] = { lines: {}, functions: {}, coveredLines: 0, calledLines: 0, coveredFunctions: 0, calledFunctions: 0, path: "build/button-core/button-core.js", code: [] }; _yuitest_coverage["build/button-core/button-core.js"].code=["YUI.add('button-core', function (Y, NAME) {","","/**","* Provides an interface for working with button-like DOM nodes","*","* @module button-core","* @since 3.5.0","*/","","var getClassName = Y.ClassNameManager.getClassName;","","/**","* Creates a button","*","* @class ButtonCore","* @param config {Object} Configuration object","* @constructor","*/","function Button(config) {"," this.initializer(config);","}","","Button.prototype = {"," TEMPLATE: '<button/>',",""," constructor: Button,",""," /**"," * @method initializer"," * @description Internal init() handler."," * @param config {Object} Config object."," * @private"," */"," initializer: function(config) {"," this._initNode(config);"," this._initAttributes(config);"," this._renderUI(config);"," },",""," /**"," * @method _initNode"," * @description Node initializer"," * @param config {Object} Config object."," * @private"," */"," _initNode: function(config) {"," if (config.host) {"," this._host = Y.one(config.host);"," } else {"," this._host = Y.Node.create(this.TEMPLATE);"," }"," },",""," /**"," * @method _initAttributes"," * @description Attribute initializer"," * @param config {Object} Config object."," * @private"," */"," _initAttributes: function(config) {"," var host = this._host,"," node = host.one('.' + Button.CLASS_NAMES.LABEL) || host;"," "," config.label = config.label || this._getLabel(node);"," Y.AttributeCore.call(this, Button.ATTRS, config);"," },",""," /**"," * @method renderUI"," * @description Renders any UI/DOM elements for Button instances"," * @param config {Object} Config object."," * @private"," */"," _renderUI: function(config) {"," var node = this.getNode(),"," tagName = node.get('tagName').toLowerCase();",""," // Set some default node attributes"," node.addClass(Button.CLASS_NAMES.BUTTON);"," "," if (tagName !== 'button' && tagName !== 'input') {"," node.set('role', 'button'); "," }"," },",""," /**"," * @method enable "," * @description Sets the button's `disabled` DOM attribute to false"," * @public"," */"," enable: function() {"," this.set('disabled', false);"," },",""," /**"," * @method disable"," * @description Sets the button's `disabled` DOM attribute to true"," * @public"," */"," disable: function() {"," this.set('disabled', true);"," },",""," /**"," * @method getNode"," * @description Gets the host node for this button instance"," * @public"," */"," getNode: function() {"," return this._host;"," },"," "," /**"," * @method _getLabel"," * @description Getter for a button's 'label' ATTR"," * @private"," */"," _getLabel: function () {"," var node = this.getNode(),"," tagName = node.get('tagName').toLowerCase(),"," label;",""," if (tagName === 'input') {"," label = node.get('value');"," }"," else {"," label = (node.one('.' + Button.CLASS_NAMES.LABEL) || node).get('text');"," }"," "," return label;"," },"," "," /**"," * @method _uiSetLabel"," * @description Setter for a button's 'label' ATTR"," * @param label {string}"," * @private"," */"," _uiSetLabel: function (label) {"," var node = this.getNode(),"," tagName = node.get('tagName').toLowerCase();",""," if (tagName === 'input') {"," node.set('value', label);"," } else {"," (node.one('.' + Button.CLASS_NAMES.LABEL) || node).set('text', label);"," }",""," return label;"," },",""," /**"," * @method _uiSetDisabled"," * @description Setter for the 'disabled' ATTR"," * @param value {boolean}"," * @private"," */"," _uiSetDisabled: function(value) {"," var node = this.getNode();"," "," node.getDOMNode().disabled = value; // avoid rerunning setter when this === node"," node.toggleClass(Button.CLASS_NAMES.DISABLED, value);"," "," return value;"," }","};","","/**","* Attribute configuration.","*","* @property ATTRS","* @type {Object}","* @private","* @static","*/","Button.ATTRS = {"," label: {"," setter: '_uiSetLabel',"," getter: '_getLabel',"," lazyAdd: false"," },",""," disabled: {"," value: false,"," setter: '_uiSetDisabled',"," lazyAdd: false"," }","};","","/**","* Name of this component.","*","* @property NAME","* @type String","* @static","*/","Button.NAME = \"button\";","","/**","* Array of static constants used to identify the classnames applied to DOM nodes","*","* @property CLASS_NAMES","* @type {Object}","* @public","* @static","*/","Button.CLASS_NAMES = {"," BUTTON : getClassName('button'),"," DISABLED: getClassName('button', 'disabled'),"," SELECTED: getClassName('button', 'selected'),"," LABEL : getClassName('button', 'label')","};","","/**","* Array of static constants used to for applying ARIA states","*","* @property CLASS_NAMES","* @type {Object}","* @private","* @static","*/","Button.ARIA_STATES = {"," PRESSED : 'aria-pressed',"," CHECKED : 'aria-checked'","};","","/**","* Array of static constants used to for applying ARIA roles","*","* @property CLASS_NAMES","* @type {Object}","* @private","* @static","*/","Button.ARIA_ROLES = {"," BUTTON : 'button',"," CHECKBOX: 'checkbox',"," TOGGLE : 'toggle'","};","","Y.mix(Button.prototype, Y.AttributeCore.prototype);","","// Export Button","Y.ButtonCore = Button;","","","}, '@VERSION@', {\"requires\": [\"attribute-core\", \"classnamemanager\", \"node-base\"]});"]; _yuitest_coverage["build/button-core/button-core.js"].lines = {"1":0,"10":0,"19":0,"20":0,"23":0,"35":0,"36":0,"37":0,"47":0,"48":0,"50":0,"61":0,"64":0,"65":0,"75":0,"79":0,"81":0,"82":0,"92":0,"101":0,"110":0,"119":0,"123":0,"124":0,"127":0,"130":0,"140":0,"143":0,"144":0,"146":0,"149":0,"159":0,"161":0,"162":0,"164":0,"176":0,"197":0,"207":0,"222":0,"235":0,"241":0,"244":0}; _yuitest_coverage["build/button-core/button-core.js"].functions = {"Button:19":0,"initializer:34":0,"_initNode:46":0,"_initAttributes:60":0,"_renderUI:74":0,"enable:91":0,"disable:100":0,"getNode:109":0,"_getLabel:118":0,"_uiSetLabel:139":0,"_uiSetDisabled:158":0,"(anonymous 1):1":0}; _yuitest_coverage["build/button-core/button-core.js"].coveredLines = 42; _yuitest_coverage["build/button-core/button-core.js"].coveredFunctions = 12; _yuitest_coverline("build/button-core/button-core.js", 1); YUI.add('button-core', function (Y, NAME) { /** * Provides an interface for working with button-like DOM nodes * * @module button-core * @since 3.5.0 */ _yuitest_coverfunc("build/button-core/button-core.js", "(anonymous 1)", 1); _yuitest_coverline("build/button-core/button-core.js", 10); var getClassName = Y.ClassNameManager.getClassName; /** * Creates a button * * @class ButtonCore * @param config {Object} Configuration object * @constructor */ _yuitest_coverline("build/button-core/button-core.js", 19); function Button(config) { _yuitest_coverfunc("build/button-core/button-core.js", "Button", 19); _yuitest_coverline("build/button-core/button-core.js", 20); this.initializer(config); } _yuitest_coverline("build/button-core/button-core.js", 23); Button.prototype = { TEMPLATE: '<button/>', constructor: Button, /** * @method initializer * @description Internal init() handler. * @param config {Object} Config object. * @private */ initializer: function(config) { _yuitest_coverfunc("build/button-core/button-core.js", "initializer", 34); _yuitest_coverline("build/button-core/button-core.js", 35); this._initNode(config); _yuitest_coverline("build/button-core/button-core.js", 36); this._initAttributes(config); _yuitest_coverline("build/button-core/button-core.js", 37); this._renderUI(config); }, /** * @method _initNode * @description Node initializer * @param config {Object} Config object. * @private */ _initNode: function(config) { _yuitest_coverfunc("build/button-core/button-core.js", "_initNode", 46); _yuitest_coverline("build/button-core/button-core.js", 47); if (config.host) { _yuitest_coverline("build/button-core/button-core.js", 48); this._host = Y.one(config.host); } else { _yuitest_coverline("build/button-core/button-core.js", 50); this._host = Y.Node.create(this.TEMPLATE); } }, /** * @method _initAttributes * @description Attribute initializer * @param config {Object} Config object. * @private */ _initAttributes: function(config) { _yuitest_coverfunc("build/button-core/button-core.js", "_initAttributes", 60); _yuitest_coverline("build/button-core/button-core.js", 61); var host = this._host, node = host.one('.' + Button.CLASS_NAMES.LABEL) || host; _yuitest_coverline("build/button-core/button-core.js", 64); config.label = config.label || this._getLabel(node); _yuitest_coverline("build/button-core/button-core.js", 65); Y.AttributeCore.call(this, Button.ATTRS, config); }, /** * @method renderUI * @description Renders any UI/DOM elements for Button instances * @param config {Object} Config object. * @private */ _renderUI: function(config) { _yuitest_coverfunc("build/button-core/button-core.js", "_renderUI", 74); _yuitest_coverline("build/button-core/button-core.js", 75); var node = this.getNode(), tagName = node.get('tagName').toLowerCase(); // Set some default node attributes _yuitest_coverline("build/button-core/button-core.js", 79); node.addClass(Button.CLASS_NAMES.BUTTON); _yuitest_coverline("build/button-core/button-core.js", 81); if (tagName !== 'button' && tagName !== 'input') { _yuitest_coverline("build/button-core/button-core.js", 82); node.set('role', 'button'); } }, /** * @method enable * @description Sets the button's `disabled` DOM attribute to false * @public */ enable: function() { _yuitest_coverfunc("build/button-core/button-core.js", "enable", 91); _yuitest_coverline("build/button-core/button-core.js", 92); this.set('disabled', false); }, /** * @method disable * @description Sets the button's `disabled` DOM attribute to true * @public */ disable: function() { _yuitest_coverfunc("build/button-core/button-core.js", "disable", 100); _yuitest_coverline("build/button-core/button-core.js", 101); this.set('disabled', true); }, /** * @method getNode * @description Gets the host node for this button instance * @public */ getNode: function() { _yuitest_coverfunc("build/button-core/button-core.js", "getNode", 109); _yuitest_coverline("build/button-core/button-core.js", 110); return this._host; }, /** * @method _getLabel * @description Getter for a button's 'label' ATTR * @private */ _getLabel: function () { _yuitest_coverfunc("build/button-core/button-core.js", "_getLabel", 118); _yuitest_coverline("build/button-core/button-core.js", 119); var node = this.getNode(), tagName = node.get('tagName').toLowerCase(), label; _yuitest_coverline("build/button-core/button-core.js", 123); if (tagName === 'input') { _yuitest_coverline("build/button-core/button-core.js", 124); label = node.get('value'); } else { _yuitest_coverline("build/button-core/button-core.js", 127); label = (node.one('.' + Button.CLASS_NAMES.LABEL) || node).get('text'); } _yuitest_coverline("build/button-core/button-core.js", 130); return label; }, /** * @method _uiSetLabel * @description Setter for a button's 'label' ATTR * @param label {string} * @private */ _uiSetLabel: function (label) { _yuitest_coverfunc("build/button-core/button-core.js", "_uiSetLabel", 139); _yuitest_coverline("build/button-core/button-core.js", 140); var node = this.getNode(), tagName = node.get('tagName').toLowerCase(); _yuitest_coverline("build/button-core/button-core.js", 143); if (tagName === 'input') { _yuitest_coverline("build/button-core/button-core.js", 144); node.set('value', label); } else { _yuitest_coverline("build/button-core/button-core.js", 146); (node.one('.' + Button.CLASS_NAMES.LABEL) || node).set('text', label); } _yuitest_coverline("build/button-core/button-core.js", 149); return label; }, /** * @method _uiSetDisabled * @description Setter for the 'disabled' ATTR * @param value {boolean} * @private */ _uiSetDisabled: function(value) { _yuitest_coverfunc("build/button-core/button-core.js", "_uiSetDisabled", 158); _yuitest_coverline("build/button-core/button-core.js", 159); var node = this.getNode(); _yuitest_coverline("build/button-core/button-core.js", 161); node.getDOMNode().disabled = value; // avoid rerunning setter when this === node _yuitest_coverline("build/button-core/button-core.js", 162); node.toggleClass(Button.CLASS_NAMES.DISABLED, value); _yuitest_coverline("build/button-core/button-core.js", 164); return value; } }; /** * Attribute configuration. * * @property ATTRS * @type {Object} * @private * @static */ _yuitest_coverline("build/button-core/button-core.js", 176); Button.ATTRS = { label: { setter: '_uiSetLabel', getter: '_getLabel', lazyAdd: false }, disabled: { value: false, setter: '_uiSetDisabled', lazyAdd: false } }; /** * Name of this component. * * @property NAME * @type String * @static */ _yuitest_coverline("build/button-core/button-core.js", 197); Button.NAME = "button"; /** * Array of static constants used to identify the classnames applied to DOM nodes * * @property CLASS_NAMES * @type {Object} * @public * @static */ _yuitest_coverline("build/button-core/button-core.js", 207); Button.CLASS_NAMES = { BUTTON : getClassName('button'), DISABLED: getClassName('button', 'disabled'), SELECTED: getClassName('button', 'selected'), LABEL : getClassName('button', 'label') }; /** * Array of static constants used to for applying ARIA states * * @property CLASS_NAMES * @type {Object} * @private * @static */ _yuitest_coverline("build/button-core/button-core.js", 222); Button.ARIA_STATES = { PRESSED : 'aria-pressed', CHECKED : 'aria-checked' }; /** * Array of static constants used to for applying ARIA roles * * @property CLASS_NAMES * @type {Object} * @private * @static */ _yuitest_coverline("build/button-core/button-core.js", 235); Button.ARIA_ROLES = { BUTTON : 'button', CHECKBOX: 'checkbox', TOGGLE : 'toggle' }; _yuitest_coverline("build/button-core/button-core.js", 241); Y.mix(Button.prototype, Y.AttributeCore.prototype); // Export Button _yuitest_coverline("build/button-core/button-core.js", 244); Y.ButtonCore = Button; }, '@VERSION@', {"requires": ["attribute-core", "classnamemanager", "node-base"]});
StoneCypher/cdnjs
ajax/libs/yui/3.7.3/button-core/button-core-coverage.js
JavaScript
mit
16,364
/* Copyright 2016 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package v1beta1 import ( "k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/v1" ) // +genclient=true // StatefulSet represents a set of pods with consistent identities. // Identities are defined as: // - Network: A single stable DNS and hostname. // - Storage: As many VolumeClaims as requested. // The StatefulSet guarantees that a given network identity will always // map to the same storage identity. type StatefulSet struct { unversioned.TypeMeta `json:",inline"` // +optional v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec defines the desired identities of pods in this set. // +optional Spec StatefulSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // Status is the current status of Pods in this StatefulSet. This data // may be out of date by some window of time. // +optional Status StatefulSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // A StatefulSetSpec is the specification of a StatefulSet. type StatefulSetSpec struct { // Replicas is the desired number of replicas of the given Template. // These are replicas in the sense that they are instantiations of the // same Template, but individual replicas also have a consistent identity. // If unspecified, defaults to 1. // TODO: Consider a rename of this field. // +optional Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` // Selector is a label query over pods that should match the replica count. // If empty, defaulted to labels on the pod template. // More info: http://kubernetes.io/docs/user-guide/labels#label-selectors // +optional Selector *unversioned.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"` // Template is the object that describes the pod that will be created if // insufficient replicas are detected. Each pod stamped out by the StatefulSet // will fulfill this Template, but have a unique identity from the rest // of the StatefulSet. Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"` // VolumeClaimTemplates is a list of claims that pods are allowed to reference. // The StatefulSet controller is responsible for mapping network identities to // claims in a way that maintains the identity of a pod. Every claim in // this list must have at least one matching (by name) volumeMount in one // container in the template. A claim in this list takes precedence over // any volumes in the template, with the same name. // TODO: Define the behavior if a claim already exists with the same name. // +optional VolumeClaimTemplates []v1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty" protobuf:"bytes,4,rep,name=volumeClaimTemplates"` // ServiceName is the name of the service that governs this StatefulSet. // This service must exist before the StatefulSet, and is responsible for // the network identity of the set. Pods get DNS/hostnames that follow the // pattern: pod-specific-string.serviceName.default.svc.cluster.local // where "pod-specific-string" is managed by the StatefulSet controller. ServiceName string `json:"serviceName" protobuf:"bytes,5,opt,name=serviceName"` } // StatefulSetStatus represents the current state of a StatefulSet. type StatefulSetStatus struct { // most recent generation observed by this autoscaler. // +optional ObservedGeneration *int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"` // Replicas is the number of actual replicas. Replicas int32 `json:"replicas" protobuf:"varint,2,opt,name=replicas"` } // StatefulSetList is a collection of StatefulSets. type StatefulSetList struct { unversioned.TypeMeta `json:",inline"` // +optional unversioned.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` Items []StatefulSet `json:"items" protobuf:"bytes,2,rep,name=items"` }
applariat/go-apl
vendor/k8s.io/client-go/pkg/apis/apps/v1beta1/types.go
GO
mit
4,513
// Copyright (c) 2011-2013 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "key.h" #include "keystore.h" #include "policy/policy.h" #include "script/script.h" #include "script/script_error.h" #include "script/interpreter.h" #include "script/sign.h" #include "uint256.h" #include "test/test_bitcoin.h" #ifdef ENABLE_WALLET #include "wallet/wallet_ismine.h" #endif #include <boost/foreach.hpp> #include <boost/test/unit_test.hpp> using namespace std; typedef vector<unsigned char> valtype; BOOST_FIXTURE_TEST_SUITE(multisig_tests, BasicTestingSetup) CScript sign_multisig(CScript scriptPubKey, vector<CKey> keys, CTransaction transaction, int whichIn) { uint256 hash = SignatureHash(scriptPubKey, transaction, whichIn, SIGHASH_ALL); CScript result; result << OP_0; // CHECKMULTISIG bug workaround BOOST_FOREACH(const CKey &key, keys) { vector<unsigned char> vchSig; BOOST_CHECK(key.Sign(hash, vchSig)); vchSig.push_back((unsigned char)SIGHASH_ALL); result << vchSig; } return result; } BOOST_AUTO_TEST_CASE(multisig_verify) { unsigned int flags = SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC; ScriptError err; CKey key[4]; for (int i = 0; i < 4; i++) key[i].MakeNewKey(true); CScript a_and_b; a_and_b << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; CScript a_or_b; a_or_b << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; CScript escrow; escrow << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()) << OP_3 << OP_CHECKMULTISIG; CMutableTransaction txFrom; // Funding transaction txFrom.vout.resize(3); txFrom.vout[0].scriptPubKey = a_and_b; txFrom.vout[1].scriptPubKey = a_or_b; txFrom.vout[2].scriptPubKey = escrow; CMutableTransaction txTo[3]; // Spending transaction for (int i = 0; i < 3; i++) { txTo[i].vin.resize(1); txTo[i].vout.resize(1); txTo[i].vin[0].prevout.n = i; txTo[i].vin[0].prevout.hash = txFrom.GetHash(); txTo[i].vout[0].nValue = 1; } vector<CKey> keys; CScript s; // Test a AND b: keys.assign(1,key[0]); keys.push_back(key[1]); s = sign_multisig(a_and_b, keys, txTo[0], 0); BOOST_CHECK(VerifyScript(s, a_and_b, flags, MutableTransactionSignatureChecker(&txTo[0], 0), &err)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); for (int i = 0; i < 4; i++) { keys.assign(1,key[i]); s = sign_multisig(a_and_b, keys, txTo[0], 0); BOOST_CHECK_MESSAGE(!VerifyScript(s, a_and_b, flags, MutableTransactionSignatureChecker(&txTo[0], 0), &err), strprintf("a&b 1: %d", i)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_INVALID_STACK_OPERATION, ScriptErrorString(err)); keys.assign(1,key[1]); keys.push_back(key[i]); s = sign_multisig(a_and_b, keys, txTo[0], 0); BOOST_CHECK_MESSAGE(!VerifyScript(s, a_and_b, flags, MutableTransactionSignatureChecker(&txTo[0], 0), &err), strprintf("a&b 2: %d", i)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EVAL_FALSE, ScriptErrorString(err)); } // Test a OR b: for (int i = 0; i < 4; i++) { keys.assign(1,key[i]); s = sign_multisig(a_or_b, keys, txTo[1], 0); if (i == 0 || i == 1) { BOOST_CHECK_MESSAGE(VerifyScript(s, a_or_b, flags, MutableTransactionSignatureChecker(&txTo[1], 0), &err), strprintf("a|b: %d", i)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); } else { BOOST_CHECK_MESSAGE(!VerifyScript(s, a_or_b, flags, MutableTransactionSignatureChecker(&txTo[1], 0), &err), strprintf("a|b: %d", i)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EVAL_FALSE, ScriptErrorString(err)); } } s.clear(); s << OP_0 << OP_1; BOOST_CHECK(!VerifyScript(s, a_or_b, flags, MutableTransactionSignatureChecker(&txTo[1], 0), &err)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_SIG_DER, ScriptErrorString(err)); for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) { keys.assign(1,key[i]); keys.push_back(key[j]); s = sign_multisig(escrow, keys, txTo[2], 0); if (i < j && i < 3 && j < 3) { BOOST_CHECK_MESSAGE(VerifyScript(s, escrow, flags, MutableTransactionSignatureChecker(&txTo[2], 0), &err), strprintf("escrow 1: %d %d", i, j)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err)); } else { BOOST_CHECK_MESSAGE(!VerifyScript(s, escrow, flags, MutableTransactionSignatureChecker(&txTo[2], 0), &err), strprintf("escrow 2: %d %d", i, j)); BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EVAL_FALSE, ScriptErrorString(err)); } } } BOOST_AUTO_TEST_CASE(multisig_IsStandard) { CKey key[4]; for (int i = 0; i < 4; i++) key[i].MakeNewKey(true); txnouttype whichType; CScript a_and_b; a_and_b << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; BOOST_CHECK(::IsStandard(a_and_b, whichType)); CScript a_or_b; a_or_b << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; BOOST_CHECK(::IsStandard(a_or_b, whichType)); CScript escrow; escrow << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()) << OP_3 << OP_CHECKMULTISIG; BOOST_CHECK(::IsStandard(escrow, whichType)); CScript one_of_four; one_of_four << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()) << ToByteVector(key[3].GetPubKey()) << OP_4 << OP_CHECKMULTISIG; BOOST_CHECK(!::IsStandard(one_of_four, whichType)); CScript malformed[6]; malformed[0] << OP_3 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; malformed[1] << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_3 << OP_CHECKMULTISIG; malformed[2] << OP_0 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; malformed[3] << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_0 << OP_CHECKMULTISIG; malformed[4] << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_CHECKMULTISIG; malformed[5] << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()); for (int i = 0; i < 6; i++) BOOST_CHECK(!::IsStandard(malformed[i], whichType)); } BOOST_AUTO_TEST_CASE(multisig_Solver1) { // Tests Solver() that returns lists of keys that are // required to satisfy a ScriptPubKey // // Also tests IsMine() and ExtractDestination() // // Note: ExtractDestination for the multisignature transactions // always returns false for this release, even if you have // one key that would satisfy an (a|b) or 2-of-3 keys needed // to spend an escrow transaction. // CBasicKeyStore keystore, emptykeystore, partialkeystore; CKey key[3]; CTxDestination keyaddr[3]; for (int i = 0; i < 3; i++) { key[i].MakeNewKey(true); keystore.AddKey(key[i]); keyaddr[i] = key[i].GetPubKey().GetID(); } partialkeystore.AddKey(key[0]); { vector<valtype> solutions; txnouttype whichType; CScript s; s << ToByteVector(key[0].GetPubKey()) << OP_CHECKSIG; BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(solutions.size() == 1); CTxDestination addr; BOOST_CHECK(ExtractDestination(s, addr)); BOOST_CHECK(addr == keyaddr[0]); #ifdef ENABLE_WALLET BOOST_CHECK(IsMine(keystore, s)); BOOST_CHECK(!IsMine(emptykeystore, s)); #endif } { vector<valtype> solutions; txnouttype whichType; CScript s; s << OP_DUP << OP_HASH160 << ToByteVector(key[0].GetPubKey().GetID()) << OP_EQUALVERIFY << OP_CHECKSIG; BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(solutions.size() == 1); CTxDestination addr; BOOST_CHECK(ExtractDestination(s, addr)); BOOST_CHECK(addr == keyaddr[0]); #ifdef ENABLE_WALLET BOOST_CHECK(IsMine(keystore, s)); BOOST_CHECK(!IsMine(emptykeystore, s)); #endif } { vector<valtype> solutions; txnouttype whichType; CScript s; s << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK_EQUAL(solutions.size(), 4U); CTxDestination addr; BOOST_CHECK(!ExtractDestination(s, addr)); #ifdef ENABLE_WALLET BOOST_CHECK(IsMine(keystore, s)); BOOST_CHECK(!IsMine(emptykeystore, s)); BOOST_CHECK(!IsMine(partialkeystore, s)); #endif } { vector<valtype> solutions; txnouttype whichType; CScript s; s << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK_EQUAL(solutions.size(), 4U); vector<CTxDestination> addrs; int nRequired; BOOST_CHECK(ExtractDestinations(s, whichType, addrs, nRequired)); BOOST_CHECK(addrs[0] == keyaddr[0]); BOOST_CHECK(addrs[1] == keyaddr[1]); BOOST_CHECK(nRequired == 1); #ifdef ENABLE_WALLET BOOST_CHECK(IsMine(keystore, s)); BOOST_CHECK(!IsMine(emptykeystore, s)); BOOST_CHECK(!IsMine(partialkeystore, s)); #endif } { vector<valtype> solutions; txnouttype whichType; CScript s; s << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()) << OP_3 << OP_CHECKMULTISIG; BOOST_CHECK(Solver(s, whichType, solutions)); BOOST_CHECK(solutions.size() == 5); } } BOOST_AUTO_TEST_CASE(multisig_Sign) { // Test SignSignature() (and therefore the version of Solver() that signs transactions) CBasicKeyStore keystore; CKey key[4]; for (int i = 0; i < 4; i++) { key[i].MakeNewKey(true); keystore.AddKey(key[i]); } CScript a_and_b; a_and_b << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; CScript a_or_b; a_or_b << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << OP_2 << OP_CHECKMULTISIG; CScript escrow; escrow << OP_2 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey()) << OP_3 << OP_CHECKMULTISIG; CMutableTransaction txFrom; // Funding transaction txFrom.vout.resize(3); txFrom.vout[0].scriptPubKey = a_and_b; txFrom.vout[1].scriptPubKey = a_or_b; txFrom.vout[2].scriptPubKey = escrow; CMutableTransaction txTo[3]; // Spending transaction for (int i = 0; i < 3; i++) { txTo[i].vin.resize(1); txTo[i].vout.resize(1); txTo[i].vin[0].prevout.n = i; txTo[i].vin[0].prevout.hash = txFrom.GetHash(); txTo[i].vout[0].nValue = 1; } for (int i = 0; i < 3; i++) { BOOST_CHECK_MESSAGE(SignSignature(keystore, txFrom, txTo[i], 0), strprintf("SignSignature %d", i)); } } BOOST_AUTO_TEST_SUITE_END()
xurantju/bitcoin
src/test/multisig_tests.cpp
C++
mit
11,946
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a){var b;b=a("./emblem"),b.throwCompileError=function(a,b){throw new Error("Emblem syntax error, line "+a+": "+b)},b.registerPartial=function(a,c,d){return d||(d=c,c=a,a=Handlebars),a.registerPartial(c,b.compile(a,d))},b.parse=function(a){var c,d,e,f,g;try{return g=b.Preprocessor.processSync(a),b.Parser.parse(g)}catch(h){if(c=h,c instanceof b.Parser.SyntaxError)return e=a.split("\n"),d=e[c.line-1],f=""+c.message+"\n"+d+"\n",f+=new Array(c.column).join("-"),f+="^",b.throwCompileError(c.line,f);throw c}},b.precompile=function(a,c,d){var e;return null==d&&(d={}),b.handlebarsVariant=a,e=b.parse(c),a.precompile(e,d)},b.compile=function(a,c,d){var e;return null==d&&(d={}),b.handlebarsVariant=a,e=b.parse(c),a.compile(e,d)}},{"./emblem":3}],2:[function(a){var b,c,d,e;c=a("./emblem"),"undefined"!=typeof window&&null!==window&&(c.compileScriptTags=function(){if("undefined"==typeof Ember||null===Ember)throw new Error("Can't run Emblem.enableEmber before Ember has been defined");return"undefined"!=typeof document&&null!==document?Ember.$('script[type="text/x-emblem"], script[type="text/x-raw-emblem"]',Ember.$(document)).each(function(){var a,b,d;return b=Ember.$(this),a="text/x-raw-handlebars"===b.attr("type")?Handlebars:Ember.Handlebars,d=b.attr("data-template-name")||b.attr("id")||"application",Ember.TEMPLATES[d]=c.compile(a,b.html()),b.remove()}):void 0},window.ENV||(window.ENV={}),b=window.ENV,b.EMBER_LOAD_HOOKS||(b.EMBER_LOAD_HOOKS={}),(d=b.EMBER_LOAD_HOOKS).application||(d.application=[]),(e=b.EMBER_LOAD_HOOKS)["Ember.Application"]||(e["Ember.Application"]=[]),b.EMBER_LOAD_HOOKS.application.push(c.compileScriptTags),b.EMBER_LOAD_HOOKS["Ember.Application"].push(function(a){return a.initializer?a.initializer({name:"emblemDomTemplates",before:"registerComponentLookup",initialize:c.compileScriptTags}):Ember.onLoad("application",c.compileScriptTags)}))},{"./emblem":3}],3:[function(a,b){var c,d=self;this.Emblem={},c=this.Emblem,c.VERSION="0.3.8",b.exports=c,"undefined"!=typeof window&&null!==window&&(window.Emblem=c),d.Emblem=c,a("./parser"),a("./compiler"),a("./preprocessor"),a("./emberties")},{"./compiler":1,"./emberties":2,"./parser":4,"./preprocessor":5}],4:[function(a,b){var c=a("./emblem");c.Parser=function(){function a(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}function b(a,b,c,d,e){function f(a,b){function c(a){function b(a){return a.charCodeAt(0).toString(16).toUpperCase()}return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(a){return"\\x0"+b(a)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(a){return"\\x"+b(a)}).replace(/[\u0180-\u0FFF]/g,function(a){return"\\u0"+b(a)}).replace(/[\u1080-\uFFFF]/g,function(a){return"\\u"+b(a)})}var d,e;switch(a.length){case 0:d="end of input";break;case 1:d=a[0];break;default:d=a.slice(0,-1).join(", ")+" or "+a[a.length-1]}return e=b?'"'+c(b)+'"':"end of input","Expected "+d+" but "+e+" found."}this.expected=a,this.found=b,this.offset=c,this.line=d,this.column=e,this.name="SyntaxError",this.message=f(a,b)}function d(a){function d(b){function c(b,c,d){var e,f;for(e=c;d>e;e++)f=a.charAt(e),"\n"===f?(b.seenCR||b.line++,b.column=1,b.seenCR=!1):"\r"===f||"\u2028"===f||"\u2029"===f?(b.line++,b.column=1,b.seenCR=!0):(b.column++,b.seenCR=!1)}return Qf!==b&&(Qf>b&&(Qf=0,Rf={line:1,column:1,seenCR:!1}),c(Rf,Qf,b),Qf=b),Rf}function e(a){Sf>Of||(Of>Sf&&(Sf=Of,Tf=[]),Tf.push(a))}function f(a){var b=0;for(a.sort();b<a.length;)a[b-1]===a[b]?a.splice(b,1):b++}function g(){var a;return a=h()}function h(){var a,b,c,d,e,f,g,h,k;return a=Of,b=j(),null!==b?(c=Of,d=_b(),null!==d?(e=i(),null!==e?(f=ec(),null!==f?(g=bc(),null!==g?(h=Zb(),null!==h?(k=j(),null!==k?(Pf=c,d=sc(k),null===d?(Of=c,c=d):c=d):(Of=c,c=qc)):(Of=c,c=qc)):(Of=c,c=qc)):(Of=c,c=qc)):(Of=c,c=qc)):(Of=c,c=qc),null===c&&(c=rc),null!==c?(Pf=a,b=tc(b,c),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc),a}function i(){var b,c,d,f;return b=Of,c=Of,61===a.charCodeAt(Of)?(d=uc,Of++):(d=null,0===Uf&&e(vc)),null!==d?(f=ec(),null!==f?(d=[d,f],c=d):(Of=c,c=qc)):(Of=c,c=qc),null===c&&(c=rc),null!==c?(a.substr(Of,4)===wc?(d=wc,Of+=4):(d=null,0===Uf&&e(xc)),null!==d?(c=[c,d],b=c):(Of=b,b=qc)):(Of=b,b=qc),b}function j(){var a,b,c;for(a=Of,b=[],c=k();null!==c;)b.push(c),c=k();return null!==b&&(Pf=a,b=yc(b)),null===b?(Of=a,a=b):a=b,a}function k(){var a,b;return Uf++,a=m(),null===a&&(a=r(),null===a&&(a=l())),Uf--,null===a&&(b=null,0===Uf&&e(zc)),a}function l(){var a,b;return Uf++,a=n(),null===a&&(a=y(),null===a&&(a=_(),null===a&&(a=p()))),Uf--,null===a&&(b=null,0===Uf&&e(Ac)),a}function m(){var a,b,c;return a=Of,b=ec(),null!==b?(c=bc(),null!==c?(Pf=a,b=Bc(),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc),a}function n(){var b,c,d,f,g,h,i;if(b=Of,62===a.charCodeAt(Of)?(c=Cc,Of++):(c=null,0===Uf&&e(Dc)),null!==c)if(d=ec(),null!==d)if(f=o(),null!==f){for(g=[],h=I();null!==h;)g.push(h),h=I();null!==g?(h=ec(),null!==h?(i=bc(),null!==i?(Pf=b,c=Ec(f,g),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc)}else Of=b,b=qc;else Of=b,b=qc;else Of=b,b=qc;return b}function o(){var b,c,d,f;if(b=Of,c=Of,d=[],Fc.test(a.charAt(Of))?(f=a.charAt(Of),Of++):(f=null,0===Uf&&e(Gc)),null!==f)for(;null!==f;)d.push(f),Fc.test(a.charAt(Of))?(f=a.charAt(Of),Of++):(f=null,0===Uf&&e(Gc));else d=qc;return null!==d&&(d=a.substring(c,Of)),c=d,null!==c&&(Pf=b,c=Hc(c)),null===c?(Of=b,b=c):b=c,b}function p(){var a,b;return a=Of,b=C(),null===b&&(b=t()),null!==b&&(Pf=a,b=Ic(b)),null===b?(Of=a,a=b):a=b,a}function q(){var a,b,c,d,e,f,g,h;if(a=Of,b=hc(),null!==b)if(c=bc(),null!==c){if(d=[],e=Of,f=Zb(),null!==f){if(g=[],h=q(),null!==h)for(;null!==h;)g.push(h),h=q();else g=qc;null!==g?(h=cc(),null!==h?(f=[f,g,h],e=f):(Of=e,e=qc)):(Of=e,e=qc)}else Of=e,e=qc;for(;null!==e;)if(d.push(e),e=Of,f=Zb(),null!==f){if(g=[],h=q(),null!==h)for(;null!==h;)g.push(h),h=q();else g=qc;null!==g?(h=cc(),null!==h?(f=[f,g,h],e=f):(Of=e,e=qc)):(Of=e,e=qc)}else Of=e,e=qc;null!==d?(Pf=a,b=Bc(),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)}else Of=a,a=qc;else Of=a,a=qc;return a}function r(){var b,c,d;return b=Of,47===a.charCodeAt(Of)?(c=Jc,Of++):(c=null,0===Uf&&e(Kc)),null!==c?(d=q(),null!==d?(Pf=b,c=Bc(),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc),b}function s(){var b,c,d;return b=Of,47===a.charCodeAt(Of)?(c=Jc,Of++):(c=null,0===Uf&&e(Kc)),null!==c?(d=hc(),null!==d?(c=[c,d],b=c):(Of=b,b=qc)):(Of=b,b=qc),b}function t(){var a;return a=u(),null===a&&(a=z()),a}function u(){var b,c,d;return b=Of,c=Of,Uf++,Lc.test(a.charAt(Of))?(d=a.charAt(Of),Of++):(d=null,0===Uf&&e(Mc)),Uf--,null!==d?(Of=c,c=rc):c=qc,null!==c?(d=z(),null!==d?(Pf=b,c=Nc(d),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc),b}function v(){var b,c,d,f,g,h,i;if(b=Of,32===a.charCodeAt(Of)?(c=Oc,Of++):(c=null,0===Uf&&e(Pc)),null!==c)if(d=ab(),null!==d){if(f=Of,g=Zb(),null!==g){if(h=[],i=Z(),null!==i)for(;null!==i;)h.push(i),i=Z();else h=qc;null!==h?(i=_b(),null!==i?(g=[g,h,i],f=g):(Of=f,f=qc)):(Of=f,f=qc)}else Of=f,f=qc;null===f&&(f=rc),null!==f?(Pf=b,c=Qc(d,f),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)}else Of=b,b=qc;else Of=b,b=qc;return b}function w(){var a,b,c,d,e;for(a=Of,b=[],c=m();null!==c;)b.push(c),c=m();return null!==b?(c=Zb(),null!==c?(d=j(),null!==d?(e=_b(),null!==e?(Pf=a,b=Rc(d),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc),a}function x(){var a,b,c,d,e;return a=A(),null===a&&(a=Of,b=ec(),null!==b?(c=C(),null!==c?(Pf=a,b=Sc(c),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc),null===a&&(a=Of,b=ec(),null!==b?(c=s(),null===c&&(c=rc),null!==c?(d=bc(),null!==d?(e=w(),null===e&&(e=rc),null!==e?(Pf=a,b=Rc(e),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc),null===a&&(a=v()))),a}function y(){var a,b,c;return a=Of,b=Bb(),null!==b?(c=x(),null!==c?(Pf=a,b=Tc(b,c),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc),a}function z(){var a,b,c,d,e;return a=Of,b=D(),null!==b?(c=ec(),null!==c?(d=s(),null===d&&(d=rc),null!==d?(e=B(),null!==e?(Pf=a,b=Uc(b,e),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc),a}function h(){var a,b,c,d,e,f,g,h,k,l;if(a=Of,b=j(),null!==b){if(c=Of,d=_b(),null!==d)if(e=i(),null!==e)if(f=ec(),null!==f)if(g=bc(),null!==g){for(h=[],k=m();null!==k;)h.push(k),k=m();null!==h?(k=Zb(),null!==k?(l=j(),null!==l?(Pf=c,d=sc(l),null===d?(Of=c,c=d):c=d):(Of=c,c=qc)):(Of=c,c=qc)):(Of=c,c=qc)}else Of=c,c=qc;else Of=c,c=qc;else Of=c,c=qc;else Of=c,c=qc;null===c&&(c=rc),null!==c?(Pf=a,b=tc(b,c),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)}else Of=a,a=qc;return a}function A(){var b,c,d,f;return b=Of,a.substr(Of,2)===Vc?(c=Vc,Of+=2):(c=null,0===Uf&&e(Wc)),null!==c?(d=ec(),null!==d?(f=l(),null!==f?(Pf=b,c=Rc(f),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc),b}function B(){var a,b,c,d,e,f,g;if(a=Of,b=A(),null===b&&(b=_()),null!==b&&(Pf=a,b=Xc(b)),null===b?(Of=a,a=b):a=b,null===a)if(a=Of,b=bc(),null!==b){for(c=Of,d=[],e=m();null!==e;)d.push(e),e=m();null!==d?(e=Zb(),null!==e?(f=h(),null!==f?(g=_b(),null!==g?(d=[d,e,f,g],c=d):(Of=c,c=qc)):(Of=c,c=qc)):(Of=c,c=qc)):(Of=c,c=qc),null===c&&(c=rc),null!==c?(Pf=a,b=Yc(c),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)}else Of=a,a=qc;return a}function C(){var a,b,c;return a=Of,b=zb(),null!==b?(c=z(),null!==c?(Pf=a,b=Zc(b,c),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc),a}function D(){var b,c,d,f,g,h;if(b=Of,62===a.charCodeAt(Of)?(c=Cc,Of++):(c=null,0===Uf&&e(Dc)),null===c&&(c=rc),null!==c)if(d=ec(),null!==d)if(f=Q(),null!==f){for(g=[],h=I();null!==h;)g.push(h),h=I();null!==g?(h=J(),null===h&&(h=rc),null!==h?(Pf=b,c=$c(c,f,g,h),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)}else Of=b,b=qc;else Of=b,b=qc;else Of=b,b=qc;return b}function E(){var a,b,c,d;return a=Of,b=ec(),null!==b?(c=Of,d=Mb(),null!==d&&(Pf=c,d=_c(d)),null===d?(Of=c,c=d):c=d,null===c&&(c=Of,d=Nb(),null!==d&&(Pf=c,d=ad(d)),null===d?(Of=c,c=d):c=d,null===c&&(c=Of,d=Ob(),null!==d&&(Pf=c,d=bd(d)),null===d?(Of=c,c=d):c=d)),null!==c?(Pf=a,b=cd(c),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc),a}function F(){var a;return a=G(),null===a&&(a=H()),a}function G(){var a,b,c,d;if(a=Of,b=Nb(),null!==b){for(c=[],d=Ob();null!==d;)c.push(d),d=Ob();null!==c?(Pf=a,b=dd(b,c),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)}else Of=a,a=qc;return a}function H(){var a,b,c;if(a=Of,b=[],c=Ob(),null!==c)for(;null!==c;)b.push(c),c=Ob();else b=qc;return null!==b&&(Pf=a,b=ed(b)),null===b?(Of=a,a=b):a=b,a}function I(){var a,b;return a=Of,b=E(),null===b&&(b=N()),null!==b&&(Pf=a,b=fd(b)),null===b?(Of=a,a=b):a=b,a}function J(){var a,b,c;if(a=Of,b=[],c=M(),null!==c)for(;null!==c;)b.push(c),c=M();else b=qc;return null!==b&&(Pf=a,b=gd(b)),null===b?(Of=a,a=b):a=b,a}function K(){var b,c,d,f;if(Uf++,a.substr(Of,2)===id?(b=id,Of+=2):(b=null,0===Uf&&e(jd)),null===b&&(46===a.charCodeAt(Of)?(b=kd,Of++):(b=null,0===Uf&&e(ld)),null===b)){if(b=Of,c=Of,d=[],md.test(a.charAt(Of))?(f=a.charAt(Of),Of++):(f=null,0===Uf&&e(nd)),null!==f)for(;null!==f;)d.push(f),md.test(a.charAt(Of))?(f=a.charAt(Of),Of++):(f=null,0===Uf&&e(nd));else d=qc;null!==d&&(d=a.substring(c,Of)),c=d,null!==c?(d=Of,Uf++,61===a.charCodeAt(Of)?(f=uc,Of++):(f=null,0===Uf&&e(vc)),Uf--,null===f?d=rc:(Of=d,d=qc),null!==d?(Pf=b,c=od(c),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)}return Uf--,null===b&&(c=null,0===Uf&&e(hd)),b}function L(){var b,c,d;for(Uf++,b=Of,c=[],d=Rb(),null===d&&(58===a.charCodeAt(Of)?(d=qd,Of++):(d=null,0===Uf&&e(rd)));null!==d;)c.push(d),d=Rb(),null===d&&(58===a.charCodeAt(Of)?(d=qd,Of++):(d=null,0===Uf&&e(rd)));return null!==c&&(c=a.substring(b,Of)),b=c,Uf--,null===b&&(c=null,0===Uf&&e(pd)),b}function M(){var b,c,d,f,g,h;return b=Of,c=dc(),null!==c?(d=Of,f=L(),null!==f?(61===a.charCodeAt(Of)?(g=uc,Of++):(g=null,0===Uf&&e(vc)),null!==g?(h=T(),null!==h?(f=[f,g,h],d=f):(Of=d,d=qc)):(Of=d,d=qc)):(Of=d,d=qc),null===d&&(d=Of,f=L(),null!==f?(61===a.charCodeAt(Of)?(g=uc,Of++):(g=null,0===Uf&&e(vc)),null!==g?(h=S(),null!==h?(f=[f,g,h],d=f):(Of=d,d=qc)):(Of=d,d=qc)):(Of=d,d=qc),null===d&&(d=Of,f=L(),null!==f?(61===a.charCodeAt(Of)?(g=uc,Of++):(g=null,0===Uf&&e(vc)),null!==g?(h=Q(),null!==h?(f=[f,g,h],d=f):(Of=d,d=qc)):(Of=d,d=qc)):(Of=d,d=qc),null===d&&(d=Of,f=L(),null!==f?(61===a.charCodeAt(Of)?(g=uc,Of++):(g=null,0===Uf&&e(vc)),null!==g?(h=R(),null!==h?(f=[f,g,h],d=f):(Of=d,d=qc)):(Of=d,d=qc)):(Of=d,d=qc)))),null!==d?(Pf=b,c=sd(d),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc),b}function N(){var a,b,c;return a=Of,b=dc(),null!==b?(c=T(),null===c&&(c=S(),null===c&&(c=Q(),null===c&&(c=R()))),null!==c?(Pf=a,b=td(c),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc),a}function O(){var a,b,c,d,e,f;if(a=Of,b=K(),null!==b){for(c=[],d=Of,e=P(),null!==e?(f=K(),null!==f?(Pf=d,e=ud(e,f),null===e?(Of=d,d=e):d=e):(Of=d,d=qc)):(Of=d,d=qc);null!==d;)c.push(d),d=Of,e=P(),null!==e?(f=K(),null!==f?(Pf=d,e=ud(e,f),null===e?(Of=d,d=e):d=e):(Of=d,d=qc)):(Of=d,d=qc);null!==c?(Pf=a,b=vd(b,c),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)}else Of=a,a=qc;return a}function P(){var b,c;return Uf++,xd.test(a.charAt(Of))?(b=a.charAt(Of),Of++):(b=null,0===Uf&&e(yd)),Uf--,null===b&&(c=null,0===Uf&&e(wd)),b}function Q(){var a,b;return a=Of,b=O(),null!==b&&(Pf=a,b=zd(b)),null===b?(Of=a,a=b):a=b,a}function R(){var a,b;return a=Of,b=W(),null!==b&&(Pf=a,b=Ad(b)),null===b?(Of=a,a=b):a=b,a}function S(){var a,b;return a=Of,b=V(),null!==b&&(Pf=a,b=Bd(b)),null===b?(Of=a,a=b):a=b,a}function T(){var a,b;return a=Of,b=U(),null!==b&&(Pf=a,b=Cd(b)),null===b?(Of=a,a=b):a=b,a}function U(){var b,c;return Uf++,a.substr(Of,4)===Ed?(b=Ed,Of+=4):(b=null,0===Uf&&e(Fd)),null===b&&(a.substr(Of,5)===Gd?(b=Gd,Of+=5):(b=null,0===Uf&&e(Hd))),Uf--,null===b&&(c=null,0===Uf&&e(Dd)),b}function V(){var b,c,d,f,g,h;if(Uf++,b=Of,c=Of,d=Of,45===a.charCodeAt(Of)?(f=Jd,Of++):(f=null,0===Uf&&e(Kd)),null===f&&(f=rc),null!==f){if(g=[],Ld.test(a.charAt(Of))?(h=a.charAt(Of),Of++):(h=null,0===Uf&&e(Md)),null!==h)for(;null!==h;)g.push(h),Ld.test(a.charAt(Of))?(h=a.charAt(Of),Of++):(h=null,0===Uf&&e(Md));else g=qc;null!==g?(f=[f,g],d=f):(Of=d,d=qc)}else Of=d,d=qc;return null!==d&&(d=a.substring(c,Of)),c=d,null!==c&&(Pf=b,c=Nd(c)),null===c?(Of=b,b=c):b=c,Uf--,null===b&&(c=null,0===Uf&&e(Id)),b}function W(){var b,c,d,f,g;return b=Of,c=Of,34===a.charCodeAt(Of)?(d=Od,Of++):(d=null,0===Uf&&e(Pd)),null!==d?(f=X(),null!==f?(34===a.charCodeAt(Of)?(g=Od,Of++):(g=null,0===Uf&&e(Pd)),null!==g?(d=[d,f,g],c=d):(Of=c,c=qc)):(Of=c,c=qc)):(Of=c,c=qc),null===c&&(c=Of,39===a.charCodeAt(Of)?(d=Qd,Of++):(d=null,0===Uf&&e(Rd)),null!==d?(f=Y(),null!==f?(39===a.charCodeAt(Of)?(g=Qd,Of++):(g=null,0===Uf&&e(Rd)),null!==g?(d=[d,f,g],c=d):(Of=c,c=qc)):(Of=c,c=qc)):(Of=c,c=qc)),null!==c&&(Pf=b,c=Sd(c)),null===c?(Of=b,b=c):b=c,b}function X(){var b,c,d,f,g;for(b=Of,c=[],d=Of,f=Of,Uf++,g=bc(),Uf--,null===g?f=rc:(Of=f,f=qc),null!==f?(Td.test(a.charAt(Of))?(g=a.charAt(Of),Of++):(g=null,0===Uf&&e(Ud)),null!==g?(f=[f,g],d=f):(Of=d,d=qc)):(Of=d,d=qc);null!==d;)c.push(d),d=Of,f=Of,Uf++,g=bc(),Uf--,null===g?f=rc:(Of=f,f=qc),null!==f?(Td.test(a.charAt(Of))?(g=a.charAt(Of),Of++):(g=null,0===Uf&&e(Ud)),null!==g?(f=[f,g],d=f):(Of=d,d=qc)):(Of=d,d=qc);return null!==c&&(c=a.substring(b,Of)),b=c}function Y(){var b,c,d,f,g;for(b=Of,c=[],d=Of,f=Of,Uf++,g=bc(),Uf--,null===g?f=rc:(Of=f,f=qc),null!==f?(Vd.test(a.charAt(Of))?(g=a.charAt(Of),Of++):(g=null,0===Uf&&e(Wd)),null!==g?(f=[f,g],d=f):(Of=d,d=qc)):(Of=d,d=qc);null!==d;)c.push(d),d=Of,f=Of,Uf++,g=bc(),Uf--,null===g?f=rc:(Of=f,f=qc),null!==f?(Vd.test(a.charAt(Of))?(g=a.charAt(Of),Of++):(g=null,0===Uf&&e(Wd)),null!==g?(f=[f,g],d=f):(Of=d,d=qc)):(Of=d,d=qc);return null!==c&&(c=a.substring(b,Of)),b=c}function Z(){var a,b,c,d,e;if(a=Of,b=Zb(),null!==b)if(c=ab(),null!==c){for(d=[],e=Z();null!==e;)d.push(e),e=Z();null!==d?(e=cc(),null!==e?(Pf=a,b=Xd(b,c,d),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc)}else Of=a,a=qc;else Of=a,a=qc;return null===a&&(a=ab()),a}function $(){var b,c,d;return b=Of,Yd.test(a.charAt(Of))?(c=a.charAt(Of),Of++):(c=null,0===Uf&&e(Zd)),null!==c?(32===a.charCodeAt(Of)?(d=Oc,Of++):(d=null,0===Uf&&e(Pc)),null===d&&(d=rc),null!==d?(Pf=b,c=od(c),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc),null===b&&(b=Of,c=Of,Uf++,60===a.charCodeAt(Of)?(d=$d,Of++):(d=null,0===Uf&&e(_d)),Uf--,null!==d?(Of=c,c=rc):c=qc,null!==c&&(Pf=b,c=ae()),null===c?(Of=b,b=c):b=c),b}function _(){var a,b,c,d,e,f,g;if(a=Of,b=$(),null!==b)if(c=ab(),null!==c){if(d=Of,e=Zb(),null!==e){for(f=[],g=Z();null!==g;)f.push(g),g=Z();null!==f?(g=_b(),null!==g?(e=[e,f,g],d=e):(Of=d,d=qc)):(Of=d,d=qc)}else Of=d,d=qc;null===d&&(d=rc),null!==d?(Pf=a,b=be(b,c,d),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)}else Of=a,a=qc;else Of=a,a=qc;return a}function ab(){var a,b,c,d,e,f;if(a=Of,b=mb(),null===b&&(b=rc),null!==b){for(c=[],d=Of,e=eb(),null!==e?(f=mb(),null===f&&(f=rc),null!==f?(e=[e,f],d=e):(Of=d,d=qc)):(Of=d,d=qc);null!==d;)c.push(d),d=Of,e=eb(),null!==e?(f=mb(),null===f&&(f=rc),null!==f?(e=[e,f],d=e):(Of=d,d=qc)):(Of=d,d=qc);null!==c?(d=bc(),null!==d?(Pf=a,b=ce(b,c),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc)}else Of=a,a=qc;return a}function bb(){var b,c,d,f;return b=Of,34===a.charCodeAt(Of)?(c=Od,Of++):(c=null,0===Uf&&e(Pd)),null!==c?(d=cb(),null!==d?(34===a.charCodeAt(Of)?(f=Od,Of++):(f=null,0===Uf&&e(Pd)),null!==f?(Pf=b,c=fd(d),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc),null===b&&(b=Of,39===a.charCodeAt(Of)?(c=Qd,Of++):(c=null,0===Uf&&e(Rd)),null!==c?(d=db(),null!==d?(39===a.charCodeAt(Of)?(f=Qd,Of++):(f=null,0===Uf&&e(Rd)),null!==f?(Pf=b,c=fd(d),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc)),b}function cb(){var a,b,c,d,e,f;if(a=Of,b=ib(),null===b&&(b=rc),null!==b){for(c=[],d=Of,e=eb(),null!==e?(f=ib(),null===f&&(f=rc),null!==f?(e=[e,f],d=e):(Of=d,d=qc)):(Of=d,d=qc);null!==d;)c.push(d),d=Of,e=eb(),null!==e?(f=ib(),null===f&&(f=rc),null!==f?(e=[e,f],d=e):(Of=d,d=qc)):(Of=d,d=qc);null!==c?(Pf=a,b=de(b,c),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)}else Of=a,a=qc;return a}function db(){var a,b,c,d,e,f;if(a=Of,b=jb(),null===b&&(b=rc),null!==b){for(c=[],d=Of,e=eb(),null!==e?(f=jb(),null===f&&(f=rc),null!==f?(e=[e,f],d=e):(Of=d,d=qc)):(Of=d,d=qc);null!==d;)c.push(d),d=Of,e=eb(),null!==e?(f=jb(),null===f&&(f=rc),null!==f?(e=[e,f],d=e):(Of=d,d=qc)):(Of=d,d=qc);null!==c?(Pf=a,b=de(b,c),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)}else Of=a,a=qc;return a}function eb(){var a;return a=hb(),null===a&&(a=gb()),a}function fb(){var b,c,d,f,g;if(b=Of,c=Of,Uf++,123===a.charCodeAt(Of)?(d=ee,Of++):(d=null,0===Uf&&e(fe)),Uf--,null===d?c=rc:(Of=c,c=qc),null!==c){for(d=Of,f=[],ge.test(a.charAt(Of))?(g=a.charAt(Of),Of++):(g=null,0===Uf&&e(he));null!==g;)f.push(g),ge.test(a.charAt(Of))?(g=a.charAt(Of),Of++):(g=null,0===Uf&&e(he));null!==f&&(f=a.substring(d,Of)),d=f,null!==d?(Pf=b,c=ie(d),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)}else Of=b,b=qc;return b}function gb(){var a,b,c,d,e,f;return a=Of,b=sb(),null!==b?(c=ec(),null!==c?(d=fb(),null!==d?(e=ec(),null!==e?(f=vb(),null!==f?(Pf=a,b=je(d),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc),null===a&&(a=Of,b=xb(),null!==b?(c=ec(),null!==c?(d=fb(),null!==d?(e=ec(),null!==e?(f=yb(),null!==f?(Pf=a,b=je(d),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc)),a}function hb(){var a,b,c,d,e,f;return a=Of,b=tb(),null!==b?(c=ec(),null!==c?(d=fb(),null!==d?(e=ec(),null!==e?(f=wb(),null!==f?(Pf=a,b=ke(d),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc),a}function ib(){var b,c,d,e;if(b=Of,c=Of,d=[],e=kb(),null!==e)for(;null!==e;)d.push(e),e=kb();else d=qc;return null!==d&&(d=a.substring(c,Of)),c=d,null!==c&&(Pf=b,c=le(c)),null===c?(Of=b,b=c):b=c,b}function jb(){var b,c,d,e;if(b=Of,c=Of,d=[],e=lb(),null!==e)for(;null!==e;)d.push(e),e=lb();else d=qc;return null!==d&&(d=a.substring(c,Of)),c=d,null!==c&&(Pf=b,c=le(c)),null===c?(Of=b,b=c):b=c,b}function kb(){var b,c,d;return b=Of,c=Of,Uf++,d=ob(),null===d&&(34===a.charCodeAt(Of)?(d=Od,Of++):(d=null,0===Uf&&e(Pd))),Uf--,null===d?c=rc:(Of=c,c=qc),null!==c?(a.length>Of?(d=a.charAt(Of),Of++):(d=null,0===Uf&&e(me)),null!==d?(Pf=b,c=Rc(d),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc),b}function lb(){var b,c,d;return b=Of,c=Of,Uf++,d=ob(),null===d&&(39===a.charCodeAt(Of)?(d=Qd,Of++):(d=null,0===Uf&&e(Rd))),Uf--,null===d?c=rc:(Of=c,c=qc),null!==c?(a.length>Of?(d=a.charAt(Of),Of++):(d=null,0===Uf&&e(me)),null!==d?(Pf=b,c=Rc(d),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc),b}function mb(){var b,c,d,e;if(b=Of,c=Of,d=[],e=nb(),null!==e)for(;null!==e;)d.push(e),e=nb();else d=qc;return null!==d&&(d=a.substring(c,Of)),c=d,null!==c&&(Pf=b,c=le(c)),null===c?(Of=b,b=c):b=c,b}function nb(){var b,c,d;return b=Of,c=Of,Uf++,d=ob(),Uf--,null===d?c=rc:(Of=c,c=qc),null!==c?(a.length>Of?(d=a.charAt(Of),Of++):(d=null,0===Uf&&e(me)),null!==d?(Pf=b,c=Rc(d),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc),b}function ob(){var a;return a=tb(),null===a&&(a=sb(),null===a&&(a=xb(),null===a&&(a=cc(),null===a&&(a=bc())))),a}function pb(){var a,b,c,d,e,f;return a=Of,b=rb(),null!==b?(c=ec(),null!==c?(d=fb(),null!==d?(e=ec(),null!==e?(f=ub(),null!==f?(Pf=a,b=je(d),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc)):(Of=a,a=qc),a}function qb(){var a;return a=pb(),null===a&&(a=hb(),null===a&&(a=gb())),a}function rb(){var b,c;return Uf++,123===a.charCodeAt(Of)?(b=ee,Of++):(b=null,0===Uf&&e(fe)),Uf--,null===b&&(c=null,0===Uf&&e(ne)),b}function sb(){var b,c;return Uf++,a.substr(Of,2)===pe?(b=pe,Of+=2):(b=null,0===Uf&&e(qe)),Uf--,null===b&&(c=null,0===Uf&&e(oe)),b}function tb(){var b,c;return Uf++,a.substr(Of,3)===se?(b=se,Of+=3):(b=null,0===Uf&&e(te)),Uf--,null===b&&(c=null,0===Uf&&e(re)),b}function ub(){var b,c;return Uf++,125===a.charCodeAt(Of)?(b=ve,Of++):(b=null,0===Uf&&e(we)),Uf--,null===b&&(c=null,0===Uf&&e(ue)),b}function vb(){var b,c;return Uf++,a.substr(Of,2)===ye?(b=ye,Of+=2):(b=null,0===Uf&&e(ze)),Uf--,null===b&&(c=null,0===Uf&&e(xe)),b}function wb(){var b,c;return Uf++,a.substr(Of,3)===Be?(b=Be,Of+=3):(b=null,0===Uf&&e(Ce)),Uf--,null===b&&(c=null,0===Uf&&e(Ae)),b}function xb(){var b,c;return Uf++,a.substr(Of,2)===Ee?(b=Ee,Of+=2):(b=null,0===Uf&&e(Fe)),Uf--,null===b&&(c=null,0===Uf&&e(De)),b}function yb(){var b,c;return Uf++,125===a.charCodeAt(Of)?(b=ve,Of++):(b=null,0===Uf&&e(we)),Uf--,null===b&&(c=null,0===Uf&&e(Ge)),b}function zb(){var b,c,d;return b=Of,a.substr(Of,2)===He?(c=He,Of+=2):(c=null,0===Uf&&e(Ie)),null!==c?(32===a.charCodeAt(Of)?(d=Oc,Of++):(d=null,0===Uf&&e(Pc)),null===d&&(d=rc),null!==d?(Pf=b,c=Je(),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc),null===b&&(b=Of,61===a.charCodeAt(Of)?(c=uc,Of++):(c=null,0===Uf&&e(vc)),null!==c?(32===a.charCodeAt(Of)?(d=Oc,Of++):(d=null,0===Uf&&e(Pc)),null===d&&(d=rc),null!==d?(Pf=b,c=Ke(),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)),b}function Ab(){var b,c,d,f,g;return b=Of,c=Ub(),null===c&&(c=rc),null!==c?(d=F(),null===d&&(d=rc),null!==d?(47===a.charCodeAt(Of)?(f=Jc,Of++):(f=null,0===Uf&&e(Kc)),null===f&&(f=rc),null!==f?(Pf=Of,g=Le(c,d),g=g?rc:qc,null!==g?(c=[c,d,f,g],b=c):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc),b}function Bb(){var a,b,c,d,e;if(a=Of,b=Ab(),null!==b){for(c=[],d=qb();null!==d;)c.push(d),d=qb();if(null!==c){for(d=[],e=Cb();null!==e;)d.push(e),e=Cb();null!==d?(Pf=a,b=Me(b,c,d),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)}else Of=a,a=qc}else Of=a,a=qc;return a}function F(){var a,b,c,d;if(a=Of,b=[],c=Of,d=Nb(),null!==d&&(Pf=c,d=Ne(d)),null===d?(Of=c,c=d):c=d,null===c&&(c=Of,d=Ob(),null!==d&&(Pf=c,d=Oe(d)),null===d?(Of=c,c=d):c=d),null!==c)for(;null!==c;)b.push(c),c=Of,d=Nb(),null!==d&&(Pf=c,d=Ne(d)),null===d?(Of=c,c=d):c=d,null===c&&(c=Of,d=Ob(),null!==d&&(Pf=c,d=Oe(d)),null===d?(Of=c,c=d):c=d);else b=qc;return null!==b&&(Pf=a,b=Pe(b)),null===b?(Of=a,a=b):a=b,a}function Cb(){var b,c,d;if(b=Of,c=[],32===a.charCodeAt(Of)?(d=Oc,Of++):(d=null,0===Uf&&e(Pc)),null!==d)for(;null!==d;)c.push(d),32===a.charCodeAt(Of)?(d=Oc,Of++):(d=null,0===Uf&&e(Pc));else c=qc;return null!==c?(d=Gb(),null===d&&(d=Hb(),null===d&&(d=Jb(),null===d&&(d=Kb(),null===d&&(d=Lb())))),null!==d?(Pf=b,c=Qe(d),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc),b}function Db(){var b;return Re.test(a.charAt(Of))?(b=a.charAt(Of),Of++):(b=null,0===Uf&&e(Se)),null===b&&(b=Xb()),b}function Eb(){var a,b;return a=Fb(),null===a&&(a=Of,b=Q(),null!==b&&(Pf=a,b=Te(b)),null===b?(Of=a,a=b):a=b),a}function Fb(){var b,c,d,f,g;return b=Of,c=Of,34===a.charCodeAt(Of)?(d=Od,Of++):(d=null,0===Uf&&e(Pd)),null!==d?(f=D(),null!==f?(34===a.charCodeAt(Of)?(g=Od,Of++):(g=null,0===Uf&&e(Pd)),null!==g?(d=[d,f,g],c=d):(Of=c,c=qc)):(Of=c,c=qc)):(Of=c,c=qc),null===c&&(c=Of,39===a.charCodeAt(Of)?(d=Qd,Of++):(d=null,0===Uf&&e(Rd)),null!==d?(f=D(),null!==f?(39===a.charCodeAt(Of)?(g=Qd,Of++):(g=null,0===Uf&&e(Rd)),null!==g?(d=[d,f,g],c=d):(Of=c,c=qc)):(Of=c,c=qc)):(Of=c,c=qc)),null!==c&&(Pf=b,c=Sd(c)),null===c?(Of=b,b=c):b=c,b}function Gb(){var b,c,d,f;return b=Of,c=Yb(),null!==c?(61===a.charCodeAt(Of)?(d=uc,Of++):(d=null,0===Uf&&e(vc)),null!==d?(f=Eb(),null!==f?(Pf=b,c=Ue(c,f),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc),b}function Hb(){var b,c,d,f;return b=Of,c=L(),null!==c?(61===a.charCodeAt(Of)?(d=uc,Of++):(d=null,0===Uf&&e(vc)),null!==d?(a.substr(Of,4)===Ed?(f=Ed,Of+=4):(f=null,0===Uf&&e(Fd)),null===f&&(a.substr(Of,5)===Gd?(f=Gd,Of+=5):(f=null,0===Uf&&e(Hd))),null!==f?(Pf=b,c=Ve(c,f),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc),b}function Ib(){var b,c,d,f,g,h;if(b=Of,123===a.charCodeAt(Of)?(c=ee,Of++):(c=null,0===Uf&&e(fe)),null!==c)if(d=ec(),null!==d){if(f=Of,g=[],h=Db(),null===h&&(32===a.charCodeAt(Of)?(h=Oc,Of++):(h=null,0===Uf&&e(Pc))),null!==h)for(;null!==h;)g.push(h),h=Db(),null===h&&(32===a.charCodeAt(Of)?(h=Oc,Of++):(h=null,0===Uf&&e(Pc)));else g=qc;null!==g&&(g=a.substring(f,Of)),f=g,null!==f?(g=ec(),null!==g?(125===a.charCodeAt(Of)?(h=ve,Of++):(h=null,0===Uf&&e(we)),null!==h?(Pf=b,c=We(f),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc)}else Of=b,b=qc;else Of=b,b=qc;if(null===b){if(b=Of,c=[],d=Db(),null!==d)for(;null!==d;)c.push(d),d=Db();else c=qc;null!==c&&(c=a.substring(b,Of)),b=c}return b}function Jb(){var b,c,d,f,g,h;return b=Of,c=L(),null!==c?(61===a.charCodeAt(Of)?(d=uc,Of++):(d=null,0===Uf&&e(vc)),null!==d?(f=Ib(),null!==f?(g=Of,Uf++,33===a.charCodeAt(Of)?(h=Xe,Of++):(h=null,0===Uf&&e(Ye)),Uf--,null===h?g=rc:(Of=g,g=qc),null!==g?(Pf=Of,h=Ze(c,f),h=h?rc:qc,null!==h?(Pf=b,c=$e(c,f),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc),b}function Kb(){var b,c,d,f;return b=Of,c=L(),null!==c?(61===a.charCodeAt(Of)?(d=uc,Of++):(d=null,0===Uf&&e(vc)),null!==d?(f=Q(),null!==f?(Pf=b,c=_e(c,f),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc),b}function Lb(){var b,c,d,f;return b=Of,c=L(),null!==c?(61===a.charCodeAt(Of)?(d=uc,Of++):(d=null,0===Uf&&e(vc)),null!==d?(f=bb(),null!==f?(Pf=b,c=af(c,f),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc),b}function Mb(){var b,c,d;return b=Of,37===a.charCodeAt(Of)?(c=bf,Of++):(c=null,0===Uf&&e(cf)),null!==c?(d=Pb(),null!==d?(Pf=b,c=Rc(d),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc),b}function Nb(){var b,c,d;return b=Of,35===a.charCodeAt(Of)?(c=df,Of++):(c=null,0===Uf&&e(ef)),null!==c?(d=Pb(),null!==d?(Pf=b,c=ff(d),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc),b}function Ob(){var b,c,d;return b=Of,46===a.charCodeAt(Of)?(c=kd,Of++):(c=null,0===Uf&&e(ld)),null!==c?(d=Pb(),null!==d?(Pf=b,c=Rc(d),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc),b}function Pb(){var a,b;return Uf++,a=Qb(),Uf--,null===a&&(b=null,0===Uf&&e(gf)),a}function Qb(){var b,c,d;for(b=Of,c=[],d=Rb();null!==d;)c.push(d),d=Rb();return null!==c&&(c=a.substring(b,Of)),b=c}function Rb(){var b;return hf.test(a.charAt(Of))?(b=a.charAt(Of),Of++):(b=null,0===Uf&&e(jf)),null===b&&(b=Sb()),b}function Sb(){var b;return kf.test(a.charAt(Of))?(b=a.charAt(Of),Of++):(b=null,0===Uf&&e(lf)),b}function Tb(){var b,c,d;if(b=Of,c=[],d=Wb(),null!==d)for(;null!==d;)c.push(d),d=Wb();else c=qc;return null!==c&&(c=a.substring(b,Of)),b=c}function Ub(){var b,c,d,f;return Uf++,b=Of,37===a.charCodeAt(Of)?(c=bf,Of++):(c=null,0===Uf&&e(cf)),null!==c?(d=ec(),null!==d?(f=Tb(),null!==f?(Pf=b,c=od(f),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc),null===b&&(b=Vb()),Uf--,null===b&&(c=null,0===Uf&&e(mf)),b}function Vb(){var a,b,c;return a=Of,b=Tb(),null!==b?(Pf=Of,c=nf(b),c=c?rc:qc,null!==c?(Pf=a,b=of(b),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc),a}function Wb(){var b;return hf.test(a.charAt(Of))?(b=a.charAt(Of),Of++):(b=null,0===Uf&&e(jf)),null===b&&(b=Xb()),b}function Xb(){var b,c,d,f;return b=Of,58===a.charCodeAt(Of)?(c=qd,Of++):(c=null,0===Uf&&e(rd)),null!==c?(d=Of,Uf++,32===a.charCodeAt(Of)?(f=Oc,Of++):(f=null,0===Uf&&e(Pc)),Uf--,null===f?d=rc:(Of=d,d=qc),null!==d?(Pf=b,c=Rc(c),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc),b}function Yb(){var a,b,c;return Uf++,a=Of,b=Tb(),null!==b?(Pf=Of,c=qf(b),c=c?rc:qc,null!==c?(Pf=a,b=of(b),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc),Uf--,null===a&&(b=null,0===Uf&&e(pf)),a}function Zb(){var a,b,c;return a=Of,b=$b(),null!==b?(c=dc(),null!==c?(Pf=a,b=od(c),null===b?(Of=a,a=b):a=b):(Of=a,a=qc)):(Of=a,a=qc),a}function $b(){var b,c;return Uf++,b=Of,61423===a.charCodeAt(Of)?(c=sf,Of++):(c=null,0===Uf&&e(tf)),null!==c&&(Pf=b,c=uf()),null===c?(Of=b,b=c):b=c,Uf--,null===b&&(c=null,0===Uf&&e(rf)),b}function _b(){var b,c;return Uf++,b=Of,61438===a.charCodeAt(Of)?(c=wf,Of++):(c=null,0===Uf&&e(xf)),null!==c&&(Pf=b,c=uf()),null===c?(Of=b,b=c):b=c,Uf--,null===b&&(c=null,0===Uf&&e(vf)),b}function ac(){var b,c;return Uf++,b=Of,61422===a.charCodeAt(Of)?(c=zf,Of++):(c=null,0===Uf&&e(Af)),null!==c&&(Pf=b,c=uf()),null===c?(Of=b,b=c):b=c,Uf--,null===b&&(c=null,0===Uf&&e(yf)),b}function bc(){var b,c,d,f;return Uf++,b=Of,13===a.charCodeAt(Of)?(c=Cf,Of++):(c=null,0===Uf&&e(Df)),null===c&&(c=rc),null!==c?(61439===a.charCodeAt(Of)?(d=Ef,Of++):(d=null,0===Uf&&e(Ff)),null!==d?(10===a.charCodeAt(Of)?(f=Gf,Of++):(f=null,0===Uf&&e(Hf)),null!==f?(Pf=b,c=Je(),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc)):(Of=b,b=qc),Uf--,null===b&&(c=null,0===Uf&&e(Bf)),b}function cc(){var a,b;return Uf++,a=_b(),null===a&&(a=ac()),Uf--,null===a&&(b=null,0===Uf&&e(If)),a}function dc(){var b,c,d;if(Uf++,b=Of,c=[],d=fc(),null!==d)for(;null!==d;)c.push(d),d=fc();else c=qc;return null!==c&&(c=a.substring(b,Of)),b=c,Uf--,null===b&&(c=null,0===Uf&&e(Jf)),b}function ec(){var a,b;for(Uf++,a=[],b=fc();null!==b;)a.push(b),b=fc();return Uf--,null===a&&(b=null,0===Uf&&e(Kf)),a}function fc(){var b,c;return Uf++,Mf.test(a.charAt(Of))?(b=a.charAt(Of),Of++):(b=null,0===Uf&&e(Nf)),Uf--,null===b&&(c=null,0===Uf&&e(Lf)),b}function gc(){var b,c,d;return b=Of,c=Of,Uf++,d=$b(),null===d&&(d=_b(),null===d&&(d=bc())),Uf--,null===d?c=rc:(Of=c,c=qc),null!==c?(a.length>Of?(d=a.charAt(Of),Of++):(d=null,0===Uf&&e(me)),null!==d?(Pf=b,c=Rc(d),null===c?(Of=b,b=c):b=c):(Of=b,b=qc)):(Of=b,b=qc),b}function hc(){var b,c,d;for(b=Of,c=[],d=gc();null!==d;)c.push(d),d=gc();return null!==c&&(c=a.substring(b,Of)),b=c}function ic(a,b,c){if(cg){var d=c?ag:bg;return new Xf.MustacheNode(a,b,d,{left:!1,right:!1})}return new Xf.MustacheNode(a,b,!c)}function jc(a,b){return cg?new Xf.ProgramNode(a,{left:!1,right:!1},b,null):new Xf.ProgramNode(a,b)}function kc(a,b,c){var d=a.hash;if(c){d=d||new Xf.HashNode([]);for(var e=0;e<c.length;++e)d.pairs.push(c[e])}var f=[a.id].concat(a.params);return f.unshift(new Xf.IdNode([{part:b}])),ic(f,d,a.escaped)}function lc(a,b){var c=[];a&&c.push(a); for(var d=0;d<b.length;++d){var e=b[d];c.push(e[0]),e[1]&&c.push(e[1])}return c}var mc,nc=arguments.length>1?arguments[1]:{},oc={start:g},pc=g,qc=null,rc="",sc=function(a){return a},tc=function(a,b){return jc(a,b||[])},uc="=",vc='"="',wc="else",xc='"else"',yc=function(a){for(var b=[],c=[],d=0;d<a.length;++d)for(var e=a[d],f=0;f<e.length;++f){var g=e[f];"content"!==g.type?(c.length&&(b.push(new Xf.ContentNode(c.join(""))),c=[]),b.push(g)):g.string&&c.push(g.string)}return c.length&&b.push(new Xf.ContentNode(c.join(""))),b},zc="BeginStatement",Ac="ContentStatement",Bc=function(){return[]},Cc=">",Dc='">"',Ec=function(a,b){return[new Xf.PartialNode(a,b[0])]},Fc=/^[a-zA-Z0-9_$-\/]/,Gc="[a-zA-Z0-9_$-\\/]",Hc=function(a){return new Xf.PartialNameNode(new Xf.StringNode(a))},Ic=function(a){return[a]},Jc="/",Kc='"/"',Lc=/^[A-Z]/,Mc="[A-Z]",Nc=function(a){var b="view";if(a.mustache){var c=a.mustache.id.string.charAt(0);return Wf&&c.match(/[A-Z]/)?(a.mustache=kc(a.mustache,b),a):a}var c=a.id.string.charAt(0);return Wf&&c.match(/[A-Z]/)?kc(a,b):a},Oc=" ",Pc='" "',Qc=function(a,b){if(b){b=b[1];for(var c=0,d=b.length;d>c;++c)a.push(new Xf.ContentNode(" ")),a=a.concat(b[c])}return a},Rc=function(a){return a},Sc=function(a){return[a]},Tc=function(a,b){var c=a[0];return b&&(c=c.concat(b)),a[1]&&c.push(a[1]),c},Uc=function(a,b){if(!b)return a;var c=a.id;cg&&(c.path=a.id,c.strip={left:!1,right:!1});var d=new Xf.BlockNode(a,b,b.inverse,c);return d.path=a.id,d},Vc=": ",Wc='": "',Xc=function(a){return jc(a,[])},Yc=function(a){return a&&a[2]},Zc=function(a,b){var c=b.mustache||b;return c.escaped=a,b},$c=function(a,b,c,d){if(a){var e=new Xf.PartialNameNode(new Xf.StringNode(b.string));return new Xf.PartialNode(e,c[0])}for(var f=[],g={},h=!1,i=0;i<c.length;++i){var j=c[i],k=j[0];"tagName"==k||"elementId"==k||"class"==k?(h=!0,g[k]=g[k]||[],g[k].push(j[1])):f.push(j)}if(h){d=d||new Xf.HashNode([]);for(var l in g)g.hasOwnProperty(l)&&d.pairs.push([l,new Xf.StringNode(g[l].join(" "))])}f.unshift(b);var m=ic(f,d,!0),n=b._emblemSuffixModifier;return"!"===n?kc(m,"unbound"):"?"===n?kc(m,"if"):"^"===n?kc(m,"unless"):m},_c=function(a){return["tagName",a]},ad=function(a){return["elementId",a]},bd=function(a){return["class",a]},cd=function(a){return a},dd=function(a,b){return[a,b]},ed=function(a){return[null,a]},fd=function(a){return a},gd=function(a){return new Xf.HashNode(a)},hd="PathIdent",id="..",jd='".."',kd=".",ld='"."',md=/^[a-zA-Z0-9_$\-!?\^]/,nd="[a-zA-Z0-9_$\\-!?\\^]",od=function(a){return a},pd="Key",qd=":",rd='":"',sd=function(a){return[a[0],a[2]]},td=function(a){return a},ud=function(a,b){return{part:b,separator:a}},vd=function(a,b){for(var c=[{part:a}],d=0;d<b.length;++d)c.push(b[d]);return c},wd="PathSeparator",xd=/^[\/.]/,yd="[\\/.]",zd=function(a){var b,c,d=a[a.length-1];(b=d.part.match(/[!\?\^]$/))&&(c=b[0],d.part=d.part.slice(0,-1));var e=new Xf.IdNode(a);return e._emblemSuffixModifier=c,e},Ad=function(a){return new Xf.StringNode(a)},Bd=function(a){return new Xf.IntegerNode(a)},Cd=function(a){return new Xf.BooleanNode(a)},Dd="Boolean",Ed="true",Fd='"true"',Gd="false",Hd='"false"',Id="Integer",Jd="-",Kd='"-"',Ld=/^[0-9]/,Md="[0-9]",Nd=function(a){return parseInt(a)},Od='"',Pd='"\\""',Qd="'",Rd='"\'"',Sd=function(a){return a[1]},Td=/^[^"}]/,Ud='[^"}]',Vd=/^[^'}]/,Wd="[^'}]",Xd=function(a,b,c){b.unshift(new Xf.ContentNode(a));for(var d=0;d<c.length;++d)b.push(new Xf.ContentNode(a)),b=b.concat(c[d]),b.push("\n");return b},Yd=/^[|`']/,Zd="[|`']",$d="<",_d='"<"',ae=function(){return"<"},be=function(a,b,c){if((b.length||!c)&&b.push("\n"),c){c=c[1];for(var d=0;d<c.length;++d)b=b.concat(c[d]),b.push("\n")}for(var e=[],f="`"!==a,d=0;d<b.length;++d){var g=b[d];"\n"==g?f||e.push(new Xf.ContentNode("\n")):e.push(g)}return"'"===a&&e.push(new Xf.ContentNode(" ")),e},ce=function(a,b){return lc(a,b)},de=function(a,b){return lc(a,b)},ee="{",fe='"{"',ge=/^[^}]/,he="[^}]",ie=function(a){return a="="+a,c.parse(a).statements[0]},je=function(a){return a.escaped=!0,a},ke=function(a){return a.escaped=!1,a},le=function(a){return new Xf.ContentNode(a)},me="any character",ne="SingleMustacheOpen",oe="DoubleMustacheOpen",pe="{{",qe='"{{"',re="TripleMustacheOpen",se="{{{",te='"{{{"',ue="SingleMustacheClose",ve="}",we='"}"',xe="DoubleMustacheClose",ye="}}",ze='"}}"',Ae="TripleMustacheClose",Be="}}}",Ce='"}}}"',De="InterpolationOpen",Ee="#{",Fe='"#{"',Ge="InterpolationClose",He="==",Ie='"=="',Je=function(){return!1},Ke=function(){return!0},Le=function(a,b){return a||b},Me=function(a,b,c){var d,e=a[0]||"div",f=a[1]||[],g=f[0],h=f[1]||[],i=[];d=function(a){var b,c,d,e;if(h.length&&a.id&&"bind-attr"===a.id.string&&a.hash&&a.hash.pairs&&(b=a.hash.pairs))for(var f in b)c=b[f],"class"===c[0]&&c[1]instanceof Xf.StringNode&&(d=c[1],e=d.original,d.original=d.string=d.stringModeValue=":"+h.join(" :")+" "+e,h=[])},i.push(new Xf.ContentNode("<"+e)),g&&i.push(new Xf.ContentNode(' id="'+g+'"'));for(var j=0;j<b.length;++j)d(b[j]),i.push(new Xf.ContentNode(" ")),i.push(b[j]);for(var j=0;j<c.length;++j){for(var k in c[j])c[j][k]instanceof Xf.MustacheNode&&d(c[j][k]);if(h.length){var l=c[j][1]&&'class="'===c[j][1].string;if(l&&4===c[j].length){if("mustache"==c[j][2].type){var m,n,o,p;m=c[j][2],n=":"+h.join(" :")+" "+m.id.original,o=new Xf.HashNode([["class",new Xf.StringNode(n)]]),p=[new Xf.IdNode([{part:"bind-attr"}])].concat(m.params),c[j]=[c[j][0],ic(p,o,!0)]}else h.push(c[j][2].string),c[j][2].string=h.join(" ");h=[]}}i=i.concat(c[j])}h&&h.length&&i.push(new Xf.ContentNode(' class="'+h.join(" ")+'"'));var q=!!a[2];return Yf[e]||q?(i.push(new Xf.ContentNode(" />")),[i]):(i.push(new Xf.ContentNode(">")),[i,new Xf.ContentNode("</"+e+">")])},Ne=function(a){return{shorthand:a,id:!0}},Oe=function(a){return{shorthand:a}},Pe=function(a){for(var b,c=[],d=0,e=a.length;e>d;++d){var f=a[d];f.id?b=f.shorthand:c.push(f.shorthand)}return[b,c]},Qe=function(a){return a.length?[new Xf.ContentNode(" ")].concat(a):[]},Re=/^[A-Za-z.0-9_\-]/,Se="[A-Za-z.0-9_\\-]",Te=function(a){return ic([a],null,!0)},Ue=function(a,b){return[kc(b,"action",[["on",new Xf.StringNode(a)]])]},Ve=function(a,b){return"true"===b?[new Xf.ContentNode(a)]:[]},We=function(a){return a.replace(/ *$/,"")},Xe="!",Ye='"!"',Ze=function(){return Wf},$e=function(a,b){var c=new Xf.HashNode([[a,new Xf.StringNode(b)]]),d=[new Xf.IdNode([{part:"bind-attr"}])],e=ic(d,c);return[e]},_e=function(a,b){var c=ic([b],null,!0);return Wf&&"!"===b._emblemSuffixModifier&&(c=kc(c,"unbound")),[new Xf.ContentNode(a+"="+'"'),c,new Xf.ContentNode('"')]},af=function(a,b){var c=[new Xf.ContentNode(a+"="+'"')].concat(b);return c.concat([new Xf.ContentNode('"')])},bf="%",cf='"%"',df="#",ef='"#"',ff=function(a){return a},gf="CSSIdentifier",hf=/^[_a-zA-Z0-9\-]/,jf="[_a-zA-Z0-9\\-]",kf=/^[\x80-\xFF]/,lf="[\\x80-\\xFF]",mf="KnownHTMLTagName",nf=function(a){return!!Zf[a]},of=function(a){return a},pf="a JS event",qf=function(a){return!!$f[a]},rf="INDENT",sf="\uefef",tf='"\\uEFEF"',uf=function(){return""},vf="DEDENT",wf="\ueffe",xf='"\\uEFFE"',yf="Unmatched DEDENT",zf="\uefee",Af='"\\uEFEE"',Bf="LineEnd",Cf="\r",Df='"\\r"',Ef="\uefff",Ff='"\\uEFFF"',Gf="\n",Hf='"\\n"',If="ANYDEDENT",Jf="RequiredWhitespace",Kf="OptionalWhitespace",Lf="InlineWhitespace",Mf=/^[ \t]/,Nf="[ \\t]",Of=0,Pf=0,Qf=0,Rf={line:1,column:1,seenCR:!1},Sf=0,Tf=[],Uf=0;if("startRule"in nc){if(!(nc.startRule in oc))throw new Error("Can't start parsing from rule \""+nc.startRule+'".');pc=oc[nc.startRule]}var Vf=c.handlebarsVariant,Wf="Ember.Handlebars"===Vf.JavaScriptCompiler.prototype.namespace,Xf=Vf.AST,Yf={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Zf={figcaption:!0,blockquote:!0,plaintext:!0,textarea:!0,progress:!0,optgroup:!0,noscript:!0,noframes:!0,frameset:!0,fieldset:!0,datalist:!0,colgroup:!0,basefont:!0,summary:!0,section:!0,marquee:!0,listing:!0,isindex:!0,details:!0,command:!0,caption:!0,bgsound:!0,article:!0,address:!0,acronym:!0,strong:!0,strike:!0,spacer:!0,source:!0,select:!0,script:!0,output:!0,option:!0,object:!0,legend:!0,keygen:!0,iframe:!0,hgroup:!0,header:!0,footer:!0,figure:!0,center:!0,canvas:!0,button:!0,applet:!0,video:!0,track:!0,title:!0,thead:!0,tfoot:!0,tbody:!0,table:!0,style:!0,small:!0,param:!0,meter:!0,label:!0,input:!0,frame:!0,embed:!0,blink:!0,audio:!0,aside:!0,time:!0,span:!0,samp:!0,ruby:!0,nobr:!0,meta:!0,menu:!0,mark:!0,main:!0,link:!0,html:!0,head:!0,form:!0,font:!0,data:!0,code:!0,cite:!0,body:!0,base:!0,area:!0,abbr:!0,xmp:!0,wbr:!0,"var":!0,sup:!0,sub:!0,pre:!0,nav:!0,map:!0,kbd:!0,ins:!0,img:!0,div:!0,dir:!0,dfn:!0,del:!0,col:!0,big:!0,bdo:!0,bdi:!0,ul:!0,tt:!0,tr:!0,th:!0,td:!0,rt:!0,rp:!0,ol:!0,li:!0,hr:!0,h6:!0,h5:!0,h4:!0,h3:!0,h2:!0,h1:!0,em:!0,dt:!0,dl:!0,dd:!0,br:!0,u:!0,s:!0,q:!0,p:!0,i:!0,b:!0,a:!0},$f={touchStart:!0,touchMove:!0,touchEnd:!0,touchCancel:!0,keyDown:!0,keyUp:!0,keyPress:!0,mouseDown:!0,mouseUp:!0,contextMenu:!0,click:!0,doubleClick:!0,mouseMove:!0,focusIn:!0,focusOut:!0,mouseEnter:!0,mouseLeave:!0,submit:!0,input:!0,change:!0,dragStart:!0,drag:!0,dragEnter:!0,dragLeave:!0,dragOver:!0,drop:!0,dragEnd:!0},_f=String.fromCharCode(125),ag=_f+_f,bg=ag+_f,cg=Vf.VERSION.slice(0,3)>=1.1;if(mc=pc(),null!==mc&&Of===a.length)return mc;throw f(Tf),Pf=Math.max(Of,Sf),new b(Tf,Pf<a.length?a.charAt(Pf):null,Pf,d(Pf).line,d(Pf).column)}return a(b,Error),{SyntaxError:b,parse:d}}(),b.exports=c.Parser},{"./emblem":3}],5:[function(a){var b,c,d;d=a("StringScanner"),b=a("./emblem"),b.Preprocessor=c=function(){function a(){this.base=null,this.indents=[],this.context=[],this.context.peek=function(){return this.length?this[this.length-1]:null},this.context.err=function(a){throw new Error("Unexpected "+a)},this.output="",this.context.observe=function(a){var b;switch(b=this.peek(),a){case e:this.push(a);break;case c:b!==e&&this.err(a),this.pop();break;case"\r":"/"!==b&&this.err(a),this.pop();break;case"\n":"/"!==b&&this.err(a),this.pop();break;case"/":this.push(a);break;case"end-\\":"\\"!==b&&this.err(a),this.pop();break;default:throw new Error("undefined token observed: "+a)}return this},this.ss=this.StringScanner?new this.StringScanner(""):b.StringScanner?new b.StringScanner(""):new d("")}var c,e,f,g,h,i,j,k;return k="\\t\\x0B\\f \\xA0\\u1680\\u180E\\u2000-\\u200A\\u202F\\u205F\\u3000\\uFEFF",e="\uefef",c="\ueffe",g="\uefee",f="\uefff",h=RegExp("["+k+"\\r?\\n]*$"),i=RegExp("(?:["+k+"]*\\r?\\n)+"),a.prototype.p=function(a){return a&&(this.output+=a),a},a.prototype.scan=function(a){return this.p(this.ss.scan(a))},a.prototype.discard=function(a){return this.ss.scan(a)},j=function(a){return function(b){var d,j,l,m;for(a||(this.ss.concat(b),this.discard(i));!this.ss.eos();)switch(this.context.peek()){case null:case e:if(this.ss.bol()||this.discard(i)){if(this.discard(RegExp("["+k+"]*\\r?\\n"))){this.p(""+f+"\n");continue}if(null!=this.base){if(null==this.discard(this.base))throw new Error("inconsistent base indentation")}else d=this.discard(RegExp("["+k+"]*")),this.base=RegExp(""+d);if(0===this.indents.length)this.ss.check(RegExp("["+k+"]+"))&&(this.p(e),this.context.observe(e),this.indents.push(this.scan(RegExp("(["+k+"]+)"))));else if(l=this.indents[this.indents.length-1],j=this.ss.check(RegExp("("+l+")")))this.discard(j),this.ss.check(RegExp("(["+k+"]+)"))&&(this.p(e),this.context.observe(e),this.indents.push(j+this.scan(RegExp("(["+k+"]+)"))));else{for(;this.indents.length&&(l=this.indents[this.indents.length-1],!this.discard(RegExp("(?:"+l+")")));)this.context.observe(c),this.p(c),this.indents.pop();(m=this.discard(RegExp("["+k+"]+")))&&(this.output=this.output.slice(0,-1),this.output+=g,this.p(e),this.context.observe(e),this.indents.push(m))}}this.scan(/[^\r\n]+/),this.discard(/\r?\n/)&&this.p(""+f+"\n")}if(a){for(this.scan(h);this.context.length&&e===this.context.peek();)this.context.observe(c),this.p(c);if(this.context.length)throw new Error("Unclosed "+this.context.peek()+" at EOF")}}},a.prototype.processData=j(!1),a.prototype.processEnd=j(!0),a.processSync=function(b){var c;return b+="\n",c=new a,c.processData(b),c.processEnd(),c.output},a}()},{"./emblem":3,StringScanner:6}],6:[function(a,b){!function(){var a;a=function(){function a(a){this.str=null!=a?a:"",this.str=""+this.str,this.pos=0,this.lastMatch={reset:function(){return this.str=null,this.captures=[],this}}.reset()}return a.prototype.bol=function(){return this.pos<=0||"\n"===this.str[this.pos-1]},a.prototype.captures=function(){return this.lastMatch.captures},a.prototype.check=function(a){var b;return 0!==this.str.substr(this.pos).search(a)?(this.lastMatch.reset(),null):(b=this.str.substr(this.pos).match(a),this.lastMatch.str=b[0],this.lastMatch.captures=b.slice(1),this.lastMatch.str)},a.prototype.checkUntil=function(a){var b,c;return c=this.str.substr(this.pos).search(a),0>c?(this.lastMatch.reset(),null):(b=this.str.substr(this.pos+c).match(a),this.lastMatch.captures=b.slice(1),this.lastMatch.str=this.str.substr(this.pos,c)+b[0])},a.prototype.clone=function(){var a,b,c,d;a=new this.constructor(this.str),a.pos=this.pos,a.lastMatch={},d=this.lastMatch;for(b in d)c=d[b],a.lastMatch[b]=c;return a},a.prototype.concat=function(a){return this.str+=a,this},a.prototype.eos=function(){return this.pos===this.str.length},a.prototype.exists=function(a){var b,c;return c=this.str.substr(this.pos).search(a),0>c?(this.lastMatch.reset(),null):(b=this.str.substr(this.pos+c).match(a),this.lastMatch.str=b[0],this.lastMatch.captures=b.slice(1),c)},a.prototype.getch=function(){return this.scan(/./)},a.prototype.match=function(){return this.lastMatch.str},a.prototype.matches=function(a){return this.check(a),this.matchSize()},a.prototype.matched=function(){return null!=this.lastMatch.str},a.prototype.matchSize=function(){return this.matched()?this.match().length:null},a.prototype.peek=function(a){return this.str.substr(this.pos,a)},a.prototype.pointer=function(){return this.pos},a.prototype.setPointer=function(a){return a=+a,0>a&&(a=0),a>this.str.length&&(a=this.str.length),this.pos=a},a.prototype.reset=function(){return this.lastMatch.reset(),this.pos=0,this},a.prototype.rest=function(){return this.str.substr(this.pos)},a.prototype.scan=function(a){var b;return b=this.check(a),null!=b&&(this.pos+=b.length),b},a.prototype.scanUntil=function(a){var b;return b=this.checkUntil(a),null!=b&&(this.pos+=b.length),b},a.prototype.skip=function(a){return this.scan(a),this.matchSize()},a.prototype.skipUntil=function(a){return this.scanUntil(a),this.matchSize()},a.prototype.string=function(){return this.str},a.prototype.terminate=function(){return this.pos=this.str.length,this.lastMatch.reset(),this},a.prototype.toString=function(){return"#<StringScanner "+(this.eos()?"fin":""+this.pos+"/"+this.str.length+" @ "+(this.str.length>8?""+this.str.substr(0,5)+"...":this.str))+">"},a}(),a.prototype.beginningOfLine=a.prototype.bol,a.prototype.clear=a.prototype.terminate,a.prototype.dup=a.prototype.clone,a.prototype.endOfString=a.prototype.eos,a.prototype.exist=a.prototype.exists,a.prototype.getChar=a.prototype.getch,a.prototype.position=a.prototype.pointer,a.StringScanner=a,b.exports=a}.call(this)},{}]},{},[3]);
Amomo/cdnjs
ajax/libs/emblem/0.3.8/emblem.min.js
JavaScript
mit
47,176