yamlandar 1.0.12 → 1.0.13

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69823728b63cdf42b43cbdd1e6d59b188c579b98
4
- data.tar.gz: 698923e16130cbb19a42499cd99caddaf8176d3b
3
+ metadata.gz: 047799a1b54b87a98f976eb71a64989999421ad7
4
+ data.tar.gz: 4dba7bb5de1dbe61e4ecc2d23921199fe1b3f33f
5
5
  SHA512:
6
- metadata.gz: 75b938c85076f73e9b1c3153113ee5223abf4a36ad6864e9392b88d94e923af51ed985dfc8f6a7a649e7d3ef7d6486dcb9cbead00c7f0c2f6b228d087f0fb95d
7
- data.tar.gz: 87460ccc2fbafc57e43eab32c8027e845a5cc2a29c01a7f79beb3d8bfd8c3260b731866ba0c24f6ecbc9143f9fddad7061b7d11d3948cbe75a1792cff5b49671
6
+ metadata.gz: e4911fc30a2882cbc7bef9a92a1e62f24f05aab21847a0c28a89854380659f90703e286bc2d0f0ed9a64e34e7ecac7b11ae4f423282c275d6614f3954b0e3283
7
+ data.tar.gz: 476614491fa13c20c614bcca60ba45c5d9611f8ec25eb3145703d62f7e044d9ec93a68c9fb46efda22ab40b93225d8b95fd14fc3e2511eb89d2cb7c2139dfb9f
data/lib/views/index.erb CHANGED
@@ -97,7 +97,7 @@
97
97
  <%= @html %>
98
98
  </div>
99
99
  <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
100
- <script src='jquery.sticky.js'></script>
100
+ <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.sticky/1.0.3/jquery.sticky.min.js"></script>
101
101
  <script>
