mirror of
https://git.adityakumar.xyz/hugo-theme-even.git
synced 2024-11-09 14:59:45 +00:00
feat: group images with fancybox
This commit is contained in:
parent
6a66b73a43
commit
8137021405
3 changed files with 5 additions and 5 deletions
|
@ -114,13 +114,13 @@ Even.fancybox = function () {
|
||||||
if ($.fancybox) {
|
if ($.fancybox) {
|
||||||
$('.post').each(function () {
|
$('.post').each(function () {
|
||||||
$(this).find('img').each(function () {
|
$(this).find('img').each(function () {
|
||||||
$(this).wrap('<a class="fancybox" href="' + this.src + '" title="' + this.alt + '"></a>')
|
$(this).wrap(`<a class="fancybox" href="${this.src}" data-fancybox="gallery" data-caption="${this.title}"></a>`)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
$('.fancybox').fancybox({
|
$('.fancybox').fancybox({
|
||||||
openEffect: 'elastic',
|
selector: '.fancybox',
|
||||||
closeEffect: 'elastic'
|
protect: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
static/dist/even.min.js
vendored
2
static/dist/even.min.js
vendored
|
@ -1,2 +1,2 @@
|
||||||
!function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";var o=n(1);n(2),hljs.initHighlighting(),o.Even.highlight(),$(document).ready(function(){o.Even.backToTop(),o.Even.mobileNavbar(),o.Even.beforeToc(),o.Even.toc(),o.Even.fancybox()})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o={};o.backToTop=function(){var e=$("#back-to-top");$(window).scroll(function(){$(window).scrollTop()>100?e.fadeIn(1e3):e.fadeOut(1e3)}),e.click(function(){$("body,html").animate({scrollTop:0})})},o.mobileNavbar=function(){var e=$("#mobile-navbar"),t=$(".mobile-navbar-icon"),n=new Slideout({panel:document.getElementById("mobile-panel"),menu:document.getElementById("mobile-menu"),padding:180,tolerance:70});n.disableTouch(),t.click(function(){n.toggle()}),n.on("beforeopen",function(){e.addClass("fixed-open"),t.addClass("icon-click").removeClass("icon-out")}),n.on("beforeclose",function(){e.removeClass("fixed-open"),t.addClass("icon-out").removeClass("icon-click")}),$("#mobile-panel").on("touchend",function(){n.isOpen()&&t.click()})},o.toc=function(){var e=$(".post-toc"),t=$(".post-footer");if(e.length){var n=e.offset().top-20,o=t.offset().top-e.height()-20,r={start:{position:"absolute",top:n},process:{position:"fixed",top:20},end:{position:"absolute",top:o}};$(window).scroll(function(){var t=$(window).scrollTop();t<n?e.css(r.start):t>o?e.css(r.end):e.css(r.process)})}var i=$(".toc-link"),l=$(".headerlink"),a=$.map(l,function(e){return $(e).offset().top});$(window).scroll(function(){for(var e=$(window).scrollTop(),t=0;t<i.length;t++){var n=t+1===i.length,o=a[t]-30,r=n?1/0:a[t+1]-30;o<e&&e<=r?$(i[t]).addClass("active"):$(i[t]).removeClass("active")}})},o.fancybox=function(){$.fancybox&&($(".post").each(function(){$(this).find("img").each(function(){$(this).wrap('<a class="fancybox" href="'+this.src+'" title="'+this.alt+'"></a>')})}),$(".fancybox").fancybox({openEffect:"elastic",closeEffect:"elastic"}))},o.highlight=function(){var e=document.querySelectorAll("pre code"),t=!0,n=!1,o=void 0;try{for(var r,i=e[Symbol.iterator]();!(t=(r=i.next()).done);t=!0){for(var l=r.value,a=l.classList,c=l.parentElement,s=l.innerHTML.split(/\n/).slice(0,-1),f=s.length,u="",d=0;d<f;d++)u+='<div class="line">'+(d+1)+"</div>";var v="",p=!0,h=!1,b=void 0;try{for(var y,m=s[Symbol.iterator]();!(p=(y=m.next()).done);p=!0){v+='<div class="line">'+y.value+"</div>"}}catch(e){h=!0,b=e}finally{try{!p&&m.return&&m.return()}finally{if(h)throw b}}a.add("highlight");var g=document.createElement("figure");g.classList=a,g.innerHTML='<table><tbody><tr><td class="gutter"><pre>'+u+'</pre></td><td class="code"><pre>'+v+"</pre></td></tr></tbody></table>",c.parentElement.replaceChild(g,c)}}catch(e){n=!0,o=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw o}}},o.beforeToc=function(){var e=document.querySelectorAll("#TableOfContents a"),t=!0,n=!1,o=void 0;try{for(var r,i=e[Symbol.iterator]();!(t=(r=i.next()).done);t=!0){r.value.classList.add("toc-link")}}catch(e){n=!0,o=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw o}}for(var l=[1,2,3,4,5,6],a=0;a<l.length;a++){var c=l[a],s=document.querySelectorAll(".post-content>h"+c),f=!0,u=!1,d=void 0;try{for(var v,p=s[Symbol.iterator]();!(f=(v=p.next()).done);f=!0){var h=v.value;h.innerHTML='<a href="#'+h.id+'" class="headerlink" title="'+h.innerHTML+'"></a>'+h.innerHTML}}catch(e){u=!0,d=e}finally{try{!f&&p.return&&p.return()}finally{if(u)throw d}}}},t.Even=o},function(e,t){}]);
|
!function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";var o=n(1);n(2),hljs.initHighlighting(),o.Even.highlight(),$(document).ready(function(){o.Even.backToTop(),o.Even.mobileNavbar(),o.Even.beforeToc(),o.Even.toc(),o.Even.fancybox()})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o={};o.backToTop=function(){var e=$("#back-to-top");$(window).scroll(function(){$(window).scrollTop()>100?e.fadeIn(1e3):e.fadeOut(1e3)}),e.click(function(){$("body,html").animate({scrollTop:0})})},o.mobileNavbar=function(){var e=$("#mobile-navbar"),t=$(".mobile-navbar-icon"),n=new Slideout({panel:document.getElementById("mobile-panel"),menu:document.getElementById("mobile-menu"),padding:180,tolerance:70});n.disableTouch(),t.click(function(){n.toggle()}),n.on("beforeopen",function(){e.addClass("fixed-open"),t.addClass("icon-click").removeClass("icon-out")}),n.on("beforeclose",function(){e.removeClass("fixed-open"),t.addClass("icon-out").removeClass("icon-click")}),$("#mobile-panel").on("touchend",function(){n.isOpen()&&t.click()})},o.toc=function(){var e=$(".post-toc"),t=$(".post-footer");if(e.length){var n=e.offset().top-20,o=t.offset().top-e.height()-20,r={start:{position:"absolute",top:n},process:{position:"fixed",top:20},end:{position:"absolute",top:o}};$(window).scroll(function(){var t=$(window).scrollTop();t<n?e.css(r.start):t>o?e.css(r.end):e.css(r.process)})}var i=$(".toc-link"),a=$(".headerlink"),l=$.map(a,function(e){return $(e).offset().top});$(window).scroll(function(){for(var e=$(window).scrollTop(),t=0;t<i.length;t++){var n=t+1===i.length,o=l[t]-30,r=n?1/0:l[t+1]-30;o<e&&e<=r?$(i[t]).addClass("active"):$(i[t]).removeClass("active")}})},o.fancybox=function(){$.fancybox&&($(".post").each(function(){$(this).find("img").each(function(){$(this).wrap('<a class="fancybox" href="'+this.src+'" data-fancybox="gallery" data-caption="'+this.title+'"></a>')})}),$(".fancybox").fancybox({selector:".fancybox",protect:!0}))},o.highlight=function(){var e=document.querySelectorAll("pre code"),t=!0,n=!1,o=void 0;try{for(var r,i=e[Symbol.iterator]();!(t=(r=i.next()).done);t=!0){for(var a=r.value,l=a.classList,c=a.parentElement,s=a.innerHTML.split(/\n/).slice(0,-1),f=s.length,u="",d=0;d<f;d++)u+='<div class="line">'+(d+1)+"</div>";var v="",p=!0,b=!1,h=void 0;try{for(var y,m=s[Symbol.iterator]();!(p=(y=m.next()).done);p=!0){v+='<div class="line">'+y.value+"</div>"}}catch(e){b=!0,h=e}finally{try{!p&&m.return&&m.return()}finally{if(b)throw h}}l.add("highlight");var g=document.createElement("figure");g.classList=l,g.innerHTML='<table><tbody><tr><td class="gutter"><pre>'+u+'</pre></td><td class="code"><pre>'+v+"</pre></td></tr></tbody></table>",c.parentElement.replaceChild(g,c)}}catch(e){n=!0,o=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw o}}},o.beforeToc=function(){var e=document.querySelectorAll("#TableOfContents a"),t=!0,n=!1,o=void 0;try{for(var r,i=e[Symbol.iterator]();!(t=(r=i.next()).done);t=!0){r.value.classList.add("toc-link")}}catch(e){n=!0,o=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw o}}for(var a=[1,2,3,4,5,6],l=0;l<a.length;l++){var c=a[l],s=document.querySelectorAll(".post-content>h"+c),f=!0,u=!1,d=void 0;try{for(var v,p=s[Symbol.iterator]();!(f=(v=p.next()).done);f=!0){var b=v.value;b.innerHTML='<a href="#'+b.id+'" class="headerlink" title="'+b.innerHTML+'"></a>'+b.innerHTML}}catch(e){u=!0,d=e}finally{try{!f&&p.return&&p.return()}finally{if(u)throw d}}}},t.Even=o},function(e,t){}]);
|
||||||
//# sourceMappingURL=even.min.js.map
|
//# sourceMappingURL=even.min.js.map
|
2
static/dist/even.min.js.map
vendored
2
static/dist/even.min.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue