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.

main.js 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* global d3:true, require:false, requirejs:false */ // eslint-disable-line no-unused-vars
  2. requirejs.config({
  3. baseUrl: "js/lib",
  4. paths: {
  5. app: "../app",
  6. jquery: "jquery-3.6.0.min",
  7. visibility: "visibility.min",
  8. bootstrap: "bootstrap.bundle.min",
  9. codejar: "codejar.min",
  10. d3: "d3.min",
  11. d3evolution: "d3evolution.min",
  12. d3pie: "d3pie.min",
  13. fontawesome: "fontawesome.min",
  14. fontawesome_solid: "solid.min",
  15. footable: "footable.min",
  16. linenumbers: "linenumbers.min",
  17. nprogress: "nprogress.min",
  18. prism: "prism",
  19. stickytabs: "jquery.stickytabs.min"
  20. },
  21. shim: {
  22. codejar: {exports: "CodeJar", deps:["linenumbers"]},
  23. bootstrap: {exports:"bootstrap", deps:["jquery"]},
  24. d3evolution: {exports:"D3Evolution", deps:["d3", "jquery"]},
  25. d3pie: {exports:"D3Pie", deps:["d3.global", "jquery"]},
  26. fontawesome: {exports: "FontAwesome", deps:["fontawesome_solid"]},
  27. footable: {deps:["bootstrap", "jquery"]},
  28. linenumbers: {exports: "withLineNumbers", deps:["prism"]},
  29. prism: {exports: "Prism"},
  30. stickytabs: {deps:["jquery"]}
  31. },
  32. waitSeconds: 30,
  33. });
  34. document.title = window.location.hostname +
  35. (window.location.port ? ":" + window.location.port : "") +
  36. (window.location.pathname !== "/" ? window.location.pathname : "") +
  37. " - Rspamd Web Interface";
  38. // Ugly hack to get d3pie work with requirejs
  39. define("d3.global", ["d3"], function (d3global) { // eslint-disable-line strict
  40. d3 = d3global;
  41. });
  42. // Notify user on module loading failure
  43. requirejs.onError = function (e) {
  44. "use strict";
  45. document.getElementById("loading").classList.add("d-none");
  46. document.getElementsByClassName("notification-area")[0].innerHTML =
  47. "<div class=\"alert alert-error\">" +
  48. "<strong>Module loading error: " + e.requireType + ", module: " + e.requireModules + "</strong>" +
  49. "<button type=\"button\" class=\"btn btn-info btn-xs float-right\" " +
  50. "onClick=\"window.location.reload(); this.parentNode.parentNode.removeChild(this.parentNode);\" " +
  51. "title=\"Reload current page\">" +
  52. "<i class=\"glyphicon glyphicon-repeat\"></i> Reload" +
  53. "</button>" +
  54. "</div>";
  55. throw e;
  56. };
  57. // Load main UI
  58. require(["app/rspamd", "fontawesome"],
  59. function (rspamd) {
  60. "use strict";
  61. rspamd.setup();
  62. rspamd.connect();
  63. }
  64. );