diff --git a/README.ko.md b/README.ko.md index cbe5238..5477c53 100644 --- a/README.ko.md +++ b/README.ko.md @@ -256,6 +256,7 @@ minItemsToShowInTagCloud = 1 # Minimum items to show in tag cloud # header homeHeaderType = "text" # text, img, slide, typewriter +hideHomeHeaderWhenMobile = false # menu showMobileMenuTerms = ["tags", "categories", "series"] diff --git a/README.md b/README.md index c1637d3..8fbf282 100644 --- a/README.md +++ b/README.md @@ -268,6 +268,7 @@ minItemsToShowInTagCloud = 1 # Minimum items to show in tag cloud # header homeHeaderType = "text" # text, img, slide, typewriter +hideHomeHeaderWhenMobile = false # menu showMobileMenuTerms = ["tags", "categories", "series"] diff --git a/assets/js/fuse.min.js b/assets/js/fuse.min.js index 44eec85..02ab1f2 100644 --- a/assets/js/fuse.min.js +++ b/assets/js/fuse.min.js @@ -1,13 +1,9 @@ /** - * Skipped minification because the original files appears to be already minified. - * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files - */ -/*! - * Fuse.js v3.4.6 - Lightweight fuzzy-search (http://fusejs.io) - * - * Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me) + * Fuse.js v6.4.1 - Lightweight fuzzy-search (http://fusejs.io) + * + * Copyright (c) 2020 Kiro Risk (http://kiro.me) * All Rights Reserved. Apache Software License 2.0 - * + * * http://www.apache.org/licenses/LICENSE-2.0 */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Fuse",[],t):"object"==typeof exports?exports.Fuse=t():e.Fuse=t()}(this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){e.exports=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{limit:!1};this._log('---------\nSearch pattern: "'.concat(e,'"'));var n=this._prepareSearchers(e),r=n.tokenSearchers,o=n.fullSearcher,i=this._search(r,o),a=i.weights,s=i.results;return this._computeScore(a,s),this.options.shouldSort&&this._sort(s),t.limit&&"number"==typeof t.limit&&(s=s.slice(0,t.limit)),this._format(s)}},{key:"_prepareSearchers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var n=e.split(this.options.tokenSeparator),r=0,o=n.length;r0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=this.list,r={},o=[];if("string"==typeof n[0]){for(var i=0,a=n.length;i1)throw new Error("Key weight has to be > 0 and <= 1");d=d.name}else s[d]={weight:1};this._analyze({key:d,value:this.options.getFn(l,d),record:l,index:c},{resultMap:r,results:o,tokenSearchers:e,fullSearcher:t})}return{weights:s,results:o}}},{key:"_analyze",value:function(e,t){var n=e.key,r=e.arrayIndex,o=void 0===r?-1:r,i=e.value,a=e.record,c=e.index,h=t.tokenSearchers,l=void 0===h?[]:h,u=t.fullSearcher,f=void 0===u?[]:u,d=t.resultMap,v=void 0===d?{}:d,p=t.results,g=void 0===p?[]:p;if(null!=i){var y=!1,m=-1,k=0;if("string"==typeof i){this._log("\nKey: ".concat(""===n?"-":n));var S=f.search(i);if(this._log('Full text: "'.concat(i,'", score: ').concat(S.score)),this.options.tokenize){for(var x=i.split(this.options.tokenSeparator),b=[],M=0;M-1&&(P=(P+m)/2),this._log("Score average:",P);var F=!this.options.tokenize||!this.options.matchAllTokens||k>=l.length;if(this._log("\nCheck Matches: ".concat(F)),(y||S.isMatch)&&F){var T=v[c];T?T.output.push({key:n,arrayIndex:o,value:i,score:P,matchedIndices:S.matchedIndices}):(v[c]={item:a,output:[{key:n,arrayIndex:o,value:i,score:P,matchedIndices:S.matchedIndices}]},g.push(v[c]))}}else if(s(i))for(var z=0,E=i.length;z-1&&(a.arrayIndex=i.arrayIndex),t.matches.push(a)}}}),this.options.includeScore&&o.push(function(e,t){t.score=e.score});for(var i=0,a=e.length;in)return o(e,this.pattern,r);var a=this.options,s=a.location,c=a.distance,h=a.threshold,l=a.findAllMatches,u=a.minMatchCharLength;return i(e,this.pattern,this.patternAlphabet,{location:s,distance:c,threshold:h,findAllMatches:l,minMatchCharLength:u})}}])&&r(t.prototype,n),s&&r(t,s),e}();e.exports=s},function(e,t){var n=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/ +/g,o=new RegExp(t.replace(n,"\\$&").replace(r,"|")),i=e.match(o),a=!!i,s=[];if(a)for(var c=0,h=i.length;c=P;z-=1){var E=z-1,K=n[e.charAt(E)];if(K&&(x[E]=1),T[z]=(T[z+1]<<1|1)&K,0!==I&&(T[z]|=(L[z+1]|L[z])<<1|1|L[z+1]),T[z]&C&&(w=r(t,{errors:I,currentLocation:E,expectedLocation:g,distance:h}))<=m){if(m=w,(k=E)<=g)break;P=Math.max(1,2*g-k)}}if(r(t,{errors:I+1,currentLocation:g,expectedLocation:g,distance:h})>m)break;L=T}return{isMatch:k>=0,score:0===w?.001:w,matchedIndices:o(x,p)}}},function(e,t){e.exports=function(e,t){var n=t.errors,r=void 0===n?0:n,o=t.currentLocation,i=void 0===o?0:o,a=t.expectedLocation,s=void 0===a?0:a,c=t.distance,h=void 0===c?100:c,l=r/e.length,u=Math.abs(s-i);return h?l+u/h:u?1:l}},function(e,t){e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],r=-1,o=-1,i=0,a=e.length;i=t&&n.push([r,o]),r=-1)}return e[i-1]&&i-r>=t&&n.push([r,i-1]),n}},function(e,t){e.exports=function(e){for(var t={},n=e.length,r=0;re.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:3,t=new Map;return{get:function(n){var r=n.match(I).length;if(t.has(r))return t.get(r);var i=parseFloat((1/Math.sqrt(r)).toFixed(e));return t.set(r,i),i},clear:function(){t.clear()}}}var E=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.getFn,i=void 0===r?A.getFn:r;t(this,e),this.norm=C(3),this.getFn=i,this.isCreated=!1,this.setIndexRecords()}return r(e,[{key:"setSources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setIndexRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=t,this._keysMap={},t.forEach((function(t,n){e._keysMap[t.id]=n}))}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,g(this.docs[0])?this.docs.forEach((function(t,n){e._addString(t,n)})):this.docs.forEach((function(t,n){e._addObject(t,n)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();g(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,n=this.size();t2&&void 0!==arguments[2]?arguments[2]:{},r=n.getFn,i=void 0===r?A.getFn:r,o=new E({getFn:i});return o.setKeys(e.map(L)),o.setSources(t),o.create(),o}function R(e,t){var n=e.matches;t.matches=[],k(n)&&n.forEach((function(e){if(k(e.indices)&&e.indices.length){var n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.src),e.idx>-1&&(n.refIndex=e.idx),t.matches.push(n)}}))}function F(e,t){t.score=e.score}function P(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.errors,r=void 0===n?0:n,i=t.currentLocation,o=void 0===i?0:i,c=t.expectedLocation,a=void 0===c?0:c,s=t.distance,u=void 0===s?A.distance:s,h=t.ignoreLocation,f=void 0===h?A.ignoreLocation:h,l=r/e.length;if(f)return l;var d=Math.abs(a-o);return u?l+d/u:d?1:l}function N(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:A.minMatchCharLength,n=[],r=-1,i=-1,o=0,c=e.length;o=t&&n.push([r,i]),r=-1)}return e[o-1]&&o-r>=t&&n.push([r,o-1]),n}function D(e){for(var t={},n=0,r=e.length;n1&&void 0!==arguments[1]?arguments[1]:{},o=i.location,c=void 0===o?A.location:o,a=i.threshold,s=void 0===a?A.threshold:a,u=i.distance,h=void 0===u?A.distance:u,f=i.includeMatches,l=void 0===f?A.includeMatches:f,d=i.findAllMatches,v=void 0===d?A.findAllMatches:d,g=i.minMatchCharLength,y=void 0===g?A.minMatchCharLength:g,p=i.isCaseSensitive,m=void 0===p?A.isCaseSensitive:p,k=i.ignoreLocation,M=void 0===k?A.ignoreLocation:k;if(t(this,e),this.options={location:c,threshold:s,distance:h,includeMatches:l,findAllMatches:v,minMatchCharLength:y,isCaseSensitive:m,ignoreLocation:M},this.pattern=m?n:n.toLowerCase(),this.chunks=[],this.pattern.length){var x=function(e,t){r.chunks.push({pattern:e,alphabet:D(e),startIndex:t})},b=this.pattern.length;if(b>32){for(var S=0,_=b%32,w=b-_;S3&&void 0!==arguments[3]?arguments[3]:{},i=r.location,o=void 0===i?A.location:i,c=r.distance,a=void 0===c?A.distance:c,s=r.threshold,u=void 0===s?A.threshold:s,h=r.findAllMatches,f=void 0===h?A.findAllMatches:h,l=r.minMatchCharLength,d=void 0===l?A.minMatchCharLength:l,v=r.includeMatches,g=void 0===v?A.includeMatches:v,y=r.ignoreLocation,p=void 0===y?A.ignoreLocation:y;if(t.length>32)throw new Error(S(32));for(var m,k=t.length,M=e.length,x=Math.max(0,Math.min(o,M)),b=u,_=x,w=d>1||g,L=w?Array(M):[];(m=e.indexOf(t,_))>-1;){var O=P(t,{currentLocation:m,expectedLocation:x,distance:a,ignoreLocation:p});if(b=Math.min(O,b),_=m+k,w)for(var j=0;j=K;J-=1){var T=J-1,U=n[e.charAt(T)];if(w&&(L[T]=+!!U),W[J]=(W[J+1]<<1|1)&U,R&&(W[J]|=(I[J+1]|I[J])<<1|1|I[J+1]),W[J]&$&&(C=P(t,{errors:R,currentLocation:T,expectedLocation:x,distance:a,ignoreLocation:p}))<=b){if(b=C,(_=T)<=x)break;K=Math.max(1,2*x-_)}}var V=P(t,{errors:R+1,currentLocation:x,expectedLocation:x,distance:a,ignoreLocation:p});if(V>b)break;I=W}var B={isMatch:_>=0,score:Math.max(.001,C)};if(w){var G=N(L,d);G.length?g&&(B.indices=G):B.isMatch=!1}return B}(e,n,i,{location:c+o,distance:a,threshold:s,findAllMatches:u,minMatchCharLength:h,includeMatches:r,ignoreLocation:f}),p=y.isMatch,m=y.score,k=y.indices;p&&(g=!0),v+=m,p&&k&&(d=[].concat(l(d),l(k)))}));var y={isMatch:g,score:g?v/this.chunks.length:1};return g&&r&&(y.indices=d),y}}]),e}(),K=function(){function e(n){t(this,e),this.pattern=n}return r(e,[{key:"search",value:function(){}}],[{key:"isMultiMatch",value:function(e){return q(e,this.multiRegex)}},{key:"isSingleMatch",value:function(e){return q(e,this.singleRegex)}}]),e}();function q(e,t){var n=e.match(t);return n?n[1]:null}var W=function(e){a(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"exact"}},{key:"multiRegex",get:function(){return/^="(.*)"$/}},{key:"singleRegex",get:function(){return/^=(.*)$/}}]),i}(K),J=function(e){a(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"$/}},{key:"singleRegex",get:function(){return/^!(.*)$/}}]),i}(K),T=function(e){a(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"prefix-exact"}},{key:"multiRegex",get:function(){return/^\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^\^(.*)$/}}]),i}(K),U=function(e){a(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-prefix-exact"}},{key:"multiRegex",get:function(){return/^!\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^!\^(.*)$/}}]),i}(K),V=function(e){a(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}],[{key:"type",get:function(){return"suffix-exact"}},{key:"multiRegex",get:function(){return/^"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^(.*)\$$/}}]),i}(K),B=function(e){a(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-suffix-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^!(.*)\$$/}}]),i}(K),G=function(e){a(i,e);var n=f(i);function i(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=o.location,a=void 0===c?A.location:c,s=o.threshold,u=void 0===s?A.threshold:s,h=o.distance,f=void 0===h?A.distance:h,l=o.includeMatches,d=void 0===l?A.includeMatches:l,v=o.findAllMatches,g=void 0===v?A.findAllMatches:v,y=o.minMatchCharLength,p=void 0===y?A.minMatchCharLength:y,m=o.isCaseSensitive,k=void 0===m?A.isCaseSensitive:m;return t(this,i),(r=n.call(this,e))._bitapSearch=new z(e,{location:a,threshold:u,distance:f,includeMatches:d,findAllMatches:g,minMatchCharLength:p,isCaseSensitive:k}),r}return r(i,[{key:"search",value:function(e){return this._bitapSearch.searchIn(e)}}],[{key:"type",get:function(){return"fuzzy"}},{key:"multiRegex",get:function(){return/^"(.*)"$/}},{key:"singleRegex",get:function(){return/^(.*)$/}}]),i}(K),H=function(e){a(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){for(var t,n=0,r=[],i=this.pattern.length;(t=e.indexOf(this.pattern,n))>-1;)n=t+i,r.push([t,n-1]);var o=!!r.length;return{isMatch:o,score:o?1:0,indices:r}}}],[{key:"type",get:function(){return"include"}},{key:"multiRegex",get:function(){return/^'"(.*)"$/}},{key:"singleRegex",get:function(){return/^'(.*)$/}}]),i}(K),Q=[W,H,T,U,B,V,J,G],X=Q.length,Y=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;function Z(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.split("|").map((function(e){for(var n=e.trim().split(Y).filter((function(e){return e&&!!e.trim()})),r=[],i=0,o=n.length;i1&&void 0!==arguments[1]?arguments[1]:{},i=r.isCaseSensitive,o=void 0===i?A.isCaseSensitive:i,c=r.includeMatches,a=void 0===c?A.includeMatches:c,s=r.minMatchCharLength,u=void 0===s?A.minMatchCharLength:s,h=r.findAllMatches,f=void 0===h?A.findAllMatches:h,l=r.location,d=void 0===l?A.location:l,v=r.threshold,g=void 0===v?A.threshold:v,y=r.distance,p=void 0===y?A.distance:y;t(this,e),this.query=null,this.options={isCaseSensitive:o,includeMatches:a,minMatchCharLength:u,findAllMatches:f,location:d,threshold:g,distance:p},this.pattern=o?n:n.toLowerCase(),this.query=Z(this.pattern,this.options)}return r(e,[{key:"searchIn",value:function(e){var t=this.query;if(!t)return{isMatch:!1,score:1};var n=this.options,r=n.includeMatches;e=n.isCaseSensitive?e:e.toLowerCase();for(var i=0,o=[],c=0,a=0,s=t.length;a1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;t(this,e),this.options=c({},A,{},r),this.options.useExtendedSearch,this._keyStore=new w(this.options.keys),this.setCollection(n,i)}return r(e,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof E))throw new Error("Incorrect 'index' type");this._myIndex=t||$(this.options.keys,this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){k(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"remove",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!1},t=[],n=0,r=this._docs.length;n1&&void 0!==arguments[1]?arguments[1]:{},n=t.limit,r=void 0===n?-1:n,i=this.options,o=i.includeMatches,c=i.includeScore,a=i.shouldSort,s=i.sortFn,u=i.ignoreFieldNorm,h=g(e)?g(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return de(h,{ignoreFieldNorm:u}),a&&h.sort(s),y(r)&&r>-1&&(h=h.slice(0,r)),ve(h,this._docs,{includeMatches:o,includeScore:c})}},{key:"_searchStringList",value:function(e){var t=re(e,this.options),n=this._myIndex.records,r=[];return n.forEach((function(e){var n=e.v,i=e.i,o=e.n;if(k(n)){var c=t.searchIn(n),a=c.isMatch,s=c.score,u=c.indices;a&&r.push({item:n,idx:i,matches:[{score:s,value:n,norm:o,indices:u}]})}})),r}},{key:"_searchLogical",value:function(e){var t=this,n=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.auto,i=void 0===r||r,o=function e(n){var r=Object.keys(n),o=ue(n);if(!o&&r.length>1&&!se(n))return e(fe(n));if(he(n)){var c=o?n[ce]:r[0],a=o?n[ae]:n[c];if(!g(a))throw new Error(b(c));var s={keyId:j(c),pattern:a};return i&&(s.searcher=re(a,t)),s}var u={children:[],operator:r[0]};return r.forEach((function(t){var r=n[t];v(r)&&r.forEach((function(t){u.children.push(e(t))}))})),u};return se(e)||(e=fe(e)),o(e)}(e,this.options),r=this._myIndex.records,i={},o=[];return r.forEach((function(e){var r=e.$,c=e.i;if(k(r)){var a=function e(n,r,i){if(!n.children){var o=n.keyId,c=n.searcher,a=t._findMatches({key:t._keyStore.get(o),value:t._myIndex.getValueForItemAtKeyId(r,o),searcher:c});return a&&a.length?[{idx:i,item:r,matches:a}]:[]}switch(n.operator){case ie:for(var s=[],u=0,h=n.children.length;u2&&void 0!==arguments[2]?arguments[2]:{},r=n.includeMatches,i=void 0===r?A.includeMatches:r,o=n.includeScore,c=void 0===o?A.includeScore:o,a=[];return i&&a.push(R),c&&a.push(F),e.map((function(e){var n=e.idx,r={item:t[n],refIndex:n};return a.length&&a.forEach((function(t){t(e,r)})),r}))}return le.version="6.4.1",le.createIndex=$,le.parseIndex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?A.getFn:n,i=e.keys,o=e.records,c=new E({getFn:r});return c.setKeys(i),c.setIndexRecords(o),c},le.config=A,function(){ne.push.apply(ne,arguments)}(te),le},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Fuse=t(); \ No newline at end of file diff --git a/assets/js/lazysizes.min.js b/assets/js/lazysizes.min.js index 0b08698..ca34f12 100644 --- a/assets/js/lazysizes.min.js +++ b/assets/js/lazysizes.min.js @@ -1,2 +1,3 @@ -/*! lazysizes - v5.1.2 */ -!function(a,b){var c=b(a,a.document);a.lazySizes=c,"object"==typeof module&&module.exports&&(module.exports=c)}("undefined"!=typeof window?window:{},function(a,b){"use strict";var c,d;if(function(){var b,c={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};d=a.lazySizesConfig||a.lazysizesConfig||{};for(b in c)b in d||(d[b]=c[b])}(),!b||!b.getElementsByClassName)return{init:function(){},cfg:d,noSupport:!0};var e=b.documentElement,f=a.Date,g=a.HTMLPictureElement,h="addEventListener",i="getAttribute",j=a[h],k=a.setTimeout,l=a.requestAnimationFrame||k,m=a.requestIdleCallback,n=/^picture$/i,o=["load","error","lazyincluded","_lazyloaded"],p={},q=Array.prototype.forEach,r=function(a,b){return p[b]||(p[b]=new RegExp("(\\s|^)"+b+"(\\s|$)")),p[b].test(a[i]("class")||"")&&p[b]},s=function(a,b){r(a,b)||a.setAttribute("class",(a[i]("class")||"").trim()+" "+b)},t=function(a,b){var c;(c=r(a,b))&&a.setAttribute("class",(a[i]("class")||"").replace(c," "))},u=function(a,b,c){var d=c?h:"removeEventListener";c&&u(a,b),o.forEach(function(c){a[d](c,b)})},v=function(a,d,e,f,g){var h=b.createEvent("Event");return e||(e={}),e.instance=c,h.initEvent(d,!f,!g),h.detail=e,a.dispatchEvent(h),h},w=function(b,c){var e;!g&&(e=a.picturefill||d.pf)?(c&&c.src&&!b[i]("srcset")&&b.setAttribute("srcset",c.src),e({reevaluate:!0,elements:[b]})):c&&c.src&&(b.src=c.src)},x=function(a,b){return(getComputedStyle(a,null)||{})[b]},y=function(a,b,c){for(c=c||a.offsetWidth;c49?function(){m(h,{timeout:g}),g!==d.ricTimeout&&(g=d.ricTimeout)}:A(function(){k(h)},!0);return function(a){var d;(a=!0===a)&&(g=33),b||(b=!0,d=e-(f.now()-c),d<0&&(d=0),a||d<9?i():k(i,d))}},C=function(a){var b,c,d=99,e=function(){b=null,a()},g=function(){var a=f.now()-c;a0)&&"visible"!=x(f,"overflow")&&(d=f.getBoundingClientRect(),g=H>d.left&&Gd.top-1&&F500&&e.clientWidth>500?500:370:d.expand,c._defEx=r,s=r*d.expFactor,t=d.hFac,J=null,O2&&o>2&&!b.hidden?(O=s,Q=0):O=o>1&&Q>1&&P<6?r:N),q!==m&&(y=innerWidth+m*t,D=innerHeight+m,n=-1*m,q=m),h=u[f].getBoundingClientRect(),(I=h.bottom)>=n&&(F=h.top)<=D&&(H=h.right)>=n*t&&(G=h.left)<=y&&(I||H||G||F)&&(d.loadHidden||S(u[f]))&&(l&&P<3&&!p&&(o<3||Q<4)||T(u[f],m))){if(aa(u[f]),k=!0,P>9)break}else!k&&l&&!j&&P<4&&Q<4&&o>2&&(g[0]||d.preloadAfterLoad)&&(g[0]||!p&&(I||H||G||F||"auto"!=u[f][i](d.sizesAttr)))&&(j=g[0]||u[f]);j&&!k&&aa(j)}},V=B(U),W=function(a){var b=a.target;if(b._lazyCache)return void delete b._lazyCache;R(a),s(b,d.loadedClass),t(b,d.loadingClass),u(b,Y),v(b,"lazyloaded")},X=A(W),Y=function(a){X({target:a.target})},Z=function(a,b){try{a.contentWindow.location.replace(b)}catch(c){a.src=b}},$=function(a){var b,c=a[i](d.srcsetAttr);(b=d.customMedia[a[i]("data-media")||a[i]("media")])&&a.setAttribute("media",b),c&&a.setAttribute("srcset",c)},_=A(function(a,b,c,e,f){var g,h,j,l,o,p;(o=v(a,"lazybeforeunveil",b)).defaultPrevented||(e&&(c?s(a,d.autosizesClass):a.setAttribute("sizes",e)),h=a[i](d.srcsetAttr),g=a[i](d.srcAttr),f&&(j=a.parentNode,l=j&&n.test(j.nodeName||"")),p=b.firesLoad||"src"in a&&(h||g||l),o={target:a},s(a,d.loadingClass),p&&(clearTimeout(m),m=k(R,2500),u(a,Y,!0)),l&&q.call(j.getElementsByTagName("source"),$),h?a.setAttribute("srcset",h):g&&!l&&(L.test(a.nodeName)?Z(a,g):a.src=g),f&&(h||l)&&w(a,{src:g})),a._lazyRace&&delete a._lazyRace,t(a,d.lazyClass),z(function(){var b=a.complete&&a.naturalWidth>1;p&&!b||(b&&s(a,"ls-is-cached"),W(o),a._lazyCache=!0,k(function(){"_lazyCache"in a&&delete a._lazyCache},9)),"lazy"==a.loading&&P--},!0)}),aa=function(a){if(!a._lazyRace){var b,c=K.test(a.nodeName),e=c&&(a[i](d.sizesAttr)||a[i]("sizes")),f="auto"==e;(!f&&l||!c||!a[i]("src")&&!a.srcset||a.complete||r(a,d.errorClass)||!r(a,d.lazyClass))&&(b=v(a,"lazyunveilread").detail,f&&E.updateElem(a,!0,a.offsetWidth),a._lazyRace=!0,P++,_(a,b,f,e,c))}},ba=C(function(){d.loadMode=3,V()}),ca=function(){3==d.loadMode&&(d.loadMode=2),ba()},da=function(){if(!l){if(f.now()-p<999)return void k(da,999);l=!0,d.loadMode=3,V(),j("scroll",ca,!0)}};return{_:function(){p=f.now(),c.elements=b.getElementsByClassName(d.lazyClass),g=b.getElementsByClassName(d.lazyClass+" "+d.preloadClass),j("scroll",V,!0),j("resize",V,!0),a.MutationObserver?new MutationObserver(V).observe(e,{childList:!0,subtree:!0,attributes:!0}):(e[h]("DOMNodeInserted",V,!0),e[h]("DOMAttrModified",V,!0),setInterval(V,999)),j("hashchange",V,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach(function(a){b[h](a,V,!0)}),/d$|^c/.test(b.readyState)?da():(j("load",da),b[h]("DOMContentLoaded",V),k(da,2e4)),c.elements.length?(U(),z._lsFlush()):V()},checkElems:V,unveil:aa,_aLSL:ca}}(),E=function(){var a,c=A(function(a,b,c,d){var e,f,g;if(a._lazysizesWidth=d,d+="px",a.setAttribute("sizes",d),n.test(b.nodeName||""))for(e=b.getElementsByTagName("source"),f=0,g=e.length;f49?function(){l(t,{timeout:n});if(n!==H.ricTimeout){n=H.ricTimeout}}:te(function(){I(t)},true);return function(e){var t;if(e=e===true){n=33}if(i){return}i=true;t=r-(f.now()-a);if(t<0){t=0}if(e||t<9){s()}else{I(s,t)}}},ae=function(e){var t,i;var a=99;var r=function(){t=null;e()};var n=function(){var e=f.now()-i;if(e0;if(r&&Z(a,"overflow")!="visible"){i=a.getBoundingClientRect();r=C>i.left&&pi.top-1&&g500&&O.clientWidth>500?500:370:H.expand;k._defEx=u;f=u*H.expFactor;c=H.hFac;A=null;if(w2&&h>2&&!D.hidden){w=f;M=0}else if(h>1&&M>1&&N<6){w=u}else{w=_}}if(o!==n){y=innerWidth+n*c;z=innerHeight+n;s=n*-1;o=n}i=d[t].getBoundingClientRect();if((b=i.bottom)>=s&&(g=i.top)<=z&&(C=i.right)>=s*c&&(p=i.left)<=y&&(b||C||p||g)&&(H.loadHidden||W(d[t]))&&(m&&N<3&&!l&&(h<3||M<4)||S(d[t],n))){R(d[t]);r=true;if(N>9){break}}else if(!r&&m&&!a&&N<4&&M<4&&h>2&&(v[0]||H.preloadAfterLoad)&&(v[0]||!l&&(b||C||p||g||d[t][$](H.sizesAttr)!="auto"))){a=v[0]||d[t]}}if(a&&!r){R(a)}}};var i=ie(t);var B=function(e){var t=e.target;if(t._lazyCache){delete t._lazyCache;return}x(e);K(t,H.loadedClass);Q(t,H.loadingClass);V(t,L);X(t,"lazyloaded")};var a=te(B);var L=function(e){a({target:e.target})};var T=function(t,i){try{t.contentWindow.location.replace(i)}catch(e){t.src=i}};var F=function(e){var t;var i=e[$](H.srcsetAttr);if(t=H.customMedia[e[$]("data-media")||e[$]("media")]){e.setAttribute("media",t)}if(i){e.setAttribute("srcset",i)}};var s=te(function(t,e,i,a,r){var n,s,l,o,u,f;if(!(u=X(t,"lazybeforeunveil",e)).defaultPrevented){if(a){if(i){K(t,H.autosizesClass)}else{t.setAttribute("sizes",a)}}s=t[$](H.srcsetAttr);n=t[$](H.srcAttr);if(r){l=t.parentNode;o=l&&j.test(l.nodeName||"")}f=e.firesLoad||"src"in t&&(s||n||o);u={target:t};K(t,H.loadingClass);if(f){clearTimeout(c);c=I(x,2500);V(t,L,true)}if(o){G.call(l.getElementsByTagName("source"),F)}if(s){t.setAttribute("srcset",s)}else if(n&&!o){if(d.test(t.nodeName)){T(t,n)}else{t.src=n}}if(r&&(s||o)){Y(t,{src:n})}}if(t._lazyRace){delete t._lazyRace}Q(t,H.lazyClass);ee(function(){var e=t.complete&&t.naturalWidth>1;if(!f||e){if(e){K(t,"ls-is-cached")}B(u);t._lazyCache=true;I(function(){if("_lazyCache"in t){delete t._lazyCache}},9)}if(t.loading=="lazy"){N--}},true)});var R=function(e){if(e._lazyRace){return}var t;var i=n.test(e.nodeName);var a=i&&(e[$](H.sizesAttr)||e[$]("sizes"));var r=a=="auto";if((r||!m)&&i&&(e[$]("src")||e.srcset)&&!e.complete&&!J(e,H.errorClass)&&J(e,H.lazyClass)){return}t=X(e,"lazyunveilread").detail;if(r){re.updateElem(e,true,e.offsetWidth)}e._lazyRace=true;N++;s(e,t,r,a,i)};var r=ae(function(){H.loadMode=3;i()});var l=function(){if(H.loadMode==3){H.loadMode=2}r()};var o=function(){if(m){return}if(f.now()-e<999){I(o,999);return}m=true;H.loadMode=3;i();q("scroll",l,true)};return{_:function(){e=f.now();k.elements=D.getElementsByClassName(H.lazyClass);v=D.getElementsByClassName(H.lazyClass+" "+H.preloadClass);q("scroll",i,true);q("resize",i,true);q("pageshow",function(e){if(e.persisted){var t=D.querySelectorAll("."+H.loadingClass);if(t.length&&t.forEach){U(function(){t.forEach(function(e){if(e.complete){R(e)}})})}}});if(u.MutationObserver){new MutationObserver(i).observe(O,{childList:true,subtree:true,attributes:true})}else{O[P]("DOMNodeInserted",i,true);O[P]("DOMAttrModified",i,true);setInterval(i,999)}q("hashchange",i,true);["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){D[P](e,i,true)});if(/d$|^c/.test(D.readyState)){o()}else{q("load",o);D[P]("DOMContentLoaded",i);I(o,2e4)}if(k.elements.length){t();ee._lsFlush()}else{i()}},checkElems:i,unveil:R,_aLSL:l}}(),re=function(){var i;var n=te(function(e,t,i,a){var r,n,s;e._lazysizesWidth=a;a+="px";e.setAttribute("sizes",a);if(j.test(t.nodeName||"")){r=t.getElementsByTagName("source");for(n=0,s=r.length;n 1 || event.scale && event.scale !== 1) { - return; - } - - // we can disable scrolling unless it is already in progress - if (options.disableScroll && isCancelable(event)) { - event.preventDefault(); - } - - touches = event.touches[0]; - } - - // measure change in x and y - delta = { - x: touches.pageX - start.x, - y: touches.pageY - start.y - }; - - // determine if scrolling test has run - one time test - if (typeof isScrolling === 'undefined') { - isScrolling = !!(isScrolling || Math.abs(delta.x) < Math.abs(delta.y)); - } - - // if user is not trying to scroll vertically - if (!isScrolling) { - - // if it is not already scrolling - if (isCancelable(event)) { - // prevent native scrolling - event.preventDefault(); - } - - // stop slideshow - stop(); - - // increase resistance if first or last slide - if (options.continuous) { // we don't add resistance at the end - - translate(circle(index - 1), delta.x + slidePos[circle(index - 1)], 0); - translate(index, delta.x + slidePos[index], 0); - translate(circle(index + 1), delta.x + slidePos[circle(index + 1)], 0); - - } else { - - delta.x = - delta.x / - ((!index && delta.x > 0 || // if first slide and sliding left - index === slides.length - 1 && // or if last slide and sliding right - delta.x < 0 // and if sliding at all - ) ? - (Math.abs(delta.x) / width + 1) // determine resistance level - : 1); // no resistance if false - - // translate 1:1 - translate(index - 1, delta.x + slidePos[index - 1], 0); - translate(index, delta.x + slidePos[index], 0); - translate(index + 1, delta.x + slidePos[index + 1], 0); - } - } - }, - - end: function (event) { - - // measure duration - var duration = +new Date() - start.time; - - // determine if slide attempt triggers next/prev slide - var isValidSlide = - Number(duration) < 250 && // if slide duration is less than 250ms - Math.abs(delta.x) > 20 || // and if slide amt is greater than 20px - Math.abs(delta.x) > width / 2; // or if slide amt is greater than half the width - - // determine if slide attempt is past start and end - var isPastBounds = - !index && delta.x > 0 || // if first slide and slide amt is greater than 0 - index === slides.length - 1 && delta.x < 0; // or if last slide and slide amt is less than 0 - - if (options.continuous) { - isPastBounds = false; - } - - // OLD determine direction of swipe (true:right, false:left) - // determine direction of swipe (1: backward, -1: forward) - var direction = Math.abs(delta.x) / delta.x; - - // if not scrolling vertically - if (!isScrolling) { - - if (isValidSlide && !isPastBounds) { - - // if we're moving right - if (direction < 0) { - - if (options.continuous) { // we need to get the next in this direction in place - - move(circle(index - 1), -width, 0); - move(circle(index + 2), width, 0); - - } else { - move(index - 1, -width, 0); - } - - move(index, slidePos[index] - width, speed); - move(circle(index + 1), slidePos[circle(index + 1)] - width, speed); - index = circle(index + 1); - - } else { - if (options.continuous) { // we need to get the next in this direction in place - - move(circle(index + 1), width, 0); - move(circle(index - 2), -width, 0); - - } else { - move(index + 1, width, 0); - } - - move(index, slidePos[index] + width, speed); - move(circle(index - 1), slidePos[circle(index - 1)] + width, speed); - index = circle(index - 1); - } - - runCallback(getPos(), slides[index], direction); - - } else { - - if (options.continuous) { - - move(circle(index - 1), -width, speed); - move(index, 0, speed); - move(circle(index + 1), width, speed); - - } else { - - move(index - 1, -width, speed); - move(index, 0, speed); - move(index + 1, width, speed); - } - } - } - - // kill touchmove and touchend event listeners until touchstart called again - if (isMouseEvent(event)) { - element.removeEventListener('mousemove', events, false); - element.removeEventListener('mouseup', events, false); - element.removeEventListener('mouseleave', events, false); - } else { - element.removeEventListener('touchmove', events, browser.passiveEvents ? { passive: false } : false); - element.removeEventListener('touchend', events, false); - } - - }, - - transitionEnd: function (event) { - var currentIndex = parseInt(event.target.getAttribute('data-index'), 10); - if (currentIndex === index) { - if (delay || options.autoRestart) restart(); - - runTransitionEnd(getPos(), slides[index]); - } - } - }; - - // trigger setup - setup(); - - // start auto slideshow if applicable - begin(); - - // Expose the Swipe API - return { - // initialize - setup: setup, - - // go to slide - slide: function (to, speed) { - stop(); - slide(to, speed); - }, - - // move to previous - prev: function () { - stop(); - prev(); - }, - - // move to next - next: function () { - stop(); - next(); - }, - - // Restart slideshow - restart: restart, - - // cancel slideshow - stop: stop, - - // return current index position - getPos: getPos, - - // disable slideshow - disable: disable, - - // enable slideshow - enable: enable, - - // return total number of slides - getNumSlides: function () { return length; }, - - // completely remove swipe - kill: kill - }; - - // remove all event listeners - function detachEvents() { - if (browser.addEventListener) { - // remove current event listeners - element.removeEventListener('touchstart', events, browser.passiveEvents ? { passive: true } : false); - element.removeEventListener('mousedown', events, false); - element.removeEventListener('webkitTransitionEnd', events, false); - element.removeEventListener('msTransitionEnd', events, false); - element.removeEventListener('oTransitionEnd', events, false); - element.removeEventListener('otransitionend', events, false); - element.removeEventListener('transitionend', events, false); - root.removeEventListener('resize', events, false); - } else { - root.onresize = null; - } - } - - // add event listeners - function attachEvents() { - if (browser.addEventListener) { - - // set touchstart event on element - if (browser.touch) { - element.addEventListener('touchstart', events, browser.passiveEvents ? { passive: true } : false); - } - - if (options.draggable) { - element.addEventListener('mousedown', events, false); - } - - if (browser.transitions) { - element.addEventListener('webkitTransitionEnd', events, false); - element.addEventListener('msTransitionEnd', events, false); - element.addEventListener('oTransitionEnd', events, false); - element.addEventListener('otransitionend', events, false); - element.addEventListener('transitionend', events, false); - } - - // set resize event on window - root.addEventListener('resize', events, false); - - } else { - root.onresize = throttledSetup; // to play nice with old IE - } - } - - // clone nodes when there is only two slides - function cloneNode(el) { - var clone = el.cloneNode(true); - element.appendChild(clone); - - // tag these slides as clones (to remove them on kill) - clone.setAttribute('data-cloned', true); - - // Remove id from element - clone.removeAttribute('id'); - } - - function setup(opts) { - // Overwrite options if necessary - if (opts != null) { - for (var prop in opts) { - options[prop] = opts[prop]; - } - } - - // cache slides - slides = element.children; - length = slides.length; - - // slides length correction, minus cloned slides - for (var i = 0; i < slides.length; i++) { - if (slides[i].getAttribute('data-cloned')) length--; - } - - // set continuous to false if only one slide - if (slides.length < 2) { - options.continuous = false; - } - - // special case if two slides - if (browser.transitions && options.continuous && slides.length < 3) { - cloneNode(slides[0]); - cloneNode(slides[1]); - - slides = element.children; - } - - // adjust style on rtl - if ('right' === slideDir) { - for (var j = 0; j < slides.length; j++) { - slides[j].style.float = 'right'; - } - } - - // create an array to store current positions of each slide - slidePos = new Array(slides.length); - - // determine width of each slide - //width = container.getBoundingClientRect().width || container.offsetWidth; - width = root.innerWidth - getScrollbarWidth(); - element.style.width = (slides.length * width * 2) + 'px'; - // stack elements - var pos = slides.length; - while (pos--) { - var slide = slides[pos]; - - slide.style.width = width + 'px'; - slide.setAttribute('data-index', pos); - - if (browser.transitions) { - slide.style[slideDir] = (pos * -width) + 'px'; - move(pos, index > pos ? -width : (index < pos ? width : 0), 0); - } - } - - // reposition elements before and after index - if (options.continuous && browser.transitions) { - move(circle(index - 1), -width, 0); - move(circle(index + 1), width, 0); - } - - if (!browser.transitions) { - element.style[slideDir] = (index * -width) + 'px'; - } - - container.style.visibility = 'visible'; - - // reinitialize events - detachEvents(); - attachEvents(); - } - - function prev() { - if (disabled) return; - - if (options.continuous) { - slide(index - 1); - } else if (index) { - slide(index - 1); - } - } - - function next() { - if (disabled) return; - if (options.continuous) { - slide(index + 1); - } else if (index < slides.length - 1) { - slide(index + 1); - } - } - - function runCallback(pos, index, dir) { - if (options.callback) { - options.callback(pos, index, dir); - } - } - - function runTransitionEnd(pos, index) { - if (options.transitionEnd) { - options.transitionEnd(pos, index); - } - } - - function circle(index) { - - // a simple positive modulo using slides.length - return (slides.length + (index % slides.length)) % slides.length; - } - - function getPos() { - // Fix for the clone issue in the event of 2 slides - var currentIndex = index; - - if (currentIndex >= length) { - currentIndex = currentIndex - length; - } - - return currentIndex; - } - - function slide(to, slideSpeed) { - - // ensure to is of type 'number' - to = typeof to !== 'number' ? parseInt(to, 10) : to; - - // do nothing if already on requested slide - if (index === to) return; - - if (browser.transitions) { - - var direction = Math.abs(index - to) / (index - to); // 1: backward, -1: forward - - // get the actual position of the slide - if (options.continuous) { - var natural_direction = direction; - direction = -slidePos[circle(to)] / width; - - // if going forward but to < index, use to = slides.length + to - // if going backward but to > index, use to = -slides.length + to - if (direction !== natural_direction) { - to = -direction * slides.length + to; - } - - } - - var diff = Math.abs(index - to) - 1; - - // move all the slides between index and to in the right direction - while (diff--) { - move(circle((to > index ? to : index) - diff - 1), width * direction, 0); - } - - to = circle(to); - - move(index, width * direction, slideSpeed || speed); - move(to, 0, slideSpeed || speed); - - if (options.continuous) { // we need to get the next in place - move(circle(to - direction), -(width * direction), 0); - } - - } else { - - to = circle(to); - animate(index * -width, to * -width, slideSpeed || speed); - // no fallback for a circular continuous if the browser does not accept transitions - } - - index = to; - offloadFn(function () { - runCallback(getPos(), slides[index], direction); - }); - } - - function move(index, dist, speed) { - translate(index, dist, speed); - slidePos[index] = dist; - } - - function translate(index, dist, speed) { - - var slide = slides[index]; - var style = slide && slide.style; - - if (!style) return; - - style.webkitTransitionDuration = - style.MozTransitionDuration = - style.msTransitionDuration = - style.OTransitionDuration = - style.transitionDuration = speed + 'ms'; - - style.webkitTransform = - style.msTransform = - style.MozTransform = - style.OTransform = - style.transform = 'translateX(' + dist + 'px)'; - } - - function animate(from, to, speed) { - - // if not an animation, just reposition - if (!speed) { - element.style[slideDir] = to + 'px'; - return; - } - - var start = +new Date(); - - var timer = setInterval(function () { - var timeElap = +new Date() - start; - - if (timeElap > speed) { - - element.style[slideDir] = to + 'px'; - - if (delay || options.autoRestart) restart(); - - runTransitionEnd(getPos(), slides[index]); - - clearInterval(timer); - - return; - } - - element.style[slideDir] = (((to - from) * (Math.floor((timeElap / speed) * 100) / 100)) + from) + 'px'; - }, 4); - - } - - function begin() { - delay = options.auto || 0; - if (delay) interval = setTimeout(next, delay); - } - - function stop() { - delay = 0; - clearTimeout(interval); - } - - function restart() { - stop(); - begin(); - } - - function disable() { - stop(); - disabled = true; - } - - function enable() { - disabled = false; - restart(); - } - - function isMouseEvent(e) { - return /^mouse/.test(e.type); - } - - function kill() { - // cancel slideshow - stop(); - - // remove inline styles - container.style.visibility = ''; - - // reset element - element.style.width = ''; - element.style[slideDir] = ''; - - // reset slides - var pos = slides.length; - while (pos--) { - - if (browser.transitions) { - translate(pos, 0, 0); - } - - var slide = slides[pos]; - - // if the slide is tagged as clone, remove it - if (slide.getAttribute('data-cloned')) { - var _parent = slide.parentElement; - _parent.removeChild(slide); - } - - // remove styles - slide.style.width = ''; - slide.style[slideDir] = ''; - - slide.style.webkitTransitionDuration = - slide.style.MozTransitionDuration = - slide.style.msTransitionDuration = - slide.style.OTransitionDuration = - slide.style.transitionDuration = ''; - - slide.style.webkitTransform = - slide.style.msTransform = - slide.style.MozTransform = - slide.style.OTransform = ''; - - // remove custom attributes (?) - // slide.removeAttribute('data-index'); - } - - // remove all events - detachEvents(); - - // remove throttled function timeout - throttledSetup.cancel(); - } - } - - if (root.jQuery || root.Zepto) { - (function ($) { - $.fn.Swipe = function (params) { - return this.each(function () { - $(this).data('Swipe', new Swipe($(this)[0], params)); - }); - }; - })(root.jQuery || root.Zepto); - } - - return Swipe; -})); \ No newline at end of file +!function(t,e){"function"==typeof define&&define.amd?define([],function(){return t.Swipe=e(),t.Swipe}):"object"==typeof module&&module.exports?module.exports=e():t.Swipe=e()}(this,function(){var t,e="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this,n=e.document;function i(t,i){"use strict";var o,s,r={},a={},u=(i=i||{}).auto||0,l=!1,c=function(){},v=function(t){setTimeout(t||c,0)};var d=function(t){return!!t&&("boolean"!=typeof t.cancelable||t.cancelable)},f={addEventListener:!!e.addEventListener,passiveEvents:function(){var t=!1;try{var n=Object.defineProperty({},"passive",{get:function(){t=!0}});e.addEventListener("testEvent",null,n),e.removeEventListener("testEvent",null,n)}catch(e){t=!1}return t}(),touch:"ontouchstart"in e||e.DocumentTouch&&n instanceof DocumentTouch,transitions:function(t){var e=["transitionProperty","WebkitTransition","MozTransition","OTransition","msTransition"];for(var n in e)if(void 0!==t.style[e[n]])return!0;return!1}(n.createElement("swipe"))};if(t){var m,h,p,E,y=t.children[0],b=parseInt(i.startSlide,10)||0,g=i.speed||300;i.continuous=void 0===i.continuous||i.continuous;var T,x,L=((T=t).currentStyle?x=T.currentStyle.direction:e.getComputedStyle&&(x=e.getComputedStyle(T,null).getPropertyValue("direction")),"rtl"===x?"right":"left");i.autoRestart=void 0!==i.autoRestart&&i.autoRestart;var w=function(t,e){e=e||100;var n=null;function i(){n&&clearTimeout(n)}function o(){var o=this,s=arguments;i(),n=setTimeout(function(){n=null,t.apply(o,s)},e)}return o.cancel=i,o}(S),D={handleEvent:function(t){if(!l){switch(t.type){case"mousedown":case"touchstart":this.start(t);break;case"mousemove":case"touchmove":this.move(t);break;case"mouseup":case"mouseleave":case"touchend":this.end(t);break;case"webkitTransitionEnd":case"msTransitionEnd":case"oTransitionEnd":case"otransitionend":case"transitionend":this.transitionEnd(t);break;case"resize":w()}i.stopPropagation&&t.stopPropagation()}},start:function(t){var e;Q(t)?(e=t,t.preventDefault()):e=t.touches[0],r={x:e.pageX,y:e.pageY,time:+new Date},o=void 0,a={},Q(t)?(y.addEventListener("mousemove",this,!1),y.addEventListener("mouseup",this,!1),y.addEventListener("mouseleave",this,!1)):(y.addEventListener("touchmove",this,!!f.passiveEvents&&{passive:!1}),y.addEventListener("touchend",this,!1))},move:function(t){var e;if(Q(t))e=t;else{if(t.touches.length>1||t.scale&&1!==t.scale)return;i.disableScroll&&d(t)&&t.preventDefault(),e=t.touches[0]}a={x:e.pageX-r.x,y:e.pageY-r.y},void 0===o&&(o=!!(o||Math.abs(a.x)0||b===m.length-1&&a.x<0?Math.abs(a.x)/p+1:1),C(b-1,a.x+h[b-1],0),C(b,a.x+h[b],0),C(b+1,a.x+h[b+1],0)))},end:function(t){var e=+new Date-r.time,n=Number(e)<250&&Math.abs(a.x)>20||Math.abs(a.x)>p/2,s=!b&&a.x>0||b===m.length-1&&a.x<0;i.continuous&&(s=!1);var u=Math.abs(a.x)/a.x;o||(n&&!s?(u<0?(i.continuous?(R(O(b-1),-p,0),R(O(b+2),p,0)):R(b-1,-p,0),R(b,h[b]-p,g),R(O(b+1),h[O(b+1)]-p,g),b=O(b+1)):(i.continuous?(R(O(b+1),p,0),R(O(b-2),-p,0)):R(b+1,p,0),R(b,h[b]+p,g),R(O(b-1),h[O(b-1)]+p,g),b=O(b-1)),A(P(),m[b],u)):i.continuous?(R(O(b-1),-p,g),R(b,0,g),R(O(b+1),p,g)):(R(b-1,-p,g),R(b,0,g),R(b+1,p,g))),Q(t)?(y.removeEventListener("mousemove",D,!1),y.removeEventListener("mouseup",D,!1),y.removeEventListener("mouseleave",D,!1)):(y.removeEventListener("touchmove",D,!!f.passiveEvents&&{passive:!1}),y.removeEventListener("touchend",D,!1))},transitionEnd:function(t){parseInt(t.target.getAttribute("data-index"),10)===b&&((u||i.autoRestart)&&X(),j(P(),m[b]))}};return S(),W(),{setup:S,slide:function(t,e){N(),I(t,e)},prev:function(){N(),function(){if(l)return;i.continuous?I(b-1):b&&I(b-1)}()},next:function(){N(),z()},restart:X,stop:N,getPos:P,disable:function(){N(),l=!0},enable:function(){l=!1,X()},getNumSlides:function(){return E},kill:function(){N(),t.style.visibility="",y.style.width="",y.style[L]="";var e=m.length;for(;e--;){f.transitions&&C(e,0,0);var n=m[e];if(n.getAttribute("data-cloned")){var i=n.parentElement;i.removeChild(n)}n.style.width="",n.style[L]="",n.style.webkitTransitionDuration=n.style.MozTransitionDuration=n.style.msTransitionDuration=n.style.OTransitionDuration=n.style.transitionDuration="",n.style.webkitTransform=n.style.msTransform=n.style.MozTransform=n.style.OTransform=""}k(),w.cancel()}}}function k(){f.addEventListener?(y.removeEventListener("touchstart",D,!!f.passiveEvents&&{passive:!0}),y.removeEventListener("mousedown",D,!1),y.removeEventListener("webkitTransitionEnd",D,!1),y.removeEventListener("msTransitionEnd",D,!1),y.removeEventListener("oTransitionEnd",D,!1),y.removeEventListener("otransitionend",D,!1),y.removeEventListener("transitionend",D,!1),e.removeEventListener("resize",D,!1)):e.onresize=null}function M(t){var e=t.cloneNode(!0);y.appendChild(e),e.setAttribute("data-cloned",!0),e.removeAttribute("id")}function S(o){if(null!=o)for(var s in o)i[s]=o[s];m=y.children,E=m.length;for(var r=0;ru?-p:b=E&&(t-=E),t}function I(t,e){if(t="number"!=typeof t?parseInt(t,10):t,b!==t){if(f.transitions){var n=Math.abs(b-t)/(b-t);if(i.continuous){var o=n;(n=-h[O(t)]/p)!==o&&(t=-n*m.length+t)}for(var s=Math.abs(b-t)-1;s--;)R(O((t>b?t:b)-s-1),p*n,0);t=O(t),R(b,p*n,e||g),R(t,0,e||g),i.continuous&&R(O(t-n),-p*n,0)}else t=O(t),function(t,e,n){if(!n)return void(y.style[L]=e+"px");var o=+new Date,s=setInterval(function(){var r=+new Date-o;if(r>n)return y.style[L]=e+"px",(u||i.autoRestart)&&X(),j(P(),m[b]),void clearInterval(s);y.style[L]=(e-t)*(Math.floor(r/n*100)/100)+t+"px"},4)}(b*-p,t*-p,e||g);b=t,v(function(){A(P(),m[b],n)})}}function R(t,e,n){C(t,e,n),h[t]=e}function C(t,e,n){var i=m[t],o=i&&i.style;o&&(o.webkitTransitionDuration=o.MozTransitionDuration=o.msTransitionDuration=o.OTransitionDuration=o.transitionDuration=n+"ms",o.webkitTransform=o.msTransform=o.MozTransform=o.OTransform=o.transform="translateX("+e+"px)")}function W(){(u=i.auto||0)&&(s=setTimeout(z,u))}function N(){u=0,clearTimeout(s)}function X(){N(),W()}function Q(t){return/^mouse/.test(t.type)}}return(e.jQuery||e.Zepto)&&((t=e.jQuery||e.Zepto).fn.Swipe=function(e){return this.each(function(){t(this).data("Swipe",new i(t(this)[0],e))})}),i}); \ No newline at end of file diff --git a/assets/js/swipehome.js b/assets/js/swipehome.js index fd008b2..47f811d 100644 --- a/assets/js/swipehome.js +++ b/assets/js/swipehome.js @@ -6,833 +6,4 @@ * */ -// if the module has no dependencies, the above pattern can be simplified to -// eslint-disable-next-line no-extra-semi -; (function (root, factory) { - // eslint-disable-next-line no-undef - if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - // eslint-disable-next-line no-undef - define([], function () { - root.Swipe = factory(); - return root.Swipe; - }); - } else if (typeof module === 'object' && module.exports) { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like environments that support module.exports, - // like Node. - module.exports = factory(); - } else { - // Browser globals - root.Swipe = factory(); - } -}(this, function () { - // Establish the root object, `window` (`self`) in the browser, `global` - // on the server, or `this` in some virtual machines. We use `self` - // instead of `window` for `WebWorker` support. - var root = typeof self == 'object' && self.self === self && self || - typeof global == 'object' && global.global === global && global || - this; - - var _document = root.document; - - function Swipe(container, options) { - - 'use strict'; - - options = options || {}; - - // setup initial vars - var start = {}; - var delta = {}; - var isScrolling; - - // setup auto slideshow - var delay = options.auto || 0; - var interval; - - var disabled = false; - - // utilities - // simple no operation function - var noop = function () { }; - // offload a functions execution - var offloadFn = function (fn) { setTimeout(fn || noop, 0); }; - // Returns a function, that, as long as it continues to be invoked, will not - // be triggered. - var throttle = function (fn, threshhold) { - threshhold = threshhold || 100; - var timeout = null; - - function cancel() { - if (timeout) clearTimeout(timeout); - } - - function throttledFn() { - var context = this; - var args = arguments; - cancel(); - timeout = setTimeout(function () { - timeout = null; - fn.apply(context, args); - }, threshhold); - } - - // allow remove throttled timeout - throttledFn.cancel = cancel; - - return throttledFn; - }; - - // check whether event is cancelable - var isCancelable = function (event) { - if (!event) return false; - return typeof event.cancelable !== 'boolean' || event.cancelable; - }; - - // check browser capabilities - var browser = { - addEventListener: !!root.addEventListener, - passiveEvents: (function () { - // Test via a getter in the options object to see if the passive property is accessed - var supportsPassive = false; - try { - var opts = Object.defineProperty({}, 'passive', { - // eslint-disable-next-line getter-return - get: function () { - supportsPassive = true; - } - }); - root.addEventListener('testEvent', null, opts); - root.removeEventListener('testEvent', null, opts); - } - catch (e) { - supportsPassive = false; - } - return supportsPassive; - })(), - // eslint-disable-next-line no-undef - touch: ('ontouchstart' in root) || root.DocumentTouch && _document instanceof DocumentTouch, - transitions: (function (temp) { - var props = ['transitionProperty', 'WebkitTransition', 'MozTransition', 'OTransition', 'msTransition']; - for (var i in props) { - if (temp.style[props[i]] !== undefined) { - return true; - } - } - return false; - })(_document.createElement('swipe')) - }; - - // quit if no root element - if (!container) return; - - var element = container.children[0]; - var slides, slidePos, width, length; - var index = parseInt(options.startSlide, 10) || 0; - var speed = options.speed || 300; - options.continuous = options.continuous !== undefined ? options.continuous : true; - - // check text direction - var slideDir = (function (el, prop, dir) { - if (el.currentStyle) { - dir = el.currentStyle[prop]; - } else if (root.getComputedStyle) { - dir = root.getComputedStyle(el, null).getPropertyValue(prop); - } - return 'rtl' === dir ? 'right' : 'left'; - })(container, 'direction'); - - // AutoRestart option: auto restart slideshow after user's touch event - options.autoRestart = options.autoRestart !== undefined ? options.autoRestart : false; - - // throttled setup - var throttledSetup = throttle(setup); - - // setup event capturing - var events = { - - handleEvent: function (event) { - if (disabled) return; - - switch (event.type) { - case 'mousedown': - case 'touchstart': this.start(event); break; - case 'mousemove': - case 'touchmove': this.move(event); break; - case 'mouseup': - case 'mouseleave': - case 'touchend': this.end(event); break; - case 'webkitTransitionEnd': - case 'msTransitionEnd': - case 'oTransitionEnd': - case 'otransitionend': - case 'transitionend': this.transitionEnd(event); break; - case 'resize': throttledSetup(); break; - } - - if (options.stopPropagation) { - event.stopPropagation(); - } - }, - - start: function (event) { - var touches; - - if (isMouseEvent(event)) { - touches = event; - event.preventDefault(); // For desktop Safari drag - } else { - touches = event.touches[0]; - } - - // measure start values - start = { - - // get initial touch coords - x: touches.pageX, - y: touches.pageY, - - // store time to determine touch duration - time: +new Date() - - }; - - // used for testing first move event - isScrolling = undefined; - - // reset delta and end measurements - delta = {}; - - // attach touchmove and touchend listeners - if (isMouseEvent(event)) { - element.addEventListener('mousemove', this, false); - element.addEventListener('mouseup', this, false); - element.addEventListener('mouseleave', this, false); - } else { - element.addEventListener('touchmove', this, browser.passiveEvents ? { passive: false } : false); - element.addEventListener('touchend', this, false); - } - runDragStart(getPos(), slides[index]); - }, - - move: function (event) { - var touches; - - if (isMouseEvent(event)) { - touches = event; - } else { - // ensure swiping with one touch and not pinching - if (event.touches.length > 1 || event.scale && event.scale !== 1) { - return; - } - - // we can disable scrolling unless it is already in progress - if (options.disableScroll && isCancelable(event)) { - event.preventDefault(); - } - - touches = event.touches[0]; - } - - // measure change in x and y - delta = { - x: touches.pageX - start.x, - y: touches.pageY - start.y - }; - - // determine if scrolling test has run - one time test - if (typeof isScrolling === 'undefined') { - isScrolling = !!(isScrolling || Math.abs(delta.x) < Math.abs(delta.y)); - } - - // if user is not trying to scroll vertically - if (!isScrolling) { - - // if it is not already scrolling - if (isCancelable(event)) { - // prevent native scrolling - event.preventDefault(); - } - - // stop slideshow - stop(); - - // increase resistance if first or last slide - if (options.continuous) { // we don't add resistance at the end - - translate(circle(index - 1), delta.x + slidePos[circle(index - 1)], 0); - translate(index, delta.x + slidePos[index], 0); - translate(circle(index + 1), delta.x + slidePos[circle(index + 1)], 0); - - } else { - - delta.x = - delta.x / - ((!index && delta.x > 0 || // if first slide and sliding left - index === slides.length - 1 && // or if last slide and sliding right - delta.x < 0 // and if sliding at all - ) ? - (Math.abs(delta.x) / width + 1) // determine resistance level - : 1); // no resistance if false - - // translate 1:1 - translate(index - 1, delta.x + slidePos[index - 1], 0); - translate(index, delta.x + slidePos[index], 0); - translate(index + 1, delta.x + slidePos[index + 1], 0); - } - } - }, - - end: function (event) { - - // measure duration - var duration = +new Date() - start.time; - - // determine if slide attempt triggers next/prev slide - var isValidSlide = - Number(duration) < 250 && // if slide duration is less than 250ms - Math.abs(delta.x) > 20 || // and if slide amt is greater than 20px - Math.abs(delta.x) > width / 2; // or if slide amt is greater than half the width - - // determine if slide attempt is past start and end - var isPastBounds = - !index && delta.x > 0 || // if first slide and slide amt is greater than 0 - index === slides.length - 1 && delta.x < 0; // or if last slide and slide amt is less than 0 - - if (options.continuous) { - isPastBounds = false; - } - - // OLD determine direction of swipe (true:right, false:left) - // determine direction of swipe (1: backward, -1: forward) - var direction = Math.abs(delta.x) / delta.x; - - // if not scrolling vertically - if (!isScrolling) { - - if (isValidSlide && !isPastBounds) { - - // if we're moving right - if (direction < 0) { - - if (options.continuous) { // we need to get the next in this direction in place - - move(circle(index - 1), -width, 0); - move(circle(index + 2), width, 0); - - } else { - move(index - 1, -width, 0); - } - - move(index, slidePos[index] - width, speed); - move(circle(index + 1), slidePos[circle(index + 1)] - width, speed); - index = circle(index + 1); - - } else { - if (options.continuous) { // we need to get the next in this direction in place - - move(circle(index + 1), width, 0); - move(circle(index - 2), -width, 0); - - } else { - move(index + 1, width, 0); - } - - move(index, slidePos[index] + width, speed); - move(circle(index - 1), slidePos[circle(index - 1)] + width, speed); - index = circle(index - 1); - } - - runCallback(getPos(), slides[index], direction); - - } else { - - if (options.continuous) { - - move(circle(index - 1), -width, speed); - move(index, 0, speed); - move(circle(index + 1), width, speed); - - } else { - - move(index - 1, -width, speed); - move(index, 0, speed); - move(index + 1, width, speed); - } - } - } - - // kill touchmove and touchend event listeners until touchstart called again - if (isMouseEvent(event)) { - element.removeEventListener('mousemove', events, false); - element.removeEventListener('mouseup', events, false); - element.removeEventListener('mouseleave', events, false); - } else { - element.removeEventListener('touchmove', events, browser.passiveEvents ? { passive: false } : false); - element.removeEventListener('touchend', events, false); - } - runDragEnd(getPos(), slides[index]); - }, - - transitionEnd: function (event) { - var currentIndex = parseInt(event.target.getAttribute('data-index'), 10); - if (currentIndex === index) { - if (delay || options.autoRestart) restart(); - - runTransitionEnd(getPos(), slides[index]); - } - } - }; - - // trigger setup - setup(); - - // start auto slideshow if applicable - begin(); - - // Expose the Swipe API - return { - // initialize - setup: setup, - - // go to slide - slide: function (to, speed) { - stop(); - slide(to, speed); - }, - - // move to previous - prev: function () { - stop(); - prev(); - }, - - // move to next - next: function () { - stop(); - next(); - }, - - // Restart slideshow - restart: restart, - - // cancel slideshow - stop: stop, - - // return current index position - getPos: getPos, - - // disable slideshow - disable: disable, - - // enable slideshow - enable: enable, - - // return total number of slides - getNumSlides: function () { return length; }, - - // completely remove swipe - kill: kill - }; - - // remove all event listeners - function detachEvents() { - if (browser.addEventListener) { - // remove current event listeners - element.removeEventListener('touchstart', events, browser.passiveEvents ? { passive: true } : false); - element.removeEventListener('mousedown', events, false); - element.removeEventListener('webkitTransitionEnd', events, false); - element.removeEventListener('msTransitionEnd', events, false); - element.removeEventListener('oTransitionEnd', events, false); - element.removeEventListener('otransitionend', events, false); - element.removeEventListener('transitionend', events, false); - root.removeEventListener('resize', events, false); - } else { - root.onresize = null; - } - } - - // add event listeners - function attachEvents() { - if (browser.addEventListener) { - - // set touchstart event on element - if (browser.touch) { - element.addEventListener('touchstart', events, browser.passiveEvents ? { passive: true } : false); - } - - if (options.draggable) { - element.addEventListener('mousedown', events, false); - } - - if (browser.transitions) { - element.addEventListener('webkitTransitionEnd', events, false); - element.addEventListener('msTransitionEnd', events, false); - element.addEventListener('oTransitionEnd', events, false); - element.addEventListener('otransitionend', events, false); - element.addEventListener('transitionend', events, false); - } - - // set resize event on window - root.addEventListener('resize', events, false); - - } else { - root.onresize = throttledSetup; // to play nice with old IE - } - } - - // clone nodes when there is only two slides - function cloneNode(el) { - var clone = el.cloneNode(true); - element.appendChild(clone); - - // tag these slides as clones (to remove them on kill) - clone.setAttribute('data-cloned', true); - - // Remove id from element - clone.removeAttribute('id'); - } - - function setup(opts) { - // Overwrite options if necessary - if (opts != null) { - for (var prop in opts) { - options[prop] = opts[prop]; - } - } - - // cache slides - slides = element.children; - length = slides.length; - - // slides length correction, minus cloned slides - for (var i = 0; i < slides.length; i++) { - if (slides[i].getAttribute('data-cloned')) length--; - } - - // set continuous to false if only one slide - if (slides.length < 2) { - options.continuous = false; - } - - // special case if two slides - if (browser.transitions && options.continuous && slides.length < 3) { - cloneNode(slides[0]); - cloneNode(slides[1]); - - slides = element.children; - } - - // adjust style on rtl - if ('right' === slideDir) { - for (var j = 0; j < slides.length; j++) { - slides[j].style.float = 'right'; - } - } - - // create an array to store current positions of each slide - slidePos = new Array(slides.length); - - // determine width of each slide - width = container.getBoundingClientRect().width || container.offsetWidth; - - element.style.width = (slides.length * width * 2) + 'px'; - - // stack elements - var pos = slides.length; - while (pos--) { - var slide = slides[pos]; - - slide.style.width = width + 'px'; - slide.setAttribute('data-index', pos); - - if (browser.transitions) { - slide.style[slideDir] = (pos * -width) + 'px'; - move(pos, index > pos ? -width : (index < pos ? width : 0), 0); - } - } - - // reposition elements before and after index - if (options.continuous && browser.transitions) { - move(circle(index - 1), -width, 0); - move(circle(index + 1), width, 0); - } - - if (!browser.transitions) { - element.style[slideDir] = (index * -width) + 'px'; - } - - container.style.visibility = 'visible'; - - // reinitialize events - detachEvents(); - attachEvents(); - } - - function prev() { - if (disabled) return; - - if (options.continuous) { - slide(index - 1); - } else if (index) { - slide(index - 1); - } - } - - function next() { - if (disabled) return; - - if (options.continuous) { - slide(index + 1); - } else if (index < slides.length - 1) { - slide(index + 1); - } - } - - function runCallback(pos, index, dir) { - if (options.callback) { - options.callback(pos, index, dir); - } - } - - function runTransitionEnd(pos, index) { - if (options.transitionEnd) { - options.transitionEnd(pos, index); - } - } - - function runDragStart(pos, index) { - if (options.dragStart) { - options.dragStart(pos, index); - } - } - - function runDragEnd(pos, index) { - if (options.dragEnd) { - options.dragEnd(pos, index); - } - } - - function circle(index) { - - // a simple positive modulo using slides.length - return (slides.length + (index % slides.length)) % slides.length; - } - - function getPos() { - // Fix for the clone issue in the event of 2 slides - var currentIndex = index; - - if (currentIndex >= length) { - currentIndex = currentIndex - length; - } - - return currentIndex; - } - - function slide(to, slideSpeed) { - - // ensure to is of type 'number' - to = typeof to !== 'number' ? parseInt(to, 10) : to; - - // do nothing if already on requested slide - if (index === to) return; - - if (browser.transitions) { - - var direction = Math.abs(index - to) / (index - to); // 1: backward, -1: forward - - // get the actual position of the slide - if (options.continuous) { - var natural_direction = direction; - direction = -slidePos[circle(to)] / width; - - // if going forward but to < index, use to = slides.length + to - // if going backward but to > index, use to = -slides.length + to - if (direction !== natural_direction) { - to = -direction * slides.length + to; - } - - } - - var diff = Math.abs(index - to) - 1; - - // move all the slides between index and to in the right direction - while (diff--) { - move(circle((to > index ? to : index) - diff - 1), width * direction, 0); - } - - to = circle(to); - - move(index, width * direction, slideSpeed || speed); - move(to, 0, slideSpeed || speed); - - if (options.continuous) { // we need to get the next in place - move(circle(to - direction), -(width * direction), 0); - } - - } else { - - to = circle(to); - animate(index * -width, to * -width, slideSpeed || speed); - // no fallback for a circular continuous if the browser does not accept transitions - } - - index = to; - offloadFn(function () { - runCallback(getPos(), slides[index], direction); - }); - } - - function move(index, dist, speed) { - translate(index, dist, speed); - slidePos[index] = dist; - } - - function translate(index, dist, speed) { - - var slide = slides[index]; - var style = slide && slide.style; - - if (!style) return; - - style.webkitTransitionDuration = - style.MozTransitionDuration = - style.msTransitionDuration = - style.OTransitionDuration = - style.transitionDuration = speed + 'ms'; - - style.webkitTransform = - style.msTransform = - style.MozTransform = - style.OTransform = - style.transform = 'translateX(' + dist + 'px)'; - } - - function animate(from, to, speed) { - - // if not an animation, just reposition - if (!speed) { - element.style[slideDir] = to + 'px'; - return; - } - - var start = +new Date(); - - var timer = setInterval(function () { - var timeElap = +new Date() - start; - - if (timeElap > speed) { - - element.style[slideDir] = to + 'px'; - - if (delay || options.autoRestart) restart(); - - runTransitionEnd(getPos(), slides[index]); - - clearInterval(timer); - - return; - } - - element.style[slideDir] = (((to - from) * (Math.floor((timeElap / speed) * 100) / 100)) + from) + 'px'; - }, 4); - - } - - function begin() { - delay = options.auto || 0; - if (delay) interval = setTimeout(next, delay); - } - - function stop() { - delay = 0; - clearTimeout(interval); - } - - function restart() { - stop(); - begin(); - } - - function disable() { - stop(); - disabled = true; - } - - function enable() { - disabled = false; - restart(); - } - - function isMouseEvent(e) { - return /^mouse/.test(e.type); - } - - function kill() { - // cancel slideshow - stop(); - - // remove inline styles - container.style.visibility = ''; - - // reset element - element.style.width = ''; - element.style[slideDir] = ''; - - // reset slides - var pos = slides.length; - while (pos--) { - - if (browser.transitions) { - translate(pos, 0, 0); - } - - var slide = slides[pos]; - - // if the slide is tagged as clone, remove it - if (slide.getAttribute('data-cloned')) { - var _parent = slide.parentElement; - _parent.removeChild(slide); - } - - // remove styles - slide.style.width = ''; - slide.style[slideDir] = ''; - - slide.style.webkitTransitionDuration = - slide.style.MozTransitionDuration = - slide.style.msTransitionDuration = - slide.style.OTransitionDuration = - slide.style.transitionDuration = ''; - - slide.style.webkitTransform = - slide.style.msTransform = - slide.style.MozTransform = - slide.style.OTransform = ''; - - // remove custom attributes (?) - // slide.removeAttribute('data-index'); - } - - // remove all events - detachEvents(); - - // remove throttled function timeout - throttledSetup.cancel(); - } - } - - if (root.jQuery || root.Zepto) { - (function ($) { - $.fn.Swipe = function (params) { - return this.each(function () { - $(this).data('Swipe', new Swipe($(this)[0], params)); - }); - }; - })(root.jQuery || root.Zepto); - } - - return Swipe; -})); \ No newline at end of file +!function(t,e){"function"==typeof define&&define.amd?define([],function(){return t.Swipe=e(),t.Swipe}):"object"==typeof module&&module.exports?module.exports=e():t.Swipe=e()}(this,function(){var t,e="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this,n=e.document;function i(t,i){"use strict";var o,s,r={},a={},u=(i=i||{}).auto||0,c=!1,l=function(){},v=function(t){setTimeout(t||l,0)},d=function(t){return!!t&&("boolean"!=typeof t.cancelable||t.cancelable)},f={addEventListener:!!e.addEventListener,passiveEvents:function(){var t=!1;try{var n=Object.defineProperty({},"passive",{get:function(){t=!0}});e.addEventListener("testEvent",null,n),e.removeEventListener("testEvent",null,n)}catch(e){t=!1}return t}(),touch:"ontouchstart"in e||e.DocumentTouch&&n instanceof DocumentTouch,transitions:function(t){var e=["transitionProperty","WebkitTransition","MozTransition","OTransition","msTransition"];for(var n in e)if(void 0!==t.style[e[n]])return!0;return!1}(n.createElement("swipe"))};if(t){var h,m,p,E,y=t.children[0],b=parseInt(i.startSlide,10)||0,g=i.speed||300;i.continuous=void 0===i.continuous||i.continuous;var T,x,L=((T=t).currentStyle?x=T.currentStyle.direction:e.getComputedStyle&&(x=e.getComputedStyle(T,null).getPropertyValue("direction")),"rtl"===x?"right":"left");i.autoRestart=void 0!==i.autoRestart&&i.autoRestart;var w=function(t,e){e=e||100;var n=null;function i(){n&&clearTimeout(n)}function o(){var o=this,s=arguments;i(),n=setTimeout(function(){n=null,t.apply(o,s)},e)}return o.cancel=i,o}(S),D={handleEvent:function(t){if(!c){switch(t.type){case"mousedown":case"touchstart":this.start(t);break;case"mousemove":case"touchmove":this.move(t);break;case"mouseup":case"mouseleave":case"touchend":this.end(t);break;case"webkitTransitionEnd":case"msTransitionEnd":case"oTransitionEnd":case"otransitionend":case"transitionend":this.transitionEnd(t);break;case"resize":w()}i.stopPropagation&&t.stopPropagation()}},start:function(t){var e;W(t)?(e=t,t.preventDefault()):e=t.touches[0],r={x:e.pageX,y:e.pageY,time:+new Date},o=void 0,a={},W(t)?(y.addEventListener("mousemove",this,!1),y.addEventListener("mouseup",this,!1),y.addEventListener("mouseleave",this,!1)):(y.addEventListener("touchmove",this,!!f.passiveEvents&&{passive:!1}),y.addEventListener("touchend",this,!1)),function(t,e){i.dragStart&&i.dragStart(t,e)}(P(),h[b])},move:function(t){var e;if(W(t))e=t;else{if(t.touches.length>1||t.scale&&1!==t.scale)return;i.disableScroll&&d(t)&&t.preventDefault(),e=t.touches[0]}a={x:e.pageX-r.x,y:e.pageY-r.y},void 0===o&&(o=!!(o||Math.abs(a.x)0||b===h.length-1&&a.x<0?Math.abs(a.x)/p+1:1),I(b-1,a.x+m[b-1],0),I(b,a.x+m[b],0),I(b+1,a.x+m[b+1],0)))},end:function(t){var e=+new Date-r.time,n=Number(e)<250&&Math.abs(a.x)>20||Math.abs(a.x)>p/2,s=!b&&a.x>0||b===h.length-1&&a.x<0;i.continuous&&(s=!1);var u=Math.abs(a.x)/a.x;o||(n&&!s?(u<0?(i.continuous?(C(O(b-1),-p,0),C(O(b+2),p,0)):C(b-1,-p,0),C(b,m[b]-p,g),C(O(b+1),m[O(b+1)]-p,g),b=O(b+1)):(i.continuous?(C(O(b+1),p,0),C(O(b-2),-p,0)):C(b+1,p,0),C(b,m[b]+p,g),C(O(b-1),m[O(b-1)]+p,g),b=O(b-1)),A(P(),h[b],u)):i.continuous?(C(O(b-1),-p,g),C(b,0,g),C(O(b+1),p,g)):(C(b-1,-p,g),C(b,0,g),C(b+1,p,g))),W(t)?(y.removeEventListener("mousemove",D,!1),y.removeEventListener("mouseup",D,!1),y.removeEventListener("mouseleave",D,!1)):(y.removeEventListener("touchmove",D,!!f.passiveEvents&&{passive:!1}),y.removeEventListener("touchend",D,!1)),function(t,e){i.dragEnd&&i.dragEnd(t,e)}(P(),h[b])},transitionEnd:function(t){parseInt(t.target.getAttribute("data-index"),10)===b&&((u||i.autoRestart)&&Q(),j(P(),h[b]))}};return S(),N(),{setup:S,slide:function(t,e){X(),R(t,e)},prev:function(){X(),function(){if(c)return;i.continuous?R(b-1):b&&R(b-1)}()},next:function(){X(),z()},restart:Q,stop:X,getPos:P,disable:function(){X(),c=!0},enable:function(){c=!1,Q()},getNumSlides:function(){return E},kill:function(){X(),t.style.visibility="",y.style.width="",y.style[L]="";var e=h.length;for(;e--;){f.transitions&&I(e,0,0);var n=h[e];if(n.getAttribute("data-cloned")){var i=n.parentElement;i.removeChild(n)}n.style.width="",n.style[L]="",n.style.webkitTransitionDuration=n.style.MozTransitionDuration=n.style.msTransitionDuration=n.style.OTransitionDuration=n.style.transitionDuration="",n.style.webkitTransform=n.style.msTransform=n.style.MozTransform=n.style.OTransform=""}k(),w.cancel()}}}function k(){f.addEventListener?(y.removeEventListener("touchstart",D,!!f.passiveEvents&&{passive:!0}),y.removeEventListener("mousedown",D,!1),y.removeEventListener("webkitTransitionEnd",D,!1),y.removeEventListener("msTransitionEnd",D,!1),y.removeEventListener("oTransitionEnd",D,!1),y.removeEventListener("otransitionend",D,!1),y.removeEventListener("transitionend",D,!1),e.removeEventListener("resize",D,!1)):e.onresize=null}function M(t){var e=t.cloneNode(!0);y.appendChild(e),e.setAttribute("data-cloned",!0),e.removeAttribute("id")}function S(n){if(null!=n)for(var o in n)i[o]=n[o];h=y.children,E=h.length;for(var s=0;sa?-p:b=E&&(t-=E),t}function R(t,e){if(t="number"!=typeof t?parseInt(t,10):t,b!==t){if(f.transitions){var n=Math.abs(b-t)/(b-t);if(i.continuous){var o=n;(n=-m[O(t)]/p)!==o&&(t=-n*h.length+t)}for(var s=Math.abs(b-t)-1;s--;)C(O((t>b?t:b)-s-1),p*n,0);t=O(t),C(b,p*n,e||g),C(t,0,e||g),i.continuous&&C(O(t-n),-p*n,0)}else t=O(t),function(t,e,n){if(!n)return void(y.style[L]=e+"px");var o=+new Date,s=setInterval(function(){var r=+new Date-o;if(r>n)return y.style[L]=e+"px",(u||i.autoRestart)&&Q(),j(P(),h[b]),void clearInterval(s);y.style[L]=(e-t)*(Math.floor(r/n*100)/100)+t+"px"},4)}(b*-p,t*-p,e||g);b=t,v(function(){A(P(),h[b],n)})}}function C(t,e,n){I(t,e,n),m[t]=e}function I(t,e,n){var i=h[t],o=i&&i.style;o&&(o.webkitTransitionDuration=o.MozTransitionDuration=o.msTransitionDuration=o.OTransitionDuration=o.transitionDuration=n+"ms",o.webkitTransform=o.msTransform=o.MozTransform=o.OTransform=o.transform="translateX("+e+"px)")}function N(){(u=i.auto||0)&&(s=setTimeout(z,u))}function X(){u=0,clearTimeout(s)}function Q(){X(),N()}function W(t){return/^mouse/.test(t.type)}}return(e.jQuery||e.Zepto)&&((t=e.jQuery||e.Zepto).fn.Swipe=function(e){return this.each(function(){t(this).data("Swipe",new i(t(this)[0],e))})}),i}); \ No newline at end of file diff --git a/assets/sass/base/_helpers.scss b/assets/sass/base/_helpers.scss index 5fd6f69..010cec6 100644 --- a/assets/sass/base/_helpers.scss +++ b/assets/sass/base/_helpers.scss @@ -10,6 +10,11 @@ .hide { display: none; + &-mobile { + @media only screen and (max-width: 769px) { + display: none; + } + } } .grow { diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index b16a7d6..6728bda 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -21,6 +21,7 @@ minItemsToShowInTagCloud = 1 # Minimum items to show in tag cloud # header homeHeaderType = "text" # text, img, slide, typewriter +hideHomeHeaderWhenMobile = false # menu showMobileMenuTerms = ["tags", "categories", "series"] diff --git a/i18n/en.toml b/i18n/en.toml index 2d795a1..3842736 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -98,4 +98,19 @@ other = "Pinned" other = "This page looks best with JavaScript enabled" [posts-by-order] -other = "TOP POSTS" \ No newline at end of file +other = "TOP POSTS" + +[skin-dark] +other = "dark" + +[skin-light] +other = "light" + +[skin-hacker] +other = "hacker" + +[skin-solarized] +other = "solarized" + +[skin-kimbie] +other = "kimbie" \ No newline at end of file diff --git a/i18n/eo.toml b/i18n/eo.toml index 0a10785..ac80aae 100644 --- a/i18n/eo.toml +++ b/i18n/eo.toml @@ -99,3 +99,18 @@ other = "Por plibona vido the ĉi tiu paĝo, eble ŝaltu JavaSkripton" [posts-by-order] other = "PLEJ BONAJ AFIŜOJ" + +[skin-dark] +other = "dark" + +[skin-light] +other = "light" + +[skin-hacker] +other = "hacker" + +[skin-solarized] +other = "solarized" + +[skin-kimbie] +other = "kimbie" \ No newline at end of file diff --git a/i18n/fa.toml b/i18n/fa.toml index b75aceb..206bbcd 100644 --- a/i18n/fa.toml +++ b/i18n/fa.toml @@ -99,3 +99,18 @@ other = "لطفا برای نمایش محتوا اجرای جاوا اسکری [posts-by-order] other = "پست های پربازدید" + +[skin-dark] +other = "dark" + +[skin-light] +other = "light" + +[skin-hacker] +other = "hacker" + +[skin-solarized] +other = "solarized" + +[skin-kimbie] +other = "kimbie" \ No newline at end of file diff --git a/i18n/fr.toml b/i18n/fr.toml index cfd59b8..896d199 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -99,3 +99,18 @@ other = "Pour un rendu optimal, activez JavaScript" [posts-by-order] other = "MEILLEURES PUBLICATIONS" + +[skin-dark] +other = "dark" + +[skin-light] +other = "light" + +[skin-hacker] +other = "hacker" + +[skin-solarized] +other = "solarized" + +[skin-kimbie] +other = "kimbie" \ No newline at end of file diff --git a/i18n/ko.toml b/i18n/ko.toml index d1d2866..8d2941c 100644 --- a/i18n/ko.toml +++ b/i18n/ko.toml @@ -98,4 +98,19 @@ other = "고정" other = "자바스크립트를 활성화 해주세요" [posts-by-order] -other = "TOP POSTS" \ No newline at end of file +other = "TOP POSTS" + +[skin-dark] +other = "dark" + +[skin-light] +other = "light" + +[skin-hacker] +other = "hacker" + +[skin-solarized] +other = "solarized" + +[skin-kimbie] +other = "kimbie" \ No newline at end of file diff --git a/i18n/zh.toml b/i18n/zh.toml index 68e3656..b4c3ad3 100644 --- a/i18n/zh.toml +++ b/i18n/zh.toml @@ -98,4 +98,19 @@ other = "固定" other = "Please enable Javascript to view the contents" [posts-by-order] -other = "TOP POSTS" \ No newline at end of file +other = "TOP POSTS" + +[skin-dark] +other = "dark" + +[skin-light] +other = "light" + +[skin-hacker] +other = "hacker" + +[skin-solarized] +other = "solarized" + +[skin-kimbie] +other = "kimbie" \ No newline at end of file diff --git a/layouts/partials/head/scripts.html b/layouts/partials/head/scripts.html index 3b9556a..80ca22a 100644 --- a/layouts/partials/head/scripts.html +++ b/layouts/partials/head/scripts.html @@ -591,12 +591,15 @@ fuse = new Fuse(JSON.parse(xhr.response.toString('utf-8')), { keys: sectionType.includes('publication') ? ['title', 'abstract'] : ['title', 'description', 'content'], includeMatches: enableSearchHighlight, - shouldSort: true, - threshold: 0.4, - location: 0, - distance: 100, + shouldSort: true, // default: true + threshold: 0.4, // default: 0.6 (0.0 requires a perfect match) + location: 0, // default: 0 + distance: 100, // default: 100 maxPatternLength: 32, minMatchCharLength: 1, + isCaseSensitive: false, // defualt: false + findAllMatches: false, // default: false + useExtendedSearch: false, // default: false }); window.fuse = fuse; } diff --git a/layouts/partials/header/site-header.html b/layouts/partials/header/site-header.html index 67f352e..f42ff05 100644 --- a/layouts/partials/header/site-header.html +++ b/layouts/partials/header/site-header.html @@ -1,5 +1,5 @@ {{ if .IsHome }} -
+
{{ if and ($.Param "homeHeaderType") (eq ($.Param "homeHeaderType") "slide") }} {{ partial "header/header-slide" . }} {{ else if and ($.Param "homeHeaderType") (eq ($.Param "homeHeaderType") "img") }} diff --git a/layouts/partials/navbar/select-theme.html b/layouts/partials/navbar/select-theme.html index f41779d..472957c 100644 --- a/layouts/partials/navbar/select-theme.html +++ b/layouts/partials/navbar/select-theme.html @@ -8,7 +8,7 @@ {{ if .Site.Params.themeOptions }} {{ range $index, $value := .Site.Params.themeOptions }} - {{ . }} + {{ i18n (print "skin-" .) | default . }} {{ end }} {{ end }}