Участник:Morpheios Melas/monobook.js: различия между версиями

Содержимое удалено Содержимое добавлено
если не двигать мышью 50 секунд то счетчик останавливается до первого движения
Нет описания правки
 
Строка 1:
document.write('<script type="text/javascript" src="'
var basecount=195133;
+ 'http://ru.wikipedia.org/w/index.php?title=MediaWiki:ExtSearchPanel.js'
var basetime=new Date(Date.UTC(2007, 7, 14, 12, 31, 0, 0))
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
var curcount=0;
var updrest=10;
 
document.write('<script type="text/javascript" src="'
function LiveCountReq() {
+ 'http://ru.wikipedia.org/w/index.php?title=MediaWiki:ExtSearch.js'
req.onreadystatechange = processCount;
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
req.open("GET", "http://ru.wikipedia.org/wiki/Special:Statistics?action=raw&randomseed="+Math.floor(Math.random()*10000000), true);
req.send(null);
}
auto_comment = 1;
function processCount() {
if (req.readyState == 4) {
/* Требуется для разных функций */
if (req.status == 200) {
function addlilink(tabs, url, name, id, title, key)
curcount=req.responseText.substring(req.responseText.indexOf('good=',1)+5,
{
req.responseText.indexOf(';views=',1));
var na = document.createElement('a');
var curtime=new Date;
na.href = url;
var progn=(200000-basecount)*
na.appendChild(document.createTextNode(name));
(curtime.valueOf()-basetime.valueOf())/
var li = document.createElement('li');
(curcount-basecount)+basetime.valueOf();
if(id) li.id var progd=new Date(progn)id;
li.appendChild(na);
document.getElementById('articlecount').innerHTML=curcount;
tabs.appendChild(li);
var secs=Math.floor((progd-curtime)/1000)
if(id)
var days=Math.floor(secs/24/60/60);
{
var hours=Math.floor((secs-days*24*60*60)/60/60);
if(key && title)
var mins=Math.floor((secs-days*24*60*60-hours*60*60)/60);
{
var lsecs=Math.floor(secs-days*24*60*60-hours*60*60-mins*60);
ta[id] = [key, title];
document.getElementById('articlecountdown').innerHTML=days+'d '+Math.floor(hours/10)+hours%10+':'+Math.floor(mins/10)+mins%10+':'+Math.floor(lsecs/10)+lsecs%10;
} else { }
else if(key)
document.getElementById('articlecount').innerHTML='??????';
{
document.getElementById('articlecountdown').innerHTML='??????';
ta[id] = [key, ''];
}
else if(title)
{
ta[id] = ['', title];
}
}
updrest-=1akeytt();
ifreturn (updrest>0) {li;
setTimeout('LiveCountReq();',5000);
} else {
document.getElementById('articlecount').innerHTML='??????';
document.getElementById('articlecountdown').innerHTML='??????';
}
}
}
function updateLastMouse(e) {
/* Требуется для разных функций */
if (updrest<1) {
function addTab(url, name, id, title, key)
updrest=10;
{
setTimeout('LiveCountReq();',5000);
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
} else {
return addlilink(tabs, url, name, id, title, key);
updrest=10;
}
}
function addLiveCount()
/* Добавление ссылки в панель навигации (над панелью поиска) */
function addToolboxLink(url, name, id)
{
var tb = document.getElementById('p-navigation').getElementsByTagName('ul')[0];
req = null;
addlilink(tb, url, name, id);
if (window.XMLHttpRequest) {
}
try {
req = new XMLHttpRequest();
gsKateInsertBefore = 'pt-mycontris'; // leave blank to append after "logout"
} catch (e){}
function KateLink() {
} else if (window.ActiveXObject) {
var user = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
try {
user = user.substring(user.indexOf('title=') + 6, user.lastIndexOf('&action=edit'));
req = new ActiveXObject('Msxml2.XMLHTTP');
user = user.substring(user.indexOf(':') + 1);
} catch (e){
var li = document.createElement( 'li' );
try {
li.id = 'pt-kate';
req = new ActiveXObject('Microsoft.XMLHTTP');
var a = document.createElement( 'a' );
} catch (e){}
a.appendChild( document.createTextNode( 'счётчик' ) ); // eh, the css makes the text lowercase
}
a.href = 'http://tools.wikimedia.de/~interiot/cgi-bin/count_edits?dbname=ruwiki_p&user=' + user;
}
li.appendChild( ifa (req) {;
if ( ! gsKateInsertBefore ) {
document.getElementById('p-logo').innerHTML='<a style="background-image: url(http://upload.wikimedia.org/wikipedia/ru/b/bc/Wiki.png);" href="/wiki/%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0" title="Перейти на заглавную страницу [z]" accesskey="z"></a><div id="articlecount" style="display:block;position:absolute;left:5px;top:100px;align:center; color:#222222; font-size: 8pt;opacity:0.7;background:#FFFFFF;padding:0em 0.25em;">??????</div><div id="articlecountdown" style="display:block;position:absolute;left:60px;top:100px;align:center; color:#773333; font-size: 8pt;opacity:0.7;background:#FFFFFF;padding:0em 0.25em;">??????</div>'
document.getElementById( 'pt-logout' ).parentNode.appendChild( li );
 
} else {
 
var before = document.getElementById( gsKateInsertBefore );
if (window.addEventListener)
before.appendChild( li, before );
window.addEventListener("mousemove", updateLastMouse, false);
else }
if (window.attachEvent)
window.attachEvent("mousemove", updateLastMouse);
LiveCountReq();
}
}
addOnloadHook(addLiveCount);
if (window.addEventListener)
window.addEventListener('load', KateLink, false);
else
if (window.attachEvent)
window.attachEvent('onload', KateLink);
importScript('User:Morpheios Melas/articlecount.js');