User:Splarka/fastdelete.js

if(wgNamespaceNumber != -1) addOnloadHook(addDeleteButtons) function addDeleteButtons { if(document.getElementById('content').innerHTML.indexOf('submitdelete')!=-1) { alert('Warning: &submitdelete link detected. Be careful clicking anything'); } switch(skin) { case 'wow': /* pass to slate */ case 'wookie': /* pass to slate */ case 'memalpha': /* pass to slate */ case 'smoke': /* pass to slate */ case 'slate': if(!document.getElementById('delete')) return for(var i=0;i<fdButtons.length;i++) { addMSBlink(wgScriptPath + 'index.php?title=' + wgPageName + '&action=delete&submitdelete=true&wpReason='+ encodeURIComponent(fdButtons[i].summary),fdButtons[i].label); }     break;

case 'chick': /* pass to monobook */ case 'simple': /* pass to monobook */ case 'myskin': /* pass to monobook */ case 'monobook': if(!document.getElementById('ca-delete')) return var url=document.getElementById('ca-delete').firstChild.href for(var i=0;i<fdButtons.length;i++) { addPortletLink('p-cactions', wgScriptPath + 'index.php?title=' + wgPageName + '&action=delete&submitdelete=true&wpReason='+ encodeURIComponent(fdButtons[i].summary),fdButtons[i].label,'ca-delete1'); }     break;

case 'classic': break; /* not supported yet */ case 'standard': break; /* not supported yet */ case 'cologneblue': break; /* not supported yet */ case 'nostalgia': break; /* not supported yet */ } }

addOnloadHook(checkdelete); function checkdelete { if(queryString("submitdelete")=="true") document.getElementById('deleteconfirm').wpConfirmB.click }

function queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { } }  return null; }

function addMSBlink(url,text) { var msbs = document.getElementById('myStuffBar').getElementsByTagName('a')[0].parentNode; var link = document.createElement('a'); link.href = url; link.appendChild(document.createTextNode(text)); link.setAttribute('style','margin-left: 10px;'); msbs.appendChild(link); }