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 = { | ||||
|     init: function() { | ||||
|         if(window.location.hash == "#small") { | ||||
|         if(window.location.hash == "#small" || inIframe()) { | ||||
|             small_player = true; | ||||
|             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) { | ||||
|     var moveFunction = function( event ) { | ||||
|         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]); | ||||
|         switch(newState.data) { | ||||
|             case YT.PlayerState.UNSTARTED: | ||||
|                 if(small_player) { | ||||
|                     Helper.css("#player", "opacity", "1"); | ||||
|                 } | ||||
|                 break; | ||||
|             case YT.PlayerState.ENDED: | ||||
|                 playing = false; | ||||
| @@ -221,7 +223,9 @@ var Player = { | ||||
|             case YT.PlayerState.BUFFERING: | ||||
|                 //was_stopped = false; | ||||
|                 buffering = true; | ||||
|                 if(small_player) { | ||||
|                     Helper.css("#player", "opacity", "1"); | ||||
|                 } | ||||
|                 resizePlaylistPlaying(newState.data == YT.PlayerState.PLAYING || newState.data == YT.PlayerState.BUFFERING); | ||||
|                 break; | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user