File: main.js

package info (click to toggle)
rspamd 2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 25,408 kB
  • sloc: ansic: 225,036; javascript: 29,185; cpp: 16,036; perl: 2,867; asm: 2,512; pascal: 1,607; python: 1,128; sh: 406; sql: 313; makefile: 130; xml: 74
file content (69 lines) | stat: -rw-r--r-- 2,523 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* global d3:true, require:false, requirejs:false */ // eslint-disable-line no-unused-vars

requirejs.config({
    baseUrl: "js/lib",
    paths: {
        app: "../app",
        jquery: "jquery.min",
        visibility: "visibility.min",
        bootstrap: "bootstrap.bundle.min",
        codejar: "codejar.min",
        d3: "d3.min",
        d3evolution: "d3evolution.min",
        d3pie: "d3pie.min",
        fontawesome: "fontawesome.min",
        fontawesome_solid: "solid.min",
        footable: "footable.min",
        linenumbers: "linenumbers.min",
        nprogress: "nprogress.min",
        prism: "prism",
        stickytabs: "jquery.stickytabs.min"
    },
    shim: {
        codejar: {exports: "CodeJar", deps:["linenumbers"]},
        bootstrap: {exports:"bootstrap", deps:["jquery"]},
        d3evolution: {exports:"D3Evolution", deps:["d3", "jquery"]},
        d3pie: {exports:"d3pie", deps:["d3.global", "jquery"]},
        fontawesome: {exports: "FontAwesome", deps:["fontawesome_solid"]},
        footable: {deps:["bootstrap", "jquery"]},
        linenumbers: {exports: "withLineNumbers", deps:["prism"]},
        prism: {exports: "Prism"},
        stickytabs: {deps:["jquery"]}
    },
    waitSeconds: 30,
});

document.title = window.location.hostname +
    (window.location.port ? ":" + window.location.port : "") +
    (window.location.pathname !== "/" ? window.location.pathname : "") +
    " - Rspamd Web Interface";

// Ugly hack to get d3pie work with requirejs
define("d3.global", ["d3"], function (d3global) { // eslint-disable-line strict
    d3 = d3global;
});

// Notify user on module loading failure
requirejs.onError = function (e) {
    "use strict";
    document.getElementById("loading").classList.add("d-none");
    document.getElementsByClassName("notification-area")[0].innerHTML =
        "<div class=\"alert alert-error\">" +
            "<strong>Module loading error: " + e.requireType + ", module: " + e.requireModules + "</strong>" +
            "<button type=\"button\" class=\"btn btn-info btn-xs float-right\" " +
                "onClick=\"window.location.reload(); this.parentNode.parentNode.removeChild(this.parentNode);\" " +
                "title=\"Reload current page\">" +
                "<i class=\"glyphicon glyphicon-repeat\"></i> Reload" +
            "</button>" +
        "</div>";
    throw e;
};

// Load main UI
require(["app/rspamd", "fontawesome"],
    function (rspamd) {
        "use strict";
        rspamd.setup();
        rspamd.connect();
    }
);