User:Writ Keeper/Scripts/previewAndDiff.js: Difference between revisions

Content deleted Content added
wow, they didn't half fuck up the edit screen.
in theory this should still work...
Line 3:
if(mw.config.get("wgAction") === "edit" || mw.config.get("wgAction") === "submit" )
{
if(/previewanddiff=true/.test(window.___location.href))
{
mw.loader.load('mediawiki.action.history.diff');
$("#wikiPreview").after('<h2></h2><h2>Your changes</h2><table class="diff" id="ajaxDiff"><colgroup><col class="diff-marker"><col class="diff-content"><col class="diff-marker"><col class="diff-content"></colgroup></table>');
var requestString="/w/api.php";
var requestData = {action:"query", prop:"revisions", format:"json", rvcontentformat:"text/x-wiki", revids:$("input[name='baseRevId']").attr("value"), rvdifftotext:$("textarea#wpTextbox1").text()};
if($("input[name='wpSection']").attr("value") !== "")
}{
requestData.rvsection = $("input[name='wpSection']").attr("value");
}
$.post(requestString, requestData, function(response, status)
{
$("#ajaxDiff").append(response.query.pages[Object.keys(response.query.pages)[0]].revisions[0].diff["*"]);
});
}
var previewDiffButton = new OO.ui.ButtonWidget();
previewDiffButton.setLabel("Show preview and changes");
Line 10 ⟶ 25:
previewDiffButton.$element.children("a").click(function()
{
if($("#wikiPreview").lengthvar formAction == 0 || $("#wikiPrevieweditform").cssattr("display") == "noneaction");
$("#editform").attr("action", formAction+"&previewanddiff=true");
{
}
});
}