Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js |
— | — | @@ -159,7 +159,7 @@ |
160 | 160 | |
161 | 161 | // Thumbnail updating flag ( to avoid rewriting an thumbnail thats already |
162 | 162 | // being updated) |
163 | | - 'thumbnail_updating' : false, |
| 163 | + 'thumbnailUpdatingFlag' : false, |
164 | 164 | |
165 | 165 | // Poster display flag |
166 | 166 | 'posterDisplayed' : true, |
— | — | @@ -1024,7 +1024,7 @@ |
1025 | 1025 | 't' : mw.seconds2npt( floatSeconds + parseInt( this.startOffset ) ) |
1026 | 1026 | } |
1027 | 1027 | ); |
1028 | | - if ( !this.thumbnail_updating ) { |
| 1028 | + if ( !this.thumbnailUpdatingFlag ) { |
1029 | 1029 | this.updatePoster( this.lastThumbUrl , false ); |
1030 | 1030 | this.lastThumbUrl = null; |
1031 | 1031 | } |
— | — | @@ -1047,64 +1047,65 @@ |
1048 | 1048 | * @param {String} |
1049 | 1049 | * src New src of thumbnail |
1050 | 1050 | * @param {Boolean} |
1051 | | - * quick_switch true switch happens instantly false / undefined |
| 1051 | + * quickSwitch true switch happens instantly false / undefined |
1052 | 1052 | * animated cross fade |
1053 | 1053 | */ |
1054 | | - updatePosterSrc: function( src, quick_switch ) { |
| 1054 | + updatePosterSrc: function( src, quickSwitch ) { |
1055 | 1055 | // make sure we don't go to the same url if we are not already updating: |
1056 | | - if ( !this.thumbnail_updating && $( '#img_thumb_' + this.id ).attr( 'src' ) == src ) |
| 1056 | + if ( !this.thumbnailUpdatingFlag && $( '#img_thumb_' + this.id ).attr( 'src' ) == src ) |
1057 | 1057 | return false; |
1058 | 1058 | // if we are already updating don't issue a new update: |
1059 | | - if ( this.thumbnail_updating && $( '#new_img_thumb_' + this.id ).attr( 'src' ) == src ) |
| 1059 | + if ( this.thumbnailUpdatingFlag && $( '#new_img_thumb_' + this.id ).attr( 'src' ) == src ) |
1060 | 1060 | return false; |
1061 | 1061 | |
1062 | 1062 | mw.log( 'update thumb: ' + src ); |
1063 | 1063 | |
1064 | | - if ( quick_switch ) { |
| 1064 | + if ( quickSwitch ) { |
1065 | 1065 | $( '#img_thumb_' + this.id ).attr( 'src', src ); |
1066 | | - } else { |
1067 | | - var _this = this; |
1068 | | - // if still animating remove new_img_thumb_ |
1069 | | - if ( this.thumbnail_updating == true ) |
1070 | | - $( '#new_img_thumb_' + this.id ).stop().remove(); |
| 1066 | + return ; |
| 1067 | + } |
| 1068 | + var _this = this; |
| 1069 | + // if still animating remove new_img_thumb_ |
| 1070 | + if ( this.thumbnailUpdatingFlag == true ) |
| 1071 | + $( '#new_img_thumb_' + this.id ).stop().remove(); |
1071 | 1072 | |
1072 | | - if ( this.posterDisplayed ) { |
1073 | | - mw.log( 'set to thumb:' + src ); |
1074 | | - this.thumbnail_updating = true; |
1075 | | - $( this ).append( |
1076 | | - $('<img />') |
1077 | | - .attr({ |
1078 | | - 'src' : src, |
1079 | | - 'id' : 'new_img_thumb_' + this.id, |
1080 | | - 'width' : this.width, |
1081 | | - 'height': this.height |
1082 | | - }) |
1083 | | - .css( { |
1084 | | - 'display' : 'none', |
1085 | | - 'position' : 'absolute', |
1086 | | - 'z-index' : 2, |
1087 | | - 'top' : '0px', |
1088 | | - 'left' : '0px' |
1089 | | - }) |
1090 | | - ); |
1091 | | - // mw.log('appended: new_img_thumb_'); |
1092 | | - $( '#new_img_thumb_' + this.id ).fadeIn( "slow", function() { |
1093 | | - // once faded in remove org and rename new: |
1094 | | - $( '#img_thumb_' + _this.id ).remove(); |
1095 | | - $( '#new_img_thumb_' + _this.id ).attr( 'id', 'img_thumb_' + _this.id ); |
1096 | | - $( '#img_thumb_' + _this.id ).css( 'z-index', '1' ); |
1097 | | - _this.thumbnail_updating = false; |
| 1073 | + if ( this.posterDisplayed ) { |
| 1074 | + mw.log( 'set to thumb:' + src ); |
| 1075 | + this.thumbnailUpdatingFlag = true; |
| 1076 | + $( this ).append( |
| 1077 | + $('<img />') |
| 1078 | + .attr({ |
| 1079 | + 'src' : src, |
| 1080 | + 'id' : 'new_img_thumb_' + this.id, |
| 1081 | + 'width' : this.width, |
| 1082 | + 'height': this.height |
| 1083 | + }) |
| 1084 | + .css( { |
| 1085 | + 'display' : 'none', |
| 1086 | + 'position' : 'absolute', |
| 1087 | + 'z-index' : 2, |
| 1088 | + 'top' : '0px', |
| 1089 | + 'left' : '0px' |
| 1090 | + }) |
| 1091 | + ); |
| 1092 | + // mw.log('appended: new_img_thumb_'); |
| 1093 | + $( '#new_img_thumb_' + this.id ).fadeIn( "slow", function() { |
| 1094 | + // once faded in remove org and rename new: |
| 1095 | + $( '#img_thumb_' + _this.id ).remove(); |
| 1096 | + $( '#new_img_thumb_' + _this.id ).attr( 'id', 'img_thumb_' + _this.id ); |
| 1097 | + $( '#img_thumb_' + _this.id ).css( 'z-index', '1' ); |
| 1098 | + _this.thumbnailUpdatingFlag = false; |
1098 | 1099 | |
1099 | | - // if we have a thumb queued update to that |
1100 | | - if ( _this.lastThumbUrl ) { |
1101 | | - var src_url = _this.lastThumbUrl; |
1102 | | - _this.lastThumbUrl = null; |
1103 | | - _this.updatePosterSrc( src_url ); |
1104 | | - } |
1105 | | - } ); |
1106 | | - } |
| 1100 | + // if we have a thumb queued update to that |
| 1101 | + if ( _this.lastThumbUrl ) { |
| 1102 | + var src_url = _this.lastThumbUrl; |
| 1103 | + _this.lastThumbUrl = null; |
| 1104 | + _this.updatePosterSrc( src_url ); |
| 1105 | + } |
| 1106 | + } ); |
1107 | 1107 | } |
1108 | 1108 | }, |
| 1109 | + |
1109 | 1110 | /** |
1110 | 1111 | * Update the poster source |
1111 | 1112 | * @param {String} url to poster src |