Wikipedia:WikiProject User scripts/Scripts/Watchlist since: Difference between revisions
Content deleted Content added
double gah |
major rewrite, works with tabbed browsing too |
||
Line 1:
// Adds a "Changes since last load" link to your watchlist. <pre><nowiki>
var anchs=document.getElementsByTagName('A');▼
}▼
if (!found) return;▼
window.sinceLinkThen=+(new Date());▼
var sp=document.createElement('span');▼
addOnloadHook(function
if (unescape(window.___location.href).indexOf("Special:Watchlist") < 0) return;
var days = ( +(new Date()) - then )/(1000 * 3600 * 24);▼
var url=document.___location.href.split('#')[0];▼
if ( /[?&]days=/.test(url) ) return url.replace(/([?&]days=)[^?&]*/, '$1'+days);▼
// just one little ID attribute would be _so_ nice...
var
while (wlNotePara && !(wlNotePara.tagName && wlNotePara.tagName.toLowerCase() == 'p'))
wlNotePara = wlNotePara.nextSibling;
link.id = 'listSince';
link.href = '#listSince'; // must have a href to show as link!
var fixLinkHref = function () {
▲ var days = ( +(new Date()) - then )/(1000 * 3600 * 24);
if (url.match(/[?&]days=/))
else
this.href = url + (url.indexOf('?') < 0 ? '?':'&') + 'days=' + days;
return true;
▲ };
link.onclick = fixLinkHref;
link.onmousedown = fixLinkHref; // react to middle clicks too
wlNotePara.appendChild(link);
link.appendChild(document.createTextNode('Changes'));
wlNotePara.appendChild(document.createTextNode(' since last load.'));
});
//</nowiki></pre>
|