//Wikilinter var currError = currError || 0; var tmpWikitext = tmpWikitext || ""; var lintData = lintData || []; var textArea = document.getElementById('wpTextbox1'); var selectRange = function(start, end) { // https://stackoverflow.com/a/40017290 var e = document.getElementById( 'wpTextbox1'); if (!e) return; else if (e.setSelectionRange) { e.focus(); e.setSelectionRange(start, end); } /* WebKit */ else if (e.createTextRange) { var range = e.createTextRange(); range.collapse(true); range.moveEnd('character', end); range.moveStart('character', start); range.select(); } /* IE */ else if (e.selectionStart) { e.selectionStart = start; e.selectionEnd = end; } }; function getError(data, currError ){ if (data && data.length){ alert("found "+ currError + " /" + data.length + " errors. Scroll down to find highlighted text."); } else { alert("No errors found."); } lintData = data; if (lintData[currError]) { var startRange = lintData[currError].dsr[0]; var endRange = lintData[currError].dsr[1]; textArea.focus(); selectRange(startRange, endRange); } } if (tmpWikitext === $("#wpTextbox1").val() && lintData.length - 1 > 0 ) { if ( currError >= lintData.length) { currError = 0; } else { currError = currError + 1; } getError(lintData, currError ); console.log("yup"); } else { tmpWikitext = $("#wpTextbox1").val(); $.post(window.location.origin +"/api/rest_v1/transform/wikitext/to/lint", { wikitext: $("#wpTextbox1").val() }).then(function (data) { var textArea = document.getElementById('wpTextbox1'); getError(data, currError); }); }
Instructions:
- Go to wikipage with errors
- Click edit / view source
- Open browser console
- Paste the snippet above
- Wait a few seconds and click OK when the alert box shows up
- Scroll down to find highlighted wikitext
- Rinse and repeat steps 3 to 6 to find more errors
Unlike the linter, this will cycle through all errors on the page.
Note: This script doesn't filter internal lint errors. So it may highlight errors not show in the linter itself. Feel free to ignore those. It is certainly possible to make it more user friendly like Topic:Tvyz5k6ki39kba6t