semantic-ui 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/lib/semantic-ui.rb +8 -0
  3. data/lib/semantic-ui/version.rb +5 -0
  4. data/vendor/assets/fonts/icons.eot +0 -0
  5. data/vendor/assets/fonts/icons.svg +450 -0
  6. data/vendor/assets/fonts/icons.ttf +0 -0
  7. data/vendor/assets/fonts/icons.woff +0 -0
  8. data/vendor/assets/images/loader-large-inverted.gif +0 -0
  9. data/vendor/assets/images/loader-large.gif +0 -0
  10. data/vendor/assets/images/loader-medium-inverted.gif +0 -0
  11. data/vendor/assets/images/loader-medium.gif +0 -0
  12. data/vendor/assets/images/loader-mini-inverted.gif +0 -0
  13. data/vendor/assets/images/loader-mini.gif +0 -0
  14. data/vendor/assets/images/loader-small-inverted.gif +0 -0
  15. data/vendor/assets/images/loader-small.gif +0 -0
  16. data/vendor/assets/javascripts/modules/accordion.js +411 -0
  17. data/vendor/assets/javascripts/modules/behavior/api.js +666 -0
  18. data/vendor/assets/javascripts/modules/behavior/colorize.js +271 -0
  19. data/vendor/assets/javascripts/modules/behavior/form.js +703 -0
  20. data/vendor/assets/javascripts/modules/behavior/state.js +752 -0
  21. data/vendor/assets/javascripts/modules/chatroom.js +766 -0
  22. data/vendor/assets/javascripts/modules/checkbox.js +348 -0
  23. data/vendor/assets/javascripts/modules/dimmer.js +524 -0
  24. data/vendor/assets/javascripts/modules/dropdown.js +707 -0
  25. data/vendor/assets/javascripts/modules/modal.js +478 -0
  26. data/vendor/assets/javascripts/modules/nag.js +542 -0
  27. data/vendor/assets/javascripts/modules/popup.js +721 -0
  28. data/vendor/assets/javascripts/modules/rating.js +358 -0
  29. data/vendor/assets/javascripts/modules/search.js +769 -0
  30. data/vendor/assets/javascripts/modules/shape.js +776 -0
  31. data/vendor/assets/javascripts/modules/sidebar.js +489 -0
  32. data/vendor/assets/javascripts/modules/tab.js +674 -0
  33. data/vendor/assets/javascripts/modules/transition.js +650 -0
  34. data/vendor/assets/javascripts/modules/video.js +459 -0
  35. data/vendor/assets/javascripts/semantic-ui.js +1 -0
  36. data/vendor/assets/stylesheets/collections/breadcrumb.less +79 -0
  37. data/vendor/assets/stylesheets/collections/form.less +536 -0
  38. data/vendor/assets/stylesheets/collections/grid.less +655 -0
  39. data/vendor/assets/stylesheets/collections/menu.less +1765 -0
  40. data/vendor/assets/stylesheets/collections/message.less +337 -0
  41. data/vendor/assets/stylesheets/collections/table.less +532 -0
  42. data/vendor/assets/stylesheets/elements/button.less +1190 -0
  43. data/vendor/assets/stylesheets/elements/divider.less +200 -0
  44. data/vendor/assets/stylesheets/elements/header.less +325 -0
  45. data/vendor/assets/stylesheets/elements/icon.less +484 -0
  46. data/vendor/assets/stylesheets/elements/image.less +170 -0
  47. data/vendor/assets/stylesheets/elements/input.less +300 -0
  48. data/vendor/assets/stylesheets/elements/label.less +824 -0
  49. data/vendor/assets/stylesheets/elements/loader.less +178 -0
  50. data/vendor/assets/stylesheets/elements/progress.less +353 -0
  51. data/vendor/assets/stylesheets/elements/segment.less +465 -0
  52. data/vendor/assets/stylesheets/elements/step.less +294 -0
  53. data/vendor/assets/stylesheets/modules/accordion.less +135 -0
  54. data/vendor/assets/stylesheets/modules/chatroom.less +271 -0
  55. data/vendor/assets/stylesheets/modules/checkbox.less +380 -0
  56. data/vendor/assets/stylesheets/modules/dimmer.less +230 -0
  57. data/vendor/assets/stylesheets/modules/dropdown.less +506 -0
  58. data/vendor/assets/stylesheets/modules/modal.less +160 -0
  59. data/vendor/assets/stylesheets/modules/nag.less +175 -0
  60. data/vendor/assets/stylesheets/modules/popup.less +238 -0
  61. data/vendor/assets/stylesheets/modules/rating.less +151 -0
  62. data/vendor/assets/stylesheets/modules/reveal.less +367 -0
  63. data/vendor/assets/stylesheets/modules/search.less +275 -0
  64. data/vendor/assets/stylesheets/modules/shape.less +115 -0
  65. data/vendor/assets/stylesheets/modules/sidebar.less +147 -0
  66. data/vendor/assets/stylesheets/modules/tab.less +59 -0
  67. data/vendor/assets/stylesheets/modules/transition.less +839 -0
  68. data/vendor/assets/stylesheets/modules/video.less +99 -0
  69. data/vendor/assets/stylesheets/semantic-ui.less +1 -0
  70. data/vendor/assets/stylesheets/views/comment.less +221 -0
  71. data/vendor/assets/stylesheets/views/feed.less +151 -0
  72. data/vendor/assets/stylesheets/views/item.less +641 -0
  73. data/vendor/assets/stylesheets/views/list.less +508 -0
  74. data/vendor/assets/stylesheets/views/statistic.css +27 -0
  75. metadata +187 -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 );