diff --git a/src/geo/ui/infowindow-view.js b/src/geo/ui/infowindow-view.js index e3937b1..9ded391 100644 --- a/src/geo/ui/infowindow-view.js +++ b/src/geo/ui/infowindow-view.js @@ -143,9 +143,9 @@ var Infowindow = View.extend({ return; } - if (!this._isValidURL(url)) { + if (!this._isValidVideoURL(url)) { this._stopCoverLoader(); - this._showInfowindowImageError(); + this._showInfowindowVideoError(); return; } @@ -155,6 +155,20 @@ var Infowindow = View.extend({ 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('
Non-valid Video URL
'); + }, // end video _initBinds: function () {