Index: trunk/extensions/Storyboard/jquery/jquery.validate.pack.js |
— | — | @@ -0,0 +1,15 @@ |
| 2 | +/* |
| 3 | + * jQuery validation plug-in 1.7 |
| 4 | + * |
| 5 | + * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ |
| 6 | + * http://docs.jquery.com/Plugins/Validation |
| 7 | + * |
| 8 | + * Copyright (c) 2006 - 2008 Jörn Zaefferer |
| 9 | + * |
| 10 | + * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $ |
| 11 | + * |
| 12 | + * Dual licensed under the MIT and GPL licenses: |
| 13 | + * http://www.opensource.org/licenses/mit-license.php |
| 14 | + * http://www.gnu.org/licenses/gpl.html |
| 15 | + */ |
| 16 | +eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(7($){$.H($.2L,{17:7(d){l(!6.F){d&&d.2q&&2T.1z&&1z.52("3y 3p, 4L\'t 17, 64 3y");8}p c=$.19(6[0],\'v\');l(c){8 c}c=2w $.v(d,6[0]);$.19(6[0],\'v\',c);l(c.q.3x){6.3s("1w, 3i").1o(".4E").3e(7(){c.3b=w});l(c.q.35){6.3s("1w, 3i").1o(":2s").3e(7(){c.1Z=6})}6.2s(7(b){l(c.q.2q)b.5J();7 1T(){l(c.q.35){l(c.1Z){p a=$("<1w 1V=\'5r\'/>").1s("u",c.1Z.u).33(c.1Z.Z).51(c.U)}c.q.35.V(c,c.U);l(c.1Z){a.3D()}8 N}8 w}l(c.3b){c.3b=N;8 1T()}l(c.L()){l(c.1b){c.1l=w;8 N}8 1T()}12{c.2l();8 N}})}8 c},J:7(){l($(6[0]).2W(\'L\')){8 6.17().L()}12{p b=w;p a=$(6[0].L).17();6.P(7(){b&=a.I(6)});8 b}},4D:7(c){p d={},$I=6;$.P(c.1I(/\\s/),7(a,b){d[b]=$I.1s(b);$I.6d(b)});8 d},1i:7(h,k){p f=6[0];l(h){p i=$.19(f.L,\'v\').q;p d=i.1i;p c=$.v.36(f);23(h){1e"1d":$.H(c,$.v.1X(k));d[f.u]=c;l(k.G)i.G[f.u]=$.H(i.G[f.u],k.G);31;1e"3D":l(!k){T d[f.u];8 c}p e={};$.P(k.1I(/\\s/),7(a,b){e[b]=c[b];T c[b]});8 e}}p g=$.v.41($.H({},$.v.3Y(f),$.v.3V(f),$.v.3T(f),$.v.36(f)),f);l(g.15){p j=g.15;T g.15;g=$.H({15:j},g)}8 g}});$.H($.5p[":"],{5n:7(a){8!$.1p(""+a.Z)},5g:7(a){8!!$.1p(""+a.Z)},5f:7(a){8!a.4h}});$.v=7(b,a){6.q=$.H(w,{},$.v.3d,b);6.U=a;6.3I()};$.v.W=7(c,b){l(R.F==1)8 7(){p a=$.3F(R);a.4V(c);8 $.v.W.1Q(6,a)};l(R.F>2&&b.2c!=3B){b=$.3F(R).4Q(1)}l(b.2c!=3B){b=[b]}$.P(b,7(i,n){c=c.1u(2w 3t("\\\\{"+i+"\\\\}","g"),n)});8 c};$.H($.v,{3d:{G:{},2a:{},1i:{},1c:"3r",28:"J",2F:"4P",2l:w,3o:$([]),2D:$([]),3x:w,3l:[],3k:N,4O:7(a){6.3U=a;l(6.q.4K&&!6.4J){6.q.1K&&6.q.1K.V(6,a,6.q.1c,6.q.28);6.1M(a).2A()}},4C:7(a){l(!6.1E(a)&&(a.u 11 6.1a||!6.K(a))){6.I(a)}},6c:7(a){l(a.u 11 6.1a||a==6.4A){6.I(a)}},68:7(a){l(a.u 11 6.1a)6.I(a);12 l(a.4x.u 11 6.1a)6.I(a.4x)},39:7(a,c,b){$(a).22(c).2v(b)},1K:7(a,c,b){$(a).2v(c).22(b)}},63:7(a){$.H($.v.3d,a)},G:{15:"61 4r 2W 15.",1q:"M 2O 6 4r.",1J:"M O a J 1J 5X.",1B:"M O a J 5W.",1A:"M O a J 1A.",2j:"M O a J 1A (5Q).",1G:"M O a J 1G.",1P:"M O 5O 1P.",2f:"M O a J 5L 5I 1G.",2o:"M O 47 5F Z 5B.",43:"M O a Z 5z a J 5x.",18:$.v.W("M O 3K 5v 2X {0} 2V."),1y:$.v.W("M O 5t 5s {0} 2V."),2i:$.v.W("M O a Z 3W {0} 3O {1} 2V 5o."),2r:$.v.W("M O a Z 3W {0} 3O {1}."),1C:$.v.W("M O a Z 5j 2X 46 3M 3L {0}."),1t:$.v.W("M O a Z 5d 2X 46 3M 3L {0}.")},3J:N,5a:{3I:7(){6.24=$(6.q.2D);6.4t=6.24.F&&6.24||$(6.U);6.2x=$(6.q.3o).1d(6.q.2D);6.1a={};6.54={};6.1b=0;6.1h={};6.1f={};6.21();p f=(6.2a={});$.P(6.q.2a,7(d,c){$.P(c.1I(/\\s/),7(a,b){f[b]=d})});p e=6.q.1i;$.P(e,7(b,a){e[b]=$.v.1X(a)});7 2N(a){p b=$.19(6[0].L,"v"),3c="4W"+a.1V.1u(/^17/,"");b.q[3c]&&b.q[3c].V(b,6[0])}$(6.U).2K(":3E, :4U, :4T, 2e, 4S","2d 2J 4R",2N).2K(":3C, :3A, 2e, 3z","3e",2N);l(6.q.3w)$(6.U).2I("1f-L.17",6.q.3w)},L:7(){6.3v();$.H(6.1a,6.1v);6.1f=$.H({},6.1v);l(!6.J())$(6.U).3u("1f-L",[6]);6.1m();8 6.J()},3v:7(){6.2H();Q(p i=0,14=(6.2b=6.14());14[i];i++){6.29(14[i])}8 6.J()},I:7(a){a=6.2G(a);6.4A=a;6.2P(a);6.2b=$(a);p b=6.29(a);l(b){T 6.1f[a.u]}12{6.1f[a.u]=w}l(!6.3q()){6.13=6.13.1d(6.2x)}6.1m();8 b},1m:7(b){l(b){$.H(6.1v,b);6.S=[];Q(p c 11 b){6.S.27({1j:b[c],I:6.26(c)[0]})}6.1n=$.3n(6.1n,7(a){8!(a.u 11 b)})}6.q.1m?6.q.1m.V(6,6.1v,6.S):6.3m()},2S:7(){l($.2L.2S)$(6.U).2S();6.1a={};6.2H();6.2Q();6.14().2v(6.q.1c)},3q:7(){8 6.2k(6.1f)},2k:7(a){p b=0;Q(p i 11 a)b++;8 b},2Q:7(){6.2C(6.13).2A()},J:7(){8 6.3j()==0},3j:7(){8 6.S.F},2l:7(){l(6.q.2l){3Q{$(6.3h()||6.S.F&&6.S[0].I||[]).1o(":4N").3g().4M("2d")}3f(e){}}},3h:7(){p a=6.3U;8 a&&$.3n(6.S,7(n){8 n.I.u==a.u}).F==1&&a},14:7(){p a=6,2B={};8 $([]).1d(6.U.14).1o(":1w").1L(":2s, :21, :4I, [4H]").1L(6.q.3l).1o(7(){!6.u&&a.q.2q&&2T.1z&&1z.3r("%o 4G 3K u 4F",6);l(6.u 11 2B||!a.2k($(6).1i()))8 N;2B[6.u]=w;8 w})},2G:7(a){8 $(a)[0]},2z:7(){8 $(6.q.2F+"."+6.q.1c,6.4t)},21:7(){6.1n=[];6.S=[];6.1v={};6.1k=$([]);6.13=$([]);6.2b=$([])},2H:7(){6.21();6.13=6.2z().1d(6.2x)},2P:7(a){6.21();6.13=6.1M(a)},29:7(d){d=6.2G(d);l(6.1E(d)){d=6.26(d.u)[0]}p a=$(d).1i();p c=N;Q(Y 11 a){p b={Y:Y,2n:a[Y]};3Q{p f=$.v.1N[Y].V(6,d.Z.1u(/\\r/g,""),d,b.2n);l(f=="1S-1Y"){c=w;6g}c=N;l(f=="1h"){6.13=6.13.1L(6.1M(d));8}l(!f){6.4B(d,b);8 N}}3f(e){6.q.2q&&2T.1z&&1z.6f("6e 6b 6a 69 I "+d.4z+", 29 47 \'"+b.Y+"\' Y",e);67 e;}}l(c)8;l(6.2k(a))6.1n.27(d);8 w},4y:7(a,b){l(!$.1H)8;p c=6.q.3a?$(a).1H()[6.q.3a]:$(a).1H();8 c&&c.G&&c.G[b]},4w:7(a,b){p m=6.q.G[a];8 m&&(m.2c==4v?m:m[b])},4u:7(){Q(p i=0;i<R.F;i++){l(R[i]!==20)8 R[i]}8 20},2u:7(a,b){8 6.4u(6.4w(a.u,b),6.4y(a,b),!6.q.3k&&a.62||20,$.v.G[b],"<4s>60: 5Z 1j 5Y Q "+a.u+"</4s>")},4B:7(b,a){p c=6.2u(b,a.Y),37=/\\$?\\{(\\d+)\\}/g;l(1g c=="7"){c=c.V(6,a.2n,b)}12 l(37.16(c)){c=1F.W(c.1u(37,\'{$1}\'),a.2n)}6.S.27({1j:c,I:b});6.1v[b.u]=c;6.1a[b.u]=c},2C:7(a){l(6.q.2t)a=a.1d(a.4q(6.q.2t));8 a},3m:7(){Q(p i=0;6.S[i];i++){p a=6.S[i];6.q.39&&6.q.39.V(6,a.I,6.q.1c,6.q.28);6.2E(a.I,a.1j)}l(6.S.F){6.1k=6.1k.1d(6.2x)}l(6.q.1x){Q(p i=0;6.1n[i];i++){6.2E(6.1n[i])}}l(6.q.1K){Q(p i=0,14=6.4p();14[i];i++){6.q.1K.V(6,14[i],6.q.1c,6.q.28)}}6.13=6.13.1L(6.1k);6.2Q();6.2C(6.1k).4o()},4p:7(){8 6.2b.1L(6.4n())},4n:7(){8 $(6.S).4m(7(){8 6.I})},2E:7(a,c){p b=6.1M(a);l(b.F){b.2v().22(6.q.1c);b.1s("4l")&&b.4k(c)}12{b=$("<"+6.q.2F+"/>").1s({"Q":6.34(a),4l:w}).22(6.q.1c).4k(c||"");l(6.q.2t){b=b.2A().4o().5V("<"+6.q.2t+"/>").4q()}l(!6.24.5S(b).F)6.q.4j?6.q.4j(b,$(a)):b.5R(a)}l(!c&&6.q.1x){b.3E("");1g 6.q.1x=="1D"?b.22(6.q.1x):6.q.1x(b)}6.1k=6.1k.1d(b)},1M:7(a){p b=6.34(a);8 6.2z().1o(7(){8 $(6).1s(\'Q\')==b})},34:7(a){8 6.2a[a.u]||(6.1E(a)?a.u:a.4z||a.u)},1E:7(a){8/3C|3A/i.16(a.1V)},26:7(d){p c=6.U;8 $(4i.5P(d)).4m(7(a,b){8 b.L==c&&b.u==d&&b||4g})},1O:7(a,b){23(b.4f.4e()){1e\'2e\':8 $("3z:3p",b).F;1e\'1w\':l(6.1E(b))8 6.26(b.u).1o(\':4h\').F}8 a.F},4d:7(b,a){8 6.32[1g b]?6.32[1g b](b,a):w},32:{"5N":7(b,a){8 b},"1D":7(b,a){8!!$(b,a.L).F},"7":7(b,a){8 b(a)}},K:7(a){8!$.v.1N.15.V(6,$.1p(a.Z),a)&&"1S-1Y"},4c:7(a){l(!6.1h[a.u]){6.1b++;6.1h[a.u]=w}},4b:7(a,b){6.1b--;l(6.1b<0)6.1b=0;T 6.1h[a.u];l(b&&6.1b==0&&6.1l&&6.L()){$(6.U).2s();6.1l=N}12 l(!b&&6.1b==0&&6.1l){$(6.U).3u("1f-L",[6]);6.1l=N}},2h:7(a){8 $.19(a,"2h")||$.19(a,"2h",{2M:4g,J:w,1j:6.2u(a,"1q")})}},1R:{15:{15:w},1J:{1J:w},1B:{1B:w},1A:{1A:w},2j:{2j:w},4a:{4a:w},1G:{1G:w},49:{49:w},1P:{1P:w},2f:{2f:w}},48:7(a,b){a.2c==4v?6.1R[a]=b:$.H(6.1R,a)},3V:7(b){p a={};p c=$(b).1s(\'5H\');c&&$.P(c.1I(\' \'),7(){l(6 11 $.v.1R){$.H(a,$.v.1R[6])}});8 a},3T:7(c){p a={};p d=$(c);Q(Y 11 $.v.1N){p b=d.1s(Y);l(b){a[Y]=b}}l(a.18&&/-1|5G|5C/.16(a.18)){T a.18}8 a},3Y:7(a){l(!$.1H)8{};p b=$.19(a.L,\'v\').q.3a;8 b?$(a).1H()[b]:$(a).1H()},36:7(b){p a={};p c=$.19(b.L,\'v\');l(c.q.1i){a=$.v.1X(c.q.1i[b.u])||{}}8 a},41:7(d,e){$.P(d,7(c,b){l(b===N){T d[c];8}l(b.2R||b.2p){p a=w;23(1g b.2p){1e"1D":a=!!$(b.2p,e.L).F;31;1e"7":a=b.2p.V(e,e);31}l(a){d[c]=b.2R!==20?b.2R:w}12{T d[c]}}});$.P(d,7(a,b){d[a]=$.44(b)?b(e):b});$.P([\'1y\',\'18\',\'1t\',\'1C\'],7(){l(d[6]){d[6]=2Z(d[6])}});$.P([\'2i\',\'2r\'],7(){l(d[6]){d[6]=[2Z(d[6][0]),2Z(d[6][1])]}});l($.v.3J){l(d.1t&&d.1C){d.2r=[d.1t,d.1C];T d.1t;T d.1C}l(d.1y&&d.18){d.2i=[d.1y,d.18];T d.1y;T d.18}}l(d.G){T d.G}8 d},1X:7(a){l(1g a=="1D"){p b={};$.P(a.1I(/\\s/),7(){b[6]=w});a=b}8 a},5A:7(c,a,b){$.v.1N[c]=a;$.v.G[c]=b!=20?b:$.v.G[c];l(a.F<3){$.v.48(c,$.v.1X(c))}},1N:{15:7(c,d,a){l(!6.4d(a,d))8"1S-1Y";23(d.4f.4e()){1e\'2e\':p b=$(d).33();8 b&&b.F>0;1e\'1w\':l(6.1E(d))8 6.1O(c,d)>0;5y:8 $.1p(c).F>0}},1q:7(f,h,j){l(6.K(h))8"1S-1Y";p g=6.2h(h);l(!6.q.G[h.u])6.q.G[h.u]={};g.40=6.q.G[h.u].1q;6.q.G[h.u].1q=g.1j;j=1g j=="1D"&&{1B:j}||j;l(g.2M!==f){g.2M=f;p k=6;6.4c(h);p i={};i[h.u]=f;$.2U($.H(w,{1B:j,3Z:"2Y",3X:"17"+h.u,5w:"5u",19:i,1x:7(d){k.q.G[h.u].1q=g.40;p b=d===w;l(b){p e=k.1l;k.2P(h);k.1l=e;k.1n.27(h);k.1m()}12{p a={};p c=(g.1j=d||k.2u(h,"1q"));a[h.u]=$.44(c)?c(f):c;k.1m(a)}g.J=b;k.4b(h,b)}},j));8"1h"}12 l(6.1h[h.u]){8"1h"}8 g.J},1y:7(b,c,a){8 6.K(c)||6.1O($.1p(b),c)>=a},18:7(b,c,a){8 6.K(c)||6.1O($.1p(b),c)<=a},2i:7(b,d,a){p c=6.1O($.1p(b),d);8 6.K(d)||(c>=a[0]&&c<=a[1])},1t:7(b,c,a){8 6.K(c)||b>=a},1C:7(b,c,a){8 6.K(c)||b<=a},2r:7(b,c,a){8 6.K(c)||(b>=a[0]&&b<=a[1])},1J:7(a,b){8 6.K(b)||/^((([a-z]|\\d|[!#\\$%&\'\\*\\+\\-\\/=\\?\\^X`{\\|}~]|[\\E-\\B\\C-\\x\\A-\\y])+(\\.([a-z]|\\d|[!#\\$%&\'\\*\\+\\-\\/=\\?\\^X`{\\|}~]|[\\E-\\B\\C-\\x\\A-\\y])+)*)|((\\3S)((((\\2m|\\1W)*(\\30\\3R))?(\\2m|\\1W)+)?(([\\3P-\\5q\\45\\42\\5D-\\5E\\3N]|\\5m|[\\5l-\\5k]|[\\5i-\\5K]|[\\E-\\B\\C-\\x\\A-\\y])|(\\\\([\\3P-\\1W\\45\\42\\30-\\3N]|[\\E-\\B\\C-\\x\\A-\\y]))))*(((\\2m|\\1W)*(\\30\\3R))?(\\2m|\\1W)+)?(\\3S)))@((([a-z]|\\d|[\\E-\\B\\C-\\x\\A-\\y])|(([a-z]|\\d|[\\E-\\B\\C-\\x\\A-\\y])([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])*([a-z]|\\d|[\\E-\\B\\C-\\x\\A-\\y])))\\.)+(([a-z]|[\\E-\\B\\C-\\x\\A-\\y])|(([a-z]|[\\E-\\B\\C-\\x\\A-\\y])([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])*([a-z]|[\\E-\\B\\C-\\x\\A-\\y])))\\.?$/i.16(a)},1B:7(a,b){8 6.K(b)||/^(5h?|5M):\\/\\/(((([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])|(%[\\1U-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:)*@)?(((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]))|((([a-z]|\\d|[\\E-\\B\\C-\\x\\A-\\y])|(([a-z]|\\d|[\\E-\\B\\C-\\x\\A-\\y])([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])*([a-z]|\\d|[\\E-\\B\\C-\\x\\A-\\y])))\\.)+(([a-z]|[\\E-\\B\\C-\\x\\A-\\y])|(([a-z]|[\\E-\\B\\C-\\x\\A-\\y])([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])*([a-z]|[\\E-\\B\\C-\\x\\A-\\y])))\\.?)(:\\d*)?)(\\/((([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])|(%[\\1U-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)+(\\/(([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])|(%[\\1U-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)*)*)?)?(\\?((([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])|(%[\\1U-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)|[\\5e-\\5T]|\\/|\\?)*)?(\\#((([a-z]|\\d|-|\\.|X|~|[\\E-\\B\\C-\\x\\A-\\y])|(%[\\1U-f]{2})|[!\\$&\'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/i.16(a)},1A:7(a,b){8 6.K(b)||!/5U|5c/.16(2w 5b(a))},2j:7(a,b){8 6.K(b)||/^\\d{4}[\\/-]\\d{1,2}[\\/-]\\d{1,2}$/.16(a)},1G:7(a,b){8 6.K(b)||/^-?(?:\\d+|\\d{1,3}(?:,\\d{3})+)(?:\\.\\d+)?$/.16(a)},1P:7(a,b){8 6.K(b)||/^\\d+$/.16(a)},2f:7(b,e){l(6.K(e))8"1S-1Y";l(/[^0-9-]+/.16(b))8 N;p a=0,d=0,2g=N;b=b.1u(/\\D/g,"");Q(p n=b.F-1;n>=0;n--){p c=b.59(n);p d=58(c,10);l(2g){l((d*=2)>9)d-=9}a+=d;2g=!2g}8(a%10)==0},43:7(b,c,a){a=1g a=="1D"?a.1u(/,/g,\'|\'):"57|56?g|55";8 6.K(c)||b.65(2w 3t(".("+a+")$","i"))},2o:7(c,d,a){p b=$(a).66(".17-2o").2I("3H.17-2o",7(){$(d).J()});8 c==b.33()}}});$.W=$.v.W})(1F);(7($){p c=$.2U;p d={};$.2U=7(a){a=$.H(a,$.H({},$.53,a));p b=a.3X;l(a.3Z=="2Y"){l(d[b]){d[b].2Y()}8(d[b]=c.1Q(6,R))}8 c.1Q(6,R)}})(1F);(7($){l(!1F.1r.38.2d&&!1F.1r.38.2J&&4i.3G){$.P({3g:\'2d\',3H:\'2J\'},7(b,a){$.1r.38[a]={50:7(){6.3G(b,2y,w)},4Z:7(){6.4Y(b,2y,w)},2y:7(e){R[0]=$.1r.2O(e);R[0].1V=a;8 $.1r.1T.1Q(6,R)}};7 2y(e){e=$.1r.2O(e);e.1V=a;8 $.1r.1T.V(6,e)}})};$.H($.2L,{2K:7(d,e,c){8 6.2I(e,7(a){p b=$(a.4X);l(b.2W(d)){8 c.1Q(b,R)}})}})})(1F);',62,389,'||||||this|function|return|||||||||||||if||||var|settings||||name|validator|true|uFDCF|uFFEF||uFDF0|uD7FF|uF900||u00A0|length|messages|extend|element|valid|optional|form|Please|false|enter|each|for|arguments|errorList|delete|currentForm|call|format|_|method|value||in|else|toHide|elements|required|test|validate|maxlength|data|submitted|pendingRequest|errorClass|add|case|invalid|typeof|pending|rules|message|toShow|formSubmitted|showErrors|successList|filter|trim|remote|event|attr|min|replace|errorMap|input|success|minlength|console|date|url|max|string|checkable|jQuery|number|metadata|split|email|unhighlight|not|errorsFor|methods|getLength|digits|apply|classRuleSettings|dependency|handle|da|type|x09|normalizeRule|mismatch|submitButton|undefined|reset|addClass|switch|labelContainer||findByName|push|validClass|check|groups|currentElements|constructor|focusin|select|creditcard|bEven|previousValue|rangelength|dateISO|objectLength|focusInvalid|x20|parameters|equalTo|depends|debug|range|submit|wrapper|defaultMessage|removeClass|new|containers|handler|errors|hide|rulesCache|addWrapper|errorLabelContainer|showLabel|errorElement|clean|prepareForm|bind|focusout|validateDelegate|fn|old|delegate|fix|prepareElement|hideErrors|param|resetForm|window|ajax|characters|is|than|abort|Number|x0d|break|dependTypes|val|idOrName|submitHandler|staticRules|theregex|special|highlight|meta|cancelSubmit|eventType|defaults|click|catch|focus|findLastActive|button|size|ignoreTitle|ignore|defaultShowErrors|grep|errorContainer|selected|numberOfInvalids|error|find|RegExp|triggerHandler|checkForm|invalidHandler|onsubmit|nothing|option|checkbox|Array|radio|remove|text|makeArray|addEventListener|blur|init|autoCreateRanges|no|to|equal|x7f|and|x01|try|x0a|x22|attributeRules|lastActive|classRules|between|port|metadataRules|mode|originalMessage|normalizeRules|x0c|accept|isFunction|x0b|or|the|addClassRules|numberDE|dateDE|stopRequest|startRequest|depend|toLowerCase|nodeName|null|checked|document|errorPlacement|html|generated|map|invalidElements|show|validElements|parent|field|strong|errorContext|findDefined|String|customMessage|parentNode|customMetaMessage|id|lastElement|formatAndAdd|onfocusout|removeAttrs|cancel|assigned|has|disabled|image|blockFocusCleanup|focusCleanup|can|trigger|visible|onfocusin|label|slice|keyup|textarea|file|password|unshift|on|target|removeEventListener|teardown|setup|appendTo|warn|ajaxSettings|valueCache|gif|jpe|png|parseInt|charAt|prototype|Date|NaN|greater|uE000|unchecked|filled|https|x5d|less|x5b|x23|x21|blank|long|expr|x08|hidden|least|at|json|more|dataType|extension|default|with|addMethod|again|524288|x0e|x1f|same|2147483647|class|card|preventDefault|x7e|credit|ftp|boolean|only|getElementsByName|ISO|insertAfter|append|uF8FF|Invalid|wrap|URL|address|defined|No|Warning|This|title|setDefaults|returning|match|unbind|throw|onclick|checking|when|occured|onkeyup|removeAttr|exception|log|continue'.split('|'),0,{})) |
\ No newline at end of file |
Property changes on: trunk/extensions/Storyboard/jquery/jquery.validate.pack.js |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 17 | + native |
Index: trunk/extensions/Storyboard/jquery/jquery.validate.js |
— | — | @@ -0,0 +1,1146 @@ |
| 2 | +/* |
| 3 | + * jQuery validation plug-in 1.7 |
| 4 | + * |
| 5 | + * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ |
| 6 | + * http://docs.jquery.com/Plugins/Validation |
| 7 | + * |
| 8 | + * Copyright (c) 2006 - 2008 Jörn Zaefferer |
| 9 | + * |
| 10 | + * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $ |
| 11 | + * |
| 12 | + * Dual licensed under the MIT and GPL licenses: |
| 13 | + * http://www.opensource.org/licenses/mit-license.php |
| 14 | + * http://www.gnu.org/licenses/gpl.html |
| 15 | + */ |
| 16 | + |
| 17 | +(function($) { |
| 18 | + |
| 19 | +$.extend($.fn, { |
| 20 | + // http://docs.jquery.com/Plugins/Validation/validate |
| 21 | + validate: function( options ) { |
| 22 | + |
| 23 | + // if nothing is selected, return nothing; can't chain anyway |
| 24 | + if (!this.length) { |
| 25 | + options && options.debug && window.console && console.warn( "nothing selected, can't validate, returning nothing" ); |
| 26 | + return; |
| 27 | + } |
| 28 | + |
| 29 | + // check if a validator for this form was already created |
| 30 | + var validator = $.data(this[0], 'validator'); |
| 31 | + if ( validator ) { |
| 32 | + return validator; |
| 33 | + } |
| 34 | + |
| 35 | + validator = new $.validator( options, this[0] ); |
| 36 | + $.data(this[0], 'validator', validator); |
| 37 | + |
| 38 | + if ( validator.settings.onsubmit ) { |
| 39 | + |
| 40 | + // allow suppresing validation by adding a cancel class to the submit button |
| 41 | + this.find("input, button").filter(".cancel").click(function() { |
| 42 | + validator.cancelSubmit = true; |
| 43 | + }); |
| 44 | + |
| 45 | + // when a submitHandler is used, capture the submitting button |
| 46 | + if (validator.settings.submitHandler) { |
| 47 | + this.find("input, button").filter(":submit").click(function() { |
| 48 | + validator.submitButton = this; |
| 49 | + }); |
| 50 | + } |
| 51 | + |
| 52 | + // validate the form on submit |
| 53 | + this.submit( function( event ) { |
| 54 | + if ( validator.settings.debug ) |
| 55 | + // prevent form submit to be able to see console output |
| 56 | + event.preventDefault(); |
| 57 | + |
| 58 | + function handle() { |
| 59 | + if ( validator.settings.submitHandler ) { |
| 60 | + if (validator.submitButton) { |
| 61 | + // insert a hidden input as a replacement for the missing submit button |
| 62 | + var hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm); |
| 63 | + } |
| 64 | + validator.settings.submitHandler.call( validator, validator.currentForm ); |
| 65 | + if (validator.submitButton) { |
| 66 | + // and clean up afterwards; thanks to no-block-scope, hidden can be referenced |
| 67 | + hidden.remove(); |
| 68 | + } |
| 69 | + return false; |
| 70 | + } |
| 71 | + return true; |
| 72 | + } |
| 73 | + |
| 74 | + // prevent submit for invalid forms or custom submit handlers |
| 75 | + if ( validator.cancelSubmit ) { |
| 76 | + validator.cancelSubmit = false; |
| 77 | + return handle(); |
| 78 | + } |
| 79 | + if ( validator.form() ) { |
| 80 | + if ( validator.pendingRequest ) { |
| 81 | + validator.formSubmitted = true; |
| 82 | + return false; |
| 83 | + } |
| 84 | + return handle(); |
| 85 | + } else { |
| 86 | + validator.focusInvalid(); |
| 87 | + return false; |
| 88 | + } |
| 89 | + }); |
| 90 | + } |
| 91 | + |
| 92 | + return validator; |
| 93 | + }, |
| 94 | + // http://docs.jquery.com/Plugins/Validation/valid |
| 95 | + valid: function() { |
| 96 | + if ( $(this[0]).is('form')) { |
| 97 | + return this.validate().form(); |
| 98 | + } else { |
| 99 | + var valid = true; |
| 100 | + var validator = $(this[0].form).validate(); |
| 101 | + this.each(function() { |
| 102 | + valid &= validator.element(this); |
| 103 | + }); |
| 104 | + return valid; |
| 105 | + } |
| 106 | + }, |
| 107 | + // attributes: space seperated list of attributes to retrieve and remove |
| 108 | + removeAttrs: function(attributes) { |
| 109 | + var result = {}, |
| 110 | + $element = this; |
| 111 | + $.each(attributes.split(/\s/), function(index, value) { |
| 112 | + result[value] = $element.attr(value); |
| 113 | + $element.removeAttr(value); |
| 114 | + }); |
| 115 | + return result; |
| 116 | + }, |
| 117 | + // http://docs.jquery.com/Plugins/Validation/rules |
| 118 | + rules: function(command, argument) { |
| 119 | + var element = this[0]; |
| 120 | + |
| 121 | + if (command) { |
| 122 | + var settings = $.data(element.form, 'validator').settings; |
| 123 | + var staticRules = settings.rules; |
| 124 | + var existingRules = $.validator.staticRules(element); |
| 125 | + switch(command) { |
| 126 | + case "add": |
| 127 | + $.extend(existingRules, $.validator.normalizeRule(argument)); |
| 128 | + staticRules[element.name] = existingRules; |
| 129 | + if (argument.messages) |
| 130 | + settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages ); |
| 131 | + break; |
| 132 | + case "remove": |
| 133 | + if (!argument) { |
| 134 | + delete staticRules[element.name]; |
| 135 | + return existingRules; |
| 136 | + } |
| 137 | + var filtered = {}; |
| 138 | + $.each(argument.split(/\s/), function(index, method) { |
| 139 | + filtered[method] = existingRules[method]; |
| 140 | + delete existingRules[method]; |
| 141 | + }); |
| 142 | + return filtered; |
| 143 | + } |
| 144 | + } |
| 145 | + |
| 146 | + var data = $.validator.normalizeRules( |
| 147 | + $.extend( |
| 148 | + {}, |
| 149 | + $.validator.metadataRules(element), |
| 150 | + $.validator.classRules(element), |
| 151 | + $.validator.attributeRules(element), |
| 152 | + $.validator.staticRules(element) |
| 153 | + ), element); |
| 154 | + |
| 155 | + // make sure required is at front |
| 156 | + if (data.required) { |
| 157 | + var param = data.required; |
| 158 | + delete data.required; |
| 159 | + data = $.extend({required: param}, data); |
| 160 | + } |
| 161 | + |
| 162 | + return data; |
| 163 | + } |
| 164 | +}); |
| 165 | + |
| 166 | +// Custom selectors |
| 167 | +$.extend($.expr[":"], { |
| 168 | + // http://docs.jquery.com/Plugins/Validation/blank |
| 169 | + blank: function(a) {return !$.trim("" + a.value);}, |
| 170 | + // http://docs.jquery.com/Plugins/Validation/filled |
| 171 | + filled: function(a) {return !!$.trim("" + a.value);}, |
| 172 | + // http://docs.jquery.com/Plugins/Validation/unchecked |
| 173 | + unchecked: function(a) {return !a.checked;} |
| 174 | +}); |
| 175 | + |
| 176 | +// constructor for validator |
| 177 | +$.validator = function( options, form ) { |
| 178 | + this.settings = $.extend( true, {}, $.validator.defaults, options ); |
| 179 | + this.currentForm = form; |
| 180 | + this.init(); |
| 181 | +}; |
| 182 | + |
| 183 | +$.validator.format = function(source, params) { |
| 184 | + if ( arguments.length == 1 ) |
| 185 | + return function() { |
| 186 | + var args = $.makeArray(arguments); |
| 187 | + args.unshift(source); |
| 188 | + return $.validator.format.apply( this, args ); |
| 189 | + }; |
| 190 | + if ( arguments.length > 2 && params.constructor != Array ) { |
| 191 | + params = $.makeArray(arguments).slice(1); |
| 192 | + } |
| 193 | + if ( params.constructor != Array ) { |
| 194 | + params = [ params ]; |
| 195 | + } |
| 196 | + $.each(params, function(i, n) { |
| 197 | + source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n); |
| 198 | + }); |
| 199 | + return source; |
| 200 | +}; |
| 201 | + |
| 202 | +$.extend($.validator, { |
| 203 | + |
| 204 | + defaults: { |
| 205 | + messages: {}, |
| 206 | + groups: {}, |
| 207 | + rules: {}, |
| 208 | + errorClass: "error", |
| 209 | + validClass: "valid", |
| 210 | + errorElement: "label", |
| 211 | + focusInvalid: true, |
| 212 | + errorContainer: $( [] ), |
| 213 | + errorLabelContainer: $( [] ), |
| 214 | + onsubmit: true, |
| 215 | + ignore: [], |
| 216 | + ignoreTitle: false, |
| 217 | + onfocusin: function(element) { |
| 218 | + this.lastActive = element; |
| 219 | + |
| 220 | + // hide error label and remove error class on focus if enabled |
| 221 | + if ( this.settings.focusCleanup && !this.blockFocusCleanup ) { |
| 222 | + this.settings.unhighlight && this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass ); |
| 223 | + this.errorsFor(element).hide(); |
| 224 | + } |
| 225 | + }, |
| 226 | + onfocusout: function(element) { |
| 227 | + if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) { |
| 228 | + this.element(element); |
| 229 | + } |
| 230 | + }, |
| 231 | + onkeyup: function(element) { |
| 232 | + if ( element.name in this.submitted || element == this.lastElement ) { |
| 233 | + this.element(element); |
| 234 | + } |
| 235 | + }, |
| 236 | + onclick: function(element) { |
| 237 | + // click on selects, radiobuttons and checkboxes |
| 238 | + if ( element.name in this.submitted ) |
| 239 | + this.element(element); |
| 240 | + // or option elements, check parent select in that case |
| 241 | + else if (element.parentNode.name in this.submitted) |
| 242 | + this.element(element.parentNode); |
| 243 | + }, |
| 244 | + highlight: function( element, errorClass, validClass ) { |
| 245 | + $(element).addClass(errorClass).removeClass(validClass); |
| 246 | + }, |
| 247 | + unhighlight: function( element, errorClass, validClass ) { |
| 248 | + $(element).removeClass(errorClass).addClass(validClass); |
| 249 | + } |
| 250 | + }, |
| 251 | + |
| 252 | + // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults |
| 253 | + setDefaults: function(settings) { |
| 254 | + $.extend( $.validator.defaults, settings ); |
| 255 | + }, |
| 256 | + |
| 257 | + messages: { |
| 258 | + required: "This field is required.", |
| 259 | + remote: "Please fix this field.", |
| 260 | + email: "Please enter a valid email address.", |
| 261 | + url: "Please enter a valid URL.", |
| 262 | + date: "Please enter a valid date.", |
| 263 | + dateISO: "Please enter a valid date (ISO).", |
| 264 | + number: "Please enter a valid number.", |
| 265 | + digits: "Please enter only digits.", |
| 266 | + creditcard: "Please enter a valid credit card number.", |
| 267 | + equalTo: "Please enter the same value again.", |
| 268 | + accept: "Please enter a value with a valid extension.", |
| 269 | + maxlength: $.validator.format("Please enter no more than {0} characters."), |
| 270 | + minlength: $.validator.format("Please enter at least {0} characters."), |
| 271 | + rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), |
| 272 | + range: $.validator.format("Please enter a value between {0} and {1}."), |
| 273 | + max: $.validator.format("Please enter a value less than or equal to {0}."), |
| 274 | + min: $.validator.format("Please enter a value greater than or equal to {0}.") |
| 275 | + }, |
| 276 | + |
| 277 | + autoCreateRanges: false, |
| 278 | + |
| 279 | + prototype: { |
| 280 | + |
| 281 | + init: function() { |
| 282 | + this.labelContainer = $(this.settings.errorLabelContainer); |
| 283 | + this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm); |
| 284 | + this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer ); |
| 285 | + this.submitted = {}; |
| 286 | + this.valueCache = {}; |
| 287 | + this.pendingRequest = 0; |
| 288 | + this.pending = {}; |
| 289 | + this.invalid = {}; |
| 290 | + this.reset(); |
| 291 | + |
| 292 | + var groups = (this.groups = {}); |
| 293 | + $.each(this.settings.groups, function(key, value) { |
| 294 | + $.each(value.split(/\s/), function(index, name) { |
| 295 | + groups[name] = key; |
| 296 | + }); |
| 297 | + }); |
| 298 | + var rules = this.settings.rules; |
| 299 | + $.each(rules, function(key, value) { |
| 300 | + rules[key] = $.validator.normalizeRule(value); |
| 301 | + }); |
| 302 | + |
| 303 | + function delegate(event) { |
| 304 | + var validator = $.data(this[0].form, "validator"), |
| 305 | + eventType = "on" + event.type.replace(/^validate/, ""); |
| 306 | + validator.settings[eventType] && validator.settings[eventType].call(validator, this[0] ); |
| 307 | + } |
| 308 | + $(this.currentForm) |
| 309 | + .validateDelegate(":text, :password, :file, select, textarea", "focusin focusout keyup", delegate) |
| 310 | + .validateDelegate(":radio, :checkbox, select, option", "click", delegate); |
| 311 | + |
| 312 | + if (this.settings.invalidHandler) |
| 313 | + $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler); |
| 314 | + }, |
| 315 | + |
| 316 | + // http://docs.jquery.com/Plugins/Validation/Validator/form |
| 317 | + form: function() { |
| 318 | + this.checkForm(); |
| 319 | + $.extend(this.submitted, this.errorMap); |
| 320 | + this.invalid = $.extend({}, this.errorMap); |
| 321 | + if (!this.valid()) |
| 322 | + $(this.currentForm).triggerHandler("invalid-form", [this]); |
| 323 | + this.showErrors(); |
| 324 | + return this.valid(); |
| 325 | + }, |
| 326 | + |
| 327 | + checkForm: function() { |
| 328 | + this.prepareForm(); |
| 329 | + for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) { |
| 330 | + this.check( elements[i] ); |
| 331 | + } |
| 332 | + return this.valid(); |
| 333 | + }, |
| 334 | + |
| 335 | + // http://docs.jquery.com/Plugins/Validation/Validator/element |
| 336 | + element: function( element ) { |
| 337 | + element = this.clean( element ); |
| 338 | + this.lastElement = element; |
| 339 | + this.prepareElement( element ); |
| 340 | + this.currentElements = $(element); |
| 341 | + var result = this.check( element ); |
| 342 | + if ( result ) { |
| 343 | + delete this.invalid[element.name]; |
| 344 | + } else { |
| 345 | + this.invalid[element.name] = true; |
| 346 | + } |
| 347 | + if ( !this.numberOfInvalids() ) { |
| 348 | + // Hide error containers on last error |
| 349 | + this.toHide = this.toHide.add( this.containers ); |
| 350 | + } |
| 351 | + this.showErrors(); |
| 352 | + return result; |
| 353 | + }, |
| 354 | + |
| 355 | + // http://docs.jquery.com/Plugins/Validation/Validator/showErrors |
| 356 | + showErrors: function(errors) { |
| 357 | + if(errors) { |
| 358 | + // add items to error list and map |
| 359 | + $.extend( this.errorMap, errors ); |
| 360 | + this.errorList = []; |
| 361 | + for ( var name in errors ) { |
| 362 | + this.errorList.push({ |
| 363 | + message: errors[name], |
| 364 | + element: this.findByName(name)[0] |
| 365 | + }); |
| 366 | + } |
| 367 | + // remove items from success list |
| 368 | + this.successList = $.grep( this.successList, function(element) { |
| 369 | + return !(element.name in errors); |
| 370 | + }); |
| 371 | + } |
| 372 | + this.settings.showErrors |
| 373 | + ? this.settings.showErrors.call( this, this.errorMap, this.errorList ) |
| 374 | + : this.defaultShowErrors(); |
| 375 | + }, |
| 376 | + |
| 377 | + // http://docs.jquery.com/Plugins/Validation/Validator/resetForm |
| 378 | + resetForm: function() { |
| 379 | + if ( $.fn.resetForm ) |
| 380 | + $( this.currentForm ).resetForm(); |
| 381 | + this.submitted = {}; |
| 382 | + this.prepareForm(); |
| 383 | + this.hideErrors(); |
| 384 | + this.elements().removeClass( this.settings.errorClass ); |
| 385 | + }, |
| 386 | + |
| 387 | + numberOfInvalids: function() { |
| 388 | + return this.objectLength(this.invalid); |
| 389 | + }, |
| 390 | + |
| 391 | + objectLength: function( obj ) { |
| 392 | + var count = 0; |
| 393 | + for ( var i in obj ) |
| 394 | + count++; |
| 395 | + return count; |
| 396 | + }, |
| 397 | + |
| 398 | + hideErrors: function() { |
| 399 | + this.addWrapper( this.toHide ).hide(); |
| 400 | + }, |
| 401 | + |
| 402 | + valid: function() { |
| 403 | + return this.size() == 0; |
| 404 | + }, |
| 405 | + |
| 406 | + size: function() { |
| 407 | + return this.errorList.length; |
| 408 | + }, |
| 409 | + |
| 410 | + focusInvalid: function() { |
| 411 | + if( this.settings.focusInvalid ) { |
| 412 | + try { |
| 413 | + $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []) |
| 414 | + .filter(":visible") |
| 415 | + .focus() |
| 416 | + // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find |
| 417 | + .trigger("focusin"); |
| 418 | + } catch(e) { |
| 419 | + // ignore IE throwing errors when focusing hidden elements |
| 420 | + } |
| 421 | + } |
| 422 | + }, |
| 423 | + |
| 424 | + findLastActive: function() { |
| 425 | + var lastActive = this.lastActive; |
| 426 | + return lastActive && $.grep(this.errorList, function(n) { |
| 427 | + return n.element.name == lastActive.name; |
| 428 | + }).length == 1 && lastActive; |
| 429 | + }, |
| 430 | + |
| 431 | + elements: function() { |
| 432 | + var validator = this, |
| 433 | + rulesCache = {}; |
| 434 | + |
| 435 | + // select all valid inputs inside the form (no submit or reset buttons) |
| 436 | + // workaround $Query([]).add until http://dev.jquery.com/ticket/2114 is solved |
| 437 | + return $([]).add(this.currentForm.elements) |
| 438 | + .filter(":input") |
| 439 | + .not(":submit, :reset, :image, [disabled]") |
| 440 | + .not( this.settings.ignore ) |
| 441 | + .filter(function() { |
| 442 | + !this.name && validator.settings.debug && window.console && console.error( "%o has no name assigned", this); |
| 443 | + |
| 444 | + // select only the first element for each name, and only those with rules specified |
| 445 | + if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) |
| 446 | + return false; |
| 447 | + |
| 448 | + rulesCache[this.name] = true; |
| 449 | + return true; |
| 450 | + }); |
| 451 | + }, |
| 452 | + |
| 453 | + clean: function( selector ) { |
| 454 | + return $( selector )[0]; |
| 455 | + }, |
| 456 | + |
| 457 | + errors: function() { |
| 458 | + return $( this.settings.errorElement + "." + this.settings.errorClass, this.errorContext ); |
| 459 | + }, |
| 460 | + |
| 461 | + reset: function() { |
| 462 | + this.successList = []; |
| 463 | + this.errorList = []; |
| 464 | + this.errorMap = {}; |
| 465 | + this.toShow = $([]); |
| 466 | + this.toHide = $([]); |
| 467 | + this.currentElements = $([]); |
| 468 | + }, |
| 469 | + |
| 470 | + prepareForm: function() { |
| 471 | + this.reset(); |
| 472 | + this.toHide = this.errors().add( this.containers ); |
| 473 | + }, |
| 474 | + |
| 475 | + prepareElement: function( element ) { |
| 476 | + this.reset(); |
| 477 | + this.toHide = this.errorsFor(element); |
| 478 | + }, |
| 479 | + |
| 480 | + check: function( element ) { |
| 481 | + element = this.clean( element ); |
| 482 | + |
| 483 | + // if radio/checkbox, validate first element in group instead |
| 484 | + if (this.checkable(element)) { |
| 485 | + element = this.findByName( element.name )[0]; |
| 486 | + } |
| 487 | + |
| 488 | + var rules = $(element).rules(); |
| 489 | + var dependencyMismatch = false; |
| 490 | + for( method in rules ) { |
| 491 | + var rule = { method: method, parameters: rules[method] }; |
| 492 | + try { |
| 493 | + var result = $.validator.methods[method].call( this, element.value.replace(/\r/g, ""), element, rule.parameters ); |
| 494 | + |
| 495 | + // if a method indicates that the field is optional and therefore valid, |
| 496 | + // don't mark it as valid when there are no other rules |
| 497 | + if ( result == "dependency-mismatch" ) { |
| 498 | + dependencyMismatch = true; |
| 499 | + continue; |
| 500 | + } |
| 501 | + dependencyMismatch = false; |
| 502 | + |
| 503 | + if ( result == "pending" ) { |
| 504 | + this.toHide = this.toHide.not( this.errorsFor(element) ); |
| 505 | + return; |
| 506 | + } |
| 507 | + |
| 508 | + if( !result ) { |
| 509 | + this.formatAndAdd( element, rule ); |
| 510 | + return false; |
| 511 | + } |
| 512 | + } catch(e) { |
| 513 | + this.settings.debug && window.console && console.log("exception occured when checking element " + element.id |
| 514 | + + ", check the '" + rule.method + "' method", e); |
| 515 | + throw e; |
| 516 | + } |
| 517 | + } |
| 518 | + if (dependencyMismatch) |
| 519 | + return; |
| 520 | + if ( this.objectLength(rules) ) |
| 521 | + this.successList.push(element); |
| 522 | + return true; |
| 523 | + }, |
| 524 | + |
| 525 | + // return the custom message for the given element and validation method |
| 526 | + // specified in the element's "messages" metadata |
| 527 | + customMetaMessage: function(element, method) { |
| 528 | + if (!$.metadata) |
| 529 | + return; |
| 530 | + |
| 531 | + var meta = this.settings.meta |
| 532 | + ? $(element).metadata()[this.settings.meta] |
| 533 | + : $(element).metadata(); |
| 534 | + |
| 535 | + return meta && meta.messages && meta.messages[method]; |
| 536 | + }, |
| 537 | + |
| 538 | + // return the custom message for the given element name and validation method |
| 539 | + customMessage: function( name, method ) { |
| 540 | + var m = this.settings.messages[name]; |
| 541 | + return m && (m.constructor == String |
| 542 | + ? m |
| 543 | + : m[method]); |
| 544 | + }, |
| 545 | + |
| 546 | + // return the first defined argument, allowing empty strings |
| 547 | + findDefined: function() { |
| 548 | + for(var i = 0; i < arguments.length; i++) { |
| 549 | + if (arguments[i] !== undefined) |
| 550 | + return arguments[i]; |
| 551 | + } |
| 552 | + return undefined; |
| 553 | + }, |
| 554 | + |
| 555 | + defaultMessage: function( element, method) { |
| 556 | + return this.findDefined( |
| 557 | + this.customMessage( element.name, method ), |
| 558 | + this.customMetaMessage( element, method ), |
| 559 | + // title is never undefined, so handle empty string as undefined |
| 560 | + !this.settings.ignoreTitle && element.title || undefined, |
| 561 | + $.validator.messages[method], |
| 562 | + "<strong>Warning: No message defined for " + element.name + "</strong>" |
| 563 | + ); |
| 564 | + }, |
| 565 | + |
| 566 | + formatAndAdd: function( element, rule ) { |
| 567 | + var message = this.defaultMessage( element, rule.method ), |
| 568 | + theregex = /\$?\{(\d+)\}/g; |
| 569 | + if ( typeof message == "function" ) { |
| 570 | + message = message.call(this, rule.parameters, element); |
| 571 | + } else if (theregex.test(message)) { |
| 572 | + message = jQuery.format(message.replace(theregex, '{$1}'), rule.parameters); |
| 573 | + } |
| 574 | + this.errorList.push({ |
| 575 | + message: message, |
| 576 | + element: element |
| 577 | + }); |
| 578 | + |
| 579 | + this.errorMap[element.name] = message; |
| 580 | + this.submitted[element.name] = message; |
| 581 | + }, |
| 582 | + |
| 583 | + addWrapper: function(toToggle) { |
| 584 | + if ( this.settings.wrapper ) |
| 585 | + toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) ); |
| 586 | + return toToggle; |
| 587 | + }, |
| 588 | + |
| 589 | + defaultShowErrors: function() { |
| 590 | + for ( var i = 0; this.errorList[i]; i++ ) { |
| 591 | + var error = this.errorList[i]; |
| 592 | + this.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass ); |
| 593 | + this.showLabel( error.element, error.message ); |
| 594 | + } |
| 595 | + if( this.errorList.length ) { |
| 596 | + this.toShow = this.toShow.add( this.containers ); |
| 597 | + } |
| 598 | + if (this.settings.success) { |
| 599 | + for ( var i = 0; this.successList[i]; i++ ) { |
| 600 | + this.showLabel( this.successList[i] ); |
| 601 | + } |
| 602 | + } |
| 603 | + if (this.settings.unhighlight) { |
| 604 | + for ( var i = 0, elements = this.validElements(); elements[i]; i++ ) { |
| 605 | + this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass ); |
| 606 | + } |
| 607 | + } |
| 608 | + this.toHide = this.toHide.not( this.toShow ); |
| 609 | + this.hideErrors(); |
| 610 | + this.addWrapper( this.toShow ).show(); |
| 611 | + }, |
| 612 | + |
| 613 | + validElements: function() { |
| 614 | + return this.currentElements.not(this.invalidElements()); |
| 615 | + }, |
| 616 | + |
| 617 | + invalidElements: function() { |
| 618 | + return $(this.errorList).map(function() { |
| 619 | + return this.element; |
| 620 | + }); |
| 621 | + }, |
| 622 | + |
| 623 | + showLabel: function(element, message) { |
| 624 | + var label = this.errorsFor( element ); |
| 625 | + if ( label.length ) { |
| 626 | + // refresh error/success class |
| 627 | + label.removeClass().addClass( this.settings.errorClass ); |
| 628 | + |
| 629 | + // check if we have a generated label, replace the message then |
| 630 | + label.attr("generated") && label.html(message); |
| 631 | + } else { |
| 632 | + // create label |
| 633 | + label = $("<" + this.settings.errorElement + "/>") |
| 634 | + .attr({"for": this.idOrName(element), generated: true}) |
| 635 | + .addClass(this.settings.errorClass) |
| 636 | + .html(message || ""); |
| 637 | + if ( this.settings.wrapper ) { |
| 638 | + // make sure the element is visible, even in IE |
| 639 | + // actually showing the wrapped element is handled elsewhere |
| 640 | + label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent(); |
| 641 | + } |
| 642 | + if ( !this.labelContainer.append(label).length ) |
| 643 | + this.settings.errorPlacement |
| 644 | + ? this.settings.errorPlacement(label, $(element) ) |
| 645 | + : label.insertAfter(element); |
| 646 | + } |
| 647 | + if ( !message && this.settings.success ) { |
| 648 | + label.text(""); |
| 649 | + typeof this.settings.success == "string" |
| 650 | + ? label.addClass( this.settings.success ) |
| 651 | + : this.settings.success( label ); |
| 652 | + } |
| 653 | + this.toShow = this.toShow.add(label); |
| 654 | + }, |
| 655 | + |
| 656 | + errorsFor: function(element) { |
| 657 | + var name = this.idOrName(element); |
| 658 | + return this.errors().filter(function() { |
| 659 | + return $(this).attr('for') == name; |
| 660 | + }); |
| 661 | + }, |
| 662 | + |
| 663 | + idOrName: function(element) { |
| 664 | + return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name); |
| 665 | + }, |
| 666 | + |
| 667 | + checkable: function( element ) { |
| 668 | + return /radio|checkbox/i.test(element.type); |
| 669 | + }, |
| 670 | + |
| 671 | + findByName: function( name ) { |
| 672 | + // select by name and filter by form for performance over form.find("[name=...]") |
| 673 | + var form = this.currentForm; |
| 674 | + return $(document.getElementsByName(name)).map(function(index, element) { |
| 675 | + return element.form == form && element.name == name && element || null; |
| 676 | + }); |
| 677 | + }, |
| 678 | + |
| 679 | + getLength: function(value, element) { |
| 680 | + switch( element.nodeName.toLowerCase() ) { |
| 681 | + case 'select': |
| 682 | + return $("option:selected", element).length; |
| 683 | + case 'input': |
| 684 | + if( this.checkable( element) ) |
| 685 | + return this.findByName(element.name).filter(':checked').length; |
| 686 | + } |
| 687 | + return value.length; |
| 688 | + }, |
| 689 | + |
| 690 | + depend: function(param, element) { |
| 691 | + return this.dependTypes[typeof param] |
| 692 | + ? this.dependTypes[typeof param](param, element) |
| 693 | + : true; |
| 694 | + }, |
| 695 | + |
| 696 | + dependTypes: { |
| 697 | + "boolean": function(param, element) { |
| 698 | + return param; |
| 699 | + }, |
| 700 | + "string": function(param, element) { |
| 701 | + return !!$(param, element.form).length; |
| 702 | + }, |
| 703 | + "function": function(param, element) { |
| 704 | + return param(element); |
| 705 | + } |
| 706 | + }, |
| 707 | + |
| 708 | + optional: function(element) { |
| 709 | + return !$.validator.methods.required.call(this, $.trim(element.value), element) && "dependency-mismatch"; |
| 710 | + }, |
| 711 | + |
| 712 | + startRequest: function(element) { |
| 713 | + if (!this.pending[element.name]) { |
| 714 | + this.pendingRequest++; |
| 715 | + this.pending[element.name] = true; |
| 716 | + } |
| 717 | + }, |
| 718 | + |
| 719 | + stopRequest: function(element, valid) { |
| 720 | + this.pendingRequest--; |
| 721 | + // sometimes synchronization fails, make sure pendingRequest is never < 0 |
| 722 | + if (this.pendingRequest < 0) |
| 723 | + this.pendingRequest = 0; |
| 724 | + delete this.pending[element.name]; |
| 725 | + if ( valid && this.pendingRequest == 0 && this.formSubmitted && this.form() ) { |
| 726 | + $(this.currentForm).submit(); |
| 727 | + this.formSubmitted = false; |
| 728 | + } else if (!valid && this.pendingRequest == 0 && this.formSubmitted) { |
| 729 | + $(this.currentForm).triggerHandler("invalid-form", [this]); |
| 730 | + this.formSubmitted = false; |
| 731 | + } |
| 732 | + }, |
| 733 | + |
| 734 | + previousValue: function(element) { |
| 735 | + return $.data(element, "previousValue") || $.data(element, "previousValue", { |
| 736 | + old: null, |
| 737 | + valid: true, |
| 738 | + message: this.defaultMessage( element, "remote" ) |
| 739 | + }); |
| 740 | + } |
| 741 | + |
| 742 | + }, |
| 743 | + |
| 744 | + classRuleSettings: { |
| 745 | + required: {required: true}, |
| 746 | + email: {email: true}, |
| 747 | + url: {url: true}, |
| 748 | + date: {date: true}, |
| 749 | + dateISO: {dateISO: true}, |
| 750 | + dateDE: {dateDE: true}, |
| 751 | + number: {number: true}, |
| 752 | + numberDE: {numberDE: true}, |
| 753 | + digits: {digits: true}, |
| 754 | + creditcard: {creditcard: true} |
| 755 | + }, |
| 756 | + |
| 757 | + addClassRules: function(className, rules) { |
| 758 | + className.constructor == String ? |
| 759 | + this.classRuleSettings[className] = rules : |
| 760 | + $.extend(this.classRuleSettings, className); |
| 761 | + }, |
| 762 | + |
| 763 | + classRules: function(element) { |
| 764 | + var rules = {}; |
| 765 | + var classes = $(element).attr('class'); |
| 766 | + classes && $.each(classes.split(' '), function() { |
| 767 | + if (this in $.validator.classRuleSettings) { |
| 768 | + $.extend(rules, $.validator.classRuleSettings[this]); |
| 769 | + } |
| 770 | + }); |
| 771 | + return rules; |
| 772 | + }, |
| 773 | + |
| 774 | + attributeRules: function(element) { |
| 775 | + var rules = {}; |
| 776 | + var $element = $(element); |
| 777 | + |
| 778 | + for (method in $.validator.methods) { |
| 779 | + var value = $element.attr(method); |
| 780 | + if (value) { |
| 781 | + rules[method] = value; |
| 782 | + } |
| 783 | + } |
| 784 | + |
| 785 | + // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs |
| 786 | + if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) { |
| 787 | + delete rules.maxlength; |
| 788 | + } |
| 789 | + |
| 790 | + return rules; |
| 791 | + }, |
| 792 | + |
| 793 | + metadataRules: function(element) { |
| 794 | + if (!$.metadata) return {}; |
| 795 | + |
| 796 | + var meta = $.data(element.form, 'validator').settings.meta; |
| 797 | + return meta ? |
| 798 | + $(element).metadata()[meta] : |
| 799 | + $(element).metadata(); |
| 800 | + }, |
| 801 | + |
| 802 | + staticRules: function(element) { |
| 803 | + var rules = {}; |
| 804 | + var validator = $.data(element.form, 'validator'); |
| 805 | + if (validator.settings.rules) { |
| 806 | + rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {}; |
| 807 | + } |
| 808 | + return rules; |
| 809 | + }, |
| 810 | + |
| 811 | + normalizeRules: function(rules, element) { |
| 812 | + // handle dependency check |
| 813 | + $.each(rules, function(prop, val) { |
| 814 | + // ignore rule when param is explicitly false, eg. required:false |
| 815 | + if (val === false) { |
| 816 | + delete rules[prop]; |
| 817 | + return; |
| 818 | + } |
| 819 | + if (val.param || val.depends) { |
| 820 | + var keepRule = true; |
| 821 | + switch (typeof val.depends) { |
| 822 | + case "string": |
| 823 | + keepRule = !!$(val.depends, element.form).length; |
| 824 | + break; |
| 825 | + case "function": |
| 826 | + keepRule = val.depends.call(element, element); |
| 827 | + break; |
| 828 | + } |
| 829 | + if (keepRule) { |
| 830 | + rules[prop] = val.param !== undefined ? val.param : true; |
| 831 | + } else { |
| 832 | + delete rules[prop]; |
| 833 | + } |
| 834 | + } |
| 835 | + }); |
| 836 | + |
| 837 | + // evaluate parameters |
| 838 | + $.each(rules, function(rule, parameter) { |
| 839 | + rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter; |
| 840 | + }); |
| 841 | + |
| 842 | + // clean number parameters |
| 843 | + $.each(['minlength', 'maxlength', 'min', 'max'], function() { |
| 844 | + if (rules[this]) { |
| 845 | + rules[this] = Number(rules[this]); |
| 846 | + } |
| 847 | + }); |
| 848 | + $.each(['rangelength', 'range'], function() { |
| 849 | + if (rules[this]) { |
| 850 | + rules[this] = [Number(rules[this][0]), Number(rules[this][1])]; |
| 851 | + } |
| 852 | + }); |
| 853 | + |
| 854 | + if ($.validator.autoCreateRanges) { |
| 855 | + // auto-create ranges |
| 856 | + if (rules.min && rules.max) { |
| 857 | + rules.range = [rules.min, rules.max]; |
| 858 | + delete rules.min; |
| 859 | + delete rules.max; |
| 860 | + } |
| 861 | + if (rules.minlength && rules.maxlength) { |
| 862 | + rules.rangelength = [rules.minlength, rules.maxlength]; |
| 863 | + delete rules.minlength; |
| 864 | + delete rules.maxlength; |
| 865 | + } |
| 866 | + } |
| 867 | + |
| 868 | + // To support custom messages in metadata ignore rule methods titled "messages" |
| 869 | + if (rules.messages) { |
| 870 | + delete rules.messages; |
| 871 | + } |
| 872 | + |
| 873 | + return rules; |
| 874 | + }, |
| 875 | + |
| 876 | + // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true} |
| 877 | + normalizeRule: function(data) { |
| 878 | + if( typeof data == "string" ) { |
| 879 | + var transformed = {}; |
| 880 | + $.each(data.split(/\s/), function() { |
| 881 | + transformed[this] = true; |
| 882 | + }); |
| 883 | + data = transformed; |
| 884 | + } |
| 885 | + return data; |
| 886 | + }, |
| 887 | + |
| 888 | + // http://docs.jquery.com/Plugins/Validation/Validator/addMethod |
| 889 | + addMethod: function(name, method, message) { |
| 890 | + $.validator.methods[name] = method; |
| 891 | + $.validator.messages[name] = message != undefined ? message : $.validator.messages[name]; |
| 892 | + if (method.length < 3) { |
| 893 | + $.validator.addClassRules(name, $.validator.normalizeRule(name)); |
| 894 | + } |
| 895 | + }, |
| 896 | + |
| 897 | + methods: { |
| 898 | + |
| 899 | + // http://docs.jquery.com/Plugins/Validation/Methods/required |
| 900 | + required: function(value, element, param) { |
| 901 | + // check if dependency is met |
| 902 | + if ( !this.depend(param, element) ) |
| 903 | + return "dependency-mismatch"; |
| 904 | + switch( element.nodeName.toLowerCase() ) { |
| 905 | + case 'select': |
| 906 | + // could be an array for select-multiple or a string, both are fine this way |
| 907 | + var val = $(element).val(); |
| 908 | + return val && val.length > 0; |
| 909 | + case 'input': |
| 910 | + if ( this.checkable(element) ) |
| 911 | + return this.getLength(value, element) > 0; |
| 912 | + default: |
| 913 | + return $.trim(value).length > 0; |
| 914 | + } |
| 915 | + }, |
| 916 | + |
| 917 | + // http://docs.jquery.com/Plugins/Validation/Methods/remote |
| 918 | + remote: function(value, element, param) { |
| 919 | + if ( this.optional(element) ) |
| 920 | + return "dependency-mismatch"; |
| 921 | + |
| 922 | + var previous = this.previousValue(element); |
| 923 | + if (!this.settings.messages[element.name] ) |
| 924 | + this.settings.messages[element.name] = {}; |
| 925 | + previous.originalMessage = this.settings.messages[element.name].remote; |
| 926 | + this.settings.messages[element.name].remote = previous.message; |
| 927 | + |
| 928 | + param = typeof param == "string" && {url:param} || param; |
| 929 | + |
| 930 | + if ( previous.old !== value ) { |
| 931 | + previous.old = value; |
| 932 | + var validator = this; |
| 933 | + this.startRequest(element); |
| 934 | + var data = {}; |
| 935 | + data[element.name] = value; |
| 936 | + $.ajax($.extend(true, { |
| 937 | + url: param, |
| 938 | + mode: "abort", |
| 939 | + port: "validate" + element.name, |
| 940 | + dataType: "json", |
| 941 | + data: data, |
| 942 | + success: function(response) { |
| 943 | + validator.settings.messages[element.name].remote = previous.originalMessage; |
| 944 | + var valid = response === true; |
| 945 | + if ( valid ) { |
| 946 | + var submitted = validator.formSubmitted; |
| 947 | + validator.prepareElement(element); |
| 948 | + validator.formSubmitted = submitted; |
| 949 | + validator.successList.push(element); |
| 950 | + validator.showErrors(); |
| 951 | + } else { |
| 952 | + var errors = {}; |
| 953 | + var message = (previous.message = response || validator.defaultMessage( element, "remote" )); |
| 954 | + errors[element.name] = $.isFunction(message) ? message(value) : message; |
| 955 | + validator.showErrors(errors); |
| 956 | + } |
| 957 | + previous.valid = valid; |
| 958 | + validator.stopRequest(element, valid); |
| 959 | + } |
| 960 | + }, param)); |
| 961 | + return "pending"; |
| 962 | + } else if( this.pending[element.name] ) { |
| 963 | + return "pending"; |
| 964 | + } |
| 965 | + return previous.valid; |
| 966 | + }, |
| 967 | + |
| 968 | + // http://docs.jquery.com/Plugins/Validation/Methods/minlength |
| 969 | + minlength: function(value, element, param) { |
| 970 | + return this.optional(element) || this.getLength($.trim(value), element) >= param; |
| 971 | + }, |
| 972 | + |
| 973 | + // http://docs.jquery.com/Plugins/Validation/Methods/maxlength |
| 974 | + maxlength: function(value, element, param) { |
| 975 | + return this.optional(element) || this.getLength($.trim(value), element) <= param; |
| 976 | + }, |
| 977 | + |
| 978 | + // http://docs.jquery.com/Plugins/Validation/Methods/rangelength |
| 979 | + rangelength: function(value, element, param) { |
| 980 | + var length = this.getLength($.trim(value), element); |
| 981 | + return this.optional(element) || ( length >= param[0] && length <= param[1] ); |
| 982 | + }, |
| 983 | + |
| 984 | + // http://docs.jquery.com/Plugins/Validation/Methods/min |
| 985 | + min: function( value, element, param ) { |
| 986 | + return this.optional(element) || value >= param; |
| 987 | + }, |
| 988 | + |
| 989 | + // http://docs.jquery.com/Plugins/Validation/Methods/max |
| 990 | + max: function( value, element, param ) { |
| 991 | + return this.optional(element) || value <= param; |
| 992 | + }, |
| 993 | + |
| 994 | + // http://docs.jquery.com/Plugins/Validation/Methods/range |
| 995 | + range: function( value, element, param ) { |
| 996 | + return this.optional(element) || ( value >= param[0] && value <= param[1] ); |
| 997 | + }, |
| 998 | + |
| 999 | + // http://docs.jquery.com/Plugins/Validation/Methods/email |
| 1000 | + email: function(value, element) { |
| 1001 | + // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ |
| 1002 | + return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value); |
| 1003 | + }, |
| 1004 | + |
| 1005 | + // http://docs.jquery.com/Plugins/Validation/Methods/url |
| 1006 | + url: function(value, element) { |
| 1007 | + // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/ |
| 1008 | + return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); |
| 1009 | + }, |
| 1010 | + |
| 1011 | + // http://docs.jquery.com/Plugins/Validation/Methods/date |
| 1012 | + date: function(value, element) { |
| 1013 | + return this.optional(element) || !/Invalid|NaN/.test(new Date(value)); |
| 1014 | + }, |
| 1015 | + |
| 1016 | + // http://docs.jquery.com/Plugins/Validation/Methods/dateISO |
| 1017 | + dateISO: function(value, element) { |
| 1018 | + return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value); |
| 1019 | + }, |
| 1020 | + |
| 1021 | + // http://docs.jquery.com/Plugins/Validation/Methods/number |
| 1022 | + number: function(value, element) { |
| 1023 | + return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value); |
| 1024 | + }, |
| 1025 | + |
| 1026 | + // http://docs.jquery.com/Plugins/Validation/Methods/digits |
| 1027 | + digits: function(value, element) { |
| 1028 | + return this.optional(element) || /^\d+$/.test(value); |
| 1029 | + }, |
| 1030 | + |
| 1031 | + // http://docs.jquery.com/Plugins/Validation/Methods/creditcard |
| 1032 | + // based on http://en.wikipedia.org/wiki/Luhn |
| 1033 | + creditcard: function(value, element) { |
| 1034 | + if ( this.optional(element) ) |
| 1035 | + return "dependency-mismatch"; |
| 1036 | + // accept only digits and dashes |
| 1037 | + if (/[^0-9-]+/.test(value)) |
| 1038 | + return false; |
| 1039 | + var nCheck = 0, |
| 1040 | + nDigit = 0, |
| 1041 | + bEven = false; |
| 1042 | + |
| 1043 | + value = value.replace(/\D/g, ""); |
| 1044 | + |
| 1045 | + for (var n = value.length - 1; n >= 0; n--) { |
| 1046 | + var cDigit = value.charAt(n); |
| 1047 | + var nDigit = parseInt(cDigit, 10); |
| 1048 | + if (bEven) { |
| 1049 | + if ((nDigit *= 2) > 9) |
| 1050 | + nDigit -= 9; |
| 1051 | + } |
| 1052 | + nCheck += nDigit; |
| 1053 | + bEven = !bEven; |
| 1054 | + } |
| 1055 | + |
| 1056 | + return (nCheck % 10) == 0; |
| 1057 | + }, |
| 1058 | + |
| 1059 | + // http://docs.jquery.com/Plugins/Validation/Methods/accept |
| 1060 | + accept: function(value, element, param) { |
| 1061 | + param = typeof param == "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif"; |
| 1062 | + return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i")); |
| 1063 | + }, |
| 1064 | + |
| 1065 | + // http://docs.jquery.com/Plugins/Validation/Methods/equalTo |
| 1066 | + equalTo: function(value, element, param) { |
| 1067 | + // bind to the blur event of the target in order to revalidate whenever the target field is updated |
| 1068 | + // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead |
| 1069 | + var target = $(param).unbind(".validate-equalTo").bind("blur.validate-equalTo", function() { |
| 1070 | + $(element).valid(); |
| 1071 | + }); |
| 1072 | + return value == target.val(); |
| 1073 | + } |
| 1074 | + |
| 1075 | + } |
| 1076 | + |
| 1077 | +}); |
| 1078 | + |
| 1079 | +// deprecated, use $.validator.format instead |
| 1080 | +$.format = $.validator.format; |
| 1081 | + |
| 1082 | +})(jQuery); |
| 1083 | + |
| 1084 | +// ajax mode: abort |
| 1085 | +// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); |
| 1086 | +// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() |
| 1087 | +;(function($) { |
| 1088 | + var ajax = $.ajax; |
| 1089 | + var pendingRequests = {}; |
| 1090 | + $.ajax = function(settings) { |
| 1091 | + // create settings for compatibility with ajaxSetup |
| 1092 | + settings = $.extend(settings, $.extend({}, $.ajaxSettings, settings)); |
| 1093 | + var port = settings.port; |
| 1094 | + if (settings.mode == "abort") { |
| 1095 | + if ( pendingRequests[port] ) { |
| 1096 | + pendingRequests[port].abort(); |
| 1097 | + } |
| 1098 | + return (pendingRequests[port] = ajax.apply(this, arguments)); |
| 1099 | + } |
| 1100 | + return ajax.apply(this, arguments); |
| 1101 | + }; |
| 1102 | +})(jQuery); |
| 1103 | + |
| 1104 | +// provides cross-browser focusin and focusout events |
| 1105 | +// IE has native support, in other browsers, use event caputuring (neither bubbles) |
| 1106 | + |
| 1107 | +// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation |
| 1108 | +// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target |
| 1109 | +;(function($) { |
| 1110 | + // only implement if not provided by jQuery core (since 1.4) |
| 1111 | + // TODO verify if jQuery 1.4's implementation is compatible with older jQuery special-event APIs |
| 1112 | + if (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) { |
| 1113 | + $.each({ |
| 1114 | + focus: 'focusin', |
| 1115 | + blur: 'focusout' |
| 1116 | + }, function( original, fix ){ |
| 1117 | + $.event.special[fix] = { |
| 1118 | + setup:function() { |
| 1119 | + this.addEventListener( original, handler, true ); |
| 1120 | + }, |
| 1121 | + teardown:function() { |
| 1122 | + this.removeEventListener( original, handler, true ); |
| 1123 | + }, |
| 1124 | + handler: function(e) { |
| 1125 | + arguments[0] = $.event.fix(e); |
| 1126 | + arguments[0].type = fix; |
| 1127 | + return $.event.handle.apply(this, arguments); |
| 1128 | + } |
| 1129 | + }; |
| 1130 | + function handler(e) { |
| 1131 | + e = $.event.fix(e); |
| 1132 | + e.type = fix; |
| 1133 | + return $.event.handle.call(this, e); |
| 1134 | + } |
| 1135 | + }); |
| 1136 | + }; |
| 1137 | + $.extend($.fn, { |
| 1138 | + validateDelegate: function(delegate, type, handler) { |
| 1139 | + return this.bind(type, function(event) { |
| 1140 | + var target = $(event.target); |
| 1141 | + if (target.is(delegate)) { |
| 1142 | + return handler.apply(target, arguments); |
| 1143 | + } |
| 1144 | + }); |
| 1145 | + } |
| 1146 | + }); |
| 1147 | +})(jQuery); |
Property changes on: trunk/extensions/Storyboard/jquery/jquery.validate.js |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 1148 | + native |
Index: trunk/extensions/Storyboard/jquery/jquery.validate.min.js |
— | — | @@ -0,0 +1,16 @@ |
| 2 | +/* |
| 3 | + * jQuery validation plug-in 1.7 |
| 4 | + * |
| 5 | + * http://bassistance.de/jquery-plugins/jquery-plugin-validation/ |
| 6 | + * http://docs.jquery.com/Plugins/Validation |
| 7 | + * |
| 8 | + * Copyright (c) 2006 - 2008 Jörn Zaefferer |
| 9 | + * |
| 10 | + * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $ |
| 11 | + * |
| 12 | + * Dual licensed under the MIT and GPL licenses: |
| 13 | + * http://www.opensource.org/licenses/mit-license.php |
| 14 | + * http://www.gnu.org/licenses/gpl.html |
| 15 | + */ |
| 16 | +(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(""+a.value);},filled:function(a){return!!$.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&¶ms.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);else if(element.parentNode.name in this.submitted)this.element(element.parentNode);},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,"");validator.settings[eventType]&&validator.settings[eventType].call(validator,this[0]);}$(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",delegate).validateDelegate(":radio, :checkbox, select, option","click",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id |
| 17 | ++", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)return arguments[i];}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=jQuery.format(message.replace(theregex,'{$1}'),rule.parameters);}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr('for')==name;});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages;}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var val=$(element).val();return val&&val.length>0;case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){if(!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){this.addEventListener(original,handler,true);},teardown:function(){this.removeEventListener(original,handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};function handler(e){e=$.event.fix(e);e.type=fix;return $.event.handle.call(this,e);}});};$.extend($.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});}});})(jQuery); |
\ No newline at end of file |
Property changes on: trunk/extensions/Storyboard/jquery/jquery.validate.min.js |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 18 | + native |
Index: trunk/extensions/Storyboard/jquery/jquery.ajaxscroll.js |
— | — | @@ -0,0 +1,135 @@ |
| 2 | +/** |
| 3 | + * AjaxScroll (jQuery Plugin) |
| 4 | + * Modified for MediaWiki storyboard extension. |
| 5 | + * |
| 6 | + * @author Timmy Tin - http://project.yctin.com/ajaxscroll |
| 7 | + * @author Jeroen De Dauw |
| 8 | + * @license GPL |
| 9 | + * @version 0.2 |
| 10 | + * |
| 11 | + */ |
| 12 | +(function($) { |
| 13 | + $.fn.ajaxScroll=function(opt){ |
| 14 | + opt=jQuery.extend( |
| 15 | + { |
| 16 | + batchNum:5, |
| 17 | + batchSize:30, |
| 18 | + batchTemplate:null, |
| 19 | + boxTemplate:null, |
| 20 | + batchClass:"storyboard-batch", |
| 21 | + boxClass:"storyboard-box", |
| 22 | + emptyBatchClass:"storyboard-empty", |
| 23 | + scrollPaneClass:"scrollpane", |
| 24 | + lBound:"auto", |
| 25 | + uBound:"auto", |
| 26 | + eBound:"auto", |
| 27 | + maxOffset:1000, |
| 28 | + scrollDelay:600, |
| 29 | + endDelay:100, |
| 30 | + updateBatch:null, |
| 31 | + updateEnd:null |
| 32 | + }, |
| 33 | + opt |
| 34 | + ); |
| 35 | + return this.each(function(){ |
| 36 | + var ele=this; |
| 37 | + var $me=jQuery(this); |
| 38 | + var $sp; |
| 39 | + var fnEnd,fnScroll; |
| 40 | + var offset=0; |
| 41 | + var lsp=-1;_css(); |
| 42 | + |
| 43 | + opt.boxTemplate=(opt.boxTemplate||"<span class='"+opt.boxClass+"'> </span>"); |
| 44 | + |
| 45 | + opt.batchTemplate=(opt.batchTemplate||"<span></span>"); |
| 46 | + $sp=jQuery("<div></div>").addClass(opt.scrollPaneClass); |
| 47 | + $me.append($sp); |
| 48 | + offset=batch($sp,offset,opt); |
| 49 | + $me.scrollTop(0).scrollLeft(0); |
| 50 | + _ab(); |
| 51 | + fnEnd=vEnd; |
| 52 | + fnScroll=vScroll; |
| 53 | + |
| 54 | + setTimeout(monEnd,opt.endDelay); |
| 55 | + |
| 56 | + if(typeof opt.updateBatch=='function'){ |
| 57 | + setTimeout(monScroll,opt.scrollDelay); |
| 58 | + } |
| 59 | + |
| 60 | + function _css(){ |
| 61 | + $me.css({"overflow-x":"hidden","overflow-y":"auto"}); |
| 62 | + } |
| 63 | + |
| 64 | + function _ab(){ |
| 65 | + var os,b; |
| 66 | + |
| 67 | + os=$me.find('.batch:first').next().offset().top; |
| 68 | + b=($me.height()/os+1)*os; |
| 69 | + |
| 70 | + if("auto"==opt.uBound){ |
| 71 | + opt.uBound=b; |
| 72 | + } |
| 73 | + |
| 74 | + if("auto"==opt.lBound){ |
| 75 | + opt.lBound=-b; |
| 76 | + } |
| 77 | + |
| 78 | + if("auto"==opt.eBound){ |
| 79 | + opt.eBound=b*2; |
| 80 | + } |
| 81 | + } |
| 82 | + |
| 83 | + function batch($s,o,opt){ |
| 84 | + var $b,i,rp=opt.batchNum; |
| 85 | + |
| 86 | + while(rp--){ |
| 87 | + $b=jQuery(opt.batchTemplate).attr({offset:o,len:opt.batchSize}).addClass(opt.batchClass+" "+opt.emptyBatchClass); |
| 88 | + i=opt.batchSize; |
| 89 | + while(i--&&opt.maxOffset>o++){ |
| 90 | + $b.append(opt.boxTemplate); |
| 91 | + } |
| 92 | + $s.append($b); |
| 93 | + } |
| 94 | + |
| 95 | + return o; |
| 96 | + }; |
| 97 | + |
| 98 | + function vScroll(){ |
| 99 | + var so=$me.scrollTop(); |
| 100 | + |
| 101 | + if(lsp!=so){ |
| 102 | + lsp=so; |
| 103 | + var co=$me.offset().top; |
| 104 | + |
| 105 | + $sp.find('> .'+opt.emptyBatchClass).each(function(i,obj){ |
| 106 | + var $b=jQuery(obj); |
| 107 | + var p=$b.position().top-co; |
| 108 | + if(opt.lBound>p||p>opt.uBound){return;} |
| 109 | + opt.updateBatch($b.removeClass(opt.emptyBatchClass)); |
| 110 | + }); |
| 111 | + } |
| 112 | + }; |
| 113 | + |
| 114 | + function vEnd(){ |
| 115 | + if(ele.scrollTop > 0 && ele.scrollHeight-ele.scrollTop < opt.eBound){ |
| 116 | + offset=batch($sp,offset,opt); |
| 117 | + return 1; |
| 118 | + } |
| 119 | + |
| 120 | + return opt.endDelay; |
| 121 | + }; |
| 122 | + |
| 123 | + function monScroll(){ |
| 124 | + fnScroll(); |
| 125 | + setTimeout(monScroll,opt.scrollDelay); |
| 126 | + }; |
| 127 | + |
| 128 | + function monEnd(){ |
| 129 | + if(offset < opt.maxOffset){ |
| 130 | + setTimeout(monEnd,fnEnd()); |
| 131 | + } |
| 132 | + } |
| 133 | + |
| 134 | + }); |
| 135 | + }; |
| 136 | +})(jQuery); |
Property changes on: trunk/extensions/Storyboard/jquery/jquery.ajaxscroll.js |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 137 | + native |
Index: trunk/extensions/Storyboard/jquery/jquery.ajaxscroll.min.js |
— | — | @@ -0,0 +1,15 @@ |
| 2 | + |
| 3 | +(function($){$.fn.ajaxScroll=function(opt){opt=jQuery.extend({batchNum:5,batchSize:30,horizontal:false,batchTemplate:null,boxTemplate:null,batchClass:"batch",boxClass:"box",emptyBatchClass:"empty",scrollPaneClass:"scrollpane",lBound:"auto",uBound:"auto",eBound:"auto",maxOffset:1000,scrollDelay:600,endDelay:100,updateBatch:null,updateEnd:null},opt);return this.each(function(){var ele=this;var $me=jQuery(this);var $sp;var fnEnd,fnScroll;var offset=0;var lsp=-1;_css();opt.boxTemplate=(opt.boxTemplate||"<span class='"+opt.boxClass+"'> </span>");if(opt.horizontal){opt.batchTemplate=(opt.batchTemplate||"<td></td>");$sp=jQuery("<table><tr></tr></table>").addClass(opt.scrollPaneClass);$me.append($sp);offset=batch($sp.find("tr"),offset,opt);_bz();_ab();fnEnd=hEnd;fnScroll=hScroll;}else{opt.batchTemplate=(opt.batchTemplate||"<span></span>");$sp=jQuery("<div></div>").addClass(opt.scrollPaneClass);$me.append($sp);offset=batch($sp,offset,opt);_bz();_ab();fnEnd=vEnd;fnScroll=vScroll;} |
| 4 | +setTimeout(monEnd,opt.endDelay);if(typeof opt.updateBatch=='function'){setTimeout(monScroll,opt.scrollDelay);} |
| 5 | +function _css(){if(opt.horizontal){$me.css({"overflow-x":"auto","overflow-y":"hidden"});}else{$me.css({"overflow-x":"hidden","overflow-y":"auto"});}} |
| 6 | +function _ab(){var os,b;if(opt.horizontal){os=$me.find('.batch:first').next().offset().left;b=($me.width()/os+1)*os;}else{os=$me.find('.batch:first').next().offset().top;b=($me.height()/os+1)*os;} |
| 7 | +if("auto"==opt.uBound){opt.uBound=b;} |
| 8 | +if("auto"==opt.lBound){opt.lBound=-b;} |
| 9 | +if("auto"==opt.eBound){opt.eBound=b*2;}} |
| 10 | +function _bz(){$me.scrollTop(0).scrollLeft(0);};function batch($s,o,opt){var $b,i,rp=opt.batchNum;while(rp--){$b=jQuery(opt.batchTemplate).attr({offset:o,len:opt.batchSize}).addClass(opt.batchClass+" "+opt.emptyBatchClass);i=opt.batchSize;while(i--&&opt.maxOffset>o++){$b.append(opt.boxTemplate);} |
| 11 | +$s.append($b);} |
| 12 | +return o;};function vScroll(){var so=$me.scrollTop();if(lsp!=so){lsp=so;var co=$me.offset().top;$sp.find('> .'+opt.emptyBatchClass).each(function(i,obj){var $b=jQuery(obj);var p=$b.position().top-co;if(opt.lBound>p||p>opt.uBound){return;} |
| 13 | +opt.updateBatch($b.removeClass(opt.emptyBatchClass));});}};function hScroll(){var so=$me.scrollLeft();if(lsp!=so){lsp=so;var co=$me.offset().left;$sp.find('tr > .'+opt.emptyBatchClass).each(function(i,obj){var $b=jQuery(obj);var p=$b.position().left-co;if(opt.lBound>p||p>opt.uBound){return;} |
| 14 | +opt.updateBatch($b.removeClass(opt.emptyBatchClass));});}};function vEnd(){if(ele.scrollTop>0&&ele.scrollHeight-ele.scrollTop<opt.eBound){offset=batch($sp,offset,opt);return 1;} |
| 15 | +return opt.endDelay;};function hEnd(){if(ele.scrollLeft>0&&ele.scrollWidth-ele.scrollLeft<opt.eBound){offset=batch($sp.find("tr:first"),offset,opt);return 1;} |
| 16 | +return opt.endDelay;};function monScroll(){fnScroll();setTimeout(monScroll,opt.scrollDelay);};function monEnd(){if(offset<opt.maxOffset){setTimeout(monEnd,fnEnd());}}});};})(jQuery); |
\ No newline at end of file |
Property changes on: trunk/extensions/Storyboard/jquery/jquery.ajaxscroll.min.js |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 17 | + native |
Index: trunk/extensions/Storyboard/tags/Storyboard/jquery.ajaxscroll.js |
— | — | @@ -1,135 +0,0 @@ |
2 | | -/** |
3 | | - * AjaxScroll (jQuery Plugin) |
4 | | - * Modified for MediaWiki storyboard extension. |
5 | | - * |
6 | | - * @author Timmy Tin - http://project.yctin.com/ajaxscroll |
7 | | - * @author Jeroen De Dauw |
8 | | - * @license GPL |
9 | | - * @version 0.2 |
10 | | - * |
11 | | - */ |
12 | | -(function($) { |
13 | | - $.fn.ajaxScroll=function(opt){ |
14 | | - opt=jQuery.extend( |
15 | | - { |
16 | | - batchNum:5, |
17 | | - batchSize:30, |
18 | | - batchTemplate:null, |
19 | | - boxTemplate:null, |
20 | | - batchClass:"storyboard-batch", |
21 | | - boxClass:"storyboard-box", |
22 | | - emptyBatchClass:"storyboard-empty", |
23 | | - scrollPaneClass:"scrollpane", |
24 | | - lBound:"auto", |
25 | | - uBound:"auto", |
26 | | - eBound:"auto", |
27 | | - maxOffset:1000, |
28 | | - scrollDelay:600, |
29 | | - endDelay:100, |
30 | | - updateBatch:null, |
31 | | - updateEnd:null |
32 | | - }, |
33 | | - opt |
34 | | - ); |
35 | | - return this.each(function(){ |
36 | | - var ele=this; |
37 | | - var $me=jQuery(this); |
38 | | - var $sp; |
39 | | - var fnEnd,fnScroll; |
40 | | - var offset=0; |
41 | | - var lsp=-1;_css(); |
42 | | - |
43 | | - opt.boxTemplate=(opt.boxTemplate||"<span class='"+opt.boxClass+"'> </span>"); |
44 | | - |
45 | | - opt.batchTemplate=(opt.batchTemplate||"<span></span>"); |
46 | | - $sp=jQuery("<div></div>").addClass(opt.scrollPaneClass); |
47 | | - $me.append($sp); |
48 | | - offset=batch($sp,offset,opt); |
49 | | - $me.scrollTop(0).scrollLeft(0); |
50 | | - _ab(); |
51 | | - fnEnd=vEnd; |
52 | | - fnScroll=vScroll; |
53 | | - |
54 | | - setTimeout(monEnd,opt.endDelay); |
55 | | - |
56 | | - if(typeof opt.updateBatch=='function'){ |
57 | | - setTimeout(monScroll,opt.scrollDelay); |
58 | | - } |
59 | | - |
60 | | - function _css(){ |
61 | | - $me.css({"overflow-x":"hidden","overflow-y":"auto"}); |
62 | | - } |
63 | | - |
64 | | - function _ab(){ |
65 | | - var os,b; |
66 | | - |
67 | | - os=$me.find('.batch:first').next().offset().top; |
68 | | - b=($me.height()/os+1)*os; |
69 | | - |
70 | | - if("auto"==opt.uBound){ |
71 | | - opt.uBound=b; |
72 | | - } |
73 | | - |
74 | | - if("auto"==opt.lBound){ |
75 | | - opt.lBound=-b; |
76 | | - } |
77 | | - |
78 | | - if("auto"==opt.eBound){ |
79 | | - opt.eBound=b*2; |
80 | | - } |
81 | | - } |
82 | | - |
83 | | - function batch($s,o,opt){ |
84 | | - var $b,i,rp=opt.batchNum; |
85 | | - |
86 | | - while(rp--){ |
87 | | - $b=jQuery(opt.batchTemplate).attr({offset:o,len:opt.batchSize}).addClass(opt.batchClass+" "+opt.emptyBatchClass); |
88 | | - i=opt.batchSize; |
89 | | - while(i--&&opt.maxOffset>o++){ |
90 | | - $b.append(opt.boxTemplate); |
91 | | - } |
92 | | - $s.append($b); |
93 | | - } |
94 | | - |
95 | | - return o; |
96 | | - }; |
97 | | - |
98 | | - function vScroll(){ |
99 | | - var so=$me.scrollTop(); |
100 | | - |
101 | | - if(lsp!=so){ |
102 | | - lsp=so; |
103 | | - var co=$me.offset().top; |
104 | | - |
105 | | - $sp.find('> .'+opt.emptyBatchClass).each(function(i,obj){ |
106 | | - var $b=jQuery(obj); |
107 | | - var p=$b.position().top-co; |
108 | | - if(opt.lBound>p||p>opt.uBound){return;} |
109 | | - opt.updateBatch($b.removeClass(opt.emptyBatchClass)); |
110 | | - }); |
111 | | - } |
112 | | - }; |
113 | | - |
114 | | - function vEnd(){ |
115 | | - if(ele.scrollTop > 0 && ele.scrollHeight-ele.scrollTop < opt.eBound){ |
116 | | - offset=batch($sp,offset,opt); |
117 | | - return 1; |
118 | | - } |
119 | | - |
120 | | - return opt.endDelay; |
121 | | - }; |
122 | | - |
123 | | - function monScroll(){ |
124 | | - fnScroll(); |
125 | | - setTimeout(monScroll,opt.scrollDelay); |
126 | | - }; |
127 | | - |
128 | | - function monEnd(){ |
129 | | - if(offset < opt.maxOffset){ |
130 | | - setTimeout(monEnd,fnEnd()); |
131 | | - } |
132 | | - } |
133 | | - |
134 | | - }); |
135 | | - }; |
136 | | -})(jQuery); |
Index: trunk/extensions/Storyboard/tags/Storyboard/jquery.ajaxscroll.min.js |
— | — | @@ -1,15 +0,0 @@ |
2 | | - |
3 | | -(function($){$.fn.ajaxScroll=function(opt){opt=jQuery.extend({batchNum:5,batchSize:30,horizontal:false,batchTemplate:null,boxTemplate:null,batchClass:"batch",boxClass:"box",emptyBatchClass:"empty",scrollPaneClass:"scrollpane",lBound:"auto",uBound:"auto",eBound:"auto",maxOffset:1000,scrollDelay:600,endDelay:100,updateBatch:null,updateEnd:null},opt);return this.each(function(){var ele=this;var $me=jQuery(this);var $sp;var fnEnd,fnScroll;var offset=0;var lsp=-1;_css();opt.boxTemplate=(opt.boxTemplate||"<span class='"+opt.boxClass+"'> </span>");if(opt.horizontal){opt.batchTemplate=(opt.batchTemplate||"<td></td>");$sp=jQuery("<table><tr></tr></table>").addClass(opt.scrollPaneClass);$me.append($sp);offset=batch($sp.find("tr"),offset,opt);_bz();_ab();fnEnd=hEnd;fnScroll=hScroll;}else{opt.batchTemplate=(opt.batchTemplate||"<span></span>");$sp=jQuery("<div></div>").addClass(opt.scrollPaneClass);$me.append($sp);offset=batch($sp,offset,opt);_bz();_ab();fnEnd=vEnd;fnScroll=vScroll;} |
4 | | -setTimeout(monEnd,opt.endDelay);if(typeof opt.updateBatch=='function'){setTimeout(monScroll,opt.scrollDelay);} |
5 | | -function _css(){if(opt.horizontal){$me.css({"overflow-x":"auto","overflow-y":"hidden"});}else{$me.css({"overflow-x":"hidden","overflow-y":"auto"});}} |
6 | | -function _ab(){var os,b;if(opt.horizontal){os=$me.find('.batch:first').next().offset().left;b=($me.width()/os+1)*os;}else{os=$me.find('.batch:first').next().offset().top;b=($me.height()/os+1)*os;} |
7 | | -if("auto"==opt.uBound){opt.uBound=b;} |
8 | | -if("auto"==opt.lBound){opt.lBound=-b;} |
9 | | -if("auto"==opt.eBound){opt.eBound=b*2;}} |
10 | | -function _bz(){$me.scrollTop(0).scrollLeft(0);};function batch($s,o,opt){var $b,i,rp=opt.batchNum;while(rp--){$b=jQuery(opt.batchTemplate).attr({offset:o,len:opt.batchSize}).addClass(opt.batchClass+" "+opt.emptyBatchClass);i=opt.batchSize;while(i--&&opt.maxOffset>o++){$b.append(opt.boxTemplate);} |
11 | | -$s.append($b);} |
12 | | -return o;};function vScroll(){var so=$me.scrollTop();if(lsp!=so){lsp=so;var co=$me.offset().top;$sp.find('> .'+opt.emptyBatchClass).each(function(i,obj){var $b=jQuery(obj);var p=$b.position().top-co;if(opt.lBound>p||p>opt.uBound){return;} |
13 | | -opt.updateBatch($b.removeClass(opt.emptyBatchClass));});}};function hScroll(){var so=$me.scrollLeft();if(lsp!=so){lsp=so;var co=$me.offset().left;$sp.find('tr > .'+opt.emptyBatchClass).each(function(i,obj){var $b=jQuery(obj);var p=$b.position().left-co;if(opt.lBound>p||p>opt.uBound){return;} |
14 | | -opt.updateBatch($b.removeClass(opt.emptyBatchClass));});}};function vEnd(){if(ele.scrollTop>0&&ele.scrollHeight-ele.scrollTop<opt.eBound){offset=batch($sp,offset,opt);return 1;} |
15 | | -return opt.endDelay;};function hEnd(){if(ele.scrollLeft>0&&ele.scrollWidth-ele.scrollLeft<opt.eBound){offset=batch($sp.find("tr:first"),offset,opt);return 1;} |
16 | | -return opt.endDelay;};function monScroll(){fnScroll();setTimeout(monScroll,opt.scrollDelay);};function monEnd(){if(offset<opt.maxOffset){setTimeout(monEnd,fnEnd());}}});};})(jQuery); |
\ No newline at end of file |
Index: trunk/extensions/Storyboard/tags/Storyboard/storyboard.js |
— | — | @@ -15,6 +15,7 @@ |
16 | 16 | } ); |
17 | 17 | |
18 | 18 | function updateStoryboard( $storyboard ) { |
| 19 | + // TODO: fix eternal load, broken when swicthing from .load to .getJSON. |
19 | 20 | $.getJSON( wgScriptPath + '/api.php', |
20 | 21 | { |
21 | 22 | 'action': 'query', |
— | — | @@ -44,7 +45,7 @@ |
45 | 46 | var $header = $( "<div />" ).addClass( "story-header" ).appendTo( $storyBody ); |
46 | 47 | $( "<div />" ).addClass( "story-title" ).text( story.title ).appendTo( $header ); |
47 | 48 | |
48 | | - // TODO: move social sharing to a pop-up that's triggered by a link above each storyboard-box |
| 49 | + // TODO: move social sharing to a jQuery UI pop-up that's triggered by a link above each storyboard-box |
49 | 50 | |
50 | 51 | $( "<div />" ) |
51 | 52 | .addClass( "story-sharing" ) |
— | — | @@ -93,7 +94,7 @@ |
94 | 95 | |
95 | 96 | $storyBody.append( textAndImg ); |
96 | 97 | |
97 | | - // TODO: add delete button that hides the story from the storyboard (=unpublish+hide?) |
| 98 | + // TODO: add hide button |
98 | 99 | |
99 | 100 | $storyboard.append( $storyBody ); |
100 | 101 | } |
Index: trunk/extensions/Storyboard/tags/Storyboard/Storyboard_body.php |
— | — | @@ -25,6 +25,8 @@ |
26 | 26 | * @param $frame |
27 | 27 | * |
28 | 28 | * @return array |
| 29 | + * |
| 30 | + * TODO: add language filter |
29 | 31 | */ |
30 | 32 | public static function render( $input, array $args, Parser $parser, $frame ) { |
31 | 33 | global $wgJsMimeType, $wgScriptPath, $wgStylePath, $wgStyleVersion, $egStoryboardScriptPath, $egStoryboardWidth, $egStoryboardHeight; |
— | — | @@ -34,7 +36,7 @@ |
35 | 37 | <<<EOT |
36 | 38 | <link rel="stylesheet" href="$egStoryboardScriptPath/storyboard.css?$wgStyleVersion" /> |
37 | 39 | <script type="$wgJsMimeType" src="$wgStylePath/common/jquery.min.js?$wgStyleVersion"></script> |
38 | | - <script type="$wgJsMimeType" src="$egStoryboardScriptPath/tags/Storyboard/jquery.ajaxscroll.js?$wgStyleVersion"></script> |
| 40 | + <script type="$wgJsMimeType" src="$egStoryboardScriptPath/jquery/jquery.ajaxscroll.js?$wgStyleVersion"></script> |
39 | 41 | <script type="$wgJsMimeType" src="$egStoryboardScriptPath/tags/Storyboard/storyboard.js?$wgStyleVersion"></script> |
40 | 42 | EOT |
41 | 43 | ); |
Index: trunk/extensions/Storyboard/tags/Storysubmission/Storysubmission_body.php |
— | — | @@ -52,6 +52,7 @@ |
53 | 53 | * @return HTML |
54 | 54 | * |
55 | 55 | * TODO: Add live validation for all fields, esp checking if a story title doesn't exist yet. |
| 56 | + * TODO: use HTMLForm? |
56 | 57 | */ |
57 | 58 | private static function getFrom( Parser $parser, array $args ) { |
58 | 59 | global $wgUser, $wgStyleVersion, $wgJsMimeType, $egStoryboardScriptPath, $egStorysubmissionWidth, $egStoryboardMaxStoryLen, $egStoryboardMinStoryLen; |
Index: trunk/extensions/Storyboard/specials/Story/Story_body.php |
— | — | @@ -169,6 +169,8 @@ |
170 | 170 | * Outputs a form to edit the story with. Code based on <storysubmission>. |
171 | 171 | * |
172 | 172 | * @param $story |
| 173 | + * |
| 174 | + * TODO: Add live validation for all fields, esp checking if a story title doesn't exist yet. |
173 | 175 | */ |
174 | 176 | private function showStoryForm( $story ) { |
175 | 177 | global $wgOut, $wgLang, $wgRequest, $wgUser, $wgJsMimeType, $egStoryboardScriptPath, $egStorysubmissionWidth, $egStoryboardMaxStoryLen, $egStoryboardMinStoryLen; |
Index: trunk/extensions/Storyboard/specials/StoryReview/StoryReview_body.php |
— | — | @@ -38,6 +38,7 @@ |
39 | 39 | } |
40 | 40 | |
41 | 41 | private function addOutput() { |
| 42 | + // TODO: add language filters |
42 | 43 | // TODO: display tabs for unpublished, published and hidden stories |
43 | 44 | // TODO: paging |
44 | 45 | |
Index: trunk/extensions/Storyboard/api/ApiStoryReview.php |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | |
50 | 50 | $params = $this->extractRequestParams(); |
51 | 51 | |
52 | | - // Check required parameters |
| 52 | + // Check to see if the required parameters are present. |
53 | 53 | if ( !isset( $params['storyid'] ) ) { |
54 | 54 | $this->dieUsageMsg( array( 'missingparam', 'storyid' ) ); |
55 | 55 | } |
Index: trunk/extensions/Storyboard/api/ApiStoryboard.php |
— | — | @@ -40,7 +40,32 @@ |
41 | 41 | } |
42 | 42 | |
43 | 43 | public function execute() { |
| 44 | + $params = $this->extractRequestParams(); |
44 | 45 | |
| 46 | + if ( !isset( $params['action'] ) ) { |
| 47 | + $this->dieUsageMsg( array( 'missingparam', 'action' ) ); |
| 48 | + } |
| 49 | + |
| 50 | + if ( $params['action'] == 'storyexists' ) { |
| 51 | + if ( !isset( $params['storyname'] ) ) { |
| 52 | + $this->dieUsageMsg( array( 'missingparam', 'storyname' ) ); |
| 53 | + } |
| 54 | + |
| 55 | + $dbr = wfGetDB( DB_SLAVE ); |
| 56 | + |
| 57 | + $story = $dbr->selectRow( |
| 58 | + 'storyboard', |
| 59 | + array( 'story_id' ), |
| 60 | + array( 'story_title' => $params['storyname'] ) |
| 61 | + ); |
| 62 | + |
| 63 | + $result = array( |
| 64 | + 'exists' => isset( $story ) |
| 65 | + ); |
| 66 | + |
| 67 | + $this->getResult()->setIndexedTagName( $result, 'story' ); |
| 68 | + $this->getResult()->addValue( null, $this->getModuleName(), $result ); |
| 69 | + } |
45 | 70 | } |
46 | 71 | |
47 | 72 | public function getAllowedParams() { |
Index: trunk/extensions/Storyboard/api/ApiQueryStories.php |
— | — | @@ -63,7 +63,7 @@ |
64 | 64 | $this->addOption( 'ORDER BY', 'story_modified, story_id DESC' ); |
65 | 65 | |
66 | 66 | if ( !is_null( $params['continue'] ) ) { |
67 | | - $continueParams = explode( '|', $params['continue'] ); |
| 67 | + $continueParams = explode( '-', $params['continue'] ); |
68 | 68 | if ( count( $continueParams ) != 2 ) { |
69 | 69 | $this->dieUsage( 'Invalid continue param. You should pass the ' . |
70 | 70 | 'original value returned by the previous query', '_badcontinue' ); |