index.ui.js 911 B

12345678910111213141516171819202122232425262728293031
  1. window.initModuleTree = function()
  2. {
  3. $('#moduleTree').replaceWith('<ul id="moduleTree"></ul>');
  4. $('#extendWin').attr('src', '');
  5. data = appendClickEvent(moduleTree);
  6. new zui.Tree("#moduleTree", {items: data});
  7. };
  8. window.appendClickEvent = function(moduleTree)
  9. {
  10. for(const tree of moduleTree)
  11. {
  12. if(tree.link != '') tree.onClick = openInExtend;
  13. if(typeof(tree.items) != 'undefined') tree.items = appendClickEvent(tree.items);
  14. }
  15. return moduleTree;
  16. };
  17. window.openInExtend = function(event, node)
  18. {
  19. let $this = $(node.element);
  20. if(node.item.link == '') return;
  21. extendWin.location.href = node.item.link;
  22. $this.closest('#moduleTree').find('li.active').removeClass('active');
  23. $this.closest('li.tree-item').addClass('active');
  24. $this.closest('li.tree-item.has-nested-menu').addClass('active');
  25. };
  26. window.waitDom('#moduleTree', initModuleTree);