Page MenuHomePhabricator

Add the Page History Gadget to new XTools
Closed, ResolvedPublic5 Estimated Story Points

Description

Old XTools has a gadget that dynamically loads an info bar at the top of every wiki page, showing a subset of the information from the Page History tool:

  1. the number of revisions
  2. how long ago the last revision was
  3. the number of contributors
  4. the number of watchers
  5. pageviews for the last 30 days
  6. who created the page
  7. the creator's global edit count
  8. the 'main author' (Hauptautor)
  9. a drop-down list of:
    1. checkwiki
    2. Wikidata
    3. language tool
    4. dead links

There's more to add to this list.

Gadget documentation: https://meta.wikimedia.org/wiki/User:Hedonil/XTools

Existing gadget code: https://meta.wikimedia.org/wiki/User:Hedonil/XTools/XTools.js

Event Timeline

PR at https://github.com/x-tools/xtools/pull/72

This covers everything but:

  • "the creator's global edit count" – I don't think this is very useful. Instead I have it showing the edit count for the current wiki they are on.
  • "the 'main author'" – I think maybe this means the most prolific editor to the page? This would be nice to show, but I don't think it's very cheap, and you must remember this gadget makes these queries on every page the user loads on the wiki.
  • "drop-down list" – These are probably rarely checked, and again aren't super cheap to fetch, and the language tool is defunct. If we really want it I can add wikidata and checkwiki errors, but instead I'm just making the "See full page statistics" a link to the ArticleInfo tool, where the user can get all the data their heart desires :)

I should also mention the new set of queries for the API are not cached. The queries in their current fashion are pretty quick, and the likelihood of someone loading the same page over and over is slim, which I think would make caching do more harm than good in terms of disk space (or memory once we get Redis going). One exception is when the user is editing the page – in which case they'd probably expect the stats to be updated.

I need this to get merged before I can work on the on-wiki gadget (which will be pretty straightforward). We might also end up moving the JS to into version control.

MusikAnimal set the point value for this task to 5.
MusikAnimal moved this task from Ready to Needs Review/Feedback on the Community-Tech-Sprint board.
MusikAnimal moved this task from Pending Review to Pending deployment on the XTools board.
MusikAnimal moved this task from Pending deployment to Working on the XTools board.

Actually, let me finish this gadget before closing.

MusikAnimal moved this task from Working to Pending Review on the XTools board.

Need to get one more PR in for this to work, which includes a bit of unrelated code: https://github.com/x-tools/xtools/pull/75

I have a working gadget, too (but the PR has to be merged first): https://en.wikipedia.org/wiki/User:MusikAnimal/xtools.js

Gadget is working! But there's a bug T172915

Will work on this now and hopefully release a hotfix today.

Looks great! Works for me (including in other skins, other projects). It's fast.

The only nitpick I can find is that the pageviews number is not included in the link, so it makes the number look like it might be a different thing.

I guess the script will end up at https://meta.wikimedia.org/wiki/MediaWiki:XTools.js ?

The only nitpick I can find is that the pageviews number is not included in the link, so it makes the number look like it might be a different thing.

Fixed with #87, as you know :)

I guess the script will end up at https://meta.wikimedia.org/wiki/MediaWiki:XTools.js ?

Going by convention I think it would be MediaWiki:Gadget-XTools.js, assuming we'd want this to be a proper gadget and not a user script. That might also mean we need to get some rough consensus for it, which shouldn't be hard :) What I did for MoreMenu was make a protected edit request at MediaWiki talk:Gadgets-definition and notify people at Meta:Babel.

Oh yes of course! I forgot (not sure how) that it's going to be a proper gadget. :-) Although, still installable in global.js on Meta as well (which is where I've got it).

Alrighty, I've made a protected edit request to add this at a gadget on Meta: https://meta.wikimedia.org/wiki/MediaWiki_talk:Gadgets-definition#XTools_ArticleInfo_gadget

Babel discussion: https://meta.wikimedia.org/wiki/Meta:Babel#XTools_ArticleInfo_gadget

We talked on IRC about moving the script source to Meta since it's WMF-specific (as coded), but having it as a subpage of our primary wiki home at mw:XTools just feels right to me. Hope this OK :) I figure we can just explain how to adjust the script to work on the third-party wiki, which only requires modifying the API endpoint. With #90, users will even be able to browse to an endpoint within XTools to get a working version of the script for their installation. I can update the on-wiki documentation if/when that PR is merged.

MusikAnimal closed this task as Resolved.EditedSep 6 2017, 3:53 PM

Deployed. See https://xtools.wmflabs.org/articleinfo-gadget.js and https://xtools.wmflabs.org/articleinfo-gadget.js?uglify=1

The gadget is now live on Meta and English Wikipedia, but can be sourced in your global.js to be functional on all wikis.

I have made a protected edit request to have the old script source the new one (permalink)