mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Automatically assuming small player if in iframe
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
var Channel = {
|
var Channel = {
|
||||||
init: function() {
|
init: function() {
|
||||||
if(window.location.hash == "#small") {
|
if(window.location.hash == "#small" || inIframe()) {
|
||||||
small_player = true;
|
small_player = true;
|
||||||
document.querySelector("footer").style.display = "none";
|
document.querySelector("footer").style.display = "none";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -354,6 +354,14 @@ function contextListener(that, event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function inIframe () {
|
||||||
|
try {
|
||||||
|
return window.self !== window.top;
|
||||||
|
} catch (e) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function mouseContext(left, top) {
|
function mouseContext(left, top) {
|
||||||
var moveFunction = function( event ) {
|
var moveFunction = function( event ) {
|
||||||
if(event.pageX < left - 60 || event.pageX > left + document.querySelector(".context-menu-root").offsetWidth + 60 ||
|
if(event.pageX < left - 60 || event.pageX > left + document.querySelector(".context-menu-root").offsetWidth + 60 ||
|
||||||
|
|||||||
@@ -120,7 +120,9 @@ var Player = {
|
|||||||
Helper.log(["video_id variable: " + video_id]);
|
Helper.log(["video_id variable: " + video_id]);
|
||||||
switch(newState.data) {
|
switch(newState.data) {
|
||||||
case YT.PlayerState.UNSTARTED:
|
case YT.PlayerState.UNSTARTED:
|
||||||
Helper.css("#player", "opacity", "1");
|
if(small_player) {
|
||||||
|
Helper.css("#player", "opacity", "1");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case YT.PlayerState.ENDED:
|
case YT.PlayerState.ENDED:
|
||||||
playing = false;
|
playing = false;
|
||||||
@@ -221,7 +223,9 @@ var Player = {
|
|||||||
case YT.PlayerState.BUFFERING:
|
case YT.PlayerState.BUFFERING:
|
||||||
//was_stopped = false;
|
//was_stopped = false;
|
||||||
buffering = true;
|
buffering = true;
|
||||||
Helper.css("#player", "opacity", "1");
|
if(small_player) {
|
||||||
|
Helper.css("#player", "opacity", "1");
|
||||||
|
}
|
||||||
resizePlaylistPlaying(newState.data == YT.PlayerState.PLAYING || newState.data == YT.PlayerState.BUFFERING);
|
resizePlaylistPlaying(newState.data == YT.PlayerState.PLAYING || newState.data == YT.PlayerState.BUFFERING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user