Jump to content

User:Swedmann/Consermon.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
(function() {
    /* with http://consermon.appspot.com/ */
 
    var display = function(enabled) {
	var id = 'pt-consermon';
	var s = document.getElementById(id);
 
	if (!s) {
	    s = addPortletLink('p-personal', 'http://www.conservapedia.com',
                               'internal error', id, 'Go to Conservapedia');
	}
 
	if (!s) {
	    document.onload = function() { display(enabled) };
	    return;
	}
 
	if (enabled) {
	    s.firstChild.innerHTML = 'account creation enabled';
	    s.firstChild.style.color = '#00ff00';
	} else {
	    s.firstChild.innerHTML = 'account creation disabled';
	    s.firstChild.style.color = '#ff0000';
	}
    }
 
    consermonCallback = function(cur) {
	display(cur);
    }
 
    var check = function() {
	var script = document.createElement('script');
	script.src = 'http://consermon.appspot.com/get';
	document.head.appendChild(script);
    }
 
    check();
    setInterval(check, 2 * 60 * 60 * 1000);
})();