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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. d3: "d3.min",
  10. d3evolution: "d3evolution.min",
  11. d3pie: "d3pie.min",
  12. fontawesome: "fontawesome.min",
  13. fontawesome_solid: "solid.min",
  14. footable: "footable.min",
  15. nprogress: "nprogress.min",
  16. stickytabs: "jquery.stickytabs.min"
  17. },
  18. shim: {
  19. bootstrap: {exports:"bootstrap", deps:["jquery"]},
  20. d3pie: {exports:"d3pie", deps:["d3.global", "jquery"]},
  21. d3evolution: {exports:"D3Evolution", deps:["d3", "jquery"]},
  22. fontawesome: {exports: "FontAwesome", deps:["fontawesome_solid"]},
  23. footable: {deps:["bootstrap", "jquery"]},
  24. stickytabs: {deps:["jquery"]}
  25. },
  26. waitSeconds: 30,
  27. });
  28. document.title = window.location.hostname +
  29. (window.location.port ? ":" + window.location.port : "") +
  30. (window.location.pathname !== "/" ? window.location.pathname : "") +
  31. " - Rspamd Web Interface";
  32. // Ugly hack to get d3pie work with requirejs
  33. define("d3.global", ["d3"], function (d3global) { // eslint-disable-line strict
  34. d3 = d3global;
  35. });
  36. // Notify user on module loading failure
  37. requirejs.onError = function (e) {
  38. "use strict";
  39. document.getElementsByClassName("notification-area")[0].innerHTML =
  40. "<div class=\"alert alert-error\">" +
  41. "<strong>Module loading error: " + e.requireType + ", module: " + e.requireModules + "</strong>" +
  42. "<button type=\"button\" class=\"btn btn-info btn-xs float-right\" " +
  43. "onClick=\"window.location.reload(); this.parentNode.parentNode.removeChild(this.parentNode);\" " +
  44. "title=\"Reload current page\">" +
  45. "<i class=\"glyphicon glyphicon-repeat\"></i> Reload" +
  46. "</button>" +
  47. "</div>";
  48. throw e;
  49. };
  50. // Load main UI
  51. require(["app/rspamd", "fontawesome"],
  52. function (rspamd) {
  53. "use strict";
  54. rspamd.setup();
  55. rspamd.connect();
  56. }
  57. );