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

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