Jump to content
Wikimedia Meta-Wiki

User:He7d3r/Tools/TopRevisionsByScore.js

From Meta, a Wikimedia project coordination wiki
This is an archived version of this page, as edited by He7d3r (talk | contribs) at 20:54, 25 February 2024 (Sync with https://github.com/he7d3r/mw-gadget-TopRevisionsByScore; minify with UgliPyJS 0.2.5). It may differ significantly from the current version .
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
 // [[File:User:He7d3r/Tools/TopRevisionsByScore.js]] (workaround for [[phab:T35355]])
 /**
  * Generates a table showing the scores for each revision returned from Quary
  *
  * @author: Helder (https://github.com/he7d3r)
  * @license: CC BY-SA 3.0 <https://creativecommons.org/licenses/by-sa/3.0/>
  */
 // <nowiki>
 (function(e,t){"use strict";functionn(e){varn,o,i,r,c,u,l,f='{| class="wikitable sortable"\n|+ Edits by score\n',d=["Revision","Status"];for(n=0;a.length>n;n++)d.unshift(a[n]);for(f+="! "+d.join(" !! "),o=0;e.length>o;o++)if(i=e[o],!(s>=i.score[0])){for(r=i.revid,c=["[[Special:Diff/"+r+"|"+r+"]]",""],u=g+"?models="+a.join("%7C")+"&revids="+r,n=0;a.length>n;n++)l=(100*i.score[n]).toFixed(0),c.unshift("["+u+" "+l+"%]");f+="\n|-\n|"+c.join(" || ")}f+="\n|}",t("#mw-content-text").empty().append(t("<pre>").text(f))}functiono(e){varo=[];t.each(e,function(e,t){varn,i,r={revid:e};for(r.score=[],n=0;a.length>n;n++)i=t[a[n]].score,r.score.push(i&&!i.error?i.probability["true"]:0);o.push(r)}),o=o.sort(function(e,t){returnt.score[0]-e.score[0]}),n(o)}functioni(n,r){vars=20,u=Math.max(1,Math.floor(s/a.length));r=r||0,t.ajax({url:g,data:{models:a.join("|"),revids:n.slice(r,r+u).join("|")},dataType:"json"}).done(function(a){t.extend(c,a[e.config.get("wgDBname")].scores),r+=u,n.length>r?(t("#mw-content-text").html(t("<p></p>").text("Getting scores: "+(r/n.length*100).toFixed(1)+"%")),i(n,r)):o(c)})}functionr(){vare=prompt("Enter a quarry URL returning the JSON with the revids:",u);e&&t.getJSON(e).done(function(e){i(t.map(e.rows,function(e){returne[0]}))})}vara=["damaging","goodfaith"],s=.7,c={},u="https://quarry.wmcloud.org/run/832579/output/0/json",g="//ores.wikimedia.org/v3/scores/"+e.config.get("wgDBname")+"/";e.config.get("wgCanonicalSpecialPageName")==="Blankpage"&&e.config.get("wgTitle").split("/")[1]==="TopRevisionsByScore"&&t.when(e.loader.using(["mediawiki.util","jquery.tablesorter"]),t.ready).then(r)})(mediaWiki,jQuery);
 // </nowiki>

AltStyle によって変換されたページ (->オリジナル) /