Käyttäjä:Feenix/monobook.js

Gingapedia sisältää juonipaljastuksia Ginga-sarjasta
Loikkaa: valikkoon, hakuun

Huomautus: Selaimen välimuisti pitää tyhjentää asetusten tallentamisen jälkeen, jotta muutokset tulisivat voimaan.

  • Firefox ja Safari: Napsauta Shift-näppäin pohjassa Päivitä, tai paina Ctrl-F5 tai Ctrl-R (⌘-R Macilla)
  • Google Chrome: Paina Ctrl-Shift-R (⌘-Shift-R Macilla)
  • Internet Explorer: Napsauta Ctrl-näppäin pohjassa Päivitä tai paina Ctrl-F5
  • Opera: Menu → Settings (Opera → Preferences Macilla) ja sitten Privacy & security → Clear browsing data → Cached images and files.
//<pre><nowiki>
// *****************************************************************
// Splarka's contribtools.js
// *****************************************************************
if(wgCanonicalSpecialPageName == 'Contributions' && !window.ContribToolsLoaded) addOnloadHook(contribtools)
var ContribToolsLoaded = true; //prevent duplication

function contribtools() {
  var ug = wgUserGroups.join(' ');
  var cs = document.getElementById('contentSub');
  // poorman contribs type finder. -1 = existing user
  try { 
    var ctype = cs.getElementsByTagName('a')[0].href.indexOf('User_talk');
  } catch(e) {
    var ctype = -1;
  }
  var inputs = document.getElementsByTagName('input');
  var targ;
  for(var i=0;i<inputs.length;i++) { 
    if(inputs[i].name=='target') { 
      targ = inputs[i].value;
      break;
    }
  }
  if(!targ) return

  //lookupuser: steward, logged in
  if((ug.indexOf('steward') > -1)&&(ctype==-1)) insertContentSubContribLink('http://wiki.hopeanuoli.com/index.php?title=Toiminnot%3ALookupUser&target=' + targ.replace(/User\:/,'') ,'LookupUser')

  //user-rights: steward, logged in
  if((ug.indexOf('steward') > -1)&&(ctype==-1)) insertContentSubContribLink('http://wiki.hopeanuoli.com/index.php?title=Toiminnot%3AK%C3%A4ytt%C3%B6oikeudet&load=true&user=' + targ.replace(/User\:/,'') ,'UserRights')

}

function insertContentSubContribLink(link,text) {
  var cs = document.getElementById('contentSub');
  var icssep = document.createTextNode(' | ');
  var ics = document.createElement('a');
  ics.href = link;
  ics.setAttribute('title', ics.href);
  ics.appendChild(document.createTextNode(text));
  try {
    cs.insertBefore(icssep,cs.childNodes[cs.childNodes.length-1]);
    cs.insertBefore(ics,cs.childNodes[cs.childNodes.length-1]);
  } catch(e) {
    cs.appendChild(document.createTextNode('(Error: contentSub still empty! Inserting... '));
    cs.appendChild(ics);
  }
}

// Needed to load user rights automagically.
addOnloadHook(checkuserrights);
function checkuserrights() {
  if(queryString('user') && document.uluser) { 
    document.getElementById('username').value = queryString('user');
    if(queryString('load')=='true') document.uluser.ssearchuser.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;
}

// *****************************************************************
// Load various external scripts 
// *****************************************************************
function appendScript(url) {
  var scriptElem = document.createElement('script');
  scriptElem.setAttribute('src',url);
  scriptElem.setAttribute('type','text/javascript');
  document.getElementsByTagName('head')[0].appendChild(scriptElem);
}
appendScript('http://www.wikia.com/index.php?title=User:Splarka/fastdelete.js&action=raw&ctype=text/javascript&dontcountme=s')
appendScript('http://en.wikipedia.org/w/index.php?title=User:Zocky/SearchBox.js&action=raw&ctype=text/javascript&dontcountme=s')

// *****************************************************************
// Custom automatic delete buttons 
// *****************************************************************
// Adds customizable one-click deletion buttons to any deletable page.
// Requires w:User:Splarka/fastdelete.js in appendScript();
var fdButtons = [];
fdButtons[fdButtons.length] = {
  'summary': 'vandalismia',
  'label': 'vandalismia'};

// *****************************************************************
// &bot=1 on contribs pages. 
// *****************************************************************
function hiderollback() {
  var botlink = document.location.href;
  if(botlink.indexOf('?')==-1) {
    botlink += '?bot=1';
  } else {
    botlink += '&bot=1';
  }
  addPortletLink('p-cactions', botlink, '&bot=1', 'ca-bot');
}
if((skin == "monobook")&&(wgCanonicalSpecialPageName == 'Contributions')) addOnloadHook(hiderollback)

// Purge link on non-special pages
// By Splarka
if(wgNamespaceNumber > -1) addOnloadHook(function() { addPortletLink('p-cactions',wgServer + wgScript + '?title=' + encodeURIComponent(wgPageName) + '&action=purge','purge'); })
//</nowiki></pre>