-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnotify.js
37 lines (29 loc) · 927 Bytes
/
notify.js
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
/*
* Plugin: Provides notifications for other plugins
*
* Usage:
* Plugins.notify.send('some notification');
*
* License: MIT
* Copyright (c) 2023 Stanislav Lechev [0xAF], LZ2SLL
*
*/
// Notify plugin version
Plugins.notify._version = 0.1;
// Initialize the plugin
Plugins.notify.init = function () {
Plugins.notify.show = function (text) {
// create the message div if it's not there
if ($("#plugins-notification").length < 1)
$("body").append("<div id='plugins-notification'></div>");
// set the message text
$("#plugins-notification").html(text);
// show the message
$("#plugins-notification").fadeIn('fast');
// clear the timeout of previous message (if exists)
clearTimeout(Plugins.notify.notify_timeout);
// timeout the current message
Plugins.notify.notify_timeout = setTimeout('$("#plugins-notification").fadeOut("fast")', 1000);
};
return true;
}