semantic-ui-sass 0.19.3.1 → 1.7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +5 -6
  4. data/app/assets/fonts/semantic-ui/icons.eot +0 -0
  5. data/app/assets/fonts/semantic-ui/icons.otf +0 -0
  6. data/app/assets/fonts/semantic-ui/icons.svg +472 -367
  7. data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
  8. data/app/assets/fonts/semantic-ui/icons.woff +0 -0
  9. data/app/assets/images/semantic-ui/flags.png +0 -0
  10. data/app/assets/javascripts/semantic-ui.js +9 -5
  11. data/app/assets/javascripts/semantic-ui/accordion.js +169 -102
  12. data/app/assets/javascripts/semantic-ui/api.js +840 -0
  13. data/app/assets/javascripts/semantic-ui/checkbox.js +203 -46
  14. data/app/assets/javascripts/semantic-ui/{behavior/colorize.js → colorize.js} +4 -2
  15. data/app/assets/javascripts/semantic-ui/dimmer.js +110 -76
  16. data/app/assets/javascripts/semantic-ui/dropdown.js +897 -285
  17. data/app/assets/javascripts/semantic-ui/{behavior/form.js → form.js} +127 -42
  18. data/app/assets/javascripts/semantic-ui/modal.js +294 -219
  19. data/app/assets/javascripts/semantic-ui/nag.js +120 -186
  20. data/app/assets/javascripts/semantic-ui/popup.js +491 -223
  21. data/app/assets/javascripts/semantic-ui/progress.js +779 -0
  22. data/app/assets/javascripts/semantic-ui/rating.js +66 -22
  23. data/app/assets/javascripts/semantic-ui/search.js +219 -99
  24. data/app/assets/javascripts/semantic-ui/shape.js +72 -29
  25. data/app/assets/javascripts/semantic-ui/sidebar.js +678 -142
  26. data/app/assets/javascripts/semantic-ui/site.js +487 -0
  27. data/app/assets/javascripts/semantic-ui/{behavior/state.js → state.js} +116 -151
  28. data/app/assets/javascripts/semantic-ui/sticky.js +771 -0
  29. data/app/assets/javascripts/semantic-ui/tab.js +680 -603
  30. data/app/assets/javascripts/semantic-ui/transition.js +269 -158
  31. data/app/assets/javascripts/semantic-ui/video.js +113 -32
  32. data/app/assets/javascripts/semantic-ui/visibility.js +970 -0
  33. data/app/assets/javascripts/semantic-ui/visit.js +513 -0
  34. data/app/assets/stylesheets/semantic-ui.scss +2 -0
  35. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +58 -14
  36. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +464 -372
  37. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +1385 -533
  38. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +482 -655
  39. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +238 -139
  40. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +631 -280
  41. data/app/assets/stylesheets/semantic-ui/elements/_all.scss +3 -2
  42. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +1614 -657
  43. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +143 -80
  44. data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1018 -0
  45. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +302 -145
  46. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +1653 -1365
  47. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +160 -59
  48. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +247 -118
  49. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +501 -470
  50. data/app/assets/stylesheets/semantic-ui/elements/_list.scss +888 -0
  51. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +189 -98
  52. data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +125 -0
  53. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +147 -212
  54. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +328 -190
  55. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +261 -185
  56. data/app/assets/stylesheets/semantic-ui/globals/_all.scss +2 -0
  57. data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +430 -0
  58. data/app/assets/stylesheets/semantic-ui/globals/_site.scss +128 -0
  59. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +190 -106
  60. data/app/assets/stylesheets/semantic-ui/modules/_all.scss +2 -1
  61. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +303 -201
  62. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +72 -63
  63. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +711 -331
  64. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +262 -140
  65. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +82 -71
  66. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +163 -119
  67. data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +435 -0
  68. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +163 -68
  69. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +223 -150
  70. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +39 -40
  71. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +413 -147
  72. data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +80 -0
  73. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +49 -20
  74. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +542 -568
  75. data/app/assets/stylesheets/semantic-ui/modules/_video.scss +69 -37
  76. data/app/assets/stylesheets/semantic-ui/views/_ad.scss +265 -0
  77. data/app/assets/stylesheets/semantic-ui/views/_all.scss +1 -1
  78. data/app/assets/stylesheets/semantic-ui/views/_card.scss +758 -0
  79. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +133 -92
  80. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +200 -87
  81. data/app/assets/stylesheets/semantic-ui/views/_item.scss +298 -523
  82. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +390 -12
  83. data/lib/semantic/ui/sass/version.rb +2 -2
  84. data/tasks/converter.rb +99 -216
  85. metadata +22 -27
  86. data/app/assets/fonts/semantic-ui/basic.icons.eot +0 -0
  87. data/app/assets/fonts/semantic-ui/basic.icons.svg +0 -450
  88. data/app/assets/fonts/semantic-ui/basic.icons.ttf +0 -0
  89. data/app/assets/fonts/semantic-ui/basic.icons.woff +0 -0
  90. data/app/assets/images/semantic-ui/loader-large-inverted.gif +0 -0
  91. data/app/assets/images/semantic-ui/loader-large.gif +0 -0
  92. data/app/assets/images/semantic-ui/loader-medium-inverted.gif +0 -0
  93. data/app/assets/images/semantic-ui/loader-medium.gif +0 -0
  94. data/app/assets/images/semantic-ui/loader-mini-inverted.gif +0 -0
  95. data/app/assets/images/semantic-ui/loader-mini.gif +0 -0
  96. data/app/assets/images/semantic-ui/loader-small-inverted.gif +0 -0
  97. data/app/assets/images/semantic-ui/loader-small.gif +0 -0
  98. data/app/assets/javascripts/semantic-ui/behavior/api.js +0 -634
  99. data/app/assets/javascripts/semantic-ui/chatroom.js +0 -772
  100. data/app/assets/stylesheets/semantic-ui/depends/_basic.icon.scss +0 -4
  101. data/app/assets/stylesheets/semantic-ui/depends/_icon.scss +0 -4
  102. data/app/assets/stylesheets/semantic-ui/depends/_loader.scss +0 -8
  103. data/app/assets/stylesheets/semantic-ui/elements/_basic.icon.scss +0 -1124
  104. data/app/assets/stylesheets/semantic-ui/elements/_progress.scss +0 -280
  105. data/app/assets/stylesheets/semantic-ui/modules/_chatroom.scss +0 -299
  106. data/app/assets/stylesheets/semantic-ui/modules/_reveal.scss +0 -322
  107. data/app/assets/stylesheets/semantic-ui/views/_list.scss +0 -700
