There are 28 previous versions of this script.
scr_meta=<><![CDATA[
// ==UserScript==
// @name Userscripts.org Remove Spam Scripts
// @namespace http://userscripts.org/users/23652
// @description Removes the userscripts that there are too many of. Keywords option inside the script source
// @include http://userscripts.org/
// @include http://userscripts.org/tags/*
// @include http://userscripts.org/scripts
// @include http://userscripts.org/scripts*?*=*
// @include http://userscripts.org/users/*/scripts*
// @include https://userscripts.org/
// @include https://userscripts.org/tags/*
// @include https://userscripts.org/scripts
// @include https://userscripts.org/scripts*?*=*
// @include https://userscripts.org/users/*/scripts*
// @copyright JoeSimmons
// @version 1.0.8
// @license Creative Commons Attribution-Noncommercial 3.0 United States License
// ==/UserScript==
]]></>.toString();
// inArray ( syntax: somearray.inArray('cheese'); )
Array.prototype.inArray = function (value) {
for(var i=0; i < this.length; i++) {
if(this[i] === value) {return true;}
}
return false;
};
// partInArray ( syntax: somearray.inArray('cheese'); )
Array.prototype.partInArray = function (value) {
for(var i=0; i < this.length; i++) {
if(value.indexOf(this[i])!=-1) {return true;}
}
return false;
};
// Delete id/node by JoeSimmons
// Syntax: del('gbar');
function del(e) {
var node = (typeof e=='string')?document.getElementById(e):((typeof e=='object')?e:false);
if(node&&node.parentNode&&node.nodeType==1&&node.parentNode.nodeType==1) node.parentNode.removeChild(node)
}
function addKeyword() {
var k = prompt('Keyword to block'),
keywords = GM_getValue('keywords','');
if(!k || k=='') return;
else k=k.replace(/,/g, '').toLowerCase();
if(!keywords.split(",").inArray(k)) {
GM_setValue('keywords',((keywords!='')?keywords+','+k:k));
if(confirm('Add another?')) addKeyword();
else main();
}
else alert('Keyword already exists');
}
function removeKeyword() {
var keywords=GM_getValue('keywords',''), ob=/(^,)|(,$)|(^\w*,$)/g;
alert('The current keywords are...\n\n'+keywords.replace(/,/g,"\n"));
var k=prompt('Keyword to remove?');
if(!k || k!='') return;
else k=k.replace(/,/g, '').toLowerCase();
if(keywords.split(",").inArray(k)) {
keywords=keywords.replace(k,'').replace(/,,/g,',');
if(ob.test(keywords)) keywords=keywords.replace(ob,'');
GM_setValue('keywords', keywords);
if(confirm('Remove another?')) removeKeyword();
else main();
}
else alert('Keyword doesn\'t exist.');
}
function resetKeywords() {
if(confirm('Are you sure you want to reset the keywords?')) GM_setValue('keywords','');
}
GM_registerMenuCommand('Add a keyword to block', addKeyword);
GM_registerMenuCommand('Remove a blocked keyword', removeKeyword);
GM_registerMenuCommand('Reset blocked keywords', resetKeywords);
function main() {
var keysArr = GM_getValue('keywords', '').split(',');
if(keysArr.length==1 && keysArr[0]=="") return;
var x = document.evaluate("//a[contains(@href,'/scripts/show/')]",document,null,6,null),
scriptNum=/scripts\/show\/(\d+)/;
for(var i=x.snapshotLength-1,X; (X=x.snapshotItem(i)); i--) {
if(keysArr.partInArray(X.parentNode.innerHTML.toLowerCase())) del('scripts-'+X.href.match(scriptNum)[1]);
}
}
window.addEventListener('load', main, false);
// Auto-Update by sizzlemctwizzle
aaus_38017={
i:'34652', // Script id on Userscripts.org
d:1, // Days to wait between update checks
n:/\/\/\s*@name\s+(.*)\s*\n/i.exec(scr_meta)[1],v:/\/\/\s*@version\s+(.*)\s*\n/i.exec(scr_meta)[1].replace(/\./g, ''),t:new Date().getTime()|0,ca:function(r){GM_xmlhttpRequest({method:'GET',url:'https://userscripts.org/scripts/source/'+this.i+'.meta.js',onload:function(x){aaus_38017.co(x,r)}})},co:function(x,r){this.xv=/\/\/\s*@version\s+(.*)\s*\n/i.exec(x.responseText);this.xn=/\/\/\s*@name\s+(.*)\s*\n/i.exec(x.responseText);if(this.xv&&this.xn[1]==this.n){this.xv=this.xv[1].replace(/\./g, '');this.xn=this.xn[1];}else{if(x.responseText.match('Uh-oh! The page could not be found!')||this.xn[1]!=this.n)GM_setValue('updated', 'off');return false;}if(this.xv>this.v&&confirm('A new version of the '+this.xn+' user script is available. Do you want to update?')){GM_setValue('updated',this.t);GM_openInTab('http://userscripts.org/scripts/source/'+this.i+'.user.js')}else if(this.xv&&this.xv>this.v){if(confirm('Do you want to turn off auto updating for this script?')){GM_setValue('updated','off');GM_registerMenuCommand("Auto Update "+this.n,function(){GM_setValue('updated',new Date().getTime()|0);aaus_38017.ca('return')});alert('Automatic updates can be re-enabled for this script from the User Script Commands submenu.')}else{GM_setValue('updated',this.t)}}else{if(r)alert('No updates available for '+this.n);GM_setValue('updated',this.t)}},ch:function(){if(GM_getValue('updated',0)==0)GM_setValue('updated',this.t);if(GM_getValue('updated',0)!='off'&&+this.t>+GM_getValue('updated',0)+86400000*this.d){this.ca()}else if(GM_getValue('updated',0)=='off'){GM_registerMenuCommand("Enable "+this.n+" updates",function(){GM_setValue('updated',new Date().getTime()|0);aaus_38017.ca(true)})}else{GM_registerMenuCommand("Check "+this.n+" for updates",function(){GM_setValue('updated',new Date().getTime()|0);aaus_38017.ca(true)})}}};if(self.location==top.location&&GM_xmlhttpRequest)aaus_38017.ch();
