From 7d96fbd01b22ac37ddc7e0529553f5a4cedeb326 Mon Sep 17 00:00:00 2001 From: Glorfindel Date: Mon, 4 Dec 2017 20:34:10 +0100 Subject: [PATCH] note to self: don't JavaScript when drunk --- destroy-spammer/destroy-spammer.user.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/destroy-spammer/destroy-spammer.user.js b/destroy-spammer/destroy-spammer.user.js index c0c5ad4..90fa7da 100644 --- a/destroy-spammer/destroy-spammer.user.js +++ b/destroy-spammer/destroy-spammer.user.js @@ -3,7 +3,7 @@ // @namespace https://github.com/Glorfindel83/ // @description Adds a 'Destroy spammer' link for moderator on user profiles with only deleted posts. // @author Glorfindel -// @version 0.4.3 +// @version 0.4.4 // @match *://*.stackexchange.com/users/* // @match *://*.stackoverflow.com/users/* // @match *://*.superuser.com/users/* @@ -41,6 +41,8 @@ destroyLink.onclick = function () { // Ask for confirmation if (window.confirm('Are you sure?')) { + // TODO: remember the last time this script was activated, + // and build in a 5 second delay to prevent the rate limit from triggering. $.post({ url: 'https://' + document.location.host + '/admin/users/' + userID + '/destroy', data: 'annotation=&deleteReasonDetails=&mod-actions=destroy&destroyReason=This+user+was+created+to+post+spam+or+nonsense+and+has+no+other+positive+participation&destroyReasonDetails=&fkey=' + window.localStorage["se:fkey"].split(",")[0], @@ -62,7 +64,7 @@ // Check for keywords in spammers' profiles $.get(document.location.href.split('?')[0] + "?tab=profile", function (data) { - if (data.search(/1\D844\D909\D0831/g)) { + if (data.search(/1\D844\D909\D0831/g) != -1) { createDestroyLink(userID); } });