and_cesbo

Web. Submenu for web interface

Oct 10th, 2017
625
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. astra_storage["/mod.js"] = astra_storage["/mod.js"] .. [[
  2. (function() {
  3. "use strict";
  4.  
  5. window.SubmenuModule = {
  6. label: "Submenu Name",
  7. order: 999,
  8. };
  9.  
  10. SubmenuModule.click = function() {
  11. var modal = $.modal();
  12. modal.addClass("main-menu");
  13.  
  14. var makeItem = function(label, link) {
  15. modal.addChild($.element("a")
  16. .setText(label)
  17. .addAttr("href", link || "#")
  18. .on("click", function(event) {
  19. modal.remove();
  20. }));
  21. };
  22.  
  23. makeItem("Cesbo.com", "https://cesbo.com");
  24. makeItem("Google", "https://google.com");
  25.  
  26. modal.addChild($.element("a")
  27. .setText("Cancel")
  28. .addClass("text-center")
  29. .addAttr("href", "#/")
  30. .on("click", function(event) {
  31. event.preventDefault();
  32. modal.remove();
  33. }));
  34. };
  35.  
  36. app.modules.push(SubmenuModule);
  37. app.menu.push(SubmenuModule);
  38. })();
  39. ]]
Advertisement
Add Comment
Please, Sign In to add comment