User:Cizagna/monaco.js

if(skin == "monobook"){ if(wgPageName=='Special:Imagelist') addOnloadHook(imagelistTools) function imagelistTools { addPortletLink('p-cactions','javascript:showFLimages(0)','Show images (full)','ca-showim0','loads the images in a full sized image tag'); addPortletLink('p-cactions','javascript:showFLimages(1)','Show images (small)','ca-showim1','loads the images in a 200x200 image tag'); addPortletLink('p-cactions','javascript:filelistprune','Desc links only','ca-prune','turns the whole page into just a list of links'); } function showFLimages(full) { var links = document.getElementById('bodyContent').getElementsByTagName('a'); var img; for(var i=0;i < links.length;i++) { if(links[i].firstChild.nodeValue=='file') { links[i].firstChild.nodeValue = ''; links[i].parentNode.setAttribute('class','plainlinks'); img = document.createElement('img'); img.setAttribute('src',links[i].href); if(full==0) { img.setAttribute('style','border:2px outset blue;'); } else { img.setAttribute('style','width:200px;height:200px;border:2px outset blue;'); }     links[i].appendChild(img); } }  document.getElementById('ca-showim0').style.display='none'; document.getElementById('ca-showim1').style.display='none'; } } function filelistprune { var descs = getElementsByClassName(document,'td','TablePager_col_img_name'); var dlist = ' '; for(var i=0;i < descs.length;i++) { dlist += '' + descs[i].firstChild.title + '\n'; } dlist += ' \n'; document.getElementById('bodyContent').innerHTML = dlist; document.getElementById('ca-prune').style.display='none'; }

// ================================================================================ // START Automated deletion button script system // ================================================================================ // Adds customizable one-click deletion buttons to any deletable page. if(wgNamespaceNumber != -1) addOnloadHook(addDeleteButtons) function addDeleteButtons { if(!document.getElementById('ca-delete')) return var url=document.getElementById('ca-delete').firstChild.href if(document.getElementById('content').innerHTML.indexOf('submitdelete')!=-1) { alert('Warning: &submitdelete link detected. Be careful clicking anything'); } if(wgNamespaceNumber == 6) addPortletLink('p-cactions', url + '&submitdelete=true&wpReason=' + encodeURIComponent('Unused image') ,'fastdelete image','ca-delete1'); }

addOnloadHook(checkdelete); function checkdelete { if(queryString('submitdelete')=='true') { var btn = (document.getElementById('mw-filedelete-submit')) ? document.getElementById('mw-filedelete-submit') : document.getElementById('wpConfirmB') btn.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; } // ================================================================================ // END Automated deletion button script system // ================================================================================