redeyed-jekyll-theme 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -21
  3. data/README.md +54 -52
  4. data/_config.yml +25 -18
  5. data/_data/assets/cross-origin.yml +1 -7
  6. data/_data/assets/self-host.yml +0 -6
  7. data/_data/locale/en.yml +63 -58
  8. data/_data/locale/es-ES.yml +79 -0
  9. data/_data/locale/fr-FR.yml +79 -0
  10. data/_data/locale/id-ID.yml +79 -0
  11. data/_data/locale/ko-KR.yml +79 -0
  12. data/_data/locale/my-MM.yml +79 -0
  13. data/_data/locale/pt-BR.yml +79 -0
  14. data/_data/locale/ru-RU.yml +79 -0
  15. data/_data/locale/uk-UA.yml +79 -0
  16. data/_data/locale/vi-VN.yml +77 -0
  17. data/_data/locale/zh-CN.yml +78 -0
  18. data/_includes/{breadcrumbs.html → elements/breadcrumbs.html} +0 -0
  19. data/_includes/{datetime.html → elements/datetime.html} +0 -0
  20. data/_includes/{favicons.html → elements/favicons.html} +14 -14
  21. data/_includes/{javascript.html → elements/javascript.html} +2 -2
  22. data/_includes/{jsdelivr-combine.html → elements/jsdelivr-combine.html} +18 -18
  23. data/_includes/elements/lang.html +11 -0
  24. data/_includes/{navbar.html → elements/navbar.html} +5 -5
  25. data/_includes/{no-linenos.html → elements/no-linenos.html} +0 -0
  26. data/_includes/{options.html → elements/options.html} +13 -13
  27. data/_includes/{pagination.html → elements/pagination.html} +0 -0
  28. data/_includes/{readtime.html → elements/readtime.html} +0 -0
  29. data/_includes/{related-posts.html → elements/related-posts.html} +0 -0
  30. data/_includes/{search-loader.html → elements/search-loader.html} +46 -46
  31. data/_includes/{search-results.html → elements/search-results.html} +0 -0
  32. data/_includes/{toc.html → elements/toc.html} +0 -0
  33. data/_includes/{back-to-top.html → extensions/back-to-top.html} +2 -2
  34. data/_includes/extensions/code-highlight.html +89 -0
  35. data/_includes/extensions/comments/disqus.html +17 -0
  36. data/_includes/extensions/comments/giscus.html +56 -0
  37. data/_includes/extensions/comments/gitment.html +15 -0
  38. data/_includes/extensions/comments/utterances.html +46 -0
  39. data/_includes/extensions/geopattern.html +19 -0
  40. data/_includes/extensions/google-analytics.html +7 -0
  41. data/_includes/{google-tags-body.html → extensions/google-tags-body.html} +3 -3
  42. data/_includes/{google-tags-head.html → extensions/google-tags-head.html} +5 -5
  43. data/_includes/extensions/google-translate.html +108 -0
  44. data/_includes/extensions/hashlocate.html +44 -0
  45. data/_includes/extensions/mathjax.html +9 -0
  46. data/_includes/{mode-toggle.html → extensions/theme-mode.html} +0 -10
  47. data/_includes/extensions/theme-toggle.html +108 -0
  48. data/_includes/extensions/trianglify.html +26 -0
  49. data/_includes/functions/get-article-excerpt.html +33 -0
  50. data/_includes/functions/get-article-words.html +18 -0
  51. data/_includes/functions/get-banner.html +67 -0
  52. data/_includes/functions/get-categories.html +9 -0
  53. data/_includes/functions/get-datetimes.html +13 -0
  54. data/_includes/functions/get-reading-time.html +39 -0
  55. data/_includes/functions/get-tags.html +9 -0
  56. data/_includes/functions/get-value.html +41 -0
  57. data/_includes/functions/log.html +17 -0
  58. data/_includes/head.html +4 -4
  59. data/_includes/{copyright.html → views/copyright.html} +0 -0
  60. data/_includes/{footer.html → views/footer.html} +0 -0
  61. data/_includes/{header-banner.html → views/header-banner.html} +0 -0
  62. data/_includes/{header-wide.html → views/header-wide.html} +0 -0
  63. data/_includes/{header.html → views/header.html} +0 -0
  64. data/_includes/{panel-bottom.html → views/panel-bottom.html} +0 -0
  65. data/_includes/{panel-foot-2.html → views/panel-foot-2.html} +0 -0
  66. data/_includes/{panel-foot-3.html → views/panel-foot-3.html} +0 -0
  67. data/_includes/{panel-foot-4.html → views/panel-foot-4.html} +0 -0
  68. data/_includes/{panel-foot-full.html → views/panel-foot-full.html} +0 -0
  69. data/_includes/{panel-top-2.html → views/panel-top-2.html} +0 -0
  70. data/_includes/{panel-top-3.html → views/panel-top-3.html} +0 -0
  71. data/_includes/{panel-top-4.html → views/panel-top-4.html} +0 -0
  72. data/_includes/{panel-top-full.html → views/panel-top-full.html} +0 -0
  73. data/_includes/{post-nav.html → views/post-nav.html} +0 -0
  74. data/_includes/{post-share.html → views/post-share.html} +0 -0
  75. data/_includes/{sidebar.html → views/sidebar.html} +0 -0
  76. data/_javascript/common/back-to-top.js +20 -20
  77. data/_javascript/common/mode-toggle.js +13 -13
  78. data/_javascript/common/scroll-helper.js +36 -36
  79. data/_javascript/common/search-display.js +129 -129
  80. data/_javascript/common/sidebar.js +30 -30
  81. data/_javascript/common/tooltip-loader.js +6 -6
  82. data/_javascript/common/topbar-switcher.js +90 -90
  83. data/_javascript/common/topbar-title.js +67 -67
  84. data/_javascript/utils/category-collapse.js +30 -30
  85. data/_javascript/utils/checkbox.js +12 -12
  86. data/_javascript/utils/clipboard.js +133 -133
  87. data/_javascript/utils/img-extra.js +47 -47
  88. data/_javascript/utils/locale-datetime.js +45 -45
  89. data/_javascript/utils/pageviews.js +250 -250
  90. data/_javascript/utils/smooth-scroll.js +96 -96
  91. data/_layouts/archive.html +5 -0
  92. data/_layouts/categories.html +5 -0
  93. data/_layouts/category.html +5 -0
  94. data/_layouts/compress.html +10 -10
  95. data/_layouts/error.html +44 -0
  96. data/_layouts/errors/404.html +9 -0
  97. data/_layouts/home.html +5 -0
  98. data/_layouts/page.html +5 -5
  99. data/_layouts/panel-both.html +13 -13
  100. data/_layouts/panel-left.html +13 -13
  101. data/_layouts/panel-none.html +24 -26
  102. data/_layouts/panel-right.html +13 -13
  103. data/_layouts/post.html +5 -5
  104. data/_layouts/tag.html +5 -0
  105. data/_layouts/tags.html +5 -0
  106. data/{_includes/comments.html → _sass/addon/alerts.scss} +0 -0
  107. data/_sass/addon/common.scss +56 -1494
  108. data/_sass/addon/mixins.scss +31 -38
  109. data/_sass/addon/syntax.scss +246 -0
  110. data/_sass/{layout/page.scss → addon/typography.scss} +0 -0
  111. data/_sass/layout/_base.scss +16 -0
  112. data/_sass/redeyed-jekyll-theme.scss +30 -15
  113. data/_sass/{layout/panel-both.scss → theme/scheme-brew.scss} +0 -0
  114. data/_sass/theme/scheme-dark.scss +220 -0
  115. data/_sass/theme/scheme-light.scss +220 -0
  116. data/_sass/theme/syntax-dark.scss +150 -0
  117. data/_sass/{colors/light-syntax.scss → theme/syntax-light.scss} +4 -4
  118. data/_sass/theme/variables.scss +60 -0
  119. metadata +147 -105
  120. data/_includes/ga-site-tag.html +0 -8
  121. data/_includes/lang.html +0 -6
  122. data/_includes/mermaid.html +0 -1
  123. data/_sass/addon/variables.scss +0 -31
  124. data/_sass/colors/brew-scheme.scss +0 -7
  125. data/_sass/colors/dark-scheme.scss +0 -21
  126. data/_sass/colors/dark-syntax.scss +0 -88
  127. data/_sass/colors/light-scheme.scss +0 -7
  128. data/_sass/layout/panel-left.scss +0 -0
  129. data/_sass/layout/panel-none.scss +0 -146
  130. data/_sass/layout/panel-right.scss +0 -0
  131. data/_sass/layout/post.scss +0 -0
