Check Reddit Modqueue

Checks your modqueue.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name		Check Reddit Modqueue
// @version 		1.04
// @namespace		http://ictinus.com/crmq/
// @description		Checks your modqueue.
// @match		http://*.reddit.com/*
// @match		https://*.reddit.com/*
// ==/UserScript==

// Author: Ictinus
// Released: 14 October 2011
// Update: 21 Oct 2011, v1.02, fixed execution in Firefox. Thanks to TedFromTheFuture.
// Update: 11 Jan 2011, v1.03, fixed icon display after reddit style changes.

// Author: Nanashi
// Fix:    08 Sep 2021, v1.04, updated for new_modmail, new spritesheet.

var redditModqChecker = {
	version : 1.03,
	init: function() {
		var aMail = document.getElementById("new_modmail");
	        var spanCheckmq = document.createElement('span');
        	spanCheckmq.id = "modqChecker";
        	spanCheckmq.innerHTML = "";
        	spanCheckmq.style.cursor = "pointer";
		spanCheckmq.href = "#";
 		aMail.parentNode.insertBefore(spanCheckmq, aMail.nextSibling);
		redditModqChecker.update();
	},
	addGlobalStyle : function(css) {
		var head, style;
		head = document.getElementsByTagName('head')[0];
		if (!head) { return; }
		style = document.createElement('style');
		style.type = 'text/css';
		style.innerHTML = css;
		head.appendChild(style);
	},
	update: function() {
		xhr = new XMLHttpRequest();
		xhr.open("GET","/r/mod/about/modqueue.json", true);
		xhr.onreadystatechange = function () { 
        		redditModqChecker.display();
        	};
        	xhr.send();
	},
	display: function() {
		var modqChecker = document.getElementById("modqChecker");
		if(xhr.readyState == 4) {
        	if(xhr.status == 200) {
        		var response=xhr.responseText;
        		var unreadJSON = JSON.parse(response);
        		if (unreadJSON.data.children.length == 0) {
       	            modqChecker.innerHTML = "";
        		} else {
					modqChecker.innerHTML = "<span class='separator'>|</span><a class='rmc-spam' href='/r/mod/about/modqueue'>&nbsp;</a><span>" + unreadJSON.data.children.length + "</span>";
				}
			} else {
               	modqChecker.innerHTML = "<span class='separator'>|</span><a class='rmc-spam' href='/r/mod/about/modqueue'>¿</a>";
			}
		}
    }
}

if (document.body) {
	redditModqChecker.addGlobalStyle('a.rmc-spam {background-image:url(https://www.redditstatic.com/sprite-reddit.png); background-position:-22px -1633px; width: 18px;  height: 14px; overflow:hidden; top:-2px; margin-bottom: -6px; margin-right:2px; display: inline-block; position:relative; } span#modqChecker {font-weight:bold; color: #369;}');
	redditModqChecker.init();
}