Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Fuwanovel title notifications
- // @namespace Luch (+ Flutterz)
- // @description Show notification number in title
- // @include http://forums.fuwanovel.*
- // @exclude http://forums.fuwanovel.net/chat/
- // @match *://forums.fuwanovel.net/*
- // @version 0.4
- // @grant GM_xmlhttpRequest
- // ==/UserScript==
- var title = "Fuwanovel";
- function setTitle(number) {
- if(number > 0) {
- document.title = "(" + number + ") " + title;
- }
- else {
- document.title = title;
- }
- }
- function getNotificationNumber() {
- var number = 0;
- GM_xmlhttpRequest({
- method: "POST",
- url: "http://forums.fuwanovel.net",
- headers: {"Content-Type": "application/x-www-form-urlencoded"},
- onload: function(t) {
- var d = document.createElement('div');
- d.innerHTML = t.responseText;
- var i = d.getElementsByClassName('ipsNotificationCount');
- console.log(i);
- if (i.item(0)!=null){
- var k = i.item(0);
- number += parseInt(k.innerHTML);
- }
- setTitle(number);
- }
- });
- }
- function init() {
- title = document.title;
- getNotificationNumber();
- var timer = setInterval(function() { getNotificationNumber(); }, 60000);
- }
- init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement