semantic-ui-sass 0.19.3.1 → 1.7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +5 -6
  4. data/app/assets/fonts/semantic-ui/icons.eot +0 -0
  5. data/app/assets/fonts/semantic-ui/icons.otf +0 -0
  6. data/app/assets/fonts/semantic-ui/icons.svg +472 -367
  7. data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
  8. data/app/assets/fonts/semantic-ui/icons.woff +0 -0
  9. data/app/assets/images/semantic-ui/flags.png +0 -0
  10. data/app/assets/javascripts/semantic-ui.js +9 -5
  11. data/app/assets/javascripts/semantic-ui/accordion.js +169 -102
  12. data/app/assets/javascripts/semantic-ui/api.js +840 -0
  13. data/app/assets/javascripts/semantic-ui/checkbox.js +203 -46
  14. data/app/assets/javascripts/semantic-ui/{behavior/colorize.js → colorize.js} +4 -2
  15. data/app/assets/javascripts/semantic-ui/dimmer.js +110 -76
  16. data/app/assets/javascripts/semantic-ui/dropdown.js +897 -285
  17. data/app/assets/javascripts/semantic-ui/{behavior/form.js → form.js} +127 -42
  18. data/app/assets/javascripts/semantic-ui/modal.js +294 -219
  19. data/app/assets/javascripts/semantic-ui/nag.js +120 -186
  20. data/app/assets/javascripts/semantic-ui/popup.js +491 -223
  21. data/app/assets/javascripts/semantic-ui/progress.js +779 -0
  22. data/app/assets/javascripts/semantic-ui/rating.js +66 -22
  23. data/app/assets/javascripts/semantic-ui/search.js +219 -99
  24. data/app/assets/javascripts/semantic-ui/shape.js +72 -29
  25. data/app/assets/javascripts/semantic-ui/sidebar.js +678 -142
  26. data/app/assets/javascripts/semantic-ui/site.js +487 -0
  27. data/app/assets/javascripts/semantic-ui/{behavior/state.js → state.js} +116 -151
  28. data/app/assets/javascripts/semantic-ui/sticky.js +771 -0
  29. data/app/assets/javascripts/semantic-ui/tab.js +680 -603
  30. data/app/assets/javascripts/semantic-ui/transition.js +269 -158
  31. data/app/assets/javascripts/semantic-ui/video.js +113 -32
  32. data/app/assets/javascripts/semantic-ui/visibility.js +970 -0
  33. data/app/assets/javascripts/semantic-ui/visit.js +513 -0
  34. data/app/assets/stylesheets/semantic-ui.scss +2 -0
  35. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +58 -14
  36. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +464 -372
  37. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +1385 -533
  38. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +482 -655
  39. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +238 -139
  40. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +631 -280
  41. data/app/assets/stylesheets/semantic-ui/elements/_all.scss +3 -2
  42. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +1614 -657
  43. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +143 -80
  44. data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1018 -0
  45. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +302 -145
  46. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +1653 -1365
  47. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +160 -59
  48. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +247 -118
  49. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +501 -470
  50. data/app/assets/stylesheets/semantic-ui/elements/_list.scss +888 -0
  51. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +189 -98
  52. data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +125 -0
  53. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +147 -212
  54. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +328 -190
  55. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +261 -185
  56. data/app/assets/stylesheets/semantic-ui/globals/_all.scss +2 -0
  57. data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +430 -0
  58. data/app/assets/stylesheets/semantic-ui/globals/_site.scss +128 -0
  59. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +190 -106
  60. data/app/assets/stylesheets/semantic-ui/modules/_all.scss +2 -1
  61. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +303 -201
  62. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +72 -63
  63. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +711 -331
  64. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +262 -140
  65. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +82 -71
  66. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +163 -119
  67. data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +435 -0
  68. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +163 -68
  69. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +223 -150
  70. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +39 -40
  71. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +413 -147
  72. data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +80 -0
  73. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +49 -20
  74. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +542 -568
  75. data/app/assets/stylesheets/semantic-ui/modules/_video.scss +69 -37
  76. data/app/assets/stylesheets/semantic-ui/views/_ad.scss +265 -0
  77. data/app/assets/stylesheets/semantic-ui/views/_all.scss +1 -1
  78. data/app/assets/stylesheets/semantic-ui/views/_card.scss +758 -0
  79. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +133 -92
  80. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +200 -87
  81. data/app/assets/stylesheets/semantic-ui/views/_item.scss +298 -523
  82. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +390 -12
  83. data/lib/semantic/ui/sass/version.rb +2 -2
  84. data/tasks/converter.rb +99 -216
  85. metadata +22 -27
  86. data/app/assets/fonts/semantic-ui/basic.icons.eot +0 -0
  87. data/app/assets/fonts/semantic-ui/basic.icons.svg +0 -450
  88. data/app/assets/fonts/semantic-ui/basic.icons.ttf +0 -0
  89. data/app/assets/fonts/semantic-ui/basic.icons.woff +0 -0
  90. data/app/assets/images/semantic-ui/loader-large-inverted.gif +0 -0
  91. data/app/assets/images/semantic-ui/loader-large.gif +0 -0
  92. data/app/assets/images/semantic-ui/loader-medium-inverted.gif +0 -0
  93. data/app/assets/images/semantic-ui/loader-medium.gif +0 -0
  94. data/app/assets/images/semantic-ui/loader-mini-inverted.gif +0 -0
  95. data/app/assets/images/semantic-ui/loader-mini.gif +0 -0
  96. data/app/assets/images/semantic-ui/loader-small-inverted.gif +0 -0
  97. data/app/assets/images/semantic-ui/loader-small.gif +0 -0
  98. data/app/assets/javascripts/semantic-ui/behavior/api.js +0 -634
  99. data/app/assets/javascripts/semantic-ui/chatroom.js +0 -772
  100. data/app/assets/stylesheets/semantic-ui/depends/_basic.icon.scss +0 -4
  101. data/app/assets/stylesheets/semantic-ui/depends/_icon.scss +0 -4
  102. data/app/assets/stylesheets/semantic-ui/depends/_loader.scss +0 -8
  103. data/app/assets/stylesheets/semantic-ui/elements/_basic.icon.scss +0 -1124
  104. data/app/assets/stylesheets/semantic-ui/elements/_progress.scss +0 -280
  105. data/app/assets/stylesheets/semantic-ui/modules/_chatroom.scss +0 -299
  106. data/app/assets/stylesheets/semantic-ui/modules/_reveal.scss +0 -322
  107. data/app/assets/stylesheets/semantic-ui/views/_list.scss +0 -700
