更新 infowindow-view.js

This commit is contained in:
钟进 2020-06-13 13:36:44 +00:00
parent 7956aacfdf
commit 72663aac2d

View File

@ -114,6 +114,10 @@ var Infowindow = View.extend({
this._loadCover(); this._loadCover();
} }
if (this._containsVideo()) {
this._loadVideo();
}
this._setupClasses(); this._setupClasses();
this._renderScroll(); this._renderScroll();
this._renderShadows(); this._renderShadows();
@ -123,6 +127,36 @@ var Infowindow = View.extend({
return this; return this;
}, },
// video add
_containsVideo: function () {
return !!this.$('.js-infowindow').attr('data-video');
},
_loadVideo: function () {
this._renderCoverLoader();
this._startCoverLoader();
var url = this._getCoverURL();
if (this._isLoadingFields()) {
return;
}
if (!this._isValidURL(url)) {
this._stopCoverLoader();
this._showInfowindowImageError();
return;
}
if (this._containsTemplateCover()) {
this._loadCoverFromTemplate(url);
} else {
this._loadCoverFromUrl(url);
}
},
// end video
_initBinds: function () { _initBinds: function () {
_.bindAll(this, '_onKeyUp', '_onLoadImageSuccess', '_onLoadImageError'); _.bindAll(this, '_onKeyUp', '_onLoadImageSuccess', '_onLoadImageError');