4

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>');
        });
    });

}());
7
  • How did you create such a nice animated gif? I tried to used ffmpeg, but the output was horrible... Feb 20, 2014 at 23:53
  • @PaulSweatte LICEcap with a framerate of 30. For a small demonstration, the filesize is usually small ~200-300kb.
    – Dave Chen
    Feb 21, 2014 at 5:04
  • LICEcap, never heard of it until now. It generates animated gifs by default, so no conversion needed. Thanks! Feb 24, 2014 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, 2017 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, 2019 at 15:15
  • I'm flagging to close this question because this script has become obsolete due to SE changes and cannot be fixed to work again. This script relied on the fact that the only checks for a pending suggestion were client-side, so it was possible to defeat this easily. Today, however, there's now a server-side check, so navigating the page to the edit URL manually as this script does won't work anymore.
    – gparyani
    Aug 3, 2021 at 23:36
  • It could probably be fixed by making a trivial edit (appending a space somewhere)? Not that I want to encourage that practice, but still ...
    – Glorfindel
    Aug 4, 2021 at 20:20

1 Answer 1

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.

8
  • Regex @includes will have inferior performance. See stackapps.com/questions/4188/… ... Also, restricting the path to /questions may skip some review pages. Mar 31, 2017 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, 2017 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, 2017 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, 2017 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, 2017 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". ;) Mar 31, 2017 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. Apr 1, 2017 at 0:04
  • Let us continue this discussion in chat.
    – Makyen
    Apr 1, 2017 at 0:05

You must log in to answer this question.

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