fomantic-ui-sass 2.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +27 -0
- data/.rspec +1 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +370 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +177 -0
- data/Rakefile +8 -0
- data/app/assets/fonts/semantic-ui/brand-icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.svg +1008 -0
- data/app/assets/fonts/semantic-ui/brand-icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/icons.otf +0 -0
- data/app/assets/fonts/semantic-ui/icons.svg +1518 -0
- data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.svg +366 -0
- data/app/assets/fonts/semantic-ui/outline-icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff2 +0 -0
- data/app/assets/images/semantic-ui/flags.png +0 -0
- data/app/assets/javascripts/semantic-ui.js +27 -0
- data/app/assets/javascripts/semantic-ui/accordion.js +613 -0
- data/app/assets/javascripts/semantic-ui/api.js +1167 -0
- data/app/assets/javascripts/semantic-ui/calendar.js +1476 -0
- data/app/assets/javascripts/semantic-ui/checkbox.js +828 -0
- data/app/assets/javascripts/semantic-ui/colorize.js +280 -0
- data/app/assets/javascripts/semantic-ui/dimmer.js +735 -0
- data/app/assets/javascripts/semantic-ui/dropdown.js +4030 -0
- data/app/assets/javascripts/semantic-ui/embed.js +706 -0
- data/app/assets/javascripts/semantic-ui/form.js +1707 -0
- data/app/assets/javascripts/semantic-ui/modal.js +1090 -0
- data/app/assets/javascripts/semantic-ui/nag.js +507 -0
- data/app/assets/javascripts/semantic-ui/popup.js +1532 -0
- data/app/assets/javascripts/semantic-ui/progress.js +923 -0
- data/app/assets/javascripts/semantic-ui/range.js +278 -0
- data/app/assets/javascripts/semantic-ui/rating.js +511 -0
- data/app/assets/javascripts/semantic-ui/search.js +1515 -0
- data/app/assets/javascripts/semantic-ui/shape.js +921 -0
- data/app/assets/javascripts/semantic-ui/sidebar.js +1033 -0
- data/app/assets/javascripts/semantic-ui/site.js +490 -0
- data/app/assets/javascripts/semantic-ui/state.js +708 -0
- data/app/assets/javascripts/semantic-ui/sticky.js +959 -0
- data/app/assets/javascripts/semantic-ui/tab.js +952 -0
- data/app/assets/javascripts/semantic-ui/toast.js +592 -0
- data/app/assets/javascripts/semantic-ui/transition.js +1106 -0
- data/app/assets/javascripts/semantic-ui/video.js +532 -0
- data/app/assets/javascripts/semantic-ui/visibility.js +1311 -0
- data/app/assets/javascripts/semantic-ui/visit.js +525 -0
- data/app/assets/stylesheets/semantic-ui.scss +5 -0
- data/app/assets/stylesheets/semantic-ui/collections/_all.scss +6 -0
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +124 -0
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +1158 -0
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +2093 -0
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +2193 -0
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +606 -0
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +1117 -0
- data/app/assets/stylesheets/semantic-ui/elements/_all.scss +16 -0
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +4530 -0
- data/app/assets/stylesheets/semantic-ui/elements/_container.scss +145 -0
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +259 -0
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1036 -0
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +762 -0
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +6330 -0
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +310 -0
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +519 -0
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +1395 -0
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +959 -0
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +458 -0
- data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +242 -0
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +152 -0
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +295 -0
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +884 -0
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +675 -0
- data/app/assets/stylesheets/semantic-ui/globals/_all.scss +3 -0
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +485 -0
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +206 -0
- data/app/assets/stylesheets/semantic-ui/globals/_variables.scss +4 -0
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +247 -0
- data/app/assets/stylesheets/semantic-ui/modules/_all.scss +20 -0
- data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +165 -0
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +718 -0
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +464 -0
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +1745 -0
- data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +165 -0
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +646 -0
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +148 -0
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +789 -0
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +523 -0
- data/app/assets/stylesheets/semantic-ui/modules/_range.scss +192 -0
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +263 -0
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +445 -0
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +154 -0
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +626 -0
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +78 -0
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +92 -0
- data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +291 -0
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +2059 -0
- data/app/assets/stylesheets/semantic-ui/modules/_video.scss +125 -0
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +275 -0
- data/app/assets/stylesheets/semantic-ui/views/_all.scss +6 -0
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +1124 -0
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +296 -0
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +314 -0
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +555 -0
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +583 -0
- data/app/helpers/semantic_breadcrumbs_helper.rb +10 -0
- data/app/helpers/semantic_flash_helper.rb +22 -0
- data/app/helpers/semantic_icon_helper.rb +8 -0
- data/app/views/semantic/_breadcrumbs.html.erb +12 -0
- data/fomantic-ui-sass.gemspec +31 -0
- data/lib/fomantic-ui-sass.rb +62 -0
- data/lib/fomantic/ui/sass/breadcrumbs.rb +41 -0
- data/lib/fomantic/ui/sass/engine.rb +23 -0
- data/lib/fomantic/ui/sass/version.rb +8 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +28 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +2 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/helpers/semantic_breadcrumbs_helper_spec.rb +38 -0
- data/spec/helpers/semantic_flash_helper_spec.rb +36 -0
- data/spec/helpers/semantic_icon_helper_spec.rb +48 -0
- data/spec/spec_helper.rb +17 -0
- data/tasks/converter.rb +216 -0
- data/templates/project/manifest.rb +29 -0
- data/templates/project/styles.scss +1 -0
- metadata +390 -0
@@ -0,0 +1,507 @@
|
|
1
|
+
/*!
|
2
|
+
* # Semantic UI - Nag
|
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.nag = function(parameters) {
|
23
|
+
var
|
24
|
+
$allModules = $(this),
|
25
|
+
moduleSelector = $allModules.selector || '',
|
26
|
+
|
27
|
+
time = new Date().getTime(),
|
28
|
+
performance = [],
|
29
|
+
|
30
|
+
query = arguments[0],
|
31
|
+
methodInvoked = (typeof query == 'string'),
|
32
|
+
queryArguments = [].slice.call(arguments, 1),
|
33
|
+
returnedValue
|
34
|
+
;
|
35
|
+
$allModules
|
36
|
+
.each(function() {
|
37
|
+
var
|
38
|
+
settings = ( $.isPlainObject(parameters) )
|
39
|
+
? $.extend(true, {}, $.fn.nag.settings, parameters)
|
40
|
+
: $.extend({}, $.fn.nag.settings),
|
41
|
+
|
42
|
+
className = settings.className,
|
43
|
+
selector = settings.selector,
|
44
|
+
error = settings.error,
|
45
|
+
namespace = settings.namespace,
|
46
|
+
|
47
|
+
eventNamespace = '.' + namespace,
|
48
|
+
moduleNamespace = namespace + '-module',
|
49
|
+
|
50
|
+
$module = $(this),
|
51
|
+
|
52
|
+
$close = $module.find(selector.close),
|
53
|
+
$context = (settings.context)
|
54
|
+
? $(settings.context)
|
55
|
+
: $('body'),
|
56
|
+
|
57
|
+
element = this,
|
58
|
+
instance = $module.data(moduleNamespace),
|
59
|
+
|
60
|
+
moduleOffset,
|
61
|
+
moduleHeight,
|
62
|
+
|
63
|
+
contextWidth,
|
64
|
+
contextHeight,
|
65
|
+
contextOffset,
|
66
|
+
|
67
|
+
yOffset,
|
68
|
+
yPosition,
|
69
|
+
|
70
|
+
timer,
|
71
|
+
module,
|
72
|
+
|
73
|
+
requestAnimationFrame = window.requestAnimationFrame
|
74
|
+
|| window.mozRequestAnimationFrame
|
75
|
+
|| window.webkitRequestAnimationFrame
|
76
|
+
|| window.msRequestAnimationFrame
|
77
|
+
|| function(callback) { setTimeout(callback, 0); }
|
78
|
+
;
|
79
|
+
module = {
|
80
|
+
|
81
|
+
initialize: function() {
|
82
|
+
module.verbose('Initializing element');
|
83
|
+
|
84
|
+
$module
|
85
|
+
.on('click' + eventNamespace, selector.close, module.dismiss)
|
86
|
+
.data(moduleNamespace, module)
|
87
|
+
;
|
88
|
+
|
89
|
+
if(settings.detachable && $module.parent()[0] !== $context[0]) {
|
90
|
+
$module
|
91
|
+
.detach()
|
92
|
+
.prependTo($context)
|
93
|
+
;
|
94
|
+
}
|
95
|
+
|
96
|
+
if(settings.displayTime > 0) {
|
97
|
+
setTimeout(module.hide, settings.displayTime);
|
98
|
+
}
|
99
|
+
module.show();
|
100
|
+
},
|
101
|
+
|
102
|
+
destroy: function() {
|
103
|
+
module.verbose('Destroying instance');
|
104
|
+
$module
|
105
|
+
.removeData(moduleNamespace)
|
106
|
+
.off(eventNamespace)
|
107
|
+
;
|
108
|
+
},
|
109
|
+
|
110
|
+
show: function() {
|
111
|
+
if( module.should.show() && !$module.is(':visible') ) {
|
112
|
+
module.debug('Showing nag', settings.animation.show);
|
113
|
+
if(settings.animation.show == 'fade') {
|
114
|
+
$module
|
115
|
+
.fadeIn(settings.duration, settings.easing)
|
116
|
+
;
|
117
|
+
}
|
118
|
+
else {
|
119
|
+
$module
|
120
|
+
.slideDown(settings.duration, settings.easing)
|
121
|
+
;
|
122
|
+
}
|
123
|
+
}
|
124
|
+
},
|
125
|
+
|
126
|
+
hide: function() {
|
127
|
+
module.debug('Showing nag', settings.animation.hide);
|
128
|
+
if(settings.animation.show == 'fade') {
|
129
|
+
$module
|
130
|
+
.fadeIn(settings.duration, settings.easing)
|
131
|
+
;
|
132
|
+
}
|
133
|
+
else {
|
134
|
+
$module
|
135
|
+
.slideUp(settings.duration, settings.easing)
|
136
|
+
;
|
137
|
+
}
|
138
|
+
},
|
139
|
+
|
140
|
+
onHide: function() {
|
141
|
+
module.debug('Removing nag', settings.animation.hide);
|
142
|
+
$module.remove();
|
143
|
+
if (settings.onHide) {
|
144
|
+
settings.onHide();
|
145
|
+
}
|
146
|
+
},
|
147
|
+
|
148
|
+
dismiss: function(event) {
|
149
|
+
if(settings.storageMethod) {
|
150
|
+
module.storage.set(settings.key, settings.value);
|
151
|
+
}
|
152
|
+
module.hide();
|
153
|
+
event.stopImmediatePropagation();
|
154
|
+
event.preventDefault();
|
155
|
+
},
|
156
|
+
|
157
|
+
should: {
|
158
|
+
show: function() {
|
159
|
+
if(settings.persist) {
|
160
|
+
module.debug('Persistent nag is set, can show nag');
|
161
|
+
return true;
|
162
|
+
}
|
163
|
+
if( module.storage.get(settings.key) != settings.value.toString() ) {
|
164
|
+
module.debug('Stored value is not set, can show nag', module.storage.get(settings.key));
|
165
|
+
return true;
|
166
|
+
}
|
167
|
+
module.debug('Stored value is set, cannot show nag', module.storage.get(settings.key));
|
168
|
+
return false;
|
169
|
+
}
|
170
|
+
},
|
171
|
+
|
172
|
+
get: {
|
173
|
+
storageOptions: function() {
|
174
|
+
var
|
175
|
+
options = {}
|
176
|
+
;
|
177
|
+
if(settings.expires) {
|
178
|
+
options.expires = settings.expires;
|
179
|
+
}
|
180
|
+
if(settings.domain) {
|
181
|
+
options.domain = settings.domain;
|
182
|
+
}
|
183
|
+
if(settings.path) {
|
184
|
+
options.path = settings.path;
|
185
|
+
}
|
186
|
+
return options;
|
187
|
+
}
|
188
|
+
},
|
189
|
+
|
190
|
+
clear: function() {
|
191
|
+
module.storage.remove(settings.key);
|
192
|
+
},
|
193
|
+
|
194
|
+
storage: {
|
195
|
+
set: function(key, value) {
|
196
|
+
var
|
197
|
+
options = module.get.storageOptions()
|
198
|
+
;
|
199
|
+
if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
|
200
|
+
window.localStorage.setItem(key, value);
|
201
|
+
module.debug('Value stored using local storage', key, value);
|
202
|
+
}
|
203
|
+
else if(settings.storageMethod == 'sessionstorage' && window.sessionStorage !== undefined) {
|
204
|
+
window.sessionStorage.setItem(key, value);
|
205
|
+
module.debug('Value stored using session storage', key, value);
|
206
|
+
}
|
207
|
+
else if($.cookie !== undefined) {
|
208
|
+
$.cookie(key, value, options);
|
209
|
+
module.debug('Value stored using cookie', key, value, options);
|
210
|
+
}
|
211
|
+
else {
|
212
|
+
module.error(error.noCookieStorage);
|
213
|
+
return;
|
214
|
+
}
|
215
|
+
},
|
216
|
+
get: function(key, value) {
|
217
|
+
var
|
218
|
+
storedValue
|
219
|
+
;
|
220
|
+
if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
|
221
|
+
storedValue = window.localStorage.getItem(key);
|
222
|
+
}
|
223
|
+
else if(settings.storageMethod == 'sessionstorage' && window.sessionStorage !== undefined) {
|
224
|
+
storedValue = window.sessionStorage.getItem(key);
|
225
|
+
}
|
226
|
+
// get by cookie
|
227
|
+
else if($.cookie !== undefined) {
|
228
|
+
storedValue = $.cookie(key);
|
229
|
+
}
|
230
|
+
else {
|
231
|
+
module.error(error.noCookieStorage);
|
232
|
+
}
|
233
|
+
if(storedValue == 'undefined' || storedValue == 'null' || storedValue === undefined || storedValue === null) {
|
234
|
+
storedValue = undefined;
|
235
|
+
}
|
236
|
+
return storedValue;
|
237
|
+
},
|
238
|
+
remove: function(key) {
|
239
|
+
var
|
240
|
+
options = module.get.storageOptions()
|
241
|
+
;
|
242
|
+
if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
|
243
|
+
window.localStorage.removeItem(key);
|
244
|
+
}
|
245
|
+
else if(settings.storageMethod == 'sessionstorage' && window.sessionStorage !== undefined) {
|
246
|
+
window.sessionStorage.removeItem(key);
|
247
|
+
}
|
248
|
+
// store by cookie
|
249
|
+
else if($.cookie !== undefined) {
|
250
|
+
$.removeCookie(key, options);
|
251
|
+
}
|
252
|
+
else {
|
253
|
+
module.error(error.noStorage);
|
254
|
+
}
|
255
|
+
}
|
256
|
+
},
|
257
|
+
|
258
|
+
setting: function(name, value) {
|
259
|
+
module.debug('Changing setting', name, value);
|
260
|
+
if( $.isPlainObject(name) ) {
|
261
|
+
$.extend(true, settings, name);
|
262
|
+
}
|
263
|
+
else if(value !== undefined) {
|
264
|
+
if($.isPlainObject(settings[name])) {
|
265
|
+
$.extend(true, settings[name], value);
|
266
|
+
}
|
267
|
+
else {
|
268
|
+
settings[name] = value;
|
269
|
+
}
|
270
|
+
}
|
271
|
+
else {
|
272
|
+
return settings[name];
|
273
|
+
}
|
274
|
+
},
|
275
|
+
internal: function(name, value) {
|
276
|
+
if( $.isPlainObject(name) ) {
|
277
|
+
$.extend(true, module, name);
|
278
|
+
}
|
279
|
+
else if(value !== undefined) {
|
280
|
+
module[name] = value;
|
281
|
+
}
|
282
|
+
else {
|
283
|
+
return module[name];
|
284
|
+
}
|
285
|
+
},
|
286
|
+
debug: function() {
|
287
|
+
if(!settings.silent && settings.debug) {
|
288
|
+
if(settings.performance) {
|
289
|
+
module.performance.log(arguments);
|
290
|
+
}
|
291
|
+
else {
|
292
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
293
|
+
module.debug.apply(console, arguments);
|
294
|
+
}
|
295
|
+
}
|
296
|
+
},
|
297
|
+
verbose: function() {
|
298
|
+
if(!settings.silent && settings.verbose && settings.debug) {
|
299
|
+
if(settings.performance) {
|
300
|
+
module.performance.log(arguments);
|
301
|
+
}
|
302
|
+
else {
|
303
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
304
|
+
module.verbose.apply(console, arguments);
|
305
|
+
}
|
306
|
+
}
|
307
|
+
},
|
308
|
+
error: function() {
|
309
|
+
if(!settings.silent) {
|
310
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
311
|
+
module.error.apply(console, arguments);
|
312
|
+
}
|
313
|
+
},
|
314
|
+
performance: {
|
315
|
+
log: function(message) {
|
316
|
+
var
|
317
|
+
currentTime,
|
318
|
+
executionTime,
|
319
|
+
previousTime
|
320
|
+
;
|
321
|
+
if(settings.performance) {
|
322
|
+
currentTime = new Date().getTime();
|
323
|
+
previousTime = time || currentTime;
|
324
|
+
executionTime = currentTime - previousTime;
|
325
|
+
time = currentTime;
|
326
|
+
performance.push({
|
327
|
+
'Name' : message[0],
|
328
|
+
'Arguments' : [].slice.call(message, 1) || '',
|
329
|
+
'Element' : element,
|
330
|
+
'Execution Time' : executionTime
|
331
|
+
});
|
332
|
+
}
|
333
|
+
clearTimeout(module.performance.timer);
|
334
|
+
module.performance.timer = setTimeout(module.performance.display, 500);
|
335
|
+
},
|
336
|
+
display: function() {
|
337
|
+
var
|
338
|
+
title = settings.name + ':',
|
339
|
+
totalTime = 0
|
340
|
+
;
|
341
|
+
time = false;
|
342
|
+
clearTimeout(module.performance.timer);
|
343
|
+
$.each(performance, function(index, data) {
|
344
|
+
totalTime += data['Execution Time'];
|
345
|
+
});
|
346
|
+
title += ' ' + totalTime + 'ms';
|
347
|
+
if(moduleSelector) {
|
348
|
+
title += ' \'' + moduleSelector + '\'';
|
349
|
+
}
|
350
|
+
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
351
|
+
console.groupCollapsed(title);
|
352
|
+
if(console.table) {
|
353
|
+
console.table(performance);
|
354
|
+
}
|
355
|
+
else {
|
356
|
+
$.each(performance, function(index, data) {
|
357
|
+
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
358
|
+
});
|
359
|
+
}
|
360
|
+
console.groupEnd();
|
361
|
+
}
|
362
|
+
performance = [];
|
363
|
+
}
|
364
|
+
},
|
365
|
+
invoke: function(query, passedArguments, context) {
|
366
|
+
var
|
367
|
+
object = instance,
|
368
|
+
maxDepth,
|
369
|
+
found,
|
370
|
+
response
|
371
|
+
;
|
372
|
+
passedArguments = passedArguments || queryArguments;
|
373
|
+
context = element || context;
|
374
|
+
if(typeof query == 'string' && object !== undefined) {
|
375
|
+
query = query.split(/[\. ]/);
|
376
|
+
maxDepth = query.length - 1;
|
377
|
+
$.each(query, function(depth, value) {
|
378
|
+
var camelCaseValue = (depth != maxDepth)
|
379
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
380
|
+
: query
|
381
|
+
;
|
382
|
+
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
383
|
+
object = object[camelCaseValue];
|
384
|
+
}
|
385
|
+
else if( object[camelCaseValue] !== undefined ) {
|
386
|
+
found = object[camelCaseValue];
|
387
|
+
return false;
|
388
|
+
}
|
389
|
+
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
390
|
+
object = object[value];
|
391
|
+
}
|
392
|
+
else if( object[value] !== undefined ) {
|
393
|
+
found = object[value];
|
394
|
+
return false;
|
395
|
+
}
|
396
|
+
else {
|
397
|
+
module.error(error.method, query);
|
398
|
+
return false;
|
399
|
+
}
|
400
|
+
});
|
401
|
+
}
|
402
|
+
if ( $.isFunction( found ) ) {
|
403
|
+
response = found.apply(context, passedArguments);
|
404
|
+
}
|
405
|
+
else if(found !== undefined) {
|
406
|
+
response = found;
|
407
|
+
}
|
408
|
+
if($.isArray(returnedValue)) {
|
409
|
+
returnedValue.push(response);
|
410
|
+
}
|
411
|
+
else if(returnedValue !== undefined) {
|
412
|
+
returnedValue = [returnedValue, response];
|
413
|
+
}
|
414
|
+
else if(response !== undefined) {
|
415
|
+
returnedValue = response;
|
416
|
+
}
|
417
|
+
return found;
|
418
|
+
}
|
419
|
+
};
|
420
|
+
|
421
|
+
if(methodInvoked) {
|
422
|
+
if(instance === undefined) {
|
423
|
+
module.initialize();
|
424
|
+
}
|
425
|
+
module.invoke(query);
|
426
|
+
}
|
427
|
+
else {
|
428
|
+
if(instance !== undefined) {
|
429
|
+
instance.invoke('destroy');
|
430
|
+
}
|
431
|
+
module.initialize();
|
432
|
+
}
|
433
|
+
})
|
434
|
+
;
|
435
|
+
|
436
|
+
return (returnedValue !== undefined)
|
437
|
+
? returnedValue
|
438
|
+
: this
|
439
|
+
;
|
440
|
+
};
|
441
|
+
|
442
|
+
$.fn.nag.settings = {
|
443
|
+
|
444
|
+
name : 'Nag',
|
445
|
+
|
446
|
+
silent : false,
|
447
|
+
debug : false,
|
448
|
+
verbose : false,
|
449
|
+
performance : true,
|
450
|
+
|
451
|
+
namespace : 'Nag',
|
452
|
+
|
453
|
+
// allows cookie to be overridden
|
454
|
+
persist : false,
|
455
|
+
|
456
|
+
// set to zero to require manually dismissal, otherwise hides on its own
|
457
|
+
displayTime : 0,
|
458
|
+
|
459
|
+
animation : {
|
460
|
+
show : 'slide',
|
461
|
+
hide : 'slide'
|
462
|
+
},
|
463
|
+
|
464
|
+
context : false,
|
465
|
+
detachable : false,
|
466
|
+
|
467
|
+
expires : 30,
|
468
|
+
domain : false,
|
469
|
+
path : '/',
|
470
|
+
|
471
|
+
// type of storage to use
|
472
|
+
storageMethod : 'cookie',
|
473
|
+
|
474
|
+
// value to store in dismissed localstorage/cookie
|
475
|
+
key : 'nag',
|
476
|
+
value : 'dismiss',
|
477
|
+
|
478
|
+
error: {
|
479
|
+
noCookieStorage : '$.cookie is not included. A storage solution is required.',
|
480
|
+
noStorage : 'Neither $.cookie or store is defined. A storage solution is required for storing state',
|
481
|
+
method : 'The method you called is not defined.'
|
482
|
+
},
|
483
|
+
|
484
|
+
className : {
|
485
|
+
bottom : 'bottom',
|
486
|
+
fixed : 'fixed'
|
487
|
+
},
|
488
|
+
|
489
|
+
selector : {
|
490
|
+
close : '.close.icon'
|
491
|
+
},
|
492
|
+
|
493
|
+
speed : 500,
|
494
|
+
easing : 'easeOutQuad',
|
495
|
+
|
496
|
+
onHide: function() {}
|
497
|
+
|
498
|
+
};
|
499
|
+
|
500
|
+
// Adds easing
|
501
|
+
$.extend( $.easing, {
|
502
|
+
easeOutQuad: function (x, t, b, c, d) {
|
503
|
+
return -c *(t/=d)*(t-2) + b;
|
504
|
+
}
|
505
|
+
});
|
506
|
+
|
507
|
+
})( jQuery, window, document );
|