@@ -0,0 +1,771 @@
1
+ /*
2
+ * # Semantic - Sticky
3
+ * http://github.com/semantic-org/semantic-ui/
4
+ *
5
+ *
6
+ * Copyright 2014 Contributors
7
+ * Released under the MIT license
8
+ * http://opensource.org/licenses/MIT
9
+ *
10
+ */
11
+
12
+ ;(function ( $, window, document, undefined ) {
13
+
14
+ "use strict";
15
+
16
+ $.fn.sticky = function(parameters) {
17
+ var
18
+ $allModules = $(this),
19
+ moduleSelector = $allModules.selector || '',
20
+
21
+ time = new Date().getTime(),
22
+ performance = [],
23
+
24
+ query = arguments[0],
25
+ methodInvoked = (typeof query == 'string'),
26
+ queryArguments = [].slice.call(arguments, 1),
27
+ returnedValue
28
+ ;
29
+
30
+ $allModules
31
+ .each(function() {
32
+ var
33
+ settings = $.extend(true, {}, $.fn.sticky.settings, parameters),
34
+
35
+ className = settings.className,
36
+ namespace = settings.namespace,
37
+ error = settings.error,
38
+
39
+ eventNamespace = '.' + namespace,
40
+ moduleNamespace = 'module-' + namespace,
41
+
42
+ $module = $(this),
43
+ $window = $(window),
44
+ $container = $module.offsetParent(),
45
+ $scroll = $(settings.scrollContext),
46
+ $context,
47
+
48
+ selector = $module.selector || '',
49
+ instance = $module.data(moduleNamespace),
50
+
51
+ requestAnimationFrame = window.requestAnimationFrame
52
+ || window.mozRequestAnimationFrame
53
+ || window.webkitRequestAnimationFrame
54
+ || window.msRequestAnimationFrame
55
+ || function(callback) { setTimeout(callback, 0); },
56
+
57
+ element = this,
58
+ observer,
59
+ module
60
+ ;
61
+
62
+ module = {
63
+
64
+ initialize: function() {
65
+ if(settings.context) {
66
+ $context = $(settings.context);
67
+ }
68
+ else {
69
+ $context = $container;
70
+ }
71
+ if($context.size() === 0) {
72
+ module.error(error.invalidContext, settings.context, $module);
73
+ return;
74
+ }
75
+ module.verbose('Initializing sticky', settings, $container);
76
+ module.save.positions();
77
+
78
+ // error conditions
79
+ if( module.is.hidden() ) {
80
+ module.error(error.visible, $module);
81
+ }
82
+ if(module.cache.element.height > module.cache.context.height) {
83
+ module.reset();
84
+ module.error(error.elementSize, $module);
85
+ return;
86
+ }
87
+
88
+ $window
89
+ .on('resize' + eventNamespace, module.event.resize)
90
+ ;
91
+ $scroll
92
+ .on('scroll' + eventNamespace, module.event.scroll)
93
+ ;
94
+
95
+ module.observeChanges();
96
+ module.instantiate();
97
+ },
98
+
99
+ instantiate: function() {
100
+ module.verbose('Storing instance of module', module);
101
+ instance = module;
102
+ $module
103
+ .data(moduleNamespace, module)
104
+ ;
105
+ },
106
+
107
+ destroy: function() {
108
+ module.verbose('Destroying previous module');
109
+ module.reset();
110
+ if(observer) {
111
+ observer.disconnect();
112
+ }
113
+ $window
114
+ .off('resize' + eventNamespace, module.event.resize)
115
+ ;
116
+ $scroll
117
+ .off('scroll' + eventNamespace, module.event.scroll)
118
+ ;
119
+ $module
120
+ .removeData(moduleNamespace)
121
+ ;
122
+ },
123
+
124
+ observeChanges: function() {
125
+ var
126
+ context = $context[0]
127
+ ;
128
+ if('MutationObserver' in window) {
129
+ observer = new MutationObserver(function(mutations) {
130
+ clearTimeout(module.timer);
131
+ module.timer = setTimeout(function() {
132
+ module.verbose('DOM tree modified, updating sticky menu');
133
+ module.refresh();
134
+ }, 200);
135
+ });
136
+ observer.observe(element, {
137
+ childList : true,
138
+ subtree : true
139
+ });
140
+ observer.observe(context, {
141
+ childList : true,
142
+ subtree : true
143
+ });
144
+ module.debug('Setting up mutation observer', observer);
145
+ }
146
+ },
147
+
148
+ event: {
149
+ resize: function() {
150
+ requestAnimationFrame(function() {
151
+ module.refresh();
152
+ module.stick();
153
+ });
154
+ },
155
+ scroll: function() {
156
+ requestAnimationFrame(function() {
157
+ module.stick();
158
+ $.proxy(settings.onScroll, element)();
159
+ });
160
+ }
161
+ },
162
+
163
+ refresh: function(hardRefresh) {
164
+ module.reset();
165
+ if(hardRefresh) {
166
+ $container = $module.offsetParent();
167
+ }
168
+ module.save.positions();
169
+ module.stick();
170
+ $.proxy(settings.onReposition, element)();
171
+ },
172
+
173
+ supports: {
174
+ sticky: function() {
175
+ var
176
+ $element = $('<div/>'),
177
+ element = $element.get()
178
+ ;
179
+ $element
180
+ .addClass(className.supported)
181
+ ;
182
+ return($element.css('position').match('sticky'));
183
+ }
184
+ },
185
+
186
+ save: {
187
+ scroll: function(scroll) {
188
+ module.lastScroll = scroll;
189
+ },
190
+ positions: function() {
191
+ var
192
+ window = {
193
+ height: $window.height()
194
+ },
195
+ element = {
196
+ margin: {
197
+ top : parseInt($module.css('margin-top'), 10),
198
+ bottom : parseInt($module.css('margin-bottom'), 10),
199
+ },
200
+ offset : $module.offset(),
201
+ width : $module.outerWidth(),
202
+ height : $module.outerHeight()
203
+ },
204
+ context = {
205
+ offset: $context.offset(),
206
+ height: $context.outerHeight()
207
+ }
208
+ ;
209
+ module.cache = {
210
+ fits : ( element.height < window.height ),
211
+ window: {
212
+ height: window.height
213
+ },
214
+ element: {
215
+ margin : element.margin,
216
+ top : element.offset.top - element.margin.top,
217
+ left : element.offset.left,
218
+ width : element.width,
219
+ height : element.height,
220
+ bottom : element.offset.top + element.height
221
+ },
222
+ context: {
223
+ top : context.offset.top,
224
+ height : context.height,
225
+ bottom : context.offset.top + context.height
226
+ }
227
+ };
228
+ module.set.containerSize();
229
+ module.set.size();
230
+ module.stick();
231
+ module.debug('Caching element positions', module.cache);
232
+ }
233
+ },
234
+
235
+ get: {
236
+ direction: function(scroll) {
237
+ var
238
+ direction = 'down'
239
+ ;
240
+ scroll = scroll || $scroll.scrollTop();
241
+ if(module.lastScroll !== undefined) {
242
+ if(module.lastScroll < scroll) {
243
+ direction = 'down';
244
+ }
245
+ else if(module.lastScroll > scroll) {
246
+ direction = 'up';
247
+ }
248
+ }
249
+ return direction;
250
+ },
251
+ scrollChange: function(scroll) {
252
+ scroll = scroll || $scroll.scrollTop();
253
+ return (module.lastScroll)
254
+ ? (scroll - module.lastScroll)
255
+ : 0
256
+ ;
257
+ },
258
+ currentElementScroll: function() {
259
+ return ( module.is.top() )
260
+ ? Math.abs(parseInt($module.css('top'), 10)) || 0
261
+ : Math.abs(parseInt($module.css('bottom'), 10)) || 0
262
+ ;
263
+ },
264
+ elementScroll: function(scroll) {
265
+ scroll = scroll || $scroll.scrollTop();
266
+ var
267
+ element = module.cache.element,
268
+ window = module.cache.window,
269
+ delta = module.get.scrollChange(scroll),
270
+ maxScroll = (element.height - window.height + settings.offset),
271
+ currentScroll = module.get.currentElementScroll(),
272
+ possibleScroll = (currentScroll + delta),
273
+ elementScroll
274
+ ;
275
+ if(module.cache.fits || possibleScroll < 0) {
276
+ elementScroll = 0;
277
+ }
278
+ else if (possibleScroll > maxScroll ) {
279
+ elementScroll = maxScroll;
280
+ }
281
+ else {
282
+ elementScroll = possibleScroll;
283
+ }
284
+ return elementScroll;
285
+ }
286
+ },
287
+
288
+ remove: {
289
+ offset: function() {
290
+ $module.css('margin-top', '');
291
+ }
292
+ },
293
+
294
+ set: {
295
+ offset: function() {
296
+ module.verbose('Setting offset on element', settings.offset);
297
+ $module.css('margin-top', settings.offset);
298
+ },
299
+ containerSize: function() {
300
+ var
301
+ tagName = $container.get(0).tagName
302
+ ;
303
+ if(tagName === 'HTML' || tagName == 'body') {
304
+ // this can trigger for too many reasons
305
+ //module.error(error.container, tagName, $module);
306
+ $container = $module.offsetParent();
307
+ }
308
+ else {
309
+ module.debug('Settings container size', module.cache.context.height);
310
+ $container.height(module.cache.context.height);
311
+ }
312
+ },
313
+ scroll: function(scroll) {
314
+ module.debug('Setting scroll on element', scroll);
315
+ if( module.is.top() ) {
316
+ $module
317
+ .css('bottom', '')
318
+ .css('top', -scroll)
319
+ ;
320
+ }
321
+ if( module.is.bottom() ) {
322
+ $module
323
+ .css('top', '')
324
+ .css('bottom', scroll)
325
+ ;
326
+ }
327
+ },
328
+ size: function() {
329
+ if(module.cache.element.height !== 0 && module.cache.element.width !== 0) {
330
+ $module
331
+ .css({
332
+ width : module.cache.element.width,
333
+ height : module.cache.element.height
334
+ })
335
+ ;
336
+ }
337
+ }
338
+ },
339
+
340
+ is: {
341
+ top: function() {
342
+ return $module.hasClass(className.top);
343
+ },
344
+ bottom: function() {
345
+ return $module.hasClass(className.bottom);
346
+ },
347
+ initialPosition: function() {
348
+ return (!module.is.fixed() && !module.is.bound());
349
+ },
350
+ hidden: function() {
351
+ return (!$module.is(':visible'));
352
+ },
353
+ bound: function() {
354
+ return $module.hasClass(className.bound);
355
+ },
356
+ fixed: function() {
357
+ return $module.hasClass(className.fixed);
358
+ }
359
+ },
360
+
361
+ stick: function() {
362
+ var
363
+ cache = module.cache,
364
+ fits = cache.fits,
365
+ element = cache.element,
366
+ window = cache.window,
367
+ context = cache.context,
368
+ offset = (module.is.bottom() && settings.pushing)
369
+ ? settings.bottomOffset
370
+ : settings.offset,
371
+ scroll = {
372
+ top : $scroll.scrollTop() + offset,
373
+ bottom : $scroll.scrollTop() + offset + window.height
374
+ },
375
+ direction = module.get.direction(scroll.top),
376
+ elementScroll = module.get.elementScroll(scroll.top),
377
+
378
+ // shorthand
379
+ doesntFit = !fits,
380
+ elementVisible = (element.height !== 0)
381
+ ;
382
+
383
+ // save current scroll for next run
384
+ module.save.scroll(scroll.top);
385
+
386
+ if(elementVisible) {
387
+
388
+ if( module.is.initialPosition() ) {
389
+ if(scroll.top >= element.top) {
390
+ module.debug('Element passed, fixing element to page');
391
+ module.fixTop();
392
+ }
393
+ }
394
+ else if( module.is.fixed() ) {
395
+
396
+ // currently fixed top
397
+ if( module.is.top() ) {
398
+ if( scroll.top < element.top ) {
399
+ module.debug('Fixed element reached top of container');
400
+ module.setInitialPosition();
401
+ }
402
+ else if( (element.height + scroll.top - elementScroll) > context.bottom ) {
403
+ module.debug('Fixed element reached bottom of container');
404
+ module.bindBottom();
405
+ }
406
+ // scroll element if larger than screen
407
+ else if(doesntFit) {
408
+ module.set.scroll(elementScroll);
409
+ }
410
+ }
411
+
412
+ // currently fixed bottom
413
+ else if(module.is.bottom() ) {
414
+
415
+ // top edge
416
+ if( (scroll.bottom - element.height) < element.top) {
417
+ module.debug('Bottom fixed rail has reached top of container');
418
+ module.setInitialPosition();
419
+ }
420
+ // bottom edge
421
+ else if(scroll.bottom > context.bottom) {
422
+ module.debug('Bottom fixed rail has reached bottom of container');
423
+ module.bindBottom();
424
+ }
425
+ // scroll element if larger than screen
426
+ else if(doesntFit) {
427
+ module.set.scroll(elementScroll);
428
+ }
429
+
430
+ }
431
+ }
432
+ else if( module.is.bottom() ) {
433
+ if(settings.pushing) {
434
+ if(module.is.bound() && scroll.bottom < context.bottom ) {
435
+ module.debug('Fixing bottom attached element to bottom of browser.');
436
+ module.fixBottom();
437
+ }
438
+ }
439
+ else {
440
+ if(module.is.bound() && (scroll.top < context.bottom - element.height) ) {
441
+ module.debug('Fixing bottom attached element to top of browser.');
442
+ module.fixTop();
443
+ }
444
+ }
445
+ }
446
+ }
447
+ },
448
+
449
+ bindTop: function() {
450
+ module.debug('Binding element to top of parent container');
451
+ module.remove.offset();
452
+ $module
453
+ .css('left' , '')
454
+ .css('top' , '')
455
+ .css('bottom' , '')
456
+ .removeClass(className.fixed)
457
+ .removeClass(className.bottom)
458
+ .addClass(className.bound)
459
+ .addClass(className.top)
460
+ ;
461
+ $.proxy(settings.onTop, element)();
462
+ $.proxy(settings.onUnstick, element)();
463
+ },
464
+ bindBottom: function() {
465
+ module.debug('Binding element to bottom of parent container');
466
+ module.remove.offset();
467
+ $module
468
+ .css('left' , '')
469
+ .css('top' , '')
470
+ .css('bottom' , '')
471
+ .removeClass(className.fixed)
472
+ .removeClass(className.top)
473
+ .addClass(className.bound)
474
+ .addClass(className.bottom)
475
+ ;
476
+ $.proxy(settings.onBottom, element)();
477
+ $.proxy(settings.onUnstick, element)();
478
+ },
479
+
480
+ setInitialPosition: function() {
481
+ module.unfix();
482
+ module.unbind();
483
+ },
484
+
485
+
486
+ fixTop: function() {
487
+ module.debug('Fixing element to top of page');
488
+ module.set.offset();
489
+ $module
490
+ .css('left', module.cache.element.left)
491
+ .removeClass(className.bound)
492
+ .removeClass(className.bottom)
493
+ .addClass(className.fixed)
494
+ .addClass(className.top)
495
+ ;
496
+ $.proxy(settings.onStick, element)();
497
+ },
498
+
499
+ fixBottom: function() {
500
+ module.debug('Sticking element to bottom of page');
501
+ module.set.offset();
502
+ $module
503
+ .css('left', module.cache.element.left)
504
+ .removeClass(className.bound)
505
+ .removeClass(className.top)
506
+ .addClass(className.fixed)
507
+ .addClass(className.bottom)
508
+ ;
509
+ $.proxy(settings.onStick, element)();
510
+ },
511
+
512
+ unbind: function() {
513
+ module.debug('Removing absolute position on element');
514
+ module.remove.offset();
515
+ $module
516
+ .removeClass(className.bound)
517
+ .removeClass(className.top)
518
+ .removeClass(className.bottom)
519
+ ;
520
+ },
521
+
522
+ unfix: function() {
523
+ module.debug('Removing fixed position on element');
524
+ module.remove.offset();
525
+ $module
526
+ .removeClass(className.fixed)
527
+ .removeClass(className.top)
528
+ .removeClass(className.bottom)
529
+ ;
530
+ $.proxy(settings.onUnstick, this)();
531
+ },
532
+
533
+ reset: function() {
534
+ module.debug('Reseting elements position');
535
+ module.unbind();
536
+ module.unfix();
537
+ module.resetCSS();
538
+ },
539
+
540
+ resetCSS: function() {
541
+ $module
542
+ .css({
543
+ top : '',
544
+ bottom : '',
545
+ width : '',
546
+ height : ''
547
+ })
548
+ ;
549
+ $container
550
+ .css({
551
+ height: ''
552
+ })
553
+ ;
554
+ },
555
+
556
+ setting: function(name, value) {
557
+ if( $.isPlainObject(name) ) {
558
+ $.extend(true, settings, name);
559
+ }
560
+ else if(value !== undefined) {
561
+ settings[name] = value;
562
+ }
563
+ else {
564
+ return settings[name];
565
+ }
566
+ },
567
+ internal: function(name, value) {
568
+ if( $.isPlainObject(name) ) {
569
+ $.extend(true, module, name);
570
+ }
571
+ else if(value !== undefined) {
572
+ module[name] = value;
573
+ }
574
+ else {
575
+ return module[name];
576
+ }
577
+ },
578
+ debug: function() {
579
+ if(settings.debug) {
580
+ if(settings.performance) {
581
+ module.performance.log(arguments);
582
+ }
583
+ else {
584
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
585
+ module.debug.apply(console, arguments);
586
+ }
587
+ }
588
+ },
589
+ verbose: function() {
590
+ if(settings.verbose && settings.debug) {
591
+ if(settings.performance) {
592
+ module.performance.log(arguments);
593
+ }
594
+ else {
595
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
596
+ module.verbose.apply(console, arguments);
597
+ }
598
+ }
599
+ },
600
+ error: function() {
601
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
602
+ module.error.apply(console, arguments);
603
+ },
604
+ performance: {
605
+ log: function(message) {
606
+ var
607
+ currentTime,
608
+ executionTime,
609
+ previousTime
610
+ ;
611
+ if(settings.performance) {
612
+ currentTime = new Date().getTime();
613
+ previousTime = time || currentTime;
614
+ executionTime = currentTime - previousTime;
615
+ time = currentTime;
616
+ performance.push({
617
+ 'Name' : message[0],
618
+ 'Arguments' : [].slice.call(message, 1) || '',
619
+ 'Element' : element,
620
+ 'Execution Time' : executionTime
621
+ });
622
+ }
623
+ clearTimeout(module.performance.timer);
624
+ module.performance.timer = setTimeout(module.performance.display, 0);
625
+ },
626
+ display: function() {
627
+ var
628
+ title = settings.name + ':',
629
+ totalTime = 0
630
+ ;
631
+ time = false;
632
+ clearTimeout(module.performance.timer);
633
+ $.each(performance, function(index, data) {
634
+ totalTime += data['Execution Time'];
635
+ });
636
+ title += ' ' + totalTime + 'ms';
637
+ if(moduleSelector) {
638
+ title += ' \'' + moduleSelector + '\'';
639
+ }
640
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
641
+ console.groupCollapsed(title);
642
+ if(console.table) {
643
+ console.table(performance);
644
+ }
645
+ else {
646
+ $.each(performance, function(index, data) {
647
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
648
+ });
649
+ }
650
+ console.groupEnd();
651
+ }
652
+ performance = [];
653
+ }
654
+ },
655
+ invoke: function(query, passedArguments, context) {
656
+ var
657
+ object = instance,
658
+ maxDepth,
659
+ found,
660
+ response
661
+ ;
662
+ passedArguments = passedArguments || queryArguments;
663
+ context = element || context;
664
+ if(typeof query == 'string' && object !== undefined) {
665
+ query = query.split(/[\. ]/);
666
+ maxDepth = query.length - 1;
667
+ $.each(query, function(depth, value) {
668
+ var camelCaseValue = (depth != maxDepth)
669
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
670
+ : query
671
+ ;
672
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
673
+ object = object[camelCaseValue];
674
+ }
675
+ else if( object[camelCaseValue] !== undefined ) {
676
+ found = object[camelCaseValue];
677
+ return false;
678
+ }
679
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
680
+ object = object[value];
681
+ }
682
+ else if( object[value] !== undefined ) {
683
+ found = object[value];
684
+ return false;
685
+ }
686
+ else {
687
+ return false;
688
+ }
689
+ });
690
+ }
691
+ if ( $.isFunction( found ) ) {
692
+ response = found.apply(context, passedArguments);
693
+ }
694
+ else if(found !== undefined) {
695
+ response = found;
696
+ }
697
+ if($.isArray(returnedValue)) {
698
+ returnedValue.push(response);
699
+ }
700
+ else if(returnedValue !== undefined) {
701
+ returnedValue = [returnedValue, response];
702
+ }
703
+ else if(response !== undefined) {
704
+ returnedValue = response;
705
+ }
706
+ return found;
707
+ }
708
+ };
709
+
710
+ if(methodInvoked) {
711
+ if(instance === undefined) {
712
+ module.initialize();
713
+ }
714
+ module.invoke(query);
715
+ }
716
+ else {
717
+ if(instance !== undefined) {
718
+ module.destroy();
719
+ }
720
+ module.initialize();
721
+ }
722
+ })
723
+ ;
724
+
725
+ return (returnedValue !== undefined)
726
+ ? returnedValue
727
+ : this
728
+ ;
729
+ };
730
+
731
+ $.fn.sticky.settings = {
732
+
733
+ name : 'Sticky',
734
+ namespace : 'sticky',
735
+
736
+ debug : false,
737
+ verbose : false,
738
+ performance : false,
739
+
740
+ pushing : false,
741
+ context : false,
742
+ scrollContext : window,
743
+ offset : 0,
744
+ bottomOffset : 0,
745
+
746
+ onReposition : function(){},
747
+ onScroll : function(){},
748
+ onStick : function(){},
749
+ onUnstick : function(){},
750
+ onTop : function(){},
751
+ onBottom : function(){},
752
+
753
+ error : {
754
+ container : 'Sticky element must be inside a relative container',
755
+ visible : 'Element is hidden, you must call refresh after element becomes visible',
756
+ method : 'The method you called is not defined.',
757
+ invalidContext : 'Context specified does not exist',
758
+ elementSize : 'Sticky element is larger than its container, cannot create sticky.'
759
+ },
760
+
761
+ className : {
762
+ bound : 'bound',
763
+ fixed : 'fixed',
764
+ supported : 'native',
765
+ top : 'top',
766
+ bottom : 'bottom'
767
+ }
768
+
769
+ };
770
+
771
+ })( jQuery, window , document );