r103549 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103548‎ | r103549 | r103550 >
Date:00:53, 18 November 2011
Author:dale
Status:ok (Comments)
Tags:
Comment:
replaced updatePosterSrc with simple updatePosterSrc method ( no animations between frames )
Modified paths:
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js
@@ -1042,78 +1042,13 @@
10431043 },
10441044
10451045 /**
1046 - * Updates the thumbnail if the thumbnail is being displayed
1047 - *
1048 - * @param {String}
1049 - * src New src of thumbnail
1050 - * @param {Boolean}
1051 - * quickSwitch true switch happens instantly false / undefined
1052 - * animated cross fade
1053 - */
1054 - updatePosterSrc: function( src, quickSwitch ) {
1055 - // make sure we don't go to the same url if we are not already updating:
1056 - if ( !this.thumbnailUpdatingFlag && $( '#img_thumb_' + this.id ).attr( 'src' ) == src )
1057 - return false;
1058 - // if we are already updating don't issue a new update:
1059 - if ( this.thumbnailUpdatingFlag && $( '#new_img_thumb_' + this.id ).attr( 'src' ) == src )
1060 - return false;
1061 -
1062 - mw.log( 'update thumb: ' + src );
1063 -
1064 - if ( quickSwitch ) {
1065 - $( '#img_thumb_' + this.id ).attr( 'src', src );
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();
1072 -
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 )
1096 - .replaceWith( $( '#new_img_thumb_' + _this.id ) )
1097 - .attr( 'id', 'img_thumb_' + _this.id )
1098 - .css( 'z-index', '1' );
1099 -
1100 - _this.thumbnailUpdatingFlag = false;
1101 -
1102 - // if we have a thumb queued update to that
1103 - if ( _this.lastThumbUrl ) {
1104 - var src_url = _this.lastThumbUrl;
1105 - _this.lastThumbUrl = null;
1106 - _this.updatePosterSrc( src_url );
1107 - }
1108 - } );
1109 - }
1110 - },
1111 -
1112 - /**
11131046 * Update the poster source
1114 - * @param {String} url to poster src
1115 - */
 1047+ * @param {String}
 1048+ * posterSrc Poster src url
 1049+ */
11161050 updatePosterSrc: function( posterSrc ){
11171051 this.poster = posterSrc;
 1052+ this.updatePosterHTML();
11181053 },
11191054 /**
11201055 * Update the player with thumbnail and play button.

Comments

#Comment by NeilK (talk | contribs)   00:13, 19 November 2011

Looks ok, but why was this necessary?

#Comment by Mdale (talk | contribs)   02:04, 19 November 2011

it supported animations for poster changes in metavid interfaces see nodes: http://www.mediawiki.org/wiki/TimedMediaHandler/ReviewNotes

Status & tagging log