@@ -1,13 +1,13 @@
1
- {% comment %} Site static assets origin {% endcomment %}
2
-
3
- {% assign origin = 'cross_origin' %}
4
-
5
- {% if site.assets.self_host.enabled %}
6
- {% if site.assets.self_host.env %}
7
- {% if site.assets.self_host.env == jekyll.environment %}
8
- {% assign origin = 'self_host' %}
9
- {% endif %}
10
- {% else %}
11
- {% assign origin = 'self_host' %}
12
- {% endif %}
13
- {% endif %}
1
+ {% comment %} Site static assets origin {% endcomment %}
2
+
3
+ {% assign origin = 'cross_origin' %}
4
+
5
+ {% if site.assets.self_host.enabled %}
6
+ {% if site.assets.self_host.env %}
7
+ {% if site.assets.self_host.env == jekyll.environment %}
8
+ {% assign origin = 'self_host' %}
9
+ {% endif %}
10
+ {% else %}
11
+ {% assign origin = 'self_host' %}
12
+ {% endif %}
13
+ {% endif %}
File without changes
@@ -1,46 +1,46 @@
1
- <!--
2
- Jekyll Simple Search loader
3
- See: <https://github.com/christian-fei/Simple-Jekyll-Search>
4
- -->
5
-
6
- {% capture result_elem %}
7
- <div class="pl-1 pr-1 pl-sm-2 pr-sm-2 pl-lg-4 pr-lg-4 pl-xl-0 pr-xl-0">
8
- <a href="{url}">{title}</a>
9
- <div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1">
10
- {categories}
11
- {tags}
12
- </div>
13
- <p>{snippet}</p>
14
- </div>
15
- {% endcapture %}
16
-
17
- {% capture not_found %}<p class="mt-5">{{ site.data.locales[lang].search.no_results }}</p>{% endcapture %}
18
-
19
- <script src="{{ site.data.assets[origin].search.js | relative_url }}"></script>
20
-
21
- <script>
22
- SimpleJekyllSearch({
23
- searchInput: document.getElementById('search-input'),
24
- resultsContainer: document.getElementById('search-results'),
25
- json: '{{ '/assets/js/data/search.json' | relative_url }}',
26
- searchResultTemplate: '{{ result_elem | strip_newlines }}',
27
- noResultsText: '{{ not_found }}',
28
- templateMiddleware: function(prop, value, template) {
29
- if (prop === 'categories') {
30
- if (value === '') {
31
- return `${value}`;
32
- } else {
33
- return `<div class="mr-sm-4"><i class="far fa-folder fa-fw"></i>${value}</div>`;
34
- }
35
- }
36
-
37
- if (prop === 'tags') {
38
- if (value === '') {
39
- return `${value}`;
40
- } else {
41
- return `<div><i class="fa fa-tag fa-fw"></i>${value}</div>`;
42
- }
43
- }
44
- }
45
- });
46
- </script>
1
+ <!--
2
+ Jekyll Simple Search loader
3
+ See: <https://github.com/christian-fei/Simple-Jekyll-Search>
4
+ -->
5
+
6
+ {% capture result_elem %}
7
+ <div class="pl-1 pr-1 pl-sm-2 pr-sm-2 pl-lg-4 pr-lg-4 pl-xl-0 pr-xl-0">
8
+ <a href="{url}">{title}</a>
9
+ <div class="post-meta d-flex flex-column flex-sm-row text-muted mt-1 mb-1">
10
+ {categories}
11
+ {tags}
12
+ </div>
13
+ <p>{snippet}</p>
14
+ </div>
15
+ {% endcapture %}
16
+
17
+ {% capture not_found %}<p class="mt-5">{{ site.data.locales[lang].search.no_results }}</p>{% endcapture %}
18
+
19
+ <script src="{{ site.data.assets[origin].search.js | relative_url }}"></script>
20
+
21
+ <script>
22
+ SimpleJekyllSearch({
23
+ searchInput: document.getElementById('search-input'),
24
+ resultsContainer: document.getElementById('search-results'),
25
+ json: '{{ '/assets/js/data/search.json' | relative_url }}',
26
+ searchResultTemplate: '{{ result_elem | strip_newlines }}',
27
+ noResultsText: '{{ not_found }}',
28
+ templateMiddleware: function(prop, value, template) {
29
+ if (prop === 'categories') {
30
+ if (value === '') {
31
+ return `${value}`;
32
+ } else {
33
+ return `<div class="mr-sm-4"><i class="far fa-folder fa-fw"></i>${value}</div>`;
34
+ }
35
+ }
36
+
37
+ if (prop === 'tags') {
38
+ if (value === '') {
39
+ return `${value}`;
40
+ } else {
41
+ return `<div><i class="fa fa-tag fa-fw"></i>${value}</div>`;
42
+ }
43
+ }
44
+ }
45
+ });
46
+ </script>
File without changes
@@ -1,2 +1,2 @@
1
- {% comment %} BACK TO TOP {% endcomment %}
2
- <a id="back-to-top" href="#" aria-label="back-to-top" class="btn btn-lg btn-box-shadow" role="button"><i class="fas fa-angle-up"></i></a>
1
+ {% comment %} BACK TO TOP {% endcomment %}
2
+ <a id="back-to-top" href="#" aria-label="back-to-top" class="btn btn-lg btn-box-shadow" role="button"><i class="fas fa-angle-up"></i></a>
@@ -0,0 +1,89 @@
1
+ <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/default.min.css">
2
+ <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/highlight.min.js"></script>
3
+ <!-- and it's easy to individually load additional languages -->
4
+ <script charset="UTF-8" src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/languages/go.min.js"></script>
5
+
6
+ {%- assign name = 'code_badge.enabled' -%}
7
+ {%- include functions.html func='get_value' default='true' -%}
8
+ {%- assign badge_enabled = return -%}
9
+
10
+ {%- assign name = 'code_badge.color' -%}
11
+ {%- include functions.html func='get_value' default='#fff' -%}
12
+ {%- assign badge_color = return -%}
13
+
14
+ {%- assign name = 'code_badge.background_color' -%}
15
+ {%- include functions.html func='get_value' default='#ff4e00' -%}
16
+ {%- assign badge_background_color = return -%}
17
+
18
+ {%- assign name = 'code_badge.text_transform' -%}
19
+ {%- include functions.html func='get_value' default='uppercase' -%}
20
+ {%- assign badge_text_transform = return -%}
21
+
22
+ <script>
23
+ // Init highlight js
24
+ document.addEventListener('DOMContentLoaded', function(event) {
25
+ var els = document.querySelectorAll('pre code')
26
+
27
+ function addLangData(block) {
28
+ var outer = block.parentElement.parentElement.parentElement;
29
+ var lang = block.getAttribute('data-lang');
30
+ for (var i = 0; i < outer.classList.length; i++) {
31
+ var cls = outer.classList[i];
32
+ if (cls.startsWith('language-')) {
33
+ lang = cls;
34
+ break;
35
+ }
36
+ }
37
+ if (!lang) {
38
+ cls = block.getAttribute('class');
39
+ lang = cls ? cls.replace('hljs ', '') : '';
40
+ }
41
+ if (lang.startsWith('language-')) {
42
+ lang = lang.substr(9);
43
+ }
44
+ block.setAttribute('class', 'hljs ' + lang);
45
+ block.parentNode.setAttribute('data-lang', lang);
46
+ }
47
+
48
+ function addBadge(block) {
49
+ var enabled = ('{{ badge_enabled }}' || 'true').toLowerCase();
50
+ if (enabled == 'true') {
51
+ var pre = block.parentElement;
52
+ pre.classList.add('badge');
53
+ }
54
+ }
55
+
56
+ function handle(block) {
57
+ addLangData(block);
58
+ addBadge(block)
59
+ hljs.highlightBlock(block);
60
+ }
61
+
62
+ for (var i = 0; i < els.length; i++) {
63
+ var el = els[i];
64
+ handle(el);
65
+ }
66
+ });
67
+ </script>
68
+
69
+ <style>
70
+ /* code language badge */
71
+ pre.badge::before {
72
+ content: attr(data-lang);
73
+ color: {{badge_color}};
74
+ background-color: {{badge_background_color}};
75
+ padding: 0 .5em;
76
+ border-radius: 0 2px;
77
+ text-transform: {{badge_text_transform}};
78
+ text-align: center;
79
+ min-width: 32px;
80
+ display: inline-block;
81
+ position: absolute;
82
+ right: 0;
83
+ }
84
+
85
+ /* fix wrong badge display for firefox browser */
86
+ code > table pre::before {
87
+ display: none;
88
+ }
89
+ </style>
@@ -0,0 +1,17 @@
1
+ <div id="disqus_thread"></div>
2
+ <script>
3
+ var disqus_config = function () {
4
+ this.page.url = '{{ page.url | absolute_url }}';
5
+ this.page.identifier = '{{ page.url | absolute_url }}';
6
+ };
7
+
8
+ (function() {
9
+ var d = document, s = d.createElement('script');
10
+
11
+ s.src = 'https://{{ site.disqus.shortname }}.disqus.com/embed.js';
12
+
13
+ s.setAttribute('data-timestamp', +new Date());
14
+ (d.head || d.body).appendChild(s);
15
+ })();
16
+ </script>
17
+ <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
@@ -0,0 +1,56 @@
1
+ <!-- https://giscus.app/ -->
2
+ <script type="text/javascript">
3
+ $(function () {
4
+ const origin = "https://giscus.app";
5
+ const iframe = "iframe.giscus-frame";
6
+ const lightTheme = "light";
7
+ const darkTheme = "dark_dimmed";
8
+ let initTheme = lightTheme;
9
+
10
+ if ($("html[data-mode=dark]").length > 0
11
+ || ($("html[data-mode]").length == 0
12
+ && window.matchMedia("(prefers-color-scheme: dark)").matches)) {
13
+ initTheme = darkTheme;
14
+ }
15
+
16
+ let giscusAttributes = {
17
+ "src": "https://giscus.app/client.js",
18
+ "data-repo": "{{ site.comments.giscus.repo}}",
19
+ "data-repo-id": "{{ site.comments.giscus.repo_id }}",
20
+ "data-category": "{{ site.comments.giscus.category }}",
21
+ "data-category-id": "{{ site.comments.giscus.category_id }}",
22
+ "data-mapping": "{{ site.comments.giscus.mapping | default: 'pathname' }}",
23
+ "data-reactions-enabled": "1",
24
+ "data-emit-metadata": "0",
25
+ "data-theme": initTheme,
26
+ "data-input-position": "{{ site.comments.giscus.input_position | default: 'bottom' }}",
27
+ "data-lang": "{{ site.comments.giscus.lang | default: lang }}",
28
+ "crossorigin": "anonymous",
29
+ "async": ""
30
+ };
31
+
32
+ let giscusScript = document.createElement("script");
33
+ Object.entries(giscusAttributes).forEach(([key, value]) => giscusScript.setAttribute(key, value));
34
+ document.getElementById("tail-wrapper").appendChild(giscusScript);
35
+
36
+ addEventListener("message", (event) => {
37
+ if (event.source === window && event.data &&
38
+ event.data.direction === ModeToggle.ID) {
39
+ /* global theme mode changed */
40
+ const mode = event.data.message;
41
+ const theme = (mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme);
42
+
43
+ const message = {
44
+ setConfig: {
45
+ theme: theme
46
+ }
47
+ };
48
+
49
+ const giscus = document.querySelector(iframe).contentWindow;
50
+ giscus.postMessage({ giscus: message }, origin);
51
+ }
52
+
53
+ });
54
+
55
+ });
56
+ </script>
@@ -0,0 +1,15 @@
1
+ <div id="gitment_thread"></div>
2
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/default.css"/>
3
+ <script src="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/gitment.browser.js"></script>
4
+ <script>
5
+ var gitment = new Gitment({
6
+ id: '{{ page.id }}',
7
+ owner: '{{ site.gitment.username }}',
8
+ repo: '{{ site.gitment.repo }}',
9
+ oauth: {
10
+ client_id: '{{ site.gitment.client_id }}',
11
+ client_secret: '{{ site.gitment.client_secret }}',
12
+ },
13
+ });
14
+ gitment.render('gitment_thread')
15
+ </script>
@@ -0,0 +1,46 @@
1
+ <script async
2
+ crossorigin="anonymous"
3
+ issue-term="{{ site.utterances.issue_term }}"
4
+ label="{{ site.utterances.label }}"
5
+ {%- if site.utterances.follow_site_theme -%}
6
+ onload="initUtterancesTheme()"
7
+ {%- endif -%}
8
+ repo="{{ site.utterances.repo }}"
9
+ src="https://utteranc.es/client.js"
10
+ theme="{{ site.utterances.theme }}">
11
+ </script>
12
+
13
+ {%- if site.utterances.follow_site_theme -%}
14
+ <script>
15
+ const setUtterancesTheme = (dataTheme) => {
16
+ const iframe = document.querySelector('.utterances-frame');
17
+ if (iframe) {
18
+ const utterancesTheme = dataTheme === 'dark' ? 'github-dark' : 'github-light'
19
+ const message = {
20
+ type: 'set-theme',
21
+ theme: utterancesTheme
22
+ };
23
+ iframe.contentWindow.postMessage(message, 'https://utteranc.es');
24
+ }
25
+ }
26
+
27
+ // init theme
28
+ const initUtterancesTheme = () => {
29
+ const iframe = document.querySelector('.utterances-frame');
30
+ if (!iframe) return
31
+ iframe.onload = () => {
32
+ setUtterancesTheme(document.documentElement.getAttribute('data-theme'))
33
+ }
34
+ }
35
+
36
+ // dynamic change
37
+ const observer = new MutationObserver((mutationsList, observer) => {
38
+ for (let mutation of mutationsList) {
39
+ if (mutation.type === 'attributes' && mutation.attributeName === 'data-theme') {
40
+ setUtterancesTheme(document.documentElement.getAttribute('data-theme'))
41
+ }
42
+ }
43
+ });
44
+ observer.observe(document.documentElement, {attributes: true, childList: false, subtree: false});
45
+ </script>
46
+ {%- endif -%}
@@ -0,0 +1,19 @@
1
+ {% if include.selector %}
2
+ {% assign selector = include.selector %}
3
+ {% endif %}
4
+
5
+ {% if include.seed %}
6
+ {% assign seed = include.seed %}
7
+ {% endif %}
8
+
9
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/geopattern/1.2.3/js/geopattern.min.js"></script>
10
+ <script>
11
+ function setRandomBgImage(selector, seed) {
12
+ var pattern = GeoPattern.generate(seed);
13
+ var element = document.querySelector(selector)
14
+ if (element) {
15
+ element.style.backgroundImage = pattern.toDataUrl();
16
+ }
17
+ }
18
+ setRandomBgImage('{{ selector }}', '{{ seed }}');
19
+ </script>
@@ -0,0 +1,7 @@
1
+ <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
2
+ <script>
3
+ window.dataLayer = window.dataLayer || [];
4
+ function gtag(){dataLayer.push(arguments);}
5
+ gtag('js', new Date());
6
+ gtag('config', '{{ site.google_analytics }}');
7
+ </script>
@@ -1,4 +1,4 @@
1
- {% comment %} Google Tag Manager (noscript) {% endcomment %}
2
- <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-58TMKPV"
3
- height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
1
+ {% comment %} Google Tag Manager (noscript) {% endcomment %}
2
+ <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-58TMKPV"
3
+ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
4
4
  <!-- End Google Tag Manager (noscript) -->
