http://www.mediawiki.org/wiki/Special:Code/MediaWiki/74065

Revision: 74065
Author:   thomasv
Date:     2010-10-01 12:58:14 +0000 (Fri, 01 Oct 2010)

Log Message:
-----------
load image after page setup

Modified Paths:
--------------
    trunk/extensions/ProofreadPage/proofread.js

Modified: trunk/extensions/ProofreadPage/proofread.js
===================================================================
--- trunk/extensions/ProofreadPage/proofread.js 2010-10-01 11:23:42 UTC (rev 
74064)
+++ trunk/extensions/ProofreadPage/proofread.js 2010-10-01 12:58:14 UTC (rev 
74065)
@@ -666,9 +666,9 @@
        pr_zoom( 0 );
 }
 
-function pr_load_image( view_url ) {
+function pr_load_image( ) {
        pr_container.innerHTML = '<img id="ProofReadImage" src="' +
-               escapeQuotesHTML( view_url ) + '" width="' + img_width + '" />';
+               escapeQuotesHTML( self.proofreadPageViewURL ) + '" width="' + 
img_width + '" />';
        pr_zoom( 0 );
 }
 
@@ -721,7 +721,7 @@
                if( !w ) {
                        w = 1024; /* Default size in edit mode */
                }
-               var view_url = pr_image_url( Math.min( w, 
self.proofreadPageWidth ) );
+               self.proofreadPageViewURL = pr_image_url( Math.min( w, 
self.proofreadPageWidth ) );
                // prevent the container from being resized once the image is 
downloaded.
                img_width = pr_horiz ? 0 : parseInt( pr_width / 2 - 70 ) - 20;
                pr_container.onmousedown = pr_grab;
@@ -730,7 +730,8 @@
                        pr_container.addEventListener( 'DOMMouseScroll', 
pr_zoom_wheel, false );
                }
                pr_container.onmousewheel = pr_zoom_wheel; // IE, Opera.
-               pr_load_image( view_url );
+               /* Load the image after page setup, so that user-defined hooks 
do not have to wait for it. */
+               hookEvent( 'load', pr_load_image );
        }
 
        table.setAttribute( 'id', 'textBoxTable' );



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to