mirror of
https://github.com/SickGear/SickGear.git
synced 2024-11-25 14:25:05 +00:00
45 lines
30 KiB
JavaScript
45 lines
30 KiB
JavaScript
|
var message_url = sbRoot + '/ui/get-messages',
|
||
|
test = !1;
|
||
|
|
||
|
PNotify.prototype.options.addclass = 'stack-bottomright';
|
||
|
PNotify.prototype.options.buttons.closer_hover = !1;
|
||
|
PNotify.prototype.options.delay = 5000;
|
||
|
PNotify.prototype.options.desktop = {desktop: !0, icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAIAAACyr5FlAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH3gsJFzgZhKUIqgAAVGhJREFUeNrdvXecXMdxJ17V3S9MntkcASxyBgGCESQYwCRSTDKDkpVlSfbJCncnSzpJtnWWHO5Olu2zLPtOWbaksxUoibREiRTFTDCAJIicwwZsnvhSd9fvjze7WACL3Znd2QX9q8/gQxC7816H6qrqCt/CA7uehbkhRMzU11mWNUfPn4I81x0ZHiGieXgXImbqMpZtX4Bpet7I0PDcTZPN3dCJqJDLa6Xm7hXnIyGM/x+/LiStVCGXn9MDMIfMAQBBEJRKpfk5wWfMijPO+fy8i3PO+Nwu47lERKVSKQiCOX2LmNN9I6JisWRalmmaczqNSSZmGIGU8/OieZ4aAARBUCyW9ByfujlneaVULpvTWs/1i84iYQhEnOu3IKIwxDxPTWudy+bU3Ovr+ZCHQRAUi8X5VC6IaMzXgTYMYx64cJyIqFgszrVCCWk+mIOISsU5V5Bn0fzs2XxyYUhBEJSK82TGCZiX86ykymfzmfoMY/NkuzHGOONaza0644zP24wAQGudz+aVnKcL4PxNzPf9eWP5kOba7JhngyMUwL7vz9sb5485iKhYKMp5VC7zIPDnU6fIICgW5tV0m1dLWymVy+Uzdel5EMWIYNTiWCNi+Gf8XwgIqLxHhiEQAeZeN2utc7n8PNxQ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m2hlu2CF/EJHruK83hRISi0Qir7f11frcmwtyETHtNCIrOMW/+ck/PPDMQ+KCXlmrojAE/O1ffe/rv/xuySshY2Ykw7kBYzcUrV9fnIGIkUiEf/6PPykMIQP5uuLcMKXTsqww5ZMblhmpY4wX3dJXH/rG13/xHSKawd1kLGMUNIWXI1AaiEATaoIzP6R0+MtYXpcZu8bGlltpvePQq03pxuXtywxhIDdU4OZyOc/zLvR6nzFOIUQqnUok4gIZRiK2aRqFfMFxnNcJC4fuIMuyIhGbCzPkjJLnfueRH/zjg99UVJ0/gwBIgyZiiKaBUQujEbQNTMUgHWOmgUJAOY0cAAACRUEAjk+DWZ0rUcGhokt+QESEiIzNkEs4Y67vfulHf9+cabp23RaDW8JKe96p18+xZAwjkUg8EQ8diVgYOTq+H67j5vMFKV8vUsQwjMaW1ki8gXPT9f0HnnnwT//5r4pukbNKQ/wEoBUxho1ptriVr+g0Ohp5JoHxCAqOtgmmgUAQZqRP/BoBEIHjkRdQvkSDWX20Tx3pk8dP6f5RFUhirPqYXhi/lWphc+eXP/jnFy1exxhmh/sH+49fEBSTiRQKjEQibkdO+5lOMweEAUmlXjciBE3LbutcZljRQAaPvvLEp7/5+cHskOAVxecIQGkyGC7rEFesMdcvFs113BQAgJoICMppxnTerwNAuEqIwBAJKAhgOK/3Hpcv7PN3HZW5omaserOHwFfBxUs3/PUHv7ioeQEQjQ71DQ906xkF92tCZwmM0xuQn8Ac5cETea6Xz+UvrAgxTLuprSsaSwVKPr17+6e+/qcnh3oE55WofiLQBF0t/JZL7M0rjXQCSUNNymYZAmPoBnTwpPzl8+4L+wJfQrXYLUQkldy28Zo/f/fnWjLNRHpksGdksHf++aMsMJIJy7bOZXP+6U9+dNIv2BGbiNSF4Q80TKupbXE0lpRKbd/34qe/8fkTAycrjMIrDZYJ
|
||
|
PNotify.prototype.options.hide = !0;
|
||
|
PNotify.prototype.options.history = !1;
|
||
|
PNotify.prototype.options.shadow = !1;
|
||
|
PNotify.prototype.options.stack = {dir1: 'up', dir2: 'left', firstpos1: 25, firstpos2: 25};
|
||
|
PNotify.prototype.options.styling = 'jqueryui';
|
||
|
PNotify.prototype.options.width = '340px';
|
||
|
PNotify.desktop.permission();
|
||
|
|
||
|
function displayPNotify(type, title, message) {
|
||
|
var notification = new PNotify({
|
||
|
type: type, title: title,
|
||
|
text: message.replace(/<br[\s\/]*(?:\s[^>]*)?>/ig, "\n")
|
||
|
.replace(/<[\/]?b(?:\s[^>]*)?>/ig, '*')
|
||
|
.replace(/<i(?:\s[^>]*)?>/ig, '[').replace(/<[\/]i>/ig, ']')
|
||
|
.replace(/<(?:[\/]?ul|\/li)(?:\s[^>]*)?>/ig, '').replace(/<li(?:\s[^>]*)?>/ig, "\n" + '* ')
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function check_notifications() {
|
||
|
if ('visible' == document.visibilityState) {
|
||
|
$.getJSON(message_url, function (data) {
|
||
|
$.each(data, function (name, data) {
|
||
|
displayPNotify(data.type, data.title, data.message)
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
setTimeout(check_notifications, 3000)
|
||
|
}
|
||
|
|
||
|
$(document).ready(function(){
|
||
|
check_notifications();
|
||
|
if (test) {
|
||
|
displayPNotify('notice', 'test', 'test<br/><i class="test-class">hello <b>world</b></i><ul><li>item 1</li><li>item 2</li></ul>');
|
||
|
//setInterval(function () {displayPNotify('success', 'test2', 'test<br/><b>body2</b>')}, 2000);
|
||
|
//setInterval(function () {displayPNotify('error', 'test3', 'hola<br/><b>body2</b>')}, 2100);
|
||
|
}
|
||
|
});
|