User:Lifebaka/closedrv/test.js

//this helps automate DRV closing by adding a 'close' tab to DRV debates when editing sections //written by User:Lifebaka, modified from WikiProject User scripts/Scripts/CloseAFD.js written by User:Johnleemk //this code is for testing changes to User:Lifebaka/closedrv.js without making changes to the actual live javascript //please do not import this code unless you are using it for testing purposes, as it is not guaranteed to work properly

function autodrv_result2 { var close = prompt("Result of debate?") var f = document.editform, t = f.wpTextbox1; t.value = t.value.split(/==== *\[/).join('['); t.value = t.value.split(/\] *====/).join(']'); if (t.value.length > 0) t.value += '\n'; t.value += ""; f.wpSummary.value += "closing: " + close; }

function autodrv_add_drv_tabs2 { // Only add for pages with the right string somewhere in the title if ((document.title.indexOf("Editing User:Lifebaka/Sandbox/closedrv testing") != -1) && (document.title.indexOf("(section)") != -1)) {     mw.util.addPortletLink('p-cactions', 'javascript:autodrv_result2', "close"); } }

$(autodrv_add_drv_tabs2);