// 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 );
} );
}
});
})();