Content deleted Content added
update script: allows user positioning relative to right and bottom |
Migration: wg* → mw.config.get('wg*'); +Missing '()' invoking a constructor and missing semicolons. |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 9:
if (offlineAfter == null) var offlineAfter = (15 * 60); // number of seconds after which a user is considered offline (default: 15 * 60 seconds)
if (statCloseOnClick == null) var statCloseOnClick = true; // whether to close the status window when clicking on it
if (statPosition == null) var statPosition = new Array(20, 600); // position of the status window [left, top, right, bottom]
//main script
Line 15:
this.launch = function() {
// launch helper. check whether there is a deletion tag on this page.
if ((mw.config.get('wgNamespaceNumber') == 2) || (mw.config.get('wgNamespaceNumber') == 3) || (window.___location.href.indexOf('Special:Contributions/') > -1)) {
this.control = new statusCheck_controller();
this.control.runCheck();
} else { return false; /* do nothing!*/ }
};
}
function statusCheck_controller() {
var statusCheck = this;
if (mw.config.get('wgPageName') == 'Special:Contributions') {
this.userName = window.___location.href.substr(window.___location.href.indexOf('Special:Contributions/') + 22);
if (this.userName == '') return false;
} else {
if (mw.config.get('wgTitle').indexOf('/') > -1) { this.userName = mw.config.get('wgTitle').substr(0, mw.config.get('wgTitle').indexOf('/')); } else { this.userName = mw.config.get('wgTitle'); }
}
Line 41:
statusCheck.interface.win_width = 110;
statusCheck.interface.win_height = 35;
statusCheck.interface.win_fontsize = 10;
statusCheck.interface.win_bg = '#dddddd';
Line 107 ⟶ 108:
case '4':
var contribsLink = '(<a href="'+mw.config.get('wgServer')+mw.config.get('wgArticlePath').replace('$1','Special:Contributions')+'/'+statusCheck.userName+'">contribs</a>)';
if (statusCheck.online == true) {
statusCheck.interface.win_bg = '#bbddbb';
statusCheck.interface.win_bd = '#99cc99';
statusCheck.interface.win_content = '<div style="width: 100px; margin: auto; margin-top: 2px; text-align: center; font-size: 1.15em; color: #00aa00;">online</div><div style="width: 100px; margin: auto; margin-top: 7px; text-align: center; font-size: 0.85em;">StatusCheck '+contribsLink+'</div>';
} else {
statusCheck.interface.win_bg = '#ddbbbb';
statusCheck.interface.win_bd = '#cc9999';
statusCheck.interface.win_content = '<div style="width: 100px; margin: auto; margin-top: 2px; text-align: center; font-size: 1.15em; color: #dd3333;">offline</div><div style="width: 100px; margin: auto; margin-top: 7px; text-align: center; font-size: 0.85em;">StatusCheck '+contribsLink+'</div>';
}
Line 126 ⟶ 129:
break;
}
};
}
Line 134 ⟶ 137:
function launchstatusCheck() {
// lib proto
wa_window.prototype = new wa_document();
wa_element.prototype = new wa_document();
// init object
var obj_statusCheck = new statusCheck();
obj_statusCheck.launch();
Line 144 ⟶ 147:
}
$.getScript("https://en.wikipedia.org/w/index.php?title=User:Ale_jrb/Scripts/waLib.js&action=raw&format=text/javascript", function() {$(document).ready(launchstatusCheck);});
|