- Show Flag Responses: initial version

- @match update for some scripts
This commit is contained in:
Glorfindel 2019-01-06 19:59:07 +01:00
parent cc558f65fd
commit c601cab4b7
3 changed files with 75 additions and 11 deletions

View file

@ -8,11 +8,12 @@
// @version 0.2
// @match *://*.stackexchange.com/admin/dashboard*
// @match *://*.stackoverflow.com/admin/dashboard*
// @match *://*.superuser.com/admin/dashboard*
// @match *://*.serverfault.com/admin/dashboard*
// @match *://*.askubuntu.com/admin/dashboard*
// @match *://*.stackapps.com/admin/dashboard*
// @match *://*.mathoverflow.net/admin/dashboard*
// @match *://stackoverflow.com/admin/dashboard*
// @match *://superuser.com/admin/dashboard*
// @match *://serverfault.com/admin/dashboard*
// @match *://askubuntu.com/admin/dashboard*
// @match *://stackapps.com/admin/dashboard*
// @match *://mathoverflow.net/admin/dashboard*
// @grant none
// ==/UserScript==

View file

@ -3,14 +3,15 @@
// @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.4
// @version 0.4.5
// @match *://*.stackexchange.com/users/*
// @match *://*.stackoverflow.com/users/*
// @match *://*.superuser.com/users/*
// @match *://*.serverfault.com/users/*
// @match *://*.askubuntu.com/users/*
// @match *://*.stackapps.com/users/*
// @match *://*.mathoverflow.net/users/*
// @match *://stackoverflow.com/users/*
// @match *://superuser.com/users/*
// @match *://serverfault.com/users/*
// @match *://askubuntu.com/users/*
// @match *://stackapps.com/users/*
// @match *://mathoverflow.net/users/*
// @grant none
// ==/UserScript==
(function () {

View file

@ -0,0 +1,62 @@
// ==UserScript==
// @name Moderator History - Show Flag Responses
// @namespace https://github.com/Glorfindel83/
// @description Loads flag responses (decline reasons and custom messages) into the Moderator History page.
// @author Glorfindel
// @updateURL https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/show-flag-responses/show-flag-responses.user.js
// @downloadURL https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/show-flag-responses/show-flag-responses.user.js
// @version 0.1
// @match *://*.stackexchange.com/admin/history/*
// @match *://*.stackoverflow.com/admin/history/*
// @match *://stackoverflow.com/admin/history/*
// @match *://superuser.com/admin/history/*
// @match *://serverfault.com/admin/history/*
// @match *://askubuntu.com/admin/history/*
// @match *://stackapps.com/admin/history/*
// @match *://mathoverflow.net/admin/history/*
// @grant none
// ==/UserScript==
(function () {
"use strict";
$("ul#mod-user-history > li").each(function() {
let post = $(this);
// Find time of handling (important to separate multiple flags on a single post)
let time = post.find("span.relativetime").attr("title");
// Find post ID
let link = post.find("a");
if (link.length == 0)
// e.g. tag merges
return;
let href = link.attr("href");
let matches = (link.hasClass("question-hyperlink")
? /\/questions\/(\d+)\//g : /#(\d+)/g).exec(href);
let postID = parseInt(matches[1]);
// Load Post Flag History page
$.get("https://apple.stackexchange.com/admin/posts/" + postID + "/show-flags", function(data) {
// Search for rows corresponding to the time of handling
let deletionDate = $(data).find("span[title='" + time + "']");
if (deletionDate.length == 0)
return;
// Find last cell in the row, it contains the feedback (if any)
let cells = deletionDate[0].parentElement.parentElement.children;
let lastCell = cells[cells.length - 1];
let feedback = lastCell.getAttribute("title");
if (feedback == null || feedback.length == 0)
return;
// Add feedback to each "Flag processed" entry
post.find("li").each(function() {
if (!this.innerText.startsWith("Flag processed"))
return;
let index = this.innerText.indexOf(") -");
this.innerText = this.innerText.substring(0, index) + ", " + feedback + this.innerText.substring(index);
})
});
});
})();