Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Desktop notifications
- // SSYT power codes !
- (function(_, $) {
- document.addEventListener('DOMContentLoaded', function () {
- if (Notification.permission !== "granted")
- Notification.requestPermission();
- });
- function notif(list) {
- if (!Notification) {
- alert('Desktop notifications not available in your browser. Try Chromium.');
- return;
- }
- if (Notification.permission !== "granted")
- Notification.requestPermission();
- else {
- switch(list)
- {
- case 'pm': {
- var sad = $('div#submenu ul li a.mainmenu[href*="/privmsg?folder=inbox"]');
- if(sad.text().match(/\d+/g) == '1' && /\d*/.test(sad.text())) {
- console.log(sad.text());
- new Notification('FM Notification', {
- icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png',
- body: "Ai "+ sad.text().match(/\d+/g) +" mesaje private noi !",
- });
- }
- break;
- }
- case 'report': {
- var sad = $('div#submenu ul li a.mainmenu[href*="/privmsg?folder=inbox"]');
- if(sad.text().match(/\d+/g) == '1' && /\d*/.test(sad.text())) {
- console.log(sad.text());
- new Notification('FM Notification', {
- icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png',
- body: "Ai "+ sad.text().match(/\d+/g) +" mesaje private noi !",
- });
- }
- break;
- }
- }
- }
- };
- $(function(){notif('pm');notif('report');});
- }({}, jQuery));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement