An unfinished system to manage all your paper documentation in an easy way.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

autodoc.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* AutoDoc Javascript */
  2. var conf = {
  3. default_hash: "home",
  4. openapi: "/v1",
  5. pageinit: {
  6. home: "page_load_home()"
  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")
  22. .find("a")
  23. .each(function (id, obj) {
  24. var curhash = $(obj)
  25. .attr("href")
  26. .substr(1);
  27. if (curhash == hash) {
  28. console.log("add " + curhash);
  29. $(obj)
  30. .parent()
  31. .addClass("active");
  32. $("#autodoc_tab_" + curhash).removeClass("d-none");
  33. } else {
  34. console.log("remove " + curhash);
  35. $(obj)
  36. .parent()
  37. .removeClass("active");
  38. $("#autodoc_tab_" + curhash).addClass("d-none");
  39. }
  40. });
  41. if (conf.pageinit[hash]) {
  42. eval(conf.pageinit[hash]);
  43. }
  44. }
  45. function page_load_home() {
  46. document_load(0);
  47. }
  48. function document_load(page) {
  49. if (!page) {
  50. page = 0;
  51. }
  52. var tmpl = $("#autodoc_template_home");
  53. var row = $(tmpl)
  54. .find(".autodoc_template_home_row")
  55. .clone();
  56. $.getJSON(
  57. conf.openapi + "/documents?pageSize=3&pageIndex=" + page,
  58. null,
  59. function (data, textStatus, jqXHR) {
  60. $.each(data, function (id, doc) {
  61. var col = $(tmpl)
  62. .find(".autodoc_template_home_col")
  63. .clone();
  64. $(col).find(".autodoc_template_home_img").attr('src', config.openapi + '/documents/' + doc.id + '/image');
  65. $(col)
  66. .find(".autodoc_template_home_owner")
  67. .html(doc.owner);
  68. $(col)
  69. .find(".autodoc_template_home_created")
  70. .html(doc.created);
  71. $.each(doc.tags, function (id, tag) {
  72. $(col)
  73. .find(".autodoc_template_home_tag")
  74. .after(
  75. $(col)
  76. .find(".autodoc_template_home_tag")
  77. .clone()
  78. .html(tag)
  79. );
  80. });
  81. $(row).append(col);
  82. });
  83. $('#autodoc_home_body').append(row);
  84. }
  85. );
  86. }