Benutzer:APPER/WikiHistory.js
aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen
Zur Suche springen
Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.
- Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
- Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
- Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
// <nowiki> varauthors={ queryPageProps:{ action:'query', prop:'pageprops', ppprop:'newsectionlink', pageids:mw.config.get('wgArticleId'), }, api:0, loadinganimation:0, execute:function(){ varns=mw.config.get('wgNamespaceNumber'); if(ns%2!=0||ns==2||ns==710) return; authors.api=newmw.Api(); authors.queryNewSectionLink(authors.api,authors.compute,authors.queryPageProps); }, queryNewSectionLink:function(api,callback,queryParams){ api.get($.extend({},queryParams,{'continue':''})).then(function(data){ callback(data); }).fail(function(code,data){ varextraText; if(code==='http'&&data){ extraText=(data.xhr&&data.xhr.status?'['+data.xhr.status+']':'')+ (data.textStatus?''+data.textStatus+(data.exception?': ':''):'')+ (data.exception?''+data.exception:''); } else{ extraText=code+(data&&data.error&&data.error.info?': '+data.error.info:''); } mw.notify('WikiHistory: error reading page properties ('+extraText+')',{tag:'WikiHistory-error'}); }); }, compute:function(data){ varpages=data.query.pages; for(varpinpages){ if(pages[p].pageprops&&pages[p].pageprops.newsectionlink=='') return; } if(mw.config.get('wgArticleId')==0) return;// no deleted articles if(mw.config.get('wgRevisionId')!=0&&mw.config.get('wgCurRevisionId')!=mw.config.get('wgRevisionId')) return;// only current revision $("<div id='authors' style='font-size:84%; line-height:1.2em; margin:0 0 0 1em; width:auto;'>von <span id='authorsresult'></span><span id='authorsloading'>...</span></div>").insertBefore(document.getElementById("contentSub")||document.getElementById("mw-content-text")); loadinganimation=window.setInterval(function(){if($("#authorsloading").html()==". ")$("#authorsloading").html(" . ");elseif($("#authorsloading").html()==" . ")$("#authorsloading").html(" .");else$("#authorsloading").html(". ");},300); mw.loader.load("//wikihistory.toolforge.org/wiki/getauthors.php?wiki="+window.location.hostname.split(".",1)[0]+"wiki&page_id="+mw.config.get('wgArticleId')); }, resultloaded:function(res,old){ $("#authorsresult").html(res); if(old==1) mw.loader.load("//wikihistory.toolforge.org/wiki/getauthors.php?wiki="+window.location.hostname.split(".",1)[0]+"wiki&page_id="+mw.config.get('wgArticleId')+'&onlynew=1'); }, stoploading:function(){ clearInterval(loadinganimation); $('#authorsloading').remove(); } }; if((typeofWikiHistory==='undefined'||WikiHistory=="all"||WikiHistory=="view")&&mw.config.get('wgAction')=="view"|| (typeofWikiHistory!=='undefined'&&(WikiHistory=="all"||WikiHistory=="info"))&&mw.config.get('wgAction')=="info") $(authors.execute); // </nowiki>