Make media.view.VideoDetails.prepareSrc a static class method instead of an instance method. Properly pairs it with its incrementing instances property.

See #27389.



git-svn-id: https://develop.svn.wordpress.org/trunk@27535 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-03-14 12:42:57 +00:00
parent 86722dfaaa
commit 12792afdde

View File

@ -6569,26 +6569,6 @@
}, this.options );
},
/**
* When multiple players in the DOM contain the same src, things get weird.
*
* @param {HTMLElement} media
* @returns {HTMLElement}
*/
prepareSrc : function (media) {
var i = wp.media.view.MediaDetails.instances++;
_.each( $(media).find('source'), function (source) {
source.src = [
source.src,
source.src.indexOf('?') > -1 ? '&' : '?',
'_=',
i
].join('');
});
return media;
},
removeSetting : function (e) {
var wrap = $( e.currentTarget ).parent(), setting;
@ -6702,7 +6682,27 @@
this.$( '.embed-media-settings' ).scrollTop( 0 );
}
}, {
instances : 0
instances : 0,
/**
* When multiple players in the DOM contain the same src, things get weird.
*
* @param {HTMLElement} media
* @returns {HTMLElement}
*/
prepareSrc : function (media) {
var i = wp.media.view.MediaDetails.instances++;
_.each( $(media).find('source'), function (source) {
source.src = [
source.src,
source.src.indexOf('?') > -1 ? '&' : '?',
'_=',
i
].join('');
});
return media;
}
});
/**
@ -6727,7 +6727,7 @@
if ( audio.is(':hidden') ) {
audio.show();
}
this.media = this.prepareSrc( audio.get(0) );
this.media = media.view.MediaDetails.prepareSrc( audio.get(0) );
} else {
audio.hide();
this.media = false;
@ -6761,7 +6761,7 @@
}
if ( ! video.hasClass('youtube-video') ) {
this.media = this.prepareSrc( video.get(0) );
this.media = media.view.MediaDetails.prepareSrc( video.get(0) );
} else {
this.media = video.get(0);
}