fomantic-ui-sass 2.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +27 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +5 -0
  5. data/CHANGELOG.md +370 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +177 -0
  9. data/Rakefile +8 -0
  10. data/app/assets/fonts/semantic-ui/brand-icons.eot +0 -0
  11. data/app/assets/fonts/semantic-ui/brand-icons.svg +1008 -0
  12. data/app/assets/fonts/semantic-ui/brand-icons.ttf +0 -0
  13. data/app/assets/fonts/semantic-ui/brand-icons.woff +0 -0
  14. data/app/assets/fonts/semantic-ui/brand-icons.woff2 +0 -0
  15. data/app/assets/fonts/semantic-ui/icons.eot +0 -0
  16. data/app/assets/fonts/semantic-ui/icons.otf +0 -0
  17. data/app/assets/fonts/semantic-ui/icons.svg +1518 -0
  18. data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
  19. data/app/assets/fonts/semantic-ui/icons.woff +0 -0
  20. data/app/assets/fonts/semantic-ui/icons.woff2 +0 -0
  21. data/app/assets/fonts/semantic-ui/outline-icons.eot +0 -0
  22. data/app/assets/fonts/semantic-ui/outline-icons.svg +366 -0
  23. data/app/assets/fonts/semantic-ui/outline-icons.ttf +0 -0
  24. data/app/assets/fonts/semantic-ui/outline-icons.woff +0 -0
  25. data/app/assets/fonts/semantic-ui/outline-icons.woff2 +0 -0
  26. data/app/assets/images/semantic-ui/flags.png +0 -0
  27. data/app/assets/javascripts/semantic-ui.js +27 -0
  28. data/app/assets/javascripts/semantic-ui/accordion.js +613 -0
  29. data/app/assets/javascripts/semantic-ui/api.js +1167 -0
  30. data/app/assets/javascripts/semantic-ui/calendar.js +1476 -0
  31. data/app/assets/javascripts/semantic-ui/checkbox.js +828 -0
  32. data/app/assets/javascripts/semantic-ui/colorize.js +280 -0
  33. data/app/assets/javascripts/semantic-ui/dimmer.js +735 -0
  34. data/app/assets/javascripts/semantic-ui/dropdown.js +4030 -0
  35. data/app/assets/javascripts/semantic-ui/embed.js +706 -0
  36. data/app/assets/javascripts/semantic-ui/form.js +1707 -0
  37. data/app/assets/javascripts/semantic-ui/modal.js +1090 -0
  38. data/app/assets/javascripts/semantic-ui/nag.js +507 -0
  39. data/app/assets/javascripts/semantic-ui/popup.js +1532 -0
  40. data/app/assets/javascripts/semantic-ui/progress.js +923 -0
  41. data/app/assets/javascripts/semantic-ui/range.js +278 -0
  42. data/app/assets/javascripts/semantic-ui/rating.js +511 -0
  43. data/app/assets/javascripts/semantic-ui/search.js +1515 -0
  44. data/app/assets/javascripts/semantic-ui/shape.js +921 -0
  45. data/app/assets/javascripts/semantic-ui/sidebar.js +1033 -0
  46. data/app/assets/javascripts/semantic-ui/site.js +490 -0
  47. data/app/assets/javascripts/semantic-ui/state.js +708 -0
  48. data/app/assets/javascripts/semantic-ui/sticky.js +959 -0
  49. data/app/assets/javascripts/semantic-ui/tab.js +952 -0
  50. data/app/assets/javascripts/semantic-ui/toast.js +592 -0
  51. data/app/assets/javascripts/semantic-ui/transition.js +1106 -0
  52. data/app/assets/javascripts/semantic-ui/video.js +532 -0
  53. data/app/assets/javascripts/semantic-ui/visibility.js +1311 -0
  54. data/app/assets/javascripts/semantic-ui/visit.js +525 -0
  55. data/app/assets/stylesheets/semantic-ui.scss +5 -0
  56. data/app/assets/stylesheets/semantic-ui/collections/_all.scss +6 -0
  57. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +124 -0
  58. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +1158 -0
  59. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +2093 -0
  60. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +2193 -0
  61. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +606 -0
  62. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +1117 -0
  63. data/app/assets/stylesheets/semantic-ui/elements/_all.scss +16 -0
  64. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +4530 -0
  65. data/app/assets/stylesheets/semantic-ui/elements/_container.scss +145 -0
  66. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +259 -0
  67. data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1036 -0
  68. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +762 -0
  69. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +6330 -0
  70. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +310 -0
  71. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +519 -0
  72. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +1395 -0
  73. data/app/assets/stylesheets/semantic-ui/elements/_list.scss +959 -0
  74. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +458 -0
  75. data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +242 -0
  76. data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +152 -0
  77. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +295 -0
  78. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +884 -0
  79. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +675 -0
  80. data/app/assets/stylesheets/semantic-ui/globals/_all.scss +3 -0
  81. data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +485 -0
  82. data/app/assets/stylesheets/semantic-ui/globals/_site.scss +206 -0
  83. data/app/assets/stylesheets/semantic-ui/globals/_variables.scss +4 -0
  84. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +247 -0
  85. data/app/assets/stylesheets/semantic-ui/modules/_all.scss +20 -0
  86. data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +165 -0
  87. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +718 -0
  88. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +464 -0
  89. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +1745 -0
  90. data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +165 -0
  91. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +646 -0
  92. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +148 -0
  93. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +789 -0
  94. data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +523 -0
  95. data/app/assets/stylesheets/semantic-ui/modules/_range.scss +192 -0
  96. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +263 -0
  97. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +445 -0
  98. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +154 -0
  99. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +626 -0
  100. data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +78 -0
  101. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +92 -0
  102. data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +291 -0
  103. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +2059 -0
  104. data/app/assets/stylesheets/semantic-ui/modules/_video.scss +125 -0
  105. data/app/assets/stylesheets/semantic-ui/views/_ad.scss +275 -0
  106. data/app/assets/stylesheets/semantic-ui/views/_all.scss +6 -0
  107. data/app/assets/stylesheets/semantic-ui/views/_card.scss +1124 -0
  108. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +296 -0
  109. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +314 -0
  110. data/app/assets/stylesheets/semantic-ui/views/_item.scss +555 -0
  111. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +583 -0
  112. data/app/helpers/semantic_breadcrumbs_helper.rb +10 -0
  113. data/app/helpers/semantic_flash_helper.rb +22 -0
  114. data/app/helpers/semantic_icon_helper.rb +8 -0
  115. data/app/views/semantic/_breadcrumbs.html.erb +12 -0
  116. data/fomantic-ui-sass.gemspec +31 -0
  117. data/lib/fomantic-ui-sass.rb +62 -0
  118. data/lib/fomantic/ui/sass/breadcrumbs.rb +41 -0
  119. data/lib/fomantic/ui/sass/engine.rb +23 -0
  120. data/lib/fomantic/ui/sass/version.rb +8 -0
  121. data/spec/dummy/README.rdoc +28 -0
  122. data/spec/dummy/Rakefile +6 -0
  123. data/spec/dummy/app/assets/images/.keep +0 -0
  124. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  125. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  126. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  127. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  128. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  129. data/spec/dummy/app/mailers/.keep +0 -0
  130. data/spec/dummy/app/models/.keep +0 -0
  131. data/spec/dummy/app/models/concerns/.keep +0 -0
  132. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  133. data/spec/dummy/bin/bundle +3 -0
  134. data/spec/dummy/bin/rails +4 -0
  135. data/spec/dummy/bin/rake +4 -0
  136. data/spec/dummy/config.ru +4 -0
  137. data/spec/dummy/config/application.rb +28 -0
  138. data/spec/dummy/config/boot.rb +5 -0
  139. data/spec/dummy/config/environment.rb +5 -0
  140. data/spec/dummy/config/environments/development.rb +29 -0
  141. data/spec/dummy/config/environments/production.rb +80 -0
  142. data/spec/dummy/config/environments/test.rb +36 -0
  143. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  144. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  145. data/spec/dummy/config/initializers/inflections.rb +16 -0
  146. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  147. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  148. data/spec/dummy/config/initializers/session_store.rb +3 -0
  149. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  150. data/spec/dummy/config/locales/en.yml +23 -0
  151. data/spec/dummy/config/routes.rb +2 -0
  152. data/spec/dummy/lib/assets/.keep +0 -0
  153. data/spec/dummy/log/.keep +0 -0
  154. data/spec/dummy/public/404.html +58 -0
  155. data/spec/dummy/public/422.html +58 -0
  156. data/spec/dummy/public/500.html +57 -0
  157. data/spec/dummy/public/favicon.ico +0 -0
  158. data/spec/helpers/semantic_breadcrumbs_helper_spec.rb +38 -0
  159. data/spec/helpers/semantic_flash_helper_spec.rb +36 -0
  160. data/spec/helpers/semantic_icon_helper_spec.rb +48 -0
  161. data/spec/spec_helper.rb +17 -0
  162. data/tasks/converter.rb +216 -0
  163. data/templates/project/manifest.rb +29 -0
  164. data/templates/project/styles.scss +1 -0
  165. metadata +390 -0
