jekyll-theme-abd3lraouf 5.2.6 → 5.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -21
  3. data/README.md +105 -105
  4. data/_data/assets/cross_origin.yml +62 -62
  5. data/_data/assets/self_host.yml +51 -51
  6. data/_data/authors.yml +17 -17
  7. data/_data/contact.yml +30 -30
  8. data/_data/locales/bg-BG.yml +83 -83
  9. data/_data/locales/en.yml +83 -83
  10. data/_data/locales/es-ES.yml +79 -79
  11. data/_data/locales/fr-FR.yml +79 -79
  12. data/_data/locales/hu-HU.yml +81 -81
  13. data/_data/locales/id-ID.yml +79 -79
  14. data/_data/locales/ko-KR.yml +79 -79
  15. data/_data/locales/my-MM.yml +79 -79
  16. data/_data/locales/pt-BR.yml +79 -79
  17. data/_data/locales/ru-RU.yml +79 -79
  18. data/_data/locales/tr-TR.yml +79 -79
  19. data/_data/locales/uk-UA.yml +79 -79
  20. data/_data/locales/vi-VN.yml +77 -77
  21. data/_data/locales/zh-CN.yml +78 -78
  22. data/_data/share.yml +27 -27
  23. data/_includes/assets-origin.html +12 -12
  24. data/_includes/comments/disqus.html +54 -54
  25. data/_includes/comments/giscus.html +56 -56
  26. data/_includes/comments/utterances.html +51 -51
  27. data/_includes/comments.html +5 -5
  28. data/_includes/datetime.html +21 -21
  29. data/_includes/favicons.html +17 -17
  30. data/_includes/footer.html +17 -36
  31. data/_includes/google-analytics.html +14 -14
  32. data/_includes/head.html +116 -116
  33. data/_includes/js-selector.html +104 -104
  34. data/_includes/jsdelivr-combine.html +32 -32
  35. data/_includes/lang.html +8 -8
  36. data/_includes/language-alias.html +70 -70
  37. data/_includes/mermaid.html +57 -57
  38. data/_includes/mode-toggle.html +129 -129
  39. data/_includes/no-linenos.html +10 -10
  40. data/_includes/post-nav.html +30 -30
  41. data/_includes/post-paginator.html +88 -88
  42. data/_includes/post-sharing.html +27 -27
  43. data/_includes/read-time.html +30 -30
  44. data/_includes/refactor-content.html +282 -282
  45. data/_includes/related-posts.html +103 -103
  46. data/_includes/search-loader.html +46 -46
  47. data/_includes/search-results.html +11 -11
  48. data/_includes/sidebar.html +93 -93
  49. data/_includes/toc.html +16 -16
  50. data/_includes/topbar.html +70 -70
  51. data/_includes/trending-tags.html +50 -50
  52. data/_includes/update-list.html +40 -40
  53. data/_layouts/archives.html +48 -48
  54. data/_layouts/categories.html +120 -120
  55. data/_layouts/category.html +24 -24
  56. data/_layouts/compress.html +10 -10
  57. data/_layouts/default.html +74 -74
  58. data/_layouts/home.html +103 -103
  59. data/_layouts/page.html +64 -64
  60. data/_layouts/post.html +159 -159
  61. data/_layouts/tag.html +23 -23
  62. data/_layouts/tags.html +23 -23
  63. data/_plugins/posts-lastmod-hook.rb +14 -14
  64. data/_sass/addon/commons.scss +1678 -1680
  65. data/_sass/addon/module.scss +151 -151
  66. data/_sass/addon/syntax.scss +289 -289
  67. data/_sass/addon/variables.scss +34 -34
  68. data/_sass/colors/dark-syntax.scss +88 -88
  69. data/_sass/colors/dark-typography.scss +157 -157
  70. data/_sass/colors/light-syntax.scss +84 -84
  71. data/_sass/colors/light-typography.scss +94 -94
  72. data/_sass/layout/archives.scss +147 -147
  73. data/_sass/layout/categories.scss +67 -67
  74. data/_sass/layout/category-tag.scss +73 -73
  75. data/_sass/layout/home.scss +184 -184
  76. data/_sass/layout/post.scss +369 -369
  77. data/_sass/layout/tags.scss +19 -19
  78. data/_sass/variables-hook.scss +3 -3
  79. data/_tabs/about.md +8 -8
  80. data/_tabs/archives.md +7 -7
  81. data/_tabs/categories.md +6 -6
  82. data/_tabs/tags.md +6 -6
  83. data/assets/404.html +16 -16
  84. data/assets/css/style.scss +12 -12
  85. data/assets/feed.xml +61 -61
  86. data/assets/img/favicons/browserconfig.xml +13 -13
  87. data/assets/img/favicons/site.webmanifest +26 -26
  88. data/assets/js/data/search.json +18 -18
  89. data/assets/js/data/swcache.js +55 -55
  90. data/assets/js/pwa/app.js +47 -47
  91. data/assets/js/pwa/sw.js +89 -89
  92. data/assets/js/pwa/unregister.js +12 -12
  93. data/assets/robots.txt +10 -10
  94. data/index.html +4 -4
  95. metadata +7 -7
