Sətir 1.093: |
Sətir 1.093: |
| | | |
| /** | | /** |
− | * This code was automatically generated and should not be manually edited. | + | * XTools ArticleInfo gadget |
− | * For updates, please copy and paste from https://xtools.wmflabs.org/articleinfo-gadget.js?uglify=1 | + | * Based on meta.wikimedia.org/wiki/User:Hedonil/XTools |
− | * Released under GPL v3 license. | + | * Documentation: mediawiki.org/wiki/XTools |
− | * Local version of [[mw:XTools/ArticleInfo.js]]
| + | * Released under GPL v3 license |
| */ | | */ |
− | $(function(){if(mw.config.get("wgArticleId")===0||mw.config.get("wgCurRevisionId")!==mw.config.get("wgRevisionId")||mw.config.get("wgAction")!=="view"){return}var e="<div id='xtools' style='font-size:84%; line-height:1.2em;"+"width:auto;'><span id='xtools_result'>.</span></div>";$(e).insertBefore("#contentSub");var t=window.setInterval(function(){if($("#xtools_result").html()===". "){$("#xtools_result").html(" . ")}else if($("#xtools_result").html()===" . "){$("#xtools_result").html(" .")}else{$("#xtools_result").html(". ")}},300);$.get("https://xtools.wmflabs.org"+"/api/page/articleinfo/"+mw.config.get("wgServerName")+"/"+mw.config.get("wgPageName").replace(/["?%&+]/g,escape)+"?format=html"+"&uselang="+mw.config.get("wgUserLanguage")).done(function(e){$("#xtools_result").html(e);clearInterval(t)})}); | + | $(function () { |
| + | if (mw.config.get('wgArticleId') === 0 || // no deleted articles, no special pages |
| + | mw.config.get('wgCurRevisionId') !== mw.config.get('wgRevisionId') || // only current revision |
| + | mw.config.get('wgAction') !== 'view') { // only when viewing a page, not editing |
| + | return; |
| + | } |
| + | |
| + | var markup = "<div id='xtools' style='font-size:84%; line-height:1.2em;" + |
| + | "width:auto;'><span id='xtools_result'>.</span></div>", |
| + | $result = $('#xtools_result'); |
| + | $(markup).insertBefore('#contentSub'); |
| + | |
| + | var loadinganimation = window.setInterval(function () { |
| + | if ($result.html() === '. ') { |
| + | $result.html(' . '); |
| + | } else if ($result.html() === ' . ') { |
| + | $result.html(' .'); |
| + | } else { |
| + | $result.html('. '); |
| + | } |
| + | }, 300); |
| + | |
| + | $.get( |
| + | 'http://xtools.wmflabs.org' + |
| + | '/api/page/articleinfo/' + |
| + | mw.config.get('wgServerName') + '/' + |
| + | mw.config.get('wgPageName').replace(/["?%&+]/g, escape) + '?format=html' + |
| + | '&uselang=' + mw.config.get('wgUserLanguage') |
| + | ).done(function (result) { |
| + | $result.html(result); |
| + | clearInterval(loadinganimation); |
| + | }); |
| + | }); |