3

Review edits have the option to force edit, which will edit the original post, as opposed to improve which will edit the suggested edit.

UserScript:

// ==UserScript==
// @name          Force edit suggested reviews Stackoverflow
// @namespace     stackoverflow
// @description   Allows you to bypass reviewing suggested edits and just edit
// @include       http://stackoverflow.com/*
// ==/UserScript==

(function () {
    function with_jquery(f) {
        var script = document.createElement("script");
        script.type = "text/javascript";
        script.textContent = "(" + f.toString() + ")(jQuery)";
        document.body.appendChild(script);
    }

    with_jquery(function ($) {
        $("a[id^=edit-pending-]").each(function () {
            var id = $(this).attr('id').substr(13),
                href = $(this).attr('href');
            $(this).replaceWith('<a id="edit-pending-' + id + '" href="' + href + '" title="1 edit to this post is pending, please review it">review edit (1)</a><span class="lsep">|</span><a href="/posts/' + id + '/edit" class="edit-post" title="force edit this post">force edit</a>');
        });
    });

}());
  • How did you create such a nice animated gif? I tried to used ffmpeg, but the output was horrible... – Paul Sweatte Feb 20 '14 at 23:53
  • @PaulSweatte LICEcap with a framerate of 30. For a small demonstration, the filesize is usually small ~200-300kb. – David Chen Feb 21 '14 at 5:04
  • LICEcap, never heard of it until now. It generates animated gifs by default, so no conversion needed. Thanks! – Paul Sweatte Feb 24 '14 at 18:04
  • This would be a lot easier for people not familiar with user scripts to use if you provided a direct link to the raw file (e.g. on GitHub). That would save people from needing to copy-and-paste the code into a new script. – Makyen Mar 31 '17 at 22:42
  • The @include needs to be *://stackoverflow.com these days to activate on https as well. (Too short an edit for me to suggest though :) – robsiemb Nov 26 at 15:15
2

As written, the script functions only on Stack Overflow. You can make it work on all Stack Exchange sites by changing the Metadata Block (the part at the beginning of the script) to the following:

// ==UserScript==
// @name          Force edit suggested reviews
// @namespace     stackoverflow
// @description   Allows you to bypass reviewing suggested edits and just edit
// @match       *://*.askubuntu.com/*
// @match       *://*.mathoverflow.net/*
// @match       *://*.serverfault.com/*
// @match       *://*.stackapps.com/*
// @match       *://*.stackexchange.com/*
// @match       *://*.stackoverflow.com/*
// @match       *://*.superuser.com/*
// @exclude     *://api.stackexchange.com/*
// @exclude     *://blog.stackexchange.com/*
// @exclude     *://blog.stackoverflow.com/*
// @exclude     *://chat.stackexchange.com/*
// @exclude     *://chat.stackoverflow.com/*
// @exclude     *://data.stackexchange.com/*
// @exclude     *://elections.stackexchange.com/*
// @exclude     *://stackexchange.com/*
// ==/UserScript==

The source for the // @match and // @exclude statements is Brock Adams' answer here.

  • Regex @includes will have inferior performance. See stackapps.com/questions/4188/… ... Also, restricting the path to /questions may skip some review pages. – Brock Adams Mar 31 '17 at 22:52
  • @BrockAdams, I've changed this because I clearly messed up original regexes. While functional, they were just...bad (I'm not sure what I was thinking when I wrote them). At least for the moment, I've changed it to use the @match and @exclude lines from your linked answer, and am considering just deleting this answer. – Makyen Mar 31 '17 at 23:38
  • @BrockAdams, wrt. including questions in the match: I am unaware of any pending edit links from review pages. Are there? I don't recall ever seeing such links. I only recall ever seeing pending edit links on actual questions pages. Matching only question pages was intentional. I've removed that criteria under the assumption I'm wrong and pending edit links exist somewhere else. – Makyen Mar 31 '17 at 23:38
  • @BrockAdams, I'm aware that using regex @include will have some unknown inferior performance vs. a similar number of @matches. I've never seen anything that actually quantifies the difference. It's unclear to me if there is actually a significant performance improvement to use 7 @matches and 8 @excludes vs a single @include regex [note: multiple @include statements were being used here instead of 1 because Tampermonkey does not parse a single regex sufficiently to show multiple site logos in it's dashboard]. (continued) – Makyen Mar 31 '17 at 23:39
  • @BrockAdams, I suspect that any performance difference may depend significantly on if the RegExp is compiled once per script change or if they are recompiled for each page load (same quandary for the potentially complex @matches/@exclude). Do you know of any reported quantified difference, or have you looked at the Tampermonkey and/or Greasemonkey code to see if the RegExp compile is every page, or every script change? – Makyen Mar 31 '17 at 23:39
  • As for the /question path, I think I remember a scenario that applied, but not enough to say for sure. Note that I did use the weasel word "may". ;) – Brock Adams Mar 31 '17 at 23:56
  • @match performs better. This is covered in various GM discussions which you can search out and also by analysis of the code. Also @match regex is "safed". Finally, @match gives proper indication in the Tampermonkey dashboard of matched sites. @include does not. – Brock Adams Apr 1 '17 at 0:04
  • Let us continue this discussion in chat. – Makyen Apr 1 '17 at 0:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .