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,280 @@
1
+ /*!
2
+ * # Semantic UI - Colorize
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.colorize = function(parameters) {
23
+ var
24
+ settings = ( $.isPlainObject(parameters) )
25
+ ? $.extend(true, {}, $.fn.colorize.settings, parameters)
26
+ : $.extend({}, $.fn.colorize.settings),
27
+ // hoist arguments
28
+ moduleArguments = arguments || false
29
+ ;
30
+ $(this)
31
+ .each(function(instanceIndex) {
32
+
33
+ var
34
+ $module = $(this),
35
+
36
+ mainCanvas = $('<canvas />')[0],
37
+ imageCanvas = $('<canvas />')[0],
38
+ overlayCanvas = $('<canvas />')[0],
39
+
40
+ backgroundImage = new Image(),
41
+
42
+ // defs
43
+ mainContext,
44
+ imageContext,
45
+ overlayContext,
46
+
47
+ image,
48
+ imageName,
49
+
50
+ width,
51
+ height,
52
+
53
+ // shortcuts
54
+ colors = settings.colors,
55
+ paths = settings.paths,
56
+ namespace = settings.namespace,
57
+ error = settings.error,
58
+
59
+ // boilerplate
60
+ instance = $module.data('module-' + namespace),
61
+ module
62
+ ;
63
+
64
+ module = {
65
+
66
+ checkPreconditions: function() {
67
+ module.debug('Checking pre-conditions');
68
+
69
+ if( !$.isPlainObject(colors) || $.isEmptyObject(colors) ) {
70
+ module.error(error.undefinedColors);
71
+ return false;
72
+ }
73
+ return true;
74
+ },
75
+
76
+ async: function(callback) {
77
+ if(settings.async) {
78
+ setTimeout(callback, 0);
79
+ }
80
+ else {
81
+ callback();
82
+ }
83
+ },
84
+
85
+ getMetadata: function() {
86
+ module.debug('Grabbing metadata');
87
+ image = $module.data('image') || settings.image || undefined;
88
+ imageName = $module.data('name') || settings.name || instanceIndex;
89
+ width = settings.width || $module.width();
90
+ height = settings.height || $module.height();
91
+ if(width === 0 || height === 0) {
92
+ module.error(error.undefinedSize);
93
+ }
94
+ },
95
+
96
+ initialize: function() {
97
+ module.debug('Initializing with colors', colors);
98
+ if( module.checkPreconditions() ) {
99
+
100
+ module.async(function() {
101
+ module.getMetadata();
102
+ module.canvas.create();
103
+
104
+ module.draw.image(function() {
105
+ module.draw.colors();
106
+ module.canvas.merge();
107
+ });
108
+ $module
109
+ .data('module-' + namespace, module)
110
+ ;
111
+ });
112
+ }
113
+ },
114
+
115
+ redraw: function() {
116
+ module.debug('Redrawing image');
117
+ module.async(function() {
118
+ module.canvas.clear();
119
+ module.draw.colors();
120
+ module.canvas.merge();
121
+ });
122
+ },
123
+
124
+ change: {
125
+ color: function(colorName, color) {
126
+ module.debug('Changing color', colorName);
127
+ if(colors[colorName] === undefined) {
128
+ module.error(error.missingColor);
129
+ return false;
130
+ }
131
+ colors[colorName] = color;
132
+ module.redraw();
133
+ }
134
+ },
135
+
136
+ canvas: {
137
+ create: function() {
138
+ module.debug('Creating canvases');
139
+
140
+ mainCanvas.width = width;
141
+ mainCanvas.height = height;
142
+ imageCanvas.width = width;
143
+ imageCanvas.height = height;
144
+ overlayCanvas.width = width;
145
+ overlayCanvas.height = height;
146
+
147
+ mainContext = mainCanvas.getContext('2d');
148
+ imageContext = imageCanvas.getContext('2d');
149
+ overlayContext = overlayCanvas.getContext('2d');
150
+
151
+ $module
152
+ .append( mainCanvas )
153
+ ;
154
+ mainContext = $module.children('canvas')[0].getContext('2d');
155
+ },
156
+ clear: function(context) {
157
+ module.debug('Clearing canvas');
158
+ overlayContext.fillStyle = '#FFFFFF';
159
+ overlayContext.fillRect(0, 0, width, height);
160
+ },
161
+ merge: function() {
162
+ if( !$.isFunction(mainContext.blendOnto) ) {
163
+ module.error(error.missingPlugin);
164
+ return;
165
+ }
166
+ mainContext.putImageData( imageContext.getImageData(0, 0, width, height), 0, 0);
167
+ overlayContext.blendOnto(mainContext, 'multiply');
168
+ }
169
+ },
170
+
171
+ draw: {
172
+
173
+ image: function(callback) {
174
+ module.debug('Drawing image');
175
+ callback = callback || function(){};
176
+ if(image) {
177
+ backgroundImage.src = image;
178
+ backgroundImage.onload = function() {
179
+ imageContext.drawImage(backgroundImage, 0, 0);
180
+ callback();
181
+ };
182
+ }
183
+ else {
184
+ module.error(error.noImage);
185
+ callback();
186
+ }
187
+ },
188
+
189
+ colors: function() {
190
+ module.debug('Drawing color overlays', colors);
191
+ $.each(colors, function(colorName, color) {
192
+ settings.onDraw(overlayContext, imageName, colorName, color);
193
+ });
194
+ }
195
+
196
+ },
197
+
198
+ debug: function(message, variableName) {
199
+ if(settings.debug) {
200
+ if(variableName !== undefined) {
201
+ console.info(settings.name + ': ' + message, variableName);
202
+ }
203
+ else {
204
+ console.info(settings.name + ': ' + message);
205
+ }
206
+ }
207
+ },
208
+ error: function(errorMessage) {
209
+ console.warn(settings.name + ': ' + errorMessage);
210
+ },
211
+ invoke: function(methodName, context, methodArguments) {
212
+ var
213
+ method
214
+ ;
215
+ methodArguments = methodArguments || Array.prototype.slice.call( arguments, 2 );
216
+
217
+ if(typeof methodName == 'string' && instance !== undefined) {
218
+ methodName = methodName.split('.');
219
+ $.each(methodName, function(index, name) {
220
+ if( $.isPlainObject( instance[name] ) ) {
221
+ instance = instance[name];
222
+ return true;
223
+ }
224
+ else if( $.isFunction( instance[name] ) ) {
225
+ method = instance[name];
226
+ return true;
227
+ }
228
+ module.error(settings.error.method);
229
+ return false;
230
+ });
231
+ }
232
+ return ( $.isFunction( method ) )
233
+ ? method.apply(context, methodArguments)
234
+ : false
235
+ ;
236
+ }
237
+
238
+ };
239
+ if(instance !== undefined && moduleArguments) {
240
+ // simpler than invoke realizing to invoke itself (and losing scope due prototype.call()
241
+ if(moduleArguments[0] == 'invoke') {
242
+ moduleArguments = Array.prototype.slice.call( moduleArguments, 1 );
243
+ }
244
+ return module.invoke(moduleArguments[0], this, Array.prototype.slice.call( moduleArguments, 1 ) );
245
+ }
246
+ // initializing
247
+ module.initialize();
248
+ })
249
+ ;
250
+ return this;
251
+ };
252
+
253
+ $.fn.colorize.settings = {
254
+ name : 'Image Colorizer',
255
+ debug : true,
256
+ namespace : 'colorize',
257
+
258
+ onDraw : function(overlayContext, imageName, colorName, color) {},
259
+
260
+ // whether to block execution while updating canvas
261
+ async : true,
262
+ // object containing names and default values of color regions
263
+ colors : {},
264
+
265
+ metadata: {
266
+ image : 'image',
267
+ name : 'name'
268
+ },
269
+
270
+ error: {
271
+ noImage : 'No tracing image specified',
272
+ undefinedColors : 'No default colors specified.',
273
+ missingColor : 'Attempted to change color that does not exist',
274
+ missingPlugin : 'Blend onto plug-in must be included',
275
+ undefinedHeight : 'The width or height of image canvas could not be automatically determined. Please specify a height.'
276
+ }
277
+
278
+ };
279
+
280
+ })( jQuery, window, document );
@@ -0,0 +1,735 @@
1
+ /*!
2
+ * # Semantic UI - Dimmer
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.dimmer = function(parameters) {
23
+ var
24
+ $allModules = $(this),
25
+
26
+ time = new Date().getTime(),
27
+ performance = [],
28
+
29
+ query = arguments[0],
30
+ methodInvoked = (typeof query == 'string'),
31
+ queryArguments = [].slice.call(arguments, 1),
32
+
33
+ returnedValue
34
+ ;
35
+
36
+ $allModules
37
+ .each(function() {
38
+ var
39
+ settings = ( $.isPlainObject(parameters) )
40
+ ? $.extend(true, {}, $.fn.dimmer.settings, parameters)
41
+ : $.extend({}, $.fn.dimmer.settings),
42
+
43
+ selector = settings.selector,
44
+ namespace = settings.namespace,
45
+ className = settings.className,
46
+ error = settings.error,
47
+
48
+ eventNamespace = '.' + namespace,
49
+ moduleNamespace = 'module-' + namespace,
50
+ moduleSelector = $allModules.selector || '',
51
+
52
+ clickEvent = ('ontouchstart' in document.documentElement)
53
+ ? 'touchstart'
54
+ : 'click',
55
+
56
+ $module = $(this),
57
+ $dimmer,
58
+ $dimmable,
59
+
60
+ element = this,
61
+ instance = $module.data(moduleNamespace),
62
+ module
63
+ ;
64
+
65
+ module = {
66
+
67
+ preinitialize: function() {
68
+ if( module.is.dimmer() ) {
69
+
70
+ $dimmable = $module.parent();
71
+ $dimmer = $module;
72
+ }
73
+ else {
74
+ $dimmable = $module;
75
+ if( module.has.dimmer() ) {
76
+ if(settings.dimmerName) {
77
+ $dimmer = $dimmable.find(selector.dimmer).filter('.' + settings.dimmerName);
78
+ }
79
+ else {
80
+ $dimmer = $dimmable.find(selector.dimmer);
81
+ }
82
+ }
83
+ else {
84
+ $dimmer = module.create();
85
+ }
86
+ }
87
+ },
88
+
89
+ initialize: function() {
90
+ module.debug('Initializing dimmer', settings);
91
+
92
+ module.bind.events();
93
+ module.set.dimmable();
94
+ module.instantiate();
95
+ },
96
+
97
+ instantiate: function() {
98
+ module.verbose('Storing instance of module', module);
99
+ instance = module;
100
+ $module
101
+ .data(moduleNamespace, instance)
102
+ ;
103
+ },
104
+
105
+ destroy: function() {
106
+ module.verbose('Destroying previous module', $dimmer);
107
+ module.unbind.events();
108
+ module.remove.variation();
109
+ $dimmable
110
+ .off(eventNamespace)
111
+ ;
112
+ },
113
+
114
+ bind: {
115
+ events: function() {
116
+ if(settings.on == 'hover') {
117
+ $dimmable
118
+ .on('mouseenter' + eventNamespace, module.show)
119
+ .on('mouseleave' + eventNamespace, module.hide)
120
+ ;
121
+ }
122
+ else if(settings.on == 'click') {
123
+ $dimmable
124
+ .on(clickEvent + eventNamespace, module.toggle)
125
+ ;
126
+ }
127
+ if( module.is.page() ) {
128
+ module.debug('Setting as a page dimmer', $dimmable);
129
+ module.set.pageDimmer();
130
+ }
131
+
132
+ if( module.is.closable() ) {
133
+ module.verbose('Adding dimmer close event', $dimmer);
134
+ $dimmable
135
+ .on(clickEvent + eventNamespace, selector.dimmer, module.event.click)
136
+ ;
137
+ }
138
+ }
139
+ },
140
+
141
+ unbind: {
142
+ events: function() {
143
+ $module
144
+ .removeData(moduleNamespace)
145
+ ;
146
+ $dimmable
147
+ .off(eventNamespace)
148
+ ;
149
+ }
150
+ },
151
+
152
+ event: {
153
+ click: function(event) {
154
+ module.verbose('Determining if event occured on dimmer', event);
155
+ if( $dimmer.find(event.target).length === 0 || $(event.target).is(selector.content) ) {
156
+ module.hide();
157
+ event.stopImmediatePropagation();
158
+ }
159
+ }
160
+ },
161
+
162
+ addContent: function(element) {
163
+ var
164
+ $content = $(element)
165
+ ;
166
+ module.debug('Add content to dimmer', $content);
167
+ if($content.parent()[0] !== $dimmer[0]) {
168
+ $content.detach().appendTo($dimmer);
169
+ }
170
+ },
171
+
172
+ create: function() {
173
+ var
174
+ $element = $( settings.template.dimmer() )
175
+ ;
176
+ if(settings.dimmerName) {
177
+ module.debug('Creating named dimmer', settings.dimmerName);
178
+ $element.addClass(settings.dimmerName);
179
+ }
180
+ $element
181
+ .appendTo($dimmable)
182
+ ;
183
+ return $element;
184
+ },
185
+
186
+ show: function(callback) {
187
+ callback = $.isFunction(callback)
188
+ ? callback
189
+ : function(){}
190
+ ;
191
+ module.debug('Showing dimmer', $dimmer, settings);
192
+ module.set.variation();
193
+ if( (!module.is.dimmed() || module.is.animating()) && module.is.enabled() ) {
194
+ module.animate.show(callback);
195
+ settings.onShow.call(element);
196
+ settings.onChange.call(element);
197
+ }
198
+ else {
199
+ module.debug('Dimmer is already shown or disabled');
200
+ }
201
+ },
202
+
203
+ hide: function(callback) {
204
+ callback = $.isFunction(callback)
205
+ ? callback
206
+ : function(){}
207
+ ;
208
+ if( module.is.dimmed() || module.is.animating() ) {
209
+ module.debug('Hiding dimmer', $dimmer);
210
+ module.animate.hide(callback);
211
+ settings.onHide.call(element);
212
+ settings.onChange.call(element);
213
+ }
214
+ else {
215
+ module.debug('Dimmer is not visible');
216
+ }
217
+ },
218
+
219
+ toggle: function() {
220
+ module.verbose('Toggling dimmer visibility', $dimmer);
221
+ if( !module.is.dimmed() ) {
222
+ module.show();
223
+ }
224
+ else {
225
+ if ( module.is.closable() ) {
226
+ module.hide();
227
+ }
228
+ }
229
+ },
230
+
231
+ animate: {
232
+ show: function(callback) {
233
+ callback = $.isFunction(callback)
234
+ ? callback
235
+ : function(){}
236
+ ;
237
+ if(settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) {
238
+ if(settings.useFlex) {
239
+ module.debug('Using flex dimmer');
240
+ module.remove.legacy();
241
+ }
242
+ else {
243
+ module.debug('Using legacy non-flex dimmer');
244
+ module.set.legacy();
245
+ }
246
+ if(settings.opacity !== 'auto') {
247
+ module.set.opacity();
248
+ }
249
+ $dimmer
250
+ .transition({
251
+ displayType : settings.useFlex
252
+ ? 'flex'
253
+ : 'block',
254
+ animation : settings.transition + ' in',
255
+ queue : false,
256
+ duration : module.get.duration(),
257
+ useFailSafe : true,
258
+ onStart : function() {
259
+ module.set.dimmed();
260
+ },
261
+ onComplete : function() {
262
+ module.set.active();
263
+ callback();
264
+ }
265
+ })
266
+ ;
267
+ }
268
+ else {
269
+ module.verbose('Showing dimmer animation with javascript');
270
+ module.set.dimmed();
271
+ if(settings.opacity == 'auto') {
272
+ settings.opacity = 0.8;
273
+ }
274
+ $dimmer
275
+ .stop()
276
+ .css({
277
+ opacity : 0,
278
+ width : '100%',
279
+ height : '100%'
280
+ })
281
+ .fadeTo(module.get.duration(), settings.opacity, function() {
282
+ $dimmer.removeAttr('style');
283
+ module.set.active();
284
+ callback();
285
+ })
286
+ ;
287
+ }
288
+ },
289
+ hide: function(callback) {
290
+ callback = $.isFunction(callback)
291
+ ? callback
292
+ : function(){}
293
+ ;
294
+ if(settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) {
295
+ module.verbose('Hiding dimmer with css');
296
+ $dimmer
297
+ .transition({
298
+ displayType : settings.useFlex
299
+ ? 'flex'
300
+ : 'block',
301
+ animation : settings.transition + ' out',
302
+ queue : false,
303
+ duration : module.get.duration(),
304
+ useFailSafe : true,
305
+ onStart : function() {
306
+ module.remove.dimmed();
307
+ },
308
+ onComplete : function() {
309
+ module.remove.variation();
310
+ module.remove.active();
311
+ callback();
312
+ }
313
+ })
314
+ ;
315
+ }
316
+ else {
317
+ module.verbose('Hiding dimmer with javascript');
318
+ module.remove.dimmed();
319
+ $dimmer
320
+ .stop()
321
+ .fadeOut(module.get.duration(), function() {
322
+ module.remove.active();
323
+ $dimmer.removeAttr('style');
324
+ callback();
325
+ })
326
+ ;
327
+ }
328
+ }
329
+ },
330
+
331
+ get: {
332
+ dimmer: function() {
333
+ return $dimmer;
334
+ },
335
+ duration: function() {
336
+ if(typeof settings.duration == 'object') {
337
+ if( module.is.active() ) {
338
+ return settings.duration.hide;
339
+ }
340
+ else {
341
+ return settings.duration.show;
342
+ }
343
+ }
344
+ return settings.duration;
345
+ }
346
+ },
347
+
348
+ has: {
349
+ dimmer: function() {
350
+ if(settings.dimmerName) {
351
+ return ($module.find(selector.dimmer).filter('.' + settings.dimmerName).length > 0);
352
+ }
353
+ else {
354
+ return ( $module.find(selector.dimmer).length > 0 );
355
+ }
356
+ }
357
+ },
358
+
359
+ is: {
360
+ active: function() {
361
+ return $dimmer.hasClass(className.active);
362
+ },
363
+ animating: function() {
364
+ return ( $dimmer.is(':animated') || $dimmer.hasClass(className.animating) );
365
+ },
366
+ closable: function() {
367
+ if(settings.closable == 'auto') {
368
+ if(settings.on == 'hover') {
369
+ return false;
370
+ }
371
+ return true;
372
+ }
373
+ return settings.closable;
374
+ },
375
+ dimmer: function() {
376
+ return $module.hasClass(className.dimmer);
377
+ },
378
+ dimmable: function() {
379
+ return $module.hasClass(className.dimmable);
380
+ },
381
+ dimmed: function() {
382
+ return $dimmable.hasClass(className.dimmed);
383
+ },
384
+ disabled: function() {
385
+ return $dimmable.hasClass(className.disabled);
386
+ },
387
+ enabled: function() {
388
+ return !module.is.disabled();
389
+ },
390
+ page: function () {
391
+ return $dimmable.is('body');
392
+ },
393
+ pageDimmer: function() {
394
+ return $dimmer.hasClass(className.pageDimmer);
395
+ }
396
+ },
397
+
398
+ can: {
399
+ show: function() {
400
+ return !$dimmer.hasClass(className.disabled);
401
+ }
402
+ },
403
+
404
+ set: {
405
+ opacity: function(opacity) {
406
+ var
407
+ color = $dimmer.css('background-color'),
408
+ colorArray = color.split(','),
409
+ isRGB = (colorArray && colorArray.length == 3),
410
+ isRGBA = (colorArray && colorArray.length == 4)
411
+ ;
412
+ opacity = settings.opacity === 0 ? 0 : settings.opacity || opacity;
413
+ if(isRGB || isRGBA) {
414
+ colorArray[3] = opacity + ')';
415
+ color = colorArray.join(',');
416
+ }
417
+ else {
418
+ color = 'rgba(0, 0, 0, ' + opacity + ')';
419
+ }
420
+ module.debug('Setting opacity to', opacity);
421
+ $dimmer.css('background-color', color);
422
+ },
423
+ legacy: function() {
424
+ $dimmer.addClass(className.legacy);
425
+ },
426
+ active: function() {
427
+ $dimmer.addClass(className.active);
428
+ },
429
+ dimmable: function() {
430
+ $dimmable.addClass(className.dimmable);
431
+ },
432
+ dimmed: function() {
433
+ $dimmable.addClass(className.dimmed);
434
+ },
435
+ pageDimmer: function() {
436
+ $dimmer.addClass(className.pageDimmer);
437
+ },
438
+ disabled: function() {
439
+ $dimmer.addClass(className.disabled);
440
+ },
441
+ variation: function(variation) {
442
+ variation = variation || settings.variation;
443
+ if(variation) {
444
+ $dimmer.addClass(variation);
445
+ }
446
+ }
447
+ },
448
+
449
+ remove: {
450
+ active: function() {
451
+ $dimmer
452
+ .removeClass(className.active)
453
+ ;
454
+ },
455
+ legacy: function() {
456
+ $dimmer.removeClass(className.legacy);
457
+ },
458
+ dimmed: function() {
459
+ $dimmable.removeClass(className.dimmed);
460
+ },
461
+ disabled: function() {
462
+ $dimmer.removeClass(className.disabled);
463
+ },
464
+ variation: function(variation) {
465
+ variation = variation || settings.variation;
466
+ if(variation) {
467
+ $dimmer.removeClass(variation);
468
+ }
469
+ }
470
+ },
471
+
472
+ setting: function(name, value) {
473
+ module.debug('Changing setting', name, value);
474
+ if( $.isPlainObject(name) ) {
475
+ $.extend(true, settings, name);
476
+ }
477
+ else if(value !== undefined) {
478
+ if($.isPlainObject(settings[name])) {
479
+ $.extend(true, settings[name], value);
480
+ }
481
+ else {
482
+ settings[name] = value;
483
+ }
484
+ }
485
+ else {
486
+ return settings[name];
487
+ }
488
+ },
489
+ internal: function(name, value) {
490
+ if( $.isPlainObject(name) ) {
491
+ $.extend(true, module, name);
492
+ }
493
+ else if(value !== undefined) {
494
+ module[name] = value;
495
+ }
496
+ else {
497
+ return module[name];
498
+ }
499
+ },
500
+ debug: function() {
501
+ if(!settings.silent && settings.debug) {
502
+ if(settings.performance) {
503
+ module.performance.log(arguments);
504
+ }
505
+ else {
506
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
507
+ module.debug.apply(console, arguments);
508
+ }
509
+ }
510
+ },
511
+ verbose: function() {
512
+ if(!settings.silent && settings.verbose && settings.debug) {
513
+ if(settings.performance) {
514
+ module.performance.log(arguments);
515
+ }
516
+ else {
517
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
518
+ module.verbose.apply(console, arguments);
519
+ }
520
+ }
521
+ },
522
+ error: function() {
523
+ if(!settings.silent) {
524
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
525
+ module.error.apply(console, arguments);
526
+ }
527
+ },
528
+ performance: {
529
+ log: function(message) {
530
+ var
531
+ currentTime,
532
+ executionTime,
533
+ previousTime
534
+ ;
535
+ if(settings.performance) {
536
+ currentTime = new Date().getTime();
537
+ previousTime = time || currentTime;
538
+ executionTime = currentTime - previousTime;
539
+ time = currentTime;
540
+ performance.push({
541
+ 'Name' : message[0],
542
+ 'Arguments' : [].slice.call(message, 1) || '',
543
+ 'Element' : element,
544
+ 'Execution Time' : executionTime
545
+ });
546
+ }
547
+ clearTimeout(module.performance.timer);
548
+ module.performance.timer = setTimeout(module.performance.display, 500);
549
+ },
550
+ display: function() {
551
+ var
552
+ title = settings.name + ':',
553
+ totalTime = 0
554
+ ;
555
+ time = false;
556
+ clearTimeout(module.performance.timer);
557
+ $.each(performance, function(index, data) {
558
+ totalTime += data['Execution Time'];
559
+ });
560
+ title += ' ' + totalTime + 'ms';
561
+ if(moduleSelector) {
562
+ title += ' \'' + moduleSelector + '\'';
563
+ }
564
+ if($allModules.length > 1) {
565
+ title += ' ' + '(' + $allModules.length + ')';
566
+ }
567
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
568
+ console.groupCollapsed(title);
569
+ if(console.table) {
570
+ console.table(performance);
571
+ }
572
+ else {
573
+ $.each(performance, function(index, data) {
574
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
575
+ });
576
+ }
577
+ console.groupEnd();
578
+ }
579
+ performance = [];
580
+ }
581
+ },
582
+ invoke: function(query, passedArguments, context) {
583
+ var
584
+ object = instance,
585
+ maxDepth,
586
+ found,
587
+ response
588
+ ;
589
+ passedArguments = passedArguments || queryArguments;
590
+ context = element || context;
591
+ if(typeof query == 'string' && object !== undefined) {
592
+ query = query.split(/[\. ]/);
593
+ maxDepth = query.length - 1;
594
+ $.each(query, function(depth, value) {
595
+ var camelCaseValue = (depth != maxDepth)
596
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
597
+ : query
598
+ ;
599
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
600
+ object = object[camelCaseValue];
601
+ }
602
+ else if( object[camelCaseValue] !== undefined ) {
603
+ found = object[camelCaseValue];
604
+ return false;
605
+ }
606
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
607
+ object = object[value];
608
+ }
609
+ else if( object[value] !== undefined ) {
610
+ found = object[value];
611
+ return false;
612
+ }
613
+ else {
614
+ module.error(error.method, query);
615
+ return false;
616
+ }
617
+ });
618
+ }
619
+ if ( $.isFunction( found ) ) {
620
+ response = found.apply(context, passedArguments);
621
+ }
622
+ else if(found !== undefined) {
623
+ response = found;
624
+ }
625
+ if($.isArray(returnedValue)) {
626
+ returnedValue.push(response);
627
+ }
628
+ else if(returnedValue !== undefined) {
629
+ returnedValue = [returnedValue, response];
630
+ }
631
+ else if(response !== undefined) {
632
+ returnedValue = response;
633
+ }
634
+ return found;
635
+ }
636
+ };
637
+
638
+ module.preinitialize();
639
+
640
+ if(methodInvoked) {
641
+ if(instance === undefined) {
642
+ module.initialize();
643
+ }
644
+ module.invoke(query);
645
+ }
646
+ else {
647
+ if(instance !== undefined) {
648
+ instance.invoke('destroy');
649
+ }
650
+ module.initialize();
651
+ }
652
+ })
653
+ ;
654
+
655
+ return (returnedValue !== undefined)
656
+ ? returnedValue
657
+ : this
658
+ ;
659
+ };
660
+
661
+ $.fn.dimmer.settings = {
662
+
663
+ name : 'Dimmer',
664
+ namespace : 'dimmer',
665
+
666
+ silent : false,
667
+ debug : false,
668
+ verbose : false,
669
+ performance : true,
670
+
671
+ // whether should use flex layout
672
+ useFlex : true,
673
+
674
+ // name to distinguish between multiple dimmers in context
675
+ dimmerName : false,
676
+
677
+ // whether to add a variation type
678
+ variation : false,
679
+
680
+ // whether to bind close events
681
+ closable : 'auto',
682
+
683
+ // whether to use css animations
684
+ useCSS : true,
685
+
686
+ // css animation to use
687
+ transition : 'fade',
688
+
689
+ // event to bind to
690
+ on : false,
691
+
692
+ // overriding opacity value
693
+ opacity : 'auto',
694
+
695
+ // transition durations
696
+ duration : {
697
+ show : 500,
698
+ hide : 500
699
+ },
700
+
701
+ onChange : function(){},
702
+ onShow : function(){},
703
+ onHide : function(){},
704
+
705
+ error : {
706
+ method : 'The method you called is not defined.'
707
+ },
708
+
709
+ className : {
710
+ active : 'active',
711
+ animating : 'animating',
712
+ dimmable : 'dimmable',
713
+ dimmed : 'dimmed',
714
+ dimmer : 'dimmer',
715
+ disabled : 'disabled',
716
+ hide : 'hide',
717
+ legacy : 'legacy',
718
+ pageDimmer : 'page',
719
+ show : 'show'
720
+ },
721
+
722
+ selector: {
723
+ dimmer : '> .ui.dimmer',
724
+ content : '.ui.dimmer > .content, .ui.dimmer > .content > .center'
725
+ },
726
+
727
+ template: {
728
+ dimmer: function() {
729
+ return $('<div />').attr('class', 'ui dimmer');
730
+ }
731
+ }
732
+
733
+ };
734
+
735
+ })( jQuery, window, document );