Version Description
- Added: Minified JS
Download this release
Release Info
Developer | n7studios |
Plugin | Slider by Soliloquy – Responsive Image Slider for WordPress |
Version | 2.2.5 |
Comparing to | |
See all releases |
Code changes from version 2.2.4 to 2.2.5
- assets/js/min/codemirror-min.js +6 -0
- assets/js/min/editor-min.js +1 -0
- assets/js/min/metabox-min.js +1 -0
- assets/js/min/settings-min.js +1 -0
- assets/js/min/soliloquy-min.js +1 -0
- assets/js/soliloquy-dev-holder.js +0 -1490
- assets/js/soliloquy.js +1490 -1
- includes/admin/editor.php +1 -1
- includes/admin/metaboxes.php +2 -2
- includes/global/shortcode.php +1 -1
- readme.txt +3 -0
- soliloquy-lite.php +2 -2
assets/js/min/codemirror-min.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
window.CodeMirror=function(){function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n||{};for(var i in bo)!n.hasOwnProperty(i)&&bo.hasOwnProperty(i)&&(n[i]=bo[i]);h(n);var o="string"==typeof n.value?0:n.value.first,a=this.display=t(r,o);a.wrapper.CodeMirror=this,c(this),n.autofocus&&!Qi&>(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new ni},s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");var l=n.value;"string"==typeof l&&(l=new Eo(n.value,n.mode)),st(this,_n)(this,l),Ii&&setTimeout(di(mt,this,!0),20),yt(this);var u;try{u=document.activeElement==a.input}catch(f){}u||n.autofocus&&!Qi?setTimeout(di(Dt,this),20):It(this),st(this,function(){for(var e in yo)yo.propertyIsEnumerable(e)&&yo[e](this,n[e],xo);for(var t=0;t<Co.length;++t)Co[t](this)})()}function t(e,t){var r={},n=r.input=gi("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none; font-size: 4px;");return Ri?n.style.width="1000px":n.setAttribute("wrap","off"),Zi&&(n.style.border="1px solid black"),n.setAttribute("autocorrect","off"),n.setAttribute("autocapitalize","off"),n.setAttribute("spellcheck","false"),r.inputDiv=gi("div",[n],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),r.scrollbarH=gi("div",[gi("div",null,null,"height: 1px")],"CodeMirror-hscrollbar"),r.scrollbarV=gi("div",[gi("div",null,null,"width: 1px")],"CodeMirror-vscrollbar"),r.scrollbarFiller=gi("div",null,"CodeMirror-scrollbar-filler"),r.gutterFiller=gi("div",null,"CodeMirror-gutter-filler"),r.lineDiv=gi("div",null,"CodeMirror-code"),r.selectionDiv=gi("div",null,null,"position: relative; z-index: 1"),r.cursor=gi("div"," ","CodeMirror-cursor"),r.otherCursor=gi("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"),r.measure=gi("div",null,"CodeMirror-measure"),r.lineSpace=gi("div",[r.measure,r.selectionDiv,r.lineDiv,r.cursor,r.otherCursor],null,"position: relative; outline: none"),r.mover=gi("div",[gi("div",[r.lineSpace],"CodeMirror-lines")],null,"position: relative"),r.sizer=gi("div",[r.mover],"CodeMirror-sizer"),r.heightForcer=gi("div",null,null,"position: absolute; height: "+Po+"px; width: 1px;"),r.gutters=gi("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=gi("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=gi("div",[r.inputDiv,r.scrollbarH,r.scrollbarV,r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),qi&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),e.appendChild?e.appendChild(r.wrapper):e(r.wrapper),Zi&&(n.style.width="0px"),Ri||(r.scroller.draggable=!0),Ui?(r.inputDiv.style.height="1px",r.inputDiv.style.position="absolute"):qi&&(r.scrollbarH.style.minWidth=r.scrollbarV.style.minWidth="18px"),r.viewOffset=r.lastSizeC=0,r.showingFrom=r.showingTo=t,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.prevInput="",r.alignWidgets=!1,r.pollingFast=!1,r.poll=new ni,r.cachedCharWidth=r.cachedTextHeight=null,r.measureLineCache=[],r.measureLineCachePos=0,r.inaccurateSelection=!1,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,H(e,100),e.state.modeGen++,e.curOp&&ft(e)}function i(e){e.options.lineWrapping?(e.display.wrapper.className+=" CodeMirror-wrap",e.display.sizer.style.minWidth=""):(e.display.wrapper.className=e.display.wrapper.className.replace(" CodeMirror-wrap",""),d(e)),a(e),ft(e),U(e),setTimeout(function(){p(e)},100)}function o(e){var t=it(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/ot(e.display)-3);return function(i){return Yr(e.doc,i)?0:r?(Math.ceil(i.text.length/n)||1)*t:t}}function a(e){var t=e.doc,r=o(e);t.iter(function(e){var t=r(e);t!=e.height&&Ln(e,t)})}function l(e){var t=So[e.options.keyMap],r=t.style;e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(r?" cm-keymap-"+r:"")}function s(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),U(e)}function u(e){c(e),ft(e),setTimeout(function(){g(e)},20)}function c(e){var t=e.display.gutters,r=e.options.gutters;vi(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(gi("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none"}function f(e,t){if(0==t.height)return 0;for(var r=t.text.length,n,i=t;n=Kr(i);){var o=n.find();i=kn(e,o.from.line),r+=o.from.ch-o.to.ch}for(i=t;n=Ur(i);){var o=n.find();r-=i.text.length-o.from.ch,i=kn(e,o.to.line),r+=i.text.length-o.to.ch}return r}function d(e){var t=e.display,r=e.doc;t.maxLine=kn(r,r.first),t.maxLineLength=f(r,t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var n=f(r,e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function h(e){var t=si(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function p(e){var t=e.display,r=e.doc.height,n=r+q(t);t.sizer.style.minHeight=t.heightForcer.style.top=n+"px",t.gutters.style.height=Math.max(n,t.scroller.clientHeight-Po)+"px";var i=Math.max(n,t.scroller.scrollHeight),o=t.scroller.scrollWidth>t.scroller.clientWidth+1,a=i>t.scroller.clientHeight+1;a?(t.scrollbarV.style.display="block",t.scrollbarV.style.bottom=o?_i(t.measure)+"px":"0",t.scrollbarV.firstChild.style.height=i-t.scroller.clientHeight+t.scrollbarV.clientHeight+"px"):(t.scrollbarV.style.display="",t.scrollbarV.firstChild.style.height="0"),o?(t.scrollbarH.style.display="block",t.scrollbarH.style.right=a?_i(t.measure)+"px":"0",t.scrollbarH.firstChild.style.width=t.scroller.scrollWidth-t.scroller.clientWidth+t.scrollbarH.clientWidth+"px"):(t.scrollbarH.style.display="",t.scrollbarH.firstChild.style.width="0"),o&&a?(t.scrollbarFiller.style.display="block",t.scrollbarFiller.style.height=t.scrollbarFiller.style.width=_i(t.measure)+"px"):t.scrollbarFiller.style.display="",o&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(t.gutterFiller.style.display="block",t.gutterFiller.style.height=_i(t.measure)+"px",t.gutterFiller.style.width=t.gutters.offsetWidth+"px"):t.gutterFiller.style.display="",$i&&0===_i(t.measure)&&(t.scrollbarV.style.minWidth=t.scrollbarH.style.minHeight=Xi?"18px":"12px",t.scrollbarV.style.pointerEvents=t.scrollbarH.style.pointerEvents="none")}function m(e,t,r){var n=e.scroller.scrollTop,i=e.wrapper.clientHeight;"number"==typeof r?n=r:r&&(n=r.top,i=r.bottom-r.top),n=Math.floor(n-I(e));var o=Math.ceil(n+i);return{from:Tn(t,n),to:Tn(t,o)}}function g(e){var t=e.display;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=b(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,i=r+"px",o=t.lineDiv.firstChild;o;o=o.nextSibling)if(o.alignable)for(var a=0,l=o.alignable;a<l.length;++a)l[a].style.left=i;e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}}function v(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=y(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(gi("div",[gi("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a),n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",!0}return!1}function y(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function b(e){return xi(e.scroller).left-xi(e.sizer).left}function x(e,t,r,n){for(var i=e.display.showingFrom,o=e.display.showingTo,a,l=m(e.display,e.doc,r),s=!0;;s=!1){var u=e.display.scroller.clientWidth;if(!w(e,t,l,n))break;if(a=!0,t=[],A(e),p(e),s&&e.options.lineWrapping&&u!=e.display.scroller.clientWidth)n=!0;else if(n=!1,r&&(r=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,"number"==typeof r?r:r.top)),l=m(e.display,e.doc,r),l.from>=e.display.showingFrom&&l.to<=e.display.showingTo)break}return a&&(Qn(e,"update",e),(e.display.showingFrom!=i||e.display.showingTo!=o)&&Qn(e,"viewportChange",e,e.display.showingFrom,e.display.showingTo)),a}function w(e,t,r,n){var i=e.display,o=e.doc;if(!i.wrapper.offsetWidth)return i.showingFrom=i.showingTo=o.first,void(i.viewOffset=0);if(!(!n&&0==t.length&&r.from>i.showingFrom&&r.to<i.showingTo)){v(e)&&(t=[{from:o.first,to:o.first+o.size}]);var a=i.sizer.style.marginLeft=i.gutters.offsetWidth+"px";i.scrollbarH.style.left=e.options.fixedGutter?a:"0";var l=1/0;if(e.options.lineNumbers)for(var s=0;s<t.length;++s)t[s].diff&&t[s].from<l&&(l=t[s].from);var u=o.first+o.size,c=Math.max(r.from-e.options.viewportMargin,o.first),f=Math.min(u,r.to+e.options.viewportMargin);if(i.showingFrom<c&&c-i.showingFrom<20&&(c=Math.max(o.first,i.showingFrom)),i.showingTo>f&&i.showingTo-f<20&&(f=Math.min(u,i.showingTo)),oo)for(c=Sn(Xr(o,kn(o,c)));u>f&&Yr(o,kn(o,f));)++f;var d=[{from:Math.max(i.showingFrom,o.first),to:Math.min(i.showingTo,u)}];if(d=d[0].from>=d[0].to?[]:C(d,t),oo)for(var s=0;s<d.length;++s)for(var h=d[s],p;p=Ur(kn(o,h.to-1));){var m=p.find().from.line;if(!(m>h.from)){d.splice(s--,1);break}h.to=m}for(var g=0,s=0;s<d.length;++s){var h=d[s];h.from<c&&(h.from=c),h.to>f&&(h.to=f),h.from>=h.to?d.splice(s--,1):g+=h.to-h.from}if(!n&&g==f-c&&c==i.showingFrom&&f==i.showingTo)return void k(e);d.sort(function(e,t){return e.from-t.from});try{var y=document.activeElement}catch(b){}.7*(f-c)>g&&(i.lineDiv.style.display="none"),L(e,c,f,d,l),i.lineDiv.style.display="",y&&document.activeElement!=y&&y.offsetHeight&&y.focus();var x=c!=i.showingFrom||f!=i.showingTo||i.lastSizeC!=i.wrapper.clientHeight;return x&&(i.lastSizeC=i.wrapper.clientHeight,H(e,400)),i.showingFrom=c,i.showingTo=f,i.gutters.style.height="",_(e),k(e),!0}}function _(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=t.lineDiv.firstChild,i;n;n=n.nextSibling)if(n.lineObj){if(qi){var o=n.offsetTop+n.offsetHeight;i=o-r,r=o}else{var a=xi(n);i=a.bottom-a.top}var l=n.lineObj.height-i;if(2>i&&(i=it(t)),l>.001||-.001>l){Ln(n.lineObj,i);var s=n.lineObj.widgets;if(s)for(var u=0;u<s.length;++u)s[u].height=s[u].node.offsetHeight}}}function k(e){var t=e.display.viewOffset=An(e,kn(e.doc,e.display.showingFrom));e.display.mover.style.top=t+"px"}function C(e,t){for(var r=0,n=t.length||0;n>r;++r){for(var i=t[r],o=[],a=i.diff||0,l=0,s=e.length;s>l;++l){var u=e[l];i.to<=u.from&&i.diff?o.push({from:u.from+a,to:u.to+a}):i.to<=u.from||i.from>=u.to?o.push(u):(i.from>u.from&&o.push({from:u.from,to:i.from}),i.to<u.to&&o.push({from:i.to+a,to:u.to+a}))}e=o}return e}function M(e){for(var t=e.display,r={},n={},i=t.gutters.firstChild,o=0;i;i=i.nextSibling,++o)r[e.options.gutters[o]]=i.offsetLeft,n[e.options.gutters[o]]=i.offsetWidth;return{fixedPos:b(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function L(e,t,r,n,i){function o(t){var r=t.nextSibling;return Ri&&Ji&&e.display.currentWheelTarget==t?(t.style.display="none",t.lineObj=null):t.parentNode.removeChild(t),r}var a=M(e),l=e.display,s=e.options.lineNumbers;n.length||Ri&&e.display.currentWheelTarget||vi(l.lineDiv);var u=l.lineDiv,c=u.firstChild,f=n.shift(),d=t;for(e.doc.iter(t,r,function(t){if(f&&f.to==d&&(f=n.shift()),Yr(e.doc,t)){if(0!=t.height&&Ln(t,0),t.widgets&&c&&c.previousSibling)for(var r=0;r<t.widgets.length;++r){var l=t.widgets[r];if(l.showIfHidden){var h=c.previousSibling;if(/pre/i.test(h.nodeName)){var p=gi("div",null,null,"position: relative");h.parentNode.replaceChild(p,h),p.appendChild(h),h=p}var m=h.appendChild(gi("div",[l.node],"CodeMirror-linewidget"));l.handleMouseEvents||(m.ignoreEvents=!0),T(l,m,h,a)}}}else if(f&&f.from<=d&&f.to>d){for(;c.lineObj!=t;)c=o(c);s&&d>=i&&c.lineNumber&&bi(c.lineNumber,y(e.options,d)),c=c.nextSibling}else{if(t.widgets)for(var g=0,v=c,b;v&&20>g;++g,v=v.nextSibling)if(v.lineObj==t&&/div/i.test(v.nodeName)){b=v;break}var x=S(e,t,d,a,b);if(x!=b)u.insertBefore(x,c);else{for(;c!=b;)c=o(c);c=c.nextSibling}x.lineObj=t}++d});c;)c=o(c)}function S(e,t,r,n,i){var o=fn(e,t),a=o.pre,l=t.gutterMarkers,s=e.display,u,c=o.bgClass?o.bgClass+" "+(t.bgClass||""):t.bgClass;if(!(e.options.lineNumbers||l||c||t.wrapClass||t.widgets))return a;if(i){i.alignable=null;for(var f=!0,d=0,h=null,p=i.firstChild,m;p;p=m)if(m=p.nextSibling,/\bCodeMirror-linewidget\b/.test(p.className)){for(var g=0;g<t.widgets.length;++g){var v=t.widgets[g];if(v.node==p.firstChild){v.above||h||(h=p),T(v,p,i,n),++d;break}}if(g==t.widgets.length){f=!1;break}}else i.removeChild(p);i.insertBefore(a,h),f&&d==t.widgets.length&&(u=i,i.className=t.wrapClass||"")}if(u||(u=gi("div",null,t.wrapClass,"position: relative"),u.appendChild(a)),c&&u.insertBefore(gi("div",null,c+" CodeMirror-linebackground"),u.firstChild),e.options.lineNumbers||l){var b=u.insertBefore(gi("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px"),a);if(e.options.fixedGutter&&(u.alignable||(u.alignable=[])).push(b),!e.options.lineNumbers||l&&l["CodeMirror-linenumbers"]||(u.lineNumber=b.appendChild(gi("div",y(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+s.lineNumInnerWidth+"px"))),l)for(var x=0;x<e.options.gutters.length;++x){var w=e.options.gutters[x],_=l.hasOwnProperty(w)&&l[w];_&&b.appendChild(gi("div",[_],"CodeMirror-gutter-elt","left: "+n.gutterLeft[w]+"px; width: "+n.gutterWidth[w]+"px"))}}if(qi&&(u.style.zIndex=2),t.widgets&&u!=i)for(var g=0,k=t.widgets;g<k.length;++g){var v=k[g],C=gi("div",[v.node],"CodeMirror-linewidget");v.handleMouseEvents||(C.ignoreEvents=!0),T(v,C,u,n),v.above?u.insertBefore(C,e.options.lineNumbers&&0!=t.height?b:a):u.appendChild(C),Qn(v,"redraw")}return u}function T(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function A(e){var t=e.display,r=Yt(e.doc.sel.from,e.doc.sel.to);if(r||e.options.showCursorWhenSelecting?z(e):t.cursor.style.display=t.otherCursor.style.display="none",r?t.selectionDiv.style.display="none":N(e),e.options.moveInputWithCursor){var n=et(e,e.doc.sel.head,"div"),i=xi(t.wrapper),o=xi(t.lineDiv);t.inputDiv.style.top=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+o.top-i.top))+"px",t.inputDiv.style.left=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+o.left-i.left))+"px"}}function z(e){var t=e.display,r=et(e,e.doc.sel.head,"div");t.cursor.style.left=r.left+"px",t.cursor.style.top=r.top+"px",t.cursor.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",t.cursor.style.display="",r.other?(t.otherCursor.style.display="",t.otherCursor.style.left=r.other.left+"px",t.otherCursor.style.top=r.other.top+"px",t.otherCursor.style.height=.85*(r.other.bottom-r.other.top)+"px"):t.otherCursor.style.display="none"}function N(e){function t(e,t,r,n){0>t&&(t=0),a.appendChild(gi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?l-e:r)+"px; height: "+(n-t)+"px"))}function r(r,n,o){function a(t,n){return J(e,Xt(r,t),"div",u,n)}var u=kn(i,r),c=u.text.length,f,d;return Ci(zn(u),n||0,null==o?c:o,function(e,r,i){var u=a(e,"left"),h,p,m;if(e==r)h=u,p=m=u.left;else{if(h=a(r-1,"right"),"rtl"==i){var g=u;u=h,h=g}p=u.left,m=h.right}null==n&&0==e&&(p=s),h.top-u.top>3&&(t(p,u.top,null,u.bottom),p=s,u.bottom<h.top&&t(p,u.bottom,null,h.top)),null==o&&r==c&&(m=l),(!f||u.top<f.top||u.top==f.top&&u.left<f.left)&&(f=u),(!d||h.bottom>d.bottom||h.bottom==d.bottom&&h.right>d.right)&&(d=h),s+1>p&&(p=s),t(p,h.top,m-p,h.bottom)}),{start:f,end:d}}var n=e.display,i=e.doc,o=e.doc.sel,a=document.createDocumentFragment(),l=n.lineSpace.offsetWidth,s=P(e.display);if(o.from.line==o.to.line)r(o.from.line,o.from.ch,o.to.ch);else{var u=kn(i,o.from.line),c=kn(i,o.to.line),f=Xr(i,u)==Xr(i,c),d=r(o.from.line,o.from.ch,f?u.text.length:null).end,h=r(o.to.line,f?0:null,o.to.ch).start;f&&(d.top<h.top-2?(t(d.right,d.top,null,d.bottom),t(s,h.top,h.left,h.bottom)):t(d.right,d.top,h.left-d.right,d.bottom)),d.bottom<h.top&&t(s,d.bottom,null,h.top)}yi(n.selectionDiv,a),n.selectionDiv.style.display=""}function W(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursor.style.visibility=t.otherCursor.style.visibility="",e.options.cursorBlinkRate>0&&(t.blinker=setInterval(function(){t.cursor.style.visibility=t.otherCursor.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate))}}function H(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.showingTo&&e.state.highlight.set(t,di(E,e))}function E(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.showingTo)){var r=+new Date+e.options.workTime,n=_r(t.mode,D(e,t.frontier)),i=[],o;t.iter(t.frontier,Math.min(t.first+t.size,e.display.showingTo+500),function(a){if(t.frontier>=e.display.showingFrom){var l=a.styles;a.styles=ln(e,a,n,!0);for(var s=!l||l.length!=a.styles.length,u=0;!s&&u<l.length;++u)s=l[u]!=a.styles[u];s&&(o&&o.end==t.frontier?o.end++:i.push(o={start:t.frontier,end:t.frontier+1})),a.stateAfter=_r(t.mode,n)}else un(e,a.text,n),a.stateAfter=t.frontier%5==0?_r(t.mode,n):null;return++t.frontier,+new Date>r?(H(e,e.options.workDelay),!0):void 0}),i.length&&st(e,function(){for(var e=0;e<i.length;++e)ft(this,i[e].start,i[e].end)})()}}function O(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=kn(o,l-1);if(s.stateAfter&&(!r||l<=o.frontier))return l;var u=ii(s.text,null,e.options.tabSize);(null==i||n>u)&&(i=l-1,n=u)}return i}function D(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=O(e,t,r),a=o>n.first&&kn(n,o-1).stateAfter;return a=a?_r(n.mode,a):kr(n.mode),n.iter(o,t,function(r){un(e,r.text,a);var l=o==t-1||o%5==0||o>=i.showingFrom&&o<i.showingTo;r.stateAfter=l?_r(n.mode,a):null,++o}),r&&(n.frontier=o),a}function I(e){return e.lineSpace.offsetTop}function q(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function P(e){var t=yi(e.measure,gi("pre",null,null,"text-align: left")).appendChild(gi("span","x"));return t.offsetLeft}function F(e,t,r,n,i){var o=-1;if(n=n||B(e,t),n.crude){var a=n.left+r*n.width;return{left:a,right:a+n.width,top:n.top,bottom:n.bottom}}for(var l=r;;l+=o){var s=n[l];if(s)break;0>o&&0==l&&(o=1)}return i=l>r?"left":r>l?"right":i,"left"==i&&s.leftSide?s=s.leftSide:"right"==i&&s.rightSide&&(s=s.rightSide),{left:r>l?s.right:s.left,right:l>r?s.left:s.right,top:s.top,bottom:s.bottom}}function V(e,t){for(var r=e.display.measureLineCache,n=0;n<r.length;++n){var i=r[n];if(i.text==t.text&&i.markedSpans==t.markedSpans&&e.display.scroller.clientWidth==i.width&&i.classes==t.textClass+"|"+t.wrapClass)return i}}function R(e,t){var r=V(e,t);r&&(r.text=r.measure=r.markedSpans=null)}function B(e,t){var r=V(e,t);if(r)return r.measure;var n=G(e,t),i=e.display.measureLineCache,o={text:t.text,width:e.display.scroller.clientWidth,markedSpans:t.markedSpans,measure:n,classes:t.textClass+"|"+t.wrapClass};return 16==i.length?i[++e.display.measureLineCachePos%16]=o:i.push(o),n}function G(e,t){function r(e){var t=e.top-p.top,r=e.bottom-p.top;r>v&&(r=v),0>t&&(t=0);for(var n=m.length-2;n>=0;n-=2){var i=m[n],o=m[n+1];if(!(i>r||t>o)&&(t>=i&&o>=r||i>=t&&r>=o||Math.min(r,o)-Math.max(t,i)>=r-t>>1)){m[n]=Math.min(t,i),m[n+1]=Math.max(r,o);break}}return 0>n&&(n=m.length,m.push(t,r)),{left:e.left-p.left,right:e.right-p.left,top:n,bottom:null}}function n(e){e.bottom=m[e.top+1],e.top=m[e.top]}if(!e.options.lineWrapping&&t.text.length>=e.options.crudeMeasuringFrom)return j(e,t);var i=e.display,o=fi(t.text.length),a=fn(e,t,o,!0).pre;if(Ii&&!qi&&!e.options.lineWrapping&&a.childNodes.length>100){for(var l=document.createDocumentFragment(),s=10,u=a.childNodes.length,c=0,f=Math.ceil(u/s);f>c;++c){for(var d=gi("div",null,null,"display: inline-block"),h=0;s>h&&u;++h)d.appendChild(a.firstChild),--u;l.appendChild(d)}a.appendChild(l)}yi(i.measure,a);var p=xi(i.lineDiv),m=[],g=fi(t.text.length),v=a.offsetHeight;Pi&&i.measure.first!=a&&yi(i.measure,a);for(var c=0,y;c<o.length;++c)if(y=o[c]){var b=y,x=null;if(/\bCodeMirror-widget\b/.test(y.className)&&y.getClientRects){1==y.firstChild.nodeType&&(b=y.firstChild);var w=b.getClientRects();w.length>1&&(x=g[c]=r(w[0]),x.rightSide=r(w[w.length-1]))}x||(x=g[c]=r(xi(b))),y.measureRight&&(x.right=xi(y.measureRight).left-p.left),y.leftSide&&(x.leftSide=r(xi(y.leftSide)))}vi(e.display.measure);for(var c=0,y;c<g.length;++c)(y=g[c])&&(n(y),y.leftSide&&n(y.leftSide),y.rightSide&&n(y.rightSide));return g}function j(e,t){var r=new zo(t.text.slice(0,100),null);t.textClass&&(r.textClass=t.textClass);var n=G(e,r),i=F(e,r,0,n,"left"),o=F(e,r,99,n,"right");return{crude:!0,top:i.top,left:i.left,bottom:i.bottom,width:(o.right-i.left)/100}}function K(e,t){var r=!1;if(t.markedSpans)for(var n=0;n<t.markedSpans;++n){var i=t.markedSpans[n];!i.collapsed||null!=i.to&&i.to!=t.text.length||(r=!0)}var o=!r&&V(e,t);if(o||t.text.length>=e.options.crudeMeasuringFrom)return F(e,t,t.text.length,o&&o.measure,"right").right;var a=fn(e,t,null,!0).pre,l=a.appendChild(ki(e.display.measure));return yi(e.display.measure,a),xi(l).right-xi(e.display.lineDiv).left}function U(e){e.display.measureLineCache.length=e.display.measureLineCachePos=0,e.display.cachedCharWidth=e.display.cachedTextHeight=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function X(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Y(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function Z(e,t,r,n){if(t.widgets)for(var i=0;i<t.widgets.length;++i)if(t.widgets[i].above){var o=tn(t.widgets[i]);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=An(e,t);if("local"==n?a+=I(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=xi(e.display.lineSpace);a+=l.top+("window"==n?0:Y());var s=l.left+("window"==n?0:X());r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function Q(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=X(),i-=Y();else if("local"==r||!r){var o=xi(e.display.sizer);n+=o.left,i+=o.top}var a=xi(e.display.lineSpace);return{left:n-a.left,top:i-a.top}}function J(e,t,r,n,i){return n||(n=kn(e.doc,t.line)),Z(e,n,F(e,n,t.ch,null,i),r)}function et(e,t,r,n,i){function o(t,o){var a=F(e,n,t,i,o?"right":"left");return o?a.left=a.right:a.right=a.left,Z(e,n,a,r)}function a(e,t){var r=l[t],n=r.level%2;return e==Mi(r)&&t&&r.level<l[t-1].level?(r=l[--t],e=Li(r)-(r.level%2?0:1),n=!0):e==Li(r)&&t<l.length-1&&r.level<l[t+1].level&&(r=l[++t],e=Mi(r)-r.level%2,n=!1),n&&e==r.to&&e>r.from?o(e-1):o(e,n)}n=n||kn(e.doc,t.line),i||(i=B(e,n));var l=zn(n),s=t.ch;if(!l)return o(s);var u=Wi(l,s),c=a(s,u);return null!=Zo&&(c.other=a(s,Zo)),c}function tt(e,t,r,n){var i=new Xt(e,t);return i.xRel=n,r&&(i.outside=!0),i}function rt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return tt(n.first,0,!0,-1);var i=Tn(n,r),o=n.first+n.size-1;if(i>o)return tt(n.first+n.size-1,kn(n,o).text.length,!0,1);for(0>t&&(t=0);;){var a=kn(n,i),l=nt(e,a,i,t,r),s=Ur(a),u=s&&s.find();if(!s||!(l.ch>u.from.ch||l.ch==u.from.ch&&l.xRel>0))return l;i=u.to.line}}function nt(e,t,r,n,i){function o(n){var i=et(e,Xt(r,n),"line",t,u);return l=!0,a>i.bottom?i.left-s:a<i.top?i.left+s:(l=!1,i.left)}var a=i-An(e,t),l=!1,s=2*e.display.wrapper.clientWidth,u=B(e,t),c=zn(t),f=t.text.length,d=Si(t),h=Ti(t),p=o(d),m=l,g=o(h),v=l;if(n>g)return tt(r,h,v,1);for(;;){if(c?h==d||h==Ei(t,d,1):1>=h-d){for(var y=p>n||g-n>=n-p?d:h,b=n-(y==d?p:g);mi(t.text.charAt(y));)++y;var x=tt(r,y,y==d?m:v,0>b?-1:b?1:0);return x}var w=Math.ceil(f/2),_=d+w;if(c){_=d;for(var k=0;w>k;++k)_=Ei(t,_,1)}var C=o(_);C>n?(h=_,g=C,(v=l)&&(g+=1e3),f=w):(d=_,p=C,m=l,f-=w)}}function it(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==ao){ao=gi("pre");for(var t=0;49>t;++t)ao.appendChild(document.createTextNode("x")),ao.appendChild(gi("br"));ao.appendChild(document.createTextNode("x"))}yi(e.measure,ao);var r=ao.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),vi(e.measure),r||1}function ot(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=gi("span","x"),r=gi("pre",[t]);yi(e.measure,r);var n=t.offsetWidth;return n>2&&(e.cachedCharWidth=n),n||10}function at(e){e.curOp={changes:[],forceUpdate:!1,updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,cursorActivity:!1,updateMaxLine:!1,updateScrollPos:!1,id:++lo},qo++||(Io=[])}function lt(e){var t=e.curOp,r=e.doc,n=e.display;if(e.curOp=null,t.updateMaxLine&&d(e),n.maxLineChanged&&!e.options.lineWrapping&&n.maxLine){var i=K(e,n.maxLine);n.sizer.style.minWidth=Math.max(0,i+3+Po)+"px",n.maxLineChanged=!1;var o=Math.max(0,n.sizer.offsetLeft+n.sizer.offsetWidth-n.scroller.clientWidth);o<r.scrollLeft&&!t.updateScrollPos&&Tt(e,Math.min(n.scroller.scrollLeft,o),!0)}var a,l;if(t.updateScrollPos)a=t.updateScrollPos;else if(t.selectionChanged&&n.scroller.clientHeight){var s=et(e,r.sel.head);a=dr(e,s.left,s.top,s.left,s.bottom)}if((t.changes.length||t.forceUpdate||a&&null!=a.scrollTop)&&(l=x(e,t.changes,a&&a.scrollTop,t.forceUpdate),e.display.scroller.offsetHeight&&(e.doc.scrollTop=e.display.scroller.scrollTop)),!l&&t.selectionChanged&&A(e),t.updateScrollPos){var u=Math.max(0,Math.min(n.scroller.scrollHeight-n.scroller.clientHeight,a.scrollTop)),c=Math.max(0,Math.min(n.scroller.scrollWidth-n.scroller.clientWidth,a.scrollLeft));n.scroller.scrollTop=n.scrollbarV.scrollTop=r.scrollTop=u,n.scroller.scrollLeft=n.scrollbarH.scrollLeft=r.scrollLeft=c,g(e),t.scrollToPos&&cr(e,tr(e.doc,t.scrollToPos.from),tr(e.doc,t.scrollToPos.to),t.scrollToPos.margin)}else a&&ur(e);t.selectionChanged&&W(e),e.state.focused&&t.updateInput&&mt(e,t.userSelChange);var f=t.maybeHiddenMarkers,h=t.maybeUnhiddenMarkers;if(f)for(var p=0;p<f.length;++p)f[p].lines.length||Zn(f[p],"hide");if(h)for(var p=0;p<h.length;++p)h[p].lines.length&&Zn(h[p],"unhide");var m;if(--qo||(m=Io,Io=null),t.textChanged&&Zn(e,"change",e,t.textChanged),t.cursorActivity&&Zn(e,"cursorActivity",e),m)for(var p=0;p<m.length;++p)m[p]()}function st(e,t){return function(){var r=e||this,n=!r.curOp;n&&at(r);try{var i=t.apply(r,arguments)}finally{n&<(r)}return i}}function ut(e){return function(){var t=this.cm&&!this.cm.curOp,r;t&&at(this.cm);try{r=e.apply(this,arguments)}finally{t&<(this.cm)}return r}}function ct(e,t){var r=!e.curOp,n;r&&at(e);try{n=t()}finally{r&<(e)}return n}function ft(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),e.curOp.changes.push({from:t,to:r,diff:n})}function dt(e){e.display.pollingFast||e.display.poll.set(e.options.pollInterval,function(){pt(e),e.state.focused&&dt(e)})}function ht(e){function t(){var n=pt(e);n||r?(e.display.pollingFast=!1,dt(e)):(r=!0,e.display.poll.set(60,t))}var r=!1;e.display.pollingFast=!0,e.display.poll.set(20,t)}function pt(e){var t=e.display.input,r=e.display.prevInput,n=e.doc,i=n.sel;if(!e.state.focused||$o(t)||vt(e)||e.options.disableInput)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var o=t.value;if(o==r&&Yt(i.from,i.to))return!1;if(Vi&&!Pi&&e.display.inputHasSelection===o)return mt(e,!0),!1;var a=!e.curOp;a&&at(e),i.shift=!1;for(var l=0,s=Math.min(r.length,o.length);s>l&&r.charCodeAt(l)==o.charCodeAt(l);)++l;var u=i.from,c=i.to,f=o.slice(l);l<r.length?u=Xt(u.line,u.ch-(r.length-l)):e.state.overwrite&&Yt(u,c)&&!e.state.pasteIncoming&&(c=Xt(c.line,Math.min(kn(n,c.line).text.length,c.ch+f.length)));var d=e.curOp.updateInput,h={from:u,to:c,text:Uo(f),origin:e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input"};if(Rt(e.doc,h,"end"),e.curOp.updateInput=d,Qn(e,"inputRead",e,h),f&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&i.head.ch<100){var p=e.getModeAt(i.head).electricChars;if(p)for(var m=0;m<p.length;m++)if(f.indexOf(p.charAt(m))>-1){mr(e,i.head.line,"smart");break}}return o.length>1e3||o.indexOf("\n")>-1?t.value=e.display.prevInput="":e.display.prevInput=o,a&<(e),e.state.pasteIncoming=e.state.cutIncoming=!1,!0}function mt(e,t){var r,n,i=e.doc;if(Yt(i.sel.from,i.sel.to))t&&(e.display.prevInput=e.display.input.value="",Vi&&!Pi&&(e.display.inputHasSelection=null));else{e.display.prevInput="",r=Xo&&(i.sel.to.line-i.sel.from.line>100||(n=e.getSelection()).length>1e3);var o=r?"-":n||e.getSelection();e.display.input.value=o,e.state.focused&&li(e.display.input),Vi&&!Pi&&(e.display.inputHasSelection=o)}e.display.inaccurateSelection=r}function gt(e){"nocursor"==e.options.readOnly||Qi&&document.activeElement==e.display.input||e.display.input.focus()}function vt(e){return e.options.readOnly||e.doc.cantEdit}function yt(e){function t(){e.state.focused&&setTimeout(di(gt,e),0)}function r(){null==l&&(l=setTimeout(function(){l=null,a.cachedCharWidth=a.cachedTextHeight=jo=null,U(e),ct(e,di(ft,e))},100))}function n(){for(var e=a.wrapper.parentNode;e&&e!=document.body;e=e.parentNode);e?setTimeout(n,5e3):Yn(window,"resize",r)}function i(t){Jn(e,t)||e.options.onDragEvent&&e.options.onDragEvent(e,Rn(t))||Kn(t)}function o(t){a.inaccurateSelection&&(a.prevInput="",a.inaccurateSelection=!1,a.input.value=e.getSelection(),li(a.input)),"cut"==t.type&&(e.state.cutIncoming=!0)}var a=e.display;Xn(a.scroller,"mousedown",st(e,wt)),Ii?Xn(a.scroller,"dblclick",st(e,function(t){if(!Jn(e,t)){var r=xt(e,t);if(r&&!Ct(e,t)&&!bt(e.display,t)){Bn(t);var n=br(kn(e.doc,r.line).text,r);ir(e.doc,n.from,n.to)}}})):Xn(a.scroller,"dblclick",function(t){Jn(e,t)||Bn(t)}),Xn(a.lineSpace,"selectstart",function(e){bt(a,e)||Bn(e)}),no||Xn(a.scroller,"contextmenu",function(t){qt(e,t)}),Xn(a.scroller,"scroll",function(){a.scroller.clientHeight&&(St(e,a.scroller.scrollTop),Tt(e,a.scroller.scrollLeft,!0),Zn(e,"scroll",e))}),Xn(a.scrollbarV,"scroll",function(){a.scroller.clientHeight&&St(e,a.scrollbarV.scrollTop)}),Xn(a.scrollbarH,"scroll",function(){a.scroller.clientHeight&&Tt(e,a.scrollbarH.scrollLeft)}),Xn(a.scroller,"mousewheel",function(t){At(e,t)}),Xn(a.scroller,"DOMMouseScroll",function(t){At(e,t)}),Xn(a.scrollbarH,"mousedown",t),Xn(a.scrollbarV,"mousedown",t),Xn(a.wrapper,"scroll",function(){a.wrapper.scrollTop=a.wrapper.scrollLeft=0});var l;Xn(window,"resize",r),setTimeout(n,5e3),Xn(a.input,"keyup",st(e,function(t){Jn(e,t)||e.options.onKeyEvent&&e.options.onKeyEvent(e,Rn(t))||16==t.keyCode&&(e.doc.sel.shift=!1)})),Xn(a.input,"input",function(){Vi&&!Pi&&e.display.inputHasSelection&&(e.display.inputHasSelection=null),ht(e)}),Xn(a.input,"keydown",st(e,Et)),Xn(a.input,"keypress",st(e,Ot)),Xn(a.input,"focus",di(Dt,e)),Xn(a.input,"blur",di(It,e)),e.options.dragDrop&&(Xn(a.scroller,"dragstart",function(t){Lt(e,t)}),Xn(a.scroller,"dragenter",i),Xn(a.scroller,"dragover",i),Xn(a.scroller,"drop",st(e,Mt))),Xn(a.scroller,"paste",function(t){bt(a,t)||(gt(e),ht(e))}),Xn(a.input,"paste",function(){if(Ri&&!e.state.fakedLastChar&&!(new Date-e.state.lastMiddleDown<200)){var t=a.input.selectionStart,r=a.input.selectionEnd;a.input.value+="$",a.input.selectionStart=t,a.input.selectionEnd=r,e.state.fakedLastChar=!0}e.state.pasteIncoming=!0,ht(e)}),Xn(a.input,"cut",o),Xn(a.input,"copy",o),Ui&&Xn(a.sizer,"mouseup",function(){document.activeElement==a.input&&a.input.blur(),gt(e)})}function bt(e,t){for(var r=Un(t);r!=e.wrapper;r=r.parentNode)if(!r||r.ignoreEvents||r.parentNode==e.sizer&&r!=e.mover)return!0
|
2 |
+
}function xt(e,t,r){var n=e.display;if(!r){var i=Un(t);if(i==n.scrollbarH||i==n.scrollbarH.firstChild||i==n.scrollbarV||i==n.scrollbarV.firstChild||i==n.scrollbarFiller||i==n.gutterFiller)return null}var o,a,l=xi(n.lineSpace);try{o=t.clientX,a=t.clientY}catch(t){return null}return rt(e,o-l.left,a-l.top)}function wt(e){function t(e){if(!Yt(v,e)){if(v=e,"single"==c)return void ir(i.doc,tr(a,s),e);if(p=tr(a,p),g=tr(a,g),"double"==c){var t=br(kn(a,e.line).text,e);Zt(e,p)?ir(i.doc,t.from,g):ir(i.doc,p,t.to)}else"triple"==c&&(Zt(e,p)?ir(i.doc,g,tr(a,Xt(e.line,0))):ir(i.doc,p,tr(a,Xt(e.line+1,0))))}}function r(e){var n=++b,l=xt(i,e,!0);if(l)if(Yt(l,d)){var s=e.clientY<y.top?-20:e.clientY>y.bottom?20:0;s&&setTimeout(st(i,function(){b==n&&(o.scroller.scrollTop+=s,r(e))}),50)}else{i.state.focused||Dt(i),d=l,t(l);var u=m(o,a);(l.line>=u.to||l.line<u.from)&&setTimeout(st(i,function(){b==n&&r(e)}),150)}}function n(e){b=1/0,Bn(e),gt(i),Yn(document,"mousemove",x),Yn(document,"mouseup",w)}if(!Jn(this,e)){var i=this,o=i.display,a=i.doc,l=a.sel;if(l.shift=e.shiftKey,bt(o,e))return void(Ri||(o.scroller.draggable=!1,setTimeout(function(){o.scroller.draggable=!0},100)));if(!Ct(i,e)){var s=xt(i,e);switch($n(e)){case 3:return void(no&&qt.call(i,i,e));case 2:return Ri&&(i.state.lastMiddleDown=+new Date),s&&ir(i.doc,s),setTimeout(di(gt,i),20),void Bn(e)}if(!s)return void(Un(e)==o.scroller&&Bn(e));i.state.focused||Dt(i);var u=+new Date,c="single";if(uo&&uo.time>u-400&&Yt(uo.pos,s))c="triple",Bn(e),setTimeout(di(gt,i),20),xr(i,s.line);else if(so&&so.time>u-400&&Yt(so.pos,s)){c="double",uo={time:u,pos:s},Bn(e);var f=br(kn(a,s.line).text,s);ir(i.doc,f.from,f.to)}else so={time:u,pos:s};var d=s;if(i.options.dragDrop&&Go&&!vt(i)&&!Yt(l.from,l.to)&&!Zt(s,l.from)&&!Zt(l.to,s)&&"single"==c){var h=st(i,function(t){Ri&&(o.scroller.draggable=!1),i.state.draggingText=!1,Yn(document,"mouseup",h),Yn(o.scroller,"drop",h),Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)<10&&(Bn(t),ir(i.doc,s),gt(i),Ii&&!Pi&&setTimeout(function(){document.body.focus(),gt(i)},20))});return Ri&&(o.scroller.draggable=!0),i.state.draggingText=h,o.scroller.dragDrop&&o.scroller.dragDrop(),Xn(document,"mouseup",h),void Xn(o.scroller,"drop",h)}Bn(e),"single"==c&&ir(i.doc,tr(a,s));var p=l.from,g=l.to,v=s,y=xi(o.wrapper),b=0,x=st(i,function(e){Ii||$n(e)?r(e):n(e)}),w=st(i,n);Xn(document,"mousemove",x),Xn(document,"mouseup",w)}}}function _t(e,t,r,n,i){try{var o=t.clientX,a=t.clientY}catch(t){return!1}if(o>=Math.floor(xi(e.display.gutters).right))return!1;n&&Bn(t);var l=e.display,s=xi(l.lineDiv);if(a>s.bottom||!ti(e,r))return jn(t);a-=s.top-l.viewOffset;for(var u=0;u<e.options.gutters.length;++u){var c=l.gutters.childNodes[u];if(c&&xi(c).right>=o){var f=Tn(e.doc,a),d=e.options.gutters[u];return i(e,r,e,f,d,t),jn(t)}}}function kt(e,t){return ti(e,"gutterContextMenu")?_t(e,t,"gutterContextMenu",!1,Zn):!1}function Ct(e,t){return _t(e,t,"gutterClick",!0,Qn)}function Mt(e){var t=this;if(!(Jn(t,e)||bt(t.display,e)||t.options.onDragEvent&&t.options.onDragEvent(t,Rn(e)))){Bn(e),Vi&&(co=+new Date);var r=xt(t,e,!0),n=e.dataTransfer.files;if(r&&!vt(t))if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,l=function(e,n){var l=new FileReader;l.onload=function(){o[n]=l.result,++a==i&&(r=tr(t.doc,r),Rt(t.doc,{from:r,to:r,text:Uo(o.join("\n")),origin:"paste"},"around"))},l.readAsText(e)},s=0;i>s;++s)l(n[s],s);else{if(t.state.draggingText&&!Zt(r,t.doc.sel.from)&&!Zt(t.doc.sel.to,r))return t.state.draggingText(e),void setTimeout(di(gt,t),20);try{var o=e.dataTransfer.getData("Text");if(o){var u=t.doc.sel.from,c=t.doc.sel.to;ar(t.doc,r,r),t.state.draggingText&&$t(t.doc,"",u,c,"paste"),t.replaceSelection(o,null,"paste"),gt(t)}}catch(e){}}}}function Lt(e,t){if(Vi&&(!e.state.draggingText||+new Date-co<100))return void Kn(t);if(!Jn(e,t)&&!bt(e.display,t)){var r=e.getSelection();if(t.dataTransfer.setData("Text",r),t.dataTransfer.setDragImage&&!Ki){var n=gi("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",ji&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),ji&&n.parentNode.removeChild(n)}}}function St(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,Di||x(e,[],t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbarV.scrollTop!=t&&(e.display.scrollbarV.scrollTop=t),Di&&x(e,[]),H(e,100))}function Tt(e,t,r){(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,g(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbarH.scrollLeft!=t&&(e.display.scrollbarH.scrollLeft=t))}function At(e,t){var r=t.wheelDeltaX,n=t.wheelDeltaY;null==r&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(r=t.detail),null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta);var i=e.display,o=i.scroller;if(r&&o.scrollWidth>o.clientWidth||n&&o.scrollHeight>o.clientHeight){if(n&&Ji&&Ri)for(var a=t.target;a!=o;a=a.parentNode)if(a.lineObj){e.display.currentWheelTarget=a;break}if(r&&!Di&&!ji&&null!=ho)return n&&St(e,Math.max(0,Math.min(o.scrollTop+n*ho,o.scrollHeight-o.clientHeight))),Tt(e,Math.max(0,Math.min(o.scrollLeft+r*ho,o.scrollWidth-o.clientWidth))),Bn(t),void(i.wheelStartX=null);if(n&&null!=ho){var l=n*ho,s=e.doc.scrollTop,u=s+i.wrapper.clientHeight;0>l?s=Math.max(0,s+l-50):u=Math.min(e.doc.height,u+l+50),x(e,[],{top:s,bottom:u})}20>fo&&(null==i.wheelStartX?(i.wheelStartX=o.scrollLeft,i.wheelStartY=o.scrollTop,i.wheelDX=r,i.wheelDY=n,setTimeout(function(){if(null!=i.wheelStartX){var e=o.scrollLeft-i.wheelStartX,t=o.scrollTop-i.wheelStartY,r=t&&i.wheelDY&&t/i.wheelDY||e&&i.wheelDX&&e/i.wheelDX;i.wheelStartX=i.wheelStartY=null,r&&(ho=(ho*fo+r)/(fo+1),++fo)}},200)):(i.wheelDX+=r,i.wheelDY+=n))}}function zt(e,t,r){if("string"==typeof t&&(t=Lo[t],!t))return!1;e.display.pollingFast&&pt(e)&&(e.display.pollingFast=!1);var n=e.doc,i=n.sel.shift,o=!1;try{vt(e)&&(e.state.suppressEdits=!0),r&&(n.sel.shift=!1),o=t(e)!=Fo}finally{n.sel.shift=i,e.state.suppressEdits=!1}return o}function Nt(e){var t=e.state.keyMaps.slice(0);return e.options.extraKeys&&t.push(e.options.extraKeys),t.push(e.options.keyMap),t}function Wt(e,t){var r=Cr(e.options.keyMap),n=r.auto;clearTimeout(po),n&&!Lr(t)&&(po=setTimeout(function(){Cr(e.options.keyMap)==r&&(e.options.keyMap=n.call?n.call(null,e):n,l(e))},50));var i=Sr(t,!0),o=!1;if(!i)return!1;var a=Nt(e);return o=t.shiftKey?Mr("Shift-"+i,a,function(t){return zt(e,t,!0)})||Mr(i,a,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?zt(e,t):void 0}):Mr(i,a,function(t){return zt(e,t)}),o&&(Bn(t),W(e),Pi&&(t.oldKeyCode=t.keyCode,t.keyCode=0),Qn(e,"keyHandled",e,i,t)),o}function Ht(e,t,r){var n=Mr("'"+r+"'",Nt(e),function(t){return zt(e,t,!0)});return n&&(Bn(t),W(e),Qn(e,"keyHandled",e,"'"+r+"'",t)),n}function Et(e){var t=this;if(t.state.focused||Dt(t),!(Jn(t,e)||t.options.onKeyEvent&&t.options.onKeyEvent(t,Rn(e)))){Ii&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.doc.sel.shift=16==r||e.shiftKey;var n=Wt(t,e);ji&&(mo=n?r:null,!n&&88==r&&!Xo&&(Ji?e.metaKey:e.ctrlKey)&&t.replaceSelection(""))}}function Ot(e){var t=this;if(!(Jn(t,e)||t.options.onKeyEvent&&t.options.onKeyEvent(t,Rn(e)))){var r=e.keyCode,n=e.charCode;if(ji&&r==mo)return mo=null,void Bn(e);if(!(ji&&(!e.which||e.which<10)||Ui)||!Wt(t,e)){var i=String.fromCharCode(null==n?r:n);Ht(t,e,i)||(Vi&&!Pi&&(t.display.inputHasSelection=null),ht(t))}}}function Dt(e){"nocursor"!=e.options.readOnly&&(e.state.focused||(Zn(e,"focus",e),e.state.focused=!0,-1==e.display.wrapper.className.search(/\bCodeMirror-focused\b/)&&(e.display.wrapper.className+=" CodeMirror-focused"),e.curOp||(mt(e,!0),Ri&&setTimeout(di(mt,e,!0),0))),dt(e),W(e))}function It(e){e.state.focused&&(Zn(e,"blur",e),e.state.focused=!1,e.display.wrapper.className=e.display.wrapper.className.replace(" CodeMirror-focused","")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.doc.sel.shift=!1)},150)}function qt(e,t){function r(){if(null!=i.input.selectionStart){var e=i.input.value=""+(Yt(o.from,o.to)?"":i.input.value);i.prevInput="",i.input.selectionStart=1,i.input.selectionEnd=e.length}}function n(){if(i.inputDiv.style.position="relative",i.input.style.cssText=u,Pi&&(i.scrollbarV.scrollTop=i.scroller.scrollTop=l),dt(e),null!=i.input.selectionStart){(!Ii||Pi)&&r(),clearTimeout(go);var t=0,n=function(){""==i.prevInput&&0==i.input.selectionStart?st(e,Lo.selectAll)(e):t++<10?go=setTimeout(n,500):mt(e)};go=setTimeout(n,200)}}if(!Jn(e,t,"contextmenu")){var i=e.display,o=e.doc.sel;if(!bt(i,t)&&!kt(e,t)){var a=xt(e,t),l=i.scroller.scrollTop;if(a&&!ji){var s=e.options.resetSelectionOnContextMenu;s&&(Yt(o.from,o.to)||Zt(a,o.from)||!Zt(a,o.to))&&st(e,ar)(e.doc,a,a);var u=i.input.style.cssText;if(i.inputDiv.style.position="absolute",i.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(t.clientY-5)+"px; left: "+(t.clientX-5)+"px; z-index: 1000; background: transparent; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; -ms-opacity: .05; filter: alpha(opacity=5);",gt(e),mt(e,!0),Yt(o.from,o.to)&&(i.input.value=i.prevInput=" "),Ii&&!Pi&&r(),no){Kn(t);var c=function(){Yn(window,"mouseup",c),setTimeout(n,20)};Xn(window,"mouseup",c)}else setTimeout(n,50)}}}}function Pt(e,t,r){if(!Zt(t.from,r))return tr(e,r);var n=t.text.length-1-(t.to.line-t.from.line);if(r.line>t.to.line+n){var i=r.line-n,o=e.first+e.size-1;return i>o?Xt(o,kn(e,o).text.length):rr(r,kn(e,i).text.length)}if(r.line==t.to.line+n)return rr(r,ai(t.text).length+(1==t.text.length?t.from.ch:0)+kn(e,t.to.line).text.length-t.to.ch);var a=r.line-t.from.line;return rr(r,t.text[a].length+(a?0:t.from.ch))}function Ft(e,t,r){if(r&&"object"==typeof r)return{anchor:Pt(e,t,r.anchor),head:Pt(e,t,r.head)};if("start"==r)return{anchor:t.from,head:t.from};var n=vo(t);if("around"==r)return{anchor:t.from,head:n};if("end"==r)return{anchor:n,head:n};var i=function(e){if(Zt(e,t.from))return e;if(!Zt(t.to,e))return n;var r=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=n.ch-t.to.ch),Xt(r,i)};return{anchor:i(e.sel.anchor),head:i(e.sel.head)}}function Vt(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return r&&(n.update=function(t,r,n,i){t&&(this.from=tr(e,t)),r&&(this.to=tr(e,r)),n&&(this.text=n),void 0!==i&&(this.origin=i)}),Zn(e,"beforeChange",e,n),e.cm&&Zn(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Rt(e,t,r,n){if(e.cm){if(!e.cm.curOp)return st(e.cm,Rt)(e,t,r,n);if(e.cm.state.suppressEdits)return}if(!(ti(e,"beforeChange")||e.cm&&ti(e.cm,"beforeChange"))||(t=Vt(e,t,!0))){var i=io&&!n&&Vr(e,t.from,t.to);if(i){for(var o=i.length-1;o>=1;--o)Bt(e,{from:i[o].from,to:i[o].to,text:[""]});i.length&&Bt(e,{from:i[0].from,to:i[0].to,text:t.text},r)}else Bt(e,t,r)}}function Bt(e,t,r){if(1!=t.text.length||""!=t.text[0]||!Yt(t.from,t.to)){var n=Ft(e,t,r);En(e,t,n,e.cm?e.cm.curOp.id:0/0),Kt(e,t,n,qr(e,t));var i=[];wn(e,function(e,r){r||-1!=si(i,e.history)||(Fn(e.history,t),i.push(e.history)),Kt(e,t,null,qr(e,t))})}}function Gt(e,t){if(!e.cm||!e.cm.state.suppressEdits){var r=e.history,n=("undo"==t?r.done:r.undone).pop();if(n){var i={changes:[],anchorBefore:n.anchorAfter,headBefore:n.headAfter,anchorAfter:n.anchorBefore,headAfter:n.headBefore,generation:r.generation};("undo"==t?r.undone:r.done).push(i),r.generation=n.generation||++r.maxGeneration;for(var o=ti(e,"beforeChange")||e.cm&&ti(e.cm,"beforeChange"),a=n.changes.length-1;a>=0;--a){var l=n.changes[a];if(l.origin=t,o&&!Vt(e,l,!1))return void(("undo"==t?r.done:r.undone).length=0);i.changes.push(Hn(e,l));var s=a?Ft(e,l,null):{anchor:n.anchorBefore,head:n.headBefore};Kt(e,l,s,Fr(e,l));var u=[];wn(e,function(e,t){t||-1!=si(u,e.history)||(Fn(e.history,l),u.push(e.history)),Kt(e,l,null,Fr(e,l))})}}}}function jt(e,t){function r(e){return Xt(e.line+t,e.ch)}e.first+=t,e.cm&&ft(e.cm,e.first,e.first,t),e.sel.head=r(e.sel.head),e.sel.anchor=r(e.sel.anchor),e.sel.from=r(e.sel.from),e.sel.to=r(e.sel.to)}function Kt(e,t,r,n){if(e.cm&&!e.cm.curOp)return st(e.cm,Kt)(e,t,r,n);if(t.to.line<e.first)return void jt(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);jt(e,i),t={from:Xt(e.first,0),to:Xt(t.to.line+i,t.to.ch),text:[ai(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:Xt(o,kn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Cn(e,t.from,t.to),r||(r=Ft(e,t,null)),e.cm?Ut(e.cm,t,n,r):yn(e,t,n,r)}}function Ut(e,t,r,n){var i=e.doc,a=e.display,l=t.from,s=t.to,u=!1,c=l.line;e.options.lineWrapping||(c=Sn(Xr(i,kn(i,l.line))),i.iter(c,s.line+1,function(e){return e==a.maxLine?(u=!0,!0):void 0})),Zt(i.sel.head,t.from)||Zt(t.to,i.sel.head)||(e.curOp.cursorActivity=!0),yn(i,t,r,n,o(e)),e.options.lineWrapping||(i.iter(c,l.line+t.text.length,function(e){var t=f(i,e);t>a.maxLineLength&&(a.maxLine=e,a.maxLineLength=t,a.maxLineChanged=!0,u=!1)}),u&&(e.curOp.updateMaxLine=!0)),i.frontier=Math.min(i.frontier,l.line),H(e,400);var d=t.text.length-(s.line-l.line)-1;if(ft(e,l.line,s.line+1,d),ti(e,"change")){var h={from:l,to:s,text:t.text,removed:t.removed,origin:t.origin};if(e.curOp.textChanged){for(var p=e.curOp.textChanged;p.next;p=p.next);p.next=h}else e.curOp.textChanged=h}}function $t(e,t,r,n,i){if(n||(n=r),Zt(n,r)){var o=n;n=r,r=o}"string"==typeof t&&(t=Uo(t)),Rt(e,{from:r,to:n,text:t,origin:i},null)}function Xt(e,t){return this instanceof Xt?(this.line=e,void(this.ch=t)):new Xt(e,t)}function Yt(e,t){return e.line==t.line&&e.ch==t.ch}function Zt(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function Qt(e,t){return e.line-t.line||e.ch-t.ch}function Jt(e){return Xt(e.line,e.ch)}function er(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function tr(e,t){if(t.line<e.first)return Xt(e.first,0);var r=e.first+e.size-1;return t.line>r?Xt(r,kn(e,r).text.length):rr(t,kn(e,t.line).text.length)}function rr(e,t){var r=e.ch;return null==r||r>t?Xt(e.line,t):0>r?Xt(e.line,0):e}function nr(e,t){return t>=e.first&&t<e.first+e.size}function ir(e,t,r,n){if(e.sel.shift||e.sel.extend){var i=e.sel.anchor;if(r){var o=Zt(t,i);o!=Zt(r,i)?(i=t,t=r):o!=Zt(t,r)&&(t=r)}ar(e,i,t,n)}else ar(e,t,r||t,n);e.cm&&(e.cm.curOp.userSelChange=!0)}function or(e,t,r){var n={anchor:t,head:r};return Zn(e,"beforeSelectionChange",e,n),e.cm&&Zn(e.cm,"beforeSelectionChange",e.cm,n),n.anchor=tr(e,n.anchor),n.head=tr(e,n.head),n}function ar(e,t,r,n,i){if(!i&&ti(e,"beforeSelectionChange")||e.cm&&ti(e.cm,"beforeSelectionChange")){var o=or(e,t,r);r=o.head,t=o.anchor}var a=e.sel;if(a.goalColumn=null,null==n&&(n=Zt(r,a.head)?-1:1),(i||!Yt(t,a.anchor))&&(t=sr(e,t,n,"push"!=i)),(i||!Yt(r,a.head))&&(r=sr(e,r,n,"push"!=i)),!Yt(a.anchor,t)||!Yt(a.head,r)){a.anchor=t,a.head=r;var l=Zt(r,t);a.from=l?r:t,a.to=l?t:r,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=e.cm.curOp.cursorActivity=!0),Qn(e,"cursorActivity",e)}}function lr(e){ar(e.doc,e.doc.sel.from,e.doc.sel.to,null,"push")}function sr(e,t,r,n){var i=!1,o=t,a=r||1;e.cantEdit=!1;e:for(;;){var l=kn(e,o.line);if(l.markedSpans)for(var s=0;s<l.markedSpans.length;++s){var u=l.markedSpans[s],c=u.marker;if((null==u.from||(c.inclusiveLeft?u.from<=o.ch:u.from<o.ch))&&(null==u.to||(c.inclusiveRight?u.to>=o.ch:u.to>o.ch))){if(n&&(Zn(c,"beforeCursorEnter"),c.explicitlyCleared)){if(l.markedSpans){--s;continue}break}if(!c.atomic)continue;var f=c.find()[0>a?"from":"to"];if(Yt(f,o)&&(f.ch+=a,f.ch<0?f=f.line>e.first?tr(e,Xt(f.line-1)):null:f.ch>l.text.length&&(f=f.line<e.first+e.size-1?Xt(f.line+1,0):null),!f)){if(i)return n?(e.cantEdit=!0,Xt(e.first,0)):sr(e,t,r,!0);i=!0,f=t,a=-a}o=f;continue e}}return o}}function ur(e){var t=cr(e,e.doc.sel.head,null,e.options.cursorScrollMargin);if(e.state.focused){var r=e.display,n=xi(r.sizer),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!Yi){var o=gi("div","",null,"position: absolute; top: "+(t.top-r.viewOffset)+"px; height: "+(t.bottom-t.top+Po)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function cr(e,t,r,n){for(null==n&&(n=0);;){var i=!1,o=et(e,t),a=r&&r!=t?et(e,r):o,l=dr(e,Math.min(o.left,a.left),Math.min(o.top,a.top)-n,Math.max(o.left,a.left),Math.max(o.bottom,a.bottom)+n),s=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=l.scrollTop&&(St(e,l.scrollTop),Math.abs(e.doc.scrollTop-s)>1&&(i=!0)),null!=l.scrollLeft&&(Tt(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(i=!0)),!i)return o}}function fr(e,t,r,n,i){var o=dr(e,t,r,n,i);null!=o.scrollTop&&St(e,o.scrollTop),null!=o.scrollLeft&&Tt(e,o.scrollLeft)}function dr(e,t,r,n,i){var o=e.display,a=it(e.display);0>r&&(r=0);var l=o.scroller.clientHeight-Po,s=o.scroller.scrollTop,u={},c=e.doc.height+q(o),f=a>r,d=i>c-a;if(s>r)u.scrollTop=f?0:r;else if(i>s+l){var h=Math.min(r,(d?c:i)-l);h!=s&&(u.scrollTop=h)}var p=o.scroller.clientWidth-Po,m=o.scroller.scrollLeft;t+=o.gutters.offsetWidth,n+=o.gutters.offsetWidth;var g=o.gutters.offsetWidth,v=g+10>t;return m+g>t||v?(v&&(t=0),u.scrollLeft=Math.max(0,t-10-g)):n>p+m-3&&(u.scrollLeft=n+10-p),u}function hr(e,t,r){e.curOp.updateScrollPos={scrollLeft:null==t?e.doc.scrollLeft:t,scrollTop:null==r?e.doc.scrollTop:r}}function pr(e,t,r){var n=e.curOp.updateScrollPos||(e.curOp.updateScrollPos={scrollLeft:e.doc.scrollLeft,scrollTop:e.doc.scrollTop}),i=e.display.scroller;n.scrollTop=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,n.scrollTop+r)),n.scrollLeft=Math.max(0,Math.min(i.scrollWidth-i.clientWidth,n.scrollLeft+t))}function mr(e,t,r,n){var i=e.doc;if(null==r&&(r="add"),"smart"==r)if(e.doc.mode.indent)var o=D(e,t);else r="prev";var a=e.options.tabSize,l=kn(i,t),s=ii(l.text,null,a),u=l.text.match(/^\s*/)[0],c;if(n||/\S/.test(l.text)){if("smart"==r&&(c=e.doc.mode.indent(o,l.text.slice(u.length),l.text),c==Fo)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>i.first?ii(kn(i,t-1).text,null,a):0:"add"==r?c=s+e.options.indentUnit:"subtract"==r?c=s-e.options.indentUnit:"number"==typeof r&&(c=s+r),c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/a);h;--h)d+=a,f+=" ";c>d&&(f+=oi(c-d)),f!=u?$t(e.doc,f,Xt(t,0),Xt(t,u.length),"+input"):i.sel.head.line==t&&i.sel.head.ch<u.length&&ar(i,Xt(t,u.length),Xt(t,u.length),1),l.stateAfter=null}function gr(e,t,r){var n=t,i=t,o=e.doc;return"number"==typeof t?i=kn(o,er(o,t)):n=Sn(t),null==n?null:r(i,n)?(ft(e,n,n+1),i):null}function vr(e,t,r,n,i){function o(){var t=l+r;return t<e.first||t>=e.first+e.size?f=!1:(l=t,c=kn(e,t))}function a(e){var t=(i?Ei:Oi)(c,s,r,!0);if(null==t){if(e||!o())return f=!1;s=i?(0>r?Ti:Si)(c):0>r?c.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,u=r,c=kn(e,l),f=!0;if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var d=null,h="group"==n,p=!0;!(0>r)||a(!p);p=!1){var m=c.text.charAt(s)||"\n",g=hi(m)?"w":h?/\s/.test(m)?null:"p":null;if(d&&d!=g){0>r&&(r=1,a());break}if(g&&(d=g),r>0&&!a(!p))break}var v=sr(e,Xt(l,s),u,!0);return f||(v.hitSide=!0),v}function yr(e,t,r,n){var i=e.doc,o=t.left,a;if("page"==n){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);a=t.top+r*(l-(0>r?1.5:.5)*it(e.display))}else"line"==n&&(a=r>0?t.bottom+3:t.top-3);for(;;){var s=rt(e,o,a);if(!s.outside)break;if(0>r?0>=a:a>=i.height){s.hitSide=!0;break}a+=5*r}return s}function br(e,t){var r=t.ch,n=t.ch;if(e){(t.xRel<0||n==e.length)&&r?--r:++n;for(var i=e.charAt(r),o=hi(i)?hi:/\s/.test(i)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!hi(e)};r>0&&o(e.charAt(r-1));)--r;for(;n<e.length&&o(e.charAt(n));)++n}return{from:Xt(t.line,r),to:Xt(t.line,n)}}function xr(e,t){ir(e.doc,Xt(t,0),tr(e.doc,Xt(t+1,0)))}function wr(t,r,n,i){e.defaults[t]=r,n&&(yo[t]=i?function(e,t,r){r!=xo&&n(e,t,r)}:n)}function _r(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function kr(e,t,r){return e.startState?e.startState(t,r):!0}function Cr(e){return"string"==typeof e?So[e]:e}function Mr(e,t,r){function n(t){t=Cr(t);var i=t[e];if(i===!1)return"stop";if(null!=i&&r(i))return!0;if(t.nofallthrough)return"stop";var o=t.fallthrough;if(null==o)return!1;if("[object Array]"!=Object.prototype.toString.call(o))return n(o);for(var a=0,l=o.length;l>a;++a){var s=n(o[a]);if(s)return s}return!1}for(var i=0;i<t.length;++i){var o=n(t[i]);if(o)return"stop"!=o}}function Lr(e){var t=Yo[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Sr(e,t){if(ji&&34==e.keyCode&&e["char"])return!1;var r=Yo[e.keyCode];return null==r||e.altGraphKey?!1:(e.altKey&&(r="Alt-"+r),(ro?e.metaKey:e.ctrlKey)&&(r="Ctrl-"+r),(ro?e.ctrlKey:e.metaKey)&&(r="Cmd-"+r),!t&&e.shiftKey&&(r="Shift-"+r),r)}function Tr(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0}function Ar(e,t){this.lines=[],this.type=t,this.doc=e}function zr(e,t,r,n,i){if(n&&n.shared)return Wr(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return st(e.cm,zr)(e,t,r,n,i);var o=new Ar(e,i);if(n&&ci(n,o),Zt(r,t)||Yt(t,r)&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.replacedWith=gi("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||(o.replacedWith.ignoreEvents=!0)),o.collapsed){if($r(e,t.line,t,r,o)||t.line!=r.line&&$r(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");oo=!0}o.addToHistory&&En(e,{from:t,to:r,origin:"markText"},{head:e.sel.head,anchor:e.sel.anchor},0/0);var a=t.line,l=e.cm,s;return e.iter(a,r.line+1,function(n){l&&o.collapsed&&!l.options.lineWrapping&&Xr(e,n)==l.display.maxLine&&(s=!0);var i={from:null,to:null,marker:o};a==t.line&&(i.from=t.ch),a==r.line&&(i.to=r.ch),o.collapsed&&a!=t.line&&Ln(n,0),Or(n,i),++a}),o.collapsed&&e.iter(t.line,r.line+1,function(t){Yr(e,t)&&Ln(t,0)}),o.clearOnEnter&&Xn(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(io=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++To,o.atomic=!0),l&&(s&&(l.curOp.updateMaxLine=!0),(o.className||o.title||o.startStyle||o.endStyle||o.collapsed)&&ft(l,t.line,r.line+1),o.atomic&&lr(l)),o}function Nr(e,t){this.markers=e,this.primary=t;for(var r=0,n=this;r<e.length;++r)e[r].parent=this,Xn(e[r],"clear",function(){n.clear()})}function Wr(e,t,r,n,i){n=ci(n),n.shared=!1;var o=[zr(e,t,r,n,i)],a=o[0],l=n.replacedWith;return wn(e,function(e){l&&(n.replacedWith=l.cloneNode(!0)),o.push(zr(e,tr(e,t),tr(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=ai(o)}),new Nr(o,a)}function Hr(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Er(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Or(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Dr(e,t,r){if(e)for(var n=0,i;n<e.length;++n){var o=e[n],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(i||(i=[])).push({from:o.from,to:s?null:o.to,marker:a})}}return i}function Ir(e,t,r){if(e)for(var n=0,i;n<e.length;++n){var o=e[n],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(i||(i=[])).push({from:s?null:o.from-t,to:null==o.to?null:o.to-t,marker:a})}}return i}function qr(e,t){var r=nr(e,t.from.line)&&kn(e,t.from.line).markedSpans,n=nr(e,t.to.line)&&kn(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=Yt(t.from,t.to),l=Dr(r,i,a),s=Ir(n,o,a),u=1==t.text.length,c=ai(t.text).length+(u?i:0);if(l)for(var f=0;f<l.length;++f){var d=l[f];if(null==d.to){var h=Hr(s,d.marker);h?u&&(d.to=null==h.to?null:h.to+c):d.to=i}}if(s)for(var f=0;f<s.length;++f){var d=s[f];if(null!=d.to&&(d.to+=c),null==d.from){var h=Hr(l,d.marker);h||(d.from=c,u&&(l||(l=[])).push(d))}else d.from+=c,u&&(l||(l=[])).push(d)}l&&(l=Pr(l)),s&&s!=l&&(s=Pr(s));var p=[l];if(!u){var m=t.text.length-2,g;if(m>0&&l)for(var f=0;f<l.length;++f)null==l[f].to&&(g||(g=[])).push({from:null,to:null,marker:l[f].marker});for(var f=0;m>f;++f)p.push(g);p.push(s)}return p}function Pr(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&r.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Fr(e,t){var r=Dn(e,t),n=qr(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],u=0;u<o.length;++u)if(o[u].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function Vr(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=si(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(),s=0;s<i.length;++s){var u=i[s];if(!Zt(u.to,l.from)&&!Zt(l.to,u.from)){var c=[s,1];(Zt(u.from,l.from)||!a.inclusiveLeft&&Yt(u.from,l.from))&&c.push({from:u.from,to:l.from}),(Zt(l.to,u.to)||!a.inclusiveRight&&Yt(u.to,l.to))&&c.push({from:l.to,to:u.to}),i.splice.apply(i,c),s+=c.length-1}}return i}function Rr(e){return e.inclusiveLeft?-1:0}function Br(e){return e.inclusiveRight?1:0}function Gr(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=Qt(n.from,i.from)||Rr(e)-Rr(t);if(o)return-o;var a=Qt(n.to,i.to)||Br(e)-Br(t);return a?a:t.id-e.id}function jr(e,t){var r=oo&&e.markedSpans,n;if(r)for(var i,o=0;o<r.length;++o)i=r[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!n||Gr(n,i.marker)<0)&&(n=i.marker);return n}function Kr(e){return jr(e,!0)}function Ur(e){return jr(e,!1)}function $r(e,t,r,n,i){var o=kn(e,t),a=oo&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var u=s.marker.find(!0),c=Qt(u.from,r)||Rr(s.marker)-Rr(i),f=Qt(u.to,n)||Br(s.marker)-Br(i);if(!(c>=0&&0>=f||0>=c&&f>=0)&&(0>=c&&(Qt(u.to,r)||Br(s.marker)-Rr(i))>0||c>=0&&(Qt(u.from,n)||Rr(s.marker)-Br(i))<0))return!0}}}function Xr(e,t){for(var r;r=Kr(t);)t=kn(e,r.find().from.line);return t}function Yr(e,t){var r=oo&&t.markedSpans;if(r)for(var n,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.replacedWith&&0==n.from&&n.marker.inclusiveLeft&&Zr(e,t,n))return!0}}function Zr(e,t,r){if(null==r.to){var n=r.marker.find().to,i=kn(e,n.line);return Zr(e,i,Hr(i.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var o,a=0;a<t.markedSpans.length;++a)if(o=t.markedSpans[a],o.marker.collapsed&&!o.marker.replacedWith&&o.from==r.to&&(null==o.to||o.to!=r.from)&&(o.marker.inclusiveLeft||r.marker.inclusiveRight)&&Zr(e,t,o))return!0}function Qr(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function Jr(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function en(e){return function(){var t=!this.cm.curOp;t&&at(this.cm);try{var r=e.apply(this,arguments)}finally{t&<(this.cm)}return r}}function tn(e){return null!=e.height?e.height:(e.node.parentNode&&1==e.node.parentNode.nodeType||yi(e.cm.display.measure,gi("div",[e.node],null,"position: relative")),e.height=e.node.offsetHeight)}function rn(e,t,r,n){var i=new Ao(e,r,n);return i.noHScroll&&(e.display.alignWidgets=!0),gr(e,t,function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,!Yr(e.doc,t)||i.showIfHidden){var n=An(e,t)<e.doc.scrollTop;Ln(t,t.height+tn(i)),n&&pr(e,0,i.height)}return!0}),i}function nn(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Qr(e),Jr(e,r);var i=n?n(e):1;i!=e.height&&Ln(e,i)}function on(e){e.parent=null,Qr(e)}function an(t,r,n,i,o,a){var l=n.flattenSpans;null==l&&(l=t.options.flattenSpans);var s=0,u=null,c=new Tr(r,t.options.tabSize),f;for(""==r&&n.blankLine&&n.blankLine(i);!c.eol();){if(c.pos>t.options.maxHighlightLength?(l=!1,a&&un(t,r,i,c.pos),c.pos=r.length,f=null):f=n.token(c,i),t.options.addModeClass){var d=e.innerMode(n,i).mode.name;d&&(f="m-"+(f?d+" "+f:d))}l&&u==f||(s<c.start&&o(c.start,u),s=c.start,u=f),c.start=c.pos}for(;s<c.pos;){var h=Math.min(c.pos,s+5e4);o(h,u),s=h}}function ln(e,t,r,n){var i=[e.state.modeGen];an(e,t.text,e.doc.mode,r,function(e,t){i.push(e,t)},n);for(var o=0;o<e.state.overlays.length;++o){var a=e.state.overlays[o],l=1,s=0;an(e,t.text,a.mode,!0,function(e,t){for(var r=l;e>s;){var n=i[l];n>e&&i.splice(l,1,e,i[l+1],n),l+=2,s=Math.min(e,n)}if(t)if(a.opaque)i.splice(r,l-r,e,t),l=r+2;else for(;l>r;r+=2){var o=i[r+1];i[r+1]=o?o+" "+t:t}})}return i}function sn(e,t){return t.styles&&t.styles[0]==e.state.modeGen||(t.styles=ln(e,t,t.stateAfter=D(e,Sn(t)))),t.styles}function un(e,t,r,n){var i=e.doc.mode,o=new Tr(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&i.blankLine&&i.blankLine(r);!o.eol()&&o.pos<=e.options.maxHighlightLength;)i.token(o,r),o.start=o.pos}function cn(e,t){if(!e)return null;for(;;){var r=e.match(/(?:^|\s)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}var i=t.cm.options.addModeClass?Wo:No;return i[e]||(i[e]="cm-"+e.replace(/ +/g," cm-"))}function fn(e,t,r,n){for(var i,o=t,a=!0;i=Kr(o);)o=kn(e.doc,i.find().from.line);var l={pre:gi("pre"),col:0,pos:0,measure:null,measuredSomething:!1,cm:e,copyWidgets:n};do{o.text&&(a=!1),l.measure=o==t&&r,l.pos=0,l.addToken=l.measure?pn:hn,(Ii||Ri)&&e.getOption("lineWrapping")&&(l.addToken=mn(l.addToken));var s=vn(o,l,sn(e,o));r&&o==t&&!l.measuredSomething&&(r[0]=l.pre.appendChild(ki(e.display.measure)),l.measuredSomething=!0),s&&(o=kn(e.doc,s.to.line))}while(s);!r||l.measuredSomething||r[0]||(r[0]=l.pre.appendChild(a?gi("span"," "):ki(e.display.measure))),l.pre.firstChild||Yr(e.doc,t)||l.pre.appendChild(document.createTextNode(" "));var u;if(r&&Vi&&(u=zn(o))){var c=u.length-1;u[c].from==u[c].to&&--c;var f=u[c],d=u[c-1];if(f.from+1==f.to&&d&&f.level<d.level){var h=r[l.pos-1];h&&h.parentNode.insertBefore(h.measureRight=ki(e.display.measure),h.nextSibling)}}var p=l.textClass?l.textClass+" "+(t.textClass||""):t.textClass;return p&&(l.pre.className=p),Zn(e,"renderLine",e,t,l.pre),l}function dn(e){var t=gi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t}function hn(e,t,r,n,i,o){if(t){var a=e.cm.options.specialChars;if(a.test(t))for(var l=document.createDocumentFragment(),s=0;;){a.lastIndex=s;var u=a.exec(t),c=u?u.index-s:t.length-s;if(c&&(l.appendChild(document.createTextNode(t.slice(s,s+c))),e.col+=c),!u)break;if(s+=c+1," "==u[0]){var f=e.cm.options.tabSize,d=f-e.col%f;l.appendChild(gi("span",oi(d),"cm-tab")),e.col+=d}else{var h=e.cm.options.specialCharPlaceholder(u[0]);l.appendChild(h),e.col+=1}}else{e.col+=t.length;var l=document.createTextNode(t)}if(r||n||i||e.measure){var p=r||"";n&&(p+=n),i&&(p+=i);var h=gi("span",[l],p);return o&&(h.title=o),e.pre.appendChild(h)}e.pre.appendChild(l)}}function pn(e,t,r,n,i){for(var o=e.cm.options.lineWrapping,a=0;a<t.length;++a){for(var l=0==a,s=a+1;s<t.length&&mi(t.charAt(s));)++s;var u=t.slice(a,s);a=s-1,a&&o&&wi(t,a)&&e.pre.appendChild(gi("wbr"));var c=e.measure[e.pos],f=e.measure[e.pos]=hn(e,u,r,l&&n,a==t.length-1&&i);c&&(f.leftSide=c.leftSide||c),Ii&&o&&" "==u&&a&&!/\s/.test(t.charAt(a-1))&&a<t.length-1&&!/\s/.test(t.charAt(a+1))&&(f.style.whiteSpace="normal"),e.pos+=u.length
|
3 |
+
}t.length&&(e.measuredSomething=!0)}function mn(e){function t(e){for(var t=" ",r=0;r<e.length-2;++r)t+=r%2?" ":" ";return t+=" "}return function(r,n,i,o,a,l){return e(r,n.replace(/ {3,}/g,t),i,o,a,l)}}function gn(e,t,r,n){var i=!n&&r.replacedWith;if(i&&(e.copyWidgets&&(i=i.cloneNode(!0)),e.pre.appendChild(i),e.measure)){if(t)e.measure[e.pos]=i;else{var o=ki(e.cm.display.measure);if("bookmark"!=r.type||r.insertLeft){if(e.measure[e.pos])return;e.measure[e.pos]=e.pre.insertBefore(o,i)}else e.measure[e.pos]=e.pre.appendChild(o)}e.measuredSomething=!0}e.pos+=t}function vn(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a=i.length,l=0,s=1,u="",c,f=0,d,h,p,m,g;;){if(f==l){d=h=p=m="",g=null,f=1/0;for(var v=[],y=0;y<n.length;++y){var b=n[y],x=b.marker;b.from<=l&&(null==b.to||b.to>l)?(null!=b.to&&f>b.to&&(f=b.to,h=""),x.className&&(d+=" "+x.className),x.startStyle&&b.from==l&&(p+=" "+x.startStyle),x.endStyle&&b.to==f&&(h+=" "+x.endStyle),x.title&&!m&&(m=x.title),x.collapsed&&(!g||Gr(g.marker,x)<0)&&(g=b)):b.from>l&&f>b.from&&(f=b.from),"bookmark"==x.type&&b.from==l&&x.replacedWith&&v.push(x)}if(g&&(g.from||0)==l&&(gn(t,(null==g.to?a:g.to)-l,g.marker,null==g.from),null==g.to))return g.marker.find();if(!g&&v.length)for(var y=0;y<v.length;++y)gn(t,0,v[y])}if(l>=a)break;for(var w=Math.min(a,f);;){if(u){var _=l+u.length;if(!g){var k=_>w?u.slice(0,w-l):u;t.addToken(t,k,c?c+d:d,p,l+k.length==f?h:"",m)}if(_>=w){u=u.slice(w-l),l=w;break}l=_,p=""}u=i.slice(o,o=r[s++]),c=cn(r[s++],t)}}else for(var s=1;s<r.length;s+=2)t.addToken(t,i.slice(o,o=r[s]),cn(r[s+1],t))}function yn(e,t,r,n,i){function o(e){return r?r[e]:null}function a(e,r,n){nn(e,r,n,i),Qn(e,"change",e,t)}var l=t.from,s=t.to,u=t.text,c=kn(e,l.line),f=kn(e,s.line),d=ai(u),h=o(u.length-1),p=s.line-l.line;if(0!=l.ch||0!=s.ch||""!=d||e.cm&&!e.cm.options.wholeLineUpdateBefore)if(c==f)if(1==u.length)a(c,c.text.slice(0,l.ch)+d+c.text.slice(s.ch),h);else{for(var m=[],g=1,v=u.length-1;v>g;++g)m.push(new zo(u[g],o(g),i));m.push(new zo(d+c.text.slice(s.ch),h,i)),a(c,c.text.slice(0,l.ch)+u[0],o(0)),e.insert(l.line+1,m)}else if(1==u.length)a(c,c.text.slice(0,l.ch)+u[0]+f.text.slice(s.ch),o(0)),e.remove(l.line+1,p);else{a(c,c.text.slice(0,l.ch)+u[0],o(0)),a(f,d+f.text.slice(s.ch),h);for(var g=1,v=u.length-1,m=[];v>g;++g)m.push(new zo(u[g],o(g),i));p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,m)}else{for(var g=0,v=u.length-1,m=[];v>g;++g)m.push(new zo(u[g],o(g),i));a(f,f.text,h),p&&e.remove(l.line,p),m.length&&e.insert(l.line,m)}Qn(e,"change",e,t),ar(e,n.anchor,n.head,null,!0)}function bn(e){this.lines=e,this.parent=null;for(var t=0,r=e.length,n=0;r>t;++t)e[t].parent=this,n+=e[t].height;this.height=n}function xn(e){this.children=e;for(var t=0,r=0,n=0,i=e.length;i>n;++n){var o=e[n];t+=o.chunkSize(),r+=o.height,o.parent=this}this.size=t,this.height=r,this.parent=null}function wn(e,t,r){function n(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;(!r||s)&&(t(l.doc,s),n(l.doc,e,s))}}}n(e,null,!0)}function _n(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,a(e),r(e),e.options.lineWrapping||d(e),e.options.mode=t.modeOption,ft(e)}function kn(e,t){for(t-=e.first;!e.lines;)for(var r=0;;++r){var n=e.children[r],i=n.chunkSize();if(i>t){e=n;break}t-=i}return e.lines[t]}function Cn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function Mn(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function Ln(e,t){for(var r=t-e.height,n=e;n;n=n.parent)n.height+=r}function Sn(e){if(null==e.parent)return null;for(var t=e.parent,r=si(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function Tn(e,t){var r=e.first;e:do{for(var n=0,i=e.children.length;i>n;++n){var o=e.children[n],a=o.height;if(a>t){e=o;continue e}t-=a,r+=o.chunkSize()}return r}while(!e.lines);for(var n=0,i=e.lines.length;i>n;++n){var l=e.lines[n],s=l.height;if(s>t)break;t-=s}return r+n}function An(e,t){t=Xr(e.doc,t);for(var r=0,n=t.parent,i=0;i<n.lines.length;++i){var o=n.lines[i];if(o==t)break;r+=o.height}for(var a=n.parent;a;n=a,a=n.parent)for(var i=0;i<a.children.length;++i){var l=a.children[i];if(l==n)break;r+=l.height}return r}function zn(e){var t=e.order;return null==t&&(t=e.order=Qo(e.text)),t}function Nn(e){return{done:[],undone:[],undoDepth:1/0,lastTime:0,lastOp:null,lastOrigin:null,generation:e||1,maxGeneration:e||1}}function Wn(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function Hn(e,t){var r={line:t.from.line,ch:t.from.ch},n={from:r,to:vo(t),text:Cn(e,t.from,t.to)};return Wn(e,n,t.from.line,t.to.line+1),wn(e,function(e){Wn(e,n,t.from.line,t.to.line+1)},!0),n}function En(e,t,r,n){var i=e.history;i.undone.length=0;var o=+new Date,a=ai(i.done);if(a&&(i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastTime>o-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))){var l=ai(a.changes);Yt(t.from,t.to)&&Yt(t.from,l.to)?l.to=vo(t):a.changes.push(Hn(e,t)),a.anchorAfter=r.anchor,a.headAfter=r.head}else for(a={changes:[Hn(e,t)],generation:i.generation,anchorBefore:e.sel.anchor,headBefore:e.sel.head,anchorAfter:r.anchor,headAfter:r.head},i.done.push(a);i.done.length>i.undoDepth;)i.done.shift();i.generation=++i.maxGeneration,i.lastTime=o,i.lastOp=n,i.lastOrigin=t.origin}function On(e){if(!e)return null;for(var t=0,r;t<e.length;++t)e[t].marker.explicitlyCleared?r||(r=e.slice(0,t)):r&&r.push(e[t]);return r?r.length?r:null:e}function Dn(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=0,i=[];n<t.text.length;++n)i.push(On(r[n]));return i}function In(e,t){for(var r=0,n=[];r<e.length;++r){var i=e[r],o=i.changes,a=[];n.push({changes:a,anchorBefore:i.anchorBefore,headBefore:i.headBefore,anchorAfter:i.anchorAfter,headAfter:i.headAfter});for(var l=0;l<o.length;++l){var s=o[l],u;if(a.push({from:s.from,to:s.to,text:s.text}),t)for(var c in s)(u=c.match(/^spans_(\d+)$/))&&si(t,Number(u[1]))>-1&&(ai(a)[c]=s[c],delete s[c])}}return n}function qn(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function Pn(e,t,r,n){for(var i=0;i<e.length;++i){for(var o=e[i],a=!0,l=0;l<o.changes.length;++l){var s=o.changes[l];if(o.copied||(s.from=Jt(s.from),s.to=Jt(s.to)),r<s.from.line)s.from.line+=n,s.to.line+=n;else if(t<=s.to.line){a=!1;break}}o.copied||(o.anchorBefore=Jt(o.anchorBefore),o.headBefore=Jt(o.headBefore),o.anchorAfter=Jt(o.anchorAfter),o.readAfter=Jt(o.headAfter),o.copied=!0),a?(qn(o.anchorBefore),qn(o.headBefore),qn(o.anchorAfter),qn(o.headAfter)):(e.splice(0,i+1),i=0)}}function Fn(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;Pn(e.done,r,n,i),Pn(e.undone,r,n,i)}function Vn(){Kn(this)}function Rn(e){return e.stop||(e.stop=Vn),e}function Bn(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Gn(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function jn(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Kn(e){Bn(e),Gn(e)}function Un(e){return e.target||e.srcElement}function $n(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Ji&&e.ctrlKey&&1==t&&(t=3),t}function Xn(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={}),i=n[t]||(n[t]=[]);i.push(r)}}function Yn(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers&&e._handlers[t];if(!n)return;for(var i=0;i<n.length;++i)if(n[i]==r){n.splice(i,1);break}}}function Zn(e,t){var r=e._handlers&&e._handlers[t];if(r)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function Qn(e,t){function r(e){return function(){e.apply(null,i)}}var n=e._handlers&&e._handlers[t];if(n){var i=Array.prototype.slice.call(arguments,2);Io||(++qo,Io=[],setTimeout(ei,0));for(var o=0;o<n.length;++o)Io.push(r(n[o]))}}function Jn(e,t,r){return Zn(e,r||t.type,e,t),jn(t)||t.codemirrorIgnore}function ei(){--qo;var e=Io;Io=null;for(var t=0;t<e.length;++t)e[t]()}function ti(e,t){var r=e._handlers&&e._handlers[t];return r&&r.length>0}function ri(e){e.prototype.on=function(e,t){Xn(this,e,t)},e.prototype.off=function(e,t){Yn(this,e,t)}}function ni(){this.id=null}function ii(e,t,r,n,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=n||0,a=i||0;t>o;++o)" "==e.charAt(o)?a+=r-a%r:++a;return a}function oi(e){for(;Vo.length<=e;)Vo.push(ai(Vo)+" ");return Vo[e]}function ai(e){return e[e.length-1]}function li(e){if(Zi)e.selectionStart=0,e.selectionEnd=e.value.length;else try{e.select()}catch(t){}}function si(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0,n=e.length;n>r;++r)if(e[r]==t)return r;return-1}function ui(e,t){function r(){}r.prototype=e;var n=new r;return t&&ci(t,n),n}function ci(e,t){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function fi(e){for(var t=[],r=0;e>r;++r)t.push(void 0);return t}function di(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function hi(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Ro.test(e))}function pi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function mi(e){return e.charCodeAt(0)>=768&&Bo.test(e)}function gi(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)bi(i,t);else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function vi(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function yi(e,t){return vi(e).appendChild(t)}function bi(e,t){Pi?(e.innerHTML="",e.appendChild(document.createTextNode(t))):e.textContent=t}function xi(e){return e.getBoundingClientRect()}function wi(){return!1}function _i(e){if(null!=jo)return jo;var t=gi("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return yi(e,t),t.offsetWidth&&(jo=t.offsetHeight-t.clientHeight),jo||0}function ki(e){if(null==Ko){var t=gi("span","");yi(e,gi("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Ko=t.offsetWidth<=1&&t.offsetHeight>2&&!qi)}return Ko?gi("span",""):gi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function Ci(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function Mi(e){return e.level%2?e.to:e.from}function Li(e){return e.level%2?e.from:e.to}function Si(e){var t=zn(e);return t?Mi(t[0]):0}function Ti(e){var t=zn(e);return t?Li(ai(t)):e.text.length}function Ai(e,t){var r=kn(e.doc,t),n=Xr(e.doc,r);n!=r&&(t=Sn(n));var i=zn(n),o=i?i[0].level%2?Ti(n):Si(n):0;return Xt(t,o)}function zi(e,t){for(var r,n;r=Ur(n=kn(e.doc,t));)t=r.find().to.line;var i=zn(n),o=i?i[0].level%2?Si(n):Ti(n):n.text.length;return Xt(t,o)}function Ni(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function Wi(e,t){Zo=null;for(var r=0,n;r<e.length;++r){var i=e[r];if(i.from<t&&i.to>t)return r;if(i.from==t||i.to==t){if(null!=n)return Ni(e,i.level,e[n].level)?(i.from!=i.to&&(Zo=n),r):(i.from!=i.to&&(Zo=r),n);n=r}}return n}function Hi(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&mi(e.text.charAt(t)));return t}function Ei(e,t,r,n){var i=zn(e);if(!i)return Oi(e,t,r,n);for(var o=Wi(i,t),a=i[o],l=Hi(e,t,a.level%2?-r:r,n);;){if(l>a.from&&l<a.to)return l;if(l==a.from||l==a.to)return Wi(i,l)==o?l:(a=i[o+=r],r>0==a.level%2?a.to:a.from);if(a=i[o+=r],!a)return null;l=r>0==a.level%2?Hi(e,a.to,-1,n):Hi(e,a.from,1,n)}}function Oi(e,t,r,n){var i=t+r;if(n)for(;i>0&&mi(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var Di=/gecko\/\d/i.test(navigator.userAgent),Ii=/MSIE \d/.test(navigator.userAgent),qi=Ii&&(null==document.documentMode||document.documentMode<8),Pi=Ii&&(null==document.documentMode||document.documentMode<9),Fi=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),Vi=Ii||Fi,Ri=/WebKit\//.test(navigator.userAgent),Bi=Ri&&/Qt\/\d+\.\d+/.test(navigator.userAgent),Gi=/Chrome\//.test(navigator.userAgent),ji=/Opera\//.test(navigator.userAgent),Ki=/Apple Computer/.test(navigator.vendor),Ui=/KHTML\//.test(navigator.userAgent),$i=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),Xi=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Yi=/PhantomJS/.test(navigator.userAgent),Zi=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Qi=Zi||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Ji=Zi||/Mac/.test(navigator.platform),eo=/win/i.test(navigator.platform),to=ji&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);to&&(to=Number(to[1])),to&&to>=15&&(ji=!1,Ri=!0);var ro=Ji&&(Bi||ji&&(null==to||12.11>to)),no=Di||Ii&&!Pi,io=!1,oo=!1,ao,lo=0,so,uo,co=0,fo=0,ho=null;Ii?ho=-.53:Di?ho=15:Gi?ho=-.7:Ki&&(ho=-1/3);var po,mo=null,go,vo=e.changeEnd=function(e){return e.text?Xt(e.from.line+e.text.length-1,ai(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.Pos=Xt,e.prototype={constructor:e,focus:function(){window.focus(),gt(this),ht(this)},setOption:function(e,t){var r=this.options,n=r[e];(r[e]!=t||"mode"==e)&&(r[e]=t,yo.hasOwnProperty(e)&&st(this,yo[e])(this,t,n))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](e)},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||"string"!=typeof t[r]&&t[r].name==e)return t.splice(r,1),!0},addOverlay:st(null,function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:n,modeSpec:t,opaque:r&&r.opaque}),this.state.modeGen++,ft(this)}),removeOverlay:st(null,function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void ft(this)}}),indentLine:st(null,function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),nr(this.doc,e)&&mr(this,e,t,r)}),indentSelection:st(null,function(e){var t=this.doc.sel;if(Yt(t.from,t.to))return mr(this,t.from.line,e,!0);for(var r=t.to.line-(t.to.ch?0:1),n=t.from.line;r>=n;++n)mr(this,n,e)}),getTokenAt:function(e,t){var r=this.doc;e=tr(r,e);for(var n=D(this,e.line,t),i=this.doc.mode,o=kn(r,e.line),a=new Tr(o.text,this.options.tabSize);a.pos<e.ch&&!a.eol();){a.start=a.pos;var l=i.token(a,n)}return{start:a.start,end:a.pos,string:a.current(),className:l||null,type:l||null,state:n}},getTokenTypeAt:function(e){e=tr(this.doc,e);var t=sn(this,kn(this.doc,e.line)),r=0,n=(t.length-1)/2,i=e.ch;if(0==i)return t[2];for(;;){var o=r+n>>1;if((o?t[2*o-1]:0)>=i)n=o;else{if(!(t[2*o+1]<i))return t[2*o+2];r=o+1}}},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!Mo.hasOwnProperty(t))return Mo;var n=Mo[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;o<i[t].length;o++){var a=n[i[t][o]];a&&r.push(a)}else i.helperType&&n[i.helperType]?r.push(n[i.helperType]):n[i.name]&&r.push(n[i.name]);for(var o=0;o<n._global.length;o++){var l=n._global[o];l.pred(i,this)&&-1==si(r,l.val)&&r.push(l.val)}return r},getStateAfter:function(e,t){var r=this.doc;return e=er(r,null==e?r.first+r.size-1:e),D(this,e+1,t)},cursorCoords:function(e,t){var r,n=this.doc.sel;return r=null==e?n.head:"object"==typeof e?tr(this.doc,e):e?n.from:n.to,et(this,r,t||"page")},charCoords:function(e,t){return J(this,tr(this.doc,e),t||"page")},coordsChar:function(e,t){return e=Q(this,e,t||"page"),rt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=Q(this,{top:e,left:0},t||"page").top,Tn(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var r=!1,n=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>n&&(e=n,r=!0);var i=kn(this.doc,e);return Z(this,kn(this.doc,e),{top:0,left:0},t||"page").top+(r?i.height:0)},defaultTextHeight:function(){return it(this.display)},defaultCharWidth:function(){return ot(this.display)},setGutterMarker:st(null,function(e,t,r){return gr(this,e,function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&pi(n)&&(e.gutterMarkers=null),!0})}),clearGutter:st(null,function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,ft(t,n,n+1),pi(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),addLineClass:st(null,function(e,t,r){return gr(this,e,function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"wrapClass";if(e[n]){if(new RegExp("(?:^|\\s)"+r+"(?:$|\\s)").test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:st(null,function(e,t,r){return gr(this,e,function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(new RegExp("(?:^|\\s+)"+r+"(?:$|\\s+)"));if(!o)return!1;var a=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0})}),addLineWidget:st(null,function(e,t,r){return rn(this,e,t,r)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if("number"==typeof e){if(!nr(this.doc,e))return null;var t=e;if(e=kn(this.doc,e),!e)return null}else{var t=Sn(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=et(this,tr(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var s=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>u&&(l=u-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),r&&fr(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:st(null,Et),execCommand:function(e){return Lo.hasOwnProperty(e)?Lo[e](this):void 0},findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=tr(this.doc,e);t>o&&(a=vr(this.doc,a,i,r,n),!a.hitSide);++o);return a},moveH:st(null,function(e,t){var r=this.doc.sel,n;n=r.shift||r.extend||Yt(r.from,r.to)?vr(this.doc,r.head,e,t,this.options.rtlMoveVisually):0>e?r.from:r.to,ir(this.doc,n,n,e)}),deleteH:st(null,function(e,t){var r=this.doc.sel;Yt(r.from,r.to)?$t(this.doc,"",r.from,vr(this.doc,r.head,e,t,!1),"+delete"):$t(this.doc,"",r.from,r.to,"+delete"),this.curOp.userSelChange=!0}),findPosV:function(e,t,r,n){var i=1,o=n;0>t&&(i=-1,t=-t);for(var a=0,l=tr(this.doc,e);t>a;++a){var s=et(this,l,"div");if(null==o?o=s.left:s.left=o,l=yr(this,s,i,r),l.hitSide)break}return l},moveV:st(null,function(e,t){var r=this.doc.sel,n,i;if(r.shift||r.extend||Yt(r.from,r.to)){var o=et(this,r.head,"div");null!=r.goalColumn&&(o.left=r.goalColumn),n=yr(this,o,e,t),"page"==t&&pr(this,0,J(this,n,"div").top-o.top),i=o.left}else n=0>e?r.from:r.to;ir(this.doc,n,n,e),null!=i&&(r.goalColumn=i)}),toggleOverwrite:function(e){(null==e||e!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?this.display.cursor.className+=" CodeMirror-overwrite":this.display.cursor.className=this.display.cursor.className.replace(" CodeMirror-overwrite",""))},hasFocus:function(){return this.state.focused},scrollTo:st(null,function(e,t){hr(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller,t=Po;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-t,width:e.scrollWidth-t,clientHeight:e.clientHeight-t,clientWidth:e.clientWidth-t}},scrollIntoView:st(null,function(e,t){null==e?e={from:this.doc.sel.head,to:null}:"number"==typeof e?e={from:Xt(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),t||(t=0);var r=e;null!=e.from.line&&(this.curOp.scrollToPos={from:e.from,to:e.to,margin:t},r={from:et(this,e.from),to:et(this,e.to)});var n=dr(this,Math.min(r.from.left,r.to.left),Math.min(r.from.top,r.to.top)-t,Math.max(r.from.right,r.to.right),Math.max(r.from.bottom,r.to.bottom)+t);hr(this,n.scrollLeft,n.scrollTop)}),setSize:st(null,function(e,t){function r(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&(this.display.measureLineCache.length=this.display.measureLineCachePos=0),this.curOp.forceUpdate=!0}),operation:function(e){return ct(this,e)},refresh:st(null,function(){var e=null==this.display.cachedTextHeight;U(this),hr(this,this.doc.scrollLeft,this.doc.scrollTop),ft(this),e&&a(this)}),swapDoc:st(null,function(e){var t=this.doc;return t.cm=null,_n(this,e),U(this),mt(this,!0),hr(this,e.scrollLeft,e.scrollTop),Qn(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ri(e);var yo=e.optionHandlers={},bo=e.defaults={},xo=e.Init={toString:function(){return"CodeMirror.Init"}};wr("value","",function(e,t){e.setValue(t)},!0),wr("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),wr("indentUnit",2,r,!0),wr("indentWithTabs",!1),wr("smartIndent",!0),wr("tabSize",4,function(e){n(e),U(e),ft(e)},!0),wr("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(e,t){e.options.specialChars=new RegExp(t.source+(t.test(" ")?"":"| "),"g"),e.refresh()},!0),wr("specialCharPlaceholder",dn,function(e){e.refresh()},!0),wr("electricChars",!0),wr("rtlMoveVisually",!eo),wr("wholeLineUpdateBefore",!0),wr("theme","default",function(e){s(e),u(e)},!0),wr("keyMap","default",l),wr("extraKeys",null),wr("onKeyEvent",null),wr("onDragEvent",null),wr("lineWrapping",!1,i,!0),wr("gutters",[],function(e){h(e.options),u(e)},!0),wr("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?b(e.display)+"px":"0",e.refresh()},!0),wr("coverGutterNextToScrollbar",!1,p,!0),wr("lineNumbers",!1,function(e){h(e.options),u(e)},!0),wr("firstLineNumber",1,u,!0),wr("lineNumberFormatter",function(e){return e},u,!0),wr("showCursorWhenSelecting",!1,A,!0),wr("resetSelectionOnContextMenu",!0),wr("readOnly",!1,function(e,t){"nocursor"==t?(It(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||mt(e,!0))}),wr("disableInput",!1,function(e,t){t||mt(e,!0)},!0),wr("dragDrop",!0),wr("cursorBlinkRate",530),wr("cursorScrollMargin",0),wr("cursorHeight",1),wr("workTime",100),wr("workDelay",100),wr("flattenSpans",!0,n,!0),wr("addModeClass",!1,n,!0),wr("pollInterval",100),wr("undoDepth",40,function(e,t){e.doc.history.undoDepth=t}),wr("historyEventDelay",500),wr("viewportMargin",10,function(e){e.refresh()},!0),wr("maxHighlightLength",1e4,n,!0),wr("crudeMeasuringFrom",1e4),wr("moveInputWithCursor",!0,function(e,t){t||(e.display.inputDiv.style.top=e.display.inputDiv.style.left=0)}),wr("tabindex",null,function(e,t){e.display.input.tabIndex=t||""}),wr("autofocus",null);var wo=e.modes={},_o=e.mimeModes={};e.defineMode=function(t,r){if(e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2){r.dependencies=[];for(var n=2;n<arguments.length;++n)r.dependencies.push(arguments[n])}wo[t]=r},e.defineMIME=function(e,t){_o[e]=t},e.resolveMode=function(t){if("string"==typeof t&&_o.hasOwnProperty(t))t=_o[t];else if(t&&"string"==typeof t.name&&_o.hasOwnProperty(t.name)){var r=_o[t.name];t=ui(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=wo[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(ko.hasOwnProperty(r.name)){var o=ko[r.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var a in r.modeProps)i[a]=r.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var ko=e.modeExtensions={};e.extendMode=function(e,t){var r=ko.hasOwnProperty(e)?ko[e]:ko[e]={};ci(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){Eo.prototype[e]=t},e.defineOption=wr;var Co=[];e.defineInitHook=function(e){Co.push(e)};var Mo=e.helpers={};e.registerHelper=function(t,r,n){Mo.hasOwnProperty(t)||(Mo[t]=e[t]={_global:[]}),Mo[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),Mo[t]._global.push({pred:n,val:i})},e.isWordChar=hi,e.copyState=_r,e.startState=kr,e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var Lo=e.commands={selectAll:function(e){e.setSelection(Xt(e.firstLine(),0),Xt(e.lastLine()))},killLine:function(e){var t=e.getCursor(!0),r=e.getCursor(!1),n=!Yt(t,r);n||e.getLine(t.line).length!=t.ch?e.replaceRange("",t,n?r:Xt(t.line),"+delete"):e.replaceRange("",t,Xt(t.line+1,0),"+delete")},deleteLine:function(e){var t=e.getCursor().line;e.replaceRange("",Xt(t,0),Xt(t),"+delete")},delLineLeft:function(e){var t=e.getCursor();e.replaceRange("",Xt(t.line,0),t,"+delete")},undo:function(e){e.undo()},redo:function(e){e.redo()},goDocStart:function(e){e.extendSelection(Xt(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(Xt(e.lastLine()))},goLineStart:function(e){e.extendSelection(Ai(e,e.getCursor().line))},goLineStartSmart:function(e){var t=e.getCursor(),r=Ai(e,t.line),n=e.getLineHandle(r.line),i=zn(n);if(i&&0!=i[0].level)e.extendSelection(r);else{var o=Math.max(0,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch;e.extendSelection(Xt(r.line,a?0:o))}},goLineEnd:function(e){e.extendSelection(zi(e,e.getCursor().line))},goLineRight:function(e){var t=e.charCoords(e.getCursor(),"div").top+5;e.extendSelection(e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:t},"div"))},goLineLeft:function(e){var t=e.charCoords(e.getCursor(),"div").top+5;e.extendSelection(e.coordsChar({left:0,top:t},"div"))},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection(" ","end","+input")},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.replaceSelection(" ","end","+input")},transposeChars:function(e){var t=e.getCursor(),r=e.getLine(t.line);t.ch>0&&t.ch<r.length-1&&e.replaceRange(r.charAt(t.ch)+r.charAt(t.ch-1),Xt(t.line,t.ch-1),Xt(t.line,t.ch+1))},newlineAndIndent:function(e){st(e,function(){e.replaceSelection("\n","end","+input"),e.indentLine(e.getCursor().line,null,!0)})()},toggleOverwrite:function(e){e.toggleOverwrite()}},So=e.keyMap={};So.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"},So.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"},So.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delLineLeft",fallthrough:["basic","emacsy"]},So["default"]=Ji?So.macDefault:So.pcDefault,So.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},e.lookupKey=Mr,e.isModifierKey=Lr,e.keyName=Sr,e.fromTextArea=function(t,r){function n(){t.value=u.getValue()}if(r||(r={}),r.value=t.value,!r.tabindex&&t.tabindex&&(r.tabindex=t.tabindex),!r.placeholder&&t.placeholder&&(r.placeholder=t.placeholder),null==r.autofocus){var i=document.body;try{i=document.activeElement}catch(o){}r.autofocus=i==t||null!=t.getAttribute("autofocus")&&i==document.body}if(t.form&&(Xn(t.form,"submit",n),!r.leaveSubmitMethodAlone)){var a=t.form,l=a.submit;try{var s=a.submit=function(){n(),a.submit=l,a.submit(),a.submit=s}}catch(o){}}t.style.display="none";var u=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},r);return u.save=n,u.getTextArea=function(){return t},u.toTextArea=function(){n(),t.parentNode.removeChild(u.getWrapperElement()),t.style.display="",t.form&&(Yn(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=l))},u},Tr.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var r=t==e;else var r=t&&(e.test?e.test(t):e(t));return r?(++this.pos,t):void 0},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ii(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?ii(this.string,this.lineStart,this.tabSize):0)
|
4 |
+
},indentation:function(){return ii(this.string,null,this.tabSize)-(this.lineStart?ii(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}},e.StringStream=Tr,e.TextMarker=Ar,ri(Ar),Ar.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&at(e),ti(this,"clear")){var r=this.find();r&&Qn(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=Hr(a.markedSpans,this);null!=l.to&&(i=Sn(a)),a.markedSpans=Er(a.markedSpans,l),null!=l.from?n=Sn(a):this.collapsed&&!Yr(this.doc,a)&&e&&Ln(a,it(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var s=Xr(e.doc,this.lines[o]),u=f(e.doc,s);u>e.display.maxLineLength&&(e.display.maxLine=s,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=n&&e&&ft(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&lr(e)),t&<(e)}},Ar.prototype.find=function(e){for(var t,r,n=0;n<this.lines.length;++n){var i=this.lines[n],o=Hr(i.markedSpans,this);if(null!=o.from||null!=o.to){var a=Sn(i);null!=o.from&&(t=Xt(a,o.from)),null!=o.to&&(r=Xt(a,o.to))}}return"bookmark"!=this.type||e?t&&{from:t,to:r}:t},Ar.prototype.changed=function(){var e=this.find(),t=this.doc.cm;if(e&&t){"bookmark"!=this.type&&(e=e.from);var r=kn(this.doc,e.line);if(R(t,r),e.line>=t.display.showingFrom&&e.line<t.display.showingTo){for(var n=t.display.lineDiv.firstChild;n;n=n.nextSibling)if(n.lineObj==r){n.offsetHeight!=r.height&&Ln(r,n.offsetHeight);break}ct(t,function(){t.curOp.selectionChanged=t.curOp.forceUpdate=t.curOp.updateMaxLine=!0})}}},Ar.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=si(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Ar.prototype.detachLine=function(e){if(this.lines.splice(si(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var To=0;e.SharedTextMarker=Nr,ri(Nr),Nr.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Qn(this,"clear")}},Nr.prototype.find=function(){return this.primary.find()};var Ao=e.LineWidget=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.cm=e,this.node=t};ri(Ao),Ao.prototype.clear=en(function(){var e=this.line.widgets,t=Sn(this.line);if(null!=t&&e){for(var r=0;r<e.length;++r)e[r]==this&&e.splice(r--,1);e.length||(this.line.widgets=null);var n=An(this.cm,this.line)<this.cm.doc.scrollTop;Ln(this.line,Math.max(0,this.line.height-tn(this))),n&&pr(this.cm,0,-this.height),ft(this.cm,t,t+1)}}),Ao.prototype.changed=en(function(){var e=this.height;this.height=null;var t=tn(this)-e;if(t){Ln(this.line,this.line.height+t);var r=Sn(this.line);ft(this.cm,r,r+1)}});var zo=e.Line=function(e,t,r){this.text=e,Jr(this,t),this.height=r?r(this):1};ri(zo),zo.prototype.lineNo=function(){return Sn(this)};var No={},Wo={};bn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;n>r;++r){var i=this.lines[r];this.height-=i.height,on(i),Qn(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.splice.apply(e,[e.length,0].concat(this.lines))},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0,i=t.length;i>n;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;n>e;++e)if(r(this.lines[e]))return!0}},xn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(i>e){var o=Math.min(t,i-e),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25){var l=[];this.collapse(l),this.children=[new bn(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0,r=this.children.length;r>t;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0,i=this.children.length;i>n;++n){var o=this.children[n],a=o.chunkSize();if(a>=e){if(o.insertInner(e,t,r),o.lines&&o.lines.length>50){for(;o.lines.length>50;){var l=o.lines.splice(o.lines.length-25,25),s=new bn(l);o.height-=s.height,this.children.splice(n+1,0,s),s.parent=this}this.maybeSpill()}break}e-=a}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new xn(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=si(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new xn(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0,i=this.children.length;i>n;++n){var o=this.children[n],a=o.chunkSize();if(a>e){var l=Math.min(t,a-e);if(o.iterN(e,l,r))return!0;if(0==(t-=l))break;e=0}else e-=a}}};var Ho=0,Eo=e.Doc=function(e,t,r){if(!(this instanceof Eo))return new Eo(e,t,r);null==r&&(r=0),xn.call(this,[new bn([new zo("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.history=Nn(),this.cleanGeneration=1,this.frontier=r;var n=Xt(r,0);this.sel={from:n,to:n,head:n,anchor:n,shift:!1,extend:!1,goalColumn:null},this.id=++Ho,this.modeOption=t,"string"==typeof e&&(e=Uo(e)),yn(this,{from:n,to:n,text:e},null,{head:n,anchor:n})};Eo.prototype=ui(xn.prototype,{constructor:Eo,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0,i=t.length;i>n;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Mn(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:function(e){var t=Xt(this.first,0),r=this.first+this.size-1;Rt(this,{from:t,to:Xt(r,kn(this,r).text.length),text:Uo(e),origin:"setValue"},{head:t,anchor:t},!0)},replaceRange:function(e,t,r,n){t=tr(this,t),r=r?tr(this,r):t,$t(this,e,t,r,n)},getRange:function(e,t,r){var n=Cn(this,tr(this,e),tr(this,t));return r===!1?n:n.join(r||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},setLine:function(e,t){nr(this,e)&&$t(this,t,Xt(e,0),tr(this,Xt(e)))},removeLine:function(e){e?$t(this,"",tr(this,Xt(e-1)),tr(this,Xt(e))):$t(this,"",Xt(0,0),tr(this,Xt(1,0)))},getLineHandle:function(e){return nr(this,e)?kn(this,e):void 0},getLineNumber:function(e){return Sn(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=kn(this,e)),Xr(this,e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return tr(this,e)},getCursor:function(e){var t=this.sel,r;return r=null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||e===!1?t.to:t.from,Jt(r)},somethingSelected:function(){return!Yt(this.sel.head,this.sel.anchor)},setCursor:ut(function(e,t,r){var n=tr(this,"number"==typeof e?Xt(e,t||0):e);r?ir(this,n):ar(this,n,n)}),setSelection:ut(function(e,t,r){ar(this,tr(this,e),tr(this,t||e),r)}),extendSelection:ut(function(e,t,r){ir(this,tr(this,e),t&&tr(this,t),r)}),getSelection:function(e){return this.getRange(this.sel.from,this.sel.to,e)},replaceSelection:function(e,t,r){Rt(this,{from:this.sel.from,to:this.sel.to,text:Uo(e),origin:r},t||"around")},undo:ut(function(){Gt(this,"undo")}),redo:ut(function(){Gt(this,"redo")}),setExtending:function(e){this.sel.extend=e},historySize:function(){var e=this.history;return{undo:e.done.length,redo:e.undone.length}},clearHistory:function(){this.history=Nn(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:In(this.history.done),undone:In(this.history.undone)}},setHistory:function(e){var t=this.history=Nn(this.history.maxGeneration);t.done=e.done.slice(0),t.undone=e.undone.slice(0)},markText:function(e,t,r){return zr(this,tr(this,e),tr(this,t),r,"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1};return e=tr(this,e),zr(this,e,e,r,"bookmark")},findMarksAt:function(e){e=tr(this,e);var t=[],r=kn(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first;return this.iter(function(n){var i=n.text.length+1;return i>e?(t=e,!0):(e-=i,void++r)}),tr(this,Xt(r,t))},indexFromPos:function(e){e=tr(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new Eo(Mn(this,this.first,this.first+this.size),this.modeOption,this.first);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel={from:this.sel.from,to:this.sel.to,head:this.sel.head,anchor:this.sel.anchor,shift:this.sel.shift,extend:!1,goalColumn:this.sel.goalColumn},e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new Eo(Mn(this,t,r),e.mode||this.modeOption,t);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],n},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var r=0;r<this.linked.length;++r){var n=this.linked[r];if(n.doc==t){this.linked.splice(r,1),t.unlinkDoc(this);break}}if(t.history==this.history){var i=[t.id];wn(t,function(e){i.push(e.id)},!0),t.history=Nn(),t.history.done=In(this.history.done,i),t.history.undone=In(this.history.undone,i)}},iterLinkedDocs:function(e){wn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),Eo.prototype.eachLine=Eo.prototype.iter;var Oo="iter insert remove copy getEditor".split(" ");for(var Do in Eo.prototype)Eo.prototype.hasOwnProperty(Do)&&si(Oo,Do)<0&&(e.prototype[Do]=function(e){return function(){return e.apply(this.doc,arguments)}}(Eo.prototype[Do]));ri(Eo),e.e_stop=Kn,e.e_preventDefault=Bn,e.e_stopPropagation=Gn;var Io,qo=0;e.on=Xn,e.off=Yn,e.signal=Zn;var Po=30,Fo=e.Pass={toString:function(){return"CodeMirror.Pass"}};ni.prototype={set:function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)}},e.countColumn=ii;var Vo=[""],Ro=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Bo=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;e.replaceGetRect=function(e){xi=e};var Go=function(){if(Pi)return!1;var e=gi("div");return"draggable"in e||"dragDrop"in e}();Di?wi=function(e,t){return 36==e.charCodeAt(t-1)&&39==e.charCodeAt(t)}:Ki&&!/Version\/([6-9]|\d\d)\b/.test(navigator.userAgent)?wi=function(e,t){return/\-[^ \-?]|\?[^ !\'\"\),.\-\/:;\?\]\}]/.test(e.slice(t-1,t+1))}:Ri&&/Chrome\/(?:29|[3-9]\d|\d\d\d)\./.test(navigator.userAgent)?wi=function(e,t){var r=e.charCodeAt(t-1);return r>=8208&&8212>=r}:Ri&&(wi=function(e,t){if(t>1&&45==e.charCodeAt(t-1)){if(/\w/.test(e.charAt(t-2))&&/[^\-?\.]/.test(e.charAt(t)))return!0;if(t>2&&/[\d\.,]/.test(e.charAt(t-2))&&/[\d\.,]/.test(e.charAt(t)))return!1}return/[~!#%&*)=+}\]\\|\"\.>,:;][({[<]|-[^\-?\.\u2010-\u201f\u2026]|\?[\w~`@#$%\^&*(_=+{[|><]|\u2026[\w~`@#$%\^&*(_=+{[><]/.test(e.slice(t-1,t+1))});var jo,Ko,Uo=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;n>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)};e.splitLines=Uo;var $o=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},Xo=function(){var e=gi("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Yo={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};e.keyNames=Yo,function(){for(var e=0;10>e;e++)Yo[e+48]=Yo[e+96]=String(e);for(var e=65;90>=e;e++)Yo[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)Yo[e+111]=Yo[e+63235]="F"+e}();var Zo,Qo=function(){function e(e){return 255>=e?t.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1791>=e?r.charAt(e-1536):e>=1792&&2220>=e?"r":"L"}var t="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,l=/[1n]/,s="L";return function(t){if(!n.test(t))return!1;for(var r=t.length,u=[],c=0,f;r>c;++c)u.push(f=e(t.charCodeAt(c)));for(var c=0,d=s;r>c;++c){var f=u[c];"m"==f?u[c]=d:d=f}for(var c=0,h=s;r>c;++c){var f=u[c];"1"==f&&"r"==h?u[c]="n":o.test(f)&&(h=f,"r"==f&&(u[c]="R"))}for(var c=1,d=u[0];r-1>c;++c){var f=u[c];"+"==f&&"1"==d&&"1"==u[c+1]?u[c]="1":","!=f||d!=u[c+1]||"1"!=d&&"n"!=d||(u[c]=d),d=f}for(var c=0;r>c;++c){var f=u[c];if(","==f)u[c]="N";else if("%"==f){for(var p=c+1;r>p&&"%"==u[p];++p);for(var m=c&&"!"==u[c-1]||r>p&&"1"==u[p]?"1":"N",g=c;p>g;++g)u[g]=m;c=p-1}}for(var c=0,h=s;r>c;++c){var f=u[c];"L"==h&&"1"==f?u[c]="L":o.test(f)&&(h=f)}for(var c=0;r>c;++c)if(i.test(u[c])){for(var p=c+1;r>p&&i.test(u[p]);++p);for(var v="L"==(c?u[c-1]:s),y="L"==(r>p?u[p]:s),m=v||y?"L":"R",g=c;p>g;++g)u[g]=m;c=p-1}for(var b=[],x,c=0;r>c;)if(a.test(u[c])){var w=c;for(++c;r>c&&a.test(u[c]);++c);b.push({from:w,to:c,level:0})}else{var _=c,k=b.length;for(++c;r>c&&"L"!=u[c];++c);for(var g=_;c>g;)if(l.test(u[g])){g>_&&b.splice(k,0,{from:_,to:g,level:1});var C=g;for(++g;c>g&&l.test(u[g]);++g);b.splice(k,0,{from:C,to:g,level:2}),_=g}else++g;c>_&&b.splice(k,0,{from:_,to:c,level:1})}return 1==b[0].level&&(x=t.match(/^\s+/))&&(b[0].from=x[0].length,b.unshift({from:0,to:x[0].length,level:0})),1==ai(b).level&&(x=t.match(/\s+$/))&&(ai(b).to-=x[0].length,b.push({from:r-x[0].length,to:r,level:0})),b[0].level!=ai(b).level&&b.push({from:r,to:r,level:b[0].level}),b}}();return e.version="3.21.0",e}(),CodeMirror.defineMode("xml",function(e,t){function r(e,t){function r(r){return t.tokenize=r,r(e,t)}var i=e.next();if("<"==i){if(e.eat("!"))return e.eat("[")?e.match("CDATA[")?r(o("atom","]]>")):null:e.match("--")?r(o("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(a(1))):null;if(e.eat("?"))return e.eatWhile(/[\w\._\-]/),t.tokenize=o("meta","?>"),"meta";var l=e.eat("/");_="";for(var s;s=e.eat(/[^\s\u00a0=<>\"\'\/?]/);)_+=s;return _?(k=l?"closeTag":"openTag",t.tokenize=n,"tag"):"tag error"}if("&"==i){var u;return u=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),u?"atom":"error"}return e.eatWhile(/[^&<]/),null}function n(e,t){var n=e.next();if(">"==n||"/"==n&&e.eat(">"))return t.tokenize=r,k=">"==n?"endTag":"selfcloseTag","tag";if("="==n)return k="equals",null;if("<"==n){t.tokenize=r,t.state=c,t.tagName=t.tagStart=null;var o=t.tokenize(e,t);return o?o+" error":"error"}return/[\'\"]/.test(n)?(t.tokenize=i(n),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.eatWhile(/[^\s\u00a0=<>\"\']/),"word")}function i(e){var t=function(t,r){for(;!t.eol();)if(t.next()==e){r.tokenize=n;break}return"string"};return t.isInAttribute=!0,t}function o(e,t){return function(n,i){for(;!n.eol();){if(n.match(t)){i.tokenize=r;break}n.next()}return e}}function a(e){return function(t,n){for(var i;null!=(i=t.next());){if("<"==i)return n.tokenize=a(e+1),n.tokenize(t,n);if(">"==i){if(1==e){n.tokenize=r;break}return n.tokenize=a(e-1),n.tokenize(t,n)}}return"meta"}}function l(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(x.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function s(e){e.context&&(e.context=e.context.prev)}function u(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName.toLowerCase(),!x.contextGrabbers.hasOwnProperty(r)||!x.contextGrabbers[r].hasOwnProperty(t))return;s(e)}}function c(e,t,r){if("openTag"==e)return r.tagName=_,r.tagStart=t.column(),h;if("closeTag"==e){var n=!1;return r.context?r.context.tagName!=_&&(x.implicitlyClosed.hasOwnProperty(r.context.tagName.toLowerCase())&&s(r),n=!r.context||r.context.tagName!=_):n=!0,n&&(C="error"),n?d:f}return c}function f(e,t,r){return"endTag"!=e?(C="error",f):(s(r),c)}function d(e,t,r){return C="error",f(e,t,r)}function h(e,t,r){if("word"==e)return C="attribute",p;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||x.autoSelfClosers.hasOwnProperty(n.toLowerCase())?u(r,n.toLowerCase()):(u(r,n.toLowerCase()),r.context=new l(r,n,i==r.indented)),c}return C="error",h}function p(e,t,r){return"equals"==e?m:(x.allowMissing||(C="error"),h(e,t,r))}function m(e,t,r){return"string"==e?g:"word"==e&&x.allowUnquoted?(C="string",h):(C="error",h(e,t,r))}function g(e,t,r){return"string"==e?g:h(e,t,r)}var v=e.indentUnit,y=t.multilineTagIndentFactor||1,b=t.multilineTagIndentPastTag||!0,x=t.htmlMode?{autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0}:{autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1},w=t.alignCDATA,_,k,C;return{startState:function(){return{tokenize:r,state:c,indented:0,tagName:null,tagStart:null,context:null}},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;_=k=null;var r=t.tokenize(e,t);return(r||k)&&"comment"!=r&&(C=null,t.state=t.state(k||r,e,t),C&&(r="error"==C?r+" error":C)),r},indent:function(e,t,i){var o=e.context;if(e.tokenize.isInAttribute)return e.stringStartCol+1;if(o&&o.noIndent)return CodeMirror.Pass;if(e.tokenize!=n&&e.tokenize!=r)return i?i.match(/^(\s*)/)[0].length:0;if(e.tagName)return b?e.tagStart+e.tagName.length+2:e.tagStart+v*y;if(w&&/<!\[CDATA\[/.test(t))return 0;for(o&&/^<\//.test(t)&&(o=o.prev);o&&!o.startOfLine;)o=o.prev;return o?o.indent+v:0},electricChars:"/",blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:t.htmlMode?"html":"xml",helperType:t.htmlMode?"html":"xml"}}),CodeMirror.defineMIME("text/xml","xml"),CodeMirror.defineMIME("application/xml","xml"),CodeMirror.mimeModes.hasOwnProperty("text/html")||CodeMirror.defineMIME("text/html",{name:"xml",htmlMode:!0}),CodeMirror.defineMode("javascript",function(e,t){function r(e){for(var t=!1,r,n=!1;null!=(r=e.next());){if(!t){if("/"==r&&!n)return;"["==r?n=!0:n&&"]"==r&&(n=!1)}t=!t&&"\\"==r}}function n(e,t,r){return bt=e,xt=r,t}function i(e,t){var i=e.next();if('"'==i||"'"==i)return t.tokenize=o(i),t.tokenize(e,t);if("."==i&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return n("number","number");if("."==i&&e.match(".."))return n("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(i))return n(i);if("="==i&&e.eat(">"))return n("=>","operator");if("0"==i&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),n("number","number");if(/\d/.test(i))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),n("number","number");if("/"==i)return e.eat("*")?(t.tokenize=a,a(e,t)):e.eat("/")?(e.skipToEnd(),n("comment","comment")):"operator"==t.lastType||"keyword c"==t.lastType||"sof"==t.lastType||/^[\[{}\(,;:]$/.test(t.lastType)?(r(e),e.eatWhile(/[gimy]/),n("regexp","string-2")):(e.eatWhile(yt),n("operator","operator",e.current()));if("`"==i)return t.tokenize=l,l(e,t);if("#"==i)return e.skipToEnd(),n("error","error");if(yt.test(i))return e.eatWhile(yt),n("operator","operator",e.current());e.eatWhile(/[\w\$_]/);var s=e.current(),u=vt.propertyIsEnumerable(s)&&vt[s];return u&&"."!=t.lastType?n(u.type,u.style,s):n("variable","variable",s)}function o(e){return function(t,r){for(var o=!1,a;null!=(a=t.next())&&(a!=e||o);)o=!o&&"\\"==a;return o||(r.tokenize=i),n("string","string")}}function a(e,t){for(var r=!1,o;o=e.next();){if("/"==o&&r){t.tokenize=i;break}r="*"==o}return n("comment","comment")}function l(e,t){for(var r=!1,o;null!=(o=e.next());){if(!r&&("`"==o||"$"==o&&e.eat("{"))){t.tokenize=i;break}r=!r&&"\\"==o}return n("quasi","string-2",e.current())}function s(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(0>r)){for(var n=0,i=!1,o=r-1;o>=0;--o){var a=e.string.charAt(o),l=wt.indexOf(a);if(l>=0&&3>l){if(!n){++o;break}if(0==--n)break}else if(l>=3&&6>l)++n;else if(/[$\w]/.test(a))i=!0;else if(i&&!n){++o;break}}i&&!n&&(t.fatArrowAt=o)}}function u(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function c(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function f(e,t,r,n,i){var o=e.cc;for(kt.state=e,kt.stream=i,kt.marked=null,kt.cc=o,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():mt?w:x;if(a(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return kt.marked?kt.marked:"variable"==r&&c(e,n)?"variable-2":t}}}function d(){for(var e=arguments.length-1;e>=0;e--)kt.cc.push(arguments[e])}function h(){return d.apply(null,arguments),!0}function p(e){function r(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var n=kt.state;if(n.context){if(kt.marked="def",r(n.localVars))return;n.localVars={name:e,next:n.localVars}}else{if(r(n.globalVars))return;t.globalVars&&(n.globalVars={name:e,next:n.globalVars})}}function m(){kt.state.context={prev:kt.state.context,vars:kt.state.localVars},kt.state.localVars=Ct}function g(){kt.state.localVars=kt.state.context.vars,kt.state.context=kt.state.context.prev}function v(e,t){var r=function(){var r=kt.state,n=r.indented;"stat"==r.lexical.type&&(n=r.lexical.indented),r.lexical=new u(n,kt.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function y(){var e=kt.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function b(e){return function(t){return t==e?h():";"==e?d():h(arguments.callee)}}function x(e,t){return"var"==e?h(v("vardef",t.length),R,b(";"),y):"keyword a"==e?h(v("form"),w,x,y):"keyword b"==e?h(v("form"),x,y):"{"==e?h(v("}"),P,y):";"==e?h():"if"==e?h(v("form"),w,x,y,U):"function"==e?h(et):"for"==e?h(v("form"),X,x,y):"variable"==e?h(v("stat"),W):"switch"==e?h(v("form"),w,v("}","switch"),b("{"),P,y,y):"case"==e?h(w,b(":")):"default"==e?h(b(":")):"catch"==e?h(v("form"),m,b("("),tt,b(")"),x,y,g):"module"==e?h(v("form"),m,ot,g,y):"class"==e?h(v("form"),rt,it,y):"export"==e?h(v("form"),at,y):"import"==e?h(v("form"),lt,y):d(v("stat"),w,b(";"),y)}function w(e){return k(e,!1)}function _(e){return k(e,!0)}function k(e,t){if(kt.state.fatArrowAt==kt.stream.start){var r=t?N:z;if("("==e)return h(m,v(")"),I(B,")"),y,b("=>"),r,g);if("variable"==e)return d(m,B,b("=>"),r,g)}var n=t?S:L;return _t.hasOwnProperty(e)?h(n):"function"==e?h(et):"keyword c"==e?h(t?M:C):"("==e?h(v(")"),C,dt,b(")"),y,n):"operator"==e||"spread"==e?h(t?_:w):"["==e?h(v("]"),ct,y,n):"{"==e?q(E,"}",null,n):h()}function C(e){return e.match(/[;\}\)\],]/)?d():d(w)}function M(e){return e.match(/[;\}\)\],]/)?d():d(_)}function L(e,t){return","==e?h(w):S(e,t,!1)}function S(e,t,r){var n=0==r?L:S,i=0==r?w:_;return"=>"==t?h(m,r?N:z,g):"operator"==e?/\+\+|--/.test(t)?h(n):"?"==t?h(w,b(":"),i):h(i):"quasi"==e?(kt.cc.push(n),T(t)):";"!=e?"("==e?q(_,")","call",n):"."==e?h(H,n):"["==e?h(v("]"),C,b("]"),y,n):void 0:void 0}function T(e){return"${"!=e.slice(e.length-2)?h():h(w,A)}function A(e){return"}"==e?(kt.marked="string-2",kt.state.tokenize=l,h()):void 0}function z(e){return s(kt.stream,kt.state),d("{"==e?x:w)}function N(e){return s(kt.stream,kt.state),d("{"==e?x:_)}function W(e){return":"==e?h(y,x):d(L,b(";"),y)}function H(e){return"variable"==e?(kt.marked="property",h()):void 0}function E(e,t){if("variable"==e){if(kt.marked="property","get"==t||"set"==t)return h(O)}else if("number"==e||"string"==e)kt.marked=e+" property";else if("["==e)return h(w,b("]"),D);return _t.hasOwnProperty(e)?h(D):void 0}function O(e){return"variable"!=e?d(D):(kt.marked="property",h(et))}function D(e){return":"==e?h(_):"("==e?d(et):void 0}function I(e,t){function r(n){if(","==n){var i=kt.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),h(e,r)}return n==t?h():h(b(t))}return function(n){return n==t?h():d(e,r)}}function q(e,t,r){for(var n=3;n<arguments.length;n++)kt.cc.push(arguments[n]);return h(v(t,r),I(e,t),y)}function P(e){return"}"==e?h():d(x,P)}function F(e){return gt&&":"==e?h(V):void 0}function V(e){return"variable"==e?(kt.marked="variable-3",h()):void 0}function R(){return d(B,F,j,K)}function B(e,t){return"variable"==e?(p(t),h()):"["==e?q(B,"]"):"{"==e?q(G,"}"):void 0}function G(e,t){return"variable"!=e||kt.stream.match(/^\s*:/,!1)?("variable"==e&&(kt.marked="property"),h(b(":"),B,j)):(p(t),h(j))}function j(e,t){return"="==t?h(_):void 0}function K(e){return","==e?h(R):void 0}function U(e,t){return"keyword b"==e&&"else"==t?h(v("form"),x,y):void 0}function X(e){return"("==e?h(v(")"),Y,b(")"),y):void 0}function Y(e){return"var"==e?h(R,b(";"),Q):";"==e?h(Q):"variable"==e?h(Z):d(w,b(";"),Q)}function Z(e,t){return"in"==t||"of"==t?(kt.marked="keyword",h(w)):h(L,Q)}function Q(e,t){return";"==e?h(J):"in"==t||"of"==t?(kt.marked="keyword",h(w)):d(w,b(";"),J)}function J(e){")"!=e&&h(w)}function et(e,t){return"*"==t?(kt.marked="keyword",h(et)):"variable"==e?(p(t),h(et)):"("==e?h(m,v(")"),I(tt,")"),y,x,g):void 0}function tt(e){return"spread"==e?h(tt):d(B,F)}function rt(e,t){return"variable"==e?(p(t),h(nt)):void 0}function nt(e,t){return"extends"==t?h(w):void 0}function it(e){return"{"==e?q(E,"}"):void 0}function ot(e,t){return"string"==e?h(x):"variable"==e?(p(t),h(ut)):void 0}function at(e,t){return"*"==t?(kt.marked="keyword",h(ut,b(";"))):"default"==t?(kt.marked="keyword",h(w,b(";"))):d(x)}function lt(e){return"string"==e?h():d(st,ut)}function st(e,t){return"{"==e?q(st,"}"):("variable"==e&&p(t),h())}function ut(e,t){return"from"==t?(kt.marked="keyword",h(w)):void 0}function ct(e){return"]"==e?h():d(_,ft)}function ft(e){return"for"==e?d(dt,b("]")):","==e?h(I(_,"]")):d(I(_,"]"))}function dt(e){return"for"==e?h(X,dt):"if"==e?h(w,dt):void 0}var ht=e.indentUnit,pt=t.statementIndent,mt=t.json,gt=t.typescript,vt=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("operator"),o={type:"atom",style:"atom"},a={"if":e("if"),"while":t,"with":t,"else":r,"do":r,"try":r,"finally":r,"return":n,"break":n,"continue":n,"new":n,"delete":n,"throw":n,"debugger":n,"var":e("var"),"const":e("var"),let:e("var"),"function":e("function"),"catch":e("catch"),"for":e("for"),"switch":e("switch"),"case":e("case"),"default":e("default"),"in":i,"typeof":i,"instanceof":i,"true":o,"false":o,"null":o,undefined:o,NaN:o,Infinity:o,"this":e("this"),module:e("module"),"class":e("class"),"super":e("atom"),"yield":n,"export":e("export"),"import":e("import"),"extends":n};if(gt){var l={type:"variable",style:"variable-3"},s={"interface":e("interface"),"extends":e("extends"),constructor:e("constructor"),"public":e("public"),"private":e("private"),"protected":e("protected"),"static":e("static"),string:l,number:l,bool:l,any:l};for(var u in s)a[u]=s[u]}return a}(),yt=/[+\-*&%=<>!?|~^]/,bt,xt,wt="([{}])",_t={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0},kt={state:null,column:null,marked:null,cc:null},Ct={name:"this",next:{name:"arguments"}};return y.lex=!0,{startState:function(e){var r={tokenize:i,lastType:"sof",cc:[],lexical:new u((e||0)-ht,0,"block",!1),localVars:t.localVars,context:t.localVars&&{vars:t.localVars},indented:0};
|
5 |
+
return t.globalVars&&(r.globalVars=t.globalVars),r},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),s(e,t)),t.tokenize!=a&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==bt?r:(t.lastType="operator"!=bt||"++"!=xt&&"--"!=xt?bt:"incdec",f(t,r,bt,xt,e))},indent:function(e,r){if(e.tokenize==a)return CodeMirror.Pass;if(e.tokenize!=i)return 0;for(var n=r&&r.charAt(0),o=e.lexical,l=e.cc.length-1;l>=0;--l){var s=e.cc[l];if(s==y)o=o.prev;else if(s!=U)break}"stat"==o.type&&"}"==n&&(o=o.prev),pt&&")"==o.type&&"stat"==o.prev.type&&(o=o.prev);var u=o.type,c=n==u;return"vardef"==u?o.indented+("operator"==e.lastType||","==e.lastType?o.info+1:0):"form"==u&&"{"==n?o.indented:"form"==u?o.indented+ht:"stat"==u?o.indented+("operator"==e.lastType||","==e.lastType?pt||ht:0):"switch"!=o.info||c||0==t.doubleIndentSwitch?o.align?o.column+(c?0:1):o.indented+(c?0:ht):o.indented+(/^(?:case|default)\b/.test(r)?ht:2*ht)},electricChars:":{}",blockCommentStart:mt?null:"/*",blockCommentEnd:mt?null:"*/",lineComment:mt?null:"//",fold:"brace",helperType:mt?"json":"javascript",jsonMode:mt}}),CodeMirror.defineMIME("text/javascript","javascript"),CodeMirror.defineMIME("text/ecmascript","javascript"),CodeMirror.defineMIME("application/javascript","javascript"),CodeMirror.defineMIME("application/ecmascript","javascript"),CodeMirror.defineMIME("application/json",{name:"javascript",json:!0}),CodeMirror.defineMIME("application/x-json",{name:"javascript",json:!0}),CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:!0}),CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:!0}),CodeMirror.defineMode("css",function(e,t){function r(e,t){return w=t,e}function n(e,t){var n=e.next();if(h[n]){var a=h[n](e,t);if(a!==!1)return a}return"@"==n?(e.eatWhile(/[\w\\\-]/),r("def",e.current())):"="==n||("~"==n||"|"==n)&&e.eat("=")?r(null,"compare"):'"'==n||"'"==n?(t.tokenize=i(n),t.tokenize(e,t)):"#"==n?(e.eatWhile(/[\w\\\-]/),r("atom","hash")):"!"==n?(e.match(/^\s*\w*/),r("keyword","important")):/\d/.test(n)||"."==n&&e.eat(/\d/)?(e.eatWhile(/[\w.%]/),r("number","unit")):"-"!==n?/[,+>*\/]/.test(n)?r(null,"select-op"):"."==n&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?r("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(n)?r(null,n):"u"==n&&e.match("rl(")?(e.backUp(1),t.tokenize=o,r("property","word")):/[\w\\\-]/.test(n)?(e.eatWhile(/[\w\\\-]/),r("property","word")):r(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),r("number","unit")):e.match(/^[^-]+-/)?r("meta","meta"):void 0}function i(e){return function(t,n){for(var i=!1,o;null!=(o=t.next());){if(o==e&&!i){")"==e&&t.backUp(1);break}i=!i&&"\\"==o}return(o==e||!i&&")"!=e)&&(n.tokenize=null),r("string","string")}}function o(e,t){return e.next(),t.tokenize=e.match(/\s*[\"\']/,!1)?null:i(")"),r(null,"(")}function a(e,t,r){this.type=e,this.indent=t,this.prev=r}function l(e,t,r){return e.context=new a(r,t.indentation()+d,e.context),r}function s(e){return e.context=e.context.prev,e.context.type}function u(e,t,r){return k[r.context.type](e,t,r)}function c(e,t,r,n){for(var i=n||1;i>0;i--)r.context=r.context.prev;return u(e,t,r)}function f(e){var t=e.current().toLowerCase();_=y.hasOwnProperty(t)?"atom":v.hasOwnProperty(t)?"keyword":"variable"}t.propertyKeywords||(t=CodeMirror.resolveMode("text/css"));var d=e.indentUnit,h=t.tokenHooks,p=t.mediaTypes||{},m=t.mediaFeatures||{},g=t.propertyKeywords||{},v=t.colorKeywords||{},y=t.valueKeywords||{},b=t.fontProperties||{},x=t.allowNested,w,_,k={};return k.top=function(e,t,r){if("{"==e)return l(r,t,"block");if("}"==e&&r.context.prev)return s(r);if("@media"==e)return l(r,t,"media");if("@font-face"==e)return"font_face_before";if(e&&"@"==e.charAt(0))return l(r,t,"at");if("hash"==e)_="builtin";else if("word"==e)_="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return l(r,t,"interpolation");if(":"==e)return"pseudo";if(x&&"("==e)return l(r,t,"params")}return r.context.type},k.block=function(e,t,r){return"word"==e?g.hasOwnProperty(t.current().toLowerCase())?(_="property","maybeprop"):x?(_=t.match(/^\s*:/,!1)?"property":"tag","block"):(_+=" error","maybeprop"):"meta"==e?"block":x||"hash"!=e&&"qualifier"!=e?k.top(e,t,r):(_="error","block")},k.maybeprop=function(e,t,r){return":"==e?l(r,t,"prop"):u(e,t,r)},k.prop=function(e,t,r){if(";"==e)return s(r);if("{"==e&&x)return l(r,t,"propBlock");if("}"==e||"{"==e)return c(e,t,r);if("("==e)return l(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t.current())){if("word"==e)f(t);else if("interpolation"==e)return l(r,t,"interpolation")}else _+=" error";return"prop"},k.propBlock=function(e,t,r){return"}"==e?s(r):"word"==e?(_="property","maybeprop"):r.context.type},k.parens=function(e,t,r){return"{"==e||"}"==e?c(e,t,r):")"==e?s(r):"parens"},k.pseudo=function(e,t,r){return"word"==e?(_="variable-3",r.context.type):u(e,t,r)},k.media=function(e,t,r){if("("==e)return l(r,t,"media_parens");if("}"==e)return c(e,t,r);if("{"==e)return s(r)&&l(r,t,x?"block":"top");if("word"==e){var n=t.current().toLowerCase();_="only"==n||"not"==n||"and"==n?"keyword":p.hasOwnProperty(n)?"attribute":m.hasOwnProperty(n)?"property":"error"}return r.context.type},k.media_parens=function(e,t,r){return")"==e?s(r):"{"==e||"}"==e?c(e,t,r,2):k.media(e,t,r)},k.font_face_before=function(e,t,r){return"{"==e?l(r,t,"font_face"):u(e,t,r)},k.font_face=function(e,t,r){return"}"==e?s(r):"word"==e?(_=b.hasOwnProperty(t.current().toLowerCase())?"property":"error","maybeprop"):"font_face"},k.at=function(e,t,r){return";"==e?s(r):"{"==e||"}"==e?c(e,t,r):("word"==e?_="tag":"hash"==e&&(_="builtin"),"at")},k.interpolation=function(e,t,r){return"}"==e?s(r):"{"==e||";"==e?c(e,t,r):("variable"!=e&&(_="error"),"interpolation")},k.params=function(e,t,r){return")"==e?s(r):"{"==e||"}"==e?c(e,t,r):("word"==e&&f(t),"params")},{startState:function(e){return{tokenize:null,state:"top",context:new a("top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||n)(e,t);return r&&"object"==typeof r&&(w=r[1],r=r[0]),_=r,t.state=k[t.state](w,e,t),_},indent:function(e,t){var r=e.context,n=t&&t.charAt(0),i=r.indent;return!r.prev||("}"!=n||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"font_face"!=r.type)&&(")"!=n||"parens"!=r.type&&"params"!=r.type&&"media_parens"!=r.type)&&("{"!=n||"at"!=r.type&&"media"!=r.type)||(i=r.indent-d,r=r.prev),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}}),function(){function e(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=!0;return t}function t(e,t){for(var r=!1,n;null!=(n=e.next());){if(r&&"/"==n){t.tokenize=null;break}r="*"==n}return["comment","comment"]}function r(e,t){return e.skipTo("-->")?(e.match("-->"),t.tokenize=null):e.skipToEnd(),["comment","comment"]}var n=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],i=e(n),o=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"],a=e(o),l=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid-cell","grid-column","grid-column-align","grid-column-sizing","grid-column-span","grid-columns","grid-flow","grid-row","grid-row-align","grid-row-sizing","grid-row-span","grid-rows","grid-template","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-inside","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","zoom","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-profile","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","kerning","text-anchor","writing-mode"],s=e(l),u=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],c=e(u),f=["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small"],d=e(f),h=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],p=e(h),m=n.concat(o).concat(l).concat(u).concat(f);CodeMirror.registerHelper("hintWords","css",m),CodeMirror.defineMIME("text/css",{mediaTypes:i,mediaFeatures:a,propertyKeywords:s,colorKeywords:c,valueKeywords:d,fontProperties:p,tokenHooks:{"<":function(e,t){return e.match("!--")?(t.tokenize=r,r(e,t)):!1},"/":function(e,r){return e.eat("*")?(r.tokenize=t,t(e,r)):!1}},name:"css"}),CodeMirror.defineMIME("text/x-scss",{mediaTypes:i,mediaFeatures:a,propertyKeywords:s,colorKeywords:c,valueKeywords:d,fontProperties:p,allowNested:!0,tokenHooks:{"/":function(e,r){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(r.tokenize=t,t(e,r)):["operator","operator"]},":":function(e){return e.match(/\s*{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),CodeMirror.defineMIME("text/x-less",{mediaTypes:i,mediaFeatures:a,propertyKeywords:s,colorKeywords:c,valueKeywords:d,fontProperties:p,allowNested:!0,tokenHooks:{"/":function(e,r){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(r.tokenize=t,t(e,r)):["operator","operator"]},"@":function(e){return e.match(/^(charset|document|font-face|import|keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"})}(),CodeMirror.defineMode("htmlmixed",function(e,t){function r(e,t){var r=t.htmlState.tagName,n=a.token(e,t.htmlState);if("script"==r&&/\btag\b/.test(n)&&">"==e.current()){var u=e.string.slice(Math.max(0,e.pos-100),e.pos).match(/\btype\s*=\s*("[^"]+"|'[^']+'|\S+)[^<]*$/i);u=u?u[1]:"",u&&/[\"\']/.test(u.charAt(0))&&(u=u.slice(1,u.length-1));for(var c=0;c<s.length;++c){var f=s[c];if("string"==typeof f.matches?u==f.matches:f.matches.test(u)){f.mode&&(t.token=i,t.localMode=f.mode,t.localState=f.mode.startState&&f.mode.startState(a.indent(t.htmlState,"")));break}}}else"style"==r&&/\btag\b/.test(n)&&">"==e.current()&&(t.token=o,t.localMode=l,t.localState=l.startState(a.indent(t.htmlState,"")));return n}function n(e,t,r){var n=e.current(),i=n.search(t),o;return i>-1?e.backUp(n.length-i):(o=n.match(/<\/?$/))&&(e.backUp(n.length),e.match(t,!1)||e.match(n)),r}function i(e,t){return e.match(/^<\/\s*script\s*>/i,!1)?(t.token=r,t.localState=t.localMode=null,r(e,t)):n(e,/<\/\s*script\s*>/,t.localMode.token(e,t.localState))}function o(e,t){return e.match(/^<\/\s*style\s*>/i,!1)?(t.token=r,t.localState=t.localMode=null,r(e,t)):n(e,/<\/\s*style\s*>/,l.token(e,t.localState))}var a=CodeMirror.getMode(e,{name:"xml",htmlMode:!0}),l=CodeMirror.getMode(e,"css"),s=[],u=t&&t.scriptTypes;if(s.push({matches:/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^$/i,mode:CodeMirror.getMode(e,"javascript")}),u)for(var c=0;c<u.length;++c){var f=u[c];s.push({matches:f.matches,mode:f.mode&&CodeMirror.getMode(e,f.mode)})}return s.push({matches:/./,mode:CodeMirror.getMode(e,"text/plain")}),{startState:function(){var e=a.startState();return{token:r,localMode:null,localState:null,htmlState:e}},copyState:function(e){if(e.localState)var t=CodeMirror.copyState(e.localMode,e.localState);return{token:e.token,localMode:e.localMode,localState:t,htmlState:CodeMirror.copyState(a,e.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(e,t){return!e.localMode||/^\s*<\//.test(t)?a.indent(e.htmlState,t):e.localMode.indent?e.localMode.indent(e.localState,t):CodeMirror.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||a}}}},"xml","javascript","css"),CodeMirror.defineMIME("text/html","htmlmixed"),function(){function e(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function t(e){return function(t,r){return t.match(e)?r.tokenize=null:t.skipToEnd(),"string"}}var r={name:"clike",keywords:e("abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally"),blockKeywords:e("catch do else elseif for foreach if switch try while finally"),atoms:e("true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__"),builtin:e("func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once"),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"
|
6 |
+
},"<":function(e,r){return e.match(/<</)?(e.eatWhile(/[\w\.]/),r.tokenize=t(e.current().slice(3)),r.tokenize(e,r)):!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1}}};CodeMirror.defineMode("php",function(e,t){function n(e,t){var r=t.curMode==o;if(e.sol()&&t.pending&&'"'!=t.pending&&"'"!=t.pending&&(t.pending=null),r)return r&&null==t.php.tokenize&&e.match("?>")?(t.curMode=i,t.curState=t.html,"meta"):o.token(e,t.curState);if(e.match(/^<\?\w*/))return t.curMode=o,t.curState=t.php,"meta";if('"'==t.pending||"'"==t.pending){for(;!e.eol()&&e.next()!=t.pending;);var n="string"}else if(t.pending&&e.pos<t.pending.end){e.pos=t.pending.end;var n=t.pending.style}else var n=i.token(e,t.curState);t.pending&&(t.pending=null);var a=e.current(),l=a.search(/<\?/),s;return-1!=l&&(t.pending="string"==n&&(s=a.match(/[\'\"]$/))&&!/\?>/.test(a)?s[0]:{end:e.pos,style:n},e.backUp(a.length-l)),n}var i=CodeMirror.getMode(e,"text/html"),o=CodeMirror.getMode(e,r);return{startState:function(){var e=CodeMirror.startState(i),r=CodeMirror.startState(o);return{html:e,php:r,curMode:t.startOpen?o:i,curState:t.startOpen?r:e,pending:null}},copyState:function(e){var t=e.html,r=CodeMirror.copyState(i,t),n=e.php,a=CodeMirror.copyState(o,n),l;return l=e.curMode==i?r:a,{html:r,php:a,curMode:e.curMode,curState:l,pending:e.pending}},token:n,indent:function(e,t){return e.curMode!=o&&/^\s*<\//.test(t)||e.curMode==o&&/^\?>/.test(t)?i.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),CodeMirror.defineMIME("application/x-httpd-php","php"),CodeMirror.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),CodeMirror.defineMIME("text/x-php",r)}();
|
assets/js/min/editor-min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function($){$(function(){var e=soliloquy_editor_frame=!1,l=function(l){l.preventDefault(),$(".soliloquy-default-ui .selected").removeClass("details selected"),$(".soliloquy-default-ui").appendTo(".soliloquy-default-ui-wrapper").hide(),e=soliloquy_editor_frame=!1};$(document).on("click",".soliloquy-choose-slider, .soliloquy-modal-trigger",function(o){o.preventDefault(),e=o.target,soliloquy_editor_frame=!0,$(".soliloquy-default-ui").appendTo("body").show(),$(document).on("click",".media-modal-close, .media-modal-backdrop, .soliloquy-cancel-insertion",l),$(document).on("keydown",function(e){27==e.keyCode&&soliloquy_editor_frame&&l(e)})}),$(document).on("click",".soliloquy-default-ui .thumbnail, .soliloquy-default-ui .check, .soliloquy-default-ui .media-modal-icon",function(e){e.preventDefault(),$(this).parent().parent().hasClass("selected")?($(this).parent().parent().removeClass("details selected"),$(".soliloquy-insert-slider").attr("disabled","disabled")):($(this).parent().parent().parent().find(".selected").removeClass("details selected"),$(this).parent().parent().addClass("details selected"),$(".soliloquy-insert-slider").removeAttr("disabled"))}),$(document).on("click",".soliloquy-default-ui .check",function(e){e.preventDefault(),$(this).parent().parent().removeClass("details selected"),$(".soliloquy-insert-slider").attr("disabled","disabled")}),$(document).on("click",".soliloquy-default-ui .soliloquy-insert-slider",function(o){if(o.preventDefault(),$(e).hasClass("soliloquy-choose-slider"))wp.media.editor.insert('[soliloquy id="'+$(".soliloquy-default-ui .selected").data("soliloquy-id")+'"]');else{var i={action:"soliloquy_load_slider_data",id:$(".soliloquy-default-ui:first .selected").data("soliloquy-id")};$.post(ajaxurl,i,function(e){$(document).trigger({type:"soliloquySliderModalData",slider:e}),l(o)},"json")}l(o)})})}(jQuery);
|
assets/js/min/metabox-min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function($){$(function(){function o(o){var l="";return l+='<div class="soliloquy-video-slide-holder"><p class="no-margin-top"><a href="#" class="button button-secondary soliloquy-delete-video-slide" title="'+soliloquy_metabox.removeslide+'">'+soliloquy_metabox.removeslide+'</a><label for="soliloquy-video-slide-'+o+'-title"><strong>'+soliloquy_metabox.videoslide+'</strong></label><br /><input type="text" class="soliloquy-video-slide-title" id="soliloquy-video-slide-'+o+'-title" value="" placeholder="'+soliloquy_metabox.videoplace+'" /></p><p><label for="soliloquy-video-slide-'+o+'"><strong>'+soliloquy_metabox.videotitle+'</strong></label><br /><input type="text" class="soliloquy-video-slide-url" id="soliloquy-video-slide-'+o+'" value="" placeholder="'+soliloquy_metabox.videooutput+'" /></p><p><label for="soliloquy-video-slide-'+o+'-thumbnail"><strong>'+soliloquy_metabox.videothumb+'</strong></label><br /><input type="text" class="soliloquy-video-slide-thumbnail" id="soliloquy-video-slide-'+o+'-thumbnail" value="" placeholder="'+soliloquy_metabox.videosrc+'" /> <span><a href="#" class="soliloquy-video-thumbnail button button-primary">'+soliloquy_metabox.videoselect+'</a> <a href="#" class="soliloquy-video-thumbnail-delete button button-secondary">'+soliloquy_metabox.videodelete+'</a></span></p><p class="no-margin-bottom"><label for="soliloquy-video-slide-'+o+'-caption"><strong>'+soliloquy_metabox.videocaption+'</strong></label><br /><textarea class="soliloquy-video-slide-caption" id="soliloquy-video-slide-'+o+'-caption"></textarea></p></div>'}function l(o){var l="";return l+='<div class="soliloquy-html-slide-holder"><p class="no-margin-top"><a href="#" class="button button-secondary soliloquy-delete-html-slide" title="'+soliloquy_metabox.removeslide+'">'+soliloquy_metabox.removeslide+'</a><label for="soliloquy-html-slide-'+o+'-title"><strong>'+soliloquy_metabox.htmlslide+'</strong></label><br /><input type="text" class="soliloquy-html-slide-title" id="soliloquy-html-slide-'+o+'-title" value="" placeholder="'+soliloquy_metabox.htmlplace+'" /></p><p class="no-margin-bottom"><label for="soliloquy-html-slide-'+o+'"><strong>'+soliloquy_metabox.htmlcode+'</strong></label><br /><textarea class="soliloquy-html-slide-code" id="soliloquy-html-slide-'+o+'">'+soliloquy_metabox.htmlstart+'</textarea><p><label for="soliloquy-html-slide-'+o+'-thumbnail"><strong>'+soliloquy_metabox.htmlthumb+'</strong></label><br /><input type="text" class="soliloquy-html-slide-thumbnail" id="soliloquy-html-slide-'+o+'-thumbnail" value="" placeholder="'+soliloquy_metabox.htmlsrc+'" /> <span><a href="#" class="soliloquy-html-thumbnail button button-primary">'+soliloquy_metabox.htmlselect+'</a> <a href="#" class="soliloquy-html-thumbnail-delete button button-secondary">'+soliloquy_metabox.htmldelete+"</a></span></p></div>"}function e(){var o={action:"soliloquy_refresh",post_id:soliloquy_metabox.id,nonce:soliloquy_metabox.refresh_nonce};$(".max-upload-size").after('<span class="spinner soliloquy-spinner soliloquy-spinner-refresh"></span>'),$(".soliloquy-spinner-refresh").css({display:"inline-block","margin-top":"-3px"}),$.post(soliloquy_metabox.ajax,o,function(o){o&&o.success&&($("#soliloquy-output").html(o.success),$("#soliloquy-output").find(".wp-editor-wrap").each(function(o,l){var e=$(l).find(".quicktags-toolbar");if(!(e.length>0)){var i=$(l).attr("id").split("-"),t=i.slice(3,-1).join("-");quicktags({id:"soliloquy-caption-"+t,buttons:"strong,em,link,ul,ol,li,close"}),QTags._buttonsInit()}}),$(".soliloquy-html").find(".soliloquy-html-code").each(function(o,l){var e=$(l).attr("id");p[e]=CodeMirror.fromTextArea(l,{enterMode:"keep",indentUnit:4,electricChars:!1,lineNumbers:!0,lineWrapping:!0,matchBrackets:!0,mode:"php",smartIndent:!1,tabMode:"shift",theme:"solarized dark"}),p[e].on("blur",function(o){$("#"+e).text(o.getValue())}),p[e].refresh()}),$("#soliloquy-output").trigger({type:"soliloquyRefreshed",html:o.success,id:soliloquy_metabox.id})),$(".soliloquy-spinner-refresh").fadeOut(300,function(){$(this).remove()})},"json")}function i(){var o=$("#soliloquy-config-mobile");o.is(":checked")&&$("#soliloquy-config-mobile-size-box").fadeIn(300),o.on("change",function(){$(this).is(":checked")?$("#soliloquy-config-mobile-size-box").fadeIn(300):$("#soliloquy-config-mobile-size-box").fadeOut(300)})}function t(){$("#soliloquy .drag-drop-inside").append('<div class="soliloquy-progress-bar"><div></div></div>'),c=new plupload.Uploader(soliloquy_metabox.plupload);var o=$("#soliloquy .soliloquy-progress-bar"),l=$("#soliloquy .soliloquy-progress-bar div"),e=$("#soliloquy-output");c&&(c.bind("Init",function(o){var l=$("#soliloquy-plupload-upload-ui");o.features.dragdrop&&!$(document.body).hasClass("mobile")?(l.addClass("drag-drop"),$("#soliloquy-drag-drop-area").bind("dragover.wp-uploader",function(){l.addClass("drag-over")}).bind("dragleave.wp-uploader, drop.wp-uploader",function(){l.removeClass("drag-over")})):(l.removeClass("drag-drop"),$("#soliloquy-drag-drop-area").unbind(".wp-uploader")),"html4"==o.runtime&&$(".upload-flash-bypass").hide()}),c.init(),c.bind("FilesAdded",function(l,e){var i=104857600,t=parseInt(l.settings.max_file_size,10);$("#soliloquy-upload-error").html(""),$(o).show().css("display","block"),plupload.each(e,function(o){t>i&&o.size>i&&"html5"!=l.runtime&&a(l,o,!0)}),l.refresh(),l.start()}),c.bind("UploadProgress",function(o,e){$(l).css("width",o.total.percent+"%")}),c.bind("FileUploaded",function(o,l,i){$.post(soliloquy_metabox.ajax,{action:"soliloquy_load_image",nonce:soliloquy_metabox.load_image,id:i.response,post_id:soliloquy_metabox.id},function(o){$(e).append(o),$(o).find(".wp-editor-container").each(function(o,l){var e=$(l).attr("id").split("-")[3];quicktags({id:"soliloquy-caption-"+e,buttons:"strong,em,link,ul,ol,li,close"}),QTags._buttonsInit()})},"json")}),c.bind("UploadComplete",function(){$(o).hide().css("display","none"),$(l).removeAttr("style")}),c.bind("Error",function(o,l){var e=104857600,i=$("#soliloquy-upload-error"),t;switch(l){case plupload.FAILED:case plupload.FILE_EXTENSION_ERROR:i.html('<p class="error">'+pluploadL10n.upload_failed+"</p>");break;case plupload.FILE_SIZE_ERROR:a(o,l.file);break;case plupload.IMAGE_FORMAT_ERROR:wpFileError(fileObj,pluploadL10n.not_an_image);break;case plupload.IMAGE_MEMORY_ERROR:wpFileError(fileObj,pluploadL10n.image_memory_exceeded);break;case plupload.IMAGE_DIMENSIONS_ERROR:wpFileError(fileObj,pluploadL10n.image_dimensions_exceeded);break;case plupload.GENERIC_ERROR:wpQueueError(pluploadL10n.upload_failed);break;case plupload.IO_ERROR:t=parseInt(uploader.settings.max_file_size,10),t>e&&fileObj.size>e?wpFileError(fileObj,pluploadL10n.big_upload_failed.replace("%1$s",'<a class="uploader-html" href="#">').replace("%2$s","</a>")):wpQueueError(pluploadL10n.io_error);break;case plupload.HTTP_ERROR:wpQueueError(pluploadL10n.http_error);break;case plupload.INIT_ERROR:$(".media-upload-form").addClass("html-uploader");break;case plupload.SECURITY_ERROR:wpQueueError(pluploadL10n.security_error);break;default:a(o,l.file)}o.refresh()}))}function a(o,l,e){var i;i=e?pluploadL10n.big_upload_queued.replace("%s",l.name)+" "+pluploadL10n.big_upload_failed.replace("%1$s",'<a class="uploader-html" href="#">').replace("%2$s","</a>"):pluploadL10n.file_exceeds_size_limit.replace("%s",l.name),$("#soliloquy-upload-error").html('<div class="error fade"><p>'+i+"</p></div>"),o.removeFile(l)}var s=$("#soliloquy-tabs"),n=$("#soliloquy-tabs-nav"),r=window.location.hash,u=window.location.hash.replace("!","");if(r&&r.indexOf("soliloquy-tab-")>=0){$(".soliloquy-active").removeClass("soliloquy-active"),n.find('li a[href="'+u+'"]').parent().addClass("soliloquy-active"),s.find(u).addClass("soliloquy-active").show();var d=$("#post").attr("action");d&&(d=d.split("#")[0],$("#post").attr("action",d+r))}$(document).on("click","#soliloquy-tabs-nav li a",function(o){o.preventDefault();var l=$(this);if(!l.parent().hasClass("soliloquy-active")){window.location.hash=r=this.hash.split("#").join("#!");var e=n.find(".soliloquy-active").removeClass("soliloquy-active").find("a").attr("href");l.parent().addClass("soliloquy-active"),s.find(e).removeClass("soliloquy-active").hide(),s.find(l.attr("href")).addClass("soliloquy-active").show();var i=$("#post").attr("action");i&&(i=i.split("#")[0],$("#post").attr("action",i+r))}});var c;$('input[name="_soliloquy[type]"]').length>0&&"default"==$('input[name="_soliloquy[type]"]:checked').val()&&t(),i(),0!==$(".soliloquy-helper-needed").length&&$('<div class="soliloquy-meta-helper-overlay" />').prependTo("#soliloquy"),$(document).on("click",".soliloquy-meta-icon",function(o){o.preventDefault();var l=$(this),e=l.parent(),i=l.next();i.is(":visible")?($(".soliloquy-meta-helper-overlay").remove(),e.removeClass("soliloquy-helper-active")):(0===$(".soliloquy-meta-helper-overlay").length&&$('<div class="soliloquy-meta-helper-overlay" />').prependTo("#soliloquy"),e.addClass("soliloquy-helper-active"))}),$(document).on("change",'input[name="_soliloquy[type]"]:radio',function(o){var l=$(this);$(".soliloquy-type-spinner .soliloquy-spinner").css({display:"inline-block","margin-top":"-1px"});var e={action:"soliloquy_change_type",post_id:soliloquy_metabox.id,type:l.val(),nonce:soliloquy_metabox.change_nonce};$.post(soliloquy_metabox.ajax,e,function(o){"default"==o.type?($("#soliloquy-slider-main").html(o.html),t()):$("#soliloquy-slider-main").html(o.html),$(document).trigger("soliloquySliderType",o),$(".soliloquy-type-spinner .soliloquy-spinner").hide()},"json")}),$(document).on("click",".soliloquy-media-library",function(o){o.preventDefault(),q=!0,$("#soliloquy-upload-ui").appendTo("body").show()}),$(".soliloquy-slider").on("click",".thumbnail, .check, .media-modal-icon",function(o){o.preventDefault(),$(this).parent().parent().hasClass("soliloquy-in-slider")||($(this).parent().parent().hasClass("selected")?$(this).parent().parent().removeClass("details selected"):$(this).parent().parent().addClass("details selected"))}),$(document).on("click",".soliloquy-load-library",function(o){o.preventDefault();var l=$(this);l.next().css({display:"inline-block","margin-top":"14px","margin-left":"-5px"});var e={action:"soliloquy_load_library",offset:parseInt(l.attr("data-soliloquy-offset")),post_id:soliloquy_metabox.id,nonce:soliloquy_metabox.load_slider};$.post(soliloquy_metabox.ajax,e,function(o){l.attr("data-soliloquy-offset",parseInt(l.attr("data-soliloquy-offset"))+20),o&&o.html&&l.hasClass("has-search")?($(".soliloquy-slider").html(o.html),l.removeClass("has-search")):$(".soliloquy-slider").append(o.html),l.next().hide()},"json")}),$(document).on("keyup keydown","#soliloquy-slider-search",function(){var o=$(this);o.prev().css({display:"inline-block","margin-top":"1px","vertical-align":"middle","margin-right":"4px"});var l=$(this).val(),e={action:"soliloquy_library_search",nonce:soliloquy_metabox.library_search,post_id:soliloquy_metabox.id,search:l};h(function(){$.post(soliloquy_metabox.ajax,e,function(l){$(".soliloquy-load-library").addClass("has-search").attr("data-soliloquy-offset",parseInt(0)),l&&$(".soliloquy-slider").html(l.html),o.prev().hide()},"json")},"500")}),$(document).on("click",".soliloquy-media-insert",function(o){o.preventDefault();var l=$(this),e=l.text(),i={action:"soliloquy_insert_slides",nonce:soliloquy_metabox.insert_nonce,post_id:soliloquy_metabox.id,images:{},videos:{},html:{}},t=!1,a=!1,s=!1,n=o;l.text(soliloquy_metabox.inserting),$(".soliloquy-media-frame").find(".attachment.selected:not(.soliloquy-in-slider)").each(function(o,l){i.images[o]=$(l).attr("data-attachment-id"),t=!0}),$(".soliloquy-media-frame").find(".soliloquy-video-slide-holder").each(function(o,l){i.videos[o]={title:$(l).find(".soliloquy-video-slide-title").val(),url:$(l).find(".soliloquy-video-slide-url").val(),thumb:$(l).find(".soliloquy-video-slide-thumbnail").val(),caption:$(l).find(".soliloquy-video-slide-caption").val()},a=!0}),$(".soliloquy-media-frame").find(".soliloquy-html-slide-holder").each(function(o,l){i.html[o]={title:$(l).find(".soliloquy-html-slide-title").val(),code:$(l).find(".soliloquy-html-slide-code").val(),thumb:$(l).find(".soliloquy-html-slide-thumbnail").val()},s=!0}),$.post(soliloquy_metabox.ajax,i,function(o){setTimeout(function(){f(n),l.text(e),t&&$(".soliloquy-load-library").attr("data-soliloquy-offset",0).addClass("has-search").trigger("click")},500)},"json")}),$(document).on("click",".soliloquy-media-frame .media-menu-item",function(o){o.preventDefault();var l=$(this),e=l.parent().find(".active").removeClass("active").data("soliloquy-content"),i=l.addClass("active").data("soliloquy-content");$("#soliloquy-"+e).hide(),$("#soliloquy-"+i).show()}),$(document).on("click",".soliloquy-add-video-slide",function(l){l.preventDefault();var e=parseInt($(this).attr("data-soliloquy-video-number")),i="soliloquy-video-slide-"+$(this).attr("data-soliloquy-html-number");$(this).attr("data-soliloquy-video-number",e+1).parent().before(o(e))}),$(document).on("click",".soliloquy-video-thumbnail",function(o){o.preventDefault();var l=wp.media.frames.soliloquy_media_frame=wp.media({className:"media-frame soliloquy-media-frame",frame:"select",multiple:!1,title:soliloquy_metabox.videoframe,library:{type:"image"},button:{text:soliloquy_metabox.videouse}}),e=$(this);l.on("select",function(){var o=l.state().get("selection").first().toJSON();e.parent().prev().val(o.url)}),l.open()}),$(document).on("click",".soliloquy-video-thumbnail-delete",function(o){o.preventDefault(),$(this).parent().prev().val("")}),$(document).on("click","#soliloquy-video-slides .soliloquy-delete-video-slide",function(o){o.preventDefault(),$(this).parent().parent().remove()});var p={};$(".soliloquy-html").find(".soliloquy-html-code").each(function(o,l){var e=$(l).attr("id");p[e]=CodeMirror.fromTextArea(l,{enterMode:"keep",indentUnit:4,electricChars:!1,lineNumbers:!0,lineWrapping:!0,matchBrackets:!0,mode:"php",smartIndent:!1,tabMode:"shift",theme:"solarized dark"}),p[e].on("blur",function(o){$("#"+e).text(o.getValue())}),p[e].refresh()}),$(document).on("click",".soliloquy-add-html-slide",function(o){o.preventDefault();var e=parseInt($(this).attr("data-soliloquy-html-number")),i="soliloquy-html-slide-"+$(this).attr("data-soliloquy-html-number");$(this).attr("data-soliloquy-html-number",e+1).parent().before(l(e)),p[i]=CodeMirror.fromTextArea(document.getElementById(i),{enterMode:"keep",indentUnit:4,electricChars:!1,lineNumbers:!0,lineWrapping:!0,matchBrackets:!0,mode:"php",smartIndent:!1,tabMode:"shift",theme:"solarized dark"}),p[i].on("blur",function(o){$("#"+i).text(o.getValue())}),p[i].refresh()}),$(document).on("click",".soliloquy-html-thumbnail",function(o){o.preventDefault();var l=wp.media.frames.soliloquy_media_frame=wp.media({className:"media-frame soliloquy-media-frame",frame:"select",multiple:!1,title:soliloquy_metabox.htmlframe,library:{type:"image"},button:{text:soliloquy_metabox.htmluse}}),e=$(this);l.on("select",function(){var o=l.state().get("selection").first().toJSON();e.parent().prev().val(o.url)}),l.open()}),$(document).on("click","#soliloquy-html-slides .soliloquy-delete-html-slide",function(o){o.preventDefault(),$(this).parent().parent().remove()}),$(document).on("click",".soliloquy-html-thumbnail-delete",function(o){o.preventDefault(),$(this).parent().prev().val("")});var m=$("#soliloquy-output");m.sortable({containment:"#soliloquy",items:"li",cursor:"move",forcePlaceholderSize:!0,placeholder:"dropzone",update:function(o,l){var e={url:soliloquy_metabox.ajax,type:"post",async:!0,cache:!1,dataType:"json",data:{action:"soliloquy_sort_images",order:m.sortable("toArray").toString(),post_id:soliloquy_metabox.id,nonce:soliloquy_metabox.sort},success:function(o){},error:function(o,l,e){}};$.ajax(e)}}),$(document).on("click","#soliloquy .soliloquy-remove-slide",function(o){o.preventDefault();var l=confirm(soliloquy_metabox.remove);if(l){var e=$(this).parent().attr("id"),i={action:"soliloquy_remove_slide",attachment_id:e,post_id:soliloquy_metabox.id,nonce:soliloquy_metabox.remove_nonce};$.post(soliloquy_metabox.ajax,i,function(o){$("#"+e).fadeOut("normal",function(){$(this).remove(),$(".soliloquy-load-library").attr("data-soliloquy-offset",0).addClass("has-search").trigger("click")})},"json")}});var y=!1;$(document).on("click.soliloquyModify","#soliloquy .soliloquy-modify-slide",function(o){o.preventDefault();var l=$(this).parent().data("soliloquy-slide"),e="soliloquy-meta-"+l;y=!0,$("#"+e).appendTo("body").show(),$.each(p,function(){this.refresh()});var i=function(o){o.preventDefault(),$("#"+e).appendTo("#"+l).hide(),y=!1,$(document).off("click.soliloquyLink")};$(document).on("click.soliloquyIframe",".media-modal-close, .media-modal-backdrop",i),$(document).off("keydown.soliloquyIframe").on("keydown.soliloquyIframe",function(o){27==o.keyCode&&y&&i(o)}),$(document).on("click.soliloquyLink",".ed_button",function(){$("#wp-link-backdrop").css("zIndex","170100"),$("#wp-link-wrap").css("zIndex","171005")})}),$(document).on("click",".soliloquy-meta-submit",function(o){o.preventDefault();var l=$(this),e=l.text(),i=l.data("soliloquy-item"),t="soliloquy-meta-"+i,a={};l.text(soliloquy_metabox.saving),a.caption=$("#soliloquy-meta-table-"+i).find('textarea[name="_soliloquy[meta_caption]"]').val(),$("#soliloquy-meta-table-"+i).find(":input,select").not(".ed_button").each(function(o,l){$(this).data("soliloquy-meta")&&(a[$(this).data("soliloquy-meta")]="checkbox"==$(this).attr("type")||"radio"==$(this).attr("type")?$(this).is(":checked")?1:0:"select"==$(this).attr("type")?$(this).find(":selected").val():$(this).val())});var s={action:"soliloquy_save_meta",nonce:soliloquy_metabox.save_nonce,attach_id:i,post_id:soliloquy_metabox.id,meta:a};$.post(soliloquy_metabox.ajax,s,function(o){setTimeout(function(){$("#"+t).appendTo("#"+i).hide(),l.text(e)},500)},"json")}),$(document).on("click","#soliloquy-import-submit",function(o){$(this).next().css("display","inline-block"),0===$("#soliloquy-config-import-slider").val().length&&(o.preventDefault(),$(this).next().hide(),alert(soliloquy_metabox["import"]))});var h=function(){var o=0;return function(l,e){clearTimeout(o),o=setTimeout(l,e)}}(),q=!1,f=function(o){o.preventDefault(),$("#soliloquy-upload-ui").appendTo("#soliloquy-upload-ui-wrapper").hide(),e(),q=!1};$(document).on("click","#soliloquy-upload-ui .media-modal-close, #soliloquy-upload-ui .media-modal-backdrop",f),$(document).on("keydown",function(o){27==o.keyCode&&q&&f(o)})})}(jQuery);
|
assets/js/min/settings-min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function($){$(function(){var i=$("#soliloquy-tabs"),o=$("#soliloquy-tabs-nav"),a=window.location.hash,l=window.location.hash.replace("!","");a&&a.indexOf("soliloquy-tab-")>=0&&($(".soliloquy-active").removeClass("soliloquy-active nav-tab-active"),o.find('a[href="'+l+'"]').addClass("soliloquy-active nav-tab-active"),i.find(l).addClass("soliloquy-active").show()),$("#soliloquy-tabs-nav a").on("click",function(l){l.preventDefault();var s=$(this);if(!s.hasClass("soliloquy-active")){window.location.hash=a=this.hash.split("#").join("#!");var t=o.find(".soliloquy-active").removeClass("soliloquy-active nav-tab-active").attr("href");s.addClass("soliloquy-active nav-tab-active"),i.find(t).removeClass("soliloquy-active").hide(),i.find(s.attr("href")).addClass("soliloquy-active").show()}}),$(".soliloquy-start-upgrade").on("click",function(i){i.preventDefault();var o=$(this);$(".soliloquy-spinner").css({display:"inline-block","float":"none","vertical-align":"text-bottom"});var a={action:"soliloquy_upgrade_sliders",nonce:soliloquy_settings.upgrade_nonce};$.post(soliloquy_settings.ajax,a,function(i){$(".soliloquy-spinner").hide(),window.location.replace(soliloquy_settings.redirect)},"json")})})}(jQuery);
|
assets/js/min/soliloquy-min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
function soliloquyIsMobile(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)}(navigator.userAgent||navigator.vendor||window.opera),e}function soliloquyYouTubeVids(e,t,i,s,n,$){$("#"+n).show().css({display:"block","z-index":"1210"}),YT.Player&&(soliloquy_youtube[t]=new YT.Player(n,{videoId:t,playerVars:e,events:{onStateChange:soliloquyYouTubeOnStateChange}}))}function soliloquyYouTubeOnStateChange(e){var t=jQuery(e.target.a).data("soliloquy-slider-id");(e.data===YT.PlayerState.PAUSED||e.data===YT.PlayerState.ENDED)&&soliloquy_slider[t]&&soliloquy_slider[t].startAuto(),e.data===YT.PlayerState.PLAYING&&soliloquy_slider[t]&&soliloquy_slider[t].stopAuto()}function onYouTubeIframeAPIReady(){}function soliloquyVimeoVids(e,t,i,s,n,$){if($("#"+n).show().css({display:"block","z-index":"1210"}),$f){var o={};$.each($("#"+n)[0].attributes,function(e,t){o[t.nodeName]=t.nodeValue}),e.player_id=n,o.src="//player.vimeo.com/video/"+t+"?"+$.param(e),o.frameborder=0,$("#"+n).replaceWith(function(){return $("<iframe />",o).append($(this).contents())}),soliloquy_vimeo[t]=$f($("#"+n)[0]),soliloquy_vimeo[t].addEvent("ready",function(){soliloquy_vimeo[t].addEvent("play",soliloquyVimeoSliderPause),soliloquy_vimeo[t].addEvent("pause",soliloquyVimeoSliderStart),soliloquy_vimeo[t].addEvent("finish",soliloquyVimeoSliderStart)})}}function soliloquyVimeoSliderPause(e){var t=jQuery("#"+e).data("soliloquy-slider-id");soliloquy_slider[t]&&soliloquy_slider[t].stopAuto()}function soliloquyVimeoSliderStart(e){var t=jQuery("#"+e).data("soliloquy-slider-id");soliloquy_slider[t]&&soliloquy_slider[t].startAuto()}function soliloquyWistiaVids(e,t,i,s,n,$){if($("#"+n).show().css({display:"block","z-index":"1210"}),wistiaEmbeds){var o={};$.each($("#"+n)[0].attributes,function(e,t){o[t.nodeName]=t.nodeValue}),e.container=n,o.src="//fast.wistia.net/embed/iframe/"+t+"?"+$.param(e),o.frameborder=0,$("#"+n).replaceWith(function(){return $("<iframe />",o).addClass("wistia_embed").append($(this).contents())}),wistiaEmbeds.onFind(function(e){t==e.hashedId()&&(soliloquy_wistia[t]=e,soliloquy_wistia[t].bind("play",function(){var e=$(this.container).data("soliloquy-slider-id");soliloquy_slider[e]&&soliloquy_slider[e].stopAuto()}),soliloquy_wistia[t].bind("pause",function(){var e=$(this.container).data("soliloquy-slider-id");soliloquy_slider[e]&&soliloquy_slider[e].startAuto()}),soliloquy_wistia[t].bind("end",function(){var e=$(this.container).data("soliloquy-slider-id");soliloquy_slider[e]&&soliloquy_slider[e].startAuto()}),e.play())})}}!function($){var e={},t={keyboard:!1,mode:"horizontal",slideSelector:"",infiniteLoop:!0,hideControlOnEnd:!1,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:!1,captions:!1,ticker:!1,tickerHover:!1,adaptiveHeight:!1,adaptiveHeightSpeed:500,video:!1,useCSS:!0,preloadImages:"visible",responsive:!0,slideZIndex:50,wrapperClass:"soliloquy-wrapper",touchEnabled:!0,swipeThreshold:50,oneToOneTouch:!0,preventDefaultSwipeX:!0,preventDefaultSwipeY:!1,pager:!0,pagerType:"full",pagerShortSeparator:" / ",pagerSelector:null,buildPager:null,pagerCustom:null,controls:!0,nextText:"Next",prevText:"Prev",nextSelector:null,prevSelector:null,autoControls:!1,startText:"Start",stopText:"Stop",autoControlsCombine:!1,autoControlsSelector:null,auto:!1,pause:4e3,autoStart:!0,autoDirection:"next",autoHover:!1,autoDelay:0,autoSlideForOnePage:!1,minSlides:1,maxSlides:1,moveSlides:0,slideWidth:0,onSliderLoad:function(){},onSlideBefore:function(){},onSlideAfter:function(){},onSlideNext:function(){},onSlidePrev:function(){},onSliderResize:function(){}};$.fn.soliloquy=function(s){if(0==this.length)return this;if(this.length>1)return this.each(function(){$(this).soliloquy(s)}),this;var n={},o=this;e.el=this;var a=$(window).width(),l=$(window).height(),r=function(){n.settings=$.extend({},t,s),n.settings.slideWidth=parseInt(n.settings.slideWidth),n.children=o.children(n.settings.slideSelector),n.children.length<n.settings.minSlides&&(n.settings.minSlides=n.children.length),n.children.length<n.settings.maxSlides&&(n.settings.maxSlides=n.children.length),n.settings.randomStart&&(n.settings.startSlide=Math.floor(Math.random()*n.children.length)),n.active={index:n.settings.startSlide},n.carousel=n.settings.minSlides>1||n.settings.maxSlides>1,n.carousel&&(n.settings.preloadImages="all"),n.minThreshold=n.settings.minSlides*n.settings.slideWidth+(n.settings.minSlides-1)*n.settings.slideMargin,n.maxThreshold=n.settings.maxSlides*n.settings.slideWidth+(n.settings.maxSlides-1)*n.settings.slideMargin,n.working=!1,n.controls={},n.interval=null,n.animProp="vertical"==n.settings.mode?"top":"left",n.usingCSS=n.settings.useCSS&&"fade"!=n.settings.mode&&function(){var e=document.createElement("div"),t=["WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var i in t)if(void 0!==e.style[t[i]])return n.cssPrefix=t[i].replace("Perspective","").toLowerCase(),n.animProp="-"+n.cssPrefix+"-transform",!0;return!1}(),"vertical"==n.settings.mode&&(n.settings.maxSlides=n.settings.minSlides),o.data("origStyle",o.attr("style")),o.children(n.settings.slideSelector).each(function(){$(this).data("origStyle",$(this).attr("style"))}),d()},d=function(){o.wrap('<div class="'+n.settings.wrapperClass+'"><div class="soliloquy-viewport"></div></div>'),n.viewport=o.parent(),n.loader=$('<div class="soliloquy-loading" />'),n.viewport.prepend(n.loader),o.css({width:"horizontal"==n.settings.mode?100*n.children.length+215+"%":"auto",position:"relative"}),n.usingCSS&&n.settings.easing?o.css("-"+n.cssPrefix+"-transition-timing-function",n.settings.easing):n.settings.easing||(n.settings.easing="swing");var e=v();n.viewport.css({width:"100%",position:"relative"}),"fade"!=n.settings.mode&&n.viewport.css({overflow:"hidden"}),n.viewport.parent().css({maxWidth:p()}),n.settings.pager||n.viewport.parent().css({margin:"0 auto 0px"}),n.children.css({"float":"left",listStyle:"none",position:"relative"}),n.children.css("width",h()),"horizontal"==n.settings.mode&&n.settings.slideMargin>0&&n.children.css("marginRight",n.settings.slideMargin),"vertical"==n.settings.mode&&n.settings.slideMargin>0&&n.children.css("marginBottom",n.settings.slideMargin),"fade"==n.settings.mode&&(n.children.css({zIndex:0,display:"none",marginRight:"-100%",width:"100%"}),n.children.eq(n.settings.startSlide).css({zIndex:n.settings.slideZIndex,display:"block"})),n.controls.el=$('<div class="soliloquy-controls" />'),n.settings.captions&&T(),n.active.last=n.settings.startSlide==m()-1;var t=n.children.eq(n.settings.startSlide);"all"==n.settings.preloadImages&&(t=n.children),n.settings.ticker?n.settings.pager=!1:(n.settings.pager&&w(),n.settings.controls&&b(),n.settings.auto&&n.settings.autoControls&&q(),(n.settings.controls||n.settings.autoControls||n.settings.pager)&&n.viewport.after(n.controls.el)),c(t,g)},c=function(e,t){var i=e.find("img, iframe").length;if(0==i)return void t();var s=0;e.find("img, iframe").each(function(){$(this).one("load",function(){++s==i&&t()}).each(function(){this.complete&&$(this).load()})})},g=function(){if(n.settings.infiniteLoop&&"fade"!=n.settings.mode&&!n.settings.ticker){var e="vertical"==n.settings.mode?n.settings.minSlides:n.settings.maxSlides,t=n.children.slice(0,e).clone().addClass("soliloquy-clone"),i=n.children.slice(-e).clone().addClass("soliloquy-clone");o.append(t).prepend(i)}n.loader.remove(),x(),"vertical"==n.settings.mode&&(n.settings.adaptiveHeight=!0),n.viewport.height(u()),o.redrawSlider(),n.settings.onSliderLoad(n.active.index),n.initialized=!0,n.settings.responsive&&$(window).bind("resize",F),n.settings.auto&&n.settings.autoStart&&(m()>1||n.settings.autoSlideForOnePage)&&D(),n.settings.ticker&&W(),n.settings.pager&&I(n.settings.startSlide),n.settings.controls&&_(),n.settings.touchEnabled&&!n.settings.ticker&&H(),n.settings.keyboard&&!n.settings.ticker&&$(document).on("keydown",function(e){return 39==e.keyCode?(k(e),!1):37==e.keyCode?(C(e),!1):void 0})},u=function(){var e=0,t=$();if("vertical"==n.settings.mode||n.settings.adaptiveHeight)if(n.carousel){var s=1==n.settings.moveSlides?n.active.index:n.active.index*f();for(t=n.children.eq(s),i=1;i<=n.settings.maxSlides-1;i++)t=t.add(s+i>=n.children.length?n.children.eq(i-1):n.children.eq(s+i))}else t=n.children.eq(n.active.index);else t=n.children;return"vertical"==n.settings.mode?(t.each(function(t){e+=$(this).outerHeight()}),n.settings.slideMargin>0&&(e+=n.settings.slideMargin*(n.settings.minSlides-1))):e=Math.max.apply(Math,t.map(function(){return $(this).outerHeight(!1)}).get()),"border-box"==n.viewport.css("box-sizing")?e+=parseFloat(n.viewport.css("padding-top"))+parseFloat(n.viewport.css("padding-bottom"))+parseFloat(n.viewport.css("border-top-width"))+parseFloat(n.viewport.css("border-bottom-width")):"padding-box"==n.viewport.css("box-sizing")&&(e+=parseFloat(n.viewport.css("padding-top"))+parseFloat(n.viewport.css("padding-bottom"))),e},p=function(){var e="100%";return n.settings.slideWidth>0&&(e="horizontal"==n.settings.mode?n.settings.maxSlides*n.settings.slideWidth+(n.settings.maxSlides-1)*n.settings.slideMargin:n.settings.slideWidth),"fade"==n.settings.mode?"100%":e},h=function(){var e=n.settings.slideWidth,t=n.viewport.width();return 0==n.settings.slideWidth||n.settings.slideWidth>t&&!n.carousel||"vertical"==n.settings.mode?e=t:n.settings.maxSlides>1&&"horizontal"==n.settings.mode&&(t>n.maxThreshold||t<n.minThreshold&&(e=(t-n.settings.slideMargin*(n.settings.minSlides-1))/n.settings.minSlides)),"fade"==n.settings.mode?"100%":e},v=function(){var e=1;if("horizontal"==n.settings.mode&&n.settings.slideWidth>0)if(n.viewport.width()<n.minThreshold)e=n.settings.minSlides;else if(n.viewport.width()>n.maxThreshold)e=n.settings.maxSlides;else{var t=n.children.first().width()+n.settings.slideMargin;e=Math.floor((n.viewport.width()+n.settings.slideMargin)/t)}else"vertical"==n.settings.mode&&(e=n.settings.minSlides);return e},m=function(){var e=0;if(n.settings.moveSlides>0)if(n.settings.infiniteLoop)e=Math.ceil(n.children.length/f());else for(var t=0,i=0;t<n.children.length;)++e,t=i+v(),i+=n.settings.moveSlides<=v()?n.settings.moveSlides:v();else e=Math.ceil(n.children.length/v());return e},f=function(){return n.settings.moveSlides>0&&n.settings.moveSlides<=v()?n.settings.moveSlides:v()},x=function(){if(n.children.length>n.settings.maxSlides&&n.active.last&&!n.settings.infiniteLoop){if("horizontal"==n.settings.mode){var e=n.children.last(),t=e.position();S(-(t.left-(n.viewport.width()-e.outerWidth())),"reset",0)}else if("vertical"==n.settings.mode){var i=n.children.length-n.settings.minSlides,t=n.children.eq(i).position();S(-t.top,"reset",0)}}else{var t=n.children.eq(n.active.index*f()).position();n.active.index==m()-1&&(n.active.last=!0),void 0!=t&&("horizontal"==n.settings.mode?S(-t.left,"reset",0):"vertical"==n.settings.mode&&S(-t.top,"reset",0))}},S=function(e,t,i,s){if(n.usingCSS){var a="vertical"==n.settings.mode?"translate3d(0, "+e+"px, 0)":"translate3d("+e+"px, 0, 0)";o.css("-"+n.cssPrefix+"-transition-duration",i/1e3+"s"),"slide"==t?(o.css(n.animProp,a),o.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){o.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),M()})):"reset"==t?o.css(n.animProp,a):"ticker"==t&&(o.css("-"+n.cssPrefix+"-transition-timing-function","linear"),o.css(n.animProp,a),o.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){o.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),S(s.resetValue,"reset",0),Y()}))}else{var l={};l[n.animProp]=e,"slide"==t?o.animate(l,i,n.settings.easing,function(){M()}):"reset"==t?o.css(n.animProp,e):"ticker"==t&&o.animate(l,speed,"linear",function(){S(s.resetValue,"reset",0),Y()})}},y=function(){for(var e="",t=m(),i=0;t>i;i++){var s="";n.settings.buildPager&&$.isFunction(n.settings.buildPager)?(s=n.settings.buildPager(i),n.pagerEl.addClass("soliloquy-custom-pager")):(s=i+1,n.pagerEl.addClass("soliloquy-default-pager")),e+='<div class="soliloquy-pager-item"><a href="" data-slide-index="'+i+'" class="soliloquy-pager-link"><span>'+s+"</span></a></div>"}n.pagerEl.html(e)},w=function(){n.settings.pagerCustom?n.pagerEl=$(n.settings.pagerCustom):(n.pagerEl=$('<div class="soliloquy-pager" />'),n.settings.pagerSelector?$(n.settings.pagerSelector).html(n.pagerEl):n.controls.el.addClass("soliloquy-has-pager").append(n.pagerEl),y()),n.pagerEl.on("click","a",z)},b=function(){n.controls.next=$('<a class="soliloquy-next" href=""><span>'+n.settings.nextText+"</span></a>"),n.controls.prev=$('<a class="soliloquy-prev" href=""><span>'+n.settings.prevText+"</span></a>"),n.controls.next.bind("click",k),n.controls.prev.bind("click",C),n.settings.nextSelector&&$(n.settings.nextSelector).append(n.controls.next),n.settings.prevSelector&&$(n.settings.prevSelector).append(n.controls.prev),n.settings.nextSelector||n.settings.prevSelector||(n.controls.directionEl=$('<div class="soliloquy-controls-direction" />'),n.controls.directionEl.append(n.controls.prev).append(n.controls.next),n.controls.el.addClass("soliloquy-has-controls-direction").append(n.controls.directionEl))},q=function(){n.controls.start=$('<div class="soliloquy-controls-auto-item"><a class="soliloquy-start" href=""><span>'+n.settings.startText+"</span></a></div>"),n.controls.stop=$('<div class="soliloquy-controls-auto-item"><a class="soliloquy-stop" href=""><span>'+n.settings.stopText+"</span></a></div>"),n.controls.autoEl=$('<div class="soliloquy-controls-auto" />'),n.controls.autoEl.on("click",".soliloquy-start",E),n.controls.autoEl.on("click",".soliloquy-stop",P),n.settings.autoControlsCombine?n.controls.autoEl.append(n.controls.start):n.controls.autoEl.append(n.controls.start).append(n.controls.stop),n.settings.autoControlsSelector?$(n.settings.autoControlsSelector).html(n.controls.autoEl):n.controls.el.addClass("soliloquy-has-controls-auto").append(n.controls.autoEl),A(n.settings.autoStart?"stop":"start")},T=function(){n.children.each(function(e){var t=$(this).find("img:first").attr("title");void 0!=t&&(""+t).length&&$(this).append('<div class="soliloquy-caption"><span>'+t+"</span></div>")})},k=function(e){n.settings.auto&&o.stopAuto(),o.goToNextSlide(),e.preventDefault()},C=function(e){n.settings.auto&&o.stopAuto(),o.goToPrevSlide(),e.preventDefault()},E=function(e){o.startAuto(),e.preventDefault()},P=function(e){o.stopAuto(),e.preventDefault()},z=function(e){n.settings.auto&&o.stopAuto();var t=$(e.currentTarget);if(void 0!==t.attr("data-slide-index")){var i=parseInt(t.attr("data-slide-index"));i!=n.active.index&&o.goToSlide(i),e.preventDefault()}},I=function(e){var t=n.children.length;return"short"==n.settings.pagerType?(n.settings.maxSlides>1&&(t=Math.ceil(n.children.length/n.settings.maxSlides)),void n.pagerEl.html(e+1+n.settings.pagerShortSeparator+t)):(n.pagerEl.find("a").removeClass("active"),void n.pagerEl.each(function(t,i){$(i).find("a").eq(e).addClass("active")}))},M=function(){if(n.settings.infiniteLoop){var e="";0==n.active.index?e=n.children.eq(0).position():n.active.index==m()-1&&n.carousel?e=n.children.eq((m()-1)*f()).position():n.active.index==n.children.length-1&&(e=n.children.eq(n.children.length-1).position()),e&&("horizontal"==n.settings.mode?S(-e.left,"reset",0):"vertical"==n.settings.mode&&S(-e.top,"reset",0))}n.working=!1,"fade"==n.settings.mode&&n.viewport.css({overflow:""}),n.settings.onSlideAfter(n.children.eq(n.active.index),n.oldIndex,n.active.index)},A=function(e){n.settings.autoControlsCombine?n.controls.autoEl.html(n.controls[e]):(n.controls.autoEl.find("a").removeClass("active"),n.controls.autoEl.find("a:not(.soliloquy-"+e+")").addClass("active"))},_=function(){1==m()?(n.controls.prev.addClass("disabled"),n.controls.next.addClass("disabled")):!n.settings.infiniteLoop&&n.settings.hideControlOnEnd&&(0==n.active.index?(n.controls.prev.addClass("disabled"),n.controls.next.removeClass("disabled")):n.active.index==m()-1?(n.controls.next.addClass("disabled"),n.controls.prev.removeClass("disabled")):(n.controls.prev.removeClass("disabled"),n.controls.next.removeClass("disabled")))},D=function(){if(n.settings.autoDelay>0)var e=setTimeout(o.startAuto,n.settings.autoDelay);else o.startAuto();n.settings.autoHover&&o.hover(function(){n.interval&&(o.stopAuto(!0),n.autoPaused=!0)},function(){n.autoPaused&&(o.startAuto(!0),n.autoPaused=null)})},W=function(){var e=0;if("next"==n.settings.autoDirection)o.append(n.children.clone().addClass("soliloquy-clone"));else{o.prepend(n.children.clone().addClass("soliloquy-clone"));var t=n.children.first().position();e="horizontal"==n.settings.mode?-t.left:-t.top}S(e,"reset",0),n.settings.pager=!1,n.settings.controls=!1,n.settings.autoControls=!1,n.settings.tickerHover&&!n.usingCSS&&n.viewport.hover(function(){o.stop()},function(){var e=0;n.children.each(function(t){e+="horizontal"==n.settings.mode?$(this).outerWidth(!0):$(this).outerHeight(!0)});var t=n.settings.speed/e,i="horizontal"==n.settings.mode?"left":"top",s=t*(e-Math.abs(parseInt(o.css(i))));Y(s)}),Y()},Y=function(e){speed=e?e:n.settings.speed;var t={left:0,top:0},i={left:0,top:0};"next"==n.settings.autoDirection?t=o.find(".soliloquy-clone").first().position():i=n.children.first().position();var s="horizontal"==n.settings.mode?-t.left:-t.top,a="horizontal"==n.settings.mode?-i.left:-i.top,l={resetValue:a};S(s,"ticker",speed,l)},H=function(){n.touch={start:{x:0,y:0},end:{x:0,y:0}},n.viewport.bind("touchstart",V)},V=function(e){if(n.working)e.preventDefault();else{n.touch.originalPos=o.position();var t=e.originalEvent;n.touch.start.x=t.changedTouches[0].pageX,n.touch.start.y=t.changedTouches[0].pageY,n.viewport.bind("touchmove",L),n.viewport.bind("touchend",N)}},L=function(e){var t=e.originalEvent,i=Math.abs(t.changedTouches[0].pageX-n.touch.start.x),s=Math.abs(t.changedTouches[0].pageY-n.touch.start.y);if(3*i>s&&n.settings.preventDefaultSwipeX?e.preventDefault():3*s>i&&n.settings.preventDefaultSwipeY&&e.preventDefault(),"fade"!=n.settings.mode&&n.settings.oneToOneTouch){var o=0;if("horizontal"==n.settings.mode){var a=t.changedTouches[0].pageX-n.touch.start.x;o=n.touch.originalPos.left+a}else{var a=t.changedTouches[0].pageY-n.touch.start.y;o=n.touch.originalPos.top+a}S(o,"reset",0)}},N=function(e){n.viewport.unbind("touchmove",L);var t=e.originalEvent,i=0;if(n.touch.end.x=t.changedTouches[0].pageX,n.touch.end.y=t.changedTouches[0].pageY,"fade"==n.settings.mode){var s=Math.abs(n.touch.start.x-n.touch.end.x);s>=n.settings.swipeThreshold&&(n.touch.start.x>n.touch.end.x?o.goToNextSlide():o.goToPrevSlide(),o.stopAuto())}else{var s=0;"horizontal"==n.settings.mode?(s=n.touch.end.x-n.touch.start.x,i=n.touch.originalPos.left):(s=n.touch.end.y-n.touch.start.y,i=n.touch.originalPos.top),!n.settings.infiniteLoop&&(0==n.active.index&&s>0||n.active.last&&0>s)?S(i,"reset",200):Math.abs(s)>=n.settings.swipeThreshold?(0>s?o.goToNextSlide():o.goToPrevSlide(),o.stopAuto()):S(i,"reset",200)}n.viewport.unbind("touchend",N)},F=function(e){if(n.initialized){var t=$(window).width(),i=$(window).height();(a!=t||l!=i)&&(a=t,l=i,o.redrawSlider(),n.settings.onSliderResize.call(o,n.active.index))}};return o.goToSlide=function(e,t){if(!n.working&&n.active.index!=e)if(n.working=!0,n.oldIndex=n.active.index,n.active.index=0>e?m()-1:e>=m()?0:e,n.settings.onSlideBefore(n.children.eq(n.active.index),n.oldIndex,n.active.index),"next"==t?n.settings.onSlideNext(n.children.eq(n.active.index),n.oldIndex,n.active.index):"prev"==t&&n.settings.onSlidePrev(n.children.eq(n.active.index),n.oldIndex,n.active.index),n.active.last=n.active.index>=m()-1,n.settings.pager&&I(n.active.index),n.settings.controls&&_(),"fade"==n.settings.mode)n.viewport.css({overflow:"hidden"}),n.settings.adaptiveHeight&&n.viewport.height()!=u()&&n.viewport.animate({height:u()},n.settings.adaptiveHeightSpeed),n.children.filter(":visible").fadeOut(n.settings.speed).css({zIndex:0}),n.children.eq(n.active.index).css("zIndex",n.settings.slideZIndex+1).fadeIn(n.settings.speed,function(){$(this).css("zIndex",n.settings.slideZIndex),M()});else{n.settings.adaptiveHeight&&n.viewport.height()!=u()&&n.viewport.animate({height:u()},n.settings.adaptiveHeightSpeed);var i=0,s={left:0,top:0};if(!n.settings.infiniteLoop&&n.carousel&&n.active.last)if("horizontal"==n.settings.mode){var a=n.children.eq(n.children.length-1);s=a.position(),i=n.viewport.width()-a.outerWidth()}else{var l=n.children.length-n.settings.minSlides;s=n.children.eq(l).position()}else if(n.carousel&&n.active.last&&"prev"==t){var r=1==n.settings.moveSlides?n.settings.maxSlides-f():(m()-1)*f()-(n.children.length-n.settings.maxSlides),a=o.children(".soliloquy-clone").eq(r);s=a.position()}else if("next"==t&&0==n.active.index)s=o.find("> .soliloquy-clone").eq(n.settings.maxSlides).position(),n.active.last=!1;else if(e>=0){var d=e*f();s=n.children.eq(d).position()}if("undefined"!=typeof s){var c="horizontal"==n.settings.mode?-(s.left-i):-s.top;S(c,"slide",n.settings.speed)}}},o.goToNextSlide=function(){if(n.settings.infiniteLoop||!n.active.last){var e=parseInt(n.active.index)+1;o.goToSlide(e,"next")}},o.goToPrevSlide=function(){if(n.settings.infiniteLoop||0!=n.active.index){var e=parseInt(n.active.index)-1;o.goToSlide(e,"prev")}},o.startAuto=function(e){n.interval||(n.interval=setInterval(function(){"next"==n.settings.autoDirection?o.goToNextSlide():o.goToPrevSlide()},n.settings.pause),n.settings.autoControls&&1!=e&&A("stop"))},o.stopAuto=function(e){n.interval&&(clearInterval(n.interval),n.interval=null,n.settings.autoControls&&1!=e&&A("start"))},o.getCurrentSlide=function(){return n.active.index},o.getCurrentSlideElement=function(){return n.children.eq(n.active.index)},o.getSlideCount=function(){return n.children.length},o.redrawSlider=function(){n.children.add(o.find(".soliloquy-clone")).width(h()),n.viewport.css("height",u()),n.settings.ticker||x(),n.active.last&&(n.active.index=m()-1),n.active.index>=m()&&(n.active.last=!0),n.settings.pager&&!n.settings.pagerCustom&&(y(),I(n.active.index))},o.destroySlider=function(){n.initialized&&(n.initialized=!1,$(".soliloquy-clone",this).remove(),n.children.each(function(){void 0!=$(this).data("origStyle")?$(this).attr("style",$(this).data("origStyle")):$(this).removeAttr("style")}),void 0!=$(this).data("origStyle")?this.attr("style",$(this).data("origStyle")):$(this).removeAttr("style"),$(this).unwrap().unwrap(),n.controls.el&&n.controls.el.remove(),n.controls.next&&n.controls.next.remove(),n.controls.prev&&n.controls.prev.remove(),n.pagerEl&&n.settings.controls&&n.pagerEl.remove(),$(".soliloquy-caption",this).remove(),n.controls.autoEl&&n.controls.autoEl.remove(),clearInterval(n.interval),n.settings.responsive&&$(window).unbind("resize",F))},o.reloadSlider=function(e){void 0!=e&&(s=e),o.destroySlider(),r()},r(),this}}(jQuery);
|
assets/js/soliloquy-dev-holder.js
DELETED
@@ -1,1490 +0,0 @@
|
|
1 |
-
;(function($){
|
2 |
-
|
3 |
-
var plugin = {};
|
4 |
-
|
5 |
-
var defaults = {
|
6 |
-
|
7 |
-
// Added by Thomas
|
8 |
-
keyboard: false,
|
9 |
-
|
10 |
-
// GENERAL
|
11 |
-
mode: 'horizontal',
|
12 |
-
slideSelector: '',
|
13 |
-
infiniteLoop: true,
|
14 |
-
hideControlOnEnd: false,
|
15 |
-
speed: 500,
|
16 |
-
easing: null,
|
17 |
-
slideMargin: 0,
|
18 |
-
startSlide: 0,
|
19 |
-
randomStart: false,
|
20 |
-
captions: false,
|
21 |
-
ticker: false,
|
22 |
-
tickerHover: false,
|
23 |
-
adaptiveHeight: false,
|
24 |
-
adaptiveHeightSpeed: 500,
|
25 |
-
video: false,
|
26 |
-
useCSS: true,
|
27 |
-
preloadImages: 'visible',
|
28 |
-
responsive: true,
|
29 |
-
slideZIndex: 50,
|
30 |
-
wrapperClass: 'soliloquy-wrapper',
|
31 |
-
|
32 |
-
// TOUCH
|
33 |
-
touchEnabled: true,
|
34 |
-
swipeThreshold: 50,
|
35 |
-
oneToOneTouch: true,
|
36 |
-
preventDefaultSwipeX: true,
|
37 |
-
preventDefaultSwipeY: false,
|
38 |
-
|
39 |
-
// PAGER
|
40 |
-
pager: true,
|
41 |
-
pagerType: 'full',
|
42 |
-
pagerShortSeparator: ' / ',
|
43 |
-
pagerSelector: null,
|
44 |
-
buildPager: null,
|
45 |
-
pagerCustom: null,
|
46 |
-
|
47 |
-
// CONTROLS
|
48 |
-
controls: true,
|
49 |
-
nextText: 'Next',
|
50 |
-
prevText: 'Prev',
|
51 |
-
nextSelector: null,
|
52 |
-
prevSelector: null,
|
53 |
-
autoControls: false,
|
54 |
-
startText: 'Start',
|
55 |
-
stopText: 'Stop',
|
56 |
-
autoControlsCombine: false,
|
57 |
-
autoControlsSelector: null,
|
58 |
-
|
59 |
-
// AUTO
|
60 |
-
auto: false,
|
61 |
-
pause: 4000,
|
62 |
-
autoStart: true,
|
63 |
-
autoDirection: 'next',
|
64 |
-
autoHover: false,
|
65 |
-
autoDelay: 0,
|
66 |
-
autoSlideForOnePage: false,
|
67 |
-
|
68 |
-
// CAROUSEL
|
69 |
-
minSlides: 1,
|
70 |
-
maxSlides: 1,
|
71 |
-
moveSlides: 0,
|
72 |
-
slideWidth: 0,
|
73 |
-
|
74 |
-
// CALLBACKS
|
75 |
-
onSliderLoad: function() {},
|
76 |
-
onSlideBefore: function() {},
|
77 |
-
onSlideAfter: function() {},
|
78 |
-
onSlideNext: function() {},
|
79 |
-
onSlidePrev: function() {},
|
80 |
-
onSliderResize: function() {}
|
81 |
-
}
|
82 |
-
|
83 |
-
$.fn.soliloquy = function(options){
|
84 |
-
|
85 |
-
if(this.length == 0) return this;
|
86 |
-
|
87 |
-
// support mutltiple elements
|
88 |
-
if(this.length > 1){
|
89 |
-
this.each(function(){$(this).soliloquy(options)});
|
90 |
-
return this;
|
91 |
-
}
|
92 |
-
|
93 |
-
// create a namespace to be used throughout the plugin
|
94 |
-
var slider = {};
|
95 |
-
// set a reference to our slider element
|
96 |
-
var el = this;
|
97 |
-
plugin.el = this;
|
98 |
-
|
99 |
-
/**
|
100 |
-
* Makes slideshow responsive
|
101 |
-
*/
|
102 |
-
// first get the original window dimens (thanks alot IE)
|
103 |
-
var windowWidth = $(window).width();
|
104 |
-
var windowHeight = $(window).height();
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
/**
|
109 |
-
* ===================================================================================
|
110 |
-
* = PRIVATE FUNCTIONS
|
111 |
-
* ===================================================================================
|
112 |
-
*/
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Initializes namespace settings to be used throughout plugin
|
116 |
-
*/
|
117 |
-
var init = function(){
|
118 |
-
// merge user-supplied options with the defaults
|
119 |
-
slider.settings = $.extend({}, defaults, options);
|
120 |
-
// parse slideWidth setting
|
121 |
-
slider.settings.slideWidth = parseInt(slider.settings.slideWidth);
|
122 |
-
// store the original children
|
123 |
-
slider.children = el.children(slider.settings.slideSelector);
|
124 |
-
// check if actual number of slides is less than minSlides / maxSlides
|
125 |
-
if(slider.children.length < slider.settings.minSlides) slider.settings.minSlides = slider.children.length;
|
126 |
-
if(slider.children.length < slider.settings.maxSlides) slider.settings.maxSlides = slider.children.length;
|
127 |
-
// if random start, set the startSlide setting to random number
|
128 |
-
if(slider.settings.randomStart) slider.settings.startSlide = Math.floor(Math.random() * slider.children.length);
|
129 |
-
// store active slide information
|
130 |
-
slider.active = { index: slider.settings.startSlide }
|
131 |
-
// store if the slider is in carousel mode (displaying / moving multiple slides)
|
132 |
-
slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1;
|
133 |
-
// if carousel, force preloadImages = 'all'
|
134 |
-
if(slider.carousel) slider.settings.preloadImages = 'all';
|
135 |
-
// calculate the min / max width thresholds based on min / max number of slides
|
136 |
-
// used to setup and update carousel slides dimensions
|
137 |
-
slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin);
|
138 |
-
slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
|
139 |
-
// store the current state of the slider (if currently animating, working is true)
|
140 |
-
slider.working = false;
|
141 |
-
// initialize the controls object
|
142 |
-
slider.controls = {};
|
143 |
-
// initialize an auto interval
|
144 |
-
slider.interval = null;
|
145 |
-
// determine which property to use for transitions
|
146 |
-
slider.animProp = slider.settings.mode == 'vertical' ? 'top' : 'left';
|
147 |
-
// determine if hardware acceleration can be used
|
148 |
-
slider.usingCSS = slider.settings.useCSS && slider.settings.mode != 'fade' && (function(){
|
149 |
-
// create our test div element
|
150 |
-
var div = document.createElement('div');
|
151 |
-
// css transition properties
|
152 |
-
var props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
|
153 |
-
// test for each property
|
154 |
-
for(var i in props){
|
155 |
-
if(div.style[props[i]] !== undefined){
|
156 |
-
slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase();
|
157 |
-
slider.animProp = '-' + slider.cssPrefix + '-transform';
|
158 |
-
return true;
|
159 |
-
}
|
160 |
-
}
|
161 |
-
return false;
|
162 |
-
}());
|
163 |
-
// if vertical mode always make maxSlides and minSlides equal
|
164 |
-
if(slider.settings.mode == 'vertical') slider.settings.maxSlides = slider.settings.minSlides;
|
165 |
-
// save original style data
|
166 |
-
el.data("origStyle", el.attr("style"));
|
167 |
-
el.children(slider.settings.slideSelector).each(function() {
|
168 |
-
$(this).data("origStyle", $(this).attr("style"));
|
169 |
-
});
|
170 |
-
// perform all DOM / CSS modifications
|
171 |
-
setup();
|
172 |
-
}
|
173 |
-
|
174 |
-
/**
|
175 |
-
* Performs all DOM and CSS modifications
|
176 |
-
*/
|
177 |
-
var setup = function(){
|
178 |
-
// wrap el in a wrapper
|
179 |
-
el.wrap('<div class="' + slider.settings.wrapperClass + '"><div class="soliloquy-viewport"></div></div>');
|
180 |
-
// store a namspace reference to .soliloquy-viewport
|
181 |
-
slider.viewport = el.parent();
|
182 |
-
// add a loading div to display while images are loading
|
183 |
-
slider.loader = $('<div class="soliloquy-loading" />');
|
184 |
-
slider.viewport.prepend(slider.loader);
|
185 |
-
// set el to a massive width, to hold any needed slides
|
186 |
-
// also strip any margin and padding from el
|
187 |
-
el.css({
|
188 |
-
width: slider.settings.mode == 'horizontal' ? (slider.children.length * 100 + 215) + '%' : 'auto',
|
189 |
-
position: 'relative'
|
190 |
-
});
|
191 |
-
// if using CSS, add the easing property
|
192 |
-
if(slider.usingCSS && slider.settings.easing){
|
193 |
-
el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing);
|
194 |
-
// if not using CSS and no easing value was supplied, use the default JS animation easing (swing)
|
195 |
-
}else if(!slider.settings.easing){
|
196 |
-
slider.settings.easing = 'swing';
|
197 |
-
}
|
198 |
-
var slidesShowing = getNumberSlidesShowing();
|
199 |
-
// make modifications to the viewport (.soliloquy-viewport)
|
200 |
-
slider.viewport.css({
|
201 |
-
width: '100%',
|
202 |
-
position: 'relative'
|
203 |
-
});
|
204 |
-
if(slider.settings.mode != 'fade'){
|
205 |
-
slider.viewport.css({overflow:'hidden'});
|
206 |
-
}
|
207 |
-
slider.viewport.parent().css({
|
208 |
-
maxWidth: getViewportMaxWidth()
|
209 |
-
});
|
210 |
-
// make modification to the wrapper (.soliloquy-wrapper)
|
211 |
-
if(!slider.settings.pager) {
|
212 |
-
slider.viewport.parent().css({
|
213 |
-
margin: '0 auto 0px'
|
214 |
-
});
|
215 |
-
}
|
216 |
-
// apply css to all slider children
|
217 |
-
slider.children.css({
|
218 |
-
'float': 'left',
|
219 |
-
listStyle: 'none',
|
220 |
-
position: 'relative'
|
221 |
-
});
|
222 |
-
// apply the calculated width after the float is applied to prevent scrollbar interference
|
223 |
-
slider.children.css('width', getSlideWidth());
|
224 |
-
// if slideMargin is supplied, add the css
|
225 |
-
if(slider.settings.mode == 'horizontal' && slider.settings.slideMargin > 0) slider.children.css('marginRight', slider.settings.slideMargin);
|
226 |
-
if(slider.settings.mode == 'vertical' && slider.settings.slideMargin > 0) slider.children.css('marginBottom', slider.settings.slideMargin);
|
227 |
-
// if "fade" mode, add positioning and z-index CSS
|
228 |
-
if(slider.settings.mode == 'fade'){
|
229 |
-
slider.children.css({
|
230 |
-
zIndex: 0,
|
231 |
-
display: 'none',
|
232 |
-
marginRight: '-100%',
|
233 |
-
width: '100%'
|
234 |
-
});
|
235 |
-
// prepare the z-index on the showing element
|
236 |
-
slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'});
|
237 |
-
}
|
238 |
-
// create an element to contain all slider controls (pager, start / stop, etc)
|
239 |
-
slider.controls.el = $('<div class="soliloquy-controls" />');
|
240 |
-
// if captions are requested, add them
|
241 |
-
if(slider.settings.captions) appendCaptions();
|
242 |
-
// check if startSlide is last slide
|
243 |
-
slider.active.last = slider.settings.startSlide == getPagerQty() - 1;
|
244 |
-
// Added by Thomas - removed fitVids support, no need.
|
245 |
-
// set the default preload selector (visible)
|
246 |
-
var preloadSelector = slider.children.eq(slider.settings.startSlide);
|
247 |
-
if (slider.settings.preloadImages == "all") preloadSelector = slider.children;
|
248 |
-
// only check for control addition if not in "ticker" mode
|
249 |
-
if(!slider.settings.ticker){
|
250 |
-
// if pager is requested, add it
|
251 |
-
if(slider.settings.pager) appendPager();
|
252 |
-
// if controls are requested, add them
|
253 |
-
if(slider.settings.controls) appendControls();
|
254 |
-
// if auto is true, and auto controls are requested, add them
|
255 |
-
if(slider.settings.auto && slider.settings.autoControls) appendControlsAuto();
|
256 |
-
// if any control option is requested, add the controls wrapper
|
257 |
-
if(slider.settings.controls || slider.settings.autoControls || slider.settings.pager) slider.viewport.after(slider.controls.el);
|
258 |
-
// if ticker mode, do not allow a pager
|
259 |
-
}else{
|
260 |
-
slider.settings.pager = false;
|
261 |
-
}
|
262 |
-
// preload all images, then perform final DOM / CSS modifications that depend on images being loaded
|
263 |
-
loadElements(preloadSelector, start);
|
264 |
-
}
|
265 |
-
|
266 |
-
var loadElements = function(selector, callback){
|
267 |
-
var total = selector.find('img, iframe').length;
|
268 |
-
if (total == 0){
|
269 |
-
callback();
|
270 |
-
return;
|
271 |
-
}
|
272 |
-
var count = 0;
|
273 |
-
selector.find('img, iframe').each(function(){
|
274 |
-
$(this).one('load', function() {
|
275 |
-
if(++count == total) callback();
|
276 |
-
}).each(function() {
|
277 |
-
if(this.complete) $(this).load();
|
278 |
-
});
|
279 |
-
});
|
280 |
-
}
|
281 |
-
|
282 |
-
/**
|
283 |
-
* Start the slider
|
284 |
-
*/
|
285 |
-
var start = function(){
|
286 |
-
// if infinite loop, prepare additional slides
|
287 |
-
if(slider.settings.infiniteLoop && slider.settings.mode != 'fade' && !slider.settings.ticker){
|
288 |
-
var slice = slider.settings.mode == 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides;
|
289 |
-
var sliceAppend = slider.children.slice(0, slice).clone().addClass('soliloquy-clone');
|
290 |
-
var slicePrepend = slider.children.slice(-slice).clone().addClass('soliloquy-clone');
|
291 |
-
el.append(sliceAppend).prepend(slicePrepend);
|
292 |
-
}
|
293 |
-
// remove the loading DOM element
|
294 |
-
slider.loader.remove();
|
295 |
-
// set the left / top position of "el"
|
296 |
-
setSlidePosition();
|
297 |
-
// if "vertical" mode, always use adaptiveHeight to prevent odd behavior
|
298 |
-
if (slider.settings.mode == 'vertical') slider.settings.adaptiveHeight = true;
|
299 |
-
// set the viewport height
|
300 |
-
slider.viewport.height(getViewportHeight());
|
301 |
-
// make sure everything is positioned just right (same as a window resize)
|
302 |
-
el.redrawSlider();
|
303 |
-
// onSliderLoad callback
|
304 |
-
slider.settings.onSliderLoad(slider.active.index);
|
305 |
-
// slider has been fully initialized
|
306 |
-
slider.initialized = true;
|
307 |
-
// bind the resize call to the window
|
308 |
-
if (slider.settings.responsive) $(window).bind('resize', resizeWindow);
|
309 |
-
// if auto is true and has more than 1 page, start the show
|
310 |
-
if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) initAuto();
|
311 |
-
// if ticker is true, start the ticker
|
312 |
-
if (slider.settings.ticker) initTicker();
|
313 |
-
// if pager is requested, make the appropriate pager link active
|
314 |
-
if (slider.settings.pager) updatePagerActive(slider.settings.startSlide);
|
315 |
-
// check for any updates to the controls (like hideControlOnEnd updates)
|
316 |
-
if (slider.settings.controls) updateDirectionControls();
|
317 |
-
// if touchEnabled is true, setup the touch events
|
318 |
-
if (slider.settings.touchEnabled && !slider.settings.ticker) initTouch();
|
319 |
-
|
320 |
-
// Added by Thomas
|
321 |
-
if (slider.settings.keyboard && !slider.settings.ticker) {
|
322 |
-
$(document).on('keydown', function(e){
|
323 |
-
if (e.keyCode == 39) {
|
324 |
-
clickNextBind(e);
|
325 |
-
return false;
|
326 |
-
}
|
327 |
-
else if (e.keyCode == 37) {
|
328 |
-
clickPrevBind(e);
|
329 |
-
return false;
|
330 |
-
}
|
331 |
-
});
|
332 |
-
}
|
333 |
-
}
|
334 |
-
|
335 |
-
/**
|
336 |
-
* Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
|
337 |
-
*/
|
338 |
-
var getViewportHeight = function(){
|
339 |
-
var height = 0;
|
340 |
-
// first determine which children (slides) should be used in our height calculation
|
341 |
-
var children = $();
|
342 |
-
// if mode is not "vertical" and adaptiveHeight is false, include all children
|
343 |
-
if(slider.settings.mode != 'vertical' && !slider.settings.adaptiveHeight){
|
344 |
-
children = slider.children;
|
345 |
-
}else{
|
346 |
-
// if not carousel, return the single active child
|
347 |
-
if(!slider.carousel){
|
348 |
-
children = slider.children.eq(slider.active.index);
|
349 |
-
// if carousel, return a slice of children
|
350 |
-
}else{
|
351 |
-
// get the individual slide index
|
352 |
-
var currentIndex = slider.settings.moveSlides == 1 ? slider.active.index : slider.active.index * getMoveBy();
|
353 |
-
// add the current slide to the children
|
354 |
-
children = slider.children.eq(currentIndex);
|
355 |
-
// cycle through the remaining "showing" slides
|
356 |
-
for (i = 1; i <= slider.settings.maxSlides - 1; i++){
|
357 |
-
// if looped back to the start
|
358 |
-
if(currentIndex + i >= slider.children.length){
|
359 |
-
children = children.add(slider.children.eq(i - 1));
|
360 |
-
}else{
|
361 |
-
children = children.add(slider.children.eq(currentIndex + i));
|
362 |
-
}
|
363 |
-
}
|
364 |
-
}
|
365 |
-
}
|
366 |
-
// if "vertical" mode, calculate the sum of the heights of the children
|
367 |
-
if(slider.settings.mode == 'vertical'){
|
368 |
-
children.each(function(index) {
|
369 |
-
height += $(this).outerHeight();
|
370 |
-
});
|
371 |
-
// add user-supplied margins
|
372 |
-
if(slider.settings.slideMargin > 0){
|
373 |
-
height += slider.settings.slideMargin * (slider.settings.minSlides - 1);
|
374 |
-
}
|
375 |
-
// if not "vertical" mode, calculate the max height of the children
|
376 |
-
}else{
|
377 |
-
height = Math.max.apply(Math, children.map(function(){
|
378 |
-
return $(this).outerHeight(false);
|
379 |
-
}).get());
|
380 |
-
}
|
381 |
-
|
382 |
-
if(slider.viewport.css('box-sizing') == 'border-box'){
|
383 |
-
height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) +
|
384 |
-
parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width'));
|
385 |
-
}else if(slider.viewport.css('box-sizing') == 'padding-box'){
|
386 |
-
height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom'));
|
387 |
-
}
|
388 |
-
|
389 |
-
return height;
|
390 |
-
}
|
391 |
-
|
392 |
-
/**
|
393 |
-
* Returns the calculated width to be used for the outer wrapper / viewport
|
394 |
-
*/
|
395 |
-
var getViewportMaxWidth = function(){
|
396 |
-
var width = '100%';
|
397 |
-
if(slider.settings.slideWidth > 0){
|
398 |
-
if(slider.settings.mode == 'horizontal'){
|
399 |
-
width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
|
400 |
-
}else{
|
401 |
-
width = slider.settings.slideWidth;
|
402 |
-
}
|
403 |
-
}
|
404 |
-
return (slider.settings.mode == 'fade') ? '100%' : width;
|
405 |
-
}
|
406 |
-
|
407 |
-
/**
|
408 |
-
* Returns the calculated width to be applied to each slide
|
409 |
-
*/
|
410 |
-
var getSlideWidth = function(){
|
411 |
-
// start with any user-supplied slide width
|
412 |
-
var newElWidth = slider.settings.slideWidth;
|
413 |
-
// get the current viewport width
|
414 |
-
var wrapWidth = slider.viewport.width();
|
415 |
-
// if slide width was not supplied, or is larger than the viewport use the viewport width
|
416 |
-
if(slider.settings.slideWidth == 0 ||
|
417 |
-
(slider.settings.slideWidth > wrapWidth && !slider.carousel) ||
|
418 |
-
slider.settings.mode == 'vertical'){
|
419 |
-
newElWidth = wrapWidth;
|
420 |
-
// if carousel, use the thresholds to determine the width
|
421 |
-
}else if(slider.settings.maxSlides > 1 && slider.settings.mode == 'horizontal'){
|
422 |
-
if(wrapWidth > slider.maxThreshold){
|
423 |
-
// newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.maxSlides - 1))) / slider.settings.maxSlides;
|
424 |
-
}else if(wrapWidth < slider.minThreshold){
|
425 |
-
newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides;
|
426 |
-
}
|
427 |
-
}
|
428 |
-
return (slider.settings.mode == 'fade') ? '100%' : newElWidth;
|
429 |
-
}
|
430 |
-
|
431 |
-
/**
|
432 |
-
* Returns the number of slides currently visible in the viewport (includes partially visible slides)
|
433 |
-
*/
|
434 |
-
var getNumberSlidesShowing = function(){
|
435 |
-
var slidesShowing = 1;
|
436 |
-
if(slider.settings.mode == 'horizontal' && slider.settings.slideWidth > 0){
|
437 |
-
// if viewport is smaller than minThreshold, return minSlides
|
438 |
-
if(slider.viewport.width() < slider.minThreshold){
|
439 |
-
slidesShowing = slider.settings.minSlides;
|
440 |
-
// if viewport is larger than minThreshold, return maxSlides
|
441 |
-
}else if(slider.viewport.width() > slider.maxThreshold){
|
442 |
-
slidesShowing = slider.settings.maxSlides;
|
443 |
-
// if viewport is between min / max thresholds, divide viewport width by first child width
|
444 |
-
}else{
|
445 |
-
var childWidth = slider.children.first().width() + slider.settings.slideMargin;
|
446 |
-
slidesShowing = Math.floor((slider.viewport.width() +
|
447 |
-
slider.settings.slideMargin) / childWidth);
|
448 |
-
}
|
449 |
-
// if "vertical" mode, slides showing will always be minSlides
|
450 |
-
}else if(slider.settings.mode == 'vertical'){
|
451 |
-
slidesShowing = slider.settings.minSlides;
|
452 |
-
}
|
453 |
-
return slidesShowing;
|
454 |
-
}
|
455 |
-
|
456 |
-
/**
|
457 |
-
* Returns the number of pages (one full viewport of slides is one "page")
|
458 |
-
*/
|
459 |
-
var getPagerQty = function(){
|
460 |
-
var pagerQty = 0;
|
461 |
-
// if moveSlides is specified by the user
|
462 |
-
if(slider.settings.moveSlides > 0){
|
463 |
-
if(slider.settings.infiniteLoop){
|
464 |
-
pagerQty = Math.ceil(slider.children.length / getMoveBy());
|
465 |
-
}else{
|
466 |
-
// use a while loop to determine pages
|
467 |
-
var breakPoint = 0;
|
468 |
-
var counter = 0
|
469 |
-
// when breakpoint goes above children length, counter is the number of pages
|
470 |
-
while (breakPoint < slider.children.length){
|
471 |
-
++pagerQty;
|
472 |
-
breakPoint = counter + getNumberSlidesShowing();
|
473 |
-
counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing();
|
474 |
-
}
|
475 |
-
}
|
476 |
-
// if moveSlides is 0 (auto) divide children length by sides showing, then round up
|
477 |
-
}else{
|
478 |
-
pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing());
|
479 |
-
}
|
480 |
-
return pagerQty;
|
481 |
-
}
|
482 |
-
|
483 |
-
/**
|
484 |
-
* Returns the number of indivual slides by which to shift the slider
|
485 |
-
*/
|
486 |
-
var getMoveBy = function(){
|
487 |
-
// if moveSlides was set by the user and moveSlides is less than number of slides showing
|
488 |
-
if(slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()){
|
489 |
-
return slider.settings.moveSlides;
|
490 |
-
}
|
491 |
-
// if moveSlides is 0 (auto)
|
492 |
-
return getNumberSlidesShowing();
|
493 |
-
}
|
494 |
-
|
495 |
-
/**
|
496 |
-
* Sets the slider's (el) left or top position
|
497 |
-
*/
|
498 |
-
var setSlidePosition = function(){
|
499 |
-
// if last slide, not infinite loop, and number of children is larger than specified maxSlides
|
500 |
-
if(slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop){
|
501 |
-
if (slider.settings.mode == 'horizontal'){
|
502 |
-
// get the last child's position
|
503 |
-
var lastChild = slider.children.last();
|
504 |
-
var position = lastChild.position();
|
505 |
-
// set the left position
|
506 |
-
setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0);
|
507 |
-
}else if(slider.settings.mode == 'vertical'){
|
508 |
-
// get the last showing index's position
|
509 |
-
var lastShowingIndex = slider.children.length - slider.settings.minSlides;
|
510 |
-
var position = slider.children.eq(lastShowingIndex).position();
|
511 |
-
// set the top position
|
512 |
-
setPositionProperty(-position.top, 'reset', 0);
|
513 |
-
}
|
514 |
-
// if not last slide
|
515 |
-
}else{
|
516 |
-
// get the position of the first showing slide
|
517 |
-
var position = slider.children.eq(slider.active.index * getMoveBy()).position();
|
518 |
-
// check for last slide
|
519 |
-
if (slider.active.index == getPagerQty() - 1) slider.active.last = true;
|
520 |
-
// set the repective position
|
521 |
-
if (position != undefined){
|
522 |
-
if (slider.settings.mode == 'horizontal') setPositionProperty(-position.left, 'reset', 0);
|
523 |
-
else if (slider.settings.mode == 'vertical') setPositionProperty(-position.top, 'reset', 0);
|
524 |
-
}
|
525 |
-
}
|
526 |
-
}
|
527 |
-
|
528 |
-
/**
|
529 |
-
* Sets the el's animating property position (which in turn will sometimes animate el).
|
530 |
-
* If using CSS, sets the transform property. If not using CSS, sets the top / left property.
|
531 |
-
*
|
532 |
-
* @param value (int)
|
533 |
-
* - the animating property's value
|
534 |
-
*
|
535 |
-
* @param type (string) 'slider', 'reset', 'ticker'
|
536 |
-
* - the type of instance for which the function is being
|
537 |
-
*
|
538 |
-
* @param duration (int)
|
539 |
-
* - the amount of time (in ms) the transition should occupy
|
540 |
-
*
|
541 |
-
* @param params (array) optional
|
542 |
-
* - an optional parameter containing any variables that need to be passed in
|
543 |
-
*/
|
544 |
-
var setPositionProperty = function(value, type, duration, params){
|
545 |
-
// use CSS transform
|
546 |
-
if(slider.usingCSS){
|
547 |
-
// determine the translate3d value
|
548 |
-
var propValue = slider.settings.mode == 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)';
|
549 |
-
// add the CSS transition-duration
|
550 |
-
el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's');
|
551 |
-
if(type == 'slide'){
|
552 |
-
// set the property value
|
553 |
-
el.css(slider.animProp, propValue);
|
554 |
-
// bind a callback method - executes when CSS transition completes
|
555 |
-
el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){
|
556 |
-
// unbind the callback
|
557 |
-
el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
|
558 |
-
updateAfterSlideTransition();
|
559 |
-
});
|
560 |
-
}else if(type == 'reset'){
|
561 |
-
el.css(slider.animProp, propValue);
|
562 |
-
}else if(type == 'ticker'){
|
563 |
-
// make the transition use 'linear'
|
564 |
-
el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear');
|
565 |
-
el.css(slider.animProp, propValue);
|
566 |
-
// bind a callback method - executes when CSS transition completes
|
567 |
-
el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){
|
568 |
-
// unbind the callback
|
569 |
-
el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
|
570 |
-
// reset the position
|
571 |
-
setPositionProperty(params['resetValue'], 'reset', 0);
|
572 |
-
// start the loop again
|
573 |
-
tickerLoop();
|
574 |
-
});
|
575 |
-
}
|
576 |
-
// use JS animate
|
577 |
-
}else{
|
578 |
-
var animateObj = {};
|
579 |
-
animateObj[slider.animProp] = value;
|
580 |
-
if(type == 'slide'){
|
581 |
-
el.animate(animateObj, duration, slider.settings.easing, function(){
|
582 |
-
updateAfterSlideTransition();
|
583 |
-
});
|
584 |
-
}else if(type == 'reset'){
|
585 |
-
el.css(slider.animProp, value)
|
586 |
-
}else if(type == 'ticker'){
|
587 |
-
el.animate(animateObj, speed, 'linear', function(){
|
588 |
-
setPositionProperty(params['resetValue'], 'reset', 0);
|
589 |
-
// run the recursive loop after animation
|
590 |
-
tickerLoop();
|
591 |
-
});
|
592 |
-
}
|
593 |
-
}
|
594 |
-
}
|
595 |
-
|
596 |
-
/**
|
597 |
-
* Populates the pager with proper amount of pages
|
598 |
-
*/
|
599 |
-
var populatePager = function(){
|
600 |
-
var pagerHtml = '';
|
601 |
-
var pagerQty = getPagerQty();
|
602 |
-
// loop through each pager item
|
603 |
-
for(var i=0; i < pagerQty; i++){
|
604 |
-
var linkContent = '';
|
605 |
-
// if a buildPager function is supplied, use it to get pager link value, else use index + 1
|
606 |
-
if(slider.settings.buildPager && $.isFunction(slider.settings.buildPager)){
|
607 |
-
linkContent = slider.settings.buildPager(i);
|
608 |
-
slider.pagerEl.addClass('soliloquy-custom-pager');
|
609 |
-
}else{
|
610 |
-
linkContent = i + 1;
|
611 |
-
slider.pagerEl.addClass('soliloquy-default-pager');
|
612 |
-
}
|
613 |
-
// var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1;
|
614 |
-
// add the markup to the string
|
615 |
-
pagerHtml += '<div class="soliloquy-pager-item"><a href="" data-slide-index="' + i + '" class="soliloquy-pager-link"><span>' + linkContent + '</span></a></div>';
|
616 |
-
};
|
617 |
-
// populate the pager element with pager links
|
618 |
-
slider.pagerEl.html(pagerHtml);
|
619 |
-
}
|
620 |
-
|
621 |
-
/**
|
622 |
-
* Appends the pager to the controls element
|
623 |
-
*/
|
624 |
-
var appendPager = function(){
|
625 |
-
if(!slider.settings.pagerCustom){
|
626 |
-
// create the pager DOM element
|
627 |
-
slider.pagerEl = $('<div class="soliloquy-pager" />');
|
628 |
-
// if a pager selector was supplied, populate it with the pager
|
629 |
-
if(slider.settings.pagerSelector){
|
630 |
-
$(slider.settings.pagerSelector).html(slider.pagerEl);
|
631 |
-
// if no pager selector was supplied, add it after the wrapper
|
632 |
-
}else{
|
633 |
-
slider.controls.el.addClass('soliloquy-has-pager').append(slider.pagerEl);
|
634 |
-
}
|
635 |
-
// populate the pager
|
636 |
-
populatePager();
|
637 |
-
}else{
|
638 |
-
slider.pagerEl = $(slider.settings.pagerCustom);
|
639 |
-
}
|
640 |
-
// assign the pager click binding
|
641 |
-
slider.pagerEl.on('click', 'a', clickPagerBind);
|
642 |
-
}
|
643 |
-
|
644 |
-
/**
|
645 |
-
* Appends prev / next controls to the controls element
|
646 |
-
*/
|
647 |
-
var appendControls = function(){
|
648 |
-
slider.controls.next = $('<a class="soliloquy-next" href=""><span>' + slider.settings.nextText + '</span></a>');
|
649 |
-
slider.controls.prev = $('<a class="soliloquy-prev" href=""><span>' + slider.settings.prevText + '</span></a>');
|
650 |
-
// bind click actions to the controls
|
651 |
-
slider.controls.next.bind('click', clickNextBind);
|
652 |
-
slider.controls.prev.bind('click', clickPrevBind);
|
653 |
-
// if nextSlector was supplied, populate it
|
654 |
-
if(slider.settings.nextSelector){
|
655 |
-
$(slider.settings.nextSelector).append(slider.controls.next);
|
656 |
-
}
|
657 |
-
// if prevSlector was supplied, populate it
|
658 |
-
if(slider.settings.prevSelector){
|
659 |
-
$(slider.settings.prevSelector).append(slider.controls.prev);
|
660 |
-
}
|
661 |
-
// if no custom selectors were supplied
|
662 |
-
if(!slider.settings.nextSelector && !slider.settings.prevSelector){
|
663 |
-
// add the controls to the DOM
|
664 |
-
slider.controls.directionEl = $('<div class="soliloquy-controls-direction" />');
|
665 |
-
// add the control elements to the directionEl
|
666 |
-
slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next);
|
667 |
-
// slider.viewport.append(slider.controls.directionEl);
|
668 |
-
slider.controls.el.addClass('soliloquy-has-controls-direction').append(slider.controls.directionEl);
|
669 |
-
}
|
670 |
-
}
|
671 |
-
|
672 |
-
/**
|
673 |
-
* Appends start / stop auto controls to the controls element
|
674 |
-
*/
|
675 |
-
var appendControlsAuto = function(){
|
676 |
-
slider.controls.start = $('<div class="soliloquy-controls-auto-item"><a class="soliloquy-start" href=""><span>' + slider.settings.startText + '</span></a></div>');
|
677 |
-
slider.controls.stop = $('<div class="soliloquy-controls-auto-item"><a class="soliloquy-stop" href=""><span>' + slider.settings.stopText + '</span></a></div>');
|
678 |
-
// add the controls to the DOM
|
679 |
-
slider.controls.autoEl = $('<div class="soliloquy-controls-auto" />');
|
680 |
-
// bind click actions to the controls
|
681 |
-
slider.controls.autoEl.on('click', '.soliloquy-start', clickStartBind);
|
682 |
-
slider.controls.autoEl.on('click', '.soliloquy-stop', clickStopBind);
|
683 |
-
// if autoControlsCombine, insert only the "start" control
|
684 |
-
if(slider.settings.autoControlsCombine){
|
685 |
-
slider.controls.autoEl.append(slider.controls.start);
|
686 |
-
// if autoControlsCombine is false, insert both controls
|
687 |
-
}else{
|
688 |
-
slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop);
|
689 |
-
}
|
690 |
-
// if auto controls selector was supplied, populate it with the controls
|
691 |
-
if(slider.settings.autoControlsSelector){
|
692 |
-
$(slider.settings.autoControlsSelector).html(slider.controls.autoEl);
|
693 |
-
// if auto controls selector was not supplied, add it after the wrapper
|
694 |
-
}else{
|
695 |
-
slider.controls.el.addClass('soliloquy-has-controls-auto').append(slider.controls.autoEl);
|
696 |
-
}
|
697 |
-
// update the auto controls
|
698 |
-
updateAutoControls(slider.settings.autoStart ? 'stop' : 'start');
|
699 |
-
}
|
700 |
-
|
701 |
-
/**
|
702 |
-
* Appends image captions to the DOM
|
703 |
-
*/
|
704 |
-
var appendCaptions = function(){
|
705 |
-
// cycle through each child
|
706 |
-
slider.children.each(function(index){
|
707 |
-
// get the image title attribute
|
708 |
-
var title = $(this).find('img:first').attr('title');
|
709 |
-
// append the caption
|
710 |
-
if (title != undefined && ('' + title).length) {
|
711 |
-
$(this).append('<div class="soliloquy-caption"><span>' + title + '</span></div>');
|
712 |
-
}
|
713 |
-
});
|
714 |
-
}
|
715 |
-
|
716 |
-
/**
|
717 |
-
* Click next binding
|
718 |
-
*
|
719 |
-
* @param e (event)
|
720 |
-
* - DOM event object
|
721 |
-
*/
|
722 |
-
var clickNextBind = function(e){
|
723 |
-
// if auto show is running, stop it
|
724 |
-
if (slider.settings.auto) el.stopAuto();
|
725 |
-
el.goToNextSlide();
|
726 |
-
e.preventDefault();
|
727 |
-
}
|
728 |
-
|
729 |
-
/**
|
730 |
-
* Click prev binding
|
731 |
-
*
|
732 |
-
* @param e (event)
|
733 |
-
* - DOM event object
|
734 |
-
*/
|
735 |
-
var clickPrevBind = function(e){
|
736 |
-
// if auto show is running, stop it
|
737 |
-
if (slider.settings.auto) el.stopAuto();
|
738 |
-
el.goToPrevSlide();
|
739 |
-
e.preventDefault();
|
740 |
-
}
|
741 |
-
|
742 |
-
/**
|
743 |
-
* Click start binding
|
744 |
-
*
|
745 |
-
* @param e (event)
|
746 |
-
* - DOM event object
|
747 |
-
*/
|
748 |
-
var clickStartBind = function(e){
|
749 |
-
el.startAuto();
|
750 |
-
e.preventDefault();
|
751 |
-
}
|
752 |
-
|
753 |
-
/**
|
754 |
-
* Click stop binding
|
755 |
-
*
|
756 |
-
* @param e (event)
|
757 |
-
* - DOM event object
|
758 |
-
*/
|
759 |
-
var clickStopBind = function(e){
|
760 |
-
el.stopAuto();
|
761 |
-
e.preventDefault();
|
762 |
-
}
|
763 |
-
|
764 |
-
/**
|
765 |
-
* Click pager binding
|
766 |
-
*
|
767 |
-
* @param e (event)
|
768 |
-
* - DOM event object
|
769 |
-
*/
|
770 |
-
var clickPagerBind = function(e){
|
771 |
-
// if auto show is running, stop it
|
772 |
-
if (slider.settings.auto) el.stopAuto();
|
773 |
-
var pagerLink = $(e.currentTarget);
|
774 |
-
if(pagerLink.attr('data-slide-index') !== undefined){
|
775 |
-
var pagerIndex = parseInt(pagerLink.attr('data-slide-index'));
|
776 |
-
// if clicked pager link is not active, continue with the goToSlide call
|
777 |
-
if(pagerIndex != slider.active.index) el.goToSlide(pagerIndex);
|
778 |
-
e.preventDefault();
|
779 |
-
}
|
780 |
-
}
|
781 |
-
|
782 |
-
/**
|
783 |
-
* Updates the pager links with an active class
|
784 |
-
*
|
785 |
-
* @param slideIndex (int)
|
786 |
-
* - index of slide to make active
|
787 |
-
*/
|
788 |
-
var updatePagerActive = function(slideIndex){
|
789 |
-
// if "short" pager type
|
790 |
-
var len = slider.children.length; // nb of children
|
791 |
-
if(slider.settings.pagerType == 'short'){
|
792 |
-
if(slider.settings.maxSlides > 1) {
|
793 |
-
len = Math.ceil(slider.children.length/slider.settings.maxSlides);
|
794 |
-
}
|
795 |
-
slider.pagerEl.html( (slideIndex + 1) + slider.settings.pagerShortSeparator + len);
|
796 |
-
return;
|
797 |
-
}
|
798 |
-
// remove all pager active classes
|
799 |
-
slider.pagerEl.find('a').removeClass('active');
|
800 |
-
// apply the active class for all pagers
|
801 |
-
slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); });
|
802 |
-
}
|
803 |
-
|
804 |
-
/**
|
805 |
-
* Performs needed actions after a slide transition
|
806 |
-
*/
|
807 |
-
var updateAfterSlideTransition = function(){
|
808 |
-
// if infinte loop is true
|
809 |
-
if(slider.settings.infiniteLoop){
|
810 |
-
var position = '';
|
811 |
-
// first slide
|
812 |
-
if(slider.active.index == 0){
|
813 |
-
// set the new position
|
814 |
-
position = slider.children.eq(0).position();
|
815 |
-
// carousel, last slide
|
816 |
-
}else if(slider.active.index == getPagerQty() - 1 && slider.carousel){
|
817 |
-
position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position();
|
818 |
-
// last slide
|
819 |
-
}else if(slider.active.index == slider.children.length - 1){
|
820 |
-
position = slider.children.eq(slider.children.length - 1).position();
|
821 |
-
}
|
822 |
-
if(position){
|
823 |
-
if (slider.settings.mode == 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
|
824 |
-
else if (slider.settings.mode == 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
|
825 |
-
}
|
826 |
-
}
|
827 |
-
// declare that the transition is complete
|
828 |
-
slider.working = false;
|
829 |
-
// Added by Thomas
|
830 |
-
if(slider.settings.mode == 'fade'){
|
831 |
-
slider.viewport.css({overflow:''});
|
832 |
-
}
|
833 |
-
// onSlideAfter callback
|
834 |
-
slider.settings.onSlideAfter(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
|
835 |
-
}
|
836 |
-
|
837 |
-
/**
|
838 |
-
* Updates the auto controls state (either active, or combined switch)
|
839 |
-
*
|
840 |
-
* @param state (string) "start", "stop"
|
841 |
-
* - the new state of the auto show
|
842 |
-
*/
|
843 |
-
var updateAutoControls = function(state){
|
844 |
-
// if autoControlsCombine is true, replace the current control with the new state
|
845 |
-
if(slider.settings.autoControlsCombine){
|
846 |
-
slider.controls.autoEl.html(slider.controls[state]);
|
847 |
-
// if autoControlsCombine is false, apply the "active" class to the appropriate control
|
848 |
-
}else{
|
849 |
-
slider.controls.autoEl.find('a').removeClass('active');
|
850 |
-
slider.controls.autoEl.find('a:not(.soliloquy-' + state + ')').addClass('active');
|
851 |
-
}
|
852 |
-
}
|
853 |
-
|
854 |
-
/**
|
855 |
-
* Updates the direction controls (checks if either should be hidden)
|
856 |
-
*/
|
857 |
-
var updateDirectionControls = function(){
|
858 |
-
if(getPagerQty() == 1){
|
859 |
-
slider.controls.prev.addClass('disabled');
|
860 |
-
slider.controls.next.addClass('disabled');
|
861 |
-
}else if(!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd){
|
862 |
-
// if first slide
|
863 |
-
if (slider.active.index == 0){
|
864 |
-
slider.controls.prev.addClass('disabled');
|
865 |
-
slider.controls.next.removeClass('disabled');
|
866 |
-
// if last slide
|
867 |
-
}else if(slider.active.index == getPagerQty() - 1){
|
868 |
-
slider.controls.next.addClass('disabled');
|
869 |
-
slider.controls.prev.removeClass('disabled');
|
870 |
-
// if any slide in the middle
|
871 |
-
}else{
|
872 |
-
slider.controls.prev.removeClass('disabled');
|
873 |
-
slider.controls.next.removeClass('disabled');
|
874 |
-
}
|
875 |
-
}
|
876 |
-
}
|
877 |
-
|
878 |
-
/**
|
879 |
-
* Initialzes the auto process
|
880 |
-
*/
|
881 |
-
var initAuto = function(){
|
882 |
-
// if autoDelay was supplied, launch the auto show using a setTimeout() call
|
883 |
-
if(slider.settings.autoDelay > 0){
|
884 |
-
var timeout = setTimeout(el.startAuto, slider.settings.autoDelay);
|
885 |
-
// if autoDelay was not supplied, start the auto show normally
|
886 |
-
}else{
|
887 |
-
el.startAuto();
|
888 |
-
}
|
889 |
-
// if autoHover is requested
|
890 |
-
if(slider.settings.autoHover){
|
891 |
-
// on el hover
|
892 |
-
el.hover(function(){
|
893 |
-
// if the auto show is currently playing (has an active interval)
|
894 |
-
if(slider.interval){
|
895 |
-
// stop the auto show and pass true agument which will prevent control update
|
896 |
-
el.stopAuto(true);
|
897 |
-
// create a new autoPaused value which will be used by the relative "mouseout" event
|
898 |
-
slider.autoPaused = true;
|
899 |
-
}
|
900 |
-
}, function(){
|
901 |
-
// if the autoPaused value was created be the prior "mouseover" event
|
902 |
-
if(slider.autoPaused){
|
903 |
-
// start the auto show and pass true agument which will prevent control update
|
904 |
-
el.startAuto(true);
|
905 |
-
// reset the autoPaused value
|
906 |
-
slider.autoPaused = null;
|
907 |
-
}
|
908 |
-
});
|
909 |
-
}
|
910 |
-
}
|
911 |
-
|
912 |
-
/**
|
913 |
-
* Initialzes the ticker process
|
914 |
-
*/
|
915 |
-
var initTicker = function(){
|
916 |
-
var startPosition = 0;
|
917 |
-
// if autoDirection is "next", append a clone of the entire slider
|
918 |
-
if(slider.settings.autoDirection == 'next'){
|
919 |
-
el.append(slider.children.clone().addClass('soliloquy-clone'));
|
920 |
-
// if autoDirection is "prev", prepend a clone of the entire slider, and set the left position
|
921 |
-
}else{
|
922 |
-
el.prepend(slider.children.clone().addClass('soliloquy-clone'));
|
923 |
-
var position = slider.children.first().position();
|
924 |
-
startPosition = slider.settings.mode == 'horizontal' ? -position.left : -position.top;
|
925 |
-
}
|
926 |
-
setPositionProperty(startPosition, 'reset', 0);
|
927 |
-
// do not allow controls in ticker mode
|
928 |
-
slider.settings.pager = false;
|
929 |
-
slider.settings.controls = false;
|
930 |
-
slider.settings.autoControls = false;
|
931 |
-
// if autoHover is requested
|
932 |
-
if(slider.settings.tickerHover && !slider.usingCSS){
|
933 |
-
// on el hover
|
934 |
-
slider.viewport.hover(function(){
|
935 |
-
el.stop();
|
936 |
-
}, function(){
|
937 |
-
// calculate the total width of children (used to calculate the speed ratio)
|
938 |
-
var totalDimens = 0;
|
939 |
-
slider.children.each(function(index){
|
940 |
-
totalDimens += slider.settings.mode == 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
|
941 |
-
});
|
942 |
-
// calculate the speed ratio (used to determine the new speed to finish the paused animation)
|
943 |
-
var ratio = slider.settings.speed / totalDimens;
|
944 |
-
// determine which property to use
|
945 |
-
var property = slider.settings.mode == 'horizontal' ? 'left' : 'top';
|
946 |
-
// calculate the new speed
|
947 |
-
var newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property)))));
|
948 |
-
tickerLoop(newSpeed);
|
949 |
-
});
|
950 |
-
}
|
951 |
-
// start the ticker loop
|
952 |
-
tickerLoop();
|
953 |
-
}
|
954 |
-
|
955 |
-
/**
|
956 |
-
* Runs a continuous loop, news ticker-style
|
957 |
-
*/
|
958 |
-
var tickerLoop = function(resumeSpeed){
|
959 |
-
speed = resumeSpeed ? resumeSpeed : slider.settings.speed;
|
960 |
-
var position = {left: 0, top: 0};
|
961 |
-
var reset = {left: 0, top: 0};
|
962 |
-
// if "next" animate left position to last child, then reset left to 0
|
963 |
-
if(slider.settings.autoDirection == 'next'){
|
964 |
-
position = el.find('.soliloquy-clone').first().position();
|
965 |
-
// if "prev" animate left position to 0, then reset left to first non-clone child
|
966 |
-
}else{
|
967 |
-
reset = slider.children.first().position();
|
968 |
-
}
|
969 |
-
var animateProperty = slider.settings.mode == 'horizontal' ? -position.left : -position.top;
|
970 |
-
var resetValue = slider.settings.mode == 'horizontal' ? -reset.left : -reset.top;
|
971 |
-
var params = {resetValue: resetValue};
|
972 |
-
setPositionProperty(animateProperty, 'ticker', speed, params);
|
973 |
-
}
|
974 |
-
|
975 |
-
/**
|
976 |
-
* Initializes touch events
|
977 |
-
*/
|
978 |
-
var initTouch = function(){
|
979 |
-
// initialize object to contain all touch values
|
980 |
-
slider.touch = {
|
981 |
-
start: {x: 0, y: 0},
|
982 |
-
end: {x: 0, y: 0}
|
983 |
-
}
|
984 |
-
slider.viewport.bind('touchstart', onTouchStart);
|
985 |
-
}
|
986 |
-
|
987 |
-
/**
|
988 |
-
* Event handler for "touchstart"
|
989 |
-
*
|
990 |
-
* @param e (event)
|
991 |
-
* - DOM event object
|
992 |
-
*/
|
993 |
-
var onTouchStart = function(e){
|
994 |
-
if(slider.working){
|
995 |
-
e.preventDefault();
|
996 |
-
}else{
|
997 |
-
// record the original position when touch starts
|
998 |
-
slider.touch.originalPos = el.position();
|
999 |
-
var orig = e.originalEvent;
|
1000 |
-
// record the starting touch x, y coordinates
|
1001 |
-
slider.touch.start.x = orig.changedTouches[0].pageX;
|
1002 |
-
slider.touch.start.y = orig.changedTouches[0].pageY;
|
1003 |
-
// bind a "touchmove" event to the viewport
|
1004 |
-
slider.viewport.bind('touchmove', onTouchMove);
|
1005 |
-
// bind a "touchend" event to the viewport
|
1006 |
-
slider.viewport.bind('touchend', onTouchEnd);
|
1007 |
-
}
|
1008 |
-
}
|
1009 |
-
|
1010 |
-
/**
|
1011 |
-
* Event handler for "touchmove"
|
1012 |
-
*
|
1013 |
-
* @param e (event)
|
1014 |
-
* - DOM event object
|
1015 |
-
*/
|
1016 |
-
var onTouchMove = function(e){
|
1017 |
-
var orig = e.originalEvent;
|
1018 |
-
// if scrolling on y axis, do not prevent default
|
1019 |
-
var xMovement = Math.abs(orig.changedTouches[0].pageX - slider.touch.start.x);
|
1020 |
-
var yMovement = Math.abs(orig.changedTouches[0].pageY - slider.touch.start.y);
|
1021 |
-
// x axis swipe
|
1022 |
-
if((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX){
|
1023 |
-
e.preventDefault();
|
1024 |
-
// y axis swipe
|
1025 |
-
}else if((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY){
|
1026 |
-
e.preventDefault();
|
1027 |
-
}
|
1028 |
-
if(slider.settings.mode != 'fade' && slider.settings.oneToOneTouch){
|
1029 |
-
var value = 0;
|
1030 |
-
// if horizontal, drag along x axis
|
1031 |
-
if(slider.settings.mode == 'horizontal'){
|
1032 |
-
var change = orig.changedTouches[0].pageX - slider.touch.start.x;
|
1033 |
-
value = slider.touch.originalPos.left + change;
|
1034 |
-
// if vertical, drag along y axis
|
1035 |
-
}else{
|
1036 |
-
var change = orig.changedTouches[0].pageY - slider.touch.start.y;
|
1037 |
-
value = slider.touch.originalPos.top + change;
|
1038 |
-
}
|
1039 |
-
setPositionProperty(value, 'reset', 0);
|
1040 |
-
}
|
1041 |
-
}
|
1042 |
-
|
1043 |
-
/**
|
1044 |
-
* Event handler for "touchend"
|
1045 |
-
*
|
1046 |
-
* @param e (event)
|
1047 |
-
* - DOM event object
|
1048 |
-
*/
|
1049 |
-
var onTouchEnd = function(e){
|
1050 |
-
slider.viewport.unbind('touchmove', onTouchMove);
|
1051 |
-
var orig = e.originalEvent;
|
1052 |
-
var value = 0;
|
1053 |
-
// record end x, y positions
|
1054 |
-
slider.touch.end.x = orig.changedTouches[0].pageX;
|
1055 |
-
slider.touch.end.y = orig.changedTouches[0].pageY;
|
1056 |
-
// if fade mode, check if absolute x distance clears the threshold
|
1057 |
-
if(slider.settings.mode == 'fade'){
|
1058 |
-
var distance = Math.abs(slider.touch.start.x - slider.touch.end.x);
|
1059 |
-
if(distance >= slider.settings.swipeThreshold){
|
1060 |
-
slider.touch.start.x > slider.touch.end.x ? el.goToNextSlide() : el.goToPrevSlide();
|
1061 |
-
el.stopAuto();
|
1062 |
-
}
|
1063 |
-
// not fade mode
|
1064 |
-
}else{
|
1065 |
-
var distance = 0;
|
1066 |
-
// calculate distance and el's animate property
|
1067 |
-
if(slider.settings.mode == 'horizontal'){
|
1068 |
-
distance = slider.touch.end.x - slider.touch.start.x;
|
1069 |
-
value = slider.touch.originalPos.left;
|
1070 |
-
}else{
|
1071 |
-
distance = slider.touch.end.y - slider.touch.start.y;
|
1072 |
-
value = slider.touch.originalPos.top;
|
1073 |
-
}
|
1074 |
-
// if not infinite loop and first / last slide, do not attempt a slide transition
|
1075 |
-
if(!slider.settings.infiniteLoop && ((slider.active.index == 0 && distance > 0) || (slider.active.last && distance < 0))){
|
1076 |
-
setPositionProperty(value, 'reset', 200);
|
1077 |
-
}else{
|
1078 |
-
// check if distance clears threshold
|
1079 |
-
if(Math.abs(distance) >= slider.settings.swipeThreshold){
|
1080 |
-
distance < 0 ? el.goToNextSlide() : el.goToPrevSlide();
|
1081 |
-
el.stopAuto();
|
1082 |
-
}else{
|
1083 |
-
// el.animate(property, 200);
|
1084 |
-
setPositionProperty(value, 'reset', 200);
|
1085 |
-
}
|
1086 |
-
}
|
1087 |
-
}
|
1088 |
-
slider.viewport.unbind('touchend', onTouchEnd);
|
1089 |
-
}
|
1090 |
-
|
1091 |
-
/**
|
1092 |
-
* Window resize event callback
|
1093 |
-
*/
|
1094 |
-
var resizeWindow = function(e){
|
1095 |
-
// don't do anything if slider isn't initialized.
|
1096 |
-
if(!slider.initialized) return;
|
1097 |
-
// get the new window dimens (again, thank you IE)
|
1098 |
-
var windowWidthNew = $(window).width();
|
1099 |
-
var windowHeightNew = $(window).height();
|
1100 |
-
// make sure that it is a true window resize
|
1101 |
-
// *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements
|
1102 |
-
// are resized. Can you just die already?*
|
1103 |
-
if(windowWidth != windowWidthNew || windowHeight != windowHeightNew){
|
1104 |
-
// set the new window dimens
|
1105 |
-
windowWidth = windowWidthNew;
|
1106 |
-
windowHeight = windowHeightNew;
|
1107 |
-
// update all dynamic elements
|
1108 |
-
el.redrawSlider();
|
1109 |
-
// Call user resize handler
|
1110 |
-
slider.settings.onSliderResize.call(el, slider.active.index);
|
1111 |
-
}
|
1112 |
-
}
|
1113 |
-
|
1114 |
-
/**
|
1115 |
-
* ===================================================================================
|
1116 |
-
* = PUBLIC FUNCTIONS
|
1117 |
-
* ===================================================================================
|
1118 |
-
*/
|
1119 |
-
|
1120 |
-
/**
|
1121 |
-
* Performs slide transition to the specified slide
|
1122 |
-
*
|
1123 |
-
* @param slideIndex (int)
|
1124 |
-
* - the destination slide's index (zero-based)
|
1125 |
-
*
|
1126 |
-
* @param direction (string)
|
1127 |
-
* - INTERNAL USE ONLY - the direction of travel ("prev" / "next")
|
1128 |
-
*/
|
1129 |
-
el.goToSlide = function(slideIndex, direction){
|
1130 |
-
// if plugin is currently in motion, ignore request
|
1131 |
-
if(slider.working || slider.active.index == slideIndex) return;
|
1132 |
-
// declare that plugin is in motion
|
1133 |
-
slider.working = true;
|
1134 |
-
// store the old index
|
1135 |
-
slider.oldIndex = slider.active.index;
|
1136 |
-
// if slideIndex is less than zero, set active index to last child (this happens during infinite loop)
|
1137 |
-
if(slideIndex < 0){
|
1138 |
-
slider.active.index = getPagerQty() - 1;
|
1139 |
-
// if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
|
1140 |
-
}else if(slideIndex >= getPagerQty()){
|
1141 |
-
slider.active.index = 0;
|
1142 |
-
// set active index to requested slide
|
1143 |
-
}else{
|
1144 |
-
slider.active.index = slideIndex;
|
1145 |
-
}
|
1146 |
-
// onSlideBefore, onSlideNext, onSlidePrev callbacks
|
1147 |
-
slider.settings.onSlideBefore(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
|
1148 |
-
if(direction == 'next'){
|
1149 |
-
slider.settings.onSlideNext(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
|
1150 |
-
}else if(direction == 'prev'){
|
1151 |
-
slider.settings.onSlidePrev(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
|
1152 |
-
}
|
1153 |
-
// check if last slide
|
1154 |
-
slider.active.last = slider.active.index >= getPagerQty() - 1;
|
1155 |
-
// update the pager with active class
|
1156 |
-
if(slider.settings.pager) updatePagerActive(slider.active.index);
|
1157 |
-
// // check for direction control update
|
1158 |
-
if(slider.settings.controls) updateDirectionControls();
|
1159 |
-
// if slider is set to mode: "fade"
|
1160 |
-
if(slider.settings.mode == 'fade'){
|
1161 |
-
// Added by Thomas
|
1162 |
-
slider.viewport.css({overflow:'hidden'});
|
1163 |
-
// if adaptiveHeight is true and next height is different from current height, animate to the new height
|
1164 |
-
if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHeight()){
|
1165 |
-
slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
|
1166 |
-
}
|
1167 |
-
// fade out the visible child and reset its z-index value
|
1168 |
-
slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
|
1169 |
-
// fade in the newly requested slide
|
1170 |
-
slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex+1).fadeIn(slider.settings.speed, function(){
|
1171 |
-
$(this).css('zIndex', slider.settings.slideZIndex);
|
1172 |
-
updateAfterSlideTransition();
|
1173 |
-
});
|
1174 |
-
// slider mode is not "fade"
|
1175 |
-
}else{
|
1176 |
-
// if adaptiveHeight is true and next height is different from current height, animate to the new height
|
1177 |
-
if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHeight()){
|
1178 |
-
slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
|
1179 |
-
}
|
1180 |
-
var moveBy = 0;
|
1181 |
-
var position = {left: 0, top: 0};
|
1182 |
-
// if carousel and not infinite loop
|
1183 |
-
if(!slider.settings.infiniteLoop && slider.carousel && slider.active.last){
|
1184 |
-
if(slider.settings.mode == 'horizontal'){
|
1185 |
-
// get the last child position
|
1186 |
-
var lastChild = slider.children.eq(slider.children.length - 1);
|
1187 |
-
position = lastChild.position();
|
1188 |
-
// calculate the position of the last slide
|
1189 |
-
moveBy = slider.viewport.width() - lastChild.outerWidth();
|
1190 |
-
}else{
|
1191 |
-
// get last showing index position
|
1192 |
-
var lastShowingIndex = slider.children.length - slider.settings.minSlides;
|
1193 |
-
position = slider.children.eq(lastShowingIndex).position();
|
1194 |
-
}
|
1195 |
-
// horizontal carousel, going previous while on first slide (infiniteLoop mode)
|
1196 |
-
}else if(slider.carousel && slider.active.last && direction == 'prev'){
|
1197 |
-
// get the last child position
|
1198 |
-
var eq = slider.settings.moveSlides == 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides);
|
1199 |
-
var lastChild = el.children('.soliloquy-clone').eq(eq);
|
1200 |
-
position = lastChild.position();
|
1201 |
-
// if infinite loop and "Next" is clicked on the last slide
|
1202 |
-
}else if(direction == 'next' && slider.active.index == 0){
|
1203 |
-
// get the last clone position
|
1204 |
-
position = el.find('> .soliloquy-clone').eq(slider.settings.maxSlides).position();
|
1205 |
-
slider.active.last = false;
|
1206 |
-
// normal non-zero requests
|
1207 |
-
}else if(slideIndex >= 0){
|
1208 |
-
var requestEl = slideIndex * getMoveBy();
|
1209 |
-
position = slider.children.eq(requestEl).position();
|
1210 |
-
}
|
1211 |
-
|
1212 |
-
/* If the position doesn't exist
|
1213 |
-
* (e.g. if you destroy the slider on a next click),
|
1214 |
-
* it doesn't throw an error.
|
1215 |
-
*/
|
1216 |
-
if ("undefined" !== typeof(position)) {
|
1217 |
-
var value = slider.settings.mode == 'horizontal' ? -(position.left - moveBy) : -position.top;
|
1218 |
-
// plugin values to be animated
|
1219 |
-
setPositionProperty(value, 'slide', slider.settings.speed);
|
1220 |
-
}
|
1221 |
-
}
|
1222 |
-
}
|
1223 |
-
|
1224 |
-
/**
|
1225 |
-
* Transitions to the next slide in the show
|
1226 |
-
*/
|
1227 |
-
el.goToNextSlide = function(){
|
1228 |
-
// if infiniteLoop is false and last page is showing, disregard call
|
1229 |
-
if (!slider.settings.infiniteLoop && slider.active.last) return;
|
1230 |
-
var pagerIndex = parseInt(slider.active.index) + 1;
|
1231 |
-
el.goToSlide(pagerIndex, 'next');
|
1232 |
-
}
|
1233 |
-
|
1234 |
-
/**
|
1235 |
-
* Transitions to the prev slide in the show
|
1236 |
-
*/
|
1237 |
-
el.goToPrevSlide = function(){
|
1238 |
-
// if infiniteLoop is false and last page is showing, disregard call
|
1239 |
-
if (!slider.settings.infiniteLoop && slider.active.index == 0) return;
|
1240 |
-
var pagerIndex = parseInt(slider.active.index) - 1;
|
1241 |
-
el.goToSlide(pagerIndex, 'prev');
|
1242 |
-
}
|
1243 |
-
|
1244 |
-
/**
|
1245 |
-
* Starts the auto show
|
1246 |
-
*
|
1247 |
-
* @param preventControlUpdate (boolean)
|
1248 |
-
* - if true, auto controls state will not be updated
|
1249 |
-
*/
|
1250 |
-
el.startAuto = function(preventControlUpdate){
|
1251 |
-
// if an interval already exists, disregard call
|
1252 |
-
if(slider.interval) return;
|
1253 |
-
// create an interval
|
1254 |
-
slider.interval = setInterval(function(){
|
1255 |
-
slider.settings.autoDirection == 'next' ? el.goToNextSlide() : el.goToPrevSlide();
|
1256 |
-
}, slider.settings.pause);
|
1257 |
-
// if auto controls are displayed and preventControlUpdate is not true
|
1258 |
-
if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('stop');
|
1259 |
-
}
|
1260 |
-
|
1261 |
-
/**
|
1262 |
-
* Stops the auto show
|
1263 |
-
*
|
1264 |
-
* @param preventControlUpdate (boolean)
|
1265 |
-
* - if true, auto controls state will not be updated
|
1266 |
-
*/
|
1267 |
-
el.stopAuto = function(preventControlUpdate){
|
1268 |
-
// if no interval exists, disregard call
|
1269 |
-
if(!slider.interval) return;
|
1270 |
-
// clear the interval
|
1271 |
-
clearInterval(slider.interval);
|
1272 |
-
slider.interval = null;
|
1273 |
-
// if auto controls are displayed and preventControlUpdate is not true
|
1274 |
-
if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('start');
|
1275 |
-
}
|
1276 |
-
|
1277 |
-
/**
|
1278 |
-
* Returns current slide index (zero-based)
|
1279 |
-
*/
|
1280 |
-
el.getCurrentSlide = function(){
|
1281 |
-
return slider.active.index;
|
1282 |
-
}
|
1283 |
-
|
1284 |
-
/**
|
1285 |
-
* Returns current slide element
|
1286 |
-
*/
|
1287 |
-
el.getCurrentSlideElement = function(){
|
1288 |
-
return slider.children.eq(slider.active.index);
|
1289 |
-
}
|
1290 |
-
|
1291 |
-
/**
|
1292 |
-
* Returns number of slides in show
|
1293 |
-
*/
|
1294 |
-
el.getSlideCount = function(){
|
1295 |
-
return slider.children.length;
|
1296 |
-
}
|
1297 |
-
|
1298 |
-
/**
|
1299 |
-
* Update all dynamic slider elements
|
1300 |
-
*/
|
1301 |
-
el.redrawSlider = function(){
|
1302 |
-
// resize all children in ratio to new screen size
|
1303 |
-
slider.children.add(el.find('.soliloquy-clone')).width(getSlideWidth());
|
1304 |
-
// adjust the height
|
1305 |
-
slider.viewport.css('height', getViewportHeight());
|
1306 |
-
// update the slide position
|
1307 |
-
if(!slider.settings.ticker) setSlidePosition();
|
1308 |
-
// if active.last was true before the screen resize, we want
|
1309 |
-
// to keep it last no matter what screen size we end on
|
1310 |
-
if (slider.active.last) slider.active.index = getPagerQty() - 1;
|
1311 |
-
// if the active index (page) no longer exists due to the resize, simply set the index as last
|
1312 |
-
if (slider.active.index >= getPagerQty()) slider.active.last = true;
|
1313 |
-
// if a pager is being displayed and a custom pager is not being used, update it
|
1314 |
-
if(slider.settings.pager && !slider.settings.pagerCustom){
|
1315 |
-
populatePager();
|
1316 |
-
updatePagerActive(slider.active.index);
|
1317 |
-
}
|
1318 |
-
}
|
1319 |
-
|
1320 |
-
/**
|
1321 |
-
* Destroy the current instance of the slider (revert everything back to original state)
|
1322 |
-
*/
|
1323 |
-
el.destroySlider = function(){
|
1324 |
-
// don't do anything if slider has already been destroyed
|
1325 |
-
if(!slider.initialized) return;
|
1326 |
-
slider.initialized = false;
|
1327 |
-
$('.soliloquy-clone', this).remove();
|
1328 |
-
slider.children.each(function() {
|
1329 |
-
$(this).data("origStyle") != undefined ? $(this).attr("style", $(this).data("origStyle")) : $(this).removeAttr('style');
|
1330 |
-
});
|
1331 |
-
$(this).data("origStyle") != undefined ? this.attr("style", $(this).data("origStyle")) : $(this).removeAttr('style');
|
1332 |
-
$(this).unwrap().unwrap();
|
1333 |
-
if(slider.controls.el) slider.controls.el.remove();
|
1334 |
-
if(slider.controls.next) slider.controls.next.remove();
|
1335 |
-
if(slider.controls.prev) slider.controls.prev.remove();
|
1336 |
-
if(slider.pagerEl && slider.settings.controls) slider.pagerEl.remove();
|
1337 |
-
$('.soliloquy-caption', this).remove();
|
1338 |
-
if(slider.controls.autoEl) slider.controls.autoEl.remove();
|
1339 |
-
clearInterval(slider.interval);
|
1340 |
-
if(slider.settings.responsive) $(window).unbind('resize', resizeWindow);
|
1341 |
-
}
|
1342 |
-
|
1343 |
-
/**
|
1344 |
-
* Reload the slider (revert all DOM changes, and re-initialize)
|
1345 |
-
*/
|
1346 |
-
el.reloadSlider = function(settings){
|
1347 |
-
if (settings != undefined) options = settings;
|
1348 |
-
el.destroySlider();
|
1349 |
-
init();
|
1350 |
-
}
|
1351 |
-
|
1352 |
-
init();
|
1353 |
-
|
1354 |
-
// returns the current jQuery object
|
1355 |
-
return this;
|
1356 |
-
}
|
1357 |
-
|
1358 |
-
})(jQuery);
|
1359 |
-
|
1360 |
-
// Mobile checker function.
|
1361 |
-
function soliloquyIsMobile() {
|
1362 |
-
var check = false;
|
1363 |
-
(function (a) {
|
1364 |
-
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true
|
1365 |
-
})(navigator.userAgent || navigator.vendor || window.opera);
|
1366 |
-
return check;
|
1367 |
-
}
|
1368 |
-
|
1369 |
-
// Video functions.
|
1370 |
-
function soliloquyYouTubeVids(data, id, width, height, holder, $){
|
1371 |
-
// Immediately make the holder visible and increase z-index to overlay the player icon.
|
1372 |
-
$('#' + holder).show().css({'display':'block','z-index':'1210'});
|
1373 |
-
|
1374 |
-
// Load a new video into the slider.
|
1375 |
-
if ( YT.Player ) {
|
1376 |
-
soliloquy_youtube[id] = new YT.Player(holder, {
|
1377 |
-
videoId: id,
|
1378 |
-
playerVars: data,
|
1379 |
-
events: {
|
1380 |
-
'onStateChange' : soliloquyYouTubeOnStateChange
|
1381 |
-
}
|
1382 |
-
});
|
1383 |
-
}
|
1384 |
-
}
|
1385 |
-
function soliloquyYouTubeOnStateChange(event){
|
1386 |
-
var id = jQuery(event.target.a).data('soliloquy-slider-id');
|
1387 |
-
// If the video has been paused or has finished playing, restart the slider.
|
1388 |
-
if ( event.data === YT.PlayerState.PAUSED || event.data === YT.PlayerState.ENDED ) {
|
1389 |
-
if ( soliloquy_slider[id] ) {
|
1390 |
-
soliloquy_slider[id].startAuto();
|
1391 |
-
}
|
1392 |
-
}
|
1393 |
-
|
1394 |
-
// If the video is playing, pause the slider.
|
1395 |
-
if ( event.data === YT.PlayerState.PLAYING ) {
|
1396 |
-
if ( soliloquy_slider[id] ) {
|
1397 |
-
soliloquy_slider[id].stopAuto();
|
1398 |
-
}
|
1399 |
-
}
|
1400 |
-
}
|
1401 |
-
function onYouTubeIframeAPIReady(){}
|
1402 |
-
function soliloquyVimeoVids(data, id, width, height, holder, $){
|
1403 |
-
// Immediately make the holder visible and increase z-index to overlay the player icon.
|
1404 |
-
$('#' + holder).show().css({'display':'block','z-index':'1210'});
|
1405 |
-
|
1406 |
-
// Load a new video into the slider.
|
1407 |
-
if ( $f ) {
|
1408 |
-
var attrs = {};
|
1409 |
-
$.each($('#' + holder)[0].attributes, function(idx, attr){
|
1410 |
-
attrs[attr.nodeName] = attr.nodeValue;
|
1411 |
-
});
|
1412 |
-
|
1413 |
-
// Add iframe specific attributes.
|
1414 |
-
data.player_id = holder;
|
1415 |
-
attrs.src = '//player.vimeo.com/video/' + id + '?' + $.param(data);
|
1416 |
-
attrs.frameborder = 0;
|
1417 |
-
|
1418 |
-
// Convert the holder to the video.
|
1419 |
-
$('#' + holder).replaceWith(function(){
|
1420 |
-
return $('<iframe />', attrs).append($(this).contents());
|
1421 |
-
});
|
1422 |
-
|
1423 |
-
// Store a reference to the video object for use with the API.
|
1424 |
-
soliloquy_vimeo[id] = $f($('#' + holder)[0]);
|
1425 |
-
soliloquy_vimeo[id].addEvent('ready', function(){
|
1426 |
-
soliloquy_vimeo[id].addEvent('play', soliloquyVimeoSliderPause);
|
1427 |
-
soliloquy_vimeo[id].addEvent('pause', soliloquyVimeoSliderStart);
|
1428 |
-
soliloquy_vimeo[id].addEvent('finish', soliloquyVimeoSliderStart);
|
1429 |
-
});
|
1430 |
-
}
|
1431 |
-
|
1432 |
-
}
|
1433 |
-
function soliloquyVimeoSliderPause(vid){
|
1434 |
-
var id = jQuery('#' + vid).data('soliloquy-slider-id');
|
1435 |
-
if ( soliloquy_slider[id] ) {
|
1436 |
-
soliloquy_slider[id].stopAuto();
|
1437 |
-
}
|
1438 |
-
}
|
1439 |
-
function soliloquyVimeoSliderStart(vid){
|
1440 |
-
var id = jQuery('#' + vid).data('soliloquy-slider-id');
|
1441 |
-
if ( soliloquy_slider[id] ) {
|
1442 |
-
soliloquy_slider[id].startAuto();
|
1443 |
-
}
|
1444 |
-
}
|
1445 |
-
function soliloquyWistiaVids(data, id, width, height, holder, $){
|
1446 |
-
// Immediately make the holder visible and increase z-index to overlay the player icon.
|
1447 |
-
$('#' + holder).show().css({'display':'block','z-index':'1210'});
|
1448 |
-
|
1449 |
-
if ( wistiaEmbeds ) {
|
1450 |
-
var attrs = {};
|
1451 |
-
$.each($('#' + holder)[0].attributes, function(idx, attr){
|
1452 |
-
attrs[attr.nodeName] = attr.nodeValue;
|
1453 |
-
});
|
1454 |
-
|
1455 |
-
// Add iframe specific attributes.
|
1456 |
-
data.container = holder;
|
1457 |
-
attrs.src = '//fast.wistia.net/embed/iframe/' + id + '?' + $.param(data);
|
1458 |
-
attrs.frameborder = 0;
|
1459 |
-
|
1460 |
-
// Convert the holder to the video.
|
1461 |
-
$('#' + holder).replaceWith(function(){
|
1462 |
-
return $('<iframe />', attrs).addClass('wistia_embed').append($(this).contents());
|
1463 |
-
});
|
1464 |
-
|
1465 |
-
wistiaEmbeds.onFind(function(video){
|
1466 |
-
if ( id == video.hashedId() ) {
|
1467 |
-
soliloquy_wistia[id] = video;
|
1468 |
-
soliloquy_wistia[id].bind('play', function(){
|
1469 |
-
var id = $(this.container).data('soliloquy-slider-id');
|
1470 |
-
if ( soliloquy_slider[id] ) {
|
1471 |
-
soliloquy_slider[id].stopAuto();
|
1472 |
-
}
|
1473 |
-
});
|
1474 |
-
soliloquy_wistia[id].bind('pause', function(){
|
1475 |
-
var id = $(this.container).data('soliloquy-slider-id');
|
1476 |
-
if ( soliloquy_slider[id] ) {
|
1477 |
-
soliloquy_slider[id].startAuto();
|
1478 |
-
}
|
1479 |
-
});
|
1480 |
-
soliloquy_wistia[id].bind('end', function(){
|
1481 |
-
var id = $(this.container).data('soliloquy-slider-id');
|
1482 |
-
if ( soliloquy_slider[id] ) {
|
1483 |
-
soliloquy_slider[id].startAuto();
|
1484 |
-
}
|
1485 |
-
});
|
1486 |
-
video.play();
|
1487 |
-
}
|
1488 |
-
});
|
1489 |
-
}
|
1490 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/soliloquy.js
CHANGED
@@ -1 +1,1490 @@
|
|
1 |
-
;(function(b){var a={};var c={keyboard:false,mode:"horizontal",slideSelector:"",infiniteLoop:true,hideControlOnEnd:false,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:false,captions:false,ticker:false,tickerHover:false,adaptiveHeight:false,adaptiveHeightSpeed:500,video:false,useCSS:true,preloadImages:"visible",responsive:true,slideZIndex:50,wrapperClass:"soliloquy-wrapper",touchEnabled:true,swipeThreshold:50,oneToOneTouch:true,preventDefaultSwipeX:true,preventDefaultSwipeY:false,pager:true,pagerType:"full",pagerShortSeparator:" / ",pagerSelector:null,buildPager:null,pagerCustom:null,controls:true,nextText:"Next",prevText:"Prev",nextSelector:null,prevSelector:null,autoControls:false,startText:"Start",stopText:"Stop",autoControlsCombine:false,autoControlsSelector:null,auto:false,pause:4000,autoStart:true,autoDirection:"next",autoHover:false,autoDelay:0,autoSlideForOnePage:false,minSlides:1,maxSlides:1,moveSlides:0,slideWidth:0,onSliderLoad:function(){},onSlideBefore:function(){},onSlideAfter:function(){},onSlideNext:function(){},onSlidePrev:function(){},onSliderResize:function(){}};b.fn.soliloquy=function(s){if(this.length==0){return this}if(this.length>1){this.each(function(){b(this).soliloquy(s)});return this}var j={};var H=this;a.el=this;var J=b(window).width();var M=b(window).height();var C=function(){j.settings=b.extend({},c,s);j.settings.slideWidth=parseInt(j.settings.slideWidth);j.children=H.children(j.settings.slideSelector);if(j.children.length<j.settings.minSlides){j.settings.minSlides=j.children.length}if(j.children.length<j.settings.maxSlides){j.settings.maxSlides=j.children.length}if(j.settings.randomStart){j.settings.startSlide=Math.floor(Math.random()*j.children.length)}j.active={index:j.settings.startSlide};j.carousel=j.settings.minSlides>1||j.settings.maxSlides>1;if(j.carousel){j.settings.preloadImages="all"}j.minThreshold=(j.settings.minSlides*j.settings.slideWidth)+((j.settings.minSlides-1)*j.settings.slideMargin);j.maxThreshold=(j.settings.maxSlides*j.settings.slideWidth)+((j.settings.maxSlides-1)*j.settings.slideMargin);j.working=false;j.controls={};j.interval=null;j.animProp=j.settings.mode=="vertical"?"top":"left";j.usingCSS=j.settings.useCSS&&j.settings.mode!="fade"&&(function(){var T=document.createElement("div");var S=["WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var R in S){if(T.style[S[R]]!==undefined){j.cssPrefix=S[R].replace("Perspective","").toLowerCase();j.animProp="-"+j.cssPrefix+"-transform";return true}}return false}());if(j.settings.mode=="vertical"){j.settings.maxSlides=j.settings.minSlides}H.data("origStyle",H.attr("style"));H.children(j.settings.slideSelector).each(function(){b(this).data("origStyle",b(this).attr("style"))});m()};var m=function(){H.wrap('<div class="'+j.settings.wrapperClass+'"><div class="soliloquy-viewport"></div></div>');j.viewport=H.parent();j.loader=b('<div class="soliloquy-loading" />');j.viewport.prepend(j.loader);H.css({width:j.settings.mode=="horizontal"?(j.children.length*100+215)+"%":"auto",position:"relative"});if(j.usingCSS&&j.settings.easing){H.css("-"+j.cssPrefix+"-transition-timing-function",j.settings.easing)}else{if(!j.settings.easing){j.settings.easing="swing"}}var R=A();j.viewport.css({width:"100%",position:"relative"});if(j.settings.mode!="fade"){j.viewport.css({overflow:"hidden"})}j.viewport.parent().css({maxWidth:L()});if(!j.settings.pager){j.viewport.parent().css({margin:"0 auto 0px"})}j.children.css({"float":"left",listStyle:"none",position:"relative"});j.children.css("width",D());if(j.settings.mode=="horizontal"&&j.settings.slideMargin>0){j.children.css("marginRight",j.settings.slideMargin)}if(j.settings.mode=="vertical"&&j.settings.slideMargin>0){j.children.css("marginBottom",j.settings.slideMargin)}if(j.settings.mode=="fade"){j.children.css({zIndex:0,display:"none",marginRight:"-100%",width:"100%"});j.children.eq(j.settings.startSlide).css({zIndex:j.settings.slideZIndex,display:"block"})}j.controls.el=b('<div class="soliloquy-controls" />');if(j.settings.captions){z()}j.active.last=j.settings.startSlide==v()-1;var S=j.children.eq(j.settings.startSlide);if(j.settings.preloadImages=="all"){S=j.children}if(!j.settings.ticker){if(j.settings.pager){O()}if(j.settings.controls){k()}if(j.settings.auto&&j.settings.autoControls){K()}if(j.settings.controls||j.settings.autoControls||j.settings.pager){j.viewport.after(j.controls.el)}}else{j.settings.pager=false}d(S,t)};var d=function(R,U){var T=R.find("img, iframe").length;if(T==0){U();return}var S=0;R.find("img, iframe").each(function(){b(this).one("load",function(){if(++S==T){U()}}).each(function(){if(this.complete){b(this).load()}})})};var t=function(){if(j.settings.infiniteLoop&&j.settings.mode!="fade"&&!j.settings.ticker){var T=j.settings.mode=="vertical"?j.settings.minSlides:j.settings.maxSlides;var S=j.children.slice(0,T).clone().addClass("soliloquy-clone");var R=j.children.slice(-T).clone().addClass("soliloquy-clone");H.append(S).prepend(R)}j.loader.remove();h();if(j.settings.mode=="vertical"){j.settings.adaptiveHeight=true}j.viewport.height(o());H.redrawSlider();j.settings.onSliderLoad(j.active.index);j.initialized=true;if(j.settings.responsive){b(window).bind("resize",n)}if(j.settings.auto&&j.settings.autoStart&&(v()>1||j.settings.autoSlideForOnePage)){e()}if(j.settings.ticker){F()}if(j.settings.pager){Q(j.settings.startSlide)}if(j.settings.controls){l()}if(j.settings.touchEnabled&&!j.settings.ticker){f()}if(j.settings.keyboard&&!j.settings.ticker){b(document).on("keydown",function(U){if(U.keyCode==39){g(U);return false}else{if(U.keyCode==37){N(U);return false}}})}};var o=function(){var R=0;var T=b();if(j.settings.mode!="vertical"&&!j.settings.adaptiveHeight){T=j.children}else{if(!j.carousel){T=j.children.eq(j.active.index)}else{var S=j.settings.moveSlides==1?j.active.index:j.active.index*q();T=j.children.eq(S);for(i=1;i<=j.settings.maxSlides-1;i++){if(S+i>=j.children.length){T=T.add(j.children.eq(i-1))}else{T=T.add(j.children.eq(S+i))}}}}if(j.settings.mode=="vertical"){T.each(function(U){R+=b(this).outerHeight()});if(j.settings.slideMargin>0){R+=j.settings.slideMargin*(j.settings.minSlides-1)}}else{R=Math.max.apply(Math,T.map(function(){return b(this).outerHeight(false)}).get())}if(j.viewport.css("box-sizing")=="border-box"){R+=parseFloat(j.viewport.css("padding-top"))+parseFloat(j.viewport.css("padding-bottom"))+parseFloat(j.viewport.css("border-top-width"))+parseFloat(j.viewport.css("border-bottom-width"))}else{if(j.viewport.css("box-sizing")=="padding-box"){R+=parseFloat(j.viewport.css("padding-top"))+parseFloat(j.viewport.css("padding-bottom"))}}return R};var L=function(){var R="100%";if(j.settings.slideWidth>0){if(j.settings.mode=="horizontal"){R=(j.settings.maxSlides*j.settings.slideWidth)+((j.settings.maxSlides-1)*j.settings.slideMargin)}else{R=j.settings.slideWidth}}return(j.settings.mode=="fade")?"100%":R};var D=function(){var S=j.settings.slideWidth;var R=j.viewport.width();if(j.settings.slideWidth==0||(j.settings.slideWidth>R&&!j.carousel)||j.settings.mode=="vertical"){S=R}else{if(j.settings.maxSlides>1&&j.settings.mode=="horizontal"){if(R>j.maxThreshold){}else{if(R<j.minThreshold){S=(R-(j.settings.slideMargin*(j.settings.minSlides-1)))/j.settings.minSlides}}}}return(j.settings.mode=="fade")?"100%":S};var A=function(){var S=1;if(j.settings.mode=="horizontal"&&j.settings.slideWidth>0){if(j.viewport.width()<j.minThreshold){S=j.settings.minSlides}else{if(j.viewport.width()>j.maxThreshold){S=j.settings.maxSlides}else{var R=j.children.first().width()+j.settings.slideMargin;S=Math.floor((j.viewport.width()+j.settings.slideMargin)/R)}}}else{if(j.settings.mode=="vertical"){S=j.settings.minSlides}}return S};var v=function(){var S=0;if(j.settings.moveSlides>0){if(j.settings.infiniteLoop){S=Math.ceil(j.children.length/q())}else{var T=0;var R=0;while(T<j.children.length){++S;T=R+A();R+=j.settings.moveSlides<=A()?j.settings.moveSlides:A()}}}else{S=Math.ceil(j.children.length/A())}return S};var q=function(){if(j.settings.moveSlides>0&&j.settings.moveSlides<=A()){return j.settings.moveSlides}return A()};var h=function(){if(j.children.length>j.settings.maxSlides&&j.active.last&&!j.settings.infiniteLoop){if(j.settings.mode=="horizontal"){var T=j.children.last();var R=T.position();B(-(R.left-(j.viewport.width()-T.outerWidth())),"reset",0)}else{if(j.settings.mode=="vertical"){var S=j.children.length-j.settings.minSlides;var R=j.children.eq(S).position();B(-R.top,"reset",0)}}}else{var R=j.children.eq(j.active.index*q()).position();if(j.active.index==v()-1){j.active.last=true}if(R!=undefined){if(j.settings.mode=="horizontal"){B(-R.left,"reset",0)}else{if(j.settings.mode=="vertical"){B(-R.top,"reset",0)}}}}};var B=function(T,S,U,W){if(j.usingCSS){var V=j.settings.mode=="vertical"?"translate3d(0, "+T+"px, 0)":"translate3d("+T+"px, 0, 0)";H.css("-"+j.cssPrefix+"-transition-duration",U/1000+"s");if(S=="slide"){H.css(j.animProp,V);H.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){H.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd");p()})}else{if(S=="reset"){H.css(j.animProp,V)}else{if(S=="ticker"){H.css("-"+j.cssPrefix+"-transition-timing-function","linear");H.css(j.animProp,V);H.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){H.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd");B(W.resetValue,"reset",0);u()})}}}}else{var R={};R[j.animProp]=T;if(S=="slide"){H.animate(R,U,j.settings.easing,function(){p()})}else{if(S=="reset"){H.css(j.animProp,T)}else{if(S=="ticker"){H.animate(R,speed,"linear",function(){B(W.resetValue,"reset",0);u()})}}}}};var r=function(){var U="";var T=v();for(var S=0;S<T;S++){var R="";if(j.settings.buildPager&&b.isFunction(j.settings.buildPager)){R=j.settings.buildPager(S);j.pagerEl.addClass("soliloquy-custom-pager")}else{R=S+1;j.pagerEl.addClass("soliloquy-default-pager")}U+='<div class="soliloquy-pager-item"><a href="" data-slide-index="'+S+'" class="soliloquy-pager-link"><span>'+R+"</span></a></div>"}j.pagerEl.html(U)};var O=function(){if(!j.settings.pagerCustom){j.pagerEl=b('<div class="soliloquy-pager" />');if(j.settings.pagerSelector){b(j.settings.pagerSelector).html(j.pagerEl)}else{j.controls.el.addClass("soliloquy-has-pager").append(j.pagerEl)}r()}else{j.pagerEl=b(j.settings.pagerCustom)}j.pagerEl.on("click","a",x)};var k=function(){j.controls.next=b('<a class="soliloquy-next" href=""><span>'+j.settings.nextText+"</span></a>");j.controls.prev=b('<a class="soliloquy-prev" href=""><span>'+j.settings.prevText+"</span></a>");j.controls.next.bind("click",g);j.controls.prev.bind("click",N);if(j.settings.nextSelector){b(j.settings.nextSelector).append(j.controls.next)}if(j.settings.prevSelector){b(j.settings.prevSelector).append(j.controls.prev)}if(!j.settings.nextSelector&&!j.settings.prevSelector){j.controls.directionEl=b('<div class="soliloquy-controls-direction" />');j.controls.directionEl.append(j.controls.prev).append(j.controls.next);j.controls.el.addClass("soliloquy-has-controls-direction").append(j.controls.directionEl)}};var K=function(){j.controls.start=b('<div class="soliloquy-controls-auto-item"><a class="soliloquy-start" href=""><span>'+j.settings.startText+"</span></a></div>");j.controls.stop=b('<div class="soliloquy-controls-auto-item"><a class="soliloquy-stop" href=""><span>'+j.settings.stopText+"</span></a></div>");j.controls.autoEl=b('<div class="soliloquy-controls-auto" />');j.controls.autoEl.on("click",".soliloquy-start",w);j.controls.autoEl.on("click",".soliloquy-stop",P);if(j.settings.autoControlsCombine){j.controls.autoEl.append(j.controls.start)}else{j.controls.autoEl.append(j.controls.start).append(j.controls.stop)}if(j.settings.autoControlsSelector){b(j.settings.autoControlsSelector).html(j.controls.autoEl)}else{j.controls.el.addClass("soliloquy-has-controls-auto").append(j.controls.autoEl)}G(j.settings.autoStart?"stop":"start")};var z=function(){j.children.each(function(R){var S=b(this).find("img:first").attr("title");if(S!=undefined&&(""+S).length){b(this).append('<div class="soliloquy-caption"><span>'+S+"</span></div>")}})};var g=function(R){if(j.settings.auto){H.stopAuto()}H.goToNextSlide();R.preventDefault()};var N=function(R){if(j.settings.auto){H.stopAuto()}H.goToPrevSlide();R.preventDefault()};var w=function(R){H.startAuto();R.preventDefault()};var P=function(R){H.stopAuto();R.preventDefault()};var x=function(T){if(j.settings.auto){H.stopAuto()}var S=b(T.currentTarget);if(S.attr("data-slide-index")!==undefined){var R=parseInt(S.attr("data-slide-index"));if(R!=j.active.index){H.goToSlide(R)}T.preventDefault()}};var Q=function(S){var R=j.children.length;if(j.settings.pagerType=="short"){if(j.settings.maxSlides>1){R=Math.ceil(j.children.length/j.settings.maxSlides)}j.pagerEl.html((S+1)+j.settings.pagerShortSeparator+R);return}j.pagerEl.find("a").removeClass("active");j.pagerEl.each(function(T,U){b(U).find("a").eq(S).addClass("active")})};var p=function(){if(j.settings.infiniteLoop){var R="";if(j.active.index==0){R=j.children.eq(0).position()}else{if(j.active.index==v()-1&&j.carousel){R=j.children.eq((v()-1)*q()).position()}else{if(j.active.index==j.children.length-1){R=j.children.eq(j.children.length-1).position()}}}if(R){if(j.settings.mode=="horizontal"){B(-R.left,"reset",0)}else{if(j.settings.mode=="vertical"){B(-R.top,"reset",0)}}}}j.working=false;if(j.settings.mode=="fade"){j.viewport.css({overflow:""})}j.settings.onSlideAfter(j.children.eq(j.active.index),j.oldIndex,j.active.index)};var G=function(R){if(j.settings.autoControlsCombine){j.controls.autoEl.html(j.controls[R])}else{j.controls.autoEl.find("a").removeClass("active");j.controls.autoEl.find("a:not(.soliloquy-"+R+")").addClass("active")}};var l=function(){if(v()==1){j.controls.prev.addClass("disabled");j.controls.next.addClass("disabled")}else{if(!j.settings.infiniteLoop&&j.settings.hideControlOnEnd){if(j.active.index==0){j.controls.prev.addClass("disabled");j.controls.next.removeClass("disabled")}else{if(j.active.index==v()-1){j.controls.next.addClass("disabled");j.controls.prev.removeClass("disabled")}else{j.controls.prev.removeClass("disabled");j.controls.next.removeClass("disabled")}}}}};var e=function(){if(j.settings.autoDelay>0){var R=setTimeout(H.startAuto,j.settings.autoDelay)}else{H.startAuto()}if(j.settings.autoHover){H.hover(function(){if(j.interval){H.stopAuto(true);j.autoPaused=true}},function(){if(j.autoPaused){H.startAuto(true);j.autoPaused=null}})}};var F=function(){var S=0;if(j.settings.autoDirection=="next"){H.append(j.children.clone().addClass("soliloquy-clone"))}else{H.prepend(j.children.clone().addClass("soliloquy-clone"));var R=j.children.first().position();S=j.settings.mode=="horizontal"?-R.left:-R.top}B(S,"reset",0);j.settings.pager=false;j.settings.controls=false;j.settings.autoControls=false;if(j.settings.tickerHover&&!j.usingCSS){j.viewport.hover(function(){H.stop()},function(){var W=0;j.children.each(function(X){W+=j.settings.mode=="horizontal"?b(this).outerWidth(true):b(this).outerHeight(true)});var T=j.settings.speed/W;var U=j.settings.mode=="horizontal"?"left":"top";var V=T*(W-(Math.abs(parseInt(H.css(U)))));u(V)})}u()};var u=function(W){speed=W?W:j.settings.speed;var R={left:0,top:0};var U={left:0,top:0};if(j.settings.autoDirection=="next"){R=H.find(".soliloquy-clone").first().position()}else{U=j.children.first().position()}var T=j.settings.mode=="horizontal"?-R.left:-R.top;var S=j.settings.mode=="horizontal"?-U.left:-U.top;var V={resetValue:S};B(T,"ticker",speed,V)};var f=function(){j.touch={start:{x:0,y:0},end:{x:0,y:0}};j.viewport.bind("touchstart",E)};var E=function(R){if(j.working){R.preventDefault()}else{j.touch.originalPos=H.position();var S=R.originalEvent;j.touch.start.x=S.changedTouches[0].pageX;j.touch.start.y=S.changedTouches[0].pageY;j.viewport.bind("touchmove",I);j.viewport.bind("touchend",y)}};var I=function(S){var W=S.originalEvent;var T=Math.abs(W.changedTouches[0].pageX-j.touch.start.x);var V=Math.abs(W.changedTouches[0].pageY-j.touch.start.y);if((T*3)>V&&j.settings.preventDefaultSwipeX){S.preventDefault()}else{if((V*3)>T&&j.settings.preventDefaultSwipeY){S.preventDefault()}}if(j.settings.mode!="fade"&&j.settings.oneToOneTouch){var R=0;if(j.settings.mode=="horizontal"){var U=W.changedTouches[0].pageX-j.touch.start.x;R=j.touch.originalPos.left+U}else{var U=W.changedTouches[0].pageY-j.touch.start.y;R=j.touch.originalPos.top+U}B(R,"reset",0)}};var y=function(S){j.viewport.unbind("touchmove",I);var U=S.originalEvent;var R=0;j.touch.end.x=U.changedTouches[0].pageX;j.touch.end.y=U.changedTouches[0].pageY;if(j.settings.mode=="fade"){var T=Math.abs(j.touch.start.x-j.touch.end.x);if(T>=j.settings.swipeThreshold){j.touch.start.x>j.touch.end.x?H.goToNextSlide():H.goToPrevSlide();H.stopAuto()}}else{var T=0;if(j.settings.mode=="horizontal"){T=j.touch.end.x-j.touch.start.x;R=j.touch.originalPos.left}else{T=j.touch.end.y-j.touch.start.y;R=j.touch.originalPos.top}if(!j.settings.infiniteLoop&&((j.active.index==0&&T>0)||(j.active.last&&T<0))){B(R,"reset",200)}else{if(Math.abs(T)>=j.settings.swipeThreshold){T<0?H.goToNextSlide():H.goToPrevSlide();H.stopAuto()}else{B(R,"reset",200)}}}j.viewport.unbind("touchend",y)};var n=function(S){if(!j.initialized){return}var R=b(window).width();var T=b(window).height();if(J!=R||M!=T){J=R;M=T;H.redrawSlider();j.settings.onSliderResize.call(H,j.active.index)}};H.goToSlide=function(V,X){if(j.working||j.active.index==V){return}j.working=true;j.oldIndex=j.active.index;if(V<0){j.active.index=v()-1}else{if(V>=v()){j.active.index=0}else{j.active.index=V}}j.settings.onSlideBefore(j.children.eq(j.active.index),j.oldIndex,j.active.index);if(X=="next"){j.settings.onSlideNext(j.children.eq(j.active.index),j.oldIndex,j.active.index)}else{if(X=="prev"){j.settings.onSlidePrev(j.children.eq(j.active.index),j.oldIndex,j.active.index)}}j.active.last=j.active.index>=v()-1;if(j.settings.pager){Q(j.active.index)}if(j.settings.controls){l()}if(j.settings.mode=="fade"){j.viewport.css({overflow:"hidden"});if(j.settings.adaptiveHeight&&j.viewport.height()!=o()){j.viewport.animate({height:o()},j.settings.adaptiveHeightSpeed)}j.children.filter(":visible").fadeOut(j.settings.speed).css({zIndex:0});j.children.eq(j.active.index).css("zIndex",j.settings.slideZIndex+1).fadeIn(j.settings.speed,function(){b(this).css("zIndex",j.settings.slideZIndex);p()})}else{if(j.settings.adaptiveHeight&&j.viewport.height()!=o()){j.viewport.animate({height:o()},j.settings.adaptiveHeightSpeed)}var W=0;var U={left:0,top:0};if(!j.settings.infiniteLoop&&j.carousel&&j.active.last){if(j.settings.mode=="horizontal"){var R=j.children.eq(j.children.length-1);U=R.position();W=j.viewport.width()-R.outerWidth()}else{var T=j.children.length-j.settings.minSlides;U=j.children.eq(T).position()}}else{if(j.carousel&&j.active.last&&X=="prev"){var Z=j.settings.moveSlides==1?j.settings.maxSlides-q():((v()-1)*q())-(j.children.length-j.settings.maxSlides);var R=H.children(".soliloquy-clone").eq(Z);U=R.position()}else{if(X=="next"&&j.active.index==0){U=H.find("> .soliloquy-clone").eq(j.settings.maxSlides).position();j.active.last=false}else{if(V>=0){var S=V*q();U=j.children.eq(S).position()}}}}if("undefined"!==typeof(U)){var Y=j.settings.mode=="horizontal"?-(U.left-W):-U.top;B(Y,"slide",j.settings.speed)}}};H.goToNextSlide=function(){if(!j.settings.infiniteLoop&&j.active.last){return}var R=parseInt(j.active.index)+1;H.goToSlide(R,"next")};H.goToPrevSlide=function(){if(!j.settings.infiniteLoop&&j.active.index==0){return}var R=parseInt(j.active.index)-1;H.goToSlide(R,"prev")};H.startAuto=function(R){if(j.interval){return}j.interval=setInterval(function(){j.settings.autoDirection=="next"?H.goToNextSlide():H.goToPrevSlide()},j.settings.pause);if(j.settings.autoControls&&R!=true){G("stop")}};H.stopAuto=function(R){if(!j.interval){return}clearInterval(j.interval);j.interval=null;if(j.settings.autoControls&&R!=true){G("start")}};H.getCurrentSlide=function(){return j.active.index};H.getCurrentSlideElement=function(){return j.children.eq(j.active.index)};H.getSlideCount=function(){return j.children.length};H.redrawSlider=function(){j.children.add(H.find(".soliloquy-clone")).width(D());j.viewport.css("height",o());if(!j.settings.ticker){h()}if(j.active.last){j.active.index=v()-1}if(j.active.index>=v()){j.active.last=true}if(j.settings.pager&&!j.settings.pagerCustom){r();Q(j.active.index)}};H.destroySlider=function(){if(!j.initialized){return}j.initialized=false;b(".soliloquy-clone",this).remove();j.children.each(function(){b(this).data("origStyle")!=undefined?b(this).attr("style",b(this).data("origStyle")):b(this).removeAttr("style")});b(this).data("origStyle")!=undefined?this.attr("style",b(this).data("origStyle")):b(this).removeAttr("style");b(this).unwrap().unwrap();if(j.controls.el){j.controls.el.remove()}if(j.controls.next){j.controls.next.remove()}if(j.controls.prev){j.controls.prev.remove()}if(j.pagerEl&&j.settings.controls){j.pagerEl.remove()}b(".soliloquy-caption",this).remove();if(j.controls.autoEl){j.controls.autoEl.remove()}clearInterval(j.interval);if(j.settings.responsive){b(window).unbind("resize",n)}};H.reloadSlider=function(R){if(R!=undefined){s=R}H.destroySlider();C()};C();return this}})(jQuery);function soliloquyIsMobile(){var a=false;(function(b){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(b)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(b.substr(0,4))){a=true}})(navigator.userAgent||navigator.vendor||window.opera);return a}function soliloquyYouTubeVids(e,f,c,a,b,d){d("#"+b).show().css({display:"block","z-index":"1210"});if(YT.Player){soliloquy_youtube[f]=new YT.Player(b,{videoId:f,playerVars:e,events:{onStateChange:soliloquyYouTubeOnStateChange}})}}function soliloquyYouTubeOnStateChange(a){var b=jQuery(a.target.a).data("soliloquy-slider-id");if(a.data===YT.PlayerState.PAUSED||a.data===YT.PlayerState.ENDED){if(soliloquy_slider[b]){soliloquy_slider[b].startAuto()}}if(a.data===YT.PlayerState.PLAYING){if(soliloquy_slider[b]){soliloquy_slider[b].stopAuto()}}}function onYouTubeIframeAPIReady(){}function soliloquyVimeoVids(f,g,d,a,c,e){e("#"+c).show().css({display:"block","z-index":"1210"});if($f){var b={};e.each(e("#"+c)[0].attributes,function(j,h){b[h.nodeName]=h.nodeValue});f.player_id=c;b.src="//player.vimeo.com/video/"+g+"?"+e.param(f);b.frameborder=0;e("#"+c).replaceWith(function(){return e("<iframe />",b).append(e(this).contents())});soliloquy_vimeo[g]=$f(e("#"+c)[0]);soliloquy_vimeo[g].addEvent("ready",function(){soliloquy_vimeo[g].addEvent("play",soliloquyVimeoSliderPause);soliloquy_vimeo[g].addEvent("pause",soliloquyVimeoSliderStart);soliloquy_vimeo[g].addEvent("finish",soliloquyVimeoSliderStart)})}}function soliloquyVimeoSliderPause(a){var b=jQuery("#"+a).data("soliloquy-slider-id");if(soliloquy_slider[b]){soliloquy_slider[b].stopAuto()}}function soliloquyVimeoSliderStart(a){var b=jQuery("#"+a).data("soliloquy-slider-id");if(soliloquy_slider[b]){soliloquy_slider[b].startAuto()}}function soliloquyWistiaVids(f,g,d,a,c,e){e("#"+c).show().css({display:"block","z-index":"1210"});if(wistiaEmbeds){var b={};e.each(e("#"+c)[0].attributes,function(j,h){b[h.nodeName]=h.nodeValue});f.container=c;b.src="//fast.wistia.net/embed/iframe/"+g+"?"+e.param(f);b.frameborder=0;e("#"+c).replaceWith(function(){return e("<iframe />",b).addClass("wistia_embed").append(e(this).contents())});wistiaEmbeds.onFind(function(h){if(g==h.hashedId()){soliloquy_wistia[g]=h;soliloquy_wistia[g].bind("play",function(){var j=e(this.container).data("soliloquy-slider-id");if(soliloquy_slider[j]){soliloquy_slider[j].stopAuto()}});soliloquy_wistia[g].bind("pause",function(){var j=e(this.container).data("soliloquy-slider-id");if(soliloquy_slider[j]){soliloquy_slider[j].startAuto()}});soliloquy_wistia[g].bind("end",function(){var j=e(this.container).data("soliloquy-slider-id");if(soliloquy_slider[j]){soliloquy_slider[j].startAuto()}});h.play()}})}};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;(function($){
|
2 |
+
|
3 |
+
var plugin = {};
|
4 |
+
|
5 |
+
var defaults = {
|
6 |
+
|
7 |
+
// Added by Thomas
|
8 |
+
keyboard: false,
|
9 |
+
|
10 |
+
// GENERAL
|
11 |
+
mode: 'horizontal',
|
12 |
+
slideSelector: '',
|
13 |
+
infiniteLoop: true,
|
14 |
+
hideControlOnEnd: false,
|
15 |
+
speed: 500,
|
16 |
+
easing: null,
|
17 |
+
slideMargin: 0,
|
18 |
+
startSlide: 0,
|
19 |
+
randomStart: false,
|
20 |
+
captions: false,
|
21 |
+
ticker: false,
|
22 |
+
tickerHover: false,
|
23 |
+
adaptiveHeight: false,
|
24 |
+
adaptiveHeightSpeed: 500,
|
25 |
+
video: false,
|
26 |
+
useCSS: true,
|
27 |
+
preloadImages: 'visible',
|
28 |
+
responsive: true,
|
29 |
+
slideZIndex: 50,
|
30 |
+
wrapperClass: 'soliloquy-wrapper',
|
31 |
+
|
32 |
+
// TOUCH
|
33 |
+
touchEnabled: true,
|
34 |
+
swipeThreshold: 50,
|
35 |
+
oneToOneTouch: true,
|
36 |
+
preventDefaultSwipeX: true,
|
37 |
+
preventDefaultSwipeY: false,
|
38 |
+
|
39 |
+
// PAGER
|
40 |
+
pager: true,
|
41 |
+
pagerType: 'full',
|
42 |
+
pagerShortSeparator: ' / ',
|
43 |
+
pagerSelector: null,
|
44 |
+
buildPager: null,
|
45 |
+
pagerCustom: null,
|
46 |
+
|
47 |
+
// CONTROLS
|
48 |
+
controls: true,
|
49 |
+
nextText: 'Next',
|
50 |
+
prevText: 'Prev',
|
51 |
+
nextSelector: null,
|
52 |
+
prevSelector: null,
|
53 |
+
autoControls: false,
|
54 |
+
startText: 'Start',
|
55 |
+
stopText: 'Stop',
|
56 |
+
autoControlsCombine: false,
|
57 |
+
autoControlsSelector: null,
|
58 |
+
|
59 |
+
// AUTO
|
60 |
+
auto: false,
|
61 |
+
pause: 4000,
|
62 |
+
autoStart: true,
|
63 |
+
autoDirection: 'next',
|
64 |
+
autoHover: false,
|
65 |
+
autoDelay: 0,
|
66 |
+
autoSlideForOnePage: false,
|
67 |
+
|
68 |
+
// CAROUSEL
|
69 |
+
minSlides: 1,
|
70 |
+
maxSlides: 1,
|
71 |
+
moveSlides: 0,
|
72 |
+
slideWidth: 0,
|
73 |
+
|
74 |
+
// CALLBACKS
|
75 |
+
onSliderLoad: function() {},
|
76 |
+
onSlideBefore: function() {},
|
77 |
+
onSlideAfter: function() {},
|
78 |
+
onSlideNext: function() {},
|
79 |
+
onSlidePrev: function() {},
|
80 |
+
onSliderResize: function() {}
|
81 |
+
}
|
82 |
+
|
83 |
+
$.fn.soliloquy = function(options){
|
84 |
+
|
85 |
+
if(this.length == 0) return this;
|
86 |
+
|
87 |
+
// support mutltiple elements
|
88 |
+
if(this.length > 1){
|
89 |
+
this.each(function(){$(this).soliloquy(options)});
|
90 |
+
return this;
|
91 |
+
}
|
92 |
+
|
93 |
+
// create a namespace to be used throughout the plugin
|
94 |
+
var slider = {};
|
95 |
+
// set a reference to our slider element
|
96 |
+
var el = this;
|
97 |
+
plugin.el = this;
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Makes slideshow responsive
|
101 |
+
*/
|
102 |
+
// first get the original window dimens (thanks alot IE)
|
103 |
+
var windowWidth = $(window).width();
|
104 |
+
var windowHeight = $(window).height();
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
+
/**
|
109 |
+
* ===================================================================================
|
110 |
+
* = PRIVATE FUNCTIONS
|
111 |
+
* ===================================================================================
|
112 |
+
*/
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Initializes namespace settings to be used throughout plugin
|
116 |
+
*/
|
117 |
+
var init = function(){
|
118 |
+
// merge user-supplied options with the defaults
|
119 |
+
slider.settings = $.extend({}, defaults, options);
|
120 |
+
// parse slideWidth setting
|
121 |
+
slider.settings.slideWidth = parseInt(slider.settings.slideWidth);
|
122 |
+
// store the original children
|
123 |
+
slider.children = el.children(slider.settings.slideSelector);
|
124 |
+
// check if actual number of slides is less than minSlides / maxSlides
|
125 |
+
if(slider.children.length < slider.settings.minSlides) slider.settings.minSlides = slider.children.length;
|
126 |
+
if(slider.children.length < slider.settings.maxSlides) slider.settings.maxSlides = slider.children.length;
|
127 |
+
// if random start, set the startSlide setting to random number
|
128 |
+
if(slider.settings.randomStart) slider.settings.startSlide = Math.floor(Math.random() * slider.children.length);
|
129 |
+
// store active slide information
|
130 |
+
slider.active = { index: slider.settings.startSlide }
|
131 |
+
// store if the slider is in carousel mode (displaying / moving multiple slides)
|
132 |
+
slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1;
|
133 |
+
// if carousel, force preloadImages = 'all'
|
134 |
+
if(slider.carousel) slider.settings.preloadImages = 'all';
|
135 |
+
// calculate the min / max width thresholds based on min / max number of slides
|
136 |
+
// used to setup and update carousel slides dimensions
|
137 |
+
slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin);
|
138 |
+
slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
|
139 |
+
// store the current state of the slider (if currently animating, working is true)
|
140 |
+
slider.working = false;
|
141 |
+
// initialize the controls object
|
142 |
+
slider.controls = {};
|
143 |
+
// initialize an auto interval
|
144 |
+
slider.interval = null;
|
145 |
+
// determine which property to use for transitions
|
146 |
+
slider.animProp = slider.settings.mode == 'vertical' ? 'top' : 'left';
|
147 |
+
// determine if hardware acceleration can be used
|
148 |
+
slider.usingCSS = slider.settings.useCSS && slider.settings.mode != 'fade' && (function(){
|
149 |
+
// create our test div element
|
150 |
+
var div = document.createElement('div');
|
151 |
+
// css transition properties
|
152 |
+
var props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
|
153 |
+
// test for each property
|
154 |
+
for(var i in props){
|
155 |
+
if(div.style[props[i]] !== undefined){
|
156 |
+
slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase();
|
157 |
+
slider.animProp = '-' + slider.cssPrefix + '-transform';
|
158 |
+
return true;
|
159 |
+
}
|
160 |
+
}
|
161 |
+
return false;
|
162 |
+
}());
|
163 |
+
// if vertical mode always make maxSlides and minSlides equal
|
164 |
+
if(slider.settings.mode == 'vertical') slider.settings.maxSlides = slider.settings.minSlides;
|
165 |
+
// save original style data
|
166 |
+
el.data("origStyle", el.attr("style"));
|
167 |
+
el.children(slider.settings.slideSelector).each(function() {
|
168 |
+
$(this).data("origStyle", $(this).attr("style"));
|
169 |
+
});
|
170 |
+
// perform all DOM / CSS modifications
|
171 |
+
setup();
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Performs all DOM and CSS modifications
|
176 |
+
*/
|
177 |
+
var setup = function(){
|
178 |
+
// wrap el in a wrapper
|
179 |
+
el.wrap('<div class="' + slider.settings.wrapperClass + '"><div class="soliloquy-viewport"></div></div>');
|
180 |
+
// store a namspace reference to .soliloquy-viewport
|
181 |
+
slider.viewport = el.parent();
|
182 |
+
// add a loading div to display while images are loading
|
183 |
+
slider.loader = $('<div class="soliloquy-loading" />');
|
184 |
+
slider.viewport.prepend(slider.loader);
|
185 |
+
// set el to a massive width, to hold any needed slides
|
186 |
+
// also strip any margin and padding from el
|
187 |
+
el.css({
|
188 |
+
width: slider.settings.mode == 'horizontal' ? (slider.children.length * 100 + 215) + '%' : 'auto',
|
189 |
+
position: 'relative'
|
190 |
+
});
|
191 |
+
// if using CSS, add the easing property
|
192 |
+
if(slider.usingCSS && slider.settings.easing){
|
193 |
+
el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing);
|
194 |
+
// if not using CSS and no easing value was supplied, use the default JS animation easing (swing)
|
195 |
+
}else if(!slider.settings.easing){
|
196 |
+
slider.settings.easing = 'swing';
|
197 |
+
}
|
198 |
+
var slidesShowing = getNumberSlidesShowing();
|
199 |
+
// make modifications to the viewport (.soliloquy-viewport)
|
200 |
+
slider.viewport.css({
|
201 |
+
width: '100%',
|
202 |
+
position: 'relative'
|
203 |
+
});
|
204 |
+
if(slider.settings.mode != 'fade'){
|
205 |
+
slider.viewport.css({overflow:'hidden'});
|
206 |
+
}
|
207 |
+
slider.viewport.parent().css({
|
208 |
+
maxWidth: getViewportMaxWidth()
|
209 |
+
});
|
210 |
+
// make modification to the wrapper (.soliloquy-wrapper)
|
211 |
+
if(!slider.settings.pager) {
|
212 |
+
slider.viewport.parent().css({
|
213 |
+
margin: '0 auto 0px'
|
214 |
+
});
|
215 |
+
}
|
216 |
+
// apply css to all slider children
|
217 |
+
slider.children.css({
|
218 |
+
'float': 'left',
|
219 |
+
listStyle: 'none',
|
220 |
+
position: 'relative'
|
221 |
+
});
|
222 |
+
// apply the calculated width after the float is applied to prevent scrollbar interference
|
223 |
+
slider.children.css('width', getSlideWidth());
|
224 |
+
// if slideMargin is supplied, add the css
|
225 |
+
if(slider.settings.mode == 'horizontal' && slider.settings.slideMargin > 0) slider.children.css('marginRight', slider.settings.slideMargin);
|
226 |
+
if(slider.settings.mode == 'vertical' && slider.settings.slideMargin > 0) slider.children.css('marginBottom', slider.settings.slideMargin);
|
227 |
+
// if "fade" mode, add positioning and z-index CSS
|
228 |
+
if(slider.settings.mode == 'fade'){
|
229 |
+
slider.children.css({
|
230 |
+
zIndex: 0,
|
231 |
+
display: 'none',
|
232 |
+
marginRight: '-100%',
|
233 |
+
width: '100%'
|
234 |
+
});
|
235 |
+
// prepare the z-index on the showing element
|
236 |
+
slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'});
|
237 |
+
}
|
238 |
+
// create an element to contain all slider controls (pager, start / stop, etc)
|
239 |
+
slider.controls.el = $('<div class="soliloquy-controls" />');
|
240 |
+
// if captions are requested, add them
|
241 |
+
if(slider.settings.captions) appendCaptions();
|
242 |
+
// check if startSlide is last slide
|
243 |
+
slider.active.last = slider.settings.startSlide == getPagerQty() - 1;
|
244 |
+
// Added by Thomas - removed fitVids support, no need.
|
245 |
+
// set the default preload selector (visible)
|
246 |
+
var preloadSelector = slider.children.eq(slider.settings.startSlide);
|
247 |
+
if (slider.settings.preloadImages == "all") preloadSelector = slider.children;
|
248 |
+
// only check for control addition if not in "ticker" mode
|
249 |
+
if(!slider.settings.ticker){
|
250 |
+
// if pager is requested, add it
|
251 |
+
if(slider.settings.pager) appendPager();
|
252 |
+
// if controls are requested, add them
|
253 |
+
if(slider.settings.controls) appendControls();
|
254 |
+
// if auto is true, and auto controls are requested, add them
|
255 |
+
if(slider.settings.auto && slider.settings.autoControls) appendControlsAuto();
|
256 |
+
// if any control option is requested, add the controls wrapper
|
257 |
+
if(slider.settings.controls || slider.settings.autoControls || slider.settings.pager) slider.viewport.after(slider.controls.el);
|
258 |
+
// if ticker mode, do not allow a pager
|
259 |
+
}else{
|
260 |
+
slider.settings.pager = false;
|
261 |
+
}
|
262 |
+
// preload all images, then perform final DOM / CSS modifications that depend on images being loaded
|
263 |
+
loadElements(preloadSelector, start);
|
264 |
+
}
|
265 |
+
|
266 |
+
var loadElements = function(selector, callback){
|
267 |
+
var total = selector.find('img, iframe').length;
|
268 |
+
if (total == 0){
|
269 |
+
callback();
|
270 |
+
return;
|
271 |
+
}
|
272 |
+
var count = 0;
|
273 |
+
selector.find('img, iframe').each(function(){
|
274 |
+
$(this).one('load', function() {
|
275 |
+
if(++count == total) callback();
|
276 |
+
}).each(function() {
|
277 |
+
if(this.complete) $(this).load();
|
278 |
+
});
|
279 |
+
});
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Start the slider
|
284 |
+
*/
|
285 |
+
var start = function(){
|
286 |
+
// if infinite loop, prepare additional slides
|
287 |
+
if(slider.settings.infiniteLoop && slider.settings.mode != 'fade' && !slider.settings.ticker){
|
288 |
+
var slice = slider.settings.mode == 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides;
|
289 |
+
var sliceAppend = slider.children.slice(0, slice).clone().addClass('soliloquy-clone');
|
290 |
+
var slicePrepend = slider.children.slice(-slice).clone().addClass('soliloquy-clone');
|
291 |
+
el.append(sliceAppend).prepend(slicePrepend);
|
292 |
+
}
|
293 |
+
// remove the loading DOM element
|
294 |
+
slider.loader.remove();
|
295 |
+
// set the left / top position of "el"
|
296 |
+
setSlidePosition();
|
297 |
+
// if "vertical" mode, always use adaptiveHeight to prevent odd behavior
|
298 |
+
if (slider.settings.mode == 'vertical') slider.settings.adaptiveHeight = true;
|
299 |
+
// set the viewport height
|
300 |
+
slider.viewport.height(getViewportHeight());
|
301 |
+
// make sure everything is positioned just right (same as a window resize)
|
302 |
+
el.redrawSlider();
|
303 |
+
// onSliderLoad callback
|
304 |
+
slider.settings.onSliderLoad(slider.active.index);
|
305 |
+
// slider has been fully initialized
|
306 |
+
slider.initialized = true;
|
307 |
+
// bind the resize call to the window
|
308 |
+
if (slider.settings.responsive) $(window).bind('resize', resizeWindow);
|
309 |
+
// if auto is true and has more than 1 page, start the show
|
310 |
+
if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) initAuto();
|
311 |
+
// if ticker is true, start the ticker
|
312 |
+
if (slider.settings.ticker) initTicker();
|
313 |
+
// if pager is requested, make the appropriate pager link active
|
314 |
+
if (slider.settings.pager) updatePagerActive(slider.settings.startSlide);
|
315 |
+
// check for any updates to the controls (like hideControlOnEnd updates)
|
316 |
+
if (slider.settings.controls) updateDirectionControls();
|
317 |
+
// if touchEnabled is true, setup the touch events
|
318 |
+
if (slider.settings.touchEnabled && !slider.settings.ticker) initTouch();
|
319 |
+
|
320 |
+
// Added by Thomas
|
321 |
+
if (slider.settings.keyboard && !slider.settings.ticker) {
|
322 |
+
$(document).on('keydown', function(e){
|
323 |
+
if (e.keyCode == 39) {
|
324 |
+
clickNextBind(e);
|
325 |
+
return false;
|
326 |
+
}
|
327 |
+
else if (e.keyCode == 37) {
|
328 |
+
clickPrevBind(e);
|
329 |
+
return false;
|
330 |
+
}
|
331 |
+
});
|
332 |
+
}
|
333 |
+
}
|
334 |
+
|
335 |
+
/**
|
336 |
+
* Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
|
337 |
+
*/
|
338 |
+
var getViewportHeight = function(){
|
339 |
+
var height = 0;
|
340 |
+
// first determine which children (slides) should be used in our height calculation
|
341 |
+
var children = $();
|
342 |
+
// if mode is not "vertical" and adaptiveHeight is false, include all children
|
343 |
+
if(slider.settings.mode != 'vertical' && !slider.settings.adaptiveHeight){
|
344 |
+
children = slider.children;
|
345 |
+
}else{
|
346 |
+
// if not carousel, return the single active child
|
347 |
+
if(!slider.carousel){
|
348 |
+
children = slider.children.eq(slider.active.index);
|
349 |
+
// if carousel, return a slice of children
|
350 |
+
}else{
|
351 |
+
// get the individual slide index
|
352 |
+
var currentIndex = slider.settings.moveSlides == 1 ? slider.active.index : slider.active.index * getMoveBy();
|
353 |
+
// add the current slide to the children
|
354 |
+
children = slider.children.eq(currentIndex);
|
355 |
+
// cycle through the remaining "showing" slides
|
356 |
+
for (i = 1; i <= slider.settings.maxSlides - 1; i++){
|
357 |
+
// if looped back to the start
|
358 |
+
if(currentIndex + i >= slider.children.length){
|
359 |
+
children = children.add(slider.children.eq(i - 1));
|
360 |
+
}else{
|
361 |
+
children = children.add(slider.children.eq(currentIndex + i));
|
362 |
+
}
|
363 |
+
}
|
364 |
+
}
|
365 |
+
}
|
366 |
+
// if "vertical" mode, calculate the sum of the heights of the children
|
367 |
+
if(slider.settings.mode == 'vertical'){
|
368 |
+
children.each(function(index) {
|
369 |
+
height += $(this).outerHeight();
|
370 |
+
});
|
371 |
+
// add user-supplied margins
|
372 |
+
if(slider.settings.slideMargin > 0){
|
373 |
+
height += slider.settings.slideMargin * (slider.settings.minSlides - 1);
|
374 |
+
}
|
375 |
+
// if not "vertical" mode, calculate the max height of the children
|
376 |
+
}else{
|
377 |
+
height = Math.max.apply(Math, children.map(function(){
|
378 |
+
return $(this).outerHeight(false);
|
379 |
+
}).get());
|
380 |
+
}
|
381 |
+
|
382 |
+
if(slider.viewport.css('box-sizing') == 'border-box'){
|
383 |
+
height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) +
|
384 |
+
parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width'));
|
385 |
+
}else if(slider.viewport.css('box-sizing') == 'padding-box'){
|
386 |
+
height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom'));
|
387 |
+
}
|
388 |
+
|
389 |
+
return height;
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* Returns the calculated width to be used for the outer wrapper / viewport
|
394 |
+
*/
|
395 |
+
var getViewportMaxWidth = function(){
|
396 |
+
var width = '100%';
|
397 |
+
if(slider.settings.slideWidth > 0){
|
398 |
+
if(slider.settings.mode == 'horizontal'){
|
399 |
+
width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
|
400 |
+
}else{
|
401 |
+
width = slider.settings.slideWidth;
|
402 |
+
}
|
403 |
+
}
|
404 |
+
return (slider.settings.mode == 'fade') ? '100%' : width;
|
405 |
+
}
|
406 |
+
|
407 |
+
/**
|
408 |
+
* Returns the calculated width to be applied to each slide
|
409 |
+
*/
|
410 |
+
var getSlideWidth = function(){
|
411 |
+
// start with any user-supplied slide width
|
412 |
+
var newElWidth = slider.settings.slideWidth;
|
413 |
+
// get the current viewport width
|
414 |
+
var wrapWidth = slider.viewport.width();
|
415 |
+
// if slide width was not supplied, or is larger than the viewport use the viewport width
|
416 |
+
if(slider.settings.slideWidth == 0 ||
|
417 |
+
(slider.settings.slideWidth > wrapWidth && !slider.carousel) ||
|
418 |
+
slider.settings.mode == 'vertical'){
|
419 |
+
newElWidth = wrapWidth;
|
420 |
+
// if carousel, use the thresholds to determine the width
|
421 |
+
}else if(slider.settings.maxSlides > 1 && slider.settings.mode == 'horizontal'){
|
422 |
+
if(wrapWidth > slider.maxThreshold){
|
423 |
+
// newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.maxSlides - 1))) / slider.settings.maxSlides;
|
424 |
+
}else if(wrapWidth < slider.minThreshold){
|
425 |
+
newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides;
|
426 |
+
}
|
427 |
+
}
|
428 |
+
return (slider.settings.mode == 'fade') ? '100%' : newElWidth;
|
429 |
+
}
|
430 |
+
|
431 |
+
/**
|
432 |
+
* Returns the number of slides currently visible in the viewport (includes partially visible slides)
|
433 |
+
*/
|
434 |
+
var getNumberSlidesShowing = function(){
|
435 |
+
var slidesShowing = 1;
|
436 |
+
if(slider.settings.mode == 'horizontal' && slider.settings.slideWidth > 0){
|
437 |
+
// if viewport is smaller than minThreshold, return minSlides
|
438 |
+
if(slider.viewport.width() < slider.minThreshold){
|
439 |
+
slidesShowing = slider.settings.minSlides;
|
440 |
+
// if viewport is larger than minThreshold, return maxSlides
|
441 |
+
}else if(slider.viewport.width() > slider.maxThreshold){
|
442 |
+
slidesShowing = slider.settings.maxSlides;
|
443 |
+
// if viewport is between min / max thresholds, divide viewport width by first child width
|
444 |
+
}else{
|
445 |
+
var childWidth = slider.children.first().width() + slider.settings.slideMargin;
|
446 |
+
slidesShowing = Math.floor((slider.viewport.width() +
|
447 |
+
slider.settings.slideMargin) / childWidth);
|
448 |
+
}
|
449 |
+
// if "vertical" mode, slides showing will always be minSlides
|
450 |
+
}else if(slider.settings.mode == 'vertical'){
|
451 |
+
slidesShowing = slider.settings.minSlides;
|
452 |
+
}
|
453 |
+
return slidesShowing;
|
454 |
+
}
|
455 |
+
|
456 |
+
/**
|
457 |
+
* Returns the number of pages (one full viewport of slides is one "page")
|
458 |
+
*/
|
459 |
+
var getPagerQty = function(){
|
460 |
+
var pagerQty = 0;
|
461 |
+
// if moveSlides is specified by the user
|
462 |
+
if(slider.settings.moveSlides > 0){
|
463 |
+
if(slider.settings.infiniteLoop){
|
464 |
+
pagerQty = Math.ceil(slider.children.length / getMoveBy());
|
465 |
+
}else{
|
466 |
+
// use a while loop to determine pages
|
467 |
+
var breakPoint = 0;
|
468 |
+
var counter = 0
|
469 |
+
// when breakpoint goes above children length, counter is the number of pages
|
470 |
+
while (breakPoint < slider.children.length){
|
471 |
+
++pagerQty;
|
472 |
+
breakPoint = counter + getNumberSlidesShowing();
|
473 |
+
counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing();
|
474 |
+
}
|
475 |
+
}
|
476 |
+
// if moveSlides is 0 (auto) divide children length by sides showing, then round up
|
477 |
+
}else{
|
478 |
+
pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing());
|
479 |
+
}
|
480 |
+
return pagerQty;
|
481 |
+
}
|
482 |
+
|
483 |
+
/**
|
484 |
+
* Returns the number of indivual slides by which to shift the slider
|
485 |
+
*/
|
486 |
+
var getMoveBy = function(){
|
487 |
+
// if moveSlides was set by the user and moveSlides is less than number of slides showing
|
488 |
+
if(slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()){
|
489 |
+
return slider.settings.moveSlides;
|
490 |
+
}
|
491 |
+
// if moveSlides is 0 (auto)
|
492 |
+
return getNumberSlidesShowing();
|
493 |
+
}
|
494 |
+
|
495 |
+
/**
|
496 |
+
* Sets the slider's (el) left or top position
|
497 |
+
*/
|
498 |
+
var setSlidePosition = function(){
|
499 |
+
// if last slide, not infinite loop, and number of children is larger than specified maxSlides
|
500 |
+
if(slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop){
|
501 |
+
if (slider.settings.mode == 'horizontal'){
|
502 |
+
// get the last child's position
|
503 |
+
var lastChild = slider.children.last();
|
504 |
+
var position = lastChild.position();
|
505 |
+
// set the left position
|
506 |
+
setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0);
|
507 |
+
}else if(slider.settings.mode == 'vertical'){
|
508 |
+
// get the last showing index's position
|
509 |
+
var lastShowingIndex = slider.children.length - slider.settings.minSlides;
|
510 |
+
var position = slider.children.eq(lastShowingIndex).position();
|
511 |
+
// set the top position
|
512 |
+
setPositionProperty(-position.top, 'reset', 0);
|
513 |
+
}
|
514 |
+
// if not last slide
|
515 |
+
}else{
|
516 |
+
// get the position of the first showing slide
|
517 |
+
var position = slider.children.eq(slider.active.index * getMoveBy()).position();
|
518 |
+
// check for last slide
|
519 |
+
if (slider.active.index == getPagerQty() - 1) slider.active.last = true;
|
520 |
+
// set the repective position
|
521 |
+
if (position != undefined){
|
522 |
+
if (slider.settings.mode == 'horizontal') setPositionProperty(-position.left, 'reset', 0);
|
523 |
+
else if (slider.settings.mode == 'vertical') setPositionProperty(-position.top, 'reset', 0);
|
524 |
+
}
|
525 |
+
}
|
526 |
+
}
|
527 |
+
|
528 |
+
/**
|
529 |
+
* Sets the el's animating property position (which in turn will sometimes animate el).
|
530 |
+
* If using CSS, sets the transform property. If not using CSS, sets the top / left property.
|
531 |
+
*
|
532 |
+
* @param value (int)
|
533 |
+
* - the animating property's value
|
534 |
+
*
|
535 |
+
* @param type (string) 'slider', 'reset', 'ticker'
|
536 |
+
* - the type of instance for which the function is being
|
537 |
+
*
|
538 |
+
* @param duration (int)
|
539 |
+
* - the amount of time (in ms) the transition should occupy
|
540 |
+
*
|
541 |
+
* @param params (array) optional
|
542 |
+
* - an optional parameter containing any variables that need to be passed in
|
543 |
+
*/
|
544 |
+
var setPositionProperty = function(value, type, duration, params){
|
545 |
+
// use CSS transform
|
546 |
+
if(slider.usingCSS){
|
547 |
+
// determine the translate3d value
|
548 |
+
var propValue = slider.settings.mode == 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)';
|
549 |
+
// add the CSS transition-duration
|
550 |
+
el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's');
|
551 |
+
if(type == 'slide'){
|
552 |
+
// set the property value
|
553 |
+
el.css(slider.animProp, propValue);
|
554 |
+
// bind a callback method - executes when CSS transition completes
|
555 |
+
el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){
|
556 |
+
// unbind the callback
|
557 |
+
el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
|
558 |
+
updateAfterSlideTransition();
|
559 |
+
});
|
560 |
+
}else if(type == 'reset'){
|
561 |
+
el.css(slider.animProp, propValue);
|
562 |
+
}else if(type == 'ticker'){
|
563 |
+
// make the transition use 'linear'
|
564 |
+
el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear');
|
565 |
+
el.css(slider.animProp, propValue);
|
566 |
+
// bind a callback method - executes when CSS transition completes
|
567 |
+
el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){
|
568 |
+
// unbind the callback
|
569 |
+
el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
|
570 |
+
// reset the position
|
571 |
+
setPositionProperty(params['resetValue'], 'reset', 0);
|
572 |
+
// start the loop again
|
573 |
+
tickerLoop();
|
574 |
+
});
|
575 |
+
}
|
576 |
+
// use JS animate
|
577 |
+
}else{
|
578 |
+
var animateObj = {};
|
579 |
+
animateObj[slider.animProp] = value;
|
580 |
+
if(type == 'slide'){
|
581 |
+
el.animate(animateObj, duration, slider.settings.easing, function(){
|
582 |
+
updateAfterSlideTransition();
|
583 |
+
});
|
584 |
+
}else if(type == 'reset'){
|
585 |
+
el.css(slider.animProp, value)
|
586 |
+
}else if(type == 'ticker'){
|
587 |
+
el.animate(animateObj, speed, 'linear', function(){
|
588 |
+
setPositionProperty(params['resetValue'], 'reset', 0);
|
589 |
+
// run the recursive loop after animation
|
590 |
+
tickerLoop();
|
591 |
+
});
|
592 |
+
}
|
593 |
+
}
|
594 |
+
}
|
595 |
+
|
596 |
+
/**
|
597 |
+
* Populates the pager with proper amount of pages
|
598 |
+
*/
|
599 |
+
var populatePager = function(){
|
600 |
+
var pagerHtml = '';
|
601 |
+
var pagerQty = getPagerQty();
|
602 |
+
// loop through each pager item
|
603 |
+
for(var i=0; i < pagerQty; i++){
|
604 |
+
var linkContent = '';
|
605 |
+
// if a buildPager function is supplied, use it to get pager link value, else use index + 1
|
606 |
+
if(slider.settings.buildPager && $.isFunction(slider.settings.buildPager)){
|
607 |
+
linkContent = slider.settings.buildPager(i);
|
608 |
+
slider.pagerEl.addClass('soliloquy-custom-pager');
|
609 |
+
}else{
|
610 |
+
linkContent = i + 1;
|
611 |
+
slider.pagerEl.addClass('soliloquy-default-pager');
|
612 |
+
}
|
613 |
+
// var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1;
|
614 |
+
// add the markup to the string
|
615 |
+
pagerHtml += '<div class="soliloquy-pager-item"><a href="" data-slide-index="' + i + '" class="soliloquy-pager-link"><span>' + linkContent + '</span></a></div>';
|
616 |
+
};
|
617 |
+
// populate the pager element with pager links
|
618 |
+
slider.pagerEl.html(pagerHtml);
|
619 |
+
}
|
620 |
+
|
621 |
+
/**
|
622 |
+
* Appends the pager to the controls element
|
623 |
+
*/
|
624 |
+
var appendPager = function(){
|
625 |
+
if(!slider.settings.pagerCustom){
|
626 |
+
// create the pager DOM element
|
627 |
+
slider.pagerEl = $('<div class="soliloquy-pager" />');
|
628 |
+
// if a pager selector was supplied, populate it with the pager
|
629 |
+
if(slider.settings.pagerSelector){
|
630 |
+
$(slider.settings.pagerSelector).html(slider.pagerEl);
|
631 |
+
// if no pager selector was supplied, add it after the wrapper
|
632 |
+
}else{
|
633 |
+
slider.controls.el.addClass('soliloquy-has-pager').append(slider.pagerEl);
|
634 |
+
}
|
635 |
+
// populate the pager
|
636 |
+
populatePager();
|
637 |
+
}else{
|
638 |
+
slider.pagerEl = $(slider.settings.pagerCustom);
|
639 |
+
}
|
640 |
+
// assign the pager click binding
|
641 |
+
slider.pagerEl.on('click', 'a', clickPagerBind);
|
642 |
+
}
|
643 |
+
|
644 |
+
/**
|
645 |
+
* Appends prev / next controls to the controls element
|
646 |
+
*/
|
647 |
+
var appendControls = function(){
|
648 |
+
slider.controls.next = $('<a class="soliloquy-next" href=""><span>' + slider.settings.nextText + '</span></a>');
|
649 |
+
slider.controls.prev = $('<a class="soliloquy-prev" href=""><span>' + slider.settings.prevText + '</span></a>');
|
650 |
+
// bind click actions to the controls
|
651 |
+
slider.controls.next.bind('click', clickNextBind);
|
652 |
+
slider.controls.prev.bind('click', clickPrevBind);
|
653 |
+
// if nextSlector was supplied, populate it
|
654 |
+
if(slider.settings.nextSelector){
|
655 |
+
$(slider.settings.nextSelector).append(slider.controls.next);
|
656 |
+
}
|
657 |
+
// if prevSlector was supplied, populate it
|
658 |
+
if(slider.settings.prevSelector){
|
659 |
+
$(slider.settings.prevSelector).append(slider.controls.prev);
|
660 |
+
}
|
661 |
+
// if no custom selectors were supplied
|
662 |
+
if(!slider.settings.nextSelector && !slider.settings.prevSelector){
|
663 |
+
// add the controls to the DOM
|
664 |
+
slider.controls.directionEl = $('<div class="soliloquy-controls-direction" />');
|
665 |
+
// add the control elements to the directionEl
|
666 |
+
slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next);
|
667 |
+
// slider.viewport.append(slider.controls.directionEl);
|
668 |
+
slider.controls.el.addClass('soliloquy-has-controls-direction').append(slider.controls.directionEl);
|
669 |
+
}
|
670 |
+
}
|
671 |
+
|
672 |
+
/**
|
673 |
+
* Appends start / stop auto controls to the controls element
|
674 |
+
*/
|
675 |
+
var appendControlsAuto = function(){
|
676 |
+
slider.controls.start = $('<div class="soliloquy-controls-auto-item"><a class="soliloquy-start" href=""><span>' + slider.settings.startText + '</span></a></div>');
|
677 |
+
slider.controls.stop = $('<div class="soliloquy-controls-auto-item"><a class="soliloquy-stop" href=""><span>' + slider.settings.stopText + '</span></a></div>');
|
678 |
+
// add the controls to the DOM
|
679 |
+
slider.controls.autoEl = $('<div class="soliloquy-controls-auto" />');
|
680 |
+
// bind click actions to the controls
|
681 |
+
slider.controls.autoEl.on('click', '.soliloquy-start', clickStartBind);
|
682 |
+
slider.controls.autoEl.on('click', '.soliloquy-stop', clickStopBind);
|
683 |
+
// if autoControlsCombine, insert only the "start" control
|
684 |
+
if(slider.settings.autoControlsCombine){
|
685 |
+
slider.controls.autoEl.append(slider.controls.start);
|
686 |
+
// if autoControlsCombine is false, insert both controls
|
687 |
+
}else{
|
688 |
+
slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop);
|
689 |
+
}
|
690 |
+
// if auto controls selector was supplied, populate it with the controls
|
691 |
+
if(slider.settings.autoControlsSelector){
|
692 |
+
$(slider.settings.autoControlsSelector).html(slider.controls.autoEl);
|
693 |
+
// if auto controls selector was not supplied, add it after the wrapper
|
694 |
+
}else{
|
695 |
+
slider.controls.el.addClass('soliloquy-has-controls-auto').append(slider.controls.autoEl);
|
696 |
+
}
|
697 |
+
// update the auto controls
|
698 |
+
updateAutoControls(slider.settings.autoStart ? 'stop' : 'start');
|
699 |
+
}
|
700 |
+
|
701 |
+
/**
|
702 |
+
* Appends image captions to the DOM
|
703 |
+
*/
|
704 |
+
var appendCaptions = function(){
|
705 |
+
// cycle through each child
|
706 |
+
slider.children.each(function(index){
|
707 |
+
// get the image title attribute
|
708 |
+
var title = $(this).find('img:first').attr('title');
|
709 |
+
// append the caption
|
710 |
+
if (title != undefined && ('' + title).length) {
|
711 |
+
$(this).append('<div class="soliloquy-caption"><span>' + title + '</span></div>');
|
712 |
+
}
|
713 |
+
});
|
714 |
+
}
|
715 |
+
|
716 |
+
/**
|
717 |
+
* Click next binding
|
718 |
+
*
|
719 |
+
* @param e (event)
|
720 |
+
* - DOM event object
|
721 |
+
*/
|
722 |
+
var clickNextBind = function(e){
|
723 |
+
// if auto show is running, stop it
|
724 |
+
if (slider.settings.auto) el.stopAuto();
|
725 |
+
el.goToNextSlide();
|
726 |
+
e.preventDefault();
|
727 |
+
}
|
728 |
+
|
729 |
+
/**
|
730 |
+
* Click prev binding
|
731 |
+
*
|
732 |
+
* @param e (event)
|
733 |
+
* - DOM event object
|
734 |
+
*/
|
735 |
+
var clickPrevBind = function(e){
|
736 |
+
// if auto show is running, stop it
|
737 |
+
if (slider.settings.auto) el.stopAuto();
|
738 |
+
el.goToPrevSlide();
|
739 |
+
e.preventDefault();
|
740 |
+
}
|
741 |
+
|
742 |
+
/**
|
743 |
+
* Click start binding
|
744 |
+
*
|
745 |
+
* @param e (event)
|
746 |
+
* - DOM event object
|
747 |
+
*/
|
748 |
+
var clickStartBind = function(e){
|
749 |
+
el.startAuto();
|
750 |
+
e.preventDefault();
|
751 |
+
}
|
752 |
+
|
753 |
+
/**
|
754 |
+
* Click stop binding
|
755 |
+
*
|
756 |
+
* @param e (event)
|
757 |
+
* - DOM event object
|
758 |
+
*/
|
759 |
+
var clickStopBind = function(e){
|
760 |
+
el.stopAuto();
|
761 |
+
e.preventDefault();
|
762 |
+
}
|
763 |
+
|
764 |
+
/**
|
765 |
+
* Click pager binding
|
766 |
+
*
|
767 |
+
* @param e (event)
|
768 |
+
* - DOM event object
|
769 |
+
*/
|
770 |
+
var clickPagerBind = function(e){
|
771 |
+
// if auto show is running, stop it
|
772 |
+
if (slider.settings.auto) el.stopAuto();
|
773 |
+
var pagerLink = $(e.currentTarget);
|
774 |
+
if(pagerLink.attr('data-slide-index') !== undefined){
|
775 |
+
var pagerIndex = parseInt(pagerLink.attr('data-slide-index'));
|
776 |
+
// if clicked pager link is not active, continue with the goToSlide call
|
777 |
+
if(pagerIndex != slider.active.index) el.goToSlide(pagerIndex);
|
778 |
+
e.preventDefault();
|
779 |
+
}
|
780 |
+
}
|
781 |
+
|
782 |
+
/**
|
783 |
+
* Updates the pager links with an active class
|
784 |
+
*
|
785 |
+
* @param slideIndex (int)
|
786 |
+
* - index of slide to make active
|
787 |
+
*/
|
788 |
+
var updatePagerActive = function(slideIndex){
|
789 |
+
// if "short" pager type
|
790 |
+
var len = slider.children.length; // nb of children
|
791 |
+
if(slider.settings.pagerType == 'short'){
|
792 |
+
if(slider.settings.maxSlides > 1) {
|
793 |
+
len = Math.ceil(slider.children.length/slider.settings.maxSlides);
|
794 |
+
}
|
795 |
+
slider.pagerEl.html( (slideIndex + 1) + slider.settings.pagerShortSeparator + len);
|
796 |
+
return;
|
797 |
+
}
|
798 |
+
// remove all pager active classes
|
799 |
+
slider.pagerEl.find('a').removeClass('active');
|
800 |
+
// apply the active class for all pagers
|
801 |
+
slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); });
|
802 |
+
}
|
803 |
+
|
804 |
+
/**
|
805 |
+
* Performs needed actions after a slide transition
|
806 |
+
*/
|
807 |
+
var updateAfterSlideTransition = function(){
|
808 |
+
// if infinte loop is true
|
809 |
+
if(slider.settings.infiniteLoop){
|
810 |
+
var position = '';
|
811 |
+
// first slide
|
812 |
+
if(slider.active.index == 0){
|
813 |
+
// set the new position
|
814 |
+
position = slider.children.eq(0).position();
|
815 |
+
// carousel, last slide
|
816 |
+
}else if(slider.active.index == getPagerQty() - 1 && slider.carousel){
|
817 |
+
position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position();
|
818 |
+
// last slide
|
819 |
+
}else if(slider.active.index == slider.children.length - 1){
|
820 |
+
position = slider.children.eq(slider.children.length - 1).position();
|
821 |
+
}
|
822 |
+
if(position){
|
823 |
+
if (slider.settings.mode == 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
|
824 |
+
else if (slider.settings.mode == 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
|
825 |
+
}
|
826 |
+
}
|
827 |
+
// declare that the transition is complete
|
828 |
+
slider.working = false;
|
829 |
+
// Added by Thomas
|
830 |
+
if(slider.settings.mode == 'fade'){
|
831 |
+
slider.viewport.css({overflow:''});
|
832 |
+
}
|
833 |
+
// onSlideAfter callback
|
834 |
+
slider.settings.onSlideAfter(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
|
835 |
+
}
|
836 |
+
|
837 |
+
/**
|
838 |
+
* Updates the auto controls state (either active, or combined switch)
|
839 |
+
*
|
840 |
+
* @param state (string) "start", "stop"
|
841 |
+
* - the new state of the auto show
|
842 |
+
*/
|
843 |
+
var updateAutoControls = function(state){
|
844 |
+
// if autoControlsCombine is true, replace the current control with the new state
|
845 |
+
if(slider.settings.autoControlsCombine){
|
846 |
+
slider.controls.autoEl.html(slider.controls[state]);
|
847 |
+
// if autoControlsCombine is false, apply the "active" class to the appropriate control
|
848 |
+
}else{
|
849 |
+
slider.controls.autoEl.find('a').removeClass('active');
|
850 |
+
slider.controls.autoEl.find('a:not(.soliloquy-' + state + ')').addClass('active');
|
851 |
+
}
|
852 |
+
}
|
853 |
+
|
854 |
+
/**
|
855 |
+
* Updates the direction controls (checks if either should be hidden)
|
856 |
+
*/
|
857 |
+
var updateDirectionControls = function(){
|
858 |
+
if(getPagerQty() == 1){
|
859 |
+
slider.controls.prev.addClass('disabled');
|
860 |
+
slider.controls.next.addClass('disabled');
|
861 |
+
}else if(!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd){
|
862 |
+
// if first slide
|
863 |
+
if (slider.active.index == 0){
|
864 |
+
slider.controls.prev.addClass('disabled');
|
865 |
+
slider.controls.next.removeClass('disabled');
|
866 |
+
// if last slide
|
867 |
+
}else if(slider.active.index == getPagerQty() - 1){
|
868 |
+
slider.controls.next.addClass('disabled');
|
869 |
+
slider.controls.prev.removeClass('disabled');
|
870 |
+
// if any slide in the middle
|
871 |
+
}else{
|
872 |
+
slider.controls.prev.removeClass('disabled');
|
873 |
+
slider.controls.next.removeClass('disabled');
|
874 |
+
}
|
875 |
+
}
|
876 |
+
}
|
877 |
+
|
878 |
+
/**
|
879 |
+
* Initialzes the auto process
|
880 |
+
*/
|
881 |
+
var initAuto = function(){
|
882 |
+
// if autoDelay was supplied, launch the auto show using a setTimeout() call
|
883 |
+
if(slider.settings.autoDelay > 0){
|
884 |
+
var timeout = setTimeout(el.startAuto, slider.settings.autoDelay);
|
885 |
+
// if autoDelay was not supplied, start the auto show normally
|
886 |
+
}else{
|
887 |
+
el.startAuto();
|
888 |
+
}
|
889 |
+
// if autoHover is requested
|
890 |
+
if(slider.settings.autoHover){
|
891 |
+
// on el hover
|
892 |
+
el.hover(function(){
|
893 |
+
// if the auto show is currently playing (has an active interval)
|
894 |
+
if(slider.interval){
|
895 |
+
// stop the auto show and pass true agument which will prevent control update
|
896 |
+
el.stopAuto(true);
|
897 |
+
// create a new autoPaused value which will be used by the relative "mouseout" event
|
898 |
+
slider.autoPaused = true;
|
899 |
+
}
|
900 |
+
}, function(){
|
901 |
+
// if the autoPaused value was created be the prior "mouseover" event
|
902 |
+
if(slider.autoPaused){
|
903 |
+
// start the auto show and pass true agument which will prevent control update
|
904 |
+
el.startAuto(true);
|
905 |
+
// reset the autoPaused value
|
906 |
+
slider.autoPaused = null;
|
907 |
+
}
|
908 |
+
});
|
909 |
+
}
|
910 |
+
}
|
911 |
+
|
912 |
+
/**
|
913 |
+
* Initialzes the ticker process
|
914 |
+
*/
|
915 |
+
var initTicker = function(){
|
916 |
+
var startPosition = 0;
|
917 |
+
// if autoDirection is "next", append a clone of the entire slider
|
918 |
+
if(slider.settings.autoDirection == 'next'){
|
919 |
+
el.append(slider.children.clone().addClass('soliloquy-clone'));
|
920 |
+
// if autoDirection is "prev", prepend a clone of the entire slider, and set the left position
|
921 |
+
}else{
|
922 |
+
el.prepend(slider.children.clone().addClass('soliloquy-clone'));
|
923 |
+
var position = slider.children.first().position();
|
924 |
+
startPosition = slider.settings.mode == 'horizontal' ? -position.left : -position.top;
|
925 |
+
}
|
926 |
+
setPositionProperty(startPosition, 'reset', 0);
|
927 |
+
// do not allow controls in ticker mode
|
928 |
+
slider.settings.pager = false;
|
929 |
+
slider.settings.controls = false;
|
930 |
+
slider.settings.autoControls = false;
|
931 |
+
// if autoHover is requested
|
932 |
+
if(slider.settings.tickerHover && !slider.usingCSS){
|
933 |
+
// on el hover
|
934 |
+
slider.viewport.hover(function(){
|
935 |
+
el.stop();
|
936 |
+
}, function(){
|
937 |
+
// calculate the total width of children (used to calculate the speed ratio)
|
938 |
+
var totalDimens = 0;
|
939 |
+
slider.children.each(function(index){
|
940 |
+
totalDimens += slider.settings.mode == 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
|
941 |
+
});
|
942 |
+
// calculate the speed ratio (used to determine the new speed to finish the paused animation)
|
943 |
+
var ratio = slider.settings.speed / totalDimens;
|
944 |
+
// determine which property to use
|
945 |
+
var property = slider.settings.mode == 'horizontal' ? 'left' : 'top';
|
946 |
+
// calculate the new speed
|
947 |
+
var newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property)))));
|
948 |
+
tickerLoop(newSpeed);
|
949 |
+
});
|
950 |
+
}
|
951 |
+
// start the ticker loop
|
952 |
+
tickerLoop();
|
953 |
+
}
|
954 |
+
|
955 |
+
/**
|
956 |
+
* Runs a continuous loop, news ticker-style
|
957 |
+
*/
|
958 |
+
var tickerLoop = function(resumeSpeed){
|
959 |
+
speed = resumeSpeed ? resumeSpeed : slider.settings.speed;
|
960 |
+
var position = {left: 0, top: 0};
|
961 |
+
var reset = {left: 0, top: 0};
|
962 |
+
// if "next" animate left position to last child, then reset left to 0
|
963 |
+
if(slider.settings.autoDirection == 'next'){
|
964 |
+
position = el.find('.soliloquy-clone').first().position();
|
965 |
+
// if "prev" animate left position to 0, then reset left to first non-clone child
|
966 |
+
}else{
|
967 |
+
reset = slider.children.first().position();
|
968 |
+
}
|
969 |
+
var animateProperty = slider.settings.mode == 'horizontal' ? -position.left : -position.top;
|
970 |
+
var resetValue = slider.settings.mode == 'horizontal' ? -reset.left : -reset.top;
|
971 |
+
var params = {resetValue: resetValue};
|
972 |
+
setPositionProperty(animateProperty, 'ticker', speed, params);
|
973 |
+
}
|
974 |
+
|
975 |
+
/**
|
976 |
+
* Initializes touch events
|
977 |
+
*/
|
978 |
+
var initTouch = function(){
|
979 |
+
// initialize object to contain all touch values
|
980 |
+
slider.touch = {
|
981 |
+
start: {x: 0, y: 0},
|
982 |
+
end: {x: 0, y: 0}
|
983 |
+
}
|
984 |
+
slider.viewport.bind('touchstart', onTouchStart);
|
985 |
+
}
|
986 |
+
|
987 |
+
/**
|
988 |
+
* Event handler for "touchstart"
|
989 |
+
*
|
990 |
+
* @param e (event)
|
991 |
+
* - DOM event object
|
992 |
+
*/
|
993 |
+
var onTouchStart = function(e){
|
994 |
+
if(slider.working){
|
995 |
+
e.preventDefault();
|
996 |
+
}else{
|
997 |
+
// record the original position when touch starts
|
998 |
+
slider.touch.originalPos = el.position();
|
999 |
+
var orig = e.originalEvent;
|
1000 |
+
// record the starting touch x, y coordinates
|
1001 |
+
slider.touch.start.x = orig.changedTouches[0].pageX;
|
1002 |
+
slider.touch.start.y = orig.changedTouches[0].pageY;
|
1003 |
+
// bind a "touchmove" event to the viewport
|
1004 |
+
slider.viewport.bind('touchmove', onTouchMove);
|
1005 |
+
// bind a "touchend" event to the viewport
|
1006 |
+
slider.viewport.bind('touchend', onTouchEnd);
|
1007 |
+
}
|
1008 |
+
}
|
1009 |
+
|
1010 |
+
/**
|
1011 |
+
* Event handler for "touchmove"
|
1012 |
+
*
|
1013 |
+
* @param e (event)
|
1014 |
+
* - DOM event object
|
1015 |
+
*/
|
1016 |
+
var onTouchMove = function(e){
|
1017 |
+
var orig = e.originalEvent;
|
1018 |
+
// if scrolling on y axis, do not prevent default
|
1019 |
+
var xMovement = Math.abs(orig.changedTouches[0].pageX - slider.touch.start.x);
|
1020 |
+
var yMovement = Math.abs(orig.changedTouches[0].pageY - slider.touch.start.y);
|
1021 |
+
// x axis swipe
|
1022 |
+
if((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX){
|
1023 |
+
e.preventDefault();
|
1024 |
+
// y axis swipe
|
1025 |
+
}else if((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY){
|
1026 |
+
e.preventDefault();
|
1027 |
+
}
|
1028 |
+
if(slider.settings.mode != 'fade' && slider.settings.oneToOneTouch){
|
1029 |
+
var value = 0;
|
1030 |
+
// if horizontal, drag along x axis
|
1031 |
+
if(slider.settings.mode == 'horizontal'){
|
1032 |
+
var change = orig.changedTouches[0].pageX - slider.touch.start.x;
|
1033 |
+
value = slider.touch.originalPos.left + change;
|
1034 |
+
// if vertical, drag along y axis
|
1035 |
+
}else{
|
1036 |
+
var change = orig.changedTouches[0].pageY - slider.touch.start.y;
|
1037 |
+
value = slider.touch.originalPos.top + change;
|
1038 |
+
}
|
1039 |
+
setPositionProperty(value, 'reset', 0);
|
1040 |
+
}
|
1041 |
+
}
|
1042 |
+
|
1043 |
+
/**
|
1044 |
+
* Event handler for "touchend"
|
1045 |
+
*
|
1046 |
+
* @param e (event)
|
1047 |
+
* - DOM event object
|
1048 |
+
*/
|
1049 |
+
var onTouchEnd = function(e){
|
1050 |
+
slider.viewport.unbind('touchmove', onTouchMove);
|
1051 |
+
var orig = e.originalEvent;
|
1052 |
+
var value = 0;
|
1053 |
+
// record end x, y positions
|
1054 |
+
slider.touch.end.x = orig.changedTouches[0].pageX;
|
1055 |
+
slider.touch.end.y = orig.changedTouches[0].pageY;
|
1056 |
+
// if fade mode, check if absolute x distance clears the threshold
|
1057 |
+
if(slider.settings.mode == 'fade'){
|
1058 |
+
var distance = Math.abs(slider.touch.start.x - slider.touch.end.x);
|
1059 |
+
if(distance >= slider.settings.swipeThreshold){
|
1060 |
+
slider.touch.start.x > slider.touch.end.x ? el.goToNextSlide() : el.goToPrevSlide();
|
1061 |
+
el.stopAuto();
|
1062 |
+
}
|
1063 |
+
// not fade mode
|
1064 |
+
}else{
|
1065 |
+
var distance = 0;
|
1066 |
+
// calculate distance and el's animate property
|
1067 |
+
if(slider.settings.mode == 'horizontal'){
|
1068 |
+
distance = slider.touch.end.x - slider.touch.start.x;
|
1069 |
+
value = slider.touch.originalPos.left;
|
1070 |
+
}else{
|
1071 |
+
distance = slider.touch.end.y - slider.touch.start.y;
|
1072 |
+
value = slider.touch.originalPos.top;
|
1073 |
+
}
|
1074 |
+
// if not infinite loop and first / last slide, do not attempt a slide transition
|
1075 |
+
if(!slider.settings.infiniteLoop && ((slider.active.index == 0 && distance > 0) || (slider.active.last && distance < 0))){
|
1076 |
+
setPositionProperty(value, 'reset', 200);
|
1077 |
+
}else{
|
1078 |
+
// check if distance clears threshold
|
1079 |
+
if(Math.abs(distance) >= slider.settings.swipeThreshold){
|
1080 |
+
distance < 0 ? el.goToNextSlide() : el.goToPrevSlide();
|
1081 |
+
el.stopAuto();
|
1082 |
+
}else{
|
1083 |
+
// el.animate(property, 200);
|
1084 |
+
setPositionProperty(value, 'reset', 200);
|
1085 |
+
}
|
1086 |
+
}
|
1087 |
+
}
|
1088 |
+
slider.viewport.unbind('touchend', onTouchEnd);
|
1089 |
+
}
|
1090 |
+
|
1091 |
+
/**
|
1092 |
+
* Window resize event callback
|
1093 |
+
*/
|
1094 |
+
var resizeWindow = function(e){
|
1095 |
+
// don't do anything if slider isn't initialized.
|
1096 |
+
if(!slider.initialized) return;
|
1097 |
+
// get the new window dimens (again, thank you IE)
|
1098 |
+
var windowWidthNew = $(window).width();
|
1099 |
+
var windowHeightNew = $(window).height();
|
1100 |
+
// make sure that it is a true window resize
|
1101 |
+
// *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements
|
1102 |
+
// are resized. Can you just die already?*
|
1103 |
+
if(windowWidth != windowWidthNew || windowHeight != windowHeightNew){
|
1104 |
+
// set the new window dimens
|
1105 |
+
windowWidth = windowWidthNew;
|
1106 |
+
windowHeight = windowHeightNew;
|
1107 |
+
// update all dynamic elements
|
1108 |
+
el.redrawSlider();
|
1109 |
+
// Call user resize handler
|
1110 |
+
slider.settings.onSliderResize.call(el, slider.active.index);
|
1111 |
+
}
|
1112 |
+
}
|
1113 |
+
|
1114 |
+
/**
|
1115 |
+
* ===================================================================================
|
1116 |
+
* = PUBLIC FUNCTIONS
|
1117 |
+
* ===================================================================================
|
1118 |
+
*/
|
1119 |
+
|
1120 |
+
/**
|
1121 |
+
* Performs slide transition to the specified slide
|
1122 |
+
*
|
1123 |
+
* @param slideIndex (int)
|
1124 |
+
* - the destination slide's index (zero-based)
|
1125 |
+
*
|
1126 |
+
* @param direction (string)
|
1127 |
+
* - INTERNAL USE ONLY - the direction of travel ("prev" / "next")
|
1128 |
+
*/
|
1129 |
+
el.goToSlide = function(slideIndex, direction){
|
1130 |
+
// if plugin is currently in motion, ignore request
|
1131 |
+
if(slider.working || slider.active.index == slideIndex) return;
|
1132 |
+
// declare that plugin is in motion
|
1133 |
+
slider.working = true;
|
1134 |
+
// store the old index
|
1135 |
+
slider.oldIndex = slider.active.index;
|
1136 |
+
// if slideIndex is less than zero, set active index to last child (this happens during infinite loop)
|
1137 |
+
if(slideIndex < 0){
|
1138 |
+
slider.active.index = getPagerQty() - 1;
|
1139 |
+
// if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
|
1140 |
+
}else if(slideIndex >= getPagerQty()){
|
1141 |
+
slider.active.index = 0;
|
1142 |
+
// set active index to requested slide
|
1143 |
+
}else{
|
1144 |
+
slider.active.index = slideIndex;
|
1145 |
+
}
|
1146 |
+
// onSlideBefore, onSlideNext, onSlidePrev callbacks
|
1147 |
+
slider.settings.onSlideBefore(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
|
1148 |
+
if(direction == 'next'){
|
1149 |
+
slider.settings.onSlideNext(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
|
1150 |
+
}else if(direction == 'prev'){
|
1151 |
+
slider.settings.onSlidePrev(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
|
1152 |
+
}
|
1153 |
+
// check if last slide
|
1154 |
+
slider.active.last = slider.active.index >= getPagerQty() - 1;
|
1155 |
+
// update the pager with active class
|
1156 |
+
if(slider.settings.pager) updatePagerActive(slider.active.index);
|
1157 |
+
// // check for direction control update
|
1158 |
+
if(slider.settings.controls) updateDirectionControls();
|
1159 |
+
// if slider is set to mode: "fade"
|
1160 |
+
if(slider.settings.mode == 'fade'){
|
1161 |
+
// Added by Thomas
|
1162 |
+
slider.viewport.css({overflow:'hidden'});
|
1163 |
+
// if adaptiveHeight is true and next height is different from current height, animate to the new height
|
1164 |
+
if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHeight()){
|
1165 |
+
slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
|
1166 |
+
}
|
1167 |
+
// fade out the visible child and reset its z-index value
|
1168 |
+
slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
|
1169 |
+
// fade in the newly requested slide
|
1170 |
+
slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex+1).fadeIn(slider.settings.speed, function(){
|
1171 |
+
$(this).css('zIndex', slider.settings.slideZIndex);
|
1172 |
+
updateAfterSlideTransition();
|
1173 |
+
});
|
1174 |
+
// slider mode is not "fade"
|
1175 |
+
}else{
|
1176 |
+
// if adaptiveHeight is true and next height is different from current height, animate to the new height
|
1177 |
+
if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHeight()){
|
1178 |
+
slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
|
1179 |
+
}
|
1180 |
+
var moveBy = 0;
|
1181 |
+
var position = {left: 0, top: 0};
|
1182 |
+
// if carousel and not infinite loop
|
1183 |
+
if(!slider.settings.infiniteLoop && slider.carousel && slider.active.last){
|
1184 |
+
if(slider.settings.mode == 'horizontal'){
|
1185 |
+
// get the last child position
|
1186 |
+
var lastChild = slider.children.eq(slider.children.length - 1);
|
1187 |
+
position = lastChild.position();
|
1188 |
+
// calculate the position of the last slide
|
1189 |
+
moveBy = slider.viewport.width() - lastChild.outerWidth();
|
1190 |
+
}else{
|
1191 |
+
// get last showing index position
|
1192 |
+
var lastShowingIndex = slider.children.length - slider.settings.minSlides;
|
1193 |
+
position = slider.children.eq(lastShowingIndex).position();
|
1194 |
+
}
|
1195 |
+
// horizontal carousel, going previous while on first slide (infiniteLoop mode)
|
1196 |
+
}else if(slider.carousel && slider.active.last && direction == 'prev'){
|
1197 |
+
// get the last child position
|
1198 |
+
var eq = slider.settings.moveSlides == 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides);
|
1199 |
+
var lastChild = el.children('.soliloquy-clone').eq(eq);
|
1200 |
+
position = lastChild.position();
|
1201 |
+
// if infinite loop and "Next" is clicked on the last slide
|
1202 |
+
}else if(direction == 'next' && slider.active.index == 0){
|
1203 |
+
// get the last clone position
|
1204 |
+
position = el.find('> .soliloquy-clone').eq(slider.settings.maxSlides).position();
|
1205 |
+
slider.active.last = false;
|
1206 |
+
// normal non-zero requests
|
1207 |
+
}else if(slideIndex >= 0){
|
1208 |
+
var requestEl = slideIndex * getMoveBy();
|
1209 |
+
position = slider.children.eq(requestEl).position();
|
1210 |
+
}
|
1211 |
+
|
1212 |
+
/* If the position doesn't exist
|
1213 |
+
* (e.g. if you destroy the slider on a next click),
|
1214 |
+
* it doesn't throw an error.
|
1215 |
+
*/
|
1216 |
+
if ("undefined" !== typeof(position)) {
|
1217 |
+
var value = slider.settings.mode == 'horizontal' ? -(position.left - moveBy) : -position.top;
|
1218 |
+
// plugin values to be animated
|
1219 |
+
setPositionProperty(value, 'slide', slider.settings.speed);
|
1220 |
+
}
|
1221 |
+
}
|
1222 |
+
}
|
1223 |
+
|
1224 |
+
/**
|
1225 |
+
* Transitions to the next slide in the show
|
1226 |
+
*/
|
1227 |
+
el.goToNextSlide = function(){
|
1228 |
+
// if infiniteLoop is false and last page is showing, disregard call
|
1229 |
+
if (!slider.settings.infiniteLoop && slider.active.last) return;
|
1230 |
+
var pagerIndex = parseInt(slider.active.index) + 1;
|
1231 |
+
el.goToSlide(pagerIndex, 'next');
|
1232 |
+
}
|
1233 |
+
|
1234 |
+
/**
|
1235 |
+
* Transitions to the prev slide in the show
|
1236 |
+
*/
|
1237 |
+
el.goToPrevSlide = function(){
|
1238 |
+
// if infiniteLoop is false and last page is showing, disregard call
|
1239 |
+
if (!slider.settings.infiniteLoop && slider.active.index == 0) return;
|
1240 |
+
var pagerIndex = parseInt(slider.active.index) - 1;
|
1241 |
+
el.goToSlide(pagerIndex, 'prev');
|
1242 |
+
}
|
1243 |
+
|
1244 |
+
/**
|
1245 |
+
* Starts the auto show
|
1246 |
+
*
|
1247 |
+
* @param preventControlUpdate (boolean)
|
1248 |
+
* - if true, auto controls state will not be updated
|
1249 |
+
*/
|
1250 |
+
el.startAuto = function(preventControlUpdate){
|
1251 |
+
// if an interval already exists, disregard call
|
1252 |
+
if(slider.interval) return;
|
1253 |
+
// create an interval
|
1254 |
+
slider.interval = setInterval(function(){
|
1255 |
+
slider.settings.autoDirection == 'next' ? el.goToNextSlide() : el.goToPrevSlide();
|
1256 |
+
}, slider.settings.pause);
|
1257 |
+
// if auto controls are displayed and preventControlUpdate is not true
|
1258 |
+
if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('stop');
|
1259 |
+
}
|
1260 |
+
|
1261 |
+
/**
|
1262 |
+
* Stops the auto show
|
1263 |
+
*
|
1264 |
+
* @param preventControlUpdate (boolean)
|
1265 |
+
* - if true, auto controls state will not be updated
|
1266 |
+
*/
|
1267 |
+
el.stopAuto = function(preventControlUpdate){
|
1268 |
+
// if no interval exists, disregard call
|
1269 |
+
if(!slider.interval) return;
|
1270 |
+
// clear the interval
|
1271 |
+
clearInterval(slider.interval);
|
1272 |
+
slider.interval = null;
|
1273 |
+
// if auto controls are displayed and preventControlUpdate is not true
|
1274 |
+
if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('start');
|
1275 |
+
}
|
1276 |
+
|
1277 |
+
/**
|
1278 |
+
* Returns current slide index (zero-based)
|
1279 |
+
*/
|
1280 |
+
el.getCurrentSlide = function(){
|
1281 |
+
return slider.active.index;
|
1282 |
+
}
|
1283 |
+
|
1284 |
+
/**
|
1285 |
+
* Returns current slide element
|
1286 |
+
*/
|
1287 |
+
el.getCurrentSlideElement = function(){
|
1288 |
+
return slider.children.eq(slider.active.index);
|
1289 |
+
}
|
1290 |
+
|
1291 |
+
/**
|
1292 |
+
* Returns number of slides in show
|
1293 |
+
*/
|
1294 |
+
el.getSlideCount = function(){
|
1295 |
+
return slider.children.length;
|
1296 |
+
}
|
1297 |
+
|
1298 |
+
/**
|
1299 |
+
* Update all dynamic slider elements
|
1300 |
+
*/
|
1301 |
+
el.redrawSlider = function(){
|
1302 |
+
// resize all children in ratio to new screen size
|
1303 |
+
slider.children.add(el.find('.soliloquy-clone')).width(getSlideWidth());
|
1304 |
+
// adjust the height
|
1305 |
+
slider.viewport.css('height', getViewportHeight());
|
1306 |
+
// update the slide position
|
1307 |
+
if(!slider.settings.ticker) setSlidePosition();
|
1308 |
+
// if active.last was true before the screen resize, we want
|
1309 |
+
// to keep it last no matter what screen size we end on
|
1310 |
+
if (slider.active.last) slider.active.index = getPagerQty() - 1;
|
1311 |
+
// if the active index (page) no longer exists due to the resize, simply set the index as last
|
1312 |
+
if (slider.active.index >= getPagerQty()) slider.active.last = true;
|
1313 |
+
// if a pager is being displayed and a custom pager is not being used, update it
|
1314 |
+
if(slider.settings.pager && !slider.settings.pagerCustom){
|
1315 |
+
populatePager();
|
1316 |
+
updatePagerActive(slider.active.index);
|
1317 |
+
}
|
1318 |
+
}
|
1319 |
+
|
1320 |
+
/**
|
1321 |
+
* Destroy the current instance of the slider (revert everything back to original state)
|
1322 |
+
*/
|
1323 |
+
el.destroySlider = function(){
|
1324 |
+
// don't do anything if slider has already been destroyed
|
1325 |
+
if(!slider.initialized) return;
|
1326 |
+
slider.initialized = false;
|
1327 |
+
$('.soliloquy-clone', this).remove();
|
1328 |
+
slider.children.each(function() {
|
1329 |
+
$(this).data("origStyle") != undefined ? $(this).attr("style", $(this).data("origStyle")) : $(this).removeAttr('style');
|
1330 |
+
});
|
1331 |
+
$(this).data("origStyle") != undefined ? this.attr("style", $(this).data("origStyle")) : $(this).removeAttr('style');
|
1332 |
+
$(this).unwrap().unwrap();
|
1333 |
+
if(slider.controls.el) slider.controls.el.remove();
|
1334 |
+
if(slider.controls.next) slider.controls.next.remove();
|
1335 |
+
if(slider.controls.prev) slider.controls.prev.remove();
|
1336 |
+
if(slider.pagerEl && slider.settings.controls) slider.pagerEl.remove();
|
1337 |
+
$('.soliloquy-caption', this).remove();
|
1338 |
+
if(slider.controls.autoEl) slider.controls.autoEl.remove();
|
1339 |
+
clearInterval(slider.interval);
|
1340 |
+
if(slider.settings.responsive) $(window).unbind('resize', resizeWindow);
|
1341 |
+
}
|
1342 |
+
|
1343 |
+
/**
|
1344 |
+
* Reload the slider (revert all DOM changes, and re-initialize)
|
1345 |
+
*/
|
1346 |
+
el.reloadSlider = function(settings){
|
1347 |
+
if (settings != undefined) options = settings;
|
1348 |
+
el.destroySlider();
|
1349 |
+
init();
|
1350 |
+
}
|
1351 |
+
|
1352 |
+
init();
|
1353 |
+
|
1354 |
+
// returns the current jQuery object
|
1355 |
+
return this;
|
1356 |
+
}
|
1357 |
+
|
1358 |
+
})(jQuery);
|
1359 |
+
|
1360 |
+
// Mobile checker function.
|
1361 |
+
function soliloquyIsMobile() {
|
1362 |
+
var check = false;
|
1363 |
+
(function (a) {
|
1364 |
+
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true
|
1365 |
+
})(navigator.userAgent || navigator.vendor || window.opera);
|
1366 |
+
return check;
|
1367 |
+
}
|
1368 |
+
|
1369 |
+
// Video functions.
|
1370 |
+
function soliloquyYouTubeVids(data, id, width, height, holder, $){
|
1371 |
+
// Immediately make the holder visible and increase z-index to overlay the player icon.
|
1372 |
+
$('#' + holder).show().css({'display':'block','z-index':'1210'});
|
1373 |
+
|
1374 |
+
// Load a new video into the slider.
|
1375 |
+
if ( YT.Player ) {
|
1376 |
+
soliloquy_youtube[id] = new YT.Player(holder, {
|
1377 |
+
videoId: id,
|
1378 |
+
playerVars: data,
|
1379 |
+
events: {
|
1380 |
+
'onStateChange' : soliloquyYouTubeOnStateChange
|
1381 |
+
}
|
1382 |
+
});
|
1383 |
+
}
|
1384 |
+
}
|
1385 |
+
function soliloquyYouTubeOnStateChange(event){
|
1386 |
+
var id = jQuery(event.target.a).data('soliloquy-slider-id');
|
1387 |
+
// If the video has been paused or has finished playing, restart the slider.
|
1388 |
+
if ( event.data === YT.PlayerState.PAUSED || event.data === YT.PlayerState.ENDED ) {
|
1389 |
+
if ( soliloquy_slider[id] ) {
|
1390 |
+
soliloquy_slider[id].startAuto();
|
1391 |
+
}
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
// If the video is playing, pause the slider.
|
1395 |
+
if ( event.data === YT.PlayerState.PLAYING ) {
|
1396 |
+
if ( soliloquy_slider[id] ) {
|
1397 |
+
soliloquy_slider[id].stopAuto();
|
1398 |
+
}
|
1399 |
+
}
|
1400 |
+
}
|
1401 |
+
function onYouTubeIframeAPIReady(){}
|
1402 |
+
function soliloquyVimeoVids(data, id, width, height, holder, $){
|
1403 |
+
// Immediately make the holder visible and increase z-index to overlay the player icon.
|
1404 |
+
$('#' + holder).show().css({'display':'block','z-index':'1210'});
|
1405 |
+
|
1406 |
+
// Load a new video into the slider.
|
1407 |
+
if ( $f ) {
|
1408 |
+
var attrs = {};
|
1409 |
+
$.each($('#' + holder)[0].attributes, function(idx, attr){
|
1410 |
+
attrs[attr.nodeName] = attr.nodeValue;
|
1411 |
+
});
|
1412 |
+
|
1413 |
+
// Add iframe specific attributes.
|
1414 |
+
data.player_id = holder;
|
1415 |
+
attrs.src = '//player.vimeo.com/video/' + id + '?' + $.param(data);
|
1416 |
+
attrs.frameborder = 0;
|
1417 |
+
|
1418 |
+
// Convert the holder to the video.
|
1419 |
+
$('#' + holder).replaceWith(function(){
|
1420 |
+
return $('<iframe />', attrs).append($(this).contents());
|
1421 |
+
});
|
1422 |
+
|
1423 |
+
// Store a reference to the video object for use with the API.
|
1424 |
+
soliloquy_vimeo[id] = $f($('#' + holder)[0]);
|
1425 |
+
soliloquy_vimeo[id].addEvent('ready', function(){
|
1426 |
+
soliloquy_vimeo[id].addEvent('play', soliloquyVimeoSliderPause);
|
1427 |
+
soliloquy_vimeo[id].addEvent('pause', soliloquyVimeoSliderStart);
|
1428 |
+
soliloquy_vimeo[id].addEvent('finish', soliloquyVimeoSliderStart);
|
1429 |
+
});
|
1430 |
+
}
|
1431 |
+
|
1432 |
+
}
|
1433 |
+
function soliloquyVimeoSliderPause(vid){
|
1434 |
+
var id = jQuery('#' + vid).data('soliloquy-slider-id');
|
1435 |
+
if ( soliloquy_slider[id] ) {
|
1436 |
+
soliloquy_slider[id].stopAuto();
|
1437 |
+
}
|
1438 |
+
}
|
1439 |
+
function soliloquyVimeoSliderStart(vid){
|
1440 |
+
var id = jQuery('#' + vid).data('soliloquy-slider-id');
|
1441 |
+
if ( soliloquy_slider[id] ) {
|
1442 |
+
soliloquy_slider[id].startAuto();
|
1443 |
+
}
|
1444 |
+
}
|
1445 |
+
function soliloquyWistiaVids(data, id, width, height, holder, $){
|
1446 |
+
// Immediately make the holder visible and increase z-index to overlay the player icon.
|
1447 |
+
$('#' + holder).show().css({'display':'block','z-index':'1210'});
|
1448 |
+
|
1449 |
+
if ( wistiaEmbeds ) {
|
1450 |
+
var attrs = {};
|
1451 |
+
$.each($('#' + holder)[0].attributes, function(idx, attr){
|
1452 |
+
attrs[attr.nodeName] = attr.nodeValue;
|
1453 |
+
});
|
1454 |
+
|
1455 |
+
// Add iframe specific attributes.
|
1456 |
+
data.container = holder;
|
1457 |
+
attrs.src = '//fast.wistia.net/embed/iframe/' + id + '?' + $.param(data);
|
1458 |
+
attrs.frameborder = 0;
|
1459 |
+
|
1460 |
+
// Convert the holder to the video.
|
1461 |
+
$('#' + holder).replaceWith(function(){
|
1462 |
+
return $('<iframe />', attrs).addClass('wistia_embed').append($(this).contents());
|
1463 |
+
});
|
1464 |
+
|
1465 |
+
wistiaEmbeds.onFind(function(video){
|
1466 |
+
if ( id == video.hashedId() ) {
|
1467 |
+
soliloquy_wistia[id] = video;
|
1468 |
+
soliloquy_wistia[id].bind('play', function(){
|
1469 |
+
var id = $(this.container).data('soliloquy-slider-id');
|
1470 |
+
if ( soliloquy_slider[id] ) {
|
1471 |
+
soliloquy_slider[id].stopAuto();
|
1472 |
+
}
|
1473 |
+
});
|
1474 |
+
soliloquy_wistia[id].bind('pause', function(){
|
1475 |
+
var id = $(this.container).data('soliloquy-slider-id');
|
1476 |
+
if ( soliloquy_slider[id] ) {
|
1477 |
+
soliloquy_slider[id].startAuto();
|
1478 |
+
}
|
1479 |
+
});
|
1480 |
+
soliloquy_wistia[id].bind('end', function(){
|
1481 |
+
var id = $(this.container).data('soliloquy-slider-id');
|
1482 |
+
if ( soliloquy_slider[id] ) {
|
1483 |
+
soliloquy_slider[id].startAuto();
|
1484 |
+
}
|
1485 |
+
});
|
1486 |
+
video.play();
|
1487 |
+
}
|
1488 |
+
});
|
1489 |
+
}
|
1490 |
+
}
|
includes/admin/editor.php
CHANGED
@@ -75,7 +75,7 @@ class Soliloquy_Editor_Lite {
|
|
75 |
$button .= '<a id="soliloquy-media-modal-button" href="#" class="button soliloquy-choose-slider" title="' . esc_attr__( 'Add Slider', 'soliloquy' ) . '" style="padding-left: .4em;"><span class="soliloquy-media-icon" style="background: transparent url(' . plugins_url( 'assets/css/images/editor-icon.png', $this->base->file ) . ') no-repeat scroll 0 0; width: 16px; height: 16px; display: inline-block; vertical-align: text-top;"></span> ' . __( 'Add Slider', 'soliloquy' ) . '</a>';
|
76 |
|
77 |
// Enqueue the script that will trigger the editor button.
|
78 |
-
wp_enqueue_script( $this->base->plugin_slug . '-editor-script', plugins_url( 'assets/js/editor.js', $this->base->file ), array( 'jquery' ), $this->base->version, true );
|
79 |
|
80 |
// Add the action to the footer to output the modal window.
|
81 |
add_action( 'admin_footer', array( $this, 'slider_selection_modal' ) );
|
75 |
$button .= '<a id="soliloquy-media-modal-button" href="#" class="button soliloquy-choose-slider" title="' . esc_attr__( 'Add Slider', 'soliloquy' ) . '" style="padding-left: .4em;"><span class="soliloquy-media-icon" style="background: transparent url(' . plugins_url( 'assets/css/images/editor-icon.png', $this->base->file ) . ') no-repeat scroll 0 0; width: 16px; height: 16px; display: inline-block; vertical-align: text-top;"></span> ' . __( 'Add Slider', 'soliloquy' ) . '</a>';
|
76 |
|
77 |
// Enqueue the script that will trigger the editor button.
|
78 |
+
wp_enqueue_script( $this->base->plugin_slug . '-editor-script', plugins_url( 'assets/js/min/editor-min.js', $this->base->file ), array( 'jquery' ), $this->base->version, true );
|
79 |
|
80 |
// Add the action to the footer to output the modal window.
|
81 |
add_action( 'admin_footer', array( $this, 'slider_selection_modal' ) );
|
includes/admin/metaboxes.php
CHANGED
@@ -120,7 +120,7 @@ class Soliloquy_Metaboxes_Lite {
|
|
120 |
|
121 |
// Load necessary metabox scripts.
|
122 |
wp_enqueue_script( 'plupload-handlers' );
|
123 |
-
wp_register_script( $this->base->plugin_slug . '-metabox-script', plugins_url( 'assets/js/metabox.js', $this->base->file ), array( 'jquery', 'plupload-handlers', 'quicktags', 'jquery-ui-sortable' ), $this->base->version, true );
|
124 |
wp_enqueue_script( $this->base->plugin_slug . '-metabox-script' );
|
125 |
wp_localize_script(
|
126 |
$this->base->plugin_slug . '-metabox-script',
|
@@ -171,7 +171,7 @@ class Soliloquy_Metaboxes_Lite {
|
|
171 |
);
|
172 |
|
173 |
// Load necessary HTML slide scripts and styles.
|
174 |
-
wp_register_script( $this->base->plugin_slug . '-codemirror', plugins_url( 'assets/js/codemirror.js', $this->base->file ), array(), $this->base->version, true );
|
175 |
wp_register_style( $this->base->plugin_slug . '-codemirror', plugins_url( 'assets/css/codemirror.css', $this->base->file ), array(), $this->base->version );
|
176 |
wp_enqueue_script( $this->base->plugin_slug . '-codemirror' );
|
177 |
wp_enqueue_style( $this->base->plugin_slug . '-codemirror' );
|
120 |
|
121 |
// Load necessary metabox scripts.
|
122 |
wp_enqueue_script( 'plupload-handlers' );
|
123 |
+
wp_register_script( $this->base->plugin_slug . '-metabox-script', plugins_url( 'assets/js/min/metabox-min.js', $this->base->file ), array( 'jquery', 'plupload-handlers', 'quicktags', 'jquery-ui-sortable' ), $this->base->version, true );
|
124 |
wp_enqueue_script( $this->base->plugin_slug . '-metabox-script' );
|
125 |
wp_localize_script(
|
126 |
$this->base->plugin_slug . '-metabox-script',
|
171 |
);
|
172 |
|
173 |
// Load necessary HTML slide scripts and styles.
|
174 |
+
wp_register_script( $this->base->plugin_slug . '-codemirror', plugins_url( 'assets/js/min/codemirror-min.js', $this->base->file ), array(), $this->base->version, true );
|
175 |
wp_register_style( $this->base->plugin_slug . '-codemirror', plugins_url( 'assets/css/codemirror.css', $this->base->file ), array(), $this->base->version );
|
176 |
wp_enqueue_script( $this->base->plugin_slug . '-codemirror' );
|
177 |
wp_enqueue_style( $this->base->plugin_slug . '-codemirror' );
|
includes/global/shortcode.php
CHANGED
@@ -113,7 +113,7 @@ class Soliloquy_Shortcode_Lite {
|
|
113 |
wp_register_style( $this->base->plugin_slug . '-style', plugins_url( 'assets/css/soliloquy.css', $this->base->file ), array(), $this->base->version );
|
114 |
|
115 |
// Register main slider script.
|
116 |
-
wp_register_script( $this->base->plugin_slug . '-script', plugins_url( 'assets/js/soliloquy.js', $this->base->file ), array( 'jquery' ), $this->base->version, true );
|
117 |
|
118 |
// Load hooks and filters.
|
119 |
add_shortcode( 'soliloquy', array( $this, 'shortcode' ) );
|
113 |
wp_register_style( $this->base->plugin_slug . '-style', plugins_url( 'assets/css/soliloquy.css', $this->base->file ), array(), $this->base->version );
|
114 |
|
115 |
// Register main slider script.
|
116 |
+
wp_register_script( $this->base->plugin_slug . '-script', plugins_url( 'assets/js/min/soliloquy-min.js', $this->base->file ), array( 'jquery' ), $this->base->version, true );
|
117 |
|
118 |
// Load hooks and filters.
|
119 |
add_shortcode( 'soliloquy', array( $this, 'shortcode' ) );
|
readme.txt
CHANGED
@@ -87,6 +87,9 @@ Soliloquy has many Addons that extend its default functionality to make it do in
|
|
87 |
|
88 |
== Changelog ==
|
89 |
|
|
|
|
|
|
|
90 |
= 2.2.4 =
|
91 |
* Added: Minified CSS
|
92 |
|
87 |
|
88 |
== Changelog ==
|
89 |
|
90 |
+
= 2.2.5 =
|
91 |
+
* Added: Minified JS
|
92 |
+
|
93 |
= 2.2.4 =
|
94 |
* Added: Minified CSS
|
95 |
|
soliloquy-lite.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Soliloquy is best responsive WordPress slider plugin. This is the lite version.
|
6 |
* Author: Thomas Griffin
|
7 |
* Author URI: http://thomasgriffinmedia.com
|
8 |
-
* Version: 2.2.
|
9 |
* Text Domain: soliloquy
|
10 |
* Domain Path: languages
|
11 |
*
|
@@ -54,7 +54,7 @@ class Soliloquy_Lite {
|
|
54 |
*
|
55 |
* @var string
|
56 |
*/
|
57 |
-
public $version = '2.2.
|
58 |
|
59 |
/**
|
60 |
* The name of the plugin.
|
5 |
* Description: Soliloquy is best responsive WordPress slider plugin. This is the lite version.
|
6 |
* Author: Thomas Griffin
|
7 |
* Author URI: http://thomasgriffinmedia.com
|
8 |
+
* Version: 2.2.5
|
9 |
* Text Domain: soliloquy
|
10 |
* Domain Path: languages
|
11 |
*
|
54 |
*
|
55 |
* @var string
|
56 |
*/
|
57 |
+
public $version = '2.2.5';
|
58 |
|
59 |
/**
|
60 |
* The name of the plugin.
|