jekyll-theme-prettydocs 0.0.6 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE.txt +0 -0
  3. data/README.md +59 -178
  4. data/_includes/footer.html +6 -6
  5. data/_includes/home.html +122 -0
  6. data/_includes/promo-block.html +29 -86
  7. data/_layouts/home.html +36 -53
  8. data/_layouts/page.html +51 -5
  9. data/assets/.DS_Store +0 -0
  10. data/assets/css/.DS_Store +0 -0
  11. data/assets/css/styles.css +1373 -1267
  12. data/assets/images/.DS_Store +0 -0
  13. data/assets/images/demo/.DS_Store +0 -0
  14. data/assets/images/demo/fontawesome-icons.png +0 -0
  15. data/assets/images/demo/instance-promo.jpg +0 -0
  16. data/assets/images/demo/theme-atom.png +0 -0
  17. data/assets/images/demo/theme-decibel.png +0 -0
  18. data/assets/images/demo/theme-delta.png +0 -0
  19. data/assets/images/demo/theme-devstudio.png +0 -0
  20. data/assets/images/demo/theme-instance.png +0 -0
  21. data/assets/images/demo/theme-onboard.png +0 -0
  22. data/assets/images/demo/theme-orbit.png +0 -0
  23. data/assets/images/demo/theme-pillar.png +0 -0
  24. data/assets/images/demo/theme-sphere.png +0 -0
  25. data/assets/images/demo/theme-startupkit.png +0 -0
  26. data/assets/images/demo/theme-tempo.png +0 -0
  27. data/assets/images/demo/theme-trades.png +0 -0
  28. data/assets/images/empty.gif +0 -0
  29. data/assets/images/untitled folder/.DS_Store +0 -0
  30. data/assets/images/untitled folder/bootstrap-template-for-schools-academy.png +0 -0
  31. data/assets/images/untitled folder/crowdfunding-landing-page-onboard.png +0 -0
  32. data/assets/images/untitled folder/free-bootstrap-portfolio-theme-for-developers.png +0 -0
  33. data/assets/images/untitled folder/free-bootstrap-theme-appkit-landing.png +0 -0
  34. data/assets/images/untitled folder/free-bootstrap-theme-for-developers-devaid.png +0 -0
  35. data/assets/images/untitled folder/free-bootstrap-theme-for-develpers-prettydocs.png +0 -0
  36. data/assets/images/untitled folder/free-bootstrap-theme-for-documentation-prettydedocs.png +0 -0
  37. data/assets/images/untitled folder/free-bootstrap-theme-for-startups-developers-appkit-landing.png +0 -0
  38. data/assets/images/untitled folder/html5-website-template-college-green.png +0 -0
  39. data/assets/images/untitled folder/html5-website-template-placeholder.png +0 -0
  40. data/assets/images/untitled folder/restaurant-landing-page-epicure.png +0 -0
  41. data/assets/images/untitled folder/wedding-invitation-landing-page-matrimony.png +0 -0
  42. data/assets/js/.DS_Store +0 -0
  43. data/assets/js/main.js +42 -46
  44. data/assets/plugins/.DS_Store +0 -0
  45. data/assets/plugins/bootstrap/css/bootstrap-grid.css +1912 -0
  46. data/assets/plugins/bootstrap/css/bootstrap-grid.css.map +0 -0
  47. data/assets/plugins/bootstrap/css/bootstrap-grid.min.css +7 -0
  48. data/assets/plugins/bootstrap/css/bootstrap-grid.min.css.map +0 -0
  49. data/assets/plugins/bootstrap/css/bootstrap-reboot.css +331 -0
  50. data/assets/plugins/bootstrap/css/bootstrap-reboot.css.map +0 -0
  51. data/assets/plugins/bootstrap/css/bootstrap-reboot.min.css +8 -0
  52. data/assets/plugins/bootstrap/css/bootstrap-reboot.min.css.map +0 -0
  53. data/assets/plugins/bootstrap/css/bootstrap.css +7946 -5683
  54. data/assets/plugins/bootstrap/css/bootstrap.css.map +0 -0
  55. data/assets/plugins/bootstrap/css/bootstrap.min.css +4 -3
  56. data/assets/plugins/bootstrap/css/bootstrap.min.css.map +0 -0
  57. data/assets/plugins/bootstrap/js/bootstrap.bundle.js +6461 -0
  58. data/assets/plugins/bootstrap/js/bootstrap.bundle.js.map +0 -0
  59. data/assets/plugins/bootstrap/js/bootstrap.bundle.min.js +7 -0
  60. data/assets/plugins/bootstrap/js/bootstrap.bundle.min.js.map +0 -0
  61. data/assets/plugins/bootstrap/js/bootstrap.js +3448 -1867
  62. data/assets/plugins/bootstrap/js/bootstrap.js.map +0 -0
  63. data/assets/plugins/bootstrap/js/bootstrap.min.js +6 -6
  64. data/assets/plugins/bootstrap/js/bootstrap.min.js.map +0 -0
  65. data/assets/plugins/jquery-3.3.1.min.js +2 -0
  66. data/assets/plugins/lightbox/Gruntfile.js +84 -83
  67. data/assets/plugins/lightbox/ISSUE_TEMPLATE.md +9 -0
  68. data/assets/plugins/lightbox/LICENSE +21 -0
  69. data/assets/plugins/lightbox/README.md +15 -10
  70. data/assets/plugins/lightbox/bower.json +29 -38
  71. data/assets/plugins/lightbox/dist/ekko-lightbox.css +2 -62
  72. data/assets/plugins/lightbox/dist/ekko-lightbox.js +668 -400
  73. data/assets/plugins/lightbox/dist/ekko-lightbox.js.map +1 -0
  74. data/assets/plugins/lightbox/dist/ekko-lightbox.min.js +2 -7
  75. data/assets/plugins/lightbox/dist/ekko-lightbox.min.js.map +1 -0
  76. data/assets/plugins/lightbox/ekko-lightbox.js +671 -0
  77. data/assets/plugins/lightbox/ekko-lightbox.less +139 -64
  78. data/assets/plugins/lightbox/examples/bs3.html +596 -0
  79. data/assets/plugins/lightbox/index.html +659 -0
  80. data/assets/plugins/lightbox/package.json +57 -46
  81. data/assets/plugins/lightbox/webpack.config.js +89 -0
  82. data/assets/plugins/lightbox/yarn.lock +6683 -0
  83. data/assets/plugins/prism/min/prism-min.js +0 -0
  84. data/assets/plugins/stickyfill/.editorconfig +9 -0
  85. data/assets/plugins/stickyfill/.gitignore +1 -0
  86. data/assets/plugins/stickyfill/Gruntfile.js +106 -0
  87. data/assets/plugins/stickyfill/LICENSE +21 -0
  88. data/assets/plugins/stickyfill/README.md +229 -0
  89. data/assets/plugins/stickyfill/dist/stickyfill.es6.js +507 -0
  90. data/assets/plugins/stickyfill/dist/stickyfill.js +520 -0
  91. data/assets/plugins/stickyfill/dist/stickyfill.min.js +7 -0
  92. data/assets/plugins/stickyfill/package-lock.json +2109 -0
  93. data/assets/plugins/stickyfill/package.json +32 -0
  94. data/assets/plugins/stickyfill/src/stickyfill.js +500 -0
  95. data/assets/plugins/stickyfill/test/index.html +941 -0
  96. data/assets/plugins/stickyfill/test/js/jquery-3.1.1.min.js +4 -0
  97. data/assets/plugins/stickyfill/types/index.d.ts +17 -0
  98. data/assets/plugins/stickyfill/yarn.lock +1475 -0
  99. data/assets/scss/.DS_Store +0 -0
  100. data/assets/{less/base.less → scss/_base.scss} +283 -307
  101. data/assets/{less/doc.less → scss/_doc.scss} +747 -747
  102. data/assets/{less/landing.less → scss/_landing.scss} +231 -244
  103. data/assets/scss/_mixins.scss +175 -0
  104. data/assets/scss/config.codekit3 +2243 -0
  105. data/assets/scss/styles.scss +45 -0
  106. metadata +76 -96
  107. data/_includes/blue-doc-wrapper.html +0 -293
  108. data/_includes/blue-header.html +0 -17
  109. data/_includes/card-charts.html +0 -10
  110. data/_includes/card-components.html +0 -10
  111. data/_includes/card-faqs.html +0 -10
  112. data/_includes/card-license.html +0 -10
  113. data/_includes/card-quick.html +0 -10
  114. data/_includes/card-showcase.html +0 -10
  115. data/_includes/cards-section.html +0 -47
  116. data/_includes/doc-wrapper.html +0 -170
  117. data/_includes/fb-root.html +0 -9
  118. data/_includes/green-doc-wrapper.html +0 -484
  119. data/_includes/green-header.html +0 -17
  120. data/_includes/header-home.html +0 -21
  121. data/_includes/header.html +0 -70
  122. data/_includes/icon-github.html +0 -1
  123. data/_includes/landing-header.html +0 -22
  124. data/_includes/orange-doc-wrapper.html +0 -65
  125. data/_includes/orange-header.html +0 -17
  126. data/_includes/pink-doc-wrapper.html +0 -281
  127. data/_includes/pink-header.html +0 -17
  128. data/_includes/purple-doc-wrapper.html +0 -138
  129. data/_includes/purple-header.html +0 -17
  130. data/_layouts/blue.html +0 -53
  131. data/_layouts/default.html +0 -53
  132. data/_layouts/green.html +0 -53
  133. data/_layouts/orange.html +0 -53
  134. data/_layouts/pink.html +0 -53
  135. data/_layouts/post.html +0 -5
  136. data/_layouts/purple.html +0 -53
  137. data/assets/images/demo/a-complete-example-of-page.png +0 -0
  138. data/assets/less/mixins.less +0 -185
  139. data/assets/less/styles.less +0 -13
  140. data/assets/less/theme-default.less +0 -115
  141. data/assets/plugins/bootstrap/css/bootstrap-theme.css +0 -587
  142. data/assets/plugins/bootstrap/css/bootstrap-theme.css.map +0 -0
  143. data/assets/plugins/bootstrap/css/bootstrap-theme.min.css +0 -6
  144. data/assets/plugins/bootstrap/css/bootstrap-theme.min.css.map +0 -0
  145. data/assets/plugins/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  146. data/assets/plugins/bootstrap/fonts/glyphicons-halflings-regular.svg +0 -288
  147. data/assets/plugins/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  148. data/assets/plugins/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  149. data/assets/plugins/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
  150. data/assets/plugins/bootstrap/js/npm.js +0 -13
  151. data/assets/plugins/font-awesome/HELP-US-OUT.txt +0 -7
  152. data/assets/plugins/font-awesome/css/font-awesome.css +0 -2199
  153. data/assets/plugins/font-awesome/css/font-awesome.min.css +0 -4
  154. data/assets/plugins/font-awesome/fonts/FontAwesome.otf +0 -0
  155. data/assets/plugins/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  156. data/assets/plugins/font-awesome/fonts/fontawesome-webfont.svg +0 -685
  157. data/assets/plugins/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  158. data/assets/plugins/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  159. data/assets/plugins/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  160. data/assets/plugins/font-awesome/less/animated.less +0 -34
  161. data/assets/plugins/font-awesome/less/bordered-pulled.less +0 -25
  162. data/assets/plugins/font-awesome/less/core.less +0 -12
  163. data/assets/plugins/font-awesome/less/fixed-width.less +0 -6
  164. data/assets/plugins/font-awesome/less/font-awesome.less +0 -18
  165. data/assets/plugins/font-awesome/less/icons.less +0 -733
  166. data/assets/plugins/font-awesome/less/larger.less +0 -13
  167. data/assets/plugins/font-awesome/less/list.less +0 -19
  168. data/assets/plugins/font-awesome/less/mixins.less +0 -60
  169. data/assets/plugins/font-awesome/less/path.less +0 -15
  170. data/assets/plugins/font-awesome/less/rotated-flipped.less +0 -20
  171. data/assets/plugins/font-awesome/less/screen-reader.less +0 -5
  172. data/assets/plugins/font-awesome/less/stacked.less +0 -20
  173. data/assets/plugins/font-awesome/less/variables.less +0 -744
  174. data/assets/plugins/font-awesome/scss/_animated.scss +0 -34
  175. data/assets/plugins/font-awesome/scss/_bordered-pulled.scss +0 -25
  176. data/assets/plugins/font-awesome/scss/_core.scss +0 -12
  177. data/assets/plugins/font-awesome/scss/_fixed-width.scss +0 -6
  178. data/assets/plugins/font-awesome/scss/_icons.scss +0 -733
  179. data/assets/plugins/font-awesome/scss/_larger.scss +0 -13
  180. data/assets/plugins/font-awesome/scss/_list.scss +0 -19
  181. data/assets/plugins/font-awesome/scss/_mixins.scss +0 -60
  182. data/assets/plugins/font-awesome/scss/_path.scss +0 -15
  183. data/assets/plugins/font-awesome/scss/_rotated-flipped.scss +0 -20
  184. data/assets/plugins/font-awesome/scss/_screen-reader.scss +0 -5
  185. data/assets/plugins/font-awesome/scss/_stacked.scss +0 -20
  186. data/assets/plugins/font-awesome/scss/_variables.scss +0 -744
  187. data/assets/plugins/font-awesome/scss/font-awesome.scss +0 -18
  188. data/assets/plugins/jquery-1.12.3.min.js +0 -5
  189. data/assets/plugins/lightbox/LICENSE.txt +0 -339
  190. data/assets/plugins/lightbox/dist/ekko-lightbox.min.css +0 -6
  191. data/assets/plugins/lightbox/ekko-lightbox.coffee +0 -353
  192. data/assets/plugins/lightbox/examples/index.html +0 -559
  193. data/assets/plugins/lightbox/examples/remote/page1.html +0 -9
  194. data/assets/plugins/lightbox/examples/remote/page2.html +0 -9
  195. data/assets/plugins/lightbox/examples/remote/readme.md +0 -1
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "stickyfilljs",
3
+ "version": "2.0.5",
4
+ "description": "Polyfill for CSS `position: sticky`",
5
+ "keywords": [
6
+ "sticky",
7
+ "polyfill"
8
+ ],
9
+ "license": "MIT",
10
+ "homepage": "https://github.com/wilddeer/stickyfill",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/wilddeer/stickyfill.git"
14
+ },
15
+ "author": {
16
+ "name": "Oleg Korsunsky",
17
+ "url": "https://github.com/wilddeer"
18
+ },
19
+ "main": "dist/stickyfill.js",
20
+ "types": "types/index.d.ts",
21
+ "devDependencies": {
22
+ "babel-preset-es2015": "^6.22.0",
23
+ "grunt": "^1.0.1",
24
+ "grunt-babel": "^6.0.0",
25
+ "grunt-bump": "^0.8.0",
26
+ "grunt-contrib-uglify": "^2.0.0",
27
+ "grunt-contrib-watch": "^1.0.0",
28
+ "grunt-shell": "^2.1.0",
29
+ "grunt-wrap": "^0.3.1"
30
+ },
31
+ "dependencies": {}
32
+ }
@@ -0,0 +1,500 @@
1
+ 'use strict';
2
+
3
+ /*
4
+ * 1. Check if the browser supports `position: sticky` natively or is too old to run the polyfill.
5
+ * If either of these is the case set `seppuku` flag. It will be checked later to disable key features
6
+ * of the polyfill, but the API will remain functional to avoid breaking things.
7
+ */
8
+ let seppuku = false;
9
+
10
+ // The polyfill cant’t function properly without `getComputedStyle`.
11
+ if (!window.getComputedStyle) seppuku = true;
12
+ // Dont’t get in a way if the browser supports `position: sticky` natively.
13
+ else {
14
+ const testNode = document.createElement('div');
15
+
16
+ if (
17
+ ['', '-webkit-', '-moz-', '-ms-'].some(prefix => {
18
+ try {
19
+ testNode.style.position = prefix + 'sticky';
20
+ }
21
+ catch(e) {}
22
+
23
+ return testNode.style.position != '';
24
+ })
25
+ ) seppuku = true;
26
+ }
27
+
28
+
29
+ /*
30
+ * 2. “Global” vars used across the polyfill
31
+ */
32
+
33
+ // Check if Shadow Root constructor exists to make further checks simpler
34
+ const shadowRootExists = typeof ShadowRoot !== 'undefined';
35
+
36
+ // Last saved scroll position
37
+ const scroll = {
38
+ top: null,
39
+ left: null
40
+ };
41
+
42
+ // Array of created Sticky instances
43
+ const stickies = [];
44
+
45
+
46
+ /*
47
+ * 3. Utility functions
48
+ */
49
+ function extend (targetObj, sourceObject) {
50
+ for (var key in sourceObject) {
51
+ if (sourceObject.hasOwnProperty(key)) {
52
+ targetObj[key] = sourceObject[key];
53
+ }
54
+ }
55
+ }
56
+
57
+ function parseNumeric (val) {
58
+ return parseFloat(val) || 0;
59
+ }
60
+
61
+ function getDocOffsetTop (node) {
62
+ let docOffsetTop = 0;
63
+
64
+ while (node) {
65
+ docOffsetTop += node.offsetTop;
66
+ node = node.offsetParent;
67
+ }
68
+
69
+ return docOffsetTop;
70
+ }
71
+
72
+
73
+ /*
74
+ * 4. Sticky class
75
+ */
76
+ class Sticky {
77
+ constructor (node) {
78
+ if (!(node instanceof HTMLElement))
79
+ throw new Error('First argument must be HTMLElement');
80
+ if (stickies.some(sticky => sticky._node === node))
81
+ throw new Error('Stickyfill is already applied to this node');
82
+
83
+ this._node = node;
84
+ this._stickyMode = null;
85
+ this._active = false;
86
+
87
+ stickies.push(this);
88
+
89
+ this.refresh();
90
+ }
91
+
92
+ refresh () {
93
+ if (seppuku || this._removed) return;
94
+ if (this._active) this._deactivate();
95
+
96
+ const node = this._node;
97
+
98
+ /*
99
+ * 1. Save node computed props
100
+ */
101
+ const nodeComputedStyle = getComputedStyle(node);
102
+ const nodeComputedProps = {
103
+ top: nodeComputedStyle.top,
104
+ display: nodeComputedStyle.display,
105
+ marginTop: nodeComputedStyle.marginTop,
106
+ marginBottom: nodeComputedStyle.marginBottom,
107
+ marginLeft: nodeComputedStyle.marginLeft,
108
+ marginRight: nodeComputedStyle.marginRight,
109
+ cssFloat: nodeComputedStyle.cssFloat
110
+ };
111
+
112
+ /*
113
+ * 2. Check if the node can be activated
114
+ */
115
+ if (
116
+ isNaN(parseFloat(nodeComputedProps.top)) ||
117
+ nodeComputedProps.display == 'table-cell' ||
118
+ nodeComputedProps.display == 'none'
119
+ ) return;
120
+
121
+ this._active = true;
122
+
123
+ /*
124
+ * 3. Get necessary node parameters
125
+ */
126
+ const referenceNode = node.parentNode;
127
+ const parentNode = shadowRootExists && referenceNode instanceof ShadowRoot? referenceNode.host: referenceNode;
128
+ const nodeWinOffset = node.getBoundingClientRect();
129
+ const parentWinOffset = parentNode.getBoundingClientRect();
130
+ const parentComputedStyle = getComputedStyle(parentNode);
131
+
132
+ this._parent = {
133
+ node: parentNode,
134
+ styles: {
135
+ position: parentNode.style.position
136
+ },
137
+ offsetHeight: parentNode.offsetHeight
138
+ };
139
+ this._offsetToWindow = {
140
+ left: nodeWinOffset.left,
141
+ right: document.documentElement.clientWidth - nodeWinOffset.right
142
+ };
143
+ this._offsetToParent = {
144
+ top: nodeWinOffset.top - parentWinOffset.top - parseNumeric(parentComputedStyle.borderTopWidth),
145
+ left: nodeWinOffset.left - parentWinOffset.left - parseNumeric(parentComputedStyle.borderLeftWidth),
146
+ right: -nodeWinOffset.right + parentWinOffset.right - parseNumeric(parentComputedStyle.borderRightWidth)
147
+ };
148
+ this._styles = {
149
+ position: node.style.position,
150
+ top: node.style.top,
151
+ bottom: node.style.bottom,
152
+ left: node.style.left,
153
+ right: node.style.right,
154
+ width: node.style.width,
155
+ marginTop: node.style.marginTop,
156
+ marginLeft: node.style.marginLeft,
157
+ marginRight: node.style.marginRight
158
+ };
159
+
160
+ const nodeTopValue = parseNumeric(nodeComputedProps.top);
161
+ this._limits = {
162
+ start: nodeWinOffset.top + window.pageYOffset - nodeTopValue,
163
+ end: parentWinOffset.top + window.pageYOffset + parentNode.offsetHeight -
164
+ parseNumeric(parentComputedStyle.borderBottomWidth) - node.offsetHeight -
165
+ nodeTopValue - parseNumeric(nodeComputedProps.marginBottom)
166
+ };
167
+
168
+ /*
169
+ * 4. Ensure that the node will be positioned relatively to the parent node
170
+ */
171
+ const parentPosition = parentComputedStyle.position;
172
+
173
+ if (
174
+ parentPosition != 'absolute' &&
175
+ parentPosition != 'relative'
176
+ ) {
177
+ parentNode.style.position = 'relative';
178
+ }
179
+
180
+ /*
181
+ * 5. Recalc node position.
182
+ * It’s important to do this before clone injection to avoid scrolling bug in Chrome.
183
+ */
184
+ this._recalcPosition();
185
+
186
+ /*
187
+ * 6. Create a clone
188
+ */
189
+ const clone = this._clone = {};
190
+ clone.node = document.createElement('div');
191
+
192
+ // Apply styles to the clone
193
+ extend(clone.node.style, {
194
+ width: nodeWinOffset.right - nodeWinOffset.left + 'px',
195
+ height: nodeWinOffset.bottom - nodeWinOffset.top + 'px',
196
+ marginTop: nodeComputedProps.marginTop,
197
+ marginBottom: nodeComputedProps.marginBottom,
198
+ marginLeft: nodeComputedProps.marginLeft,
199
+ marginRight: nodeComputedProps.marginRight,
200
+ cssFloat: nodeComputedProps.cssFloat,
201
+ padding: 0,
202
+ border: 0,
203
+ borderSpacing: 0,
204
+ fontSize: '1em',
205
+ position: 'static'
206
+ });
207
+
208
+ referenceNode.insertBefore(clone.node, node);
209
+ clone.docOffsetTop = getDocOffsetTop(clone.node);
210
+ }
211
+
212
+ _recalcPosition () {
213
+ if (!this._active || this._removed) return;
214
+
215
+ const stickyMode = scroll.top <= this._limits.start? 'start': scroll.top >= this._limits.end? 'end': 'middle';
216
+
217
+ if (this._stickyMode == stickyMode) return;
218
+
219
+ switch (stickyMode) {
220
+ case 'start':
221
+ extend(this._node.style, {
222
+ position: 'absolute',
223
+ left: this._offsetToParent.left + 'px',
224
+ right: this._offsetToParent.right + 'px',
225
+ top: this._offsetToParent.top + 'px',
226
+ bottom: 'auto',
227
+ width: 'auto',
228
+ marginLeft: 0,
229
+ marginRight: 0,
230
+ marginTop: 0
231
+ });
232
+ break;
233
+
234
+ case 'middle':
235
+ extend(this._node.style, {
236
+ position: 'fixed',
237
+ left: this._offsetToWindow.left + 'px',
238
+ right: this._offsetToWindow.right + 'px',
239
+ top: this._styles.top,
240
+ bottom: 'auto',
241
+ width: 'auto',
242
+ marginLeft: 0,
243
+ marginRight: 0,
244
+ marginTop: 0
245
+ });
246
+ break;
247
+
248
+ case 'end':
249
+ extend(this._node.style, {
250
+ position: 'absolute',
251
+ left: this._offsetToParent.left + 'px',
252
+ right: this._offsetToParent.right + 'px',
253
+ top: 'auto',
254
+ bottom: 0,
255
+ width: 'auto',
256
+ marginLeft: 0,
257
+ marginRight: 0
258
+ });
259
+ break;
260
+ }
261
+
262
+ this._stickyMode = stickyMode;
263
+ }
264
+
265
+ _fastCheck () {
266
+ if (!this._active || this._removed) return;
267
+
268
+ if (
269
+ Math.abs(getDocOffsetTop(this._clone.node) - this._clone.docOffsetTop) > 1 ||
270
+ Math.abs(this._parent.node.offsetHeight - this._parent.offsetHeight) > 1
271
+ ) this.refresh();
272
+ }
273
+
274
+ _deactivate () {
275
+ if (!this._active || this._removed) return;
276
+
277
+ this._clone.node.parentNode.removeChild(this._clone.node);
278
+ delete this._clone;
279
+
280
+ extend(this._node.style, this._styles);
281
+ delete this._styles;
282
+
283
+ // Check whether element’s parent node is used by other stickies.
284
+ // If not, restore parent node’s styles.
285
+ if (!stickies.some(sticky => sticky !== this && sticky._parent && sticky._parent.node === this._parent.node)) {
286
+ extend(this._parent.node.style, this._parent.styles);
287
+ }
288
+ delete this._parent;
289
+
290
+ this._stickyMode = null;
291
+ this._active = false;
292
+
293
+ delete this._offsetToWindow;
294
+ delete this._offsetToParent;
295
+ delete this._limits;
296
+ }
297
+
298
+ remove () {
299
+ this._deactivate();
300
+
301
+ stickies.some((sticky, index) => {
302
+ if (sticky._node === this._node) {
303
+ stickies.splice(index, 1);
304
+ return true;
305
+ }
306
+ });
307
+
308
+ this._removed = true;
309
+ }
310
+ }
311
+
312
+
313
+ /*
314
+ * 5. Stickyfill API
315
+ */
316
+ const Stickyfill = {
317
+ stickies,
318
+ Sticky,
319
+
320
+ addOne (node) {
321
+ // Check whether it’s a node
322
+ if (!(node instanceof HTMLElement)) {
323
+ // Maybe it’s a node list of some sort?
324
+ // Take first node from the list then
325
+ if (node.length && node[0]) node = node[0];
326
+ else return;
327
+ }
328
+
329
+ // Check if Stickyfill is already applied to the node
330
+ // and return existing sticky
331
+ for (var i = 0; i < stickies.length; i++) {
332
+ if (stickies[i]._node === node) return stickies[i];
333
+ }
334
+
335
+ // Create and return new sticky
336
+ return new Sticky(node);
337
+ },
338
+
339
+ add (nodeList) {
340
+ // If it’s a node make an array of one node
341
+ if (nodeList instanceof HTMLElement) nodeList = [nodeList];
342
+ // Check if the argument is an iterable of some sort
343
+ if (!nodeList.length) return;
344
+
345
+ // Add every element as a sticky and return an array of created Sticky instances
346
+ const addedStickies = [];
347
+
348
+ for (let i = 0; i < nodeList.length; i++) {
349
+ const node = nodeList[i];
350
+
351
+ // If it’s not an HTMLElement – create an empty element to preserve 1-to-1
352
+ // correlation with input list
353
+ if (!(node instanceof HTMLElement)) {
354
+ addedStickies.push(void 0);
355
+ continue;
356
+ }
357
+
358
+ // If Stickyfill is already applied to the node
359
+ // add existing sticky
360
+ if (stickies.some(sticky => {
361
+ if (sticky._node === node) {
362
+ addedStickies.push(sticky);
363
+ return true;
364
+ }
365
+ })) continue;
366
+
367
+ // Create and add new sticky
368
+ addedStickies.push(new Sticky(node));
369
+ }
370
+
371
+ return addedStickies;
372
+ },
373
+
374
+ refreshAll () {
375
+ stickies.forEach(sticky => sticky.refresh());
376
+ },
377
+
378
+ removeOne (node) {
379
+ // Check whether it’s a node
380
+ if (!(node instanceof HTMLElement)) {
381
+ // Maybe it’s a node list of some sort?
382
+ // Take first node from the list then
383
+ if (node.length && node[0]) node = node[0];
384
+ else return;
385
+ }
386
+
387
+ // Remove the stickies bound to the nodes in the list
388
+ stickies.some(sticky => {
389
+ if (sticky._node === node) {
390
+ sticky.remove();
391
+ return true;
392
+ }
393
+ });
394
+ },
395
+
396
+ remove (nodeList) {
397
+ // If it’s a node make an array of one node
398
+ if (nodeList instanceof HTMLElement) nodeList = [nodeList];
399
+ // Check if the argument is an iterable of some sort
400
+ if (!nodeList.length) return;
401
+
402
+ // Remove the stickies bound to the nodes in the list
403
+ for (let i = 0; i < nodeList.length; i++) {
404
+ const node = nodeList[i];
405
+
406
+ stickies.some(sticky => {
407
+ if (sticky._node === node) {
408
+ sticky.remove();
409
+ return true;
410
+ }
411
+ });
412
+ }
413
+ },
414
+
415
+ removeAll () {
416
+ while (stickies.length) stickies[0].remove();
417
+ }
418
+ };
419
+
420
+
421
+ /*
422
+ * 6. Setup events (unless the polyfill was disabled)
423
+ */
424
+ function init () {
425
+ // Watch for scroll position changes and trigger recalc/refresh if needed
426
+ function checkScroll () {
427
+ if (window.pageXOffset != scroll.left) {
428
+ scroll.top = window.pageYOffset;
429
+ scroll.left = window.pageXOffset;
430
+
431
+ Stickyfill.refreshAll();
432
+ }
433
+ else if (window.pageYOffset != scroll.top) {
434
+ scroll.top = window.pageYOffset;
435
+ scroll.left = window.pageXOffset;
436
+
437
+ // recalc position for all stickies
438
+ stickies.forEach(sticky => sticky._recalcPosition());
439
+ }
440
+ }
441
+
442
+ checkScroll();
443
+ window.addEventListener('scroll', checkScroll);
444
+
445
+ // Watch for window resizes and device orientation changes and trigger refresh
446
+ window.addEventListener('resize', Stickyfill.refreshAll);
447
+ window.addEventListener('orientationchange', Stickyfill.refreshAll);
448
+
449
+ //Fast dirty check for layout changes every 500ms
450
+ let fastCheckTimer;
451
+
452
+ function startFastCheckTimer () {
453
+ fastCheckTimer = setInterval(function () {
454
+ stickies.forEach(sticky => sticky._fastCheck());
455
+ }, 500);
456
+ }
457
+
458
+ function stopFastCheckTimer () {
459
+ clearInterval(fastCheckTimer);
460
+ }
461
+
462
+ let docHiddenKey;
463
+ let visibilityChangeEventName;
464
+
465
+ if ('hidden' in document) {
466
+ docHiddenKey = 'hidden';
467
+ visibilityChangeEventName = 'visibilitychange';
468
+ }
469
+ else if ('webkitHidden' in document) {
470
+ docHiddenKey = 'webkitHidden';
471
+ visibilityChangeEventName = 'webkitvisibilitychange';
472
+ }
473
+
474
+ if (visibilityChangeEventName) {
475
+ if (!document[docHiddenKey]) startFastCheckTimer();
476
+
477
+ document.addEventListener(visibilityChangeEventName, () => {
478
+ if (document[docHiddenKey]) {
479
+ stopFastCheckTimer();
480
+ }
481
+ else {
482
+ startFastCheckTimer();
483
+ }
484
+ });
485
+ }
486
+ else startFastCheckTimer();
487
+ }
488
+
489
+ if (!seppuku) init();
490
+
491
+
492
+ /*
493
+ * 7. Expose Stickyfill
494
+ */
495
+ if (typeof module != 'undefined' && module.exports) {
496
+ module.exports = Stickyfill;
497
+ }
498
+ else {
499
+ window.Stickyfill = Stickyfill;
500
+ }