semantic-ui-sass 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +51 -0
  6. data/Rakefile +5 -0
  7. data/app/assets/fonts/semantic-ui/basic.icons.eot +0 -0
  8. data/app/assets/fonts/semantic-ui/basic.icons.svg +450 -0
  9. data/app/assets/fonts/semantic-ui/basic.icons.ttf +0 -0
  10. data/app/assets/fonts/semantic-ui/basic.icons.woff +0 -0
  11. data/app/assets/fonts/semantic-ui/icons.eot +0 -0
  12. data/app/assets/fonts/semantic-ui/icons.otf +0 -0
  13. data/app/assets/fonts/semantic-ui/icons.svg +399 -0
  14. data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
  15. data/app/assets/fonts/semantic-ui/icons.woff +0 -0
  16. data/app/assets/images/semantic-ui/loader-large-inverted.gif +0 -0
  17. data/app/assets/images/semantic-ui/loader-large.gif +0 -0
  18. data/app/assets/images/semantic-ui/loader-medium-inverted.gif +0 -0
  19. data/app/assets/images/semantic-ui/loader-medium.gif +0 -0
  20. data/app/assets/images/semantic-ui/loader-mini-inverted.gif +0 -0
  21. data/app/assets/images/semantic-ui/loader-mini.gif +0 -0
  22. data/app/assets/images/semantic-ui/loader-small-inverted.gif +0 -0
  23. data/app/assets/images/semantic-ui/loader-small.gif +0 -0
  24. data/app/assets/javascripts/semantic-ui.js +20 -0
  25. data/app/assets/javascripts/semantic-ui/accordion.js +419 -0
  26. data/app/assets/javascripts/semantic-ui/behavior/api.js +638 -0
  27. data/app/assets/javascripts/semantic-ui/behavior/colorize.js +270 -0
  28. data/app/assets/javascripts/semantic-ui/behavior/form.js +702 -0
  29. data/app/assets/javascripts/semantic-ui/behavior/state.js +725 -0
  30. data/app/assets/javascripts/semantic-ui/chatroom.js +769 -0
  31. data/app/assets/javascripts/semantic-ui/checkbox.js +344 -0
  32. data/app/assets/javascripts/semantic-ui/dimmer.js +564 -0
  33. data/app/assets/javascripts/semantic-ui/dropdown.js +724 -0
  34. data/app/assets/javascripts/semantic-ui/modal.js +553 -0
  35. data/app/assets/javascripts/semantic-ui/nag.js +545 -0
  36. data/app/assets/javascripts/semantic-ui/popup.js +727 -0
  37. data/app/assets/javascripts/semantic-ui/rating.js +403 -0
  38. data/app/assets/javascripts/semantic-ui/search.js +772 -0
  39. data/app/assets/javascripts/semantic-ui/shape.js +778 -0
  40. data/app/assets/javascripts/semantic-ui/sidebar.js +490 -0
  41. data/app/assets/javascripts/semantic-ui/tab.js +689 -0
  42. data/app/assets/javascripts/semantic-ui/transition.js +654 -0
  43. data/app/assets/javascripts/semantic-ui/video.js +457 -0
  44. data/app/assets/stylesheets/semantic-ui.scss +4 -0
  45. data/app/assets/stylesheets/semantic-ui/collections/_all.scss +6 -0
  46. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +77 -0
  47. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +569 -0
  48. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +643 -0
  49. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +1767 -0
  50. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +347 -0
  51. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +524 -0
  52. data/app/assets/stylesheets/semantic-ui/elements/_all.scss +12 -0
  53. data/app/assets/stylesheets/semantic-ui/elements/_basic.icon.scss +479 -0
  54. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +1187 -0
  55. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +199 -0
  56. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +342 -0
  57. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +772 -0
  58. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +181 -0
  59. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +338 -0
  60. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +827 -0
  61. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +185 -0
  62. data/app/assets/stylesheets/semantic-ui/elements/_progress.scss +352 -0
  63. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +464 -0
  64. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +293 -0
  65. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +199 -0
  66. data/app/assets/stylesheets/semantic-ui/modules/_all.scss +16 -0
  67. data/app/assets/stylesheets/semantic-ui/modules/_chatroom.scss +281 -0
  68. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +481 -0
  69. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +236 -0
  70. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +548 -0
  71. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +217 -0
  72. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +173 -0
  73. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +255 -0
  74. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +179 -0
  75. data/app/assets/stylesheets/semantic-ui/modules/_reveal.scss +365 -0
  76. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +273 -0
  77. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +113 -0
  78. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +150 -0
  79. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +63 -0
  80. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1096 -0
  81. data/app/assets/stylesheets/semantic-ui/modules/_video.scss +98 -0
  82. data/app/assets/stylesheets/semantic-ui/views/_all.scss +5 -0
  83. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +221 -0
  84. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +152 -0
  85. data/app/assets/stylesheets/semantic-ui/views/_item.scss +651 -0
  86. data/app/assets/stylesheets/semantic-ui/views/_list.scss +555 -0
  87. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +27 -0
  88. data/lib/semantic/ui/sass.rb +10 -0
  89. data/lib/semantic/ui/sass/engine.rb +13 -0
  90. data/lib/semantic/ui/sass/version.rb +8 -0
  91. data/semantic-ui-sass.gemspec +24 -0
  92. data/tasks/converter.rb +237 -0
  93. metadata +177 -0
