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.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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.5.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: "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.getElementsByClassName("notification-area")[0].innerHTML =
  46. "<div class=\"alert alert-error\">" +
  47. "<strong>Module loading error: " + e.requireType + ", module: " + e.requireModules + "</strong>" +
  48. "<button type=\"button\" class=\"btn btn-info btn-xs float-right\" " +
  49. "onClick=\"window.location.reload(); this.parentNode.parentNode.removeChild(this.parentNode);\" " +
  50. "title=\"Reload current page\">" +
  51. "<i class=\"glyphicon glyphicon-repeat\"></i> Reload" +
  52. "</button>" +
  53. "</div>";
  54. throw e;
  55. };
  56. // Load main UI
  57. require(["app/rspamd", "fontawesome"],
  58. function (rspamd) {
  59. "use strict";
  60. rspamd.setup();
  61. rspamd.connect();
  62. }
  63. );