bolo-fantastic/js/common.min.js

1 line
6.2 KiB
JavaScript

!function(){function t(){return Array.prototype.slice.call(document.querySelectorAll.apply(document,arguments))}t("body > .navbar, body > .section, body > .footer").forEach((function(t){t.style.transition="0s",t.style.opacity="0"})),document.querySelector("body > .navbar").style.transform="translateY(-100px)",[".column-main > .card",".column-left > .card, .column-right-shadow > .card",".column-right > .card"].map((function(e){t(e).forEach((function(t){t.style.transition="0s",t.style.opacity="0",t.style.transform="scale(0.8)",t.style.transformOrigin="center top"}))})),setTimeout((function(){t("body > .navbar, body > .section, body > .footer").forEach((function(t){t.style.opacity="1",t.style.transition="opacity 0.3s ease-out, transform 0.3s ease-out"})),document.querySelector("body > .navbar").style.transform="translateY(0)",[".column-main > .card",".column-left > .card, .column-right-shadow > .card",".column-right > .card"].map((function(e){var i=1;t(e).forEach((function(t){setTimeout((function(){t.style.opacity="1",t.style.transform="",t.style.transition="opacity 0.3s ease-out, transform 0.3s ease-out"}),100*i),i++}))}))}))}(),function(){var t=document.querySelector(".burger"),e=document.querySelector("#"+t.dataset.target);t.addEventListener("click",(function(){t.classList.toggle("is-active"),e.classList.toggle("is-active")}))}(),$(document).ready((function(){var t=$("#back-to-top"),e=$("footer.footer"),i=$(".column-main"),a=$(".column-left"),n=$(".column-right"),o=0,s=null,r={base:{classname:"card has-text-centered",left:"",width:64,bottom:20,"border-radius":4}};function l(e){if(null===s||!function(t,e){for(var i in t)if(!e.hasOwnProperty(i)||e[i]!==t[i])return!1;for(var i in e)if(!t.hasOwnProperty(i)||t[i]!=t[i])return!1;return!0}(s,e)){t.attr("class",e.classname);for(let i in e)"classname"!==i&&t.css(i,e[i]);s=e}}function c(){return window.innerWidth>=1078}function d(){return n.length>0}function f(){return $(window).scrollTop()+$(window).height()}function h(){return t.outerHeight(!0)}function u(){if(c()||window.innerWidth>=768&&!c()&&!(a.length>0)&&d()){var s,u=(i.outerWidth()-i.width())/2,g=$(window).width()-t.outerWidth(!0)-20,m=e.offset().top+h()/2+20;s=0==$(window).scrollTop()||f()<(d()?Math.max.apply(null,n.find(".widget").map((function(){return $(this).offset().top+$(this).outerHeight(!0)}))):0)+u+h()?r["desktop-hidden"]:f()<m?r["desktop-visible"]:Object.assign({},r["desktop-dock"],{bottom:f()-m+20});var p=i.offset().left+i.outerWidth()+u;l(s=Object.assign({},s,{left:Math.min(p,g)}))}else $(window).scrollTop()<o&&$(window).scrollTop()>0?l(r["mobile-visible"]):l(r["mobile-hidden"]),o=$(window).scrollTop()}r["desktop-hidden"]=Object.assign({},r.base,{classname:r.base.classname+" rise-up"}),r["desktop-visible"]=Object.assign({},r["desktop-hidden"],{classname:r["desktop-hidden"].classname+" fade-in"}),r["desktop-dock"]=Object.assign({},r["desktop-visible"],{classname:r["desktop-visible"].classname+" fade-in",width:40,"border-radius":"50%"}),r["mobile-hidden"]=Object.assign({},r.base,{classname:r.base.classname+" fade-in",right:20}),r["mobile-visible"]=Object.assign({},r["mobile-hidden"],{classname:r["mobile-hidden"].classname+" rise-up"}),u(),$(window).resize(u),$(window).scroll(u),$("#back-to-top").on("click",(function(){$("body, html").animate({scrollTop:0},400)}))})),document.addEventListener("DOMContentLoaded",(function(){"function"==typeof $.fn.lightGallery&&$(".article").lightGallery({selector:".gallery-item"}),"function"==typeof $.fn.justifiedGallery&&($(".justified-gallery > p > .gallery-item").length&&$(".justified-gallery > p > .gallery-item").unwrap(),$(".justified-gallery").justifiedGallery())})),function(t){function e(){const e=t(".navbar-main .navbar-start").outerWidth()+t(".navbar-main .navbar-end").outerWidth();t(document).outerWidth()<e?t(".navbar-main .navbar-menu").addClass("is-flex-start"):t(".navbar-main .navbar-menu").removeClass("is-flex-start")}if(t('.article img:not(".not-gallery-item")').each((function(){0===t(this).parent("a").length&&(t(this).wrap('<a class="gallery-item" href="'+t(this).attr("src")+'"></a>'),this.alt&&t(this).after('<div class="has-text-centered is-size-6 has-text-grey caption">'+this.alt+"</div>"))})),"function"==typeof moment&&t(".article-meta time").each((function(){t(this).text(moment(t(this).attr("datetime")).fromNow())})),t(".article > .content > table").each((function(){t(this).width()>t(this).parent().width()&&t(this).wrap('<div class="table-overflow"></div>')})),e(),t(window).resize(e),t("figure.highlight table").wrap('<div class="highlight-body">'),"undefined"!=typeof IcarusThemeSettings&&void 0!==IcarusThemeSettings.article&&void 0!==IcarusThemeSettings.article.highlight){"undefined"!=typeof ClipboardJS&&IcarusThemeSettings.article.highlight.clipboard&&(t("figure.highlight").each((function(){var e="code-"+Date.now()+(1e3*Math.random()|0),i='<a href="javascript:;" class="copy" title="Copy" data-clipboard-target="#'+e+' .code"><i class="fas fa-copy"></i></a>';t(this).attr("id",e),t(this).find("figcaption").length?t(this).find("figcaption").prepend(i):t(this).prepend("<figcaption>"+i+"</figcaption>")})),new ClipboardJS(".highlight .copy"));var i=IcarusThemeSettings.article.highlight.fold;if(i.trim()){var a='<span class="fold">'+("unfolded"===i?'<i class="fas fa-angle-down"></i>':'<i class="fas fa-angle-right"></i>')+"</span>";function n(e,i){var a=t(e).find(".fold i");i?t(e).addClass("folded"):t(e).removeClass("folded"),i?a.removeClass("fa-angle-down"):a.removeClass("fa-angle-right"),i?a.addClass("fa-angle-right"):a.addClass("fa-angle-down")}t("figure.highlight").each((function(){t(this).find("figcaption").length?t(this).find("figcaption").prepend(a):t(this).prepend("<figcaption>"+a+"</figcaption>")})),t("figure.highlight").each((function(){n(this,"folded"===i)})),t("figure.highlight figcaption .fold").click((function(){var e=t(this).closest("figure.highlight");n(e.eq(0),!e.hasClass("folded"))}))}}var o=t("#toc");if(o.length>0){var s=t("<div>");function r(){o.toggleClass("is-active"),s.toggleClass("is-active")}s.attr("id","toc-mask"),t("body").append(s),o.on("click",r),s.on("click",r),t(".navbar-main .catalogue").on("click",r)}}(jQuery);var swiper=new Swiper(".blog-slider",{spaceBetween:30,effect:"fade",pagination:{el:".blog-slider__pagination",clickable:!0}});