diff --git a/css/app.css b/css/app.css index fec7d21e..5edb0047 100644 --- a/css/app.css +++ b/css/app.css @@ -1410,7 +1410,7 @@ sidebar .play .poster img.big-poster { height: 100%; border-radius: 4px; } -sidebar .play a.play-button { +sidebar .play a.play-button, a.trailer-button { text-align: center; color: #FFF; font-weight: bold; @@ -1424,7 +1424,7 @@ sidebar .play a.play-button { text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); background: #cc181e; } -sidebar .play a.play-button:hover { +sidebar .play a.play-button:hover, a.trailer-button:hover { background: #eb282e; } sidebar .play .movie-detail { @@ -1740,7 +1740,7 @@ sidebar .play .movie-detail .side-content .subtitles-list ul li .flag.flag-hunga sidebar .play .movie-detail .side-content .subtitles-list ul li .flag.flag-bulgarian { background-image: url(../images/bulgarian.png); } -sidebar .play .movie-detail .side-content a.play-button { +sidebar .play .movie-detail .side-content a.play-button, a.trailer-button { background: #286dc4; background-image: linear-gradient(to bottom, #3076ce 0%, #175ab0 100%); color: #FFF; @@ -1752,7 +1752,7 @@ sidebar .play .movie-detail .side-content a.play-button { margin-top: 10px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); } -sidebar .play .movie-detail .side-content a.play-button:hover { +sidebar .play .movie-detail .side-content a.play-button:hover, a.trailer-button:hover { background-image: linear-gradient(to bottom, #4387de 0%, #175ab0 100%); } diff --git a/index.html b/index.html index cf5b5b34..dde17c0c 100644 --- a/index.html +++ b/index.html @@ -131,6 +131,12 @@

<%= i18n.__('subtitledIn') %>

<% if (this.model.get('torrents')) { %> <%= i18n.__('watchItNow') %> <% } %> + + <% if (this.model.get('trailer')) { %> + <%= i18n.__('trailer') %> + <% } %> + + @@ -173,8 +179,6 @@

<%= i18n.__('subtitledIn') %>

- - @@ -182,6 +186,11 @@

<%= i18n.__('subtitledIn') %>

+ + + + + @@ -200,8 +209,8 @@

<%= i18n.__('subtitledIn') %>

+ - diff --git a/js/app.js b/js/app.js index 6fa879aa..0c75335a 100644 --- a/js/app.js +++ b/js/app.js @@ -145,7 +145,6 @@ if( ! Settings.get('disclaimerAccepted') ) { $('.popcorn-disclaimer .btn.confirmation.continue').click(function(event){ event.preventDefault(); - userTracking.event('App Disclaimer', 'Accepted', navigator.language.toLowerCase() ).send(); Settings.set('disclaimerAccepted', 1); $('.popcorn-disclaimer').addClass('hidden'); }); @@ -157,7 +156,6 @@ if( ! Settings.get('disclaimerAccepted') ) { if( $('.popcorn-disclaimer').hasClass('quitting') ){ return; } $('.popcorn-disclaimer').addClass('quitting'); - userTracking.event('App Disclaimer', 'Quit', navigator.language.toLowerCase() ).send(); setTimeout(function(){ gui.App.quit(); }, 2000); diff --git a/js/frontend/controllers/filter.js b/js/frontend/controllers/filter.js index ba259e52..0742b661 100644 --- a/js/frontend/controllers/filter.js +++ b/js/frontend/controllers/filter.js @@ -18,8 +18,6 @@ App.Controller.FilterGenre = function (genre, page) { App.Page.FilterGenre.show(); } - userTracking.pageview('/movies/'+genre + ((page && page > 1) ? '?page='+page : ''), genre.capitalize() + ' Movies').send(); - setTimeout(function(){ movieList.constructor.busy = false; }, 5000); diff --git a/js/frontend/controllers/home.js b/js/frontend/controllers/home.js index ad4ccf53..3e4c0cd2 100644 --- a/js/frontend/controllers/home.js +++ b/js/frontend/controllers/home.js @@ -21,8 +21,6 @@ App.Controller.Home = function (page) { App.Page.Home.show(); } - - userTracking.pageview('/movies/popular'+((page && page > 1) ? '?page='+page : ''), 'Popular Movies').send(); setTimeout(function(){ movieList.constructor.busy = false; diff --git a/js/frontend/controllers/search.js b/js/frontend/controllers/search.js index f1f4a1a1..4a38c816 100644 --- a/js/frontend/controllers/search.js +++ b/js/frontend/controllers/search.js @@ -22,8 +22,6 @@ App.Controller.Search = function (searchTerm, page) { App.Page.Search.show(); } - userTracking.pageview('/movies/search?q='+encodeURIComponent(searchTerm)+((page && page > 1) ? '&page='+page : '')).send(); - setTimeout(function(){ movieList.constructor.busy = false; }, 5000); diff --git a/js/frontend/models/movie.js b/js/frontend/models/movie.js index 2c8c1da9..9030c49a 100644 --- a/js/frontend/models/movie.js +++ b/js/frontend/models/movie.js @@ -63,8 +63,8 @@ App.Model.Movie = Backbone.Model.extend({ initialize: function () { this.buildBasicView(); - //this.setRottenInfo(); - //this.setSubtitles(); + this.setRottenInfo(); + this.setSubtitles(); this.calculateTorrentHealth(); }, diff --git a/js/frontend/player.js b/js/frontend/player.js index 351f4e06..911f217c 100644 --- a/js/frontend/player.js +++ b/js/frontend/player.js @@ -125,7 +125,7 @@ window.spawnVideoPlayer = function (url, subs, movieModel) { var player = '' + ''; @@ -146,22 +146,31 @@ window.spawnVideoPlayer = function (url, subs, movieModel) { $('.vjs-fullscreen-control').trigger('click'); }); - // Init video. - var video = window.videoPlaying = videojs('video_player', { plugins: { biggerSubtitle : {}, smallerSubtitle : {}, customSubtitles: {} }}); - + // Youtube support (for trailers) + if(!movieModel) { + var options = { + techOrder: ["html5", "youtube"], + forceSSL: true, + loop: true + }; + } else { + var options = { + techOrder: ["html5"], + plugins: { biggerSubtitle : {}, smallerSubtitle : {}, customSubtitles: {} } + }; + } - userTracking.pageview('/movies/watch/'+movieModel.get('slug'), movieModel.get('niceTitle') ).send(); + // Init video. + var video = window.videoPlaying = videojs('video_player', options); // Enter full-screen $('.vjs-fullscreen-control').on('click', function () { if(win.isFullscreen) { win.leaveFullscreen(); - userTracking.event('Video Size', 'Normal', movieModel.get('niceTitle') ).send(); win.focus(); } else { win.enterFullscreen(); - userTracking.event('Video Size', 'Fullscreen', movieModel.get('niceTitle') ).send(); win.focus(); } }); @@ -171,7 +180,6 @@ window.spawnVideoPlayer = function (url, subs, movieModel) { if (e.keyCode == 27) { if(win.isFullscreen) { win.leaveFullscreen(); - userTracking.event('Video Size', 'Normal', movieModel.get('niceTitle') ).send(); win.focus(); } } @@ -183,7 +191,6 @@ window.spawnVideoPlayer = function (url, subs, movieModel) { tracks[i].on('loaded', function(){ // Trigger a resize to get the subtitles position right $(window).trigger('resize'); - userTracking.event('Video Subtitles', 'Select '+ this.language_, movieModel.get('niceTitle') ).send(); }); } @@ -207,7 +214,6 @@ window.spawnVideoPlayer = function (url, subs, movieModel) { if( typeof video == 'undefined' || video == null ){ clearInterval(statusReportInterval); return; } - userTracking.event('Video Playing', movieModel.get('niceTitle'), getTimeLabel(), Math.round(video.currentTime()/60) ).send(); }, 1000*60*10); @@ -215,14 +221,6 @@ window.spawnVideoPlayer = function (url, subs, movieModel) { // Close player $('#video_player_close').on('click', function () { - // Determine if the user quit because he watched the entire movie - // Give 15 minutes or 15% of the movie for credits (everyone quits there) - if( video.duration() > 0 && video.currentTime() >= Math.min(video.duration() * 0.85, video.duration() - 15*60) ) { - userTracking.event('Video Finished', movieModel.get('niceTitle'), getTimeLabel(), Math.round(video.currentTime()/60) ).send(); - } - else { - userTracking.event('Video Quit', movieModel.get('niceTitle'), getTimeLabel(), Math.round(video.currentTime()/60) ).send(); - } // Clear the status report interval so it doesn't leak clearInterval(statusReportInterval); @@ -240,14 +238,12 @@ window.spawnVideoPlayer = function (url, subs, movieModel) { // Todo: delay these tracking events so we don't send two on double click video.player().on('pause', function () { - //userTracking.event('Video Control', 'Pause Button', getTimeLabel(), Math.round(video.currentTime()/60) ).send(); }); video.player().on('play', function () { // Trigger a resize so the subtitles are adjusted $(window).trigger('resize'); - //userTracking.event('Video Control', 'Play Button', getTimeLabel(), Math.round(video.currentTime()/60) ).send(); }); // There was an issue with the video diff --git a/js/frontend/providers/torrents.js b/js/frontend/providers/torrents.js index ab21f355..f44d9ef8 100644 --- a/js/frontend/providers/torrents.js +++ b/js/frontend/providers/torrents.js @@ -1,6 +1,95 @@ App.getTorrentsCollection = function (options) { - var url = 'http://subapi.com/'; + var start = +new Date(), + url = 'http://yts.re/api/list.json?sort=seeds&limit=50'; + + if (options.keywords) { + url += '&keywords=' + options.keywords; + } + + if (options.genre) { + url += '&genre=' + options.genre; + } + + if (options.page && options.page.match(/\d+/)) { + url += '&set=' + options.page; + } + + var MovieTorrentCollection = Backbone.Collection.extend({ + url: url, + model: App.Model.Movie, + parse: function (data) { + var movies = [], + memory = {}; + + if (data.error || typeof data.MovieList === 'undefined') { + return movies; + } + + data.MovieList.forEach(function (movie) { + // No imdb, no movie. + if( typeof movie.ImdbCode != 'string' || movie.ImdbCode.replace('tt', '') == '' ){ return; } + + var torrents = {}; + torrents[movie.Quality] = movie.TorrentUrl; + + // Temporary object + var movieModel = { + imdb: movie.ImdbCode.replace('tt', ''), + title: movie.MovieTitleClean, + year: movie.MovieYear, + runtime: 0, + synopsis: "", + voteAverage:parseInt(movie.MovieRating, 10), + + image: movie.CoverImage, + bigImage: movie.CoverImage, + backdrop: "", + + quality: movie.Quality, + torrent: movie.TorrentUrl, + torrents: torrents, + videos: {}, + subtitles: {}, + seeders: movie.TorrentSeeds, + leechers: movie.TorrentPeers + }; + + + var stored = memory[movieModel.imdb]; + + // Create it on memory map if it doesn't exist. + if (typeof stored === 'undefined') { + stored = memory[movieModel.imdb] = movieModel; + } + + if (stored.quality !== movieModel.quality && movieModel.quality === '720p') { + stored.torrent = movieModel.torrent; + stored.quality = '720p'; + } + + // Set it's correspondent quality torrent URL. + stored.torrents[movie.Quality] = movie.TorrentUrl; + + // Push it if not currently on array. + if (movies.indexOf(stored) === -1) { + movies.push(stored); + } + }); + + console.log('Torrents found:', data.MovieList.length); + + return movies; + } + }); + + return new MovieTorrentCollection(); +}; + + +/*App.getTorrentsCollection = function (options) { + + var url = 'http://yts.re/api/'; var supportedLanguages = ['english', 'french', 'dutch', 'portuguese', 'romanian', 'spanish', 'turkish', 'brazilian', 'italian', 'german', 'hungarian', 'russian', 'ukrainian', 'finnish', 'bulgarian', 'latvian']; @@ -59,6 +148,7 @@ App.getTorrentsCollection = function (options) { } if( (typeof movie.subtitles == 'undefined' || movie.subtitles.length == 0) && (typeof movie.videos == 'undefined' || movie.videos.length == 0) ){ return; } + movies.push({ imdb: movie.imdb_id, @@ -88,3 +178,4 @@ App.getTorrentsCollection = function (options) { return new MovieTorrentCollection(); }; +*/ \ No newline at end of file diff --git a/js/frontend/providers/trailersapi.js b/js/frontend/providers/trailersapi.js new file mode 100644 index 00000000..cf75194e --- /dev/null +++ b/js/frontend/providers/trailersapi.js @@ -0,0 +1,61 @@ +var request = require('request'), + + trailerFetchStyle = 'direct', + + magicWords = 'hd trailer'; + +App.findTrailer = function (model, callback) { + var doRequest = function () { + var title = model.get('title'), + year = model.get('year'); + + switch (trailerFetchStyel) { + case 'direct': + var requestOptions = { + url: 'https://gdata.youtube.com/feeds/api/videos?q=' + encodeURI(title + ' ' + year + ' '+ magicWords+'&max-results=1&alt=json') + }; + + request(requestOptions, function(error, response, json) { + if (!error && response.statusCode == 200) { + try { + var trailer = /(watch\?)\??v?=?([^#\&\?]*).*/.exec(JSON.parse(json).feed.entry[0].link[0].href)[2]; + App.Cache.setItem('trailer', model, trailer); + model.set('trailer', trailer); + callback(trailer); + } catch(e) { + return; + } + } + }); + + break; + default: // trailersapi.com + var requestOptions = { + url: 'http://trailersapi.com/trailers.json?movie=' + encodeURI(title) + }; + request(requestOptions, function(error, response, json) { + if (!error && response.statusCode == 200) { + try { + var trailer=/[^>]+src="?([^"\s]+)"/.exec(JSON.parse(json)[0]['code'])[1]; + App.Cache.setItem('trailer', title, trailer); + model.set('trailer', trailer); + callback(trailer); + } catch(e) { + return; + } + } + }); + } + + }; + + App.Cache.getItem('trailer', model, function (cachedItem) { + if (cachedItem) { + console.log('get from cache'); + cb(cachedItem); + } else { + console.log('get from interwebs'); + doRequest(); + } + }); +}; \ No newline at end of file diff --git a/js/frontend/views/sidebar.js b/js/frontend/views/sidebar.js index 7e5c8333..5ed3c333 100644 --- a/js/frontend/views/sidebar.js +++ b/js/frontend/views/sidebar.js @@ -6,6 +6,7 @@ App.View.Sidebar = Backbone.View.extend({ events: { 'click .closer': 'hide', 'click .play-button': 'play', + 'click .trailer-button': 'playTrailer', 'click .subtitles button': 'selectSubtitle', 'click .dropdown-toggle': 'toggleDropdown', 'click #switch-on': 'enableHD', @@ -35,6 +36,13 @@ App.View.Sidebar = Backbone.View.extend({ this.model.set('selectedSubtitle', lang); }, + playTrailer: function(evt) { + evt.preventDefault(); + App.findTrailer(model, function(data) { + spawnVideoPlayer('http://www.youtube.com/?watch='+data); + }); + }, + play: function (evt) { evt.preventDefault(); if( videoStreamer != null ){ return; } @@ -74,7 +82,6 @@ App.View.Sidebar = Backbone.View.extend({ } if( bufferStatus != previousStatus ) { - userTracking.event('Video Preloading', bufferStatus, movieModel.get('niceTitle')).send(); previousStatus = bufferStatus; } @@ -82,7 +89,6 @@ App.View.Sidebar = Backbone.View.extend({ } ); - userTracking.event('Movie Quality', 'Watch on '+this.model.get('quality')+' - '+this.model.get('health').capitalize(), this.model.get('niceTitle') ).send(); }, initialize: function () { @@ -137,8 +143,6 @@ App.View.Sidebar = Backbone.View.extend({ } } - userTracking.event( 'Movie Closed', this.model.get('niceTitle'), - (noSubForUser ? 'No Local Subtitles' : 'With Local Subtitles') +' - '+ this.model.get('health').capitalize() ).send(); } $('.movie.active').removeClass('active'); @@ -158,7 +162,6 @@ App.View.Sidebar = Backbone.View.extend({ $(".backdrop-image").addClass("loaded") }; - userTracking.pageview('/movies/view/'+this.model.get('slug'), this.model.get('niceTitle') ).send(); }, enableHD: function (evt) { diff --git a/js/tracking.js b/js/tracking.js deleted file mode 100644 index 9c03536a..00000000 --- a/js/tracking.js +++ /dev/null @@ -1,110 +0,0 @@ -// Tracking -var getTrackingId = function(){ - - var clientId = Settings.get('trackingId'); - - if( typeof clientId == 'undefined' || clientId == null || clientId == '' ) { - - // A UUID v4 (random) is the recommended format for Google Analytics - var uuid = require('node-uuid'); - - Settings.set('trackingId', uuid.v4() ); - clientId = Settings.get('trackingId'); - - // Try a time-based UUID (v1) if the proper one fails - if( typeof clientId == 'undefined' || clientId == null || clientId == '' ) { - Settings.set('trackingId', uuid.v1() ); - clientId = Settings.get('trackingId'); - - if( typeof clientId == 'undefined' || clientId == null || clientId == '' ) { - clientId = null; - } - } - } - - return clientId; -}; - -var ua = require('universal-analytics'); - - -if( getTrackingId() == null ) { - // Don't report anything if we don't have a trackingId - var dummyMethod = function(){ return {send:function(){}}; }; - var userTracking = window.userTracking = {event:dummyMethod, pageview:dummyMethod, timing:dummyMethod, exception:dummyMethod, transaction:dummyMethod}; -} -else { - var userTracking = window.userTracking = ua('UA-48789649-1', getTrackingId()); -} - - -// Check if the user has a working internet connection (uses Google as reference) -var checkInternetConnection = function(callback) { - var http = require('http'); - var hasInternetConnection = false; - - var opts = url.parse(Settings.get('connectionCheckUrl')); - opts.method = 'HEAD'; - http.get(opts, function(res){ - if( res.statusCode == 200 || res.statusCode == 302 || res.statusCode == 301 ) { - hasInternetConnection = true; - } - typeof callback == 'function' ? callback(hasInternetConnection) : null; - }); -}; - - -// Detect the operating system of the user -var getOperatingSystem = function() { - var os = require('os'); - var platform = os.platform(); - - if( platform == 'win32' || platform == 'win64' ) { - return 'windows'; - } - if( platform == 'darwin' ) { - return 'mac'; - } - if( platform == 'linux' ) { - return 'linux'; - } - return null; -}; - - -// Report Installs and Upgrades -if( typeof __isNewInstall != 'undefined' && __isNewInstall == true ) { - userTracking.event('App Install', getOperatingSystem().capitalize(), Settings.get('version')).send(); -} -else if( typeof __isUpgradeInstall != 'undefined' && __isUpgradeInstall == true ) { - userTracking.event('App Upgrade', getOperatingSystem().capitalize(), Settings.get('version')).send(); -} - - -// Todo: Remove Upgrade in the next version to prevent double counting of device stats (we'd send stats once per version) -if( (typeof __isNewInstall != 'undefined' && __isNewInstall == true) || - (typeof __isUpgradeInstall != 'undefined' && __isUpgradeInstall == true) ) { - - // General Device Stats - userTracking.event('Device Stats', 'Version', Settings.get('version') + (isDebug ? '-debug' : '') ).send(); - userTracking.event('Device Stats', 'Type', getOperatingSystem().capitalize()).send(); - userTracking.event('Device Stats', 'Operating System', os.type() +' '+ os.release()).send(); - userTracking.event('Device Stats', 'CPU', os.cpus()[0].model +' @ '+ (os.cpus()[0].speed/1000).toFixed(1) +'GHz' +' x '+ os.cpus().length ).send(); - userTracking.event('Device Stats', 'RAM', Math.round(os.totalmem() / 1024 / 1024 / 1024)+'GB' ).send(); - userTracking.event('Device Stats', 'Uptime', Math.round(os.uptime() / 60 / 60)+'hs' ).send(); - - // Screen resolution, depth and pixel ratio (retina displays) - if( typeof screen.width == 'number' && typeof screen.height == 'number' ) { - var resolution = (screen.width).toString() +'x'+ (screen.height.toString()); - if( typeof screen.pixelDepth == 'number' ) { - resolution += '@'+ (screen.pixelDepth).toString(); - } - if( typeof window.devicePixelRatio == 'number' ) { - resolution += '#'+ (window.devicePixelRatio).toString(); - } - userTracking.event('Device Stats', 'Resolution', resolution).send(); - } - - // User Language - userTracking.event('Device Stats', 'Language', navigator.language.toLowerCase() ).send(); -} diff --git a/js/updater.js b/js/updater.js deleted file mode 100644 index 3b8f1e20..00000000 --- a/js/updater.js +++ /dev/null @@ -1,34 +0,0 @@ - -// Check if there's a newer version and shows a prompt if that's the case -var checkForUpdates = function() { - var http = require('http'); - - var currentOs = getOperatingSystem(); - // We may want to change this in case the detection fails - if( ! currentOs ){ return; } - - http.get(Settings.get('updateNotificationUrl'), function(res){ - var data = ''; - res.on('data', function(chunk){ data += chunk; }); - - res.on('end', function(){ - try { - var updateInfo = JSON.parse(data); - } catch(e){ return; } - - if( ! updateInfo ){ return; } - - if( updateInfo[currentOs].version > Settings.get('version') ) { - // Check if there's a newer version and show the update notification - $('#notification').html( - i18n.__('UpgradeVersionDescription', updateInfo[currentOs].versionName) + - ' '+ i18n.__('UpgradeVersion') + '' - ); - $('body').addClass('has-notification'); - } - }); - - }) -}; - -checkForUpdates(); diff --git a/js/vendor/settings.js b/js/vendor/settings.js index 778dba9b..f8d7659a 100644 --- a/js/vendor/settings.js +++ b/js/vendor/settings.js @@ -8,8 +8,6 @@ Settings = { // Default to the first beta "version": "0.1.0", "dbVersion": "1.0", - // Used to check for the latest version - "updateNotificationUrl": "http://getpopcornti.me/update.json", // Used to check if there's an internet connection "connectionCheckUrl": "http://www.google.com", // YIFY Endpoint diff --git a/js/vendor/videojsplugins.js b/js/vendor/videojsplugins.js index a1c6cb3a..0a99673d 100644 --- a/js/vendor/videojsplugins.js +++ b/js/vendor/videojsplugins.js @@ -13,8 +13,6 @@ videojs.BiggerSubtitleButton.prototype.onClick = function() { var font_size = parseInt($subs.css('font-size')); font_size = font_size + 3; $subs.css('font-size', font_size+'px'); - - userTracking.event('Video Subtitle Size', 'Make Bigger', font_size+'px', font_size).send(); }; var createBiggerSubtitleButton = function() { @@ -48,8 +46,6 @@ videojs.SmallerSubtitleButton.prototype.onClick = function() { var font_size = parseInt($subs.css('font-size')); font_size = font_size - 3; $subs.css('font-size', font_size+'px'); - - userTracking.event('Video Subtitle Size', 'Make Smaller', font_size+'px', font_size).send(); }; var createSmallerSubtitleButton = function() { diff --git a/js/vendor/vjs.youtube.js b/js/vendor/vjs.youtube.js new file mode 100644 index 00000000..b3b95281 --- /dev/null +++ b/js/vendor/vjs.youtube.js @@ -0,0 +1,27 @@ +videojs.Youtube=videojs.MediaTechController.extend({init:function(a,b,c){videojs.MediaTechController.call(this,a,b,c);this.features.progressEvents=!1;this.features.timeupdateEvents=!1;if("undefined"!=typeof b.source)for(var e in b.source)a.options()[e]=b.source[e];this.userQuality=videojs.Youtube.convertQualityName(a.options().quality);this.player_=a;this.player_el_=document.getElementById(a.id());this.player_el_.className+=" vjs-youtube";this.qualityButton=document.createElement("div");this.qualityButton.setAttribute("class", +"vjs-quality-button vjs-menu-button vjs-control");this.qualityButton.setAttribute("tabindex",0);b=document.createElement("div");this.qualityButton.appendChild(b);this.qualityTitle=document.createElement("span");b.appendChild(this.qualityTitle);b=document.createElement("div");b.setAttribute("class","vjs-menu");this.qualityButton.appendChild(b);this.qualityMenuContent=document.createElement("ul");this.qualityMenuContent.setAttribute("class","vjs-menu-content");b.appendChild(this.qualityMenuContent); +this.id_=this.player_.id()+"_youtube_api";this.el_=videojs.Component.prototype.createEl("iframe",{id:this.id_,className:"vjs-tech",scrolling:"no",marginWidth:0,marginHeight:0,frameBorder:0,webkitAllowFullScreen:"true",mozallowfullscreen:"true",allowFullScreen:"true"});this.iframeblocker=videojs.Component.prototype.createEl("div",{className:"iframeblocker"});var d=this;this.iframeblocker.addEventListener("click",function(){d.paused()?d.play():d.pause()});this.iframeblocker.addEventListener("mousemove", +function(a){d.player_.userActive()||d.player_.userActive(!0);a.stopPropagation();a.preventDefault()});this.iframeblocker.addEventListener("tap",function(){!0===d.player_.userActive()?d.player_.userActive(!1):d.player_.userActive(!0)});this.player_.options().ytcontrols||(this.iframeblocker.style.display="block");this.player_el_.insertBefore(this.iframeblocker,this.player_el_.firstChild);this.player_el_.insertBefore(this.el_,this.iframeblocker);this.parseSrc(a.options().src);this.playOnReady=this.player_.options().autoplay|| +!1;this.forceSSL=this.player_.options().forceSSL||!1;b={enablejsapi:1,iv_load_policy:3,playerapiid:this.id(),disablekb:1,wmode:"transparent",controls:this.player_.options().ytcontrols?1:0,playsinline:this.player_.options().playsInline?1:0,showinfo:0,modestbranding:1,rel:0,autoplay:this.playOnReady?1:0,loop:this.player_.options().loop?1:0,list:this.playlistId,vq:this.userQuality};for(var f in b)b.hasOwnProperty(f)&&"undefined"===typeof b[f]&&delete b[f];"file:"!=window.location.protocol?this.forceSSL? +this.el_.src="https://www.youtube.com/embed/"+this.videoId+"?"+videojs.Youtube.makeQueryString(b):(b.origin=window.location.protocol+"//"+window.location.host,this.el_.src=window.location.protocol+"//www.youtube.com/embed/"+this.videoId+"?"+videojs.Youtube.makeQueryString(b)):this.el_.src="https://www.youtube.com/embed/"+this.videoId+"?"+videojs.Youtube.makeQueryString(b);d=this;a.ready(function(){d.player_el_.getElementsByClassName("vjs-control-bar")[0].appendChild(d.qualityButton);d.playOnReady&& +!d.player_.options().ytcontrols&&("undefined"!=typeof d.player_.loadingSpinner&&d.player_.loadingSpinner.show(),d.player_.bigPlayButton.hide())});this.player_.options().ytcontrols?this.player_.controls(!1):this.player_.poster()||(null==this.videoId?this.iframeblocker.style.backgroundColor="black":this.player_.poster("https://img.youtube.com/vi/"+this.videoId+"/0.jpg"));videojs.Youtube.apiReady?this.loadYoutube():(videojs.Youtube.loadingQueue.push(this),videojs.Youtube.apiLoading||(a=document.createElement("script"), +a.src=this.forceSSL||"file:"===window.location.protocol?"https://www.youtube.com/iframe_api":"//www.youtube.com/iframe_api",f=document.getElementsByTagName("script")[0],f.parentNode.insertBefore(a,f),videojs.Youtube.apiLoading=!0));this.on("dispose",function(){this.el_.parentNode.removeChild(this.el_);this.iframeblocker.parentNode.removeChild(this.iframeblocker);this.qualityButton.parentNode.removeChild(this.qualityButton);"undefined"!=typeof this.player_.loadingSpinner&&this.player_.loadingSpinner.hide(); +this.player_.bigPlayButton.hide()})}});videojs.Youtube.prototype.parseSrc=function(a){if(this.srcVal=a){var b=a.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/);this.videoId=b&&11==b[2].length?b[2]:null;b=a.match(/[?&]list=([^#\&\?]+)/);null!=b&&1 div:first-child > span:first-child { position:relative;top:7px } ":a.innerText= +" .vjs-youtube .vjs-poster { background-size: cover; } .vjs-poster, .vjs-loading-spinner, .vjs-big-play-button, .vjs-text-track-display{ pointer-events: none !important; } .iframeblocker { display:none;position:absolute;top:0;left:0;width:100%;height:100%;cursor:pointer;z-index:2; } .vjs-youtube.vjs-user-inactive .iframeblocker { display:block; } .vjs-quality-button > div:first-child > span:first-child { position:relative;top:7px } ";document.getElementsByTagName("head")[0].appendChild(a)})(); \ No newline at end of file diff --git a/language/en.json b/language/en.json index f2aab380..f9364c74 100644 --- a/language/en.json +++ b/language/en.json @@ -11,6 +11,7 @@ "subtitledIn": "Subtitled in", "quality": "Quality", "watchItNow": "Watch It Now", + "trailer": "Trailer", "durationUnit": "min", "connecting": "Connecting...", "startingDownload": "Starting Download...",