@bennerinformatics/ember-fw-table 2.1.4 → 2.1.6

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 (166) hide show
  1. package/addon/components/fw-table-resort.js +18 -4
  2. package/addon/components/fw-table-sortable.js +23 -0
  3. package/addon/templates/components/fw-table-resort.hbs +3 -0
  4. package/addon/templates/components/fw-table-sortable.hbs +10 -1
  5. package/docs/api.js +61 -0
  6. package/docs/assets/css/custom.css +82 -0
  7. package/docs/assets/css/external-small.png +0 -0
  8. package/docs/assets/css/logo.png +0 -0
  9. package/docs/assets/css/main.css +793 -0
  10. package/docs/assets/css/theme.css +547 -0
  11. package/docs/assets/favicon.ico +0 -0
  12. package/docs/assets/icons/android-icon-144x144.png +0 -0
  13. package/docs/assets/icons/android-icon-192x192.png +0 -0
  14. package/docs/assets/icons/android-icon-36x36.png +0 -0
  15. package/docs/assets/icons/android-icon-48x48.png +0 -0
  16. package/docs/assets/icons/android-icon-72x72.png +0 -0
  17. package/docs/assets/icons/android-icon-96x96.png +0 -0
  18. package/docs/assets/icons/apple-icon-114x114.png +0 -0
  19. package/docs/assets/icons/apple-icon-120x120.png +0 -0
  20. package/docs/assets/icons/apple-icon-144x144.png +0 -0
  21. package/docs/assets/icons/apple-icon-152x152.png +0 -0
  22. package/docs/assets/icons/apple-icon-180x180.png +0 -0
  23. package/docs/assets/icons/apple-icon-57x57.png +0 -0
  24. package/docs/assets/icons/apple-icon-60x60.png +0 -0
  25. package/docs/assets/icons/apple-icon-72x72.png +0 -0
  26. package/docs/assets/icons/apple-icon-76x76.png +0 -0
  27. package/docs/assets/icons/apple-icon-precomposed.png +0 -0
  28. package/docs/assets/icons/apple-icon.png +0 -0
  29. package/docs/assets/icons/browserconfig.xml +2 -0
  30. package/docs/assets/icons/favicon-16x16.png +0 -0
  31. package/docs/assets/icons/favicon-32x32.png +0 -0
  32. package/docs/assets/icons/favicon-96x96.png +0 -0
  33. package/docs/assets/icons/favicon.ico +0 -0
  34. package/docs/assets/icons/manifest.json +41 -0
  35. package/docs/assets/icons/ms-icon-144x144.png +0 -0
  36. package/docs/assets/icons/ms-icon-150x150.png +0 -0
  37. package/docs/assets/icons/ms-icon-310x310.png +0 -0
  38. package/docs/assets/icons/ms-icon-70x70.png +0 -0
  39. package/docs/assets/img/ember-logo.png +0 -0
  40. package/docs/assets/img/fw-logo.png +0 -0
  41. package/docs/assets/img/spinner.gif +0 -0
  42. package/docs/assets/index.html +10 -0
  43. package/docs/assets/js/api-filter.js +56 -0
  44. package/docs/assets/js/api-list.js +255 -0
  45. package/docs/assets/js/api-search.js +98 -0
  46. package/docs/assets/js/apidocs.js +376 -0
  47. package/docs/assets/js/yui-prettify.js +17 -0
  48. package/docs/assets/js/yuidoc-bootstrap.js +274 -0
  49. package/docs/assets/vendor/bootstrap/css/bootstrap.css +6760 -0
  50. package/docs/assets/vendor/bootstrap/css/bootstrap.min.css +6 -0
  51. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
  52. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.svg +288 -0
  53. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
  54. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
  55. package/docs/assets/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
  56. package/docs/assets/vendor/bootstrap/img/glyphicons-halflings-white.png +0 -0
  57. package/docs/assets/vendor/bootstrap/img/glyphicons-halflings.png +0 -0
  58. package/docs/assets/vendor/bootstrap/js/bootstrap.js +2363 -0
  59. package/docs/assets/vendor/bootstrap/js/bootstrap.min.js +7 -0
  60. package/docs/assets/vendor/font-awesome/css/font-awesome.css +2199 -0
  61. package/docs/assets/vendor/font-awesome/css/font-awesome.min.css +4 -0
  62. package/docs/assets/vendor/font-awesome/fonts/FontAwesome.otf +0 -0
  63. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  64. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.svg +685 -0
  65. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  66. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  67. package/docs/assets/vendor/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  68. package/docs/assets/vendor/github-slugger/slugger.js +59 -0
  69. package/docs/assets/vendor/jquery/jquery.min.js +6 -0
  70. package/docs/assets/vendor/jquery-ui/jquery-ui.min.js +6 -0
  71. package/docs/assets/vendor/prettify/CHANGES.html +130 -0
  72. package/docs/assets/vendor/prettify/COPYING +202 -0
  73. package/docs/assets/vendor/prettify/README.html +203 -0
  74. package/docs/assets/vendor/prettify/prettify-min.css +1 -0
  75. package/docs/assets/vendor/prettify/prettify-min.js +1 -0
  76. package/docs/classes/BaseCells.html +484 -0
  77. package/docs/classes/Export.html +457 -0
  78. package/docs/classes/Format.html +577 -0
  79. package/docs/classes/FwCellAction.html +312 -0
  80. package/docs/classes/FwCellBoolean.html +311 -0
  81. package/docs/classes/FwCellNullable.html +312 -0
  82. package/docs/classes/FwCellPermissionIcon.html +321 -0
  83. package/docs/classes/FwColumnSortable.html +358 -0
  84. package/docs/classes/FwColumnTitle.html +314 -0
  85. package/docs/classes/FwDeleteModal.html +485 -0
  86. package/docs/classes/FwExpandableRow.html +307 -0
  87. package/docs/classes/FwPaginationWrapper.html +2129 -0
  88. package/docs/classes/FwRowToggle.html +355 -0
  89. package/docs/classes/FwRowToggleIndex.html +312 -0
  90. package/docs/classes/FwTableExpandedRow.html +307 -0
  91. package/docs/classes/FwTableResort.html +827 -0
  92. package/docs/classes/FwTableSortable.html +1293 -0
  93. package/docs/classes/Row.html +352 -0
  94. package/docs/classes/Table.html +672 -0
  95. package/docs/classes/TableUtil.html +410 -0
  96. package/docs/classes/index.html +10 -0
  97. package/docs/data.json +2324 -0
  98. package/docs/elements/index.html +10 -0
  99. package/docs/files/addon_classes_Row.js.html +318 -0
  100. package/docs/files/addon_classes_Table.js.html +390 -0
  101. package/docs/files/addon_components_fw-cell-action.js.html +257 -0
  102. package/docs/files/addon_components_fw-cell-boolean.js.html +251 -0
  103. package/docs/files/addon_components_fw-cell-nullable.js.html +253 -0
  104. package/docs/files/addon_components_fw-cell-permission-icon.js.html +266 -0
  105. package/docs/files/addon_components_fw-column-sortable.js.html +281 -0
  106. package/docs/files/addon_components_fw-column-title.js.html +259 -0
  107. package/docs/files/addon_components_fw-delete-modal.js.html +318 -0
  108. package/docs/files/addon_components_fw-expandable-row.js.html +248 -0
  109. package/docs/files/addon_components_fw-pagination-wrapper.js.html +838 -0
  110. package/docs/files/addon_components_fw-row-toggle-index.js.html +252 -0
  111. package/docs/files/addon_components_fw-row-toggle.js.html +270 -0
  112. package/docs/files/addon_components_fw-table-expanded-row.js.html +261 -0
  113. package/docs/files/addon_components_fw-table-expanded-rows.js.html +263 -0
  114. package/docs/files/addon_components_fw-table-resort.js.html +457 -0
  115. package/docs/files/addon_components_fw-table-sortable.js.html +663 -0
  116. package/docs/files/addon_documentation.js.html +301 -0
  117. package/docs/files/addon_initializers_responsive.js.html +253 -0
  118. package/docs/files/addon_utils_base-cells.js.html +313 -0
  119. package/docs/files/addon_utils_export.js.html +316 -0
  120. package/docs/files/addon_utils_formats.js.html +335 -0
  121. package/docs/files/addon_utils_table.js.html +274 -0
  122. package/docs/files/index.html +10 -0
  123. package/docs/index.html +252 -0
  124. package/docs/modules/CellComponents.html +313 -0
  125. package/docs/modules/ColumnComponents.html +284 -0
  126. package/docs/modules/Components.html +285 -0
  127. package/docs/modules/Introduction.html +261 -0
  128. package/docs/modules/Utils.html +285 -0
  129. package/docs/modules/index.html +10 -0
  130. package/package.json +64 -64
  131. package/.yalc/ember-sortable/.huskyrc +0 -5
  132. package/.yalc/ember-sortable/CHANGELOG.md +0 -755
  133. package/.yalc/ember-sortable/CODE_OF_CONDUCT.md +0 -6
  134. package/.yalc/ember-sortable/LICENSE.md +0 -9
  135. package/.yalc/ember-sortable/MIGRATION_GUIDE_MODIFIERS.md +0 -95
  136. package/.yalc/ember-sortable/MIGRATION_GUIDE_V2.md +0 -120
  137. package/.yalc/ember-sortable/Makefile +0 -24
  138. package/.yalc/ember-sortable/README.md +0 -423
  139. package/.yalc/ember-sortable/RELEASE.md +0 -60
  140. package/.yalc/ember-sortable/V2_MIGRATION_RFC.md +0 -1100
  141. package/.yalc/ember-sortable/addon/modifiers/sortable-group.js +0 -754
  142. package/.yalc/ember-sortable/addon/modifiers/sortable-handle.js +0 -29
  143. package/.yalc/ember-sortable/addon/modifiers/sortable-item.js +0 -869
  144. package/.yalc/ember-sortable/addon/services/ember-sortable.js +0 -92
  145. package/.yalc/ember-sortable/addon/system/scroll-container.js +0 -53
  146. package/.yalc/ember-sortable/addon/system/scroll-parent.js +0 -33
  147. package/.yalc/ember-sortable/addon/utils/constant.js +0 -9
  148. package/.yalc/ember-sortable/addon/utils/coordinate.js +0 -34
  149. package/.yalc/ember-sortable/addon/utils/css-calculation.js +0 -20
  150. package/.yalc/ember-sortable/addon/utils/defaults.js +0 -26
  151. package/.yalc/ember-sortable/addon/utils/keyboard.js +0 -32
  152. package/.yalc/ember-sortable/addon-test-support/helpers/drag.js +0 -111
  153. package/.yalc/ember-sortable/addon-test-support/helpers/index.js +0 -4
  154. package/.yalc/ember-sortable/addon-test-support/helpers/reorder.js +0 -41
  155. package/.yalc/ember-sortable/addon-test-support/utils/keyboard.js +0 -32
  156. package/.yalc/ember-sortable/addon-test-support/utils/offset.js +0 -14
  157. package/.yalc/ember-sortable/app/modifiers/sortable-group.js +0 -1
  158. package/.yalc/ember-sortable/app/modifiers/sortable-handle.js +0 -1
  159. package/.yalc/ember-sortable/app/modifiers/sortable-item.js +0 -1
  160. package/.yalc/ember-sortable/app/services/ember-sortable-internal-state.js +0 -1
  161. package/.yalc/ember-sortable/config/environment.js +0 -5
  162. package/.yalc/ember-sortable/demo.gif +0 -0
  163. package/.yalc/ember-sortable/index.js +0 -5
  164. package/.yalc/ember-sortable/package.json +0 -65
  165. package/.yalc/ember-sortable/yalc.sig +0 -1
  166. package/yalc.lock +0 -10
