PageSourceSearch

https://www.ehess.fr/js/jalios/core/jalios-toastr.js

js ehess.fr collected 2026-09-24 08:38:59 UTC 1,952 bytes, 74 lines download raw bytes

1!(function ($) {
2  /* global toastr */
3
4  if (!$.jalios) {
5    $.jalios = {};
6  }
7  if (!$.jalios.toastr) {
8    $.jalios.toastr = {};
9  }
10
11  /**
12   * Enum for position toast options.
13   * @readonly
14   * @enum {string}
15   */
16  const Position = {
17    TOP_RIGHT: "toast-top-right",
18    BOTTOM_RIGHT: "toast-bottom-right",
19    BOTTOM_LEFT: "toast-bottom-left",
20    TOP_LEFT: "toast-top-left",
21    TOP_FULL_WIDTH: "toast-top-full-width",
22    BOTTOM_FULL_WIDTH: "toast-bottom-full-width",
23    TOP_CENTER: "toast-top-center",
24    BOTTOM_CENTER: "toast-bottom-center"
25  };
26
27  /**
28   * Enum for toast level.
29   * @readonly
30   * @enum {string}
31   */
32  const Level = {
33    SUCCESS: "success",
34    INFO: "info",
35    WARNING: "warning",
36    ERROR: "error"
37  };
38
39  const defaultOptions = {
40    positionClass: Position.TOP_CENTER
41  };
42
43  $.jalios.toastr = {
44    Level,
45    Position,
46    /**
47     * Displays a message using Toastr.
48     * @param {string} message - The message to be displayed.
49     * @param {Level} level - The toast level.
50     * @param {object} [options=defaultOptions] - Additional options for the toast.
51     * @throws {Error} Throws an error if the specified level is not valid.
52     */
53    displayMessage(message, level = Level.INFO, options = defaultOptions) {
54      const mergedOptions = $.extend({}, defaultOptions, options);
55      const validTypes = Object.values(Level).join(", ");
56      if (typeof toastr[level] !== "function") {
57        throw new Error(`toastr.${level} is not a function, valid function are: ${validTypes}`);
58      }
59      toastr[level](message, null, mergedOptions);
60    },
61    remove() {
62      toastr.remove();
63    },
64    subscribe(callback) {
65      toastr.subscribe(callback);
66    },
67    clear() {
68      toastr.clear();
69    },
70    getContainer(options, create) {
71      return toastr.getContainer(options, create);
72    }
73  };
74})(window.jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.