less-rails-semantic_ui 1.11.8.0 → 1.12.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +3 -0
- data/assets/javascripts/semantic_ui/definitions/behaviors/visibility.js +95 -36
- data/assets/javascripts/semantic_ui/definitions/modules/popup.js +1 -1
- data/assets/javascripts/semantic_ui/definitions/modules/sticky.js +46 -25
- data/assets/stylesheets/semantic_ui/definitions/elements/input.less +1 -1
- data/lib/less/rails/semantic_ui/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7de92ea0be933285c37c6a19b99e5afc205879a3
|
4
|
+
data.tar.gz: c38387e17d87deca0c2efef75fdbb4c704f3e145
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c8c7fb818c79cb149128e8a5146e33398fc19e3ce889d5b4f56ab04f74ce2007b63df1e19c928c920c6e44bbc9118f6715825eb071501c5779e8f387ac6bbcf
|
7
|
+
data.tar.gz: 044c5f5f74fbc415869c4bfb80b813da09faa6416cf9b4c90a3463a4de36c44b6aa34bf50af1cebe2d726c84dddc65462114a750811c992246a45f829e8ac20d
|
data/Appraisals
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
appraise 'rails40' do
|
2
2
|
gem 'rails', '~> 4.0.12'
|
3
|
+
gem 'sprockets', '~> 2'
|
3
4
|
end
|
4
5
|
|
5
6
|
appraise 'rails41' do
|
6
7
|
gem 'rails', '~> 4.1.8'
|
8
|
+
gem 'sprockets', '~> 2'
|
7
9
|
end
|
8
10
|
|
9
11
|
appraise 'rails42' do
|
10
12
|
gem 'rails', '~> 4.2.0'
|
13
|
+
gem 'sprockets', '~> 2'
|
11
14
|
end
|
@@ -42,11 +42,11 @@ $.fn.visibility = function(parameters) {
|
|
42
42
|
moduleNamespace = 'module-' + namespace,
|
43
43
|
|
44
44
|
$window = $(window),
|
45
|
+
|
45
46
|
$module = $(this),
|
46
47
|
$context = $(settings.context),
|
47
|
-
$images = $module.find('img'),
|
48
|
-
|
49
48
|
selector = $module.selector || '',
|
49
|
+
|
50
50
|
instance = $module.data(moduleNamespace),
|
51
51
|
|
52
52
|
requestAnimationFrame = window.requestAnimationFrame
|
@@ -76,13 +76,16 @@ $.fn.visibility = function(parameters) {
|
|
76
76
|
if(settings.type == 'fixed') {
|
77
77
|
module.setup.fixed();
|
78
78
|
}
|
79
|
+
if(settings.observeChanges) {
|
80
|
+
module.observeChanges();
|
81
|
+
}
|
82
|
+
if( !module.is.visible() ) {
|
83
|
+
module.error(error.visible, $module);
|
84
|
+
}
|
79
85
|
}
|
80
86
|
if(settings.initialCheck) {
|
81
87
|
module.checkVisibility();
|
82
88
|
}
|
83
|
-
if(settings.observeChanges) {
|
84
|
-
module.observeChanges();
|
85
|
-
}
|
86
89
|
module.instantiate();
|
87
90
|
},
|
88
91
|
|
@@ -96,12 +99,18 @@ $.fn.visibility = function(parameters) {
|
|
96
99
|
|
97
100
|
destroy: function() {
|
98
101
|
module.verbose('Destroying previous module');
|
102
|
+
if(observer) {
|
103
|
+
observer.disconnect();
|
104
|
+
}
|
105
|
+
$window
|
106
|
+
.off('load' + eventNamespace, module.event.load)
|
107
|
+
.off('resize' + eventNamespace, module.event.resize)
|
108
|
+
;
|
109
|
+
$context.off('scrollchange' + eventNamespace, module.event.scrollchange);
|
99
110
|
$module
|
100
111
|
.off(eventNamespace)
|
101
112
|
.removeData(moduleNamespace)
|
102
113
|
;
|
103
|
-
$window.off('resize' + eventNamespace, module.event.refresh);
|
104
|
-
$context.off('scroll' + eventNamespace, module.event.scroll);
|
105
114
|
},
|
106
115
|
|
107
116
|
observeChanges: function() {
|
@@ -111,7 +120,10 @@ $.fn.visibility = function(parameters) {
|
|
111
120
|
if('MutationObserver' in window) {
|
112
121
|
observer = new MutationObserver(function(mutations) {
|
113
122
|
module.verbose('DOM tree modified, updating visibility calculations');
|
114
|
-
module.
|
123
|
+
module.timer = setTimeout(function() {
|
124
|
+
module.verbose('DOM tree modified, updating sticky menu');
|
125
|
+
module.refresh();
|
126
|
+
}, 100);
|
115
127
|
});
|
116
128
|
observer.observe(element, {
|
117
129
|
childList : true,
|
@@ -125,17 +137,19 @@ $.fn.visibility = function(parameters) {
|
|
125
137
|
events: function() {
|
126
138
|
module.verbose('Binding visibility events to scroll and resize');
|
127
139
|
$window
|
128
|
-
.on('
|
140
|
+
.on('load' + eventNamespace, module.event.load)
|
141
|
+
.on('resize' + eventNamespace, module.event.resize)
|
129
142
|
;
|
143
|
+
// pub/sub pattern
|
130
144
|
$context
|
145
|
+
.off('scroll' + eventNamespace)
|
131
146
|
.on('scroll' + eventNamespace, module.event.scroll)
|
147
|
+
.on('scrollchange' + eventNamespace, module.event.scrollchange)
|
132
148
|
;
|
133
|
-
if($images.length > 0) {
|
134
|
-
module.bind.imageLoad();
|
135
|
-
}
|
136
149
|
},
|
137
150
|
imageLoad: function() {
|
138
151
|
var
|
152
|
+
$images = $module.find('img'),
|
139
153
|
imageCount = $images.length,
|
140
154
|
index = imageCount,
|
141
155
|
loadedCount = 0,
|
@@ -150,44 +164,82 @@ $.fn.visibility = function(parameters) {
|
|
150
164
|
}
|
151
165
|
}
|
152
166
|
;
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
167
|
+
if(imageCount > 0) {
|
168
|
+
$images
|
169
|
+
.each(function() {
|
170
|
+
images.push( $(this).attr('src') );
|
171
|
+
})
|
172
|
+
;
|
173
|
+
while(index--) {
|
174
|
+
cacheImage = document.createElement('img');
|
175
|
+
cacheImage.onload = handleLoad;
|
176
|
+
cacheImage.onerror = handleLoad;
|
177
|
+
cacheImage.src = images[index];
|
178
|
+
cache.push(cacheImage);
|
179
|
+
}
|
164
180
|
}
|
165
181
|
}
|
166
182
|
},
|
167
183
|
|
168
184
|
event: {
|
169
|
-
|
185
|
+
resize: function() {
|
186
|
+
module.debug('Window resized');
|
170
187
|
requestAnimationFrame(module.refresh);
|
171
188
|
},
|
189
|
+
load: function() {
|
190
|
+
module.debug('Page finished loading');
|
191
|
+
requestAnimationFrame(module.refresh);
|
192
|
+
},
|
193
|
+
// publishes scrollchange event on one scroll
|
172
194
|
scroll: function() {
|
173
|
-
module.verbose('Scroll position changed');
|
174
195
|
if(settings.throttle) {
|
175
196
|
clearTimeout(module.timer);
|
176
197
|
module.timer = setTimeout(function() {
|
177
|
-
|
198
|
+
$context.trigger('scrollchange' + eventNamespace, [ $context.scrollTop() ]);
|
178
199
|
}, settings.throttle);
|
179
200
|
}
|
180
201
|
else {
|
181
202
|
requestAnimationFrame(function() {
|
182
|
-
|
203
|
+
$context.trigger('scrollchange' + eventNamespace, [ $context.scrollTop() ]);
|
183
204
|
});
|
184
205
|
}
|
206
|
+
},
|
207
|
+
// subscribes to scrollchange
|
208
|
+
scrollchange: function(event, scrollPosition) {
|
209
|
+
module.checkVisibility(scrollPosition);
|
210
|
+
},
|
211
|
+
},
|
212
|
+
|
213
|
+
precache: function(images, callback) {
|
214
|
+
if (!(images instanceof Array)) {
|
215
|
+
images = [images];
|
216
|
+
}
|
217
|
+
var
|
218
|
+
imagesLength = images.length,
|
219
|
+
loadedCounter = 0,
|
220
|
+
cache = [],
|
221
|
+
cacheImage = document.createElement('img'),
|
222
|
+
handleLoad = function() {
|
223
|
+
loadedCounter++;
|
224
|
+
if (loadedCounter >= images.length) {
|
225
|
+
if ($.isFunction(callback)) {
|
226
|
+
callback();
|
227
|
+
}
|
228
|
+
}
|
229
|
+
}
|
230
|
+
;
|
231
|
+
while (imagesLength--) {
|
232
|
+
cacheImage = document.createElement('img');
|
233
|
+
cacheImage.onload = handleLoad;
|
234
|
+
cacheImage.onerror = handleLoad;
|
235
|
+
cacheImage.src = images[imagesLength];
|
236
|
+
cache.push(cacheImage);
|
185
237
|
}
|
186
238
|
},
|
187
239
|
|
188
240
|
should: {
|
189
241
|
trackChanges: function() {
|
190
|
-
if(methodInvoked
|
242
|
+
if(methodInvoked) {
|
191
243
|
module.debug('One time query, no need to bind events');
|
192
244
|
return false;
|
193
245
|
}
|
@@ -287,7 +339,7 @@ $.fn.visibility = function(parameters) {
|
|
287
339
|
},
|
288
340
|
|
289
341
|
refresh: function() {
|
290
|
-
module.debug('Refreshing constants (
|
342
|
+
module.debug('Refreshing constants (width/height)');
|
291
343
|
module.reset();
|
292
344
|
module.save.position();
|
293
345
|
module.checkVisibility();
|
@@ -302,11 +354,14 @@ $.fn.visibility = function(parameters) {
|
|
302
354
|
}
|
303
355
|
},
|
304
356
|
|
305
|
-
checkVisibility: function() {
|
357
|
+
checkVisibility: function(scroll) {
|
306
358
|
module.verbose('Checking visibility of element', module.cache.element);
|
307
359
|
|
308
360
|
if( module.is.visible() ) {
|
309
361
|
|
362
|
+
// save scroll position
|
363
|
+
module.save.scroll(scroll);
|
364
|
+
|
310
365
|
// update calculations derived from scroll
|
311
366
|
module.save.calculations();
|
312
367
|
|
@@ -616,7 +671,6 @@ $.fn.visibility = function(parameters) {
|
|
616
671
|
save: {
|
617
672
|
calculations: function() {
|
618
673
|
module.verbose('Saving all calculations necessary to determine positioning');
|
619
|
-
module.save.scroll();
|
620
674
|
module.save.direction();
|
621
675
|
module.save.screenCalculations();
|
622
676
|
module.save.elementCalculations();
|
@@ -629,8 +683,9 @@ $.fn.visibility = function(parameters) {
|
|
629
683
|
}
|
630
684
|
}
|
631
685
|
},
|
632
|
-
scroll: function() {
|
633
|
-
|
686
|
+
scroll: function(scrollPosition) {
|
687
|
+
scrollPosition = scrollPosition + settings.offset || $context.scrollTop() + settings.offset;
|
688
|
+
module.cache.scroll = scrollPosition;
|
634
689
|
},
|
635
690
|
direction: function() {
|
636
691
|
var
|
@@ -855,7 +910,7 @@ $.fn.visibility = function(parameters) {
|
|
855
910
|
});
|
856
911
|
}
|
857
912
|
clearTimeout(module.performance.timer);
|
858
|
-
module.performance.timer = setTimeout(module.performance.display,
|
913
|
+
module.performance.timer = setTimeout(module.performance.display, 500);
|
859
914
|
},
|
860
915
|
display: function() {
|
861
916
|
var
|
@@ -975,6 +1030,9 @@ $.fn.visibility.settings = {
|
|
975
1030
|
// whether to use mutation observers to follow changes
|
976
1031
|
observeChanges : true,
|
977
1032
|
|
1033
|
+
// whether to refresh calculations after all page images load
|
1034
|
+
refreshOnLoad : true,
|
1035
|
+
|
978
1036
|
// callback should only occur one time
|
979
1037
|
once : true,
|
980
1038
|
|
@@ -1029,9 +1087,10 @@ $.fn.visibility.settings = {
|
|
1029
1087
|
},
|
1030
1088
|
|
1031
1089
|
error : {
|
1032
|
-
method
|
1090
|
+
method : 'The method you called is not defined.',
|
1091
|
+
visible : 'Element is hidden, you must call refresh after element becomes visible'
|
1033
1092
|
}
|
1034
1093
|
|
1035
1094
|
};
|
1036
1095
|
|
1037
|
-
})( jQuery, window , document );
|
1096
|
+
})( jQuery, window , document );
|
@@ -760,7 +760,7 @@ $.fn.popup = function(parameters) {
|
|
760
760
|
}
|
761
761
|
else if(!settings.lastResort) {
|
762
762
|
module.debug('Popup could not find a position in view', $popup);
|
763
|
-
module.error(error.cannotPlace, element);
|
763
|
+
// module.error(error.cannotPlace, element);
|
764
764
|
module.remove.attempts();
|
765
765
|
module.remove.loading();
|
766
766
|
module.reset();
|
@@ -87,13 +87,18 @@ $.fn.sticky = function(parameters) {
|
|
87
87
|
},
|
88
88
|
|
89
89
|
destroy: function() {
|
90
|
-
module.verbose('Destroying previous
|
90
|
+
module.verbose('Destroying previous instance');
|
91
91
|
module.reset();
|
92
92
|
if(observer) {
|
93
93
|
observer.disconnect();
|
94
94
|
}
|
95
|
-
$window
|
96
|
-
|
95
|
+
$window
|
96
|
+
.off('load' + eventNamespace, module.event.load)
|
97
|
+
.off('resize' + eventNamespace, module.event.resize)
|
98
|
+
;
|
99
|
+
$scroll
|
100
|
+
.off('scrollchange' + eventNamespace, module.event.scrollchange)
|
101
|
+
;
|
97
102
|
$module.removeData(moduleNamespace);
|
98
103
|
},
|
99
104
|
|
@@ -107,7 +112,7 @@ $.fn.sticky = function(parameters) {
|
|
107
112
|
module.timer = setTimeout(function() {
|
108
113
|
module.verbose('DOM tree modified, updating sticky menu');
|
109
114
|
module.refresh();
|
110
|
-
},
|
115
|
+
}, 100);
|
111
116
|
});
|
112
117
|
observer.observe(element, {
|
113
118
|
childList : true,
|
@@ -147,23 +152,36 @@ $.fn.sticky = function(parameters) {
|
|
147
152
|
|
148
153
|
bind: {
|
149
154
|
events: function() {
|
150
|
-
$window
|
151
|
-
|
155
|
+
$window
|
156
|
+
.on('load' + eventNamespace, module.event.load)
|
157
|
+
.on('resize' + eventNamespace, module.event.resize)
|
158
|
+
;
|
159
|
+
// pub/sub pattern
|
160
|
+
$scroll
|
161
|
+
.off('scroll' + eventNamespace)
|
162
|
+
.on('scroll' + eventNamespace, module.event.scroll)
|
163
|
+
.on('scrollchange' + eventNamespace, module.event.scrollchange)
|
164
|
+
;
|
152
165
|
}
|
153
166
|
},
|
154
167
|
|
155
168
|
event: {
|
169
|
+
load: function() {
|
170
|
+
module.verbose('Page contents finished loading');
|
171
|
+
requestAnimationFrame(module.refresh);
|
172
|
+
},
|
156
173
|
resize: function() {
|
157
|
-
|
158
|
-
|
159
|
-
module.stick();
|
160
|
-
});
|
174
|
+
module.verbose('Window resized');
|
175
|
+
requestAnimationFrame(module.refresh);
|
161
176
|
},
|
162
177
|
scroll: function() {
|
163
178
|
requestAnimationFrame(function() {
|
164
|
-
|
165
|
-
settings.onScroll.call(element);
|
179
|
+
$scroll.trigger('scrollchange' + eventNamespace, $scroll.scrollTop() );
|
166
180
|
});
|
181
|
+
},
|
182
|
+
scrollchange: function(event, scrollPosition) {
|
183
|
+
module.stick(scrollPosition);
|
184
|
+
settings.onScroll.call(element);
|
167
185
|
}
|
168
186
|
},
|
169
187
|
|
@@ -189,7 +207,7 @@ $.fn.sticky = function(parameters) {
|
|
189
207
|
},
|
190
208
|
|
191
209
|
save: {
|
192
|
-
|
210
|
+
lastScroll: function(scroll) {
|
193
211
|
module.lastScroll = scroll;
|
194
212
|
},
|
195
213
|
positions: function() {
|
@@ -268,6 +286,7 @@ $.fn.sticky = function(parameters) {
|
|
268
286
|
: Math.abs(parseInt($module.css('bottom'), 10)) || 0
|
269
287
|
;
|
270
288
|
},
|
289
|
+
|
271
290
|
elementScroll: function(scroll) {
|
272
291
|
scroll = scroll || $scroll.scrollTop();
|
273
292
|
var
|
@@ -275,14 +294,14 @@ $.fn.sticky = function(parameters) {
|
|
275
294
|
window = module.cache.window,
|
276
295
|
delta = module.get.scrollChange(scroll),
|
277
296
|
maxScroll = (element.height - window.height + settings.offset),
|
278
|
-
|
279
|
-
possibleScroll = (
|
297
|
+
elementScroll = module.get.currentElementScroll(),
|
298
|
+
possibleScroll = (elementScroll + delta),
|
280
299
|
elementScroll
|
281
300
|
;
|
282
301
|
if(module.cache.fits || possibleScroll < 0) {
|
283
302
|
elementScroll = 0;
|
284
303
|
}
|
285
|
-
else if
|
304
|
+
else if(possibleScroll > maxScroll ) {
|
286
305
|
elementScroll = maxScroll;
|
287
306
|
}
|
288
307
|
else {
|
@@ -313,8 +332,8 @@ $.fn.sticky = function(parameters) {
|
|
313
332
|
$container = $module.offsetParent();
|
314
333
|
}
|
315
334
|
else {
|
316
|
-
module.debug('Settings container size', module.cache.context.height);
|
317
335
|
if( Math.abs($container.height() - module.cache.context.height) > 5) {
|
336
|
+
module.debug('Context has padding, specifying exact height for container', module.cache.context.height);
|
318
337
|
$container.css({
|
319
338
|
height: module.cache.context.height
|
320
339
|
});
|
@@ -369,8 +388,9 @@ $.fn.sticky = function(parameters) {
|
|
369
388
|
}
|
370
389
|
},
|
371
390
|
|
372
|
-
stick: function() {
|
391
|
+
stick: function(scroll) {
|
373
392
|
var
|
393
|
+
cachedPosition = scroll || $scroll.scrollTop(),
|
374
394
|
cache = module.cache,
|
375
395
|
fits = cache.fits,
|
376
396
|
element = cache.element,
|
@@ -380,11 +400,13 @@ $.fn.sticky = function(parameters) {
|
|
380
400
|
? settings.bottomOffset
|
381
401
|
: settings.offset,
|
382
402
|
scroll = {
|
383
|
-
top :
|
384
|
-
bottom :
|
403
|
+
top : cachedPosition + offset,
|
404
|
+
bottom : cachedPosition + offset + window.height
|
385
405
|
},
|
386
406
|
direction = module.get.direction(scroll.top),
|
387
|
-
elementScroll =
|
407
|
+
elementScroll = (fits)
|
408
|
+
? 0
|
409
|
+
: module.get.elementScroll(scroll.top),
|
388
410
|
|
389
411
|
// shorthand
|
390
412
|
doesntFit = !fits,
|
@@ -392,7 +414,7 @@ $.fn.sticky = function(parameters) {
|
|
392
414
|
;
|
393
415
|
|
394
416
|
// save current scroll for next run
|
395
|
-
module.save.
|
417
|
+
module.save.lastScroll(scroll.top);
|
396
418
|
|
397
419
|
if(elementVisible) {
|
398
420
|
|
@@ -552,13 +574,12 @@ $.fn.sticky = function(parameters) {
|
|
552
574
|
module.unbind();
|
553
575
|
module.unfix();
|
554
576
|
module.resetCSS();
|
577
|
+
module.remove.offset();
|
555
578
|
},
|
556
579
|
|
557
580
|
resetCSS: function() {
|
558
581
|
$module
|
559
582
|
.css({
|
560
|
-
top : '',
|
561
|
-
bottom : '',
|
562
583
|
width : '',
|
563
584
|
height : ''
|
564
585
|
})
|
@@ -788,4 +809,4 @@ $.fn.sticky.settings = {
|
|
788
809
|
|
789
810
|
};
|
790
811
|
|
791
|
-
})( jQuery, window , document );
|
812
|
+
})( jQuery, window , document );
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: less-rails-semantic_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.12.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxim Dobryakov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: less-rails
|