@@ -0,0 +1,1033 @@
1
+ /*!
2
+ * # Semantic UI - Sidebar
3
+ * http://github.com/semantic-org/semantic-ui/
4
+ *
5
+ *
6
+ * Released under the MIT license
7
+ * http://opensource.org/licenses/MIT
8
+ *
9
+ */
10
+
11
+ ;(function ($, window, document, undefined) {
12
+
13
+ 'use strict';
14
+
15
+ window = (typeof window != 'undefined' && window.Math == Math)
16
+ ? window
17
+ : (typeof self != 'undefined' && self.Math == Math)
18
+ ? self
19
+ : Function('return this')()
20
+ ;
21
+
22
+ $.fn.sidebar = function(parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ $window = $(window),
26
+ $document = $(document),
27
+ $html = $('html'),
28
+ $head = $('head'),
29
+
30
+ moduleSelector = $allModules.selector || '',
31
+
32
+ time = new Date().getTime(),
33
+ performance = [],
34
+
35
+ query = arguments[0],
36
+ methodInvoked = (typeof query == 'string'),
37
+ queryArguments = [].slice.call(arguments, 1),
38
+
39
+ requestAnimationFrame = window.requestAnimationFrame
40
+ || window.mozRequestAnimationFrame
41
+ || window.webkitRequestAnimationFrame
42
+ || window.msRequestAnimationFrame
43
+ || function(callback) { setTimeout(callback, 0); },
44
+
45
+ returnedValue
46
+ ;
47
+
48
+ $allModules
49
+ .each(function() {
50
+ var
51
+ settings = ( $.isPlainObject(parameters) )
52
+ ? $.extend(true, {}, $.fn.sidebar.settings, parameters)
53
+ : $.extend({}, $.fn.sidebar.settings),
54
+
55
+ selector = settings.selector,
56
+ className = settings.className,
57
+ namespace = settings.namespace,
58
+ regExp = settings.regExp,
59
+ error = settings.error,
60
+
61
+ eventNamespace = '.' + namespace,
62
+ moduleNamespace = 'module-' + namespace,
63
+
64
+ $module = $(this),
65
+ $context = $(settings.context),
66
+
67
+ $sidebars = $module.children(selector.sidebar),
68
+ $fixed = $context.children(selector.fixed),
69
+ $pusher = $context.children(selector.pusher),
70
+ $style,
71
+
72
+ element = this,
73
+ instance = $module.data(moduleNamespace),
74
+
75
+ elementNamespace,
76
+ id,
77
+ currentScroll,
78
+ transitionEvent,
79
+
80
+ module
81
+ ;
82
+
83
+ module = {
84
+
85
+ initialize: function() {
86
+ module.debug('Initializing sidebar', parameters);
87
+
88
+ module.create.id();
89
+
90
+ transitionEvent = module.get.transitionEvent();
91
+
92
+ // avoids locking rendering if initialized in onReady
93
+ if(settings.delaySetup) {
94
+ requestAnimationFrame(module.setup.layout);
95
+ }
96
+ else {
97
+ module.setup.layout();
98
+ }
99
+
100
+ requestAnimationFrame(function() {
101
+ module.setup.cache();
102
+ });
103
+
104
+ module.instantiate();
105
+ },
106
+
107
+ instantiate: function() {
108
+ module.verbose('Storing instance of module', module);
109
+ instance = module;
110
+ $module
111
+ .data(moduleNamespace, module)
112
+ ;
113
+ },
114
+
115
+ create: {
116
+ id: function() {
117
+ id = (Math.random().toString(16) + '000000000').substr(2,8);
118
+ elementNamespace = '.' + id;
119
+ module.verbose('Creating unique id for element', id);
120
+ }
121
+ },
122
+
123
+ destroy: function() {
124
+ module.verbose('Destroying previous module for', $module);
125
+ $module
126
+ .off(eventNamespace)
127
+ .removeData(moduleNamespace)
128
+ ;
129
+ if(module.is.ios()) {
130
+ module.remove.ios();
131
+ }
132
+ // bound by uuid
133
+ $context.off(elementNamespace);
134
+ $window.off(elementNamespace);
135
+ $document.off(elementNamespace);
136
+ },
137
+
138
+ event: {
139
+ clickaway: function(event) {
140
+ var
141
+ clickedInPusher = ($pusher.find(event.target).length > 0 || $pusher.is(event.target)),
142
+ clickedContext = ($context.is(event.target))
143
+ ;
144
+ if(clickedInPusher) {
145
+ module.verbose('User clicked on dimmed page');
146
+ module.hide();
147
+ }
148
+ if(clickedContext) {
149
+ module.verbose('User clicked on dimmable context (scaled out page)');
150
+ module.hide();
151
+ }
152
+ },
153
+ touch: function(event) {
154
+ //event.stopPropagation();
155
+ },
156
+ containScroll: function(event) {
157
+ if(element.scrollTop <= 0) {
158
+ element.scrollTop = 1;
159
+ }
160
+ if((element.scrollTop + element.offsetHeight) >= element.scrollHeight) {
161
+ element.scrollTop = element.scrollHeight - element.offsetHeight - 1;
162
+ }
163
+ },
164
+ scroll: function(event) {
165
+ if( $(event.target).closest(selector.sidebar).length === 0 ) {
166
+ event.preventDefault();
167
+ }
168
+ }
169
+ },
170
+
171
+ bind: {
172
+ clickaway: function() {
173
+ module.verbose('Adding clickaway events to context', $context);
174
+ if(settings.closable) {
175
+ $context
176
+ .on('click' + elementNamespace, module.event.clickaway)
177
+ .on('touchend' + elementNamespace, module.event.clickaway)
178
+ ;
179
+ }
180
+ },
181
+ scrollLock: function() {
182
+ if(settings.scrollLock) {
183
+ module.debug('Disabling page scroll');
184
+ $window
185
+ .on('DOMMouseScroll' + elementNamespace, module.event.scroll)
186
+ ;
187
+ }
188
+ module.verbose('Adding events to contain sidebar scroll');
189
+ $document
190
+ .on('touchmove' + elementNamespace, module.event.touch)
191
+ ;
192
+ $module
193
+ .on('scroll' + eventNamespace, module.event.containScroll)
194
+ ;
195
+ }
196
+ },
197
+ unbind: {
198
+ clickaway: function() {
199
+ module.verbose('Removing clickaway events from context', $context);
200
+ $context.off(elementNamespace);
201
+ },
202
+ scrollLock: function() {
203
+ module.verbose('Removing scroll lock from page');
204
+ $document.off(elementNamespace);
205
+ $window.off(elementNamespace);
206
+ $module.off('scroll' + eventNamespace);
207
+ }
208
+ },
209
+
210
+ add: {
211
+ inlineCSS: function() {
212
+ var
213
+ width = module.cache.width || $module.outerWidth(),
214
+ height = module.cache.height || $module.outerHeight(),
215
+ isRTL = module.is.rtl(),
216
+ direction = module.get.direction(),
217
+ distance = {
218
+ left : width,
219
+ right : -width,
220
+ top : height,
221
+ bottom : -height
222
+ },
223
+ style
224
+ ;
225
+
226
+ if(isRTL){
227
+ module.verbose('RTL detected, flipping widths');
228
+ distance.left = -width;
229
+ distance.right = width;
230
+ }
231
+
232
+ style = '<style>';
233
+
234
+ if(direction === 'left' || direction === 'right') {
235
+ module.debug('Adding CSS rules for animation distance', width);
236
+ style += ''
237
+ + ' .ui.visible.' + direction + '.sidebar ~ .fixed,'
238
+ + ' .ui.visible.' + direction + '.sidebar ~ .pusher {'
239
+ + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
240
+ + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
241
+ + ' }'
242
+ ;
243
+ }
244
+ else if(direction === 'top' || direction == 'bottom') {
245
+ style += ''
246
+ + ' .ui.visible.' + direction + '.sidebar ~ .fixed,'
247
+ + ' .ui.visible.' + direction + '.sidebar ~ .pusher {'
248
+ + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
249
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
250
+ + ' }'
251
+ ;
252
+ }
253
+
254
+ /* IE is only browser not to create context with transforms */
255
+ /* https://www.w3.org/Bugs/Public/show_bug.cgi?id=16328 */
256
+ if( module.is.ie() ) {
257
+ if(direction === 'left' || direction === 'right') {
258
+ module.debug('Adding CSS rules for animation distance', width);
259
+ style += ''
260
+ + ' body.pushable > .ui.visible.' + direction + '.sidebar ~ .pusher:after {'
261
+ + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
262
+ + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
263
+ + ' }'
264
+ ;
265
+ }
266
+ else if(direction === 'top' || direction == 'bottom') {
267
+ style += ''
268
+ + ' body.pushable > .ui.visible.' + direction + '.sidebar ~ .pusher:after {'
269
+ + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
270
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
271
+ + ' }'
272
+ ;
273
+ }
274
+ /* opposite sides visible forces content overlay */
275
+ style += ''
276
+ + ' body.pushable > .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher:after,'
277
+ + ' body.pushable > .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher:after {'
278
+ + ' -webkit-transform: translate3d(0px, 0, 0);'
279
+ + ' transform: translate3d(0px, 0, 0);'
280
+ + ' }'
281
+ ;
282
+ }
283
+ style += '</style>';
284
+ $style = $(style)
285
+ .appendTo($head)
286
+ ;
287
+ module.debug('Adding sizing css to head', $style);
288
+ }
289
+ },
290
+
291
+ refresh: function() {
292
+ module.verbose('Refreshing selector cache');
293
+ $context = $(settings.context);
294
+ $sidebars = $context.children(selector.sidebar);
295
+ $pusher = $context.children(selector.pusher);
296
+ $fixed = $context.children(selector.fixed);
297
+ module.clear.cache();
298
+ },
299
+
300
+ refreshSidebars: function() {
301
+ module.verbose('Refreshing other sidebars');
302
+ $sidebars = $context.children(selector.sidebar);
303
+ },
304
+
305
+ repaint: function() {
306
+ module.verbose('Forcing repaint event');
307
+ element.style.display = 'none';
308
+ var ignored = element.offsetHeight;
309
+ element.scrollTop = element.scrollTop;
310
+ element.style.display = '';
311
+ },
312
+
313
+ setup: {
314
+ cache: function() {
315
+ module.cache = {
316
+ width : $module.outerWidth(),
317
+ height : $module.outerHeight(),
318
+ rtl : ($module.css('direction') == 'rtl')
319
+ };
320
+ },
321
+ layout: function() {
322
+ if( $context.children(selector.pusher).length === 0 ) {
323
+ module.debug('Adding wrapper element for sidebar');
324
+ module.error(error.pusher);
325
+ $pusher = $('<div class="pusher" />');
326
+ $context
327
+ .children()
328
+ .not(selector.omitted)
329
+ .not($sidebars)
330
+ .wrapAll($pusher)
331
+ ;
332
+ module.refresh();
333
+ }
334
+ if($module.nextAll(selector.pusher).length === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
335
+ module.debug('Moved sidebar to correct parent element');
336
+ module.error(error.movedSidebar, element);
337
+ $module.detach().prependTo($context);
338
+ module.refresh();
339
+ }
340
+ module.clear.cache();
341
+ module.set.pushable();
342
+ module.set.direction();
343
+ }
344
+ },
345
+
346
+ attachEvents: function(selector, event) {
347
+ var
348
+ $toggle = $(selector)
349
+ ;
350
+ event = $.isFunction(module[event])
351
+ ? module[event]
352
+ : module.toggle
353
+ ;
354
+ if($toggle.length > 0) {
355
+ module.debug('Attaching sidebar events to element', selector, event);
356
+ $toggle
357
+ .on('click' + eventNamespace, event)
358
+ ;
359
+ }
360
+ else {
361
+ module.error(error.notFound, selector);
362
+ }
363
+ },
364
+
365
+ show: function(callback) {
366
+ callback = $.isFunction(callback)
367
+ ? callback
368
+ : function(){}
369
+ ;
370
+ if(module.is.hidden()) {
371
+ module.refreshSidebars();
372
+ if(settings.overlay) {
373
+ module.error(error.overlay);
374
+ settings.transition = 'overlay';
375
+ }
376
+ module.refresh();
377
+ if(module.othersActive()) {
378
+ module.debug('Other sidebars currently visible');
379
+ if(settings.exclusive) {
380
+ // if not overlay queue animation after hide
381
+ if(settings.transition != 'overlay') {
382
+ module.hideOthers(module.show);
383
+ return;
384
+ }
385
+ else {
386
+ module.hideOthers();
387
+ }
388
+ }
389
+ else {
390
+ settings.transition = 'overlay';
391
+ }
392
+ }
393
+ module.pushPage(function() {
394
+ callback.call(element);
395
+ settings.onShow.call(element);
396
+ });
397
+ settings.onChange.call(element);
398
+ settings.onVisible.call(element);
399
+ }
400
+ else {
401
+ module.debug('Sidebar is already visible');
402
+ }
403
+ },
404
+
405
+ hide: function(callback) {
406
+ callback = $.isFunction(callback)
407
+ ? callback
408
+ : function(){}
409
+ ;
410
+ if(module.is.visible() || module.is.animating()) {
411
+ module.debug('Hiding sidebar', callback);
412
+ module.refreshSidebars();
413
+ module.pullPage(function() {
414
+ callback.call(element);
415
+ settings.onHidden.call(element);
416
+ });
417
+ settings.onChange.call(element);
418
+ settings.onHide.call(element);
419
+ }
420
+ },
421
+
422
+ othersAnimating: function() {
423
+ return ($sidebars.not($module).filter('.' + className.animating).length > 0);
424
+ },
425
+ othersVisible: function() {
426
+ return ($sidebars.not($module).filter('.' + className.visible).length > 0);
427
+ },
428
+ othersActive: function() {
429
+ return(module.othersVisible() || module.othersAnimating());
430
+ },
431
+
432
+ hideOthers: function(callback) {
433
+ var
434
+ $otherSidebars = $sidebars.not($module).filter('.' + className.visible),
435
+ sidebarCount = $otherSidebars.length,
436
+ callbackCount = 0
437
+ ;
438
+ callback = callback || function(){};
439
+ $otherSidebars
440
+ .sidebar('hide', function() {
441
+ callbackCount++;
442
+ if(callbackCount == sidebarCount) {
443
+ callback();
444
+ }
445
+ })
446
+ ;
447
+ },
448
+
449
+ toggle: function() {
450
+ module.verbose('Determining toggled direction');
451
+ if(module.is.hidden()) {
452
+ module.show();
453
+ }
454
+ else {
455
+ module.hide();
456
+ }
457
+ },
458
+
459
+ pushPage: function(callback) {
460
+ var
461
+ transition = module.get.transition(),
462
+ $transition = (transition === 'overlay' || module.othersActive())
463
+ ? $module
464
+ : $pusher,
465
+ animate,
466
+ dim,
467
+ transitionEnd
468
+ ;
469
+ callback = $.isFunction(callback)
470
+ ? callback
471
+ : function(){}
472
+ ;
473
+ if(settings.transition == 'scale down') {
474
+ module.scrollToTop();
475
+ }
476
+ module.set.transition(transition);
477
+ module.repaint();
478
+ animate = function() {
479
+ module.bind.clickaway();
480
+ module.add.inlineCSS();
481
+ module.set.animating();
482
+ module.set.visible();
483
+ };
484
+ dim = function() {
485
+ module.set.dimmed();
486
+ };
487
+ transitionEnd = function(event) {
488
+ if( event.target == $transition[0] ) {
489
+ $transition.off(transitionEvent + elementNamespace, transitionEnd);
490
+ module.remove.animating();
491
+ module.bind.scrollLock();
492
+ callback.call(element);
493
+ }
494
+ };
495
+ $transition.off(transitionEvent + elementNamespace);
496
+ $transition.on(transitionEvent + elementNamespace, transitionEnd);
497
+ requestAnimationFrame(animate);
498
+ if(settings.dimPage && !module.othersVisible()) {
499
+ requestAnimationFrame(dim);
500
+ }
501
+ },
502
+
503
+ pullPage: function(callback) {
504
+ var
505
+ transition = module.get.transition(),
506
+ $transition = (transition == 'overlay' || module.othersActive())
507
+ ? $module
508
+ : $pusher,
509
+ animate,
510
+ transitionEnd
511
+ ;
512
+ callback = $.isFunction(callback)
513
+ ? callback
514
+ : function(){}
515
+ ;
516
+ module.verbose('Removing context push state', module.get.direction());
517
+
518
+ module.unbind.clickaway();
519
+ module.unbind.scrollLock();
520
+
521
+ animate = function() {
522
+ module.set.transition(transition);
523
+ module.set.animating();
524
+ module.remove.visible();
525
+ if(settings.dimPage && !module.othersVisible()) {
526
+ $pusher.removeClass(className.dimmed);
527
+ }
528
+ };
529
+ transitionEnd = function(event) {
530
+ if( event.target == $transition[0] ) {
531
+ $transition.off(transitionEvent + elementNamespace, transitionEnd);
532
+ module.remove.animating();
533
+ module.remove.transition();
534
+ module.remove.inlineCSS();
535
+ if(transition == 'scale down' || (settings.returnScroll && module.is.mobile()) ) {
536
+ module.scrollBack();
537
+ }
538
+ callback.call(element);
539
+ }
540
+ };
541
+ $transition.off(transitionEvent + elementNamespace);
542
+ $transition.on(transitionEvent + elementNamespace, transitionEnd);
543
+ requestAnimationFrame(animate);
544
+ },
545
+
546
+ scrollToTop: function() {
547
+ module.verbose('Scrolling to top of page to avoid animation issues');
548
+ currentScroll = $(window).scrollTop();
549
+ $module.scrollTop(0);
550
+ window.scrollTo(0, 0);
551
+ },
552
+
553
+ scrollBack: function() {
554
+ module.verbose('Scrolling back to original page position');
555
+ window.scrollTo(0, currentScroll);
556
+ },
557
+
558
+ clear: {
559
+ cache: function() {
560
+ module.verbose('Clearing cached dimensions');
561
+ module.cache = {};
562
+ }
563
+ },
564
+
565
+ set: {
566
+
567
+ // ios only (scroll on html not document). This prevent auto-resize canvas/scroll in ios
568
+ // (This is no longer necessary in latest iOS)
569
+ ios: function() {
570
+ $html.addClass(className.ios);
571
+ },
572
+
573
+ // container
574
+ pushed: function() {
575
+ $context.addClass(className.pushed);
576
+ },
577
+ pushable: function() {
578
+ $context.addClass(className.pushable);
579
+ },
580
+
581
+ // pusher
582
+ dimmed: function() {
583
+ $pusher.addClass(className.dimmed);
584
+ },
585
+
586
+ // sidebar
587
+ active: function() {
588
+ $module.addClass(className.active);
589
+ },
590
+ animating: function() {
591
+ $module.addClass(className.animating);
592
+ },
593
+ transition: function(transition) {
594
+ transition = transition || module.get.transition();
595
+ $module.addClass(transition);
596
+ },
597
+ direction: function(direction) {
598
+ direction = direction || module.get.direction();
599
+ $module.addClass(className[direction]);
600
+ },
601
+ visible: function() {
602
+ $module.addClass(className.visible);
603
+ },
604
+ overlay: function() {
605
+ $module.addClass(className.overlay);
606
+ }
607
+ },
608
+ remove: {
609
+
610
+ inlineCSS: function() {
611
+ module.debug('Removing inline css styles', $style);
612
+ if($style && $style.length > 0) {
613
+ $style.remove();
614
+ }
615
+ },
616
+
617
+ // ios scroll on html not document
618
+ ios: function() {
619
+ $html.removeClass(className.ios);
620
+ },
621
+
622
+ // context
623
+ pushed: function() {
624
+ $context.removeClass(className.pushed);
625
+ },
626
+ pushable: function() {
627
+ $context.removeClass(className.pushable);
628
+ },
629
+
630
+ // sidebar
631
+ active: function() {
632
+ $module.removeClass(className.active);
633
+ },
634
+ animating: function() {
635
+ $module.removeClass(className.animating);
636
+ },
637
+ transition: function(transition) {
638
+ transition = transition || module.get.transition();
639
+ $module.removeClass(transition);
640
+ },
641
+ direction: function(direction) {
642
+ direction = direction || module.get.direction();
643
+ $module.removeClass(className[direction]);
644
+ },
645
+ visible: function() {
646
+ $module.removeClass(className.visible);
647
+ },
648
+ overlay: function() {
649
+ $module.removeClass(className.overlay);
650
+ }
651
+ },
652
+
653
+ get: {
654
+ direction: function() {
655
+ if($module.hasClass(className.top)) {
656
+ return className.top;
657
+ }
658
+ else if($module.hasClass(className.right)) {
659
+ return className.right;
660
+ }
661
+ else if($module.hasClass(className.bottom)) {
662
+ return className.bottom;
663
+ }
664
+ return className.left;
665
+ },
666
+ transition: function() {
667
+ var
668
+ direction = module.get.direction(),
669
+ transition
670
+ ;
671
+ transition = ( module.is.mobile() )
672
+ ? (settings.mobileTransition == 'auto')
673
+ ? settings.defaultTransition.mobile[direction]
674
+ : settings.mobileTransition
675
+ : (settings.transition == 'auto')
676
+ ? settings.defaultTransition.computer[direction]
677
+ : settings.transition
678
+ ;
679
+ module.verbose('Determined transition', transition);
680
+ return transition;
681
+ },
682
+ transitionEvent: function() {
683
+ var
684
+ element = document.createElement('element'),
685
+ transitions = {
686
+ 'transition' :'transitionend',
687
+ 'OTransition' :'oTransitionEnd',
688
+ 'MozTransition' :'transitionend',
689
+ 'WebkitTransition' :'webkitTransitionEnd'
690
+ },
691
+ transition
692
+ ;
693
+ for(transition in transitions){
694
+ if( element.style[transition] !== undefined ){
695
+ return transitions[transition];
696
+ }
697
+ }
698
+ }
699
+ },
700
+
701
+ is: {
702
+
703
+ ie: function() {
704
+ var
705
+ isIE11 = (!(window.ActiveXObject) && 'ActiveXObject' in window),
706
+ isIE = ('ActiveXObject' in window)
707
+ ;
708
+ return (isIE11 || isIE);
709
+ },
710
+
711
+ ios: function() {
712
+ var
713
+ userAgent = navigator.userAgent,
714
+ isIOS = userAgent.match(regExp.ios),
715
+ isMobileChrome = userAgent.match(regExp.mobileChrome)
716
+ ;
717
+ if(isIOS && !isMobileChrome) {
718
+ module.verbose('Browser was found to be iOS', userAgent);
719
+ return true;
720
+ }
721
+ else {
722
+ return false;
723
+ }
724
+ },
725
+ mobile: function() {
726
+ var
727
+ userAgent = navigator.userAgent,
728
+ isMobile = userAgent.match(regExp.mobile)
729
+ ;
730
+ if(isMobile) {
731
+ module.verbose('Browser was found to be mobile', userAgent);
732
+ return true;
733
+ }
734
+ else {
735
+ module.verbose('Browser is not mobile, using regular transition', userAgent);
736
+ return false;
737
+ }
738
+ },
739
+ hidden: function() {
740
+ return !module.is.visible();
741
+ },
742
+ visible: function() {
743
+ return $module.hasClass(className.visible);
744
+ },
745
+ // alias
746
+ open: function() {
747
+ return module.is.visible();
748
+ },
749
+ closed: function() {
750
+ return module.is.hidden();
751
+ },
752
+ vertical: function() {
753
+ return $module.hasClass(className.top);
754
+ },
755
+ animating: function() {
756
+ return $context.hasClass(className.animating);
757
+ },
758
+ rtl: function () {
759
+ if(module.cache.rtl === undefined) {
760
+ module.cache.rtl = ($module.css('direction') == 'rtl');
761
+ }
762
+ return module.cache.rtl;
763
+ }
764
+ },
765
+
766
+ setting: function(name, value) {
767
+ module.debug('Changing setting', name, value);
768
+ if( $.isPlainObject(name) ) {
769
+ $.extend(true, settings, name);
770
+ }
771
+ else if(value !== undefined) {
772
+ if($.isPlainObject(settings[name])) {
773
+ $.extend(true, settings[name], value);
774
+ }
775
+ else {
776
+ settings[name] = value;
777
+ }
778
+ }
779
+ else {
780
+ return settings[name];
781
+ }
782
+ },
783
+ internal: function(name, value) {
784
+ if( $.isPlainObject(name) ) {
785
+ $.extend(true, module, name);
786
+ }
787
+ else if(value !== undefined) {
788
+ module[name] = value;
789
+ }
790
+ else {
791
+ return module[name];
792
+ }
793
+ },
794
+ debug: function() {
795
+ if(!settings.silent && settings.debug) {
796
+ if(settings.performance) {
797
+ module.performance.log(arguments);
798
+ }
799
+ else {
800
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
801
+ module.debug.apply(console, arguments);
802
+ }
803
+ }
804
+ },
805
+ verbose: function() {
806
+ if(!settings.silent && settings.verbose && settings.debug) {
807
+ if(settings.performance) {
808
+ module.performance.log(arguments);
809
+ }
810
+ else {
811
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
812
+ module.verbose.apply(console, arguments);
813
+ }
814
+ }
815
+ },
816
+ error: function() {
817
+ if(!settings.silent) {
818
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
819
+ module.error.apply(console, arguments);
820
+ }
821
+ },
822
+ performance: {
823
+ log: function(message) {
824
+ var
825
+ currentTime,
826
+ executionTime,
827
+ previousTime
828
+ ;
829
+ if(settings.performance) {
830
+ currentTime = new Date().getTime();
831
+ previousTime = time || currentTime;
832
+ executionTime = currentTime - previousTime;
833
+ time = currentTime;
834
+ performance.push({
835
+ 'Name' : message[0],
836
+ 'Arguments' : [].slice.call(message, 1) || '',
837
+ 'Element' : element,
838
+ 'Execution Time' : executionTime
839
+ });
840
+ }
841
+ clearTimeout(module.performance.timer);
842
+ module.performance.timer = setTimeout(module.performance.display, 500);
843
+ },
844
+ display: function() {
845
+ var
846
+ title = settings.name + ':',
847
+ totalTime = 0
848
+ ;
849
+ time = false;
850
+ clearTimeout(module.performance.timer);
851
+ $.each(performance, function(index, data) {
852
+ totalTime += data['Execution Time'];
853
+ });
854
+ title += ' ' + totalTime + 'ms';
855
+ if(moduleSelector) {
856
+ title += ' \'' + moduleSelector + '\'';
857
+ }
858
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
859
+ console.groupCollapsed(title);
860
+ if(console.table) {
861
+ console.table(performance);
862
+ }
863
+ else {
864
+ $.each(performance, function(index, data) {
865
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
866
+ });
867
+ }
868
+ console.groupEnd();
869
+ }
870
+ performance = [];
871
+ }
872
+ },
873
+ invoke: function(query, passedArguments, context) {
874
+ var
875
+ object = instance,
876
+ maxDepth,
877
+ found,
878
+ response
879
+ ;
880
+ passedArguments = passedArguments || queryArguments;
881
+ context = element || context;
882
+ if(typeof query == 'string' && object !== undefined) {
883
+ query = query.split(/[\. ]/);
884
+ maxDepth = query.length - 1;
885
+ $.each(query, function(depth, value) {
886
+ var camelCaseValue = (depth != maxDepth)
887
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
888
+ : query
889
+ ;
890
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
891
+ object = object[camelCaseValue];
892
+ }
893
+ else if( object[camelCaseValue] !== undefined ) {
894
+ found = object[camelCaseValue];
895
+ return false;
896
+ }
897
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
898
+ object = object[value];
899
+ }
900
+ else if( object[value] !== undefined ) {
901
+ found = object[value];
902
+ return false;
903
+ }
904
+ else {
905
+ module.error(error.method, query);
906
+ return false;
907
+ }
908
+ });
909
+ }
910
+ if ( $.isFunction( found ) ) {
911
+ response = found.apply(context, passedArguments);
912
+ }
913
+ else if(found !== undefined) {
914
+ response = found;
915
+ }
916
+ if($.isArray(returnedValue)) {
917
+ returnedValue.push(response);
918
+ }
919
+ else if(returnedValue !== undefined) {
920
+ returnedValue = [returnedValue, response];
921
+ }
922
+ else if(response !== undefined) {
923
+ returnedValue = response;
924
+ }
925
+ return found;
926
+ }
927
+ }
928
+ ;
929
+
930
+ if(methodInvoked) {
931
+ if(instance === undefined) {
932
+ module.initialize();
933
+ }
934
+ module.invoke(query);
935
+ }
936
+ else {
937
+ if(instance !== undefined) {
938
+ module.invoke('destroy');
939
+ }
940
+ module.initialize();
941
+ }
942
+ });
943
+
944
+ return (returnedValue !== undefined)
945
+ ? returnedValue
946
+ : this
947
+ ;
948
+ };
949
+
950
+ $.fn.sidebar.settings = {
951
+
952
+ name : 'Sidebar',
953
+ namespace : 'sidebar',
954
+
955
+ silent : false,
956
+ debug : false,
957
+ verbose : false,
958
+ performance : true,
959
+
960
+ transition : 'auto',
961
+ mobileTransition : 'auto',
962
+
963
+ defaultTransition : {
964
+ computer: {
965
+ left : 'uncover',
966
+ right : 'uncover',
967
+ top : 'overlay',
968
+ bottom : 'overlay'
969
+ },
970
+ mobile: {
971
+ left : 'uncover',
972
+ right : 'uncover',
973
+ top : 'overlay',
974
+ bottom : 'overlay'
975
+ }
976
+ },
977
+
978
+ context : 'body',
979
+ exclusive : false,
980
+ closable : true,
981
+ dimPage : true,
982
+ scrollLock : false,
983
+ returnScroll : false,
984
+ delaySetup : false,
985
+
986
+ duration : 500,
987
+
988
+ onChange : function(){},
989
+ onShow : function(){},
990
+ onHide : function(){},
991
+
992
+ onHidden : function(){},
993
+ onVisible : function(){},
994
+
995
+ className : {
996
+ active : 'active',
997
+ animating : 'animating',
998
+ dimmed : 'dimmed',
999
+ ios : 'ios',
1000
+ pushable : 'pushable',
1001
+ pushed : 'pushed',
1002
+ right : 'right',
1003
+ top : 'top',
1004
+ left : 'left',
1005
+ bottom : 'bottom',
1006
+ visible : 'visible'
1007
+ },
1008
+
1009
+ selector: {
1010
+ fixed : '.fixed',
1011
+ omitted : 'script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed',
1012
+ pusher : '.pusher',
1013
+ sidebar : '.ui.sidebar'
1014
+ },
1015
+
1016
+ regExp: {
1017
+ ios : /(iPad|iPhone|iPod)/g,
1018
+ mobileChrome : /(CriOS)/g,
1019
+ mobile : /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g
1020
+ },
1021
+
1022
+ error : {
1023
+ method : 'The method you called is not defined.',
1024
+ pusher : 'Had to add pusher element. For optimal performance make sure body content is inside a pusher element',
1025
+ movedSidebar : 'Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag',
1026
+ overlay : 'The overlay setting is no longer supported, use animation: overlay',
1027
+ notFound : 'There were no elements that matched the specified selector'
1028
+ }
1029
+
1030
+ };
1031
+
1032
+
1033
+ })( jQuery, window, document );