更新 infowindow-view.js
This commit is contained in:
parent
28ba40f0c9
commit
7956aacfdf
@ -114,12 +114,6 @@ 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();
|
||||||
@ -171,8 +165,6 @@ var Infowindow = View.extend({
|
|||||||
var hasContent = this._getContent().length;
|
var hasContent = this._getContent().length;
|
||||||
var hasTitle = this.$('.CDB-infowindow-title').length;
|
var hasTitle = this.$('.CDB-infowindow-title').length;
|
||||||
var numberOfFields = this.model.get('content') && this.model.get('content').fields.length;
|
var numberOfFields = this.model.get('content') && this.model.get('content').fields.length;
|
||||||
var hasH5url = this.$('.js-h5url').length;
|
|
||||||
|
|
||||||
|
|
||||||
if (hasCover) {
|
if (hasCover) {
|
||||||
$infowindow
|
$infowindow
|
||||||
@ -304,12 +296,6 @@ var Infowindow = View.extend({
|
|||||||
return !!this.$('.js-infowindow').attr('data-cover');
|
return !!this.$('.js-infowindow').attr('data-cover');
|
||||||
},
|
},
|
||||||
|
|
||||||
//检测视频
|
|
||||||
_containsVideo: function () {
|
|
||||||
return !!this.$('.js-infowindow').attr('data-video');
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
_containsTemplateCover: function () {
|
_containsTemplateCover: function () {
|
||||||
return this.$('.js-cover img').length > 0;
|
return this.$('.js-cover img').length > 0;
|
||||||
},
|
},
|
||||||
@ -380,21 +366,6 @@ var Infowindow = View.extend({
|
|||||||
this._loadCoverFromUrl(url);
|
this._loadCoverFromUrl(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
_loadVideoFromUrl: function (url) {
|
|
||||||
var $cover = this.$('.js-cover');
|
|
||||||
|
|
||||||
this._startCoverLoader();
|
|
||||||
|
|
||||||
var $img = $("<video class='CDB-infowindow-media-item' />");
|
|
||||||
$cover.append($img);
|
|
||||||
|
|
||||||
$img
|
|
||||||
.load(this._onLoadImageSuccess)
|
|
||||||
.error(this._onLoadImageError)
|
|
||||||
.attr('src', url);
|
|
||||||
},
|
|
||||||
|
|
||||||
_loadCoverFromUrl: function (url) {
|
_loadCoverFromUrl: function (url) {
|
||||||
var $cover = this.$('.js-cover');
|
var $cover = this.$('.js-cover');
|
||||||
|
|
||||||
@ -455,25 +426,6 @@ var Infowindow = View.extend({
|
|||||||
return styles;
|
return styles;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
_loadVideo: function () {
|
|
||||||
this._renderCoverLoader();
|
|
||||||
this._startCoverLoader();
|
|
||||||
|
|
||||||
var url = this._getCoverURL();
|
|
||||||
if (this._isLoadingFields()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this._isValidURL(url)) {
|
|
||||||
this._stopCoverLoader();
|
|
||||||
this._showInfowindowVideoError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._loadVideoFromUrl(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
_loadCover: function () {
|
_loadCover: function () {
|
||||||
this._renderCoverLoader();
|
this._renderCoverLoader();
|
||||||
this._startCoverLoader();
|
this._startCoverLoader();
|
||||||
@ -524,11 +476,6 @@ var Infowindow = View.extend({
|
|||||||
this.$('.js-cover').append('<p class="CDB-infowindow-fail">Non-valid picture URL</p>');
|
this.$('.js-cover').append('<p class="CDB-infowindow-fail">Non-valid picture URL</p>');
|
||||||
},
|
},
|
||||||
|
|
||||||
_showInfowindowVideoError: function () {
|
|
||||||
this.$('.js-infowindow').addClass('is-fail');
|
|
||||||
this.$('.js-cover').append('<p class="CDB-infowindow-fail">无效的视频地址</p>');
|
|
||||||
},
|
|
||||||
|
|
||||||
_stopCoverLoader: function () {
|
_stopCoverLoader: function () {
|
||||||
this.$('.js-infowindow').removeClass('is-loading');
|
this.$('.js-infowindow').removeClass('is-loading');
|
||||||
this.$('.js-loader').removeClass('is-visible');
|
this.$('.js-loader').removeClass('is-visible');
|
||||||
|
Loading…
Reference in New Issue
Block a user