Jump to content

User:Sevela.p/global.js: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
Sevela.p (talk | contribs)
Sevela.p (talk | contribs)
m edit Editcount
Line 61: Line 61:
function doQuickCount() {
function doQuickCount() {
if (wgPageName == "Special:Contributions") {
if ( ( wgCanonicalNamespace == "Special" && wgCanonicalSpecialPageName == "Contributions" ) ) {
var name = document.getElementById("contentSub").getElementsByTagName("a");
var name = document.getElementById("contentSub").getElementsByTagName("a");
var rname = name[0].innerHTML;
var rname = name[0].innerHTML;
if (rname == "talk") return; //IP
if (rname == "talk") return; //IP
var cnteraj = sajax_init_object(null);
var cnteraj = sajax_init_object(null);
cnteraj.open("GET", "http://en.wikipedia.org/w/api.php?action=query&list=users&ususers=" + rname + "&usprop=editcount&format=json", true);
cnteraj.open("GET", wgServer + wgScriptPath + "/api.php?action=query&list=users&ususers=" + rname + "&usprop=editcount&format=json", true);
cnteraj.onreadystatechange = function()
cnteraj.onreadystatechange = function()
{
{

Revision as of 23:22, 7 March 2010

/*My global buttons*/
if (mwCustomEditButtons) {
 
    mwCustomEditButtons[mwCustomEditButtons.length] = {
      "imageFile": "http://upload.wikimedia.org/wikipedia/commons/1/12/Button_case.png",
      "speedTip": "Commonscat",
      "tagOpen": "\x7b\x7bCommonscat|",
      "tagClose": "}}",
      "sampleText": ""};
};

/* UTC clock */
importScriptURI('http://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-UTCLiveClock.js&action=raw&ctype=text/javascript');

/*HotCat*/
importScriptURI('http://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript');

/*Transclude mwEmbed.js*/
importScriptURI('http://prototype.wikimedia.org/s-2/js/mwEmbed/remotes/mediaWiki.js?&uselang=cs' );

/*Moves edit links next to section headers, see [[:en:User:Drilnoth/lefteditlinks.js/doc]]*/
importScriptURI('http://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-lefteditlinks.js&action=raw&ctype=text/javascript');

/*Allow up to 50 more characters in each of your edit summaries. Works in Internet Explorer, Firefox, and Opera.*/
importScriptURI('http://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-LongEditSummaries.js&action=raw&ctype=text/javascript');

/*Force left-to-right format on RTL wikis
by [[m:user:Pathoschild]] <http://meta.wikimedia.org/wiki/User:Pathoschild/Scripts/Force_ltr>*/
importScriptURI('http://meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/Force_ltr.js&action=raw&ctype=text/javascript');

/*LinkFixr*/
importScriptURI('http://en.wikipedia.org/w/index.php?title=MediaWiki:LinkFixr.js&action=raw&ctype=text/javascript');

/*urldecoder*/
importScriptURI('http://en.wikipedia.org/w/index.php?title=User:Js/urldecoder.js&action=raw&ctype=text/javascript');

/*markblocked*/
importScriptURI('http://ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-markblocked.js&action=raw&ctype=text/javascript');

/*Watchlist since*/
importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:WikiProject User scripts/Scripts/Watchlist since&action=raw&ctype=text/javascript');

/*LinkComplete*/
importScriptURI('http://en.wikipedia.org/w/index.php?title=User:Zocky/LinkComplete.js&action=raw&ctype=text/javascript');

/*Force edit summary alternative*/
importScriptURI('http://en.wikipedia.org/w/index.php?title=Wikipedia:WikiProject User scripts/Scripts/Force edit summary alternative&action=raw&ctype=text/javascript');

/*Deluxe history*/
//importScriptURI('http://fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-Objects.js&action=raw&ctype=text/javascript');
//importScriptURI('http://fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-DeluxeHistory.js&action=raw&ctype=text/javascript');

/*Magic words*/
//importScriptURI('http://fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-CaracteresMagic.js&action=raw&ctype=text/javascript');

/*Parser functions*/
//importScriptURI('http://fr.wikipedia.org/w/index.php?title=MediaWiki:Gadget-CaracteresParser.js&action=raw&ctype=text/javascript');

/*Editcount*/
addOnloadHook(doQuickCount);
 
function doQuickCount() {
  if ( ( wgCanonicalNamespace == "Special" && wgCanonicalSpecialPageName == "Contributions" ) ) { 
    var name = document.getElementById("contentSub").getElementsByTagName("a"); 
    var rname = name[0].innerHTML;    
    if (rname == "talk") return; //IP
    var cnteraj = sajax_init_object(null);
    cnteraj.open("GET", wgServer + wgScriptPath + "/api.php?action=query&list=users&ususers=" + rname + "&usprop=editcount&format=json", true); 
    cnteraj.onreadystatechange = function()
    {
      if(cnteraj.readyState != 4) return;
      var response = eval('(' + cnteraj.responseText + ')');
      var count = response["query"]["users"][0]["editcount"];    
      document.getElementById("contentSub").innerHTML = document.getElementById("contentSub").innerHTML + "&nbsp;·&nbsp;<span id='quickEditCount'>Edit count: " + count + "</span>";        
    };
    cnteraj.send(null);
  }
}