1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /* AutoDoc Javascript */
-
- var conf = {
- "default_hash": "home",
- "openapi": "/v1",
- "pageinit": {
- "home": "page_load_home()"
- }
- };
-
-
- $(document).ready(function() {
- change_page();
- });
-
- $(window).bind('hashchange', function() {
- change_page();
- });
-
- function change_page() {
- var hash = document.location.hash.substr(1) || conf.default_hash;
-
- if ( ! $("#autodoc_tab_"+hash).length ) {
- hash = conf.default_hash;
- }
-
- /* change menu highlights and content visibility */
- $('#autodoc_navbar').find("a").each(function(id, obj) {
- var curhash = $(obj).attr('href').substr(1);
- if ( curhash == hash ) {
- console.log("add " + curhash);
- $(obj).parent().addClass('active');
- $('#autodoc_tab_'+curhash).removeClass('d-none');
- }
- else {
- console.log("remove " + curhash);
- $(obj).parent().removeClass('active');
- $('#autodoc_tab_'+curhash).addClass('d-none');
- }
- });
-
- if ( conf.pageinit[hash]) {
- eval(conf.pageinit[hash]);
- }
- }
-
- function page_load_home() {
- document_load(0);
- }
-
- function document_load(page) {
- if ( ! page ) { page = 0; }
-
- $.getJSON(conf.openapi + "/documents?pageSize=3&pageIndex=" + page, null,
- function (data, textStatus, jqXHR) {
- console.log(data);
- }
- );
- }
|