r74065 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74064‎ | r74065 | r74066 >
Date:12:58, 1 October 2010
Author:thomasv
Status:ok
Tags:
Comment:
load image after page setup
Modified paths:
  • /trunk/extensions/ProofreadPage/proofread.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/proofread.js
@@ -666,9 +666,9 @@
667667 pr_zoom( 0 );
668668 }
669669
670 -function pr_load_image( view_url ) {
 670+function pr_load_image( ) {
671671 pr_container.innerHTML = '<img id="ProofReadImage" src="' +
672 - escapeQuotesHTML( view_url ) + '" width="' + img_width + '" />';
 672+ escapeQuotesHTML( self.proofreadPageViewURL ) + '" width="' + img_width + '" />';
673673 pr_zoom( 0 );
674674 }
675675
@@ -721,7 +721,7 @@
722722 if( !w ) {
723723 w = 1024; /* Default size in edit mode */
724724 }
725 - var view_url = pr_image_url( Math.min( w, self.proofreadPageWidth ) );
 725+ self.proofreadPageViewURL = pr_image_url( Math.min( w, self.proofreadPageWidth ) );
726726 // prevent the container from being resized once the image is downloaded.
727727 img_width = pr_horiz ? 0 : parseInt( pr_width / 2 - 70 ) - 20;
728728 pr_container.onmousedown = pr_grab;
@@ -730,7 +730,8 @@
731731 pr_container.addEventListener( 'DOMMouseScroll', pr_zoom_wheel, false );
732732 }
733733 pr_container.onmousewheel = pr_zoom_wheel; // IE, Opera.
734 - pr_load_image( view_url );
 734+ /* Load the image after page setup, so that user-defined hooks do not have to wait for it. */
 735+ hookEvent( 'load', pr_load_image );
735736 }
736737
737738 table.setAttribute( 'id', 'textBoxTable' );

Status & tagging log