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

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