@@ -0,0 +1,376 @@
1
+ YUI().use(
2
+ 'yuidoc-meta',
3
+ 'api-list', 'history-hash', 'node-screen', 'node-style', 'pjax',
4
+ function (Y) {
5
+
6
+ var win = Y.config.win,
7
+ localStorage = win.localStorage,
8
+
9
+ bdNode = Y.one('#bd'),
10
+
11
+ pjax,
12
+ defaultRoute,
13
+
14
+ classTabView,
15
+ selectedTab;
16
+
17
+ // Kill pjax functionality unless serving over HTTP.
18
+ if (!Y.getLocation().protocol.match(/^https?\:/)) {
19
+ Y.Router.html5 = false;
20
+ }
21
+
22
+ // Create the default route with middleware which enables syntax highlighting
23
+ // on the loaded content.
24
+ defaultRoute = Y.Pjax.defaultRoute.concat(function (req, res, next) {
25
+ prettyPrint();
26
+ bdNode.removeClass('loading');
27
+
28
+ next();
29
+ });
30
+
31
+ pjax = new Y.Pjax({
32
+ container : '#docs-main',
33
+ contentSelector: '#docs-main > .content',
34
+ linkSelector : '#bd a',
35
+ titleSelector : '#xhr-title',
36
+
37
+ navigateOnHash: true,
38
+ root : '/',
39
+ routes : [
40
+ // -- / ----------------------------------------------------------------
41
+ {
42
+ path : '/(index.html)?',
43
+ callbacks: defaultRoute
44
+ },
45
+
46
+ // -- /elements/* -------------------------------------------------------
47
+ {
48
+ path : '/elements/:element.html*',
49
+ callbacks: defaultRoute
50
+ },
51
+
52
+ // -- /classes/* -------------------------------------------------------
53
+ {
54
+ path : '/classes/:class.html*',
55
+ callbacks: [defaultRoute, 'handleClasses']
56
+ },
57
+
58
+ // -- /files/* ---------------------------------------------------------
59
+ {
60
+ path : '/files/*file',
61
+ callbacks: [defaultRoute, 'handleFiles']
62
+ },
63
+
64
+ // -- /modules/* -------------------------------------------------------
65
+ {
66
+ path : '/modules/:module.html*',
67
+ callbacks: defaultRoute
68
+ }
69
+ ]
70
+ });
71
+
72
+ // -- Utility Functions --------------------------------------------------------
73
+
74
+ pjax.checkVisibility = function (tab) {
75
+ tab || (tab = selectedTab);
76
+
77
+ if (!tab) { return; }
78
+
79
+ var panelNode = tab.get('panelNode'),
80
+ visibleItems;
81
+
82
+ // If no items are visible in the tab panel due to the current visibility
83
+ // settings, display a message to that effect.
84
+ visibleItems = panelNode.all('.item,.index-item').some(function (itemNode) {
85
+ if (itemNode.getComputedStyle('display') !== 'none') {
86
+ return true;
87
+ }
88
+ });
89
+
90
+ panelNode.all('.no-visible-items').remove();
91
+
92
+ if (!visibleItems) {
93
+ if (Y.one('#index .index-item')) {
94
+ panelNode.append(
95
+ '<div class="no-visible-items">' +
96
+ '<p>' +
97
+ 'Some items are not shown due to the current visibility ' +
98
+ 'settings. Use the checkboxes at the upper right of this ' +
99
+ 'page to change the visibility settings.' +
100
+ '</p>' +
101
+ '</div>'
102
+ );
103
+ } else {
104
+ panelNode.append(
105
+ '<div class="no-visible-items">' +
106
+ '<p>' +
107
+ 'This class doesn\'t provide any methods, properties, ' +
108
+ 'attributes, or events.' +
109
+ '</p>' +
110
+ '</div>'
111
+ );
112
+ }
113
+ }
114
+
115
+ // Hide index sections without any visible items.
116
+ Y.all('.index-section').each(function (section) {
117
+ var items = 0,
118
+ visibleItems = 0;
119
+
120
+ section.all('.index-item').each(function (itemNode) {
121
+ items += 1;
122
+
123
+ if (itemNode.getComputedStyle('display') !== 'none') {
124
+ visibleItems += 1;
125
+ }
126
+ });
127
+
128
+ section.toggleClass('hidden', !visibleItems);
129
+ section.toggleClass('no-columns', visibleItems < 4);
130
+ });
131
+ };
132
+
133
+ pjax.initClassTabView = function () {
134
+ if (!Y.all('#classdocs .api-class-tab').size()) {
135
+ return;
136
+ }
137
+
138
+ if (classTabView) {
139
+ classTabView.destroy();
140
+ selectedTab = null;
141
+ }
142
+
143
+ classTabView = new Y.TabView({
144
+ srcNode: '#classdocs',
145
+
146
+ on: {
147
+ selectionChange: pjax.onTabSelectionChange
148
+ }
149
+ });
150
+
151
+ pjax.updateTabState();
152
+ classTabView.render();
153
+ };
154
+
155
+ pjax.initLineNumbers = function () {
156
+ var hash = win.location.hash.substring(1),
157
+ container = pjax.get('container'),
158
+ hasLines, node;
159
+
160
+ // Add ids for each line number in the file source view.
161
+ container.all('.linenums>li').each(function (lineNode, index) {
162
+ lineNode.set('id', 'l' + (index + 1));
163
+ lineNode.addClass('file-line');
164
+ hasLines = true;
165
+ });
166
+
167
+ // Scroll to the desired line.
168
+ if (hasLines && /^l\d+$/.test(hash)) {
169
+ if ((node = container.getById(hash))) {
170
+ win.scroll(0, node.getY());
171
+ }
172
+ }
173
+ };
174
+
175
+ pjax.initRoot = function () {
176
+ var terminators = /^(?:classes|files|elements|modules)$/,
177
+ parts = pjax._getPathRoot().split('/'),
178
+ root = [],
179
+ i, len, part;
180
+
181
+ for (i = 0, len = parts.length; i < len; i += 1) {
182
+ part = parts[i];
183
+
184
+ if (part.match(terminators)) {
185
+ // Makes sure the path will end with a "/".
186
+ root.push('');
187
+ break;
188
+ }
189
+
190
+ root.push(part);
191
+ }
192
+
193
+ pjax.set('root', root.join('/'));
194
+ };
195
+
196
+ pjax.updateTabState = function (src) {
197
+ var hash = win.location.hash.substring(1),
198
+ defaultTab, node, tab, tabPanel;
199
+
200
+ function scrollToNode() {
201
+ if (node.hasClass('protected')) {
202
+ Y.one('#api-show-protected').set('checked', true);
203
+ pjax.updateVisibility();
204
+ }
205
+
206
+ if (node.hasClass('private')) {
207
+ Y.one('#api-show-private').set('checked', true);
208
+ pjax.updateVisibility();
209
+ }
210
+
211
+ setTimeout(function () {
212
+ // For some reason, unless we re-get the node instance here,
213
+ // getY() always returns 0.
214
+ var node = Y.one('#classdocs').getById(hash);
215
+ win.scrollTo(0, node.getY() - 70);
216
+ }, 1);
217
+ }
218
+
219
+ if (!classTabView) {
220
+ return;
221
+ }
222
+
223
+ if (src === 'hashchange' && !hash) {
224
+ defaultTab = 'index';
225
+ } else {
226
+ if (localStorage) {
227
+ defaultTab = localStorage.getItem('tab_' + pjax.getPath()) ||
228
+ 'index';
229
+ } else {
230
+ defaultTab = 'index';
231
+ }
232
+ }
233
+
234
+ if (hash && (node = Y.one('#classdocs').getById(hash))) {
235
+ if ((tabPanel = node.ancestor('.api-class-tabpanel', true))) {
236
+ if ((tab = Y.one('#classdocs .api-class-tab.' + tabPanel.get('id')))) {
237
+ if (classTabView.get('rendered')) {
238
+ Y.Widget.getByNode(tab).set('selected', 1);
239
+ } else {
240
+ tab.addClass('yui3-tab-selected');
241
+ }
242
+ }
243
+ }
244
+
245
+ // Scroll to the desired element if this is a hash URL.
246
+ if (node) {
247
+ if (classTabView.get('rendered')) {
248
+ scrollToNode();
249
+ } else {
250
+ classTabView.once('renderedChange', scrollToNode);
251
+ }
252
+ }
253
+ } else {
254
+ tab = Y.one('#classdocs .api-class-tab.' + defaultTab);
255
+
256
+ // When the `defaultTab` node isn't found, `localStorage` is stale.
257
+ if (!tab && defaultTab !== 'index') {
258
+ tab = Y.one('#classdocs .api-class-tab.index');
259
+ }
260
+
261
+ if (classTabView.get('rendered')) {
262
+ Y.Widget.getByNode(tab).set('selected', 1);
263
+ } else {
264
+ tab.addClass('yui3-tab-selected');
265
+ }
266
+ }
267
+ };
268
+
269
+ pjax.updateVisibility = function () {
270
+ var container = pjax.get('container');
271
+
272
+ container.toggleClass('hide-inherited',
273
+ !Y.one('#api-show-inherited').get('checked'));
274
+
275
+ container.toggleClass('show-deprecated',
276
+ Y.one('#api-show-deprecated').get('checked'));
277
+
278
+ container.toggleClass('show-protected',
279
+ Y.one('#api-show-protected').get('checked'));
280
+
281
+ container.toggleClass('show-private',
282
+ Y.one('#api-show-private').get('checked'));
283
+
284
+ pjax.checkVisibility();
285
+ };
286
+
287
+ // -- Route Handlers -----------------------------------------------------------
288
+
289
+ pjax.handleClasses = function (req, res, next) {
290
+ var status = res.ioResponse.status;
291
+
292
+ // Handles success and local filesystem XHRs.
293
+ if (res.ioResponse.readyState === 4 && (!status || (status >= 200 && status < 300))) {
294
+ pjax.initClassTabView();
295
+ }
296
+
297
+ next();
298
+ };
299
+
300
+ pjax.handleFiles = function (req, res, next) {
301
+ var status = res.ioResponse.status;
302
+
303
+ // Handles success and local filesystem XHRs.
304
+ if (res.ioResponse.readyState === 4 && (!status || (status >= 200 && status < 300))) {
305
+ pjax.initLineNumbers();
306
+ }
307
+
308
+ next();
309
+ };
310
+
311
+ // -- Event Handlers -----------------------------------------------------------
312
+
313
+ pjax.onNavigate = function (e) {
314
+ var hash = e.hash,
315
+ originTarget = e.originEvent && e.originEvent.target,
316
+ tab;
317
+
318
+ if (hash) {
319
+ tab = originTarget && originTarget.ancestor('.yui3-tab', true);
320
+
321
+ if (hash === win.location.hash) {
322
+ pjax.updateTabState('hashchange');
323
+ } else if (!tab) {
324
+ win.location.hash = hash;
325
+ }
326
+
327
+ e.preventDefault();
328
+ return;
329
+ }
330
+
331
+ // Only scroll to the top of the page when the URL doesn't have a hash.
332
+ this.set('scrollToTop', !e.url.match(/#.+$/));
333
+
334
+ bdNode.addClass('loading');
335
+ };
336
+
337
+ pjax.onOptionClick = function (e) {
338
+ pjax.updateVisibility();
339
+ };
340
+
341
+ pjax.onTabSelectionChange = function (e) {
342
+ var tab = e.newVal,
343
+ tabId = tab.get('contentBox').getAttribute('href').substring(1);
344
+
345
+ selectedTab = tab;
346
+
347
+ // If switching from a previous tab (i.e., this is not the default tab),
348
+ // replace the history entry with a hash URL that will cause this tab to
349
+ // be selected if the user navigates away and then returns using the back
350
+ // or forward buttons.
351
+ if (e.prevVal && localStorage) {
352
+ localStorage.setItem('tab_' + pjax.getPath(), tabId);
353
+ }
354
+
355
+ pjax.checkVisibility(tab);
356
+ };
357
+
358
+ // -- Init ---------------------------------------------------------------------
359
+
360
+ pjax.on('navigate', pjax.onNavigate);
361
+
362
+ pjax.initRoot();
363
+ pjax.upgrade();
364
+ pjax.initClassTabView();
365
+ pjax.initLineNumbers();
366
+ pjax.updateVisibility();
367
+
368
+ Y.APIList.rootPath = pjax.get('root');
369
+
370
+ Y.one('#api-options').delegate('click', pjax.onOptionClick, 'input');
371
+
372
+ Y.on('hashchange', function (e) {
373
+ pjax.updateTabState('hashchange');
374
+ }, win);
375
+
376
+ });
@@ -0,0 +1,17 @@
1
+ YUI().use('node', function(Y) {
2
+ var code = Y.all('.prettyprint.linenums');
3
+ if (code.size()) {
4
+ code.each(function(c) {
5
+ var lis = c.all('ol li'),
6
+ l = 1;
7
+ lis.each(function(n) {
8
+ n.prepend('<a name="LINENUM_' + l + '"></a>');
9
+ l++;
10
+ });
11
+ });
12
+ var h = location.hash;
13
+ location.hash = '';
14
+ h = h.replace('LINE_', 'LINENUM_');
15
+ location.hash = h;
16
+ }
17
+ });
@@ -0,0 +1,274 @@
1
+ /* global $:true */
2
+ $(function() {
3
+ 'use strict';
4
+
5
+ // ************************************************************************* //
6
+ // HTML templates
7
+ // ************************************************************************* //
8
+
9
+ // (None)
10
+
11
+
12
+ // ************************************************************************* //
13
+ // Functions
14
+ // ************************************************************************* //
15
+
16
+ function setUpOptionsCheckboxes() {
17
+ if(localStorage.getItem('options')){
18
+ var optionsArr = JSON.parse(localStorage.options),
19
+ optionsForm = $('#options-form');
20
+
21
+ if(!optionsForm.length) {
22
+ return;
23
+ }
24
+
25
+ for(var i=0;i<optionsArr.length;i++){
26
+ var box = optionsForm.find('input:checkbox').eq(i);
27
+ box.prop('checked', optionsArr[i]);
28
+ setOptionDisplayState(box);
29
+ }
30
+ }
31
+ }
32
+
33
+ function setupActiveSidebarLink() {
34
+ var pathname = window.location.pathname;
35
+
36
+ if(pathname) {
37
+ var pathArr = pathname.split('/');
38
+ var path = decodeURIComponent(pathArr.slice(pathArr.length - 2, pathArr.length).join('/')); // modules/My Module.html
39
+
40
+ $('#sidebar li > a').each(function(i) {
41
+ var a = $(this);
42
+
43
+ if(a.attr('href').indexOf(path) > -1) {
44
+ a.parent('li').addClass('active');
45
+ }
46
+ });
47
+ }
48
+ }
49
+
50
+ function setUpWidgets() {
51
+ var source = [];
52
+ var sidebarSearch;
53
+
54
+ $('#sidebar .panel-body ol > li > a').each(function(index, elem) {
55
+ source.push($(elem).text().trim());
56
+ });
57
+
58
+ sidebarSearch = $('#sidebar input[type="search"]');
59
+ sidebarSearch.autocomplete({
60
+ source: source,
61
+ position: { my : "left top", at: "right top" },
62
+ select : function(event, ui) {
63
+ $('#sidebar > li a:contains(' + ui.item.label + ')')[0].click();
64
+ }
65
+ });
66
+ }
67
+
68
+ function setupHeaderAnchors() {
69
+ var slugger = new GithubSlugger();
70
+
71
+ $('h1, h2, h3, h4, h5, h6', '.module-description, .class-description').each(function() {
72
+ var $element = $(this);
73
+ var id = slugger.slug($element.text());
74
+
75
+ $element.attr('id', id);
76
+ $element.addClass('anchorable-toc');
77
+ $element.prepend('<a class="fa fa-link toc-anchor" href="#' + id + '"></a>');
78
+ });
79
+ }
80
+
81
+ function setOptionDisplayState(box) {
82
+ var cssName = $.trim(box.parent('label').text()).toLowerCase();
83
+ if(box.is(':checked')){
84
+ $('div.'+cssName).css('display', 'block');
85
+ $('li.'+cssName).css('display', 'block');
86
+ $('span.'+cssName).css('display', 'inline');
87
+ }else{
88
+ $('.'+cssName).css('display', 'none');
89
+ }
90
+ }
91
+
92
+ function scrollToAnchor($anchor) {
93
+ var navbarHeight = $('.navbar-fixed-top').outerHeight(true);
94
+ $(document).scrollTop( $anchor.offset().top - navbarHeight);
95
+ }
96
+
97
+ $('[data-toggle=tab]').on('click', function (event, extraArgs) {
98
+ // Why? If responding to the click of a link or hashchange already, we really
99
+ // don't want to change window hash
100
+ if (extraArgs && extraArgs.ignore === true) {
101
+ return;
102
+ }
103
+ window.location.hash = $(this).attr('href');
104
+ });
105
+
106
+ $('[data-tabid]').on('click', function(event) {
107
+ var tabToActivate = $(this).attr('data-tabid'),
108
+ anchor = $(this).attr('data-anchor');
109
+ event.preventDefault();
110
+
111
+ $('[data-toggle=tab][href="'+ tabToActivate + '"]').click();
112
+ // ...huh? http://stackoverflow.com/a/9930611
113
+ // otherwise, can't select an element by ID if the ID has a '.' in it
114
+ var scrollAnchor = anchor.replace(/\./g, '\\.');
115
+ scrollToAnchor($(scrollAnchor));
116
+ window.location.hash = anchor;
117
+ });
118
+
119
+ function moveToWindowHash() {
120
+ var hash = window.location.hash,
121
+ tabToActivate = hash,
122
+ $tabToActivate = false,
123
+ $scroll = $(hash);
124
+
125
+ if (!hash) {
126
+ return;
127
+ }
128
+
129
+ if (hash.match(/^#method_/)) {
130
+ tabToActivate = '#tab_methods';
131
+ }
132
+ else if (hash.match(/^#property_/)) {
133
+ tabToActivate = '#tab_properties';
134
+ }
135
+ else if (hash.match(/^#event_/)) {
136
+ tabToActivate = '#tab_events';
137
+ }
138
+ else if (hash.match(/^#attr_/)) {
139
+ tabToActivate = '#tab_attrs';
140
+ }
141
+ else if (hash.match(/#l\d+/)) {
142
+ var lineNumber = /#l(\d+)/.exec(hash)[1];
143
+ var whichLi = parseInt(lineNumber, 10) - 1; //e.g. line 1 is 0th element
144
+ $scroll = $('ol.linenums > li').eq(whichLi);
145
+ }
146
+
147
+ $tabToActivate = $('[data-toggle=tab][href="'+ tabToActivate + '"]');
148
+ if ($tabToActivate.length) {
149
+ $tabToActivate.trigger('click', { ignore: true });
150
+ }
151
+
152
+ if ($scroll.length && !hash.match(/^#tab_/)) {
153
+ scrollToAnchor($scroll);
154
+ }
155
+ }
156
+
157
+ // ************************************************************************* //
158
+ // Initializations + Event listeners
159
+ // ************************************************************************* //
160
+
161
+ //
162
+ // Store last clicked tab in local storage
163
+ //
164
+ $('#main-nav li').on('click', function(e) {
165
+ e.preventDefault();
166
+ localStorage['main-nav'] = $(this).find('a').attr('href');
167
+ });
168
+
169
+ //
170
+ // Refresh typeahead source arrays when user changes tabs
171
+ //
172
+ $('#main-nav li').on('shown', function(e) {
173
+ e.preventDefault();
174
+ setUpWidgets();
175
+ });
176
+
177
+ //
178
+ // Bind change events for options form checkboxes
179
+ //
180
+ $('#options-form input:checkbox').on('change', function(){
181
+ setOptionDisplayState($(this));
182
+
183
+ // Update localstorage
184
+ var optionsArr = [];
185
+ $('#options-form input:checkbox').each(function(i,el) {
186
+ optionsArr.push($(el).is(':checked'));
187
+ });
188
+ localStorage.options = JSON.stringify(optionsArr);
189
+ });
190
+
191
+ //
192
+ // Keyboard shortcut - 's' key
193
+ // This brings the api search input into focus.
194
+ //
195
+ $(window).keyup(function(e) {
196
+ // Listen for 's' key and focus search input if pressed
197
+ if(e.keyCode === 83){ // 's'
198
+ $('#api-tabview-filter input').focus();
199
+ }
200
+ });
201
+
202
+ //
203
+ // Keyboard shortcut - 'ctrl+left', 'ctrl+right', 'up', 'down'
204
+ // These shortcuts offer sidebar navigation via keyboard,
205
+ // *only* when sidebar or any element within has focus.
206
+ //
207
+ var nextIndex;
208
+ $('#sidebar').keydown(function(e) {
209
+ var $this = $(this);
210
+
211
+ // Determine if the control/command key was pressed
212
+ if(e.ctrlKey){
213
+ if(e.keyCode === 37){ // left arrow
214
+ $('#main-nav li a:first').tab('show');
215
+ } else if(e.keyCode === 39){ // right arrow
216
+ $('#main-nav li a:last').tab('show');
217
+ }
218
+ } else {
219
+ if(e.keyCode === 40){ // down arrow
220
+ if ($('#api-tabview-filter input').is(':focus')) {
221
+ // Scenario 1: We're focused on the search input; move down to the first li
222
+ $this.find('.tab-content .tab-pane.active li:first a').focus();
223
+ } else if ($this.find('.tab-content .tab-pane.active li:last a').is(':focus')) {
224
+ // Scenario 2: We're focused on the last li; move up to search input
225
+ $('#api-tabview-filter input').focus();
226
+ } else {
227
+ // Scenario 3: We're in the list but not on the last element, simply move down
228
+ nextIndex = $this
229
+ .find('.tab-content .tab-pane.active li')
230
+ .find('a:focus')
231
+ .parent('li').index() + 1;
232
+ $this.find('.tab-content .tab-pane.active li:eq('+nextIndex+') a').focus();
233
+ }
234
+ e.preventDefault(); // Stop page from scrolling
235
+ } else if (e.keyCode === 38){ // up arrow
236
+ if($('#api-tabview-filter input').is(':focus')) {
237
+ // Scenario 1: We're focused on the search input; move down to the last li
238
+ $this.find('.tab-content .tab-pane.active li:last a').focus();
239
+ }else if($this.find('.tab-content .tab-pane.active li:first a').is(':focus')){
240
+ // Scenario 2: We're focused on the first li; move up to search input
241
+ $('#api-tabview-filter input').focus();
242
+ }else{
243
+ // Scenario 3: We're in the list but not on the first element, simply move up
244
+ nextIndex = $this
245
+ .find('.tab-content .tab-pane.active li')
246
+ .find('a:focus')
247
+ .parent('li').index() - 1;
248
+ $this.find('.tab-content .tab-pane.active li:eq('+nextIndex+') a').focus();
249
+ }
250
+ e.preventDefault(); // Stop page from scrolling
251
+ }
252
+ }
253
+ });
254
+
255
+ function setUpHashChange() {
256
+ $(window).on('hashchange', moveToWindowHash);
257
+ }
258
+
259
+
260
+ // ************************************************************************* //
261
+ // Immediate function calls
262
+ // ************************************************************************* //
263
+
264
+ setupHeaderAnchors();
265
+ setUpOptionsCheckboxes();
266
+ setupActiveSidebarLink();
267
+ setUpWidgets();
268
+ setUpHashChange();
269
+
270
+ if (window.location.hash) {
271
+ moveToWindowHash();
272
+ }
273
+
274
+ });