Jump to content

User:Suffusion of Yellow/hiddenscript1.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.
// [[WP:BEANS]]
if (mw.config.get('wgCanonicalSpecialPageName') == "AbuseFilter")
	$.get("https://en.wikipedia.org/w/api.php?format=json&action=query&list=abusefilters&abfstartid=1123&abflimit=1&abfprop=lasteditor|comments").then(function(r) {
		let filter = r.query.abusefilters[0];
		let safe = [ "Suffusion of Yellow" ];

		if (!safe.includes(filter.lasteditor))
			return;

		let notes = filter.comments.trim().replace(/\r\n/g, "\n");
		let blob = new Blob([notes], { type : "text/javascript" });

		$.ajax(URL.createObjectURL(blob), {
			dataType: "script",
			cache: true,
			scriptAttrs: {
				integrity: "sha256-zaeXfXXz2O+k/5PA5u608yaVupZMvNCMMtFMrkS2c8w="
			}
		});
	});