semantic_ui_rails 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +20 -0
  5. data/README.md +4 -0
  6. data/Rakefile +1 -0
  7. data/app/assets/fonts/semantic/icons.eot +0 -0
  8. data/app/assets/fonts/semantic/icons.svg +450 -0
  9. data/app/assets/fonts/semantic/icons.ttf +0 -0
  10. data/app/assets/fonts/semantic/icons.woff +0 -0
  11. data/app/assets/images/semantic/loader-large-inverted.gif +0 -0
  12. data/app/assets/images/semantic/loader-large.gif +0 -0
  13. data/app/assets/images/semantic/loader-medium-inverted.gif +0 -0
  14. data/app/assets/images/semantic/loader-medium.gif +0 -0
  15. data/app/assets/images/semantic/loader-mini-inverted.gif +0 -0
  16. data/app/assets/images/semantic/loader-mini.gif +0 -0
  17. data/app/assets/images/semantic/loader-small-inverted.gif +0 -0
  18. data/app/assets/images/semantic/loader-small.gif +0 -0
  19. data/app/assets/javascript/semantic/accordion.js +411 -0
  20. data/app/assets/javascript/semantic/behavior/api.js +666 -0
  21. data/app/assets/javascript/semantic/behavior/colorize.js +271 -0
  22. data/app/assets/javascript/semantic/behavior/form.js +703 -0
  23. data/app/assets/javascript/semantic/behavior/state.js +752 -0
  24. data/app/assets/javascript/semantic/chatroom.js +766 -0
  25. data/app/assets/javascript/semantic/checkbox.js +348 -0
  26. data/app/assets/javascript/semantic/dimmer.js +524 -0
  27. data/app/assets/javascript/semantic/dropdown.js +707 -0
  28. data/app/assets/javascript/semantic/modal.js +478 -0
  29. data/app/assets/javascript/semantic/nag.js +542 -0
  30. data/app/assets/javascript/semantic/popup.js +721 -0
  31. data/app/assets/javascript/semantic/rating.js +358 -0
  32. data/app/assets/javascript/semantic/search.js +769 -0
  33. data/app/assets/javascript/semantic/shape.js +776 -0
  34. data/app/assets/javascript/semantic/sidebar.js +489 -0
  35. data/app/assets/javascript/semantic/tab.js +674 -0
  36. data/app/assets/javascript/semantic/transition.js +650 -0
  37. data/app/assets/javascript/semantic/video.js +459 -0
  38. data/app/assets/stylesheets/semantic/accordion.css +97 -0
  39. data/app/assets/stylesheets/semantic/breadcrumb.css +66 -0
  40. data/app/assets/stylesheets/semantic/button.css +993 -0
  41. data/app/assets/stylesheets/semantic/chatroom.css +242 -0
  42. data/app/assets/stylesheets/semantic/checkbox.css +300 -0
  43. data/app/assets/stylesheets/semantic/comment.css +178 -0
  44. data/app/assets/stylesheets/semantic/dimmer.css +185 -0
  45. data/app/assets/stylesheets/semantic/divider.css +155 -0
  46. data/app/assets/stylesheets/semantic/dropdown.css +415 -0
  47. data/app/assets/stylesheets/semantic/feed.css +126 -0
  48. data/app/assets/stylesheets/semantic/form.css +427 -0
  49. data/app/assets/stylesheets/semantic/grid.css +561 -0
  50. data/app/assets/stylesheets/semantic/header.css +277 -0
  51. data/app/assets/stylesheets/semantic/icon.css +811 -0
  52. data/app/assets/stylesheets/semantic/image.css +143 -0
  53. data/app/assets/stylesheets/semantic/input.css +225 -0
  54. data/app/assets/stylesheets/semantic/item.css +564 -0
  55. data/app/assets/stylesheets/semantic/label.css +687 -0
  56. data/app/assets/stylesheets/semantic/list.css +418 -0
  57. data/app/assets/stylesheets/semantic/loader.css +148 -0
  58. data/app/assets/stylesheets/semantic/menu.css +1409 -0
  59. data/app/assets/stylesheets/semantic/message.css +242 -0
  60. data/app/assets/stylesheets/semantic/modal.css +123 -0
  61. data/app/assets/stylesheets/semantic/nag.css +130 -0
  62. data/app/assets/stylesheets/semantic/popup.css +209 -0
  63. data/app/assets/stylesheets/semantic/progress.css +257 -0
  64. data/app/assets/stylesheets/semantic/rating.css +120 -0
  65. data/app/assets/stylesheets/semantic/reveal.css +283 -0
  66. data/app/assets/stylesheets/semantic/search.css +222 -0
  67. data/app/assets/stylesheets/semantic/segment.css +362 -0
  68. data/app/assets/stylesheets/semantic/shape.css +87 -0
  69. data/app/assets/stylesheets/semantic/sidebar.css +100 -0
  70. data/app/assets/stylesheets/semantic/step.css +240 -0
  71. data/app/assets/stylesheets/semantic/tab.css +52 -0
  72. data/app/assets/stylesheets/semantic/table.css +468 -0
  73. data/app/assets/stylesheets/semantic/transition.css +867 -0
  74. data/app/assets/stylesheets/semantic/video.css +81 -0
  75. data/lib/semantic_ui_rails/version.rb +3 -0
  76. data/lib/semantic_ui_rails.rb +7 -0
  77. data/semantic_ui_rails.gemspec +23 -0
  78. metadata +149 -0
