Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==UserScript==
// @name Cross-site investigator
// @namespace https://github.com/Glorfindel83/
// @match https://stackexchange.com/sites
// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// @connect *.stackexchange.com
// @connect *.stackoverflow.com
// @connect *.superuser.com
// @connect *.serverfault.com
// @connect *.askubuntu.com
// @connect *.mathoverflow.net
// @connect stackapps.com
// @grant GM_xmlhttpRequest
// @grant GM.xmlHttpRequest
// ==/UserScript==
/* global $ */
(function() {
'use strict';
var sites = [];
$("div.lv-item > a").each(function() {
sites.push($(this).attr("href"));
});
var message = "";
function process() {
let URL = sites.pop();
if (typeof URL == 'undefined') {
console.log(message);
return;
}
console.log(URL);
GM.xmlHttpRequest({
method: 'GET',
url: URL + '/badges',
onload: function (data) {
let hasBanner = data.responseText.includes("id=\"announcement-banner\"");
let hasBadge = data.responseText.includes("Census");
message += URL + "," + hasBanner + "," + hasBadge + "\n";
process();
}
});
};
process();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.