@@ -1,6 +1,6 @@
1
- {% comment %} Google Tag Manager {% endcomment %}
2
- <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
3
- new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
4
- j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;
5
- f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-58TMKPV');</script>
1
+ {% comment %} Google Tag Manager {% endcomment %}
2
+ <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
3
+ new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
4
+ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;
5
+ f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-58TMKPV');</script>
6
6
  {% comment %} End Google Tag Manager {% endcomment %}
@@ -0,0 +1,108 @@
1
+ {% if include.translate_langs %}
2
+ {% assign translate_langs = include.translate_langs %}
3
+ {% endif %}
4
+
5
+ {% if include.lang %}
6
+ {% assign lang = include.lang %}
7
+ {% endif %}
8
+
9
+ <div id="google_translate_element" style="display: none;">
10
+ </div>
11
+
12
+ <span class="ct-language">
13
+ <ul class="list-unstyled ct-language-dropdown">
14
+ {% for item in translate_langs %}
15
+ <li>
16
+ <a href="#" class="lang-select" data-lang="{{ item.lang }}">
17
+ {% if item.img %}
18
+ <img src="{{ item.img }}" title="{{ item.text }}">
19
+ {% else %}
20
+ {{ item.text }}
21
+ {% endif %}
22
+ </a>
23
+ </li>
24
+ {% endfor %}
25
+ </ul>
26
+ </span>
27
+
28
+ <script type="text/javascript">
29
+ function googleTranslateElementInit() {
30
+ new google.translate.TranslateElement({
31
+ pageLanguage: '{{ lang }}',
32
+ autoDisplay: false,
33
+ layout: google.translate.TranslateElement.InlineLayout.VERTICAL
34
+ }, 'google_translate_element');
35
+
36
+ // Links to cross-origin destinations are unsafe
37
+ var gll = document.getElementsByClassName('goog-logo-link')[0];
38
+ if (gll) {
39
+ gll.setAttribute('rel', 'noopener');
40
+ }
41
+
42
+ function restoreLang() {
43
+ var iframe = document.getElementsByClassName('goog-te-banner-frame')[0];
44
+ if (!iframe) return;
45
+
46
+ var innerDoc = iframe.contentDocument || iframe.contentWindow.document;
47
+ var restore_el = innerDoc.getElementsByTagName("button");
48
+
49
+ for (var i = 0; i < restore_el.length; i++) {
50
+ if (restore_el[i].id.indexOf("restore") >= 0) {
51
+ restore_el[i].click();
52
+ var close_el = innerDoc.getElementsByClassName("goog-close-link");
53
+ close_el[0].click();
54
+ return;
55
+ }
56
+ }
57
+ }
58
+
59
+ function triggerHtmlEvent(element, eventName) {
60
+ var event;
61
+ if (document.createEvent) {
62
+ event = document.createEvent('HTMLEvents');
63
+ event.initEvent(eventName, true, true);
64
+ element.dispatchEvent(event);
65
+ } else {
66
+ event = document.createEventObject();
67
+ event.eventType = eventName;
68
+ element.fireEvent('on' + event.eventType, event);
69
+ }
70
+ }
71
+
72
+ var googleCombo = document.querySelector("select.goog-te-combo");
73
+ var langSelect = document.querySelector('.ct-language');
74
+ langSelect.addEventListener('click', function(event) {
75
+ if (!event.target) {
76
+ return;
77
+ }
78
+
79
+ var selected = document.querySelector('.ct-language .ct-language-selected');
80
+ if (selected) {
81
+ selected.classList.remove('ct-language-selected');
82
+ }
83
+
84
+ var target = event.target;
85
+ while (target && target !== langSelect ) {
86
+ if (target.matches('.lang-select')) {
87
+ break;
88
+ }
89
+ target = target.parentElement;
90
+ }
91
+
92
+ if (target && target.matches('.lang-select')) {
93
+ var lang = target.getAttribute('data-lang');
94
+ if (googleCombo.value == lang) {
95
+ restoreLang();
96
+ } else {
97
+ target.parentElement.classList.add('ct-language-selected');
98
+ googleCombo.value = lang;
99
+ triggerHtmlEvent(googleCombo, 'change');
100
+ }
101
+ }
102
+
103
+ event.preventDefault();
104
+ });
105
+ }
106
+ </script>
107
+
108
+ <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
@@ -0,0 +1,44 @@
1
+ <script>
2
+ function hashLocate(hashValue) {
3
+ hashValue = hashValue.replace(/^.*#h-/, '');
4
+ hashValue = decodeURIComponent(hashValue);
5
+ var element = document.getElementById(hashValue);
6
+
7
+ if (!element) {
8
+ return;
9
+ }
10
+
11
+ var header = document.querySelector('header.site-header');
12
+ var headerRect = header.getBoundingClientRect();
13
+ var headerTop = Math.floor(headerRect.top);
14
+ var headerHeight = Math.floor(headerRect.height);
15
+ var scrollPos = getScrollPos();
16
+ var offsetY = element.offsetTop - (headerTop + headerHeight + 20);
17
+
18
+ if (offsetY == scrollPos.y) {
19
+ return;
20
+ }
21
+
22
+ if (headerTop == 0 && offsetY > scrollPos.y) {
23
+ offsetY += headerHeight + 2;
24
+ } else if (headerTop < 0 && offsetY < scrollPos.y) {
25
+ offsetY -= headerHeight - 2;
26
+ }
27
+
28
+ smoothScrollTo(offsetY);
29
+ }
30
+
31
+ // The first event occurred
32
+ window.addEventListener('load', function(event) {
33
+ if (window.location.hash) {
34
+ hashLocate(window.location.hash);
35
+ }
36
+ });
37
+
38
+ // The first event occurred
39
+ window.addEventListener('click', function(event) {
40
+ if (event.target.tagName.toLowerCase() == 'a') {
41
+ hashLocate(event.target.getAttribute('href'));
42
+ }
43
+ });
44
+ </script>
@@ -0,0 +1,9 @@
1
+ <script type="text/x-mathjax-config">
2
+ MathJax.Hub.Config({
3
+ tex2jax: {
4
+ skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
5
+ inlineMath: [['$','$']]
6
+ }
7
+ });
8
+ </script>
9
+ <script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" type="text/javascript"></script>
@@ -8,7 +8,6 @@
8
8
  static get MODE_ATTR() { return "data-mode"; }
9
9
  static get DARK_MODE() { return "dark"; }
10
10
  static get LIGHT_MODE() { return "light"; }
11
- static get BREW_MODE() { return "brew"; }
12
11
  static get ID() { return "mode-toggle"; }
13
12
 
14
13
  constructor() {
@@ -57,8 +56,6 @@
57
56
 
58
57
  get isLightMode() { return this.mode === ModeToggle.LIGHT_MODE; }
59
58
 
60
- get isBrewMode() { return this.mode === ModeToggle.BREW_MODE; }
61
-
62
59
  get hasMode() { return this.mode != null; }
63
60
 
64
61
  get mode() { return sessionStorage.getItem(ModeToggle.MODE_KEY); }
@@ -67,8 +64,6 @@
67
64
  get modeStatus() {
68
65
  if (this.isDarkMode || (!this.hasMode && this.isSysDarkPrefer)) {
69
66
  return ModeToggle.DARK_MODE;
70
- } else if (this.isBrewMode) {
71
- return ModeToggle.BREW_MODE;
72
67
  } else {
73
68
  return ModeToggle.LIGHT_MODE;
74
69
  }
@@ -84,11 +79,6 @@
84
79
  sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.LIGHT_MODE);
85
80
  }
86
81
 
87
- setBrew() {
88
- $('html').attr(ModeToggle.MODE_ATTR, ModeToggle.BREW_MODE);
89
- sessionStorage.setItem(ModeToggle.MODE_KEY, ModeToggle.BREW_MODE);
90
- }
91
-
92
82
  clearMode() {
93
83
  $('html').removeAttr(ModeToggle.MODE_ATTR);
94
84
  sessionStorage.removeItem(ModeToggle.MODE_KEY);