diff --git a/DONATION.md b/DONATION.md index c6c0f8ae..988ac0b6 100644 --- a/DONATION.md +++ b/DONATION.md @@ -1,36 +1,43 @@ -# 赞助 +# 赞助 / Sponsorship -**非常感谢各位对本项目的支持!!** +**非常感谢各位对本项目的支持!!** +**Thank you very much for your support to this project!** -## 引言 +## 引言 / Introduction -刚开始这个主题其实是自用的,后来有网友看见我的博客,就问我是怎么改的。 +刚开始这个主题其实是自用的,后来有网友看见我的博客,就问我是怎么改的。 +Initially, this theme was created for my personal use, but later, some readers came across my blog and asked me how I customized it. -想了一下,就开了个项目。一路走来,跌跌撞撞也写了几个版本,也收到了不少网友的反馈,而且第一次拿到这么多 Star,在这里非常感谢各位的支持。 +想了一下,就开了个项目。一路走来,跌跌撞撞也写了几个版本,也收到了不少网友的反馈,而且第一次拿到这么多 Star,在这里非常感谢各位的支持。 +After giving it some thought, I decided to start a project. Along the way, I encountered some challenges and went through several versions. I also received valuable feedback from many users. Moreover, it's the first time I've received such a high number of stars. I want to express my sincere appreciation for all your support. -本来没想着要求打赏,但是目前阿里云国内下行流量平均一个月消耗 100GB,本人每月流量费用大概在 20 元左右,想着换 unpkg/jsdelivr 做 cdn,但是那个速度真的感人。 +本来没想着要求打赏,但是目前阿里云国内下行流量平均一个月消耗 100GB,本人每月流量费用大概在 20 元左右,想着换 unpkg/jsdelivr 做 cdn,但是那个速度真的感人。 +Originally, I hadn't planned on requesting any contributions. However, currently, the average monthly consumption of downstream traffic on Aliyun in China is around 100GB, and my monthly traffic cost is approximately 20 yuan. I considered switching to unpkg/jsdelivr as a CDN, but the speed there is truly disappointing. -如果各位能支持一下,**一块两块都已足够**,就能维持阿里云cdn的流量费用,本人实在是感激不尽。 +如果各位能支持一下,**一块两块都已足够**,就能维持阿里云 CDN 的流量费用,本人实在是感激不尽。 +If any of you could provide some support, even a small amount such as one or two yuan, it would be sufficient to cover the CDN traffic cost on Aliyun. I would be immensely grateful for your assistance. -感谢所有赞助本项目的朋友,你们的支持是我继续更新的动力! +感谢所有赞助本项目的朋友,你们的支持是我继续更新的动力! +Thank you to all the friends who have sponsored this project. Your support is what motivates me to keep updating and improving it! -## 赞助方法 +## 赞助方法 / Sponsorship Methods -微信 | 支付宝| Paypal +微信 / WeChat | 支付宝 / Alipay | Paypal :-------------------------:|:-------------------------:|:-------------------------: ![IMG_0382](https://user-images.githubusercontent.com/68590232/223455834-d2e5ab6e-9d75-4bbf-adfb-2c519d6b4582.JPG) | ![IMG_9570](https://user-images.githubusercontent.com/68590232/223463950-f7276ef8-0198-4070-8541-697ec25e5b9a.png) | ![IMG_0385](https://user-images.githubusercontent.com/68590232/223459896-593e105e-89f3-4631-8cab-cb7798a53bf1.jpg) +赞助完以后,请各位加我微信 `do-not-go-plzzz` 联系我添加 GitHub 账号和网站链接! +After making a donation, if you want to get in touch with me, please add me on Discord with my username `evan404`. +感谢! +Thank you! -赞助完以后,请各位加我微信 `do-not-go-plzzz` 联系我添加 Github账号 和 网站链接! +## 赞助名单 / Sponsorship List -感谢! +按时间先后排序 / Sorted by chronological order -## 赞助名单 -按时间先后排序 - -| 赞助时间 | 赞助人 | 赞助金额 | 赞助方式 | 网站 | +| 赞助时间 / Date | 赞助人 / Sponsor | 赞助金额 / Amount | 赞助方式 / Method | 网站 / Website | | :----------: | :--------------------------------------------------------: | :------: | :--------: | :---------------: | | Mar 4 | [@username0occupied](https://github.com/username0occupied) | ¥6.66 | 微信红包 | / | | Mar 4 | [@jkoor](https://github.com/jkoor) | ¥15.00 | 微信红包 | https://jkor.site | @@ -50,4 +57,7 @@ | Jun 12 | Anonymous | ¥0.99 | 微信赞赏码 | / | | Jun 22 | [@JuTemp](https://github.com/JuTemp) | ¥15.00 | 支付宝 | https://jtp0415.top | | Jul 13 | [@825i](https://github.com/825i) | $20.00 | Paypal | https://blog.xtu.icu/ | - \ No newline at end of file +| Jul 14 | 点点 | ¥8.88 | 微信赞赏码 | / | + + + diff --git a/README_zh-CN.md b/README_zh-CN.md index ea11a732..5dd6769e 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -1,6 +1,6 @@
- 简体中文 english + 简体中文 繁体中文
diff --git a/README_zh-TW.md b/README_zh-TW.md index ea9ef44d..2413df52 100644 --- a/README_zh-TW.md +++ b/README_zh-TW.md @@ -1,7 +1,7 @@
- language english 简体中文 + language
Redefine diff --git a/_config.yml b/_config.yml index 4bbfba4a..baee216a 100755 --- a/_config.yml +++ b/_config.yml @@ -64,14 +64,15 @@ global: scroll_progress: bar: false # progress bar percentage: true # percentage - # Website counter (powered by https://busuanzi.ibruce.info/) - busuanzi_counter: + # Website counter + website_counter: + url: https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js # counter API URL (no need to change) enable: true # enable website counter or not site_pv: true # site page view site_uv: true # site unique visitor post_pv: true # post page view - # Whether to enable PJAX - pjax: true + # Whether to enable single page experience (using swup). See https://swup.js.org/. similar to pjax + single_page: true # Whether to enable open graph open_graph: true # Google Analytics @@ -150,6 +151,10 @@ home_banner: twitter: # your twitter URL email: # your email # ...... # you can add more + # Social links with QRcode drawers + qrs: + weixin: # your Wechat QRcode image URL + # ...... # you can add more # HOME BANNER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< end diff --git a/layout/_meta/article-info.ejs b/layout/_meta/article-info.ejs index 52dacb08..960da878 100755 --- a/layout/_meta/article-info.ejs +++ b/layout/_meta/article-info.ejs @@ -70,7 +70,7 @@  <%= temp_min2read %> <%- __('min2read') %> <% } %> - <% if (is_post() && theme.global.busuanzi_counter.enable && theme.global.busuanzi_counter.post_pv) { %> + <% if (is_post() && theme.global.website_counter.enable && theme.global.website_counter.post_pv) { %>   diff --git a/layout/_partials/comments/comment.ejs b/layout/_partials/comments/comment.ejs index fe2cf38e..b4f91f88 100755 --- a/layout/_partials/comments/comment.ejs +++ b/layout/_partials/comments/comment.ejs @@ -1,4 +1,4 @@ -
+
 <%- __('comments') %> diff --git a/layout/_partials/comments/giscus.ejs b/layout/_partials/comments/giscus.ejs index 76ce733c..138b5172 100755 --- a/layout/_partials/comments/giscus.ejs +++ b/layout/_partials/comments/giscus.ejs @@ -5,7 +5,7 @@ theme.comment.config.giscus.category_id ) { %>
- -
-
- + <% if (theme.global.website_counter.enable === true) { %> +
- <% if (theme.global.busuanzi_counter.site_uv) { %> + <% if (theme.global.website_counter.site_uv) { %> <%- __('site_uv') %>  <% } %> - <% if (theme.global.busuanzi_counter.site_pv) { %> + <% if (theme.global.website_counter.site_pv) { %> <%- __('site_pv') %>  @@ -26,7 +26,7 @@
<%- __('powered_by', 'Hexo') %>
- <%# 保留主题信息是对作者的尊重,感谢! %><%- __('theme') %> Redefine v<%- getThemeVersion() %><%# 保留主题信息是对作者的尊重,感谢! %> + <%# 保留主题信息是对作者的尊重,感谢! %><%- __('theme') %> Redefine v<%- getThemeVersion() %><%# 保留主题信息是对作者的尊重,感谢! %>
<% if (theme.footer.icp.enable && theme.footer.icp.hasOwnProperty('number')) { %> <% } %> - <% if (theme.footer.hasOwnProperty('upyun') && theme.footer.upyun) { %> - - <% } %> <% if (theme.footer.runtime === true) {%>
<%= __('runtime') %> <%= __('days') %> <%= __('hours') %> <%= __('minutes') %> <%= __('seconds') %> @@ -51,7 +46,7 @@
<%- theme.footer.customize %>
<% } %> <% if (theme.footer.runtime === true) {%> - <% } %> - <% if (theme.inject.enable == true) { %> + <% if (theme.inject.enable === true) { %> <% for (let i in theme.inject.footer) { %> <% if (theme.inject.footer[i] !== null ){ %> - <% if (theme.global.pjax == true) { %> - <%- theme.inject.footer[i].replace(" + <% if (theme.global.single_page === true) { %> + <%- theme.inject.footer[i].replace(" <% } else { %> <%- theme.inject.footer[i] %> <% } } %> diff --git a/layout/_partials/head.ejs b/layout/_partials/head.ejs index c1171082..30ee02ed 100755 --- a/layout/_partials/head.ejs +++ b/layout/_partials/head.ejs @@ -32,7 +32,7 @@ <% } %> <% if (theme.global.google_analytics.enable) { %> - + diff --git a/layout/_plugins/swup.ejs b/layout/_plugins/swup.ejs new file mode 100755 index 00000000..39579e03 --- /dev/null +++ b/layout/_plugins/swup.ejs @@ -0,0 +1,34 @@ +<%- renderJS([ + 'js/libs/Swup.min.js', + 'js/libs/SwupSlideTheme.min.js', + 'js/libs/SwupScriptsPlugin.min.js', + 'js/libs/SwupProgressPlugin.min.js', + 'js/libs/SwupScrollPlugin.min.js'] +) %> + diff --git a/layout/_widgets/essays.ejs b/layout/_widgets/essays.ejs index d1eb85cf..dd09df87 100644 --- a/layout/_widgets/essays.ejs +++ b/layout/_widgets/essays.ejs @@ -9,7 +9,7 @@ %> <% for (const e of newessays) { %>
  • -
    <%- image_tag(url_for(theme.defaults.avatar)) %>
    +
    <%- image_tag(theme.defaults.avatar) %>
    <%- markdown(e.content) %>
    <%- date(e.date, config.date_format) %>
    diff --git a/layout/_widgets/post-tools.ejs b/layout/_widgets/post-tools.ejs index a3b0dd70..b649c8cb 100755 --- a/layout/_widgets/post-tools.ejs +++ b/layout/_widgets/post-tools.ejs @@ -8,7 +8,7 @@ <% } %> - <% if (theme.comment.enable === true && theme.comment.hasOwnProperty('system')) { %> + <% if (theme.comment.enable === true && theme.comment.hasOwnProperty('system') && page.comment !== false) { %>
  • diff --git a/layout/_widgets/progress-bar.ejs b/layout/_widgets/progress-bar.ejs index 6337f7bf..b65d748f 100755 --- a/layout/_widgets/progress-bar.ejs +++ b/layout/_widgets/progress-bar.ejs @@ -3,9 +3,9 @@ <% } %> - <% if (theme.global.pjax === true) { %> + <% if (theme.global.single_page === true) { %> - + <% } %> diff --git a/layout/_widgets/tagcloud.ejs b/layout/_widgets/tagcloud.ejs index d89898b5..c3243dd1 100755 --- a/layout/_widgets/tagcloud.ejs +++ b/layout/_widgets/tagcloud.ejs @@ -1,31 +1,28 @@ <% if (site.tags.length){ %> -
    -
    - <% if (theme.page_templates.tags_style == 'cloud') { %> -
    -

    <%- __('tags') %>

    -
    -
    - <%- tagcloud({ - min_font: 1, - max_font: 5, - unit: 'rem', - amount: 100 - }) %> -
    - - <% } else {%> -
    -

    <%- __('tags') %>

    -
    -
    -
      - <% for (const tag of site.tags.data) { %> -
    • <%- tag.name %>
    • - <% } %> -
    -
    - <% } %> -
    -
    -<% } %> \ No newline at end of file +
    + <% if (theme.page_templates.tags_style == 'cloud') { %> +
    +

    <%- __('tags') %>

    +
    +
    + <%- tagcloud({ min_font: 1, max_font: 5, unit: 'rem', amount: 100 }) %> +
    + + <% } else {%> +
    +

    <%- __('tags') %>

    +
    +
    +
      + <% for (const tag of site.tags.data) { %> +
    • + <%- tag.name %> +
    • + <% } %> +
    +
    + <% } %> +
    +<% } %> diff --git a/layout/archive-content.ejs b/layout/archive-content.ejs index 497db6c5..c4ec6ae3 100755 --- a/layout/archive-content.ejs +++ b/layout/archive-content.ejs @@ -1,5 +1,3 @@ -
    -
    - <%- partial('_widgets/archive-list', {posts_new: site.posts}) %> -
    +
    + <%- partial('_widgets/archive-list', {posts_new: site.posts}) %>
    \ No newline at end of file diff --git a/layout/article-content.ejs b/layout/article-content.ejs index 804dfd4d..4a7a16c2 100755 --- a/layout/article-content.ejs +++ b/layout/article-content.ejs @@ -1,127 +1,126 @@ -
    -
    -
    +
    +
    -
    - <% if (page.cover || page.banner || (page.thumbnail && page.thumbnail !== false)) { %> - <% let articleCover = ""; - if (page.cover && page.cover.includes("/")) { - articleCover = page.cover; - } else if (page.banner && page.banner.includes("/")) { - articleCover = page.banner; - } else if (page.thumbnail && page.thumbnail !== null) { - articleCover = page.thumbnail; - } else if (config.marked.postAsset && config.marked.postAsset == true) { - articleCover = [page.path, page.cover || page.banner].join("/"); - } - %> - <% if (articleCover) { %> - <%= page.title %> - <% } %> -

    <%= page.title %>

    - <% } else { %> -

    <%= page.title %>

    +
    + <% if (page.cover || page.banner || (page.thumbnail && page.thumbnail !== false)) { %> + <% let articleCover = ""; + if (page.cover && page.cover.includes("/")) { + articleCover = page.cover; + } else if (page.banner && page.banner.includes("/")) { + articleCover = page.banner; + } else if (page.thumbnail && page.thumbnail !== null) { + articleCover = page.thumbnail; + } else if (config.marked.postAsset && config.marked.postAsset == true) { + articleCover = [page.path, page.cover || page.banner].join("/"); + } + %> + <% if (articleCover) { %> + <%= page.title %> <% } %> -
    - - +

    <%= page.title %>

    + <% } else { %> +

    <%= page.title %>

    + <% } %> +
    - <% if (theme.info.author || config.author) { %> -
    -
    - <%- image_tag(url_for(theme.defaults.avatar)) %> -
    -
    -
    - <%= theme.info.author || config.author %> - <% if (theme.hasOwnProperty('articles') && theme.articles.author_label.enable === true) { %> - <%- getAuthorLabel(site.posts.length, theme.articles.author_label.auto, theme.articles.author_label.list) %> - <% } %> -
    -
    - <%- partial('_meta/article-info', {articleObject: page, index: true}) %> -
    -
    + + + <% if (theme.info.author || config.author) { %> +
    +
    + <%- image_tag(theme.defaults.avatar) %>
    - <% } else { %> -
    +
    +
    + <%= theme.info.author || config.author %> + <% if (theme.hasOwnProperty('articles') && theme.articles.author_label.enable === true) { %> + <%- getAuthorLabel(site.posts.length, theme.articles.author_label.auto, theme.articles.author_label.list) %> + <% } %> +
    <%- partial('_meta/article-info', {articleObject: page, index: true}) %>
    - <% } %> - -
    - <%- page.content %>
    - - <% if (theme.articles.copyright) { %> -
    - <%- partial('_meta/article-copyright') %> + <% } else { %> +
    +
    + <%- partial('_meta/article-info', {articleObject: page, index: true}) %>
    - <% } %> +
    + <% } %> - <% if (page.tags.length) { %> - - <% } %> +
    + <%- page.content %> +
    - <%- articleRecommendationGenerator(page) %> + <% if (theme.articles.copyright) { %> +
    + <%- partial('_meta/article-copyright') %> +
    + <% } %> - <% if (page.prev || page.next) { %> -
    - <% if (page.prev) { %> -
    - -
    - <% } %> - <% if (page.next) { %> -
    - -
    - <% } %> -
    - <% } %> + <% if (page.tags.length) { %> + + <% } %> + <%- articleRecommendationGenerator(page) %> - <% if (theme.comment.enable === true && theme.comment.hasOwnProperty('system') && page.comment !== false && page.comment !== false) { %> -
    - <%- partial('_partials/comments/comment') %> -
    - <% } %> -
    + <% if (page.prev || page.next) { %> +
    + <% if (page.prev) { %> +
    + +
    + <% } %> + <% if (page.next) { %> +
    + +
    + <% } %> +
    + <% } %> - <% if (is_post() && theme.articles.toc.enable === true) { %> -
    - <%- partial('_widgets/toc') %> + + <% if (theme.comment.enable === true && theme.comment.hasOwnProperty('system') && page.comment !== false && page.comment !== false) { %> +
    + <%- partial('_partials/comments/comment') %>
    <% } %>
    + + <% if (is_post() && theme.articles.toc.enable === true) { %> +
    + <%- partial('_widgets/toc') %> +
    + <% } %>
    + diff --git a/layout/category-content.ejs b/layout/category-content.ejs index 9c24886b..d7fb95cf 100755 --- a/layout/category-content.ejs +++ b/layout/category-content.ejs @@ -1,13 +1,12 @@ -
    -
    -
    -  <%= page.category %> -
    -
    - <%- partial('_widgets/archive-list', {posts_new: page.posts}) %> -
    +
    +
    +  <%= page.category %>
    -
    - <%- partial('_widgets/paginator', {pageObject: page}) %> +
    + <%- partial('_widgets/archive-list', {posts_new: page.posts}) %>
    +
    + <%- partial('_widgets/paginator', {pageObject: page}) %> +
    + diff --git a/layout/category-list.ejs b/layout/category-list.ejs index d9c95ab1..88b3e87f 100755 --- a/layout/category-list.ejs +++ b/layout/category-list.ejs @@ -1,20 +1,15 @@ -
    -
    -
    -

    <%- __('categories') %>

    -
    -
    - <%- list_categories(site.categories, { - class: 'all-category', - depth: 5, - style: 'list', - }) %> -
    -
    - <% if (page.comment) { %> - <%- partial('_partials/comments/comment') %> - <% } %> -
    -
    +
    +
    +

    + <%- __('categories') %> +

    +
    +
    + <%- list_categories(site.categories, { class: 'all-category', depth: 5, + style: 'list', }) %> +
    +
    + <% if (page.comment) { %> <%- partial('_partials/comments/comment') %> + <% } %> +
    -<%- renderPjaxJS('js/layouts/categoryList.js') %> \ No newline at end of file diff --git a/layout/page.ejs b/layout/page.ejs index fdd367af..cb2d50c9 100755 --- a/layout/page.ejs +++ b/layout/page.ejs @@ -1,5 +1,6 @@ <%- partial('_widgets/progress-bar') %> -
    +
    + <% if (theme.home_banner.enable === true && is_home() && !page.prev) { %> <%- partial('_partials/home-banner') %> @@ -8,6 +9,7 @@ <% } %>
    +
    <%- partial('_partials/navbar') %> @@ -23,6 +25,7 @@ <% if (is_home()) { %> <%- partial('_partials/home-content') %> +
    <% } else if (is_archive()) { %> <%- partial('archive-content') %> @@ -81,4 +84,6 @@
    +<%- partial('_plugins/swup') %> + diff --git a/layout/tag-content.ejs b/layout/tag-content.ejs index 4f8e85d7..9cad922d 100755 --- a/layout/tag-content.ejs +++ b/layout/tag-content.ejs @@ -1,13 +1,12 @@ -
    -
    -
     <%= page.tag %> -
    -
    - <%- partial('_widgets/archive-list', {posts_new: page.posts}) %> -
    -
    +
    +
    +  <%= page.tag %> +
    +
    + <%- partial('_widgets/archive-list', {posts_new: page.posts}) %> +
    +
    -
    - <%- partial('_widgets/paginator', {pageObject: page}) %> -
    +
    + <%- partial('_widgets/paginator', {pageObject: page}) %>
    diff --git a/package.json b/package.json index 9ef2481e..e41c4b0c 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "hexo-theme-redefine", - "version": "2.2.2", + "version": "2.3.0", "private": false, - "description": "Redefine your writing with modern style and various functionality in 'Redefine' Hexo Theme.", + "description": "Redefine your writing in Hexo Theme Redefine", "scripts": { "npm:publish": "npm publish", "format": "prettier --write ./source/js/*.js ./scripts", diff --git a/scripts/filters/stylHandle.js b/scripts/filters/stylHandle.js new file mode 100644 index 00000000..5783c684 --- /dev/null +++ b/scripts/filters/stylHandle.js @@ -0,0 +1,9 @@ +hexo.extend.filter.register('stylus:renderer', function (style) { + style.define('url-for', function (data) { + const urlRender = hexo.extend.helper.get('url_for').bind(hexo); + + const url = urlRender(data.val); + + return url; + }); +}) \ No newline at end of file diff --git a/scripts/helpers/themeHelpers.js b/scripts/helpers/themeHelpers.js index 52d2b48c..01ed29e5 100755 --- a/scripts/helpers/themeHelpers.js +++ b/scripts/helpers/themeHelpers.js @@ -124,16 +124,16 @@ hexo.extend.helper.register('renderPjaxJS', function (path) { const cdnBase = cdnProviders[this.theme.cdn.provider] || cdnProviders.aliyun; const renderedPath = urlRender(path); - if (this.theme.global.pjax === true) { + if (this.theme.global.single_page === true) { if (this.theme.cdn.provider === 'custom') { const customUrl = cdnBase.replace('${version}', themeVersion).replace('${path}', path); return this.theme.cdn.enable - ? `` - : ``; + ? `` + : ``; } else { return this.theme.cdn.enable - ? `` - : ``; + ? `` + : ``; } } else { if (this.theme.cdn.provider === 'custom') { diff --git a/source/css/common/variables.styl b/source/css/common/variables.styl index a467f67b..28e3bad8 100755 --- a/source/css/common/variables.styl +++ b/source/css/common/variables.styl @@ -197,8 +197,8 @@ $home-banner-icons-container-background-color-dark = rgba(197, 197, 197, 0.3) // ======================================================================================== // background image // ======================================================================================== -$home-banner-img-light = url(hexo-config('home_banner.image.light')) -$home-banner-img-dark = url(hexo-config('home_banner.image.dark')) +$home-banner-img-light = url(url-for(hexo-config('home_banner.image.light'))) +$home-banner-img-dark = url(url-for(hexo-config('home_banner.image.dark'))) // ======================================================================================== diff --git a/source/css/layout/_partials/home-banner.styl b/source/css/layout/_partials/home-banner.styl index 0a690bd8..e8859582 100755 --- a/source/css/layout/_partials/home-banner.styl +++ b/source/css/layout/_partials/home-banner.styl @@ -84,3 +84,36 @@ $home-banner-icon-size = 1.6rem &:last-child margin-right 0 + + .social-contact-item-qr + margin-right 20px + cursor pointer + line-height 2 + color #FFF + + &:last-child + margin-right 0 + + .social-qr-container + display none + position absolute + bottom 120% + left 50% + backdrop-filter blur(10px) + -webkit-backdrop-filter blur(10px) + box-shadow 0 0 10px 0 rgba(0, 0, 0, 0.5) + border-radius $redefine-border-radius-medium + box-shadow inset 0 0 2000px var(--home-banner-icons-container-background-color) + border 1.5px solid var(--home-banner-icons-container-border-color) + overflow hidden + + .social-contacts-qr + display flex + width 150px + padding 15px + + .social-contact-item-qr:hover .social-qr-container + display initial + + + \ No newline at end of file diff --git a/source/css/layout/_partials/page-template.styl b/source/css/layout/_partials/page-template.styl index 15ac9737..72588b7e 100755 --- a/source/css/layout/_partials/page-template.styl +++ b/source/css/layout/_partials/page-template.styl @@ -383,6 +383,8 @@ $friend-link-item-border-radius = 9px #masonry-container position relative display none + opacity 0 + transition opacity 0.1s ease-in .masonry-item position absolute @@ -403,6 +405,8 @@ $friend-link-item-border-radius = 9px display block justify-content center align-items center + opacity 1 + transition opacity 0.1s ease-out .loading -webkit-animation gradient-slide 1.1s ease infinite diff --git a/source/css/layout/_partials/progress-bar.styl b/source/css/layout/_partials/progress-bar.styl index f895ee77..5f87c8da 100755 --- a/source/css/layout/_partials/progress-bar.styl +++ b/source/css/layout/_partials/progress-bar.styl @@ -1,58 +1,57 @@ .progress-bar-container - position fixed - top 0 - left 0 - width 100% - z-index $z-index-9 - - if (hexo-config('global.pjax') == true) - .pjax-progress-bar - position absolute - top 0 - left 0 - height 2px - width 0 - background var(--pjax-progress-bar-color) - visibility hidden - opacity 0 - z-index $z-index-8 - transition-t('width', '0', '0.1', 'linear') - - &.show - opacity 1 - visibility visible - - .pjax-progress-icon - position absolute - top 0 - right 0 - z-index $z-index-8 - display flex - align-items center - justify-content center - padding 7px 6px 0 0 - visibility hidden - font-size 1.1rem - color var(--default-text-color) - - +redefine-tablet() - padding 6px 5px 0 0 - font-size 1rem - - &.show - visibility visible - - if (hexo-config('global.scroll_progress.bar') == true) + position fixed + top 0 + left 0 + width 100% + z-index $z-index-9 + + if (hexo-config('global.single_page') == true) + + .swup-progress-icon + position absolute + top 5px + right 8px + z-index $z-index-8 + display flex + align-items center + justify-content center + padding 7px 6px 0 0 + font-size 1.1rem + color var(--default-text-color) + opacity 0 + transition opacity 0.1s ease-out + + +redefine-tablet() + padding 6px 5px 0 0 + font-size 1rem + + if (hexo-config('global.scroll_progress.bar') == true) + .scroll-progress-bar + position absolute + top 0 + left 0 + width 0 + height $scroll-progress-bar-height + visibility hidden + z-index $z-index-7 + background var(--primary-color) + transition-t('width, opacity', '0, 0', '0.1, 0.1', 'ease, ease') + + &.hide + display none !important + +html.is-animating .scroll-progress-bar - position absolute - top 0 - left 0 - width 0 - height $scroll-progress-bar-height - visibility hidden - z-index $z-index-7 - background var(--primary-color) - transition-t('width', '0', '0.1', 'linear') - - &.hide - display none !important + opacity 0 + transition opacity 0.1s ease-out + + .swup-progress-icon + opacity 1 + transition opacity 0.1s ease + + + +.swup-progress-bar + background: #12c2e9; + height 2px + background linear-gradient(to right, #12c2e9, #c471ed, #f64f59); \ No newline at end of file diff --git a/source/css/layout/article-content.styl b/source/css/layout/article-content.styl index e00d9036..b40fc8ef 100755 --- a/source/css/layout/article-content.styl +++ b/source/css/layout/article-content.styl @@ -18,6 +18,7 @@ $gap = 30px height 100% gap 0px + &.show-toc gap 30px diff --git a/source/css/layout/page.styl b/source/css/layout/page.styl index 8f55e559..43e08a21 100755 --- a/source/css/layout/page.styl +++ b/source/css/layout/page.styl @@ -102,7 +102,7 @@ top: $navbar-shrink-height + $spacing-unit +redefine-tablet() - top: ($navbar-shrink-height * 0.9) + $spacing-unit + top ($navbar-shrink-height * 0.9) + $spacing-unit +redefine-mobile() top: ($navbar-shrink-height * 0.8 + $spacing-unit) @@ -133,3 +133,14 @@ +redefine-mobile() right 12px + +.transition-fade + transition 0.4s + opacity 1 + +html.is-animating + .transition-fade + opacity 0 + transition 0.4s + + diff --git a/source/js/layouts/categoryList.js b/source/js/layouts/categoryList.js index 2d71a40f..bd3ba548 100644 --- a/source/js/layouts/categoryList.js +++ b/source/js/layouts/categoryList.js @@ -1,69 +1,81 @@ function categoryListInit() { - var allParentElements = document.querySelectorAll(".all-category-list-item"); + var allParentElements = document.querySelectorAll( + ".all-category-list-item" + ); + if (!allParentElements) { + return; + } - let parentElements = Array.from(allParentElements).filter((item) => { - return item.parentElement.classList.contains("all-category-list"); - }); + let parentElements = Array.from(allParentElements).filter((item) => { + return item.parentElement.classList.contains("all-category-list"); + }); - // Loop through each parent element - // Set initial maxHeight and marginTop values for child elements - parentElements.forEach(function (parentElement) { - var childElements = parentElement.querySelectorAll( - ".all-category-list-child" - ); - childElements.forEach(function (childElement) { - childElement.style.maxHeight = "0px"; - childElement.style.marginTop = "0px"; - }); - }); + // Loop through each parent element + // Set initial maxHeight and marginTop values for child elements + parentElements.forEach(function (parentElement) { + var childElements = parentElement.querySelectorAll( + ".all-category-list-child" + ); + childElements.forEach(function (childElement) { + childElement.style.maxHeight = "0px"; + childElement.style.marginTop = "0px"; + }); + }); - // Loop through each parent element - parentElements.forEach(function (parentElement, index) { - // Add click event listener to the parent element - parentElement.addEventListener("click", function () { - // Toggle the display of child elements - var childElements = parentElement.querySelectorAll( - ".all-category-list-child" - ); - childElements.forEach(function (childElement) { - childElement.style.maxHeight = - childElement.style.maxHeight === "0px" ? "1000px" : "0px"; - childElement.style.marginTop = - childElement.style.marginTop === "0px" ? "15px" : "0px"; - }); + // Loop through each parent element + parentElements.forEach(function (parentElement, index) { + // Add click event listener to the parent element + parentElement.addEventListener("click", function () { + // Toggle the display of child elements + var childElements = parentElement.querySelectorAll( + ".all-category-list-child" + ); + childElements.forEach(function (childElement) { + childElement.style.maxHeight = + childElement.style.maxHeight === "0px" ? "1000px" : "0px"; + childElement.style.marginTop = + childElement.style.marginTop === "0px" ? "15px" : "0px"; + }); - // If there is a next sibling in the parentElements array, toggle its display as well - if (index % 2 === 0 && parentElements[index + 1]) { - var siblingChildElements = parentElements[index + 1].querySelectorAll( - ".all-category-list-child" - ); - siblingChildElements.forEach(function (siblingChildElement) { - siblingChildElement.style.maxHeight = - siblingChildElement.style.maxHeight === "0px" ? "1000px" : "0px"; - siblingChildElement.style.marginTop = - siblingChildElement.style.marginTop === "0px" ? "15px" : "0px"; - }); - } + // If there is a next sibling in the parentElements array, toggle its display as well + if (index % 2 === 0 && parentElements[index + 1]) { + var siblingChildElements = parentElements[ + index + 1 + ].querySelectorAll(".all-category-list-child"); + siblingChildElements.forEach(function (siblingChildElement) { + siblingChildElement.style.maxHeight = + siblingChildElement.style.maxHeight === "0px" + ? "1000px" + : "0px"; + siblingChildElement.style.marginTop = + siblingChildElement.style.marginTop === "0px" + ? "15px" + : "0px"; + }); + } - // If there is a previous sibling in the parentElements array, toggle its display as well - if (index % 2 === 1 && parentElements[index - 1]) { - var siblingChildElements = parentElements[index - 1].querySelectorAll( - ".all-category-list-child" - ); - siblingChildElements.forEach(function (siblingChildElement) { - siblingChildElement.style.maxHeight = - siblingChildElement.style.maxHeight === "0px" ? "1000px" : "0px"; - siblingChildElement.style.marginTop = - siblingChildElement.style.marginTop === "0px" ? "15px" : "0px"; - }); - } - }); - }); + // If there is a previous sibling in the parentElements array, toggle its display as well + if (index % 2 === 1 && parentElements[index - 1]) { + var siblingChildElements = parentElements[ + index - 1 + ].querySelectorAll(".all-category-list-child"); + siblingChildElements.forEach(function (siblingChildElement) { + siblingChildElement.style.maxHeight = + siblingChildElement.style.maxHeight === "0px" + ? "1000px" + : "0px"; + siblingChildElement.style.marginTop = + siblingChildElement.style.marginTop === "0px" + ? "15px" + : "0px"; + }); + } + }); + }); } +swup.on("pageView", () => { + categoryListInit(); +}); -if (Global.theme_config.global.pjax === true && Global.utils) { - categoryListInit(); -} else { - window.addEventListener('DOMContentLoaded', categoryListInit); -} +window.addEventListener("DOMContentLoaded", categoryListInit); diff --git a/source/js/layouts/toc.js b/source/js/layouts/toc.js index 408c9e4a..ef3d772c 100755 --- a/source/js/layouts/toc.js +++ b/source/js/layouts/toc.js @@ -12,7 +12,7 @@ function initTOC() { updateActiveTOCLink() { if (!Array.isArray(Global.utils.sections)) return; let index = Global.utils.sections.findIndex(element => { - return element && element.getBoundingClientRect().top - 200 > 0; + return element && element.getBoundingClientRect().top - 100 > 0; }); if (index === -1) { index = Global.utils.sections.length - 1; @@ -25,21 +25,6 @@ function initTOC() { registerTOCScroll() { Global.utils.sections = [...document.querySelectorAll('.post-toc li a.nav-link')].map(element => { const target = document.getElementById(decodeURI(element.getAttribute('href')).replace('#', '')); - element.addEventListener('click', event => { - event.preventDefault(); - const offset = target.getBoundingClientRect().top + window.scrollY; - window.anime({ - targets: document.scrollingElement, - duration: 500, - easing: 'linear', - scrollTop: offset - 10, - complete: function () { - setTimeout(() => { - Global.utils.pageTop_dom.classList.add('hide'); - }, 100) - } - }); - }); return target; }); }, @@ -56,22 +41,7 @@ function initTOC() { element.classList.remove('active', 'active-current'); }); target.classList.add('active', 'active-current'); - - // Scroll to the active TOC item - const tocElement = document.querySelector('.toc-content-container'); - const tocTop = tocElement.getBoundingClientRect().top; - const scrollTopOffset = tocElement.offsetHeight > window.innerHeight ? (tocElement.offsetHeight - window.innerHeight) / 2 : 0; - const targetTop = target.getBoundingClientRect().top - tocTop; - const viewportHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); - const distanceToCenter = targetTop - (viewportHeight / 2) + (target.offsetHeight / 2) - scrollTopOffset; - const scrollTop = tocElement.scrollTop + distanceToCenter; - - window.anime({ - targets: tocElement, - duration: 300, - easing: 'easeOutQuad', - scrollTop: scrollTop - }); + }, @@ -110,8 +80,9 @@ function initTOC() { } } -if (Global.theme_config.global.pjax === true && Global.utils) { +swup.on('pageView', () => { initTOC(); -} else { - window.addEventListener('DOMContentLoaded', initTOC); -} +}); + +window.addEventListener('DOMContentLoaded', initTOC); + diff --git a/source/js/libs/Swup.min.js b/source/js/libs/Swup.min.js new file mode 100644 index 00000000..317d0af4 --- /dev/null +++ b/source/js/libs/Swup.min.js @@ -0,0 +1,2 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t||self).Swup=e()}(this,function(){const t=function(t){let{hash:e}=void 0===t?{}:t;return location.pathname+location.search+(e?location.hash:"")},e=function(e,n){void 0===e&&(e=null),void 0===n&&(n={}),e=e||t({hash:!0});const i={...history.state,url:e,random:Math.random(),source:"swup",...n};history.replaceState(i,"",e)},n=new WeakMap;function i(t,e,i,s){if(!t&&!n.has(e))return!1;const o=n.get(e)??new WeakMap;n.set(e,o);const r=o.get(i)??new Set;o.set(i,r);const a=r.has(s);return t?r.add(s):r.delete(s),a&&t}const s=(t,e,n,s)=>{const o=new AbortController;return function(t,e,n,s={}){const{signal:o,base:r=document}=s;if(o?.aborted)return;const{once:a,...l}=s,c=r instanceof Document?r.documentElement:r,u=Boolean("object"==typeof s?s.capture:s),h=s=>{const o=function(t,e){let n=t.target;if(n instanceof Text&&(n=n.parentElement),n instanceof Element&&t.currentTarget instanceof Element){const i=n.closest(e);if(i&&t.currentTarget.contains(i))return i}}(s,t);if(o){const t=Object.assign(s,{delegateTarget:o});n.call(c,t),a&&(c.removeEventListener(e,h,l),i(!1,c,n,d))}},d=JSON.stringify({selector:t,type:e,capture:u});i(!0,c,n,d)||c.addEventListener(e,h,l),o?.addEventListener("abort",()=>{i(!1,c,n,d)})}(t,e,n,s),{destroy:()=>o.abort()}},o=function(t,e){return void 0===e&&(e=document),e.querySelector(t)},r=function(t,e){return void 0===e&&(e=document),Array.from(e.querySelectorAll(t))},a=t=>window.CSS&&window.CSS.escape?CSS.escape(t):t,l=t=>1e3*Number(t.slice(0,-1).replace(",","."));class c extends URL{constructor(t,e){void 0===e&&(e=document.baseURI),super(t.toString(),e)}get url(){return this.pathname+this.search}static fromElement(t){const e=t.getAttribute("href")||t.getAttribute("xlink:href");return new c(e)}static fromUrl(t){return new c(t)}}const u=t=>/^to-/.test(t)||["is-changing","is-rendering","is-popstate"].includes(t),h=()=>{const t=document.documentElement.className.split(" ").filter(u);document.documentElement.classList.remove(...t)};class d{constructor(t){this.pages={},this.last=null,this.swup=void 0,this.swup=t}getCacheUrl(t){return this.swup.resolveUrl(c.fromUrl(t).url)}cacheUrl(t){t.url=this.getCacheUrl(t.url),t.url in this.pages==0&&(this.pages[t.url]=t),t.responseURL=this.getCacheUrl(t.responseURL),this.last=this.pages[t.url],this.swup.log(`Cache (${Object.keys(this.pages).length})`,this.pages)}getPage(t){return t=this.getCacheUrl(t),this.pages[t]}getCurrentPage(){return this.getPage(t())}exists(t){return(t=this.getCacheUrl(t))in this.pages}empty(){this.pages={},this.last=null,this.swup.log("Cache cleared")}remove(t){delete this.pages[this.getCacheUrl(t)]}}const p=function(t){let{event:e,skipTransition:n}=void 0===t?{}:t;if(n)return this.triggerEvent("transitionEnd",e),this.cleanupAnimationClasses(),[Promise.resolve()];var i;i=()=>{this.triggerEvent("animationInStart"),document.documentElement.classList.remove("is-animating")},requestAnimationFrame(()=>{requestAnimationFrame(()=>{i()})});const s=this.getAnimationPromises("in");return Promise.all(s).then(()=>{this.triggerEvent("animationInDone"),this.triggerEvent("transitionEnd",e),this.cleanupAnimationClasses()}),s},g=t=>{if(t&&"#"===t.charAt(0)&&(t=t.substring(1)),!t)return null;const e=decodeURIComponent(t);let n=document.getElementById(t)||document.getElementById(e)||o(`a[name='${a(t)}']`)||o(`a[name='${a(e)}']`);return n||"top"!==t||(n=document.body),n};let m="transition",f="transitionend",v="animation",w="animationend";function E(t){const e=this.options.animationSelector;if(!1===e)return[Promise.resolve()];const n=r(e,document.body);if(!n.length)return console.warn(`[swup] No elements found matching animationSelector \`${e}\``),[Promise.resolve()];const i=n.map(t=>function(t){const{type:e,timeout:n,propCount:i}=function(t,e){void 0===e&&(e=null);const n=window.getComputedStyle(t),i=`${m}Duration`,s=`${v}Delay`,o=`${v}Duration`,r=n[`${m}Delay`].split(", "),a=(n[i]||"").split(", "),l=P(r,a),c=(n[s]||"").split(", "),u=(n[o]||"").split(", "),h=P(c,u);let d="",p=0,g=0;return"transition"===e?l>0&&(d="transition",p=l,g=a.length):"animation"===e?h>0&&(d="animation",p=h,g=u.length):(p=Math.max(l,h),d=p>0?l>h?"transition":"animation":null,g=d?"transition"===d?a.length:u.length:0),{type:d,timeout:p,propCount:g}}(t);if(e&&n)return new Promise(s=>{const o="transition"===e?f:w,r=performance.now();let a=0;const l=()=>{t.removeEventListener(o,c),s()},c=e=>{if(e.target===t){if(!(t=>[f,w].includes(t.type))(e))throw new Error("Not a transition or animation event.");(performance.now()-r)/1e3=i&&l()}};setTimeout(()=>{al(e)+l(t[n])))}void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(m="WebkitTransition",f="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(v="WebkitAnimation",w="webkitAnimationEnd");const S=function(t){const e=((t,e)=>{let n=document.createElement("html");n.innerHTML=t;let i=[];e.forEach(t=>{if(null==o(t,n))return console.warn(`[swup] Container ${t} not found on page.`),null;r(t).length!==r(t,n).length&&console.warn("[swup] Mismatched number of containers found on new page."),r(t).forEach((e,s)=>{r(t,n)[s].setAttribute("data-swup",String(i.length)),i.push(r(t,n)[s].outerHTML)})});const s=o("title",n)?.innerText||"",a=o("body",n)?.className;return n.innerHTML="",n=null,{title:s,pageClass:a,blocks:i,originalContent:t}})(t.responseText,this.options.containers);return e?{...e,responseURL:t.responseURL||window.location.href}:(console.warn("[swup] Received page is invalid."),null)};function b(t){const e=this.options.requestHeaders,{url:n}=t;return this.cache.exists(n)?(this.triggerEvent("pageRetrievedFromCache"),Promise.resolve(this.cache.getPage(n))):new Promise((i,s)=>{((t,e)=>{const n={url:window.location.pathname+window.location.search,method:"GET",data:null,headers:{}},{url:i,method:s,headers:o,data:r}={...n,...t},a=new XMLHttpRequest;a.onreadystatechange=function(){4===a.readyState&&e(a)},a.open(s,i,!0),Object.entries(o).forEach(t=>{let[e,n]=t;a.setRequestHeader(e,n)}),a.send(r)})({...t,headers:e},t=>{if(500===t.status)return this.triggerEvent("serverError"),void s(n);const e=this.getPageData(t);if(!e||!e.blocks.length)return void s(n);const o={...e,url:n};this.cache.cacheUrl(o),this.triggerEvent("pageLoaded"),i(o)})})}const y=function(t){let{event:e,skipTransition:n}=void 0===t?{}:t;const i=e instanceof PopStateEvent;if(n)return this.triggerEvent("animationSkipped"),[Promise.resolve()];this.triggerEvent("animationOutStart"),document.documentElement.classList.add("is-changing","is-leaving","is-animating"),i&&document.documentElement.classList.add("is-popstate");const s=this.getAnimationPromises("out");return Promise.all(s).then(()=>{this.triggerEvent("animationOutDone")}),s};function k(t){const{url:e}=t;this.shouldIgnoreVisit(e)?window.location.href=e:this.performPageLoad(t)}function U(n){const{url:i,event:s,customTransition:o,history:r="push"}=n??{},a=s instanceof PopStateEvent,l=this.shouldSkipTransition({url:i,event:s});var c;this.triggerEvent("transitionStart",s),this.updateTransition(t(),i,o),null!=o&&document.documentElement.classList.add(`to-${c=o,String(c).toLowerCase().replace(/[\s/_.]+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")||""}`);const u=this.leavePage({event:s,skipTransition:l}),h=this.fetchPage(n);if(!a){const n=i+(this.scrollToElement||"");"replace"===r?e(n):function(e,n){void 0===n&&(n={});const i={url:e=e||t({hash:!0}),random:Math.random(),source:"swup",...n};history.pushState(i,"",e)}(n)}this.currentPageUrl=t(),Promise.all([h,...u]).then(t=>{let[e]=t;this.renderPage(e,{event:s,skipTransition:l})}).catch(t=>{void 0!==t&&(this.options.skipPopStateHandling=()=>(window.location=t,!0),history.go(-1))})}const L=function(t){let{blocks:e,title:n}=t;return e.forEach((t,e)=>{document.body.querySelector(`[data-swup="${e}"]`).outerHTML=t}),document.title=n,Promise.resolve()};function T(t,e){const n=this._handlers[t];n?n.push(e):console.warn(`Unsupported event ${t}.`)}function C(t,e){if(t&&e){const n=this._handlers[t];n.includes(e)?this._handlers[t]=n.filter(t=>t!==e):console.warn(`Handler for event '${t}' not found.`)}else t?this._handlers[t]=[]:Object.keys(this._handlers).forEach(t=>{this._handlers[t]=[]})}function H(t,e){this._handlers[t].forEach(t=>{try{t(e)}catch(t){console.error(t)}});const n=new CustomEvent(`swup:${t}`,{detail:t});document.dispatchEvent(n)}const R=function(t){if(t?.isSwupPlugin){if(t.swup=this,!t._checkRequirements||t._checkRequirements())return t._beforeMount&&t._beforeMount(),t.mount(),this.plugins.push(t),this.plugins}else console.error("Not a swup plugin instance",t)};function A(t){const e=this.findPlugin(t);if(e)return e.unmount(),e._afterUnmount&&e._afterUnmount(),this.plugins=this.plugins.filter(t=>t!==e),this.plugins;console.error("No such plugin",e)}function $(t){return this.plugins.find(e=>e===t||e.name===t)}const _=function(n,i){let{event:s,skipTransition:o}=void 0===i?{}:i;if(document.documentElement.classList.remove("is-leaving"),!this.isSameResolvedUrl(t(),n.url))return;const{url:r}=c.fromUrl(n.responseURL);this.isSameResolvedUrl(t(),r)||(this.cache.cacheUrl({...n,url:r}),this.currentPageUrl=t(),e(r)),o||document.documentElement.classList.add("is-rendering"),this.triggerEvent("willReplaceContent",s),this.replaceContent(n).then(()=>{this.triggerEvent("contentReplaced",s),this.triggerEvent("pageView",s),this.options.cache||this.cache.empty(),this.enterPage({event:s,skipTransition:o}),this.scrollToElement=null})};function x(t,e,n){this.transition={from:t,to:e,custom:n}}function I(t){let{event:e}=t;return!(!(e instanceof PopStateEvent)||this.options.animateHistoryBrowsing)}return class{constructor(e){void 0===e&&(e={}),this.version="3.1.1",this._handlers={animationInDone:[],animationInStart:[],animationOutDone:[],animationOutStart:[],animationSkipped:[],clickLink:[],contentReplaced:[],disabled:[],enabled:[],openPageInNewTab:[],pageLoaded:[],pageRetrievedFromCache:[],pageView:[],popState:[],samePage:[],samePageWithHash:[],serverError:[],transitionStart:[],transitionEnd:[],willReplaceContent:[]},this.scrollToElement=null,this.options=void 0,this.plugins=[],this.transition={},this.cache=void 0,this.currentPageUrl=t(),this.delegatedListeners={},this.boundPopStateHandler=void 0,this.loadPage=k,this.performPageLoad=U,this.leavePage=y,this.renderPage=_,this.replaceContent=L,this.enterPage=p,this.triggerEvent=H,this.delegateEvent=s,this.on=T,this.off=C,this.updateTransition=x,this.shouldSkipTransition=I,this.getAnimationPromises=E,this.getPageData=S,this.fetchPage=b,this.getAnchorElement=g,this.log=()=>{},this.use=R,this.unuse=A,this.findPlugin=$,this.getCurrentUrl=t,this.cleanupAnimationClasses=h,this.defaults={animateHistoryBrowsing:!1,animationSelector:'[class*="transition-"]',cache:!0,containers:["#swup"],ignoreVisit:function(t,e){let{el:n}=void 0===e?{}:e;return!!n?.closest("[data-no-swup]")},linkSelector:"a[href]",plugins:[],resolveUrl:t=>t,requestHeaders:{"X-Requested-With":"swup",Accept:"text/html, application/xhtml+xml"},skipPopStateHandling:t=>"swup"!==t.state?.source},this.options={...this.defaults,...e},this.boundPopStateHandler=this.popStateHandler.bind(this),this.cache=new d(this),this.enable()}enable(){"undefined"!=typeof Promise?(this.delegatedListeners.click=s(this.options.linkSelector,"click",this.linkClickHandler.bind(this)),window.addEventListener("popstate",this.boundPopStateHandler),((t,e)=>{let n=0;this.options.containers.forEach(e=>{null==o(e,t)?console.warn(`[swup] Container ${e} not found on page.`):r(e).forEach((i,s)=>{r(e,t)[s].setAttribute("data-swup",String(n)),n++})})})(document.documentElement),this.options.plugins.forEach(t=>this.use(t)),e(),this.triggerEvent("enabled"),document.documentElement.classList.add("swup-enabled"),this.triggerEvent("pageView")):console.warn("Promise is not supported")}destroy(){this.delegatedListeners.click.destroy(),window.removeEventListener("popstate",this.boundPopStateHandler),this.cache.empty(),this.options.plugins.forEach(t=>{this.unuse(t)}),r("[data-swup]").forEach(t=>{t.removeAttribute("data-swup")}),this.off(),this.triggerEvent("disabled"),document.documentElement.classList.remove("swup-enabled")}shouldIgnoreVisit(t,e){let{el:n,event:i}=void 0===e?{}:e;const{origin:s,url:o,hash:r}=c.fromUrl(t);return s!==window.location.origin||!(!n||!this.triggerWillOpenNewWindow(n))||!!this.options.ignoreVisit(o+r,{el:n,event:i})}linkClickHandler(e){const n=e.delegateTarget,{href:i,url:s,hash:o}=c.fromElement(n);if(this.shouldIgnoreVisit(i,{el:n,event:e}))return;if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return void this.triggerEvent("openPageInNewTab",e);if(0!==e.button)return;if(this.triggerEvent("clickLink",e),e.preventDefault(),!s||s===t())return void this.handleLinkToSamePage(s,o,e);if(this.isSameResolvedUrl(s,t()))return;this.scrollToElement=o||null;const r=n.getAttribute("data-swup-transition")||void 0;let a;const l=n.getAttribute("data-swup-history");l&&["push","replace"].includes(l)&&(a=l),this.performPageLoad({url:s,customTransition:r,history:a})}handleLinkToSamePage(t,n,i){if(n){if(this.triggerEvent("samePageWithHash",i),!g(n))return console.warn(`Element for offset not found (#${n})`);e(t+n)}else this.triggerEvent("samePage",i)}triggerWillOpenNewWindow(t){return!!t.matches('[download], [target="_blank"]')}popStateHandler(e){if(this.options.skipPopStateHandling(e))return;if(this.isSameResolvedUrl(t(),this.currentPageUrl))return;const n=e.state?.url??location.href;if(this.shouldIgnoreVisit(n,{event:e}))return;const{url:i,hash:s}=c.fromUrl(n);s?this.scrollToElement=s:e.preventDefault(),this.triggerEvent("popState",e),this.options.animateHistoryBrowsing||(document.documentElement.classList.remove("is-animating"),h()),this.performPageLoad({url:i,event:e})}resolveUrl(t){if("function"!=typeof this.options.resolveUrl)return console.warn("[swup] options.resolveUrl expects a callback function."),t;const e=this.options.resolveUrl(t);return e&&"string"==typeof e?e.startsWith("//")||e.startsWith("http")?(console.warn("[swup] options.resolveUrl needs to return a relative url"),t):e:(console.warn("[swup] options.resolveUrl needs to return a url"),t)}isSameResolvedUrl(t,e){return this.resolveUrl(t)===this.resolveUrl(e)}}}); +//# sourceMappingURL=Swup.min.js.map diff --git a/source/js/libs/Swup.min.js.map b/source/js/libs/Swup.min.js.map new file mode 100644 index 00000000..ccc90475 --- /dev/null +++ b/source/js/libs/Swup.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Swup.umd.js","sources":["../src/helpers/classify.ts","../src/helpers/getCurrentUrl.ts","../src/helpers/updateHistoryRecord.ts","../node_modules/delegate-it/delegate.js","../src/helpers/delegateEvent.ts","../src/utils/index.ts","../src/helpers/Location.ts","../src/helpers/markSwupElements.ts","../src/helpers/cleanupAnimationClasses.ts","../src/modules/Cache.ts","../src/modules/enterPage.ts","../src/modules/getAnchorElement.ts","../src/modules/getAnimationPromises.ts","../src/modules/getPageData.ts","../src/helpers/getDataFromHtml.ts","../src/modules/fetchPage.ts","../src/helpers/fetch.ts","../src/modules/leavePage.ts","../src/modules/loadPage.ts","../src/helpers/createHistoryRecord.ts","../src/modules/replaceContent.ts","../src/modules/events.ts","../src/modules/plugins.ts","../src/modules/renderPage.ts","../src/modules/transitions.ts","../src/Swup.ts"],"sourcesContent":["export const classify = (text: string, fallback?: string): string => {\n\tconst output = String(text)\n\t\t.toLowerCase()\n\t\t// .normalize('NFD') // split an accented letter in the base letter and the acent\n\t\t// .replace(/[\\u0300-\\u036f]/g, '') // remove all previously split accents\n\t\t.replace(/[\\s/_.]+/g, '-') // replace spaces and _./ with '-'\n\t\t.replace(/[^\\w-]+/g, '') // remove all non-word chars\n\t\t.replace(/--+/g, '-') // replace repeating '-' with single '-'\n\t\t.replace(/^-+|-+$/g, ''); // trim '-' from edges\n\treturn output || fallback || '';\n};\n","export const getCurrentUrl = ({ hash }: { hash?: boolean } = {}): string => {\n\treturn location.pathname + location.search + (hash ? location.hash : '');\n};\n","import { getCurrentUrl } from './getCurrentUrl.js';\n\nexport const updateHistoryRecord = (\n\turl: string | null = null,\n\tcustomData: Record = {}\n): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst data = {\n\t\t...history.state,\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...customData\n\t};\n\thistory.replaceState(data, '', url);\n};\n","/** Keeps track of raw listeners added to the base elements to avoid duplication */\nconst ledger = new WeakMap();\nfunction editLedger(wanted, baseElement, callback, setup) {\n if (!wanted && !ledger.has(baseElement)) {\n return false;\n }\n const elementMap = ledger.get(baseElement)\n ?? new WeakMap();\n ledger.set(baseElement, elementMap);\n const setups = elementMap.get(callback) ?? new Set();\n elementMap.set(callback, setups);\n const existed = setups.has(setup);\n if (wanted) {\n setups.add(setup);\n }\n else {\n setups.delete(setup);\n }\n return existed && wanted;\n}\nfunction safeClosest(event, selector) {\n let target = event.target;\n if (target instanceof Text) {\n target = target.parentElement;\n }\n if (target instanceof Element && event.currentTarget instanceof Element) {\n // `.closest()` may match ancestors of `currentTarget` but we only need its children\n const closest = target.closest(selector);\n if (closest && event.currentTarget.contains(closest)) {\n return closest;\n }\n }\n}\n// This type isn't exported as a declaration, so it needs to be duplicated above\nfunction delegate(selector, type, callback, options = {}) {\n const { signal, base = document } = options;\n if (signal?.aborted) {\n return;\n }\n // Don't pass `once` to `addEventListener` because it needs to be handled in `delegate-it`\n const { once, ...nativeListenerOptions } = options;\n // `document` should never be the base, it's just an easy way to define \"global event listeners\"\n const baseElement = base instanceof Document ? base.documentElement : base;\n // Handle the regular Element usage\n const capture = Boolean(typeof options === 'object' ? options.capture : options);\n const listenerFn = (event) => {\n const delegateTarget = safeClosest(event, selector);\n if (delegateTarget) {\n const delegateEvent = Object.assign(event, { delegateTarget });\n callback.call(baseElement, delegateEvent);\n if (once) {\n baseElement.removeEventListener(type, listenerFn, nativeListenerOptions);\n editLedger(false, baseElement, callback, setup);\n }\n }\n };\n const setup = JSON.stringify({ selector, type, capture });\n const isAlreadyListening = editLedger(true, baseElement, callback, setup);\n if (!isAlreadyListening) {\n baseElement.addEventListener(type, listenerFn, nativeListenerOptions);\n }\n signal?.addEventListener('abort', () => {\n editLedger(false, baseElement, callback, setup);\n });\n}\nexport default delegate;\n","import delegate, { DelegateEventHandler, DelegateOptions, EventType } from 'delegate-it';\nimport { ParseSelector } from 'typed-query-selector/parser.js';\n\nexport type Unsubscribe = {\n\tdestroy: () => void;\n};\n\nexport const delegateEvent = (\n\tselector: Selector,\n\ttype: TEvent,\n\tcallback: DelegateEventHandler,\n\toptions?: DelegateOptions\n): Unsubscribe => {\n\tconst controller = new AbortController();\n\tdelegate, TEvent>(\n\t\tselector,\n\t\ttype,\n\t\tcallback,\n\t\toptions\n\t);\n\treturn { destroy: () => controller.abort() };\n};\n","export const query = (selector: string, context: Document | Element = document) => {\n\treturn context.querySelector(selector);\n};\n\nexport const queryAll = (\n\tselector: string,\n\tcontext: Document | Element = document\n): HTMLElement[] => {\n\treturn Array.from(context.querySelectorAll(selector));\n};\n\nexport const nextTick = (callback: () => void) => {\n\trequestAnimationFrame(() => {\n\t\trequestAnimationFrame(() => {\n\t\t\tcallback();\n\t\t});\n\t});\n};\n\nexport const escapeCssIdentifier = (ident: string) => {\n\t// @ts-ignore this is for support check, so it's correct that TS complains\n\tif (window.CSS && window.CSS.escape) {\n\t\treturn CSS.escape(ident);\n\t} else {\n\t\treturn ident;\n\t}\n};\n\n// Fix for Chrome below v61 formatting CSS floats with comma in some locales\nexport const toMs = (s: string) => {\n\treturn Number(s.slice(0, -1).replace(',', '.')) * 1000;\n};\n","/**\n * A helper for creating a Location from either an element\n * or a URL object/string\n *\n */\n\nexport class Location extends URL {\n\tconstructor(url: string, base: string = document.baseURI) {\n\t\tsuper(url.toString(), base);\n\t}\n\n\tget url() {\n\t\treturn this.pathname + this.search;\n\t}\n\n\t/**\n\t * Instantiate a Location from an element's href attribute\n\t * @param {Element} el\n\t * @return new Location instance\n\t */\n\tstatic fromElement(el: HTMLAnchorElement): Location {\n\t\tconst href = el.getAttribute('href') || el.getAttribute('xlink:href');\n\t\treturn new Location(href!);\n\t}\n\n\t/**\n\t * Instantiate a Location from a URL object or string\n\t * @param {URL|string} url\n\t * @return new Location instance\n\t */\n\tstatic fromUrl(url: string): Location {\n\t\treturn new Location(url);\n\t}\n}\n","import { query, queryAll } from '../utils.js';\n\nexport const markSwupElements = (element: Element, containers: string[]): void => {\n\tlet blocks = 0;\n\n\tcontainers.forEach((selector) => {\n\t\tif (query(selector, element) == null) {\n\t\t\tconsole.warn(`[swup] Container ${selector} not found on page.`);\n\t\t} else {\n\t\t\tqueryAll(selector).forEach((item: Element, index: number) => {\n\t\t\t\tqueryAll(selector, element)[index].setAttribute('data-swup', String(blocks));\n\t\t\t\tblocks++;\n\t\t\t});\n\t\t}\n\t});\n};\n","export const isSwupClass = (className: string): boolean =>\n\t/^to-/.test(className) || ['is-changing', 'is-rendering', 'is-popstate'].includes(className);\n\nexport const cleanupAnimationClasses = (): void => {\n\tconst htmlClasses = document.documentElement.className.split(' ');\n\tconst removeClasses = htmlClasses.filter(isSwupClass);\n\tdocument.documentElement.classList.remove(...removeClasses);\n};\n","import { getCurrentUrl, Location } from '../helpers.js';\nimport Swup from '../Swup.js';\nimport { PageData } from './getPageData.js';\n\nexport interface PageRecord extends PageData {\n\turl: string;\n\tresponseURL: string;\n}\nexport class Cache {\n\tpages: Record = {};\n\tlast: PageRecord | null = null;\n\tswup: Swup;\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\tgetCacheUrl(url: string): string {\n\t\treturn this.swup.resolveUrl(Location.fromUrl(url).url);\n\t}\n\n\tcacheUrl(page: PageRecord) {\n\t\tpage.url = this.getCacheUrl(page.url);\n\t\tif (page.url in this.pages === false) {\n\t\t\tthis.pages[page.url] = page;\n\t\t}\n\t\tpage.responseURL = this.getCacheUrl(page.responseURL);\n\t\tthis.last = this.pages[page.url];\n\t\tthis.swup.log(`Cache (${Object.keys(this.pages).length})`, this.pages);\n\t}\n\n\tgetPage(url: string): PageRecord {\n\t\turl = this.getCacheUrl(url);\n\t\treturn this.pages[url];\n\t}\n\n\tgetCurrentPage(): PageRecord {\n\t\treturn this.getPage(getCurrentUrl());\n\t}\n\n\texists(url: string): boolean {\n\t\turl = this.getCacheUrl(url);\n\t\treturn url in this.pages;\n\t}\n\n\tempty(): void {\n\t\tthis.pages = {};\n\t\tthis.last = null;\n\t\tthis.swup.log('Cache cleared');\n\t}\n\n\tremove(url: string): void {\n\t\tdelete this.pages[this.getCacheUrl(url)];\n\t}\n}\n","import { nextTick } from '../utils.js';\nimport Swup from '../Swup.js';\nimport { PageRenderOptions } from './renderPage.js';\n\nexport const enterPage = function (this: Swup, { event, skipTransition }: PageRenderOptions = {}) {\n\tif (skipTransition) {\n\t\tthis.triggerEvent('transitionEnd', event);\n\t\tthis.cleanupAnimationClasses();\n\t\treturn [Promise.resolve()];\n\t}\n\n\tnextTick(() => {\n\t\tthis.triggerEvent('animationInStart');\n\t\tdocument.documentElement.classList.remove('is-animating');\n\t});\n\n\tconst animationPromises = this.getAnimationPromises('in');\n\tPromise.all(animationPromises).then(() => {\n\t\tthis.triggerEvent('animationInDone');\n\t\tthis.triggerEvent('transitionEnd', event);\n\t\tthis.cleanupAnimationClasses();\n\t});\n\treturn animationPromises;\n};\n","import { escapeCssIdentifier as escape, query } from '../utils.js';\n\n/**\n * Find the anchor element for a given hash.\n * @see https://html.spec.whatwg.org/#find-a-potential-indicated-element\n *\n * @param hash Hash with or without leading '#'\n * @returns The element, if found, or null.\n */\nexport const getAnchorElement = (hash: string): Element | null => {\n\tif (hash && hash.charAt(0) === '#') {\n\t\thash = hash.substring(1);\n\t}\n\n\tif (!hash) {\n\t\treturn null;\n\t}\n\n\tconst decoded = decodeURIComponent(hash);\n\tlet element =\n\t\tdocument.getElementById(hash) ||\n\t\tdocument.getElementById(decoded) ||\n\t\tquery(`a[name='${escape(hash)}']`) ||\n\t\tquery(`a[name='${escape(decoded)}']`);\n\n\tif (!element && hash === 'top') {\n\t\telement = document.body;\n\t}\n\n\treturn element;\n};\n","import { queryAll, toMs } from '../utils.js';\nimport Swup from '../Swup.js';\n\n// Transition property/event sniffing\nlet transitionProp = 'transition';\nlet transitionEndEvent = 'transitionend';\nlet animationProp = 'animation';\nlet animationEndEvent = 'animationend';\n\nif (window.ontransitionend === undefined && window.onwebkittransitionend !== undefined) {\n\ttransitionProp = 'WebkitTransition';\n\ttransitionEndEvent = 'webkitTransitionEnd';\n}\n\nif (window.onanimationend === undefined && window.onwebkitanimationend !== undefined) {\n\tanimationProp = 'WebkitAnimation';\n\tanimationEndEvent = 'webkitAnimationEnd';\n}\n\nexport function getAnimationPromises(\n\tthis: Swup,\n\t// we don't use this argument, but JS plugin depends on it with\n\t// its own version of getAnimationPromises, so it must be specified when\n\t// getAnimationPromises is being used\n\tanimationType: 'in' | 'out'\n): Promise[] {\n\tconst selector = this.options.animationSelector;\n\n\t// Allow usage of swup without animations\n\tif (selector === false) {\n\t\t// Use array of a single resolved promise instead of an empty array to allow\n\t\t// possible future use with Promise.race() which requires an actual value\n\t\treturn [Promise.resolve()];\n\t}\n\n\tconst animatedElements = queryAll(selector, document.body);\n\n\t// Warn if no elements match the animationSelector, but keep things going\n\tif (!animatedElements.length) {\n\t\tconsole.warn(`[swup] No elements found matching animationSelector \\`${selector}\\``);\n\t\treturn [Promise.resolve()];\n\t}\n\n\tconst animationPromises = animatedElements\n\t\t.map((element) => getAnimationPromiseForElement(element))\n\t\t.filter(Boolean) as Promise[];\n\n\tif (!animationPromises.length) {\n\t\tconsole.warn(\n\t\t\t`[swup] No CSS animation duration defined on elements matching \\`${selector}\\``\n\t\t);\n\t\treturn [Promise.resolve()];\n\t}\n\n\treturn animationPromises;\n}\n\nconst isTransitionOrAnimationEvent = (event: any): event is TransitionEvent | AnimationEvent =>\n\t[transitionEndEvent, animationEndEvent].includes(event.type);\n\nfunction getAnimationPromiseForElement(element: Element): Promise | undefined {\n\tconst { type, timeout, propCount } = getTransitionInfo(element);\n\n\t// Resolve immediately if no transition defined\n\tif (!type || !timeout) {\n\t\treturn undefined;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tconst endEvent = type === 'transition' ? transitionEndEvent : animationEndEvent;\n\t\tconst startTime = performance.now();\n\t\tlet propsTransitioned = 0;\n\n\t\tconst end = () => {\n\t\t\telement.removeEventListener(endEvent, onEnd);\n\t\t\tresolve();\n\t\t};\n\n\t\tconst onEnd: EventListener = (event) => {\n\t\t\t// Skip transitions on child elements\n\t\t\tif (event.target !== element) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!isTransitionOrAnimationEvent(event)) {\n\t\t\t\tthrow new Error('Not a transition or animation event.');\n\t\t\t}\n\n\t\t\t// Skip transitions that happened before we started listening\n\t\t\tconst elapsedTime = (performance.now() - startTime) / 1000;\n\t\t\tif (elapsedTime < event.elapsedTime) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// End if all properties have transitioned\n\t\t\tif (++propsTransitioned >= propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t};\n\n\t\tsetTimeout(() => {\n\t\t\tif (propsTransitioned < propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t}, timeout + 1);\n\n\t\telement.addEventListener(endEvent, onEnd);\n\t});\n}\n\nexport function getTransitionInfo(\n\telement: Element,\n\texpectedType: 'animation' | 'transition' | null = null\n) {\n\tconst styles = window.getComputedStyle(element);\n\n\t// not sure what to do about the below mess other than casting, but it's a mess\n\tconst transitionDelay = `${transitionProp}Delay` as keyof CSSStyleDeclaration;\n\tconst transitionDuration = `${transitionProp}Duration` as keyof CSSStyleDeclaration;\n\tconst animationDelay = `${animationProp}Delay` as keyof CSSStyleDeclaration;\n\tconst animationDuration = `${animationProp}Duration` as keyof CSSStyleDeclaration;\n\n\tconst transitionDelays = (\n\t\tstyles[transitionDelay] as CSSStyleDeclaration['transitionDelay']\n\t).split(', ');\n\tconst transitionDurations = (\n\t\t(styles[transitionDuration] || '') as CSSStyleDeclaration['transitionDuration']\n\t).split(', ');\n\tconst transitionTimeout = calculateTimeout(transitionDelays, transitionDurations);\n\n\tconst animationDelays = (\n\t\t(styles[animationDelay] || '') as CSSStyleDeclaration['animationDelay']\n\t).split(', ');\n\tconst animationDurations = (\n\t\t(styles[animationDuration] || '') as CSSStyleDeclaration['animationDuration']\n\t).split(', ');\n\tconst animationTimeout = calculateTimeout(animationDelays, animationDurations);\n\n\tlet type: string | null = '';\n\tlet timeout = 0;\n\tlet propCount = 0;\n\n\tif (expectedType === 'transition') {\n\t\tif (transitionTimeout > 0) {\n\t\t\ttype = 'transition';\n\t\t\ttimeout = transitionTimeout;\n\t\t\tpropCount = transitionDurations.length;\n\t\t}\n\t} else if (expectedType === 'animation') {\n\t\tif (animationTimeout > 0) {\n\t\t\ttype = 'animation';\n\t\t\ttimeout = animationTimeout;\n\t\t\tpropCount = animationDurations.length;\n\t\t}\n\t} else {\n\t\ttimeout = Math.max(transitionTimeout, animationTimeout);\n\t\ttype =\n\t\t\ttimeout > 0\n\t\t\t\t? transitionTimeout > animationTimeout\n\t\t\t\t\t? 'transition'\n\t\t\t\t\t: 'animation'\n\t\t\t\t: null;\n\t\tpropCount = type\n\t\t\t? type === 'transition'\n\t\t\t\t? transitionDurations.length\n\t\t\t\t: animationDurations.length\n\t\t\t: 0;\n\t}\n\n\treturn {\n\t\ttype,\n\t\ttimeout,\n\t\tpropCount\n\t};\n}\n\nfunction calculateTimeout(delays: string[], durations: string[]) {\n\twhile (delays.length < durations.length) {\n\t\tdelays = delays.concat(delays);\n\t}\n\n\treturn Math.max(...durations.map((duration, i) => toMs(duration) + toMs(delays[i])));\n}\n","import { getDataFromHtml } from '../helpers.js';\nimport Swup from '../Swup.js';\nimport { PageHtmlData } from '../helpers/getDataFromHtml.js';\n\nexport type PageData = PageHtmlData & {\n\tresponseURL: string;\n};\nexport const getPageData = function (this: Swup, request: XMLHttpRequest): PageData | null {\n\t// this method can be replaced in case other content than html is expected to be received from server\n\t// this function should always return { title, pageClass, originalContent, blocks, responseURL }\n\t// in case page has invalid structure - return null\n\tconst html = request.responseText;\n\tconst pageHtmlData = getDataFromHtml(html, this.options.containers);\n\n\tif (!pageHtmlData) {\n\t\tconsole.warn('[swup] Received page is invalid.');\n\t\treturn null;\n\t}\n\n\treturn {\n\t\t...pageHtmlData,\n\t\tresponseURL: request.responseURL || window.location.href\n\t};\n};\n","import { query, queryAll } from '../utils.js';\n\nexport type PageHtmlData = {\n\ttitle: string;\n\toriginalContent: string;\n\tblocks: string[];\n\tpageClass?: string;\n};\n\nexport const getDataFromHtml = (html: string, containers: string[]): PageHtmlData => {\n\tlet fakeDom = document.createElement('html');\n\tfakeDom.innerHTML = html;\n\tlet blocks: string[] = [];\n\n\tcontainers.forEach((selector) => {\n\t\tif (query(selector, fakeDom) == null) {\n\t\t\tconsole.warn(`[swup] Container ${selector} not found on page.`);\n\t\t\treturn null;\n\t\t} else {\n\t\t\tif (queryAll(selector).length !== queryAll(selector, fakeDom).length) {\n\t\t\t\tconsole.warn(`[swup] Mismatched number of containers found on new page.`);\n\t\t\t}\n\t\t\tqueryAll(selector).forEach((item, index) => {\n\t\t\t\tqueryAll(selector, fakeDom)[index].setAttribute('data-swup', String(blocks.length));\n\t\t\t\tblocks.push(queryAll(selector, fakeDom)[index].outerHTML);\n\t\t\t});\n\t\t}\n\t});\n\n\tconst title = query('title', fakeDom)?.innerText || '';\n\tconst pageClass = query('body', fakeDom)?.className;\n\n\t// to prevent memory leaks\n\tfakeDom.innerHTML = '';\n\t// @ts-ignore don't want to type it as possible null, since it's created at the top of the function always\n\tfakeDom = null;\n\n\treturn { title, pageClass, blocks, originalContent: html };\n};\n","import Swup from '../Swup.js';\nimport { fetch } from '../helpers.js';\nimport { TransitionOptions } from './loadPage.js';\nimport { PageRecord } from './Cache.js';\n\nexport function fetchPage(this: Swup, data: TransitionOptions): Promise {\n\tconst headers = this.options.requestHeaders;\n\tconst { url } = data;\n\n\tif (this.cache.exists(url)) {\n\t\tthis.triggerEvent('pageRetrievedFromCache');\n\t\treturn Promise.resolve(this.cache.getPage(url));\n\t}\n\n\treturn new Promise((resolve, reject) => {\n\t\tfetch({ ...data, headers }, (response) => {\n\t\t\tif (response.status === 500) {\n\t\t\t\tthis.triggerEvent('serverError');\n\t\t\t\treject(url);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// get json data\n\t\t\tconst page = this.getPageData(response);\n\t\t\tif (!page || !page.blocks.length) {\n\t\t\t\treject(url);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// render page\n\t\t\tconst cacheablePageData = { ...page, url };\n\t\t\tthis.cache.cacheUrl(cacheablePageData);\n\t\t\tthis.triggerEvent('pageLoaded');\n\t\t\tresolve(cacheablePageData);\n\t\t});\n\t});\n}\n","import { TransitionOptions } from '../modules/loadPage.js';\nimport { Options } from '../Swup.js';\n\nexport const fetch = (\n\toptions: TransitionOptions & { headers: Options['requestHeaders'] },\n\tcallback: (request: XMLHttpRequest) => void\n): XMLHttpRequest => {\n\tconst defaults = {\n\t\turl: window.location.pathname + window.location.search,\n\t\tmethod: 'GET',\n\t\tdata: null,\n\t\theaders: {}\n\t};\n\n\tconst { url, method, headers, data } = { ...defaults, ...options };\n\n\tconst request = new XMLHttpRequest();\n\n\trequest.onreadystatechange = function () {\n\t\tif (request.readyState === 4) {\n\t\t\t// if (request.status === 500) {} else {}\n\t\t\tcallback(request);\n\t\t}\n\t};\n\n\trequest.open(method, url, true);\n\tObject.entries(headers).forEach(([key, header]) => {\n\t\trequest.setRequestHeader(key, header);\n\t});\n\trequest.send(data);\n\n\treturn request;\n};\n","import Swup from '../Swup.js';\nimport { PageRenderOptions } from './renderPage.js';\n\nexport const leavePage = function (this: Swup, { event, skipTransition }: PageRenderOptions = {}) {\n\tconst isHistoryVisit = event instanceof PopStateEvent;\n\n\tif (skipTransition) {\n\t\tthis.triggerEvent('animationSkipped');\n\t\treturn [Promise.resolve()];\n\t}\n\n\tthis.triggerEvent('animationOutStart');\n\n\t// handle classes\n\tdocument.documentElement.classList.add('is-changing', 'is-leaving', 'is-animating');\n\tif (isHistoryVisit) {\n\t\tdocument.documentElement.classList.add('is-popstate');\n\t}\n\n\t// animation promise stuff\n\tconst animationPromises: Promise[] = this.getAnimationPromises('out');\n\tPromise.all(animationPromises).then(() => {\n\t\tthis.triggerEvent('animationOutDone');\n\t});\n\n\treturn animationPromises;\n};\n","import { classify, createHistoryRecord, updateHistoryRecord, getCurrentUrl } from '../helpers.js';\nimport Swup from '../Swup.js';\nimport { PageRecord } from './Cache.js';\n\nexport type HistoryAction = 'push' | 'replace';\n\nexport type TransitionOptions = {\n\turl: string;\n\tcustomTransition?: string;\n\thistory?: HistoryAction;\n};\n\nexport type PageLoadOptions = {\n\turl: string;\n\tcustomTransition?: string;\n\thistory?: HistoryAction;\n\tevent?: PopStateEvent;\n};\n\nexport function loadPage(this: Swup, data: TransitionOptions) {\n\tconst { url } = data;\n\n\t// Check if the visit should be ignored\n\tif (this.shouldIgnoreVisit(url)) {\n\t\twindow.location.href = url;\n\t} else {\n\t\tthis.performPageLoad(data);\n\t}\n}\n\nexport function performPageLoad(this: Swup, data: PageLoadOptions) {\n\tconst { url, event, customTransition, history: historyAction = 'push' } = data ?? {};\n\n\tconst isHistoryVisit = event instanceof PopStateEvent;\n\tconst skipTransition = this.shouldSkipTransition({ url, event });\n\n\tthis.triggerEvent('transitionStart', event);\n\n\t// set transition object\n\tthis.updateTransition(getCurrentUrl(), url, customTransition);\n\tif (customTransition != null) {\n\t\tdocument.documentElement.classList.add(`to-${classify(customTransition)}`);\n\t}\n\n\t// start/skip animation\n\tconst animationPromises = this.leavePage({ event, skipTransition });\n\n\t// Load page data\n\tconst fetchPromise = this.fetchPage(data);\n\n\t// create history record if this is not a popstate call (with or without anchor)\n\tif (!isHistoryVisit) {\n\t\tconst historyUrl = url + (this.scrollToElement || '');\n\t\tif (historyAction === 'replace') {\n\t\t\tupdateHistoryRecord(historyUrl);\n\t\t} else {\n\t\t\tcreateHistoryRecord(historyUrl);\n\t\t}\n\t}\n\n\tthis.currentPageUrl = getCurrentUrl();\n\n\t// when everything is ready, render the page\n\tPromise.all([fetchPromise, ...animationPromises])\n\t\t.then(([pageData]) => {\n\t\t\tthis.renderPage(pageData as PageRecord, { event, skipTransition });\n\t\t})\n\t\t.catch((errorUrl) => {\n\t\t\t// Return early if errorUrl is not defined (probably aborted preload request)\n\t\t\tif (errorUrl === undefined) return;\n\n\t\t\t// Rewrite `skipPopStateHandling` to redirect manually when `history.go` is processed\n\t\t\tthis.options.skipPopStateHandling = () => {\n\t\t\t\twindow.location = errorUrl;\n\t\t\t\treturn true;\n\t\t\t};\n\n\t\t\t// Go back to the actual page we're still at\n\t\t\thistory.go(-1);\n\t\t});\n}\n","import { getCurrentUrl } from './getCurrentUrl.js';\n\nexport const createHistoryRecord = (\n\turl: string,\n\tcustomData: Record = {}\n): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst data = {\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...customData\n\t};\n\thistory.pushState(data, '', url);\n};\n","/**\n * Perform the replacement of content after loading a page.\n *\n * This method can be replaced or augmented by plugins to allow pausing.\n *\n * It takes an object with the page data as return from `getPageData` and has to\n * return a Promise that resolves once all content has been replaced and the\n * site is ready to start animating in the new page.\n *\n * @param {object} page The page object\n * @returns Promise\n */\nexport const replaceContent = function ({ blocks, title }: { blocks: string[]; title: string }) {\n\t// Replace content blocks\n\tblocks.forEach((html, i) => {\n\t\t// we know the block exists at this point\n\t\tconst block = document.body.querySelector(`[data-swup=\"${i}\"]`)!;\n\t\tblock.outerHTML = html;\n\t});\n\n\t// Update browser title\n\tdocument.title = title;\n\n\t// Return a Promise to allow plugins to defer\n\treturn Promise.resolve();\n};\n","import Swup from '../Swup.js';\nimport { DelegateEvent } from 'delegate-it';\n\ntype HandlersEventMap = {\n\tanimationInDone: undefined;\n\tanimationInStart: undefined;\n\tanimationOutDone: undefined;\n\tanimationOutStart: undefined;\n\tanimationSkipped: undefined;\n\tclickLink: DelegateEvent;\n\tcontentReplaced: PopStateEvent | undefined;\n\tdisabled: undefined;\n\tenabled: undefined;\n\topenPageInNewTab: DelegateEvent;\n\tpageLoaded: undefined;\n\tpageRetrievedFromCache: undefined;\n\tpageView: PopStateEvent | undefined;\n\tpopState: PopStateEvent;\n\tsamePage: DelegateEvent;\n\tsamePageWithHash: DelegateEvent;\n\tserverError: undefined;\n\ttransitionStart: PopStateEvent | undefined;\n\ttransitionEnd: PopStateEvent | undefined;\n\twillReplaceContent: PopStateEvent | undefined;\n};\ntype AvailableEventNames = keyof HandlersEventMap;\n\nexport type Handler = (event: HandlersEventMap[T]) => void;\nexport type Handlers = {\n\t[Key in keyof HandlersEventMap]: Handler[];\n};\n\nexport function on(\n\tthis: Swup,\n\tevent: TEventType,\n\thandler: Handler\n): void {\n\tconst eventHandlers = this._handlers[event] as Handler[];\n\n\tif (eventHandlers) {\n\t\teventHandlers.push(handler);\n\t} else {\n\t\tconsole.warn(`Unsupported event ${event}.`);\n\t}\n}\n\nexport function off(\n\tthis: Swup,\n\tevent?: TEventType,\n\thandler?: Handler\n) {\n\tif (event && handler) {\n\t\tconst eventHandlers = this._handlers[event] as Handler[];\n\t\t// Remove specific handler\n\t\tif (eventHandlers.includes(handler)) {\n\t\t\t(this._handlers[event] as Handler[]) = eventHandlers.filter(\n\t\t\t\t(h) => h !== handler\n\t\t\t);\n\t\t} else {\n\t\t\tconsole.warn(`Handler for event '${event}' not found.`);\n\t\t}\n\t} else if (event) {\n\t\t// Remove all handlers for specific event\n\t\tthis._handlers[event] = [];\n\t} else {\n\t\t// Remove all handlers for all events\n\t\tObject.keys(this._handlers).forEach((event) => {\n\t\t\tthis._handlers[event as keyof HandlersEventMap] = [];\n\t\t});\n\t}\n}\n\nexport function triggerEvent(\n\tthis: Swup,\n\teventName: TEventType,\n\toriginalEvent?: HandlersEventMap[TEventType]\n): void {\n\tconst eventHandlers = this._handlers[eventName] as Handler[];\n\n\t// call saved handlers with \"on\" method and pass originalEvent object if available\n\teventHandlers.forEach((handler) => {\n\t\ttry {\n\t\t\thandler(originalEvent as HandlersEventMap[TEventType]);\n\t\t} catch (error) {\n\t\t\tconsole.error(error);\n\t\t}\n\t});\n\n\t// trigger event on document with prefix \"swup:\"\n\tconst event = new CustomEvent(`swup:${eventName}`, { detail: eventName });\n\tdocument.dispatchEvent(event);\n}\n","import Swup from '../Swup.js';\n\nexport type Plugin = {\n\tname: string;\n\tisSwupPlugin: true;\n\tmount: () => void;\n\tunmount: () => void;\n\n\t// the instance is assigned later on after passing to swup\n\tswup?: Swup;\n\n\t// these are possibly undefined for backward compatibility\n\tversion?: string;\n\trequires?: Record;\n\t_beforeMount?: () => void;\n\t_afterUnmount?: () => void;\n\t_checkRequirements?: () => boolean;\n};\n\nconst isSwupPlugin = (maybeInvalidPlugin: unknown): maybeInvalidPlugin is Plugin => {\n\t// @ts-ignore\n\treturn maybeInvalidPlugin?.isSwupPlugin;\n};\n\nexport const use = function (this: Swup, plugin: unknown) {\n\tif (!isSwupPlugin(plugin)) {\n\t\tconsole.error('Not a swup plugin instance', plugin);\n\t\treturn;\n\t}\n\n\tplugin.swup = this;\n\tif (plugin._checkRequirements) {\n\t\tif (!plugin._checkRequirements()) {\n\t\t\treturn;\n\t\t}\n\t}\n\tif (plugin._beforeMount) {\n\t\tplugin._beforeMount();\n\t}\n\tplugin.mount();\n\n\tthis.plugins.push(plugin);\n\n\treturn this.plugins;\n};\n\nexport function unuse(this: Swup, pluginOrName: Plugin | string) {\n\tconst plugin = this.findPlugin(pluginOrName);\n\tif (!plugin) {\n\t\tconsole.error('No such plugin', plugin);\n\t\treturn;\n\t}\n\n\tplugin.unmount();\n\tif (plugin._afterUnmount) {\n\t\tplugin._afterUnmount();\n\t}\n\n\tthis.plugins = this.plugins.filter((p) => p !== plugin);\n\n\treturn this.plugins;\n}\n\nexport function findPlugin(this: Swup, pluginOrName: Plugin | string) {\n\treturn this.plugins.find((plugin) => plugin === pluginOrName || plugin.name === pluginOrName);\n}\n","import { Location, updateHistoryRecord, getCurrentUrl } from '../helpers.js';\nimport Swup from '../Swup.js';\nimport { PageRecord } from './Cache.js';\n\nexport type PageRenderOptions = {\n\tevent?: PopStateEvent;\n\tskipTransition?: boolean;\n};\n\nexport const renderPage = function (\n\tthis: Swup,\n\tpage: PageRecord,\n\t{ event, skipTransition }: PageRenderOptions = {}\n) {\n\tdocument.documentElement.classList.remove('is-leaving');\n\n\t// do nothing if another page was requested in the meantime\n\tif (!this.isSameResolvedUrl(getCurrentUrl(), page.url)) {\n\t\treturn;\n\t}\n\n\tconst { url } = Location.fromUrl(page.responseURL);\n\n\t// update cache and state if the url was redirected\n\tif (!this.isSameResolvedUrl(getCurrentUrl(), url)) {\n\t\tthis.cache.cacheUrl({ ...page, url });\n\t\tthis.currentPageUrl = getCurrentUrl();\n\t\tupdateHistoryRecord(url);\n\t}\n\n\t// only add for page loads with transitions\n\tif (!skipTransition) {\n\t\tdocument.documentElement.classList.add('is-rendering');\n\t}\n\n\tthis.triggerEvent('willReplaceContent', event);\n\n\tthis.replaceContent(page).then(() => {\n\t\tthis.triggerEvent('contentReplaced', event);\n\t\tthis.triggerEvent('pageView', event);\n\n\t\t// empty cache if it's disabled (in case preload plugin filled it)\n\t\tif (!this.options.cache) {\n\t\t\tthis.cache.empty();\n\t\t}\n\n\t\t// Perform in transition\n\t\tthis.enterPage({ event, skipTransition });\n\n\t\t// reset scroll-to element\n\t\tthis.scrollToElement = null;\n\t});\n};\n","import Swup from '../Swup.js';\n\nexport function updateTransition(this: Swup, from: string, to: string, custom?: string): void {\n\tthis.transition = { from, to, custom };\n}\n\nexport function shouldSkipTransition(this: Swup, { event }: { url?: string; event?: Event }) {\n\tconst isHistoryVisit = event instanceof PopStateEvent;\n\treturn !!(isHistoryVisit && !this.options.animateHistoryBrowsing);\n}\n","import { DelegateEvent } from 'delegate-it';\n\nimport version from './config/version.js';\n\nimport {\n\tcleanupAnimationClasses,\n\tdelegateEvent,\n\tgetCurrentUrl,\n\tLocation,\n\tmarkSwupElements,\n\tupdateHistoryRecord\n} from './helpers.js';\nimport { Unsubscribe } from './helpers/delegateEvent.js';\n\nimport { Cache } from './modules/Cache.js';\nimport { enterPage } from './modules/enterPage.js';\nimport { getAnchorElement } from './modules/getAnchorElement.js';\nimport { getAnimationPromises } from './modules/getAnimationPromises.js';\nimport { getPageData } from './modules/getPageData.js';\nimport { fetchPage } from './modules/fetchPage.js';\nimport { leavePage } from './modules/leavePage.js';\nimport { HistoryAction, loadPage, performPageLoad } from './modules/loadPage.js';\nimport { replaceContent } from './modules/replaceContent.js';\nimport { on, off, triggerEvent, Handlers } from './modules/events.js';\nimport { use, unuse, findPlugin, Plugin } from './modules/plugins.js';\nimport { renderPage } from './modules/renderPage.js';\nimport { updateTransition, shouldSkipTransition } from './modules/transitions.js';\n\nimport { queryAll } from './utils.js';\n\nexport type Transition = {\n\tfrom?: string;\n\tto?: string;\n\tcustom?: string;\n};\n\ntype DelegatedListeners = {\n\tclick?: Unsubscribe;\n};\n\nexport type Options = {\n\tanimateHistoryBrowsing: boolean;\n\tanimationSelector: string | false;\n\tlinkSelector: string;\n\tcache: boolean;\n\tcontainers: string[];\n\trequestHeaders: Record;\n\tplugins: Plugin[];\n\tskipPopStateHandling: (event: any) => boolean;\n\tignoreVisit: (url: string, { el, event }: { el?: Element; event?: Event }) => boolean;\n\tresolveUrl: (url: string) => string;\n};\n\nexport default class Swup {\n\tversion = version;\n\n\t_handlers: Handlers = {\n\t\tanimationInDone: [],\n\t\tanimationInStart: [],\n\t\tanimationOutDone: [],\n\t\tanimationOutStart: [],\n\t\tanimationSkipped: [],\n\t\tclickLink: [],\n\t\tcontentReplaced: [],\n\t\tdisabled: [],\n\t\tenabled: [],\n\t\topenPageInNewTab: [],\n\t\tpageLoaded: [],\n\t\tpageRetrievedFromCache: [],\n\t\tpageView: [],\n\t\tpopState: [],\n\t\tsamePage: [],\n\t\tsamePageWithHash: [],\n\t\tserverError: [],\n\t\ttransitionStart: [],\n\t\ttransitionEnd: [],\n\t\twillReplaceContent: []\n\t};\n\n\t// variable for anchor to scroll to after render\n\tscrollToElement: string | null = null;\n\t// variable for save options\n\toptions: Options;\n\t// running plugin instances\n\tplugins: Plugin[] = [];\n\t// variable for current transition info object\n\ttransition: Transition = {};\n\t// cache instance\n\tcache: Cache;\n\t// allows us to compare the current and new path inside popStateHandler\n\tcurrentPageUrl = getCurrentUrl();\n\t// variable for keeping event listeners from \"delegate\"\n\tdelegatedListeners: DelegatedListeners = {};\n\t// so we are able to remove the listener\n\tboundPopStateHandler: (event: PopStateEvent) => void;\n\n\tloadPage = loadPage;\n\tperformPageLoad = performPageLoad;\n\tleavePage = leavePage;\n\trenderPage = renderPage;\n\treplaceContent = replaceContent;\n\tenterPage = enterPage;\n\ttriggerEvent = triggerEvent;\n\tdelegateEvent = delegateEvent;\n\ton = on;\n\toff = off;\n\tupdateTransition = updateTransition;\n\tshouldSkipTransition = shouldSkipTransition;\n\tgetAnimationPromises = getAnimationPromises;\n\tgetPageData = getPageData;\n\tfetchPage = fetchPage;\n\tgetAnchorElement = getAnchorElement;\n\tlog: (message: string, context?: any) => void = () => {}; // here so it can be used by plugins\n\tuse = use;\n\tunuse = unuse;\n\tfindPlugin = findPlugin;\n\tgetCurrentUrl = getCurrentUrl;\n\tcleanupAnimationClasses = cleanupAnimationClasses;\n\n\tdefaults: Options = {\n\t\tanimateHistoryBrowsing: false,\n\t\tanimationSelector: '[class*=\"transition-\"]',\n\t\tcache: true,\n\t\tcontainers: ['#swup'],\n\t\tignoreVisit: (url, { el, event } = {}) => !!el?.closest('[data-no-swup]'),\n\t\tlinkSelector: 'a[href]',\n\t\tplugins: [],\n\t\tresolveUrl: (url) => url,\n\t\trequestHeaders: {\n\t\t\t'X-Requested-With': 'swup',\n\t\t\tAccept: 'text/html, application/xhtml+xml'\n\t\t},\n\t\tskipPopStateHandling: (event) => event.state?.source !== 'swup'\n\t};\n\n\tconstructor(options: Partial = {}) {\n\t\t// Merge defaults and options\n\t\tthis.options = { ...this.defaults, ...options };\n\n\t\tthis.boundPopStateHandler = this.popStateHandler.bind(this);\n\n\t\tthis.cache = new Cache(this);\n\n\t\tthis.enable();\n\t}\n\n\tenable() {\n\t\t// Check for Promise support\n\t\tif (typeof Promise === 'undefined') {\n\t\t\tconsole.warn('Promise is not supported');\n\t\t\treturn;\n\t\t}\n\n\t\t// Add event listeners\n\t\tthis.delegatedListeners.click = delegateEvent(\n\t\t\tthis.options.linkSelector,\n\t\t\t'click',\n\t\t\tthis.linkClickHandler.bind(this)\n\t\t);\n\n\t\twindow.addEventListener('popstate', this.boundPopStateHandler);\n\n\t\t// Initial save to cache\n\t\tif (this.options.cache) {\n\t\t\t// Disabled to avoid caching modified dom state: logic moved to preload plugin\n\t\t\t// https://github.com/swup/swup/issues/475\n\t\t}\n\n\t\t// Mark swup blocks in html\n\t\tmarkSwupElements(document.documentElement, this.options.containers);\n\n\t\t// Mount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.use(plugin));\n\n\t\t// Modify initial history record\n\t\tupdateHistoryRecord();\n\n\t\t// Trigger enabled event\n\t\tthis.triggerEvent('enabled');\n\n\t\t// Add swup-enabled class to html tag\n\t\tdocument.documentElement.classList.add('swup-enabled');\n\n\t\t// Trigger page view event\n\t\tthis.triggerEvent('pageView');\n\t}\n\n\tdestroy() {\n\t\t// remove delegated listeners\n\t\tthis.delegatedListeners.click!.destroy();\n\n\t\t// remove popstate listener\n\t\twindow.removeEventListener('popstate', this.boundPopStateHandler);\n\n\t\t// empty cache\n\t\tthis.cache.empty();\n\n\t\t// unmount plugins\n\t\tthis.options.plugins.forEach((plugin) => {\n\t\t\tthis.unuse(plugin);\n\t\t});\n\n\t\t// remove swup data atributes from blocks\n\t\tqueryAll('[data-swup]').forEach((element) => {\n\t\t\telement.removeAttribute('data-swup');\n\t\t});\n\n\t\t// remove handlers\n\t\tthis.off();\n\n\t\t// trigger disable event\n\t\tthis.triggerEvent('disabled');\n\n\t\t// remove swup-enabled class from html tag\n\t\tdocument.documentElement.classList.remove('swup-enabled');\n\t}\n\n\tshouldIgnoreVisit(href: string, { el, event }: { el?: Element; event?: Event } = {}) {\n\t\tconst { origin, url, hash } = Location.fromUrl(href);\n\n\t\t// Ignore if the new origin doesn't match the current one\n\t\tif (origin !== window.location.origin) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the link/form would open a new window (or none at all)\n\t\tif (el && this.triggerWillOpenNewWindow(el)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the visit should be ignored as per user options\n\t\tif (this.options.ignoreVisit(url + hash, { el, event })) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Finally, allow the visit\n\t\treturn false;\n\t}\n\n\tlinkClickHandler(event: DelegateEvent) {\n\t\tconst linkEl = event.delegateTarget;\n\t\tconst { href, url, hash } = Location.fromElement(linkEl as HTMLAnchorElement);\n\n\t\t// Exit early if the link should be ignored\n\t\tif (this.shouldIgnoreVisit(href, { el: linkEl, event })) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if control key pressed\n\t\tif (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {\n\t\t\tthis.triggerEvent('openPageInNewTab', event);\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if other than left mouse button\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.triggerEvent('clickLink', event);\n\t\tevent.preventDefault();\n\n\t\t// Handle links to the same page and exit early, where applicable\n\t\tif (!url || url === getCurrentUrl()) {\n\t\t\tthis.handleLinkToSamePage(url, hash, event);\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if the resolved path hasn't changed\n\t\tif (this.isSameResolvedUrl(url, getCurrentUrl())) return;\n\n\t\t// Store the element that should be scrolled to after loading the next page\n\t\tthis.scrollToElement = hash || null;\n\n\t\t// Get the custom transition name, if present\n\t\tconst customTransition = linkEl.getAttribute('data-swup-transition') || undefined;\n\n\t\t// Get the history action, if set\n\t\tlet history: HistoryAction | undefined;\n\t\tconst historyAttr = linkEl.getAttribute('data-swup-history');\n\t\tif (historyAttr && ['push', 'replace'].includes(historyAttr)) {\n\t\t\thistory = historyAttr as HistoryAction;\n\t\t}\n\n\t\t// Finally, proceed with loading the page\n\t\tthis.performPageLoad({ url, customTransition, history });\n\t}\n\n\thandleLinkToSamePage(url: string, hash: string, event: DelegateEvent) {\n\t\t// Emit event and exit early if the url points to the same page without hash\n\t\tif (!hash) {\n\t\t\tthis.triggerEvent('samePage', event);\n\t\t\treturn;\n\t\t}\n\n\t\t// link to the same URL with hash\n\t\tthis.triggerEvent('samePageWithHash', event);\n\n\t\tconst element = getAnchorElement(hash);\n\n\t\t// Warn and exit early if no matching element was found for the hash\n\t\tif (!element) {\n\t\t\treturn console.warn(`Element for offset not found (#${hash})`);\n\t\t}\n\n\t\tupdateHistoryRecord(url + hash);\n\t}\n\n\ttriggerWillOpenNewWindow(triggerEl: Element) {\n\t\tif (triggerEl.matches('[download], [target=\"_blank\"]')) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpopStateHandler(event: PopStateEvent) {\n\t\t// Exit early if this event should be ignored\n\t\tif (this.options.skipPopStateHandling(event)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if the resolved path hasn't changed\n\t\tif (this.isSameResolvedUrl(getCurrentUrl(), this.currentPageUrl)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst href = event.state?.url ?? location.href;\n\n\t\t// Exit early if the link should be ignored\n\t\tif (this.shouldIgnoreVisit(href, { event })) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { url, hash } = Location.fromUrl(href);\n\n\t\tif (hash) {\n\t\t\tthis.scrollToElement = hash;\n\t\t} else {\n\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tthis.triggerEvent('popState', event);\n\n\t\tif (!this.options.animateHistoryBrowsing) {\n\t\t\tdocument.documentElement.classList.remove('is-animating');\n\t\t\tcleanupAnimationClasses();\n\t\t}\n\n\t\tthis.performPageLoad({ url, event });\n\t}\n\n\t/**\n\t * Utility function to validate and run the global option 'resolveUrl'\n\t * @param {string} url\n\t * @returns {string} the resolved url\n\t */\n\tresolveUrl(url: string) {\n\t\tif (typeof this.options.resolveUrl !== 'function') {\n\t\t\tconsole.warn(`[swup] options.resolveUrl expects a callback function.`);\n\t\t\treturn url;\n\t\t}\n\t\tconst result = this.options.resolveUrl(url);\n\t\tif (!result || typeof result !== 'string') {\n\t\t\tconsole.warn(`[swup] options.resolveUrl needs to return a url`);\n\t\t\treturn url;\n\t\t}\n\t\tif (result.startsWith('//') || result.startsWith('http')) {\n\t\t\tconsole.warn(`[swup] options.resolveUrl needs to return a relative url`);\n\t\t\treturn url;\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Compares the resolved version of two paths and returns true if they are the same\n\t * @param {string} url1\n\t * @param {string} url2\n\t * @returns {boolean}\n\t */\n\tisSameResolvedUrl(url1: string, url2: string) {\n\t\treturn this.resolveUrl(url1) === this.resolveUrl(url2);\n\t}\n}\n"],"names":["getCurrentUrl","_temp","hash","location","pathname","search","updateHistoryRecord","url","customData","data","history","state","random","Math","source","replaceState","ledger","WeakMap","editLedger","wanted","baseElement","callback","setup","has","elementMap","get","set","setups","Set","existed","add","delete","delegateEvent","selector","type","options","signal","base","document","aborted","once","nativeListenerOptions","Document","documentElement","capture","Boolean","listenerFn","event","delegateTarget","target","Text","parentElement","Element","currentTarget","closest","contains","safeClosest","Object","assign","call","removeEventListener","JSON","stringify","addEventListener","delegate","destroy","controller","abort","query","context","querySelector","queryAll","Array","from","querySelectorAll","escapeCssIdentifier","ident","window","CSS","escape","toMs","s","Number","slice","replace","Location","constructor","baseURI","super","toString","this","static","el","getAttribute","href","markSwupElements","isSwupClass","className","test","includes","cleanupAnimationClasses","removeClasses","split","filter","classList","remove","Cache","swup","pages","last","getCacheUrl","resolveUrl","fromUrl","cacheUrl","page","responseURL","log","keys","length","getPage","getCurrentPage","exists","empty","enterPage","skipTransition","triggerEvent","Promise","resolve","requestAnimationFrame","animationPromises","getAnimationPromises","all","then","getAnchorElement","charAt","substring","decodeURIComponent","element","getElementById","decoded","body","transitionProp","transitionEndEvent","animationProp","animationEndEvent","animationType","animationSelector","animatedElements","console","warn","map","timeout","propCount","expectedType","getComputedStyle","transitionDuration","animationDelay","animationDuration","transitionDelays","styles","transitionTimeout","calculateTimeout","transitionDurations","animationDelays","animationDurations","animationTimeout","max","getTransitionInfo","endEvent","startTime","performance","now","propsTransitioned","end","onEnd","isTransitionOrAnimationEvent","elapsedTime","setTimeout","getAnimationPromiseForElement","delays","durations","concat","duration","i","undefined","ontransitionend","onwebkittransitionend","onanimationend","onwebkitanimationend","getPageData","request","pageHtmlData","html","containers","fakeDom","createElement","innerHTML","blocks","forEach","item","index","setAttribute","String","push","outerHTML","title","innerText","pageClass","originalContent","getDataFromHtml","responseText","fetchPage","headers","requestHeaders","cache","reject","defaults","method","onreadystatechange","readyState","open","entries","_ref","key","header","setRequestHeader","send","fetch","response","status","cacheablePageData","leavePage","isHistoryVisit","shouldIgnoreVisit","performPageLoad","customTransition","historyAction","shouldSkipTransition","text","updateTransition","toLowerCase","fetchPromise","scrollToElement","historyUrl","pushState","createHistoryRecord","currentPageUrl","pageData","renderPage","catch","errorUrl","skipPopStateHandling","go","replaceContent","handler","eventHandlers","_handlers","off","h","eventName","originalEvent","error","CustomEvent","detail","dispatchEvent","plugin","isSwupPlugin","_checkRequirements","_beforeMount","mount","plugins","pluginOrName","findPlugin","unmount","_afterUnmount","p","find","name","isSameResolvedUrl","to","custom","transition","PopStateEvent","animateHistoryBrowsing","Swup","version","animationInDone","animationInStart","animationOutDone","animationOutStart","animationSkipped","clickLink","contentReplaced","disabled","enabled","openPageInNewTab","pageLoaded","pageRetrievedFromCache","pageView","popState","samePage","samePageWithHash","serverError","transitionStart","transitionEnd","willReplaceContent","delegatedListeners","boundPopStateHandler","loadPage","on","use","unuse","ignoreVisit","linkSelector","Accept","popStateHandler","bind","enable","click","linkClickHandler","removeAttribute","_temp2","origin","triggerWillOpenNewWindow","linkEl","fromElement","metaKey","ctrlKey","shiftKey","altKey","button","preventDefault","handleLinkToSamePage","historyAttr","triggerEl","matches","result","startsWith","url1","url2"],"mappings":"uNAAO,MCAMA,EAAgB,SAAAC,GAAC,IAAAC,KAAEA,QAA6B,IAAAD,EAAA,CAAE,EAAAA,EAC9D,OAAOE,SAASC,SAAWD,SAASE,QAAUH,EAAOC,SAASD,KAAO,GACtE,ECAgCI,EAAG,SAClCC,EACAC,YADAD,IAAAA,EAAqB,WACrBC,IAAAA,IAAAA,EAAsC,CAAE,GAExCD,EAAMA,GAAOP,EAAc,CAAEE,MAAM,IACnC,MAAUO,EAAG,IACTC,QAAQC,MACXJ,MACAK,OAAQC,KAAKD,SACbE,OAAQ,UACLN,GAEJE,QAAQK,aAAaN,EAAM,GAAIF,EAChC,ECdMS,EAAS,IAAIC,QACnB,SAASC,EAAWC,EAAQC,EAAaC,EAAUC,GAC/C,IAAKH,IAAWH,EAAOO,IAAIH,GACvB,OAAO,EAEX,MAAMI,EAAaR,EAAOS,IAAIL,I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AAa,mBAAoB9E,IAEtBsF,EAAiBnI,GAIhC,OAAckJ,QAACC,uCAAuCnJ,MAGvDI,EAAoBC,EAAML,EAZzB,MAFAwF,KAAKmC,aAAa,WAAY9E,EAehC,CAEAoR,yBAAyBW,GACxB,QAAIA,EAAUC,QAAQ,gCAIvB,CAEApB,gBAAgB5Q,GAEf,GAAI2C,KAAKvD,QAAQwN,qBAAqB5M,GACrC,OAID,GAAI2C,KAAK4L,kBAAkBtR,IAAiB0F,KAAK4J,gBAChD,OAGD,MAAMxJ,EAAO/C,EAAMpC,OAAOJ,KAAOJ,SAAS2F,KAG1C,GAAIJ,KAAK+I,kBAAkB3I,EAAM,CAAE/C,UAClC,OAGD,MAAMxC,IAAEA,EAAGL,KAAEA,GAASmF,EAAS2B,QAAQlB,GAEnC5F,EACHwF,KAAKwJ,gBAAkBhP,EAEvB6C,EAAM4R,iBAGPjP,KAAKmC,aAAa,WAAY9E,GAEzB2C,KAAKvD,QAAQwP,yBACjBrP,SAASK,gBAAgB6D,UAAUC,OAAO,gBAC1CL,KAGDV,KAAKgJ,gBAAgB,CAAEnO,MAAKwC,SAC7B,CAOAgE,WAAWxG,GACV,GAAuC,wBAAvB4B,QAAQ4E,WAEvB,OADAqC,QAAQC,KAAK,0DACN9I,EAER,QAAemF,KAAKvD,QAAQ4E,WAAWxG,GACvC,OAAKyU,GAA4B,iBAALA,EAIxBA,EAAOC,WAAW,OAASD,EAAOC,WAAW,SAChD7L,QAAQC,KAAK,+DAIf2L,GARE5L,QAAQC,KAAK,mDACN9I,EAOT,CAQA+Q,kBAAkB4D,EAAcC,GAC/B,OAAWzP,KAACqB,WAAWmO,KAAUxP,KAAKqB,WAAWoO,EAClD"} \ No newline at end of file diff --git a/source/js/libs/SwupFadeTheme.min.js b/source/js/libs/SwupFadeTheme.min.js new file mode 100644 index 00000000..f7019b9a --- /dev/null +++ b/source/js/libs/SwupFadeTheme.min.js @@ -0,0 +1 @@ +(function e(t,n){if(typeof exports==="object"&&typeof module==="object")module.exports=n();else if(typeof define==="function"&&define.amd)define([],n);else if(typeof exports==="object")exports["SwupFadeTheme"]=n();else t["SwupFadeTheme"]=n()})(window,function(){return function(e){var t={};function n(o){if(t[o]){return t[o].exports}var r=t[o]={i:o,l:false,exports:{}};e[o].call(r.exports,r,r.exports,n);r.l=true;return r.exports}n.m=e;n.c=t;n.d=function(e,t,o){if(!n.o(e,t)){Object.defineProperty(e,t,{enumerable:true,get:o})}};n.r=function(e){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})};n.t=function(e,t){if(t&1)e=n(e);if(t&8)return e;if(t&4&&typeof e==="object"&&e&&e.__esModule)return e;var o=Object.create(null);n.r(o);Object.defineProperty(o,"default",{enumerable:true,value:e});if(t&2&&typeof e!="string")for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o};n.n=function(e){var t=e&&e.__esModule?function t(){return e["default"]}:function t(){return e};n.d(t,"a",t);return t};n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};n.p="";return n(n.s=0)}([function(e,t,n){"use strict";var o=n(1);var r=i(o);function i(e){return e&&e.__esModule?e:{default:e}}e.exports=r.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});var o=Object.assign||function(e){for(var t=1;t
    \n\t\t')}}]);return n}(a.default);n.default=p},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:true});var r=function(){function t(t,n){for(var e=0;e0&&arguments[0]!==undefined?arguments[0]:{};f(this,t);var n=c(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));n.name="SwupProgressPlugin";n.startShowingProgress=function(){n.progressBar.setValue(0);n.showProgressBarAfterDelay()};n.stopShowingProgress=function(){n.progressBar.setValue(1);if(n.options.hideImmediately){n.hideProgressBar()}else{n.finishAnimationAndHideProgressBar()}};n.showProgressBar=function(){n.cancelHideProgressBarTimeout();n.progressBar.show()};n.showProgressBarAfterDelay=function(){n.cancelShowProgressBarTimeout();n.cancelHideProgressBarTimeout();n.showProgressBarTimeout=window.setTimeout(n.showProgressBar,n.options.delay)};n.hideProgressBar=function(){n.cancelShowProgressBarTimeout();n.progressBar.hide()};n.finishAnimationAndHideProgressBar=function(){n.cancelShowProgressBarTimeout();n.hideProgressBarTimeout=window.setTimeout(n.hideProgressBar,n.options.transition)};n.cancelShowProgressBarTimeout=function(){window.clearTimeout(n.showProgressBarTimeout);delete n.showProgressBarTimeout};n.cancelHideProgressBarTimeout=function(){window.clearTimeout(n.hideProgressBarTimeout);delete n.hideProgressBarTimeout};var i={className:"swup-progress-bar",delay:300,transition:undefined,minValue:undefined,initialValue:undefined,hideImmediately:true};n.options=r({},i,e);n.showProgressBarTimeout=null;n.hideProgressBarTimeout=null;n.progressBar=new u.default({className:n.options.className,animationDuration:n.options.transition,minValue:n.options.minValue,initialValue:n.options.initialValue});return n}i(t,[{key:"mount",value:function e(){this.swup.on("transitionStart",this.startShowingProgress);this.swup.on("contentReplaced",this.stopShowingProgress)}},{key:"unmount",value:function e(){this.swup.off("transitionStart",this.startShowingProgress);this.swup.off("contentReplaced",this.stopShowingProgress)}}]);return t}(s.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=function(){function e(e,t){for(var n=0;n0&&arguments[0]!==undefined?arguments[0]:{},r=n.className,o=r===undefined?"progress-bar":r,s=n.styleAttr,a=s===undefined?"data-progressbar-styles":s,u=n.animationDuration,l=u===undefined?300:u,f=n.minValue,c=f===undefined?.1:f,h=n.initialValue,d=h===undefined?.25:h,m=n.trickleValue,p=m===undefined?.03:m;i(this,e);this.styleElement=null;this.progressElement=null;this.value=0;this.visible=false;this.hiding=false;this.trickleInterval=null;this.trickle=function(){var e=Math.random()*t.trickleValue;t.setValue(t.value+e)};this.className=o;this.styleAttr=a;this.animationDuration=l;this.minValue=c;this.initialValue=d;this.trickleValue=p;this.styleElement=this.createStyleElement();this.progressElement=this.createProgressElement()}r(e,[{key:"show",value:function e(){if(!this.visible){this.visible=true;this.installStyleElement();this.installProgressElement();this.startTrickling()}}},{key:"hide",value:function e(){var t=this;if(this.visible&&!this.hiding){this.hiding=true;this.fadeProgressElement(function(){t.uninstallProgressElement();t.stopTrickling();t.visible=false;t.hiding=false})}}},{key:"setValue",value:function e(t){this.value=Math.min(1,Math.max(this.minValue,t));this.refresh()}},{key:"installStyleElement",value:function e(){document.head.insertBefore(this.styleElement,document.head.firstChild)}},{key:"installProgressElement",value:function e(){this.progressElement.style.width="0%";this.progressElement.style.opacity="1";document.documentElement.insertBefore(this.progressElement,document.body);this.progressElement.scrollTop=0;this.setValue(Math.random()*this.initialValue)}},{key:"fadeProgressElement",value:function e(t){this.progressElement.style.opacity="0";setTimeout(t,this.animationDuration*1.5)}},{key:"uninstallProgressElement",value:function e(){if(this.progressElement.parentNode){document.documentElement.removeChild(this.progressElement)}}},{key:"startTrickling",value:function e(){if(!this.trickleInterval){this.trickleInterval=window.setInterval(this.trickle,this.animationDuration)}}},{key:"stopTrickling",value:function e(){window.clearInterval(this.trickleInterval);delete this.trickleInterval}},{key:"refresh",value:function e(){var t=this;requestAnimationFrame(function(){t.progressElement.style.width=t.value*100+"%"})}},{key:"createStyleElement",value:function e(){var t=document.createElement("style");t.setAttribute(this.styleAttr,"");t.textContent=this.defaultStyles;return t}},{key:"createProgressElement",value:function e(){var t=document.createElement("div");t.className=this.className;return t}},{key:"defaultStyles",get:function e(){return"\n\t\t."+this.className+" {\n\t\t\t\tposition: fixed;\n\t\t\t\tdisplay: block;\n\t\t\t\ttop: 0;\n\t\t\t\tleft: 0;\n\t\t\t\theight: 3px;\n\t\t\t\tbackground-color: black;\n\t\t\t\tz-index: 9999;\n\t\t\t\ttransition:\n\t\t\t\t\twidth "+this.animationDuration+"ms ease-out,\n\t\t\t\t\topacity "+this.animationDuration/2+"ms "+this.animationDuration/2+"ms ease-in;\n\t\t\t\ttransform: translate3d(0, 0, 0);\n\t\t\t}\n\t\t"}}]);return e}();t.default=o}])}); \ No newline at end of file diff --git a/source/js/libs/SwupScriptsPlugin.min.js b/source/js/libs/SwupScriptsPlugin.min.js new file mode 100644 index 00000000..9b72a4b7 --- /dev/null +++ b/source/js/libs/SwupScriptsPlugin.min.js @@ -0,0 +1 @@ +(function e(t,r){if(typeof exports==="object"&&typeof module==="object")module.exports=r();else if(typeof define==="function"&&define.amd)define([],r);else if(typeof exports==="object")exports["SwupScriptsPlugin"]=r();else t["SwupScriptsPlugin"]=r()})(window,function(){return function(e){var t={};function r(n){if(t[n]){return t[n].exports}var o=t[n]={i:n,l:false,exports:{}};e[n].call(o.exports,o,o.exports,r);o.l=true;return o.exports}r.m=e;r.c=t;r.d=function(e,t,n){if(!r.o(e,t)){Object.defineProperty(e,t,{enumerable:true,get:n})}};r.r=function(e){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})};r.t=function(e,t){if(t&1)e=r(e);if(t&8)return e;if(t&4&&typeof e==="object"&&e&&e.__esModule)return e;var n=Object.create(null);r.r(n);Object.defineProperty(n,"default",{enumerable:true,value:e});if(t&2&&typeof e!="string")for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n};r.n=function(e){var t=e&&e.__esModule?function t(){return e["default"]}:function t(){return e};r.d(t,"a",t);return t};r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};r.p="";return r(r.s=0)}([function(e,t,r){"use strict";var n=r(1);var o=u(n);function u(e){return e&&e.__esModule?e:{default:e}}e.exports=o.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:true});var n=Object.assign||function(e){for(var t=1;tString(t).split(".").concat(["0","0"]).slice(0,3).join(".");class o{constructor(){this.isSwupPlugin=!0,this.requires={},this.swup=void 0,this.version=void 0}mount(){}unmount(){}_beforeMount(){if(!this.name)throw new Error("You must define a name of plugin when creating a class.")}_afterUnmount(){}_checkRequirements(){return"object"!=typeof this.requires||Object.entries(this.requires).forEach(([o,e])=>{if(!function(o,e,i){const n=function(t,o){var e;if("swup"===t)return null!=(e=o.version)?e:"";{var i;const e=o.findPlugin(t);return null!=(i=null==e?void 0:e.version)?i:""}}(o,i);return!!n&&((o,e)=>e.every(e=>{const[,i,n]=e.match(/^([\D]+)?(.*)$/)||[];var s,r;return((t,o)=>{const e={"":t=>0===t,">":t=>t>0,">=":t=>t>=0,"<":t=>t<0,"<=":t=>t<=0};return(e[o]||e[""])(t)})((r=n,s=t(s=o),r=t(r),s.localeCompare(r,void 0,{numeric:!0})),i||">=")}))(n,e)}(o,e=Array.isArray(e)?e:[e],this.swup)){const t=`${o} ${e.join(", ")}`;throw new Error(`Plugin version mismatch: ${this.name} requires ${t}`)}}),!0}}const e=(t,o=document)=>Array.from(o.querySelectorAll(t));class i extends URL{constructor(t,o=document.baseURI){super(t.toString(),o)}get url(){return this.pathname+this.search}static fromElement(t){const o=t.getAttribute("href")||t.getAttribute("xlink:href");return new i(o)}static fromUrl(t){return new i(t)}}function n(){return n=Object.assign?Object.assign.bind():function(t){for(var o=1;o{if(t&&t.nodeType)this._targetPositionY=Math.round(t.getBoundingClientRect().top+window.pageYOffset);else{if(parseInt(this._targetPositionY)!==this._targetPositionY)return void console.error("Argument must be a number or an element.");this._targetPositionY=Math.round(t)}this._targetPositionY>document.documentElement.scrollHeight-window.innerHeight&&(this._targetPositionY=document.documentElement.scrollHeight-window.innerHeight),this._positionY=document.body.scrollTop||document.documentElement.scrollTop,this._direction=this._positionY>this._targetPositionY?-1:1,this._targetPositionYWithOffset=this._targetPositionY+this._direction,this._velocityY=0,this._positionY!==this._targetPositionY?(this.options.onStart(),this._animate()):this.options.onAlreadyAtPositions()},this._animate=()=>{this._update(),this._render(),1===this._direction&&this._targetPositionY>this._positionY||-1===this._direction&&this._targetPositionY{const t=this._targetPositionYWithOffset-this._positionY;return this._velocityY+=t*this.options.acceleration,this._velocityY*=this.options.friction,this._positionY+=this._velocityY,Math.abs(t)},this._render=()=>{window.scrollTo(0,this._positionY)},this.options=n({},{onAlreadyAtPositions:()=>{},onCancel:()=>{},onEnd:()=>{},onStart:()=>{},onTick:()=>{},friction:.7,acceleration:.04},t),t&&t.friction&&(this.options.friction=1-t.friction),window.addEventListener("mousewheel",t=>{this._raf&&(this.options.onCancel(),cancelAnimationFrame(this._raf),this._raf=null)},{passive:!0})}}return class extends o{constructor(t){var o;void 0===t&&(t={}),super(),o=this,this.name="ScrollPlugin",this.getAnchorElement=function(t){return void 0===t&&(t=""),"function"==typeof o.options.getAnchorElement?o.options.getAnchorElement(t):"function"==typeof o.swup.getAnchorElement?o.swup.getAnchorElement(t):document.querySelector(t)},this.getOffset=function(t){return void 0===t&&(t=null),"function"==typeof o.options.offset?parseInt(o.options.offset(t),10):parseInt(o.options.offset,10)},this.onSamePage=()=>{this.swup.scrollTo(0,this.shouldAnimate("samePage"))},this.onSamePageWithHash=t=>{this.maybeScrollToAnchor(t.delegateTarget.hash,"samePageWithHash")},this.onTransitionStart=t=>{this.options.doScrollingRightAway&&!this.swup.scrollToElement&&this.doScrollingBetweenPages(t)},this.onContentReplaced=t=>{this.options.doScrollingRightAway&&!this.swup.scrollToElement||this.doScrollingBetweenPages(t),this.restoreScrollContainers(t)},this.doScrollingBetweenPages=t=>{const o=this.swup;if(t&&!o.options.animateHistoryBrowsing)return;if(this.maybeScrollToAnchor(o.scrollToElement,"betweenPages"))return void(o.scrollToElement=null);const e=this.getStoredScrollPositions(this.getCurrentCacheKey())||{},i=e.window&&e.window.top||0;requestAnimationFrame(()=>o.scrollTo(i,this.shouldAnimate("betweenPages")))},this.onWillReplaceContent=()=>{this.storeScrollPositions(this.currentCacheKey),this.currentCacheKey=this.getCurrentCacheKey()},this.onClickLink=t=>{this.maybeResetScrollPositions(t.delegateTarget)},this.options={doScrollingRightAway:!1,animateScroll:{betweenPages:!0,samePageWithHash:!0,samePage:!0},scrollFriction:.3,scrollAcceleration:.04,getAnchorElement:null,offset:0,scrollContainers:"[data-swup-scroll-container]",shouldResetScrollPosition:t=>!0,...t}}mount(){var t=this;const o=this.swup;o._handlers.scrollDone=[],o._handlers.scrollStart=[],this.scrl=new s({onStart:()=>o.triggerEvent("scrollStart"),onEnd:()=>o.triggerEvent("scrollDone"),onCancel:()=>o.triggerEvent("scrollDone"),friction:this.options.scrollFriction,acceleration:this.options.scrollAcceleration}),o.scrollTo=function(e,i){void 0===i&&(i=!0),i?t.scrl.scrollTo(e):(o.triggerEvent("scrollStart"),window.scrollTo(0,e),o.triggerEvent("scrollDone"))},this.scrollPositionsStore={},this.currentCacheKey=this.getCurrentCacheKey(),this.previousScrollRestoration=window.history.scrollRestoration,o.options.animateHistoryBrowsing&&(window.history.scrollRestoration="manual"),o.on("samePage",this.onSamePage),o.on("samePageWithHash",this.onSamePageWithHash),o.on("transitionStart",this.onTransitionStart),o.on("contentReplaced",this.onContentReplaced),o.on("willReplaceContent",this.onWillReplaceContent),o.on("clickLink",this.onClickLink)}unmount(){const t=this.swup;t.scrollTo=null,delete this.scrl,this.scrl=null,t.off("samePage",this.onSamePage),t.off("samePageWithHash",this.onSamePageWithHash),t.off("transitionStart",this.onTransitionStart),t.off("contentReplaced",this.onContentReplaced),t.off("willReplaceContent",this.onWillReplaceContent),t.off("clickLink",this.onClickLink),t._handlers.scrollDone=null,t._handlers.scrollStart=null,window.history.scrollRestoration=this.previousScrollRestoration}shouldAnimate(t){return"boolean"==typeof this.options.animateScroll?this.options.animateScroll:this.options.animateScroll[t]}maybeScrollToAnchor(t,o){if(null==t)return!1;const e=this.getAnchorElement(t);if(!e)return console.warn(`Element ${t} not found`),!1;if(!(e instanceof Element))return console.warn(`Element ${t} is not a DOM node`),!1;const i=e.getBoundingClientRect().top+window.pageYOffset-this.getOffset(e);return this.swup.scrollTo(i,this.shouldAnimate(o)),!0}maybeResetScrollPositions(t){if(!this.options.shouldResetScrollPosition(t))return;const{url:o}=i.fromElement(t);this.resetScrollPositions(o)}storeScrollPositions(t){const o=e(this.options.scrollContainers).map(t=>({top:t.scrollTop,left:t.scrollLeft}));this.scrollPositionsStore[t]={window:{top:window.scrollY,left:window.scrollX},containers:o}}resetScrollPositions(t){const o=this.getResolvedUrl(t);delete this.scrollPositionsStore[o],this.scrollPositionsStore[o]=null}getStoredScrollPositions(t){const o=this.getResolvedUrl(t);return this.scrollPositionsStore[o]}restoreScrollContainers(t){const o=this.getStoredScrollPositions(this.getCurrentCacheKey())||{};null!=o.containers&&e(this.options.scrollContainers).forEach((t,e)=>{const i=o.containers[e];null!=i&&(t.scrollTop=i.top,t.scrollLeft=i.left)})}getCurrentCacheKey(){return this.getResolvedUrl((({hash:t}={})=>location.pathname+location.search+(t?location.hash:""))())}getResolvedUrl(t){return"function"==typeof this.swup.resolveUrl?this.swup.resolveUrl(t):t}}}); +//# sourceMappingURL=SwupScrollPlugin.min.js.map diff --git a/source/js/libs/SwupScrollPlugin.min.js.map b/source/js/libs/SwupScrollPlugin.min.js.map new file mode 100644 index 00000000..e72b3150 --- /dev/null +++ b/source/js/libs/SwupScrollPlugin.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.umd.js","sources":["../node_modules/@swup/plugin/dist/index.modern.js","../node_modules/swup/dist/Swup.modern.js","../node_modules/scrl/dist/index.modern.js","../src/index.js"],"sourcesContent":["const r=r=>String(r).split(\".\").concat([\"0\",\"0\"]).slice(0,3).join(\".\");class n{constructor(){this.isSwupPlugin=!0,this.requires={},this.swup=void 0,this.version=void 0}mount(){}unmount(){}_beforeMount(){if(!this.name)throw new Error(\"You must define a name of plugin when creating a class.\")}_afterUnmount(){}_checkRequirements(){return\"object\"!=typeof this.requires||Object.entries(this.requires).forEach(([n,e])=>{if(!function(n,e,t){const i=function(r,n){var e;if(\"swup\"===r)return null!=(e=n.version)?e:\"\";{var t;const e=n.findPlugin(r);return null!=(t=null==e?void 0:e.version)?t:\"\"}}(n,t);return!!i&&((n,e)=>e.every(e=>{const[,t,i]=e.match(/^([\\D]+)?(.*)$/)||[];var s,o;return((r,n)=>{const e={\"\":r=>0===r,\">\":r=>r>0,\">=\":r=>r>=0,\"<\":r=>r<0,\"<=\":r=>r<=0};return(e[n]||e[\"\"])(r)})((o=i,s=r(s=n),o=r(o),s.localeCompare(o,void 0,{numeric:!0})),t||\">=\")}))(i,e)}(n,e=Array.isArray(e)?e:[e],this.swup)){const r=`${n} ${e.join(\", \")}`;throw new Error(`Plugin version mismatch: ${this.name} requires ${r}`)}}),!0}}export{n as default};\n//# sourceMappingURL=index.modern.js.map\n","import t from\"delegate-it\";function e(){return e=Object.assign?Object.assign.bind():function(t){for(var e=1;eString(t).toLowerCase().replace(/[\\s/_.]+/g,\"-\").replace(/[^\\w-]+/g,\"\").replace(/--+/g,\"-\").replace(/^-+|-+$/g,\"\")||e||\"\",i=({hash:t}={})=>location.pathname+location.search+(t?location.hash:\"\"),s=(t,n={})=>{const s=e({url:t=t||i({hash:!0}),random:Math.random(),source:\"swup\"},n);history.pushState(s,\"\",t)},o=(t=null,n={})=>{t=t||i({hash:!0});const s=e({},history.state,{url:t,random:Math.random(),source:\"swup\"},n);history.replaceState(s,\"\",t)},r=[\"base\"],a=(e,n,i,s={})=>{let{base:o=document}=s,a=function(t,e){if(null==t)return{};var n,i,s={},o=Object.keys(t);for(i=0;i=0||(s[n]=t[n]);return s}(s,r);const l=t(o,e,n,i,a);return{destroy:()=>l.destroy()}},l=(t,e=document)=>e.querySelector(t),u=(t,e=document)=>Array.from(e.querySelectorAll(t)),h=t=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})},c=t=>window.CSS&&window.CSS.escape?CSS.escape(t):t,d=t=>1e3*Number(t.slice(0,-1).replace(\",\",\".\")),p=(t,e)=>{var n,i;let s=document.createElement(\"html\");s.innerHTML=t;let o=[];e.forEach(t=>{if(null==l(t,s))return console.warn(`[swup] Container ${t} not found on page.`),null;u(t).length!==u(t,s).length&&console.warn(\"[swup] Mismatched number of containers found on new page.\"),u(t).forEach((e,n)=>{u(t,s)[n].setAttribute(\"data-swup\",String(o.length)),o.push(u(t,s)[n].outerHTML)})});const r=(null==(n=l(\"title\",s))?void 0:n.innerText)||\"\",a=null==(i=l(\"body\",s))?void 0:i.className;return s.innerHTML=\"\",s=null,{title:r,pageClass:a,blocks:o,originalContent:t}},g=(t,n)=>{const i={url:window.location.pathname+window.location.search,method:\"GET\",data:null,headers:{}},{url:s,method:o,headers:r,data:a}=e({},i,t),l=new XMLHttpRequest;return l.onreadystatechange=function(){4===l.readyState&&n(l)},l.open(o,s,!0),Object.entries(r).forEach(([t,e])=>{l.setRequestHeader(t,e)}),l.send(a),l};class m extends URL{constructor(t,e=document.baseURI){super(t.toString(),e)}get url(){return this.pathname+this.search}static fromElement(t){const e=t.getAttribute(\"href\")||t.getAttribute(\"xlink:href\");return new m(e)}static fromUrl(t){return new m(t)}}const f=(t,e)=>{let n=0;e.forEach(e=>{null==l(e,t)?console.warn(`[swup] Container ${e} not found on page.`):u(e).forEach((i,s)=>{u(e,t)[s].setAttribute(\"data-swup\",String(n)),n++})})},v=t=>/^to-/.test(t)||[\"is-changing\",\"is-rendering\",\"is-popstate\"].includes(t),w=()=>{const t=document.documentElement.className.split(\" \").filter(v);document.documentElement.classList.remove(...t)};class E{constructor(t){this.pages={},this.last=null,this.swup=void 0,this.swup=t}getCacheUrl(t){return this.swup.resolveUrl(m.fromUrl(t).url)}cacheUrl(t){t.url=this.getCacheUrl(t.url),t.url in this.pages==0&&(this.pages[t.url]=t),t.responseURL=this.getCacheUrl(t.responseURL),this.last=this.pages[t.url],this.swup.log(`Cache (${Object.keys(this.pages).length})`,this.pages)}getPage(t){return t=this.getCacheUrl(t),this.pages[t]}getCurrentPage(){return this.getPage(i())}exists(t){return(t=this.getCacheUrl(t))in this.pages}empty(){this.pages={},this.last=null,this.swup.log(\"Cache cleared\")}remove(t){delete this.pages[this.getCacheUrl(t)]}}const P=function({event:t,skipTransition:e}={}){if(e)return this.triggerEvent(\"transitionEnd\",t),this.cleanupAnimationClasses(),[Promise.resolve()];h(()=>{this.triggerEvent(\"animationInStart\"),document.documentElement.classList.remove(\"is-animating\")});const n=this.getAnimationPromises(\"in\");return Promise.all(n).then(()=>{this.triggerEvent(\"animationInDone\"),this.triggerEvent(\"transitionEnd\",t),this.cleanupAnimationClasses()}),n},S=t=>t?(\"#\"===t.charAt(0)&&(t=t.substring(1)),t=decodeURIComponent(t),t=c(t),l(`#${t}`)||l(`a[name='${t}']`)):null;let b=\"transition\",k=\"transitionend\",U=\"animation\",y=\"animationend\";function L(t){const e=this.options.animationSelector;if(!1===e)return[Promise.resolve()];const n=u(e,document.body);return n.length?n.map(t=>function(t,e,n=null){const{type:i,timeout:s,propCount:o}=function(t,e=null){const n=window.getComputedStyle(t),i=`${b}Duration`,s=`${U}Delay`,o=`${U}Duration`,r=n[`${b}Delay`].split(\", \"),a=(n[i]||\"\").split(\", \"),l=C(r,a),u=(n[s]||\"\").split(\", \"),h=(n[o]||\"\").split(\", \"),c=C(u,h);let d=\"\",p=0,g=0;return\"transition\"===e?l>0&&(d=\"transition\",p=l,g=a.length):\"animation\"===e?c>0&&(d=\"animation\",p=c,g=h.length):(p=Math.max(l,c),d=p>0?l>c?\"transition\":\"animation\":null,g=d?\"transition\"===d?a.length:h.length:0),{type:d,timeout:p,propCount:g}}(t,n);return i&&s?new Promise(e=>{const n=\"transition\"===i?k:y,r=performance.now();let a=0;const l=()=>{t.removeEventListener(n,u),e()},u=e=>{if(e.target===t){if(!(t=>!!t.elapsedTime)(e))throw new Error(\"Not a transition or animation event.\");(performance.now()-r)/1e3=o&&l()}};setTimeout(()=>{ad(e)+d(t[n])))}void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(b=\"WebkitTransition\",k=\"webkitTransitionEnd\"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(U=\"WebkitAnimation\",y=\"webkitAnimationEnd\");const T=function(t){const n=p(t.responseText,this.options.containers);return n?e({},n,{responseURL:t.responseURL||window.location.href}):(console.warn(\"[swup] Received page is invalid.\"),null)};function H(t){const n=this.options.requestHeaders,{url:i}=t;return this.cache.exists(i)?(this.triggerEvent(\"pageRetrievedFromCache\"),Promise.resolve(this.cache.getPage(i))):new Promise((s,o)=>{g(e({},t,{headers:n}),t=>{if(500===t.status)return this.triggerEvent(\"serverError\"),void o(i);const n=this.getPageData(t);if(!n||!n.blocks.length)return void o(i);const r=e({},n,{url:i});this.cache.cacheUrl(r),this.triggerEvent(\"pageLoaded\"),s(r)})})}const R=function({event:t,skipTransition:e}={}){const n=t instanceof PopStateEvent;if(e)return this.triggerEvent(\"animationSkipped\"),[Promise.resolve()];this.triggerEvent(\"animationOutStart\"),document.documentElement.classList.add(\"is-changing\",\"is-leaving\",\"is-animating\"),n&&document.documentElement.classList.add(\"is-popstate\");const i=this.getAnimationPromises(\"out\");return Promise.all(i).then(()=>{this.triggerEvent(\"animationOutDone\")}),i};function A(t){const{url:e}=t;this.shouldIgnoreVisit(e)?window.location.href=e:this.performPageLoad(t)}function $(t){const{url:e,event:o,customTransition:r}=null!=t?t:{},a=o instanceof PopStateEvent,l=this.shouldSkipTransition({url:e,event:o});this.triggerEvent(\"transitionStart\",o),this.updateTransition(i(),e,r),null!=r&&document.documentElement.classList.add(`to-${n(r)}`);const u=this.leavePage({event:o,skipTransition:l});a||s(e+(this.scrollToElement||\"\")),this.currentPageUrl=i();const h=this.fetchPage(t);Promise.all([h,...u]).then(([t])=>{this.renderPage(t,{event:o,skipTransition:l})}).catch(t=>{void 0!==t&&(this.options.skipPopStateHandling=()=>(window.location=t,!0),history.go(-1))})}const _=function({blocks:t,title:e}){return t.forEach((t,e)=>{document.body.querySelector(`[data-swup=\"${e}\"]`).outerHTML=t}),document.title=e,Promise.resolve()};function O(t,e){this._handlers[t]?this._handlers[t].push(e):console.warn(`Unsupported event ${t}.`)}function x(t,e){t&&e?this._handlers[t].includes(e)?this._handlers[t]=this._handlers[t].filter(t=>t!==e):console.warn(`Handler for event '${t}' not found.`):t?this._handlers[t]=[]:Object.keys(this._handlers).forEach(t=>{this._handlers[t]=[]})}function q(t,e){this._handlers[t].forEach(t=>{try{t(e)}catch(t){console.error(t)}});const n=new CustomEvent(`swup:${t}`,{detail:t});document.dispatchEvent(n)}const D=function(t){var e;if(null==(e=t)?void 0:e.isSwupPlugin){if(t.swup=this,!t._checkRequirements||t._checkRequirements())return t._beforeMount&&t._beforeMount(),t.mount(),this.plugins.push(t),this.plugins}else console.error(\"Not a swup plugin instance\",t)};function I(t){const e=this.findPlugin(t);if(e)return e.unmount(),e._afterUnmount&&e._afterUnmount(),this.plugins=this.plugins.filter(t=>t!==e),this.plugins;console.error(\"No such plugin\",e)}function M(t){return this.plugins.find(e=>e===t||e.name===t)}const N=function(t,{event:n,skipTransition:s}={}){if(document.documentElement.classList.remove(\"is-leaving\"),!this.isSameResolvedUrl(i(),t.url))return;const{url:r}=m.fromUrl(t.responseURL);this.isSameResolvedUrl(i(),r)||(this.cache.cacheUrl(e({},t,{url:r})),this.currentPageUrl=i(),o(r)),s||document.documentElement.classList.add(\"is-rendering\"),this.triggerEvent(\"willReplaceContent\",n),this.replaceContent(t).then(()=>{this.triggerEvent(\"contentReplaced\",n),this.triggerEvent(\"pageView\",n),this.options.cache||this.cache.empty(),this.enterPage({event:n,skipTransition:s}),this.scrollToElement=null})};function W(t,e,n){this.transition={from:t,to:e,custom:n}}function V({event:t}){return!(!(t instanceof PopStateEvent)||this.options.animateHistoryBrowsing)}class j{constructor(t={}){this.version=\"3.0.3\",this._handlers={animationInDone:[],animationInStart:[],animationOutDone:[],animationOutStart:[],animationSkipped:[],clickLink:[],contentReplaced:[],disabled:[],enabled:[],openPageInNewTab:[],pageLoaded:[],pageRetrievedFromCache:[],pageView:[],popState:[],samePage:[],samePageWithHash:[],serverError:[],transitionStart:[],transitionEnd:[],willReplaceContent:[]},this.scrollToElement=null,this.options=void 0,this.plugins=[],this.transition={},this.cache=void 0,this.currentPageUrl=i(),this.delegatedListeners={},this.boundPopStateHandler=void 0,this.loadPage=A,this.performPageLoad=$,this.leavePage=R,this.renderPage=N,this.replaceContent=_,this.enterPage=P,this.triggerEvent=q,this.delegateEvent=a,this.on=O,this.off=x,this.updateTransition=W,this.shouldSkipTransition=V,this.getAnimationPromises=L,this.getPageData=T,this.fetchPage=H,this.getAnchorElement=S,this.log=()=>{},this.use=D,this.unuse=I,this.findPlugin=M,this.getCurrentUrl=i,this.cleanupAnimationClasses=w,this.defaults={animateHistoryBrowsing:!1,animationSelector:'[class*=\"transition-\"]',cache:!0,containers:[\"#swup\"],ignoreVisit:(t,{el:e}={})=>!(null==e||!e.closest(\"[data-no-swup]\")),linkSelector:\"a[href]\",plugins:[],resolveUrl:t=>t,requestHeaders:{\"X-Requested-With\":\"swup\",Accept:\"text/html, application/xhtml+xml\"},skipPopStateHandling:t=>{var e;return\"swup\"!==(null==(e=t.state)?void 0:e.source)}},this.options=e({},this.defaults,t),this.boundPopStateHandler=this.popStateHandler.bind(this),this.cache=new E(this),this.enable()}enable(){\"undefined\"!=typeof Promise?(this.delegatedListeners.click=a(this.options.linkSelector,\"click\",this.linkClickHandler.bind(this)),window.addEventListener(\"popstate\",this.boundPopStateHandler),f(document.documentElement,this.options.containers),this.options.plugins.forEach(t=>this.use(t)),o(),this.triggerEvent(\"enabled\"),document.documentElement.classList.add(\"swup-enabled\"),this.triggerEvent(\"pageView\")):console.warn(\"Promise is not supported\")}destroy(){this.delegatedListeners.click.destroy(),window.removeEventListener(\"popstate\",this.boundPopStateHandler),this.cache.empty(),this.options.plugins.forEach(t=>{this.unuse(t)}),u(\"[data-swup]\").forEach(t=>{t.removeAttribute(\"data-swup\")}),this.off(),this.triggerEvent(\"disabled\"),document.documentElement.classList.remove(\"swup-enabled\")}shouldIgnoreVisit(t,{el:e}={}){const{origin:n,url:i,hash:s}=m.fromUrl(t);return n!==window.location.origin||!(!e||!this.triggerWillOpenNewWindow(e))||!!this.options.ignoreVisit(i+s,{el:e})}linkClickHandler(t){const e=t.delegateTarget,{href:n,url:s,hash:o}=m.fromElement(e);if(this.shouldIgnoreVisit(n,{el:e}))return;if(t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return void this.triggerEvent(\"openPageInNewTab\",t);if(0!==t.button)return;if(this.triggerEvent(\"clickLink\",t),t.preventDefault(),!s||s===i())return void this.handleLinkToSamePage(s,o,t);if(this.isSameResolvedUrl(s,i()))return;this.scrollToElement=o||null;const r=e.getAttribute(\"data-swup-transition\")||void 0;this.performPageLoad({url:s,customTransition:r})}handleLinkToSamePage(t,e,n){if(e){if(this.triggerEvent(\"samePageWithHash\",n),!S(e))return console.warn(`Element for offset not found (#${e})`);o(t+e)}else this.triggerEvent(\"samePage\",n)}triggerWillOpenNewWindow(t){return!!t.matches('[download], [target=\"_blank\"]')}popStateHandler(t){var e,n;if(this.options.skipPopStateHandling(t))return;if(this.isSameResolvedUrl(i(),this.currentPageUrl))return;const s=null!=(e=null==(n=t.state)?void 0:n.url)?e:location.href;if(this.shouldIgnoreVisit(s))return;const{url:o,hash:r}=m.fromUrl(s);r?this.scrollToElement=r:t.preventDefault(),this.triggerEvent(\"popState\",t),this.options.animateHistoryBrowsing||(document.documentElement.classList.remove(\"is-animating\"),w()),this.performPageLoad({url:o,event:t})}resolveUrl(t){if(\"function\"!=typeof this.options.resolveUrl)return console.warn(\"[swup] options.resolveUrl expects a callback function.\"),t;const e=this.options.resolveUrl(t);return e&&\"string\"==typeof e?e.startsWith(\"//\")||e.startsWith(\"http\")?(console.warn(\"[swup] options.resolveUrl needs to return a relative url\"),t):e:(console.warn(\"[swup] options.resolveUrl needs to return a url\"),t)}isSameResolvedUrl(t,e){return this.resolveUrl(t)===this.resolveUrl(e)}}export{m as Location,n as classify,w as cleanupAnimationClasses,s as createHistoryRecord,j as default,a as delegateEvent,c as escapeCssIdentifier,g as fetch,i as getCurrentUrl,p as getDataFromHtml,f as markSwupElements,h as nextTick,l as query,u as queryAll,d as toMs,o as updateHistoryRecord};\n//# sourceMappingURL=Swup.modern.js.map\n","function t(){return t=Object.assign?Object.assign.bind():function(t){for(var i=1;i{if(t&&t.nodeType)this._targetPositionY=Math.round(t.getBoundingClientRect().top+window.pageYOffset);else{if(parseInt(this._targetPositionY)!==this._targetPositionY)return void console.error(\"Argument must be a number or an element.\");this._targetPositionY=Math.round(t)}this._targetPositionY>document.documentElement.scrollHeight-window.innerHeight&&(this._targetPositionY=document.documentElement.scrollHeight-window.innerHeight),this._positionY=document.body.scrollTop||document.documentElement.scrollTop,this._direction=this._positionY>this._targetPositionY?-1:1,this._targetPositionYWithOffset=this._targetPositionY+this._direction,this._velocityY=0,this._positionY!==this._targetPositionY?(this.options.onStart(),this._animate()):this.options.onAlreadyAtPositions()},this._animate=()=>{this._update(),this._render(),1===this._direction&&this._targetPositionY>this._positionY||-1===this._direction&&this._targetPositionY{const t=this._targetPositionYWithOffset-this._positionY;return this._velocityY+=t*this.options.acceleration,this._velocityY*=this.options.friction,this._positionY+=this._velocityY,Math.abs(t)},this._render=()=>{window.scrollTo(0,this._positionY)},this.options=t({},{onAlreadyAtPositions:()=>{},onCancel:()=>{},onEnd:()=>{},onStart:()=>{},onTick:()=>{},friction:.7,acceleration:.04},i),i&&i.friction&&(this.options.friction=1-i.friction),window.addEventListener(\"mousewheel\",t=>{this._raf&&(this.options.onCancel(),cancelAnimationFrame(this._raf),this._raf=null)},{passive:!0})}}export{i as default};\n//# sourceMappingURL=index.modern.js.map\n","import Plugin from '@swup/plugin';\nimport { getCurrentUrl, Location, queryAll } from 'swup';\nimport Scrl from 'scrl';\n\n/**\n * Class representing a Scroll Plugin.\n * @extends Plugin\n */\nexport default class ScrollPlugin extends Plugin {\n\tname = 'ScrollPlugin';\n\n\t/**\n\t * Constructor\n\t * @param {object|undefined} options the plugin options\n\t */\n\tconstructor(options = {}) {\n\t\tsuper();\n\t\tconst defaultOptions = {\n\t\t\tdoScrollingRightAway: false,\n\t\t\tanimateScroll: {\n\t\t\t\tbetweenPages: true,\n\t\t\t\tsamePageWithHash: true,\n\t\t\t\tsamePage: true\n\t\t\t},\n\t\t\tscrollFriction: 0.3,\n\t\t\tscrollAcceleration: 0.04,\n\t\t\tgetAnchorElement: null,\n\t\t\toffset: 0,\n\t\t\tscrollContainers: `[data-swup-scroll-container]`,\n\t\t\tshouldResetScrollPosition: (htmlAnchorElement) => true\n\t\t};\n\n\t\tthis.options = {\n\t\t\t...defaultOptions,\n\t\t\t...options\n\t\t};\n\t}\n\n\t/**\n\t * Runs if the plugin is mounted\n\t */\n\tmount() {\n\t\tconst swup = this.swup;\n\n\t\t// add empty handlers array for scroll events\n\t\tswup._handlers.scrollDone = [];\n\t\tswup._handlers.scrollStart = [];\n\n\t\t// Initialize Scrl for smooth animations\n\t\tthis.scrl = new Scrl({\n\t\t\tonStart: () => swup.triggerEvent('scrollStart'),\n\t\t\tonEnd: () => swup.triggerEvent('scrollDone'),\n\t\t\tonCancel: () => swup.triggerEvent('scrollDone'),\n\t\t\tfriction: this.options.scrollFriction,\n\t\t\tacceleration: this.options.scrollAcceleration\n\t\t});\n\n\t\t// set scrollTo method of swup and animate based on current animateScroll option\n\t\tswup.scrollTo = (offset, animate = true) => {\n\t\t\tif (animate) {\n\t\t\t\tthis.scrl.scrollTo(offset);\n\t\t\t} else {\n\t\t\t\tswup.triggerEvent('scrollStart');\n\t\t\t\twindow.scrollTo(0, offset);\n\t\t\t\tswup.triggerEvent('scrollDone');\n\t\t\t}\n\t\t};\n\n\t\t// This object will hold all scroll positions\n\t\tthis.scrollPositionsStore = {};\n\t\t// this URL helps with storing the current scroll positions on `willReplaceContent`\n\t\tthis.currentCacheKey = this.getCurrentCacheKey();\n\n\t\t// disable browser scroll control on popstates when\n\t\t// animateHistoryBrowsing option is enabled in swup.\n\t\t// Cache the previous setting to be able to properly restore it on unmount\n\t\tthis.previousScrollRestoration = window.history.scrollRestoration;\n\t\tif (swup.options.animateHistoryBrowsing) {\n\t\t\twindow.history.scrollRestoration = 'manual';\n\t\t}\n\n\t\t// scroll to the top of the page\n\t\tswup.on('samePage', this.onSamePage);\n\n\t\t// scroll to referenced element on the same page\n\t\tswup.on('samePageWithHash', this.onSamePageWithHash);\n\n\t\t// scroll to the referenced element\n\t\tswup.on('transitionStart', this.onTransitionStart);\n\n\t\t// scroll to the referenced element when it's in the page (after render)\n\t\tswup.on('contentReplaced', this.onContentReplaced);\n\n\t\tswup.on('willReplaceContent', this.onWillReplaceContent);\n\t\tswup.on('clickLink', this.onClickLink);\n\t}\n\n\t/**\n\t * Runs when the plugin is unmounted\n\t */\n\tunmount() {\n\t\tconst swup = this.swup;\n\t\tswup.scrollTo = null;\n\n\t\tdelete this.scrl;\n\t\tthis.scrl = null;\n\n\t\tswup.off('samePage', this.onSamePage);\n\t\tswup.off('samePageWithHash', this.onSamePageWithHash);\n\t\tswup.off('transitionStart', this.onTransitionStart);\n\t\tswup.off('contentReplaced', this.onContentReplaced);\n\t\tswup.off('willReplaceContent', this.onWillReplaceContent);\n\t\tswup.off('clickLink', this.onClickLink);\n\n\t\tswup._handlers.scrollDone = null;\n\t\tswup._handlers.scrollStart = null;\n\n\t\twindow.history.scrollRestoration = this.previousScrollRestoration;\n\t}\n\n\t/**\n\t * Detects if a scroll should be animated, based on context\n\t * @param {string} context\n\t * @returns {boolean}\n\t */\n\tshouldAnimate(context) {\n\t\tif (typeof this.options.animateScroll === 'boolean') {\n\t\t\treturn this.options.animateScroll;\n\t\t}\n\t\treturn this.options.animateScroll[context];\n\t}\n\n\t/**\n\t * Get an element based on anchor\n\t * @param {string} hash\n\t * @returns {mixed}\n\t */\n\tgetAnchorElement = (hash = '') => {\n\t\t// Look for a custom function provided via the plugin options\n\t\tif (typeof this.options.getAnchorElement === 'function') {\n\t\t\treturn this.options.getAnchorElement(hash);\n\t\t}\n\t\t// Look for a the built-in function in swup, added in swup 2.0.16\n\t\tif (typeof this.swup.getAnchorElement === 'function') {\n\t\t\treturn this.swup.getAnchorElement(hash);\n\t\t}\n\t\t// Finally, return a native browser query\n\t\treturn document.querySelector(hash);\n\t};\n\n\t/**\n\t * Get the offset for a scroll\n\t * @param {(HtmlELement|null)} element\n\t * @returns {number}\n\t */\n\tgetOffset = (element = null) => {\n\t\t// If options.offset is a function, apply and return it\n\t\tif (typeof this.options.offset === 'function') {\n\t\t\treturn parseInt(this.options.offset(element), 10);\n\t\t}\n\t\t// Otherwise, return the sanitized offset\n\t\treturn parseInt(this.options.offset, 10);\n\t};\n\n\t/**\n\t * Handles `samePage`\n\t */\n\tonSamePage = () => {\n\t\tthis.swup.scrollTo(0, this.shouldAnimate('samePage'));\n\t};\n\n\t/**\n\t * Handles `onSamePageWithHash`\n\t * @param {PointerEvent} event\n\t */\n\tonSamePageWithHash = (event) => {\n\t\tconst link = event.delegateTarget;\n\t\tthis.maybeScrollToAnchor(link.hash, 'samePageWithHash');\n\t};\n\n\t/**\n\t * Attempts to scroll to an anchor\n\t * @param {string} hash\n\t * @param {string} context\n\t * @returns {boolean}\n\t */\n\tmaybeScrollToAnchor(hash, context) {\n\t\t// Bail early if the hash is null\n\t\tif (hash == null) {\n\t\t\treturn false;\n\t\t}\n\t\tconst element = this.getAnchorElement(hash);\n\t\tif (!element) {\n\t\t\tconsole.warn(`Element ${hash} not found`);\n\t\t\treturn false;\n\t\t}\n\t\tif (!(element instanceof Element)) {\n\t\t\tconsole.warn(`Element ${hash} is not a DOM node`);\n\t\t\treturn false;\n\t\t}\n\t\tconst top =\n\t\t\telement.getBoundingClientRect().top + window.pageYOffset - this.getOffset(element);\n\t\tthis.swup.scrollTo(top, this.shouldAnimate(context));\n\t\treturn true;\n\t}\n\n\t/**\n\t * Handles `transitionStart`\n\t * @param {PopStateEvent} popstate\n\t */\n\tonTransitionStart = (popstate) => {\n\t\tif (this.options.doScrollingRightAway && !this.swup.scrollToElement) {\n\t\t\tthis.doScrollingBetweenPages(popstate);\n\t\t}\n\t};\n\n\t/**\n\t * Handles `contentReplaced`\n\t * @param {PopStateEvent} popstate\n\t */\n\tonContentReplaced = (popstate) => {\n\t\tif (!this.options.doScrollingRightAway || this.swup.scrollToElement) {\n\t\t\tthis.doScrollingBetweenPages(popstate);\n\t\t}\n\n\t\tthis.restoreScrollContainers(popstate);\n\t};\n\n\t/**\n\t * Scrolls the window, based on context\n\t * @param {(PopStateEvent|boolean)} popstate\n\t * @returns {void}\n\t */\n\tdoScrollingBetweenPages = (popstate) => {\n\t\tconst swup = this.swup;\n\n\t\t// Bail early on popstate and inactive `animateHistoryBrowsing`\n\t\tif (popstate && !swup.options.animateHistoryBrowsing) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Try scrolling to a given anchor\n\t\tif (this.maybeScrollToAnchor(swup.scrollToElement, 'betweenPages')) {\n\t\t\tswup.scrollToElement = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// Finally, scroll to either the stored scroll position or to the very top of the page\n\t\tconst scrollPositions = this.getStoredScrollPositions(this.getCurrentCacheKey()) || {};\n\t\tconst top = (scrollPositions.window && scrollPositions.window.top) || 0;\n\t\t// Give possible JavaScript time to execute before scrolling\n\t\trequestAnimationFrame(() => swup.scrollTo(top, this.shouldAnimate('betweenPages')));\n\t};\n\n\t/**\n\t * Stores the current scroll positions for the URL we just came from\n\t */\n\tonWillReplaceContent = () => {\n\t\tthis.storeScrollPositions(this.currentCacheKey);\n\t\tthis.currentCacheKey = this.getCurrentCacheKey();\n\t};\n\n\t/**\n\t * Handles `clickLink`\n\t * @param {PointerEvent}\n\t * @returns {void}\n\t */\n\tonClickLink = (event) => {\n\t\tthis.maybeResetScrollPositions(event.delegateTarget);\n\t};\n\n\t/**\n\t * Deletes the scroll positions for the URL a link is pointing to,\n\t * if shouldResetScrollPosition evaluates to true\n\t * @param {HTMLAnchorElement} htmlAnchorElement\n\t * @returns {void}\n\t */\n\tmaybeResetScrollPositions(htmlAnchorElement) {\n\t\tif (!this.options.shouldResetScrollPosition(htmlAnchorElement)) {\n\t\t\treturn;\n\t\t}\n\t\tconst { url } = Location.fromElement(htmlAnchorElement);\n\t\tthis.resetScrollPositions(url);\n\t}\n\n\t/**\n\t * Stores the scroll positions for the current URL\n\t * @param {string} url\n\t * @returns {void}\n\t */\n\tstoreScrollPositions(url) {\n\t\t// retrieve the current scroll position for all containers\n\t\tconst containers = queryAll(this.options.scrollContainers).map((el) => ({\n\t\t\ttop: el.scrollTop,\n\t\t\tleft: el.scrollLeft\n\t\t}));\n\n\t\t// construct the final object entry, with the window scroll positions added\n\t\tthis.scrollPositionsStore[url] = {\n\t\t\twindow: { top: window.scrollY, left: window.scrollX },\n\t\t\tcontainers\n\t\t};\n\t}\n\n\t/**\n\t * Resets stored scroll positions for a given URL\n\t * @param {string} url\n\t */\n\tresetScrollPositions(url) {\n\t\tconst cacheKey = this.getResolvedUrl(url);\n\t\tdelete this.scrollPositionsStore[cacheKey];\n\t\tthis.scrollPositionsStore[cacheKey] = null;\n\t}\n\n\t/**\n\t * Get the stored scroll positions for a given URL from the cache\n\t * @returns {(object|undefined)}\n\t */\n\tgetStoredScrollPositions(url) {\n\t\tconst cacheKey = this.getResolvedUrl(url);\n\t\treturn this.scrollPositionsStore[cacheKey];\n\t}\n\n\t/**\n\t * Restore the scroll positions for all matching scrollContainers\n\t * @returns void\n\t */\n\trestoreScrollContainers(popstate) {\n\t\t// get the stored scroll positions from the cache\n\t\tconst scrollPositions = this.getStoredScrollPositions(this.getCurrentCacheKey()) || {};\n\t\tif (scrollPositions.containers == null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// cycle through all containers on the current page and restore their scroll positions, if appropriate\n\t\tqueryAll(this.options.scrollContainers).forEach((el, index) => {\n\t\t\tconst scrollPosition = scrollPositions.containers[index];\n\t\t\tif (scrollPosition == null) return;\n\t\t\tel.scrollTop = scrollPosition.top;\n\t\t\tel.scrollLeft = scrollPosition.left;\n\t\t});\n\t}\n\t/**\n\t * Get the current cache key for the scroll positions.\n\t * @returns {string}\n\t */\n\tgetCurrentCacheKey() {\n\t\treturn this.getResolvedUrl(getCurrentUrl());\n\t}\n\t/**\n\t * Apply `swup.resolveUrl` to a given URL\n\t *\n\t * @returns {string}\n\t */\n\tgetResolvedUrl(url) {\n\t\tif (typeof this.swup.resolveUrl === 'function') {\n\t\t\treturn this.swup.resolveUrl(url);\n\t\t}\n\t\treturn url;\n\t}\n}\n"],"names":["r","String","split","concat","slice","join","n","constructor","this","isSwupPlugin","requires","swup","version","mount","unmount","_beforeMount","name","Error","_afterUnmount","_checkRequirements","Object","entries","forEach","e","t","i","findPlugin","every","match","s","o","localeCompare","numeric","Array","isArray","u","document","from","querySelectorAll","m","URL","baseURI","super","toString","url","pathname","search","static","getAttribute","assign","bind","arguments","length","prototype","hasOwnProperty","call","apply","_raf","_positionY","_velocityY","_targetPositionY","_targetPositionYWithOffset","_direction","scrollTo","nodeType","Math","round","getBoundingClientRect","top","window","pageYOffset","parseInt","console","error","documentElement","scrollHeight","innerHeight","body","scrollTop","options","onStart","_animate","onAlreadyAtPositions","_update","_render","requestAnimationFrame","onTick","onEnd","acceleration","friction","abs","onCancel","addEventListener","cancelAnimationFrame","passive","ScrollPlugin","Plugin","getAnchorElement","hash","_this","querySelector","getOffset","element","offset","onSamePage","shouldAnimate","onSamePageWithHash","event","maybeScrollToAnchor","delegateTarget","onTransitionStart","popstate","doScrollingRightAway","scrollToElement","doScrollingBetweenPages","onContentReplaced","restoreScrollContainers","animateHistoryBrowsing","scrollPositions","getStoredScrollPositions","getCurrentCacheKey","onWillReplaceContent","storeScrollPositions","currentCacheKey","onClickLink","maybeResetScrollPositions","animateScroll","betweenPages","samePageWithHash","samePage","scrollFriction","scrollAcceleration","scrollContainers","shouldResetScrollPosition","htmlAnchorElement","_this2","_handlers","scrollDone","scrollStart","scrl","Scrl","triggerEvent","animate","scrollPositionsStore","previousScrollRestoration","history","scrollRestoration","on","off","context","warn","Element","Location","fromElement","resetScrollPositions","queryAll","map","el","left","scrollLeft","scrollY","scrollX","containers","cacheKey","getResolvedUrl","index","scrollPosition","location","getCurrentUrl","resolveUrl"],"mappings":"mOAAA,MAAMA,EAAEA,GAAGC,OAAOD,GAAGE,MAAM,KAAKC,OAAO,CAAC,IAAI,MAAMC,MAA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/asE,GAC5B,CAMAJ,eAAexH,GACd,MAAoC,wBAApBjC,KAAK8J,gBACR9J,KAAK8J,WAAW7H,IAG9B"} \ No newline at end of file diff --git a/source/js/libs/SwupSlideTheme.min.js b/source/js/libs/SwupSlideTheme.min.js new file mode 100644 index 00000000..5493788a --- /dev/null +++ b/source/js/libs/SwupSlideTheme.min.js @@ -0,0 +1 @@ +(function e(t,n){if(typeof exports==="object"&&typeof module==="object")module.exports=n();else if(typeof define==="function"&&define.amd)define([],n);else if(typeof exports==="object")exports["SwupSlideTheme"]=n();else t["SwupSlideTheme"]=n()})(window,function(){return function(e){var t={};function n(r){if(t[r]){return t[r].exports}var o=t[r]={i:r,l:false,exports:{}};e[r].call(o.exports,o,o.exports,n);o.l=true;return o.exports}n.m=e;n.c=t;n.d=function(e,t,r){if(!n.o(e,t)){Object.defineProperty(e,t,{enumerable:true,get:r})}};n.r=function(e){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})};n.t=function(e,t){if(t&1)e=n(e);if(t&8)return e;if(t&4&&typeof e==="object"&&e&&e.__esModule)return e;var r=Object.create(null);n.r(r);Object.defineProperty(r,"default",{enumerable:true,value:e});if(t&2&&typeof e!="string")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 t(){return e["default"]}:function t(){return e};n.d(t,"a",t);return t};n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};n.p="";return n(n.s=0)}([function(e,t,n){"use strict";var r=n(1);var o=i(r);function i(e){return e&&e.__esModule?e:{default:e}}e.exports=o.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=Object.assign||function(e){for(var t=1;t]+>/gi;var htmlAttribsRegex=/\s?[a-z:]+(?:=['"][^'">]+['"])*/gi;var matches=html.match(htmlRegex);if(matches&&matches.length){matches=matches[0].match(htmlAttribsRegex);if(matches.length){matches.shift();matches.forEach(function(htmlAttrib){var attr=htmlAttrib.trim().split("=");if(attr.length===1){tmpEl.documentElement.setAttribute(attr[0],true)}else{tmpEl.documentElement.setAttribute(attr[0],attr[1].slice(1,-1))}})}}tmpEl.documentElement.innerHTML=html;this.log("load content",tmpEl.documentElement.attributes,tmpEl.documentElement.innerHTML.length);if(document.activeElement&&contains(document,this.options.selectors,document.activeElement)){try{document.activeElement.blur()}catch(e){}}this.switchSelectors(this.options.selectors,tmpEl,document,options)},abortRequest:require("./lib/abort-request"),doRequest:require("./lib/send-request"),handleResponse:require("./lib/proto/handle-response"),loadUrl:function(href,options){options=typeof options==="object"?extend({},this.options,options):clone(this.options);this.log("load href",href,options);this.abortRequest(this.request);trigger(document,"pjax:send",options);this.request=this.doRequest(href,options,this.handleResponse.bind(this))},executeScripts:function(elements){elements.forEach(function(element){var code=element.text||element.textContent||element.innerHTML||"";var script=document.createElement("script");if(element.id){script.id=element.id}if(element.className){script.className=element.className}if(element.type){script.type=element.type}if(element.src){script.src=element.src;script.async=false}if(element.dataset.pjax!==undefined){script.dataset.pjax=""}if(code!==""){script.appendChild(document.createTextNode(code))}element.parentNode.replaceChild(script,element)})},afterAllSwitches:function(){var autofocusEl=Array.prototype.slice.call(document.querySelectorAll("[autofocus]")).pop();if(autofocusEl&&document.activeElement!==autofocusEl){autofocusEl.focus()}this.options.selectors.forEach(function(selector){forEachEls(document.querySelectorAll(selector),function(el){if(el===0);})});var state=this.state;if(state.options.history){if(!window.history.state){this.lastUid=this.maxUid=newUid();window.history.replaceState({url:window.location.href,title:document.title,uid:this.maxUid,scrollPos:[0,0]},document.title)}this.lastUid=this.maxUid=newUid();window.history.pushState({url:state.href,title:state.options.title,uid:this.maxUid,scrollPos:[0,0]},state.options.title,state.href)}this.forEachSelectors(function(el){this.parseDOM(el)},this);trigger(document,"pjax:complete pjax:success",state.options);if(typeof state.options.analytics==="function"){state.options.analytics()}if(state.options.history){var a=document.createElement("a");a.href=this.state.href;if(a.hash){var name=a.hash.slice(1);name=decodeURIComponent(name);var curtop=0;var target=document.getElementById(name)||document.getElementsByName(name)[0];if(target){if(target.offsetParent){do{curtop+=target.offsetTop;target=target.offsetParent}while(target)}}window.scrollTo(0,curtop)}else if(state.options.scrollTo!==false){if(state.options.scrollTo.length>1){window.scrollTo(state.options.scrollTo[0],state.options.scrollTo[1])}else{window.scrollTo(0,state.options.scrollTo)}}}else if(state.options.scrollRestoration&&state.options.scrollPos){window.scrollTo(state.options.scrollPos[0],state.options.scrollPos[1])}this.state={numPendingSwitches:0,href:null,options:null}}};Pjax.isSupported=require("./lib/is-supported");if(Pjax.isSupported()){module.exports=Pjax}else{var stupidPjax=noop;for(var key in Pjax.prototype){if(Pjax.prototype.hasOwnProperty(key)&&typeof Pjax.prototype[key]==="function"){stupidPjax[key]=noop}}module.exports=stupidPjax}},{"./lib/abort-request":2,"./lib/events/on":3,"./lib/events/trigger":4,"./lib/foreach-els":5,"./lib/foreach-selectors":6,"./lib/is-supported":7,"./lib/parse-options":8,"./lib/proto/attach-form":9,"./lib/proto/attach-link":10,"./lib/proto/handle-response":11,"./lib/proto/log":12,"./lib/proto/parse-element":13,"./lib/send-request":14,"./lib/switches":16,"./lib/switches-selectors":15,"./lib/uniqueid":17,"./lib/util/clone":18,"./lib/util/contains":19,"./lib/util/extend":20,"./lib/util/noop":21}],2:[function(require,module,exports){var noop=require("./util/noop");module.exports=function(request){if(request&&request.readyState<4){request.onreadystatechange=noop;request.abort()}}},{"./util/noop":21}],3:[function(require,module,exports){var forEachEls=require("../foreach-els");module.exports=function(els,events,listener,useCapture){events=typeof events==="string"?events.split(" "):events;events.forEach(function(e){forEachEls(els,function(el){el.addEventListener(e,listener,useCapture)})})}},{"../foreach-els":5}],4:[function(require,module,exports){var forEachEls=require("../foreach-els");module.exports=function(els,events,opts){events=typeof events==="string"?events.split(" "):events;events.forEach(function(e){var event;event=document.createEvent("HTMLEvents");event.initEvent(e,true,true);event.eventName=e;if(opts){Object.keys(opts).forEach(function(key){event[key]=opts[key]})}forEachEls(els,function(el){var domFix=false;if(!el.parentNode&&el!==document&&el!==window){domFix=true;document.body.appendChild(el)}el.dispatchEvent(event);if(domFix){el.parentNode.removeChild(el)}})})}},{"../foreach-els":5}],5:[function(require,module,exports){module.exports=function(els,fn,context){if(els instanceof HTMLCollection||els instanceof NodeList||els instanceof Array){return Array.prototype.forEach.call(els,fn,context)}return fn.call(context,els)}},{}],6:[function(require,module,exports){var forEachEls=require("./foreach-els");module.exports=function(selectors,cb,context,DOMcontext){DOMcontext=DOMcontext||document;selectors.forEach(function(selector){forEachEls(DOMcontext.querySelectorAll(selector),cb,context)})}},{"./foreach-els":5}],7:[function(require,module,exports){module.exports=function(){return window.history&&window.history.pushState&&window.history.replaceState&&!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/)}},{}],8:[function(require,module,exports){var defaultSwitches=require("./switches");module.exports=function(options){options=options||{};options.elements=options.elements||"a[href], form[action]";options.selectors=options.selectors||["title",".js-Pjax"];options.switches=options.switches||{};options.switchesOptions=options.switchesOptions||{};options.history=typeof options.history==="undefined"?true:options.history;options.analytics=typeof options.analytics==="function"||options.analytics===false?options.analytics:defaultAnalytics;options.scrollTo=typeof options.scrollTo==="undefined"?0:options.scrollTo;options.scrollRestoration=typeof options.scrollRestoration!=="undefined"?options.scrollRestoration:true;options.cacheBust=typeof options.cacheBust==="undefined"?true:options.cacheBust;options.debug=options.debug||false;options.timeout=options.timeout||0;options.currentUrlFullReload=typeof options.currentUrlFullReload==="undefined"?false:options.currentUrlFullReload;if(!options.switches.head){options.switches.head=defaultSwitches.switchElementsAlt}if(!options.switches.body){options.switches.body=defaultSwitches.switchElementsAlt}return options};function defaultAnalytics(){if(window._gaq){_gaq.push(["_trackPageview"])}if(window.ga){ga("send","pageview",{page:location.pathname,title:document.title})}}},{"./switches":16}],9:[function(require,module,exports){var on=require("../events/on");var clone=require("../util/clone");var attrState="data-pjax-state";var formAction=function(el,event){if(isDefaultPrevented(event)){return}var options=clone(this.options);options.requestOptions={requestUrl:el.getAttribute("action")||window.location.href,requestMethod:el.getAttribute("method")||"GET"};var virtLinkElement=document.createElement("a");virtLinkElement.setAttribute("href",options.requestOptions.requestUrl);var attrValue=checkIfShouldAbort(virtLinkElement,options);if(attrValue){el.setAttribute(attrState,attrValue);return}event.preventDefault();if(el.enctype==="multipart/form-data"){options.requestOptions.formData=new FormData(el)}else{options.requestOptions.requestParams=parseFormElements(el)}el.setAttribute(attrState,"submit");options.triggerElement=el;this.loadUrl(virtLinkElement.href,options)};function parseFormElements(el){var requestParams=[];var formElements=el.elements;for(var i=0;i1||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey){return"modifier"}if(el.protocol!==window.location.protocol||el.host!==window.location.host){return"external"}if(el.hash&&el.href.replace(el.hash,"")===window.location.href.replace(location.hash,"")){return"anchor"}if(el.href===window.location.href.split("#")[0]+"#"){return"anchor-empty"}}var isDefaultPrevented=function(event){return event.defaultPrevented||event.returnValue===false};module.exports=function(el){var that=this;el.setAttribute(attrState,"");on(el,"click",function(event){linkAction.call(that,el,event)});on(el,"keyup",function(event){if(event.keyCode===13){linkAction.call(that,el,event)}}.bind(this))}},{"../events/on":3,"../util/clone":18}],11:[function(require,module,exports){var clone=require("../util/clone");var newUid=require("../uniqueid");var trigger=require("../events/trigger");module.exports=function(responseText,request,href,options){options=clone(options||this.options);options.request=request;if(responseText===false){trigger(document,"pjax:complete pjax:error",options);return}var currentState=window.history.state||{};window.history.replaceState({url:currentState.url||window.location.href,title:currentState.title||document.title,uid:currentState.uid||newUid(),scrollPos:[document.documentElement.scrollLeft||document.body.scrollLeft,document.documentElement.scrollTop||document.body.scrollTop]},document.title,window.location.href);var oldHref=href;if(request.responseURL){if(href!==request.responseURL){href=request.responseURL}}else if(request.getResponseHeader("X-PJAX-URL")){href=request.getResponseHeader("X-PJAX-URL")}else if(request.getResponseHeader("X-XHR-Redirected-To")){href=request.getResponseHeader("X-XHR-Redirected-To")}var a=document.createElement("a");a.href=oldHref;var oldHash=a.hash;a.href=href;if(oldHash&&!a.hash){a.hash=oldHash;href=a.href}this.state.href=href;this.state.options=options;try{this.loadContent(responseText,options)}catch(e){trigger(document,"pjax:error",options);if(!this.options.debug){if(console&&console.error){console.error("Pjax switch fail: ",e)}return this.latestChance(href)}else{throw e}}}},{"../events/trigger":4,"../uniqueid":17,"../util/clone":18}],12:[function(require,module,exports){module.exports=function(){if(this.options.debug&&console){if(typeof console.log==="function"){console.log.apply(console,arguments)}else if(console.log){console.log(arguments)}}}},{}],13:[function(require,module,exports){var attrState="data-pjax-state";module.exports=function(el){switch(el.tagName.toLowerCase()){case"a":if(!el.hasAttribute(attrState)){this.attachLink(el)}break;case"form":if(!el.hasAttribute(attrState)){this.attachForm(el)}break;default:throw"Pjax can only be applied on or
    submit"}}},{}],14:[function(require,module,exports){var updateQueryString=require("./util/update-query-string");module.exports=function(location,options,callback){options=options||{};var queryString;var requestOptions=options.requestOptions||{};var requestMethod=(requestOptions.requestMethod||"GET").toUpperCase();var requestParams=requestOptions.requestParams||null;var formData=requestOptions.formData||null;var requestPayload=null;var request=new XMLHttpRequest;var timeout=options.timeout||0;request.onreadystatechange=function(){if(request.readyState===4){if(request.status===200){callback(request.responseText,request,location,options)}else if(request.status!==0){callback(null,request,location,options)}}};request.onerror=function(e){console.log(e);callback(null,request,location,options)};request.ontimeout=function(){callback(null,request,location,options)};if(requestParams&&requestParams.length){queryString=requestParams.map(function(param){return param.name+"="+param.value}).join("&");switch(requestMethod){case"GET":location=location.split("?")[0];location+="?"+queryString;break;case"POST":requestPayload=queryString;break}}else if(formData){requestPayload=formData}if(options.cacheBust){location=updateQueryString(location,"t",Date.now())}request.open(requestMethod,location,true);request.timeout=timeout;request.setRequestHeader("X-Requested-With","XMLHttpRequest");request.setRequestHeader("X-PJAX","true");request.setRequestHeader("X-PJAX-Selectors",JSON.stringify(options.selectors));if(requestPayload&&requestMethod==="POST"&&!formData){request.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}request.send(requestPayload);return request}},{"./util/update-query-string":22}],15:[function(require,module,exports){var forEachEls=require("./foreach-els");var defaultSwitches=require("./switches");module.exports=function(switches,switchesOptions,selectors,fromEl,toEl,options){var switchesQueue=[];selectors.forEach(function(selector){var newEls=fromEl.querySelectorAll(selector);var oldEls=toEl.querySelectorAll(selector);if(this.log){this.log("Pjax switch",selector,newEls,oldEls)}if(newEls.length!==oldEls.length){throw"DOM doesn’t look the same on new loaded page: ’"+selector+"’ - new "+newEls.length+", old "+oldEls.length}forEachEls(newEls,function(newEl,i){var oldEl=oldEls[i];if(this.log){this.log("newEl",newEl,"oldEl",oldEl)}var callback=switches[selector]?switches[selector].bind(this,oldEl,newEl,options,switchesOptions[selector]):defaultSwitches.outerHTML.bind(this,oldEl,newEl,options);switchesQueue.push(callback)},this)},this);this.state.numPendingSwitches=switchesQueue.length;switchesQueue.forEach(function(queuedSwitch){queuedSwitch()})}},{"./foreach-els":5,"./switches":16}],16:[function(require,module,exports){var on=require("./events/on");module.exports={outerHTML:function(oldEl,newEl){oldEl.outerHTML=newEl.outerHTML;this.onSwitch()},innerHTML:function(oldEl,newEl){oldEl.innerHTML=newEl.innerHTML;if(newEl.className===""){oldEl.removeAttribute("class")}else{oldEl.className=newEl.className}this.onSwitch()},switchElementsAlt:function(oldEl,newEl){oldEl.innerHTML=newEl.innerHTML;if(newEl.hasAttributes()){var attrs=newEl.attributes;for(var i=0;i]+>/gi;var htmlAttribsRegex=/\s?[a-z:]+(?:=['"][^'">]+['"])*/gi;var matches=html.match(htmlRegex);if(matches&&matches.length){matches=matches[0].match(htmlAttribsRegex);if(matches.length){matches.shift();matches.forEach(function(htmlAttrib){var attr=htmlAttrib.trim().split("=");if(attr.length===1){tmpEl.documentElement.setAttribute(attr[0],true)}else{tmpEl.documentElement.setAttribute(attr[0],attr[1].slice(1,-1))}})}}tmpEl.documentElement.innerHTML=html;this.log("load content",tmpEl.documentElement.attributes,tmpEl.documentElement.innerHTML.length);if(document.activeElement&&contains(document,this.options.selectors,document.activeElement)){try{document.activeElement.blur()}catch(e){}}this.switchSelectors(this.options.selectors,tmpEl,document,options)},abortRequest:require("./lib/abort-request"),doRequest:require("./lib/send-request"),handleResponse:require("./lib/proto/handle-response"),loadUrl:function(href,options){options=typeof options==="object"?extend({},this.options,options):clone(this.options);this.log("load href",href,options);this.abortRequest(this.request);trigger(document,"pjax:send",options);this.request=this.doRequest(href,options,this.handleResponse.bind(this))},afterAllSwitches:function(){var autofocusEl=Array.prototype.slice.call(document.querySelectorAll("[autofocus]")).pop();if(autofocusEl&&document.activeElement!==autofocusEl){autofocusEl.focus()}this.options.selectors.forEach(function(selector){forEachEls(document.querySelectorAll(selector),function(el){executeScripts(el)})});var state=this.state;if(state.options.history){if(!window.history.state){this.lastUid=this.maxUid=newUid();window.history.replaceState({url:window.location.href,title:document.title,uid:this.maxUid,scrollPos:[0,0]},document.title)}this.lastUid=this.maxUid=newUid();window.history.pushState({url:state.href,title:state.options.title,uid:this.maxUid,scrollPos:[0,0]},state.options.title,state.href)}this.forEachSelectors(function(el){this.parseDOM(el)},this);trigger(document,"pjax:complete pjax:success",state.options);if(typeof state.options.analytics==="function"){state.options.analytics()}if(state.options.history){var a=document.createElement("a");a.href=this.state.href;if(a.hash){var name=a.hash.slice(1);name=decodeURIComponent(name);var curtop=0;var target=document.getElementById(name)||document.getElementsByName(name)[0];if(target){if(target.offsetParent){do{curtop+=target.offsetTop;target=target.offsetParent}while(target)}}window.scrollTo(0,curtop)}else if(state.options.scrollTo!==false){if(state.options.scrollTo.length>1){window.scrollTo(state.options.scrollTo[0],state.options.scrollTo[1])}else{window.scrollTo(0,state.options.scrollTo)}}}else if(state.options.scrollRestoration&&state.options.scrollPos){window.scrollTo(state.options.scrollPos[0],state.options.scrollPos[1])}this.state={numPendingSwitches:0,href:null,options:null}}};Pjax.isSupported=require("./lib/is-supported");if(Pjax.isSupported()){module.exports=Pjax}else{var stupidPjax=noop;for(var key in Pjax.prototype){if(Pjax.prototype.hasOwnProperty(key)&&typeof Pjax.prototype[key]==="function"){stupidPjax[key]=noop}}module.exports=stupidPjax}},{"./lib/abort-request":2,"./lib/events/on":4,"./lib/events/trigger":5,"./lib/execute-scripts":6,"./lib/foreach-els":7,"./lib/foreach-selectors":8,"./lib/is-supported":9,"./lib/parse-options":10,"./lib/proto/attach-form":11,"./lib/proto/attach-link":12,"./lib/proto/handle-response":13,"./lib/proto/log":14,"./lib/proto/parse-element":15,"./lib/send-request":16,"./lib/switches":18,"./lib/switches-selectors":17,"./lib/uniqueid":19,"./lib/util/clone":20,"./lib/util/contains":21,"./lib/util/extend":22,"./lib/util/noop":23}],2:[function(require,module,exports){var noop=require("./util/noop");module.exports=function(request){if(request&&request.readyState<4){request.onreadystatechange=noop;request.abort()}}},{"./util/noop":23}],3:[function(require,module,exports){module.exports=function(el){var code=el.text||el.textContent||el.innerHTML||"";var src=el.src||"";var parent=el.parentNode||document.querySelector("head")||document.documentElement;var script=document.createElement("script");if(code.match("document.write")){if(console&&console.log){console.log("Script contains document.write. Can’t be executed correctly. Code skipped ",el)}return false}script.type="text/javascript";script.id=el.id;if(src!==""){script.src=src;script.async=false}if(code!==""){try{script.appendChild(document.createTextNode(code))}catch(e){script.text=code}}parent.appendChild(script);if((parent instanceof HTMLHeadElement||parent instanceof HTMLBodyElement)&&parent.contains(script)){parent.removeChild(script)}return true}},{}],4:[function(require,module,exports){var forEachEls=require("../foreach-els");module.exports=function(els,events,listener,useCapture){events=typeof events==="string"?events.split(" "):events;events.forEach(function(e){forEachEls(els,function(el){el.addEventListener(e,listener,useCapture)})})}},{"../foreach-els":7}],5:[function(require,module,exports){var forEachEls=require("../foreach-els");module.exports=function(els,events,opts){events=typeof events==="string"?events.split(" "):events;events.forEach(function(e){var event;event=document.createEvent("HTMLEvents");event.initEvent(e,true,true);event.eventName=e;if(opts){Object.keys(opts).forEach(function(key){event[key]=opts[key]})}forEachEls(els,function(el){var domFix=false;if(!el.parentNode&&el!==document&&el!==window){domFix=true;document.body.appendChild(el)}el.dispatchEvent(event);if(domFix){el.parentNode.removeChild(el)}})})}},{"../foreach-els":7}],6:[function(require,module,exports){var forEachEls=require("./foreach-els");var evalScript=require("./eval-script");module.exports=function(el){if(el.tagName.toLowerCase()==="script"){evalScript(el)}forEachEls(el.querySelectorAll("script"),function(script){if(!script.type||script.type.toLowerCase()==="text/javascript"){if(script.parentNode){script.parentNode.removeChild(script)}evalScript(script)}})}},{"./eval-script":3,"./foreach-els":7}],7:[function(require,module,exports){module.exports=function(els,fn,context){if(els instanceof HTMLCollection||els instanceof NodeList||els instanceof Array){return Array.prototype.forEach.call(els,fn,context)}return fn.call(context,els)}},{}],8:[function(require,module,exports){var forEachEls=require("./foreach-els");module.exports=function(selectors,cb,context,DOMcontext){DOMcontext=DOMcontext||document;selectors.forEach(function(selector){forEachEls(DOMcontext.querySelectorAll(selector),cb,context)})}},{"./foreach-els":7}],9:[function(require,module,exports){module.exports=function(){return window.history&&window.history.pushState&&window.history.replaceState&&!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/)}},{}],10:[function(require,module,exports){var defaultSwitches=require("./switches");module.exports=function(options){options=options||{};options.elements=options.elements||"a[href], form[action]";options.selectors=options.selectors||["title",".js-Pjax"];options.switches=options.switches||{};options.switchesOptions=options.switchesOptions||{};options.history=typeof options.history==="undefined"?true:options.history;options.analytics=typeof options.analytics==="function"||options.analytics===false?options.analytics:defaultAnalytics;options.scrollTo=typeof options.scrollTo==="undefined"?0:options.scrollTo;options.scrollRestoration=typeof options.scrollRestoration!=="undefined"?options.scrollRestoration:true;options.cacheBust=typeof options.cacheBust==="undefined"?true:options.cacheBust;options.debug=options.debug||false;options.timeout=options.timeout||0;options.currentUrlFullReload=typeof options.currentUrlFullReload==="undefined"?false:options.currentUrlFullReload;if(!options.switches.head){options.switches.head=defaultSwitches.switchElementsAlt}if(!options.switches.body){options.switches.body=defaultSwitches.switchElementsAlt}return options};function defaultAnalytics(){if(window._gaq){_gaq.push(["_trackPageview"])}if(window.ga){ga("send","pageview",{page:location.pathname,title:document.title})}}},{"./switches":18}],11:[function(require,module,exports){var on=require("../events/on");var clone=require("../util/clone");var attrState="data-pjax-state";var formAction=function(el,event){if(isDefaultPrevented(event)){return}var options=clone(this.options);options.requestOptions={requestUrl:el.getAttribute("action")||window.location.href,requestMethod:el.getAttribute("method")||"GET"};var virtLinkElement=document.createElement("a");virtLinkElement.setAttribute("href",options.requestOptions.requestUrl);var attrValue=checkIfShouldAbort(virtLinkElement,options);if(attrValue){el.setAttribute(attrState,attrValue);return}event.preventDefault();if(el.enctype==="multipart/form-data"){options.requestOptions.formData=new FormData(el)}else{options.requestOptions.requestParams=parseFormElements(el)}el.setAttribute(attrState,"submit");options.triggerElement=el;this.loadUrl(virtLinkElement.href,options)};function parseFormElements(el){var requestParams=[];var formElements=el.elements;for(var i=0;i1||event.metaKey||event.ctrlKey||event.shiftKey||event.altKey){return"modifier"}if(el.protocol!==window.location.protocol||el.host!==window.location.host){return"external"}if(el.hash&&el.href.replace(el.hash,"")===window.location.href.replace(location.hash,"")){return"anchor"}if(el.href===window.location.href.split("#")[0]+"#"){return"anchor-empty"}}var isDefaultPrevented=function(event){return event.defaultPrevented||event.returnValue===false};module.exports=function(el){var that=this;el.setAttribute(attrState,"");on(el,"click",function(event){linkAction.call(that,el,event)});on(el,"keyup",function(event){if(event.keyCode===13){linkAction.call(that,el,event)}}.bind(this))}},{"../events/on":4,"../util/clone":20}],13:[function(require,module,exports){var clone=require("../util/clone");var newUid=require("../uniqueid");var trigger=require("../events/trigger");module.exports=function(responseText,request,href,options){options=clone(options||this.options);options.request=request;if(responseText===false){trigger(document,"pjax:complete pjax:error",options);return}var currentState=window.history.state||{};window.history.replaceState({url:currentState.url||window.location.href,title:currentState.title||document.title,uid:currentState.uid||newUid(),scrollPos:[document.documentElement.scrollLeft||document.body.scrollLeft,document.documentElement.scrollTop||document.body.scrollTop]},document.title,window.location.href);var oldHref=href;if(request.responseURL){if(href!==request.responseURL){href=request.responseURL}}else if(request.getResponseHeader("X-PJAX-URL")){href=request.getResponseHeader("X-PJAX-URL")}else if(request.getResponseHeader("X-XHR-Redirected-To")){href=request.getResponseHeader("X-XHR-Redirected-To")}var a=document.createElement("a");a.href=oldHref;var oldHash=a.hash;a.href=href;if(oldHash&&!a.hash){a.hash=oldHash;href=a.href}this.state.href=href;this.state.options=options;try{this.loadContent(responseText,options)}catch(e){trigger(document,"pjax:error",options);if(!this.options.debug){if(console&&console.error){console.error("Pjax switch fail: ",e)}return this.latestChance(href)}else{throw e}}}},{"../events/trigger":5,"../uniqueid":19,"../util/clone":20}],14:[function(require,module,exports){module.exports=function(){if(this.options.debug&&console){if(typeof console.log==="function"){console.log.apply(console,arguments)}else if(console.log){console.log(arguments)}}}},{}],15:[function(require,module,exports){var attrState="data-pjax-state";module.exports=function(el){switch(el.tagName.toLowerCase()){case"a":if(!el.hasAttribute(attrState)){this.attachLink(el)}break;case"form":if(!el.hasAttribute(attrState)){this.attachForm(el)}break;default:throw"Pjax can only be applied on or submit"}}},{}],16:[function(require,module,exports){var updateQueryString=require("./util/update-query-string");module.exports=function(location,options,callback){options=options||{};var queryString;var requestOptions=options.requestOptions||{};var requestMethod=(requestOptions.requestMethod||"GET").toUpperCase();var requestParams=requestOptions.requestParams||null;var formData=requestOptions.formData||null;var requestPayload=null;var request=new XMLHttpRequest;var timeout=options.timeout||0;request.onreadystatechange=function(){if(request.readyState===4){if(request.status===200){callback(request.responseText,request,location,options)}else if(request.status!==0){callback(null,request,location,options)}}};request.onerror=function(e){console.log(e);callback(null,request,location,options)};request.ontimeout=function(){callback(null,request,location,options)};if(requestParams&&requestParams.length){queryString=requestParams.map(function(param){return param.name+"="+param.value}).join("&");switch(requestMethod){case"GET":location=location.split("?")[0];location+="?"+queryString;break;case"POST":requestPayload=queryString;break}}else if(formData){requestPayload=formData}if(options.cacheBust){location=updateQueryString(location,"t",Date.now())}request.open(requestMethod,location,true);request.timeout=timeout;request.setRequestHeader("X-Requested-With","XMLHttpRequest");request.setRequestHeader("X-PJAX","true");request.setRequestHeader("X-PJAX-Selectors",JSON.stringify(options.selectors));if(requestPayload&&requestMethod==="POST"&&!formData){request.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}request.send(requestPayload);return request}},{"./util/update-query-string":24}],17:[function(require,module,exports){var forEachEls=require("./foreach-els");var defaultSwitches=require("./switches");module.exports=function(switches,switchesOptions,selectors,fromEl,toEl,options){var switchesQueue=[];selectors.forEach(function(selector){var newEls=fromEl.querySelectorAll(selector);var oldEls=toEl.querySelectorAll(selector);if(this.log){this.log("Pjax switch",selector,newEls,oldEls)}if(newEls.length!==oldEls.length){throw"DOM doesn’t look the same on new loaded page: ’"+selector+"’ - new "+newEls.length+", old "+oldEls.length}forEachEls(newEls,function(newEl,i){var oldEl=oldEls[i];if(this.log){this.log("newEl",newEl,"oldEl",oldEl)}var callback=switches[selector]?switches[selector].bind(this,oldEl,newEl,options,switchesOptions[selector]):defaultSwitches.outerHTML.bind(this,oldEl,newEl,options);switchesQueue.push(callback)},this)},this);this.state.numPendingSwitches=switchesQueue.length;switchesQueue.forEach(function(queuedSwitch){queuedSwitch()})}},{"./foreach-els":7,"./switches":18}],18:[function(require,module,exports){var on=require("./events/on");module.exports={outerHTML:function(oldEl,newEl){oldEl.outerHTML=newEl.outerHTML;this.onSwitch()},innerHTML:function(oldEl,newEl){oldEl.innerHTML=newEl.innerHTML;if(newEl.className===""){oldEl.removeAttribute("class")}else{oldEl.className=newEl.className}this.onSwitch()},switchElementsAlt:function(oldEl,newEl){oldEl.innerHTML=newEl.innerHTML;if(newEl.hasAttributes()){var attrs=newEl.attributes;for(var i=0;i { + loadingPlaceholder.style.display = "none"; + masonryContainer.style.display = "block"; + var masonry = new MiniMasonry({ + container: masonryContainer, + gutterX: 10, + gutterY: 5, + surroundingGutter: false, + }); + masonry.layout(); + masonryContainer.style.opacity = 1; + }, 100); + + + } } diff --git a/source/js/plugins/tabs.js b/source/js/plugins/tabs.js index 8ddf6e69..78d35e4e 100644 --- a/source/js/plugins/tabs.js +++ b/source/js/plugins/tabs.js @@ -23,7 +23,7 @@ function setTabs() { } -if (Global.theme_config.global.pjax === true && Global.utils) { +if (Global.theme_config.global.single_page === true && Global.utils) { setTabs(); } else { window.addEventListener('DOMContentLoaded', setTabs); diff --git a/source/js/tools/runtime.js b/source/js/tools/runtime.js index 7bb7e98b..97a97ea6 100644 --- a/source/js/tools/runtime.js +++ b/source/js/tools/runtime.js @@ -18,8 +18,5 @@ function footerRuntime() { runtime_seconds.innerHTML = D; } -if (Global.theme_config.global.pjax === true && Global.utils) { - footerRuntime(); -} else { - window.addEventListener('DOMContentLoaded', footerRuntime); -} \ No newline at end of file + +window.addEventListener('DOMContentLoaded', footerRuntime); \ No newline at end of file diff --git a/source/js/tools/tocToggle.js b/source/js/tools/tocToggle.js index 564cc9fe..73e0cd26 100755 --- a/source/js/tools/tocToggle.js +++ b/source/js/tools/tocToggle.js @@ -35,8 +35,8 @@ function initTocToggle() { Global.utils.TocToggle.initToggleBarButton(); } -if (Global.theme_config.global.pjax === true && Global.utils) { +swup.on('pageView', () => { initTocToggle(); -} else { - window.addEventListener('DOMContentLoaded', initTocToggle); -} +}); + +window.addEventListener('DOMContentLoaded', initTocToggle); diff --git a/source/js/utils.js b/source/js/utils.js index a7cdeda5..6202478b 100755 --- a/source/js/utils.js +++ b/source/js/utils.js @@ -8,7 +8,7 @@ Global.initUtils = () => { homeBanner_dom: document.querySelector(".home-banner-container"), scrollProgressBar_dom: document.querySelector(".scroll-progress-bar"), pjaxProgressBar_dom: document.querySelector(".pjax-progress-bar"), - pjaxProgressIcon_dom: document.querySelector(".pjax-progress-icon"), + pjaxProgressIcon_dom: document.querySelector(".swup-progress-icon"), backToTopButton_dom: document.querySelector(".tool-scroll-to-top"), toolsList: document.querySelector(".hidden-tools-list"), toggleButton: document.querySelector(".toggle-tools-list"), @@ -248,6 +248,18 @@ Global.initUtils = () => { toolExpandDom.addEventListener("click", () => { isExpand = !isExpand; setPageWidth(isExpand); + + var loadingPlaceholder = document.querySelector(".loading-placeholder"); + var masonryContainer = document.querySelector("#masonry-container"); + if (!loadingPlaceholder || !masonryContainer) return; + + loadingPlaceholder.style.opacity = 1; + loadingPlaceholder.style.display = "block"; + masonryContainer.style.display = "none"; + + setTimeout(() => { + Global.initMasonry(); + }, 300); }); },