更新 infowindow-view.js
This commit is contained in:
parent
72663aac2d
commit
f08c99fd29
@ -143,9 +143,9 @@ var Infowindow = View.extend({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this._isValidURL(url)) {
|
if (!this._isValidVideoURL(url)) {
|
||||||
this._stopCoverLoader();
|
this._stopCoverLoader();
|
||||||
this._showInfowindowImageError();
|
this._showInfowindowVideoError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,6 +155,20 @@ var Infowindow = View.extend({
|
|||||||
this._loadCoverFromUrl(url);
|
this._loadCoverFromUrl(url);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_isValidVideoURL: function (url) {
|
||||||
|
if (url) {
|
||||||
|
var urlPattern = /^(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-|]*[\w@?^=%&\/~+#-])?$/;
|
||||||
|
return String(url).match(urlPattern) !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
_showInfowindowVideoError: function () {
|
||||||
|
this.$('.js-infowindow').addClass('is-fail');
|
||||||
|
this.$('.js-cover').append('<p class="CDB-infowindow-fail">Non-valid Video URL</p>');
|
||||||
|
},
|
||||||
// end video
|
// end video
|
||||||
|
|
||||||
_initBinds: function () {
|
_initBinds: function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user