Fetch fkey
from localStorage
This commit is contained in:
parent
1e39b80f35
commit
aa99dc9356
1 changed files with 17 additions and 24 deletions
|
@ -3,7 +3,7 @@
|
||||||
// @namespace https://github.com/Glorfindel83/
|
// @namespace https://github.com/Glorfindel83/
|
||||||
// @description Adds a 'Destroy spammer' link for moderator on user profiles with only deleted posts.
|
// @description Adds a 'Destroy spammer' link for moderator on user profiles with only deleted posts.
|
||||||
// @author Glorfindel
|
// @author Glorfindel
|
||||||
// @version 0.1
|
// @version 0.2
|
||||||
// @match *://*.stackexchange.com/users/*
|
// @match *://*.stackexchange.com/users/*
|
||||||
// @match *://*.stackoverflow.com/users/*
|
// @match *://*.stackoverflow.com/users/*
|
||||||
// @match *://*.superuser.com/users/*
|
// @match *://*.superuser.com/users/*
|
||||||
|
@ -40,21 +40,16 @@
|
||||||
|
|
||||||
// Create Destroy link
|
// Create Destroy link
|
||||||
var destroyLink = document.createElement('a');
|
var destroyLink = document.createElement('a');
|
||||||
|
var attribute = document.createAttribute("href");
|
||||||
|
attribute.value = "#";
|
||||||
|
destroyLink.setAttributeNode(attribute);
|
||||||
destroyLink.appendChild(document.createTextNode('Destroy spammer'));
|
destroyLink.appendChild(document.createTextNode('Destroy spammer'));
|
||||||
destroyLink.onclick = function () {
|
destroyLink.onclick = function () {
|
||||||
// 'Open' moderator menu
|
|
||||||
$.get({
|
|
||||||
url: 'https://apple.stackexchange.com/admin/users/' + userID + '/moderator-menu?_=',
|
|
||||||
cache: false,
|
|
||||||
success: function (html) {
|
|
||||||
// Find key
|
|
||||||
var fkey = ($($.parseHTML(html)).find('input[name=fkey]').attr('value'));
|
|
||||||
|
|
||||||
// Ask for confirmation
|
// Ask for confirmation
|
||||||
if (window.confirm('Are you sure?')) {
|
if (window.confirm('Are you sure?')) {
|
||||||
$.post({
|
$.post({
|
||||||
url: 'https://apple.stackexchange.com/admin/users/' + userID + '/destroy',
|
url: 'https://apple.stackexchange.com/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=' + fkey,
|
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],
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
// Reload page
|
// Reload page
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
@ -64,8 +59,6 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add to document
|
// Add to document
|
||||||
|
|
Loading…
Reference in a new issue