An unfinished system to manage all your paper documentation in an easy way.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

autodoc.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* AutoDoc Javascript */
  2. var conf = {
  3. "default_hash": "home",
  4. "openapi": "/v1",
  5. "pageinit": {
  6. "home": "page_load_home(0)"
  7. }
  8. };
  9. $(document).ready(function() {
  10. change_page();
  11. });
  12. $(window).bind('hashchange', function() {
  13. change_page();
  14. });
  15. function change_page() {
  16. var hash = document.location.hash.substr(1) || conf.default_hash;
  17. if ( ! $("#autodoc_tab_"+hash).length ) {
  18. hash = conf.default_hash;
  19. }
  20. /* change menu highlights and content visibility */
  21. $('#autodoc_navbar').find("a").each(function(id, obj) {
  22. var curhash = $(obj).attr('href').substr(1);
  23. if ( curhash == hash ) {
  24. console.log("add " + curhash);
  25. $(obj).parent().addClass('active');
  26. $('#autodoc_tab_'+curhash).removeClass('d-none');
  27. }
  28. else {
  29. console.log("remove " + curhash);
  30. $(obj).parent().removeClass('active');
  31. $('#autodoc_tab_'+curhash).addClass('d-none');
  32. }
  33. });
  34. if ( conf.pageinit[hash]) {
  35. eval(conf.pageinit[hash]);
  36. }
  37. }
  38. function document_load(page) {
  39. if ( ! page ) { page = 0; }
  40. $.getJSON(conf.openapi + "/documents?pageSize=3&pageIndex=" + page, null,
  41. function (data, textStatus, jqXHR) {
  42. console.log(data);
  43. }
  44. );
  45. }