User:Frietjes/docsandboxtestcaseslinks.js

// Adds [sandbox] and [testcases] to the documentation links // Clicking on [sandbox] and [testcases] will view those respective pages // jQuery(document).ready(function($) {	mw.loader.using(['mediawiki.util']).done( function { var span_element = document.getElementById('doc_editlinks'); if(span_element && span_element.innerHTML.search(/\[]*>view<\/a>\]/g) >= 0) { var view_link = span_element.innerHTML.replace(/^.*(\[]*>view<\/a>\]).*$/, '$1'); var sandbox_link = view_link.replace(/("[^"]*)\/doc(?:\/[^"]*|)(")/g, '$1/sandbox$2'); sandbox_link = sandbox_link.replace(/>viewsandbox<'); var testcases_link = view_link.replace(/("[^"]*)\/doc(?:\/[^"]*|)(")/g, '$1/testcases$2'); testcases_link = testcases_link.replace(/>viewtestcases<'); span_element.innerHTML = span_element.innerHTML + ' ' + sandbox_link + ' ' + testcases_link; } }); });