jekyll-theme-mdui 0.5.2.4 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +21 -21
- data/README.md +88 -89
- data/_includes/analytics/google.html +7 -7
- data/_includes/comment/comment.html +2 -2
- data/_includes/comment/disqus.html +72 -75
- data/_includes/comment/gitment.html +16 -16
- data/_includes/comment/livere.html +42 -26
- data/_includes/comment/valine.html +37 -18
- data/_includes/component/customCssJS.html +7 -7
- data/_includes/component/nprogress.html +24 -24
- data/_includes/component/sw.html +6 -6
- data/_includes/component/totop.html +13 -13
- data/_includes/content/category_list.html +86 -86
- data/_includes/content/category_post_list.html +108 -100
- data/_includes/content/component/highlight.html +11 -11
- data/_includes/content/component/imgboxed.html +304 -304
- data/_includes/content/component/lastupdate.html +35 -35
- data/_includes/content/component/lazyload.html +6 -6
- data/_includes/content/component/page_tags.html +17 -17
- data/_includes/content/component/qrcode.html +26 -26
- data/_includes/content/component/readtime.html +27 -27
- data/_includes/content/component/sns_share.html +42 -42
- data/_includes/content/component/toc.html +84 -84
- data/_includes/content/editor.html +1058 -1058
- data/_includes/content/friends.html +23 -23
- data/_includes/content/love.html +123 -0
- data/_includes/content/page_content.html +92 -87
- data/_includes/content/page_content_no_toc.html +69 -64
- data/_includes/content/paginator_button.html +24 -24
- data/_includes/content/paginator_post_list.html +103 -95
- data/_includes/content/tags_list.html +99 -99
- data/_includes/footer/footer.html +30 -30
- data/_includes/head.html +90 -87
- data/_includes/header/header.html +174 -174
- data/_includes/meng/aplayer.html +100 -100
- data/_includes/meng/background.html +34 -34
- data/_includes/meng/card.html +13 -13
- data/_includes/meng/console.html +10 -10
- data/_includes/meng/cplayer.html +61 -61
- data/_includes/meng/cursor.html +8 -8
- data/_includes/meng/head_card.html +67 -67
- data/_includes/meng/live2d.html +60 -60
- data/_includes/meng/title.html +23 -23
- data/_includes/submission/baidu.html +13 -13
- data/_layouts/category_content.html +3 -3
- data/_layouts/category_list.html +3 -3
- data/_layouts/compress.html +9 -9
- data/_layouts/default.html +49 -49
- data/_layouts/editor.html +4 -4
- data/_layouts/friends.html +3 -3
- data/_layouts/home.html +20 -20
- data/_layouts/love.html +4 -0
- data/_layouts/page.html +12 -12
- data/_layouts/post.html +12 -12
- data/_layouts/tags.html +4 -4
- data/assets/css/global.css +181 -181
- metadata +7 -6
@@ -1,12 +1,12 @@
|
|
1
|
-
<link href="//cdn.bootcss.com/prism/1.6.0/themes/{{site.data.site.prism.themes}}.min.css" rel="stylesheet">
|
2
|
-
<script>
|
3
|
-
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={manual:_self.Prism&&_self.Prism.manual,util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function(e){var t=n.util.type(e);switch(t){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=n.util.clone(e[r]));return a;case"Array":return e.map&&e.map(function(e){return n.util.clone(e)})}return e}},languages:{extend:function(e,t){var a=n.util.clone(n.languages[e]);for(var r in t)a[r]=t[r];return a},insertBefore:function(e,t,a,r){r=r||n.languages;var i=r[e];if(2==arguments.length){a=arguments[1];for(var l in a)a.hasOwnProperty(l)&&(i[l]=a[l]);return i}var o={};for(var s in i)if(i.hasOwnProperty(s)){if(s==t)for(var l in a)a.hasOwnProperty(l)&&(o[l]=a[l]);o[s]=i[s]}return n.languages.DFS(n.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=o)}),r[e]=o},DFS:function(e,t,a,r){r=r||{};for(var i in e)e.hasOwnProperty(i)&&(t.call(e,i,e[i],a||i),"Object"!==n.util.type(e[i])||r[n.util.objId(e[i])]?"Array"!==n.util.type(e[i])||r[n.util.objId(e[i])]||(r[n.util.objId(e[i])]=!0,n.languages.DFS(e[i],t,i,r)):(r[n.util.objId(e[i])]=!0,n.languages.DFS(e[i],t,null,r)))}},plugins:{},highlightAll:function(e,t){var a={callback:t,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};n.hooks.run("before-highlightall",a);for(var r,i=a.elements||document.querySelectorAll(a.selector),l=0;r=i[l++];)n.highlightElement(r,e===!0,a.callback)},highlightElement:function(t,a,r){for(var i,l,o=t;o&&!e.test(o.className);)o=o.parentNode;o&&(i=(o.className.match(e)||[,""])[1].toLowerCase(),l=n.languages[i]),t.className=t.className.replace(e,"").replace(/\s+/g," ")+" language-"+i,o=t.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+i);var s=t.textContent,u={element:t,language:i,grammar:l,code:s};if(n.hooks.run("before-sanity-check",u),!u.code||!u.grammar)return u.code&&(n.hooks.run("before-highlight",u),u.element.textContent=u.code,n.hooks.run("after-highlight",u)),n.hooks.run("complete",u),void 0;if(n.hooks.run("before-highlight",u),a&&_self.Worker){var g=new Worker(n.filename);g.onmessage=function(e){u.highlightedCode=e.data,n.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(u.element),n.hooks.run("after-highlight",u),n.hooks.run("complete",u)},g.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=n.highlight(u.code,u.grammar,u.language),n.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(t),n.hooks.run("after-highlight",u),n.hooks.run("complete",u)},highlight:function(e,t,r){var i=n.tokenize(e,t);return a.stringify(n.util.encode(i),r)},matchGrammar:function(e,t,a,r,i,l,o){var s=n.Token;for(var u in a)if(a.hasOwnProperty(u)&&a[u]){if(u==o)return;var g=a[u];g="Array"===n.util.type(g)?g:[g];for(var c=0;c<g.length;++c){var h=g[c],f=h.inside,d=!!h.lookbehind,m=!!h.greedy,p=0,y=h.alias;if(m&&!h.pattern.global){var v=h.pattern.toString().match(/[imuy]*$/)[0];h.pattern=RegExp(h.pattern.source,v+"g")}h=h.pattern||h;for(var b=r,k=i;b<t.length;k+=t[b].length,++b){var w=t[b];if(t.length>e.length)return;if(!(w instanceof s)){h.lastIndex=0;var _=h.exec(w),P=1;if(!_&&m&&b!=t.length-1){if(h.lastIndex=k,_=h.exec(e),!_)break;for(var A=_.index+(d?_[1].length:0),j=_.index+_[0].length,x=b,O=k,S=t.length;S>x&&(j>O||!t[x].type&&!t[x-1].greedy);++x)O+=t[x].length,A>=O&&(++b,k=O);if(t[b]instanceof s||t[x-1].greedy)continue;P=x-b,w=e.slice(k,O),_.index-=k}if(_){d&&(p=_[1].length);var A=_.index+p,_=_[0].slice(p),j=A+_.length,N=w.slice(0,A),C=w.slice(j),E=[b,P];N&&(++b,k+=N.length,E.push(N));var L=new s(u,f?n.tokenize(_,f):_,y,_,m);if(E.push(L),C&&E.push(C),Array.prototype.splice.apply(t,E),1!=P&&n.matchGrammar(e,t,a,b,k,!0,u),l)break}else if(l)break}}}}},tokenize:function(e,t){var a=[e],r=t.rest;if(r){for(var i in r)t[i]=r[i];delete t.rest}return n.matchGrammar(e,a,t,0,0,!1),a},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(t)}}},a=n.Token=function(e,t,n,a,r){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length,this.greedy=!!r};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var i={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}n.hooks.run("wrap",i);var o=Object.keys(i.attributes).map(function(e){return e+'="'+(i.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+(o?" "+o:"")+">"+i.content+"</"+i.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,i=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),i&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,!document.addEventListener||n.manual||r.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(n.highlightAll):window.setTimeout(n.highlightAll,16):document.addEventListener("DOMContentLoaded",n.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
|
4
|
-
Prism.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:/<!DOCTYPE[\s\S]+?>/i,cdata:/<!\[CDATA\[[\s\S]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\s\S])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\s\S]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
|
5
|
-
Prism.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:{pattern:/("|')(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag));
|
6
|
-
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:{pattern:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};
|
7
|
-
Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i,operator:/-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0}}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\\\|\\?[^\\])*?`/,greedy:!0,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript;
|
8
|
-
</script>
|
9
|
-
|
10
|
-
{%for l in site.data.site.prism.components%}
|
11
|
-
<script src="//cdn.bootcss.com/prism/1.6.0/components/prism-{{ l }}.min.js"></script>
|
1
|
+
<link href="//cdn.bootcss.com/prism/1.6.0/themes/{{site.data.site.prism.themes}}.min.css" rel="stylesheet">
|
2
|
+
<script>
|
3
|
+
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={manual:_self.Prism&&_self.Prism.manual,util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function(e){var t=n.util.type(e);switch(t){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=n.util.clone(e[r]));return a;case"Array":return e.map&&e.map(function(e){return n.util.clone(e)})}return e}},languages:{extend:function(e,t){var a=n.util.clone(n.languages[e]);for(var r in t)a[r]=t[r];return a},insertBefore:function(e,t,a,r){r=r||n.languages;var i=r[e];if(2==arguments.length){a=arguments[1];for(var l in a)a.hasOwnProperty(l)&&(i[l]=a[l]);return i}var o={};for(var s in i)if(i.hasOwnProperty(s)){if(s==t)for(var l in a)a.hasOwnProperty(l)&&(o[l]=a[l]);o[s]=i[s]}return n.languages.DFS(n.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=o)}),r[e]=o},DFS:function(e,t,a,r){r=r||{};for(var i in e)e.hasOwnProperty(i)&&(t.call(e,i,e[i],a||i),"Object"!==n.util.type(e[i])||r[n.util.objId(e[i])]?"Array"!==n.util.type(e[i])||r[n.util.objId(e[i])]||(r[n.util.objId(e[i])]=!0,n.languages.DFS(e[i],t,i,r)):(r[n.util.objId(e[i])]=!0,n.languages.DFS(e[i],t,null,r)))}},plugins:{},highlightAll:function(e,t){var a={callback:t,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};n.hooks.run("before-highlightall",a);for(var r,i=a.elements||document.querySelectorAll(a.selector),l=0;r=i[l++];)n.highlightElement(r,e===!0,a.callback)},highlightElement:function(t,a,r){for(var i,l,o=t;o&&!e.test(o.className);)o=o.parentNode;o&&(i=(o.className.match(e)||[,""])[1].toLowerCase(),l=n.languages[i]),t.className=t.className.replace(e,"").replace(/\s+/g," ")+" language-"+i,o=t.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+i);var s=t.textContent,u={element:t,language:i,grammar:l,code:s};if(n.hooks.run("before-sanity-check",u),!u.code||!u.grammar)return u.code&&(n.hooks.run("before-highlight",u),u.element.textContent=u.code,n.hooks.run("after-highlight",u)),n.hooks.run("complete",u),void 0;if(n.hooks.run("before-highlight",u),a&&_self.Worker){var g=new Worker(n.filename);g.onmessage=function(e){u.highlightedCode=e.data,n.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(u.element),n.hooks.run("after-highlight",u),n.hooks.run("complete",u)},g.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=n.highlight(u.code,u.grammar,u.language),n.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(t),n.hooks.run("after-highlight",u),n.hooks.run("complete",u)},highlight:function(e,t,r){var i=n.tokenize(e,t);return a.stringify(n.util.encode(i),r)},matchGrammar:function(e,t,a,r,i,l,o){var s=n.Token;for(var u in a)if(a.hasOwnProperty(u)&&a[u]){if(u==o)return;var g=a[u];g="Array"===n.util.type(g)?g:[g];for(var c=0;c<g.length;++c){var h=g[c],f=h.inside,d=!!h.lookbehind,m=!!h.greedy,p=0,y=h.alias;if(m&&!h.pattern.global){var v=h.pattern.toString().match(/[imuy]*$/)[0];h.pattern=RegExp(h.pattern.source,v+"g")}h=h.pattern||h;for(var b=r,k=i;b<t.length;k+=t[b].length,++b){var w=t[b];if(t.length>e.length)return;if(!(w instanceof s)){h.lastIndex=0;var _=h.exec(w),P=1;if(!_&&m&&b!=t.length-1){if(h.lastIndex=k,_=h.exec(e),!_)break;for(var A=_.index+(d?_[1].length:0),j=_.index+_[0].length,x=b,O=k,S=t.length;S>x&&(j>O||!t[x].type&&!t[x-1].greedy);++x)O+=t[x].length,A>=O&&(++b,k=O);if(t[b]instanceof s||t[x-1].greedy)continue;P=x-b,w=e.slice(k,O),_.index-=k}if(_){d&&(p=_[1].length);var A=_.index+p,_=_[0].slice(p),j=A+_.length,N=w.slice(0,A),C=w.slice(j),E=[b,P];N&&(++b,k+=N.length,E.push(N));var L=new s(u,f?n.tokenize(_,f):_,y,_,m);if(E.push(L),C&&E.push(C),Array.prototype.splice.apply(t,E),1!=P&&n.matchGrammar(e,t,a,b,k,!0,u),l)break}else if(l)break}}}}},tokenize:function(e,t){var a=[e],r=t.rest;if(r){for(var i in r)t[i]=r[i];delete t.rest}return n.matchGrammar(e,a,t,0,0,!1),a},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(t)}}},a=n.Token=function(e,t,n,a,r){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length,this.greedy=!!r};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var i={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}n.hooks.run("wrap",i);var o=Object.keys(i.attributes).map(function(e){return e+'="'+(i.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+(o?" "+o:"")+">"+i.content+"</"+i.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,i=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),i&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,!document.addEventListener||n.manual||r.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(n.highlightAll):window.setTimeout(n.highlightAll,16):document.addEventListener("DOMContentLoaded",n.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
|
4
|
+
Prism.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:/<!DOCTYPE[\s\S]+?>/i,cdata:/<!\[CDATA\[[\s\S]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\s\S])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\s\S]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
|
5
|
+
Prism.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:{pattern:/("|')(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag));
|
6
|
+
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:{pattern:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};
|
7
|
+
Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i,operator:/-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0}}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\\\|\\?[^\\])*?`/,greedy:!0,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript;
|
8
|
+
</script>
|
9
|
+
|
10
|
+
{%for l in site.data.site.prism.components%}
|
11
|
+
<script src="//cdn.bootcss.com/prism/1.6.0/components/prism-{{ l }}.min.js"></script>
|
12
12
|
{% endfor %}
|
@@ -1,305 +1,305 @@
|
|
1
|
-
<style>
|
2
|
-
img[data-action="zoom"] {
|
3
|
-
cursor: pointer;
|
4
|
-
cursor: -webkit-zoom-in;
|
5
|
-
cursor: -moz-zoom-in;
|
6
|
-
}
|
7
|
-
.zoom-img,
|
8
|
-
.zoom-img-wrap {
|
9
|
-
position: relative;
|
10
|
-
z-index: 1001;
|
11
|
-
-webkit-transition: all 300ms;
|
12
|
-
-o-transition: all 300ms;
|
13
|
-
transition: all 300ms;
|
14
|
-
}
|
15
|
-
img.zoom-img {
|
16
|
-
cursor: pointer;
|
17
|
-
cursor: -webkit-zoom-out;
|
18
|
-
cursor: -moz-zoom-out;
|
19
|
-
}
|
20
|
-
.zoom-overlay {
|
21
|
-
z-index: 1000;
|
22
|
-
background: #292929;
|
23
|
-
position: fixed;
|
24
|
-
top: 0;
|
25
|
-
left: 0;
|
26
|
-
right: 0;
|
27
|
-
bottom: 0;
|
28
|
-
pointer-events: none;
|
29
|
-
filter: "alpha(opacity=0)";
|
30
|
-
opacity: 0;
|
31
|
-
-webkit-transition: opacity 300ms;
|
32
|
-
-o-transition: opacity 300ms;
|
33
|
-
transition: opacity 300ms;
|
34
|
-
}
|
35
|
-
.zoom-overlay-open .zoom-overlay {
|
36
|
-
filter: "alpha(opacity=100)";
|
37
|
-
opacity: 1;
|
38
|
-
}
|
39
|
-
|
40
|
-
</style>
|
41
|
-
|
42
|
-
<script>
|
43
|
-
$(function(){
|
44
|
-
$('.mdui-typo img').attr('data-action','zoom');
|
45
|
-
})
|
46
|
-
+function ($) {
|
47
|
-
'use strict';
|
48
|
-
function transitionEnd() {
|
49
|
-
var el = document.createElement('bootstrap');
|
50
|
-
|
51
|
-
var transEndEventNames = {
|
52
|
-
WebkitTransition : 'webkitTransitionEnd',
|
53
|
-
MozTransition : 'transitionend',
|
54
|
-
OTransition : 'oTransitionEnd otransitionend',
|
55
|
-
transition : 'transitionend'
|
56
|
-
};
|
57
|
-
|
58
|
-
for (var name in transEndEventNames) {
|
59
|
-
if (el.style[name] !== undefined) {
|
60
|
-
return { end: transEndEventNames[name] }
|
61
|
-
}
|
62
|
-
};
|
63
|
-
|
64
|
-
return false
|
65
|
-
}
|
66
|
-
|
67
|
-
$.fn.emulateTransitionEnd = function (duration) {
|
68
|
-
var called = false;
|
69
|
-
var $el = this;
|
70
|
-
$(this).one('bsTransitionEnd', function () { called = true });
|
71
|
-
var callback = function () { if (!called) $($el).trigger($.support.transition.end) };
|
72
|
-
setTimeout(callback, duration);
|
73
|
-
return this
|
74
|
-
};
|
75
|
-
|
76
|
-
$(function () {
|
77
|
-
$.support.transition = transitionEnd();
|
78
|
-
|
79
|
-
if (!$.support.transition) return;
|
80
|
-
|
81
|
-
$.event.special.bsTransitionEnd = {
|
82
|
-
bindType: $.support.transition.end,
|
83
|
-
delegateType: $.support.transition.end,
|
84
|
-
handle: function (e) {
|
85
|
-
if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments);
|
86
|
-
}
|
87
|
-
}
|
88
|
-
});
|
89
|
-
}(jQuery);
|
90
|
-
|
91
|
-
+function ($) { "use strict";
|
92
|
-
|
93
|
-
function ZoomService () {
|
94
|
-
this._activeZoom =
|
95
|
-
this._initialScrollPosition =
|
96
|
-
this._initialTouchPosition =
|
97
|
-
this._touchMoveListener = null;
|
98
|
-
|
99
|
-
this._$document = $(document);
|
100
|
-
this._$window = $(window);
|
101
|
-
this._$body = $(document.body);
|
102
|
-
}
|
103
|
-
|
104
|
-
ZoomService.prototype.listen = function () {
|
105
|
-
if (!imgzoom){
|
106
|
-
this._$body.on('click', '[data-action="zoom"]', $.proxy(this._zoom, this))
|
107
|
-
}
|
108
|
-
imgzoom = true;
|
109
|
-
};
|
110
|
-
|
111
|
-
ZoomService.prototype._zoom = function (e) {
|
112
|
-
var target = e.target;
|
113
|
-
|
114
|
-
if (!target || target.tagName != 'IMG') return;
|
115
|
-
|
116
|
-
if (e.metaKey) return window.open(e.target.src, '_blank');
|
117
|
-
|
118
|
-
if (target.width >= (window.innerWidth - Zoom.OFFSET)) return;
|
119
|
-
|
120
|
-
this._activeZoomClose(true);
|
121
|
-
|
122
|
-
this._activeZoom = new Zoom(target);
|
123
|
-
this._activeZoom.zoomImage();
|
124
|
-
|
125
|
-
this._$window.on('scroll.zoom', $.proxy(this._scrollHandler, this));
|
126
|
-
|
127
|
-
this._$document.on('click.zoom', $.proxy(this._clickHandler, this));
|
128
|
-
this._$document.on('keyup.zoom', $.proxy(this._keyHandler, this));
|
129
|
-
this._$document.on('touchstart.zoom', $.proxy(this._touchStart, this));
|
130
|
-
|
131
|
-
e.stopPropagation();
|
132
|
-
};
|
133
|
-
|
134
|
-
ZoomService.prototype._activeZoomClose = function (forceDispose) {
|
135
|
-
if (!this._activeZoom) return;
|
136
|
-
|
137
|
-
if (forceDispose) {
|
138
|
-
this._activeZoom.dispose();
|
139
|
-
} else {
|
140
|
-
this._activeZoom.close();
|
141
|
-
}
|
142
|
-
|
143
|
-
this._$window.off('.zoom');
|
144
|
-
this._$document.off('.zoom');
|
145
|
-
|
146
|
-
this._activeZoom = null;
|
147
|
-
};
|
148
|
-
|
149
|
-
ZoomService.prototype._scrollHandler = function (e) {
|
150
|
-
if (this._initialScrollPosition === null) this._initialScrollPosition = window.scrollY;
|
151
|
-
var deltaY = this._initialScrollPosition - window.scrollY;
|
152
|
-
if (Math.abs(deltaY) >= 40) this._activeZoomClose();
|
153
|
-
};
|
154
|
-
|
155
|
-
ZoomService.prototype._keyHandler = function (e) {
|
156
|
-
if (e.keyCode == 27) this._activeZoomClose();
|
157
|
-
};
|
158
|
-
|
159
|
-
ZoomService.prototype._clickHandler = function (e) {
|
160
|
-
e.stopPropagation();
|
161
|
-
e.preventDefault();
|
162
|
-
this._activeZoomClose();
|
163
|
-
};
|
164
|
-
|
165
|
-
ZoomService.prototype._touchStart = function (e) {
|
166
|
-
this._initialTouchPosition = e.touches[0].pageY;
|
167
|
-
$(e.target).on('touchmove.zoom', $.proxy(this._touchMove, this));
|
168
|
-
};
|
169
|
-
|
170
|
-
ZoomService.prototype._touchMove = function (e) {
|
171
|
-
if (Math.abs(e.touches[0].pageY - this._initialTouchPosition) > 10) {
|
172
|
-
this._activeZoomClose();
|
173
|
-
$(e.target).off('touchmove.zoom');
|
174
|
-
}
|
175
|
-
};
|
176
|
-
|
177
|
-
|
178
|
-
function Zoom (img) {
|
179
|
-
this._fullHeight =
|
180
|
-
this._fullWidth =
|
181
|
-
this._overlay =
|
182
|
-
this._targetImageWrap = null;
|
183
|
-
|
184
|
-
this._targetImage = img;
|
185
|
-
|
186
|
-
this._$body = $(document.body);
|
187
|
-
}
|
188
|
-
|
189
|
-
Zoom.OFFSET = 80;
|
190
|
-
Zoom._MAX_WIDTH = 2560;
|
191
|
-
Zoom._MAX_HEIGHT = 4096;
|
192
|
-
|
193
|
-
Zoom.prototype.zoomImage = function () {
|
194
|
-
var img = document.createElement('img');
|
195
|
-
img.onload = $.proxy(function () {
|
196
|
-
this._fullHeight = Number(img.height);
|
197
|
-
this._fullWidth = Number(img.width);
|
198
|
-
this._zoomOriginal();
|
199
|
-
}, this);
|
200
|
-
img.src = this._targetImage.src;
|
201
|
-
};
|
202
|
-
|
203
|
-
Zoom.prototype._zoomOriginal = function () {
|
204
|
-
this._targetImageWrap = document.createElement('div');
|
205
|
-
this._targetImageWrap.className = 'zoom-img-wrap';
|
206
|
-
|
207
|
-
this._targetImage.parentNode.insertBefore(this._targetImageWrap, this._targetImage);
|
208
|
-
this._targetImageWrap.appendChild(this._targetImage);
|
209
|
-
|
210
|
-
$(this._targetImage)
|
211
|
-
.addClass('zoom-img')
|
212
|
-
.attr('data-action', 'zoom-out');
|
213
|
-
|
214
|
-
$('.k-postcontent').css('overflow','visible');
|
215
|
-
|
216
|
-
this._overlay = document.createElement('div');
|
217
|
-
this._overlay.className = 'zoom-overlay';
|
218
|
-
|
219
|
-
document.body.appendChild(this._overlay);
|
220
|
-
|
221
|
-
this._calculateZoom();
|
222
|
-
this._triggerAnimation();
|
223
|
-
};
|
224
|
-
|
225
|
-
Zoom.prototype._calculateZoom = function () {
|
226
|
-
this._targetImage.offsetWidth ;
|
227
|
-
|
228
|
-
var originalFullImageWidth = this._fullWidth;
|
229
|
-
var originalFullImageHeight = this._fullHeight;
|
230
|
-
|
231
|
-
var scrollTop = window.scrollY;
|
232
|
-
|
233
|
-
var maxScaleFactor = originalFullImageWidth / this._targetImage.width;
|
234
|
-
|
235
|
-
var viewportHeight = (window.innerHeight - Zoom.OFFSET);
|
236
|
-
var viewportWidth = (window.innerWidth - Zoom.OFFSET);
|
237
|
-
|
238
|
-
var imageAspectRatio = originalFullImageWidth / originalFullImageHeight;
|
239
|
-
var viewportAspectRatio = viewportWidth / viewportHeight;
|
240
|
-
|
241
|
-
if (originalFullImageWidth < viewportWidth && originalFullImageHeight < viewportHeight) {
|
242
|
-
this._imgScaleFactor = maxScaleFactor;
|
243
|
-
|
244
|
-
} else if (imageAspectRatio < viewportAspectRatio) {
|
245
|
-
this._imgScaleFactor = (viewportHeight / originalFullImageHeight) * maxScaleFactor;
|
246
|
-
|
247
|
-
} else {
|
248
|
-
this._imgScaleFactor = (viewportWidth / originalFullImageWidth) * maxScaleFactor;
|
249
|
-
}
|
250
|
-
};
|
251
|
-
|
252
|
-
Zoom.prototype._triggerAnimation = function () {
|
253
|
-
this._targetImage.offsetWidth ;
|
254
|
-
|
255
|
-
var imageOffset = $(this._targetImage).offset();
|
256
|
-
var scrollTop = window.scrollY;
|
257
|
-
|
258
|
-
var viewportY = scrollTop + (window.innerHeight / 2);
|
259
|
-
var viewportX = (window.innerWidth / 2);
|
260
|
-
|
261
|
-
var imageCenterY = imageOffset.top + (this._targetImage.height / 2);
|
262
|
-
var imageCenterX = imageOffset.left + (this._targetImage.width / 2);
|
263
|
-
|
264
|
-
this._translateY = viewportY - imageCenterY;
|
265
|
-
this._translateX = viewportX - imageCenterX;
|
266
|
-
|
267
|
-
$(this._targetImage).css('transform', 'scale(' + this._imgScaleFactor + ')');
|
268
|
-
$(this._targetImageWrap).css('transform', 'translate(' + this._translateX + 'px, ' + this._translateY + 'px) translateZ(0)');
|
269
|
-
|
270
|
-
this._$body.addClass('zoom-overlay-open');
|
271
|
-
};
|
272
|
-
|
273
|
-
Zoom.prototype.close = function () {
|
274
|
-
this._$body
|
275
|
-
.removeClass('zoom-overlay-open')
|
276
|
-
.addClass('zoom-overlay-transitioning');
|
277
|
-
|
278
|
-
$(this._targetImage).css('transform', '');
|
279
|
-
$(this._targetImageWrap).css('transform', '');
|
280
|
-
|
281
|
-
$(this._targetImage)
|
282
|
-
.one($.support.transition.end, $.proxy(this.dispose, this))
|
283
|
-
.emulateTransitionEnd(300);
|
284
|
-
};
|
285
|
-
|
286
|
-
Zoom.prototype.dispose = function () {
|
287
|
-
if (this._targetImageWrap && this._targetImageWrap.parentNode) {
|
288
|
-
$(this._targetImage)
|
289
|
-
.removeClass('zoom-img')
|
290
|
-
.attr('data-action', 'zoom');
|
291
|
-
|
292
|
-
$('.k-postcontent').css('overflow','hidden');
|
293
|
-
|
294
|
-
this._targetImageWrap.parentNode.replaceChild(this._targetImage, this._targetImageWrap);
|
295
|
-
this._overlay.parentNode.removeChild(this._overlay);
|
296
|
-
|
297
|
-
this._$body.removeClass('zoom-overlay-transitioning');
|
298
|
-
}
|
299
|
-
};
|
300
|
-
|
301
|
-
new ZoomService().listen();
|
302
|
-
|
303
|
-
}(jQuery);
|
304
|
-
|
1
|
+
<style>
|
2
|
+
img[data-action="zoom"] {
|
3
|
+
cursor: pointer;
|
4
|
+
cursor: -webkit-zoom-in;
|
5
|
+
cursor: -moz-zoom-in;
|
6
|
+
}
|
7
|
+
.zoom-img,
|
8
|
+
.zoom-img-wrap {
|
9
|
+
position: relative;
|
10
|
+
z-index: 1001;
|
11
|
+
-webkit-transition: all 300ms;
|
12
|
+
-o-transition: all 300ms;
|
13
|
+
transition: all 300ms;
|
14
|
+
}
|
15
|
+
img.zoom-img {
|
16
|
+
cursor: pointer;
|
17
|
+
cursor: -webkit-zoom-out;
|
18
|
+
cursor: -moz-zoom-out;
|
19
|
+
}
|
20
|
+
.zoom-overlay {
|
21
|
+
z-index: 1000;
|
22
|
+
background: #292929;
|
23
|
+
position: fixed;
|
24
|
+
top: 0;
|
25
|
+
left: 0;
|
26
|
+
right: 0;
|
27
|
+
bottom: 0;
|
28
|
+
pointer-events: none;
|
29
|
+
filter: "alpha(opacity=0)";
|
30
|
+
opacity: 0;
|
31
|
+
-webkit-transition: opacity 300ms;
|
32
|
+
-o-transition: opacity 300ms;
|
33
|
+
transition: opacity 300ms;
|
34
|
+
}
|
35
|
+
.zoom-overlay-open .zoom-overlay {
|
36
|
+
filter: "alpha(opacity=100)";
|
37
|
+
opacity: 1;
|
38
|
+
}
|
39
|
+
|
40
|
+
</style>
|
41
|
+
|
42
|
+
<script>
|
43
|
+
$(function(){
|
44
|
+
$('.mdui-typo img').attr('data-action','zoom');
|
45
|
+
})
|
46
|
+
+function ($) {
|
47
|
+
'use strict';
|
48
|
+
function transitionEnd() {
|
49
|
+
var el = document.createElement('bootstrap');
|
50
|
+
|
51
|
+
var transEndEventNames = {
|
52
|
+
WebkitTransition : 'webkitTransitionEnd',
|
53
|
+
MozTransition : 'transitionend',
|
54
|
+
OTransition : 'oTransitionEnd otransitionend',
|
55
|
+
transition : 'transitionend'
|
56
|
+
};
|
57
|
+
|
58
|
+
for (var name in transEndEventNames) {
|
59
|
+
if (el.style[name] !== undefined) {
|
60
|
+
return { end: transEndEventNames[name] }
|
61
|
+
}
|
62
|
+
};
|
63
|
+
|
64
|
+
return false
|
65
|
+
}
|
66
|
+
|
67
|
+
$.fn.emulateTransitionEnd = function (duration) {
|
68
|
+
var called = false;
|
69
|
+
var $el = this;
|
70
|
+
$(this).one('bsTransitionEnd', function () { called = true });
|
71
|
+
var callback = function () { if (!called) $($el).trigger($.support.transition.end) };
|
72
|
+
setTimeout(callback, duration);
|
73
|
+
return this
|
74
|
+
};
|
75
|
+
|
76
|
+
$(function () {
|
77
|
+
$.support.transition = transitionEnd();
|
78
|
+
|
79
|
+
if (!$.support.transition) return;
|
80
|
+
|
81
|
+
$.event.special.bsTransitionEnd = {
|
82
|
+
bindType: $.support.transition.end,
|
83
|
+
delegateType: $.support.transition.end,
|
84
|
+
handle: function (e) {
|
85
|
+
if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
});
|
89
|
+
}(jQuery);
|
90
|
+
|
91
|
+
+function ($) { "use strict";
|
92
|
+
|
93
|
+
function ZoomService () {
|
94
|
+
this._activeZoom =
|
95
|
+
this._initialScrollPosition =
|
96
|
+
this._initialTouchPosition =
|
97
|
+
this._touchMoveListener = null;
|
98
|
+
|
99
|
+
this._$document = $(document);
|
100
|
+
this._$window = $(window);
|
101
|
+
this._$body = $(document.body);
|
102
|
+
}
|
103
|
+
|
104
|
+
ZoomService.prototype.listen = function () {
|
105
|
+
if (!imgzoom){
|
106
|
+
this._$body.on('click', '[data-action="zoom"]', $.proxy(this._zoom, this))
|
107
|
+
}
|
108
|
+
imgzoom = true;
|
109
|
+
};
|
110
|
+
|
111
|
+
ZoomService.prototype._zoom = function (e) {
|
112
|
+
var target = e.target;
|
113
|
+
|
114
|
+
if (!target || target.tagName != 'IMG') return;
|
115
|
+
|
116
|
+
if (e.metaKey) return window.open(e.target.src, '_blank');
|
117
|
+
|
118
|
+
if (target.width >= (window.innerWidth - Zoom.OFFSET)) return;
|
119
|
+
|
120
|
+
this._activeZoomClose(true);
|
121
|
+
|
122
|
+
this._activeZoom = new Zoom(target);
|
123
|
+
this._activeZoom.zoomImage();
|
124
|
+
|
125
|
+
this._$window.on('scroll.zoom', $.proxy(this._scrollHandler, this));
|
126
|
+
|
127
|
+
this._$document.on('click.zoom', $.proxy(this._clickHandler, this));
|
128
|
+
this._$document.on('keyup.zoom', $.proxy(this._keyHandler, this));
|
129
|
+
this._$document.on('touchstart.zoom', $.proxy(this._touchStart, this));
|
130
|
+
|
131
|
+
e.stopPropagation();
|
132
|
+
};
|
133
|
+
|
134
|
+
ZoomService.prototype._activeZoomClose = function (forceDispose) {
|
135
|
+
if (!this._activeZoom) return;
|
136
|
+
|
137
|
+
if (forceDispose) {
|
138
|
+
this._activeZoom.dispose();
|
139
|
+
} else {
|
140
|
+
this._activeZoom.close();
|
141
|
+
}
|
142
|
+
|
143
|
+
this._$window.off('.zoom');
|
144
|
+
this._$document.off('.zoom');
|
145
|
+
|
146
|
+
this._activeZoom = null;
|
147
|
+
};
|
148
|
+
|
149
|
+
ZoomService.prototype._scrollHandler = function (e) {
|
150
|
+
if (this._initialScrollPosition === null) this._initialScrollPosition = window.scrollY;
|
151
|
+
var deltaY = this._initialScrollPosition - window.scrollY;
|
152
|
+
if (Math.abs(deltaY) >= 40) this._activeZoomClose();
|
153
|
+
};
|
154
|
+
|
155
|
+
ZoomService.prototype._keyHandler = function (e) {
|
156
|
+
if (e.keyCode == 27) this._activeZoomClose();
|
157
|
+
};
|
158
|
+
|
159
|
+
ZoomService.prototype._clickHandler = function (e) {
|
160
|
+
e.stopPropagation();
|
161
|
+
e.preventDefault();
|
162
|
+
this._activeZoomClose();
|
163
|
+
};
|
164
|
+
|
165
|
+
ZoomService.prototype._touchStart = function (e) {
|
166
|
+
this._initialTouchPosition = e.touches[0].pageY;
|
167
|
+
$(e.target).on('touchmove.zoom', $.proxy(this._touchMove, this));
|
168
|
+
};
|
169
|
+
|
170
|
+
ZoomService.prototype._touchMove = function (e) {
|
171
|
+
if (Math.abs(e.touches[0].pageY - this._initialTouchPosition) > 10) {
|
172
|
+
this._activeZoomClose();
|
173
|
+
$(e.target).off('touchmove.zoom');
|
174
|
+
}
|
175
|
+
};
|
176
|
+
|
177
|
+
|
178
|
+
function Zoom (img) {
|
179
|
+
this._fullHeight =
|
180
|
+
this._fullWidth =
|
181
|
+
this._overlay =
|
182
|
+
this._targetImageWrap = null;
|
183
|
+
|
184
|
+
this._targetImage = img;
|
185
|
+
|
186
|
+
this._$body = $(document.body);
|
187
|
+
}
|
188
|
+
|
189
|
+
Zoom.OFFSET = 80;
|
190
|
+
Zoom._MAX_WIDTH = 2560;
|
191
|
+
Zoom._MAX_HEIGHT = 4096;
|
192
|
+
|
193
|
+
Zoom.prototype.zoomImage = function () {
|
194
|
+
var img = document.createElement('img');
|
195
|
+
img.onload = $.proxy(function () {
|
196
|
+
this._fullHeight = Number(img.height);
|
197
|
+
this._fullWidth = Number(img.width);
|
198
|
+
this._zoomOriginal();
|
199
|
+
}, this);
|
200
|
+
img.src = this._targetImage.src;
|
201
|
+
};
|
202
|
+
|
203
|
+
Zoom.prototype._zoomOriginal = function () {
|
204
|
+
this._targetImageWrap = document.createElement('div');
|
205
|
+
this._targetImageWrap.className = 'zoom-img-wrap';
|
206
|
+
|
207
|
+
this._targetImage.parentNode.insertBefore(this._targetImageWrap, this._targetImage);
|
208
|
+
this._targetImageWrap.appendChild(this._targetImage);
|
209
|
+
|
210
|
+
$(this._targetImage)
|
211
|
+
.addClass('zoom-img')
|
212
|
+
.attr('data-action', 'zoom-out');
|
213
|
+
|
214
|
+
$('.k-postcontent').css('overflow','visible');
|
215
|
+
|
216
|
+
this._overlay = document.createElement('div');
|
217
|
+
this._overlay.className = 'zoom-overlay';
|
218
|
+
|
219
|
+
document.body.appendChild(this._overlay);
|
220
|
+
|
221
|
+
this._calculateZoom();
|
222
|
+
this._triggerAnimation();
|
223
|
+
};
|
224
|
+
|
225
|
+
Zoom.prototype._calculateZoom = function () {
|
226
|
+
this._targetImage.offsetWidth ;
|
227
|
+
|
228
|
+
var originalFullImageWidth = this._fullWidth;
|
229
|
+
var originalFullImageHeight = this._fullHeight;
|
230
|
+
|
231
|
+
var scrollTop = window.scrollY;
|
232
|
+
|
233
|
+
var maxScaleFactor = originalFullImageWidth / this._targetImage.width;
|
234
|
+
|
235
|
+
var viewportHeight = (window.innerHeight - Zoom.OFFSET);
|
236
|
+
var viewportWidth = (window.innerWidth - Zoom.OFFSET);
|
237
|
+
|
238
|
+
var imageAspectRatio = originalFullImageWidth / originalFullImageHeight;
|
239
|
+
var viewportAspectRatio = viewportWidth / viewportHeight;
|
240
|
+
|
241
|
+
if (originalFullImageWidth < viewportWidth && originalFullImageHeight < viewportHeight) {
|
242
|
+
this._imgScaleFactor = maxScaleFactor;
|
243
|
+
|
244
|
+
} else if (imageAspectRatio < viewportAspectRatio) {
|
245
|
+
this._imgScaleFactor = (viewportHeight / originalFullImageHeight) * maxScaleFactor;
|
246
|
+
|
247
|
+
} else {
|
248
|
+
this._imgScaleFactor = (viewportWidth / originalFullImageWidth) * maxScaleFactor;
|
249
|
+
}
|
250
|
+
};
|
251
|
+
|
252
|
+
Zoom.prototype._triggerAnimation = function () {
|
253
|
+
this._targetImage.offsetWidth ;
|
254
|
+
|
255
|
+
var imageOffset = $(this._targetImage).offset();
|
256
|
+
var scrollTop = window.scrollY;
|
257
|
+
|
258
|
+
var viewportY = scrollTop + (window.innerHeight / 2);
|
259
|
+
var viewportX = (window.innerWidth / 2);
|
260
|
+
|
261
|
+
var imageCenterY = imageOffset.top + (this._targetImage.height / 2);
|
262
|
+
var imageCenterX = imageOffset.left + (this._targetImage.width / 2);
|
263
|
+
|
264
|
+
this._translateY = viewportY - imageCenterY;
|
265
|
+
this._translateX = viewportX - imageCenterX;
|
266
|
+
|
267
|
+
$(this._targetImage).css('transform', 'scale(' + this._imgScaleFactor + ')');
|
268
|
+
$(this._targetImageWrap).css('transform', 'translate(' + this._translateX + 'px, ' + this._translateY + 'px) translateZ(0)');
|
269
|
+
|
270
|
+
this._$body.addClass('zoom-overlay-open');
|
271
|
+
};
|
272
|
+
|
273
|
+
Zoom.prototype.close = function () {
|
274
|
+
this._$body
|
275
|
+
.removeClass('zoom-overlay-open')
|
276
|
+
.addClass('zoom-overlay-transitioning');
|
277
|
+
|
278
|
+
$(this._targetImage).css('transform', '');
|
279
|
+
$(this._targetImageWrap).css('transform', '');
|
280
|
+
|
281
|
+
$(this._targetImage)
|
282
|
+
.one($.support.transition.end, $.proxy(this.dispose, this))
|
283
|
+
.emulateTransitionEnd(300);
|
284
|
+
};
|
285
|
+
|
286
|
+
Zoom.prototype.dispose = function () {
|
287
|
+
if (this._targetImageWrap && this._targetImageWrap.parentNode) {
|
288
|
+
$(this._targetImage)
|
289
|
+
.removeClass('zoom-img')
|
290
|
+
.attr('data-action', 'zoom');
|
291
|
+
|
292
|
+
$('.k-postcontent').css('overflow','hidden');
|
293
|
+
|
294
|
+
this._targetImageWrap.parentNode.replaceChild(this._targetImage, this._targetImageWrap);
|
295
|
+
this._overlay.parentNode.removeChild(this._overlay);
|
296
|
+
|
297
|
+
this._$body.removeClass('zoom-overlay-transitioning');
|
298
|
+
}
|
299
|
+
};
|
300
|
+
|
301
|
+
new ZoomService().listen();
|
302
|
+
|
303
|
+
}(jQuery);
|
304
|
+
|
305
305
|
</script>
|