@@ -1,19 +1,19 @@
1
- /*
2
- Styles for Tab Tags
3
- */
4
-
5
- .tag {
6
- border-radius: 0.7em;
7
- padding: 6px 8px 7px;
8
- margin-right: 0.8rem;
9
- line-height: 3rem;
10
- letter-spacing: 0;
11
- border: 1px solid var(--tag-border) !important;
12
- box-shadow: 0 0 3px 0 var(--tag-shadow);
13
-
14
- span {
15
- margin-left: 0.6em;
16
- font-size: 0.7em;
17
- font-family: 'Oswald', sans-serif;
18
- }
19
- }
1
+ /*
2
+ Styles for Tab Tags
3
+ */
4
+
5
+ .tag {
6
+ border-radius: 0.7em;
7
+ padding: 6px 8px 7px;
8
+ margin-right: 0.8rem;
9
+ line-height: 3rem;
10
+ letter-spacing: 0;
11
+ border: 1px solid var(--tag-border) !important;
12
+ box-shadow: 0 0 3px 0 var(--tag-shadow);
13
+
14
+ span {
15
+ margin-left: 0.6em;
16
+ font-size: 0.7em;
17
+ font-family: 'Oswald', sans-serif;
18
+ }
19
+ }
@@ -1,3 +1,3 @@
1
- /*
2
- Appending custom SCSS variables will override the default ones in `_sass/addon/variables.scsss`
3
- */
1
+ /*
2
+ Appending custom SCSS variables will override the default ones in `_sass/addon/variables.scsss`
3
+ */
data/_tabs/about.md CHANGED
@@ -1,8 +1,8 @@
1
- ---
2
- title: About
3
- icon: fas fa-info-circle
4
- order: 4
5
- ---
6
-
7
- > Add Markdown syntax content to file `_tabs/about.md`{: .filepath } and it will show up on this page.
8
- {: .prompt-tip }
1
+ ---
2
+ title: About
3
+ icon: fas fa-info-circle
4
+ order: 4
5
+ ---
6
+
7
+ > Add Markdown syntax content to file `_tabs/about.md`{: .filepath } and it will show up on this page.
8
+ {: .prompt-tip }
data/_tabs/archives.md CHANGED
@@ -1,7 +1,7 @@
1
- ---
2
- layout: archives
3
- title: Archives
4
- icon: fas fa-archive
5
- order: 3
6
- ---
7
-
1
+ ---
2
+ layout: archives
3
+ title: Archives
4
+ icon: fas fa-archive
5
+ order: 3
6
+ ---
7
+
data/_tabs/categories.md CHANGED
@@ -1,6 +1,6 @@
1
- ---
2
- layout: categories
3
- title: Categories
4
- icon: fas fa-stream
5
- order: 1
6
- ---
1
+ ---
2
+ layout: categories
3
+ title: Categories
4
+ icon: fas fa-stream
5
+ order: 1
6
+ ---
data/_tabs/tags.md CHANGED
@@ -1,6 +1,6 @@
1
- ---
2
- layout: tags
3
- title: Tags
4
- icon: fas fa-tag
5
- order: 2
6
- ---
1
+ ---
2
+ layout: tags
3
+ title: Tags
4
+ icon: fas fa-tag
5
+ order: 2
6
+ ---
data/assets/404.html CHANGED
@@ -1,16 +1,16 @@
1
- ---
2
- layout: page
3
- title: "404: Page not found"
4
- permalink: /404.html
5
-
6
- redirect_from:
7
- - /norobots/
8
- - /assets/
9
- - /posts/
10
- ---
11
-
12
- {% include lang.html %}
13
-
14
- <div class="lead">
15
- <p>{{site.data.locales[lang].not_found.statment }}</p>
16
- </div>
1
+ ---
2
+ layout: page
3
+ title: "404: Page not found"
4
+ permalink: /404.html
5
+
6
+ redirect_from:
7
+ - /norobots/
8
+ - /assets/
9
+ - /posts/
10
+ ---
11
+
12
+ {% include lang.html %}
13
+
14
+ <div class="lead">
15
+ <p>{{site.data.locales[lang].not_found.statment }}</p>
16
+ </div>
@@ -1,12 +1,12 @@
1
- ---
2
- ---
3
-
4
- /*
5
- If the number of TAB files has changed, the following variable is required.
6
- And it must be defined before `@import`.
7
- */
8
- $tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab
9
-
10
- @import "{{ site.theme }}";
11
-
12
- /* append your custom style below */
1
+ ---
2
+ ---
3
+
4
+ /*
5
+ If the number of TAB files has changed, the following variable is required.
6
+ And it must be defined before `@import`.
7
+ */
8
+ $tab-count: {{ site.tabs | size | plus: 1 }}; // plus 1 for home tab
9
+
10
+ @import "{{ site.theme }}";
11
+
12
+ /* append your custom style below */
data/assets/feed.xml CHANGED
@@ -1,61 +1,61 @@
1
- ---
2
- layout: compress
3
- permalink: /feed.xml
4
- # Atom Feed, reference: https://validator.w3.org/feed/docs/atom.html
5
- ---
6
-
7
- {% capture source %}
8
- <feed xmlns="http://www.w3.org/2005/Atom">
9
- <id>{{ "/" | absolute_url }}</id>
10
- <title>{{ site.title }}</title>
11
- <subtitle>{{ site.description }}</subtitle>
12
- <updated>{{ site.time | date_to_xmlschema }}</updated>
13
- <author>
14
- <name>{{ site.social.name }}</name>
15
- <uri>{{ "/" | absolute_url }}</uri>
16
- </author>
17
- <link rel="self" type="application/atom+xml" href="{{ page.url | absolute_url }}"/>
18
- <link rel="alternate" type="text/html" hreflang="{{ site.lang }}"
19
- href="{{ '/' | absolute_url }}"/>
20
- <generator uri="https://jekyllrb.com/" version="{{ jekyll.version }}">Jekyll</generator>
21
- <rights> © {{ 'now' | date: '%Y' }} {{ site.social.name }} </rights>
22
- <icon>{{ site.baseurl }}/assets/img/favicons/favicon.ico</icon>
23
- <logo>{{ site.baseurl }}/assets/img/favicons/favicon-96x96.png</logo>
24
-
25
- {% for post in site.posts limit: 5 %}
26
- {% assign post_absolute_url = post.url | absolute_url %}
27
- <entry>
28
- <title>{{ post.title }}</title>
29
- <link href="{{ post_absolute_url }}" rel="alternate" type="text/html" title="{{ post.title }}" />
30
- <published>{{ post.date | date_to_xmlschema }}</published>
31
- {% if post.last_modified_at %}
32
- <updated>{{ post.last_modified_at | date_to_xmlschema }}</updated>
33
- {% else %}
34
- <updated>{{ post.date | date_to_xmlschema }}</updated>
35
- {% endif %}
36
- <id>{{ post_absolute_url }}</id>
37
- <content src="{{ post_absolute_url }}" />
38
- <author>
39
- <name>{{ post.author | default: site.social.name }}</name>
40
- </author>
41
-
42
- {% if post.categories %}
43
- {% for category in post.categories %}
44
- <category term="{{ category }}" />
45
- {% endfor %}
46
- {% endif %}
47
-
48
- {% if post.summary %}
49
- <summary>{{ post.summary | strip }}</summary>
50
- {% else %}
51
- <summary>
52
- {% include no-linenos.html content=post.content %}
53
- {{ content | strip_html | truncate: 400 }}
54
- </summary>
55
- {% endif %}
56
-
57
- </entry>
58
- {% endfor %}
59
- </feed>
60
- {% endcapture %}
61
- {{ source | replace: '&', '&amp;' }}
1
+ ---
2
+ layout: compress
3
+ permalink: /feed.xml
4
+ # Atom Feed, reference: https://validator.w3.org/feed/docs/atom.html
5
+ ---
6
+
7
+ {% capture source %}
8
+ <feed xmlns="http://www.w3.org/2005/Atom">
9
+ <id>{{ "/" | absolute_url }}</id>
10
+ <title>{{ site.title }}</title>
11
+ <subtitle>{{ site.description }}</subtitle>
12
+ <updated>{{ site.time | date_to_xmlschema }}</updated>
13
+ <author>
14
+ <name>{{ site.social.name }}</name>
15
+ <uri>{{ "/" | absolute_url }}</uri>
16
+ </author>
17
+ <link rel="self" type="application/atom+xml" href="{{ page.url | absolute_url }}"/>
18
+ <link rel="alternate" type="text/html" hreflang="{{ site.lang }}"
19
+ href="{{ '/' | absolute_url }}"/>
20
+ <generator uri="https://jekyllrb.com/" version="{{ jekyll.version }}">Jekyll</generator>
21
+ <rights> © {{ 'now' | date: '%Y' }} {{ site.social.name }} </rights>
22
+ <icon>{{ site.baseurl }}/assets/img/favicons/favicon.ico</icon>
23
+ <logo>{{ site.baseurl }}/assets/img/favicons/favicon-96x96.png</logo>
24
+
25
+ {% for post in site.posts limit: 5 %}
26
+ {% assign post_absolute_url = post.url | absolute_url %}
27
+ <entry>
28
+ <title>{{ post.title }}</title>
29
+ <link href="{{ post_absolute_url }}" rel="alternate" type="text/html" title="{{ post.title }}" />
30
+ <published>{{ post.date | date_to_xmlschema }}</published>
31
+ {% if post.last_modified_at %}
32
+ <updated>{{ post.last_modified_at | date_to_xmlschema }}</updated>
33
+ {% else %}
34
+ <updated>{{ post.date | date_to_xmlschema }}</updated>
35
+ {% endif %}
36
+ <id>{{ post_absolute_url }}</id>
37
+ <content src="{{ post_absolute_url }}" />
38
+ <author>
39
+ <name>{{ post.author | default: site.social.name }}</name>
40
+ </author>
41
+
42
+ {% if post.categories %}
43
+ {% for category in post.categories %}
44
+ <category term="{{ category }}" />
45
+ {% endfor %}
46
+ {% endif %}
47
+
48
+ {% if post.summary %}
49
+ <summary>{{ post.summary | strip }}</summary>
50
+ {% else %}
51
+ <summary>
52
+ {% include no-linenos.html content=post.content %}
53
+ {{ content | strip_html | truncate: 400 }}
54
+ </summary>
55
+ {% endif %}
56
+
57
+ </entry>
58
+ {% endfor %}
59
+ </feed>
60
+ {% endcapture %}
61
+ {{ source | replace: '&', '&amp;' }}
@@ -1,13 +1,13 @@
1
- ---
2
- layout: compress
3
- ---
4
-
5
- <?xml version="1.0" encoding="utf-8"?>
6
- <browserconfig>
7
- <msapplication>
8
- <tile>
9
- <square150x150logo src="{{ '/assets/img/favicons/mstile-150x150.png' | relative_url }}" />
10
- <TileColor>#da532c</TileColor>
11
- </tile>
12
- </msapplication>
13
- </browserconfig>
1
+ ---
2
+ layout: compress
3
+ ---
4
+
5
+ <?xml version="1.0" encoding="utf-8"?>
6
+ <browserconfig>
7
+ <msapplication>
8
+ <tile>
9
+ <square150x150logo src="{{ '/assets/img/favicons/mstile-150x150.png' | relative_url }}" />
10
+ <TileColor>#da532c</TileColor>
11
+ </tile>
12
+ </msapplication>
13
+ </browserconfig>
@@ -1,26 +1,26 @@
1
- ---
2
- layout: compress
3
- ---
4
-
5
- {% assign favicon_path = "/assets/img/favicons" | relative_url %}
6
-
7
- {
8
- "name": "{{ site.title }}",
9
- "short_name": "{{ site.title }}",
10
- "description": "{{ site.description }}",
11
- "icons": [
12
- {
13
- "src": "{{ favicon_path }}/android-chrome-192x192.png",
14
- "sizes": "192x192",
15
- "type": "image/png"
16
- },
17
- {
18
- "src": "{{ favicon_path }}/android-chrome-512x512.png",
19
- "sizes": "512x512",
20
- "type": "image/png"
21
- }],
22
- "start_url": "{{ '/index.html' | relative_url }}",
23
- "theme_color": "#2a1e6b",
24
- "background_color": "#ffffff",
25
- "display": "fullscreen"
26
- }
1
+ ---
2
+ layout: compress
3
+ ---
4
+
5
+ {% assign favicon_path = "/assets/img/favicons" | relative_url %}
6
+
7
+ {
8
+ "name": "{{ site.title }}",
9
+ "short_name": "{{ site.title }}",
10
+ "description": "{{ site.description }}",
11
+ "icons": [
12
+ {
13
+ "src": "{{ favicon_path }}/android-chrome-192x192.png",
14
+ "sizes": "192x192",
15
+ "type": "image/png"
16
+ },
17
+ {
18
+ "src": "{{ favicon_path }}/android-chrome-512x512.png",
19
+ "sizes": "512x512",
20
+ "type": "image/png"
21
+ }],
22
+ "start_url": "{{ '/index.html' | relative_url }}",
23
+ "theme_color": "#2a1e6b",
24
+ "background_color": "#ffffff",
25
+ "display": "fullscreen"
26
+ }
@@ -1,18 +1,18 @@
1
- ---
2
- layout: compress
3
- swcache: true
4
- ---
5
-
6
- [
7
- {% for post in site.posts %}
8
- {
9
- "title": {{ post.title | jsonify }},
10
- "url": {{ post.url | relative_url | jsonify }},
11
- "categories": {{ post.categories | join: ', ' | jsonify }},
12
- "tags": {{ post.tags | join: ', ' | jsonify }},
13
- "date": "{{ post.date }}",
14
- {% include no-linenos.html content=post.content %}
15
- "snippet": {{ content | strip_html | strip_newlines | jsonify }}
16
- }{% unless forloop.last %},{% endunless %}
17
- {% endfor %}
18
- ]
1
+ ---
2
+ layout: compress
3
+ swcache: true
4
+ ---
5
+
6
+ [
7
+ {% for post in site.posts %}
8
+ {
9
+ "title": {{ post.title | jsonify }},
10
+ "url": {{ post.url | relative_url | jsonify }},
11
+ "categories": {{ post.categories | join: ', ' | jsonify }},
12
+ "tags": {{ post.tags | join: ', ' | jsonify }},
13
+ "date": "{{ post.date }}",
14
+ {% include no-linenos.html content=post.content %}
15
+ "snippet": {{ content | strip_html | strip_newlines | jsonify }}
16
+ }{% unless forloop.last %},{% endunless %}
17
+ {% endfor %}
18
+ ]
@@ -1,55 +1,55 @@
1
- ---
2
- layout: compress
3
-
4
- # The list to be cached by PWA
5
- ---
6
-
7
- const resource = [
8
-
9
- /* --- CSS --- */
10
- '{{ "/assets/css/style.css" | relative_url }}',
11
-
12
- /* --- PWA --- */
13
- '{{ "/app.js" | relative_url }}',
14
- '{{ "/sw.js" | relative_url }}',
15
-
16
- /* --- HTML --- */
17
- '{{ "/index.html" | relative_url }}',
18
- '{{ "/404.html" | relative_url }}',
19
- {% for tab in site.tabs %}
20
- '{{ tab.url | relative_url }}',
21
- {% endfor %}
22
-
23
- /* --- Favicons & compressed JS --- */
24
- {% assign cache_list = site.static_files | where: 'swcache', true %}
25
- {% for file in cache_list %}
26
- '{{ file.path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%}
27
- {% endfor %}
28
-
29
- ];
30
-
31
- /* The request url with below domain will be cached */
32
- const allowedDomains = [
33
- {% if site.google_analytics.id != empty and site.google_analytics.id %}
34
- 'www.googletagmanager.com',
35
- 'www.google-analytics.com',
36
- {% endif %}
37
-
38
- '{{ site.url | split: "//" | last }}',
39
-
40
- {% if site.img_cdn contains '//' and site.img_cdn %}
41
- '{{ site.img_cdn | split: '//' | last | split: '/' | first }}',
42
- {% endif %}
43
-
44
- 'fonts.gstatic.com',
45
- 'fonts.googleapis.com',
46
- 'cdn.jsdelivr.net',
47
- 'polyfill.io'
48
- ];
49
-
50
- /* Requests that include the following path will be banned */
51
- const denyUrls = [
52
- {% if site.google_analytics.pv.cache_path %}
53
- '{{ site.google_analytics.pv.cache_path | absolute_url }}'
54
- {% endif %}
55
- ];
1
+ ---
2
+ layout: compress
3
+
4
+ # The list to be cached by PWA
5
+ ---
6
+
7
+ const resource = [
8
+
9
+ /* --- CSS --- */
10
+ '{{ "/assets/css/style.css" | relative_url }}',
11
+
12
+ /* --- PWA --- */
13
+ '{{ "/app.js" | relative_url }}',
14
+ '{{ "/sw.js" | relative_url }}',
15
+
16
+ /* --- HTML --- */
17
+ '{{ "/index.html" | relative_url }}',
18
+ '{{ "/404.html" | relative_url }}',
19
+ {% for tab in site.tabs %}
20
+ '{{ tab.url | relative_url }}',
21
+ {% endfor %}
22
+
23
+ /* --- Favicons & compressed JS --- */
24
+ {% assign cache_list = site.static_files | where: 'swcache', true %}
25
+ {% for file in cache_list %}
26
+ '{{ file.path | relative_url }}'{%- unless forloop.last -%},{%- endunless -%}
27
+ {% endfor %}
28
+
29
+ ];
30
+
31
+ /* The request url with below domain will be cached */
32
+ const allowedDomains = [
33
+ {% if site.google_analytics.id != empty and site.google_analytics.id %}
34
+ 'www.googletagmanager.com',
35
+ 'www.google-analytics.com',
36
+ {% endif %}
37
+
38
+ '{{ site.url | split: "//" | last }}',
39
+
40
+ {% if site.img_cdn contains '//' and site.img_cdn %}
41
+ '{{ site.img_cdn | split: '//' | last | split: '/' | first }}',
42
+ {% endif %}
43
+
44
+ 'fonts.gstatic.com',
45
+ 'fonts.googleapis.com',
46
+ 'cdn.jsdelivr.net',
47
+ 'polyfill.io'
48
+ ];
49
+
50
+ /* Requests that include the following path will be banned */
51
+ const denyUrls = [
52
+ {% if site.google_analytics.pv.cache_path %}
53
+ '{{ site.google_analytics.pv.cache_path | absolute_url }}'
54
+ {% endif %}
55
+ ];
data/assets/js/pwa/app.js CHANGED
@@ -1,47 +1,47 @@
1
- ---
2
- layout: compress
3
- permalink: '/app.js'
4
- ---
5
-
6
- const $notification = $('#notification');
7
- const $btnRefresh = $('#notification .toast-body>button');
8
-
9
- if ('serviceWorker' in navigator) {
10
- /* Registering Service Worker */
11
- navigator.serviceWorker.register('{{ "/sw.js" | relative_url }}')
12
- .then(registration => {
13
-
14
- /* in case the user ignores the notification */
15
- if (registration.waiting) {
16
- $notification.toast('show');
17
- }
18
-
19
- registration.addEventListener('updatefound', () => {
20
- registration.installing.addEventListener('statechange', () => {
21
- if (registration.waiting) {
22
- if (navigator.serviceWorker.controller) {
23
- $notification.toast('show');
24
- }
25
- }
26
- });
27
- });
28
-
29
- $btnRefresh.click(() => {
30
- if (registration.waiting) {
31
- registration.waiting.postMessage('SKIP_WAITING');
32
- }
33
- $notification.toast('hide');
34
- });
35
- }
36
- );
37
-
38
- let refreshing = false;
39
-
40
- /* Detect controller change and refresh all the opened tabs */
41
- navigator.serviceWorker.addEventListener('controllerchange', () => {
42
- if (!refreshing) {
43
- window.location.reload();
44
- refreshing = true;
45
- }
46
- });
47
- }
1
+ ---
2
+ layout: compress
3
+ permalink: '/app.js'
4
+ ---
5
+
6
+ const $notification = $('#notification');
7
+ const $btnRefresh = $('#notification .toast-body>button');
8
+
9
+ if ('serviceWorker' in navigator) {
10
+ /* Registering Service Worker */
11
+ navigator.serviceWorker.register('{{ "/sw.js" | relative_url }}')
12
+ .then(registration => {
13
+
14
+ /* in case the user ignores the notification */
15
+ if (registration.waiting) {
16
+ $notification.toast('show');
17
+ }
18
+
19
+ registration.addEventListener('updatefound', () => {
20
+ registration.installing.addEventListener('statechange', () => {
21
+ if (registration.waiting) {
22
+ if (navigator.serviceWorker.controller) {
23
+ $notification.toast('show');
24
+ }
25
+ }
26
+ });
27
+ });
28
+
29
+ $btnRefresh.click(() => {
30
+ if (registration.waiting) {
31
+ registration.waiting.postMessage('SKIP_WAITING');
32
+ }
33
+ $notification.toast('hide');
34
+ });
35
+ }
36
+ );
37
+
38
+ let refreshing = false;
39
+
40
+ /* Detect controller change and refresh all the opened tabs */
41
+ navigator.serviceWorker.addEventListener('controllerchange', () => {
42
+ if (!refreshing) {
43
+ window.location.reload();
44
+ refreshing = true;
45
+ }
46
+ });
47
+ }