User:Collectonian/monobook.js
From Wikipedia, the free encyclopedia
If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure whether the code is safe, you can ask at the appropriate village pump.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
importScript('User:AzaToth/twinkle.js'); importScript('User:Ioeth/friendly.js'); /**** quick image delete ****/ document.write('<script type="text/javascript"' + 'src="http://en.wikipedia.org/w/index.php?title=User:Howcheng/quickimgdelete.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>'); /* This is to keep track of who is using this extension: [[User:Howcheng/quickimgdelete.js]] */ /* Del tab for easier tagging of deletion articles */ <!-- Begin deletion-sorting code --> // From code by [[User:Raylu|raylu]] // // // This script adds a "Anime and manga Deletion" tab to the top of article pages // when in edit mode. It is disabled for the User namespace. function dodeletion() { document.editform.wpTextbox1.value = document.editform.wpTextbox1.value + '\n{' + '{' + 'subst' + ':' + 'delsort' + '|' + 'Anime and manga' + '}' + '}' + ' ' + '--' + ' ' + '~' + '~' + '~' + '~'; document.editform.wpSummary.value = 'Tagged as a Anime and manga-related deletion.'; document.editform.wpMinoredit.checked = true; document.editform.submit(); } function adddeletion() { addTab("javascript:dodeletion()", "Anime and manga deletion", "ca-Anime and mangadeletion", "Anime and manga Deletion", ""); akeytt(); } addOnloadHook(function() { if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1) { return; } if (document.title.indexOf("Editing ") != -1) { addOnloadHook(adddeletion); } }); function addTab(url, name, id, title, key){ var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; return addlilink(tabs, url, name, id, title, key) }; function addlilink(tabs, url, name, id, title, key){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); tabs.appendChild(li); if(id) { if(key && title) { ta[id] = [key, title]; } else if(key) { ta[id] = [key, '']; } else if(title) { ta[id] = ['', title]; } } // re-render the title and accesskeys from existing code in wikibits.js akeytt(); return li; } <!--End deletion-sorting code --> /* Twinkle Configuration Settings */ TwinkleConfig = { revertMaxRevisions : 50, userTalkPageMode : 'tab', showSharedIPNotice : true, openTalkPage : [ 'agf', 'norm', 'vand' ], openTalkPageOnAutoRevert : false, summaryAd : " using [[WP:TWINKLE|TW]]", deletionSummaryAd : " using [[WP:TWINKLE|TW]]", protectionSummaryAd : " using [[WP:TWINKLE|TW]]", watchSpeedyPages : [ 'g1', 'g2', 'g#', 'g4', 'g5', 'g6', 'g7', 'g8', 'g9', 'g10', 'g11', 'g12', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'i1', 'i2', 'i3', 'i4', 'i5', 'i6', 'i7', 'u1', 'u2', 'u3', 't1', 'r1', 'r2', 'r3' ], watchProdPages : true, openUserTalkPageOnSpeedyDelete : [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ], watchRevertedPages : [ 'agf', 'norm', 'vand', 'torev' ], markRevertedPagesAsMinor : [ 'agf', 'norm', 'vand', 'torev' ], watchWarnings : true, markAIVReportAsMinor : false, markSpeedyPagesAsMinor : false, offerReasonOnNormalRevert : true }; /* Semi-automatic image watcher, version [0.0.3a] Originally from: http://en.wikipedia.org/wiki/User:Splarka/watchimages.js Operation: * Checks which images are being used on a page * Sorts out those from commons, builds a list of those local or missing * Passes this list to Special:Watchlist/raw (but does not save, being a test script). * When saved, returns to the original page. Notes: * The logic of which images to watch is easily changed (see below) * This avoids ajax editing (which is a pain). Possibly the API actions will be enabled later. To do after more testing: * Abort if no matching images are found. * Check page more specifically for a content type (page has ID? etc). * Auto-submit if so desired. */ if(wgNamespaceNumber != -1) addOnloadHook(watchAllImagesButton) function watchAllImagesButton() { addPortletLink('p-tb','javascript:watchAllImages()','Watch images','t-wai','Add all images on this page to your watchlist.'); } function watchAllImages() { var wai = document.getElementById('t-wai'); if(wai) { wai.getElementsByTagName('a')[0].style.display = 'none'; var prog = document.createElement('img'); prog.setAttribute('id','wai-prog'); prog.setAttribute('src',stylepath + '/common/images/spinner.gif'); wai.appendChild(document.createTextNode('Working...')); wai.appendChild(prog); } var url = wgServer + wgScriptPath +'/api.php?action=query&format=json&callback=watchAllImagesCB&generator=images&prop=imageinfo&iiprop=&iilimit=1&titles=' + encodeURIComponent(wgPageName) var scriptElem = document.createElement('script'); scriptElem.setAttribute('src',url); scriptElem.setAttribute('type','text/javascript'); document.getElementsByTagName('head')[0].appendChild(scriptElem); } function watchAllImagesCB(obj) { document.getElementById('wai-prog').style.display = 'none'; var towatch = ''; if(!obj['query'] || !obj['query']['pages']) return var images = obj['query']['pages']; for(var i in images) { // Logic variables to determine which images to watch // islocal = image is local, rather than shared (from commons). // haspage = has a description page, all local and some shared images have this. // hasmedia = the image exists, either locally or shared. var islocal = (images[i]['imagerepository'] == 'local') var haspage = i > 0 var hasmedia = (images[i]['imagerepository'] != '') //(!hasmedia || islocal) => all local images, as well as all missing (deleted or soon to be uploaded) images if(!hasmedia || islocal) { towatch += images[i]['title'] += '\n'; } } var url = wgServer + wgArticlePath.replace(/\$1/,'Special:Watchlist/raw') + '?fromtitle=' + encodeURIComponent(wgPageName) + '&towatch=' + encodeURIComponent(towatch); document.location.href = url; } if(queryString('towatch') && wgCanonicalSpecialPageName == 'Watchlist') addOnloadHook(addToWatchlist) function addToWatchlist() { var txt = document.getElementById('titles'); var towatch = decodeURIComponent(queryString('towatch')); if(!txt) return if(queryString('fromtitle')) { var forms = document.forms; for(var i=0;i<forms.length;i++) { if(forms[i].action.indexOf('Watchlist') != -1) { forms[i].action += '&pleasereturnto=' + queryString('fromtitle'); } } } txt.value += towatch; alert('Note: the following images will be added to your watchlist upon save:\n' + towatch); } if(queryString('pleasereturnto') && wgCanonicalSpecialPageName == 'Watchlist') addOnloadHook(addToWatchlistDone) function addToWatchlistDone() { var url = wgServer + wgArticlePath.replace(/\$1/,decodeURIComponent(queryString('pleasereturnto'))); document.location.href = url; } function queryString(p) { var re = RegExp('[&?]' + p + '=([^&]*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches[1]); } catch (e) { } } return null; }