diff -r 8b0a464fb5ac -r 007254e97333 js/remote-player.js --- a/js/remote-player.js Wed Apr 17 17:10:43 2013 +0200 +++ b/js/remote-player.js Mon Apr 22 18:42:40 2013 +0200 @@ -1,14 +1,15 @@ -function Player() { +function Player(dimensions) { var events = {}, self = this, loaded = false, -// tvWindow, + tvWindow, destination = document.location.href.replace(/^(https?:\/\/[^\/]+).*$/,'$1'), timeAtLoad, timeDelta = 0, timeOut, - playAtLoad = false; + playAtLoad = false, + winDimensions = dimensions || { left: 0, top: 0, width: 640, height:360 }; this.currentTime = 0; this.duration = 0; @@ -65,10 +66,16 @@ } $(".tv").click(function() { - tvWindow = window.open("tv.html","TV","width=640,height=360,toolbar=0,location=0,status=0,titlebar=0"); + tvWindow = window.open("tv.html","TV", _(winDimensions).reduce(function(mem, v, k) { return mem + k + "=" + v + "," },"") + "toolbar=0,location=0,status=0,titlebar=0"); window.addEventListener("message",receiveMessage,false); }); + $(window).on("unload", function() { + if (typeof tvWindow !== "undefined" && tvWindow) { + tvWindow.close(); + } + }) + this.setCurrentTime = function(t) { if (loaded) { sendMessage("timeupdate:" + t);