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,192 @@
1
+ (function() {
2
+ {%- include scripts/lib/swiper.js -%}
3
+ var SOURCES = window.TEXT_VARIABLES.sources;
4
+ window.Lazyload.js(SOURCES.jquery, function() {
5
+ var template =
6
+ '<div class="swiper gallery__swiper">' +
7
+ '<div class="swiper__wrapper">' +
8
+ '</div>' +
9
+ '<div class="swiper__button swiper__button--prev fas fa-chevron-left"></div>' +
10
+ '<div class="swiper__button swiper__button--next fas fa-chevron-right"></div>' +
11
+ '</div>';
12
+ function setState($item, zoom, translate) {
13
+ $item.css('transform', 'scale(' + zoom + ') translate(' + translate.x + 'px,' + translate.y + 'px)');
14
+ }
15
+ function Gallery(root, items) {
16
+ this.$root = $(root);
17
+ this.$swiper = null;
18
+ this.$swiperWrapper = null;
19
+ this.$activeItem = null;
20
+ this.$items = [];
21
+ this.contentWidth = 0;
22
+ this.contentHeight = 0;
23
+ this.swiper = null;
24
+ this.items = items;
25
+ this.disabled = false;
26
+ this.curIndex = 0;
27
+ this.touchCenter = null;
28
+ this.lastTouchCenter = null;
29
+ this.zoomRect = null;
30
+ this.lastZoomRect = null;
31
+ this.lastTranslate = null;
32
+ this.translate = null;
33
+ this.lastZoom = 1;
34
+ this.preZoom = 1;
35
+ this.zoom = 1;
36
+ }
37
+ Gallery.prototype.init = function() {
38
+ var i, item, items = this.items, size, self = this, touchstartFingerCount = 0;
39
+ this.$root.append(template);
40
+ this.$swiper = this.$root.find('.gallery__swiper');
41
+ this.$swiperWrapper = this.$root.find('.swiper__wrapper');
42
+ this.contentWidth = this.$swiperWrapper && this.$swiperWrapper.width();
43
+ this.contentHeight = this.$swiperWrapper && this.$swiperWrapper.height();
44
+ for (i = 0; i < items.length; i++) {
45
+ item = items[i];
46
+ size = this._calculateImageSize(item.w, item.h);
47
+ this.$items.push($(
48
+ '<div class="swiper__slide">' +
49
+ '<div class="gallery-item">' +
50
+ '<div class="gallery-item__content">' +
51
+ '<img src="' + item.src + '" style="width:' + size.w + 'px;height:' + size.h + 'px"/>' +
52
+ '</div>' +
53
+ '</div>' +
54
+ '</div>'
55
+ ));
56
+ }
57
+ this.$swiperWrapper && this.$swiperWrapper.append(this.$items);
58
+ this.swiper = this.$swiper && this.$swiper.swiper({
59
+ onChangeEnd: function() {
60
+ self._handleChangeEnd.apply(self, Array.prototype.slice.call(arguments));
61
+ }
62
+ });
63
+ $(window).on('resize', function() {
64
+ if (self.disabled) { return; }
65
+ self._resizeImageSize();
66
+ });
67
+ // Char Code: 37 ⬅, 39 ➡
68
+ $(window).on('keyup', function(e) {
69
+ if (window.isFormElement(e.target || e.srcElement) || self.disabled) { return; }
70
+ if (e.which === 37) {
71
+ self.swiper && self.swiper.previous();
72
+ } else if (e.which === 39) {
73
+ self.swiper && self.swiper.next();
74
+ }
75
+ });
76
+ function getRect(touch0, touch1) {
77
+ return {
78
+ o: {
79
+ x: (touch0.pageX + touch1.pageX) / 2,
80
+ y: (touch0.pageY + touch1.pageY) / 2
81
+ },
82
+ w: Math.abs(touch0.pageX - touch1.pageX),
83
+ h: Math.abs(touch0.pageY - touch1.pageY)
84
+ };
85
+ }
86
+ function getTouches(e) {
87
+ return e.touches || e;
88
+ }
89
+ function getTouchesCount(e) {
90
+ if (e.touches) {
91
+ return e.touches.length;
92
+ } else {
93
+ return 1;
94
+ }
95
+ }
96
+ this.$swiperWrapper.on('touchstart', function(e) {
97
+ var touch0, touch1, rect;
98
+ touchstartFingerCount = getTouchesCount(e);
99
+ if (touchstartFingerCount > 1) {
100
+ touch0 = e.touches[0];
101
+ touch1 = e.touches[1];
102
+ rect = getRect(touch0, touch1);
103
+ self.lastZoomRect = { w: rect.w, h: rect.h };
104
+ self.lastTouchCenter = rect.o;
105
+ } else {
106
+ var touch = getTouches(e)[0];
107
+ self.lastTouchCenter = { x: touch.pageX, y: touch.pageY };
108
+ }
109
+ });
110
+ this.$swiperWrapper.on('touchmove', function(e) {
111
+ if (touchstartFingerCount === getTouchesCount(e)) {
112
+ if (touchstartFingerCount > 1) {
113
+ var touch0 = e.touches[0];
114
+ var touch1 = e.touches[1];
115
+ var rect = getRect(touch0, touch1);
116
+ self.zoomRect = { w: rect.w, h: rect.h };
117
+ self.touchCenter = rect.o;
118
+ self._zoom(); self._translate();
119
+ setState(self.$activeItem, self.zoom, self.translate);
120
+ } else {
121
+ var touch = getTouches(e)[0];
122
+ self.touchCenter = { x: touch.pageX, y: touch.pageY };
123
+ self._translate();
124
+ setState(self.$activeItem, self.zoom, self.translate);
125
+ }
126
+ }
127
+ });
128
+ this.$swiperWrapper.on('touchend', function(e) {
129
+ self.lastZoom = self.zoom;
130
+ self.lastTranslate = self.translate;
131
+ touchstartFingerCount = 0;
132
+ });
133
+ this.$root.on('touchmove', function(e) {
134
+ if (self.disabled) { return; }
135
+ e.preventDefault();
136
+ });
137
+ };
138
+
139
+ Gallery.prototype._translate = function() {
140
+ this.translate = this.touchCenter && this.lastTouchCenter && this.lastTranslate ? {
141
+ x: (this.touchCenter.x - this.lastTouchCenter.x) / this.zoom + this.lastTranslate.x,
142
+ y: (this.touchCenter.y - this.lastTouchCenter.y) / this.zoom + this.lastTranslate.y
143
+ } : { x: 0, y: 0 };
144
+ }
145
+ Gallery.prototype._zoom = function() {
146
+ this.zoom = (this.zoomRect.w + this.zoomRect.h) / (this.lastZoomRect.w + this.lastZoomRect.h) * this.lastZoom;
147
+ this.zoom > 1 ? this.$activeItem.addClass('zoom') : this.$activeItem.removeClass('zoom');
148
+ this.preZoom = this.zoom;
149
+ }
150
+
151
+ Gallery.prototype._calculateImageSize = function(w, h) {
152
+ var scale = 1;
153
+ if (this.contentWidth > 0 && this.contentHeight > 0 && w > 0 && h > 0) {
154
+ scale = Math.min(
155
+ Math.min(w, this.contentWidth) / w,
156
+ Math.min(h, this.contentHeight) / h);
157
+ }
158
+ return { w: Math.floor(w * scale), h: Math.floor(h * scale) };
159
+ };
160
+
161
+ Gallery.prototype._resizeImageSize = function() {
162
+ var i, $item, $items = this.$items, item, size;
163
+ this.contentWidth = this.$swiperWrapper && this.$swiperWrapper.width();
164
+ this.contentHeight = this.$swiperWrapper && this.$swiperWrapper.height();
165
+ if ($items.length < 1) { return; }
166
+ for (i = 0; i < $items.length; i++) {
167
+ item = this.items[i], $item = $items[i];
168
+ size = this._calculateImageSize(item.w, item.h);
169
+ item.width = size.w; item.height = size.h;
170
+ $item && $item.find('img').css({ width: size.w, height: size.h });
171
+ }
172
+ };
173
+ Gallery.prototype._handleChangeEnd = function(index, $dom, preIndex, $preDom) {
174
+ this.curIndex = index;
175
+ this.lastZoomRect = null; this.lastZoomRect = null;
176
+ this.lastTranslate = this.translate = { x: 0, y:0 };
177
+ this.lastZoom = this.preZoom = this.zoom = 1;
178
+ this.$activeItem = $dom.find('.gallery-item__content');
179
+ setState($preDom.find('.gallery-item__content'), this.zoom, this.translate);
180
+ };
181
+
182
+ Gallery.prototype.refresh = function() {
183
+ this.swiper && this.swiper.refresh();
184
+ this._resizeImageSize();
185
+ };
186
+ Gallery.prototype.setOptions = function(options) {
187
+ this.disabled = options.disabled;
188
+ this.swiper && this.swiper.setOptions(options);
189
+ };
190
+ window.Gallery = Gallery;
191
+ });
192
+ })();
@@ -0,0 +1,143 @@
1
+ (function() {
2
+ var Set = (function() {
3
+ var add = function(item) {
4
+ var i, data = this._data;
5
+ for (i = 0; i < data.length; i++) {
6
+ if (data[i] === item) {
7
+ return;
8
+ }
9
+ }
10
+ this.size ++;
11
+ data.push(item);
12
+ return data;
13
+ };
14
+
15
+ var Set = function(data) {
16
+ this.size = 0;
17
+ this._data = [];
18
+ var i;
19
+ if (data.length > 0) {
20
+ for (i = 0; i < data.length; i++) {
21
+ add.call(this, data[i]);
22
+ }
23
+ }
24
+ };
25
+ Set.prototype.add = add;
26
+ Set.prototype.get = function(index) { return this._data[index]; };
27
+ Set.prototype.has = function(item) {
28
+ var i, data = this._data;
29
+ for (i = 0; i < data.length; i++) {
30
+ if (this.get(i) === item) {
31
+ return true;
32
+ }
33
+ }
34
+ return false;
35
+ };
36
+ Set.prototype.is = function(map) {
37
+ if (map._data.length !== this._data.length) { return false; }
38
+ var i, j, flag, tData = this._data, mData = map._data;
39
+ for (i = 0; i < tData.length; i++) {
40
+ for (flag = false, j = 0; j < mData.length; j++) {
41
+ if (tData[i] === mData[j]) {
42
+ flag = true;
43
+ break;
44
+ }
45
+ }
46
+ if (!flag) { return false; }
47
+ }
48
+ return true;
49
+ };
50
+ Set.prototype.values = function() {
51
+ return this._data;
52
+ };
53
+ return Set;
54
+ })();
55
+
56
+ window.Lazyload = (function(doc) {
57
+ var queue = {js: [], css: []}, sources = {js: {}, css: {}}, context = this;
58
+ var createNode = function(name, attrs) {
59
+ var node = doc.createElement(name), attr;
60
+ for (attr in attrs) {
61
+ if (attrs.hasOwnProperty(attr)) {
62
+ node.setAttribute(attr, attrs[attr]);
63
+ }
64
+ }
65
+ return node;
66
+ };
67
+ var end = function(type, url) {
68
+ var s, q, qi, cbs, i, j, cur, val, flag;
69
+ if (type === 'js' || type ==='css') {
70
+ s = sources[type], q = queue[type];
71
+ s[url] = true;
72
+ for (i = 0; i < q.length; i++) {
73
+ cur = q[i];
74
+ if (cur.urls.has(url)) {
75
+ qi = cur, val = qi.urls.values();
76
+ qi && (cbs = qi.callbacks);
77
+ for (flag = true, j = 0; j < val.length; j++) {
78
+ cur = val[j];
79
+ if (!s[cur]) {
80
+ flag = false;
81
+ }
82
+ }
83
+ if (flag && cbs && cbs.length > 0) {
84
+ for (j = 0; j < cbs.length; j++) {
85
+ cbs[j].call(context);
86
+ }
87
+ qi.load = true;
88
+ }
89
+ }
90
+ }
91
+ }
92
+ };
93
+ var load = function(type, urls, callback) {
94
+ var s, q, qi, node, i, cur,
95
+ _urls = typeof urls === 'string' ? new Set([urls]) : new Set(urls), val, url;
96
+ if (type === 'js' || type ==='css') {
97
+ s = sources[type], q = queue[type];
98
+ for (i = 0; i < q.length; i++) {
99
+ cur = q[i];
100
+ if (_urls.is(cur.urls)) {
101
+ qi = cur;
102
+ break;
103
+ }
104
+ }
105
+ val = _urls.values();
106
+ if (qi) {
107
+ callback && (qi.load || qi.callbacks.push(callback));
108
+ callback && (qi.load && callback());
109
+ } else {
110
+ q.push({
111
+ urls: _urls,
112
+ callbacks: callback ? [callback] : [],
113
+ load: false
114
+ });
115
+ for (i = 0; i < val.length; i++) {
116
+ node = null, url = val[i];
117
+ if (s[url] === undefined) {
118
+ (type === 'js' ) && (node = createNode('script', { src: url }));
119
+ (type === 'css') && (node = createNode('link', { rel: 'stylesheet', href: url }));
120
+ if (node) {
121
+ node.onload = (function(type, url) {
122
+ return function() {
123
+ end(type, url);
124
+ };
125
+ })(type, url);
126
+ (doc.head || doc.body).appendChild(node);
127
+ s[url] = false;
128
+ }
129
+ }
130
+ }
131
+ }
132
+ }
133
+ };
134
+ return {
135
+ js: function(url, callback) {
136
+ load('js', url, callback);
137
+ },
138
+ css: function(url, callback) {
139
+ load('css', url, callback);
140
+ }
141
+ };
142
+ })(this.document);
143
+ })();
@@ -0,0 +1,64 @@
1
+ (function() {
2
+ var SOURCES = window.TEXT_VARIABLES.sources;
3
+ window.Lazyload.js(SOURCES.jquery, function() {
4
+ var $body = $('body'), $window = $(window);
5
+ var $pageRoot = $('.js-page-root'), $pageMain = $('.js-page-main');
6
+ var activeCount = 0;
7
+ function modal(options) {
8
+ var $root = this, visible, onChange, hideWhenWindowScroll = false;
9
+ var scrollTop;
10
+ function setOptions(options) {
11
+ var _options = options || {};
12
+ visible = _options.initialVisible === undefined ? false : show;
13
+ onChange = _options.onChange;
14
+ hideWhenWindowScroll = _options.hideWhenWindowScroll;
15
+ }
16
+ function init() {
17
+ setState(visible);
18
+ }
19
+ function setState(isShow) {
20
+ if (isShow === visible) {
21
+ return;
22
+ }
23
+ visible = isShow;
24
+ if (visible) {
25
+ activeCount++;
26
+ scrollTop = $(window).scrollTop() || $pageMain.scrollTop();
27
+ $root.addClass('modal--show');
28
+ $pageMain.scrollTop(scrollTop);
29
+ activeCount === 1 && ($pageRoot.addClass('show-modal'), $body.addClass('of-hidden'));
30
+ hideWhenWindowScroll && window.hasEvent('touchstart') && $window.on('scroll', hide);
31
+ $window.on('keyup', handleKeyup);
32
+ } else {
33
+ activeCount > 0 && activeCount--;
34
+ $root.removeClass('modal--show');
35
+ $window.scrollTop(scrollTop);
36
+ activeCount === 0 && ($pageRoot.removeClass('show-modal'), $body.removeClass('of-hidden'));
37
+ hideWhenWindowScroll && window.hasEvent('touchstart') && $window.off('scroll', hide);
38
+ $window.off('keyup', handleKeyup);
39
+ }
40
+ onChange && onChange(visible);
41
+ }
42
+ function show() {
43
+ setState(true);
44
+ }
45
+ function hide() {
46
+ setState(false);
47
+ }
48
+ function handleKeyup(e) {
49
+ // Char Code: 27 ESC
50
+ if (e.which === 27) {
51
+ hide();
52
+ }
53
+ }
54
+ setOptions(options);
55
+ init();
56
+ return {
57
+ show: show,
58
+ hide: hide,
59
+ $el: $root
60
+ };
61
+ }
62
+ $.fn.modal = modal;
63
+ });
64
+ })();
@@ -0,0 +1,13 @@
1
+ (function() {
2
+ var SOURCES = window.TEXT_VARIABLES.sources;
3
+ window.Lazyload.js(SOURCES.jquery, function() {
4
+ function scrollToAnchor(anchor, duration, callback) {
5
+ var $root = this;
6
+ $root.animate({ scrollTop: $(anchor).position().top }, duration, function() {
7
+ window.history.replaceState(null, '', window.location.href.split('#')[0] + anchor);
8
+ callback && callback();
9
+ });
10
+ }
11
+ $.fn.scrollToAnchor = scrollToAnchor;
12
+ });
13
+ })();
@@ -0,0 +1,203 @@
1
+ (function() {
2
+ var SOURCES = window.TEXT_VARIABLES.sources;
3
+ window.Lazyload.js(SOURCES.jquery, function() {
4
+ function swiper(options) {
5
+ var $window = $(window), $root = this, $swiperWrapper, $swiperSlides, $swiperButtonPrev, $swiperButtonNext,
6
+ initialSlide, animation, onChange, onChangeEnd,
7
+ rootWidth, count, preIndex, curIndex, translateX, CRITICAL_ANGLE = Math.PI / 3;
8
+
9
+ function setOptions(options) {
10
+ var _options = options || {};
11
+ initialSlide = _options.initialSlide || 0;
12
+ animation = _options.animation === undefined && true;
13
+ onChange = onChange || _options.onChange;
14
+ onChangeEnd = onChangeEnd || _options.onChangeEnd;
15
+ }
16
+
17
+ function init() {
18
+ $swiperWrapper = $root.find('.swiper__wrapper');
19
+ $swiperSlides = $root.find('.swiper__slide');
20
+ $swiperButtonPrev = $root.find('.swiper__button--prev');
21
+ $swiperButtonNext = $root.find('.swiper__button--next');
22
+ animation && $swiperWrapper.addClass('swiper__wrapper--animation');
23
+ calc(true);
24
+ }
25
+
26
+ function preCalc() {
27
+ rootWidth = $root.width();
28
+ count = $swiperWrapper.children('.swiper__slide').length;
29
+ if (count < 2) {
30
+ $swiperButtonPrev.addClass('d-none');
31
+ $swiperButtonNext.addClass('d-none');
32
+ }
33
+ curIndex = initialSlide || 0;
34
+ translateX = getTranslateXFromCurIndex();
35
+ }
36
+
37
+ var calc = (function() {
38
+ var preAnimation, $swiperSlide, $preSwiperSlide;
39
+ return function (needPreCalc, params) {
40
+ needPreCalc && preCalc();
41
+ var _animation = (params && params.animation !== undefined) ? params.animation : animation;
42
+ if (preAnimation === undefined || preAnimation !== _animation) {
43
+ preAnimation = _animation ? $swiperWrapper.addClass('swiper__wrapper--animation') :
44
+ $swiperWrapper.removeClass('swiper__wrapper--animation');
45
+ }
46
+ if (preIndex !== curIndex) {
47
+ ($preSwiperSlide = $swiperSlides.eq(preIndex)).removeClass('active');
48
+ ($swiperSlide = $swiperSlides.eq(curIndex)).addClass('active');
49
+ onChange && onChange(curIndex, $swiperSlides.eq(curIndex), $swiperSlide, $preSwiperSlide);
50
+ if (onChangeEnd) {
51
+ if (_animation) {
52
+ setTimeout(function() {
53
+ onChangeEnd(curIndex, $swiperSlides.eq(curIndex), $swiperSlide, $preSwiperSlide);
54
+ }, 400);
55
+ } else {
56
+ onChangeEnd(curIndex, $swiperSlides.eq(curIndex), $swiperSlide, $preSwiperSlide);
57
+ }
58
+ }
59
+ preIndex = curIndex;
60
+ }
61
+ $swiperWrapper.css('transform', 'translate(' + translateX + 'px, 0)');
62
+ if (count > 1) {
63
+ if (curIndex <= 0) {
64
+ $swiperButtonPrev.addClass('disabled');
65
+ } else {
66
+ $swiperButtonPrev.removeClass('disabled');
67
+ }
68
+ if (curIndex >= count - 1) {
69
+ $swiperButtonNext.addClass('disabled');
70
+ } else {
71
+ $swiperButtonNext.removeClass('disabled');
72
+ }
73
+ }
74
+ };
75
+ })();
76
+
77
+ function getTranslateXFromCurIndex() {
78
+ return curIndex <= 0 ? 0 : - rootWidth * curIndex;
79
+ }
80
+
81
+ function moveToIndex(index ,params) {
82
+ preIndex = curIndex;
83
+ curIndex = index;
84
+ translateX = getTranslateXFromCurIndex();
85
+ calc(false, params);
86
+ }
87
+
88
+ function move(type) {
89
+ var nextIndex = curIndex, unstableTranslateX;
90
+ if (type === 'prev') {
91
+ nextIndex > 0 && nextIndex--;
92
+ } else if (type === 'next') {
93
+ nextIndex < count - 1 && nextIndex++;
94
+ }
95
+ if (type === 'cur') {
96
+ moveToIndex(curIndex, { animation: true });
97
+ return;
98
+ }
99
+ unstableTranslateX = translateX % rootWidth !== 0;
100
+ if (nextIndex !== curIndex || unstableTranslateX) {
101
+ unstableTranslateX ? moveToIndex(nextIndex, { animation: true }) : moveToIndex(nextIndex);
102
+ }
103
+ }
104
+
105
+ setOptions(options);
106
+ init();
107
+ preIndex = curIndex;
108
+
109
+ $swiperButtonPrev.on('click', function(e) {
110
+ e.stopPropagation();
111
+ move('prev');
112
+ });
113
+ $swiperButtonNext.on('click', function(e) {
114
+ e.stopPropagation();
115
+ move('next');
116
+ });
117
+ $window.on('resize', function() {
118
+ calc(true, { animation: false });
119
+ });
120
+
121
+ (function() {
122
+ var pageX, pageY, velocityX, preTranslateX = translateX, timeStamp, touching;
123
+ function handleTouchstart(e) {
124
+ var point = e.touches ? e.touches[0] : e;
125
+ pageX = point.pageX;
126
+ pageY = point.pageY;
127
+ velocityX = 0;
128
+ preTranslateX = translateX;
129
+ }
130
+ function handleTouchmove(e) {
131
+ if (e.touches && e.touches.length > 1) {
132
+ return;
133
+ }
134
+ var point = e.touches ? e.touches[0] : e;
135
+ var deltaX = point.pageX - pageX;
136
+ var deltaY = point.pageY - pageY;
137
+ velocityX = deltaX / (e.timeStamp - timeStamp);
138
+ timeStamp = e.timeStamp;
139
+ if (e.cancelable && Math.abs(Math.atan(deltaY / deltaX)) < CRITICAL_ANGLE) {
140
+ touching = true;
141
+ translateX += deltaX;
142
+ calc(false, { animation: false });
143
+ }
144
+ pageX = point.pageX;
145
+ pageY = point.pageY;
146
+ }
147
+ function handleTouchend() {
148
+ touching = false;
149
+ var deltaX = translateX - preTranslateX;
150
+ var distance = deltaX + velocityX * rootWidth;
151
+ if (Math.abs(distance) > rootWidth / 2) {
152
+ distance > 0 ? move('prev') : move('next');
153
+ } else {
154
+ move('cur');
155
+ }
156
+ }
157
+ $swiperWrapper.on('touchstart', handleTouchstart);
158
+ $swiperWrapper.on('touchmove', handleTouchmove);
159
+ $swiperWrapper.on('touchend', handleTouchend);
160
+ $swiperWrapper.on('touchcancel', handleTouchend);
161
+
162
+ (function() {
163
+ var pressing = false, moved = false;
164
+ $swiperWrapper.on('mousedown', function(e) {
165
+ pressing = true; handleTouchstart(e);
166
+ });
167
+ $swiperWrapper.on('mousemove', function(e) {
168
+ pressing && (e.preventDefault(), moved = true, handleTouchmove(e));
169
+ });
170
+ $swiperWrapper.on('mouseup', function(e) {
171
+ pressing && (pressing = false, handleTouchend(e));
172
+ });
173
+ $swiperWrapper.on('mouseleave', function(e) {
174
+ pressing && (pressing = false, handleTouchend(e));
175
+ });
176
+ $swiperWrapper.on('click', function(e) {
177
+ moved && (e.stopPropagation(), moved = false);
178
+ });
179
+ })();
180
+
181
+ $root.on('touchmove', function(e) {
182
+ if (e.cancelable & touching) {
183
+ e.preventDefault();
184
+ }
185
+ });
186
+ })();
187
+
188
+ return {
189
+ setOptions: setOptions,
190
+ previous: function(){
191
+ move('prev');
192
+ },
193
+ next: function(){
194
+ move('next');
195
+ },
196
+ refresh: function() {
197
+ calc(true, { animation: false });
198
+ }
199
+ };
200
+ }
201
+ $.fn.swiper = swiper;
202
+ });
203
+ })();
@@ -0,0 +1,28 @@
1
+ (function() {
2
+ window.throttle = function(func, wait) {
3
+ var args, result, thisArg, timeoutId, lastCalled = 0;
4
+
5
+ function trailingCall() {
6
+ lastCalled = new Date;
7
+ timeoutId = null;
8
+ result = func.apply(thisArg, args);
9
+ }
10
+ return function() {
11
+ var now = new Date,
12
+ remaining = wait - (now - lastCalled);
13
+
14
+ args = arguments;
15
+ thisArg = this;
16
+
17
+ if (remaining <= 0) {
18
+ clearTimeout(timeoutId);
19
+ timeoutId = null;
20
+ lastCalled = now;
21
+ result = func.apply(thisArg, args);
22
+ } else if (!timeoutId) {
23
+ timeoutId = setTimeout(trailingCall, remaining);
24
+ }
25
+ return result;
26
+ };
27
+ };
28
+ })();