hexo-theme-shokax 0.4.5 → 0.4.6-beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (183) hide show
  1. package/CODE_OF_CONDUCT.md +128 -128
  2. package/CONTRIBUTING.md +58 -58
  3. package/LICENSE +660 -660
  4. package/LICENSE-shoka +21 -21
  5. package/README.md +99 -98
  6. package/README_en.MD +91 -90
  7. package/UsageRestrictions.md +25 -25
  8. package/_config.yml +381 -388
  9. package/_images.yml +9 -9
  10. package/eslint.config.mjs +55 -55
  11. package/index.html +231 -0
  12. package/languages/README.md +19 -19
  13. package/languages/default.yml +1 -1
  14. package/languages/en.yml +153 -153
  15. package/languages/ja.yml +153 -153
  16. package/languages/zh-CN.yml +153 -153
  17. package/languages/zh-HK.yml +153 -153
  18. package/languages/zh-TW.yml +153 -153
  19. package/layout/_alternate/atom.ejs +30 -30
  20. package/layout/_alternate/json.ejs +16 -16
  21. package/layout/_alternate/rss.ejs +34 -34
  22. package/layout/_mixin/breadcrumb.pug +33 -33
  23. package/layout/_mixin/card.pug +38 -38
  24. package/layout/_mixin/comment.pug +6 -6
  25. package/layout/_mixin/postmeta.pug +29 -29
  26. package/layout/_mixin/segment.pug +35 -35
  27. package/layout/_mixin/sidebar.pug +40 -40
  28. package/layout/_mixin/widgets.pug +28 -28
  29. package/layout/_partials/footer.pug +43 -43
  30. package/layout/_partials/head/head.pug +55 -56
  31. package/layout/_partials/head/head_com.pug +24 -24
  32. package/layout/_partials/head/pwa.pug +18 -18
  33. package/layout/_partials/header.pug +18 -18
  34. package/layout/_partials/layout.pug +140 -140
  35. package/layout/_partials/loading.pug +13 -13
  36. package/layout/_partials/pagination.pug +4 -4
  37. package/layout/_partials/post/copyright.pug +20 -20
  38. package/layout/_partials/post/footer.pug +17 -17
  39. package/layout/_partials/post/nav.pug +13 -13
  40. package/layout/_partials/post/post.pug +41 -41
  41. package/layout/_partials/post/reward.pug +18 -18
  42. package/layout/_partials/sidebar/menu.pug +37 -37
  43. package/layout/_partials/sidebar/overview.pug +42 -42
  44. package/layout/_partials/third-party/baidu-analytics.pug +11 -11
  45. package/layout/_partials/third-party/clarity.pug +8 -8
  46. package/layout/_partials/third-party/google-analytics.pug +9 -9
  47. package/layout/archive.pug +118 -118
  48. package/layout/category.pug +59 -59
  49. package/layout/index.pug +33 -33
  50. package/layout/page.pug +55 -55
  51. package/layout/post.pug +36 -36
  52. package/layout/tag.pug +43 -43
  53. package/meta.json +6431 -0
  54. package/package.json +72 -70
  55. package/scripts/helpers/engine.js +10 -0
  56. package/scripts/plugin/check.js +2 -2
  57. package/scripts/tags/links.js +4 -4
  58. package/source/assets/algolia_logo.svg +9 -9
  59. package/source/assets/logo.svg +16 -16
  60. package/source/css/_colors.styl +207 -207
  61. package/source/css/_common/components/components.styl +6 -6
  62. package/source/css/_common/components/highlight/highlight.styl +357 -357
  63. package/source/css/_common/components/highlight/operation.styl +21 -21
  64. package/source/css/_common/components/pages/collapse.styl +119 -119
  65. package/source/css/_common/components/pages/home.styl +391 -391
  66. package/source/css/_common/components/pages/pages.styl +56 -56
  67. package/source/css/_common/components/pages/tag-cloud.styl +12 -12
  68. package/source/css/_common/components/post/breadcrumb.styl +39 -39
  69. package/source/css/_common/components/post/copyright.styl +41 -41
  70. package/source/css/_common/components/post/expand.styl +263 -263
  71. package/source/css/_common/components/post/footer.styl +11 -11
  72. package/source/css/_common/components/post/header.styl +79 -79
  73. package/source/css/_common/components/post/nav.styl +64 -64
  74. package/source/css/_common/components/post/post.styl +29 -29
  75. package/source/css/_common/components/post/reward.styl +50 -50
  76. package/source/css/_common/components/post/rtl.styl +12 -12
  77. package/source/css/_common/components/post/tags.styl +39 -39
  78. package/source/css/_common/components/tags/collapse.styl +72 -72
  79. package/source/css/_common/components/tags/container.styl +49 -49
  80. package/source/css/_common/components/tags/label.styl +12 -12
  81. package/source/css/_common/components/tags/links.styl +77 -77
  82. package/source/css/_common/components/tags/list.styl +131 -131
  83. package/source/css/_common/components/tags/note.styl +70 -70
  84. package/source/css/_common/components/tags/player.styl +361 -361
  85. package/source/css/_common/components/tags/quiz.styl +200 -200
  86. package/source/css/_common/components/tags/tabs.styl +89 -89
  87. package/source/css/_common/components/tags/tags.styl +9 -9
  88. package/source/css/_common/components/third-party/loading.styl +222 -222
  89. package/source/css/_common/components/third-party/mermaid/class.styl +90 -90
  90. package/source/css/_common/components/third-party/mermaid/flowchart.styl +72 -72
  91. package/source/css/_common/components/third-party/mermaid/gantt.styl +251 -251
  92. package/source/css/_common/components/third-party/mermaid/git.styl +7 -7
  93. package/source/css/_common/components/third-party/mermaid/mermaid.styl +37 -37
  94. package/source/css/_common/components/third-party/mermaid/pie.styl +9 -9
  95. package/source/css/_common/components/third-party/mermaid/sequence.styl +95 -95
  96. package/source/css/_common/components/third-party/mermaid/state.styl +130 -130
  97. package/source/css/_common/components/third-party/pace.styl +18 -18
  98. package/source/css/_common/components/third-party/search.styl +167 -167
  99. package/source/css/_common/components/third-party/theme.styl +151 -151
  100. package/source/css/_common/components/third-party/third-party.styl +22 -22
  101. package/source/css/_common/components/third-party/widgets.styl +57 -57
  102. package/source/css/_common/outline/footer/footer.styl +67 -67
  103. package/source/css/_common/outline/header/brand.styl +77 -77
  104. package/source/css/_common/outline/header/header.styl +20 -20
  105. package/source/css/_common/outline/header/image.styl +85 -85
  106. package/source/css/_common/outline/header/menu.styl +117 -117
  107. package/source/css/_common/outline/header/nav.styl +81 -81
  108. package/source/css/_common/outline/header/right.styl +15 -15
  109. package/source/css/_common/outline/header/tool.styl +207 -207
  110. package/source/css/_common/outline/header/waves.styl +57 -57
  111. package/source/css/_common/outline/mobile.styl +46 -46
  112. package/source/css/_common/outline/outline.styl +78 -78
  113. package/source/css/_common/outline/sidebar/author.styl +59 -59
  114. package/source/css/_common/outline/sidebar/dimmer.styl +23 -23
  115. package/source/css/_common/outline/sidebar/menu.styl +63 -63
  116. package/source/css/_common/outline/sidebar/quick.styl +43 -43
  117. package/source/css/_common/outline/sidebar/related.styl +56 -56
  118. package/source/css/_common/outline/sidebar/sidebar.styl +80 -80
  119. package/source/css/_common/outline/sidebar/social.styl +69 -69
  120. package/source/css/_common/outline/sidebar/state.styl +37 -37
  121. package/source/css/_common/outline/sidebar/tab.styl +71 -71
  122. package/source/css/_common/outline/sidebar/toc.styl +47 -47
  123. package/source/css/_common/scaffolding/animate.styl +322 -322
  124. package/source/css/_common/scaffolding/base.styl +190 -190
  125. package/source/css/_common/scaffolding/buttons.styl +48 -48
  126. package/source/css/_common/scaffolding/divider.styl +36 -36
  127. package/source/css/_common/scaffolding/iconfont.styl +443 -443
  128. package/source/css/_common/scaffolding/normalize.styl +273 -273
  129. package/source/css/_common/scaffolding/pagination.styl +81 -81
  130. package/source/css/_common/scaffolding/ribbon.styl +38 -38
  131. package/source/css/_common/scaffolding/scaffolding.styl +14 -14
  132. package/source/css/_common/scaffolding/scrollbar.styl +37 -37
  133. package/source/css/_common/scaffolding/tables.styl +50 -50
  134. package/source/css/_common/scaffolding/tip.styl +19 -19
  135. package/source/css/_common/scaffolding/toggles.styl +59 -59
  136. package/source/css/_iconfont.styl +455 -455
  137. package/source/css/_mixins.styl +148 -148
  138. package/source/css/_variables.styl +89 -89
  139. package/source/css/app.styl +41 -41
  140. package/source/css/mermaid.styl +5 -5
  141. package/source/css/optimize.styl +5 -5
  142. package/source/js/_app/components/comments.js +59 -0
  143. package/source/js/_app/components/comments.ts +88 -89
  144. package/source/js/_app/components/sidebar.js +244 -0
  145. package/source/js/_app/components/sidebar.ts +239 -239
  146. package/source/js/_app/components/tcomments.js +47 -0
  147. package/source/js/_app/components/tcomments.ts +54 -54
  148. package/source/js/_app/globals/globalVars.ts +99 -99
  149. package/source/js/_app/globals/handles.js +105 -0
  150. package/source/js/_app/globals/handles.ts +124 -124
  151. package/source/js/_app/globals/themeColor.ts +63 -63
  152. package/source/js/_app/globals/thirdparty.ts +63 -63
  153. package/source/js/_app/globals/tools.ts +75 -75
  154. package/source/js/_app/library/anime.ts +110 -110
  155. package/source/js/_app/library/declare.d.ts +128 -130
  156. package/source/js/_app/library/dom.ts +28 -28
  157. package/source/js/_app/library/loadFile.js +43 -0
  158. package/source/js/_app/library/loadFile.ts +47 -50
  159. package/source/js/_app/library/proto.ts +137 -137
  160. package/source/js/_app/library/scriptPjax.ts +72 -72
  161. package/source/js/_app/library/storage.ts +12 -12
  162. package/source/js/_app/library/vue.js +52 -0
  163. package/source/js/_app/library/vue.ts +49 -49
  164. package/source/js/_app/page/common.js +45 -0
  165. package/source/js/_app/page/common.ts +43 -43
  166. package/source/js/_app/page/fancybox.js +70 -0
  167. package/source/js/_app/page/fancybox.ts +72 -72
  168. package/source/js/_app/page/post.js +253 -0
  169. package/source/js/_app/page/post.ts +266 -266
  170. package/source/js/_app/page/search.js +111 -0
  171. package/source/js/_app/page/search.ts +115 -115
  172. package/source/js/_app/page/tab.ts +60 -60
  173. package/source/js/_app/pjax/domInit.js +80 -0
  174. package/source/js/_app/pjax/domInit.ts +97 -97
  175. package/source/js/_app/pjax/refresh.js +137 -0
  176. package/source/js/_app/pjax/refresh.ts +140 -138
  177. package/source/js/_app/pjax/siteInit.js +115 -0
  178. package/source/js/_app/pjax/siteInit.ts +106 -104
  179. package/source/js/_app/player.js +777 -0
  180. package/source/js/_app/player.ts +798 -798
  181. package/toolbox/compiler.mjs +73 -0
  182. package/toolbox/hoistdep.mjs +6 -0
  183. package/toolbox/lib.mjs +40 -0
@@ -1,43 +1,43 @@
1
- import { $dom } from '../library/dom'
2
-
3
- export const cardActive = () => {
4
- if (!document.querySelector('.index.wrap')) { return }
5
- const io = new IntersectionObserver((entries) => {
6
- entries.forEach((article) => {
7
- if (article.target.hasClass('show')) {
8
- io.unobserve(article.target)
9
- } else {
10
- if (article.isIntersecting || article.intersectionRatio > 0) {
11
- article.target.addClass('show')
12
- io.unobserve(article.target)
13
- }
14
- }
15
- })
16
- }, {
17
- root: null,
18
- threshold: [0.3]
19
- })
20
-
21
- $dom.each('.index.wrap article.item, .index.wrap section.item', (article) => {
22
- io.observe(article)
23
- })
24
-
25
- document.querySelector('.index.wrap .item:first-child').addClass('show')
26
-
27
- $dom.each('.cards .item', (element) => {
28
- ['mouseenter', 'touchstart'].forEach((item) => {
29
- element.addEventListener(item, () => {
30
- const cardEle = document.querySelector('.cards .item.active')
31
- if (cardEle) {
32
- cardEle.removeClass('active')
33
- }
34
- element.addClass('active')
35
- }, { passive: true })
36
- });
37
- ['mouseleave'].forEach((item) => {
38
- element.addEventListener(item, () => {
39
- element.removeClass('active')
40
- }, { passive: true })
41
- })
42
- })
43
- }
1
+ import { $dom } from '../library/dom'
2
+
3
+ export const cardActive = () => {
4
+ if (!document.querySelector('.index.wrap')) { return }
5
+ const io = new IntersectionObserver((entries) => {
6
+ entries.forEach((article) => {
7
+ if (article.target.hasClass('show')) {
8
+ io.unobserve(article.target)
9
+ } else {
10
+ if (article.isIntersecting || article.intersectionRatio > 0) {
11
+ article.target.addClass('show')
12
+ io.unobserve(article.target)
13
+ }
14
+ }
15
+ })
16
+ }, {
17
+ root: null,
18
+ threshold: [0.3]
19
+ })
20
+
21
+ $dom.each('.index.wrap article.item, .index.wrap section.item', (article) => {
22
+ io.observe(article)
23
+ })
24
+
25
+ document.querySelector('.index.wrap .item:first-child').addClass('show')
26
+
27
+ $dom.each('.cards .item', (element) => {
28
+ ['mouseenter', 'touchstart'].forEach((item) => {
29
+ element.addEventListener(item, () => {
30
+ const cardEle = document.querySelector('.cards .item.active')
31
+ if (cardEle) {
32
+ cardEle.removeClass('active')
33
+ }
34
+ element.addClass('active')
35
+ }, { passive: true })
36
+ });
37
+ ['mouseleave'].forEach((item) => {
38
+ element.addEventListener(item, () => {
39
+ element.removeClass('active')
40
+ }, { passive: true })
41
+ })
42
+ })
43
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.postFancybox = void 0;
4
+ const dom_1 = require("../library/dom");
5
+ const loadFile_1 = require("../library/loadFile");
6
+ const proto_1 = require("../library/proto");
7
+ const postFancybox = (p) => {
8
+ if ((0, dom_1.$dom)(p + ' .md img')) {
9
+ (0, loadFile_1.vendorCss)('fancybox');
10
+ (0, loadFile_1.vendorCss)('justifiedGallery');
11
+ (0, loadFile_1.vendorJs)('fancybox', () => {
12
+ const q = jQuery.noConflict();
13
+ dom_1.$dom.each(p + ' p.gallery', (element) => {
14
+ const box = document.createElement('div');
15
+ box.className = 'gallery';
16
+ box.setAttribute('data-height', String(element.getAttribute('data-height') || 220));
17
+ box.innerHTML = element.innerHTML.replace(/<br>/g, '');
18
+ element.parentNode.insertBefore(box, element);
19
+ element.remove();
20
+ });
21
+ dom_1.$dom.each(p + ' .md img:not(.emoji):not(.vemoji)', (element) => {
22
+ const $image = q(element);
23
+ const imageLink = $image.attr('data-src') || $image.attr('src'); // 替换
24
+ const $imageWrapLink = $image.wrap('<a class="fancybox" href="' + imageLink + '" itemscope itemtype="https://schema.org/ImageObject" itemprop="url"></a>').parent('a');
25
+ let info;
26
+ let captionClass = 'image-info';
27
+ if (!$image.is('a img')) {
28
+ $image.data('safe-src', imageLink);
29
+ if (!$image.is('.gallery img')) {
30
+ $imageWrapLink.attr('data-fancybox', 'default').attr('rel', 'default');
31
+ }
32
+ else {
33
+ captionClass = 'jg-caption';
34
+ }
35
+ }
36
+ if ((info = element.getAttribute('title'))) {
37
+ $imageWrapLink.attr('data-caption', info);
38
+ const para = document.createElement('span');
39
+ const txt = document.createTextNode(info);
40
+ para.appendChild(txt);
41
+ para.addClass(captionClass);
42
+ (0, proto_1.insertAfter)(element, para);
43
+ }
44
+ });
45
+ dom_1.$dom.each(p + ' div.gallery', (el, i) => {
46
+ // @ts-ignore
47
+ q(el).justifiedGallery({
48
+ rowHeight: q(el).data('height') || 120,
49
+ rel: 'gallery-' + i
50
+ }).on('jg.complete', function () {
51
+ q(this).find('a').each((k, ele) => {
52
+ ele.setAttribute('data-fancybox', 'gallery-' + i);
53
+ });
54
+ });
55
+ });
56
+ q.fancybox.defaults.hash = false;
57
+ q(p + ' .fancybox').fancybox({
58
+ loop: true,
59
+ // @ts-ignore
60
+ helpers: {
61
+ overlay: {
62
+ locked: false
63
+ }
64
+ }
65
+ });
66
+ // @ts-ignore
67
+ }, window.jQuery);
68
+ }
69
+ };
70
+ exports.postFancybox = postFancybox;
@@ -1,72 +1,72 @@
1
- import { $dom } from '../library/dom'
2
- import { vendorCss, vendorJs } from '../library/loadFile'
3
- import { insertAfter } from '../library/proto'
4
-
5
- // TODO 使用PhotoSwipe替换Fancybox
6
- export const postFancybox = (p:string) => {
7
- if (document.querySelector(p + ' .md img')) {
8
- vendorCss('fancybox')
9
- vendorCss('justifiedGallery')
10
- vendorJs('fancybox', () => {
11
- const q = jQuery.noConflict()
12
-
13
- $dom.each(p + ' p.gallery', (element) => {
14
- const box = document.createElement('div')
15
- box.className = 'gallery'
16
- box.setAttribute('data-height', String(element.getAttribute('data-height') || 220))
17
-
18
- box.innerHTML = element.innerHTML.replace(/<br>/g, '')
19
-
20
- element.parentNode.insertBefore(box, element)
21
- element.remove()
22
- })
23
-
24
- $dom.each(p + ' .md img:not(.emoji):not(.vemoji)', (element) => {
25
- const $image = q(element)
26
- const imageLink = $image.attr('data-src') || $image.attr('src') // 替换
27
- const $imageWrapLink = $image.wrap('<a class="fancybox" href="' + imageLink + '" itemscope itemtype="https://schema.org/ImageObject" itemprop="url"></a>').parent('a')
28
- let info; let captionClass = 'image-info'
29
- if (!$image.is('a img')) {
30
- $image.data('safe-src', imageLink)
31
- if (!$image.is('.gallery img')) {
32
- $imageWrapLink.attr('data-fancybox', 'default').attr('rel', 'default')
33
- } else {
34
- captionClass = 'jg-caption'
35
- }
36
- }
37
- if ((info = element.getAttribute('title'))) {
38
- $imageWrapLink.attr('data-caption', info)
39
- const para = document.createElement('span')
40
- const txt = document.createTextNode(info)
41
- para.appendChild(txt)
42
- para.addClass(captionClass)
43
- insertAfter(element, para)
44
- }
45
- })
46
-
47
- $dom.each(p + ' div.gallery', (el, i) => {
48
- // @ts-ignore
49
- q(el).justifiedGallery({
50
- rowHeight: q(el).data('height') || 120,
51
- rel: 'gallery-' + i
52
- }).on('jg.complete', function () {
53
- q(this).find('a').each((k, ele) => {
54
- ele.setAttribute('data-fancybox', 'gallery-' + i)
55
- })
56
- })
57
- })
58
-
59
- q.fancybox.defaults.hash = false
60
- q(p + ' .fancybox').fancybox({
61
- loop: true,
62
- // @ts-ignore
63
- helpers: {
64
- overlay: {
65
- locked: false
66
- }
67
- }
68
- })
69
- // @ts-ignore
70
- }, window.jQuery)
71
- }
72
- }
1
+ import { $dom } from '../library/dom'
2
+ import { vendorCss, vendorJs } from '../library/loadFile'
3
+ import { insertAfter } from '../library/proto'
4
+
5
+ // TODO 使用PhotoSwipe替换Fancybox
6
+ export const postFancybox = (p:string) => {
7
+ if (document.querySelector(p + ' .md img')) {
8
+ vendorCss('fancybox')
9
+ vendorCss('justifiedGallery')
10
+ vendorJs('fancybox', () => {
11
+ const q = jQuery.noConflict()
12
+
13
+ $dom.each(p + ' p.gallery', (element) => {
14
+ const box = document.createElement('div')
15
+ box.className = 'gallery'
16
+ box.setAttribute('data-height', String(element.getAttribute('data-height') || 220))
17
+
18
+ box.innerHTML = element.innerHTML.replace(/<br>/g, '')
19
+
20
+ element.parentNode.insertBefore(box, element)
21
+ element.remove()
22
+ })
23
+
24
+ $dom.each(p + ' .md img:not(.emoji):not(.vemoji)', (element) => {
25
+ const $image = q(element)
26
+ const imageLink = $image.attr('data-src') || $image.attr('src') // 替换
27
+ const $imageWrapLink = $image.wrap('<a class="fancybox" href="' + imageLink + '" itemscope itemtype="https://schema.org/ImageObject" itemprop="url"></a>').parent('a')
28
+ let info; let captionClass = 'image-info'
29
+ if (!$image.is('a img')) {
30
+ $image.data('safe-src', imageLink)
31
+ if (!$image.is('.gallery img')) {
32
+ $imageWrapLink.attr('data-fancybox', 'default').attr('rel', 'default')
33
+ } else {
34
+ captionClass = 'jg-caption'
35
+ }
36
+ }
37
+ if ((info = element.getAttribute('title'))) {
38
+ $imageWrapLink.attr('data-caption', info)
39
+ const para = document.createElement('span')
40
+ const txt = document.createTextNode(info)
41
+ para.appendChild(txt)
42
+ para.addClass(captionClass)
43
+ insertAfter(element, para)
44
+ }
45
+ })
46
+
47
+ $dom.each(p + ' div.gallery', (el, i) => {
48
+ // @ts-ignore
49
+ q(el).justifiedGallery({
50
+ rowHeight: q(el).data('height') || 120,
51
+ rel: 'gallery-' + i
52
+ }).on('jg.complete', function () {
53
+ q(this).find('a').each((k, ele) => {
54
+ ele.setAttribute('data-fancybox', 'gallery-' + i)
55
+ })
56
+ })
57
+ })
58
+
59
+ q.fancybox.defaults.hash = false
60
+ q(p + ' .fancybox').fancybox({
61
+ loop: true,
62
+ // @ts-ignore
63
+ helpers: {
64
+ overlay: {
65
+ locked: false
66
+ }
67
+ }
68
+ })
69
+ // @ts-ignore
70
+ }, window.jQuery)
71
+ }
72
+ }
@@ -0,0 +1,253 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.postBeauty = void 0;
4
+ const dom_1 = require("../library/dom");
5
+ const fancybox_1 = require("./fancybox");
6
+ const tools_1 = require("../globals/tools");
7
+ const globalVars_1 = require("../globals/globalVars");
8
+ const anime_1 = require("../library/anime");
9
+ const player_1 = require("../player");
10
+ const proto_1 = require("../library/proto");
11
+ const postBeauty = () => {
12
+ if (!(0, dom_1.$dom)('.md')) {
13
+ return;
14
+ }
15
+ if (__shokax_fancybox__) {
16
+ (0, fancybox_1.postFancybox)('.post.block');
17
+ }
18
+ (0, dom_1.$dom)('.post.block').oncopy = (event) => {
19
+ (0, tools_1.showtip)(LOCAL.copyright);
20
+ if (LOCAL.nocopy) {
21
+ event.preventDefault();
22
+ return;
23
+ }
24
+ const copyright = (0, dom_1.$dom)('#copyright');
25
+ if (window.getSelection().toString().length > 30 && copyright) {
26
+ event.preventDefault();
27
+ const author = '# ' + copyright.child('.author').innerText;
28
+ const link = '# ' + copyright.child('.link').innerText;
29
+ const license = '# ' + copyright.child('.license').innerText;
30
+ const htmlData = author + '<br>' + link + '<br>' + license + '<br><br>' + window.getSelection().toString().replace(/\r\n/g, '<br>');
31
+ const textData = author + '\n' + link + '\n' + license + '\n\n' + window.getSelection().toString().replace(/\r\n/g, '\n');
32
+ if (event.clipboardData) {
33
+ event.clipboardData.setData('text/html', htmlData);
34
+ event.clipboardData.setData('text/plain', textData);
35
+ }
36
+ else {
37
+ // @ts-ignore
38
+ if (window.clipboardData) {
39
+ // @ts-ignore
40
+ return window.clipboardData.setData('text', textData);
41
+ }
42
+ }
43
+ }
44
+ };
45
+ dom_1.$dom.each('li ruby', (element) => {
46
+ let parent = element.parentNode;
47
+ // @ts-ignore
48
+ if (element.parentNode.tagName !== 'LI') {
49
+ parent = element.parentNode.parentNode;
50
+ }
51
+ parent.addClass('ruby');
52
+ });
53
+ dom_1.$dom.each('ol[start]', (element) => {
54
+ // @ts-ignore
55
+ element.style.counterReset = 'counter ' + parseInt(element.getAttribute('start') - 1);
56
+ });
57
+ dom_1.$dom.each('.md table', (element) => {
58
+ (0, proto_1.wrapObject)(element, {
59
+ className: 'table-container'
60
+ });
61
+ });
62
+ dom_1.$dom.each('.highlight > .table-container', (element) => {
63
+ element.className = 'code-container';
64
+ });
65
+ dom_1.$dom.each('figure.highlight', (element) => {
66
+ const code_container = element.child('.code-container');
67
+ const caption = element.child('figcaption');
68
+ element.insertAdjacentHTML('beforeend', '<div class="operation"><span class="breakline-btn"><i class="ic i-align-left"></i></span><span class="copy-btn"><i class="ic i-clipboard"></i></span><span class="fullscreen-btn"><i class="ic i-expand"></i></span></div>');
69
+ const copyBtn = element.child('.copy-btn');
70
+ if (LOCAL.nocopy) {
71
+ copyBtn.remove();
72
+ }
73
+ else {
74
+ copyBtn.addEventListener('click', (event) => {
75
+ const target = event.currentTarget;
76
+ let comma = '';
77
+ let code = '';
78
+ code_container.find('pre').forEach((line) => {
79
+ code += comma + line.innerText;
80
+ comma = '\n';
81
+ });
82
+ (0, tools_1.clipBoard)(code, (result) => {
83
+ target.child('.ic').className = result ? 'ic i-check' : 'ic i-times';
84
+ target.blur();
85
+ (0, tools_1.showtip)(LOCAL.copyright);
86
+ });
87
+ }, { passive: true });
88
+ copyBtn.addEventListener('mouseleave', (event) => {
89
+ setTimeout(() => {
90
+ event.target.child('.ic').className = 'ic i-clipboard';
91
+ }, 1000);
92
+ });
93
+ }
94
+ const breakBtn = element.child('.breakline-btn');
95
+ breakBtn.addEventListener('click', (event) => {
96
+ const target = event.currentTarget;
97
+ if (element.hasClass('breakline')) {
98
+ element.removeClass('breakline');
99
+ target.child('.ic').className = 'ic i-align-left';
100
+ }
101
+ else {
102
+ element.addClass('breakline');
103
+ target.child('.ic').className = 'ic i-align-justify';
104
+ }
105
+ });
106
+ const fullscreenBtn = element.child('.fullscreen-btn');
107
+ const removeFullscreen = () => {
108
+ element.removeClass('fullscreen');
109
+ element.scrollTop = 0;
110
+ globalVars_1.BODY.removeClass('fullscreen');
111
+ fullscreenBtn.child('.ic').className = 'ic i-expand';
112
+ };
113
+ const fullscreenHandle = () => {
114
+ if (element.hasClass('fullscreen')) {
115
+ removeFullscreen();
116
+ if (code_container && code_container.find('tr').length > 15) {
117
+ const showBtn = code_container.child('.show-btn');
118
+ code_container.style.maxHeight = '300px';
119
+ showBtn.removeClass('open');
120
+ }
121
+ (0, anime_1.pageScroll)(element);
122
+ }
123
+ else {
124
+ element.addClass('fullscreen');
125
+ globalVars_1.BODY.addClass('fullscreen');
126
+ fullscreenBtn.child('.ic').className = 'ic i-compress';
127
+ if (code_container && code_container.find('tr').length > 15) {
128
+ const showBtn = code_container.child('.show-btn');
129
+ code_container.style.maxHeight = '';
130
+ showBtn.addClass('open');
131
+ }
132
+ }
133
+ };
134
+ fullscreenBtn.addEventListener('click', fullscreenHandle);
135
+ caption && caption.addEventListener('click', fullscreenHandle);
136
+ if (code_container && code_container.find('tr').length > 15) {
137
+ code_container.style.maxHeight = '300px';
138
+ code_container.insertAdjacentHTML('beforeend', '<div class="show-btn"><i class="ic i-angle-down"></i></div>');
139
+ const showBtn = code_container.child('.show-btn');
140
+ const hideCode = () => {
141
+ code_container.style.maxHeight = '300px';
142
+ showBtn.removeClass('open');
143
+ };
144
+ const showCode = () => {
145
+ code_container.style.maxHeight = '';
146
+ showBtn.addClass('open');
147
+ };
148
+ showBtn.addEventListener('click', () => {
149
+ if (showBtn.hasClass('open')) {
150
+ removeFullscreen();
151
+ hideCode();
152
+ (0, anime_1.pageScroll)(code_container);
153
+ }
154
+ else {
155
+ showCode();
156
+ }
157
+ });
158
+ }
159
+ });
160
+ dom_1.$dom.each('pre.mermaid > svg', (element) => {
161
+ const temp = element;
162
+ temp.style.maxWidth = '';
163
+ });
164
+ dom_1.$dom.each('.reward button', (element) => {
165
+ element.addEventListener('click', (event) => {
166
+ event.preventDefault();
167
+ const qr = (0, dom_1.$dom)('#qr');
168
+ if ((0, proto_1.getDisplay)(qr) === 'inline-flex') {
169
+ (0, anime_1.transition)(qr, 0);
170
+ }
171
+ else {
172
+ (0, anime_1.transition)(qr, 1, () => {
173
+ (0, proto_1.setDisplay)(qr, 'inline-flex');
174
+ }); // slideUpBigIn
175
+ }
176
+ });
177
+ });
178
+ // quiz
179
+ if (__shokax_quiz__) {
180
+ dom_1.$dom.each('.quiz > ul.options li', (element) => {
181
+ element.addEventListener('click', () => {
182
+ if (element.hasClass('correct')) {
183
+ element.toggleClass('right');
184
+ element.parentNode.parentNode.addClass('show');
185
+ }
186
+ else {
187
+ element.toggleClass('wrong');
188
+ }
189
+ });
190
+ });
191
+ dom_1.$dom.each('.quiz > p', (element) => {
192
+ element.addEventListener('click', () => {
193
+ element.parentNode.toggleClass('show');
194
+ });
195
+ });
196
+ dom_1.$dom.each('.quiz > p:first-child', (element) => {
197
+ const quiz = element.parentNode;
198
+ let type = 'choice';
199
+ if (quiz.hasClass('true') || quiz.hasClass('false')) {
200
+ type = 'true_false';
201
+ }
202
+ if (quiz.hasClass('multi')) {
203
+ type = 'multiple';
204
+ }
205
+ if (quiz.hasClass('fill')) {
206
+ type = 'gap_fill';
207
+ }
208
+ if (quiz.hasClass('essay')) {
209
+ type = 'essay';
210
+ }
211
+ element.setAttribute('data-type', LOCAL.quiz[type]);
212
+ });
213
+ dom_1.$dom.each('.quiz .mistake', (element) => {
214
+ element.setAttribute('data-type', LOCAL.quiz.mistake);
215
+ });
216
+ }
217
+ dom_1.$dom.each('div.tags a', (element) => {
218
+ element.className = ['primary', 'success', 'info', 'warning', 'danger'][Math.floor(Math.random() * 5)];
219
+ });
220
+ if (__shokax_player__) {
221
+ dom_1.$dom.each('.md div.player', (element) => {
222
+ (0, player_1.mediaPlayer)(element, {
223
+ type: element.getAttribute('data-type'),
224
+ mode: 'order',
225
+ btns: []
226
+ }).player.load(JSON.parse(element.getAttribute('data-src'))).fetch();
227
+ });
228
+ }
229
+ const angleDown = document.querySelectorAll('.show-btn .i-angle-down');
230
+ if (angleDown.length) {
231
+ const io = new IntersectionObserver((entries) => {
232
+ entries.forEach(entry => {
233
+ if (entry.isIntersecting) {
234
+ angleDown.forEach(i => {
235
+ i.classList.remove('stop-animation');
236
+ });
237
+ }
238
+ else {
239
+ angleDown.forEach(i => {
240
+ i.classList.add('stop-animation');
241
+ });
242
+ }
243
+ });
244
+ }, {
245
+ root: null,
246
+ threshold: 0.5
247
+ });
248
+ angleDown.forEach(i => {
249
+ io.observe(i);
250
+ });
251
+ }
252
+ };
253
+ exports.postBeauty = postBeauty;