Created
January 25, 2019 10:07
-
-
Save Glorfindel83/5641848ce10fd2687dd98554160b4055 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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