102
102
  $(".sticky").each(function(){
103
103
  $(this).sticky({topSpacing:0});
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yamlandar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Olds
@@ -33,7 +33,6 @@ extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
35
  - bin/yamlandar
36
- - lib/public/jquery.sticky.js
37
36
  - lib/views/index.erb
38
37
  - lib/yamlandar.rb
39
38
  homepage: http://rubygems.org/gems/yamlandar
@@ -1,278 +0,0 @@
1
- // Sticky Plugin v1.0.4 for jQuery
2
- // =============
3
- // Author: Anthony Garand
4
- // Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk)
5
- // Improvements by Leonardo C. Daronco (daronco)
6
- // Created: 02/14/2011
7
- // Date: 07/20/2015
8
- // Website: http://stickyjs.com/
9
- // Description: Makes an element on the page stick on the screen as you scroll
10
- // It will only set the 'top' and 'position' of your element, you
11
- // might need to adjust the width in some cases.
12
-
13
- (function (factory) {
14
- if (typeof define === 'function' && define.amd) {
15
- // AMD. Register as an anonymous module.
16
- define(['jquery'], factory);
17
- } else if (typeof module === 'object' && module.exports) {
18
- // Node/CommonJS
19
- module.exports = factory(require('jquery'));
20
- } else {
21
- // Browser globals
22
- factory(jQuery);
23
- }
24
- }(function ($) {
25
- var slice = Array.prototype.slice; // save ref to original slice()
26
- var splice = Array.prototype.splice; // save ref to original slice()
27
-
28
- var defaults = {
29
- topSpacing: 0,
30
- bottomSpacing: 0,
31
- className: 'is-sticky',
32
- wrapperClassName: 'sticky-wrapper',
33
- center: false,
34
- getWidthFrom: '',
35
- widthFromWrapper: true, // works only when .getWidthFrom is empty
36
- responsiveWidth: false,
37
- zIndex: 'auto'
38
- },
39
- $window = $(window),
40
- $document = $(document),
41
- sticked = [],
42
- windowHeight = $window.height(),
43
- scroller = function() {
44
- var scrollTop = $window.scrollTop(),
45
- documentHeight = $document.height(),
46
- dwh = documentHeight - windowHeight,
47
- extra = (scrollTop > dwh) ? dwh - scrollTop : 0;
48
-
49
- for (var i = 0, l = sticked.length; i < l; i++) {
50
- var s = sticked[i],
51
- elementTop = s.stickyWrapper.offset().top,
52
- etse = elementTop - s.topSpacing - extra;
53
-
54
- //update height in case of dynamic content
55
- s.stickyWrapper.css('height', s.stickyElement.outerHeight());
56
-
57
- if (scrollTop <= etse) {
58
- if (s.currentTop !== null) {
59
- s.stickyElement
60
- .css({
61
- 'width': '',
62
- 'position': '',
63
- 'top': '',
64
- 'z-index': ''
65
- });
66
- s.stickyElement.parent().removeClass(s.className);
67
- s.stickyElement.trigger('sticky-end', [s]);
68
- s.currentTop = null;
69
- }
70
- }
71
- else {
72
- var newTop = documentHeight - s.stickyElement.outerHeight()
73
- - s.topSpacing - s.bottomSpacing - scrollTop - extra;
74
- if (newTop < 0) {
75
- newTop = newTop + s.topSpacing;
76
- } else {
77
- newTop = s.topSpacing;
78
- }
79
- if (s.currentTop !== newTop) {
80
- var newWidth;
81
- if (s.getWidthFrom) {
82
- newWidth = $(s.getWidthFrom).width() || null;
83
- } else if (s.widthFromWrapper) {
84
- newWidth = s.stickyWrapper.width();
85
- }
86
- if (newWidth == null) {
87
- newWidth = s.stickyElement.width();
88
- }
89
- s.stickyElement
90
- .css('width', newWidth)
91
- .css('position', 'fixed')
92
- .css('top', newTop)
93
- .css('z-index', s.zIndex);
94
-
95
- s.stickyElement.parent().addClass(s.className);
96
-
97
- if (s.currentTop === null) {
98
- s.stickyElement.trigger('sticky-start', [s]);
99
- } else {
100
- // sticky is started but it have to be repositioned
101
- s.stickyElement.trigger('sticky-update', [s]);
102
- }
103
-
104
- if (s.currentTop === s.topSpacing && s.currentTop > newTop || s.currentTop === null && newTop < s.topSpacing) {
105
- // just reached bottom || just started to stick but bottom is already reached
106
- s.stickyElement.trigger('sticky-bottom-reached', [s]);
107
- } else if(s.currentTop !== null && newTop === s.topSpacing && s.currentTop < newTop) {
108
- // sticky is started && sticked at topSpacing && overflowing from top just finished
109
- s.stickyElement.trigger('sticky-bottom-unreached', [s]);
110
- }
111
-
112
- s.currentTop = newTop;
113
- }
114
-
115
- // Check if sticky has reached end of container and stop sticking
116
- var stickyWrapperContainer = s.stickyWrapper.parent();
117
- var unstick = (s.stickyElement.offset().top + s.stickyElement.outerHeight() >= stickyWrapperContainer.offset().top + stickyWrapperContainer.outerHeight()) && (s.stickyElement.offset().top <= s.topSpacing);
118
-
119
- if( unstick ) {
120
- s.stickyElement
121
- .css('position', 'absolute')
122
- .css('top', '')
123
- .css('bottom', 0)
124
- .css('z-index', '');
125
- } else {
126
- s.stickyElement
127
- .css('position', 'fixed')
128
- .css('top', newTop)
129
- .css('bottom', '')
130
- .css('z-index', s.zIndex);
131
- }
132
- }
133
- }
134
- },
135
- resizer = function() {
136
- windowHeight = $window.height();
137
-
138
- for (var i = 0, l = sticked.length; i < l; i++) {
139
- var s = sticked[i];
140
- var newWidth = null;
141
- if (s.getWidthFrom) {
142
- if (s.responsiveWidth) {
143
- newWidth = $(s.getWidthFrom).width();
144
- }
145
- } else if(s.widthFromWrapper) {
146
- newWidth = s.stickyWrapper.width();
147
- }
148
- if (newWidth != null) {
149
- s.stickyElement.css('width', newWidth);
150
- }
151
- }
152
- },
153
- methods = {
154
- init: function(options) {
155
- var o = $.extend({}, defaults, options);
156
- return this.each(function() {
157
- var stickyElement = $(this);
158
-
159
- var stickyId = stickyElement.attr('id');
160
- var wrapperId = stickyId ? stickyId + '-' + defaults.wrapperClassName : defaults.wrapperClassName;
161
- var wrapper = $('<div></div>')
162
- .attr('id', wrapperId)
163
- .addClass(o.wrapperClassName);
164
-
165
- stickyElement.wrapAll(function() {
166
- if ($(this).parent("#" + wrapperId).length == 0) {
167
- return wrapper;
168
- }
169
- });
170
-
171
- var stickyWrapper = stickyElement.parent();
172
-
173
- if (o.center) {
174
- stickyWrapper.css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"});
175
- }
176
-
177
- if (stickyElement.css("float") === "right") {
178
- stickyElement.css({"float":"none"}).parent().css({"float":"right"});
179
- }
180
-
181
- o.stickyElement = stickyElement;
182
- o.stickyWrapper = stickyWrapper;
183
- o.currentTop = null;
184
-
185
- sticked.push(o);
186
-
187
- methods.setWrapperHeight(this);
188
- methods.setupChangeListeners(this);
189
- });
190
- },
191
-
192
- setWrapperHeight: function(stickyElement) {
193
- var element = $(stickyElement);
194
- var stickyWrapper = element.parent();
195
- if (stickyWrapper) {
196
- stickyWrapper.css('height', element.outerHeight());
197
- }
198
- },
199
-
200
- setupChangeListeners: function(stickyElement) {
201
- if (window.MutationObserver) {
202
- var mutationObserver = new window.MutationObserver(function(mutations) {
203
- if (mutations[0].addedNodes.length || mutations[0].removedNodes.length) {
204
- methods.setWrapperHeight(stickyElement);
205
- }
206
- });
207
- mutationObserver.observe(stickyElement, {subtree: true, childList: true});
208
- } else {
209
- stickyElement.addEventListener('DOMNodeInserted', function() {
210
- methods.setWrapperHeight(stickyElement);
211
- }, false);
212
- stickyElement.addEventListener('DOMNodeRemoved', function() {
213
- methods.setWrapperHeight(stickyElement);
214
- }, false);
215
- }
216
- },
217
- update: scroller,
218
- unstick: function(options) {
219
- return this.each(function() {
220
- var that = this;
221
- var unstickyElement = $(that);
222
-
223
- var removeIdx = -1;
224
- var i = sticked.length;
225
- while (i-- > 0) {
226
- if (sticked[i].stickyElement.get(0) === that) {
227
- splice.call(sticked,i,1);
228
- removeIdx = i;
229
- }
230
- }
231
- if(removeIdx !== -1) {
232
- unstickyElement.unwrap();
233
- unstickyElement
234
- .css({
235
- 'width': '',
236
- 'position': '',
237
- 'top': '',
238
- 'float': '',
239
- 'z-index': ''
240
- })
241
- ;
242
- }
243
- });
244
- }
245
- };
246
-
247
- // should be more efficient than using $window.scroll(scroller) and $window.resize(resizer):
248
- if (window.addEventListener) {
249
- window.addEventListener('scroll', scroller, false);
250
- window.addEventListener('resize', resizer, false);
251
- } else if (window.attachEvent) {
252
- window.attachEvent('onscroll', scroller);
253
- window.attachEvent('onresize', resizer);
254
- }
255
-
256
- $.fn.sticky = function(method) {
257
- if (methods[method]) {
258
- return methods[method].apply(this, slice.call(arguments, 1));
259
- } else if (typeof method === 'object' || !method ) {
260
- return methods.init.apply( this, arguments );
261
- } else {
262
- $.error('Method ' + method + ' does not exist on jQuery.sticky');
263
- }
264
- };
265
-
266
- $.fn.unstick = function(method) {
267
- if (methods[method]) {
268
- return methods[method].apply(this, slice.call(arguments, 1));
269
- } else if (typeof method === 'object' || !method ) {
270
- return methods.unstick.apply( this, arguments );
271
- } else {
272
- $.error('Method ' + method + ' does not exist on jQuery.sticky');
273
- }
274
- };
275
- $(function() {
276
- setTimeout(scroller, 0);
277
- });
278
- }));