OLD | NEW |
1 /** | 1 /** |
2 * @fileoverview This file is the controller for generating extension | 2 * @fileoverview This file is the controller for generating extension |
3 * doc pages. | 3 * doc pages. |
4 * | 4 * |
5 * It expects to have available via XHR (relative path): | 5 * It expects to have available via XHR (relative path): |
6 * 1) API_TEMPLATE which is the main template for the api pages. | 6 * 1) API_TEMPLATE which is the main template for the api pages. |
7 * 2) A file located at SCHEMA which is shared with the extension system and | 7 * 2) A file located at SCHEMA which is shared with the extension system and |
8 * defines the methods and events contained in one api. | 8 * defines the methods and events contained in one api. |
9 * 3) (Possibly) A static version of the current page url in /static/. I.e. | 9 * 3) (Possibly) A static version of the current page url in /static/. I.e. |
10 * if called as ../foo.html, it will look for ../static/foo.html. | 10 * if called as ../foo.html, it will look for ../static/foo.html. |
(...skipping 281 matching lines...) Loading... |
292 } | 292 } |
293 | 293 |
294 function isArray(type) { | 294 function isArray(type) { |
295 return type.type == 'array'; | 295 return type.type == 'array'; |
296 } | 296 } |
297 | 297 |
298 function getTypeRef(type) { | 298 function getTypeRef(type) { |
299 return type["$ref"]; | 299 return type["$ref"]; |
300 } | 300 } |
301 | 301 |
| 302 function getEnumValues(enumList, type) { |
| 303 if (type === "string") { |
| 304 enumList = enumList.map(function(e) { return '"' + e + '"'}); |
| 305 } |
| 306 var retval = enumList.join(', '); |
| 307 return "[" + retval + "]"; |
| 308 } |
| 309 |
302 function showPageTOC() { | 310 function showPageTOC() { |
303 return module || getDataFromPageHTML('pageData-showTOC'); | 311 return module || getDataFromPageHTML('pageData-showTOC'); |
304 } | 312 } |
305 | 313 |
306 function showSideNav() { | 314 function showSideNav() { |
307 return getDataFromPageHTML("pageData-showSideNav") != "false"; | 315 return getDataFromPageHTML("pageData-showSideNav") != "false"; |
308 } | 316 } |
309 | 317 |
310 function getStaticTOC() { | 318 function getStaticTOC() { |
311 var staticHNodes = evalXPathFromId(".//h2|h3", "static"); | 319 var staticHNodes = evalXPathFromId(".//h2|h3", "static"); |
(...skipping 109 matching lines...) Loading... |
421 | 429 |
422 function sortByName(a, b) { | 430 function sortByName(a, b) { |
423 if (a.name < b.name) { | 431 if (a.name < b.name) { |
424 return -1; | 432 return -1; |
425 } | 433 } |
426 if (a.name > b.name) { | 434 if (a.name > b.name) { |
427 return 1; | 435 return 1; |
428 } | 436 } |
429 return 0; | 437 return 0; |
430 } | 438 } |
OLD | NEW |