User:Voice of All/monobook/parse.js
Appearance
(Redirected from User:Aaron Schulz/monobook/parse.js)
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
Documentation for this user script can be added at User:Voice of All/monobook/parse. |
// Some functions for parsing raw HTML.
// Need to be maintained...
window.getSumOfHistLI = function(li)
{
var the_sum = '';
var l = document.getElementById('bodyContent').getElementsByTagName('li')[li];
var ls = l.getElementsByTagName('span');
for (k = 0; k < ls.length; k++)
{
if (ls[k].className=='autocomment')
{
if (ls[k-1].innerHTML.indexOf("-</span> ") !=-1)
{the_sum = ls[k-1].innerHTML.split("-</span> ")[1].split("</span>")[0];}
else if (ls[k-1].innerHTML.indexOf("-</span>") !=-1)
{the_sum = ls[k-1].innerHTML.split("-</span>")[1].split("</span>")[0];}
else if (ls[k-1].innerHTML.indexOf("</span>") !=-1)
{the_sum = ls[k-1].innerHTML.split("</span>")[1].split("</span>")[0];}
else {the_sum = '';}
break;
}
else if (ls[k].className=='comment')
{the_sum = ls[k].innerHTML;}
}
the_sum = the_sum.replace(/(-<\/span>|→)/gi,'');
return the_sum;
}
window.getSumOfContribsLI = function(li)
{
return getSumOfHistLI(li);
}
window.getTimeOfHistLI = function(li)
{
var the_time = '';
var l = document.getElementById('bodyContent').getElementsByTagName('li')[li];
var la = l.getElementsByTagName('a');
for ( var k = 0; k < la.length; k++)
{
if( la[k].href.indexOf('&oldid=') !=-1 && la[k].href.indexOf('&diff=') ==-1 ) {
the_time = la[k].innerHTML;
break;
}
}
return the_time;
}
window.getTimeOfContribsLI = function(li)
{
var the_time = '';
var l = document.getElementById('bodyContent').getElementsByTagName('li')[li];
var la = l.getElementsByTagName('a');
for ( var k = 0; k < la.length; k++)
{
if( la[k].href.indexOf('&oldid=') !=-1 && la[k].href.indexOf('&diff=') ==-1 ) {
the_time = la[k].innerHTML;
break;
}
}
return the_time;
}