1 2/* 3 * jQuery 1.2.6 - New Wave Javascript 4 * 5 * Copyright (c) 2008 John Resig (jquery.com) 6 * Dual licensed under the MIT (MIT-LICENSE.txt) 7 * and GPL (GPL-LICENSE.txt) licenses. 8 * 9 * Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) 10 * Rev: 5685 11 */ 12eval(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}('(H(){J w=1b.4M,3m$=1b.$;J D=1b.4M=1b.$=H(a,b){I 2B D.17.5j(a,b)};J u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/,62=/^.[^:#\\[\\.]*$/,12;D.17=D.44={5j:H(d,b){d=d||S;G(d.16){7[0]=d;7.K=1;I 7}G(1j d=="23"){J c=u.2D(d);G(c&&(c[1]||!b)){G(c[1])d=D.4h([c[1]],b);N{J a=S.61(c[3]);G(a){G(a.2v!=c[3])I D().2q(d);I D(a)}d=[]}}N I D(b).2q(d)}N G(D.1D(d))I D(S)[D.17.27?"27":"43"](d);I 7.6Y(D.2d(d))},5w:"1.2.6",8G:H(){I 7.K},K:0,3p:H(a){I a==12?D.2d(7):7[a]},2I:H(b){J a=D(b);a.5n=7;I a},6Y:H(a){7.K=0;2p.44.1p.1w(7,a);I 7},P:H(a,b){I D.P(7,a,b)},5i:H(b){J a=-1;I D.2L(b&&b.5w?b[0]:b,7)},1K:H(c,a,b){J d=c;G(c.1q==56)G(a===12)I 7[0]&&D[b||"1K"](7[0],c);N{d={};d[c]=a}I 7.P(H(i){R(c 1n d)D.1K(b?7.V:7,c,D.1i(7,d[c],b,i,c))})},1g:H(b,a){G((b==\'2h\'||b==\'1Z\')&&3d(a)<0)a=12;I 7.1K(b,a,"2a")},1r:H(b){G(1j b!="49"&&b!=U)I 7.4E().3v((7[0]&&7[0].2z||S).5F(b));J a="";D.P(b||7,H(){D.P(7.3t,H(){G(7.16!=8)a+=7.16!=1?7.76:D.17.1r([7])})});I a},5z:H(b){G(7[0])D(b,7[0].2z).5y().39(7[0]).2l(H(){J a=7;1B(a.1x)a=a.1x;I a}).3v(7);I 7},8Y:H(a){I 7.P(H(){D(7).6Q().5z(a)})},8R:H(a){I 7.P(H(){D(7).5z(a)})},3v:H(){I 7.3W(19,M,Q,H(a){G(7.16==1)7.3U(a)})},6F:H(){I 7.3W(19,M,M,H(a){G(7.16==1)7.39(a,7.1x)})},6E:H(){I 7.3W(19,Q,Q,H(a){7.1d.39(a,7)})},5q:H(){I 7.3W(19,Q,M,H(a){7.1d.39(a,7.2H)})},3l:H(){I 7.5n||D([])},2q:H(b){J c=D.2l(7,H(a){I D.2q(b,a)});I 7.2I(/[^+>] [^+>]/.11(b)||b.1h("..")>-1?D.4r(c):c)},5y:H(e){J f=7.2l(H(){G(D.14.1f&&!D.4n(7)){J a=7.6o(M),5h=S.3h("1v");5h.3U(a);I D.4h([5h.4H])[0]}N I 7.6o(M)});J d=f.2q("*").5c().P(H(){G(7[E]!=12)7[E]=U});G(e===M)7.2q("*").5c().P(H(i){G(7.16==3)I;J c=D.L(7,"3w");R(J a 1n c)R(J b 1n c[a])D.W.1e(d[i],a,c[a][b],c[a][b].L)});I f},1E:H(b){I 7.2I(D.1D(b)&&D.3C(7,H(a,i){I b.1k(a,i)})||D.3g(b,7))},4Y:H(b){G(b.1q==56)G(62.11(b))I 7.2I(D.3g(b,7,M));
12N b=D.3g(b,7);J a=b.K&&b[b.K-1]!==12&&!b.16;I 7.1E(H(){I a?D.2L(7,b)<0:7!=b})},1e:H(a){I 7.2I(D.4r(D.2R(7.3p(),1j a==\'23\'?D(a):D.2d(a))))},3F:H(a){I!!a&&D.3g(a,7).K>0},7T:H(a){I 7.3F("."+a)},6e:H(b){G(b==12){G(7.K){J c=7[0];G(D.Y(c,"2A")){J e=c.64,63=[],15=c.15,2V=c.O=="2A-2V";G(e<0)I U;R(J i=2V?e:0,2f=2V?e+1:15.K;i<2f;i++){J d=15[i];G(d.2W){b=D.14.1f&&!d.at.2x.an?d.1r:d.2x;G(2V)I b;63.1p(b)}}I 63}N I(7[0].2x||"").1o(/\\r/g,"")}I 12}G(b.1q==4L)b+=\'\';I 7.P(H(){G(7.16!=1)I;G(b.1q==2p&&/5O|5L/.11(7.O))7.4J=(D.2L(7.2x,b)>=0||D.2L(7.34,b)>=0);N G(D.Y(7,"2A")){J a=D.2d(b);D("9R",7).P(H(){7.2W=(D.2L(7.2x,a)>=0||D.2L(7.1r,a)>=0)});G(!a.K)7.64=-1}N 7.2x=b})},2K:H(a){I a==12?(7[0]?7[0].4H:U):7.4E().3v(a)},7b:H(a){I 7.5q(a).21()},79:H(i){I 7.3s(i,i+1)},3s:H(){I 7.2I(2p.44.3s.1w(7,19))},2l:H(b){I 7.2I(D.2l(7,H(a,i){I b.1k(a,i,a)}))},5c:H(){I 7.1e(7.5n)},L:H(d,b){J a=d.1R(".");a[1]=a[1]?"."+a[1]:"";G(b===12){J c=7.5C("9z"+a[1]+"!",[a[0]]);G(c===12&&7.K)c=D.L(7[0],d);I c===12&&a[1]?7.L(a[0]):c}N I 7.1P("9u"+a[1]+"!",[a[0],b]).P(H(){D.L(7,d,b)})},3b:H(a){I 7.P(H(){D.3b(7,a)})},3W:H(g,f,h,d){J e=7.K>1,3x;I 7.P(H(){G(!3x){3x=D.4h(g,7.2z);G(h)3x.9o()}J b=7;G(f&&D.Y(7,"1T")&&D.Y(3x[0],"4F"))b=7.3H("22")[0]||7.3U(7.2z.3h("22"));J c=D([]);D.P(3x,H(){J a=e?D(7).5y(M)[0]:7;G(D.Y(a,"1m"))c=c.1e(a);N{G(a.16==1)c=c.1e(D("1m",a).21());d.1k(b,a)}});c.P(6T)})}};D.17.5j.44=D.17;H 6T(i,a){G(a.4d)D.3Y({1a:a.4d,31:Q,1O:"1m"});N D.5u(a.1r||a.6O||a.4H||"");G(a.1d)a.1d.37(a)}H 1z(){I+2B 8J}D.1l=D.17.1l=H(){J b=19[0]||{},i=1,K=19.K,4x=Q,15;G(b.1q==8I){4x=b;b=19[1]||{};i=2}G(1j b!="49"&&1j b!="H")b={};G(K==i){b=7;--i}R(;i<K;i++)G((15=19[i])!=U)R(J c 1n 15){J a=b[c],2w=15[c];G(b===2w)6M;G(4x&&2w&&1j 2w=="49"&&!2w.16)b[c]=D.1l(4x,a||(2w.K!=U?[]:{}),2w);N G(2w!==12)b[c]=2w}I b};J E="4M"+1z(),6K=0,5r={},6G=/z-?5i|8B-?8A|1y|6B|8v-?1Z/i,3P=S.3P||{};D.1l({8u:H(a){1b.$=3m$;G(a)1b.4M=w;I D},1D:H(a){I!!a&&1j a!="23"&&!a.Y&&a.1q!=2p&&/^[\\s[]?H/.11(a+"")},4n:H(a){I a.1C&&!a.1c||a.2j&&a.2z&&!a.2z.1c},5u:H(a){a=D.3k(a);G(a){J b=S.3H("6w")[0]||S.1C,1m=S.3h("1m");1m.O="1r/4t";G(D.14.1f)1m.1r=a;N 1m.3U(S.5F(a));b.39(1m,b.1x);b.37(1m)}},Y:H(b,a){I b.Y&&b.Y.2r()==a.2r()},1Y:{},L:H(c,d,b){c=c==1b?5r:c;J a=c[E];G(!a)a=c[E]=++6K;G(d&&!D.1Y[a])D.1Y[a]={};G(b!==12)D.1Y[a][d]=b;I d?D.1Y[a][d]:a},3b:H(c,b){c=c==1b?5r:c;J a=c[E];G(b){G(D.1Y[a]){2U D.1Y[a][b];b="";R(b 1n D.1Y[a])1X;G(!b)D.3b(c)}}N{1U{2U c[E]}1V(e){G(c.5l)c.5l(E)}2U D.1Y[a]}},P:H(d,a,c){J e,i=0,K=d.K;G(c){G(K==12){R(e 1n d)G(a.1w(d[e],c)===Q)1X}N R(;i<K;)G(a.1w(d[i++],c)===Q)1X}N{G(K==12){R(e 1n d)G(a.1k(d[e],e,d[e])===Q)1X}N R(J b=d[0];i<K&&a.1k(b,i,b)!==Q;b=d[++i]){}}I d},1i:H(b,a,c,i,d){G(D.1D(a))a=a.1k(b,i);I a&&a.1q==4L&&c=="2a"&&!6G.11(d)?a+"2X":a},1F:{1e:H(c,b){D.P((b||"").1R(/\\s+/),H(i,a){G(c.16==1&&!D.1F.3T(c.1F,a))c.1F+=(c.1F?" ":"")+a})},21:H(c,b){G(c.16==1)c.1F=b!=12?D.3C(c.1F.1R(/\\s+/),H(a){I!D.1F.3T(b,a)}).6s(" "):""},3T:H(b,a){I D.2L(a,(b.1F||b).6r().1R(/\\s+/))>-1}},6q:H(b,c,a){J e={};R(J d 1n c){e[d]=b.V[d];b.V[d]=c[d]}a.1k(b);R(J d 1n c)b.V[d]=e[d]},1g:H(d,e,c){G(e=="2h"||e=="1Z"){J b,3X={30:"5x",5g:"1G",18:"3I"},35=e=="2h"?["5e","6k"]:["5G","6i"];H 5b(){b=e=="2h"?d.8f:d.8c;J a=0,2C=0;D.P(35,H(){a+=3d(D.2a(d,"57"+7,M))||0;2C+=3d(D.2a(d,"2C"+7+"4b",M))||0});b-=29.83(a+2C)}G(D(d).3F(":4j"))5b();N D.6q(d,3X,5b);I 29.2f(0,b)}I D.2a(d,e,c)},2a:H(f,l,k){J e,V=f.V;H 3E(b){G(!D.14.2k)I Q;J a=3P.54(b,U);I!a||a.52("3E")==""}G(l=="1y"&&D.14.1f){e=D.1K(V,"1y");I e==""?"1":e}G(D.14.2G&&l=="18"){J d=V.50;V.50="0 7Y 7W";V.50=d}G(l.1I(/4i/i))l=y;G(!k&&V&&V[l])e=V[l];N G(3P.54){G(l.1I(/4i/i))l="4i";l=l.1o(/([A-Z])/g,"-$1").3y();J c=3P.54(f,U);G(c&&!3E(f))e=c.52(l);N{J g=[],2E=[],a=f,i=0;R(;a&&3E(a);a=a.1d)2E.6h(a);R(;i<2E.K;i++)G(3E(2E[i])){g[i]=2E[i].V.18;2E[i].V.18="3I"}e=l=="18"&&g[2E.K-1]!=U?"2F":(c&&c.52(l))||"";R(i=0;i<g.K;i++)G(g[i]!=U)2E[i].V.18=g[i]}G(l=="1y"&&e=="")e="1"}N G(f.4g){J h=l.1o(/\\-(\\w)/g,H(a,b){I b.2r()});e=f.4g[l]||f.4g[h];G(!/^\\d+(2X)?$/i.11(e)&&/^\\d/.11(e)){J j=V.1A,66=f.65.1A;f.65.1A=f.4g.1A;V.1A=e||0;e=V.aM+"2X";V.1A=j;f.65.1A=66}}I e},4h:H(l,h){J k=[];h=h||S;G(1j h.3h==\'12\')h=h.2z||h[0]&&h[0].2z||S;D.P(l,H(i,d){G(!d)I;G(d.1q==4L)d+=\'\';G(1j d=="23"){d=d.1o(/(<(\\w+)[^>]*?)\\/>/g,H(b,a,c){I c.1I(/^(aK|4f|7E|aG|4T|7A|aB|3n|az|ay|av)$/i)?b:a+"></"+c+">"});J f=D.3k(d).3y(),1v=h.3h("1v");J e=!f.1h("<au")&&[1,"<2A 7w=\'7w\'>","</2A>"]||!f.1h("<ar")&&[1,"<7v>","</7v>"]||f.1I(/^<(aq|22|am|ak|ai)/)&&[1,"<1T>","</1T>"]||!f.1h("<4F")&&[2,"<1T><22>","</22></1T>"]||(!f.1h("<af")||!f.1h("<ad"))&&[3,"<1T><22><4F>","</4F></22></1T>"]||!f.1h("<7E")&&[2,"<1T><22></22><7q>","</7q></1T>"]||D.14.1f&&[1,"1v<1v>","</1v>"]||[0,"",""];1v.4H=e[1]+d+e[2];1B(e[0]--)1v=1v.5T;G(D.14.1f){J g=!f.1h("<1T")&&f.1h("<22")<0?1v.1x&&1v.1x.3t:e[1]=="<1T>"&&f.1h("<22")<0?1v.3t:[];R(J j=g.K-1;j>=0;
12--j)G(D.Y(g[j],"22")&&!g[j].3t.K)g[j].1d.37(g[j]);G(/^\\s/.11(d))1v.39(h.5F(d.1I(/^\\s*/)[0]),1v.1x)}d=D.2d(1v.3t)}G(d.K===0&&(!D.Y(d,"3V")&&!D.Y(d,"2A")))I;G(d[0]==12||D.Y(d,"3V")||d.15)k.1p(d);N k=D.2R(k,d)});I k},1K:H(d,f,c){G(!d||d.16==3||d.16==8)I 12;J e=!D.4n(d),40=c!==12,1f=D.14.1f;f=e&&D.3X[f]||f;G(d.2j){J g=/5Q|4d|V/.11(f);G(f=="2W"&&D.14.2k)d.1d.64;G(f 1n d&&e&&!g){G(40){G(f=="O"&&D.Y(d,"4T")&&d.1d)7p"O a3 a1\'t 9V 9U";d[f]=c}G(D.Y(d,"3V")&&d.7i(f))I d.7i(f).76;I d[f]}G(1f&&e&&f=="V")I D.1K(d.V,"9T",c);G(40)d.9Q(f,""+c);J h=1f&&e&&g?d.4G(f,2):d.4G(f);I h===U?12:h}G(1f&&f=="1y"){G(40){d.6B=1;d.1E=(d.1E||"").1o(/7f\\([^)]*\\)/,"")+(3r(c)+\'\'=="9L"?"":"7f(1y="+c*7a+")")}I d.1E&&d.1E.1h("1y=")>=0?(3d(d.1E.1I(/1y=([^)]*)/)[1])/7a)+\'\':""}f=f.1o(/-([a-z])/9H,H(a,b){I b.2r()});G(40)d[f]=c;I d[f]},3k:H(a){I(a||"").1o(/^\\s+|\\s+$/g,"")},2d:H(b){J a=[];G(b!=U){J i=b.K;G(i==U||b.1R||b.4I||b.1k)a[0]=b;N 1B(i)a[--i]=b[i]}I a},2L:H(b,a){R(J i=0,K=a.K;i<K;i++)G(a[i]===b)I i;I-1},2R:H(a,b){J i=0,T,2S=a.K;G(D.14.1f){1B(T=b[i++])G(T.16!=8)a[2S++]=T}N 1B(T=b[i++])a[2S++]=T;I a},4r:H(a){J c=[],2o={};1U{R(J i=0,K=a.K;i<K;i++){J b=D.L(a[i]);G(!2o[b]){2o[b]=M;c.1p(a[i])}}}1V(e){c=a}I c},3C:H(c,a,d){J b=[];R(J i=0,K=c.K;i<K;i++)G(!d!=!a(c[i],i))b.1p(c[i]);I b},2l:H(d,a){J c=[];R(J i=0,K=d.K;i<K;i++){J b=a(d[i],i);G(b!=U)c[c.K]=b}I c.7d.1w([],c)}});J v=9B.9A.3y();D.14={5B:(v.1I(/.+(?:9y|9x|9w|9v)[\\/: ]([\\d.]+)/)||[])[1],2k:/75/.11(v),2G:/2G/.11(v),1f:/1f/.11(v)&&!/2G/.11(v),42:/42/.11(v)&&!/(9s|75)/.11(v)};J y=D.14.1f?"7o":"72";D.1l({71:!D.14.1f||S.70=="6Z",3X:{"R":"9n","9k":"1F","4i":y,72:y,7o:y,9h:"9f",9e:"9d",9b:"99"}});D.P({6W:H(a){I a.1d},97:H(a){I D.4S(a,"1d")},95:H(a){I D.3a(a,2,"2H")},91:H(a){I D.3a(a,2,"4l")},8Z:H(a){I D.4S(a,"2H")},8X:H(a){I D.4S(a,"4l")},8W:H(a){I D.5v(a.1d.1x,a)},8V:H(a){I D.5v(a.1x)},6Q:H(a){I D.Y(a,"8U")?a.8T||a.8S.S:D.2d(a.3t)}},H(c,d){D.17[c]=H(b){J a=D.2l(7,d);G(b&&1j b=="23")a=D.3g(b,a);I 7.2I(D.4r(a))}});D.P({6P:"3v",8Q:"6F",39:"6E",8P:"5q",8O:"7b"},H(c,b){D.17[c]=H(){J a=19;I 7.P(H(){R(J i=0,K=a.K;i<K;i++)D(a[i])[b](7)})}});D.P({8N:H(a){D.1K(7,a,"");G(7.16==1)7.5l(a)},8M:H(a){D.1F.1e(7,a)},8L:H(a){D.1F.21(7,a)},8K:H(a){D.1F[D.1F.3T(7,a)?"21":"1e"](7,a)},21:H(a){G(!a||D.1E(a,[7]).r.K){D("*",7).1e(7).P(H(){D.W.21(7);D.3b(7)});G(7.1d)7.1d.37(7)}},4E:H(){D(">*",7).21();1B(7.1x)7.37(7.1x)}},H(a,b){D.17[a]=H(){I 7.P(b,19)}});D.P(["6N","4b"],H(i,c){J b=c.3y();D.17[b]=H(a){I 7[0]==1b?D.14.2G&&S.1c["5t"+c]||D.14.2k&&1b["5s"+c]||S.70=="6Z"&&S.1C["5t"+c]||S.1c["5t"+c]:7[0]==S?29.2f(29.2f(S.1c["4y"+c],S.1C["4y"+c]),29.2f(S.1c["2i"+c],S.1C["2i"+c])):a==12?(7.K?D.1g(7[0],b):U):7.1g(b,a.1q==56?a:a+"2X")}});H 25(a,b){I a[0]&&3r(D.2a(a[0],b,M),10)||0}J C=D.14.2k&&3r(D.14.5B)<8H?"(?:[\\\\w*3m-]|\\\\\\\\.)":"(?:[\\\\w\\8F-\\8E*3m-]|\\\\\\\\.)",6L=2B 4v("^>\\\\s*("+C+"+)"),6J=2B 4v("^("+C+"+)(#)("+C+"+)"),6I=2B 4v("^([#.]?)("+C+"*)");D.1l({6H:{"":H(a,i,m){I m[2]=="*"||D.Y(a,m[2])},"#":H(a,i,m){I a.4G("2v")==m[2]},":":{8D:H(a,i,m){I i<m[3]-0},8C:H(a,i,m){I i>m[3]-0},3a:H(a,i,m){I m[3]-0==i},79:H(a,i,m){I m[3]-0==i},3o:H(a,i){I i==0},3S:H(a,i,m,r){I i==r.K-1},6D:H(a,i){I i%2==0},6C:H(a,i){I i%2},"3o-4u":H(a){I a.1d.3H("*")[0]==a},"3S-4u":H(a){I D.3a(a.1d.5T,1,"4l")==a},"8z-4u":H(a){I!D.3a(a.1d.5T,2,"4l")},6W:H(a){I a.1x},4E:H(a){I!a.1x},8y:H(a,i,m){I(a.6O||a.8x||D(a).1r()||"").1h(m[3])>=0},4j:H(a){I"1G"!=a.O&&D.1g(a,"18")!="2F"&&D.1g(a,"5g")!="1G"},1G:H(a){I"1G"==a.O||D.1g(a,"18")=="2F"||D.1g(a,"5g")=="1G"},8w:H(a){I!a.3R},3R:H(a){I a.3R},4J:H(a){I a.4J},2W:H(a){I a.2W||D.1K(a,"2W")},1r:H(a){I"1r"==a.O},5O:H(a){I"5O"==a.O},5L:H(a){I"5L"==a.O},5p:H(a){I"5p"==a.O},3Q:H(a){I"3Q"==a.O},5o:H(a){I"5o"==a.O},6A:H(a){I"6A"==a.O},6z:H(a){I"6z"==a.O},2s:H(a){I"2s"==a.O||D.Y(a,"2s")},4T:H(a){I/4T|2A|6y|2s/i.11(a.Y)},3T:H(a,i,m){I D.2q(m[3],a).K},8t:H(a){I/h\\d/i.11(a.Y)},8s:H(a){I D.3C(D.3O,H(b){I a==b.T}).K}}},6x:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,2B 4v("^([:.#]*)("+C+"+)")],3g:H(a,c,b){J d,1t=[];1B(a&&a!=d){d=a;J f=D.1E(a,c,b);a=f.t.1o(/^\\s*,\\s*/,"");1t=b?c=f.r:D.2R(1t,f.r)}I 1t},2q:H(t,o){G(1j t!="23")I[t];G(o&&o.16!=1&&o.16!=9)I[];o=o||S;J d=[o],2o=[],3S,Y;
121B(t&&3S!=t){J r=[];3S=t;t=D.3k(t);J l=Q,3j=6L,m=3j.2D(t);G(m){Y=m[1].2r();R(J i=0;d[i];i++)R(J c=d[i].1x;c;c=c.2H)G(c.16==1&&(Y=="*"||c.Y.2r()==Y))r.1p(c);d=r;t=t.1o(3j,"");G(t.1h(" ")==0)6M;l=M}N{3j=/^([>+~])\\s*(\\w*)/i;G((m=3j.2D(t))!=U){r=[];J k={};Y=m[2].2r();m=m[1];R(J j=0,3i=d.K;j<3i;j++){J n=m=="~"||m=="+"?d[j].2H:d[j].1x;R(;n;n=n.2H)G(n.16==1){J g=D.L(n);G(m=="~"&&k[g])1X;G(!Y||n.Y.2r()==Y){G(m=="~")k[g]=M;r.1p(n)}G(m=="+")1X}}d=r;t=D.3k(t.1o(3j,""));l=M}}G(t&&!l){G(!t.1h(",")){G(o==d[0])d.4s();2o=D.2R(2o,d);r=d=[o];t=" "+t.6v(1,t.K)}N{J h=6J;J m=h.2D(t);G(m){m=[0,m[2],m[3],m[1]]}N{h=6I;m=h.2D(t)}m[2]=m[2].1o(/\\\\/g,"");J f=d[d.K-1];G(m[1]=="#"&&f&&f.61&&!D.4n(f)){J p=f.61(m[2]);G((D.14.1f||D.14.2G)&&p&&1j p.2v=="23"&&p.2v!=m[2])p=D(\'[@2v="\'+m[2]+\'"]\',f)[0];d=r=p&&(!m[3]||D.Y(p,m[3]))?[p]:[]}N{R(J i=0;d[i];i++){J a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];G(a=="*"&&d[i].Y.3y()=="49")a="3n";r=D.2R(r,d[i].3H(a))}G(m[1]==".")r=D.5m(r,m[2]);G(m[1]=="#"){J e=[];R(J i=0;r[i];i++)G(r[i].4G("2v")==m[2]){e=[r[i]];1X}r=e}d=r}t=t.1o(h,"")}}G(t){J b=D.1E(t,r);d=r=b.r;t=D.3k(b.t)}}G(t)d=[];G(d&&o==d[0])d.4s();2o=D.2R(2o,d);I 2o},5m:H(r,m,a){m=" "+m+" ";J c=[];R(J i=0;r[i];i++){J b=(" "+r[i].1F+" ").1h(m)>=0;G(!a&&b||a&&!b)c.1p(r[i])}I c},1E:H(t,r,h){J d;1B(t&&t!=d){d=t;J p=D.6x,m;R(J i=0;p[i];i++){m=p[i].2D(t);G(m){t=t.8r(m[0].K);m[2]=m[2].1o(/\\\\/g,"");1X}}G(!m)1X;G(m[1]==":"&&m[2]=="4Y")r=62.11(m[3])?D.1E(m[3],r,M).r:D(r).4Y(m[3]);N G(m[1]==".")r=D.5m(r,m[2],h);N G(m[1]=="["){J g=[],O=m[3];R(J i=0,3i=r.K;i<3i;i++){J a=r[i],z=a[D.3X[m[2]]||m[2]];G(z==U||/5Q|4d|2W/.11(m[2]))z=D.1K(a,m[2])||\'\';G((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1h(m[5])||O=="$="&&z.6v(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1h(m[5])>=0)^h)g.1p(a)}r=g}N G(m[1]==":"&&m[2]=="3a-4u"){J e={},g=[],11=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2D(m[3]=="6D"&&"2n"||m[3]=="6C"&&"2n+1"||!/\\D/.11(m[3])&&"8q+"+m[3]||m[3]),3o=(11[1]+(11[2]||1))-0,d=11[3]-0;R(J i=0,3i=r.K;i<3i;i++){J j=r[i],1d=j.1d,2v=D.L(1d);G(!e[2v]){J c=1;R(J n=1d.1x;n;n=n.2H)G(n.16==1)n.4q=c++;e[2v]=M}J b=Q;G(3o==0){G(j.4q==d)b=M}N G((j.4q-d)%3o==0&&(j.4q-d)/3o>=0)b=M;G(b^h)g.1p(j)}r=g}N{J f=D.6H[m[1]];G(1j f=="49")f=f[m[2]];G(1j f=="23")f=6u("Q||H(a,i){I "+f+";}");r=D.3C(r,H(a,i){I f(a,i,m,r)},h)}}I{r:r,t:t}},4S:H(b,c){J a=[],1t=b[c];1B(1t&&1t!=S){G(1t.16==1)a.1p(1t);1t=1t[c]}I a},3a:H(a,e,c,b){e=e||1;J d=0;R(;a;a=a[c])G(a.16==1&&++d==e)1X;I a},5v:H(n,a){J r=[];R(;n;n=n.2H){G(n.16==1&&n!=a)r.1p(n)}I r}});D.W={1e:H(f,i,g,e){G(f.16==3||f.16==8)I;G(D.14.1f&&f.4I)f=1b;G(!g.24)g.24=7.24++;G(e!=12){J h=g;g=7.3M(h,H(){I h.1w(7,19)});g.L=e}J j=D.L(f,"3w")||D.L(f,"3w",{}),1H=D.L(f,"1H")||D.L(f,"1H",H(){G(1j D!="12"&&!D.W.5k)I D.W.1H.1w(19.3L.T,19)});1H.T=f;D.P(i.1R(/\\s+/),H(c,b){J a=b.1R(".");b=a[0];g.O=a[1];J d=j[b];G(!d){d=j[b]={};G(!D.W.2t[b]||D.W.2t[b].4p.1k(f)===Q){G(f.3K)f.3K(b,1H,Q);N G(f.6t)f.6t("4o"+b,1H)}}d[g.24]=g;D.W.26[b]=M});f=U},24:1,26:{},21:H(e,h,f){G(e.16==3||e.16==8)I;J i=D.L(e,"3w"),1L,5i;G(i){G(h==12||(1j h=="23"&&h.8p(0)=="."))R(J g 1n i)7.21(e,g+(h||""));N{G(h.O){f=h.2y;h=h.O}D.P(h.1R(/\\s+/),H(b,a){J c=a.1R(".");a=c[0];G(i[a]){G(f)2U i[a][f.24];N R(f 1n i[a])G(!c[1]||i[a][f].O==c[1])2U i[a][f];R(1L 1n i[a])1X;G(!1L){G(!D.W.2t[a]||D.W.2t[a].4A.1k(e)===Q){G(e.6p)e.6p(a,D.L(e,"1H"),Q);N G(e.6n)e.6n("4o"+a,D.L(e,"1H"))}1L=U;2U i[a]}}})}R(1L 1n i)1X;G(!1L){J d=D.L(e,"1H");G(d)d.T=U;D.3b(e,"3w");D.3b(e,"1H")}}},1P:H(h,c,f,g,i){c=D.2d(c);G(h.1h("!")>=0){h=h.3s(0,-1);J a=M}G(!f){G(7.26[h])D("*").1e([1b,S]).1P(h,c)}N{G(f.16==3||f.16==8)I 12;J b,1L,17=D.1D(f[h]||U),W=!c[0]||!c[0].32;G(W){c.6h({O:h,2J:f,32:H(){},3J:H(){},4C:1z()});c[0][E]=M}c[0].O=h;G(a)c[0].6m=M;J d=D.L(f,"1H");G(d)b=d.1w(f,c);G((!17||(D.Y(f,\'a\')&&h=="4V"))&&f["4o"+h]&&f["4o"+h].1w(f,c)===Q)b=Q;G(W)c.4s();G(i&&D.1D(i)){1L=i.1w(f,b==U?c:c.7d(b));G(1L!==12)b=1L}G(17&&g!==Q&&b!==Q&&!(D.Y(f,\'a\')&&h=="4V")){7.5k=M;1U{f[h]()}1V(e){}}7.5k=Q}I b},1H:H(b){J a,1L,38,5f,4m;b=19[0]=D.W.6l(b||1b.W);38=b.O.1R(".");b.O=38[0];38=38[1];5f=!38&&!b.6m;4m=(D.L(7,"3w")||{})[b.O];R(J j 1n 4m){J c=4m[j];G(5f||c.O==38){b.2y=c;b.L=c.L;1L=c.1w(7,19);G(a!==Q)a=1L;G(1L===Q){b.32();b.3J()}}}I a},6l:H(b){G(b[E]==M)I b;J d=b;b={8o:d};J c="8n 8m 8l 8k 2s 8j 47 5d 6j 5E 8i L 8h 8g 4K 2y 5a 59 8e 8b 58 6f 8a 88 4k 87 86 84 6d 2J 4C 6c O 82 81 35".1R(" ");R(J i=c.K;i;i--)b[c[i]]=d[c[i]];b[E]=M;b.32=H(){G(d.32)d.32();d.80=Q};
12b.3J=H(){G(d.3J)d.3J();d.7Z=M};b.4C=b.4C||1z();G(!b.2J)b.2J=b.6d||S;G(b.2J.16==3)b.2J=b.2J.1d;G(!b.4k&&b.4K)b.4k=b.4K==b.2J?b.6c:b.4K;G(b.58==U&&b.5d!=U){J a=S.1C,1c=S.1c;b.58=b.5d+(a&&a.2e||1c&&1c.2e||0)-(a.6b||0);b.6f=b.6j+(a&&a.2c||1c&&1c.2c||0)-(a.6a||0)}G(!b.35&&((b.47||b.47===0)?b.47:b.5a))b.35=b.47||b.5a;G(!b.59&&b.5E)b.59=b.5E;G(!b.35&&b.2s)b.35=(b.2s&1?1:(b.2s&2?3:(b.2s&4?2:0)));I b},3M:H(a,b){b.24=a.24=a.24||b.24||7.24++;I b},2t:{27:{4p:H(){55();I},4A:H(){I}},3D:{4p:H(){G(D.14.1f)I Q;D(7).2O("53",D.W.2t.3D.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e("53",D.W.2t.3D.2y);I M},2y:H(a){G(F(a,7))I M;a.O="3D";I D.W.1H.1w(7,19)}},3N:{4p:H(){G(D.14.1f)I Q;D(7).2O("51",D.W.2t.3N.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e("51",D.W.2t.3N.2y);I M},2y:H(a){G(F(a,7))I M;a.O="3N";I D.W.1H.1w(7,19)}}}};D.17.1l({2O:H(c,a,b){I c=="4X"?7.2V(c,a,b):7.P(H(){D.W.1e(7,c,b||a,b&&a)})},2V:H(d,b,c){J e=D.W.3M(c||b,H(a){D(7).4e(a,e);I(c||b).1w(7,19)});I 7.P(H(){D.W.1e(7,d,e,c&&b)})},4e:H(a,b){I 7.P(H(){D.W.21(7,a,b)})},1P:H(c,a,b){I 7.P(H(){D.W.1P(c,a,7,M,b)})},5C:H(c,a,b){I 7[0]&&D.W.1P(c,a,7[0],Q,b)},2m:H(b){J c=19,i=1;1B(i<c.K)D.W.3M(b,c[i++]);I 7.4V(D.W.3M(b,H(a){7.4Z=(7.4Z||0)%i;a.32();I c[7.4Z++].1w(7,19)||Q}))},7X:H(a,b){I 7.2O(\'3D\',a).2O(\'3N\',b)},27:H(a){55();G(D.2Q)a.1k(S,D);N D.3A.1p(H(){I a.1k(7,D)});I 7}});D.1l({2Q:Q,3A:[],27:H(){G(!D.2Q){D.2Q=M;G(D.3A){D.P(D.3A,H(){7.1k(S)});D.3A=U}D(S).5C("27")}}});J x=Q;H 55(){G(x)I;x=M;G(S.3K&&!D.14.2G)S.3K("69",D.27,Q);G(D.14.1f&&1b==1S)(H(){G(D.2Q)I;1U{S.1C.7V("1A")}1V(3e){3B(19.3L,0);I}D.27()})();G(D.14.2G)S.3K("69",H(){G(D.2Q)I;R(J i=0;i<S.4W.K;i++)G(S.4W[i].3R){3B(19.3L,0);I}D.27()},Q);G(D.14.2k){J a;(H(){G(D.2Q)I;G(S.3f!="68"&&S.3f!="1J"){3B(19.3L,0);I}G(a===12)a=D("V, 7A[7U=7S]").K;G(S.4W.K!=a){3B(19.3L,0);I}D.27()})()}D.W.1e(1b,"43",D.27)}D.P(("7R,7Q,43,85,4y,4X,4V,7P,"+"7O,7N,89,53,51,7M,2A,"+"5o,7L,7K,8d,3e").1R(","),H(i,b){D.17[b]=H(a){I a?7.2O(b,a):7.1P(b)}});J F=H(a,c){J b=a.4k;1B(b&&b!=c)1U{b=b.1d}1V(3e){b=c}I b==c};D(1b).2O("4X",H(){D("*").1e(S).4e()});D.17.1l({67:D.17.43,43:H(g,d,c){G(1j g!=\'23\')I 7.67(g);J e=g.1h(" ");G(e>=0){J i=g.3s(e,g.K);g=g.3s(0,e)}c=c||H(){};J f="2P";G(d)G(D.1D(d)){c=d;d=U}N{d=D.3n(d);f="6g"}J h=7;D.3Y({1a:g,O:f,1O:"2K",L:d,1J:H(a,b){G(b=="1W"||b=="7J")h.2K(i?D("<1v/>").3v(a.4U.1o(/<1m(.|\\s)*?\\/1m>/g,"")).2q(i):a.4U);h.P(c,[a.4U,b,a])}});I 7},aL:H(){I D.3n(7.7I())},7I:H(){I 7.2l(H(){I D.Y(7,"3V")?D.2d(7.aH):7}).1E(H(){I 7.34&&!7.3R&&(7.4J||/2A|6y/i.11(7.Y)||/1r|1G|3Q/i.11(7.O))}).2l(H(i,c){J b=D(7).6e();I b==U?U:b.1q==2p?D.2l(b,H(a,i){I{34:c.34,2x:a}}):{34:c.34,2x:b}}).3p()}});D.P("7H,7G,7F,7D,7C,7B".1R(","),H(i,o){D.17[o]=H(f){I 7.2O(o,f)}});J B=1z();D.1l({3p:H(d,b,a,c){G(D.1D(b)){a=b;b=U}I D.3Y({O:"2P",1a:d,L:b,1W:a,1O:c})},aE:H(b,a){I D.3p(b,U,a,"1m")},aD:H(c,b,a){I D.3p(c,b,a,"3z")},aC:H(d,b,a,c){G(D.1D(b)){a=b;b={}}I D.3Y({O:"6g",1a:d,L:b,1W:a,1O:c})},aA:H(a){D.1l(D.60,a)},60:{1a:5Z.5Q,26:M,O:"2P",2T:0,7z:"4R/x-ax-3V-aw",7x:M,31:M,L:U,5Y:U,3Q:U,4Q:{2N:"4R/2N, 1r/2N",2K:"1r/2K",1m:"1r/4t, 4R/4t",3z:"4R/3z, 1r/4t",1r:"1r/as",4w:"*/*"}},4z:{},3Y:H(s){s=D.1l(M,s,D.1l(M,{},D.60,s));J g,2Z=/=\\?(&|$)/g,1u,L,O=s.O.2r();G(s.L&&s.7x&&1j s.L!="23")s.L=D.3n(s.L);G(s.1O=="4P"){G(O=="2P"){G(!s.1a.1I(2Z))s.1a+=(s.1a.1I(/\\?/)?"&":"?")+(s.4P||"7u")+"=?"}N G(!s.L||!s.L.1I(2Z))s.L=(s.L?s.L+"&":"")+(s.4P||"7u")+"=?";s.1O="3z"}G(s.1O=="3z"&&(s.L&&s.L.1I(2Z)||s.1a.1I(2Z))){g="4P"+B++;G(s.L)s.L=(s.L+"").1o(2Z,"="+g+"$1");s.1a=s.1a.1o(2Z,"="+g+"$1");s.1O="1m";1b[g]=H(a){L=a;1W();1J();1b[g]=12;1U{2U 1b[g]}1V(e){}G(i)i.37(h)}}G(s.1O=="1m"&&s.1Y==U)s.1Y=Q;G(s.1Y===Q&&O=="2P"){J j=1z();J k=s.1a.1o(/(\\?|&)3m=.*?(&|$)/,"$ap="+j+"$2");s.1a=k+((k==s.1a)?(s.1a.1I(/\\?/)?"&":"?")+"3m="+j:"")}G(s.L&&O=="2P"){s.1a+=(s.1a.1I(/\\?/)?"&":"?")+s.L;s.L=U}G(s.26&&!D.4O++)D.W.1P("7H");J n=/^(?:\\w+:)?\\/\\/([^\\/?#]+)/;G(s.1O=="1m"&&O=="2P"&&n.11(s.1a)&&n.2D(s.1a)[1]!=5Z.al){J i=S.3H("6w")[0];J h=S.3h("1m");h.4d=s.1a;G(s.7t)h.aj=s.7t;G(!g){J l=Q;h.ah=h.ag=H(){G(!l&&(!7.3f||7.3f=="68"||7.3f=="1J")){l=M;1W();1J();i.37(h)}}}i.3U(h);I 12}J m=Q;J c=1b.7s?2B 7s("ae.ac"):2B 7r();G(s.5Y)c.6R(O,s.1a,s.31,s.5Y,s.3Q);N c.6R(O,s.1a,s.31);1U{G(s.L)c.4B("ab-aa",s.7z);G(s.5S)c.4B("a9-5R-a8",D.4z[s.1a]||"a7, a6 a5 a4 5N:5N:5N a2");c.4B("X-9Z-9Y","7r");c.4B("9W",s.1O&&s.4Q[s.1O]?s.4Q[s.1O]+", */*":s.4Q.4w)}1V(e){}G(s.7m&&s.7m(c,s)===Q){s.26&&D.4O--;c.7l();I Q}G(s.26)D.W.1P("7B",[c,s]);J d=H(a){G(!m&&c&&(c.3f==4||a=="2T")){m=M;G(f){7k(f);f=U}1u=a=="2T"&&"2T"||!D.7j(c)&&"3e"||s.5S&&D.7h(c,s.1a)&&"7J"||"1W";G(1u=="1W"){1U{L=D.6X(c,s.1O,s.9S)}1V(e){1u="5J"}}G(1u=="1W"){J b;1U{b=c.5I("7g-5R")}1V(e){}G(s.5S&&b)D.4z[s.1a]=b;G(!g)1W()}N D.5H(s,c,1u);1J();G(s.31)c=U}};G(s.31){J f=4I(d,13);G(s.2T>0)3B(H(){G(c){c.7l();G(!m)d("2T")}},s.2T)}1U{c.9P(s.L)}1V(e){D.5H(s,c,U,e)}G(!s.31)d();H 1W(){G(s.1W)s.1W(L,1u);G(s.26)D.W.1P("7C",[c,s])}H 1J(){G(s.1J)s.1J(c,1u);G(s.26)D.W.1P("7F",[c,s]);G(s.26&&!--D.4O)D.W.1P("7G")}I c},5H:H(s,a,b,e){G(s.3e)s.3e(a,b,e);G(s.26)D.W.1P("7D",[a,s,e])},4O:0,7j:H(a){1U{I!a.1u&&5Z.9O=="5p:"||(a.1u>=7e&&a.1u<9N)||a.1u==7c||a.1u==9K||D.14.2k&&a.1u==12}1V(e){}I Q},7h:H(a,c){1U{J b=a.5I("7g-5R");I a.1u==7c||b==D.4z[c]||D.14.2k&&a.1u==12}1V(e){}I Q}
12,6X:H(a,c,b){J d=a.5I("9J-O"),2N=c=="2N"||!c&&d&&d.1h("2N")>=0,L=2N?a.9I:a.4U;G(2N&&L.1C.2j=="5J")7p"5J";G(b)L=b(L,c);G(c=="1m")D.5u(L);G(c=="3z")L=6u("("+L+")");I L},3n:H(a){J s=[];G(a.1q==2p||a.5w)D.P(a,H(){s.1p(3u(7.34)+"="+3u(7.2x))});N R(J j 1n a)G(a[j]&&a[j].1q==2p)D.P(a[j],H(){s.1p(3u(j)+"="+3u(7))});N s.1p(3u(j)+"="+3u(D.1D(a[j])?a[j]():a[j]));I s.6s("&").1o(/%20/g,"+")}});D.17.1l({1N:H(c,b){I c?7.2g({1Z:"1N",2h:"1N",1y:"1N"},c,b):7.1E(":1G").P(H(){7.V.18=7.5D||"";G(D.1g(7,"18")=="2F"){J a=D("<"+7.2j+" />").6P("1c");7.V.18=a.1g("18");G(7.V.18=="2F")7.V.18="3I";a.21()}}).3l()},1M:H(b,a){I b?7.2g({1Z:"1M",2h:"1M",1y:"1M"},b,a):7.1E(":4j").P(H(){7.5D=7.5D||D.1g(7,"18");7.V.18="2F"}).3l()},78:D.17.2m,2m:H(a,b){I D.1D(a)&&D.1D(b)?7.78.1w(7,19):a?7.2g({1Z:"2m",2h:"2m",1y:"2m"},a,b):7.P(H(){D(7)[D(7).3F(":1G")?"1N":"1M"]()})},9G:H(b,a){I 7.2g({1Z:"1N"},b,a)},9F:H(b,a){I 7.2g({1Z:"1M"},b,a)},9E:H(b,a){I 7.2g({1Z:"2m"},b,a)},9D:H(b,a){I 7.2g({1y:"1N"},b,a)},9M:H(b,a){I 7.2g({1y:"1M"},b,a)},9C:H(c,a,b){I 7.2g({1y:a},c,b)},2g:H(k,j,i,g){J h=D.77(j,i,g);I 7[h.36===Q?"P":"36"](H(){G(7.16!=1)I Q;J f=D.1l({},h),p,1G=D(7).3F(":1G"),46=7;R(p 1n k){G(k[p]=="1M"&&1G||k[p]=="1N"&&!1G)I f.1J.1k(7);G(p=="1Z"||p=="2h"){f.18=D.1g(7,"18");f.33=7.V.33}}G(f.33!=U)7.V.33="1G";f.45=D.1l({},k);D.P(k,H(c,a){J e=2B D.28(46,f,c);G(/2m|1N|1M/.11(a))e[a=="2m"?1G?"1N":"1M":a](k);N{J b=a.6r().1I(/^([+-]=)?([\\d+-.]+)(.*)$/),2b=e.1t(M)||0;G(b){J d=3d(b[2]),2M=b[3]||"2X";G(2M!="2X"){46.V[c]=(d||1)+2M;2b=((d||1)/e.1t(M))*2b;46.V[c]=2b+2M}G(b[1])d=((b[1]=="-="?-1:1)*d)+2b;e.3G(2b,d,2M)}N e.3G(2b,a,"")}});I M})},36:H(a,b){G(D.1D(a)||(a&&a.1q==2p)){b=a;a="28"}G(!a||(1j a=="23"&&!b))I A(7[0],a);I 7.P(H(){G(b.1q==2p)A(7,a,b);N{A(7,a).1p(b);G(A(7,a).K==1)b.1k(7)}})},9X:H(b,c){J a=D.3O;G(b)7.36([]);7.P(H(){R(J i=a.K-1;i>=0;i--)G(a[i].T==7){G(c)a[i](M);a.7n(i,1)}});G(!c)7.5A();I 7}});J A=H(b,c,a){G(b){c=c||"28";J q=D.L(b,c+"36");G(!q||a)q=D.L(b,c+"36",D.2d(a))}I q};D.17.5A=H(a){a=a||"28";I 7.P(H(){J q=A(7,a);q.4s();G(q.K)q[0].1k(7)})};D.1l({77:H(b,a,c){J d=b&&b.1q==a0?b:{1J:c||!c&&a||D.1D(b)&&b,2u:b,41:c&&a||a&&a.1q!=9t&&a};d.2u=(d.2u&&d.2u.1q==4L?d.2u:D.28.5K[d.2u])||D.28.5K.74;d.5M=d.1J;d.1J=H(){G(d.36!==Q)D(7).5A();G(D.1D(d.5M))d.5M.1k(7)};I d},41:{73:H(p,n,b,a){I b+a*p},5P:H(p,n,b,a){I((-29.9r(p*29.9q)/2)+0.5)*a+b}},3O:[],48:U,28:H(b,c,a){7.15=c;7.T=b;7.1i=a;G(!c.3Z)c.3Z={}}});D.28.44={4D:H(){G(7.15.2Y)7.15.2Y.1k(7.T,7.1z,7);(D.28.2Y[7.1i]||D.28.2Y.4w)(7);G(7.1i=="1Z"||7.1i=="2h")7.T.V.18="3I"},1t:H(a){G(7.T[7.1i]!=U&&7.T.V[7.1i]==U)I 7.T[7.1i];J r=3d(D.1g(7.T,7.1i,a));I r&&r>-9p?r:3d(D.2a(7.T,7.1i))||0},3G:H(c,b,d){7.5V=1z();7.2b=c;7.3l=b;7.2M=d||7.2M||"2X";7.1z=7.2b;7.2S=7.4N=0;7.4D();J e=7;H t(a){I e.2Y(a)}t.T=7.T;D.3O.1p(t);G(D.48==U){D.48=4I(H(){J a=D.3O;R(J i=0;i<a.K;i++)G(!a[i]())a.7n(i--,1);G(!a.K){7k(D.48);D.48=U}},13)}},1N:H(){7.15.3Z[7.1i]=D.1K(7.T.V,7.1i);7.15.1N=M;7.3G(0,7.1t());G(7.1i=="2h"||7.1i=="1Z")7.T.V[7.1i]="9m";D(7.T).1N()},1M:H(){7.15.3Z[7.1i]=D.1K(7.T.V,7.1i);7.15.1M=M;7.3G(7.1t(),0)},2Y:H(a){J t=1z();G(a||t>7.15.2u+7.5V){7.1z=7.3l;7.2S=7.4N=1;7.4D();7.15.45[7.1i]=M;J b=M;R(J i 1n 7.15.45)G(7.15.45[i]!==M)b=Q;G(b){G(7.15.18!=U){7.T.V.33=7.15.33;7.T.V.18=7.15.18;G(D.1g(7.T,"18")=="2F")7.T.V.18="3I"}G(7.15.1M)7.T.V.18="2F";G(7.15.1M||7.15.1N)R(J p 1n 7.15.45)D.1K(7.T.V,p,7.15.3Z[p])}G(b)7.15.1J.1k(7.T);I Q}N{J n=t-7.5V;7.4N=n/7.15.2u;7.2S=D.41[7.15.41||(D.41.5P?"5P":"73")](7.4N,n,0,1,7.15.2u);7.1z=7.2b+((7.3l-7.2b)*7.2S);7.4D()}I M}};D.1l(D.28,{5K:{9l:9j,9i:7e,74:9g},2Y:{2e:H(a){a.T.2e=a.1z},2c:H(a){a.T.2c=a.1z},1y:H(a){D.1K(a.T.V,"1y",a.1z)},4w:H(a){a.T.V[a.1i]=a.1z+a.2M}}});D.17.2i=H(){J b=0,1S=0,T=7[0],3q;G(T)ao(D.14){J d=T.1d,4a=T,1s=T.1s,1Q=T.2z,5U=2k&&3r(5B)<9c&&!/9a/i.11(v),1g=D.2a,3c=1g(T,"30")=="3c";G(T.7y){J c=T.7y();1e(c.1A+29.2f(1Q.1C.2e,1Q.1c.2e),c.1S+29.2f(1Q.1C.2c,1Q.1c.2c));1e(-1Q.1C.6b,-1Q.1C.6a)}N{1e(T.5X,T.5W);1B(1s){1e(1s.5X,1s.5W);G(42&&!/^t(98|d|h)$/i.11(1s.2j)||2k&&!5U)2C(1s);G(!3c&&1g(1s,"30")=="3c")3c=M;4a=/^1c$/i.11(1s.2j)?4a:1s;1s=1s.1s}1B(d&&d.2j&&!/^1c|2K$/i.11(d.2j)){G(!/^96|1T.*$/i.11(1g(d,"18")))1e(-d.2e,-d.2c);G(42&&1g(d,"33")!="4j")2C(d);d=d.1d}G((5U&&(3c||1g(4a,"30")=="5x"))||(42&&1g(4a,"30")!="5x"))1e(-1Q.1c.5X,-1Q.1c.5W);G(3c)1e(29.2f(1Q.1C.2e,1Q.1c.2e),29.2f(1Q.1C.2c,1Q.1c.2c))}3q={1S:1S,1A:b}}H 2C(a){1e(D.2a(a,"6V",M),D.2a(a,"6U",M))}H 1e(l,t){b+=3r(l,10)||0;1S+=3r(t,10)||0}I 3q};D.17.1l({30:H(){J a=0,1S=0,3q;G(7[0]){J b=7.1s(),2i=7.2i(),4c=/^1c|2K$/i.11(b[0].2j)?{1S:0,1A:0}:b.2i();2i.1S-=25(7,\'94\');2i.1A-=25(7,\'aF\');4c.1S+=25(b,\'6U\');4c.1A+=25(b,\'6V\');3q={1S:2i.1S-4c.1S,1A:2i.1A-4c.1A}}I 3q},1s:H(){J a=7[0].1s;1B(a&&(!/^1c|2K$/i.11(a.2j)&&D.1g(a,\'30\')==\'93\'))a=a.1s;I D(a)}});D.P([\'5e\',\'5G\'],H(i,b){J c=\'4y\'+b;D.17[c]=H(a){G(!7[0])I;I a!=12?7.P(H(){7==1b||7==S?1b.92(!i?a:D(1b).2e(),i?a:D(1b).2c()):7[c]=a}):7[0]==1b||7[0]==S?46[i?\'aI\':\'aJ\']||D.71&&S.1C[c]||S.1c[c]:7[0][c]}});D.P(["6N","4b"],H(i,b){J c=i?"5e":"5G",4f=i?"6k":"6i";D.17["5s"+b]=H(){I 7[b.3y()]()+25(7,"57"+c)+25(7,"57"+4f)};D.17["90"+b]=H(a){I 7["5s"+b]()+25(7,"2C"+c+"4b")+25(7,"2C"+4f+"4b")+(a?25(7,"6S"+c)+25(7,"6S"+4f):0)}})})();',62,669,'|||||||this|||||||||||||||||||||||||||||||||||if|function|return|var|length|data|true|else|type|each|false|for|document|elem|null|style|event||nodeName|||test|undefined||browser|options|nodeType|fn|display|arguments|url|window|body|parentNode|add|msie|css|indexOf|prop|typeof|call|extend|script|in|replace|push|constructor|text|offsetParent|cur|status|div|apply|firstChild|opacity|now|left|while|documentElement|isFunction|filter|className|hidden|handle|match|complete|attr|ret|hide|show|dataType|trigger|doc|split|top|table|try|catch|success|break|cache|height||remove|tbody|string|guid|num|global|ready|fx|Math|curCSS|start|scrollTop|makeArray|scrollLeft|max|animate|width|offset|tagName|safari|map|toggle||done|Array|find|toUpperCase|button|special|duration|id|copy|value|handler|ownerDocument|select|new|border|exec|stack|
12none|opera|nextSibling|pushStack|target|html|inArray|unit|xml|bind|GET|isReady|merge|pos|timeout|delete|one|selected|px|step|jsre|position|async|preventDefault|overflow|name|which|queue|removeChild|namespace|insertBefore|nth|removeData|fixed|parseFloat|error|readyState|multiFilter|createElement|rl|re|trim|end|_|param|first|get|results|parseInt|slice|childNodes|encodeURIComponent|append|events|elems|toLowerCase|json|readyList|setTimeout|grep|mouseenter|color|is|custom|getElementsByTagName|block|stopPropagation|addEventListener|callee|proxy|mouseleave|timers|defaultView|password|disabled|last|has|appendChild|form|domManip|props|ajax|orig|set|easing|mozilla|load|prototype|curAnim|self|charCode|timerId|object|offsetChild|Width|parentOffset|src|unbind|br|currentStyle|clean|float|visible|relatedTarget|previousSibling|handlers|isXMLDoc|on|setup|nodeIndex|unique|shift|javascript|child|RegExp|_default|deep|scroll|lastModified|teardown|setRequestHeader|timeStamp|update|empty|tr|getAttribute|innerHTML|setInterval|checked|fromElement|Number|jQuery|state|active|jsonp|accepts|application|dir|input|responseText|click|styleSheets|unload|not|lastToggle|outline|mouseout|getPropertyValue|mouseover|getComputedStyle|bindReady|String|padding|pageX|metaKey|keyCode|getWH|andSelf|clientX|Left|all|visibility|container|index|init|triggered|removeAttribute|classFilter|prevObject|submit|file|after|windowData|inner|client|globalEval|sibling|jquery|absolute|clone|wrapAll|dequeue|version|triggerHandler|oldblock|ctrlKey|createTextNode|Top|handleError|getResponseHeader|parsererror|speeds|checkbox|old|00|radio|swing|href|Modified|ifModified|lastChild|safari2|startTime|offsetTop|offsetLeft|username|location|ajaxSettings|getElementById|isSimple|values|selectedIndex|runtimeStyle|rsLeft|_load|loaded|DOMContentLoaded|clientTop|clientLeft|toElement|srcElement|val|pageY|POST|unshift|Bottom|clientY|Right|fix|exclusive|detachEvent|cloneNode|removeEventListener|swap|toString|join|attachEvent|eval|substr|head|parse|textarea|reset|image|zoom|odd|even|before|prepend|exclude|expr|quickClass|quickID|uuid|quickChild|continue|Height|textContent|appendTo|contents|open|margin|evalScript|borderTopWidth|borderLeftWidth|parent|httpData|setArray|CSS1Compat|compatMode|boxModel|cssFloat|linear|def|webkit|nodeValue|speed|_toggle|eq|100|replaceWith|304|concat|200|alpha|Last|httpNotModified|getAttributeNode|httpSuccess|clearInterval|abort|beforeSend|splice|styleFloat|throw|colgroup|XMLHttpRequest|ActiveXObject|scriptCharset|callback|fieldset|multiple|processData|getBoundingClientRect|contentType|link|ajaxSend|ajaxSuccess|ajaxError|col|ajaxComplete|ajaxStop|ajaxStart|serializeArray|notmodified|keypress|keydown|change|mouseup|mousedown|dblclick|focus|blur|stylesheet|hasClass|rel|doScroll|black|hover|solid|cancelBubble|returnValue|wheelDelta|view|round|shiftKey|resize|screenY|screenX|relatedNode|mousemove|prevValue|originalTarget|offsetHeight|keyup|newValue|offsetWidth|eventPhase|detail|currentTarget|cancelable|bubbles|attrName|attrChange|altKey|originalEvent|charAt|0n|substring|animated|header|noConflict|line|enabled|innerText|contains|only|weight|font|gt|lt|uFFFF|u0128|size|417|Boolean|Date|toggleClass|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|wrap|contentWindow|contentDocument|iframe|children|siblings|prevAll|wrapInner|nextAll|outer|prev|scrollTo|static|marginTop|next|inline|parents|able|cellSpacing|adobeair|cellspacing|522|maxLength|maxlength|readOnly|400|readonly|fast|600|class|slow|1px|htmlFor|reverse|10000|PI|cos|compatible|Function|setData|ie|ra|it|rv|getData|userAgent|navigator|fadeTo|fadeIn|slideToggle|slideUp|slideDown|ig|responseXML|content|1223|NaN|fadeOut|300|protocol|send|setAttribute|option|dataFilter|cssText|changed|be|Accept|stop|With|Requested|Object|can|GMT|property|1970|Jan|01|Thu|Since|If|Type|Content|XMLHTTP|th|Microsoft|td|onreadystatechange|onload|cap|charset|colg|host|tfoot|specified|with|1_|thead|leg|plain|attributes|opt|embed|urlencoded|www|area|hr|ajaxSetup|meta|post|getJSON|getScript|marginLeft|img|elements|pageYOffset|pageXOffset|abbr|seri
12alize|pixelLeft'.split('|'),0,{})); 13/** 14 * For jQuery versions less than 3.4.0, this replaces the jQuery.extend 15 * function with the one from jQuery 3.4.0, slightly modified (documented 16 * below) to be compatible with older jQuery versions and browsers. 17 * 18 * This provides the Object.prototype pollution vulnerability fix to Drupal 19 * installations running older jQuery versions, including the versions shipped 20 * with Drupal core and https://www.drupal.org/project/jquery_update. 21 * 22 * @see https://github.com/jquery/jquery/pull/4333 23 */ 24 25(function (jQuery) { 26 27// Do not override jQuery.extend() if the jQuery version is already >=3.4.0. 28var versionParts = jQuery.fn.jquery.split('.'); 29var majorVersion = parseInt(versionParts[0]); 30var minorVersion = parseInt(versionParts[1]); 31var patchVersion = parseInt(versionParts[2]); 32var isPreReleaseVersion = (patchVersion.toString() !== versionParts[2]); 33if ( 34 (majorVersion > 3) || 35 (majorVersion === 3 && minorVersion > 4) || 36 (majorVersion === 3 && minorVersion === 4 && patchVersion > 0) || 37 (majorVersion === 3 && minorVersion === 4 && patchVersion === 0 && !isPreReleaseVersion) 38) { 39 return; 40} 41 42/** 43 * This adds some funtions from jQuery 1.4.4 (the default version used in 44 * Drupal 7) for when they aren't present, like when using jQuery 1.2.6 (the 45 * default version used in Drupal 6). 46 */ 47 48if (typeof jQuery.type === 'undefined') { 49 var toString = Object.prototype.toString, 50 class2type = {}; 51 52 // Populate the class2type map 53 jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { 54 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 55 }); 56 57 jQuery.type = function (obj) { 58 return obj == null ? 59 String( obj ) : 60 class2type[ toString.call(obj) ] || "object"; 61 }; 62} 63 64if (typeof jQuery.isArray === 'undefined') { 65 jQuery.isArray = function (obj) { 66 return jQuery.type(obj) === "array"; 67 }; 68} 69 70if (typeof jQuery.isWindow === 'undefined') { 71 jQuery.isWindow = function (obj) { 72 return obj && typeof obj === "object" && "setInterval" in obj; 73 }; 74} 75 76if (typeof jQuery.isPlainObject === 'undefined') { 77 var hasOwn = Object.prototype.hasOwnProperty; 78 79 jQuery.isPlainObject = function (obj) { 80 // Must be an Object. 81 // Because of IE, we also have to check the presence of the constructor property. 82 // Make sure that DOM nodes and window objects don't pass through, as well 83 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { 84 return false; 85 } 86 87 // Not own constructor property must be Object 88 if ( obj.constructor && 89 !hasOwn.call(obj, "constructor") && 90 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { 91 return false; 92 } 93 94 // Own properties are enumerated firstly, so to speed up, 95 // if last one is own, then all properties are own. 96 97 var key; 98 for ( key in obj ) {} 99 100 return key === undefined || hasOwn.call( obj, key ); 101 }; 102} 103 104/** 105 * This is almost verbatim copied from jQuery 3.4.0. 106 * 107 * Only two minor changes have been made: 108 * - The call to isFunction() is changed to jQuery.isFunction(). 109 * - The two calls to Array.isArray() is changed to jQuery.isArray(). 110 * 111 * The above two changes ensure compatibility with all older jQuery versions 112 * (1.2.6 - 3.3.1) and older browser versions (e.g., IE8). 113 */ 114jQuery.extend = jQuery.fn.extend = function() { 115 var options, name, src, copy, copyIsArray, clone, 116 target = arguments[ 0 ] || {}, 117 i = 1, 118 length = arguments.length, 119 deep = false; 120 121 // Handle a deep copy situation 122 if ( typeof target === "boolean" ) { 123 deep = target; 124 125 // Skip the boolean and the target 126 target = arguments[ i ] || {}; 127 i++; 128 } 129 130 // Handle case when target is a string or something (possible in deep copy) 131 if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { 132 target = {}; 133 } 134 135 // Extend jQuery itself if only one argument is passed 136 if ( i === length ) { 137 target = this; 138 i--; 139 } 140 141 for ( ; i < length; i++ ) { 142 143 // Only deal with non-null/undefined values 144 if ( ( options = arguments[ i ] ) != null ) { 145 146 // Extend the base object 147 for ( name in options ) { 148 copy = options[ name ]; 149 150 // Prevent Object.prototype pollution 151 // Prevent never-ending loop
152 if ( name === "__proto__" || target === copy ) { 153 continue; 154 } 155 156 // Recurse if we're merging plain objects or arrays 157 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 158 ( copyIsArray = jQuery.isArray( copy ) ) ) ) { 159 src = target[ name ]; 160 161 // Ensure proper type for the source value 162 if ( copyIsArray && !jQuery.isArray( src ) ) { 163 clone = []; 164 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 165 clone = {}; 166 } else { 167 clone = src; 168 } 169 copyIsArray = false; 170 171 // Never move original objects, clone them 172 target[ name ] = jQuery.extend( deep, clone, copy ); 173 174 // Don't bring in undefined values 175 } else if ( copy !== undefined ) { 176 target[ name ] = copy; 177 } 178 } 179 } 180 } 181 182 // Return the modified object 183 return target; 184}; 185 186})(jQuery); 187; 188/** 189 * For jQuery versions less than 3.5.0, this replaces the jQuery.htmlPrefilter() 190 * function with one that fixes these security vulnerabilities while also 191 * retaining the pre-3.5.0 behavior where it's safe to do so. 192 * - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-11022 193 * - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-11023 194 * 195 * Additionally, for jQuery versions that do not have a jQuery.htmlPrefilter() 196 * function (1.x prior to 1.12 and 2.x prior to 2.2), this adds it, and 197 * extends the functions that need to call it to do so. 198 * 199 * Drupal core's jQuery version is 1.4.4, but jQuery Update can provide a 200 * different version, so this covers all versions between 1.4.4 and 3.4.1. 201 * The GitHub links in the code comments below link to jQuery 1.5 code, because 202 * 1.4.4 isn't on GitHub, but the referenced code didn't change from 1.4.4 to 203 * 1.5. 204 */ 205 206(function (jQuery) { 207 208 // Parts of this backport differ by jQuery version. 209 var versionParts = jQuery.fn.jquery.split('.'); 210 var majorVersion = parseInt(versionParts[0]); 211 var minorVersion = parseInt(versionParts[1]); 212 213 // No backport is needed if we're already on jQuery 3.5 or higher. 214 if ( (majorVersion > 3) || (majorVersion === 3 && minorVersion >= 5) ) { 215 return; 216 } 217 218 // Prior to jQuery 3.5, jQuery converted XHTML-style self-closing tags to 219 // their XML equivalent: e.g., "<div />" to "<div></div>". This is 220 // problematic for several reasons, including that it's vulnerable to XSS 221 // attacks. However, since this was jQuery's behavior for many years, many 222 // Drupal modules and jQuery plugins may be relying on it. Therefore, we 223 // preserve that behavior, but for a limited set of tags only, that we believe 224 // to not be vulnerable. This is the set of HTML tags that satisfy all of the 225 // following conditions: 226 // - In DOMPurify's list of HTML tags. If an HTML tag isn't safe enough to 227 // appear in that list, then we don't want to mess with it here either. 228 // @see https://github.com/cure53/DOMPurify/blob/2.0.11/dist/purify.js#L128 229 // - A normal element (not a void, template, text, or foreign element). 230 // @see https://html.spec.whatwg.org/multipage/syntax.html#elements-2 231 // - An element that is still defined by the current HTML specification 232 // (not a deprecated element), because we do not want to rely on how 233 // browsers parse deprecated elements. 234 // @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element 235 // - Not 'html', 'head', or 'body', because this pseudo-XHTML expansion is 236 // designed for fragments, not entire documents. 237 // - Not 'colgroup', because due to an idiosyncrasy of jQuery's original 238 // regular expression, it didn't match on colgroup, and we don't want to 239 // introduce a behavior change for that. 240 var selfClosingTagsToReplace = [ 241 'a', 'abbr', 'address', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 242 'blockquote', 'button', 'canvas', 'caption', 'cite', 'code', 'data', 243 'datalist', 'dd', 'del', 'details', 'dfn', 'div', 'dl', 'dt', 'em', 244 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 245 'h4', 'h5', 'h6', 'header', 'hgroup', 'i', 'ins', 'kbd', 'label', 'legend', 246 'li', 'main', 'map', 'mark', 'menu', 'meter', 'nav', 'ol', 'optgroup', 247 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 248 'ruby', 's', 'samp', 'section', 'select', 'small', 'source', 'span', 249 'strong', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 250 'thead', 'time', 'tr', 'u', 'ul', 'var', 'video' 251 ]; 252 253 // Define regular expressions for <TAG/> and <TAG ATTRIBUTES/>. Doing this as 254 // two expressions makes it easier to target <a/> without also targeting 255 // every tag that starts with "a". 256 var xhtmlRegExpGroup = '(' + selfClosingTagsToReplace.join('|') + ')'; 257 var whitespace = '[\\x20\\t\\r\\n\\f]'; 258 var rxhtmlTagWithoutSpaceOrAttributes = new RegExp('<' + xhtmlRegExpGroup + '\\/>', 'gi'); 259 var rxhtmlTagWithSpaceAndMaybeAttributes = new RegExp('<' + xhtmlRegExpGroup + '(' + whitespace + '[^>]*)\\/>', 'gi'); 260 261 // jQuery 3.5 also fixed a vulnerability for when </select> appears within 262 // an <option> or <optgroup>, but it did that in local code that we can't 263 // backport directly. Instead, we filter such cases out. To do so, we need to 264 // determine when jQuery would otherwise invoke the vulnerable code, which it 265 // uses this regular expression to determine. The regular expression changed 266 // for version 3.0.0 and changed again for 3.4.0. 267 // @see https://github.com/jquery/jquery/blob/1.5/jquery.js#L4958 268 // @see https://github.com/jquery/jquery/blob/3.0.0/dist/jquery.js#L4584 269 // @see https://github.com/jquery/jquery/blob/3.4.0/dist/jquery.js#L4712 270 var rtagName; 271 if (majorVersion < 3) { 272 rtagName = /<([\w:]+)/; 273 } 274 else if (minorVersion < 4) { 275 rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i; 276 } 277 else { 278 rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i; 279 } 280 281 // The regular expression that jQuery uses to determine which self-closing 282 // tags to expand to open and close tags. This is vulnerable, because it 283 // matches all tag names except the few excluded ones. We only use this 284 // expression for determining vulnerability. The expression changed for 285 // version 3, but we only need to check for vulnerability in versions 1 and 2, 286 // so we use the expression from those versions. 287 // @see https://github.com/jquery/jquery/blob/1.5/jquery.js#L4957 288 var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi; 289 290 jQuery.extend({ 291 htmlPrefilter: function (html) { 292 // This is how jQuery determines the first tag in the HTML. 293 // @see https://github.com/jquery/jquery/blob/1.5/jquery.js#L5521 294 var tag = ( rtagName.exec( html ) || [ "", "" ] )[ 1 ].toLowerCase(); 295
296 // It is not valid HTML for <option> or <optgroup> to have <select> as 297 // either a descendant or sibling, and attempts to inject one can cause 298 // XSS on jQuery versions before 3.5. Since this is invalid HTML and a 299 // possible XSS attack, reject the entire string. 300 // @see https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-11023 301 if ((tag === 'option' || tag === 'optgroup') && html.match(/<\/?select/i)) { 302 html = ''; 303 } 304 305 // Retain jQuery's prior to 3.5 conversion of pseudo-XHTML, but for only 306 // the tags in the `selfClosingTagsToReplace` list defined above. 307 // @see https://github.com/jquery/jquery/blob/1.5/jquery.js#L5518 308 // @see https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-11022 309 html = html.replace(rxhtmlTagWithoutSpaceOrAttributes, "<$1></$1>"); 310 html = html.replace(rxhtmlTagWithSpaceAndMaybeAttributes, "<$1$2></$1>"); 311 312 // Prior to jQuery 1.12 and 2.2, this function gets called (via code later 313 // in this file) in addition to, rather than instead of, the unsafe 314 // expansion of self-closing tags (including ones not in the list above). 315 // We can't prevent that unsafe expansion from running, so instead we 316 // check to make sure that it doesn't affect the DOM returned by the 317 // browser's parsing logic. If it does affect it, then it's vulnerable to 318 // XSS, so we reject the entire string. 319 if ( (majorVersion === 1 && minorVersion < 12) || (majorVersion === 2 && minorVersion < 2) ) { 320 var htmlRisky = html.replace(rxhtmlTag, "<$1></$2>"); 321 if (htmlRisky !== html) { 322 // Even though htmlRisky and html are different strings, they might 323 // represent the same HTML structure once parsed, in which case, 324 // htmlRisky is actually safe. We can ask the browser to parse both 325 // to find out, but the browser can't parse table fragments (e.g., a 326 // root-level "<td>"), so we need to wrap them. We just need this 327 // technique to work on all supported browsers; we don't need to 328 // copy from the specific jQuery version we're using. 329 // @see https://github.com/jquery/jquery/blob/3.5.1/dist/jquery.js#L4939 330 var wrapMap = { 331 thead: [ 1, "<table>", "</table>" ], 332 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 333 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 334 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 335 }; 336 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 337 wrapMap.th = wrapMap.td; 338 339 // Function to wrap HTML into something that a browser can parse. 340 // @see https://github.com/jquery/jquery/blob/3.5.1/dist/jquery.js#L5032 341 var getWrappedHtml = function (html) { 342 var wrap = wrapMap[tag]; 343 if (wrap) { 344 html = wrap[1] + html + wrap[2]; 345 } 346 return html; 347 }; 348 349 // Function to return canonical HTML after parsing it. This parses 350 // only; it doesn't execute scripts. 351 // @see https://github.com/jquery/jquery-migrate/blob/3.3.0/src/jquery/manipulation.js#L5 352 var getParsedHtml = function (html) { 353 var doc = window.document.implementation.createHTMLDocument( "" ); 354 doc.body.innerHTML = html; 355 return doc.body ? doc.body.innerHTML : ''; 356 }; 357 358 // If the browser couldn't parse either one successfully, or if 359 // htmlRisky parses differently than html, then html is vulnerable, 360 // so reject it. 361 var htmlParsed = getParsedHtml(getWrappedHtml(html)); 362 var htmlRiskyParsed = getParsedHtml(getWrappedHtml(htmlRisky)); 363 if (htmlRiskyParsed === '' || htmlParsed === '' || (htmlRiskyParsed !== htmlParsed)) { 364 html = ''; 365 } 366 } 367 } 368 369 return html; 370 } 371 }); 372 373 // Prior to jQuery 1.12 and 2.2, jQuery.clean(), jQuery.buildFragment(), and 374 // jQuery.fn.html() did not call jQuery.htmlPrefilter(), so we add that. 375 if ( (majorVersion === 1 && minorVersion < 12) || (majorVersion === 2 && minorVersion < 2) ) { 376 // Filter the HTML coming into jQuery.fn.html(). 377 var fnOriginalHtml = jQuery.fn.html; 378 jQuery.fn.extend({ 379 // @see https://github.com/jquery/jquery/blob/1.5/jquery.js#L5147 380 html: function (value) { 381 if (typeof value === "string") { 382 value = jQuery.htmlPrefilter(value); 383 } 384 // .html() can be called as a setter (with an argument) or as a getter 385 // (without an argument), so invoke fnOriginalHtml() the same way that 386 // we were invoked. 387 return fnOriginalHtml.apply(this, arguments.length ? [value] : []); 388 } 389 }); 390 391 // The regular expression that jQuery uses to determine if a string is HTML. 392 // Used by both clean() and buildFragment(). 393 // @see https://github.com/jquery/jquery/blob/1.5/jquery.js#L4960
394 var rhtml = /<|&#?\w+;/; 395 396 // Filter HTML coming into: 397 // - jQuery.clean() for versions prior to 1.9. 398 // - jQuery.buildFragment() for 1.9 and above. 399 // 400 // The looping constructs in the two functions might be essentially 401 // identical, but they're each expressed here in the way that most closely 402 // matches their original expression in jQuery, so that we filter all of 403 // the items and only the items that jQuery will treat as HTML strings. 404 if (majorVersion === 1 && minorVersion < 9) { 405 var originalClean = jQuery.clean; 406 jQuery.extend({ 407 // @see https://github.com/jquery/jquery/blob/1.5/jquery.js#L5493 408 'clean': function (elems, context, fragment, scripts) { 409 for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { 410 if ( typeof elem === "string" && rhtml.test( elem ) ) { 411 elems[i] = elem = jQuery.htmlPrefilter(elem); 412 } 413 } 414 return originalClean.call(this, elems, context, fragment, scripts); 415 } 416 }); 417 } 418 else { 419 var originalBuildFragment = jQuery.buildFragment; 420 jQuery.extend({ 421 // @see https://github.com/jquery/jquery/blob/1.9.0/jquery.js#L6419 422 'buildFragment': function (elems, context, scripts, selection) { 423 var l = elems.length; 424 for ( var i = 0; i < l; i++ ) { 425 var elem = elems[i]; 426 if (elem || elem === 0) { 427 if ( jQuery.type( elem ) !== "object" && rhtml.test( elem ) ) { 428 elems[i] = elem = jQuery.htmlPrefilter(elem); 429 } 430 } 431 } 432 return originalBuildFragment.call(this, elems, context, scripts, selection); 433 } 434 }); 435 } 436 } 437 438})(jQuery); 439; 440 441/** 442 * Override jQuery.fn.init to guard against XSS attacks. 443 * 444 * See http://bugs.jquery.com/ticket/9521 445 */ 446(function () { 447 var jquery_init = jQuery.fn.init; 448 jQuery.fn.init = function (selector, context, rootjQuery) { 449 // If the string contains a "#" before a "<", treat it as invalid HTML. 450 if (selector && typeof selector === 'string') { 451 var hash_position = selector.indexOf('#'); 452 if (hash_position >= 0) { 453 var bracket_position = selector.indexOf('<'); 454 if (bracket_position > hash_position) { 455 throw 'Syntax error, unrecognized expression: ' + selector; 456 } 457 } 458 } 459 return jquery_init.call(this, selector, context, rootjQuery); 460 }; 461 jQuery.fn.init.prototype = jquery_init.prototype; 462 463 /** 464 * Pre-filter Ajax requests to guard against XSS attacks. 465 * 466 * See https://github.com/jquery/jquery/issues/2432 467 */ 468 if ($.ajaxPrefilter) { 469 // For newer versions of jQuery, use an Ajax prefilter to prevent 470 // auto-executing script tags from untrusted domains. This is similar to the 471 // fix that is built in to jQuery 3.0 and higher. 472 $.ajaxPrefilter(function (s) { 473 if (s.crossDomain) { 474 s.contents.script = false; 475 } 476 }); 477 } 478 else if ($.httpData) { 479 // For the version of jQuery that ships with Drupal core, override 480 // jQuery.httpData to prevent auto-detecting "script" data types from 481 // untrusted domains. 482 var jquery_httpData = $.httpData; 483 $.httpData = function (xhr, type, s) { 484 // @todo Consider backporting code from newer jQuery versions to check for 485 // a cross-domain request here, rather than using Drupal.urlIsLocal() to 486 // block scripts from all URLs that are not on the same site. 487 if (!type && (!s || !Drupal.urlIsLocal(s.url))) { 488 var content_type = xhr.getResponseHeader('content-type') || ''; 489 if (content_type.indexOf('javascript') >= 0) { 490 // Default to a safe data type. 491 type = 'text'; 492 } 493 } 494 return jquery_httpData.call(this, xhr, type, s); 495 }; 496 $.httpData.prototype = jquery_httpData.prototype; 497 } 498})(); 499 500var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'themes': {}, 'locale': {} }; 501 502/** 503 * Set the variable that indicates if JavaScript behaviors should be applied 504 */ 505Drupal.jsEnabled = true; 506 507/** 508 * Attach all registered behaviors to a page element. 509 * 510 * Behaviors are event-triggered actions that attach to page elements, enhancing 511 * default non-Javascript UIs. Behaviors are registered in the Drupal.behaviors 512 * object as follows: 513 * @code 514 * Drupal.behaviors.behaviorName = function () { 515 * ... 516 * }; 517 * @endcode 518 * 519 * Drupal.attachBehaviors is added below to the jQuery ready event and so 520 * runs on initial page load. Developers implementing AHAH/AJAX in their 521 * solutions should also call this function after new page content has been 522 * loaded, feeding in an element to be processed, in order to attach all 523 * behaviors to the new content. 524 * 525 * Behaviors should use a class in the form behaviorName-processed to ensure 526 * the behavior is attached only once to a given element. (Doing so enables 527 * the reprocessing of given elements, which may be needed on occasion despite 528 * the ability to limit behavior attachment to a particular element.) 529 * 530 * @param context 531 * An element to attach behaviors to. If none is given, the document element 532 * is used. 533 */ 534Drupal.attachBehaviors = function(context) { 535 context = context || document; 536 // Execute all of them. 537 jQuery.each(Drupal.behaviors, function() { 538 this(context); 539 }); 540}; 541 542/** 543 * Encode special characters in a plain-text string for display as HTML. 544 */ 545Drupal.checkPlain = function(str) { 546 str = String(str); 547 var replace = { '&': '&', "'": ''', '"': '"', '<': '<', '>': '>' }; 548 for (var character in replace) { 549 var regex = new RegExp(character, 'g'); 550 str = str.replace(regex, replace[character]); 551 } 552 return str; 553}; 554 555/** 556 * Translate strings to the page language or a given language. 557 * 558 * See the documentation of the server-side t() function for further details. 559 * 560 * @param str 561 * A string containing the English string to translate. 562 * @param args 563 * An object of replacements pairs to make after translation. Incidences 564 * of any key in this array are replaced with the corresponding value. 565 * Based on the first character of the key, the value is escaped and/or themed: 566 * - !variable: inserted as is 567 * - @variable: escape plain text to HTML (Drupal.checkPlain) 568 * - %variable: escape text and theme as a placeholder for user-submitted 569 * content (checkPlain + Drupal.theme('placeholder')) 570 * @return 571 * The translated string. 572 */ 573Drupal.t = function(str, args) { 574 // Fetch the localized version of the string. 575 if (Drupal.locale.strings && Drupal.locale.strings[str]) { 576 str = Drupal.locale.strings[str]; 577 } 578 579 if (args) { 580 // Transform arguments before inserting them 581 for (var key in args) { 582 switch (key.charAt(0)) { 583 // Escaped only 584 case '@': 585 args[key] = Drupal.checkPlain(args[key]); 586 break; 587 // Pass-through 588 case '!': 589 break; 590 // Escaped and placeholder 591 case '%': 592 default: 593 args[key] = Drupal.theme('placeholder', args[key]); 594 break; 595 } 596 str = str.replace(key, args[key]); 597 } 598 } 599 return str; 600}; 601 602/** 603 * Format a string containing a count of items. 604 * 605 * This function ensures that the string is pluralized correctly. Since Drupal.t() is 606 * called by this function, make sure not to pass already-localized strings to it. 607 * 608 * See the documentation of the server-side format_plural() function for further details. 609 * 610 * @param count 611 * The item count to display. 612 * @param singular 613 * The string for the singular case. Please make sure it is clear this is 614 * singular, to ease translation (e.g. use "1 new comment" instead of "1 new"). 615 * Do not use @count in the singular string. 616 * @param plural 617 * The string for the plural case. Please make sure it is clear this is plural, 618 * to ease translation. Use @count in place of the item count, as in "@count 619 * new comments". 620 * @param args 621 * An object of replacements pairs to make after translation. Incidences 622 * of any key in this array are replaced with the corresponding value. 623 * Based on the first character of the key, the value is escaped and/or themed: 624 * - !variable: inserted as is 625 * - @variable: escape plain text to HTML (Drupal.checkPlain) 626 * - %variable: escape text and theme as a placeholder for user-submitted 627 * content (checkPlain + Drupal.theme('placeholder')) 628 * Note that you do not need to include @count in this array.
629 * This replacement is done automatically for the plural case. 630 * @return 631 * A translated string. 632 */ 633Drupal.formatPlural = function(count, singular, plural, args) { 634 var args = args || {}; 635 args['@count'] = count; 636 // Determine the index of the plural form. 637 var index = Drupal.locale.pluralFormula ? Drupal.locale.pluralFormula(args['@count']) : ((args['@count'] == 1) ? 0 : 1); 638 639 if (index == 0) { 640 return Drupal.t(singular, args); 641 } 642 else if (index == 1) { 643 return Drupal.t(plural, args); 644 } 645 else { 646 args['@count['+ index +']'] = args['@count']; 647 delete args['@count']; 648 return Drupal.t(plural.replace('@count', '@count['+ index +']'), args); 649 } 650}; 651 652/** 653 * Returns the passed in URL as an absolute URL. 654 * 655 * @param url 656 * The URL string to be normalized to an absolute URL. 657 * 658 * @return 659 * The normalized, absolute URL. 660 * 661 * @see https://github.com/angular/angular.js/blob/v1.4.4/src/ng/urlUtils.js 662 * @see https://grack.com/blog/2009/11/17/absolutizing-url-in-javascript 663 * @see https://github.com/jquery/jquery-ui/blob/1.11.4/ui/tabs.js#L53 664 */ 665Drupal.absoluteUrl = function (url) { 666 var urlParsingNode = document.createElement('a'); 667 668 // Decode the URL first; this is required by IE <= 6. Decoding non-UTF-8 669 // strings may throw an exception. 670 try { 671 url = decodeURIComponent(url); 672 } catch (e) {} 673 674 urlParsingNode.setAttribute('href', url); 675 676 // IE <= 7 normalizes the URL when assigned to the anchor node similar to 677 // the other browsers. 678 return urlParsingNode.cloneNode(false).href; 679}; 680 681/** 682 * Returns true if the URL is within Drupal's base path. 683 * 684 * @param url 685 * The URL string to be tested. 686 * 687 * @return 688 * Boolean true if local. 689 * 690 * @see https://github.com/jquery/jquery-ui/blob/1.11.4/ui/tabs.js#L58 691 */ 692Drupal.urlIsLocal = function (url) { 693 // Always use browser-derived absolute URLs in the comparison, to avoid 694 // attempts to break out of the base path using directory traversal. 695 var absoluteUrl = Drupal.absoluteUrl(url); 696 var protocol = location.protocol; 697 698 // Consider URLs that match this site's base URL but use HTTPS instead of HTTP 699 // as local as well. 700 if (protocol === 'http:' && absoluteUrl.indexOf('https:') === 0) { 701 protocol = 'https:'; 702 } 703 var baseUrl = protocol + '//' + location.host + Drupal.settings.basePath.slice(0, -1); 704 705 // Decoding non-UTF-8 strings may throw an exception. 706 try { 707 absoluteUrl = decodeURIComponent(absoluteUrl); 708 } catch (e) {} 709 try { 710 baseUrl = decodeURIComponent(baseUrl); 711 } catch (e) {} 712 713 // The given URL matches the site's base URL, or has a path under the site's 714 // base URL. 715 return absoluteUrl === baseUrl || absoluteUrl.indexOf(baseUrl + '/') === 0; 716}; 717 718/** 719 * Generate the themed representation of a Drupal object. 720 * 721 * All requests for themed output must go through this function. It examines 722 * the request and routes it to the appropriate theme function. If the current 723 * theme does not provide an override function, the generic theme function is 724 * called. 725 * 726 * For example, to retrieve the HTML that is output by theme_placeholder(text), 727 * call Drupal.theme('placeholder', text). 728 * 729 * @param func 730 * The name of the theme function to call. 731 * @param ... 732 * Additional arguments to pass along to the theme function. 733 * @return 734 * Any data the theme function returns. This could be a plain HTML string, 735 * but also a complex object. 736 */ 737Drupal.theme = function(func) { 738 for (var i = 1, args = []; i < arguments.length; i++) { 739 args.push(arguments[i]); 740 } 741 742 return (Drupal.theme[func] || Drupal.theme.prototype[func]).apply(this, args); 743}; 744 745/** 746 * Parse a JSON response. 747 * 748 * The result is either the JSON object, or an object with 'status' 0 and 'data' an error message. 749 */ 750Drupal.parseJson = function (data) { 751 if ((data.substring(0, 1) != '{') && (data.substring(0, 1) != '[')) { 752 return { status: 0, data: data.length ? data : Drupal.t('Unspecified error') }; 753 } 754 return eval('(' + data + ');'); 755}; 756 757/** 758 * Freeze the current body height (as minimum height). Used to prevent 759 * unnecessary upwards scrolling when doing DOM manipulations. 760 */ 761Drupal.freezeHeight = function () { 762 Drupal.unfreezeHeight(); 763 var div = document.createElement('div'); 764 $(div).css({ 765 position: 'absolute', 766 top: '0px', 767 left: '0px', 768 width: '1px', 769 height: $('body').css('height') 770 }).attr('id', 'freeze-height'); 771 $('body').append(div); 772}; 773 774/** 775 * Unfreeze the body height 776 */ 777Drupal.unfreezeHeight = function () { 778 $('#freeze-height').remove(); 779}; 780 781/** 782 * Wrapper around encodeURIComponent() which avoids Apache quirks (equivalent of 783 * drupal_urlencode() in PHP). This function should only be used on paths, not 784 * on query string arguments. 785 */ 786Drupal.encodeURIComponent = function (item, uri) { 787 uri = uri || location.href; 788 item = encodeURIComponent(item).replace(/%2F/g, '/'); 789 return (uri.indexOf('?q=') != -1) ? item : item.replace(/%26/g, '%2526').replace(/%23/g, '%2523').replace(/\/\//g, '/%252F'); 790}; 791 792/** 793 * Get the text selection in a textarea. 794 */ 795Drupal.getSelection = function (element) { 796 if (typeof(element.selectionStart) != 'number' && document.selection) { 797 // The current selection 798 var range1 = document.selection.createRange(); 799 var range2 = range1.duplicate(); 800 // Select all text. 801 range2.moveToElementText(element); 802 // Now move 'dummy' end point to end point of original range.
803 range2.setEndPoint('EndToEnd', range1); 804 // Now we can calculate start and end points. 805 var start = range2.text.length - range1.text.length; 806 var end = start + range1.text.length; 807 return { 'start': start, 'end': end }; 808 } 809 return { 'start': element.selectionStart, 'end': element.selectionEnd }; 810}; 811 812/** 813 * Sanitizes a URL for use with jQuery.ajax(). 814 * 815 * @param url 816 * The URL string to be sanitized. 817 * 818 * @return 819 * The sanitized URL. 820 */ 821Drupal.sanitizeAjaxUrl = function (url) { 822 var regex = /\=\?(&|$)/; 823 while (url.match(regex)) { 824 url = url.replace(regex, ''); 825 } 826 return url; 827} 828 829/** 830 * Build an error message from ahah response. 831 */ 832Drupal.ahahError = function(xmlhttp, uri) { 833 if (xmlhttp.status == 200) { 834 if (jQuery.trim(xmlhttp.responseText)) { 835 var message = Drupal.t("An error occurred. \n@uri\n@text", {'@uri': uri, '@text': xmlhttp.responseText }); 836 } 837 else { 838 var message = Drupal.t("An error occurred. \n@uri\n(no information available).", {'@uri': uri }); 839 } 840 } 841 else { 842 var message = Drupal.t("An HTTP error @status occurred. \n@uri", {'@uri': uri, '@status': xmlhttp.status }); 843 } 844 return message.replace(/\n/g, '<br />'); 845} 846 847// Global Killswitch on the <html> element 848$(document.documentElement).addClass('js'); 849// Attach all behaviors. 850$(document).ready(function() { 851 Drupal.attachBehaviors(this); 852}); 853 854/** 855 * The default themes. 856 */ 857Drupal.theme.prototype = { 858 859 /** 860 * Formats text for emphasized display in a placeholder inside a sentence. 861 * 862 * @param str 863 * The text to format (plain-text). 864 * @return 865 * The formatted text (html). 866 */ 867 placeholder: function(str) { 868 return '<em>' + Drupal.checkPlain(str) + '</em>'; 869 } 870}; 871; 872 873/** 874 * Adds the custom autocomplete widget behavior. 875 */ 876Drupal.behaviors.apachesolr_autocomplete = function(context) { 877 $(".apachesolr-autocomplete.unprocessed", context).autocomplete(Drupal.settings.apachesolr_autocomplete.path, 878 { 879 // Classnames for the widget. 880 inputClass: "", 881 loadingClass: "throbbing", 882 // Do not select first suggestion by default. 883 selectFirst: false, 884 // Specify no matching as it wil be done on server-side. 885 matchContains: false, 886 matchSubset: false, 887 // Maximum number of items to show in widget. 888 max: 50, 889 scroll: true, 890 scrollHeight: 360, 891 // Data returned from server is JSON-encoded. 892 dataType: "json", 893 // Function to parse returned json into elements. 894 parse: function(data) { 895 return $.map(data, function(item) { 896 return { 897 data: item, // Echo the input data. 898 value: item.display, // This will be shown in the options widget. 899 result: item.key // The actual value to put into the form element. 900 } 901 }); 902 }, 903 // Return the HTML to display in the options widget. 904 formatItem: function(item) { 905 return item.display; 906 } 907 }).result(function(item, element) { 908 // Handle selection of an element in the autocomplete widget. 909 // We should submit the widget's parent form. 910 $(this).get(0).form.submit(); 911 }).addClass('form-autocomplete'); // Add Drupal autocomplete widget's style. 912}; 913; 914/* 915 * jQuery Autocomplete plugin 1.1 916 * 917 * Copyright (c) 2009 Jörn Zaefferer 918 * 919 * Dual licensed under the MIT and GPL licenses: 920 * http://www.opensource.org/licenses/mit-license.php 921 * http://www.gnu.org/licenses/gpl.html 922 * 923 */ 924 925;(function($) { 926 927$.fn.extend({ 928 autocomplete: function(urlOrData, options) { 929 var isUrl = typeof urlOrData == "string"; 930 options = $.extend({}, $.Autocompleter.defaults, { 931 url: isUrl ? urlOrData : null, 932 data: isUrl ? null : urlOrData, 933 delay: isUrl ? $.Autocompleter.defaults.delay : 10, 934 max: options && !options.scroll ? 10 : 150 935 }, options); 936 937 // if highlight is set to false, replace it with a do-nothing function 938 options.highlight = options.highlight || function(value) { return value; }; 939 940 // if the formatMatch option is not specified, then use formatItem for backwards compatibility 941 options.formatMatch = options.formatMatch || options.formatItem; 942 943 return this.each(function() { 944 new $.Autocompleter(this, options); 945 }); 946 }, 947 result: function(handler) { 948 return this.bind("result", handler); 949 }, 950 search: function(handler) { 951 return this.trigger("search", [handler]); 952 }, 953 flushCache: function() { 954 return this.trigger("flushCache"); 955 }, 956 setOptions: function(options){ 957 return this.trigger("setOptions", [options]); 958 }, 959 unautocomplete: function() { 960 return this.trigger("unautocomplete"); 961 } 962}); 963 964$.Autocompleter = function(input, options) { 965 966 var KEY = { 967 UP: 38, 968 DOWN: 40, 969 DEL: 46, 970 TAB: 9, 971 RETURN: 13, 972 ESC: 27, 973 COMMA: 188, 974 PAGEUP: 33, 975 PAGEDOWN: 34, 976 BACKSPACE: 8 977 }; 978 979 // Create $ object for input element 980 var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); 981 982 var timeout; 983 var previousValue = ""; 984 var cache = $.Autocompleter.Cache(options); 985 var hasFocus = 0; 986 var lastKeyPressCode; 987 var config = { 988 mouseDownOnSelect: false 989 }; 990 var select = $.Autocompleter.Select(options, input, selectCurrent, config); 991 992 var blockSubmit; 993
994 // prevent form submit in opera when selecting with return key 995 $.browser.opera && $(input.form).bind("submit.autocomplete", function() { 996 if (blockSubmit) { 997 blockSubmit = false; 998 return false; 999 } 1000 }); 1001 1002 // only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all 1003 $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) { 1004 // a keypress means the input has focus 1005 // avoids issue where input had focus before the autocomplete was applied 1006 hasFocus = 1; 1007 // track last key pressed 1008 lastKeyPressCode = event.keyCode; 1009 switch(event.keyCode) { 1010 1011 case KEY.UP: 1012 event.preventDefault(); 1013 if ( select.visible() ) { 1014 select.prev(); 1015 } else { 1016 onChange(0, true); 1017 } 1018 break; 1019 1020 case KEY.DOWN: 1021 event.preventDefault(); 1022 if ( select.visible() ) { 1023 select.next(); 1024 } else { 1025 onChange(0, true); 1026 } 1027 break; 1028 1029 case KEY.PAGEUP: 1030 event.preventDefault(); 1031 if ( select.visible() ) { 1032 select.pageUp(); 1033 } else { 1034 onChange(0, true); 1035 } 1036 break; 1037 1038 case KEY.PAGEDOWN: 1039 event.preventDefault(); 1040 if ( select.visible() ) { 1041 select.pageDown(); 1042 } else { 1043 onChange(0, true); 1044 } 1045 break; 1046 1047 // matches also semicolon 1048 case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: 1049 case KEY.TAB: 1050 case KEY.RETURN: 1051 if( selectCurrent() ) { 1052 // stop default to prevent a form submit, Opera needs special handling 1053 event.preventDefault(); 1054 blockSubmit = true; 1055 return false; 1056 } 1057 break; 1058 1059 case KEY.ESC: 1060 select.hide(); 1061 break; 1062 1063 default: 1064 clearTimeout(timeout); 1065 timeout = setTimeout(onChange, options.delay); 1066 break; 1067 } 1068 }).focus(function(){ 1069 // track whether the field has focus, we shouldn't process any 1070 // results if the field no longer has focus 1071 hasFocus++; 1072 }).blur(function() { 1073 hasFocus = 0; 1074 if (!config.mouseDownOnSelect) { 1075 hideResults(); 1076 } 1077 }).click(function() { 1078 // show select when clicking in a focused field 1079 if ( hasFocus++ > 1 && !select.visible() ) { 1080 onChange(0, true); 1081 } 1082 }).bind("search", function() { 1083 // TODO why not just specifying both arguments? 1084 var fn = (arguments.length > 1) ? arguments[1] : null; 1085 function findValueCallback(q, data) { 1086 var result; 1087 if( data && data.length ) { 1088 for (var i=0; i < data.length; i++) { 1089 if( data[i].result.toLowerCase() == q.toLowerCase() ) { 1090 result = data[i]; 1091 break; 1092 } 1093 } 1094 } 1095 if( typeof fn == "function" ) fn(result); 1096 else $input.trigger("result", result && [result.data, result.value]); 1097 } 1098 $.each(trimWords($input.val()), function(i, value) { 1099 request(value, findValueCallback, findValueCallback); 1100 }); 1101 }).bind("flushCache", function() { 1102 cache.flush(); 1103 }).bind("setOptions", function() { 1104 $.extend(options, arguments[1]); 1105 // if we've updated the data, repopulate 1106 if ( "data" in arguments[1] ) 1107 cache.populate(); 1108 }).bind("unautocomplete", function() { 1109 select.unbind(); 1110 $input.unbind(); 1111 $(input.form).unbind(".autocomplete"); 1112 }); 1113 1114 1115 function selectCurrent() { 1116 var selected = select.selected(); 1117 if( !selected ) 1118 return false; 1119 1120 var v = selected.result; 1121 previousValue = v; 1122 1123 if ( options.multiple ) { 1124 var words = trimWords($input.val()); 1125 if ( words.length > 1 ) { 1126 var seperator = options.multipleSeparator.length; 1127 var cursorAt = $(input).selection().start; 1128 var wordAt, progress = 0; 1129 $.each(words, function(i, word) { 1130 progress += word.length; 1131 if (cursorAt <= progress) { 1132 wordAt = i; 1133 return false; 1134 } 1135 progress += seperator; 1136 }); 1137 words[wordAt] = v; 1138 // TODO this should set the cursor to the right position, but it gets overriden somewhere 1139 //$.Autocompleter.Selection(input, progress + seperator, progress + seperator); 1140 v = words.join( options.multipleSeparator ); 1141 } 1142 v += options.multipleSeparator; 1143 } 1144 1145 $input.val(v); 1146 hideResultsNow(); 1147 $input.trigger("result", [selected.data, selected.value]); 1148 return true; 1149 } 1150 1151 function onChange(crap, skipPrevCheck) { 1152 if( lastKeyPressCode == KEY.DEL ) { 1153 select.hide(); 1154 return; 1155 } 1156 1157 var currentValue = $input.val(); 1158 1159 if ( !skipPrevCheck && currentValue == previousValue ) 1160 return; 1161 1162 previousValue = currentValue; 1163 1164 currentValue = lastWord(currentValue); 1165 if ( currentValue.length >= options.minChars) { 1166 $input.addClass(options.loadingClass); 1167 if (!options.matchCase) 1168 currentValue = currentValue.toLowerCase(); 1169 request(currentValue, receiveData, hideResultsNow); 1170 } else { 1171 stopLoading(); 1172 select.hide(); 1173 } 1174 }; 1175 1176 function trimWords(value) { 1177 if (!value) 1178 return [""]; 1179 if (!options.multiple) 1180 return [$.trim(value)]; 1181 return $.map(value.split(options.multipleSeparator), function(word) { 1182 return $.trim(value).length ? $.trim(word) : null; 1183 }); 1184 } 1185 1186 function lastWord(value) { 1187 if ( !options.multiple ) 1188 return value; 1189 var words = trimWords(value); 1190 if (words.length == 1) 1191 return words[0]; 1192 var cursorAt = $(input).selection().start; 1193 if (cursorAt == value.length) { 1194 words = trimWords(value) 1195 } else { 1196 words = trimWords(value.replace(value.substring(cursorAt), "")); 1197 } 1198 return words[words.length - 1]; 1199 } 1200 1201 // fills in the input box w/the first match (assumed to be the best match) 1202 // q: the term entered 1203 // sValue: the first matching result 1204 function autoFill(q, sValue){ 1205 // autofill in the complete box w/the first match as long as the user hasn't entered in more data 1206 // if the last user key pressed was backspace, don't autofill 1207 if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) { 1208 // fill in the value (keep the case the user has typed) 1209 $input.val($input.val() + sValue.substring(lastWord(previousValue).length)); 1210 // select the portion of the value not typed by the user (so the next character will erase) 1211 $(input).selection(previousValue.length, previousValue.length + sValue.length); 1212 } 1213 }; 1214 1215 function hideResults() { 1216 clearTimeout(timeout); 1217 timeout = setTimeout(hideResultsNow, 200); 1218 }; 1219 1220 function hideResultsNow() { 1221 var wasVisible = select.visible(); 1222 select.hide(); 1223 clearTimeout(timeout); 1224 stopLoading(); 1225 if (options.mustMatch) { 1226 // call search and run callback 1227 $input.search( 1228 function (result){ 1229 // if no value found, clear the input box 1230 if( !result ) { 1231 if (options.multiple) { 1232 var words = trimWords($input.val()).slice(0, -1); 1233 $input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") ); 1234 } 1235 else { 1236 $input.val( "" ); 1237 $input.trigger("result", null); 1238 } 1239 } 1240 } 1241 ); 1242 } 1243 }; 1244 1245 function receiveData(q, data) { 1246 if ( data && data.length && hasFocus ) { 1247 stopLoading(); 1248 select.display(data, q); 1249 autoFill(q, data[0].value); 1250 select.show(); 1251 } else { 1252 hideResultsNow(); 1253 } 1254 }; 1255 1256 function request(term, success, failure) { 1257 if (!options.matchCase) 1258 term = term.toLowerCase(); 1259 var data = cache.load(term); 1260 // recieve the cached data 1261 if (data && data.length) { 1262 success(term, data); 1263 // if an AJAX url has been supplied, try loading the data now 1264 } else if( (typeof options.url == "string") && (options.url.length > 0) ){ 1265 1266 var extraParams = { 1267 timestamp: +new Date() 1268 }; 1269 $.each(options.extraParams, function(key, param) { 1270 extraParams[key] = typeof param == "function" ? param() : param; 1271 }); 1272 1273 $.ajax({ 1274 // try to leverage ajaxQueue plugin to abort previous requests 1275 mode: "abort", 1276 // limit abortion to this input 1277 port: "autocomplete" + input.name, 1278 dataType: options.dataType, 1279 url: options.url, 1280 data: $.extend({ 1281 query: lastWord(term), 1282 limit: options.max 1283 }, extraParams), 1284 success: function(data) { 1285 var parsed = options.parse && options.parse(data) || parse(data); 1286 cache.add(term, parsed); 1287 success(term, parsed); 1288 } 1289 }); 1290 } else { 1291 // if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match 1292 select.emptyList(); 1293 failure(term); 1294 } 1295 }; 1296 1297 function parse(data) { 1298 var parsed = []; 1299 var rows = data.split("\n"); 1300 for (var i=0; i < rows.length; i++) { 1301 var row = $.trim(rows[i]); 1302 if (row) { 1303 row = row.split("|"); 1304 parsed[parsed.length] = { 1305 data: row, 1306 value: row[0], 1307 result: options.formatResult && options.formatResult(row, row[0]) || row[0] 1308 }; 1309 } 1310 } 1311 return parsed; 1312 }; 1313 1314 function stopLoading() { 1315 $input.removeClass(options.loadingClass); 1316 }; 1317 1318}; 1319 1320$.Autocompleter.defaults = { 1321 inputClass: "ac_input", 1322 resultsClass: "ac_results", 1323 loadingClass: "ac_loading", 1324 minChars: 1, 1325 delay: 400, 1326 matchCase: false, 1327 matchSubset: true,
1328 matchContains: false, 1329 cacheLength: 10, 1330 max: 100, 1331 mustMatch: false, 1332 extraParams: {}, 1333 selectFirst: true, 1334 formatItem: function(row) { return row[0]; }, 1335 formatMatch: null, 1336 autoFill: false, 1337 width: 0, 1338 multiple: false, 1339 multipleSeparator: ", ", 1340 highlight: function(value, term) { 1341 return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>"); 1342 }, 1343 scroll: true, 1344 scrollHeight: 180 1345}; 1346 1347$.Autocompleter.Cache = function(options) { 1348 1349 var data = {}; 1350 var length = 0; 1351 1352 function matchSubset(s, sub) { 1353 if (!options.matchCase) 1354 s = s.toLowerCase(); 1355 var i = s.indexOf(sub); 1356 if (options.matchContains == "word"){ 1357 i = s.toLowerCase().search("\\b" + sub.toLowerCase()); 1358 } 1359 if (i == -1) return false; 1360 return i == 0 || options.matchContains; 1361 }; 1362 1363 function add(q, value) { 1364 if (length > options.cacheLength){ 1365 flush(); 1366 } 1367 if (!data[q]){ 1368 length++; 1369 } 1370 data[q] = value; 1371 } 1372 1373 function populate(){ 1374 if( !options.data ) return false; 1375 // track the matches 1376 var stMatchSets = {}, 1377 nullData = 0; 1378 1379 // no url was specified, we need to adjust the cache length to make sure it fits the local data store 1380 if( !options.url ) options.cacheLength = 1; 1381 1382 // track all options for minChars = 0 1383 stMatchSets[""] = []; 1384 1385 // loop through the array and create a lookup structure 1386 for ( var i = 0, ol = options.data.length; i < ol; i++ ) { 1387 var rawValue = options.data[i]; 1388 // if rawValue is a string, make an array otherwise just reference the array 1389 rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; 1390 1391 var value = options.formatMatch(rawValue, i+1, options.data.length); 1392 if ( value === false ) 1393 continue; 1394 1395 var firstChar = value.charAt(0).toLowerCase(); 1396 // if no lookup array for this character exists, look it up now 1397 if( !stMatchSets[firstChar] ) 1398 stMatchSets[firstChar] = []; 1399 1400 // if the match is a string 1401 var row = { 1402 value: value, 1403 data: rawValue, 1404 result: options.formatResult && options.formatResult(rawValue) || value 1405 }; 1406 1407 // push the current match into the set list 1408 stMatchSets[firstChar].push(row); 1409 1410 // keep track of minChars zero items 1411 if ( nullData++ < options.max ) { 1412 stMatchSets[""].push(row); 1413 } 1414 }; 1415 1416 // add the data items to the cache 1417 $.each(stMatchSets, function(i, value) { 1418 // increase the cache size 1419 options.cacheLength++; 1420 // add to the cache 1421 add(i, value); 1422 }); 1423 } 1424 1425 // populate any existing data 1426 setTimeout(populate, 25); 1427 1428 function flush(){ 1429 data = {}; 1430 length = 0; 1431 } 1432 1433 return { 1434 flush: flush, 1435 add: add, 1436 populate: populate, 1437 load: function(q) { 1438 if (!options.cacheLength || !length) 1439 return null; 1440 /* 1441 * if dealing w/local data and matchContains than we must make sure 1442 * to loop through all the data collections looking for matches 1443 */ 1444 if( !options.url && options.matchContains ){ 1445 // track all matches 1446 var csub = []; 1447 // loop through all the data grids for matches 1448 for( var k in data ){ 1449 // don't search through the stMatchSets[""] (minChars: 0) cache 1450 // this prevents duplicates 1451 if( k.length > 0 ){ 1452 var c = data[k]; 1453 $.each(c, function(i, x) { 1454 // if we've got a match, add it to the array 1455 if (matchSubset(x.value, q)) { 1456 csub.push(x); 1457 } 1458 }); 1459 } 1460 } 1461 return csub; 1462 } else 1463 // if the exact item exists, use it 1464 if (data[q]){ 1465 return data[q]; 1466 } else 1467 if (options.matchSubset) { 1468 for (var i = q.length - 1; i >= options.minChars; i--) { 1469 var c = data[q.substr(0, i)]; 1470 if (c) { 1471 var csub = []; 1472 $.each(c, function(i, x) { 1473 if (matchSubset(x.value, q)) { 1474 csub[csub.length] = x; 1475 } 1476 }); 1477 return csub; 1478 } 1479 } 1480 } 1481 return null; 1482 } 1483 }; 1484}; 1485 1486$.Autocompleter.Select = function (options, input, select, config) { 1487 var CLASSES = { 1488 ACTIVE: "ac_over" 1489 }; 1490 1491 var listItems, 1492 active = -1, 1493 data, 1494 term = "", 1495 needsInit = true, 1496 element, 1497 list; 1498 1499 // Create results
1500 function init() { 1501 if (!needsInit) 1502 return; 1503 element = $("<div/>") 1504 .hide() 1505 .addClass(options.resultsClass) 1506 .css("position", "absolute") 1507 .appendTo(document.body); 1508 1509 list = $("<ul/>").appendTo(element).mouseover( function(event) { 1510 if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { 1511 active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); 1512 $(target(event)).addClass(CLASSES.ACTIVE); 1513 } 1514 }).click(function(event) { 1515 $(target(event)).addClass(CLASSES.ACTIVE); 1516 select(); 1517 // TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus 1518 input.focus(); 1519 return false; 1520 }).mousedown(function() { 1521 config.mouseDownOnSelect = true; 1522 }).mouseup(function() { 1523 config.mouseDownOnSelect = false; 1524 }); 1525 1526 if( options.width > 0 ) 1527 element.css("width", options.width); 1528 1529 needsInit = false; 1530 } 1531 1532 function target(event) { 1533 var element = event.target; 1534 while(element && element.tagName != "LI") 1535 element = element.parentNode; 1536 // more fun with IE, sometimes event.target is empty, just ignore it then 1537 if(!element) 1538 return []; 1539 return element; 1540 } 1541 1542 function moveSelect(step) { 1543 listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE); 1544 movePosition(step); 1545 var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE); 1546 if(options.scroll) { 1547 var offset = 0; 1548 listItems.slice(0, active).each(function() { 1549 offset += this.offsetHeight; 1550 }); 1551 if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) { 1552 list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight()); 1553 } else if(offset < list.scrollTop()) { 1554 list.scrollTop(offset); 1555 } 1556 } 1557 }; 1558 1559 function movePosition(step) { 1560 active += step; 1561 if (active < 0) { 1562 active = listItems.size() - 1; 1563 } else if (active >= listItems.size()) { 1564 active = 0; 1565 } 1566 } 1567 1568 function limitNumberOfItems(available) { 1569 return options.max && options.max < available 1570 ? options.max 1571 : available; 1572 } 1573 1574 function fillList() { 1575 list.empty(); 1576 var max = limitNumberOfItems(data.length); 1577 for (var i=0; i < max; i++) { 1578 if (!data[i]) 1579 continue; 1580 var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term); 1581 if ( formatted === false ) 1582 continue; 1583 var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0]; 1584 $.data(li, "ac_data", data[i]); 1585 } 1586 listItems = list.find("li"); 1587 if ( options.selectFirst ) { 1588 listItems.slice(0, 1).addClass(CLASSES.ACTIVE); 1589 active = 0; 1590 } 1591 // apply bgiframe if available 1592 if ( $.fn.bgiframe ) 1593 list.bgiframe(); 1594 } 1595 1596 return { 1597 display: function(d, q) { 1598 init(); 1599 data = d; 1600 term = q; 1601 fillList(); 1602 }, 1603 next: function() { 1604 moveSelect(1); 1605 }, 1606 prev: function() { 1607 moveSelect(-1); 1608 }, 1609 pageUp: function() { 1610 if (active != 0 && active - 8 < 0) { 1611 moveSelect( -active ); 1612 } else { 1613 moveSelect(-8); 1614 } 1615 }, 1616 pageDown: function() { 1617 if (active != listItems.size() - 1 && active + 8 > listItems.size()) { 1618 moveSelect( listItems.size() - 1 - active ); 1619 } else { 1620 moveSelect(8); 1621 } 1622 }, 1623 hide: function() { 1624 element && element.hide(); 1625 listItems && listItems.removeClass(CLASSES.ACTIVE); 1626 active = -1; 1627 }, 1628 visible : function() { 1629 return element && element.is(":visible"); 1630 }, 1631 current: function() { 1632 return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]); 1633 }, 1634 show: function() { 1635 var offset = $(input).offset(); 1636 element.css({ 1637 width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(), 1638 top: offset.top + input.offsetHeight, 1639 left: offset.left 1640 }).show(); 1641 if(options.scroll) { 1642 list.scrollTop(0); 1643 list.css({ 1644 maxHeight: options.scrollHeight, 1645 overflow: 'auto' 1646 }); 1647 1648 if($.browser.msie && typeof document.body.style.maxHeight === "undefined") { 1649 var listHeight = 0; 1650 listItems.each(function() { 1651 listHeight += this.offsetHeight; 1652 }); 1653 var scrollbarsVisible = listHeight > options.scrollHeight; 1654 list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight ); 1655 if (!scrollbarsVisible) { 1656 // IE doesn't recalculate width when scrollbar disappears 1657 listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) ); 1658 } 1659 } 1660 1661 } 1662 }, 1663 selected: function() { 1664 var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); 1665 return selected && selected.length && $.data(selected[0], "ac_data"); 1666 }, 1667 emptyList: function (){ 1668 list && list.empty(); 1669 }, 1670 unbind: function() { 1671 element && element.remove(); 1672 } 1673 }; 1674}; 1675 1676$.fn.selection = function(start, end) { 1677 if (start !== undefined) { 1678 return this.each(function() { 1679 if( this.createTextRange ){ 1680 var selRange = this.createTextRange(); 1681 if (end === undefined || start == end) { 1682 selRange.move("character", start); 1683 selRange.select(); 1684 } else { 1685 selRange.collapse(true); 1686 selRange.moveStart("character", start); 1687 selRange.moveEnd("character", end); 1688 selRange.select(); 1689 } 1690 } else if( this.setSelectionRange ){ 1691 this.setSelectionRange(start, end); 1692 } else if( this.selectionStart ){ 1693 this.selectionStart = start; 1694 this.selectionEnd = end; 1695 } 1696 }); 1697 } 1698 var field = this[0]; 1699 if ( field.createTextRange ) { 1700 var range = document.selection.createRange(), 1701 orig = field.value, 1702 teststring = "<->", 1703 textLength = range.text.length; 1704 range.text = teststring; 1705 var caretAt = field.value.indexOf(teststring); 1706 field.value = orig; 1707 this.selection(caretAt, caretAt + textLength); 1708 return { 1709 start: caretAt, 1710 end: caretAt + textLength 1711 } 1712 } else if( field.selectionStart !== undefined ){ 1713 return { 1714 start: field.selectionStart, 1715 end: field.selectionEnd 1716 } 1717 } 1718}; 1719 1720}
1720)(jQuery); 1721; 1722//Special function to load Drupal.settings.dd.$_GET with the values of GET, like PHP would have access to 1723 1724if (typeof Drupal.dd !== 'object') { 1725 Drupal.dd = {}; 1726} 1727 1728Drupal.dd.$_GET = {}; 1729 1730document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () { 1731 function decode(s) { 1732 return decodeURIComponent(s.split("+").join(" ")); 1733 } 1734 1735 Drupal.dd.$_GET[decode(arguments[1])] = decode(arguments[2]); 1736}); 1737 1738/** 1739 * DD Classes Animations 1740 */ 1741 1742Drupal.DDClassesAnimations = { 1743 expand: function($content, duration) { 1744 var t = duration || 500; 1745 if ($content.length) { 1746 $content.stop(true,true).animate({opacity:'show', height:'show'}, t); 1747 } 1748 }, 1749 collapse: function($content, duration) { 1750 var t = duration || 250; 1751 if ($content.length) { 1752 $content.stop(true,true).animate({opacity:'hide', height:'hide'}, t); 1753 } 1754 }, 1755}; 1756 1757/** 1758 * Drupal Behaviors 1759 */ 1760 1761Drupal.behaviors.ddClassesFitAndFinish = function(context) { 1762 var $advancedMenu = $('.menu-adv', context); 1763 1764 if ($advancedMenu.length) { 1765 $advancedMenu.find('.navbar a.depth-1').append(" <span class='arrow'>»</span>"); 1766 $advancedMenu.find('.navbar .menuparent .menuparent a.depth-2').append(" <span class='arrow'>+</span>"); 1767 $advancedMenu.find('.block-menu_block .collapsed a.depth-2').append(" <span class='arrow'>+</span>"); 1768 $advancedMenu.find('.block-menu_block .block-title a.depth-2').prepend(" <span class='arrow'>«</span> "); 1769 } 1770}; 1771 1772Drupal.behaviors.ddClassesImageLayouts = function(context) { 1773 $.each($(".node-full:not(.hide-captions) .field-image img[title], .enable-captions .field-image img[title], .enable-1-caption .field-image.c1 img[title]", context), function(k,v) { 1774 var image = $(v); 1775 var caption = image.attr('title'); 1776 var imageContainer = image.parents('.field-image').slice(0,1); 1777 imageContainer.append("<span class='caption'>" + caption + "</span>"); 1778 }); 1779}; 1780 1781Drupal.behaviors.ddClassesIE7Fixes = function(context) { 1782 if ($.browser.msie && $.browser.version.slice(0,1) === '7') { 1783 $("body").addClass("ie7"); 1784 $.each($(".pod-image:visible", context), function(k,v) { 1785 var h = $(v).height(); 1786 var w = $(v).width(); 1787 $(v).find("span").height(h).width(w); 1788 $(v).find("span").css('display', 'block'); 1789 }); 1790 1791 $(".nice-menu li:empty, .block-menu_block li:empty", context).hide(); 1792 $.each($('.channel > div', context) , function(key, value) { 1793 $(value).css('width', $(value).width() + 'px'); 1794 }); 1795 1796 $.each($(".channel", context), function(k,v) { 1797 var spacing = $(v).find(".node:last").css('margin-bottom'); 1798 $(v).css('padding-bottom', spacing); 1799 }); 1800 } 1801}; 1802 1803Drupal.behaviors.initSubtermTabs = function(context) { 1804 $('div.switch-subtermtabs', context).each(function (channelIndex, element) { 1805 var $channel = $(element), 1806 count = 0, 1807 tabs = {}; 1808 1809 $channel.find('.subterm').each(function (index, block) { 1810 var $block = $(block), 1811 tabName = ''; 1812 1813 // Set tab name based on the subterm header text. 1814 if ($channel.hasClass('switch-subtermtabs')) { 1815 tabName = $block.find('.subterm-header').text(); 1816 } 1817 1818 if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];} 1819 tabs[tabName].push($block.attr('id')); 1820 }); 1821 1822 // Build an 'All' tab 1823 var alltab = { 'All': [] }; 1824 $channel.find('.subterm').each(function (index, block) { 1825 alltab.All.push($(block).attr('id')); 1826 }); 1827 1828 // If switch to add the all tab == enabled, put at beginning 1829 if ($channel.hasClass('tabs-all') && $channel.find('.subterm').size()) { 1830 tabs = $.extend(alltab, tabs); 1831 } 1832 // Or perhaps put it at the end 1833 else if ($channel.hasClass('tabs-all-e') && $channel.find('.subterm').size()) { 1834 tabs = $.extend(tabs, alltab); 1835 } 1836 1837 //Binding function e.g. 'click' or 'hover' 1838 var bindingFunction = 'click'; 1839 1840 if ($channel.hasClass('tabs-show-hover')) { 1841 bindingFunction = 'mouseover'; 1842 } 1843 1844 // Create a tablist which will contain all related tabs. 1845 var $dtabs = $('<div class="dtabs"></div>'); 1846 $dtabs.attr({ 1847 'role': 'tablist', 1848 'aria-label': 'Filter content by...', 1849 }); 1850 // Create the tabs container from the tabs created 1851 $dtabs.prependTo($channel.find('.subterm-inner')); 1852 1853 // Create the tabs which controls which content to display. 1854 $.each(tabs, function(tabName, blocks) { 1855 count++; 1856 var $tab = $('<div class="tab"></div>'); 1857 $tab.addClass('tab-'+ count); 1858 $tab.append('<span>' + tabName + ' <em>('+ blocks.length +')</em></span>'); 1859 $tab.data('tabGroup', count); 1860 $tab.attr({ 1861 'role': 'tab', 1862 'aria-controls': blocks.join(' '), 1863 'id': 'subterm-tabs-button_' + channelIndex + '-' + count, 1864 }); 1865 1866 // Add our tab to the tablist container. 1867 $tab.appendTo($dtabs); 1868 1869 // Properly identify the content related to each of the tabs within the tablist. 1870 $.each(blocks, function(blockIndex, block) { 1871 var $underTabs = $channel.find('#' + block); 1872 1873 // Make sure we aren't duplicating efforts assigning variables. 1874 $underTabs.each(function(iii, tabPanelMember) { 1875 var $tabPanelMember = $(tabPanelMember); 1876 if (!$tabPanelMember.data('processed')) { 1877 $tabPanelMember.addClass('subterm-tab-content under-tab under-tab-' + count); 1878 $tabPanelMember.attr({ 1879 'role': 'tabpanel', 1880 'aria-labelledby': 'subterm-tabs-button_' + channelIndex + '-' + count, 1881 'tabindex': 0, 1882 }); 1883 } else { 1884 var labelledBy = $tabPanelMember.attr('aria-labelledby'); 1885 $tabPanelMember 1886 .addClass('under-tab-' + count) 1887 .attr('aria-labelledby', labelledBy + ' subterm-tabs-button_' + channelIndex + '-' + count); 1888 } 1889 }); 1890 1891 // Mark these as process so we can not duplicate assignment to attributes. 1892 $underTabs.data('processed', true); 1893 }); 1894 }); 1895 1896 // Bind the click or mouseover event 1897 $channel.find('.tab').bind(bindingFunction, function(event) { 1898 // Remove active from all tabs 1899 $dtabs.find('.tab') 1900 .removeClass('active') 1901 .attr({ 1902 'aria-selected': false, 1903 'tabindex': -1, 1904 }); 1905 1906 // Add active class to current tab 1907 $(event.currentTarget) 1908 .addClass('active') 1909 .attr({ 1910 'aria-selected': true, 1911 'tabindex': 0, 1912 }); 1913 1914 var duration = 250, 1915 $elementsToShow = $channel.find('.subterm-tab-content').filter('.under-tab-' + $(event.currentTarget).data('tabGroup')), 1916 $elementsToHide = $channel.find('.subterm-tab-content').not($elementsToShow); 1917 1918 // Hide all items under any tab 1919 $elementsToHide 1920 .animate({ opacity:'hide', height:'hide' }, duration); 1921 1922 // Show items under current tab 1923 $elementsToShow 1924 .stop(true, true) 1925 .animate({ opacity:'show', height:'show' }, duration * 2); 1926 $elementsToShow 1927 .removeClass('hide-in'); 1928 }); 1929 1930 // Mouseover event binding 1931 if (bindingFunction === 'mouseover') { 1932 $channel.mouseout(function() { 1933 $channel.find('.under-tab').addClass('hide-in').data('hideIn', 3); 1934 });
1935 $channel.find('.under-tab').mouseover(function() { 1936 $(this).removeClass('hide-in'); 1937 }); 1938 } 1939 1940 // Initial setup 1941 if ($channel.hasClass('tabs-1st')) { 1942 $channel.find('.under-tab').hide(); 1943 $channel.find('.tab-1').get(0).click(); 1944 } else if ($channel.hasClass('tabs-expand')) { 1945 $channel.find('.under-tab').hide(); 1946 } 1947 }); 1948}; 1949 1950Drupal.behaviors.initTabs = function(context) { 1951 $('div[class*="switch-tabs-"]', context).not('.switch-tabs-disable').each(function(channelIndex, element) { 1952 var $channel = $(element), 1953 $nodes = $channel.find('.node'), 1954 tabClasses = {}, 1955 count = 0, 1956 tabs = {}; 1957 1958 // Fail-safe way to extract a Date object from a time element. 1959 function extractDate(dateElement) { 1960 var timeElement = $(dateElement).find('time'); 1961 if (timeElement.length == 0) return; 1962 1963 var timeString = timeElement.attr('datetime'); 1964 if (!timeString) return; 1965 1966 var match = timeString.match(/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}):(\d{2})?)?$/); 1967 if (!match) return; 1968 1969 return new Date( 1970 parseInt(match[1]), 1971 parseInt(match[2]) - 1, 1972 parseInt(match[3]), 1973 parseInt(match[4] || '0'), 1974 parseInt(match[5] || '0'), 1975 parseInt(match[6] || '0') 1976 ); 1977 } 1978 1979 var monthAbbrevs = [ 1980 'Jan', 1981 'Feb', 1982 'Mar', 1983 'Apr', 1984 'May', 1985 'Jun', 1986 'Jul', 1987 'Aug', 1988 'Sep', 1989 'Oct', 1990 'Nov', 1991 'Dec' 1992 ]; 1993 1994 var monthNames = [ 1995 'January', 1996 'February', 1997 'March', 1998 'April', 1999 'May', 2000 'June', 2001 'July', 2002 'August', 2003 'September', 2004 'October', 2005 'November', 2006 'December' 2007 ]; 2008 2009 // Do not proceed if no nodes are present within this channel. 2010 if (!$nodes.length) { 2011 return; 2012 } 2013 2014 $nodes.each(function (index, node) { 2015 var $node = $(node), 2016 tabName = '', 2017 tabClass = ''; 2018 2019 if ($channel.hasClass( 'switch-tabs-title' )) { 2020 tabName = $node.find('.node-header .title').text(); 2021 } 2022 else if ($channel.hasClass( 'switch-tabs-pt' )) { 2023 tabName = $node.find('.node-item .post-type').attr('data-plural'); 2024 tabClass = $node.attr('class').match(/pt(\d+)/); 2025 if (tabClass) { tabClass = tabClass[0]; } 2026 } 2027 else if ($channel.hasClass( 'switch-tabs-subtitle' )) { 2028 tabName = $node.find('.node-header .subtitle').text(); 2029 } 2030 else if ($channel.hasClass( 'switch-tabs-image' )) { 2031 tabName = $node.find('.node-item .node-upper-image').html(); 2032 } 2033 else if ($channel.hasClass( 'switch-tabs-image2' )) { 2034 tabName = $node.find('.node-item .slideshow-images a:first').html(); 2035 } 2036 else if ($channel.hasClass( 'switch-tabs-sa' )) { 2037 $node.find('.node-item .meta-access').each(function(k,v) { 2038 tabName = $(v).text(); 2039 if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];} 2040 tabs[tabName].push($(node).attr('id')); 2041 }); 2042 } 2043 else if ($channel.hasClass( 'switch-tabs-related' )) { 2044 $node.find('.node-item .meta-profile').each(function(k,v) { 2045 tabName = $(v).text(); 2046 if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];} 2047 tabs[tabName].push($node.attr('id')); 2048 }); 2049 } 2050 else if ($channel.hasClass( 'switch-tabs-post-date' )) { 2051 $node.find('.node-item .post-date').each(function(di, dateElement) { 2052 var date = extractDate(dateElement); 2053 if (date) { 2054 tabName = monthNames[date.getMonth()] + ' ' + date.getDate(); 2055 } 2056 // Fall back to legacy date parsing logic. 2057 else { 2058 tabName = $(dateElement).text().split(' ')[0] + ' ' + $(dateElement).text().split(',')[0].split(' ')[1]; 2059 } 2060 2061 if (tabName === '') {tabName = 'Other';} 2062 if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];} 2063 tabs[tabName].push($node.attr('id')); 2064 }); 2065 // Not sure what was intended here, but reversing an object is impossible. 2066 // tabs = tabs.reverse(); 2067 } 2068 else if ($channel.hasClass( 'switch-tabs-post-date-month' )) { 2069 $node.find('.node-item .post-date').each(function(di, dateElement) { 2070 var date = extractDate(dateElement); 2071 if (date) { 2072 tabName = monthNames[date.getMonth()]; 2073 } 2074 // Fall back to legacy date parsing logic. 2075 else { 2076 tabName = $(dateElement).text().split(' ')[0]; 2077 } 2078 2079 if (tabName === '') {tabName = 'Other';} 2080 if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];} 2081 tabs[tabName].push($node.attr('id')); 2082 }); 2083 } 2084 else if ($channel.hasClass( 'switch-tabs-post-date-m-year' )) { 2085 $node.find('.node-item .post-date').each(function(di, dateElement) { 2086 var date = extractDate(dateElement); 2087 if (date) { 2088 tabName = monthNames[date.getMonth()] + ' ' + date.getFullYear(); 2089 } 2090 // Fall back to legacy date parsing logic. 2091 else { 2092 tabName = $(dateElement).text().split(' ')[0] + ' ' + $.trim($(dateElement).text().split(',')[1].split('-')[0]); 2093 } 2094 2095 if (tabName === '') {tabName = 'Other';} 2096 if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];} 2097 tabs[tabName].push($node.attr('id')); 2098 }); 2099 } 2100 else if ($channel.hasClass( 'switch-tabs-post-date-year' )) { 2101 $node.find('.node-item .post-date').each(function(di, dateElement) { 2102 var date = extractDate(dateElement); 2103 if (date) { 2104 tabName = date.getFullYear(); 2105 } 2106 // Fall back to legacy date parsing logic. 2107 else { 2108 tabName = $.trim($(dateElement).text().split(',')[1].split('-')[0]); 2109 } 2110 2111 if (tabName === '') {tabName = 'Other';} 2112 if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];} 2113 tabs[tabName].push($node.attr('id')); 2114 }); 2115 } 2116 2117 if (tabName === '') {tabName = 'Other';} 2118 if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];} 2119 tabs[tabName].push($node.attr('id')); 2120 if (tabClass) {tabClasses[tabName] = tabClass;} 2121 }); 2122 2123 // Build an "All" tab 2124 var alltab = {'All': []}; 2125 $channel.find(".node").each(function (index, node) { 2126 alltab.All.push($(node).attr('id')); 2127 }); 2128 2129 // If switch to add the all tab == enabled, put at beginning 2130 if ($channel.hasClass('tabs-all') && $channel.find(".node").size()) { 2131 tabs = $.extend(alltab, tabs); 2132 } 2133 // Or perhaps put it at the end 2134 else if ($channel.hasClass('tabs-all-e') && $channel.find(".node").size()) { 2135 tabs = $.extend(tabs, alltab); 2136 } 2137 2138 //Binding function e.g. 'click' or 'hover' 2139 var bindingFunction = 'click'; 2140 2141 if ($channel.hasClass('tabs-show-hover')) { 2142 bindingFunction = 'mouseover'; 2143 } 2144 2145 var tabIndicesByHash = {}; 2146 2147 // Collect all tab names in preparation for sorting. Note that we can't use 2148 // the ECMAScript 5.0 Object.keys function, because it's not availabe in 2149 // IE 8 and such. 2150 var tabNames = [], tabName; 2151 for (tabName in tabs) { 2152 if (tabs.hasOwnProperty(tabName)) { 2153 tabNames.push(tabName); 2154 } 2155 } 2156 2157 // Sort from new to old in the case of post date years. 2158 if ($channel.hasClass('switch-tabs-post-date-year')) { 2159 var allAtEnd = $channel.hasClass('tabs-all-e'); 2160 2161 tabNames.sort(function(a, b) { 2162 if (a == 'All') { 2163 return allAtEnd ? 1 : -1; 2164 } 2165 else if (b == 'All') { 2166 return allAtEnd ? -1 : 1; 2167 } 2168 else { 2169 return -1 * a.localeCompare(b); 2170 } 2171 }); 2172 } 2173 2174 // Create a tablist which will contain all related tabs. 2175 var $dtabs = $('<div class="dtabs"></div>'); 2176 $dtabs.attr({ 2177 'role': 'tablist', 2178 'aria-label': 'Filter content by...', 2179 }); 2180 // Add our tablist at the top of the content channel. 2181 $dtabs.prependTo($channel.find('.block-content')); 2182 2183 // Create the tabs which controls which content to display. 2184 $.each(tabNames, function(i, tabName) { 2185 // An array of items by tabname => array(nodeID, nodeID, nodeID) 2186 var nodeIDs = tabs[tabName]; 2187 var tabClass; 2188 count++; 2189 2190 if (tabClasses[tabName]) { 2191 tabClass = tabClasses[tabName]; 2192 } 2193 2194 // Vary functionality based on views-row or node based rows markup.
2195 var rowBased = $channel.find('.views-row').length; 2196 2197 // Create the tab which controls visibility of it's related tabpanel content. 2198 var $tab = $('<div class="tab"></div>'); 2199 $tab.addClass('tab-' + count); 2200 if (tabClass) { 2201 $tab.addClass('tab-' + tabClass); 2202 } 2203 $tab.append('<span>' + tabName + ' <em>('+ nodeIDs.length +')</em></span>'); 2204 $tab.data('tabGroup', count); 2205 $tab.attr({ 2206 'role': 'tab', 2207 'aria-selected': false, 2208 'id': 'tabs-button_' + channelIndex + '-' + count, 2209 'tabindex': -1, 2210 }); 2211 2212 // Manage control assignment based on views-row or node based rows markup. 2213 var ariaControls = nodeIDs; 2214 if (rowBased) { 2215 ariaControls = $.map(nodeIDs, function(value) { return value + '-tabpanel'; }); 2216 } 2217 2218 // Aria controls are based on the node ids. 2219 $tab.attr('aria-controls', ariaControls.join(' ')); 2220 2221 // Add our tab to the tablist container. 2222 $tab.appendTo($dtabs); 2223 2224 // Properly identify the content related to each of the tabs within the tablist. 2225 $.each(nodeIDs, function(ii, nodeID) { 2226 var $underTabs = rowBased 2227 ? $channel.find('#' + nodeID).parent('.views-row') 2228 : $channel.find('#' + nodeID); 2229 2230 // Make sure we aren't duplicating efforts assigning variables. 2231 $underTabs.each(function(iii, tabPanelMember) { 2232 var $tabPanelMember = $(tabPanelMember); 2233 if (!$tabPanelMember.data('processed')) { 2234 $tabPanelMember.addClass('tab-content under-tab under-tab-' + count); 2235 $tabPanelMember.attr({ 2236 'role': 'tabpanel', 2237 'aria-labelledby': 'tabs-button_' + channelIndex + '-' + count, 2238 'tabindex': 0, 2239 }); 2240 2241 // Manage definition assignment based on views-row or node based rows markup. 2242 if (rowBased) { 2243 $underTabs.attr('id', nodeID + '-tabpanel'); 2244 } 2245 } else { 2246 var ariaLabelledBy = $tabPanelMember.attr('aria-labelledby'); 2247 $tabPanelMember 2248 .addClass('under-tab-' + count) 2249 .attr('aria-labelledby', ariaLabelledBy + ' tabs-button_' + channelIndex + '-' + count); 2250 } 2251 }); 2252 2253 // Mark these as process so we can not duplicate assignment to attributes. 2254 $underTabs.data('processed', true); 2255 }); 2256 2257 // Set the possible tab index based on a hash. 2258 var tabHash = tabName.replace(/\s+/g, '-').replace(/[^\w\d-]/g, '').toLowerCase(); 2259 tabIndicesByHash[tabHash] = count; 2260 }); 2261 2262 var $tabs = $dtabs.find('.tab'); 2263 $tabs.bind(bindingFunction, function(event) { 2264 // Remove active from all tabs 2265 $tabs 2266 .not(event.currentTarget) 2267 .removeClass('active') 2268 .attr({ 2269 'aria-selected': false, 2270 'tabindex': -1, 2271 }); 2272 2273 // Add active class to current tab 2274 $(event.currentTarget) 2275 .addClass('active') 2276 .attr({ 2277 'aria-selected': true, 2278 'tabindex': 0, 2279 }); 2280 2281 var duration = 250, 2282 $elementsToShow = $channel.find('.tab-content').filter('.under-tab-' + $(event.currentTarget).data('tabGroup')), 2283 $elementsToHide = $channel.find('.tab-content').not($elementsToShow); 2284 2285 // Hide all items under any tab 2286 $elementsToHide 2287 .animate({ opacity:'hide', height:'hide' }, duration) 2288 .removeClass('js-tabs-show'); 2289 2290 // Show items under current tab 2291 $elementsToShow 2292 .stop(true, true) 2293 .animate({ opacity:'show', height:'show' }, duration * 2) 2294 .addClass('js-tabs-show'); 2295 $elementsToShow 2296 .removeClass('hide-in'); 2297 }); 2298 2299 if (bindingFunction === 'mouseover') { 2300 $channel.mouseout(function() { 2301 $channel.find('.under-tab').addClass('hide-in'); 2302 $channel.find('.under-tab').data('hideIn', 3); 2303 }); 2304 $channel.find('.under-tab').mouseover(function() { 2305 $(this).removeClass('hide-in'); 2306 }); 2307 } 2308 2309 var match; 2310 2311 if ((match = document.location.hash.match(/^#tab-(.+)$/)) && (index = tabIndicesByHash[match[1]])) { 2312 $channel.find('.under-tab').hide(); 2313 $channel.find('.tab-' + index).get(0).click(); 2314 } else if ($channel.hasClass('tabs-1st')) { 2315 $channel.find('.under-tab').hide(); 2316 $channel.find('.tab-1').get(0).click(); 2317 } else if ($channel.hasClass('tabs-expand')) { 2318 $channel.find('.under-tab').hide(); 2319 } 2320 }); 2321}; 2322 2323/* 2324 * Identifies long undordered lists with relatively short items and adds a CSS class 2325 * Useful for stacking into two columns to save space. 2326 */ 2327Drupal.behaviors.ddIdentifyLongListsOfShortItems = function(context) { 2328 var uls = $(".node-content ul", context); 2329 if (uls.size()) { 2330 $.each(uls, function(k, ul) { 2331 var lis = $(ul).find("li"); 2332 var maxLiStringLength = 0; 2333 if (lis.size() > 3) { 2334 $.each (lis, function(k2, li) { 2335 if ($(li).text().length > maxLiStringLength) { 2336 maxLiStringLength = $(li).text().length; 2337 } 2338 }); 2339 } 2340 if (maxLiStringLength > 0 && maxLiStringLength < 50) { 2341 $(ul).addClass("long-list-of-short-items"); 2342 } 2343 }); 2344 } 2345}; 2346 2347Drupal.behaviors.ddNodeLevelTabs = function(context) { 2348 var instanceID = 0; 2349 var selector = '.node.h3s-tabs:not(.tabs-processed):not(.h3s-tabs-disable)'; 2350 $(selector, context).each(function(i, node) { 2351 var $node = $(node);
2352 var $elements = $node.find('.node-content').children(); 2353 var counter = -1; 2354 var tabs = []; 2355 2356 // Add processed identifier. 2357 $node.addClass('tabs-processed'); 2358 2359 // Utility array to store the tab content groupings. 2360 var groupings = []; 2361 2362 // Loop through and label all tabbed content appropriately. 2363 $elements.each(function(ii, element) { 2364 var $element = $(element); 2365 if (element.tagName.toLowerCase() == 'h3' && $.trim($element.text())) { 2366 counter++; 2367 groupings[counter] = []; 2368 tabs[counter] = $element.text(); 2369 } 2370 if (counter >= 0) { 2371 groupings[counter].push(element); 2372 } 2373 }); 2374 2375 // Place all related content into a containing tabpanel element. 2376 $.each(groupings, function (ii, group) { 2377 var $contents = $('<div class="under-tab"></div>'); 2378 $contents.attr({ 2379 'role': 'tabpanel', 2380 'aria-labelledby': 'h3tabs-button_' + instanceID + '-' + ii, 2381 'id': 'h3tabs-tabpanel_' + instanceID + '-' + ii, 2382 'tabindex': 0, 2383 }); 2384 $contents.data('id', ii); 2385 $(group).wrapAll($contents); 2386 }) 2387 2388 // Create the tabs which controls which content to display. 2389 var $dtabs = $('<div class="dtabs"></div>'); 2390 $dtabs.attr({ 2391 'role': 'tablist', 2392 'aria-label': 'Filter content by...', 2393 }); 2394 2395 if (tabs.length) { 2396 $dtabs.insertBefore($node.find('.under-tab').eq(0)); 2397 } 2398 2399 $.each(tabs, function(ii, tab) { 2400 var $tab = $('<div class="tab"></div>'); 2401 $tab.append('<span>' + tab + '</span>'); 2402 $tab.addClass('show-tab-' + ii); 2403 $tab.data('id', ii); 2404 $tab.attr({ 2405 'role': 'tab', 2406 'aria-selected': false, 2407 'aria-controls': 'h3tabs-tabpanel_' + instanceID + '-' + ii, 2408 'id': 'h3tabs-button_' + instanceID + '-' + ii, 2409 }); 2410 2411 // Manage tab and tabpanel state on user interaction or init. 2412 $tab.bind('click', function(event) { 2413 var id = $(event.currentTarget).attr('id').replace('button', 'tabpanel'); 2414 $node.find('.under-tab').hide(); 2415 $node.find('#' + id).fadeIn('fast'); 2416 $dtabs.children() 2417 .removeClass('active') 2418 .attr('aria-selected', false); 2419 $(event.currentTarget) 2420 .addClass('active') 2421 .attr('aria-selected', true); 2422 }); 2423 2424 // Add the tab to the tablist. 2425 $tab.appendTo($dtabs); 2426 }); 2427 2428 // Expand first tab by default. 2429 var currentTab = 0; 2430 2431 // Expand tabbed content based on hash. 2432 if (window.location.hash.length) { 2433 var $hashed = $node.find(window.location.hash); 2434 if ($hashed.length) { 2435 if ($hashed.is('.under-tab')) { 2436 currentTab = $hashed.data('id'); 2437 } else if ($hashed.parents('.under-tab').length) { 2438 currentTab = $hashed.parents('.under-tab').data('id'); 2439 } 2440 } 2441 } 2442 2443 // Expand whatever tab is set to be currently active. 2444 if (document.getElementById('h3tabs-button_' + instanceID + '-' + currentTab) !== null) { 2445 document.getElementById('h3tabs-button_' + instanceID + '-' + currentTab).click(); 2446 } 2447 2448 // Advance the instanceID of this tabset by 1. 2449 instanceID += 1; 2450 }); 2451}; 2452 2453//To hide an element, give it the class hide-in and set $(element).data('hideIn', 4) for a four second coundown 2454 2455Drupal.behaviors.ddHideInXSecondsChecker = function(context) { 2456 Drupal.settings.ddCheckHideInXSeconds = function() { 2457 $.each($(".hide-in"), function (i, v) { 2458 var hideIn = $(v).data("hideIn"); 2459 if (typeof hideIn === 'undefined') { 2460 hideIn = 0; 2461 } 2462 if (hideIn > 0) { 2463 $(v).data("hideIn", hideIn - 1); 2464 } 2465 else { 2466 $(v).data("hideIn", 0); 2467 $(v).removeClass("hide-in"); 2468 $(v).fadeOut("fast"); 2469 2470 2471 2472 var activeTab = $(v).parents(".channel").eq(0).find(".dtabs .tab.active").attr('rel'); 2473 if (typeof activeTab === 'string') { 2474 if ($(v).hasClass("under-tab-" + activeTab)) { 2475 $(v).parents(".channel").eq(0).find(".dtabs .tab.active").removeClass('active'); 2476 } 2477 } 2478 } 2479 }); 2480 Drupal.settings.ddHideTimer = setTimeout(Drupal.settings.ddCheckHideInXSeconds, 1000); 2481 }; 2482 2483 Drupal.settings.ddHideTimer = setTimeout(Drupal.settings.ddCheckHideInXSeconds, 1000); 2484 2485}; 2486 2487Drupal.behaviors.randomDisplay = function(context) { 2488 //get any channel with a random-### class on it. 2489 //e.g. random-4, which means to pick 4 elements to display 2490 //each item gets .picked class 2491 2492 var i, randomChannels, originalHtml, numberOfItemsToPick, numberOfItemsToConsider, collection, itemsNotPicked, randomNum, randomItemToPick, randomItem, picked; 2493 2494 randomChannels = $(".channel[class*='random-']", context); 2495 $.each(randomChannels, function(k,v) { 2496 2497 // Stores original HTML (.block-content) for the admin in the tblock.data('originalHtml'); 2498 // if ( $(v).data('originalHtml')) { 2499 // $(v).find(".block-inner").replaceWith($(v).data('originalHtml')); 2500 // } 2501 // else { 2502 // originalHtml = $(v).html(); 2503 // } 2504 $(v).find('.views-row').removeClass("picked"); 2505 numberOfItemsToPick = $(v).attr('class').split('random-').pop().slice(0,1); 2506 numberOfItemsToConsider = $(v).find(".views-row").length; 2507 // grab the last character of the class, e.g. 4 from .random-4 2508 // note: won't work above 9 2509 collection = $('<div class="view-content"></div>'); 2510 for (i = 1; i <= numberOfItemsToPick; i++) { 2511 itemsNotPicked = numberOfItemsToConsider - i + 1;
2512 randomNum = Math.ceil(Math.random()*itemsNotPicked); //pick a number between 1 and itemsNotPicked 2513 randomItemToPick = randomNum - 1; //the index starts with zero, so reduce by 1 2514 randomItem = $(v).find(".views-row:not(.picked)").eq(randomItemToPick); 2515 randomItem.addClass("picked"); 2516 $(collection).append(randomItem); 2517 } 2518 2519 picked = $(collection); 2520 2521 // $(v).data('originalHtml', originalHtml); 2522 $(v).find(".view-content").replaceWith(picked); 2523 2524 }); 2525}; 2526 2527Drupal.behaviors.externalWindowsForAttachments = function(context) { 2528 $(".node-links .link-file a").attr('target', '_blank'); 2529 $(".node-content .file a").attr('target', '_blank'); 2530}; 2531 2532/** 2533 * Behavior to apply the overview default state for the Teaser behavior class. 2534 */ 2535Drupal.behaviors.defaultTeaserDisplayOverview = function (context) { 2536 var overviews_without_display = $('.dd-overview-block', context).not('.open-new, .te-open-slideshow, .open-lightframe, .webform-ajax, .disable-links'); 2537 overviews_without_display.each(function () { 2538 $(this).addClass('te-open-slideshow'); 2539 }); 2540}; 2541 2542Drupal.behaviors.nodeEffects = function(context) { 2543 // TODO: This is broken, remove? 2544 $('.switch-pod-subt', context).each(function() { 2545 var $subtitle = $(this).find('.subtitle'); 2546 $subtitle.hide(); 2547 2548 $(this).find('.node-header a').hover(function() { 2549 $subtitle.animate({'opacity': '1', 'max-height':'200px'}, 'medium'); 2550 }, function() { 2551 $subtitle.animate({'opacity': '0', 'max-height':'0px'}, 'medium'); 2552 }); 2553 }); 2554 2555 // TODO: This is ancient, remove? 2556 $(".switch-pod-slide .node-header a", context).hover(function() { 2557 $(this).find('.subtitle').slideDown('medium'); 2558 }, function() { 2559 $(this).find('.subtitle').slideUp('medium'); 2560 }); 2561 2562 // TODO: This is ancient, remove? 2563 $('.switch-img-swap .node-inner').each(function(k, v) { 2564 var image1Src = $(v).find('.field-image > a > img:visible').eq(0).attr('src'); 2565 var image2Src = $(v).find('.slideshow-images > a > img').eq(0).attr('src'); 2566 2567 $(v).find('.field-image > a > img').hover(function() { 2568 $(v).find('.field-image > a > img').attr('src', image2Src); 2569 }, function() { 2570 $(v).find('.field-image > a > img').attr('src', image1Src); 2571 }); 2572 }); 2573 2574 $('.open-new').each(function() { 2575 $(this).find('.node-header a, .field-image a, .link-read-more a').attr('target', '_blank'); 2576 }); 2577 2578 $('.open-lightframe').each(function() { 2579 // Videos. 2580 $(this).find('.node-header a, .field-image.field-video a, .link-read-more a').attr('rel', 'lightframe').attr('target', ''); 2581 2582 // Images. 2583 var img_links = $(this).find(".field-image.field-not-video:not(.image-to-url) a"); 2584 $.each(img_links, function (key, link) { 2585 var img = $(link).find('img'); 2586 if (img) { 2587 var src = img.attr('src'); 2588 2589 // If this is a site image, use the lightbox ImageCache preset. 2590 src = src.replace( 2591 /\/sites\/(main|default)\/files(\/imagecache\/[^\/]+)\/main-images\//, 2592 '/sites/$1/files/imagecache/lightbox/main-images/' 2593 ); 2594 2595 $(link).attr('href', src); 2596 $(link).attr('rel', 'lightbox'); 2597 } 2598 }); 2599 }); 2600 2601 /* 2602 var openInLightframe = $(".open-lightframe .node-header a, .open-lightframe .field-image a, .open-lightframe .link-read-more a"); 2603 openInLightframe 2604 Drupal.attachBehaviors(openInLightframe); 2605 */ 2606 2607 $(".te-open-slideshow .node, .te-open-slideshow.node",context).each(function() { 2608 // Images. 2609 var img_links = $(this).find(".field-image.field-not-video:not(.image-to-url) a"); 2610 $.each(img_links, function (key, link) { 2611 var img = $(link).find('img'); 2612 if (img) { 2613 var src = img.attr('src'); 2614 2615 // If this is a site image, use the lightbox ImageCache preset. 2616 src = src.replace( 2617 /\/sites\/(main|default)\/files(\/imagecache\/[^\/]+)\/main-images\//, 2618 '/sites/$1/files/imagecache/lightbox/main-images/' 2619 ); 2620 2621 $(link).attr('href', src); 2622 $(link).attr('rel', 'lightbox'); 2623 } 2624 }); 2625 Drupal.attachBehaviors(img_links); 2626 2627 // Videos.
2628 var video = $(this).find(".field-image.field-video a"); 2629 $.each(video, function () { 2630 $(this).attr('rel', 'lightframe').attr('target', ''); 2631 }); 2632 }); 2633 2634 $(".te-webform-compact .node-webform div:not(.dd_captcha) div.type-textfield", context).each(function() { 2635 var labeltext = $(this).find('label').text().replace(':', '').replace('*', '').trim(); 2636 var inputbox = $(this).find('input'); 2637 2638 if (inputbox.attr('size') === '60') { 2639 inputbox.attr('size', '20'); 2640 } 2641 2642 inputbox.attr('title', labeltext); 2643 2644 if (! inputbox.val().length) { 2645 inputbox.val(labeltext); 2646 } 2647 2648 inputbox.focus(function() { 2649 if ($(this).val() === $(this).attr('title')) { 2650 $(this).val(''); 2651 } 2652 }); 2653 inputbox.blur(function() { 2654 if ($(this).val() === '') { 2655 $(this).val($(this).attr('title')); 2656 } 2657 }); 2658 }); 2659 2660 $(".webform-ajax form.webform-client-form", context).submit( function() { 2661 var webform = $(this).parent(); 2662 webform.find("input.form-text").each(function() { 2663 if ($(this).val() === $(this).attr('title')) { 2664 $(this).val(''); 2665 } 2666 }); 2667 webform.fadeTo("fast", 0.5); 2668 webform.find("input[type='submit']").hide(); 2669 webform.find(".form-submit").before("<span class='saving-webform'>Saving...</span>"); 2670 webform.find(".saving-webform").hide().fadeIn('fast'); 2671 2672 $.post($(this).attr('action'), $(this).serialize(), function(response) { 2673 var confirmation = $(response).find(".webform-confirmation"); 2674 if (confirmation.size()) { 2675 webform.html(confirmation); 2676 webform.parents(".node").eq(0).addClass('webform-submitted-via-ajax'); 2677 } 2678 else { 2679 webform.find(".saving-webform").remove(); 2680 var problem = $(response).find(".messages.error"); 2681 webform.append(problem); 2682 webform.find("input[type='submit']").show(); 2683 webform.find(".messages.error").dialog({ modal: true, height: 'auto'}); 2684 } 2685 webform.fadeTo("fast", 1); 2686 }); 2687 return false; 2688 }); 2689}; 2690 2691Drupal.behaviors.slideshowImageBehaviors = function(context) { 2692 $.each($(".icpb-fullscreenslides.node, .icpb-fullscreenslides .node", context), function(k,v) { 2693 2694 //Remove any previous click events 2695 $(v).find(".field-image a").unbind("click"); 2696 $(v).find(".field-image a").attr("rel", ""); 2697 //For each image, set the new source to the full original images 2698 $.each($(v).find(".field-image a img"), function(k,v) { 2699 $(v).attr("src", $(v).attr("src").replace(/(imagecache\/\w+\/)/i, '')); 2700 }); 2701 2702 //When an image is clicked, set the background image source to the current image 2703 $(v).find(".field-image a").click(function(e) { 2704 $("body").addClass("fullslide-mode"); 2705 $("body").css("background-image", "url(" + $(this).find("img").attr("src") + ")"); 2706 //Mark the link containing the current image with a class 2707 $(v).find(".field-image a").removeClass("currently-displaying-as-full-slide"); 2708 $(this).addClass("currently-displaying-as-full-slide"); 2709 e.preventDefault(); 2710 }); 2711 2712 //Setup forward and back buttons. Escape exits the slideshow. 2713 //Todo: add an X button to exit 2714 $(document).unbind("keydown"); 2715 $(document).keydown(function(e){ 2716 if (e.keyCode == 37) { 2717 $(".currently-displaying-as-full-slide").parent().prev().find("a").click(); 2718 } 2719 if (e.keyCode == 39) { 2720 $(".currently-displaying-as-full-slide").parent().next().find("a").click(); 2721 } 2722 if (e.keyCode == 27) { 2723 $("body").removeClass("fullslide-mode"); 2724 window.location.reload(); 2725 } 2726 }); 2727 }); 2728 2729 2730}; 2731 2732Drupal.behaviors.foucChecks = function(context) { 2733 $(".fouc .node", context).css("visibility", "visible"); 2734}; 2735 2736Drupal.behaviors.correctLastVisibleClasses = function(context) { 2737 // Find all places where meta items appear 2738 $('.meta-inner').each(function() { 2739 // Find all visible meta items in this parent 2740 // Optimization: $('.meta-item:visible', this) is slower, see 2741 // http://jsperf.com/class-visible-vs-filter 2742 var items = $(this).find('.meta-item').filter(':visible'); 2743 2744 if (items.length > 0) { 2745 // Add a last class to the last visible meta item in this parent 2746 items.eq(items.length - 1).addClass('last'); 2747 } 2748 }); 2749}; 2750 2751Drupal.behaviors.ddDisableLinks = function(context) { 2752 $('.disable-links', context).each(function() { 2753 var $context = $(this); 2754 var $links = $context.find('.node-header a, .field-image a, .link-read-more a'); 2755 2756 $links.each(function() { 2757 var $link = $(this); 2758 2759 // Skip video lightframes.
2760 if ($link.parents().is('.field-video')) { 2761 return; 2762 } 2763 2764 $link.attr('href', '').attr('target', ''); 2765 }); 2766 2767 $links.click(function() { 2768 return false; 2769 }); 2770 }); 2771}; 2772 2773Drupal.behaviors.emailHide = function(context) { 2774 if ($(".field-email", context).size()) { 2775 $(".field-email", context).each(function(index) { 2776 this.innerHTML = this.innerHTML.replace(/\[remove-this-and-replace-with-at\]/g, '@'); 2777 }); 2778 } 2779}; 2780 2781Drupal.behaviors.initializeStandardClasses = function (context) { 2782 $(".has-video .pod-images", context).click(function() { 2783 $(this).parents(".node").find(".field-image a").trigger('click'); 2784 return false; 2785 }); 2786}; 2787 2788Drupal.behaviors.disableVideoFlashOnMobile = function(context) { 2789 var isiPad = navigator.userAgent.match(/iPad/i) !== null; 2790 var isiPhone = navigator.userAgent.match(/iPhone/i) !== null; 2791 2792 if (isiPad || isiPhone) { 2793 $("a.video-lightframe").unbind('click'); 2794 $(".node.has-video").each(function () { 2795 $(this).find(".pod-images").unbind('click'); 2796 $(this).find(".node-upper-image a, .node-image a").unbind('click'); 2797 $(this).find(".node-upper-image a, .node-image a").attr('rel',''); 2798 $(this).find(".node-upper-image a, .node-image a").attr('href', $(this).find("a.video-lightframe").eq(0).attr('href')); 2799 }); 2800 } 2801}; 2802 2803 2804Drupal.behaviors.dmodelCarousel = function(context) { 2805 var carouselNavigation = "<div class='carousel-navigation'><div class='carousel-previous'><a href='#'><span>«</span></a></div><div class='carousel-pager'></div><div class='carousel-next'><a href='#'><span>»</span></a></div></div>"; 2806 $("div[class*='switch-carousel-'].carousel-enabled .view-content", context).cycle('destroy'); 2807 2808 $("div[class*='switch-carousel-']:not('.switch-carousel-disable')", context).each(function () { 2809 2810 var classes = $(this).attr('class').split(' '); 2811 var ID = $(this).attr('id'); 2812 var isSubtermContainer = ($(this).attr('class').indexOf('main-channel-subterm-') > -1); 2813 var baseContainer = '.view-content'; 2814 2815 if (isSubtermContainer) { 2816 baseContainer = '.subterm-inner'; 2817 } 2818 2819 var defaultSettings = { 2820 fx: 'fade', 2821 next: '#' + ID + ' .carousel-navigation .carousel-next', 2822 prev: '#' + ID + ' .carousel-navigation .carousel-previous', 2823 timeout: '8000', 2824 pause: true, 2825 pauseOnPagerHover: true, 2826 pager: '#' + ID + ' .carousel-navigation .carousel-pager', 2827 activePagerClass: 'active-slide', 2828 cleartype: true, 2829 cleartypeNoBg: true 2830 }; 2831 2832 2833 var customSettings = { 2834 2835 'switch-carousel-fade' : {fx: 'fade', delay: -1000}, 2836 'switch-carousel-fade-slow' : {fx: 'fade', delay: 1000, speedOut: 1500, speedIn: 2000}, 2837 'switch-carousel-cover' : {fx: 'cover'}, 2838 'switch-carousel-uncover' : {fx: 'uncover'}, 2839 'switch-carousel-scroll-down' : {fx: 'scrollDown'}, 2840 'switch-carousel-slide-simple' : {fx: 'scrollHorz'}, 2841 'switch-carousel-slider' : {fx: 'scrollFade'}, 2842 2843 'show-carousel-nav' : {next: defaultSettings.next, prev: defaultSettings.prev}, 2844 'show-carousel-numbered' : {pagerAnchorBuilder: function(index, e) { return '<a href="#"><span>' + (index + 1) + '</span></a>'; } }, 2845 'show-carousel-pager-titles-5r' : {pagerAnchorBuilder: function(index, e) { return '<a href="#">' + $('.node-header a .title', e).html() + "</a>"; } }, 2846 'show-carousel-pager-titles-4b' : {next: defaultSettings.next, prev: defaultSettings.prev, pagerAnchorBuilder: function(index, e) { return '<a href="#"><span>' + $('.node-header .title', e).html() + "</span></a>"; } }, 2847 'show-carousel-pager-dots' : {next: defaultSettings.next, prev: defaultSettings.prev, pagerAnchorBuilder: function(index, e) { return '<a href="#"><span>•</span></a>'; } }, 2848 2849 'carousel-random' : {random: 1}, 2850 'carousel-not-random' : {random: false}, 2851 2852 'carousel-repeat' : {nowrap: 0}, 2853 'carousel-nowrap' : {nowrap: 1}, 2854 2855 'carousel8' : {timeout: 8000}, 2856 'carousel12' : {timeout: 12000}, 2857 'carousel6' : {timeout: 6000}, 2858 'carousel3' : {timeout: 3000}, 2859 'carousel-manual-advance' : {timeout: 0} 2860 }; 2861 2862 var settings = defaultSettings; 2863 2864 $.each(classes, function(index, val) { 2865 if (val && typeof customSettings[val] === 'object') { 2866 $.extend(settings, customSettings[val]); 2867 } 2868 }); 2869 2870 $(this).addClass("carousel-enabled"); 2871 2872 $(baseContainer, this).before(carouselNavigation).cycle(settings); 2873 $(baseContainer, this).dblclick(function() { 2874 $(this).cycle("pause"); 2875 }); 2876 }); 2877}; 2878 2879/** 2880 * DD Classes: Accordions 2881 */ 2882 2883Drupal.behaviors.ddAccordion = function(context) { 2884 // Find all accordions that haven't been initialized yet 2885 var $h3accordions = $('.h3accordion.node:not(.accordion-processed), .h3accordion .node:not(.accordion-processed)', context), 2886 $h4accordions = $('.h4accordion.node:not(.accordion-processed), .h4accordion .node:not(.accordion-processed)', context); 2887 2888 // Used to identify nodes with accordions 2889 $h3accordions.addClass('h3a'); 2890 $h4accordions.addClass('h4a'); 2891 2892 // Iterate through each creating new accordion instances 2893 $h3accordions.add($h4accordions).each(function(id) { 2894 // Only process the accordion instance if it's not been disabled 2895 if (!$(this).hasClass('noaccordion')) { 2896 new Drupal.DDAccordion(this, id); 2897 } 2898 }); 2899}; 2900 2901Drupal.DDAccordion = function(element, id) { 2902 this.instanceID = id; 2903 this.accordion = element; 2904 this.$accordion = $(element); 2905 this.$headings = []; 2906 this.$contents = []; 2907 this.animations = Drupal.DDClassesAnimations; 2908 this.tag = this.getTag(); 2909 this.multipleAllowed = this.setMultipleAllowed(); 2910 this.duration = 300; 2911 this.init(); 2912}; 2913 2914Drupal.DDAccordion.prototype = { 2915 init: function() { 2916 var self = this; 2917 2918 // Mark this accordion processed 2919 self.$accordion.addClass("accordion-processed accordion"); 2920
2921 // Group all elements within node content 2922 var $elements = self.$accordion.find(".node-content .body, .node-content .teaser, .node-content .body .under-tab, .node-content .teaser .under-tab").find('> *'); 2923 if (!$elements.length) { 2924 $elements = self.$accordion.find(".node-content, .node-content .under-tab").find('> *'); 2925 } 2926 2927 var groups = [], 2928 counter = -1, 2929 passedH3 = false; 2930 2931 $.each($elements, function(id, element) { 2932 var $element = $(element), 2933 tagName = element.tagName.toLowerCase(); 2934 2935 // If processing h4s as tabs and we pass an h3, mark the flag 2936 if (self.tag == 'h4' && tagName == 'h3') { 2937 passedH3 = true; 2938 } 2939 2940 // Filters for the heading tag element 2941 if (self.tag == tagName && $.trim($element.text())) { 2942 counter++; 2943 passedH3 = false; 2944 groups[counter] = []; 2945 $element.addClass('accordion-heading'); 2946 2947 // Add support when anchors are added within a heading. 2948 if ($element.find('a[id]').length) { 2949 var hash = $element.find('a[id]').attr('id'); 2950 $element.attr('id', hash); 2951 } 2952 2953 var $link = $('<a href="#"><i class="icon"></i><span class="link-text">' + $element.text() + '</span></a>'); 2954 // Add required accessible attributes to our accordion heading link/button. 2955 $link.attr({ 2956 'role': 'button', 2957 'aria-expanded': false, 2958 'aria-controls': 'accordion-content-' + self.instanceID + '-' + counter, 2959 'id': 'accordion-heading-' + self.instanceID + '-' + counter, 2960 }); 2961 2962 // Fill in contents of heading with our custom markup. 2963 $element.html($link); 2964 2965 // And make sure they don't scroll to the top of the page when clicked 2966 $element.find('a').click(function(event) { 2967 event.preventDefault(); 2968 }); 2969 } 2970 2971 // Filters for the content following each tag element 2972 if (counter >= 0 && !passedH3) { 2973 groups[counter].push(element); 2974 } 2975 }); 2976 2977 // Iterate through content associated with each tab 2978 $.each(groups, function(id) { 2979 var $content = $(groups[id].slice(1)); 2980 var $accordionContent = $('<div class="accordion-content"></div>'); 2981 // Add required accessible attributes to our accordion content. 2982 $accordionContent.attr({ 2983 'role': 'region', 2984 'aria-labelledby': 'accordion-heading-' + self.instanceID + '-' + id, 2985 'id': 'accordion-content-' + self.instanceID + '-' + id, 2986 }); 2987 $content.wrapAll($accordionContent); 2988 }); 2989 2990 // Save references to all accordion headings 2991 self.$headings = self.$accordion.find('.accordion-heading'); 2992 2993 // Save references to all accordion content 2994 self.$contents = self.$accordion.find('.accordion-content'); 2995 2996 // Add a click handler to each accordion heading 2997 self.$headings.bind('click', {scope: self}, self.clickHandler); 2998 2999 // Default to setting all accordions collapsed. 3000 this.deactivate(self.$headings); 3001 self.animations.collapse(self.$contents, self.duration); 3002 3003 // If it has the 1st class, expand the first accordion. 3004 if (self.$accordion.hasClass('accordion-1st') || self.$accordion.parents('.accordion-1st').length) { 3005 this.$headings.eq(0).click(); 3006 } 3007 3008 // Expand accordions based on a hash. 3009 if (window.location.hash.length) { 3010 // Expand accordion if heading id matches the hash. 3011 self.$headings.filter(window.location.hash).click(); 3012 3013 // Expand accordion if content contains an identified element matching the hash. 3014 self.$contents.find(window.location.hash) 3015 .parents('.accordion-content') 3016 .prev('.accordion-heading') 3017 .click(); 3018 } 3019 }, 3020 clickHandler: function(event) { 3021 var self = event.data.scope, 3022 $heading = $(this), 3023 $content = $heading.next('.accordion-content'); 3024 3025 if ($content) { 3026 // Muliple open at once 3027 if (self.multipleAllowed) { 3028 if ($heading.is('.active')) { 3029 self.deactivate($heading); 3030 self.animations.collapse($content, self.duration); 3031 } else { 3032 self.activate($heading); 3033 self.animations.expand($content, self.duration); 3034 } 3035 } else { 3036 // One open at a time 3037 if ($heading.is('.active')) { 3038 // Deactive these elements 3039 self.deactivate($heading); 3040 self.animations.collapse($content, self.duration); 3041 } else { 3042 // Activate these elements 3043 self.activate($heading); 3044 self.animations.expand($content, self.duration); 3045 // Deactivate these elements 3046 self.deactivate(self.$headings.not($heading)); 3047 self.animations.collapse(self.$contents.not($content), self.duration); 3048 setTimeout(() => { 3049 $heading[0].scrollIntoView(); 3050 }, 500); 3051 } 3052 } 3053 } 3054 }, 3055 // Manages the 'active' state of our accordion headings. 3056 activate: function($elements) { 3057 $elements.addClass('active'); 3058 $elements.find('[role="button"]').attr('aria-expanded', true); 3059 }, 3060 // Manages the 'inactive' state of our accordion headings. 3061 deactivate: function($elements) { 3062 $elements.removeClass('active'); 3063 $elements.find('[role="button"]').attr('aria-expanded', false); 3064 }, 3065 getTag: function () { 3066 var tag = 'h3'; 3067 3068 if (this.$accordion.hasClass('h4a')) { 3069 tag = 'h4'; 3070 } 3071 3072 return tag; 3073 }, 3074 setMultipleAllowed: function() { 3075 // Set multi flag 3076 return this.$accordion.hasClass('accordion-multi') || this.$accordion.parents('.accordion-multi').length; 3077 } 3078}; 3079 3080/*
3081 * Function to append TOC to the sidebar if node has class toc-right or toc-left. 3082 */ 3083function appendTocToSidebar(context) { 3084 var leftSidebar = $('aside.page-left',context).find('div.page-sidebar.inner'); 3085 var rightSidebar = $('aside.page-right',context).find('div.page-sidebar.inner'); 3086 var tocRight = $('.toc-right'); 3087 var tocLeft = $('.toc-left'); 3088 3089 tocRight.find('#toc-wrapper').appendTo(rightSidebar).addClass('sidebar-toc'); 3090 tocLeft.find('#toc-wrapper').appendTo(leftSidebar).addClass('sidebar-toc'); 3091} 3092 3093Drupal.behaviors.switchTableOfContents = function(context) { 3094 3095 $("#toc-wrapper").remove(); 3096 3097 $("#node-full.s-toc .node-content", context).prepend("<div id='toc-wrapper'><h2 id='toc-top' class='toc-title'>Table of contents</h2><ul id='toc'></ul></div>"); 3098 $("#node-full.s-toc #toc", context).hide().tableOfContents( 3099 $("#node-full.s-toc"), // Scoped to this element 3100 { 3101 startLevel: 3, // H2 and up 3102 depth: 2, // H2 through H4, 3103 topLinks: true // Add "Top" Links to Each Header 3104 } 3105 ).show(); 3106 3107 $(".channel.s-toc .block-inner", context).prepend("<div id='toc-wrapper'><h2 id='toc-top' class='toc-title'>In this section</h2><ul id='toc'></ul></div>"); 3108 $(".channel.s-toc #toc", context).hide().tableOfContents( 3109 $("#toc-wrapper ~"), // Scoped to this element 3110 { 3111 startLevel: 2, // H2 and up 3112 depth: 3, // H2 through H4, 3113 topLinks: true // Add "Top" Links to Each Header 3114 } 3115 ).slideDown("slow"); 3116 3117 //Legacy switch-toc support for help and other areas 3118 3119 $(".switch-toc", context).prepend("<div id='toc-wrapper'><h2 id='toc-top' class='toc-title'>In this section</h2><ul id='toc'></ul></div>"); 3120 $(".switch-toc #toc", context).hide().tableOfContents( 3121 $(".switch-toc"), // Scoped to this element 3122 { 3123 startLevel: 3, // H2 and up 3124 depth: 2, // H2 through H4, 3125 topLinks: true // Add "Top" Links to Each Header 3126 } 3127 ).slideDown("slow"); 3128 3129 // TOC position. 3130 // If we have class toc-right or toc-left it will append TOC to the sidebar. 3131 // Otherwise it will stay on top of the node. 3132 if($(window).width() >= 1025) { 3133 appendTocToSidebar(context); 3134 } 3135 3136 $(window).resize(function() { 3137 var toc = $('#toc-wrapper'); 3138 if ($(this).width() >= 1025) { 3139 appendTocToSidebar(context); 3140 } 3141 else { 3142 $("#node-full.s-toc .node-content", context).prepend(toc); 3143 toc.removeClass('sidebar-toc'); 3144 } 3145 }); 3146}; 3147 3148Drupal.behaviors.fixLightbox = function(context) { 3149 (function() { 3150 if (typeof Lightbox !== 'undefined') { 3151 Lightbox.filterXSS = function(str, allowed_tags) { 3152 return str.replace(/<\/?[^>]+(>|$)/g, ""); 3153 }; 3154 Lightbox.alternative_layout = 1; 3155 Lightbox.isSlideshow = true; 3156 Lightbox.togglePlayPause('lightshowPause', 'lightshowPlay'); 3157 } 3158 }()); 3159}; 3160 3161 3162Drupal.behaviors.forceRowsToHaveSameHeight = function(context) { 3163 3164 var channels = $(".channel.force-rows", context); 3165 3166 $.each(channels, function (channel_k, channel_v) { 3167 var nodes = $(channel_v).find(".node"); 3168 var numberOfNodesInChannel = $(channel_v).size(); 3169 var lastTop = 0; 3170 var maxH = 1; 3171 var rowCount = 0; 3172 3173 //Reset height 3174 $(channel_v).find(".dd-row").height(""); 3175 3176 $.each(nodes, function (k,v) { 3177 var itemHeight = $(v).height(); 3178 var currentPosition = $(v).position(); 3179 3180 if (currentPosition.top != lastTop) { 3181 rowCount++; 3182 lastTop = currentPosition.top; 3183 if (rowCount == 1) { 3184 $(channel_v).find(".dd-current-row").addClass("dd-first-row"); 3185 } 3186 if (k == numberOfNodesInChannel) { 3187 $(channel_v).find(".dd-current-row").addClass("dd-last-row"); 3188 } 3189 3190 $(channel_v).find(".dd-current-row").height(maxH); 3191 $(channel_v).find(".dd-current-row").removeClass("dd-current-row"); 3192 maxH = 0; 3193 } 3194 $(v).addClass('dd-current-row').addClass('dd-row'); 3195 if (itemHeight > maxH) { 3196 maxH = itemHeight; 3197 } 3198 3199 3200 }); 3201 }); 3202 3203}; 3204 3205Drupal.behaviors.ddClassesImageGalleryPlugin = function(context) { 3206 // Elements identified by the image-gallery classname. 3207 $('.image-gallery', context).each(function() { 3208 var $instance = $(this), 3209 classes = $instance.attr('class').split(/\s/), 3210 options = {}; 3211 3212 // Available plugins configurable options manipulated by classnames. 3213 var customSettings = { 3214 // Autoplay 3215 'gallery-ap': {autoPlay: true},
3216 'gallery-no-ap':{autoPlay: false}, 3217 // Progress bar 3218 'gallery-pb': {showProgressBar: true}, 3219 'gallery-no-pb':{showProgressBar: false}, 3220 // Aspect ratio 3221 'gallery-ar43': {aspectRatio: '4:3'}, 3222 'gallery-ar34': {aspectRatio: '3:4'}, 3223 'gallery-ar32': {aspectRatio: '3:2'}, 3224 'gallery-ar11': {aspectRatio: '1:1'}, 3225 'gallery-ar169':{aspectRatio: '16:9'}, 3226 // Animation duration 3227 'gallery-ad4': {duration: 400}, 3228 'gallery-ad6': {duration: 600}, 3229 'gallery-ad8': {duration: 800}, 3230 'gallery-ad10': {duration: 1000}, 3231 // Duration between slides 3232 'gallery-sd4': {slideshowDuration: 4000}, 3233 'gallery-sd6': {slideshowDuration: 6000}, 3234 'gallery-sd8': {slideshowDuration: 8000}, 3235 'gallery-sd10': {slideshowDuration: 10000}, 3236 'gallery-sd12': {slideshowDuration: 12000} 3237 }; 3238 3239 // See if one of the classnames is an object key. 3240 $.each(classes, function(key, value) { 3241 if (value && typeof customSettings[value] === 'object') { 3242 $.extend(options, customSettings[value]); 3243 } 3244 }); 3245 3246 // Create image gallery instances. 3247 $instance.gallery(options); 3248 }); 3249}; 3250 3251/** 3252 * Enables expanding overviews on term pages when "read more" is clicked. 3253 */ 3254Drupal.behaviors.ddClassesExpanding = function(context) { 3255 $('.oexpanding .expanding', context).each(function() { 3256 var teaser = $(this).find('.teaser'), 3257 body = $(this).find('.body'), 3258 readmore = $(this).parents('div.node-inner').find('.link-read-more'); 3259 readmore.find('a').click(function(e) { 3260 e.preventDefault(); 3261 teaser.hide(); 3262 body.show(); 3263 readmore.hide(); 3264 $(this).parents('div.node').removeClass('has-more'); 3265 }); 3266 }); 3267}; 3268 3269/* 3270(function(d){d.fn.shuffle=function(c){c=[];return this.each(function(){c.push(d(this).clone(true))}).each(function(a,b){d(b).replaceWith(c[a=Math.floor(Math.random()*c.length)]);c.splice(a,1)})};d.shuffle=function(a){return d(a).shuffle()}})(jQuery); 3271 3272*/ 3273 3274/* 3275 TableOfContents Plugin for jQuery 3276 3277 Programmed by Doug Neiner 3278 Edited by Dennis Stevense for Digital Deployment 3279 3280 Version: 0.8-digitaldeployment 3281 3282 Based on code and concept by Janko Jovanovic 3283 in his article: http://www.jankoatwarpspeed.com/post/2009/08/20/Table-of-contents-using-jQuery.aspx 3284 3285 This plugin is offered under the MIT license: 3286 3287 (c) 2009 by Doug Neiner, http://dougneiner.com 3288 3289 Permission is hereby granted, free of charge, to any person obtaining 3290 a copy of this software and associated documentation files (the 3291 "Software"), to deal in the Software without restriction, including 3292 without limitation the rights to use, copy, modify, merge, publish, 3293 distribute, sublicense, and/or sell copies of the Software, and to 3294 permit persons to whom the Software is furnished to do so, subject to 3295 the following conditions: 3296 3297 The above copyright notice and this permission notice shall be 3298 included in all copies or substantial portions of the Software. 3299 3300 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 3301 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 3302 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 3303 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 3304 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 3305 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 3306 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 3307 3308*/ 3309 3310 3311(function($){ 3312 3313 $.TableOfContents = function(el, scope, options){ 3314 // To avoid scope issues, use 'base' instead of 'this' 3315 // to reference this class from internal events and functions. 3316 var base = this; 3317 3318 // Access to jQuery and DOM versions of element 3319 base.$el = $(el); 3320 base.el = el; 3321 3322 base.toc = ""; // We use this to build our TOC; 3323 base.listStyle = null; // This will store the type of list 3324 base.tags = ["h1","h2","h3","h4","h5","h6"]; // The six header tags 3325 3326 3327 base.init = function(){ 3328 // Merge the defaultOptions with any options passed in 3329 base.options = $.extend({},$.TableOfContents.defaultOptions, options); 3330 3331 // Gets the scope. Defaults to the entire document if not specified 3332 if(typeof(scope) == "undefined" || scope == null) scope = document.body; 3333 base.$scope = $(scope); 3334 3335 // Find the first heading withing the scope 3336 var $first = base.$scope.find(base.tags.join(', ')).filter(':first'); 3337 3338 // If no headings were found, stop building the TOC 3339 if($first.length !== 1) return; 3340 3341 // Set the starting depth 3342 base.starting_depth = base.options.startLevel; 3343 3344 // Quick validation on depth 3345 if(base.options.depth < 1) base.options.depth = 1; 3346 3347 // Get only the tags starting with startLevel, and counting the depth 3348 var filtered_tags = base.tags.splice(base.options.startLevel - 1, base.options.depth); 3349 3350 // Cache all the headings that match our new filter 3351 base.$headings = base.findHeadings(base.$scope, filtered_tags.join(', ')); 3352 3353 // If topLinks is enabled, set/get an id for the body element 3354 if(base.options.topLinks !== false){ 3355 var id = $(document.body).attr('id'); 3356 if(id == "") { 3357 id = base.options.topBodyId; 3358 //document.body.id = id; 3359 } 3360 3361 // Cache the id locally 3362 base.topLinkId = id; 3363 } 3364 3365 3366 // Find out which list style to use 3367 if(base.$el.is('ul')){ 3368 base.listStyle = 'ul'; 3369 } else if (base.$el.is('ol')){ 3370 base.listStyle = 'ol'; 3371 } 3372 3373 3374 base.buildTOC(); 3375 3376 if(base.options.proportionateSpacing === true && !base.tieredList()){ 3377 base.addSpacing(); 3378 } 3379 3380 return base; // Return this object for memory cleanup 3381 }; 3382 3383 base.findHeadings = function($element, selector, $headings) { 3384 // If no headings are given, default to an empty jQuery set 3385 if ($headings === undefined) { 3386 $headings = $([]); 3387 } 3388 3389 // Iterate the children in order 3390 $element.children().each(function(i, child) { 3391 $child = $(child); 3392 3393 if ($child.is(selector)) { 3394 // We found a header, add it 3395 $headings = $headings.add($child); 3396 } 3397 else { 3398 // Recurse 3399 $headings = base.findHeadings($child, selector, $headings); 3400 } 3401 }); 3402 3403 return $headings; 3404 }; 3405 3406 // Helper function that returns true for both OL and UL lists 3407 base.tieredList = function(){ 3408 return (base.listStyle === 'ul' || base.listStyle === 'ol'); 3409 }; 3410 3411 base.buildTOC = function(){ 3412 base.current_depth = base.starting_depth; 3413 3414 base.$headings.each(function(i,element){ 3415 // Get current depth base on h1, h2, h3, etc. 3416 var depth = parseInt(this.nodeName.toLowerCase().substr(1, 1)); 3417 3418 // This changes depth, or adds separators, only if not the first item 3419 if(i > 0 || ( i === 0 && depth !== base.current_depth)){ 3420 base.changeDepth(depth); 3421 } 3422 3423 // Add the TOC link 3424 base.toc += base.formatLink(this, depth, i) + "\n"; 3425 3426 // Add the topLink if enabled 3427 if(base.options.topLinks !== false) base.addTopLink(this); 3428 }); 3429 3430 // Close up any nested list 3431 base.changeDepth(base.starting_depth, true); 3432 3433 // Wrap entire TOC in an LI if item was nested. 3434 if(base.tieredList()) base.toc = "<li>\n" + base.toc + "</li>\n"; 3435 3436 // Update the TOC element with the completed TOC 3437 base.$el.html(base.toc); 3438 }; 3439 3440 base.addTopLink = function(element){ 3441 // Get the text for the link (if topLinks === true, it defaults to "Top") 3442 var text = (base.options.topLinks === true ? "Back to contents" : base.options.topLinks ); 3443 var $a = $("<a href='#" + base.topLinkId + "' class='" + base.options.topLinkClass + "'></a>") 3444 .html('<span>
3444' + text + '</span>'); 3445 3446 // Append to the current Header element 3447 $(element).prepend($a); 3448 }; 3449 3450 base.formatLink = function(element, depth, index){ 3451 // Get the current id of the header element 3452 var id, a; 3453 id = element.id; 3454 3455 // If no id exisits, create a unique one 3456 if(id === ""){ 3457 id = base.buildSlug($(element).text()); 3458 element.id = id; 3459 } 3460 3461 // Start building the a link 3462 a = "<a href='#" + id + "'"; 3463 3464 // If this isn't a tiered list, we need to add the depth class 3465 if(!base.tieredList()) { a += " class='" + base.depthClass(depth) + "'"; } 3466 3467 // Finish building the link 3468 if ($(element).find("a").size()) { 3469 a += ">" + base.options.levelText.replace('%', $(element).find("a").html()) + '</a>'; 3470 } 3471 else { 3472 a += ">" + base.options.levelText.replace('%', $(element).html()) + '</a>'; 3473 } 3474 return a; 3475 }; 3476 3477 base.changeDepth = function(new_depth, last){ 3478 var i, opening_tags, closing_tags, li; 3479 3480 if(last !== true) { last = false; } 3481 3482 // If straight links, just change depth and return 3483 if(!base.tieredList()){ 3484 base.current_depth = new_depth; 3485 return true; 3486 } 3487 3488 // If nested 3489 if(new_depth > base.current_depth){ 3490 // Add enough opening tags to step into the heading 3491 // as it is possible that a poorly built document 3492 // steps from h1 to h3 without an h2 3493 opening_tags = []; 3494 for(i = base.current_depth; i < new_depth; i++){ 3495 opening_tags.push('<' + base.listStyle + '>' + "\n"); 3496 } 3497 li = "<li>\n"; 3498 3499 // Add the code to our TOC and an opening LI 3500 base.toc += opening_tags.join(li) + li; 3501 3502 } else if (new_depth < base.current_depth){ 3503 // Close all the loops 3504 closing_tags = []; 3505 for(i = base.current_depth; i > new_depth; i--){ 3506 closing_tags.push('</' + base.listStyle + '>' + "\n"); 3507 } 3508 3509 // Add closing LI and any additional closing tags 3510 base.toc += "</li>\n" + closing_tags.join('</li>' + "\n"); 3511 3512 // Open next block 3513 if (!last) { 3514 base.toc += "</li>\n<li>\n"; 3515 } 3516 } else { 3517 // Just close a tag and open a new one 3518 // since the depth has not changed 3519 if (!last) { 3520 base.toc += "</li>\n<li>\n"; 3521 } 3522 } 3523 3524 // Store the new depth 3525 base.current_depth = new_depth; 3526 }; 3527 3528 base.buildSlug = function(text){ 3529 text = text.toLowerCase().replace(/[^a-z0-9 \-]/gi,'').replace(/ /gi,'-'); 3530 text = text.substr(0,50); 3531 return text; 3532 }; 3533 3534 base.depthClass = function(depth){ 3535 // Normalizes the depths to always start at 1, even if the starting tier is a h4 3536 return base.options.levelClass.replace('%', (depth - ( base.starting_depth - 1 ) ) ); 3537 }; 3538 3539 base.addSpacing = function(){ 3540 var start = base.$headings.filter(':first').position().top; 3541 3542 base.$headings.each(function(i,el){ 3543 var $a = base.$el.find('a:eq(' + i + ')'); 3544 var pos = ( 3545 ( $(this).position().top - start ) / 3546 ( base.$scope.height() - start ) 3547 ) * base.$el.height(); 3548 $a.css({ 3549 position: "absolute", 3550 top: pos 3551 }); 3552 }); 3553 }; 3554 3555 return base.init(); 3556 }; 3557 3558 3559 $.TableOfContents.defaultOptions = { 3560 // One option is set by the container element, and not by changing 3561 // a setting here. That is the type of TOC to output. For a nested ordered list 3562 // make sure your wrapping element is an <ol>. For a nested bulleted list 3563 // make sure your wrapping element is an <ul>. For a straight outputting of links 3564 // use any other element. 3565 3566 // Which H tags should be the root items. h1 = 1, h2 = 2, etc. 3567 startLevel: 1, 3568 3569 // How many levels of H tags should be shown, including the startLevel 3570 // startLevel: 1, depth: 3 = h1, h2, h3 3571 // startLevel: 2, depth: 3 = h2, h3, h4 3572 depth: 3, 3573 3574 // Each link in a straight set is give a class designating how deep it is. 3575 // You can change the class by changing this option, 3576 // but you must include a % sign where you want the number to go. 3577 // Nested lists do not add classes, as you can determine their depth with straight css 3578 levelClass: "toc-depth-%", 3579 3580 // When each link is formed, you can supply additional html or text to be formatted 3581 // with the text of the header. % represents the text of the header 3582 levelText: "%", 3583 3584 // This plugin can add "To Top" links to each header element if you want. 3585 // Set topLinks to true to use the text "Top" or set it to some text or html 3586 // content you wish to use as the body of the link 3587 topLinks: false, 3588 3589 // If topLinks is either true or a text/html value, you can also set the following options: 3590 3591 // Class of the link that is added to the headers 3592 topLinkClass: "toc-top-link", 3593 3594 // Which class should be added to the body element if it does not 3595 // already have an id associated with it 3596 topBodyId: "toc-top", 3597 3598 // To have the TOC spaced proportionatly to the spacing of the headings, 3599 // you must have a fixed height on the TOC wrapper, and it must "haveLayout" 3600 // either position = fixed | absolute | relative 3601 // Finally, the TOC wrapper must not be a UL or an LI or this setting will 3602 // have no effect 3603 proportionateSpacing: false 3604 3605 }; 3606 3607 3608 $.fn.tableOfContents = function(scope, options){ 3609 return this.each(function(){ 3610 var toc = new $.TableOfContents(this, scope, options); 3611 delete toc; // Free memory 3612 }); 3613 }; 3614 3615 3616})(jQuery); 3617 3618/* 3619 * jQuery Cycle Plugin (with Transition Definitions) 3620 * Examples and documentation at: http://jquery.malsup.com/cycle/ 3621 * Copyright (c) 2007-2010 M. Alsup 3622 * Version: 2.88 (08-JUN-2010) 3623 * Dual licensed under the MIT and GPL licenses. 3624 * http://jquery.malsup.com/license.html 3625 * Requires: jQuery v1.2.6 or later 3626 */ 3627(function($){var ver="2.88";
3627if($.support==undefined){$.support={opacity:!($.browser.msie)};}function debug(s){if($.fn.cycle.debug){log(s);}}function log(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments," "));}}$.fn.cycle=function(options,arg2){var o={s:this.selector,c:this.context};if(this.length===0&&options!="stop"){if(!$.isReady&&o.s){log("DOM not ready, queuing slideshow");$(function(){$(o.s,o.c).cycle(options,arg2);});return this;}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this;}return this.each(function(){var opts=handleArguments(this,options,arg2);if(opts===false){return;}opts.updateActivePagerLink=opts.updateActivePagerLink||$.fn.cycle.updateActivePagerLink;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);}this.cycleTimeout=this.cyclePause=0;var $cont=$(this);var $slides=opts.slideExpr?$(opts.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){log("terminating; too few slides: "+els.length);return;}var opts2=buildOptions($cont,$slides,els,opts,o);if(opts2===false){return;}var startTime=opts2.continuous?10:getTimeout(els[opts2.currSlide],els[opts2.nextSlide],opts2,!opts2.rev);if(startTime){startTime+=(opts2.delay||0);if(startTime<10){startTime=10;}debug("first timeout: "+startTime);this.cycleTimeout=setTimeout(function(){go(els,opts2,0,(!opts2.rev&&!opts.backwards));},startTime);}});};function handleArguments(cont,options,arg2){if(cont.cycleStop==undefined){cont.cycleStop=0;}if(options===undefined||options===null){options={};}if(options.constructor==String){switch(options){case"destroy":case"stop":var opts=$(cont).data("cycle.opts");if(!opts){return false;}cont.cycleStop++;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);}cont.cycleTimeout=0;$(cont).removeData("cycle.opts");if(options=="destroy"){destroy(opts);}return false;case"toggle":cont.cyclePause=(cont.cyclePause===1)?0:1;checkInstantResume(cont.cyclePause,arg2,cont);return false;case"pause":cont.cyclePause=1;return false;case"resume":cont.cyclePause=0;checkInstantResume(false,arg2,cont);return false;case"prev":case"next":var opts=$(cont).data("cycle.opts");if(!opts){log('options not found, "prev/next" ignored');return false;}$.fn.cycle[options](opts);return false;default:options={fx:options};}return options;}else{if(options.constructor==Number){var num=options;options=$(cont).data("cycle.opts");if(!options){log("options not found, can not advance slide");return false;}if(num<0||num>=options.elements.length){log("invalid slide index: "+num);return false;}options.nextSlide=num;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}if(typeof arg2=="string"){options.oneTimeFx=arg2;}go(options.elements,options,1,num>=options.currSlide);return false;}}return options;function checkInstantResume(isPaused,arg2,cont){if(!isPaused&&arg2===true){var options=$(cont).data("cycle.opts");if(!options){log("options not found, can not resume");return false;}if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}go(options.elements,options,1,(!opts.rev&&!opts.backwards));}}}function removeFilter(el,opts){if(!$.support.opacity&&opts.cleartype&&el.style.filter){try{el.style.removeAttribute("filter");}catch(smother){}}}function destroy(opts){if(opts.next){$(opts.next).unbind(opts.prevNextEvent);}if(opts.prev){$(opts.prev).unbind(opts.prevNextEvent);}if(opts.pager||opts.pagerAnchorBuilder){$.each(opts.pagerAnchors||[],function(){this.unbind().remove();});}opts.pagerAnchors=null;if(opts.destroy){opts.destroy(opts);}}function buildOptions($cont,$slides,els,options,o){var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});if(opts.autostop){opts.countdown=opts.autostopCount||els.length;}var cont=$cont[0];$cont.data("cycle.opts",opts);opts.$cont=$cont;opts.stopCount=cont.cycleStop;opts.elements=els;opts.before=opts.before?[opts.before]:[];opts.after=opts.after?[opts.after]:[];opts.after.unshift(function(){opts.busy=0;});if(!$.support.opacity&&opts.cleartype){opts.after.push(function(){removeFilter(this,opts);});}if(opts.continuous){opts.after.push(function(){go(els,opts,0,(!opts.rev&&!opts.backwards));});}saveOriginalOpts(opts);if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($slides);}if($cont.css("position")=="static"){$cont.css("position","relative");}if(opts.width){$cont.width(opts.width);}if(opts.height&&opts.height!="auto"){$cont.height(opts.height);}if(opts.startingSlide){opts.startingSlide=parseInt(opts.startingSlide);}
3627else{if(opts.backwards){opts.startingSlide=els.length-1;}}if(opts.random){opts.randomMap=[];for(var i=0;i<els.length;i++){opts.randomMap.push(i);}opts.randomMap.sort(function(a,b){return Math.random()-0.5;});opts.randomIndex=1;opts.startingSlide=opts.randomMap[1];}else{if(opts.startingSlide>=els.length){opts.startingSlide=0;}}opts.currSlide=opts.startingSlide||0;var first=opts.startingSlide;$slides.css({position:"absolute",top:0,left:0}).hide().each(function(i){var z;if(opts.backwards){z=first?i<=first?els.length+(i-first):first-i:els.length-i;}else{z=first?i>=first?els.length-(i-first):first-i:els.length-i;}$(this).css("z-index",z);});$(els[first]).css("opacity",1).show();removeFilter(els[first],opts);if(opts.fit&&opts.width){$slides.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}var reshape=opts.containerResize&&!$cont.innerHeight();if(reshape){var maxw=0,maxh=0;for(var j=0;j<els.length;j++){var $e=$(els[j]),e=$e[0],w=$e.outerWidth(),h=$e.outerHeight();if(!w){w=e.offsetWidth||e.width||$e.attr("width");}if(!h){h=e.offsetHeight||e.height||$e.attr("height");}maxw=w>maxw?w:maxw;maxh=h>maxh?h:maxh;}if(maxw>0&&maxh>0){$cont.css({width:maxw+"px",height:maxh+"px"});}}if(opts.pause){$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});}if(supportMultiTransitions(opts)===false){return false;}var requeue=false;options.requeueAttempts=options.requeueAttempts||0;$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:($el.height()||this.offsetHeight||this.height||$el.attr("height")||0);this.cycleW=(opts.fit&&opts.width)?opts.width:($el.width()||this.offsetWidth||this.width||$el.attr("width")||0);if($el.is("img")){var loadingIE=($.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var loadingFF=($.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var loadingOp=($.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var loadingOther=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(loadingIE||loadingFF||loadingOp||loadingOther){if(o.s&&opts.requeueOnImageNotLoaded&&++options.requeueAttempts<100){log(options.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){$(o.s,o.c).cycle(options);},opts.requeueTimeout);requeue=true;return false;}else{log("could not determine size of image: "+this.src,this.cycleW,this.cycleH);}}}return true;});if(requeue){return false;}opts.cssBefore=opts.cssBefore||{};opts.animIn=opts.animIn||{};opts.animOut=opts.animOut||{};$slides.not(":eq("+first+")").css(opts.cssBefore);if(opts.cssFirst){$($slides[first]).css(opts.cssFirst);}if(opts.timeout){opts.timeout=parseInt(opts.timeout);if(opts.speed.constructor==String){opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed);}if(!opts.sync){opts.speed=opts.speed/2;}var buffer=opts.fx=="shuffle"?500:250;while((opts.timeout-opts.speed)<buffer){opts.timeout+=opts.speed;}}if(opts.easing){opts.easeIn=opts.easeOut=opts.easing;}if(!opts.speedIn){opts.speedIn=opts.speed;}if(!opts.speedOut){opts.speedOut=opts.speed;}opts.slideCount=els.length;opts.currSlide=opts.lastSlide=first;if(opts.random){if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.backwards){opts.nextSlide=opts.startingSlide==0?(els.length-1):opts.startingSlide-1;}else{opts.nextSlide=opts.startingSlide>=(els.length-1)?0:opts.startingSlide+1;}}if(!opts.multiFx){var init=$.fn.cycle.transitions[opts.fx];if($.isFunction(init)){init($cont,$slides,opts);}else{if(opts.fx!="custom"&&!opts.multiFx){log("unknown transition: "+opts.fx,"; slideshow terminating");return false;}}}var e0=$slides[first];if(opts.before.length){opts.before[0].apply(e0,[e0,e0,opts,true]);}if(opts.after.length>1){opts.after[1].apply(e0,[e0,e0,opts,true]);}if(opts.next){$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?-1:1);});}if(opts.prev){$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?1:-1);});}if(opts.pager||opts.pagerAnchorBuilder){buildPager(els,opts);}exposeAddSlide(opts,els);return opts;}function saveOriginalOpts(opts){opts.original={before:[],after:[]};opts.original.cssBefore=$.extend({},opts.cssBefore);opts.original.cssAfter=$.extend({},opts.cssAfter);opts.original.animIn=$.extend({},opts.animIn);opts.original.animOut=$.extend({},opts.animOut);$.each(opts.before,function(){opts.original.before.push(this);});$.each(opts.after,function(){opts.original.after.push(this);});}function supportMultiTransitions(opts){var i,tx,txs=$.fn.cycle.transitions;if(opts.fx.indexOf(",")>0){opts.multiFx=true;opts.fxs=opts.fx.replace(/\s*/g,"").split(",");for(i=0;i<opts.fxs.length;i++){var fx=opts.fxs[i];tx=txs[fx];if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction(tx)){log("discarding unknown transition: ",fx);opts.fxs.splice(i,1);i--;}}if(!opts.fxs.length){log("No valid transitions named; slideshow terminating.");return false;}}else{if(opts.fx=="all"){opts.multiFx=true;opts.fxs=[];for(p in txs){tx=txs[p];if(txs.hasOwnProperty(p)&&$.isFunction(tx)){opts.fxs.push(p);}}}}if(opts.multiFx&&opts.randomizeEffects){var r1=Math.floor(Math.random()*20)+30;for(i=0;i<r1;i++){var r2=Math.floor(Math.random()*opts.fxs.length);opts.fxs.push(opts.fxs.splice(r2,1)[0]);}debug("randomized fx sequence: ",opts.fxs);}return true;}function exposeAddSlide(opts,els){opts.addSlide=function(newSlide,prepend){var $s=$(newSlide),s=$s[0];
3627if(!opts.autostopCount){opts.countdown++;}els[prepend?"unshift":"push"](s);if(opts.els){opts.els[prepend?"unshift":"push"](s);}opts.slideCount=els.length;$s.css("position","absolute");$s[prepend?"prependTo":"appendTo"](opts.$cont);if(prepend){opts.currSlide++;opts.nextSlide++;}if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($s);}if(opts.fit&&opts.width){$s.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}s.cycleH=(opts.fit&&opts.height)?opts.height:$s.height();s.cycleW=(opts.fit&&opts.width)?opts.width:$s.width();$s.css(opts.cssBefore);if(opts.pager||opts.pagerAnchorBuilder){$.fn.cycle.createPagerAnchor(els.length-1,s,$(opts.pager),els,opts);}if($.isFunction(opts.onAddSlide)){opts.onAddSlide($s);}else{$s.hide();}};}$.fn.cycle.resetState=function(opts,fx){fx=fx||opts.fx;opts.before=[];opts.after=[];opts.cssBefore=$.extend({},opts.original.cssBefore);opts.cssAfter=$.extend({},opts.original.cssAfter);opts.animIn=$.extend({},opts.original.animIn);opts.animOut=$.extend({},opts.original.animOut);opts.fxFn=null;$.each(opts.original.before,function(){opts.before.push(this);});$.each(opts.original.after,function(){opts.after.push(this);});var init=$.fn.cycle.transitions[fx];if($.isFunction(init)){init(opts.$cont,$(opts.elements),opts);}};function go(els,opts,manual,fwd){if(manual&&opts.busy&&opts.manualTrump){debug("manualTrump in go(), stopping active transition");$(els).stop(true,true);opts.busy=false;}if(opts.busy){debug("transition active, ignoring new tx request");return;}var p=opts.$cont[0],curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleStop!=opts.stopCount||p.cycleTimeout===0&&!manual){return;}if(!manual&&!p.cyclePause&&!opts.bounce&&((opts.autostop&&(--opts.countdown<=0))||(opts.nowrap&&!opts.random&&opts.nextSlide<opts.currSlide))){if(opts.end){opts.end(opts);}return;}var changed=false;if((manual||!p.cyclePause)&&(opts.nextSlide!=opts.currSlide)){changed=true;var fx=opts.fx;curr.cycleH=curr.cycleH||$(curr).height();curr.cycleW=curr.cycleW||$(curr).width();next.cycleH=next.cycleH||$(next).height();next.cycleW=next.cycleW||$(next).width();if(opts.multiFx){if(opts.lastFx==undefined||++opts.lastFx>=opts.fxs.length){opts.lastFx=0;}fx=opts.fxs[opts.lastFx];opts.currFx=fx;}if(opts.oneTimeFx){fx=opts.oneTimeFx;opts.oneTimeFx=null;}$.fn.cycle.resetState(opts,fx);if(opts.before.length){$.each(opts.before,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});}var after=function(){$.each(opts.after,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});};debug("tx firing; currSlide: "+opts.currSlide+"; nextSlide: "+opts.nextSlide);opts.busy=1;if(opts.fxFn){opts.fxFn(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{if($.isFunction($.fn.cycle[opts.fx])){$.fn.cycle[opts.fx](curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{$.fn.cycle.custom(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}}}if(changed||opts.nextSlide==opts.currSlide){opts.lastSlide=opts.currSlide;if(opts.random){opts.currSlide=opts.nextSlide;if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];if(opts.nextSlide==opts.currSlide){opts.nextSlide=(opts.currSlide==opts.slideCount-1)?0:opts.currSlide+1;}}else{if(opts.backwards){var roll=(opts.nextSlide-1)<0;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=1;opts.currSlide=0;}else{opts.nextSlide=roll?(els.length-1):opts.nextSlide-1;opts.currSlide=roll?0:opts.nextSlide+1;}}else{var roll=(opts.nextSlide+1)==els.length;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=els.length-2;opts.currSlide=els.length-1;}else{opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}}}}if(changed&&opts.pager){opts.updateActivePagerLink(opts.pager,opts.currSlide,opts.activePagerClass);}var ms=0;if(opts.timeout&&!opts.continuous){ms=getTimeout(els[opts.currSlide],els[opts.nextSlide],opts,fwd);}else{if(opts.continuous&&p.cyclePause){ms=10;}}if(ms>0){p.cycleTimeout=setTimeout(function(){go(els,opts,0,(!opts.rev&&!opts.backwards));},ms);}}
3627$.fn.cycle.updateActivePagerLink=function(pager,currSlide,clsName){$(pager).each(function(){$(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);});};function getTimeout(curr,next,opts,fwd){if(opts.timeoutFn){var t=opts.timeoutFn.call(curr,curr,next,opts,fwd);while((t-opts.speed)<250){t+=opts.speed;}debug("calculated timeout: "+t+"; speed: "+opts.speed);if(t!==false){return t;}}return opts.timeout;}$.fn.cycle.next=function(opts){advance(opts,opts.rev?-1:1);};$.fn.cycle.prev=function(opts){advance(opts,opts.rev?1:-1);};function advance(opts,val){var els=opts.elements;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}if(opts.random&&val<0){opts.randomIndex--;if(--opts.randomIndex==-2){opts.randomIndex=els.length-2;}else{if(opts.randomIndex==-1){opts.randomIndex=els.length-1;}}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.random){opts.nextSlide=opts.randomMap[opts.randomIndex];}else{opts.nextSlide=opts.currSlide+val;if(opts.nextSlide<0){if(opts.nowrap){return false;}opts.nextSlide=els.length-1;}else{if(opts.nextSlide>=els.length){if(opts.nowrap){return false;}opts.nextSlide=0;}}}}var cb=opts.onPrevNextEvent||opts.prevNextClick;if($.isFunction(cb)){cb(val>0,opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,val>=0);return false;}function buildPager(els,opts){var $p=$(opts.pager);$.each(els,function(i,o){$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);});opts.updateActivePagerLink(opts.pager,opts.startingSlide,opts.activePagerClass);}$.fn.cycle.createPagerAnchor=function(i,el,$p,els,opts){var a;if($.isFunction(opts.pagerAnchorBuilder)){a=opts.pagerAnchorBuilder(i,el);debug("pagerAnchorBuilder("+i+", el) returned: "+a);}else{a='<a href="#">'+(i+1)+"</a>";}if(!a){return;}var $a=$(a);if($a.parents("body").length===0){var arr=[];if($p.length>1){$p.each(function(){var $clone=$a.clone(true);$(this).append($clone);arr.push($clone[0]);});$a=$(arr);}else{$a.appendTo($p);}}opts.pagerAnchors=opts.pagerAnchors||[];opts.pagerAnchors.push($a);$a.bind(opts.pagerEvent,function(e){e.preventDefault();opts.nextSlide=i;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}var cb=opts.onPagerEvent||opts.pagerClick;if($.isFunction(cb)){cb(opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,opts.currSlide<i);});if(!/^click/.test(opts.pagerEvent)&&!opts.allowPagerClickBubble){$a.bind("click.cycle",function(){return false;});}if(opts.pauseOnPagerHover){$a.hover(function(){opts.$cont[0].cyclePause++;},function(){opts.$cont[0].cyclePause--;});}};$.fn.cycle.hopsFromLast=function(opts,fwd){var hops,l=opts.lastSlide,c=opts.currSlide;if(fwd){hops=c>l?c-l:opts.slideCount-l;}else{hops=c<l?l-c:l+opts.slideCount-c;}return hops;};function clearTypeFix($slides){debug("applying clearType background-color hack");function hex(s){s=parseInt(s).toString(16);return s.length<2?"0"+s:s;}function getBg(e){for(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){var v=$.css(e,"background-color");if(v.indexOf("rgb")>=0){var rgb=v.match(/\d+/g);return"#"+hex(rgb[0])+hex(rgb[1])+hex(rgb[2]);}if(v&&v!="transparent"){return v;}}return"#ffffff";}$slides.each(function(){$(this).css("background-color",getBg(this));});}$.fn.cycle.commonReset=function(curr,next,opts,w,h,rev){$(opts.elements).not(curr).hide();opts.cssBefore.opacity=1;opts.cssBefore.display="block";if(w!==false&&next.cycleW>0){opts.cssBefore.width=next.cycleW;}if(h!==false&&next.cycleH>0){opts.cssBefore.height=next.cycleH;}opts.cssAfter=opts.cssAfter||{};opts.cssAfter.display="none";$(curr).css("zIndex",opts.slideCount+(rev===true?1:0));$(next).css("zIndex",opts.slideCount+(rev===true?0:1));};$.fn.cycle.custom=function(curr,next,opts,cb,fwd,speedOverride){var $l=$(curr),$n=$(next);var speedIn=opts.speedIn,speedOut=opts.speedOut,easeIn=opts.easeIn,easeOut=opts.easeOut;$n.css(opts.cssBefore);if(speedOverride){if(typeof speedOverride=="number"){speedIn=speedOut=speedOverride;}else{speedIn=speedOut=1;}easeIn=easeOut=null;}var fn=function(){$n.animate(opts.animIn,speedIn,easeIn,cb);};$l.animate(opts.animOut,speedOut,easeOut,function(){if(opts.cssAfter){$l.css(opts.cssAfter);}if(!opts.sync){fn();}});if(opts.sync){fn();}};$.fn.cycle.transitions={fade:function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css("opacity",0);opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.opacity=0;});opts.animIn={opacity:1};opts.animOut={opacity:0}
3627;opts.cssBefore={top:0,left:0};}};$.fn.cycle.ver=function(){return ver;};$.fn.cycle.defaults={fx:"fade",timeout:4000,timeoutFn:null,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,onPrevNextEvent:null,prevNextEvent:"click.cycle",pager:null,onPagerEvent:null,pagerEvent:"click.cycle",allowPagerClickBubble:false,pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:null,cssAfter:null,fxFn:null,height:"auto",startingSlide:0,sync:1,random:0,fit:0,containerResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:!$.support.opacity,cleartypeNoBg:false,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250,activePagerClass:"activeSlide",updateActivePagerLink:null,backwards:false};})(jQuery); 3628/* 3629 * jQuery Cycle Plugin Transition Definitions 3630 * This script is a plugin for the jQuery Cycle Plugin 3631 * Examples and documentation at: http://malsup.com/jquery/cycle/ 3632 * Copyright (c) 2007-2010 M. Alsup 3633 * Version: 2.72 3634 * Dual licensed under the MIT and GPL licenses: 3635 * http://www.opensource.org/licenses/mit-license.php 3636 * http://www.gnu.org/licenses/gpl.html 3637 */ 3638(function($){$.fn.cycle.transitions.none=function($cont,$slides,opts){opts.fxFn=function(curr,next,opts,after){$(next).show();$(curr).hide();after();};};$.fn.cycle.transitions.scrollUp=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssBefore={top:h,left:0};opts.cssFirst={top:0};opts.animIn={top:0};opts.animOut={top:-h};};$.fn.cycle.transitions.scrollDown=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssFirst={top:0};opts.cssBefore={top:-h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.scrollLeft=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:0-w};};$.fn.cycle.transitions.scrollRight=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:-w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.scrollHorz=function($cont,$slides,opts){$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts,fwd){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.left=fwd?(next.cycleW-1):(1-next.cycleW);opts.animOut.left=fwd?-curr.cycleW:curr.cycleW;});opts.cssFirst={left:0};opts.cssBefore={top:0};opts.animIn={left:0};opts.animOut={top:0};};$.fn.cycle.transitions.scrollVert=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push(function(curr,next,opts,fwd){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.top=fwd?(1-next.cycleH):(next.cycleH-1);opts.animOut.top=fwd?curr.cycleH:-curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0};opts.animIn={top:0};opts.animOut={left:0};};$.fn.cycle.transitions.slideX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;});opts.cssBefore={left:0,top:0,width:0};opts.animIn={width:"show"};opts.animOut={width:0};};$.fn.cycle.transitions.slideY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;});opts.cssBefore={left:0,top:0,height:0};opts.animIn={height:"show"};opts.animOut={height:0};};$.fn.cycle.transitions.shuffle=function($cont,$slides,opts){var i,w=$cont.css("overflow","visible").width();$slides.css({left:0,top:0});opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);});if(!opts.speedAdjusted){opts.speed=opts.speed/2;opts.speedAdjusted=true;}opts.random=0;opts.shuffle=opts.shuffle||{left:-w,top:15};opts.els=[];for(i=0;i<$slides.length;i++){opts.els.push($slides[i]);}for(i=0;i<opts.currSlide;i++){opts.els.push(opts.els.shift());}opts.fxFn=function(curr,next,opts,cb,fwd){var $el=fwd?$(curr):$(next);$(next).css(opts.cssBefore);var count=opts.slideCount;$el.animate(opts.shuffle,opts.speedIn,opts.easeIn,function(){var hops=$.fn.cycle.hopsFromLast(opts,fwd);for(var k=0;k<hops;k++){fwd?opts.els.push(opts.els.shift()):opts.els.unshift(opts.els.pop());}if(fwd){for(var i=0,len=opts.els.length;i<len;i++){$(opts.els[i]).css("z-index",len-i+count);}}else{var z=$(curr).css("z-index");$el.css("z-index",parseInt(z)+1+count);}$el.animate({left:0,top:0},opts.speedOut,opts.easeOut,function(){$(fwd?this:curr).hide();if(cb){cb();}});});};opts.cssBefore={display:"block",opacity:1,top:0,left:0};};$.fn.cycle.transitions.turnUp=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=next.cycleH;opts.animIn.height=next.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0,height:0};opts.animIn={top:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnDown=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0,top:0,height:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnLeft=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=next.cycleW;opts.animIn.width=next.cycleW;});opts.cssBefore={top:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.turnRight=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={top:0,left:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.zoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false,true);opts.cssBefore.top=next.cycleH/2;opts.cssBefore.left=next.cycleW/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};opts.animOut={width:0,height:0,top:curr.cycleH/2,left:curr.cycleW/2};});opts.cssFirst={top:0,left:0};opts.cssBefore={width:0,height:0};};$.fn.cycle.transitions.fadeZoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false);opts.cssBefore.left=next.cycleW/2;opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};});opts.cssBefore={width:0,height:0};opts.animOut={opacity:0}
3638;};$.fn.cycle.transitions.blindX=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.blindY=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.blindZ=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();var w=$cont.width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:w};opts.animIn={top:0,left:0};opts.animOut={top:h,left:w};};$.fn.cycle.transitions.growX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=this.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:0};});opts.cssBefore={width:0,top:0};};$.fn.cycle.transitions.growY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=this.cycleH/2;opts.animIn={top:0,height:this.cycleH};opts.animOut={top:0};});opts.cssBefore={height:0,left:0};}; 3639 $.fn.cycle.transitions.scrollFade = function($cont, $slides, opts) { 3640 $cont.css('overflow','visible').width(); 3641 opts.before.push(function(curr, next, opts, fwd) { 3642 opts.cssBefore.opacity = 0; 3643 $.fn.cycle.commonReset(curr,next,opts); 3644 opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW); 3645 opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW; 3646 }); 3647 opts.cssFirst = { left: 0 }; 3648 opts.cssBefore= { top: 0, opacity: 0}; 3649 opts.animIn = { left: 0, opacity: 1}; 3650 opts.animOut = { top: 0, opacity: 0}; 3651 }; 3652 3653$.fn.cycle.transitions.curtainX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true,true);opts.cssBefore.left=next.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:curr.cycleW/2,width:0};});opts.cssBefore={top:0,width:0};};$.fn.cycle.transitions.curtainY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false,true);opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,height:next.cycleH};opts.animOut={top:curr.cycleH/2,height:0};});opts.cssBefore={left:0,height:0};};$.fn.cycle.transitions.cover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);if(d=="right"){opts.cssBefore.left=-w;}else{if(d=="up"){opts.cssBefore.top=h;}else{if(d=="down"){opts.cssBefore.top=-h;}else{opts.cssBefore.left=w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.uncover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(d=="right"){opts.animOut.left=w;}else{if(d=="up"){opts.animOut.top=-h;}else{if(d=="down"){opts.animOut.top=h;}else{opts.animOut.left=-w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.toss=function($cont,$slides,opts){var w=$cont.css("overflow","visible").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(!opts.animOut.left&&!opts.animOut.top){opts.animOut={left:w*2,top:-h/2,opacity:0};}else{opts.animOut.opacity=0;}});opts.cssBefore={left:0,top:0};opts.animIn={left:0};};$.fn.cycle.transitions.wipe=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();
3653var h=$cont.height();opts.cssBefore=opts.cssBefore||{};var clip;if(opts.clip){if(/l2r/.test(opts.clip)){clip="rect(0px 0px "+h+"px 0px)";}else{if(/r2l/.test(opts.clip)){clip="rect(0px "+w+"px "+h+"px "+w+"px)";}else{if(/t2b/.test(opts.clip)){clip="rect(0px "+w+"px 0px 0px)";}else{if(/b2t/.test(opts.clip)){clip="rect("+h+"px "+w+"px "+h+"px 0px)";}else{if(/zoom/.test(opts.clip)){var top=parseInt(h/2);var left=parseInt(w/2);clip="rect("+top+"px "+left+"px "+top+"px "+left+"px)";}}}}}}opts.cssBefore.clip=opts.cssBefore.clip||clip||"rect(0px 0px 0px 0px)";var d=opts.cssBefore.clip.match(/(\d+)/g);var t=parseInt(d[0]),r=parseInt(d[1]),b=parseInt(d[2]),l=parseInt(d[3]);opts.before.push(function(curr,next,opts){if(curr==next){return;}var $curr=$(curr),$next=$(next);$.fn.cycle.commonReset(curr,next,opts,true,true,false);opts.cssAfter.display="block";var step=1,count=parseInt((opts.speedIn/13))-1;(function f(){var tt=t?t-parseInt(step*(t/count)):0;var ll=l?l-parseInt(step*(l/count)):0;var bb=b<h?b+parseInt(step*((h-b)/count||1)):h;var rr=r<w?r+parseInt(step*((w-r)/count||1)):w;$next.css({clip:"rect("+tt+"px "+rr+"px "+bb+"px "+ll+"px)"});(step++<=count)?setTimeout(f,13):$curr.css("display","none");})();});opts.cssBefore={display:"block",opacity:1,top:0,left:0};opts.animIn={left:0};opts.animOut={left:0};};})(jQuery); 3654; 3655/* 3656 * jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010 3657 * http://benalman.com/projects/jquery-dotimeout-plugin/ 3658 * 3659 * Copyright (c) 2010 "Cowboy" Ben Alman 3660 * Dual licensed under the MIT and GPL licenses. 3661 * http://benalman.com/about/license/ 3662 */ 3663(function($){var a={},c="doTimeout",d=Array.prototype.slice;$[c]=function(){return b.apply(window,[0].concat(d.call(arguments)))};$.fn[c]=function(){var f=d.call(arguments),e=b.apply(this,[c+f[0]].concat(f));return typeof f[0]==="number"||typeof f[1]==="number"?this:e};function b(l){var m=this,h,k={},g=l?$.fn:$,n=arguments,i=4,f=n[1],j=n[2],p=n[3];if(typeof f!=="string"){i--;f=l=0;j=n[1];p=n[2]}if(l){h=m.eq(0);h.data(l,k=h.data(l)||{})}else{if(f){k=a[f]||(a[f]={})}}k.id&&clearTimeout(k.id);delete k.id;function e(){if(l){h.removeData(l)}else{if(f){delete a[f]}}}function o(){k.id=setTimeout(function(){k.fn()},j)}if(p){k.fn=function(q){if(typeof p==="string"){p=g[p]}p.apply(m,d.call(n,i))===true&&!q?o():e()};o()}else{if(k.fn){j===undefined?e():k.fn(j===false);return true}else{e()}}}})(jQuery);; 3664/** 3665 * @plugin gallery 3666 * @desc Creates a slideshow of images by way of many structured template formats. 3667 * todo: extend this to be nodes and a full node page. 3668 * */ 3669;(function($, window, document, undefined) { 3670 3671 "use strict"; 3672 3673 var pluginName = "gallery", 3674 defaults = { 3675 autoPlay: true, 3676 width: null, 3677 height: null, 3678 duration: 600, 3679 aspectRatio: '4:3', // (default '4:3'), '3:4', '3:2', '1:1', '16:9' 3680 galleryBorderWidth: 5, 3681 slideshowDuration: 6000, 3682 navArrowWidth: 30, 3683 showProgressBar: true, 3684 filmstripMarkerWidth: 50, 3685 userInteruptsSlideshow: true, 3686 // sets alternate image cache preset's sizing for all image uses. 3687 imageSizing: { 3688 zoomed: 'lightbox', 3689 slide: 'gallery', 3690 marker: 'thumbnail' 3691 }, 3692 // used to replace values from imageSizing within classes and src attr's. 3693 icpPathRegEx: /files\/imagecache\/([^\/]+)/, 3694 icpClassRegEx: /field-image-preset-([^ ]+)/ 3695 }; 3696 3697 function Plugin(element, options) { 3698 this.element = element; 3699 this.$element = $(element); 3700 this._name = pluginName; 3701 this._defaults = defaults; 3702 this.options = $.extend({}, defaults, options); 3703 3704 // allows for ratios or defined width/height's. 3705 if ( !this.options.width || !this.options.height ) { 3706 this.options.width = this.$element.width() - this.options.galleryBorderWidth * 2; 3707 switch (this.options.aspectRatio) { 3708 case '3:4' : this.options.height = this.options.width / 3 * 4; break; 3709 case '3:2' : this.options.height = this.options.width / 3 * 2; break; 3710 case '1:1' : this.options.height = this.options.width * 1.00; break; 3711 case '16:9': this.options.height = this.options.width * 0.5625; break; 3712 default : this.options.height = this.options.width * 0.75; 3713 } 3714 } 3715 3716 this.$images = this.getImages(); 3717 this.isPlaying = false;
3718 this.currentPage = 0; 3719 this.currentIndex = 0; 3720 this.currentCaption = ''; 3721 this.totalImages = this.$images.length; 3722 this.markersPerPage = Math.floor((this.options.width - this.options.navArrowWidth * 2)/this.options.filmstripMarkerWidth); 3723 this.markerWidth = Math.floor((this.options.width - this.options.navArrowWidth * 2)/this.markersPerPage); 3724 this.pageWidth = this.markersPerPage * this.markerWidth; 3725 this.totalPages = Math.ceil(this.$images.length/this.markersPerPage); 3726 3727 // creates the gallery. 3728 this.$gallery = this.render('gallery'); 3729 this.$gallery.insertBefore(this.$images.eq(0)); 3730 3731 // wraps images with the gallery div. 3732 this.$galleryImages = this.render('galleryImages'); 3733 this.$galleryImages.appendTo(this.$gallery); 3734 this.$images.appendTo(this.$galleryImages); 3735 3736 // creates all buttons for the gallery controls. 3737 this.controls = this.render('controls'); 3738 this.controls.$wrapper.appendTo(this.$gallery); 3739 3740 // creates a caption container for passing captions for each image. 3741 this.$caption = this.render('caption'); 3742 this.$caption.appendTo(this.$gallery); 3743 3744 // creates a progress bar which visually animates the autoplay duration. 3745 this.$progress = this.render('progress'); 3746 this.$progress.appendTo(this.$gallery); 3747 3748 // creates a filmstrip and appends it to the gallery. 3749 this.$filmstrip = this.render('filmstrip'); 3750 this.$filmstrip.appendTo(this.$gallery); 3751 3752 // this is references the showcase which is used for zoom/lightbox feature. 3753 this.$showcase = this.render('showcase'); 3754 3755 // Add helper class to simplify gallery if there is only one image. 3756 if (this.totalImages <= 1) { 3757 this.$gallery.addClass('simple'); 3758 // Assure elimination of the autoPlay feature. 3759 this.options.autoPlay = false; 3760 } 3761 3762 // initialize. 3763 this.init(); 3764 } 3765 3766 Plugin.prototype = { 3767 init: function() { 3768 var plugin = this; 3769 3770 // Fire up the carousel with the first indexed image. 3771 plugin.$filmstrip.find('.marker').eq(plugin.currentIndex).trigger('click'); 3772 3773 // Automatically start slideshow? 3774 if (plugin.options.autoPlay) { 3775 plugin.controls.$playBtn.trigger('click'); 3776 } 3777 3778 // set element resize event handler. 3779 plugin.$element.bind('resize.gallery', {scope: plugin}, plugin.events.resize); 3780 }, 3781 // ------------------------------------------------------------------------- 3782 // Smart get of image resources to use within the gallery. 3783 // ------------------------------------------------------------------------- 3784 getImages: function() { 3785 var plugin = this, $images; 3786 $images = plugin.$element.find('.node-image .field-image, .node-upper-image .field-image'); 3787 $images.each(function(key, image) { 3788 var $image = $(image), 3789 src, href, classes; 3790 src = $image.find('img').attr('src'); 3791 href = $image.find('a').attr('href'); 3792 classes = $image.attr('class'); 3793 // swap out imagecache paths according to passed imageSizing options. 3794 $image.attr('class', classes.replace(plugin.options.icpClassRegEx.exec(classes)[1], plugin.options.imageSizing.slide)); 3795 if ( !$image.hasClass('field-video') ) { 3796 $image.find('a').attr('href', href.replace(plugin.options.icpPathRegEx.exec(href)[1], plugin.options.imageSizing.zoomed)); 3797 } 3798 $image.find('img').attr('src', src.replace(plugin.options.icpPathRegEx.exec(src)[1], plugin.options.imageSizing.slide)); 3799 }); 3800 3801 // @todo: extend this to be nodes and a full node page. 3802 /* 3803 // node page 3804 if (plugin.$element.hasClass('node-full')) { 3805 // @note already implemented above ^ 3806 } 3807 // views-blocks 3808 else if (plugin.$element.hasClass('views-block')) { 3809 $images = plugin.$element.find('.views-row'); 3810 } 3811 */ 3812 return $images; 3813 }, 3814 // ------------------------------------------------------------------------- 3815 // Sets plugin indexes for images and pages. 3816 // ------------------------------------------------------------------------- 3817 setCurrentIndex: function(index) { 3818 var plugin = this; 3819 if (index <= 0) { 3820 index = plugin.totalImages; 3821 } 3822 else if (index > plugin.totalImages) { 3823 index = 1; 3824 } 3825 plugin.currentIndex = index; 3826 plugin.setActiveItems(index);
3827 var page = Math.ceil(index/plugin.markersPerPage); 3828 if (page !== plugin.currentPage) { 3829 plugin.gotoPage(page, false); 3830 } 3831 return index; 3832 }, 3833 // ------------------------------------------------------------------------- 3834 // Controls styling of active items. 3835 // ------------------------------------------------------------------------- 3836 setActiveItems: function(index) { 3837 var plugin = this; 3838 // markers. 3839 plugin.$filmstrip.find('.active').removeClass('active'); 3840 plugin.$filmstrip.find('.marker').eq(index - 1).addClass('active'); 3841 }, 3842 // ------------------------------------------------------------------------- 3843 // Update current image. 3844 // ------------------------------------------------------------------------- 3845 gotoImage: function(origin, destination, clickEvent) { 3846 var plugin = this, 3847 // -1 because the images are an array, index starts at 1. 3848 $origin = plugin.$images.eq(origin-1), 3849 $destination = plugin.$images.eq(destination-1); 3850 // resets the slideshow timer if caused by user interaction. 3851 if (clickEvent && plugin.isPlaying) { 3852 plugin.options.userInteruptsSlideshow 3853 ? plugin.controls.$pauseBtn.trigger('click') 3854 : plugin.options.userInteruptsSlideshow(); 3855 } 3856 // shuffle images. 3857 $origin.css('z-index', 2).stop(true,true).animate({opacity:'hide'}, plugin.options.duration); 3858 $destination.css('z-index', 3).stop(true,true).animate({opacity:'show'}, plugin.options.duration); 3859 plugin.$images.not($origin).not($destination).css('z-index', 1).hide(); 3860 // set caption. 3861 var $captionText = plugin.$caption.find('.gallery-caption-text'), 3862 prevHeight = $captionText.outerHeight(); 3863 plugin.currentCaption = $destination.find('img').attr('title') || ''; 3864 $captionText.stop(true,true).animate({opacity:'hide'}, plugin.options.duration/2, function() { 3865 $captionText.html(plugin.currentCaption); 3866 if (plugin.currentCaption.length > 0) { 3867 var newHeight = $captionText.outerHeight(); 3868 plugin.$caption.height(prevHeight).stop(true,true).animate({height: newHeight}, plugin.options.duration/2); 3869 $captionText.animate({opacity:'show'}, plugin.options.duration/2); 3870 } 3871 else { 3872 plugin.$caption.stop(true,true).animate({height: 0}, plugin.options.duration/2); 3873 } 3874 }); 3875 }, 3876 // ------------------------------------------------------------------------- 3877 // Update current filmstrip page. 3878 // ------------------------------------------------------------------------- 3879 gotoPage: function(destination, clickEvent) { 3880 var plugin = this, 3881 origin = plugin.currentPage, 3882 difference = destination - origin, 3883 distance = plugin.markerWidth * plugin.markersPerPage, 3884 $content = plugin.$filmstrip.find('.markers-content'), 3885 duration = plugin.options.duration / 2, 3886 callback = function(){return true;}; 3887 // resets the slideshow timer if caused by user interaction. 3888 if (clickEvent && plugin.isPlaying) { 3889 plugin.options.userInteruptsSlideshow 3890 ? plugin.controls.$pauseBtn.trigger('click') 3891 : plugin.options.userInteruptsSlideshow(); 3892 } 3893 // is the destination greater than 1 page. 3894 if (difference <= -1 && difference >= 1) { 3895 distance = 0; 3896 if (difference > 0) { 3897 distance = -(plugin.totalPages - 1) * plugin.pageWidth; 3898 } 3899 duration = 50 * (plugin.totalPages - 1); 3900 } 3901 // next page. 3902 else if (destination > origin) { 3903 if (destination <= plugin.totalPages ) { 3904 distance = (destination - 1) * -distance; 3905 } 3906 else { 3907 duration = 100; 3908 distance = -(distance * (plugin.totalPages - 1)) - plugin.options.navArrowWidth; 3909 callback = function() { 3910 $content.animate({left: -(plugin.pageWidth * (plugin.totalPages - 1))}, 100); 3911 }; 3912 destination = plugin.currentPage; 3913 } 3914 } 3915 // prev page. 3916 else if (destination < origin) { 3917 if (destination > 0) { 3918 distance = (destination - 1) * -distance; 3919 } 3920 else { 3921 duration = 100; 3922 distance = plugin.options.navArrowWidth; 3923 callback = function() { 3924 $content.animate({left: 0}, 100); 3925 }; 3926 destination = plugin.currentPage; 3927 } 3928 } 3929 plugin.currentPage = destination; 3930 $content.animate({left: distance}, duration, callback); 3931 }, 3932 // ------------------------------------------------------------------------- 3933 // Slideshow Timer 3934 // ------------------------------------------------------------------------- 3935 startSlideshowTimer: function() { 3936 var plugin = this; 3937 plugin.startProgressBar(); 3938 $.doTimeout('slideshow', plugin.options.slideshowDuration, function() { 3939 var origin = plugin.currentIndex, 3940 destination = plugin.setCurrentIndex(plugin.currentIndex + 1); 3941 plugin.startProgressBar();
3942 plugin.gotoImage(origin, destination, false); 3943 return true; 3944 }); 3945 }, 3946 stopSlideshowTimer: function() { 3947 var plugin = this; 3948 $.doTimeout('slideshow'); 3949 plugin.stopProgressBar(); 3950 }, 3951 // ------------------------------------------------------------------------- 3952 // Progress Bar 3953 // ------------------------------------------------------------------------- 3954 startProgressBar: function() { 3955 var plugin = this; 3956 if (plugin.options.showProgressBar) { 3957 plugin.$progress.width(0).show(); 3958 plugin.$progress.stop(true).animate({width: plugin.options.width}, plugin.options.slideshowDuration, 'linear'); 3959 } 3960 }, 3961 stopProgressBar: function() { 3962 var plugin = this; 3963 if (plugin.options.showProgressBar) { 3964 plugin.$progress.stop(true,true).hide(); 3965 } 3966 }, 3967 // ------------------------------------------------------------------------- 3968 // Event Handlers 3969 // ------------------------------------------------------------------------- 3970 events: { 3971 resize: function(event) { 3972 console.log(event.type); 3973 }, 3974 marker: function(event) { 3975 var plugin = event.data.scope, 3976 origin = plugin.currentIndex, 3977 destination = Number($(this).data('index')); 3978 if (origin != destination) { 3979 plugin.setCurrentIndex(destination); 3980 plugin.gotoImage(origin, destination, true); 3981 } 3982 event.preventDefault(); 3983 }, 3984 nextPage: function(event) { 3985 var plugin = event.data.scope; 3986 plugin.gotoPage(plugin.currentPage + 1, true); 3987 }, 3988 prevPage: function(event) { 3989 var plugin = event.data.scope; 3990 plugin.gotoPage(plugin.currentPage - 1, true); 3991 }, 3992 play: function(event) { 3993 var plugin = event.data.scope; 3994 if ( !plugin.isPlaying ) { 3995 $(this).hide(); 3996 plugin.isPlaying = true; 3997 plugin.controls.$pauseBtn.show(); 3998 plugin.startSlideshowTimer(); 3999 } 4000 }, 4001 pause: function(event) { 4002 var plugin = event.data.scope; 4003 if ( plugin.isPlaying ) { 4004 $(this).hide(); 4005 plugin.isPlaying = false; 4006 plugin.controls.$playBtn.show(); 4007 plugin.stopSlideshowTimer(); 4008 } 4009 }, 4010 prev: function(event) { 4011 var plugin = event.data.scope, 4012 origin = plugin.currentIndex, 4013 destination = plugin.setCurrentIndex(plugin.currentIndex - 1); 4014 plugin.gotoImage(origin, destination, true); 4015 }, 4016 next: function(event) { 4017 var plugin = event.data.scope, 4018 origin = plugin.currentIndex, 4019 destination = plugin.setCurrentIndex(plugin.currentIndex + 1); 4020 plugin.gotoImage(origin, destination, true); 4021 }, 4022 zoom: function(event) { 4023 var plugin = event.data.scope; 4024 // fire off the lightbox2 behavior. 4025 plugin.$images.eq(plugin.currentIndex-1).find('a').trigger('click'); 4026 } 4027 }, 4028 // ------------------------------------------------------------------------- 4029 // jQuery Template Renderer 4030 // ------------------------------------------------------------------------- 4031 render: function(name, args, args2, args3) { 4032 var plugin = this, 4033 templates = { 4034 gallery: function() { 4035 var $gallery = $('<div class="gallery"></div>'); 4036 $gallery 4037 .addClass(pluginName) 4038 .width(plugin.options.width) 4039 .height(plugin.options.height) 4040 .css({ 4041 border: plugin.options.galleryBorderWidth + 'px solid white', 4042 'margin-bottom': (plugin.options.galleryBorderWidth + 75) + 'px' 4043 }); 4044 return $gallery; 4045 }, 4046 galleryImages: function() { 4047 return $('<div class="gallery-images"></div>'); 4048 }, 4049 caption: function() { 4050 return $('<div class="gallery-caption"><div class="gallery-caption-text"></div></div>'); 4051 }, 4052 showcase: function() { 4053 var $showcase = $('#gallery-showcase'); 4054 if ($showcase.length <= 0) {
4055 $showcase = $('<div id="gallery-showcase"></div>'); 4056 plugin.$element.parents('body').append($showcase); 4057 } 4058 return $showcase; 4059 }, 4060 button: function(type) { 4061 return $('<div class="btn-'+type+'"><span></span></div>'); 4062 }, 4063 controls: function() { 4064 var $wrapper = $('<div class="gallery-controls"></div>'), 4065 buttons = ['pause', 'play', 'zoom', 'next', 'prev'], 4066 controls = {}; 4067 $.each(buttons, function(key, type) { 4068 var $btn = plugin.render('button', type); 4069 $btn.bind('click', {scope: plugin}, plugin.events[type]); 4070 $btn.appendTo($wrapper); 4071 controls['$'+type+'Btn'] = $btn; 4072 }); 4073 controls.$wrapper = $wrapper; 4074 return controls; 4075 }, 4076 markers: function() { 4077 var $markers = $('<div class="markers"></div>'), 4078 $inner = $('<div class="markers-content"></div>'); 4079 $.each(plugin.$images, function(key, image) { 4080 var $marker = $('<a href="#" class="marker"></a>'), 4081 $wrap = $('<span class="marker-image"></span>'), 4082 $image = $(image).find('img').clone(), 4083 src = $image.attr('src'); 4084 $image.attr('src', src.replace(plugin.options.icpPathRegEx.exec(src)[1], plugin.options.imageSizing.marker)); 4085 $marker.data('index', key+1).width(plugin.markerWidth).bind('click', {scope: plugin}, plugin.events.marker); 4086 $image.prependTo($wrap); 4087 $wrap.prependTo($marker); 4088 $marker.appendTo($inner); 4089 }); 4090 $inner.width(Math.ceil(plugin.pageWidth * plugin.totalPages)); 4091 $inner.appendTo($markers); 4092 $markers.width(plugin.options.width - (plugin.options.navArrowWidth * 2)); 4093 return $markers; 4094 }, 4095 filmstrip: function() { 4096 var $filmstrip = $('<div class="gallery-filmstrip"></div>'), 4097 $inner = $('<div class="gallery-filmstrip-inner"></div>'), 4098 $links = plugin.render('markers'), 4099 $prev = plugin.render('button', 'prev-page'), 4100 $next = plugin.render('button', 'next-page'); 4101 if (plugin.totalImages > 1) { 4102 $prev.appendTo($inner).bind('click', {scope: plugin}, plugin.events.prevPage); 4103 $next.appendTo($inner).bind('click', {scope: plugin}, plugin.events.nextPage); 4104 plugin.controls.$prevPageBtn = $prev; 4105 plugin.controls.$nextPageBtn = $next; 4106 $links.css({'margin': '0 '+plugin.options.navArrowWidth+'px'}); 4107 } 4108 $inner.css({top: plugin.options.galleryBorderWidth+'px'}); 4109 $links.appendTo($inner); 4110 $inner.appendTo($filmstrip); 4111 return $filmstrip; 4112 }, 4113 progress: function() { 4114 return $('<div class="gallery-progress"></div>'); 4115 } 4116 }; 4117 4118 return templates[name](args, args2, args3); 4119 } 4120 }; 4121 4122 $.fn[pluginName] = function (options) { 4123 return this.each(function () { 4124 if ( !$.data(this, "plugin_" + pluginName )) { 4125 $.data(this, "plugin_" + pluginName, new Plugin(this, options)); 4126 } 4127 }); 4128 }; 4129 4130})(jQuery, window, document); 4131; 4132Drupal.behaviors.ddAddDateToCalendarWidget = function(context) { 4133 if (Drupal.settings.ddCreate && Drupal.settings.ddCreate.addDateToCalendarWidget) { 4134 var attach = function() { 4135 $('#calpopup .node-teaser:has(.first-upcoming):not(:has(a.add))').each(function() { 4136 var $teaser = $(this); 4137 var $date = $teaser.find(".first-upcoming"); 4138 var nodeId = $teaser.attr("id").replace(/(node-)|(-teaser)/g, ""); 4139 4140 var $addLink = $('<a class="add"></a>'); 4141 var $addPopup = $('<div class="add-calendar-popup">Loading...</div>'); 4142 4143 $date.append($addLink).append($addPopup); 4144 $addLink.toggle(function() { 4145 // Hide any existing popups. 4146 $('.add-calendar-popup:visible').fadeOut('fast'); 4147 4148 $addPopup.fadeIn("fast").load(Drupal.settings.basePath + 'node/' + nodeId + ' #block-dd_create-calendar', function() { 4149 $addPopup.find("a").attr("target", "_blank"); 4150 }); 4151 }, function() { 4152 $addPopup.fadeOut("fast"); 4153 }); 4154 }); 4155 }; 4156 4157 attach(); 4158 4159 $(document).ajaxComplete(function() { 4160 attach(); 4161 }); 4162 } 4163}; 4164 4165/**
4166 * Handles adding the "node-advanced" class to navigation terms which should be 4167 * hidden on the node edit/create form. 4168 */ 4169Drupal.behaviors.ddNavTermVisibility = function(context) { 4170 if (Drupal.settings.pt_nav_terms_hidden) { 4171 var el = $('#edit-taxonomy-2-wrapper', context); 4172 for (var i = 0; i < Drupal.settings.pt_nav_terms_hidden.length; i++) { 4173 var tid = Drupal.settings.pt_nav_terms_hidden[i]; 4174 var li = $('#edit-taxonomy-2-' + tid).parents('li'); 4175 if (li.length) { 4176 $(li[0]).addClass('node-advanced'); 4177 } 4178 } 4179 } 4180}; 4181 4182/** 4183 * Handles the cloning form elements visiblity. 4184 */ 4185Drupal.behaviors.ddClonePostVisibility = function(context) { 4186 if (Drupal.settings.clone_post) { 4187 // Hide tabs. 4188 $('.tabs').css("display","none"); 4189 } 4190}; 4191 4192/** 4193 * Disable URL Alias and show warning message when creating/editing overviews. 4194 */ 4195Drupal.behaviors.ddOverviewVisibility = function(context) { 4196 var urlAlias = $('.vertical-tabs-path', context); 4197 var clonedUrlAlias = urlAlias.html(); 4198 var postSelect = $('#edit-taxonomy-1'); 4199 var warningMessage = "URL aliases should be added to the navigation term, not the Overview post. <a href='https://support.digitaldeployment.com/support/solutions/articles/4000085428-advanced-creating-custom-urls-for-posts-and-url-aliases-for-navigation-terms-'>Learn how to create URL aliases for navigation terms</a>."; 4200 4201 var postType = postSelect.find(":selected").text(); 4202 if(postType == 'Overview') { 4203 urlAlias.html('<div style="white-space: normal;" class="messages warning no-attachment-text disable-url">' + warningMessage + '</div>'); 4204 } 4205 4206 // On post type change. 4207 postSelect.change(function() { 4208 if($(this).find(":selected").text() == 'Overview') { 4209 $('.vertical-tabs-path').html('<div style="white-space: normal;" class="messages warning no-attachment-text disable-url">' + warningMessage + '</div>'); 4210 } 4211 else { 4212 $('.vertical-tabs-path').html(clonedUrlAlias); 4213 // Remove the additional legend. 4214 $('.vertical-tabs-path').find('legend').remove(); 4215 } 4216 }); 4217 4218 $(".disable-url").unbind( "click" ); 4219}; 4220 4221/** 4222 * Show Visibility to unauthorized users when we have peeking enabled. 4223 */ 4224Drupal.behaviors.VisibillityUnauthorizedUsers= function(context) { 4225 var accessDefaultt = $('#edit-dd-access-default', context); 4226 var accessEveryone = $('#edit-dd-access-rids-0', context); 4227 var visibilityDiv = $('#edit-dd-access-peeking-wrapper', context); 4228 4229 // Default state. 4230 if(accessEveryone.is(':checked')) { 4231 visibilityDiv.hide(); 4232 } 4233 4234 // Everyone change 4235 accessEveryone.change(function() { 4236 if(!$(this).is(":checked")) { 4237 visibilityDiv.show(); 4238 } 4239 else { 4240 visibilityDiv.hide(); 4241 } 4242 }); 4243 4244 // Default change 4245 accessDefaultt.change(function() { 4246 if(accessEveryone.is(":checked")) { 4247 visibilityDiv.hide(); 4248 } 4249 else { 4250 visibilityDiv.show(); 4251 } 4252 }); 4253}; 4254 4255/** 4256 * Autocomplete the calendar end date. 4257 */ 4258Drupal.behaviors.setCalendarEndDate = function(context) { 4259 $("input[name^='field_date['][name*='[value]']", context).change(function autocompleteEndDate() { 4260 // Only get the date field. 4261 if($(this).hasClass('hasDatepicker')) { 4262 const name = this.name.split('[');
4263 const fieldId = name[1].split(']'); 4264 $("input[name='field_date["+ fieldId[0] +"][value2][date]']").val($(this).val()); 4265 } 4266 }); 4267}; 4268 4269/** 4270 * Handles temporary lat/lon field to be displayed under location. 4271 */ 4272Drupal.behaviors.LatitudeLongitudeFields = function(context) { 4273 var latitude = $('#edit-location-x-wrapper'); 4274 var longitude = $('#edit-location-y-wrapper'); 4275 var locationField = $('#edit-field-location-0-text'); 4276 // Place the inputs. 4277 longitude.insertBefore(locationField); 4278 latitude.insertBefore(locationField); 4279 // Display them. 4280 latitude.css('display','inline-block'); 4281 longitude.css('display','inline-block'); 4282}; 4283; 4284Drupal.behaviors.ddLoginInit = function(context) { 4285 var $loginBlock = $('body.not-logged-in #block-dd_login-login', context); 4286 if ($loginBlock.size() == 0) { 4287 return; 4288 } 4289 4290 $loginBlock.dialog({ modal: true, height: 'auto', autoOpen: false, dialogClass: 'dd-login'}); 4291 4292 $("body.not-logged-in a[href$='/user/login'], body.not-logged-in a[href$='/user']", context).click(function() { 4293 openLoginDialog(); 4294 return false; 4295 }); 4296 4297 if (location.hash == '#dd-login') { 4298 openLoginDialog(); 4299 } 4300 4301 function openLoginDialog() { 4302 // Redirect to HTTPS, if necessary. 4303 if (Drupal.settings.ddForceHttpsAuthenticated && location.protocol != 'https:') { 4304 location.assign('https://' + location.hostname + location.pathname + location.search + '#dd-login'); 4305 return; 4306 } 4307 4308 $loginBlock.dialog('open'); 4309 $loginBlock.find('#edit-name').focus(); 4310 } 4311}; 4312; 4313Drupal.behaviors.ddPoll = function(context) { 4314 // Optimization: first search for .dd-poll-node, then search for the rest. 4315 $('.dd-poll-node', context).each(function() { 4316 var $node = $(this); 4317 4318 if ($node.find('.vote form').length) { 4319 new Drupal.ddPollNodeVote($node); 4320 } 4321 else if ($node.find('.results table').length) { 4322 new Drupal.ddPollNodeResults($node); 4323 } 4324 }); 4325 4326 // Draw charts, if any, once all other behaviors are done processing. 4327 setTimeout(function() { 4328 Drupal.ddPollNodeResultsGraph.ready = true; 4329 Drupal.ddPollNodeResultsGraph.drawCharts(); 4330 }, 0); 4331}; 4332 4333Drupal.ddPollNodeVote = function($element) { 4334 var self = this; 4335 this.$element = $element; 4336 this.nid = this.$element.find('input[name=nid]').val(); 4337 this.vid = this.getVid(); 4338 4339 // If we couldn't establish a unique voter ID, leave the poll disabled. 4340 if (!this.vid) { 4341 this.$element.addClass('initialized'); 4342 return; 4343 } 4344 4345 // Enable the poll. 4346 this.setMessage(); 4347 4348 // Enable the submit button. 4349 this.$element.find('input.form-submit') 4350 .attr('disabled', false) 4351 .attr('data-disabled', false); 4352 4353 // Remove the dd_mobile 'disabled' button theme. 4354 this.$element.find('.ui-submit') 4355 .removeClass('ui-disabled') 4356 .attr('aria-disabled', false) 4357 .attr('data-disabled', false); 4358 4359 this.$element.addClass('initialized'); 4360 4361 // Load the poll results if the voter has already voted for this poll. 4362 var nids = self.getVotedNids(); 4363 4364 if ($.inArray(this.nid, nids) != -1) { 4365 this.$element.addClass('in-progress'); 4366 4367 // Request the results. 4368 $.ajax({ 4369 type: "GET", 4370 url: Drupal.settings.ddPoll['resultsURI'], 4371 data: { nid: this.nid, vid: this.vid }, 4372 dataType: 'html', 4373 success: function(data) { 4374 self.setResults(data); 4375 }, 4376 complete: function() { 4377 self.$element.removeClass('in-progress'); 4378 } 4379 }); 4380 } 4381 4382 // Submit the vote when the form is submitted. 4383 this.$element.find('form').submit(function() { 4384 var $form = $(this); 4385 4386 // Throw a fit if no answer has been selected. 4387 if ($form.find('input[name=aid]:checked').length == 0) { 4388 self.setMessage('Please select an answer in order to vote.', 'warning'); 4389 return false; 4390 } 4391 4392 // Populate the voter ID. 4393 $form.find('input[name=vid]').val(self.vid); 4394 4395 // Disable the submit button. 4396 $form.find('input.form-submit') 4397 .attr('disabled', true) 4398 .attr('data-disabled', true); 4399 4400 // Adds the dd_mobile 'disabled' button theme. 4401 $form.find('.ui-submit') 4402 .addClass('ui-disabled') 4403 .attr('aria-disabled', true) 4404 .attr('data-disabled', true); 4405 4406 // Show something's going on. 4407 self.$element.addClass('in-progress'); 4408 4409 $.ajax({ 4410 type: "POST", 4411 url: $form.attr('action'), 4412 data: $form.serialize(), 4413 dataType: 'json', 4414 success: function(data) { 4415 // Remember this poll has been voted on. 4416 if (data['voted']) { 4417 var nids = self.getVotedNids(); 4418 4419 if ($.inArray(self.nid, nids) == -1) { 4420 nids.push(self.nid); 4421 } 4422 4423 self.setVotedNids(nids); 4424 } 4425 4426 // Show a message, if necessary. 4427 if (data['message'] && data['messageType']) { 4428 self.setMessage(data['message'], data['messageType']); 4429 } 4430 4431 // Show the poll results, if available. 4432 if (data['results']) { 4433 self.setResults(data['results']); 4434 } 4435 }, 4436 complete: function() { 4437 self.$element.removeClass('in-progress'); 4438 } 4439 }); 4440 4441 return false;
4442 }); 4443}; 4444 4445Drupal.ddPollNodeVote.prototype.setMessage = function(message, type) { 4446 var $element = this.$element.find('div.message'); 4447 4448 // Reset the message element's classes. 4449 $element.attr('class', ''); 4450 $element.addClass('message'); 4451 4452 // Set the message. 4453 if (message) { 4454 $element.html(message); 4455 4456 if (!type) { 4457 type = 'notice'; 4458 } 4459 $element.addClass('message-' + type); 4460 } 4461 else { 4462 $element.empty(); 4463 } 4464}; 4465 4466Drupal.ddPollNodeVote.prototype.setResults = function(results) { 4467 this.$element.find('div.vote').empty(); 4468 this.$element.find('div.results').empty(); 4469 this.$element.find('div.results').append(results); 4470 4471 new Drupal.ddPollNodeResults(this.$element); 4472}; 4473 4474Drupal.ddPollNodeVote.prototype.getVid = function() { 4475 var vid = this.getPrimitiveVid(); 4476 4477 if (!vid) { 4478 var randomVid = this.generateRandomVid(); 4479 this.setVid(randomVid); 4480 4481 // Check whether we were actually able to save the 4482 if (this.getPrimitiveVid() == randomVid) { 4483 vid = randomVid; 4484 } 4485 } 4486 4487 return vid; 4488}; 4489 4490Drupal.ddPollNodeVote.prototype.generateRandomVid = function() { 4491 // Generates a random two-byte integer. 4492 var randomWord = function() { 4493 return (Math.random() * 0x10000) | 0; 4494 }; 4495 4496 // Formats a two-byte integer into a padded hex string. 4497 var formatWord = function(word) { 4498 var string = word.toString(16); 4499 while (string.length < 4) string = '0' + string; 4500 return string; 4501 }; 4502 4503 // Generate a v4 UUID. 4504 var words = [null, null, null, null, null, null, null, null]; 4505 words = $.map(words, randomWord);
4506 words[3] = words[3] & 0x0FFF | 0x4000; 4507 words[4] = words[4] & 0x3FFF | 0x8000; 4508 4509 return $.map(words, formatWord).join(''); 4510}; 4511 4512Drupal.ddPollNodeVote.prototype.setVid = function(vid) { 4513 if (typeof window.localStorage != 'undefined') { 4514 window.localStorage.setItem('VSESSIONID', vid); 4515 } 4516 else { 4517 document.cookie = "VSESSIONID=" + vid + "; expires=Sat, 1 Jan 2050 00:00:00 UTC; path=/"; 4518 } 4519}; 4520 4521Drupal.ddPollNodeVote.prototype.getPrimitiveVid = function() { 4522 var vid = undefined; 4523 4524 if (typeof window.localStorage != 'undefined') { 4525 vid = window.localStorage.getItem('VSESSIONID'); 4526 } 4527 4528 if (vid === undefined) { 4529 var name = "VSESSIONID="; 4530 4531 $.each(document.cookie.split(';'), function(index, cookie) { 4532 cookie = $.trim(cookie); 4533 4534 if (cookie.indexOf(name) == 0) { 4535 vid = cookie.substring(name.length, cookie.length); 4536 } 4537 }); 4538 } 4539 4540 if (typeof(vid) != 'string' || vid.length != 32) { 4541 vid = undefined; 4542 } 4543 4544 return vid; 4545}; 4546 4547Drupal.ddPollNodeVote.prototype.setVotedNids = function(nids) { 4548 if ((typeof window.localStorage != 'undefined') && (typeof window.JSON != 'undefined')) { 4549 window.localStorage.setItem('ddPollVotedNids', JSON.stringify(nids)); 4550 } 4551 else { 4552 document.cookie = "ddPollVotedNids=" + nids.join(',') + "; expires=Sat, 1 Jan 2050 00:00:00 UTC; path=/"; 4553 } 4554}; 4555 4556Drupal.ddPollNodeVote.prototype.getVotedNids = function() { 4557 var nids = undefined; 4558 4559 if ((typeof window.localStorage != 'undefined') && (typeof window.JSON != 'undefined')) { 4560 try { 4561 nids = JSON.parse(window.localStorage.getItem('ddPollVotedNids')); 4562 } 4563 catch(e) { 4564 // Ignore 4565 } 4566 } 4567 4568 if (nids == undefined) { 4569 var name = "ddPollVotedNids="; 4570 4571 $.each(document.cookie.split(';'), function(index, cookie) { 4572 cookie = $.trim(cookie); 4573 4574 if (cookie.indexOf(name) == 0) { 4575 nids = cookie.substring(name.length, cookie.length); 4576 } 4577 }); 4578 4579 if (nids) { 4580 nids = nids.split(','); 4581 } 4582 } 4583 4584 if (typeof(nids) != 'object' || !(nids instanceof Array)) { 4585 nids = []; 4586 } 4587 4588 return nids; 4589}; 4590 4591Drupal.ddPollNodeResults = function($element) { 4592// var self = this; 4593 this.$element = $element; 4594 4595 // Add this to the array of results to be graphed and trigger them to be 4596 // drawn. 4597 Drupal.ddPollNodeResultsGraph.results.push(this); 4598 Drupal.ddPollNodeResultsGraph.drawCharts(); 4599 4600 $element.addClass('initialized'); 4601}; 4602 4603Drupal.ddPollNodeResults.prototype.drawChart = function() { 4604 //noinspection JSUnresolvedFunction,JSUnresolvedVariable 4605 var data = new google.visualization.DataTable(); 4606 //noinspection JSUnresolvedFunction 4607 data.addColumn('string', 'Answer'); 4608 //noinspection JSUnresolvedFunction 4609 data.addColumn('number', 'Votes'); 4610 4611 var $table = this.$element.find('table.dd-poll-results'); 4612 4613 $table.find('tbody tr').each(function() { 4614 var $columns = $(this).find('td'); 4615 4616 if ($columns.length == 2) { 4617 var answer = $columns.eq(0).text(); 4618 var percent = parseFloat($columns.eq(1).text().replace('%', '')); 4619 //noinspection JSUnresolvedFunction 4620 data.addRow([answer, percent]); 4621 } 4622 }); 4623 4624 var options = { 4625 width: '100%', 4626 height: 200, 4627 chartArea: { 4628 width: '100%' 4629 }, 4630 legend: { 4631 position: 'bottom' 4632 }, 4633 tooltip: { 4634 text: 'percentage' 4635 }, 4636 backgroundColor: 'transparent', 4637 // So that slices with 0 votes still show up in the legend. 4638 sliceVisibilityThreshold: 0 4639 }; 4640 4641 if (Drupal.ddPollNodeResultsGraphOptionsAlter) { 4642 Drupal.ddPollNodeResultsGraphOptionsAlter(this.$element, options); 4643 } 4644 4645 // Make a div to hold the chart, replacing the table. 4646 var $chartDiv = $('<div></div>'); 4647 $table.css('display', 'none').after($chartDiv); 4648 4649 //noinspection JSUnresolvedFunction,JSUnresolvedVariable 4650 var chart = new google.visualization.PieChart($chartDiv.get(0)); 4651 //noinspection JSUnresolvedFunction 4652 chart.draw(data, options); 4653}; 4654 4655Drupal.ddPollNodeResultsGraph = { 4656 // Wether all graphs have been initialized. 4657 ready: false, 4658 // Whether the graph API has been loaded. 4659 prepared: false, 4660 // The results that need to be graphed. 4661 results: [] 4662}; 4663 4664Drupal.ddPollNodeResultsGraph.prepareCharts = function() { 4665 // Don't attempt to load the API more than once. 4666 if (Drupal.ddPollNodeResultsGraph.prepared) { 4667 return; 4668 } 4669 4670 var autoload = '{"modules":[{"name":"visualization","version":"1.0","packages":["corechart"],"callback":"Drupal.ddPollNodeResultsGraph.chartsPrepared"}]}'; 4671 4672 // We don't use $.getScript, because it does unnecessary cache breaking. 4673 $.ajax({ 4674 url: 'https://www.google.com/jsapi?autoload=' + encodeURIComponent(autoload),
4675 dataType: 'script', 4676 cache: true 4677 }); 4678}; 4679 4680Drupal.ddPollNodeResultsGraph.chartsPrepared = function() { 4681 // Now that the graph API has been loaded, re-trigger graphs to be drawn. 4682 Drupal.ddPollNodeResultsGraph.prepared = true; 4683 Drupal.ddPollNodeResultsGraph.drawCharts(); 4684}; 4685 4686Drupal.ddPollNodeResultsGraph.drawCharts = function() { 4687 // Abort if we're not ready yet or if there's nothing to draw. 4688 if (!Drupal.ddPollNodeResultsGraph.ready || Drupal.ddPollNodeResultsGraph.results.length == 0) { 4689 return; 4690 } 4691 4692 // Load the graph API first, if necessary. 4693 if (!Drupal.ddPollNodeResultsGraph.prepared) { 4694 Drupal.ddPollNodeResultsGraph.prepareCharts(); 4695 return; 4696 } 4697 4698 while (Drupal.ddPollNodeResultsGraph.results.length > 0) { 4699 Drupal.ddPollNodeResultsGraph.results.pop().drawChart(); 4700 } 4701}; 4702; 4703// Get all cookieconsent cookies on a a site. 4704function getAllConsentCookies() { 4705 var theCookies = document.cookie.split(';'); 4706 var cookieconsent_cookies = []; 4707 4708 $.each( theCookies, function( key, value ) { 4709 // if(value.includes('cookieconsent_status_')) { // fix this for IE 11 on Win 7 4710 if(value.indexOf('cookieconsent_status_') > -1) { 4711 cookieconsent_cookies.push(value.split("=")[0].replace(/ /g,'')); 4712 } 4713 }); 4714 return cookieconsent_cookies; 4715} 4716 4717// Retrieve an array key out of Drupal.settings.dd_sitewide_message_notification for a specific cookie. 4718function getArrayKey(name) { 4719 var cookie_key = null; 4720 4721 $.each(Drupal.settings.dd_sitewide_message_notification.dd_sitewide_message_cookie_name, function( key, value ) { 4722 if(value == name) { 4723 cookie_key = key; 4724 } 4725 }); 4726 return cookie_key; 4727} 4728 4729// Get a cookie by name 4730function getCookie(name) { 4731 var value = "; " + document.cookie; 4732 var parts = value.split("; " + name + "="); 4733 if (parts.length == 2) return parts.pop().split(";").shift(); 4734} 4735 4736// Delete a cookie by setting expire date to the past. 4737function deleteCookie(name) { 4738 document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; 4739} 4740 4741Drupal.behaviors.dd_sitewide_message_reset_notifications = function (context) { 4742 // Check if we have any data. 4743 if( typeof Drupal.settings.dd_sitewide_message_notification === "undefined") { 4744 return; 4745 } 4746 4747 // Iterate over cookie consent cookies and check if needs to be reset. 4748 $.each( getAllConsentCookies(), function( key, value ) { 4749 var existing_cookie_version = getCookie(value).split(',')[1]; 4750 var cookieArrayKey = getArrayKey(value); 4751 var cookie_version = Drupal.settings.dd_sitewide_message_notification.dd_sitewide_message_cookie_version; 4752 4753 // Check if we have more than one message. 4754 if (typeof(cookie_version) === 'object') { 4755 current_cookie_version = cookie_version[cookieArrayKey]; 4756 } else { 4757 current_cookie_version = cookie_version; 4758 } 4759 4760 // Delete the cookie so it will re-appear. 4761 if (existing_cookie_version != current_cookie_version) { 4762 deleteCookie(value); 4763 } 4764 }); 4765}; 4766; 4767Drupal.behaviors.ddTwitterFeed = function(context) { 4768 var $feedBlock = $('.dd-twitter-feed', context); 4769 // See if there is a DD Twitter Feed Block present. 4770 if ($feedBlock.length > 0) { 4771 new Drupal.DDTwitterFeedTweets($feedBlock); 4772 } 4773}; 4774 4775Drupal.DDTwitterFeedTweets = function($element) { 4776 var self = this; 4777 this.$element = $element; 4778 4779 // Add helper class for theming the load of tweets. 4780 this.$element.addClass('loading-tweets'); 4781 4782 // Request the tweets. 4783 $.ajax({ 4784 type: 'GET', 4785 cache: true, 4786 url: Drupal.settings.ddTwitterFeed['getTweetsURI'], 4787 dataType: 'html', 4788 success: function(data) { 4789 self.$element.find('.dd-twitter-feed-tweets').html(data); 4790 self.animateResults(); 4791 }, 4792 complete: function() { 4793 self.$element.removeClass('loading-tweets'); 4794 } 4795 }); 4796}; 4797 4798Drupal.DDTwitterFeedTweets.prototype.animateResults = function() { 4799 var $tweets = this.$element.find('.dd-twitter-feed-tweet'), 4800 count = 0, 4801 total = $tweets.length, 4802 delay = 5500; 4803 4804 // show the first tweet. 4805 $tweets.eq(count).show(); 4806 4807 // only animate if there is more than one tweet. 4808 if (total > 1) { 4809 window.setInterval(function() { 4810 // fade out current tweet. 4811 $tweets.eq(count).animate({opacity:'hide'}, 200, function() { 4812 count++; 4813 // keeps count in bounds. 4814 if (count >= total) count = 0; 4815 // fade in the next tweet. 4816 $tweets.eq(count).animate({opacity:'show'}, 300); 4817 }); 4818 }, delay); 4819 } 4820}; 4821; 4822// $Id: extlink.js,v 1.4.2.12 2010/05/26 01:25:56 quicksketch Exp $ 4823 4824// This is unnecessary and breaks webwraps in IE 4825//(function ($) { 4826 4827function extlinkAttach(context) { 4828 // Strip the host name down, removing ports, subdomains, or www. 4829 var pattern = /^(([^\/:]+?\.)*)([^\.:]{4,})((\.[a-z]{1,4})*)(:[0-9]{1,5})?$/; 4830 var host = window.location.host.replace(pattern, '$3$4'); 4831 var subdomain = window.location.host.replace(pattern, '$1'); 4832 4833 // Determine what subdomains are considered internal. 4834 if (Drupal.settings.extlink.extSubdomains) { 4835 var subdomains = "([^/]*\\.)?"; 4836 } 4837 else if (subdomain == 'www.' || subdomain == '') { 4838 var subdomains = "(www\\.)?"; 4839 } 4840 else { 4841 var subdomains = subdomain.replace(".", "\\."); 4842 } 4843 4844 // Build regular expressions that define an internal link. 4845 var internal_link = new RegExp("^https?://" + subdomains + host, "i"); 4846 4847 // Extra internal link matching. 4848 var extInclude = false;
4849 if (Drupal.settings.extlink.extInclude) { 4850 extInclude = new RegExp(Drupal.settings.extlink.extInclude.replace(/\\/, '\\')); 4851 } 4852 4853 // Extra external link matching. 4854 var extExclude = false; 4855 if (Drupal.settings.extlink.extExclude) { 4856 extExclude = new RegExp(Drupal.settings.extlink.extExclude.replace(/\\/, '\\')); 4857 } 4858 4859 // Find all links which are NOT internal and begin with http (as opposed 4860 // to ftp://, javascript:, etc. other kinds of links. 4861 // When operating on the 'this' variable, the host has been appended to 4862 // all links by the browser, even local ones. 4863 // In jQuery 1.1 and higher, we'd use a filter method here, but it is not 4864 // available in jQuery 1.0 (Drupal 5 default). 4865 var external_links = new Array(); 4866 var mailto_links = new Array(); 4867 $("a:not(." + Drupal.settings.extlink.extClass + ", ." + Drupal.settings.extlink.mailtoClass + ")", context).each(function(el) { 4868 try { 4869 var url = this.href.toLowerCase(); 4870 if (url.indexOf('http') == 0 && (!url.match(internal_link) || (extInclude && url.match(extInclude))) && !(extExclude && url.match(extExclude))) { 4871 external_links.push(this); 4872 } 4873 else if (url.indexOf('mailto:') == 0) { 4874 mailto_links.push(this); 4875 } 4876 } 4877 // IE7 throws errors often when dealing with irregular links, such as: 4878 // <a href="node/10"></a> Empty tags. 4879 // <a href="http://user:[email protected]">example</a> User:pass syntax. 4880 catch(error) { 4881 return false; 4882 } 4883 }); 4884 4885 if (Drupal.settings.extlink.extClass) { 4886 // Apply the "ext" class to all links not containing images. 4887 if (parseFloat($().jquery) < 1.2) { 4888 $(external_links).not('[img]').addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.extClass + '></span>'); }); 4889 } 4890 else { 4891 $(external_links).not($(external_links).find('img').parents('a')).addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.extClass + '></span>'); }); 4892 } 4893 } 4894 4895 if (Drupal.settings.extlink.mailtoClass) { 4896 // Apply the "mailto" class to all mailto links not containing images. 4897 if (parseFloat($().jquery) < 1.2) { 4898 $(mailto_links).not('[img]').addClass(Drupal.settings.extlink.mailtoClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>'); }); 4899 } 4900 else { 4901 $(mailto_links).not($(mailto_links).find('img').parents('a')).addClass(Drupal.settings.extlink.mailtoClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>'); }); 4902 } 4903 } 4904 4905 if (Drupal.settings.extlink.extTarget) { 4906 // Apply the target attribute to all links. 4907 $(external_links).attr('target', Drupal.settings.extlink.extTarget); 4908 } 4909 4910 if (Drupal.settings.extlink.extAlert) { 4911 // Add pop-up click-through dialog. 4912 $(external_links).click(function(e) { 4913 return confirm(Drupal.settings.extlink.extAlertText); 4914 }); 4915 } 4916 4917 // Work around for Internet Explorer box model problems. 4918 if (($.support && !($.support.boxModel === undefined) && !$.support.boxModel) || ($.browser.msie && parseInt($.browser.version) <= 7)) { 4919 $('span.ext, span.mailto').css('display', 'inline-block'); 4920 } 4921} 4922 4923Drupal.behaviors.extlink = function(context) { 4924 extlinkAttach(context); 4925} 4926 4927//})(jQuery); 4928; 4929 4930/** 4931 * Manage the active and inactive states of the commands menu. 4932 */ 4933 4934Drupal.DigitaldCoreCommandsMenu = function(element, options) { 4935 var self = this; 4936 self.element = element; 4937 self.$element = $(element); 4938 self._defaults = {delay: 300}; 4939 self.settings = $.extend({}, true, this._defaults, options); 4940 self.init(); 4941}; 4942 4943Drupal.DigitaldCoreCommandsMenu.prototype = { 4944 init: function() { 4945 this.addListeners(); 4946 }, 4947 hide: function($element) { 4948 // Set the element(s) inactive 4949 $element.removeClass('active'); 4950 }, 4951 show: function($element) {
4952 // Set the element(s) active 4953 $element.addClass('active'); 4954 // Cancel the timeout delay for the element(s) 4955 $element.doTimeout('deactivate'); 4956 }, 4957 on: function(event) { 4958 var self = event.data.self; 4959 var $this = $(this); 4960 if ($this.is('.active')) { 4961 self.show($this); 4962 } 4963 }, 4964 off: function(event) { 4965 var self = event.data.self; 4966 var $this = $(this); 4967 // Add a delay before deactivating the menu 4968 $this.doTimeout('deactivate', self.settings.delay, function() { 4969 self.hide($this); 4970 }); 4971 }, 4972 click: function(event) { 4973 var self = event.data.self; 4974 if (self.$element.is('.active')) { 4975 self.hide(self.$element); 4976 } 4977 else { 4978 self.show(self.$element); 4979 } 4980 }, 4981 addListeners: function() { 4982 // Add a click event to toggle the display of the menu 4983 this.$element.find('.block-title').bind('click', {self: this}, this.click); 4984 // Add a listener to hide/show the menu if the user hovers on/off of it. 4985 this.$element.bind('mouseenter', {self: this}, this.on); 4986 this.$element.bind('mouseleave', {self: this}, this.off); 4987 } 4988}; 4989 4990Drupal.behaviors.digitaldcoreCommandsMenu = function(context) { 4991 $('#block-digitaldcore-command_menu', context).each(function(i, element) { 4992 if (!element.digitaldcoreCommandsMenu) { 4993 element.digitaldcoreCommandsMenu = new Drupal.DigitaldCoreCommandsMenu(element); 4994 } 4995 }); 4996}; 4997 4998Drupal.behaviors.digitaldcoreInitialize = function(context) { 4999 $("body.page-manage-content-advanced .admin-content .view-filters > form > div", context).before("<div class='filter-title'>Filter and search content</div>"); 5000 5001 $("body.page-manage-content-advanced .admin-content #edit-submit-manage-content", context).parent().append('<button type="button" onclick="window.location = "/manage/content/advanced?filters=reset";" class="admin-reset-filters">Reset filters</button>'); 5002 5003 $("body.page-manage-content-advanced .admin-content #views-bulk-operations-select #views-bulk-operations-dropdown", context).before("<div class='bulk-instructions'>Choose posts to perform a batch operation:</div>"); 5004 5005 // Create a sitemap using the default site navigation menu (.navbar) 5006 5007 var sitemap = $("#site-map", context); 5008 var navbar = $(".navbar .block-content", context); 5009 5010 if (sitemap.length && navbar.length) { 5011 Drupal.digitaldcoreCreateSiteMap(sitemap, navbar); 5012 } 5013}; 5014 5015/** 5016 * Function that creates a sitemap display using the main site navigation menu 5017 * 5018 * @param $sitemap (jQuery element) Sitemap container 5019 * @param $navbar (jQuery element) Main site navigation menu 5020 */ 5021 5022Drupal.digitaldcoreCreateSiteMap = function($sitemap, $navbar) { 5023 // Get reference to the sitemap message 5024 var message = $('.site-map-message', $sitemap).html(); 5025 5026 // Clear out any existing content within the sitemap container 5027 $sitemap.empty(); 5028 5029 // If a message was found, add that back into the new sitemap content 5030 if (message) { 5031 $sitemap.before('<div id="site-map-message">' + message + '</div>'); 5032 } 5033 5034 // Convert the crazy long menu item classname to cleaner alternative 5035 $sitemap.append($navbar.html().replace(/menu-path-taxonomy-term-/ig, 'tid-')); 5036 $sitemap.find('a[href="/"]').removeClass('hidden'); 5037 5038 // Remove hidden term links 5039 $sitemap.find('a.hidden').remove(); 5040 5041 // Remove hidden terms associated to a hidden navigation term 5042 $sitemap.find('li').map(function() { 5043 if(!$(this).children('a').length) { 5044 return this; 5045 } 5046 }).remove(); 5047 5048 // Remove class names from lists 5049 $sitemap.find('ul').removeAttr('class'); 5050 5051 // Remove inline styling, titles, ids, and focus from any sitemap element 5052 $sitemap.find("*").removeAttr('style').removeAttr('title').removeAttr('id').removeAttr('hidefocus'); 5053 5054 // Add an RSS feed icon which links to each menu items RSS output 5055 $sitemap.find('a.menu-link:not(.ext)').each(function() { 5056 var link = $(this); 5057 var match = link.attr('class').match(/\btid-(\d+)\b/); 5058 if (!match) { 5059 return; 5060 } 5061 var tid = match[1]; 5062 link.after(link.clone()); 5063 link.html('<img src="/misc/feed.png" alt="RSS Feed" />'); 5064 link.addClass('sitemap-rss'); 5065 link.attr('href', Drupal.settings.basePath + 'taxonomy/term/' + tid + '/0/feed'); 5066 }); 5067}; 5068 5069Drupal.behaviors.digitaldcoreInterrupt = function(context) { 5070 var showDialog = true; 5071 5072 // Take care of the multivariateness 5073 if (Drupal.settings.ddCreatePopup) { 5074 var winner = null; 5075 var accumulator = 0.0; 5076 var threshold = Math.random(); 5077 5078 $.each(Drupal.settings.ddCreatePopup, function(key, popup) { 5079 var probability = parseFloat(popup.probability); 5080 accumulator += probability; 5081 5082 if (accumulator > threshold) { 5083 winner = popup.content_nid; 5084 return false;
5085 } 5086 }); 5087 5088 if (winner) { 5089 $('#block-digitaldcore-interrupt .node-teaser').hide(); 5090 $('#block-digitaldcore-interrupt .node-teaser.node-' + winner).show(); 5091 } 5092 else { 5093 showDialog = false; 5094 } 5095 } 5096 5097 if (showDialog && $('#block-digitaldcore-interrupt', context).size()) { 5098 setTimeout(function() { 5099 // Ensure that the plugin is still available, since being called via setTimeout 5100 if (typeof $.fn.dialog === 'function') { 5101 $('#block-digitaldcore-interrupt', context).dialog({ dialogClass: 'dd-interrupt', modal: true, width: 550, height: 400 }); 5102 } 5103 }, 3000); // 6 second delay will work with every browser 5104 5105 $('#block-digitaldcore-interrupt .dd-hover-expand', context).click(function() { 5106 $('.ui-dialog-overlay').fadeOut(); 5107 }); 5108 $('#block-digitaldcore-interrupt .dd-hover-wrapper').css({ left:'100px', right:'auto' }); 5109 } 5110 else { 5111 $('#block-digitaldcore-interrupt', context).hide(); 5112 } 5113}; 5114 5115Drupal.behaviors.ddCalendarAttachBehaviors = function(context) { 5116 $('body.section-calendar article header .event-date .date-display-single', context).each(function () { 5117 if (this.children.length === 0 && $(this).text() === '12:00am') { 5118 $(this).hide(); 5119 } 5120 }); 5121 $("body.section-calendar", context).ajaxComplete(function() { 5122 Drupal.attachBehaviors($("#calpopup", context)); 5123 }); 5124}; 5125 5126/** 5127 * Force all links to common files (pdf, doc, etc) to open in a new window. 5128 */ 5129Drupal.behaviors.fileLinks = function(context) { 5130 var pattern = /\.(pdf|doc|docx|xls|xlsx|csv|txt|rtf|odf|ppt|pptx|xml)$/; 5131 $('#main a', context).each(function() { 5132 if (this.href.match(pattern)) { 5133 this.target = "_blank"; 5134 } 5135 }); 5136}; 5137 5138Drupal.behaviors.webformDuplicateSubmissions = function(context) { 5139 $('form.webform-client-form', context).submit(function(event) { 5140 if (event.defaultPrevented) { 5141 return; 5142 } 5143 5144 var $submit = $('input#edit-submit', this); 5145 5146 // Disable the button asynchronously, so that its value still gets submitted 5147 // to the server. This is important for webforms with multiple buttons, such 5148 // as multipage webforms or webforms that support drafts. 5149 setTimeout(function() { 5150 $submit.attr('disabled', 'disabled'); 5151 }, 1); 5152 5153 // Change the button label after a delay, so that it only shows up if the 5154 // form submission is slower. 5155 setTimeout(function() { 5156 $submit.attr('value', 'Please wait...'); 5157 }, 2500); 5158 }); 5159}; 5160; 5161/* Modernizr 2.8.3 (Custom Build) | MIT & BSD 5162 * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderradius-boxshadow-flexbox-flexboxlegacy-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-csstransforms-csstransforms3d-csstransitions-canvas-canvastext-draganddrop-audio-video-input-inputtypes-localstorage-sessionstorage-geolocation-inlinesvg-svg-touch-shiv-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes 5163 */ 5164; 5165 5166 5167 5168window.Modernizr = (function( window, document, undefined ) { 5169 5170 var version = '2.8.3', 5171 5172 Modernizr = {}, 5173 5174 enableClasses = true, 5175 5176 docElement = document.documentElement, 5177 5178 mod = 'modernizr', 5179 modElem = document.createElement(mod), 5180 mStyle = modElem.style, 5181 5182 inputElem = document.createElement('input') , 5183 5184 smile = ':)', 5185 5186 toString = {}.toString, 5187 5188 prefixes = ' -webkit- -moz- -o- -ms- '.split(' '), 5189 5190 5191 5192 omPrefixes = 'Webkit Moz O ms', 5193 5194 cssomPrefixes = omPrefixes.split(' '), 5195 5196 domPrefixes = omPrefixes.toLowerCase().split(' '), 5197 5198 ns = {'svg': 'http://www.w3.org/2000/svg'}, 5199 5200 tests = {}, 5201 inputs = {}, 5202 attrs = {}, 5203 5204 classes = [], 5205 5206 slice = classes.slice, 5207 5208 featureName, 5209 5210 5211 injectElementWithStyles = function( rule, callback, nodes, testnames ) { 5212 5213 var style, ret, node, docOverflow, 5214 div = document.createElement('div'), 5215 body = document.body, 5216 fakeBody = body || document.createElement('body'); 5217 5218 if ( parseInt(nodes, 10) ) { 5219 while ( nodes-- ) { 5220 node = document.createElement('div'); 5221 node.id = testnames ? testnames[nodes] : mod + (nodes + 1); 5222 div.appendChild(node); 5223 } 5224 } 5225 5226 style = ['­','<style id="s', mod, '">', rule, '</style>'].join(''); 5227 div.id = mod; 5228 (body ? div : fakeBody).innerHTML += style; 5229 fakeBody.appendChild(div); 5230 if ( !body ) { 5231 fakeBody.style.background = ''; 5232 fakeBody.style.overflow = 'hidden'; 5233 docOverflow = docElement.style.overflow; 5234 docElement.style.overflow = 'hidden'; 5235 docElement.appendChild(fakeBody); 5236 } 5237 5238 ret = callback(div, rule); 5239 if ( !body ) { 5240 fakeBody.parentNode.removeChild(fakeBody); 5241 docElement.style.overflow = docOverflow; 5242 } else { 5243 div.parentNode.removeChild(div); 5244 } 5245 5246 return !!ret; 5247 5248 }, 5249 5250 5251 5252 isEventSupported = (function() { 5253 5254 var TAGNAMES = { 5255 'select': 'input', 'change': 'input', 5256 'submit': 'form', 'reset': 'form', 5257 'error': 'img', 'load': 'img', 'abort': 'img' 5258 }; 5259 5260 function isEventSupported( eventName, element ) { 5261 5262 element = element || document.createElement(TAGNAMES[eventName] || 'div'); 5263 eventName = 'on' + eventName; 5264 5265 var isSupported = eventName in element; 5266 5267 if ( !isSupported ) { 5268 if ( !element.setAttribute ) { 5269 element = document.createElement('div'); 5270 } 5271 if ( element.setAttribute && element.removeAttribute ) { 5272 element.setAttribute(eventName, ''); 5273 isSupported = is(element[eventName], 'function'); 5274 5275 if ( !is(element[eventName], 'undefined') ) { 5276 element[eventName] = undefined; 5277 } 5278 element.removeAttribute(eventName); 5279 } 5280 } 5281 5282 element = null; 5283 return isSupported; 5284 } 5285 return isEventSupported; 5286 })(), 5287 5288 5289 _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp; 5290 5291 if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) { 5292 hasOwnProp = function (object, property) { 5293 return _hasOwnProperty.call(object, property); 5294 }; 5295 } 5296 else { 5297 hasOwnProp = function (object, property) { 5298 return ((property in object) && is(object.constructor.prototype[property], 'undefined')); 5299 }; 5300 } 5301 5302 5303 if (!Function.prototype.bind) { 5304 Function.prototype.bind = function bind(that) { 5305 5306 var target = this; 5307 5308 if (typeof target != "function") { 5309 throw new TypeError(); 5310 } 5311 5312 var args = slice.call(arguments, 1), 5313 bound = function () { 5314 5315 if (this instanceof bound) { 5316 5317 var F = function(){}; 5318 F.prototype = target.prototype; 5319 var self = new F(); 5320 5321 var result = target.apply( 5322 self, 5323 args.concat(slice.call(arguments)) 5324 ); 5325 if (Object(result) === result) { 5326 return result; 5327 } 5328 return self; 5329 5330 } else { 5331 5332 return target.apply( 5333 that, 5334 args.concat(slice.call(arguments)) 5335 ); 5336 5337 } 5338 5339 }; 5340 5341 return bound; 5342 }; 5343 } 5344 5345 function setCss( str ) { 5346 mStyle.cssText = str; 5347 } 5348 5349 function setCssAll( str1, str2 ) { 5350 return setCss(prefixes.join(str1 + ';') + ( str2 || '' )); 5351 } 5352 5353 function is( obj, type ) { 5354 return typeof obj === type; 5355 } 5356 5357 function contains( str, substr ) {
vendor: 16,484 bytes, lines 5358-5848
5358 return !!~('' + str).indexOf(substr); 5359 } 5360 5361 function testProps( props, prefixed ) { 5362 for ( var i in props ) { 5363 var prop = props[i]; 5364 if ( !contains(prop, "-") && mStyle[prop] !== undefined ) { 5365 return prefixed == 'pfx' ? prop : true; 5366 } 5367 } 5368 return false; 5369 } 5370 5371 function testDOMProps( props, obj, elem ) { 5372 for ( var i in props ) { 5373 var item = obj[props[i]]; 5374 if ( item !== undefined) { 5375 5376 if (elem === false) return props[i]; 5377 5378 if (is(item, 'function')){ 5379 return item.bind(elem || obj); 5380 } 5381 5382 return item; 5383 } 5384 } 5385 return false; 5386 } 5387 5388 function testPropsAll( prop, prefixed, elem ) { 5389 5390 var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), 5391 props = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' '); 5392 5393 if(is(prefixed, "string") || is(prefixed, "undefined")) { 5394 return testProps(props, prefixed); 5395 5396 } else { 5397 props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' '); 5398 return testDOMProps(props, prefixed, elem); 5399 } 5400 } tests['flexbox'] = function() { 5401 return testPropsAll('flexWrap'); 5402 }; 5403 5404 5405 tests['flexboxlegacy'] = function() { 5406 return testPropsAll('boxDirection'); 5407 }; 5408 5409 5410 tests['canvas'] = function() { 5411 var elem = document.createElement('canvas'); 5412 return !!(elem.getContext && elem.getContext('2d')); 5413 }; 5414 5415 tests['canvastext'] = function() { 5416 return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function')); 5417 }; 5418 tests['touch'] = function() { 5419 var bool; 5420 5421 if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { 5422 bool = true; 5423 } else { 5424 injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) { 5425 bool = node.offsetTop === 9; 5426 }); 5427 } 5428 5429 return bool; 5430 }; 5431 5432 5433 5434 tests['geolocation'] = function() { 5435 return 'geolocation' in navigator; 5436 }; 5437 5438 5439 5440 tests['draganddrop'] = function() { 5441 var div = document.createElement('div'); 5442 return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div); 5443 }; 5444 5445 5446 5447 tests['rgba'] = function() { 5448 setCss('background-color:rgba(150,255,150,.5)'); 5449 5450 return contains(mStyle.backgroundColor, 'rgba'); 5451 }; 5452 5453 5454 tests['multiplebgs'] = function() { 5455 setCss('background:url(https://),url(https://),red url(https://)'); 5456 5457 return (/(url\s*\(.*?){3}/).test(mStyle.background); 5458 }; tests['backgroundsize'] = function() { 5459 return testPropsAll('backgroundSize'); 5460 }; tests['borderradius'] = function() { 5461 return testPropsAll('borderRadius'); 5462 }; 5463 5464 tests['boxshadow'] = function() { 5465 return testPropsAll('boxShadow'); 5466 }; 5467 5468 tests['textshadow'] = function() { 5469 return document.createElement('div').style.textShadow === ''; 5470 }; 5471 5472 5473 tests['opacity'] = function() { 5474 setCssAll('opacity:.55'); 5475 5476 return (/^0.55$/).test(mStyle.opacity); 5477 }; 5478 5479 5480 tests['cssanimations'] = function() { 5481 return testPropsAll('animationName'); 5482 }; 5483 5484 5485 tests['csscolumns'] = function() { 5486 return testPropsAll('columnCount'); 5487 }; 5488 5489 5490 tests['cssgradients'] = function() { 5491 var str1 = 'background-image:', 5492 str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));', 5493 str3 = 'linear-gradient(left top,#9f9, white);'; 5494 5495 setCss( 5496 (str1 + '-webkit- '.split(' ').join(str2 + str1) + 5497 prefixes.join(str3 + str1)).slice(0, -str1.length) 5498 ); 5499 5500 return contains(mStyle.backgroundImage, 'gradient'); 5501 }; tests['csstransforms'] = function() { 5502 return !!testPropsAll('transform'); 5503 }; 5504 5505 5506 tests['csstransforms3d'] = function() { 5507 5508 var ret = !!testPropsAll('perspective'); 5509 5510 if ( ret && 'webkitPerspective' in docElement.style ) { 5511 5512 injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) { 5513 ret = node.offsetLeft === 9 && node.offsetHeight === 3; 5514 }); 5515 } 5516 return ret; 5517 }; 5518 5519 5520 tests['csstransitions'] = function() { 5521 return testPropsAll('transition'); 5522 }; 5523 5524 5525 5526 tests['fontface'] = function() { 5527 var bool; 5528 5529 injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) { 5530 var style = document.getElementById('smodernizr'), 5531 sheet = style.sheet || style.styleSheet, 5532 cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : ''; 5533 5534 bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0; 5535 }); 5536 5537 return bool; 5538 }; 5539 5540 tests['generatedcontent'] = function() { 5541 var bool; 5542 5543 injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) { 5544 bool = node.offsetHeight >= 3; 5545 }); 5546 5547 return bool; 5548 }; 5549 tests['video'] = function() { 5550 var elem = document.createElement('video'), 5551 bool = false; 5552 5553 try { 5554 if ( bool = !!elem.canPlayType ) { 5555 bool = new Boolean(bool); 5556 bool.ogg = elem.canPlayType('video/ogg; codecs="theora"') .replace(/^no$/,''); 5557 5558 bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,''); 5559 5560 bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,''); 5561 } 5562 5563 } catch(e) { } 5564 5565 return bool; 5566 }; 5567 5568 tests['audio'] = function() { 5569 var elem = document.createElement('audio'), 5570 bool = false; 5571 5572 try { 5573 if ( bool = !!elem.canPlayType ) { 5574 bool = new Boolean(bool); 5575 bool.ogg = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,''); 5576 bool.mp3 = elem.canPlayType('audio/mpeg;') .replace(/^no$/,''); 5577 5578 bool.wav = elem.canPlayType('audio/wav; codecs="1"') .replace(/^no$/,''); 5579 bool.m4a = ( elem.canPlayType('audio/x-m4a;') || 5580 elem.canPlayType('audio/aac;')) .replace(/^no$/,''); 5581 } 5582 } catch(e) { } 5583 5584 return bool; 5585 }; 5586 5587 5588 tests['localstorage'] = function() { 5589 try { 5590 localStorage.setItem(mod, mod); 5591 localStorage.removeItem(mod); 5592 return true; 5593 } catch(e) { 5594 return false; 5595 } 5596 }; 5597 5598 tests['sessionstorage'] = function() { 5599 try { 5600 sessionStorage.setItem(mod, mod); 5601 sessionStorage.removeItem(mod); 5602 return true; 5603 } catch(e) { 5604 return false; 5605 } 5606 }; 5607 5608 tests['svg'] = function() { 5609 return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect; 5610 }; 5611 5612 tests['inlinesvg'] = function() { 5613 var div = document.createElement('div'); 5614 div.innerHTML = '<svg/>'; 5615 return (div.firstChild && div.firstChild.namespaceURI) == ns.svg; 5616 }; function webforms() { 5617 Modernizr['input'] = (function( props ) { 5618 for ( var i = 0, len = props.length; i < len; i++ ) { 5619 attrs[ props[i] ] = !!(props[i] in inputElem); 5620 } 5621 if (attrs.list){ 5622 attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement); 5623 } 5624 return attrs; 5625 })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' ')); 5626 Modernizr['inputtypes'] = (function(props) { 5627 5628 for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) { 5629 5630 inputElem.setAttribute('type', inputElemType = props[i]); 5631 bool = inputElem.type !== 'text'; 5632 5633 if ( bool ) { 5634 5635 inputElem.value = smile; 5636 inputElem.style.cssText = 'position:absolute;visibility:hidden;'; 5637 5638 if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) { 5639 5640 docElement.appendChild(inputElem); 5641 defaultView = document.defaultView; 5642 5643 bool = defaultView.getComputedStyle && 5644 defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' && 5645 (inputElem.offsetHeight !== 0); 5646 5647 docElement.removeChild(inputElem); 5648 5649 } else if ( /^(search|tel)$/.test(inputElemType) ){ 5650 } else if ( /^(url|email)$/.test(inputElemType) ) { 5651 bool = inputElem.checkValidity && inputElem.checkValidity() === false; 5652 5653 } else { 5654 bool = inputElem.value != smile; 5655 } 5656 } 5657 5658 inputs[ props[i] ] = !!bool; 5659 } 5660 return inputs; 5661 })('search tel url email datetime date month week time datetime-local number range color'.split(' ')); 5662 } 5663 for ( var feature in tests ) { 5664 if ( hasOwnProp(tests, feature) ) { 5665 featureName = feature.toLowerCase(); 5666 Modernizr[featureName] = tests[feature](); 5667 5668 classes.push((Modernizr[featureName] ? '' : 'no-') + featureName); 5669 } 5670 } 5671 5672 Modernizr.input || webforms(); 5673 5674 5675 Modernizr.addTest = function ( feature, test ) { 5676 if ( typeof feature == 'object' ) { 5677 for ( var key in feature ) { 5678 if ( hasOwnProp( feature, key ) ) { 5679 Modernizr.addTest( key, feature[ key ] ); 5680 } 5681 } 5682 } else { 5683 5684 feature = feature.toLowerCase(); 5685 5686 if ( Modernizr[feature] !== undefined ) { 5687 return Modernizr; 5688 } 5689 5690 test = typeof test == 'function' ? test() : test; 5691 5692 if (typeof enableClasses !== "undefined" && enableClasses) { 5693 docElement.className += ' ' + (test ? '' : 'no-') + feature; 5694 } 5695 Modernizr[feature] = test; 5696 5697 } 5698 5699 return Modernizr; 5700 }; 5701 5702 5703 setCss(''); 5704 modElem = inputElem = null; 5705 5706 ;(function(window, document) { 5707 var version = '3.7.0'; 5708 5709 var options = window.html5 || {}; 5710 5711 var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; 5712 5713 var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; 5714 5715 var supportsHtml5Styles; 5716 5717 var expando = '_html5shiv'; 5718 5719 var expanID = 0; 5720 5721 var expandoData = {}; 5722 5723 var supportsUnknownElements; 5724 5725 (function() { 5726 try { 5727 var a = document.createElement('a'); 5728 a.innerHTML = '<xyz></xyz>'; 5729 supportsHtml5Styles = ('hidden' in a); 5730 5731 supportsUnknownElements = a.childNodes.length == 1 || (function() { 5732 (document.createElement)('a'); 5733 var frag = document.createDocumentFragment(); 5734 return ( 5735 typeof frag.cloneNode == 'undefined' || 5736 typeof frag.createDocumentFragment == 'undefined' || 5737 typeof frag.createElement == 'undefined' 5738 ); 5739 }()); 5740 } catch(e) { 5741 supportsHtml5Styles = true; 5742 supportsUnknownElements = true; 5743 } 5744 5745 }()); 5746 5747 function addStyleSheet(ownerDocument, cssText) { 5748 var p = ownerDocument.createElement('p'), 5749 parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; 5750 5751 p.innerHTML = 'x<style>' + cssText + '</style>'; 5752 return parent.insertBefore(p.lastChild, parent.firstChild); 5753 } 5754 5755 function getElements() { 5756 var elements = html5.elements; 5757 return typeof elements == 'string' ? elements.split(' ') : elements; 5758 } 5759 5760 function getExpandoData(ownerDocument) { 5761 var data = expandoData[ownerDocument[expando]]; 5762 if (!data) { 5763 data = {}; 5764 expanID++; 5765 ownerDocument[expando] = expanID; 5766 expandoData[expanID] = data; 5767 } 5768 return data; 5769 } 5770 5771 function createElement(nodeName, ownerDocument, data){ 5772 if (!ownerDocument) { 5773 ownerDocument = document; 5774 } 5775 if(supportsUnknownElements){ 5776 return ownerDocument.createElement(nodeName); 5777 } 5778 if (!data) { 5779 data = getExpandoData(ownerDocument); 5780 } 5781 var node; 5782 5783 if (data.cache[nodeName]) { 5784 node = data.cache[nodeName].cloneNode(); 5785 } else if (saveClones.test(nodeName)) { 5786 node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); 5787 } else { 5788 node = data.createElem(nodeName); 5789 } 5790 5791 return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node; 5792 } 5793 5794 function createDocumentFragment(ownerDocument, data){ 5795 if (!ownerDocument) { 5796 ownerDocument = document; 5797 } 5798 if(supportsUnknownElements){ 5799 return ownerDocument.createDocumentFragment(); 5800 } 5801 data = data || getExpandoData(ownerDocument); 5802 var clone = data.frag.cloneNode(), 5803 i = 0, 5804 elems = getElements(), 5805 l = elems.length; 5806 for(;i<l;i++){ 5807 clone.createElement(elems[i]); 5808 } 5809 return clone; 5810 } 5811 5812 function shivMethods(ownerDocument, data) { 5813 if (!data.cache) { 5814 data.cache = {}; 5815 data.createElem = ownerDocument.createElement; 5816 data.createFrag = ownerDocument.createDocumentFragment; 5817 data.frag = data.createFrag(); 5818 } 5819 5820 5821 ownerDocument.createElement = function(nodeName) { 5822 if (!html5.shivMethods) { 5823 return data.createElem(nodeName); 5824 } 5825 return createElement(nodeName, ownerDocument, data); 5826 }; 5827 5828 ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' + 5829 'var n=f.cloneNode(),c=n.createElement;' + 5830 'h.shivMethods&&(' + 5831 getElements().join().replace(/[\w\-]+/g, function(nodeName) { 5832 data.createElem(nodeName); 5833 data.frag.createElement(nodeName); 5834 return 'c("' + nodeName + '")'; 5835 }) + 5836 ');return n}' 5837 )(html5, data.frag); 5838 } 5839 5840 function shivDocument(ownerDocument) { 5841 if (!ownerDocument) { 5842 ownerDocument = document; 5843 } 5844 var data = getExpandoData(ownerDocument); 5845 5846 if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) { 5847 data.hasCSS = !!addStyleSheet(ownerDocument, 5848 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{dis
5848play:block}' + 5849 'mark{background:#FF0;color:#000}' + 5850 'template{display:none}' 5851 ); 5852 } 5853 if (!supportsUnknownElements) { 5854 shivMethods(ownerDocument, data); 5855 } 5856 return ownerDocument; 5857 } 5858 5859 var html5 = { 5860 5861 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video', 5862 5863 'version': version, 5864 5865 'shivCSS': (options.shivCSS !== false), 5866 5867 'supportsUnknownElements': supportsUnknownElements, 5868 5869 'shivMethods': (options.shivMethods !== false), 5870 5871 'type': 'default', 5872 5873 'shivDocument': shivDocument, 5874 5875 createElement: createElement, 5876 5877 createDocumentFragment: createDocumentFragment 5878 }; 5879 5880 window.html5 = html5; 5881 5882 shivDocument(document); 5883 5884 }(this, document)); 5885 5886 Modernizr._version = version; 5887 5888 Modernizr._prefixes = prefixes; 5889 Modernizr._domPrefixes = domPrefixes; 5890 Modernizr._cssomPrefixes = cssomPrefixes; 5891 5892 5893 Modernizr.hasEvent = isEventSupported; 5894 5895 Modernizr.testProp = function(prop){ 5896 return testProps([prop]); 5897 }; 5898 5899 Modernizr.testAllProps = testPropsAll; 5900 5901 5902 Modernizr.testStyles = injectElementWithStyles; docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') + 5903 5904 (enableClasses ? ' js ' + classes.join(' ') : ''); 5905 5906 return Modernizr; 5907 5908})(this, this.document); 5909; 5910; 5911;(function() { 5912 5913 var BrowserDetect = function() { 5914 this.browser = this.getBrowserAgent(); 5915 this.version = this.getBrowserVersion(); 5916 }; 5917 5918 BrowserDetect.prototype = { 5919 getBrowserAgent: function() { 5920 return this.searchString(this.dataBrowser); 5921 }, 5922 getBrowserVersion: function() { 5923 return this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion); 5924 }, 5925 searchString: function (data) { 5926 for (var i = 0; i < data.length; i++) { 5927 var dataString = data[i].string; 5928 this.versionSearchString = data[i].subString; 5929 if (dataString.indexOf(data[i].subString) != -1) { 5930 return data[i].identity; 5931 } 5932 } 5933 }, 5934 searchVersion: function (dataString) { 5935 var index = dataString.indexOf(this.versionSearchString); 5936 if (index == -1) return; 5937 return parseFloat(dataString.substring(index + this.versionSearchString.length + 1)); 5938 }, 5939 dataBrowser: [ 5940 { string: navigator.userAgent, subString: "Chrome", identity: "chrome" }, 5941 { string: navigator.userAgent, subString: "MSIE", identity: "ie" }, 5942 { string: navigator.userAgent, subString: "Firefox", identity: "firefox" }, 5943 { string: navigator.userAgent, subString: "Safari", identity: "safari" }, 5944 { string: navigator.userAgent, subString: "Opera", identity: "opera" } 5945 ], 5946 addClasses: function() { 5947 var b = browserDetect.browser, 5948 v = browserDetect.version; 5949 // add the browser name 5950 $(document.documentElement).addClass(b); 5951 // add the browser version too if it's available 5952 if (v) $(document.documentElement).addClass(b + '-' + v); 5953 } 5954 }; 5955 5956 // Create an instance of the BrowserDetect and add the browser and version 5957 // to the HTML doc element. 5958 var browserDetect = new BrowserDetect(); 5959 if (browserDetect.browser) { 5960 browserDetect.addClasses(); 5961 } 5962 5963})(); 5964; 5965Drupal.behaviors.ddSearchBox = function(context) { 5966 $('#dd-search').each(function() { 5967 new Drupal.ddSearchBox($(this)); 5968 }); 5969}; 5970 5971Drupal.ddSearchBox = function($search) { 5972 var self = this; 5973 this.$search = $search; 5974 this.placeholderText = $('#edit-box-text').val(); 5975 5976 // Don't do anything if we have no placeholder text. 5977 if (!this.placeholderText) { 5978 return; 5979 } 5980 5981 this.$input = this.$search.find('.dd-search-keywords input'); 5982 5983 // Initialize. 5984 this.update(false); 5985 5986 // Update when the input field receives focus. 5987 this.$input.focus(function() { 5988 self.update(true); 5989 }); 5990 5991 // Update when the input field looses focus. 5992 this.$input.blur(function() { 5993 self.update(false); 5994 }); 5995 5996 // Update when the form gets submitted. 5997 $search.find('form').submit(function() { 5998 self.update(true); 5999 }); 6000}; 6001 6002Drupal.ddSearchBox.prototype.update = function(active) { 6003 if (active) { 6004 // When getting focus, clear the placeholder text, if necessary. 6005 if (this.$input.val() == this.placeholderText) { 6006 this.clearPlaceholder(); 6007 } 6008 } 6009 else { 6010 // When leaving focus, restore the placeholder text, if appropriate. 6011 if (this.$input.val() == '') { 6012 this.setPlaceholder(); 6013 } 6014 } 6015}; 6016 6017Drupal.ddSearchBox.prototype.setPlaceholder = function() { 6018 this.$input.val(this.placeholderText); 6019 this.$search.removeClass('dd-search-active'); 6020}; 6021 6022Drupal.ddSearchBox.prototype.clearPlaceholder = function() { 6023 this.$input.val(''); 6024 this.$search.addClass('dd-search-active'); 6025}; 6026; 6027/* 6028 * jQuery UI 1.6 6029 * 6030 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) 6031 * Dual licensed under the MIT (MIT-LICENSE.txt) 6032 * and GPL (GPL-LICENSE.txt) licenses. 6033 * 6034 * http://docs.jquery.com/UI 6035 */�(function(C){var I=C.fn.remove,D=C.browser.mozilla&&(parseFloat(C.browser.version)<1.9);C.ui={version:"1.6",plugin:{add:function(K,L,N){var M=C.ui[K].prototype;for(var J in N){M.plugins[J]=M.plugins[J]||[];M.plugins[J].push([L,N[J]])}},call:function(J,L,K){var N=J.plugins[L];if(!N){return }for(var M=0;M<N.length;M++){if(J.options[N[M][0]]){N[M][1].apply(J.element,K)}}}},contains:function(L,K){var J=C.browser.safari&&C.browser.version<522;if(L.contains&&!J){return L.contains(K)}if(L.compareDocumentPosition){return !!(L.compareDocumentPosition(K)&16)}while(K=K.parentNode){if(K==L){return true}}return false},cssCache:{}
6035,css:function(J){if(C.ui.cssCache[J]){return C.ui.cssCache[J]}var K=C('<div class="ui-gen">').addClass(J).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");C.ui.cssCache[J]=!!((!(/auto|default/).test(K.css("cursor"))||(/^[1-9]/).test(K.css("height"))||(/^[1-9]/).test(K.css("width"))||!(/none/).test(K.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(K.css("backgroundColor"))));try{C("body").get(0).removeChild(K.get(0))}catch(L){}return C.ui.cssCache[J]},hasScroll:function(M,K){if(C(M).css("overflow")=="hidden"){return false}var J=(K&&K=="left")?"scrollLeft":"scrollTop",L=false;if(M[J]>0){return true}M[J]=1;L=(M[J]>0);M[J]=0;return L},isOverAxis:function(K,J,L){return(K>J)&&(K<(J+L))},isOver:function(O,K,N,M,J,L){return C.ui.isOverAxis(O,N,J)&&C.ui.isOverAxis(K,M,L)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(D){var F=C.attr,E=C.fn.removeAttr,H="http://www.w3.org/2005/07/aaa",A=/^aria-/,B=/^wairole:/;C.attr=function(K,J,L){var M=L!==undefined;return(J=="role"?(M?F.call(this,K,J,"wairole:"+L):(F.apply(this,arguments)||"").replace(B,"")):(A.test(J)?(M?K.setAttributeNS(H,J.replace(A,"aaa:"),L):F.call(this,K,J.replace(A,"aaa:"))):F.apply(this,arguments)))};C.fn.removeAttr=function(J){return(A.test(J)?this.each(function(){this.removeAttributeNS(H,J.replace(A,""))}):E.call(this,J))}}C.fn.extend({remove:function(){C("*",this).add(this).each(function(){C(this).triggerHandler("remove")});return I.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var J;if((C.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){J=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(C.curCSS(this,"position",1))&&(/(auto|scroll)/).test(C.curCSS(this,"overflow",1)+C.curCSS(this,"overflow-y",1)+C.curCSS(this,"overflow-x",1))}).eq(0)}else{J=this.parents().filter(function(){return(/(auto|scroll)/).test(C.curCSS(this,"overflow",1)+C.curCSS(this,"overflow-y",1)+C.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!J.length?C(document):J}});C.extend(C.expr[":"],{data:function(K,L,J){return C.data(K,J[3])},tabbable:function(L,M,K){var N=L.nodeName.toLowerCase();function J(O){return !(C(O).is(":hidden")||C(O).parents(":hidden").length)}return(L.tabIndex>=0&&(("a"==N&&L.href)||(/input|select|textarea|button/.test(N)&&"hidden"!=L.type&&!L.disabled))&&J(L))}});function G(M,N,O,L){function K(Q){var P=C[M][N][Q]||[];return(typeof P=="string"?P.split(/,?\s+/):P)}var J=K("getter");if(L.length==1&&typeof L[0]=="string"){J=J.concat(K("getterSetter"))}return(C.inArray(O,J)!=-1)}C.widget=function(K,J){var L=K.split(".")[0];K=K.split(".")[1];C.fn[K]=function(P){var N=(typeof P=="string"),O=Array.prototype.slice.call(arguments,1);if(N&&P.substring(0,1)=="_"){return this}if(N&&G(L,K,P,O)){var M=C.data(this[0],K);return(M?M[P].apply(M,O):undefined)}return this.each(function(){var Q=C.data(this,K);(!Q&&!N&&C.data(this,K,new C[L][K](this,P)));(Q&&N&&C.isFunction(Q[P])&&Q[P].apply(Q,O))})};C[L]=C[L]||{};C[L][K]=function(O,N){var M=this;this.widgetName=K;this.widgetEventPrefix=C[L][K].eventPrefix||K;this.widgetBaseClass=L+"-"+K;this.options=C.extend({},C.widget.defaults,C[L][K].defaults,C.metadata&&C.metadata.get(O)[K],N);this.element=C(O).bind("setData."+K,function(Q,P,R){return M._setData(P,R)}).bind("getData."+K,function(Q,P){return M._getData(P)}).bind("remove",function(){return M.destroy()});this._init()};C[L][K].prototype=C.extend({},C.widget.prototype,J);C[L][K].getterSetter="option"};C.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName)},option:function(L,M){var K=L,J=this;if(typeof L=="string"){if(M===undefined){return this._getData(L)}K={};K[L]=M}C.each(K,function(N,O){J._setData(N,O)})},_getData:function(J){return this.options[J]},_setData:function(J,K){this.options[J]=K;if(J=="disabled"){this.element[K?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")}}
6035,enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(K,L,M){var J=(K==this.widgetEventPrefix?K:this.widgetEventPrefix+K);L=L||C.event.fix({type:J,target:this.element[0]});return this.element.triggerHandler(J,[L,M],this.options[K])}};C.widget.defaults={disabled:false};C.ui.mouse={_mouseInit:function(){var J=this;this.element.bind("mousedown."+this.widgetName,function(K){return J._mouseDown(K)}).bind("click."+this.widgetName,function(K){if(J._preventClickEvent){J._preventClickEvent=false;return false}});if(C.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(C.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(L){(this._mouseStarted&&this._mouseUp(L));this._mouseDownEvent=L;var K=this,M=(L.which==1),J=(typeof this.options.cancel=="string"?C(L.target).parents().add(L.target).filter(this.options.cancel).length:false);if(!M||J||!this._mouseCapture(L)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){K.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(L)&&this._mouseDelayMet(L)){this._mouseStarted=(this._mouseStart(L)!==false);if(!this._mouseStarted){L.preventDefault();return true}}this._mouseMoveDelegate=function(N){return K._mouseMove(N)};this._mouseUpDelegate=function(N){return K._mouseUp(N)};C(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);if(!C.browser.safari){L.preventDefault()}return true},_mouseMove:function(J){if(C.browser.msie&&!J.button){return this._mouseUp(J)}if(this._mouseStarted){this._mouseDrag(J);return J.preventDefault()}if(this._mouseDistanceMet(J)&&this._mouseDelayMet(J)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,J)!==false);(this._mouseStarted?this._mouseDrag(J):this._mouseUp(J))}return !this._mouseStarted},_mouseUp:function(J){C(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=true;this._mouseStop(J)}return false},_mouseDistanceMet:function(J){return(Math.max(Math.abs(this._mouseDownEvent.pageX-J.pageX),Math.abs(this._mouseDownEvent.pageY-J.pageY))>=this.options.distance)},_mouseDelayMet:function(J){return this.mouseDelayMet},_mouseStart:function(J){},_mouseDrag:function(J){},_mouseStop:function(J){},_mouseCapture:function(J){return true}};C.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery); 6036/* 6037 * jQuery UI Dialog 1.6 6038 * 6039 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about) 6040 * Dual licensed under the MIT (MIT-LICENSE.txt) 6041 * and GPL (GPL-LICENSE.txt) licenses. 6042 * 6043 * http://docs.jquery.com/UI/Dialog 6044 * 6045 * Depends: 6046 * ui.core.js 6047 * ui.draggable.js 6048 * ui.resizable.js 6049 */�(function(B){var A={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"};B.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");this.options.title=this.options.title||this.originalTitle;var M=this,N=this.options,F=this.element.removeAttr("title").addClass("ui-dialog-content").wrap("<div></div>").wrap("<div></div>"),I=(this.uiDialogContainer=F.parent()).addClass("ui-dialog-container").css({position:"relative",width:"100%",height:"100%"}),E=(this.uiDialogTitlebar=B("<div></div>")).addClass("ui-dialog-titlebar").mousedown(function(){M.moveToTop()}).prependTo(I),J=B('<a href="#"/>').addClass("ui-dialog-titlebar-close").attr("role","button").appendTo(E),G=(this.uiDialogTitlebarCloseText=B("<span/>")).text(N.closeText).appendTo(J),L=N.title||" ",D=B.ui.dialog.getTitleId(this.element),C=B("<span/>").addClass("ui-dialog-title").attr("id",D).html(L).prependTo(E),K=(this.uiDialog=I.parent()).appendTo(document.body).hide().addClass("ui-dialog").addClass(N.dialogClass).css({position:"absolute",width:N.width,height:N.height,overflow:"hidden",zIndex:N.zIndex}
6049).attr("tabIndex",-1).css("outline",0).keydown(function(O){(N.closeOnEscape&&O.keyCode&&O.keyCode==B.ui.keyCode.ESCAPE&&M.close())}).attr({role:"dialog","aria-labelledby":D}).mouseup(function(){M.moveToTop()}),H=(this.uiDialogButtonPane=B("<div></div>")).addClass("ui-dialog-buttonpane").css({position:"absolute",bottom:0}).appendTo(K),J=B(".ui-dialog-titlebar-close",E).hover(function(){B(this).addClass("ui-dialog-titlebar-close-hover")},function(){B(this).removeClass("ui-dialog-titlebar-close-hover")}).mousedown(function(O){O.stopPropagation()}).click(function(){M.close();return false});E.find("*").add(E).disableSelection();(N.draggable&&B.fn.draggable&&this._makeDraggable());(N.resizable&&B.fn.resizable&&this._makeResizable());this._createButtons(N.buttons);this._isOpen=false;(N.bgiframe&&B.fn.bgiframe&&K.bgiframe());(N.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(){if(false===this._trigger("beforeclose",null,{options:this.options})){return }(this.overlay&&this.overlay.destroy());this.uiDialog.hide(this.options.hide).unbind("keypress.ui-dialog");this._trigger("close",null,{options:this.options});B.ui.dialog.overlay.resize();this._isOpen=false},isOpen:function(){return this._isOpen},moveToTop:function(F){if((this.options.modal&&!F)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",null,{options:this.options})}var E=this.options.zIndex,D=this.options;B(".ui-dialog:visible").each(function(){E=Math.max(E,parseInt(B(this).css("z-index"),10)||D.zIndex)});(this.overlay&&this.overlay.$el.css("z-index",++E));var C={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++E);this.element.attr(C);this._trigger("focus",null,{options:this.options})},open:function(){if(this._isOpen){return }this.overlay=this.options.modal?new B.ui.dialog.overlay(this):null;(this.uiDialog.next().length&&this.uiDialog.appendTo("body"));this._position(this.options.position);this.uiDialog.show(this.options.show);(this.options.autoResize&&this._size());this.moveToTop(true);(this.options.modal&&this.uiDialog.bind("keypress.ui-dialog",function(E){if(E.keyCode!=B.ui.keyCode.TAB){return }var D=B(":tabbable",this),F=D.filter(":first")[0],C=D.filter(":last")[0];if(E.target==C&&!E.shiftKey){setTimeout(function(){F.focus()},1)}else{if(E.target==F&&E.shiftKey){setTimeout(function(){C.focus()},1)}}}));this.uiDialog.find(":tabbable:first").focus();this._trigger("open",null,{options:this.options});this._isOpen=true},_createButtons:function(F){var E=this,C=false,D=this.uiDialogButtonPane;D.empty().hide();B.each(F,function(){return !(C=true)});if(C){D.show();B.each(F,function(G,H){B('<button type="button"></button>').text(G).click(function(){H.apply(E.element[0],arguments)}).appendTo(D)})}},_makeDraggable:function(){var C=this,D=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content",helper:D.dragHelper,handle:".ui-dialog-titlebar",start:function(){C.moveToTop();(D.dragStart&&D.dragStart.apply(C.element[0],arguments))},drag:function(){(D.drag&&D.drag.apply(C.element[0],arguments))},stop:function(){(D.dragStop&&D.dragStop.apply(C.element[0],arguments));B.ui.dialog.overlay.resize()}})},_makeResizable:function(F){F=(F===undefined?this.options.resizable:F);var C=this,E=this.options,D=typeof F=="string"?F:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",helper:E.resizeHelper,maxWidth:E.maxWidth,maxHeight:E.maxHeight,minWidth:E.minWidth,minHeight:E.minHeight,start:function(){(E.resizeStart&&E.resizeStart.apply(C.element[0],arguments))},resize:function(){(E.autoResize&&C._size.apply(C));(E.resize&&E.resize.apply(C.element[0],arguments))},handles:D,stop:function(){(E.autoResize&&C._size.apply(C));(E.resizeStop&&E.resizeStop.apply(C.element[0],arguments));B.ui.dialog.overlay.resize()}})},_position:function(H){var D=B(window),E=B(document),F=E.scrollTop(),C=E.scrollLeft(),G=F;if(B.inArray(H,["center","top","right","bottom","left"])>=0){H=[H=="right"||H=="left"?H:"center",H=="top"||H=="bottom"?H:"middle"]}if(H.constructor!=Array){H=["center","middle"]}if(H[0].constructor==Number){C+=H[0]}
6049else{switch(H[0]){case"left":C+=0;break;case"right":C+=D.width()-this.uiDialog.outerWidth();break;default:case"center":C+=(D.width()-this.uiDialog.outerWidth())/2}}if(H[1].constructor==Number){F+=H[1]}else{switch(H[1]){case"top":F+=0;break;case"bottom":F+=(B.browser.opera?window.innerHeight:D.height())-this.uiDialog.outerHeight();break;default:case"middle":F+=((B.browser.opera?window.innerHeight:D.height())-this.uiDialog.outerHeight())/2}}F=Math.max(F,G);this.uiDialog.css({top:F,left:C})},_setData:function(D,E){(A[D]&&this.uiDialog.data(A[D],E));switch(D){case"buttons":this._createButtons(E);break;case"closeText":this.uiDialogTitlebarCloseText.text(E);break;case"draggable":(E?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(E);break;case"position":this._position(E);break;case"resizable":var C=this.uiDialog,F=this.uiDialog.is(":data(resizable)");(F&&!E&&C.resizable("destroy"));(F&&typeof E=="string"&&C.resizable("option","handles",E));(F||this._makeResizable(E));break;case"title":B(".ui-dialog-title",this.uiDialogTitlebar).html(E||" ");break;case"width":this.uiDialog.width(E);break}B.widget.prototype._setData.apply(this,arguments)},_size:function(){var D=this.uiDialogContainer,G=this.uiDialogTitlebar,E=this.element,F=(parseInt(E.css("margin-top"),10)||0)+(parseInt(E.css("margin-bottom"),10)||0),C=(parseInt(E.css("margin-left"),10)||0)+(parseInt(E.css("margin-right"),10)||0);E.height(D.height()-G.outerHeight()-F);E.width(D.width()-C)}});B.extend(B.ui.dialog,{version:"1.6",defaults:{autoOpen:true,autoResize:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",draggable:true,height:200,minHeight:100,minWidth:150,modal:false,overlay:{},position:"center",resizable:true,stack:true,width:300,zIndex:1000},getter:"isOpen",uuid:0,getTitleId:function(C){return"ui-dialog-title-"+(C.attr("id")||++this.uuid)},overlay:function(C){this.$el=B.ui.dialog.overlay.create(C)}});B.extend(B.ui.dialog.overlay,{instances:[],events:B.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(C){return C+".dialog-overlay"}).join(" "),create:function(D){if(this.instances.length===0){setTimeout(function(){B("a, :input").bind(B.ui.dialog.overlay.events,function(){var F=false;var H=B(this).parents(".ui-dialog");if(H.length){var E=B(".ui-dialog-overlay");if(E.length){var G=parseInt(E.css("z-index"),10);E.each(function(){G=Math.max(G,parseInt(B(this).css("z-index"),10))});F=parseInt(H.css("z-index"),10)>G}else{F=true}}return F})},1);B(document).bind("keydown.dialog-overlay",function(E){(D.options.closeOnEscape&&E.keyCode&&E.keyCode==B.ui.keyCode.ESCAPE&&D.close())});B(window).bind("resize.dialog-overlay",B.ui.dialog.overlay.resize)}var C=B("<div></div>").appendTo(document.body).addClass("ui-dialog-overlay").css(B.extend({borderWidth:0,margin:0,padding:0,position:"absolute",top:0,left:0,width:this.width(),height:this.height()},D.options.overlay));(D.options.bgiframe&&B.fn.bgiframe&&C.bgiframe());this.instances.push(C);return C},destroy:function(C){this.instances.splice(B.inArray(this.instances,C),1);if(this.instances.length===0){B("a, :input").add([document,window]).unbind(".dialog-overlay")}C.remove()},height:function(){if(B.browser.msie&&B.browser.version<7){var D=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var C=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(D<C){return B(window).height()+"px"}else{return D+"px"}}else{if(B.browser.opera){return Math.max(window.innerHeight,B(document).height())+"px"}else{return B(document).height()+"px"}}},width:function(){if(B.browser.msie&&B.browser.version<7){var C=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var D=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(C<D){return B(window).width()+"px"}else{return C+"px"}}else{if(B.browser.opera){return Math.max(window.innerWidth,B(document).width())+"px"}else{return B(document).width()+"px"}}},resize:function(){var C=B([]);B.each(B.ui.dialog.overlay.instances,function(){C=C.add(this)});C.css({width:0,height:0}).css({width:B.ui.dialog.overlay.width(),height:B.ui.dialog.overlay.height()})}});B.extend(B.ui.dialog.overlay.prototype,{destroy:function(){B.ui.dialog.overlay.destroy(this.$el)}})})(jQuery); 6050if ($.ui.version == '1.6') { 6051 // Backported from more recent version of jQuery UI for IE 9 and 10 6052 // compatbility, to make resizables and draggables work in those browsers. 6053 // https://github.com/jquery/jquery-ui/blob/83b3d67175f16057844e5719bcda56eeb74560f3/ui/mouse.js
6054 $.ui.mouse._mouseMove = function(event) { 6055 // IE mouseup check - mouseup happened when mouse was out of window 6056 if ($.browser.msie && (!document.documentMode || document.documentMode < 9) && !event.button) { 6057 return this._mouseUp(event); 6058 } 6059 6060 if (this._mouseStarted) { 6061 this._mouseDrag(event); 6062 return event.preventDefault(); 6063 } 6064 6065 if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { 6066 this._mouseStarted = 6067 (this._mouseStart(this._mouseDownEvent, event) !== false); 6068 (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); 6069 } 6070 6071 return !this._mouseStarted; 6072 }; 6073} 6074; 6075Drupal.behaviors.dmodel = function(context) { 6076 new Drupal.dmodelPositionFixed(); 6077}; 6078 6079Drupal.dmodelPositionFixed = function() { 6080 // Bind 'this' so we can reference it in functions 6081 var self = this; 6082 6083 // Find the elements we need to reposition and determine the current offsets 6084 this.bottomElements = $('#block-digitaldcore-command_menu, #channel-controls'); 6085 6086 if (this.bottomElements.length != 0) { 6087 this.lastScrollTop = $(window).scrollTop(); 6088 this.lastTopOffset = this.bottomElements.offset().top; 6089 6090 // Create a named function so that we can unbind it from the scroll event later 6091 this.scrollHandler = function() { 6092 self.update(); 6093 }; 6094 6095 $(window).bind('scroll', this.scrollHandler); 6096 6097 $(window).bind('orientationchange', function() { 6098 self.update(true); 6099 }); 6100 } 6101}; 6102 6103Drupal.dmodelPositionFixed.prototype.update = function(force) { 6104 if (force === undefined) { 6105 force = false; 6106 } 6107 6108 var scrollTop = $(window).scrollTop(); 6109 6110 // Only do something if we did scroll (sanity check) 6111 if (force || scrollTop != this.lastScrollTop) { 6112 var topOffset = this.bottomElements.offset().top; 6113 6114 // If the elements were repositioned by the browser, we don't need to do anything 6115 if (!force && topOffset != this.lastTopOffset) { 6116 $(window).unbind('scroll', this.scrollHandler); 6117 } 6118 // Apparently, we're in a browser that doesn't reposition position:fixed elements (such as Mobile Safari) 6119 else { 6120 this.bottomElements.css('bottom', -scrollTop + 'px'); 6121 this.lastScrollTop = $(window).scrollTop(); 6122 this.lastTopOffset = this.bottomElements.offset().top; 6123 } 6124 } 6125}; 6126 6127Drupal.behaviors.dmodelMessageClosing = function(context) { 6128 var messages = $('.messages', context); 6129 6130 // Filter out messages containing Krumo stuff output by dsm() 6131 messages = messages.filter(function() { 6132 return $('.krumo-root', this).length == 0; 6133 }); 6134 6135 // Fade out messages when clicking on them 6136 messages.click(function(event) { 6137 $(this).animate({opacity: 'hide', height: 'hide'}, 250); 6138 }); 6139}; 6140 6141/** 6142 * Add additional behaviors to the date popups, especially to fix a problem with 6143 * tab order: https://support.digitaldeployment.com/helpdesk/tickets/459 6144 * 6145 * @param context 6146 */ 6147Drupal.behaviors.dmodelDatePopup = function(context) { 6148 for (var id in Drupal.settings.datePopup) { 6149 if (Drupal.settings.datePopup[id].func == 'datepicker') { 6150 // Add an "onClose" handler to each date popup 6151 // Check if date_year_range setting exists 6152 var datePopupConfig = { 6153 onClose: function(dateString, config) { 6154 // When the popup is closing set the focus to the time entry field 6155 $('#' + config.id.replace('-datepicker-popup-0', '-timeEntry-popup-1')).focus().click(); 6156 } 6157 }; 6158 if ('date_year_range' in Drupal.settings.dd) { 6159 datePopupConfig.yearRange = Drupal.settings.dd['date_year_range']; 6160 } 6161 $('#' + id).datepicker(datePopupConfig); 6162 } 6163 } 6164}; 6165 6166/** 6167 * Adds an active classname to all node's who's destination url matches the 6168 * current url path. 6169 */ 6170Drupal.behaviors.dmodelLabelActiveNodes = function(context) { 6171 var pathname = document.location.pathname, 6172 $activeLinks = $('.link-read-more a', context).filter('[href=' + pathname + ']'); 6173 $activeLinks.parents('.node-teaser').addClass('active'); 6174}; 6175 6176/** 6177 * Email Campaign Assistant 6178 * 6179 * @desc: A user experience helper class to assist in the memory of previously 6180 * configured email campaign data. This functionality saves the user time since 6181 * they don't have to fill out the same form each and every time they're testing 6182 * e-blasts to their subscribers. 6183 */ 6184Drupal.behaviors.dmodelEmailCampaign = function(context) { 6185 var $campaignForm = $('#banana-node-send-campaign-form', context); 6186 if ($campaignForm.length) { 6187 var results = $campaignForm.attr('action').match(/node\/([0-9]+)\/campaign/i); 6188 if (results) { 6189 new Drupal.EmailCampaignAssistant($campaignForm, { 6190 nid: results[1], 6191 formComponents: [ 6192 '#edit-test-mail', // Test email address 6193 '#edit-emailkit-address', // Direct email address(es) 6194 '#edit-from-name', // Name of sender 6195 '#edit-from-address', // From email address 6196 '#edit-subject' // Subject of the email 6197 ] 6198 }); 6199 } 6200 } 6201}; 6202 6203Drupal.EmailCampaignAssistant = function($element, options) { 6204 this.$element = $element; 6205 this.options = options; 6206 this.storageKey = 'EmailCampaignAssistantData_' + this.options.nid; 6207 this.$formComponents = this.getFormComponents(); 6208 this.formData = this.getData(); 6209 this.init(); 6210}; 6211 6212Drupal.EmailCampaignAssistant.prototype = { 6213 init: function() { 6214 if (this.$formComponents.length) { 6215 this.addEventListeners(); 6216 this.setData(); 6217 } 6218 }, 6219 getData: function() { 6220 var data = sessionStorage.getItem(this.storageKey) || '{}'; 6221 return JSON.parse(data); 6222 }, 6223 setData: function() { 6224 var self = this; 6225 self.$formComponents.each(function() { 6226 var key = '#' + $(this).attr('id'); 6227 $(this).val(self.formData[key]); 6228 $(this).data('key', key); 6229 }); 6230 }, 6231 saveData: function() { 6232 sessionStorage.setItem(this.storageKey, JSON.stringify(this.formData)); 6233 }, 6234 updateData: function(event) { 6235 var self = event.data.self; 6236 self.formData[$(this).data('key')] = $(this).val(); 6237 self.saveData(); 6238 }, 6239 getFormComponents: function() { 6240 return this.$element.find(this.options.formComponents.toString()); 6241 }, 6242 addEventListeners: function() { 6243 this.$formComponents.bind('keyup', {self: this} , this.updateData); 6244 } 6245}; 6246 6247/**
6248 * Simply applies a class to the standard overview block if an overview is 6249 * already present. 6250 */ 6251Drupal.behaviors.dmodelOverviewHelper = function(context) { 6252 var $overviewBlock = $('.overview.block', context); 6253 if ($overviewBlock.find('.node').length) { 6254 $overviewBlock.addClass('hide-add-new'); 6255 } 6256 $('.block-title', context).each(function () { 6257 var $title = $(this); 6258 var labelText = $.trim($title.find('.block-title-text').text()); 6259 if (labelText && !$title.attr('aria-label')) { 6260 $title.attr('aria-label', labelText); 6261 } 6262 }); 6263(function ($) { 6264 6265 function fixArchivedFacet() { 6266 6267 $('.facetapi-checkbox').each(function () { 6268 6269 var $checkbox = $(this); 6270 6271 // Only target the archived checkbox 6272 var text = $.trim($checkbox.parent().text()); 6273 6274 if (text.indexOf('Include archived content') === -1) return; 6275 6276 // Add aria-label 6277 if (!$checkbox.attr('aria-label')) { 6278 $checkbox.attr('aria-label', 'Include archived content'); 6279 } 6280 6281 // Add hidden label only once 6282 if (!$checkbox.prev('label.archived-hidden-label').length) { 6283 6284 var id = $checkbox.attr('id'); 6285 6286 if (!id) { 6287 id = 'include-archived-checkbox'; 6288 $checkbox.attr('id', id); 6289 } 6290 6291 $checkbox.before( 6292 '<label for="' + id + '" class="archived-hidden-label visually-hidden">Include archived content</label>' 6293 ); 6294 } 6295 6296 }); 6297 6298 } 6299 6300 // Run once on page load 6301 $(document).ready(function () { 6302 fixArchivedFacet(); 6303 }); 6304 6305 // MutationObserver (unique name so it doesn't conflict) 6306 var archivedFacetObserver = new MutationObserver(function () { 6307 fixArchivedFacet(); 6308 }); 6309 6310 archivedFacetObserver.observe(document.body, { 6311 childList: true, 6312 subtree: true 6313 }); 6314 6315})(jQuery); 6316 $('.toc-top-link', context).each(function () { 6317 var $link = $(this); 6318 var hasName = $link.attr('aria-label') || $link.attr('aria-labelledby') || $.trim($link.text()); 6319 6320 if (!hasName) { 6321 $link.attr('aria-label', 'Back to contents'); 6322 } else if (!$link.attr('aria-label')) { 6323 $link.attr('aria-label', $.trim($link.text())); 6324 } 6325 }); 6326 $('.node-footer-stat .node-header h2.title, .node-footer-feedback .node-header h2.title', context).each(function () { 6327 var $heading = $(this); 6328 var $replacement = $('<div class="h2 title"></div>'); 6329 $replacement.append($heading.contents()); 6330 $heading.replaceWith($replacement); 6331 }); 6332 //ADA 6333 $('a').each(function () { 6334 var $link = $(this); 6335 var linkText = $.trim($link.text()); 6336 var linkHref = $link.attr('href'); 6337 var imgAlt = $link.find('img[alt]').attr('alt'); 6338 if (linkText === '') { 6339 if (imgAlt) { 6340 $link.attr('aria-label', imgAlt); 6341 } else if (linkHref) { 6342 var cleanHref = linkHref.replace(/https?:\/\//, '').split('/')[0]; // Extract domain 6343 $link.attr('aria-label', 'Visit ' + cleanHref); 6344 } else { 6345 $link.attr('aria-label', 'Unnamed link'); 6346 } 6347 } 6348 }); 6349 $('[aria-hidden="true"]').find('a, button, input, textarea, select, [tabindex]').each(function () { 6350 $(this).attr('tabindex', '-1'); // Prevents focus 6351 }); 6352 6353 6354 function addIframeTitle(context) { 6355 6356 $('iframe:not([title])', context).each(function () { 6357 6358 var nodeTitle = $(this) 6359 .parents('.node:first') 6360 .find('.node-header .title') 6361 .text(); 6362 6363 if (!nodeTitle) { 6364 nodeTitle = 'Embedded external content'; 6365 } 6366 6367 $(this).attr('title', nodeTitle); 6368 6369 }); 6370 6371 } 6372 6373 $(document).ready(function () { 6374 6375 addIframeTitle(document); 6376 6377 if (window.MutationObserver) { 6378 6379 var observer = new MutationObserver(function (mutations) { 6380 6381 for (var i = 0; i < mutations.length; i++) { 6382 6383 var mutation = mutations[i]; 6384 6385 for (var j = 0; j < mutation.addedNodes.length; j++) { 6386 6387 var node = mutation.addedNodes[j]; 6388 6389 if (node.nodeType === 1) { 6390 addIframeTitle(node); 6391 } 6392 6393 } 6394 6395 } 6396 6397 }); 6398 6399 observer.observe(document.body, { 6400 childList: true, 6401 subtree: true 6402 }); 6403 6404 } 6405 6406 }); 6407 6408 jQuery(document).ready(function ($) { 6409 6410 function fixAriaHidden() {
6411 // Keep hidden navigation submenus truly hidden for AT and focus handling. 6412 $('.navigation__submenu[aria-hidden="true"]').attr('hidden', 'hidden'); 6413 $('.navigation__submenu[aria-hidden="false"]').removeAttr('hidden'); 6414 6415 // Ensure labeled flyout is exposed as a landmark region. 6416 $('#flyout[aria-label]').attr('role', 'region'); 6417 6418 $('[aria-hidden="true"]').find('a, button, input, select, textarea').attr('tabindex', '-1'); 6419 } 6420 6421 // Run once on page load 6422 fixAriaHidden(); 6423 6424 // Observe DOM changes 6425 if (window.MutationObserver) { 6426 6427 var observer = new MutationObserver(function(mutations) { 6428 fixAriaHidden(); 6429 }); 6430 6431 observer.observe(document.body, { 6432 childList: true, 6433 subtree: true, 6434 attributes: true, 6435 attributeFilter: ['aria-hidden'] 6436 }); 6437 6438 } 6439 6440}); 6441 6442(function ($) { 6443 $(document).ready(function () { 6444 6445 var lacersGlobalObserver = new MutationObserver(function () { 6446 6447 // ========================= 6448 // HEADER FIX (mobile duplicate) 6449 // ========================= 6450 var $headerSocial = $('.header-social'); 6451 6452 if ($headerSocial.length > 1) { 6453 $headerSocial.eq(1).find('[id^="node-"]').each(function () { 6454 var currentId = $(this).attr('id'); 6455 6456 if (currentId && !currentId.includes('-mobile')) { 6457 $(this).attr('id', currentId + '-mobile'); 6458 } 6459 }); 6460 } 6461 6462 // ========================= 6463 // FOOTER FIX (duplicate IDs) 6464 // ========================= 6465 var seenIds = {}; 6466 6467 $('.footer-social [id^="node-"]').each(function () { 6468 var id = $(this).attr('id'); 6469 6470 if (seenIds[id]) { 6471 // Duplicate found â make unique 6472 $(this).attr('id', id + '-footer-' + seenIds[id]); 6473 seenIds[id]++; 6474 } else { 6475 seenIds[id] = 1; 6476 } 6477 }); 6478 6479 }); 6480 6481 // Observe whole document (covers header + footer + ajax) 6482 lacersGlobalObserver.observe(document.body, { 6483 childList: true, 6484 subtree: true 6485 }); 6486 6487 }); 6488})(jQuery); 6489(function ($) { 6490 $(document).ready(function () { 6491 6492 var lacersSocialObserver = new MutationObserver(function () { 6493 6494 $('.header-social a.node-link, .footer-social a.node-link, a.node-link.ext').each(function () { 6495 6496 var $link = $(this); 6497 var href = ($link.attr('href') || '').toLowerCase(); 6498 6499 // Avoid re-processing 6500 if ($link.attr('data-aria-fixed')) return; 6501 6502 if (href.includes('youtube.com')) { 6503 $link.attr('aria-label', 'YouTube'); 6504 } 6505 6506 if (href.includes('facebook.com')) { 6507 $link.attr('aria-label', 'Facebook'); 6508 } 6509 6510 if (href.includes('linkedin.com')) { 6511 $link.attr('aria-label', 'Linkedin'); 6512 } 6513 6514 if (href.includes('twitter.com') || href.includes('x.com')) { 6515 $link.attr('aria-label', 'Twitter'); 6516 } 6517 6518 $link.attr('data-aria-fixed', 'true'); 6519 6520 }); 6521 6522 }); 6523 6524 lacersSocialObserver.observe(document.body, { 6525 childList: true, 6526 subtree: true 6527 }); 6528 6529 }); 6530})(jQuery); 6531(function ($) { 6532 $(document).ready(function () { 6533 6534 var lacersWebformObserver = new MutationObserver(function () { 6535 6536 $('#webform-client-form-1003 input.form-submit').each(function (index) { 6537 $(this).attr('id', 'edit-submit-1003-' + index); 6538 }); 6539 6540 }); 6541 6542 lacersWebformObserver.observe(document.body, { 6543 childList: true, 6544 subtree: true 6545 }); 6546 6547 }); 6548})(jQuery); 6549 6550(function ($) { 6551 6552 $(document).ready(function () { 6553 6554 var menuAriaFixObserver = new MutationObserver(function (mutations) { 6555 6556 $('.block-title').each(function () { 6557 6558 // 1. Remove incorrect aria-label from div 6559 if ($(this).attr('aria-label')) { 6560 $(this).removeAttr('aria-label'); 6561 } 6562 6563 // 2. Fix button aria attributes 6564 var $btn = $(this).find('button'); 6565 6566 if ($btn.length) { 6567 6568 // Fix aria-haspopup 6569 if ($btn.attr('aria-haspopup') !== 'menu') { 6570 $btn.attr('aria-haspopup', 'menu'); 6571 } 6572 6573 // Add aria-expanded if missing 6574 if (!$btn.attr('aria-expanded')) { 6575 $btn.attr('aria-expanded', 'false'); 6576 } 6577 6578 } 6579 6580 }); 6581 6582 }); 6583 6584 // Observe whole body because menu loads dynamically 6585 menuAriaFixObserver.observe(document.body, { 6586 childList: true, 6587 subtree: true 6588 }); 6589 6590 }); 6591 6592})(jQuery); 6593 6594(function ($) { 6595 6596 function cleanEmptyH4Elements(ctx) { 6597 $(ctx).find('h4').filter(function () { 6598 return !$(this).text().replace(/\u00A0/g, '').trim(); 6599 }).remove(); 6600 } 6601 6602 // Initial run 6603 cleanEmptyH4Elements(document); 6604 6605 // Unique observer name 6606 const h4CleanupObserver = new MutationObserver(function (mutationList) { 6607 mutationList.forEach(function (mutationItem) {
6608 mutationItem.addedNodes.forEach(function (addedNode) { 6609 6610 if (addedNode.nodeType !== 1) return; 6611 6612 // If the node itself is H4 6613 if (addedNode.tagName === 'H4') { 6614 const text = $(addedNode).text().replace(/\u00A0/g, '').trim(); 6615 if (!text) { 6616 $(addedNode).remove(); 6617 } 6618 } else { 6619 // Check inside the node 6620 cleanEmptyH4Elements(addedNode); 6621 } 6622 6623 }); 6624 }); 6625 }); 6626 6627 h4CleanupObserver.observe(document.body, { 6628 childList: true, 6629 subtree: true 6630 }); 6631 6632})(jQuery); 6633 //ADA 6634 6635}; 6636;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.