Author(s) | Enterprisey |
---|---|
Status | Stable |
Updated | November 7, 2019 |
Browsers | Firefox |
Skins | Vector |
Source | User: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
editHint: 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:
- Place
{{subst:iusc|User:Enterprisey/parsoid-jump.js}}
on Special:MyPage/common.js or a skin-specific page, like Special:MyPage/vector.js. - Clear your cache and enjoy!
Declaring a dependency
editLike this:
$.getScript('https://en.wiki.x.io/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
});