Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var allMyPosts = document.getElementsByClassName("highlightPost");
- var allReplies = 0;
- var sawReplies = 0;
- var responded = false;
- for (let i = 0; i < allMyPosts.length; i++) {
- if (allMyPosts[i].getElementsByClassName("backlink")[0].innerText.length > 0) {
- sawReplies += 1;
- }
- }
- function containsNumber(str) {
- return /\d/.test(str);
- }
- const changeFavicon = link => {
- let $favicon = document.querySelector('link[rel="icon"]');
- if ($favicon !== null) {
- $favicon.href = link;
- } else {
- $favicon = document.createElement("link");
- $favicon.rel = "icon";
- $favicon.href = link;
- document.head.appendChild($favicon);
- }
- }
- window.setInterval(function () {
- let newPosts = 0;
- if (containsNumber(document.title[1])) {
- let num = document.title[1];
- if (containsNumber(document.title[2])) num += document.title[2];
- if (containsNumber(document.title[3])) num += document.title[3];
- num = parseInt(num);
- if (num > newPosts) newPosts = num;
- allMyPosts = document.getElementsByClassName("highlightPost");
- for (let i = 0; i < allMyPosts.length; i++) {
- if (allMyPosts[i].getElementsByClassName("backlink")[0].innerText.length > 0) allReplies += 1;
- }
- if (allReplies > sawReplies) {
- responded = true;
- }
- }
- else {
- sawReplies = allReplies;
- responded = false;
- }
- if (responded) changeFavicon("https://i.ibb.co/8DbD9S2/cbimage.gif");
- else changeFavicon("https://karachan.org/favicon.ico");
- }, 5000);
Advertisement
Add Comment
Please, Sign In to add comment