jekyll-text-theme-fork 2.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (224) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +235 -0
  3. data/LICENSE +21 -0
  4. data/README.md +89 -0
  5. data/_data/authors.yml +0 -0
  6. data/_data/licenses.yml +16 -0
  7. data/_data/locale.yml +169 -0
  8. data/_data/navigation.yml +52 -0
  9. data/_data/variables.yml +64 -0
  10. data/_includes/analytics-providers/custom.html +3 -0
  11. data/_includes/analytics-providers/google.html +14 -0
  12. data/_includes/analytics.html +7 -0
  13. data/_includes/article/footer/author-profile.html +47 -0
  14. data/_includes/article/footer/custom.html +3 -0
  15. data/_includes/article/footer/license.html +14 -0
  16. data/_includes/article/footer/subscribe.html +6 -0
  17. data/_includes/article/top/custom.html +3 -0
  18. data/_includes/article-footer.html +55 -0
  19. data/_includes/article-header.html +49 -0
  20. data/_includes/article-info.html +96 -0
  21. data/_includes/article-list.html +144 -0
  22. data/_includes/article-section-navigator.html +54 -0
  23. data/_includes/aside/toc.html +1 -0
  24. data/_includes/author-links.html +120 -0
  25. data/_includes/comments-providers/custom.html +3 -0
  26. data/_includes/comments-providers/disqus.html +22 -0
  27. data/_includes/comments-providers/gitalk.html +39 -0
  28. data/_includes/comments-providers/valine.html +46 -0
  29. data/_includes/comments.html +11 -0
  30. data/_includes/extensions/bilibili.html +5 -0
  31. data/_includes/extensions/codepen.html +4 -0
  32. data/_includes/extensions/netease-cloud-music.html +4 -0
  33. data/_includes/extensions/slideshare.html +6 -0
  34. data/_includes/extensions/soundcloud.html +4 -0
  35. data/_includes/extensions/ted.html +5 -0
  36. data/_includes/extensions/youtube.html +4 -0
  37. data/_includes/footer.html +37 -0
  38. data/_includes/head/custom.html +3 -0
  39. data/_includes/head/favicon.html +26 -0
  40. data/_includes/head.html +24 -0
  41. data/_includes/header.html +44 -0
  42. data/_includes/main/bottom/custom.html +3 -0
  43. data/_includes/main/top/custom.html +3 -0
  44. data/_includes/markdown-enhancements/chart.html +15 -0
  45. data/_includes/markdown-enhancements/mathjax.html +17 -0
  46. data/_includes/markdown-enhancements/mermaid.html +10 -0
  47. data/_includes/markdown-enhancements.html +17 -0
  48. data/_includes/pageview-providers/custom/home.html +3 -0
  49. data/_includes/pageview-providers/custom/post.html +3 -0
  50. data/_includes/pageview-providers/leancloud/home.html +35 -0
  51. data/_includes/pageview-providers/leancloud/leancloud.js +72 -0
  52. data/_includes/pageview-providers/leancloud/post.html +31 -0
  53. data/_includes/pageview.html +29 -0
  54. data/_includes/paginator.html +98 -0
  55. data/_includes/scripts/archieve.js +135 -0
  56. data/_includes/scripts/article.js +24 -0
  57. data/_includes/scripts/aside/affix.js +26 -0
  58. data/_includes/scripts/aside/toc.js +35 -0
  59. data/_includes/scripts/common.js +7 -0
  60. data/_includes/scripts/components/lightbox.js +49 -0
  61. data/_includes/scripts/components/search.js +86 -0
  62. data/_includes/scripts/components/sidebar.js +30 -0
  63. data/_includes/scripts/home.js +3 -0
  64. data/_includes/scripts/lib/affix.js +111 -0
  65. data/_includes/scripts/lib/gallery.js +192 -0
  66. data/_includes/scripts/lib/lazyload.js +143 -0
  67. data/_includes/scripts/lib/modal.js +64 -0
  68. data/_includes/scripts/lib/scroll-to.js +13 -0
  69. data/_includes/scripts/lib/swiper.js +203 -0
  70. data/_includes/scripts/lib/throttle.js +28 -0
  71. data/_includes/scripts/lib/toc.js +107 -0
  72. data/_includes/scripts/page.js +3 -0
  73. data/_includes/scripts/utils/imagesLoad.js +28 -0
  74. data/_includes/scripts/utils/utils.js +39 -0
  75. data/_includes/scripts/variables.html +35 -0
  76. data/_includes/search-providers/custom/search.html +3 -0
  77. data/_includes/search-providers/default/search-data.js +14 -0
  78. data/_includes/search-providers/default/search.html +18 -0
  79. data/_includes/search-providers/default/search.js +112 -0
  80. data/_includes/search-providers/google-custom-search-engine/search.html +21 -0
  81. data/_includes/search-providers/google-custom-search-engine/search.js +33 -0
  82. data/_includes/search.html +20 -0
  83. data/_includes/sharing-providers/addthis.html +9 -0
  84. data/_includes/sharing-providers/addtoany.html +10 -0
  85. data/_includes/sharing-providers/custom.html +3 -0
  86. data/_includes/sharing.html +7 -0
  87. data/_includes/sidebar/toc.html +25 -0
  88. data/_includes/snippets/assign.html +9 -0
  89. data/_includes/snippets/get-article-title.html +11 -0
  90. data/_includes/snippets/get-lang.html +6 -0
  91. data/_includes/snippets/get-locale-string.html +12 -0
  92. data/_includes/snippets/get-nav-url.html +8 -0
  93. data/_includes/snippets/get-sources.html +2 -0
  94. data/_includes/snippets/get-string-from-locale-config.html +7 -0
  95. data/_includes/snippets/is_collection.html +6 -0
  96. data/_includes/snippets/page-url.html +2 -0
  97. data/_includes/snippets/prepend-baseurl.html +4 -0
  98. data/_includes/snippets/prepend-path.html +1 -0
  99. data/_includes/svg/icon/social/behance.svg +3 -0
  100. data/_includes/svg/icon/social/douban.svg +5 -0
  101. data/_includes/svg/icon/social/facebook.svg +3 -0
  102. data/_includes/svg/icon/social/flicker.svg +5 -0
  103. data/_includes/svg/icon/social/github.svg +3 -0
  104. data/_includes/svg/icon/social/googleplus.svg +3 -0
  105. data/_includes/svg/icon/social/linkedin.svg +3 -0
  106. data/_includes/svg/icon/social/mail.svg +6 -0
  107. data/_includes/svg/icon/social/medium.svg +3 -0
  108. data/_includes/svg/icon/social/npm.svg +9 -0
  109. data/_includes/svg/icon/social/pinterest.svg +3 -0
  110. data/_includes/svg/icon/social/qq.svg +3 -0
  111. data/_includes/svg/icon/social/telegram.svg +4 -0
  112. data/_includes/svg/icon/social/twitter.svg +3 -0
  113. data/_includes/svg/icon/social/weibo.svg +6 -0
  114. data/_includes/svg/icon/social/weixin.svg +3 -0
  115. data/_includes/svg/icon/social/zhihu.svg +3 -0
  116. data/_includes/svg/logo.svg +8 -0
  117. data/_includes/tags.html +52 -0
  118. data/_layouts/404.html +13 -0
  119. data/_layouts/archive.html +40 -0
  120. data/_layouts/article.html +29 -0
  121. data/_layouts/articles.html +89 -0
  122. data/_layouts/base.html +25 -0
  123. data/_layouts/home.html +43 -0
  124. data/_layouts/landing.html +178 -0
  125. data/_layouts/none.html +1 -0
  126. data/_layouts/page.html +270 -0
  127. data/_sass/additional/_alert.scss +29 -0
  128. data/_sass/additional/_photo-frame.scss +17 -0
  129. data/_sass/additional/_tag.scss +21 -0
  130. data/_sass/animate/_fade-in-down.scss +10 -0
  131. data/_sass/animate/_fade-in-up.scss +10 -0
  132. data/_sass/animate/_fade-in.scss +8 -0
  133. data/_sass/common/_classes.scss +24 -0
  134. data/_sass/common/_function.scss +15 -0
  135. data/_sass/common/_print.scss +20 -0
  136. data/_sass/common/_reset.scss +174 -0
  137. data/_sass/common/_variables.scss +150 -0
  138. data/_sass/common/classes/_animation.scss +13 -0
  139. data/_sass/common/classes/_clearfix.scss +19 -0
  140. data/_sass/common/classes/_clickable.scss +159 -0
  141. data/_sass/common/classes/_display.scss +13 -0
  142. data/_sass/common/classes/_flex.scss +394 -0
  143. data/_sass/common/classes/_grid.scss +80 -0
  144. data/_sass/common/classes/_horizontal-rules.scss +14 -0
  145. data/_sass/common/classes/_link.scss +12 -0
  146. data/_sass/common/classes/_media.scss +17 -0
  147. data/_sass/common/classes/_overflow.scss +26 -0
  148. data/_sass/common/classes/_pseudo.scss +33 -0
  149. data/_sass/common/classes/_shadow.scss +22 -0
  150. data/_sass/common/classes/_spacing.scss +81 -0
  151. data/_sass/common/classes/_split-line.scss +24 -0
  152. data/_sass/common/classes/_text.scss +37 -0
  153. data/_sass/common/classes/_transform.scss +4 -0
  154. data/_sass/common/classes/_transition.scss +4 -0
  155. data/_sass/common/classes/_user-select.scss +6 -0
  156. data/_sass/common/components/_button.scss +163 -0
  157. data/_sass/common/components/_card.scss +103 -0
  158. data/_sass/common/components/_gallery.scss +21 -0
  159. data/_sass/common/components/_hero.scss +70 -0
  160. data/_sass/common/components/_image.scss +19 -0
  161. data/_sass/common/components/_item.scss +100 -0
  162. data/_sass/common/components/_menu.scss +67 -0
  163. data/_sass/common/components/_modal.scss +39 -0
  164. data/_sass/common/components/_swiper.scss +48 -0
  165. data/_sass/common/components/_toc.scss +124 -0
  166. data/_sass/components/_article-content.scss +221 -0
  167. data/_sass/components/_article-footer.scss +17 -0
  168. data/_sass/components/_article-header.scss +50 -0
  169. data/_sass/components/_article-info.scss +25 -0
  170. data/_sass/components/_article-list.scss +18 -0
  171. data/_sass/components/_author-links.scss +43 -0
  172. data/_sass/components/_author-profile.scss +26 -0
  173. data/_sass/components/_extensions.scss +35 -0
  174. data/_sass/components/_footer.scss +33 -0
  175. data/_sass/components/_header.scss +123 -0
  176. data/_sass/components/_lightbox.scss +7 -0
  177. data/_sass/components/_main.scss +28 -0
  178. data/_sass/components/_search.scss +186 -0
  179. data/_sass/components/_tags.scss +24 -0
  180. data/_sass/custom.scss +3 -0
  181. data/_sass/layout/_404.scss +14 -0
  182. data/_sass/layout/_archive.scss +5 -0
  183. data/_sass/layout/_article.scss +29 -0
  184. data/_sass/layout/_articles.scss +17 -0
  185. data/_sass/layout/_base.scss +6 -0
  186. data/_sass/layout/_home.scss +15 -0
  187. data/_sass/layout/_landing.scss +23 -0
  188. data/_sass/layout/_page.scss +165 -0
  189. data/_sass/skins/_chocolate.scss +74 -0
  190. data/_sass/skins/_dark.scss +74 -0
  191. data/_sass/skins/_default.scss +74 -0
  192. data/_sass/skins/_forest.scss +74 -0
  193. data/_sass/skins/_ocean.scss +74 -0
  194. data/_sass/skins/_orange.scss +74 -0
  195. data/_sass/skins/highlight/_default.scss +0 -0
  196. data/_sass/skins/highlight/_tomorrow-night-blue.scss +2 -0
  197. data/_sass/skins/highlight/_tomorrow-night-bright.scss +2 -0
  198. data/_sass/skins/highlight/_tomorrow-night-eighties.scss +2 -0
  199. data/_sass/skins/highlight/_tomorrow-night.scss +2 -0
  200. data/_sass/skins/highlight/_tomorrow.scss +2 -0
  201. data/_sass/skins/highlight/tomorrow/_default.scss +10 -0
  202. data/_sass/skins/highlight/tomorrow/_highlight.scss +74 -0
  203. data/_sass/skins/highlight/tomorrow/_night-blue.scss +10 -0
  204. data/_sass/skins/highlight/tomorrow/_night-bright.scss +10 -0
  205. data/_sass/skins/highlight/tomorrow/_night-eighties.scss +10 -0
  206. data/_sass/skins/highlight/tomorrow/_night.scss +10 -0
  207. data/assets/android-chrome-192x192.png +0 -0
  208. data/assets/android-chrome-512x512.png +0 -0
  209. data/assets/apple-touch-icon.png +0 -0
  210. data/assets/browserconfig.xml +9 -0
  211. data/assets/css/main.scss +74 -0
  212. data/assets/favicon-16x16.png +0 -0
  213. data/assets/favicon-32x32.png +0 -0
  214. data/assets/favicon.ico +0 -0
  215. data/assets/images/logo/logo.svg +8 -0
  216. data/assets/mstile-144x144.png +0 -0
  217. data/assets/mstile-150x150.png +0 -0
  218. data/assets/mstile-310x150.png +0 -0
  219. data/assets/mstile-310x310.png +0 -0
  220. data/assets/mstile-70x70.png +0 -0
  221. data/assets/safari-pinned-tab.svg +38 -0
  222. data/assets/search.js +3 -0
  223. data/assets/site.webmanifest +19 -0
  224. metadata +371 -0
@@ -0,0 +1,135 @@
1
+ (function() {
2
+ var SOURCES = window.TEXT_VARIABLES.sources;
3
+ function queryString() {
4
+ // This function is anonymous, is executed immediately and
5
+ // the return value is assigned to QueryString!
6
+ var i = 0, queryObj = {}, pair;
7
+ var queryStr = window.location.search.substring(1);
8
+ var queryArr = queryStr.split('&');
9
+ for (i = 0; i < queryArr.length; i++) {
10
+ pair = queryArr[i].split('=');
11
+ // If first entry with this name
12
+ if (typeof queryObj[pair[0]] === 'undefined') {
13
+ queryObj[pair[0]] = pair[1];
14
+ // If second entry with this name
15
+ } else if (typeof queryObj[pair[0]] === 'string') {
16
+ queryObj[pair[0]] = [queryObj[pair[0]], pair[1]];
17
+ // If third or later entry with this name
18
+ } else {
19
+ queryObj[pair[0]].push(pair[1]);
20
+ }
21
+ }
22
+ return queryObj;
23
+ }
24
+
25
+ var setUrlQuery = (function() {
26
+ var baseUrl = window.location.href.split('?')[0];
27
+ return function(query) {
28
+ if (typeof query === 'string') {
29
+ window.history.replaceState(null, '', baseUrl + query);
30
+ } else {
31
+ window.history.replaceState(null, '', baseUrl);
32
+ }
33
+ };
34
+ })();
35
+
36
+ window.Lazyload.js(SOURCES.jquery, function() {
37
+ var $tags = $('.js-tags');
38
+ var $articleTags = $tags.find('button');
39
+ var $tagShowAll = $tags.find('.tag-button--all');
40
+ var $result = $('.js-result');
41
+ var $sections = $result.find('section');
42
+ var sectionArticles = [];
43
+ var $lastFocusButton = null;
44
+ var sectionTopArticleIndex = [];
45
+ var hasInit = false;
46
+
47
+ $sections.each(function() {
48
+ sectionArticles.push($(this).find('.item'));
49
+ });
50
+
51
+ function init() {
52
+ var i, index = 0;
53
+ for (i = 0; i < $sections.length; i++) {
54
+ sectionTopArticleIndex.push(index);
55
+ index += $sections.eq(i).find('.item').length;
56
+ }
57
+ sectionTopArticleIndex.push(index);
58
+ }
59
+
60
+ function searchButtonsByTag(_tag/*raw tag*/) {
61
+ if (!_tag) {
62
+ return $tagShowAll;
63
+ }
64
+ var _buttons = $articleTags.filter('[data-encode="' + _tag + '"]');
65
+ if (_buttons.length === 0) {
66
+ return $tagShowAll;
67
+ }
68
+ return _buttons;
69
+ }
70
+ function buttonFocus(target) {
71
+ if (target) {
72
+ target.addClass('focus');
73
+ $lastFocusButton && !$lastFocusButton.is(target) && $lastFocusButton.removeClass('focus');
74
+ $lastFocusButton = target;
75
+ }
76
+ }
77
+
78
+ function tagSelect (tag/*raw tag*/, target) {
79
+ var result = {}, $articles;
80
+ var i, j, k, _tag;
81
+
82
+ for (i = 0; i < sectionArticles.length; i++) {
83
+ $articles = sectionArticles[i];
84
+ for (j = 0; j < $articles.length; j++) {
85
+ if (tag === '' || tag === undefined) {
86
+ result[i] || (result[i] = {});
87
+ result[i][j] = true;
88
+ } else {
89
+ var tags = $articles.eq(j).data('tags').split(',');
90
+ for (k = 0; k < tags.length; k++) {
91
+ if (tags[k] === tag) {
92
+ result[i] || (result[i] = {});
93
+ result[i][j] = true; break;
94
+ }
95
+ }
96
+ }
97
+ }
98
+ }
99
+
100
+ for (i = 0; i < sectionArticles.length; i++) {
101
+ result[i] && $sections.eq(i).removeClass('d-none');
102
+ result[i] || $sections.eq(i).addClass('d-none');
103
+ for (j = 0; j < sectionArticles[i].length; j++) {
104
+ if (result[i] && result[i][j]) {
105
+ sectionArticles[i].eq(j).removeClass('d-none');
106
+ } else {
107
+ sectionArticles[i].eq(j).addClass('d-none');
108
+ }
109
+ }
110
+ }
111
+
112
+ hasInit || ($result.removeClass('d-none'), hasInit = true);
113
+
114
+
115
+ if (target) {
116
+ buttonFocus(target);
117
+ _tag = target.attr('data-encode');
118
+ if (_tag === '' || typeof _tag !== 'string') {
119
+ setUrlQuery();
120
+ } else {
121
+ setUrlQuery('?tag=' + _tag);
122
+ }
123
+ } else {
124
+ buttonFocus(searchButtonsByTag(tag));
125
+ }
126
+ }
127
+
128
+ var query = queryString(), _tag = query.tag;
129
+ init(); tagSelect(_tag);
130
+ $tags.on('click', 'button', function() {
131
+ tagSelect($(this).data('encode'), $(this));
132
+ });
133
+
134
+ });
135
+ })();
@@ -0,0 +1,24 @@
1
+ (function() {
2
+ var SOURCES = window.TEXT_VARIABLES.sources;
3
+ window.Lazyload.js(SOURCES.jquery, function() {
4
+ $(function() {
5
+ var $this ,$scroll;
6
+ var $articleContent = $('.js-article-content');
7
+ var hasSidebar = $('.js-page-root').hasClass('layout--page--sidebar');
8
+ var scroll = hasSidebar ? '.js-page-main' : 'html, body';
9
+ $scroll = $(scroll);
10
+
11
+ $articleContent.find('.highlight').each(function() {
12
+ $this = $(this);
13
+ $this.attr('data-lang', $this.find('code').attr('data-lang'));
14
+ });
15
+ $articleContent.find('h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]').each(function() {
16
+ $this = $(this);
17
+ $this.append($('<a class="anchor d-print-none" aria-hidden="true"></a>').html('<i class="fas fa-anchor"></i>'));
18
+ });
19
+ $articleContent.on('click', '.anchor', function() {
20
+ $scroll.scrollToAnchor('#' + $(this).parent().attr('id'), 400);
21
+ });
22
+ });
23
+ });
24
+ })();
@@ -0,0 +1,26 @@
1
+ (function() {
2
+ var SOURCES = window.TEXT_VARIABLES.sources;
3
+ window.Lazyload.js(SOURCES.jquery, function() {
4
+ var $window = $(window), $pageFooter = $('.js-page-footer');
5
+ var $pageAside = $('.js-page-aside');
6
+ var affix;
7
+ var tocDisabled = false;
8
+ var hasSidebar = $('.js-page-root').hasClass('layout--page--sidebar');
9
+
10
+ affix = $pageAside.affix({
11
+ offsetBottom: $pageFooter.outerHeight(),
12
+ scrollTarget: hasSidebar ? '.js-page-main' : null,
13
+ scroller: hasSidebar ? '.js-page-main' : null,
14
+ scroll: hasSidebar ? $('.js-page-main').children() : null,
15
+ disabled: tocDisabled
16
+ });
17
+
18
+ $window.on('resize', window.throttle(function() {
19
+ affix && affix.setOptions({
20
+ disabled: tocDisabled
21
+ });
22
+ }, 100));
23
+
24
+ window.pageAsideAffix = affix;
25
+ });
26
+ })();
@@ -0,0 +1,35 @@
1
+ (function() {
2
+ var SOURCES = window.TEXT_VARIABLES.sources;
3
+ var TOC_SELECTOR = window.TEXT_VARIABLES.site.toc.selectors;
4
+ window.Lazyload.js(SOURCES.jquery, function() {
5
+ var $window = $(window);
6
+ var $articleContent = $('.js-article-content');
7
+ var $tocRoot = $('.js-toc-root'), $col2 = $('.js-col-aside');
8
+ var toc;
9
+ var tocDisabled = false;
10
+ var hasSidebar = $('.js-page-root').hasClass('layout--page--sidebar');
11
+ var hasToc = $articleContent.find(TOC_SELECTOR).length > 0;
12
+
13
+ function disabled() {
14
+ return $col2.css('display') === 'none' || !hasToc;
15
+ }
16
+
17
+ tocDisabled = disabled();
18
+
19
+ toc = $tocRoot.toc({
20
+ selectors: TOC_SELECTOR,
21
+ container: $articleContent,
22
+ scrollTarget: hasSidebar ? '.js-page-main' : null,
23
+ scroller: hasSidebar ? '.js-page-main' : null,
24
+ disabled: tocDisabled
25
+ });
26
+
27
+ $window.on('resize', window.throttle(function() {
28
+ tocDisabled = disabled();
29
+ toc && toc.setOptions({
30
+ disabled: tocDisabled
31
+ });
32
+ }, 100));
33
+
34
+ });
35
+ })();
@@ -0,0 +1,7 @@
1
+ (function () {
2
+ var $root = document.getElementsByClassName('root')[0];
3
+ if (window.hasEvent('touchstart')) {
4
+ $root.dataset.isTouch = true;
5
+ document.addEventListener('touchstart', function(){}, false);
6
+ }
7
+ })();
@@ -0,0 +1,49 @@
1
+ {%- include scripts/utils/imagesLoad.js -%}
2
+ (function () {
3
+ var SOURCES = window.TEXT_VARIABLES.sources;
4
+ window.Lazyload.js(SOURCES.jquery, function() {
5
+ var $pageGalleryModal = $('.js-page-gallery-modal');
6
+ var $images = $('.page__content').find('img:not(.lightbox-ignore)');
7
+ window.imagesLoad($images).then(function() {
8
+ /* global Gallery */
9
+ var pageGalleryModal = $pageGalleryModal.modal({ onChange: handleModalChange });
10
+ var gallery = null;
11
+ var modalVisible = false;
12
+ var i, items = [], image, item;
13
+ if($images && $images.length > 0) {
14
+ for (i = 0; i < $images.length; i++) {
15
+ image = $images.eq(i);
16
+ if (image.get(0).naturalWidth > 800) {
17
+ items.push({ src: image.attr('src'), w: image.get(0).naturalWidth, h: image.get(0).naturalHeight, $el: image});
18
+ }
19
+ }
20
+ }
21
+
22
+ if(items.length > 0) {
23
+ gallery = new Gallery('.gallery', items);
24
+ gallery.setOptions({ disabled: !modalVisible });
25
+ gallery.init();
26
+ for (i = 0; i < items.length; i++) {
27
+ item = items[i];
28
+ item.$el && (item.$el.addClass('popup-image'), item.$el.on('click', (function() {
29
+ var index = i;
30
+ return function() {
31
+ pageGalleryModal.show();
32
+ gallery.setOptions({ initialSlide: index });
33
+ gallery.refresh(true, { animation: false });
34
+ };
35
+ })()));
36
+ }
37
+ }
38
+
39
+ function handleModalChange(visible) {
40
+ modalVisible = visible;
41
+ gallery && gallery.setOptions({ disabled: !modalVisible });
42
+ }
43
+
44
+ $pageGalleryModal.on('click', function() {
45
+ pageGalleryModal.hide();
46
+ });
47
+ });
48
+ });
49
+ })();
@@ -0,0 +1,86 @@
1
+
2
+ (function () {
3
+ var SOURCES = window.TEXT_VARIABLES.sources;
4
+ window.Lazyload.js(SOURCES.jquery, function() {
5
+ // search panel
6
+ var search = (window.search || (window.search = {}));
7
+ var useDefaultSearchBox = window.useDefaultSearchBox === undefined ?
8
+ true : window.useDefaultSearchBox ;
9
+
10
+ var $searchModal = $('.js-page-search-modal');
11
+ var $searchToggle = $('.js-search-toggle');
12
+ var searchModal = $searchModal.modal({ onChange: handleModalChange, hideWhenWindowScroll: true });
13
+ var modalVisible = false;
14
+ search.searchModal = searchModal;
15
+
16
+ var $searchBox = null;
17
+ var $searchInput = null;
18
+ var $searchClear = null;
19
+
20
+ function getModalVisible() {
21
+ return modalVisible;
22
+ }
23
+ search.getModalVisible = getModalVisible;
24
+
25
+ function handleModalChange(visible) {
26
+ modalVisible = visible;
27
+ if (visible) {
28
+ search.onShow && search.onShow();
29
+ useDefaultSearchBox && $searchInput[0] && $searchInput[0].focus();
30
+ } else {
31
+ search.onShow && search.onHide();
32
+ useDefaultSearchBox && $searchInput[0] && $searchInput[0].blur();
33
+ setTimeout(function() {
34
+ useDefaultSearchBox && ($searchInput.val(''), $searchBox.removeClass('not-empty'));
35
+ search.clear && search.clear();
36
+ window.pageAsideAffix && window.pageAsideAffix.refresh();
37
+ }, 400);
38
+ }
39
+ }
40
+
41
+ $searchToggle.on('click', function() {
42
+ modalVisible ? searchModal.hide() : searchModal.show();
43
+ });
44
+ // Char Code: 83 S, 191 /
45
+ $(window).on('keyup', function(e) {
46
+ if (!modalVisible && !window.isFormElement(e.target || e.srcElement) && (e.which === 83 || e.which === 191)) {
47
+ modalVisible || searchModal.show();
48
+ }
49
+ });
50
+
51
+ if (useDefaultSearchBox) {
52
+ $searchBox = $('.js-search-box');
53
+ $searchInput = $searchBox.children('input');
54
+ $searchClear = $searchBox.children('.js-icon-clear');
55
+ search.getSearchInput = function() {
56
+ return $searchInput.get(0);
57
+ };
58
+ search.getVal = function() {
59
+ return $searchInput.val();
60
+ };
61
+ search.setVal = function(val) {
62
+ $searchInput.val(val);
63
+ };
64
+
65
+ $searchInput.on('focus', function() {
66
+ $(this).addClass('focus');
67
+ });
68
+ $searchInput.on('blur', function() {
69
+ $(this).removeClass('focus');
70
+ });
71
+ $searchInput.on('input', window.throttle(function() {
72
+ var val = $(this).val();
73
+ if (val === '' || typeof val !== 'string') {
74
+ search.clear && search.clear();
75
+ } else {
76
+ $searchBox.addClass('not-empty');
77
+ search.onInputNotEmpty && search.onInputNotEmpty(val);
78
+ }
79
+ }, 400));
80
+ $searchClear.on('click', function() {
81
+ $searchInput.val(''); $searchBox.removeClass('not-empty');
82
+ search.clear && search.clear();
83
+ });
84
+ }
85
+ });
86
+ })();
@@ -0,0 +1,30 @@
1
+ (function() {
2
+ var SOURCES = window.TEXT_VARIABLES.sources;
3
+
4
+ window.Lazyload.js(SOURCES.jquery, function() {
5
+ var $pageMask = $('.js-page-mask');
6
+ var $pageRoot = $('.js-page-root');
7
+ var $sidebarShow = $('.js-sidebar-show');
8
+ var $sidebarHide = $('.js-sidebar-hide');
9
+
10
+ function freeze(e) {
11
+ if (e.target === $pageMask[0]) {
12
+ e.preventDefault();
13
+ }
14
+ }
15
+ function stopBodyScrolling(bool) {
16
+ if (bool === true) {
17
+ window.addEventListener('touchmove', freeze, { passive: false });
18
+ } else {
19
+ window.removeEventListener('touchmove', freeze, { passive: false });
20
+ }
21
+ }
22
+
23
+ $sidebarShow.on('click', function() {
24
+ stopBodyScrolling(true); $pageRoot.addClass('show-sidebar');
25
+ });
26
+ $sidebarHide.on('click', function() {
27
+ stopBodyScrolling(false); $pageRoot.removeClass('show-sidebar');
28
+ });
29
+ });
30
+ })();
@@ -0,0 +1,3 @@
1
+ /*(function () {
2
+
3
+ })();*/
@@ -0,0 +1,111 @@
1
+ (function() {
2
+ var SOURCES = window.TEXT_VARIABLES.sources;
3
+ window.Lazyload.js(SOURCES.jquery, function() {
4
+ function affix(options) {
5
+ var $root = this, $window = $(window), $scrollTarget, $scroll,
6
+ offsetBottom = 0, scrollTarget = window, scroll = window.document, disabled = false, isOverallScroller = true,
7
+ rootTop, rootLeft, rootHeight, scrollBottom, rootBottomTop,
8
+ hasInit = false, curState;
9
+
10
+ function setOptions(options) {
11
+ var _options = options || {};
12
+ _options.offsetBottom && (offsetBottom = _options.offsetBottom);
13
+ _options.scrollTarget && (scrollTarget = _options.scrollTarget);
14
+ _options.scroll && (scroll = _options.scroll);
15
+ _options.disabled !== undefined && (disabled = _options.disabled);
16
+ $scrollTarget = $(scrollTarget);
17
+ isOverallScroller = window.isOverallScroller($scrollTarget[0]);
18
+ $scroll = $(scroll);
19
+ }
20
+ function preCalc() {
21
+ top();
22
+ rootHeight = $root.outerHeight();
23
+ rootTop = $root.offset().top + (isOverallScroller ? 0 : $scrollTarget.scrollTop());
24
+ rootLeft = $root.offset().left;
25
+ }
26
+ function calc(needPreCalc) {
27
+ needPreCalc && preCalc();
28
+ scrollBottom = $scroll.outerHeight() - offsetBottom - rootHeight;
29
+ rootBottomTop = scrollBottom - rootTop;
30
+ }
31
+ function top() {
32
+ if (curState !== 'top') {
33
+ $root.removeClass('fixed').css({
34
+ left: 0,
35
+ top: 0
36
+ });
37
+ curState = 'top';
38
+ }
39
+ }
40
+ function fixed() {
41
+ if (curState !== 'fixed') {
42
+ $root.addClass('fixed').css({
43
+ left: rootLeft + 'px',
44
+ top: 0
45
+ });
46
+ curState = 'fixed';
47
+ }
48
+ }
49
+ function bottom() {
50
+ if (curState !== 'bottom') {
51
+ $root.removeClass('fixed').css({
52
+ left: 0,
53
+ top: rootBottomTop + 'px'
54
+ });
55
+ curState = 'bottom';
56
+ }
57
+ }
58
+ function setState() {
59
+ var scrollTop = $scrollTarget.scrollTop();
60
+ if (scrollTop >= rootTop && scrollTop <= scrollBottom) {
61
+ fixed();
62
+ } else if (scrollTop < rootTop) {
63
+ top();
64
+ } else {
65
+ bottom();
66
+ }
67
+ }
68
+ function init() {
69
+ if(!hasInit) {
70
+ var interval, timeout;
71
+ calc(true); setState();
72
+ // run calc every 100 millisecond
73
+ interval = setInterval(function() {
74
+ calc();
75
+ }, 100);
76
+ timeout = setTimeout(function() {
77
+ clearInterval(interval);
78
+ }, 45000);
79
+ window.pageLoad.then(function() {
80
+ setTimeout(function() {
81
+ clearInterval(interval);
82
+ clearTimeout(timeout);
83
+ }, 3000);
84
+ });
85
+ $scrollTarget.on('scroll', function() {
86
+ disabled || setState();
87
+ });
88
+ $window.on('resize', function() {
89
+ disabled || (calc(true), setState());
90
+ });
91
+ hasInit = true;
92
+ }
93
+ }
94
+
95
+ setOptions(options);
96
+ if (!disabled) {
97
+ init();
98
+ }
99
+ $window.on('resize', window.throttle(function() {
100
+ init();
101
+ }, 200));
102
+ return {
103
+ setOptions: setOptions,
104
+ refresh: function() {
105
+ calc(true, { animation: false }); setState();
106
+ }
107
+ };
108
+ }
109
+ $.fn.affix = affix;
110
+ });
111
+ })();