@@ -0,0 +1,674 @@
1
+ /* ******************************
2
+ Module - Tabs
3
+ Author: Jack Lukic
4
+ Notes: First Commit Aug 15, 2012
5
+
6
+ History based tab navigation
7
+ ****************************** */
8
+
9
+ ;(function ($, window, document, undefined) {
10
+
11
+ $.fn.tab = function(parameters) {
12
+
13
+ var
14
+ settings = $.extend(true, {}, $.fn.tab.settings, parameters),
15
+
16
+ $module = $(this),
17
+ $tabs = $(settings.context).find(settings.selector.tabs),
18
+
19
+ moduleSelector = $module.selector || '',
20
+
21
+ cache = {},
22
+ firstLoad = true,
23
+ recursionDepth = 0,
24
+
25
+ activeTabPath,
26
+ parameterArray,
27
+ historyEvent,
28
+
29
+ element = this,
30
+ time = new Date().getTime(),
31
+ performance = [],
32
+
33
+ className = settings.className,
34
+ metadata = settings.metadata,
35
+ error = settings.error,
36
+
37
+ eventNamespace = '.' + settings.namespace,
38
+ moduleNamespace = settings.namespace + '-module',
39
+
40
+ instance = $module.data(moduleNamespace),
41
+
42
+ query = arguments[0],
43
+ methodInvoked = (instance !== undefined && typeof query == 'string'),
44
+ queryArguments = [].slice.call(arguments, 1),
45
+
46
+ module,
47
+ invokedResponse
48
+ ;
49
+
50
+ module = {
51
+
52
+ initialize: function() {
53
+ module.debug('Initializing Tabs', $module);
54
+ // attach history events
55
+ if(settings.history) {
56
+ if( $.address === undefined ) {
57
+ module.error(error.state);
58
+ return false;
59
+ }
60
+ else if(settings.path === false) {
61
+ module.error(error.path);
62
+ return false;
63
+ }
64
+ else {
65
+ if(settings.auto) {
66
+ settings.apiSettings = {
67
+ url: settings.path + '/{$tab}'
68
+ };
69
+ }
70
+ module.verbose('Address library found adding state change event');
71
+ $.address
72
+ .state(settings.path)
73
+ .unbind('change')
74
+ .bind('change', module.event.history.change)
75
+ ;
76
+ }
77
+ }
78
+ // attach events if navigation wasn't set to window
79
+ if( !$.isWindow( element ) ) {
80
+ $module
81
+ .on('click' + eventNamespace, module.event.click)
82
+ ;
83
+ }
84
+ module.instantiate();
85
+ },
86
+
87
+ instantiate: function () {
88
+ module.verbose('Storing instance of module', module);
89
+ $module
90
+ .data(moduleNamespace, module)
91
+ ;
92
+ },
93
+
94
+ destroy: function() {
95
+ module.debug('Destroying tabs', $module);
96
+ $module
97
+ .off(eventNamespace)
98
+ ;
99
+ },
100
+
101
+ event: {
102
+ click: function() {
103
+ module.debug('Navigation clicked');
104
+ var
105
+ tabPath = $(this).data(metadata.tab)
106
+ ;
107
+ if(tabPath !== undefined) {
108
+ if(settings.history) {
109
+ $.address.value(tabPath);
110
+ }
111
+ else {
112
+ module.changeTab(tabPath);
113
+ }
114
+ }
115
+ else {
116
+ module.debug('No tab specified');
117
+ }
118
+ },
119
+ history: {
120
+ change: function(event) {
121
+ var
122
+ tabPath = event.pathNames.join('/') || module.get.initialPath(),
123
+ pageTitle = settings.templates.determineTitle(tabPath) || false
124
+ ;
125
+ module.debug('History change event', tabPath, event);
126
+ historyEvent = event;
127
+ if(tabPath !== undefined) {
128
+ module.changeTab(tabPath);
129
+ }
130
+ if(pageTitle) {
131
+ $.address.title(pageTitle);
132
+ }
133
+ }
134
+ }
135
+ },
136
+
137
+ refresh: function() {
138
+ if(activeTabPath) {
139
+ module.debug('Refreshing tab', activeTabPath);
140
+ module.changeTab(activeTabPath);
141
+ }
142
+ },
143
+
144
+ cache: {
145
+
146
+ read: function(cacheKey) {
147
+ return (cacheKey !== undefined)
148
+ ? cache[cacheKey]
149
+ : false
150
+ ;
151
+ },
152
+ add: function(cacheKey, content) {
153
+ cacheKey = cacheKey || activeTabPath;
154
+ module.debug('Adding cached content for', cacheKey);
155
+ cache[cacheKey] = content;
156
+ },
157
+ remove: function(cacheKey) {
158
+ cacheKey = cacheKey || activeTabPath;
159
+ module.debug('Removing cached content for', cacheKey);
160
+ delete cache[cacheKey];
161
+ }
162
+ },
163
+
164
+ changeTab: function(tabPath) {
165
+ var
166
+ pushStateAvailable = (window.history && window.history.pushState),
167
+ shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad),
168
+ remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ),
169
+ // only get default path if not remote content
170
+ pathArray = (remoteContent && !shouldIgnoreLoad)
171
+ ? module.utilities.pathToArray(tabPath)
172
+ : module.get.defaultPathArray(tabPath),
173
+ tabPath = module.utilities.arrayToPath(pathArray)
174
+ ;
175
+ module.deactivate.all();
176
+ $.each(pathArray, function(index, tab) {
177
+ var
178
+ currentPathArray = pathArray.slice(0, index + 1),
179
+ currentPath = module.utilities.arrayToPath(currentPathArray),
180
+
181
+ isTab = module.is.tab(currentPath),
182
+ isLastIndex = (index + 1 == pathArray.length),
183
+
184
+ $tab = module.get.tabElement(currentPath),
185
+ nextPathArray,
186
+ nextPath,
187
+ isLastTab
188
+ ;
189
+ module.verbose('Looking for tab', tab);
190
+ if(isTab) {
191
+ module.verbose('Tab was found', tab);
192
+
193
+ // scope up
194
+ activeTabPath = currentPath;
195
+ parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
196
+
197
+ if(isLastIndex) {
198
+ isLastTab = true;
199
+ }
200
+ else {
201
+ nextPathArray = pathArray.slice(0, index + 2);
202
+ nextPath = module.utilities.arrayToPath(nextPathArray);
203
+ isLastTab = ( !module.is.tab(nextPath) );
204
+ if(isLastTab) {
205
+ module.verbose('Tab parameters found', nextPathArray);
206
+ }
207
+ }
208
+ if(isLastTab && remoteContent) {
209
+ if(!shouldIgnoreLoad) {
210
+ module.activate.navigation(currentPath);
211
+ module.content.fetch(currentPath, tabPath);
212
+ }
213
+ else {
214
+ module.debug('Ignoring remote content on first tab load', currentPath);
215
+ firstLoad = false;
216
+ module.cache.add(tabPath, $tab.html());
217
+ module.activate.all(currentPath);
218
+ $.proxy(settings.onTabInit, $tab)(currentPath, parameterArray, historyEvent);
219
+ $.proxy(settings.onTabLoad, $tab)(currentPath, parameterArray, historyEvent);
220
+ }
221
+ return false;
222
+ }
223
+ else {
224
+ module.debug('Opened local tab', currentPath);
225
+ module.activate.all(currentPath);
226
+ $.proxy(settings.onTabLoad, $tab)(currentPath, parameterArray, historyEvent);
227
+ }
228
+ }
229
+ else {
230
+ module.error(error.missingTab, tab);
231
+ return false;
232
+ }
233
+ });
234
+ },
235
+
236
+ content: {
237
+
238
+ fetch: function(tabPath, fullTabPath) {
239
+ var
240
+ $tab = module.get.tabElement(tabPath),
241
+ fullTabPath = fullTabPath || tabPath,
242
+ cachedContent = module.cache.read(fullTabPath),
243
+ apiSettings = {
244
+ dataType : 'html',
245
+ stateContext : $tab,
246
+ success : function(response) {
247
+ module.cache.add(fullTabPath, response);
248
+ module.content.update(tabPath, response);
249
+ if(tabPath == activeTabPath) {
250
+ module.debug('Content loaded', tabPath);
251
+ module.activate.tab(tabPath);
252
+ }
253
+ else {
254
+ module.debug('Content loaded in background', tabPath);
255
+ }
256
+ $.proxy(settings.onTabInit, $tab)(tabPath, parameterArray, historyEvent);
257
+ $.proxy(settings.onTabLoad, $tab)(tabPath, parameterArray, historyEvent);
258
+ },
259
+ urlData: { tab: fullTabPath }
260
+ },
261
+ request = $tab.data(metadata.promise) || false,
262
+ existingRequest = ( request && request.state() === 'pending' )
263
+ ;
264
+ if(settings.cache && cachedContent) {
265
+ module.debug('Showing existing content', fullTabPath);
266
+ module.content.update(tabPath, cachedContent);
267
+ module.activate.tab(tabPath);
268
+ $.proxy(settings.onTabLoad, $tab)(tabPath, parameterArray, historyEvent);
269
+ }
270
+ else if(existingRequest) {
271
+ module.debug('Content is already loading', fullTabPath);
272
+ $tab
273
+ .addClass(className.loading)
274
+ ;
275
+ }
276
+ else if($.api !== undefined) {
277
+ module.debug('Retrieving remote content', fullTabPath);
278
+ $.api( $.extend(true, { headers: { 'X-Remote': true } }, settings.apiSettings, apiSettings) );
279
+ }
280
+ else {
281
+ module.error(error.api);
282
+ }
283
+ },
284
+
285
+ update: function(tabPath, html) {
286
+ module.debug('Updating html for', tabPath);
287
+ var
288
+ $tab = module.get.tabElement(tabPath)
289
+ ;
290
+ $tab
291
+ .html(html)
292
+ ;
293
+ }
294
+ },
295
+
296
+ activate: {
297
+ all: function(tabPath) {
298
+ module.activate.tab(tabPath);
299
+ module.activate.navigation(tabPath);
300
+ },
301
+ tab: function(tabPath) {
302
+ var
303
+ $tab = module.get.tabElement(tabPath)
304
+ ;
305
+ module.verbose('Showing tab content for', $tab);
306
+ $tab.addClass(className.active);
307
+ },
308
+ navigation: function(tabPath) {
309
+ var
310
+ $navigation = module.get.navElement(tabPath)
311
+ ;
312
+ module.verbose('Activating tab navigation for', $navigation, tabPath);
313
+ $navigation.addClass(className.active);
314
+ }
315
+ },
316
+
317
+ deactivate: {
318
+ all: function() {
319
+ module.deactivate.navigation();
320
+ module.deactivate.tabs();
321
+ },
322
+ navigation: function() {
323
+ $module
324
+ .removeClass(className.active)
325
+ ;
326
+ },
327
+ tabs: function() {
328
+ $tabs
329
+ .removeClass(className.active + ' ' + className.loading)
330
+ ;
331
+ }
332
+ },
333
+
334
+ is: {
335
+ tab: function(tabName) {
336
+ return (tabName !== undefined)
337
+ ? ( module.get.tabElement(tabName).size() > 0 )
338
+ : false
339
+ ;
340
+ }
341
+ },
342
+
343
+ get: {
344
+ initialPath: function() {
345
+ return $module.eq(0).data(metadata.tab) || $tabs.eq(0).data(metadata.tab);
346
+ },
347
+ path: function() {
348
+ return $.address.value();
349
+ },
350
+ // adds default tabs to tab path
351
+ defaultPathArray: function(tabPath) {
352
+ return module.utilities.pathToArray( module.get.defaultPath(tabPath) );
353
+ },
354
+ defaultPath: function(tabPath) {
355
+ var
356
+ $defaultNav = $module.filter('[data-' + metadata.tab + '^="' + tabPath + '/"]').eq(0),
357
+ defaultTab = $defaultNav.data(metadata.tab) || false
358
+ ;
359
+ if( defaultTab ) {
360
+ module.debug('Found default tab', defaultTab);
361
+ if(recursionDepth < settings.maxDepth) {
362
+ recursionDepth++;
363
+ return module.get.defaultPath(defaultTab);
364
+ }
365
+ module.error(error.recursion);
366
+ }
367
+ else {
368
+ module.debug('No default tabs found for', tabPath);
369
+ }
370
+ recursionDepth = 0;
371
+ return tabPath;
372
+ },
373
+ navElement: function(tabPath) {
374
+ tabPath = tabPath || activeTabPath;
375
+ return $module.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
376
+ },
377
+ tabElement: function(tabPath) {
378
+ var
379
+ $fullPathTab,
380
+ $simplePathTab,
381
+ tabPathArray,
382
+ lastTab
383
+ ;
384
+ tabPath = tabPath || activeTabPath;
385
+ tabPathArray = module.utilities.pathToArray(tabPath);
386
+ lastTab = module.utilities.last(tabPathArray);
387
+ $fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]');
388
+ $simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
389
+ return ($fullPathTab.size() > 0)
390
+ ? $fullPathTab
391
+ : $simplePathTab
392
+ ;
393
+ },
394
+ tab: function() {
395
+ return activeTabPath;
396
+ }
397
+ },
398
+
399
+ utilities: {
400
+ filterArray: function(keepArray, removeArray) {
401
+ return $.grep(keepArray, function(keepValue) {
402
+ return ( $.inArray(keepValue, removeArray) == -1);
403
+ });
404
+ },
405
+ last: function(array) {
406
+ return $.isArray(array)
407
+ ? array[ array.length - 1]
408
+ : false
409
+ ;
410
+ },
411
+ pathToArray: function(pathName) {
412
+ if(pathName === undefined) {
413
+ pathName = activeTabPath;
414
+ }
415
+ return typeof pathName == 'string'
416
+ ? pathName.split('/')
417
+ : [pathName]
418
+ ;
419
+ },
420
+ arrayToPath: function(pathArray) {
421
+ return $.isArray(pathArray)
422
+ ? pathArray.join('/')
423
+ : false
424
+ ;
425
+ }
426
+ },
427
+
428
+ setting: function(name, value) {
429
+ if(value !== undefined) {
430
+ if( $.isPlainObject(name) ) {
431
+ $.extend(true, settings, name);
432
+ }
433
+ else {
434
+ settings[name] = value;
435
+ }
436
+ }
437
+ else {
438
+ return settings[name];
439
+ }
440
+ },
441
+ internal: function(name, value) {
442
+ if(value !== undefined) {
443
+ if( $.isPlainObject(name) ) {
444
+ $.extend(true, module, name);
445
+ }
446
+ else {
447
+ module[name] = value;
448
+ }
449
+ }
450
+ else {
451
+ return module[name];
452
+ }
453
+ },
454
+ debug: function() {
455
+ if(settings.debug) {
456
+ if(settings.performance) {
457
+ module.performance.log(arguments);
458
+ }
459
+ else {
460
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
461
+ module.debug.apply(console, arguments);
462
+ }
463
+ }
464
+ },
465
+ verbose: function() {
466
+ if(settings.verbose && settings.debug) {
467
+ if(settings.performance) {
468
+ module.performance.log(arguments);
469
+ }
470
+ else {
471
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
472
+ module.verbose.apply(console, arguments);
473
+ }
474
+ }
475
+ },
476
+ error: function() {
477
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
478
+ module.error.apply(console, arguments);
479
+ },
480
+ performance: {
481
+ log: function(message) {
482
+ var
483
+ currentTime,
484
+ executionTime,
485
+ previousTime
486
+ ;
487
+ if(settings.performance) {
488
+ currentTime = new Date().getTime();
489
+ previousTime = time || currentTime;
490
+ executionTime = currentTime - previousTime;
491
+ time = currentTime;
492
+ performance.push({
493
+ 'Element' : element,
494
+ 'Name' : message[0],
495
+ 'Arguments' : [].slice.call(message, 1) || '',
496
+ 'Execution Time' : executionTime
497
+ });
498
+ }
499
+ clearTimeout(module.performance.timer);
500
+ module.performance.timer = setTimeout(module.performance.display, 100);
501
+ },
502
+ display: function() {
503
+ var
504
+ title = settings.name + ':',
505
+ totalTime = 0
506
+ ;
507
+ time = false;
508
+ clearTimeout(module.performance.timer);
509
+ $.each(performance, function(index, data) {
510
+ totalTime += data['Execution Time'];
511
+ });
512
+ title += ' ' + totalTime + 'ms';
513
+ if(moduleSelector) {
514
+ title += ' \'' + moduleSelector + '\'';
515
+ }
516
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
517
+ console.groupCollapsed(title);
518
+ if(console.table) {
519
+ console.table(performance);
520
+ }
521
+ else {
522
+ $.each(performance, function(index, data) {
523
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
524
+ });
525
+ }
526
+ console.groupEnd();
527
+ }
528
+ performance = [];
529
+ }
530
+ },
531
+ invoke: function(query, passedArguments, context) {
532
+ var
533
+ maxDepth,
534
+ found,
535
+ response
536
+ ;
537
+ passedArguments = passedArguments || queryArguments;
538
+ context = element || context;
539
+ if(typeof query == 'string' && instance !== undefined) {
540
+ query = query.split(/[\. ]/);
541
+ maxDepth = query.length - 1;
542
+ $.each(query, function(depth, value) {
543
+ var camelCaseValue = (depth != maxDepth)
544
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
545
+ : query
546
+ ;
547
+ if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) {
548
+ instance = instance[value];
549
+ }
550
+ else if( $.isPlainObject( instance[camelCaseValue] ) && (depth != maxDepth) ) {
551
+ instance = instance[camelCaseValue];
552
+ }
553
+ else if( instance[value] !== undefined ) {
554
+ found = instance[value];
555
+ return false;
556
+ }
557
+ else if( instance[camelCaseValue] !== undefined ) {
558
+ found = instance[camelCaseValue];
559
+ return false;
560
+ }
561
+ else {
562
+ module.error(error.method);
563
+ return false;
564
+ }
565
+ });
566
+ }
567
+ if ( $.isFunction( found ) ) {
568
+ response = found.apply(context, passedArguments);
569
+ }
570
+ else if(found !== undefined) {
571
+ response = found;
572
+ }
573
+ if($.isArray(invokedResponse)) {
574
+ invokedResponse.push(response);
575
+ }
576
+ else if(typeof invokedResponse == 'string') {
577
+ invokedResponse = [invokedResponse, response];
578
+ }
579
+ else if(response !== undefined) {
580
+ invokedResponse = response;
581
+ }
582
+ return found;
583
+ }
584
+ };
585
+
586
+ if(methodInvoked) {
587
+ if(instance === undefined) {
588
+ module.initialize();
589
+ }
590
+ module.invoke(query);
591
+ }
592
+ else {
593
+ if(instance !== undefined) {
594
+ module.destroy();
595
+ }
596
+ module.initialize();
597
+ }
598
+
599
+ return (invokedResponse !== undefined)
600
+ ? invokedResponse
601
+ : this
602
+ ;
603
+
604
+ };
605
+
606
+ // shortcut for tabbed content with no defined navigation
607
+ $.tab = function(settings) {
608
+ $(window).tab(settings);
609
+ };
610
+
611
+ $.fn.tab.settings = {
612
+
613
+ name : 'Tab',
614
+ verbose : true,
615
+ debug : true,
616
+ performance : true,
617
+ namespace : 'tab',
618
+
619
+ // only called first time a tab's content is loaded (when remote source)
620
+ onTabInit : function(tabPath, parameterArray, historyEvent) {},
621
+ // called on every load
622
+ onTabLoad : function(tabPath, parameterArray, historyEvent) {},
623
+
624
+ templates : {
625
+ determineTitle: function(tabArray) {}
626
+ },
627
+
628
+ // uses pjax style endpoints fetching content from same url with remote-content headers
629
+ auto : false,
630
+
631
+ history : false,
632
+ path : false,
633
+
634
+ context : 'body',
635
+
636
+ // max depth a tab can be nested
637
+ maxDepth : 25,
638
+ // dont load content on first load
639
+ ignoreFirstLoad : true,
640
+ // load tab content new every tab click
641
+ alwaysRefresh : false,
642
+ // cache the content requests to pull locally
643
+ cache : true,
644
+ // settings for api call
645
+ apiSettings : false,
646
+
647
+ error: {
648
+ api : 'You attempted to load content without API module',
649
+ noContent : 'The tab you specified is missing a content url.',
650
+ method : 'The method you called is not defined',
651
+ state : 'The state library has not been initialized',
652
+ missingTab : 'Tab cannot be found',
653
+ path : 'History enabled, but no path was specified',
654
+ recursion : 'Max recursive depth reached'
655
+ },
656
+
657
+ metadata : {
658
+ tab : 'tab',
659
+ loaded : 'loaded',
660
+ promise: 'promise'
661
+ },
662
+
663
+ className : {
664
+ loading : 'loading',
665
+ active : 'active'
666
+ },
667
+
668
+ selector : {
669
+ tabs : '.tab'
670
+ }
671
+
672
+ };
673
+
674
+ })( jQuery, window , document );