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