importScript("User:Lupin/recent2.js");
// [[User:Lupin/popups.js]]
importScript('User:Lupin/popups.js');
importScript('User:AzaToth/twinkle.js');
importScript('User:Ioeth/friendly.js');
if (location.href.indexOf('Special:Watchlist') != -1) {
importScript('User:Misza13/watchlistSorter.js');
}
// Stub tag tab. By [[User:ais523]], on a request by [[User:thesublime514]].
// ([[User:ais523/stubtagtab.js]])
// <source lang="javascript">
addOnloadHook(function(){
if(wgNamespaceNumber==0&&wgAction=="view")
{
if(document.getElementById("ca-edit"))
mw.util.addPortletLink('p-cactions', 'javascript:stubtagtab()', 'stub', 'ca-stubtag',
'Add a stub tag to this page', '');
}
if(location.href.indexOf("&autoaddstubtag=")!=-1&&document.getElementById('wpTextbox1')!=null)
{
var x=decodeURIComponent(location.href.split("&autoaddstubtag=")[1]);
if(x=="") x="stub"; else x+="-stub";
document.getElementById('wpTextbox1').value+="\n{"+"{"+x+"}}"; //add to the end of the article
document.getElementById('wpSummary').value=
"Tagging with {"+"{"+x+"}} using [[WP:US/S|user scripts]]";
document.getElementById('wpPreview').click();
}
});
function stubtagtab()
{
var x=prompt("Which stub tag? (Leave blank for {"+
"{stub}}; otherwise -stub will be added to the name)");
if(x==null) return;
location.href=mw.config.get('wgServer')+mw.config.get('wgScript')+"?title="+encodeURIComponent(mw.config.get('wgPageName'))+
"&action=edit&autoaddstubtag="+encodeURIComponent(x);
}
// </source> [[Category:Wikipedia scripts]]
importScript('User:Barticus88/edit section zero.js');
function talkpageplus()
{
var talkpagelink = document.getElementById('ca-talk');
if (talkpagelink.className == 'new')
{
talkpagelink.firstChild.href += '§ion=new';
}
}
addOnloadHook(talkpageplus);
//
//
var histComb = new function(){
if (!window.histCombTalk) histCombTalk = 't'
if (!window.histCombContrib) histCombContrib = 'c'
if (!window.histCombMyBg) histCombMyBg = '#F0FFF0'
var pagehis, histRow, histSize, isCombEdits = false
this.onLoad = function(){
if (!(pagehis = document.getElementById('pagehistory'))) return
histRow = pagehis.getElementsByTagName('li')
histSize = new Array (histRow.length)
var row, spans, i, aa, author, author_p = '', size_digits
var sameAuthor = 0, thisMinor, allMinor = true
for (var rr=histRow.length-1; rr>=0; rr--){ //main loop: bottom to top
row = histRow[rr]
thisMinor = false
spans = row.getElementsByTagName('span')
//check all spans
for (i=0; i<spans.length; i++)
switch (spans[i].className){
case 'history-size':
size_digits = spans[i].innerHTML.match(/\d+/g)
histSize[rr] = size_digits ? size_digits.join('') : '0'
if (histSize[rr+1]){
spans[i].title = spans[i].innerHTML.replace(/ /g,' ')
insertDiffValue(spans[i], histSize[rr] - histSize[rr+1])
}
break
case 'minor':
thisMinor = true
break
case 'history-user': // get user name and shorten talk/contribs
aa = spans[i].getElementsByTagName('a')
author = aa[1].title.split(':')[1]
aa[1].innerHTML = histCombTalk
if (aa.length >= 3 && (aa[2].title.indexOf(':Contributions/') != -1)) //for anons this could be 'block'
aa[2].innerHTML = histCombContrib
break
case 'mw-history-undo':
aa = spans[i].getElementsByTagName('a')[0]
aa.title = aa.innerHTML
aa.innerHTML = '×'
break
//case 'comment': histSumm = spans[i].innerHTML break
}//end switch inside for
if (!histSize[rr] && histSize[rr+1]) histSize[rr] = histSize[rr+1] //assume it was '(un)protect' edit
if (wgUserName == author) histRow[rr].style.backgroundColor = histCombMyBg
//check how many consequent edits
if (author == author_p)
sameAuthor++
else {
if (sameAuthor > 1) createCombineEdit(rr+1, sameAuthor, allMinor)
sameAuthor = 1
author_p = author
allMinor = thisMinor
}
if (!thisMinor) allMinor = false
}//main loop
if (sameAuthor>1) { //collapse top editor too
createCombineEdit(0, sameAuthor, allMinor)
if (histRow.length > sameAuthor){ //and select next editor left radio button
rr = histRow[sameAuthor]
rr.className = 'selected'
rr.getElementsByTagName('input')[0].checked = true
}
}
if (isCombEdits) { //add all expand/collapse link
var togAll = document.createElement('a')
togAll.appendChild(document.createTextNode('[±]'))
togAll.href = 'javascript:histComb.toggleAll()'
//togAll.style.marginLeft = '0.2em'
pagehis.parentNode.insertBefore(togAll, pagehis.previousSibling)
}
//bonus: link to toоlserver
var lnk = document.createElement('a')
lnk.style.marginLeft = '20px'
lnk.href = 'http://tools.wikimedia.de/~daniel/WikiSense/Contributors.php?'
+'wikilang='+wgServer.substring(wgServer.lastIndexOf('/')+1, wgServer.indexOf('.'))
+'&wikifam='+wgServer.substring(wgServer.indexOf('.'))
+'&grouped=on&order=-edit_count&page='+encodeURIComponent(mw.config.get('wgPageName'))
lnk.appendChild(document.createTextNode('Contributors'))
lnk.title = 'All authors sorted by edits (on toolserver)'
if (i=document.getElementById('contentSub')) i.appendChild(lnk)
}
this.toggleAll = function(){
var links = getElementsByClassName(pagehis, 'a', 'collapsedEdits')
for (var i=0; i<links.length; i++)
if (isCombEdits != (links[i].innerHTML == '[–]'))
eval(links[i].href)
isCombEdits = ! isCombEdits
}
this.toggle = function (m, len, isMinor){ //handler for collapsing link
var row = histRow[m]
var spans = row.getElementsByTagName('span')
var plus = row.lastChild
var radios = row.getElementsByTagName('input')
var topDiff = row.getElementsByTagName('a')[ m > 0 ? 1 : 0] // "diff to last" in the combined edit
var i, clss, bottomDiff, oldid
var isHiding = (plus.innerHTML == '[–]')
if (isHiding) {//need to collapse −
plus.innerHTML = '[' + len + ']'
row.style.borderLeft = '1px solid transparent'
//hide other rows
for (i=m+1; i<m+len; i++) histRow[i].style.display = 'none'
//"diff from last" link: get oldid from the lowest collapsed edit
bottomDiff = histRow[m+len-1].getElementsByTagName('a')[1].href
if (bottomDiff.indexOf('&diff=') == -1) topDiff.style.visibility = 'hidden' //the very 1st edit
oldid = bottomDiff.match(/oldid=(\d+)/)[1]
topDiff['old'] = topDiff.href
topDiff.href = topDiff.href.replace(/&oldid=\d+/, '&oldid='+oldid)
}else{ //need to expand
plus.innerHTML = '[–]'
//show other rows and visually reference the whole group
row.style.borderLeft = '1px dotted gray'
for (i=m+1; i<m+len; i++){
histRow[i].style.display = 'block'
histRow[i].style.borderLeft = '1px dotted gray'
histRow[i].style.listStyle = 'none none'
}
histRow[m+len-1].style.borderBottom = '1px dotted gray'
topDiff.href = topDiff['old']
topDiff.style.visibility = 'visible'
}
//hide/show/modify spans in this row
for (i=0; i<spans.length; i++)
switch (spans[i].className.split(' ')[0]){
case 'minor':
spans[i].style.display = (isHiding && !isMinor)?'none':'inline'
break
case 'history-size': //switch to combined diff size and back
insertDiffValue(spans[i], histSize[m] - (isHiding ? histSize[m+len] : histSize[m+1]))
break
case 'comment': //hide/show
spans[i].style.display = (isHiding && !window.histCombLeaveComment)?'none':'inline'
break
case 'mw-history-undo':
var undoLnk = spans[i].getElementsByTagName('a')[0]
if (isHiding) {
undoLnk['old'] = undoLnk.href
undoLnk.href = undoLnk.href.replace(/&undoafter=\d+/, '&undoafter='+oldid)
}else
undoLnk.href = undoLnk['old']
break
//case 'history-user':
}
}
function createCombineEdit(m, len, isMinor){ //creates collapsing link for row m down to row m+len
var row = histRow[m]
row.style.listStyle = 'none none'
row.style.position = 'relative'
var plus = document.createElement('a')
plus.className = 'collapsedEdits'
plus.appendChild(document.createTextNode('[–]'))
plus.style.position = 'absolute'
plus.style.left = '-22px'
plus.style.top = '2px'
plus.href = 'javascript:histComb.toggle('+m+','+len+','+isMinor+')'
row.appendChild(plus)
if (!window.histCombNoCollapse) histComb.toggle(m, len, isMinor) //and collapse
isCombEdits = true
}
function insertDiffValue(span, value){
var html, class2
if (value>0) {
html = '(+' + value + ')'
class2 = ' mw-plusminus-pos'
} else if (value<0) {
html = '(' + value + ')'
class2 = ' mw-plusminus-neg'
} else {
html = '(0)'
class2 = ' mw-plusminus-null'
}
span.style.fontWeight = (value < -500) ? 'bold' : 'normal'
span.innerHTML = html
span.className = span.className.split(' ')[0] + class2
}
}//obj
if (doneOnloadHook) histComb.onLoad()
else if (wgAction == 'history') addOnloadHook(histComb.onLoad)