@@ -0,0 +1,344 @@
1
+ /*
2
+ * # Semantic - Checkbox
3
+ * http://github.com/jlukic/semantic-ui/
4
+ *
5
+ *
6
+ * Copyright 2013 Contributors
7
+ * Released under the MIT license
8
+ * http://opensource.org/licenses/MIT
9
+ *
10
+ */
11
+
12
+ ;(function ( $, window, document, undefined ) {
13
+
14
+ $.fn.checkbox = function(parameters) {
15
+ var
16
+ $allModules = $(this),
17
+
18
+ settings = $.extend(true, {}, $.fn.checkbox.settings, parameters),
19
+
20
+ className = settings.className,
21
+ namespace = settings.namespace,
22
+ error = settings.error,
23
+
24
+ eventNamespace = '.' + namespace,
25
+ moduleNamespace = 'module-' + namespace,
26
+
27
+ moduleSelector = $allModules.selector || '',
28
+
29
+ time = new Date().getTime(),
30
+ performance = [],
31
+
32
+ query = arguments[0],
33
+ methodInvoked = (typeof query == 'string'),
34
+ queryArguments = [].slice.call(arguments, 1),
35
+ invokedResponse
36
+ ;
37
+
38
+ $allModules
39
+ .each(function() {
40
+ var
41
+ $module = $(this),
42
+ $label = $(this).next(settings.selector.label).first(),
43
+ $input = $(this).find(settings.selector.input),
44
+
45
+ selector = $module.selector || '',
46
+ instance = $module.data(moduleNamespace),
47
+
48
+ element = this,
49
+ module
50
+ ;
51
+
52
+ module = {
53
+
54
+ initialize: function() {
55
+ module.verbose('Initializing checkbox', settings);
56
+ if(settings.context && selector !== '') {
57
+ module.verbose('Adding delegated events');
58
+ $(element, settings.context)
59
+ .on(selector, 'click' + eventNamespace, module.toggle)
60
+ .on(selector + ' + ' + settings.selector.label, 'click' + eventNamespace, module.toggle)
61
+ ;
62
+ }
63
+ else {
64
+ $module
65
+ .on('click' + eventNamespace, module.toggle)
66
+ .data(moduleNamespace, module)
67
+ ;
68
+ $label
69
+ .on('click' + eventNamespace, module.toggle)
70
+ ;
71
+ }
72
+ module.instantiate();
73
+ },
74
+
75
+ instantiate: function() {
76
+ module.verbose('Storing instance of module', module);
77
+ instance = module;
78
+ $module
79
+ .data(moduleNamespace, module)
80
+ ;
81
+ },
82
+
83
+ destroy: function() {
84
+ module.verbose('Destroying previous module');
85
+ $module
86
+ .off(eventNamespace)
87
+ .removeData(moduleNamespace)
88
+ ;
89
+ },
90
+
91
+ is: {
92
+ radio: function() {
93
+ return $module.hasClass(className.radio);
94
+ }
95
+ },
96
+
97
+ can: {
98
+ disable: function() {
99
+ return (typeof settings.required === 'boolean')
100
+ ? settings.required
101
+ : !module.is.radio()
102
+ ;
103
+ }
104
+ },
105
+
106
+ enable: function() {
107
+ module.debug('Enabling checkbox', $input);
108
+ $input
109
+ .prop('checked', true)
110
+ ;
111
+ $.proxy(settings.onChange, $input.get())();
112
+ $.proxy(settings.onEnable, $input.get())();
113
+ },
114
+
115
+ disable: function() {
116
+ module.debug('Disabling checkbox');
117
+ $input
118
+ .prop('checked', false)
119
+ ;
120
+ $.proxy(settings.onChange, $input.get())();
121
+ $.proxy(settings.onDisable, $input.get())();
122
+ },
123
+
124
+ toggle: function(event) {
125
+ module.verbose('Determining new checkbox state');
126
+ if($input.prop('checked') === undefined || !$input.prop('checked')) {
127
+ module.enable();
128
+ }
129
+ else if( module.can.disable() ) {
130
+ module.disable();
131
+ }
132
+ },
133
+ setting: function(name, value) {
134
+ if(value !== undefined) {
135
+ if( $.isPlainObject(name) ) {
136
+ $.extend(true, settings, name);
137
+ }
138
+ else {
139
+ settings[name] = value;
140
+ }
141
+ }
142
+ else {
143
+ return settings[name];
144
+ }
145
+ },
146
+ internal: function(name, value) {
147
+ if(value !== undefined) {
148
+ if( $.isPlainObject(name) ) {
149
+ $.extend(true, module, name);
150
+ }
151
+ else {
152
+ module[name] = value;
153
+ }
154
+ }
155
+ else {
156
+ return module[name];
157
+ }
158
+ },
159
+ debug: function() {
160
+ if(settings.debug) {
161
+ if(settings.performance) {
162
+ module.performance.log(arguments);
163
+ }
164
+ else {
165
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
166
+ module.debug.apply(console, arguments);
167
+ }
168
+ }
169
+ },
170
+ verbose: function() {
171
+ if(settings.verbose && settings.debug) {
172
+ if(settings.performance) {
173
+ module.performance.log(arguments);
174
+ }
175
+ else {
176
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
177
+ module.verbose.apply(console, arguments);
178
+ }
179
+ }
180
+ },
181
+ error: function() {
182
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
183
+ module.error.apply(console, arguments);
184
+ },
185
+ performance: {
186
+ log: function(message) {
187
+ var
188
+ currentTime,
189
+ executionTime,
190
+ previousTime
191
+ ;
192
+ if(settings.performance) {
193
+ currentTime = new Date().getTime();
194
+ previousTime = time || currentTime;
195
+ executionTime = currentTime - previousTime;
196
+ time = currentTime;
197
+ performance.push({
198
+ 'Element' : element,
199
+ 'Name' : message[0],
200
+ 'Arguments' : [].slice.call(message, 1) || '',
201
+ 'Execution Time' : executionTime
202
+ });
203
+ }
204
+ clearTimeout(module.performance.timer);
205
+ module.performance.timer = setTimeout(module.performance.display, 100);
206
+ },
207
+ display: function() {
208
+ var
209
+ title = settings.name + ':',
210
+ totalTime = 0
211
+ ;
212
+ time = false;
213
+ clearTimeout(module.performance.timer);
214
+ $.each(performance, function(index, data) {
215
+ totalTime += data['Execution Time'];
216
+ });
217
+ title += ' ' + totalTime + 'ms';
218
+ if(moduleSelector) {
219
+ title += ' \'' + moduleSelector + '\'';
220
+ }
221
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
222
+ console.groupCollapsed(title);
223
+ if(console.table) {
224
+ console.table(performance);
225
+ }
226
+ else {
227
+ $.each(performance, function(index, data) {
228
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
229
+ });
230
+ }
231
+ console.groupEnd();
232
+ }
233
+ performance = [];
234
+ }
235
+ },
236
+ invoke: function(query, passedArguments, context) {
237
+ var
238
+ maxDepth,
239
+ found,
240
+ response
241
+ ;
242
+ passedArguments = passedArguments || queryArguments;
243
+ context = element || context;
244
+ if(typeof query == 'string' && instance !== undefined) {
245
+ query = query.split(/[\. ]/);
246
+ maxDepth = query.length - 1;
247
+ $.each(query, function(depth, value) {
248
+ var camelCaseValue = (depth != maxDepth)
249
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
250
+ : query
251
+ ;
252
+ if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) {
253
+ instance = instance[value];
254
+ }
255
+ else if( $.isPlainObject( instance[camelCaseValue] ) && (depth != maxDepth) ) {
256
+ instance = instance[camelCaseValue];
257
+ }
258
+ else if( instance[value] !== undefined ) {
259
+ found = instance[value];
260
+ return false;
261
+ }
262
+ else if( instance[camelCaseValue] !== undefined ) {
263
+ found = instance[camelCaseValue];
264
+ return false;
265
+ }
266
+ else {
267
+ module.error(error.method);
268
+ return false;
269
+ }
270
+ });
271
+ }
272
+ if ( $.isFunction( found ) ) {
273
+ response = found.apply(context, passedArguments);
274
+ }
275
+ else if(found !== undefined) {
276
+ response = found;
277
+ }
278
+ if($.isArray(invokedResponse)) {
279
+ invokedResponse.push(response);
280
+ }
281
+ else if(typeof invokedResponse == 'string') {
282
+ invokedResponse = [invokedResponse, response];
283
+ }
284
+ else if(response !== undefined) {
285
+ invokedResponse = response;
286
+ }
287
+ return found;
288
+ }
289
+ };
290
+
291
+ if(methodInvoked) {
292
+ if(instance === undefined) {
293
+ module.initialize();
294
+ }
295
+ module.invoke(query);
296
+ }
297
+ else {
298
+ if(instance !== undefined) {
299
+ module.destroy();
300
+ }
301
+ module.initialize();
302
+ }
303
+ })
304
+ ;
305
+
306
+ return (invokedResponse !== undefined)
307
+ ? invokedResponse
308
+ : this
309
+ ;
310
+ };
311
+
312
+ $.fn.checkbox.settings = {
313
+
314
+ name : 'Checkbox',
315
+ namespace : 'checkbox',
316
+
317
+ verbose : true,
318
+ debug : true,
319
+ performance : true,
320
+
321
+ // delegated event context
322
+ context : false,
323
+ required : 'auto',
324
+
325
+ onChange : function(){},
326
+ onEnable : function(){},
327
+ onDisable : function(){},
328
+
329
+ error : {
330
+ method : 'The method you called is not defined.'
331
+ },
332
+
333
+ selector : {
334
+ input : 'input[type=checkbox], input[type=radio]',
335
+ label : 'label'
336
+ },
337
+
338
+ className : {
339
+ radio : 'radio'
340
+ }
341
+
342
+ };
343
+
344
+ })( jQuery, window , document );
@@ -0,0 +1,564 @@
1
+ /*
2
+ * # Semantic - Dimmer
3
+ * http://github.com/jlukic/semantic-ui/
4
+ *
5
+ *
6
+ * Copyright 2013 Contributors
7
+ * Released under the MIT license
8
+ * http://opensource.org/licenses/MIT
9
+ *
10
+ */
11
+
12
+ ;(function ( $, window, document, undefined ) {
13
+
14
+ $.fn.dimmer = function(parameters) {
15
+ var
16
+ $allModules = $(this),
17
+
18
+ settings = ( $.isPlainObject(parameters) )
19
+ ? $.extend(true, {}, $.fn.dimmer.settings, parameters)
20
+ : $.fn.dimmer.settings,
21
+
22
+ selector = settings.selector,
23
+ namespace = settings.namespace,
24
+ className = settings.className,
25
+ error = settings.error,
26
+
27
+ eventNamespace = '.' + namespace,
28
+ moduleNamespace = 'module-' + namespace,
29
+ moduleSelector = $allModules.selector || '',
30
+
31
+ time = new Date().getTime(),
32
+ performance = [],
33
+
34
+ query = arguments[0],
35
+ methodInvoked = (typeof query == 'string'),
36
+ queryArguments = [].slice.call(arguments, 1),
37
+ clickEvent = ('ontouchstart' in document.documentElement)
38
+ ? 'touchstart'
39
+ : 'click',
40
+
41
+ invokedResponse
42
+ ;
43
+
44
+ $allModules
45
+ .each(function() {
46
+ var
47
+ $module = $(this),
48
+ $dimmer,
49
+ $dimmable,
50
+
51
+ element = this,
52
+ instance = $module.data(moduleNamespace),
53
+ module
54
+ ;
55
+
56
+ module = {
57
+
58
+ preinitialize: function() {
59
+ if( module.is.dimmer() ) {
60
+ $dimmable = $module.parent();
61
+ $dimmer = $module;
62
+ }
63
+ else {
64
+ $dimmable = $module;
65
+ if( module.has.dimmer() ) {
66
+ $dimmer = $dimmable.children(selector.dimmer).first();
67
+ }
68
+ else {
69
+ module.create();
70
+ }
71
+ }
72
+ },
73
+
74
+ initialize: function() {
75
+ module.debug('Initializing dimmer', settings);
76
+ if(settings.on == 'hover') {
77
+ $dimmable
78
+ .on('mouseenter' + eventNamespace, module.show)
79
+ .on('mouseleave' + eventNamespace, module.hide)
80
+ ;
81
+ }
82
+ else if(settings.on == 'click') {
83
+ $dimmable
84
+ .on(clickEvent + eventNamespace, module.toggle)
85
+ ;
86
+ }
87
+
88
+ if( module.is.page() ) {
89
+ module.debug('Setting as a page dimmer', $dimmable);
90
+ module.set.pageDimmer();
91
+ }
92
+
93
+ if(settings.closable) {
94
+ module.verbose('Adding dimmer close event', $dimmer);
95
+ $dimmer
96
+ .on(clickEvent + eventNamespace, module.event.click)
97
+ ;
98
+ }
99
+ module.set.dimmable();
100
+ module.instantiate();
101
+ },
102
+
103
+ instantiate: function() {
104
+ module.verbose('Storing instance of module', module);
105
+ instance = module;
106
+ $module
107
+ .data(moduleNamespace, instance)
108
+ ;
109
+ },
110
+
111
+ destroy: function() {
112
+ module.verbose('Destroying previous module', $dimmer);
113
+ $dimmable
114
+ .off(eventNamespace)
115
+ ;
116
+ $dimmer
117
+ .off(eventNamespace)
118
+ ;
119
+ },
120
+
121
+ event: {
122
+
123
+ click: function(event) {
124
+ module.verbose('Determining if event occured on dimmer', event);
125
+ if( $dimmer.find(event.target).size() === 0 || $(event.target).is(selector.content) ) {
126
+ module.hide();
127
+ event.stopImmediatePropagation();
128
+ }
129
+ }
130
+
131
+ },
132
+
133
+ addContent: function(element) {
134
+ var
135
+ $content = $(element).detach()
136
+ ;
137
+ module.debug('Add content to dimmer', $content);
138
+ if($content.parent()[0] !== $dimmer[0]) {
139
+ $dimmer.append($content);
140
+ }
141
+ },
142
+
143
+ create: function() {
144
+ $dimmer = $( settings.template.dimmer() );
145
+ return $dimmer.appendTo($dimmable);
146
+ },
147
+
148
+ animate: {
149
+ show: function(callback) {
150
+ callback = callback || function(){};
151
+ module.set.dimmed();
152
+ if($.fn.transition !== undefined) {
153
+ $dimmer
154
+ .transition(settings.transition + ' in', module.get.duration(), function() {
155
+ module.set.active();
156
+ callback();
157
+ })
158
+ ;
159
+ }
160
+ else {
161
+ module.verbose('Showing dimmer animation with javascript');
162
+ $dimmer
163
+ .stop()
164
+ .css({
165
+ opacity : 0,
166
+ width : '100%',
167
+ height : '100%'
168
+ })
169
+ .fadeTo(module.get.duration(), 1, function() {
170
+ $dimmer.removeAttr('style');
171
+ module.set.active();
172
+ callback();
173
+ })
174
+ ;
175
+ }
176
+ },
177
+ hide: function(callback) {
178
+ callback = callback || function(){};
179
+ module.remove.dimmed();
180
+ if($.fn.transition !== undefined) {
181
+ module.verbose('Hiding dimmer with css');
182
+ $dimmer
183
+ .transition(settings.transition + ' out', module.get.duration(), function() {
184
+ module.remove.active();
185
+ callback();
186
+ })
187
+ ;
188
+ }
189
+ else {
190
+ module.verbose('Hiding dimmer with javascript');
191
+ $dimmer
192
+ .stop()
193
+ .fadeOut(module.get.duration(), function() {
194
+ $dimmer.removeAttr('style');
195
+ module.remove.active();
196
+ callback();
197
+ })
198
+ ;
199
+ }
200
+ }
201
+ },
202
+
203
+ get: {
204
+ dimmer: function() {
205
+ return $dimmer;
206
+ },
207
+ duration: function() {
208
+ if(typeof settings.duration == 'object') {
209
+ if( module.is.active() ) {
210
+ return settings.duration.hide;
211
+ }
212
+ else {
213
+ return settings.duration.show;
214
+ }
215
+ }
216
+ return settings.duration;
217
+ }
218
+ },
219
+
220
+ has: {
221
+ dimmer: function() {
222
+ return ( $module.children(selector.dimmer).size() > 0 );
223
+ }
224
+ },
225
+
226
+ is: {
227
+ dimmer: function() {
228
+ return $module.is(selector.dimmer);
229
+ },
230
+ dimmable: function() {
231
+ return $module.is(selector.dimmable);
232
+ },
233
+ active: function() {
234
+ return $dimmer.hasClass(className.active);
235
+ },
236
+ animating: function() {
237
+ return ( $dimmer.is(':animated') || $dimmer.hasClass(className.transition) );
238
+ },
239
+ page: function () {
240
+ return $dimmable.is('body');
241
+ },
242
+ enabled: function() {
243
+ return !$dimmable.hasClass(className.disabled);
244
+ },
245
+ disabled: function() {
246
+ return $dimmable.hasClass(className.disabled);
247
+ },
248
+ pageDimmer: function() {
249
+ return $dimmer.hasClass(className.pageDimmer);
250
+ }
251
+ },
252
+
253
+ can: {
254
+ show: function() {
255
+ return !$dimmer.hasClass(className.disabled);
256
+ }
257
+ },
258
+
259
+ set: {
260
+ active: function() {
261
+ $dimmer
262
+ .removeClass(className.transition)
263
+ .addClass(className.active)
264
+ ;
265
+ },
266
+ dimmable: function() {
267
+ $dimmable.addClass(className.dimmable);
268
+ },
269
+ dimmed: function() {
270
+ $dimmable.addClass(className.dimmed);
271
+ },
272
+ pageDimmer: function() {
273
+ $dimmer.addClass(className.pageDimmer);
274
+ },
275
+ disabled: function() {
276
+ $dimmer.addClass(className.disabled);
277
+ }
278
+ },
279
+
280
+ remove: {
281
+ active: function() {
282
+ $dimmer
283
+ .removeClass(className.transition)
284
+ .removeClass(className.active)
285
+ ;
286
+ },
287
+ dimmed: function() {
288
+ $dimmable.removeClass(className.dimmed);
289
+ },
290
+ disabled: function() {
291
+ $dimmer.removeClass(className.disabled);
292
+ }
293
+ },
294
+
295
+ show: function(callback) {
296
+ module.debug('Showing dimmer', $dimmer, settings);
297
+ if( !(module.is.active() || module.is.animating() ) && module.is.enabled() ) {
298
+ module.animate.show(callback);
299
+ $.proxy(settings.onShow, element)();
300
+ $.proxy(settings.onChange, element)();
301
+ }
302
+ else {
303
+ module.debug('Dimmer is already shown or disabled');
304
+ }
305
+ },
306
+
307
+ hide: function(callback) {
308
+ if( module.is.active() && !module.is.animating() ) {
309
+ module.debug('Hiding dimmer', $dimmer);
310
+ module.animate.hide(callback);
311
+ $.proxy(settings.onHide, element)();
312
+ $.proxy(settings.onChange, element)();
313
+ }
314
+ else {
315
+ module.debug('Dimmer is not visible');
316
+ }
317
+ },
318
+
319
+ toggle: function() {
320
+ module.verbose('Toggling dimmer visibility', $dimmer);
321
+ if( !module.is.active() ) {
322
+ module.show();
323
+ }
324
+ else {
325
+ module.hide();
326
+ }
327
+ },
328
+
329
+ setting: function(name, value) {
330
+ if(value !== undefined) {
331
+ if( $.isPlainObject(name) ) {
332
+ $.extend(true, settings, name);
333
+ }
334
+ else {
335
+ settings[name] = value;
336
+ }
337
+ }
338
+ else {
339
+ return settings[name];
340
+ }
341
+ },
342
+ internal: function(name, value) {
343
+ if(value !== undefined) {
344
+ if( $.isPlainObject(name) ) {
345
+ $.extend(true, module, name);
346
+ }
347
+ else {
348
+ module[name] = value;
349
+ }
350
+ }
351
+ else {
352
+ return module[name];
353
+ }
354
+ },
355
+ debug: function() {
356
+ if(settings.debug) {
357
+ if(settings.performance) {
358
+ module.performance.log(arguments);
359
+ }
360
+ else {
361
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
362
+ module.debug.apply(console, arguments);
363
+ }
364
+ }
365
+ },
366
+ verbose: function() {
367
+ if(settings.verbose && settings.debug) {
368
+ if(settings.performance) {
369
+ module.performance.log(arguments);
370
+ }
371
+ else {
372
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
373
+ module.verbose.apply(console, arguments);
374
+ }
375
+ }
376
+ },
377
+ error: function() {
378
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
379
+ module.error.apply(console, arguments);
380
+ },
381
+ performance: {
382
+ log: function(message) {
383
+ var
384
+ currentTime,
385
+ executionTime,
386
+ previousTime
387
+ ;
388
+ if(settings.performance) {
389
+ currentTime = new Date().getTime();
390
+ previousTime = time || currentTime;
391
+ executionTime = currentTime - previousTime;
392
+ time = currentTime;
393
+ performance.push({
394
+ 'Element' : element,
395
+ 'Name' : message[0],
396
+ 'Arguments' : [].slice.call(message, 1) || '',
397
+ 'Execution Time' : executionTime
398
+ });
399
+ }
400
+ clearTimeout(module.performance.timer);
401
+ module.performance.timer = setTimeout(module.performance.display, 100);
402
+ },
403
+ display: function() {
404
+ var
405
+ title = settings.name + ':',
406
+ totalTime = 0
407
+ ;
408
+ time = false;
409
+ clearTimeout(module.performance.timer);
410
+ $.each(performance, function(index, data) {
411
+ totalTime += data['Execution Time'];
412
+ });
413
+ title += ' ' + totalTime + 'ms';
414
+ if(moduleSelector) {
415
+ title += ' \'' + moduleSelector + '\'';
416
+ }
417
+ if($allModules.size() > 1) {
418
+ title += ' ' + '(' + $allModules.size() + ')';
419
+ }
420
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
421
+ console.groupCollapsed(title);
422
+ if(console.table) {
423
+ console.table(performance);
424
+ }
425
+ else {
426
+ $.each(performance, function(index, data) {
427
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
428
+ });
429
+ }
430
+ console.groupEnd();
431
+ }
432
+ performance = [];
433
+ }
434
+ },
435
+ invoke: function(query, passedArguments, context) {
436
+ var
437
+ maxDepth,
438
+ found,
439
+ response
440
+ ;
441
+ passedArguments = passedArguments || queryArguments;
442
+ context = element || context;
443
+ if(typeof query == 'string' && instance !== undefined) {
444
+ query = query.split(/[\. ]/);
445
+ maxDepth = query.length - 1;
446
+ $.each(query, function(depth, value) {
447
+ var camelCaseValue = (depth != maxDepth)
448
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
449
+ : query
450
+ ;
451
+ if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) {
452
+ instance = instance[value];
453
+ }
454
+ else if( $.isPlainObject( instance[camelCaseValue] ) && (depth != maxDepth) ) {
455
+ instance = instance[camelCaseValue];
456
+ }
457
+ else if( instance[value] !== undefined ) {
458
+ found = instance[value];
459
+ return false;
460
+ }
461
+ else if( instance[camelCaseValue] !== undefined ) {
462
+ found = instance[camelCaseValue];
463
+ return false;
464
+ }
465
+ else {
466
+ module.error(error.method);
467
+ return false;
468
+ }
469
+ });
470
+ }
471
+ if ( $.isFunction( found ) ) {
472
+ response = found.apply(context, passedArguments);
473
+ }
474
+ else if(found !== undefined) {
475
+ response = found;
476
+ }
477
+ if($.isArray(invokedResponse)) {
478
+ invokedResponse.push(response);
479
+ }
480
+ else if(typeof invokedResponse == 'string') {
481
+ invokedResponse = [invokedResponse, response];
482
+ }
483
+ else if(response !== undefined) {
484
+ invokedResponse = response;
485
+ }
486
+ return found;
487
+ }
488
+ };
489
+
490
+ module.preinitialize();
491
+
492
+ if(methodInvoked) {
493
+ if(instance === undefined) {
494
+ module.initialize();
495
+ }
496
+ module.invoke(query);
497
+ }
498
+ else {
499
+ if(instance !== undefined) {
500
+ module.destroy();
501
+ }
502
+ module.initialize();
503
+ }
504
+ })
505
+ ;
506
+
507
+ return (invokedResponse !== undefined)
508
+ ? invokedResponse
509
+ : this
510
+ ;
511
+ };
512
+
513
+ $.fn.dimmer.settings = {
514
+
515
+ name : 'Dimmer',
516
+ namespace : 'dimmer',
517
+
518
+ verbose : true,
519
+ debug : true,
520
+ performance : true,
521
+
522
+ transition : 'fade',
523
+
524
+ on : false,
525
+ closable : true,
526
+ duration : {
527
+ show : 500,
528
+ hide : 500
529
+ },
530
+
531
+ onChange : function(){},
532
+ onShow : function(){},
533
+ onHide : function(){},
534
+
535
+ error : {
536
+ method : 'The method you called is not defined.'
537
+ },
538
+
539
+ selector: {
540
+ dimmable : '.ui.dimmable',
541
+ dimmer : '.ui.dimmer',
542
+ content : '.ui.dimmer > .content, .ui.dimmer > .content > .center'
543
+ },
544
+
545
+ template: {
546
+ dimmer: function() {
547
+ return $('<div />').attr('class', 'ui dimmer');
548
+ }
549
+ },
550
+
551
+ className : {
552
+ active : 'active',
553
+ dimmable : 'ui dimmable',
554
+ dimmed : 'dimmed',
555
+ disabled : 'disabled',
556
+ pageDimmer : 'page',
557
+ hide : 'hide',
558
+ show : 'show',
559
+ transition : 'transition'
560
+ }
561
+
562
+ };
563
+
564
+ })( jQuery, window , document );