@@ -1,6 +1,7 @@
1
- /*
1
+ /*
2
2
  * # Semantic - Tab
3
- * http://github.com/jlukic/semantic-ui/
3
+ * http://github.com/semantic-org/semantic-ui/
4
+ *
4
5
  *
5
6
  * Copyright 2014 Contributors
6
7
  * Released under the MIT license
@@ -8,703 +9,779 @@
8
9
  *
9
10
  */
10
11
 
11
-
12
12
  ;(function ($, window, document, undefined) {
13
13
 
14
- $.fn.tab = function(parameters) {
14
+ "use strict";
15
15
 
16
- var
17
- settings = $.extend(true, {}, $.fn.tab.settings, parameters),
16
+ $.fn.tab = function(parameters) {
18
17
 
19
- $module = $(this),
20
- $tabs = $(settings.context).find(settings.selector.tabs),
18
+ var
19
+ // use window context if none specified
20
+ $allModules = $.isFunction(this)
21
+ ? $(window)
22
+ : $(this),
21
23
 
22
- moduleSelector = $module.selector || '',
24
+ settings = ( $.isPlainObject(parameters) )
25
+ ? $.extend(true, {}, $.fn.tab.settings, parameters)
26
+ : $.extend({}, $.fn.tab.settings),
23
27
 
24
- cache = {},
25
- firstLoad = true,
26
- recursionDepth = 0,
28
+ moduleSelector = $allModules.selector || '',
29
+ time = new Date().getTime(),
30
+ performance = [],
27
31
 
28
- activeTabPath,
29
- parameterArray,
30
- historyEvent,
32
+ query = arguments[0],
33
+ methodInvoked = (typeof query == 'string'),
34
+ queryArguments = [].slice.call(arguments, 1),
31
35
 
32
- element = this,
33
- time = new Date().getTime(),
34
- performance = [],
36
+ module,
37
+ returnedValue
38
+ ;
35
39
 
36
- className = settings.className,
37
- metadata = settings.metadata,
38
- error = settings.error,
40
+ $allModules
41
+ .each(function() {
42
+ var
39
43
 
40
- eventNamespace = '.' + settings.namespace,
41
- moduleNamespace = 'module-' + settings.namespace,
44
+ className = settings.className,
45
+ metadata = settings.metadata,
46
+ selector = settings.selector,
47
+ error = settings.error,
42
48
 
43
- instance = $module.data(moduleNamespace),
49
+ eventNamespace = '.' + settings.namespace,
50
+ moduleNamespace = 'module-' + settings.namespace,
44
51
 
45
- query = arguments[0],
46
- methodInvoked = (instance !== undefined && typeof query == 'string'),
47
- queryArguments = [].slice.call(arguments, 1),
52
+ $module = $(this),
48
53
 
49
- module,
50
- returnedValue
51
- ;
54
+ cache = {},
55
+ firstLoad = true,
56
+ recursionDepth = 0,
52
57
 
53
- module = {
58
+ $context,
59
+ $tabs,
60
+ activeTabPath,
61
+ parameterArray,
62
+ historyEvent,
54
63
 
55
- initialize: function() {
56
- module.debug('Initializing Tabs', $module);
64
+ element = this,
65
+ instance = $module.data(moduleNamespace)
66
+ ;
57
67
 
58
- // set up automatic routing
59
- if(settings.auto) {
60
- module.verbose('Setting up automatic tab retrieval from server');
61
- settings.apiSettings = {
62
- url: settings.path + '/{$tab}'
63
- };
64
- }
68
+ module = {
69
+
70
+ initialize: function() {
71
+ module.debug('Initializing tab menu item', $module);
65
72
 
66
- // attach history events
67
- if(settings.history) {
68
- module.debug('Initializing page state');
69
- if( $.address === undefined ) {
70
- module.error(error.state);
71
- return false;
73
+ module.determineTabs();
74
+ module.debug('Determining tabs', settings.context, $tabs);
75
+
76
+ // set up automatic routing
77
+ if(settings.auto) {
78
+ module.verbose('Setting up automatic tab retrieval from server');
79
+ settings.apiSettings = {
80
+ url: settings.path + '/{$tab}'
81
+ };
72
82
  }
73
- else {
74
- if(settings.historyType == 'hash') {
75
- module.debug('Using hash state change to manage state');
76
- }
77
- if(settings.historyType == 'html5') {
78
- module.debug('Using HTML5 to manage state');
79
- if(settings.path !== false) {
80
- $.address
81
- .history(true)
82
- .state(settings.path)
83
- ;
84
- }
85
- else {
86
- module.error(error.path);
87
- return false;
88
- }
89
- }
90
- $.address
91
- .unbind('change')
92
- .bind('change', module.event.history.change)
83
+
84
+ // attach events if navigation wasn't set to window
85
+ if( !$.isWindow( element ) ) {
86
+ module.debug('Attaching tab activation events to element', $module);
87
+ $module
88
+ .on('click' + eventNamespace, module.event.click)
93
89
  ;
94
90
  }
95
- }
91
+ module.instantiate();
92
+ },
96
93
 
97
- // attach events if navigation wasn't set to window
98
- if( !$.isWindow( element ) ) {
99
- module.debug('Attaching tab activation events to element', $module);
100
- $module
101
- .on('click' + eventNamespace, module.event.click)
102
- ;
103
- }
104
- module.instantiate();
105
- },
106
-
107
- instantiate: function () {
108
- module.verbose('Storing instance of module', module);
109
- $module
110
- .data(moduleNamespace, module)
111
- ;
112
- },
113
-
114
- destroy: function() {
115
- module.debug('Destroying tabs', $module);
116
- $module
117
- .removeData(moduleNamespace)
118
- .off(eventNamespace)
119
- ;
120
- },
121
-
122
- event: {
123
- click: function(event) {
94
+ determineTabs: function() {
124
95
  var
125
- tabPath = $(this).data(metadata.tab)
96
+ $reference
126
97
  ;
127
- if(tabPath !== undefined) {
128
- if(settings.history) {
129
- module.verbose('Updating page state', event);
130
- $.address.value(tabPath);
98
+
99
+ // determine tab context
100
+ if(settings.context === 'parent') {
101
+ if($module.closest(selector.ui).size() > 0) {
102
+ $reference = $module.closest(selector.ui);
103
+ module.verbose('Using closest UI element for determining parent', $reference);
131
104
  }
132
105
  else {
133
- module.verbose('Changing tab without state management', event);
134
- module.changeTab(tabPath);
106
+ $reference = $module;
135
107
  }
136
- event.preventDefault();
108
+ $context = $reference.parent();
109
+ module.verbose('Determined parent element for creating context', $context);
110
+ }
111
+ else if(settings.context) {
112
+ $context = $(settings.context);
113
+ module.verbose('Using selector for tab context', settings.context, $context);
114
+ }
115
+ else {
116
+ $context = $('body');
117
+ }
118
+
119
+ // find tabs
120
+ if(settings.childrenOnly) {
121
+ $tabs = $context.children(selector.tabs);
122
+ module.debug('Searching tab context children for tabs', $context, $tabs);
137
123
  }
138
124
  else {
139
- module.debug('No tab specified');
125
+ $tabs = $context.find(selector.tabs);
126
+ module.debug('Searching tab context for tabs', $context, $tabs);
140
127
  }
141
128
  },
142
- history: {
143
- change: function(event) {
129
+
130
+ initializeHistory: function() {
131
+ if(settings.history) {
132
+ module.debug('Initializing page state');
133
+ if( $.address === undefined ) {
134
+ module.error(error.state);
135
+ return false;
136
+ }
137
+ else {
138
+ if(settings.historyType == 'state') {
139
+ module.debug('Using HTML5 to manage state');
140
+ if(settings.path !== false) {
141
+ $.address
142
+ .history(true)
143
+ .state(settings.path)
144
+ ;
145
+ }
146
+ else {
147
+ module.error(error.path);
148
+ return false;
149
+ }
150
+ }
151
+ $.address
152
+ .bind('change', module.event.history.change)
153
+ ;
154
+ }
155
+ }
156
+ },
157
+
158
+ instantiate: function () {
159
+ module.verbose('Storing instance of module', module);
160
+ instance = module;
161
+ $module
162
+ .data(moduleNamespace, module)
163
+ ;
164
+ },
165
+
166
+ destroy: function() {
167
+ module.debug('Destroying tabs', $module);
168
+ $module
169
+ .removeData(moduleNamespace)
170
+ .off(eventNamespace)
171
+ ;
172
+ },
173
+
174
+ event: {
175
+ click: function(event) {
144
176
  var
145
- tabPath = event.pathNames.join('/') || module.get.initialPath(),
146
- pageTitle = settings.templates.determineTitle(tabPath) || false
177
+ tabPath = $(this).data(metadata.tab)
147
178
  ;
148
- module.debug('History change event', tabPath, event);
149
- historyEvent = event;
150
179
  if(tabPath !== undefined) {
151
- module.changeTab(tabPath);
180
+ if(settings.history) {
181
+ module.verbose('Updating page state', event);
182
+ $.address.value(tabPath);
183
+ }
184
+ else {
185
+ module.verbose('Changing tab', event);
186
+ module.changeTab(tabPath);
187
+ }
188
+ event.preventDefault();
189
+ }
190
+ else {
191
+ module.debug('No tab specified');
152
192
  }
153
- if(pageTitle) {
154
- $.address.title(pageTitle);
193
+ },
194
+ history: {
195
+ change: function(event) {
196
+ var
197
+ tabPath = event.pathNames.join('/') || module.get.initialPath(),
198
+ pageTitle = settings.templates.determineTitle(tabPath) || false
199
+ ;
200
+ module.performance.display();
201
+ module.debug('History change event', tabPath, event);
202
+ historyEvent = event;
203
+ if(tabPath !== undefined) {
204
+ module.changeTab(tabPath);
205
+ }
206
+ if(pageTitle) {
207
+ $.address.title(pageTitle);
208
+ }
155
209
  }
156
210
  }
157
- }
158
- },
211
+ },
159
212
 
160
- refresh: function() {
161
- if(activeTabPath) {
162
- module.debug('Refreshing tab', activeTabPath);
163
- module.changeTab(activeTabPath);
164
- }
165
- },
213
+ refresh: function() {
214
+ if(activeTabPath) {
215
+ module.debug('Refreshing tab', activeTabPath);
216
+ module.changeTab(activeTabPath);
217
+ }
218
+ },
166
219
 
167
- cache: {
220
+ cache: {
168
221
 
169
- read: function(cacheKey) {
170
- return (cacheKey !== undefined)
171
- ? cache[cacheKey]
172
- : false
173
- ;
222
+ read: function(cacheKey) {
223
+ return (cacheKey !== undefined)
224
+ ? cache[cacheKey]
225
+ : false
226
+ ;
227
+ },
228
+ add: function(cacheKey, content) {
229
+ cacheKey = cacheKey || activeTabPath;
230
+ module.debug('Adding cached content for', cacheKey);
231
+ cache[cacheKey] = content;
232
+ },
233
+ remove: function(cacheKey) {
234
+ cacheKey = cacheKey || activeTabPath;
235
+ module.debug('Removing cached content for', cacheKey);
236
+ delete cache[cacheKey];
237
+ }
174
238
  },
175
- add: function(cacheKey, content) {
176
- cacheKey = cacheKey || activeTabPath;
177
- module.debug('Adding cached content for', cacheKey);
178
- cache[cacheKey] = content;
239
+
240
+ set: {
241
+ state: function(state) {
242
+ $.address.value(state);
243
+ }
179
244
  },
180
- remove: function(cacheKey) {
181
- cacheKey = cacheKey || activeTabPath;
182
- module.debug('Removing cached content for', cacheKey);
183
- delete cache[cacheKey];
184
- }
185
- },
186
245
 
187
- set: {
188
- state: function(url) {
189
- $.address.value(url);
190
- }
191
- },
192
-
193
- changeTab: function(tabPath) {
194
- var
195
- pushStateAvailable = (window.history && window.history.pushState),
196
- shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad),
197
- remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ),
198
- // only get default path if not remote content
199
- pathArray = (remoteContent && !shouldIgnoreLoad)
200
- ? module.utilities.pathToArray(tabPath)
201
- : module.get.defaultPathArray(tabPath)
202
- ;
203
- tabPath = module.utilities.arrayToPath(pathArray);
204
- module.deactivate.all();
205
- $.each(pathArray, function(index, tab) {
246
+ changeTab: function(tabPath) {
206
247
  var
207
- currentPathArray = pathArray.slice(0, index + 1),
208
- currentPath = module.utilities.arrayToPath(currentPathArray),
248
+ pushStateAvailable = (window.history && window.history.pushState),
249
+ shouldIgnoreLoad = (pushStateAvailable && settings.ignoreFirstLoad && firstLoad),
250
+ remoteContent = (settings.auto || $.isPlainObject(settings.apiSettings) ),
251
+ // only get default path if not remote content
252
+ pathArray = (remoteContent && !shouldIgnoreLoad)
253
+ ? module.utilities.pathToArray(tabPath)
254
+ : module.get.defaultPathArray(tabPath)
255
+ ;
256
+ tabPath = module.utilities.arrayToPath(pathArray);
257
+ $.each(pathArray, function(index, tab) {
258
+ var
259
+ currentPathArray = pathArray.slice(0, index + 1),
260
+ currentPath = module.utilities.arrayToPath(currentPathArray),
209
261
 
210
- isTab = module.is.tab(currentPath),
211
- isLastIndex = (index + 1 == pathArray.length),
262
+ isTab = module.is.tab(currentPath),
263
+ isLastIndex = (index + 1 == pathArray.length),
212
264
 
213
- $tab = module.get.tabElement(currentPath),
214
- nextPathArray,
215
- nextPath,
216
- isLastTab
217
- ;
218
- module.verbose('Looking for tab', tab);
219
- if(isTab) {
220
- module.verbose('Tab was found', tab);
265
+ $tab = module.get.tabElement(currentPath),
266
+ $anchor,
267
+ nextPathArray,
268
+ nextPath,
269
+ isLastTab
270
+ ;
271
+ module.verbose('Looking for tab', tab);
272
+ if(isTab) {
273
+ module.verbose('Tab was found', tab);
221
274
 
222
- // scope up
223
- activeTabPath = currentPath;
224
- parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
275
+ // scope up
276
+ activeTabPath = currentPath;
277
+ parameterArray = module.utilities.filterArray(pathArray, currentPathArray);
225
278
 
226
- if(isLastIndex) {
227
- isLastTab = true;
228
- }
229
- else {
230
- nextPathArray = pathArray.slice(0, index + 2);
231
- nextPath = module.utilities.arrayToPath(nextPathArray);
232
- isLastTab = ( !module.is.tab(nextPath) );
233
- if(isLastTab) {
234
- module.verbose('Tab parameters found', nextPathArray);
279
+ if(isLastIndex) {
280
+ isLastTab = true;
235
281
  }
236
- }
237
- if(isLastTab && remoteContent) {
238
- if(!shouldIgnoreLoad) {
239
- module.activate.navigation(currentPath);
240
- module.content.fetch(currentPath, tabPath);
282
+ else {
283
+ nextPathArray = pathArray.slice(0, index + 2);
284
+ nextPath = module.utilities.arrayToPath(nextPathArray);
285
+ isLastTab = ( !module.is.tab(nextPath) );
286
+ if(isLastTab) {
287
+ module.verbose('Tab parameters found', nextPathArray);
288
+ }
289
+ }
290
+ if(isLastTab && remoteContent) {
291
+ if(!shouldIgnoreLoad) {
292
+ module.activate.navigation(currentPath);
293
+ module.content.fetch(currentPath, tabPath);
294
+ }
295
+ else {
296
+ module.debug('Ignoring remote content on first tab load', currentPath);
297
+ firstLoad = false;
298
+ module.cache.add(tabPath, $tab.html());
299
+ module.activate.all(currentPath);
300
+ $.proxy(settings.onTabInit, $tab)(currentPath, parameterArray, historyEvent);
301
+ $.proxy(settings.onTabLoad, $tab)(currentPath, parameterArray, historyEvent);
302
+ }
303
+ return false;
241
304
  }
242
305
  else {
243
- module.debug('Ignoring remote content on first tab load', currentPath);
244
- firstLoad = false;
245
- module.cache.add(tabPath, $tab.html());
306
+ module.debug('Opened local tab', currentPath);
246
307
  module.activate.all(currentPath);
247
- $.proxy(settings.onTabInit, $tab)(currentPath, parameterArray, historyEvent);
308
+ if( !module.cache.read(currentPath) ) {
309
+ module.cache.add(currentPath, true);
310
+ module.debug('First time tab loaded calling tab init');
311
+ $.proxy(settings.onTabInit, $tab)(currentPath, parameterArray, historyEvent);
312
+ }
248
313
  $.proxy(settings.onTabLoad, $tab)(currentPath, parameterArray, historyEvent);
249
314
  }
250
- return false;
251
315
  }
252
- else {
253
- module.debug('Opened local tab', currentPath);
254
- module.activate.all(currentPath);
255
- if( !module.cache.read(currentPath) ) {
256
- module.cache.add(currentPath, true);
257
- module.debug('First time tab loaded calling tab init');
258
- $.proxy(settings.onTabInit, $tab)(currentPath, parameterArray, historyEvent);
316
+ else if(tabPath.search('/') == -1 && tabPath !== '') {
317
+ // look for in page anchor
318
+ $anchor = $('#' + tabPath + ', a[name="' + tabPath + '"]'),
319
+ currentPath = $anchor.closest('[data-tab]').data('tab');
320
+ $tab = module.get.tabElement(currentPath);
321
+ // if anchor exists use parent tab
322
+ if($anchor && $anchor.size() > 0 && currentPath) {
323
+ module.debug('No tab found, but deep anchor link present, opening parent tab');
324
+ module.activate.all(currentPath);
325
+ if( !module.cache.read(currentPath) ) {
326
+ module.cache.add(currentPath, true);
327
+ module.debug('First time tab loaded calling tab init');
328
+ $.proxy(settings.onTabInit, $tab)(currentPath, parameterArray, historyEvent);
329
+ }
330
+ return false;
259
331
  }
260
- $.proxy(settings.onTabLoad, $tab)(currentPath, parameterArray, historyEvent);
261
332
  }
262
- }
263
- else {
264
- module.error(error.missingTab, tab);
265
- return false;
266
- }
267
- });
268
- },
333
+ else {
334
+ module.error(error.missingTab, $module, $context, currentPath);
335
+ return false;
336
+ }
337
+ });
338
+ },
269
339
 
270
- content: {
340
+ content: {
271
341
 
272
- fetch: function(tabPath, fullTabPath) {
273
- var
274
- $tab = module.get.tabElement(tabPath),
275
- apiSettings = {
276
- dataType : 'html',
277
- stateContext : $tab,
278
- success : function(response) {
279
- module.cache.add(fullTabPath, response);
280
- module.content.update(tabPath, response);
281
- if(tabPath == activeTabPath) {
282
- module.debug('Content loaded', tabPath);
283
- module.activate.tab(tabPath);
284
- }
285
- else {
286
- module.debug('Content loaded in background', tabPath);
287
- }
288
- $.proxy(settings.onTabInit, $tab)(tabPath, parameterArray, historyEvent);
289
- $.proxy(settings.onTabLoad, $tab)(tabPath, parameterArray, historyEvent);
342
+ fetch: function(tabPath, fullTabPath) {
343
+ var
344
+ $tab = module.get.tabElement(tabPath),
345
+ apiSettings = {
346
+ dataType : 'html',
347
+ stateContext : $tab,
348
+ onSuccess : function(response) {
349
+ module.cache.add(fullTabPath, response);
350
+ module.content.update(tabPath, response);
351
+ if(tabPath == activeTabPath) {
352
+ module.debug('Content loaded', tabPath);
353
+ module.activate.tab(tabPath);
354
+ }
355
+ else {
356
+ module.debug('Content loaded in background', tabPath);
357
+ }
358
+ $.proxy(settings.onTabInit, $tab)(tabPath, parameterArray, historyEvent);
359
+ $.proxy(settings.onTabLoad, $tab)(tabPath, parameterArray, historyEvent);
360
+ },
361
+ urlData: { tab: fullTabPath }
290
362
  },
291
- urlData: { tab: fullTabPath }
292
- },
293
- request = $tab.data(metadata.promise) || false,
294
- existingRequest = ( request && request.state() === 'pending' ),
295
- requestSettings,
296
- cachedContent
297
- ;
363
+ request = $tab.data(metadata.promise) || false,
364
+ existingRequest = ( request && request.state() === 'pending' ),
365
+ requestSettings,
366
+ cachedContent
367
+ ;
298
368
 
299
- fullTabPath = fullTabPath || tabPath;
300
- cachedContent = module.cache.read(fullTabPath);
369
+ fullTabPath = fullTabPath || tabPath;
370
+ cachedContent = module.cache.read(fullTabPath);
301
371
 
302
- if(settings.cache && cachedContent) {
303
- module.debug('Showing existing content', fullTabPath);
304
- module.content.update(tabPath, cachedContent);
305
- module.activate.tab(tabPath);
306
- $.proxy(settings.onTabLoad, $tab)(tabPath, parameterArray, historyEvent);
307
- }
308
- else if(existingRequest) {
309
- module.debug('Content is already loading', fullTabPath);
372
+ if(settings.cache && cachedContent) {
373
+ module.debug('Showing existing content', fullTabPath);
374
+ module.content.update(tabPath, cachedContent);
375
+ module.activate.tab(tabPath);
376
+ $.proxy(settings.onTabLoad, $tab)(tabPath, parameterArray, historyEvent);
377
+ }
378
+ else if(existingRequest) {
379
+ module.debug('Content is already loading', fullTabPath);
380
+ $tab
381
+ .addClass(className.loading)
382
+ ;
383
+ }
384
+ else if($.api !== undefined) {
385
+ requestSettings = $.extend(true, { headers: { 'X-Remote': true } }, settings.apiSettings, apiSettings);
386
+ module.debug('Retrieving remote content', fullTabPath, requestSettings);
387
+ $.api( requestSettings );
388
+ }
389
+ else {
390
+ module.error(error.api);
391
+ }
392
+ },
393
+
394
+ update: function(tabPath, html) {
395
+ module.debug('Updating html for', tabPath);
396
+ var
397
+ $tab = module.get.tabElement(tabPath)
398
+ ;
310
399
  $tab
311
- .addClass(className.loading)
400
+ .html(html)
312
401
  ;
313
402
  }
314
- else if($.api !== undefined) {
315
- console.log(settings.apiSettings);
316
- requestSettings = $.extend(true, { headers: { 'X-Remote': true } }, settings.apiSettings, apiSettings);
317
- module.debug('Retrieving remote content', fullTabPath, requestSettings);
318
- $.api( requestSettings );
319
- }
320
- else {
321
- module.error(error.api);
322
- }
323
403
  },
324
404
 
325
- update: function(tabPath, html) {
326
- module.debug('Updating html for', tabPath);
327
- var
328
- $tab = module.get.tabElement(tabPath)
329
- ;
330
- $tab
331
- .html(html)
332
- ;
333
- }
334
- },
335
-
336
- activate: {
337
- all: function(tabPath) {
338
- module.activate.tab(tabPath);
339
- module.activate.navigation(tabPath);
340
- },
341
- tab: function(tabPath) {
342
- var
343
- $tab = module.get.tabElement(tabPath)
344
- ;
345
- module.verbose('Showing tab content for', $tab);
346
- $tab.addClass(className.active);
405
+ activate: {
406
+ all: function(tabPath) {
407
+ module.activate.tab(tabPath);
408
+ module.activate.navigation(tabPath);
409
+ },
410
+ tab: function(tabPath) {
411
+ var
412
+ $tab = module.get.tabElement(tabPath)
413
+ ;
414
+ module.verbose('Showing tab content for', $tab);
415
+ $tab
416
+ .addClass(className.active)
417
+ .siblings($tabs)
418
+ .removeClass(className.active + ' ' + className.loading)
419
+ ;
420
+ },
421
+ navigation: function(tabPath) {
422
+ var
423
+ $navigation = module.get.navElement(tabPath)
424
+ ;
425
+ module.verbose('Activating tab navigation for', $navigation, tabPath);
426
+ $navigation
427
+ .addClass(className.active)
428
+ .siblings($allModules)
429
+ .removeClass(className.active + ' ' + className.loading)
430
+ ;
431
+ }
347
432
  },
348
- navigation: function(tabPath) {
349
- var
350
- $navigation = module.get.navElement(tabPath)
351
- ;
352
- module.verbose('Activating tab navigation for', $navigation, tabPath);
353
- $navigation.addClass(className.active);
354
- }
355
- },
356
433
 
357
- deactivate: {
358
- all: function() {
359
- module.deactivate.navigation();
360
- module.deactivate.tabs();
361
- },
362
- navigation: function() {
363
- $module
364
- .removeClass(className.active)
365
- ;
434
+ deactivate: {
435
+ all: function() {
436
+ module.deactivate.navigation();
437
+ module.deactivate.tabs();
438
+ },
439
+ navigation: function() {
440
+ $allModules
441
+ .removeClass(className.active)
442
+ ;
443
+ },
444
+ tabs: function() {
445
+ $tabs
446
+ .removeClass(className.active + ' ' + className.loading)
447
+ ;
448
+ }
366
449
  },
367
- tabs: function() {
368
- $tabs
369
- .removeClass(className.active + ' ' + className.loading)
370
- ;
371
- }
372
- },
373
-
374
- is: {
375
- tab: function(tabName) {
376
- return (tabName !== undefined)
377
- ? ( module.get.tabElement(tabName).size() > 0 )
378
- : false
379
- ;
380
- }
381
- },
382
450
 
383
- get: {
384
- initialPath: function() {
385
- return $module.eq(0).data(metadata.tab) || $tabs.eq(0).data(metadata.tab);
386
- },
387
- path: function() {
388
- return $.address.value();
389
- },
390
- // adds default tabs to tab path
391
- defaultPathArray: function(tabPath) {
392
- return module.utilities.pathToArray( module.get.defaultPath(tabPath) );
451
+ is: {
452
+ tab: function(tabName) {
453
+ return (tabName !== undefined)
454
+ ? ( module.get.tabElement(tabName).size() > 0 )
455
+ : false
456
+ ;
457
+ }
393
458
  },
394
- defaultPath: function(tabPath) {
395
- var
396
- $defaultNav = $module.filter('[data-' + metadata.tab + '^="' + tabPath + '/"]').eq(0),
397
- defaultTab = $defaultNav.data(metadata.tab) || false
398
- ;
399
- if( defaultTab ) {
400
- module.debug('Found default tab', defaultTab);
401
- if(recursionDepth < settings.maxDepth) {
402
- recursionDepth++;
403
- return module.get.defaultPath(defaultTab);
459
+
460
+ get: {
461
+ initialPath: function() {
462
+ return $allModules.eq(0).data(metadata.tab) || $tabs.eq(0).data(metadata.tab);
463
+ },
464
+ path: function() {
465
+ return $.address.value();
466
+ },
467
+ // adds default tabs to tab path
468
+ defaultPathArray: function(tabPath) {
469
+ return module.utilities.pathToArray( module.get.defaultPath(tabPath) );
470
+ },
471
+ defaultPath: function(tabPath) {
472
+ var
473
+ $defaultNav = $allModules.filter('[data-' + metadata.tab + '^="' + tabPath + '/"]').eq(0),
474
+ defaultTab = $defaultNav.data(metadata.tab) || false
475
+ ;
476
+ if( defaultTab ) {
477
+ module.debug('Found default tab', defaultTab);
478
+ if(recursionDepth < settings.maxDepth) {
479
+ recursionDepth++;
480
+ return module.get.defaultPath(defaultTab);
481
+ }
482
+ module.error(error.recursion);
404
483
  }
405
- module.error(error.recursion);
406
- }
407
- else {
408
- module.debug('No default tabs found for', tabPath, $tabs);
484
+ else {
485
+ module.debug('No default tabs found for', tabPath, $tabs);
486
+ }
487
+ recursionDepth = 0;
488
+ return tabPath;
489
+ },
490
+ navElement: function(tabPath) {
491
+ tabPath = tabPath || activeTabPath;
492
+ return $allModules.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
493
+ },
494
+ tabElement: function(tabPath) {
495
+ var
496
+ $fullPathTab,
497
+ $simplePathTab,
498
+ tabPathArray,
499
+ lastTab
500
+ ;
501
+ tabPath = tabPath || activeTabPath;
502
+ tabPathArray = module.utilities.pathToArray(tabPath);
503
+ lastTab = module.utilities.last(tabPathArray);
504
+ $fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]');
505
+ $simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
506
+ return ($fullPathTab.size() > 0)
507
+ ? $fullPathTab
508
+ : $simplePathTab
509
+ ;
510
+ },
511
+ tab: function() {
512
+ return activeTabPath;
409
513
  }
410
- recursionDepth = 0;
411
- return tabPath;
412
514
  },
413
- navElement: function(tabPath) {
414
- tabPath = tabPath || activeTabPath;
415
- return $module.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
416
- },
417
- tabElement: function(tabPath) {
418
- var
419
- $fullPathTab,
420
- $simplePathTab,
421
- tabPathArray,
422
- lastTab
423
- ;
424
- tabPath = tabPath || activeTabPath;
425
- tabPathArray = module.utilities.pathToArray(tabPath);
426
- lastTab = module.utilities.last(tabPathArray);
427
- $fullPathTab = $tabs.filter('[data-' + metadata.tab + '="' + lastTab + '"]');
428
- $simplePathTab = $tabs.filter('[data-' + metadata.tab + '="' + tabPath + '"]');
429
- return ($fullPathTab.size() > 0)
430
- ? $fullPathTab
431
- : $simplePathTab
432
- ;
433
- },
434
- tab: function() {
435
- return activeTabPath;
436
- }
437
- },
438
515
 
439
- utilities: {
440
- filterArray: function(keepArray, removeArray) {
441
- return $.grep(keepArray, function(keepValue) {
442
- return ( $.inArray(keepValue, removeArray) == -1);
443
- });
444
- },
445
- last: function(array) {
446
- return $.isArray(array)
447
- ? array[ array.length - 1]
448
- : false
449
- ;
450
- },
451
- pathToArray: function(pathName) {
452
- if(pathName === undefined) {
453
- pathName = activeTabPath;
516
+ utilities: {
517
+ filterArray: function(keepArray, removeArray) {
518
+ return $.grep(keepArray, function(keepValue) {
519
+ return ( $.inArray(keepValue, removeArray) == -1);
520
+ });
521
+ },
522
+ last: function(array) {
523
+ return $.isArray(array)
524
+ ? array[ array.length - 1]
525
+ : false
526
+ ;
527
+ },
528
+ pathToArray: function(pathName) {
529
+ if(pathName === undefined) {
530
+ pathName = activeTabPath;
531
+ }
532
+ return typeof pathName == 'string'
533
+ ? pathName.split('/')
534
+ : [pathName]
535
+ ;
536
+ },
537
+ arrayToPath: function(pathArray) {
538
+ return $.isArray(pathArray)
539
+ ? pathArray.join('/')
540
+ : false
541
+ ;
454
542
  }
455
- return typeof pathName == 'string'
456
- ? pathName.split('/')
457
- : [pathName]
458
- ;
459
543
  },
460
- arrayToPath: function(pathArray) {
461
- return $.isArray(pathArray)
462
- ? pathArray.join('/')
463
- : false
464
- ;
465
- }
466
- },
467
544
 
468
- setting: function(name, value) {
469
- if( $.isPlainObject(name) ) {
470
- $.extend(true, settings, name);
471
- }
472
- else if(value !== undefined) {
473
- settings[name] = value;
474
- }
475
- else {
476
- return settings[name];
477
- }
478
- },
479
- internal: function(name, value) {
480
- if( $.isPlainObject(name) ) {
481
- $.extend(true, module, name);
482
- }
483
- else if(value !== undefined) {
484
- module[name] = value;
485
- }
486
- else {
487
- return module[name];
488
- }
489
- },
490
- debug: function() {
491
- if(settings.debug) {
492
- if(settings.performance) {
493
- module.performance.log(arguments);
545
+ setting: function(name, value) {
546
+ module.debug('Changing setting', name, value);
547
+ if( $.isPlainObject(name) ) {
548
+ $.extend(true, settings, name);
549
+ }
550
+ else if(value !== undefined) {
551
+ settings[name] = value;
494
552
  }
495
553
  else {
496
- module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
497
- module.debug.apply(console, arguments);
554
+ return settings[name];
498
555
  }
499
- }
500
- },
501
- verbose: function() {
502
- if(settings.verbose && settings.debug) {
503
- if(settings.performance) {
504
- module.performance.log(arguments);
556
+ },
557
+ internal: function(name, value) {
558
+ if( $.isPlainObject(name) ) {
559
+ $.extend(true, module, name);
505
560
  }
506
- else {
507
- module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
508
- module.verbose.apply(console, arguments);
561
+ else if(value !== undefined) {
562
+ module[name] = value;
509
563
  }
510
- }
511
- },
512
- error: function() {
513
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
514
- module.error.apply(console, arguments);
515
- },
516
- performance: {
517
- log: function(message) {
518
- var
519
- currentTime,
520
- executionTime,
521
- previousTime
522
- ;
523
- if(settings.performance) {
524
- currentTime = new Date().getTime();
525
- previousTime = time || currentTime;
526
- executionTime = currentTime - previousTime;
527
- time = currentTime;
528
- performance.push({
529
- 'Element' : element,
530
- 'Name' : message[0],
531
- 'Arguments' : [].slice.call(message, 1) || '',
532
- 'Execution Time' : executionTime
533
- });
564
+ else {
565
+ return module[name];
534
566
  }
535
- clearTimeout(module.performance.timer);
536
- module.performance.timer = setTimeout(module.performance.display, 100);
537
567
  },
538
- display: function() {
539
- var
540
- title = settings.name + ':',
541
- totalTime = 0
542
- ;
543
- time = false;
544
- clearTimeout(module.performance.timer);
545
- $.each(performance, function(index, data) {
546
- totalTime += data['Execution Time'];
547
- });
548
- title += ' ' + totalTime + 'ms';
549
- if(moduleSelector) {
550
- title += ' \'' + moduleSelector + '\'';
551
- }
552
- if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
553
- console.groupCollapsed(title);
554
- if(console.table) {
555
- console.table(performance);
568
+ debug: function() {
569
+ if(settings.debug) {
570
+ if(settings.performance) {
571
+ module.performance.log(arguments);
556
572
  }
557
573
  else {
558
- $.each(performance, function(index, data) {
559
- console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
560
- });
574
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
575
+ module.debug.apply(console, arguments);
561
576
  }
562
- console.groupEnd();
563
577
  }
564
- performance = [];
565
- }
566
- },
567
- invoke: function(query, passedArguments, context) {
568
- var
569
- object = instance,
570
- maxDepth,
571
- found,
572
- response
573
- ;
574
- passedArguments = passedArguments || queryArguments;
575
- context = element || context;
576
- if(typeof query == 'string' && object !== undefined) {
577
- query = query.split(/[\. ]/);
578
- maxDepth = query.length - 1;
579
- $.each(query, function(depth, value) {
580
- var camelCaseValue = (depth != maxDepth)
581
- ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
582
- : query
583
- ;
584
- if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
585
- object = object[camelCaseValue];
578
+ },
579
+ verbose: function() {
580
+ if(settings.verbose && settings.debug) {
581
+ if(settings.performance) {
582
+ module.performance.log(arguments);
586
583
  }
587
- else if( object[camelCaseValue] !== undefined ) {
588
- found = object[camelCaseValue];
589
- return false;
584
+ else {
585
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
586
+ module.verbose.apply(console, arguments);
590
587
  }
591
- else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
592
- object = object[value];
588
+ }
589
+ },
590
+ error: function() {
591
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
592
+ module.error.apply(console, arguments);
593
+ },
594
+ performance: {
595
+ log: function(message) {
596
+ var
597
+ currentTime,
598
+ executionTime,
599
+ previousTime
600
+ ;
601
+ if(settings.performance) {
602
+ currentTime = new Date().getTime();
603
+ previousTime = time || currentTime;
604
+ executionTime = currentTime - previousTime;
605
+ time = currentTime;
606
+ performance.push({
607
+ 'Name' : message[0],
608
+ 'Arguments' : [].slice.call(message, 1) || '',
609
+ 'Element' : element,
610
+ 'Execution Time' : executionTime
611
+ });
593
612
  }
594
- else if( object[value] !== undefined ) {
595
- found = object[value];
596
- return false;
613
+ clearTimeout(module.performance.timer);
614
+ module.performance.timer = setTimeout(module.performance.display, 100);
615
+ },
616
+ display: function() {
617
+ var
618
+ title = settings.name + ':',
619
+ totalTime = 0
620
+ ;
621
+ time = false;
622
+ clearTimeout(module.performance.timer);
623
+ $.each(performance, function(index, data) {
624
+ totalTime += data['Execution Time'];
625
+ });
626
+ title += ' ' + totalTime + 'ms';
627
+ if(moduleSelector) {
628
+ title += ' \'' + moduleSelector + '\'';
597
629
  }
598
- else {
599
- return false;
630
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
631
+ console.groupCollapsed(title);
632
+ if(console.table) {
633
+ console.table(performance);
634
+ }
635
+ else {
636
+ $.each(performance, function(index, data) {
637
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
638
+ });
639
+ }
640
+ console.groupEnd();
600
641
  }
601
- });
602
- }
603
- if ( $.isFunction( found ) ) {
604
- response = found.apply(context, passedArguments);
605
- }
606
- else if(found !== undefined) {
607
- response = found;
608
- }
609
- if($.isArray(returnedValue)) {
610
- returnedValue.push(response);
611
- }
612
- else if(returnedValue !== undefined) {
613
- returnedValue = [returnedValue, response];
642
+ performance = [];
643
+ }
644
+ },
645
+ invoke: function(query, passedArguments, context) {
646
+ var
647
+ object = instance,
648
+ maxDepth,
649
+ found,
650
+ response
651
+ ;
652
+ passedArguments = passedArguments || queryArguments;
653
+ context = element || context;
654
+ if(typeof query == 'string' && object !== undefined) {
655
+ query = query.split(/[\. ]/);
656
+ maxDepth = query.length - 1;
657
+ $.each(query, function(depth, value) {
658
+ var camelCaseValue = (depth != maxDepth)
659
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
660
+ : query
661
+ ;
662
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
663
+ object = object[camelCaseValue];
664
+ }
665
+ else if( object[camelCaseValue] !== undefined ) {
666
+ found = object[camelCaseValue];
667
+ return false;
668
+ }
669
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
670
+ object = object[value];
671
+ }
672
+ else if( object[value] !== undefined ) {
673
+ found = object[value];
674
+ return false;
675
+ }
676
+ else {
677
+ module.error(error.method, query);
678
+ return false;
679
+ }
680
+ });
681
+ }
682
+ if ( $.isFunction( found ) ) {
683
+ response = found.apply(context, passedArguments);
684
+ }
685
+ else if(found !== undefined) {
686
+ response = found;
687
+ }
688
+ if($.isArray(returnedValue)) {
689
+ returnedValue.push(response);
690
+ }
691
+ else if(returnedValue !== undefined) {
692
+ returnedValue = [returnedValue, response];
693
+ }
694
+ else if(response !== undefined) {
695
+ returnedValue = response;
696
+ }
697
+ return found;
614
698
  }
615
- else if(response !== undefined) {
616
- returnedValue = response;
699
+ };
700
+ if(methodInvoked) {
701
+ if(instance === undefined) {
702
+ module.initialize();
617
703
  }
618
- return found;
704
+ module.invoke(query);
619
705
  }
620
- };
621
-
622
- if(methodInvoked) {
623
- if(instance === undefined) {
706
+ else {
707
+ if(instance !== undefined) {
708
+ module.destroy();
709
+ }
624
710
  module.initialize();
625
711
  }
626
- module.invoke(query);
627
- }
628
- else {
629
- if(instance !== undefined) {
630
- module.destroy();
631
- }
632
- module.initialize();
633
- }
634
-
635
- return (returnedValue !== undefined)
636
- ? returnedValue
637
- : this
638
- ;
639
-
640
- };
641
-
642
- // shortcut for tabbed content with no defined navigation
643
- $.tab = function(settings) {
644
- $(window).tab(settings);
645
- };
646
-
647
- $.fn.tab.settings = {
648
-
649
- name : 'Tab',
650
- debug : false,
651
- verbose : true,
652
- performance : true,
653
- namespace : 'tab',
654
-
655
- // only called first time a tab's content is loaded (when remote source)
656
- onTabInit : function(tabPath, parameterArray, historyEvent) {},
657
- // called on every load
658
- onTabLoad : function(tabPath, parameterArray, historyEvent) {},
659
-
660
- templates : {
661
- determineTitle: function(tabArray) {}
662
- },
663
-
664
- // uses pjax style endpoints fetching content from same url with remote-content headers
665
- auto : false,
666
- history : true,
667
- historyType : 'hash',
668
- path : false,
669
-
670
- context : 'body',
671
-
672
- // max depth a tab can be nested
673
- maxDepth : 25,
674
- // dont load content on first load
675
- ignoreFirstLoad : false,
676
- // load tab content new every tab click
677
- alwaysRefresh : false,
678
- // cache the content requests to pull locally
679
- cache : true,
680
- // settings for api call
681
- apiSettings : false,
682
-
683
- error: {
684
- api : 'You attempted to load content without API module',
685
- method : 'The method you called is not defined',
686
- missingTab : 'Tab cannot be found',
687
- noContent : 'The tab you specified is missing a content url.',
688
- path : 'History enabled, but no path was specified',
689
- recursion : 'Max recursive depth reached',
690
- state : 'The state library has not been initialized'
691
- },
692
-
693
- metadata : {
694
- tab : 'tab',
695
- loaded : 'loaded',
696
- promise: 'promise'
697
- },
698
-
699
- className : {
700
- loading : 'loading',
701
- active : 'active'
702
- },
703
-
704
- selector : {
705
- tabs : '.ui.tab'
706
- }
707
-
708
- };
709
-
710
- })( jQuery, window , document );
712
+ })
713
+ ;
714
+ if(module && !methodInvoked) {
715
+ module.initializeHistory();
716
+ }
717
+ return (returnedValue !== undefined)
718
+ ? returnedValue
719
+ : this
720
+ ;
721
+
722
+ };
723
+
724
+ // shortcut for tabbed content with no defined navigation
725
+ $.tab = function() {
726
+ $(window).tab.apply(this, arguments);
727
+ };
728
+
729
+ $.fn.tab.settings = {
730
+
731
+ name : 'Tab',
732
+ namespace : 'tab',
733
+
734
+ debug : false,
735
+ verbose : true,
736
+ performance : true,
737
+
738
+ auto : false, // uses pjax style endpoints fetching content from same url with remote-content headers
739
+ history : false, // use browser history
740
+ historyType : 'hash', // #/ or html5 state
741
+ path : false, // base path of url
742
+
743
+ context : false, // specify a context that tabs must appear inside
744
+ childrenOnly : false, // use only tabs that are children of context
745
+ maxDepth : 25, // max depth a tab can be nested
746
+
747
+ alwaysRefresh : false, // load tab content new every tab click
748
+ cache : true, // cache the content requests to pull locally
749
+ ignoreFirstLoad : false, // don't load remote content on first load
750
+ apiSettings : false, // settings for api call
751
+
752
+ onTabInit : function(tabPath, parameterArray, historyEvent) {}, // called first time loaded
753
+ onTabLoad : function(tabPath, parameterArray, historyEvent) {}, // called on every load
754
+
755
+ templates : {
756
+ determineTitle: function(tabArray) {} // returns page title for path
757
+ },
758
+
759
+ error: {
760
+ api : 'You attempted to load content without API module',
761
+ method : 'The method you called is not defined',
762
+ missingTab : 'Activated tab cannot be found for this context.',
763
+ noContent : 'The tab you specified is missing a content url.',
764
+ path : 'History enabled, but no path was specified',
765
+ recursion : 'Max recursive depth reached',
766
+ state : 'History requires Asual\'s Address library <https://github.com/asual/jquery-address>'
767
+ },
768
+
769
+ metadata : {
770
+ tab : 'tab',
771
+ loaded : 'loaded',
772
+ promise: 'promise'
773
+ },
774
+
775
+ className : {
776
+ loading : 'loading',
777
+ active : 'active'
778
+ },
779
+
780
+ selector : {
781
+ tabs : '.ui.tab',
782
+ ui : '.ui'
783
+ }
784
+
785
+ };
786
+
787
+ })( jQuery, window , document );