User:Sohom Datta/openseadragon minimap.js
(Redirected from User:Sohom data/openseadragon minimap.js)
Note: After saving, changes may not occur immediately. Click here to learn how to bypass your browser's cache.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Cmd-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (Cmd-Shift-R on a Mac)
- Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Clear the cache in Tools → Preferences
For details and instructions about other browsers, see Wikipedia:Bypass your cache.
Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the central discussion page, Scriptorium. The code will be executed when previewing this page under some skins, including Monobook. You can in the interim if you wish to refresh the content sooner under another skin. |
Documentation for this script can be added at User:Sohom Datta/openseadragon minimap. |
// Demo script for changes to the ProofreadPage Openseadragon API in {{gerrit|852322}}
(function(){
// We have our Openseadragon object here, so we can go ahead and hook into it's API
function initialize( openseadragon ) {
// Our objective is to add a minimap for Openseadragon
// Based on the documentation at https://openseadragon.github.io/docs/OpenSeadragon.html#.Options
// We effectively need to set showNavigator: true in the options.
// We use the 'prp-osd-before-creation' hook to modify the parameters that will
// be used to initialize Openseadragon.
openseadragon.on( 'prp-osd-before-creation', function ( osdParams ) {
osdParams['showNavigator'] = true;
} );
// In case Openseadragon has already been initialized, force it
// to initialize again
openseadragon.forceInitialize();
}
// We make sure that we are loading after 'ext.proofreadpage.page.edit'
// (which initializes Openseadragon)
mw.loader.using(['ext.proofreadpage.page.edit'], function () {
if ( mw.proofreadpage.openseadragon ) {
// We have already initialized Openseadragon here
initialize( mw.proofreadpage.openseadragon );
} else {
// Alternatively wait for the 'ext.proofreadpage.osd-controller-available' hook to be fired
// and then initialize our script
mw.hook( 'ext.proofreadpage.osd-controller-available', function () {
initialize( mw.proofreadpage.openseadragon );
} );
}
});
})();