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,525 @@
|
|
1
|
+
/*!
|
2
|
+
* # Semantic UI - Visit
|
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
|
+
$.visit = $.fn.visit = function(parameters) {
|
23
|
+
var
|
24
|
+
$allModules = $.isFunction(this)
|
25
|
+
? $(window)
|
26
|
+
: $(this),
|
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
|
+
returnedValue
|
36
|
+
;
|
37
|
+
$allModules
|
38
|
+
.each(function() {
|
39
|
+
var
|
40
|
+
settings = ( $.isPlainObject(parameters) )
|
41
|
+
? $.extend(true, {}, $.fn.visit.settings, parameters)
|
42
|
+
: $.extend({}, $.fn.visit.settings),
|
43
|
+
|
44
|
+
error = settings.error,
|
45
|
+
namespace = settings.namespace,
|
46
|
+
|
47
|
+
eventNamespace = '.' + namespace,
|
48
|
+
moduleNamespace = namespace + '-module',
|
49
|
+
|
50
|
+
$module = $(this),
|
51
|
+
$displays = $(),
|
52
|
+
|
53
|
+
element = this,
|
54
|
+
instance = $module.data(moduleNamespace),
|
55
|
+
module
|
56
|
+
;
|
57
|
+
module = {
|
58
|
+
|
59
|
+
initialize: function() {
|
60
|
+
if(settings.count) {
|
61
|
+
module.store(settings.key.count, settings.count);
|
62
|
+
}
|
63
|
+
else if(settings.id) {
|
64
|
+
module.add.id(settings.id);
|
65
|
+
}
|
66
|
+
else if(settings.increment && methodInvoked !== 'increment') {
|
67
|
+
module.increment();
|
68
|
+
}
|
69
|
+
module.add.display($module);
|
70
|
+
module.instantiate();
|
71
|
+
},
|
72
|
+
|
73
|
+
instantiate: function() {
|
74
|
+
module.verbose('Storing instance of visit module', module);
|
75
|
+
instance = module;
|
76
|
+
$module
|
77
|
+
.data(moduleNamespace, module)
|
78
|
+
;
|
79
|
+
},
|
80
|
+
|
81
|
+
destroy: function() {
|
82
|
+
module.verbose('Destroying instance');
|
83
|
+
$module
|
84
|
+
.removeData(moduleNamespace)
|
85
|
+
;
|
86
|
+
},
|
87
|
+
|
88
|
+
increment: function(id) {
|
89
|
+
var
|
90
|
+
currentValue = module.get.count(),
|
91
|
+
newValue = +(currentValue) + 1
|
92
|
+
;
|
93
|
+
if(id) {
|
94
|
+
module.add.id(id);
|
95
|
+
}
|
96
|
+
else {
|
97
|
+
if(newValue > settings.limit && !settings.surpass) {
|
98
|
+
newValue = settings.limit;
|
99
|
+
}
|
100
|
+
module.debug('Incrementing visits', newValue);
|
101
|
+
module.store(settings.key.count, newValue);
|
102
|
+
}
|
103
|
+
},
|
104
|
+
|
105
|
+
decrement: function(id) {
|
106
|
+
var
|
107
|
+
currentValue = module.get.count(),
|
108
|
+
newValue = +(currentValue) - 1
|
109
|
+
;
|
110
|
+
if(id) {
|
111
|
+
module.remove.id(id);
|
112
|
+
}
|
113
|
+
else {
|
114
|
+
module.debug('Removing visit');
|
115
|
+
module.store(settings.key.count, newValue);
|
116
|
+
}
|
117
|
+
},
|
118
|
+
|
119
|
+
get: {
|
120
|
+
count: function() {
|
121
|
+
return +(module.retrieve(settings.key.count)) || 0;
|
122
|
+
},
|
123
|
+
idCount: function(ids) {
|
124
|
+
ids = ids || module.get.ids();
|
125
|
+
return ids.length;
|
126
|
+
},
|
127
|
+
ids: function(delimitedIDs) {
|
128
|
+
var
|
129
|
+
idArray = []
|
130
|
+
;
|
131
|
+
delimitedIDs = delimitedIDs || module.retrieve(settings.key.ids);
|
132
|
+
if(typeof delimitedIDs === 'string') {
|
133
|
+
idArray = delimitedIDs.split(settings.delimiter);
|
134
|
+
}
|
135
|
+
module.verbose('Found visited ID list', idArray);
|
136
|
+
return idArray;
|
137
|
+
},
|
138
|
+
storageOptions: function(data) {
|
139
|
+
var
|
140
|
+
options = {}
|
141
|
+
;
|
142
|
+
if(settings.expires) {
|
143
|
+
options.expires = settings.expires;
|
144
|
+
}
|
145
|
+
if(settings.domain) {
|
146
|
+
options.domain = settings.domain;
|
147
|
+
}
|
148
|
+
if(settings.path) {
|
149
|
+
options.path = settings.path;
|
150
|
+
}
|
151
|
+
return options;
|
152
|
+
}
|
153
|
+
},
|
154
|
+
|
155
|
+
has: {
|
156
|
+
visited: function(id, ids) {
|
157
|
+
var
|
158
|
+
visited = false
|
159
|
+
;
|
160
|
+
ids = ids || module.get.ids();
|
161
|
+
if(id !== undefined && ids) {
|
162
|
+
$.each(ids, function(index, value){
|
163
|
+
if(value == id) {
|
164
|
+
visited = true;
|
165
|
+
}
|
166
|
+
});
|
167
|
+
}
|
168
|
+
return visited;
|
169
|
+
}
|
170
|
+
},
|
171
|
+
|
172
|
+
set: {
|
173
|
+
count: function(value) {
|
174
|
+
module.store(settings.key.count, value);
|
175
|
+
},
|
176
|
+
ids: function(value) {
|
177
|
+
module.store(settings.key.ids, value);
|
178
|
+
}
|
179
|
+
},
|
180
|
+
|
181
|
+
reset: function() {
|
182
|
+
module.store(settings.key.count, 0);
|
183
|
+
module.store(settings.key.ids, null);
|
184
|
+
},
|
185
|
+
|
186
|
+
add: {
|
187
|
+
id: function(id) {
|
188
|
+
var
|
189
|
+
currentIDs = module.retrieve(settings.key.ids),
|
190
|
+
newIDs = (currentIDs === undefined || currentIDs === '')
|
191
|
+
? id
|
192
|
+
: currentIDs + settings.delimiter + id
|
193
|
+
;
|
194
|
+
if( module.has.visited(id) ) {
|
195
|
+
module.debug('Unique content already visited, not adding visit', id, currentIDs);
|
196
|
+
}
|
197
|
+
else if(id === undefined) {
|
198
|
+
module.debug('ID is not defined');
|
199
|
+
}
|
200
|
+
else {
|
201
|
+
module.debug('Adding visit to unique content', id);
|
202
|
+
module.store(settings.key.ids, newIDs);
|
203
|
+
}
|
204
|
+
module.set.count( module.get.idCount() );
|
205
|
+
},
|
206
|
+
display: function(selector) {
|
207
|
+
var
|
208
|
+
$element = $(selector)
|
209
|
+
;
|
210
|
+
if($element.length > 0 && !$.isWindow($element[0])) {
|
211
|
+
module.debug('Updating visit count for element', $element);
|
212
|
+
$displays = ($displays.length > 0)
|
213
|
+
? $displays.add($element)
|
214
|
+
: $element
|
215
|
+
;
|
216
|
+
}
|
217
|
+
}
|
218
|
+
},
|
219
|
+
|
220
|
+
remove: {
|
221
|
+
id: function(id) {
|
222
|
+
var
|
223
|
+
currentIDs = module.get.ids(),
|
224
|
+
newIDs = []
|
225
|
+
;
|
226
|
+
if(id !== undefined && currentIDs !== undefined) {
|
227
|
+
module.debug('Removing visit to unique content', id, currentIDs);
|
228
|
+
$.each(currentIDs, function(index, value){
|
229
|
+
if(value !== id) {
|
230
|
+
newIDs.push(value);
|
231
|
+
}
|
232
|
+
});
|
233
|
+
newIDs = newIDs.join(settings.delimiter);
|
234
|
+
module.store(settings.key.ids, newIDs );
|
235
|
+
}
|
236
|
+
module.set.count( module.get.idCount() );
|
237
|
+
}
|
238
|
+
},
|
239
|
+
|
240
|
+
check: {
|
241
|
+
limit: function(value) {
|
242
|
+
value = value || module.get.count();
|
243
|
+
if(settings.limit) {
|
244
|
+
if(value >= settings.limit) {
|
245
|
+
module.debug('Pages viewed exceeded limit, firing callback', value, settings.limit);
|
246
|
+
settings.onLimit.call(element, value);
|
247
|
+
}
|
248
|
+
module.debug('Limit not reached', value, settings.limit);
|
249
|
+
settings.onChange.call(element, value);
|
250
|
+
}
|
251
|
+
module.update.display(value);
|
252
|
+
}
|
253
|
+
},
|
254
|
+
|
255
|
+
update: {
|
256
|
+
display: function(value) {
|
257
|
+
value = value || module.get.count();
|
258
|
+
if($displays.length > 0) {
|
259
|
+
module.debug('Updating displayed view count', $displays);
|
260
|
+
$displays.html(value);
|
261
|
+
}
|
262
|
+
}
|
263
|
+
},
|
264
|
+
|
265
|
+
store: function(key, value) {
|
266
|
+
var
|
267
|
+
options = module.get.storageOptions(value)
|
268
|
+
;
|
269
|
+
if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
|
270
|
+
window.localStorage.setItem(key, value);
|
271
|
+
module.debug('Value stored using local storage', key, value);
|
272
|
+
}
|
273
|
+
else if($.cookie !== undefined) {
|
274
|
+
$.cookie(key, value, options);
|
275
|
+
module.debug('Value stored using cookie', key, value, options);
|
276
|
+
}
|
277
|
+
else {
|
278
|
+
module.error(error.noCookieStorage);
|
279
|
+
return;
|
280
|
+
}
|
281
|
+
if(key == settings.key.count) {
|
282
|
+
module.check.limit(value);
|
283
|
+
}
|
284
|
+
},
|
285
|
+
retrieve: function(key, value) {
|
286
|
+
var
|
287
|
+
storedValue
|
288
|
+
;
|
289
|
+
if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
|
290
|
+
storedValue = window.localStorage.getItem(key);
|
291
|
+
}
|
292
|
+
// get by cookie
|
293
|
+
else if($.cookie !== undefined) {
|
294
|
+
storedValue = $.cookie(key);
|
295
|
+
}
|
296
|
+
else {
|
297
|
+
module.error(error.noCookieStorage);
|
298
|
+
}
|
299
|
+
if(storedValue == 'undefined' || storedValue == 'null' || storedValue === undefined || storedValue === null) {
|
300
|
+
storedValue = undefined;
|
301
|
+
}
|
302
|
+
return storedValue;
|
303
|
+
},
|
304
|
+
|
305
|
+
setting: function(name, value) {
|
306
|
+
if( $.isPlainObject(name) ) {
|
307
|
+
$.extend(true, settings, name);
|
308
|
+
}
|
309
|
+
else if(value !== undefined) {
|
310
|
+
settings[name] = value;
|
311
|
+
}
|
312
|
+
else {
|
313
|
+
return settings[name];
|
314
|
+
}
|
315
|
+
},
|
316
|
+
internal: function(name, value) {
|
317
|
+
module.debug('Changing internal', name, value);
|
318
|
+
if(value !== undefined) {
|
319
|
+
if( $.isPlainObject(name) ) {
|
320
|
+
$.extend(true, module, name);
|
321
|
+
}
|
322
|
+
else {
|
323
|
+
module[name] = value;
|
324
|
+
}
|
325
|
+
}
|
326
|
+
else {
|
327
|
+
return module[name];
|
328
|
+
}
|
329
|
+
},
|
330
|
+
debug: function() {
|
331
|
+
if(!settings.silent && settings.debug) {
|
332
|
+
if(settings.performance) {
|
333
|
+
module.performance.log(arguments);
|
334
|
+
}
|
335
|
+
else {
|
336
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
337
|
+
module.debug.apply(console, arguments);
|
338
|
+
}
|
339
|
+
}
|
340
|
+
},
|
341
|
+
verbose: function() {
|
342
|
+
if(!settings.silent && settings.verbose && settings.debug) {
|
343
|
+
if(settings.performance) {
|
344
|
+
module.performance.log(arguments);
|
345
|
+
}
|
346
|
+
else {
|
347
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
348
|
+
module.verbose.apply(console, arguments);
|
349
|
+
}
|
350
|
+
}
|
351
|
+
},
|
352
|
+
error: function() {
|
353
|
+
if(!settings.silent) {
|
354
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
355
|
+
module.error.apply(console, arguments);
|
356
|
+
}
|
357
|
+
},
|
358
|
+
performance: {
|
359
|
+
log: function(message) {
|
360
|
+
var
|
361
|
+
currentTime,
|
362
|
+
executionTime,
|
363
|
+
previousTime
|
364
|
+
;
|
365
|
+
if(settings.performance) {
|
366
|
+
currentTime = new Date().getTime();
|
367
|
+
previousTime = time || currentTime;
|
368
|
+
executionTime = currentTime - previousTime;
|
369
|
+
time = currentTime;
|
370
|
+
performance.push({
|
371
|
+
'Name' : message[0],
|
372
|
+
'Arguments' : [].slice.call(message, 1) || '',
|
373
|
+
'Element' : element,
|
374
|
+
'Execution Time' : executionTime
|
375
|
+
});
|
376
|
+
}
|
377
|
+
clearTimeout(module.performance.timer);
|
378
|
+
module.performance.timer = setTimeout(module.performance.display, 500);
|
379
|
+
},
|
380
|
+
display: function() {
|
381
|
+
var
|
382
|
+
title = settings.name + ':',
|
383
|
+
totalTime = 0
|
384
|
+
;
|
385
|
+
time = false;
|
386
|
+
clearTimeout(module.performance.timer);
|
387
|
+
$.each(performance, function(index, data) {
|
388
|
+
totalTime += data['Execution Time'];
|
389
|
+
});
|
390
|
+
title += ' ' + totalTime + 'ms';
|
391
|
+
if(moduleSelector) {
|
392
|
+
title += ' \'' + moduleSelector + '\'';
|
393
|
+
}
|
394
|
+
if($allModules.length > 1) {
|
395
|
+
title += ' ' + '(' + $allModules.length + ')';
|
396
|
+
}
|
397
|
+
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
398
|
+
console.groupCollapsed(title);
|
399
|
+
if(console.table) {
|
400
|
+
console.table(performance);
|
401
|
+
}
|
402
|
+
else {
|
403
|
+
$.each(performance, function(index, data) {
|
404
|
+
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
405
|
+
});
|
406
|
+
}
|
407
|
+
console.groupEnd();
|
408
|
+
}
|
409
|
+
performance = [];
|
410
|
+
}
|
411
|
+
},
|
412
|
+
invoke: function(query, passedArguments, context) {
|
413
|
+
var
|
414
|
+
object = instance,
|
415
|
+
maxDepth,
|
416
|
+
found,
|
417
|
+
response
|
418
|
+
;
|
419
|
+
passedArguments = passedArguments || queryArguments;
|
420
|
+
context = element || context;
|
421
|
+
if(typeof query == 'string' && object !== undefined) {
|
422
|
+
query = query.split(/[\. ]/);
|
423
|
+
maxDepth = query.length - 1;
|
424
|
+
$.each(query, function(depth, value) {
|
425
|
+
var camelCaseValue = (depth != maxDepth)
|
426
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
427
|
+
: query
|
428
|
+
;
|
429
|
+
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
430
|
+
object = object[camelCaseValue];
|
431
|
+
}
|
432
|
+
else if( object[camelCaseValue] !== undefined ) {
|
433
|
+
found = object[camelCaseValue];
|
434
|
+
return false;
|
435
|
+
}
|
436
|
+
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
437
|
+
object = object[value];
|
438
|
+
}
|
439
|
+
else if( object[value] !== undefined ) {
|
440
|
+
found = object[value];
|
441
|
+
return false;
|
442
|
+
}
|
443
|
+
else {
|
444
|
+
return false;
|
445
|
+
}
|
446
|
+
});
|
447
|
+
}
|
448
|
+
if ( $.isFunction( found ) ) {
|
449
|
+
response = found.apply(context, passedArguments);
|
450
|
+
}
|
451
|
+
else if(found !== undefined) {
|
452
|
+
response = found;
|
453
|
+
}
|
454
|
+
if($.isArray(returnedValue)) {
|
455
|
+
returnedValue.push(response);
|
456
|
+
}
|
457
|
+
else if(returnedValue !== undefined) {
|
458
|
+
returnedValue = [returnedValue, response];
|
459
|
+
}
|
460
|
+
else if(response !== undefined) {
|
461
|
+
returnedValue = response;
|
462
|
+
}
|
463
|
+
return found;
|
464
|
+
}
|
465
|
+
};
|
466
|
+
if(methodInvoked) {
|
467
|
+
if(instance === undefined) {
|
468
|
+
module.initialize();
|
469
|
+
}
|
470
|
+
module.invoke(query);
|
471
|
+
}
|
472
|
+
else {
|
473
|
+
if(instance !== undefined) {
|
474
|
+
instance.invoke('destroy');
|
475
|
+
}
|
476
|
+
module.initialize();
|
477
|
+
}
|
478
|
+
|
479
|
+
})
|
480
|
+
;
|
481
|
+
return (returnedValue !== undefined)
|
482
|
+
? returnedValue
|
483
|
+
: this
|
484
|
+
;
|
485
|
+
};
|
486
|
+
|
487
|
+
$.fn.visit.settings = {
|
488
|
+
|
489
|
+
name : 'Visit',
|
490
|
+
|
491
|
+
debug : false,
|
492
|
+
verbose : false,
|
493
|
+
performance : true,
|
494
|
+
|
495
|
+
namespace : 'visit',
|
496
|
+
|
497
|
+
increment : false,
|
498
|
+
surpass : false,
|
499
|
+
count : false,
|
500
|
+
limit : false,
|
501
|
+
|
502
|
+
delimiter : '&',
|
503
|
+
storageMethod : 'localstorage',
|
504
|
+
|
505
|
+
key : {
|
506
|
+
count : 'visit-count',
|
507
|
+
ids : 'visit-ids'
|
508
|
+
},
|
509
|
+
|
510
|
+
expires : 30,
|
511
|
+
domain : false,
|
512
|
+
path : '/',
|
513
|
+
|
514
|
+
onLimit : function() {},
|
515
|
+
onChange : function() {},
|
516
|
+
|
517
|
+
error : {
|
518
|
+
method : 'The method you called is not defined',
|
519
|
+
missingPersist : 'Using the persist setting requires the inclusion of PersistJS',
|
520
|
+
noCookieStorage : 'The default storage cookie requires $.cookie to be included.'
|
521
|
+
}
|
522
|
+
|
523
|
+
};
|
524
|
+
|
525
|
+
})( jQuery, window, document );
|