parsoid-jump
Author(s)Enterprisey
StatusStable
UpdatedNovember 7, 2019; 4 years ago (2019-11-07)
Browser supportFirefox
Skin supportVector
SourceUser:Enterprisey/parsoid-jump.js

Useful little utility for jumping to arbitrary elements quickly. For user script developers: if the query string of the current URL sets parsoid_jump=SOME_ID, this script jumps (on page load) to the element assigned SOME_ID in the mw:Parsoid version of the current page's HTML. Let's say your script just edited the element mwXY and you want to reload and show the user what happened. You would declare a dependency on this script and, at runtime, reload the page, tacking on ?parsoid_jump=mwXY to the end of the URL. You can also set the parsoid_jump cookie, if you don't want to change the URL.

For users: you might not need to install this script manually. But if some script or link keeps putting parsoid_jump=whatever in your URLs and your browser stubbornly remains at the top of the page, installing this script might help with that.

User:Enterprisey/reply-link uses this script to jump to comments that it inserts after reloading the page.

Installation instructions edit

Hint: It's much easier if you get ScriptInstaller, then navigate to User:Enterprisey/parsoid-jump.js and click "Install" at the top.

However, here's the manual method:

  1. Place {{subst:iusc|User:Enterprisey/parsoid-jump.js}} on Special:MyPage/common.js or a skin-specific page, like Special:MyPage/vector.js.
  2. Clear your cache and enjoy!

Declaring a dependency edit

Like this:

$.getScript('https://en.wikipedia.org/w/index.php?title=User:Enterprisey/parsoid-jump.js&action=raw&ctype=text%2Fjavascript').done( function() {
    // if there's a parsoid_jump=whatever in the query string, it'll jump there now
});

See also edit