Skip to content

Commit

Permalink
Manipulate images only after they're loaded
Browse files Browse the repository at this point in the history
This switches from adding JS functionality after the DOM has
loaded, to adding it after the whole page (including iamges)
has loaded.

Bug: T215187
  • Loading branch information
samwilson committed Feb 6, 2019
1 parent b7146d0 commit 76c52b9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions assets/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ $( function () {
/**
* When a translation field is changed, update the image preview, and also mark the form as unsaved.
*/
$( function () {
$( window ).on( 'load', function () {
$( '.translation-fields .oo-ui-fieldLayout .oo-ui-inputWidget' ).each( function () {
var inputWiget = OO.ui.infuse( $( this ) ),
$imgElement = $( '#translation-image img' ),
Expand Down Expand Up @@ -139,7 +139,7 @@ $( function () {
/**
* Add LeafletJS to image, for zooming and panning.
*/
$( function () {
$( window ).on( 'load', function () {
var imagemap, $imageElement,
$imageWrapper = $( '#translation-image' );
if ( $imageWrapper.length !== 1 ) {
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/assets/entrypoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"assets/app.cdb1250c.css"
],
"js": [
"assets/app.7fd078db.js"
"assets/app.10e4979a.js"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion public/assets/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"assets/app.css": "assets/app.cdb1250c.css",
"assets/app.js": "assets/app.7fd078db.js",
"assets/app.js": "assets/app.10e4979a.js",
"assets/grabbing.cur": "assets/a8c874b93b3d848f39a71260c57e3863.cur",
"assets/grab.cur": "assets/b06c243f534d9c5461d16528156cd5a8.cur",
"assets/i18n/app/af.json": "assets/i18n/app/af.json",
Expand Down

0 comments on commit 76c52b9

Please sign in to comment.