Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Glorfindel83/5641848ce10fd2687dd98554160b4055 to your computer and use it in GitHub Desktop.
Save Glorfindel83/5641848ce10fd2687dd98554160b4055 to your computer and use it in GitHub Desktop.
// ==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