mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-28 19:05:49 +00:00
Cleanup
This commit is contained in:
parent
6a63230a64
commit
e459fafdf1
@ -1,42 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { margin: 0; width:100%%; height:100%%; background-color:transparent; }
|
||||
html { width:100%%; height:100%%; background-color:transparent; }
|
||||
|
||||
.embed-container iframe,
|
||||
.embed-container object,
|
||||
.embed-container embed {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%% !important;
|
||||
height: 100%% !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="embed-container">
|
||||
<iframe id="player" src="%@" width="100%" height="100%" frameborder="0"></iframe>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
var iframe;
|
||||
|
||||
function injectCmd(cmd) {
|
||||
var cmdStr = JSON.stringify({ "event": "inject", "cmd": cmd, "id": 1 });
|
||||
iframe.contentWindow.postMessage(cmdStr, "*");
|
||||
}
|
||||
|
||||
(function(){
|
||||
iframe = document.querySelectorAll('iframe')[0];
|
||||
|
||||
iframe.onload = function() {
|
||||
injectCmd('fixInline');
|
||||
};
|
||||
})();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,18 +0,0 @@
|
||||
function fixInline() {
|
||||
var video = document.getElementsByTagName('video')[0];
|
||||
video.setAttribute('webkit-playsinline', '');
|
||||
video.setAttribute('playsinline', '');
|
||||
video.webkitExitFullscreen = undefined;
|
||||
|
||||
video.play();
|
||||
}
|
||||
|
||||
function receiveMessage(evt) {
|
||||
try {
|
||||
var obj = JSON.parse(evt.data);
|
||||
if (obj.cmd == 'fixInline')
|
||||
fixInline();
|
||||
} catch (ex) { }
|
||||
}
|
||||
|
||||
window.addEventListener('message', receiveMessage, false);
|
||||
@ -1,52 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { margin: 0; width:100%%; height:100%%; background-color:#000; }
|
||||
html { width:100%%; height:100%%; background-color:#000; }
|
||||
|
||||
.embed-container iframe,
|
||||
.embed-container object,
|
||||
.embed-container embed {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%% !important;
|
||||
height: 100%% !important;
|
||||
}
|
||||
|
||||
video::-webkit-media-controls { display: none !important }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="embed-container">
|
||||
<video id="video" type="video/mp4" preload="auto" src="%@" webkit-playsinline></video>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
var video = document.getElementsByTagName('video')[0];
|
||||
video.addEventListener("playing", onPlaybackStart, false);
|
||||
video.addEventListener("ended", onPlaybackEnd, false);
|
||||
|
||||
function onPlaybackStart() {
|
||||
window.location.href = 'instagramplayer://onPlayback?data=';
|
||||
}
|
||||
|
||||
function onPlaybackEnd() {
|
||||
video.currentTime = 0;
|
||||
video.play();
|
||||
}
|
||||
|
||||
function play() {
|
||||
video.play();
|
||||
}
|
||||
|
||||
function pause() {
|
||||
video.pause();
|
||||
}
|
||||
|
||||
video.play();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,53 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { margin: 0; width:100%%; height:100%%; background-color:transparent; }
|
||||
html { width:100%%; height:100%%; background-color:transparent; }
|
||||
|
||||
.embed-container iframe,
|
||||
.embed-container object,
|
||||
.embed-container embed {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%% !important;
|
||||
height: 100%% !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="embed-container">
|
||||
<iframe id="player" src="%@" width="100%" height="100%" frameborder="0"></iframe>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
var iframe;
|
||||
var player;
|
||||
|
||||
function injectCmd(cmd) {
|
||||
var cmdStr = JSON.stringify({ "event": "inject", "cmd": cmd, "id": 1 });
|
||||
iframe.contentWindow.postMessage(cmdStr, "*");
|
||||
}
|
||||
|
||||
(function(){
|
||||
iframe = document.querySelectorAll('iframe')[0];
|
||||
|
||||
iframe.onload = function() {
|
||||
injectCmd('fixPlayer');
|
||||
};
|
||||
})();
|
||||
|
||||
function receiveMessage(evt) {
|
||||
if ((typeof evt.data) != 'string')
|
||||
return;
|
||||
|
||||
if (evt.data == 'playbackStarted')
|
||||
window.location.href = 'twitchplayer://onPlayback?data=';
|
||||
}
|
||||
|
||||
window.addEventListener('message', receiveMessage, false);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,129 +0,0 @@
|
||||
var video;
|
||||
|
||||
function hidePlayButton() {
|
||||
var css = 'video::-webkit-media-controls { display: none !important } video::--webkit-media-controls-play-button { display: none !important; -webkit-appearance: none; } video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }',
|
||||
head = document.head || document.getElementsByTagName('head')[0],
|
||||
style = document.createElement('style');
|
||||
|
||||
style.type = 'text/css';
|
||||
if (style.styleSheet){
|
||||
style.styleSheet.cssText = css;
|
||||
} else {
|
||||
style.appendChild(document.createTextNode(css));
|
||||
}
|
||||
|
||||
head.appendChild(style);
|
||||
}
|
||||
|
||||
function fixPlayer() {
|
||||
var controls = document.getElementsByClassName('player-controls-bottom')[0];
|
||||
if (controls == null) {
|
||||
controls = document.getElementsByClassName('player-overlay-container')[0];
|
||||
}
|
||||
if (controls != null) {
|
||||
controls.style.display = 'none';
|
||||
}
|
||||
|
||||
var topBar = document.getElementById('top-bar');
|
||||
if (topBar == null) {
|
||||
topBar = document.getElementsByClassName('player-controls-top')[0];
|
||||
}
|
||||
if (topBar != null) {
|
||||
topBar.style.display = 'none';
|
||||
}
|
||||
|
||||
var pauseOverlay = document.getElementsByClassName('player-play-overlay')[0];
|
||||
if (pauseOverlay == null) {
|
||||
pauseOverlay = document.getElementsByClassName('player-controls-bottom')[0];
|
||||
}
|
||||
if (pauseOverlay != null) {
|
||||
pauseOverlay.style.display = 'none';
|
||||
}
|
||||
|
||||
var statusOverlay = document.getElementsByClassName('player-streamstatus')[0];
|
||||
if (statusOverlay != null) {
|
||||
statusOverlay.style.right = undefined;
|
||||
statusOverlay.style.left = '0px';
|
||||
statusOverlay.style.padding = '1.5em 1.5em 5.5em 2.5em';
|
||||
}
|
||||
|
||||
var recommendationOverlay = document.getElementById('js-player-recommendations-overlay');
|
||||
if (recommendationOverlay != null) {
|
||||
recommendationOverlay.style.display = 'none';
|
||||
}
|
||||
|
||||
var adOverlay = document.getElementsByClassName('player-ad-overlay')[0];
|
||||
if (adOverlay != null) {
|
||||
adOverlay.style.display = 'none';
|
||||
}
|
||||
|
||||
var alertOverlay = document.getElementById('js-player-alert-container');
|
||||
if (alertOverlay != null) {
|
||||
alertOverlay.style.display = 'none';
|
||||
}
|
||||
|
||||
var video = document.getElementsByTagName('video')[0];
|
||||
video.setAttribute('webkit-playsinline', '');
|
||||
video.setAttribute('playsinline', '');
|
||||
video.webkitEnterFullscreen = undefined;
|
||||
|
||||
video.addEventListener("playing", onPlaybackStart, false);
|
||||
|
||||
video.play();
|
||||
|
||||
hidePlayButton();
|
||||
|
||||
var ageButton = document.getElementById('mature-link');
|
||||
if (ageButton != null) {
|
||||
eventFire(ageButton, 'click');
|
||||
}
|
||||
}
|
||||
|
||||
function onPlaybackStart() {
|
||||
window.parent.postMessage('playbackStarted', '*');
|
||||
}
|
||||
|
||||
function switchToPIP() {
|
||||
var video = document.getElementsByTagName('video')[0];
|
||||
video.webkitSetPresentationMode('picture-in-picture');
|
||||
}
|
||||
|
||||
function eventFire(el, etype){
|
||||
if (el.fireEvent) {
|
||||
el.fireEvent('on' + etype);
|
||||
} else {
|
||||
var evObj = document.createEvent('Events');
|
||||
evObj.initEvent(etype, true, false);
|
||||
el.dispatchEvent(evObj);
|
||||
}
|
||||
}
|
||||
|
||||
function play() {
|
||||
var playButton = document.getElementsByClassName('js-control-playpause-button')[0];
|
||||
if (playButton == null) {
|
||||
playButton = document.getElementsByClassName('player-button--playpause')[0];
|
||||
}
|
||||
|
||||
eventFire(playButton, 'click');
|
||||
}
|
||||
|
||||
function receiveMessage(evt) {
|
||||
if ((typeof evt.data) != 'string')
|
||||
return;
|
||||
|
||||
try {
|
||||
var obj = JSON.parse(evt.data);
|
||||
if (!obj.event || obj.event != 'inject')
|
||||
return;
|
||||
|
||||
if (obj.cmd == 'fixPlayer')
|
||||
fixPlayer();
|
||||
else if (obj.cmd == 'play')
|
||||
play();
|
||||
else if (obj.cmd == 'switchToPIP')
|
||||
switchToPIP();
|
||||
} catch (ex) { }
|
||||
}
|
||||
|
||||
window.addEventListener('message', receiveMessage, false);
|
||||
|
||||
@ -1,95 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { margin: 0; width:100%%; height:100%%; background-color:transparent; }
|
||||
html { width:100%%; height:100%%; background-color:transparent; }
|
||||
|
||||
.embed-container iframe,
|
||||
.embed-container object,
|
||||
.embed-container embed {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%% !important;
|
||||
height: 100%% !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="embed-container">
|
||||
<iframe id="player" src="https://player.vimeo.com/video/%@?api=1&badge=0&byline=0&portrait=0&title=0&player_id=player" width="100%" height="100%" frameborder="0"></iframe>
|
||||
</div>
|
||||
<script>
|
||||
var Froogaloop=function(){function e(a){return new e.fn.init(a)}function g(a,c,b){if(!b.contentWindow.postMessage)return!1;a=JSON.stringify({method:a,value:c});b.contentWindow.postMessage(a,h)}function l(a){var c,b;try{c=JSON.parse(a.data),b=c.event||c.method}catch(e){}"ready"!=b||k||(k=!0);if(!/^https?:\/\/player.vimeo.com/.test(a.origin))return!1;"*"===h&&(h=a.origin);a=c.value;var m=c.data,f=""===f?null:c.player_id;c=f?d[f][b]:d[b];b=[];if(!c)return!1;void 0!==a&&b.push(a);m&&b.push(m);f&&b.push(f);
|
||||
return 0<b.length?c.apply(null,b):c.call()}function n(a,c,b){b?(d[b]||(d[b]={}),d[b][a]=c):d[a]=c}var d={},k=!1,h="*";e.fn=e.prototype={element:null,init:function(a){"string"===typeof a&&(a=document.getElementById(a));this.element=a;return this},api:function(a,c){if(!this.element||!a)return!1;var b=this.element,d=""!==b.id?b.id:null,e=c&&c.constructor&&c.call&&c.apply?null:c,f=c&&c.constructor&&c.call&&c.apply?c:null;f&&n(a,f,d);g(a,e,b);return this},addEvent:function(a,c){if(!this.element)return!1;
|
||||
var b=this.element,d=""!==b.id?b.id:null;n(a,c,d);"ready"!=a?g("addEventListener",a,b):"ready"==a&&k&&c.call(null,d);return this},removeEvent:function(a){if(!this.element)return!1;var c=this.element,b=""!==c.id?c.id:null;a:{if(b&&d[b]){if(!d[b][a]){b=!1;break a}d[b][a]=null}else{if(!d[a]){b=!1;break a}d[a]=null}b=!0}"ready"!=a&&b&&g("removeEventListener",a,c)}};e.fn.init.prototype=e.fn;window.addEventListener?window.addEventListener("message",l,!1):window.attachEvent("onmessage",l);return window.Froogaloop=
|
||||
window.$f=e}();
|
||||
|
||||
var iframe;
|
||||
var player;
|
||||
|
||||
function injectCmd(cmd) {
|
||||
var cmdStr = JSON.stringify({ "event": "inject", "cmd": cmd, "id": 1 });
|
||||
iframe.contentWindow.postMessage(cmdStr, "*");
|
||||
}
|
||||
|
||||
(function(){
|
||||
var playbackState = 0;
|
||||
var duration = 0.0;
|
||||
var position = 0.0;
|
||||
var downloadProgress = 0.0;
|
||||
|
||||
iframe = document.querySelectorAll('iframe')[0];
|
||||
player = $f(iframe);
|
||||
|
||||
function updateState() {
|
||||
window.location.href = 'vimeoplayer://onState?playback=' + playbackState + '&position=' + position + '&duration=' + duration + '&download=' + downloadProgress;
|
||||
}
|
||||
|
||||
player.addEvent('ready', function(player_id) {
|
||||
window.location.href = 'vimeoplayer://onReady?data=' + player_id;
|
||||
|
||||
player.addEvent('play', onPlay);
|
||||
player.addEvent('pause', onPause);
|
||||
player.addEvent('finish', onFinish);
|
||||
player.addEvent('playProgress', onPlayProgress);
|
||||
player.addEvent('loadProgress', onLoadProgress);
|
||||
|
||||
window.setInterval(updateState, 500);
|
||||
|
||||
injectCmd('fixPlayer');
|
||||
|
||||
if (%@) {
|
||||
injectCmd('initialPlay');
|
||||
}
|
||||
});
|
||||
|
||||
function onPlay(data) {
|
||||
playbackState = 1;
|
||||
updateState();
|
||||
}
|
||||
|
||||
function onPause(data) {
|
||||
playbackState = 0;
|
||||
updateState();
|
||||
}
|
||||
|
||||
function onFinish(data) {
|
||||
playbackState = 2;
|
||||
updateState();
|
||||
}
|
||||
|
||||
function onPlayProgress(data) {
|
||||
position = data.seconds;
|
||||
duration = data.duration;
|
||||
}
|
||||
|
||||
function onLoadProgress(data) {
|
||||
downloadProgress = data.percent;
|
||||
}
|
||||
})();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,52 +0,0 @@
|
||||
function fixPlayer() {
|
||||
var controls = document.getElementsByClassName('controls')[0];
|
||||
controls.style.display = 'none';
|
||||
|
||||
var sidedock = document.getElementsByClassName('sidedock')[0];
|
||||
sidedock.style.display = 'none';
|
||||
|
||||
var video = document.getElementsByTagName('video')[0];
|
||||
video.setAttribute('webkit-playsinline', '');
|
||||
video.setAttribute('playsinline', '');
|
||||
video.webkitEnterFullscreen = undefined;
|
||||
}
|
||||
|
||||
function switchToPIP() {
|
||||
var video = document.getElementsByTagName('video')[0];
|
||||
video.webkitSetPresentationMode('picture-in-picture');
|
||||
}
|
||||
|
||||
function eventFire(el, etype){
|
||||
if (el.fireEvent) {
|
||||
el.fireEvent('on' + etype);
|
||||
} else {
|
||||
var evObj = document.createEvent('Events');
|
||||
evObj.initEvent(etype, true, false);
|
||||
el.dispatchEvent(evObj);
|
||||
}
|
||||
}
|
||||
|
||||
function initialPlay() {
|
||||
var playButton = document.getElementsByClassName('play')[0];
|
||||
eventFire(playButton, 'click');
|
||||
}
|
||||
|
||||
function receiveMessage(evt) {
|
||||
if ((typeof evt.data) != 'string')
|
||||
return;
|
||||
|
||||
try {
|
||||
var obj = JSON.parse(evt.data);
|
||||
if (!obj.event || obj.event != 'inject')
|
||||
return;
|
||||
|
||||
if (obj.cmd == 'fixPlayer')
|
||||
fixPlayer();
|
||||
else if (obj.cmd == 'initialPlay')
|
||||
initialPlay();
|
||||
else if (obj.cmd == 'switchToPIP')
|
||||
switchToPIP();
|
||||
} catch (ex) { }
|
||||
}
|
||||
|
||||
window.addEventListener('message', receiveMessage, false);
|
||||
@ -1,51 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { margin: 0; width:100%%; height:100%%; background-color:transparent; }
|
||||
html { width:100%%; height:100%%; background-color:transparent; }
|
||||
|
||||
.embed-container iframe,
|
||||
.embed-container object,
|
||||
.embed-container embed {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%% !important;
|
||||
height: 100%% !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="embed-container">
|
||||
<iframe id="player" src="https://vine.co/v/%@/card" width="100%" height="100%" frameborder="0"></iframe>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
var iframe;
|
||||
var player;
|
||||
|
||||
function injectCmd(cmd) {
|
||||
var cmdStr = JSON.stringify({ "event": "inject", "cmd": cmd, "id": 1 });
|
||||
iframe.contentWindow.postMessage(cmdStr, "*");
|
||||
}
|
||||
|
||||
function receiveMessage(evt) {
|
||||
if ((typeof evt.data) != 'string')
|
||||
return;
|
||||
|
||||
try {
|
||||
var obj = JSON.parse(evt.data);
|
||||
if (obj.event == 'src')
|
||||
window.location.href = 'vineplayer://onSrc?data=' + obj.data;
|
||||
} catch(ex) { }
|
||||
|
||||
if (evt.data == 'playbackStarted')
|
||||
window.location.href = 'vineplayer://onPlayback?data=';
|
||||
}
|
||||
|
||||
window.addEventListener('message', receiveMessage, false);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,80 +0,0 @@
|
||||
function hidePlayButton() {
|
||||
var css = 'video::-webkit-media-controls { display: none !important }',
|
||||
head = document.head || document.getElementsByTagName('head')[0],
|
||||
style = document.createElement('style');
|
||||
|
||||
style.type = 'text/css';
|
||||
if (style.styleSheet){
|
||||
style.styleSheet.cssText = css;
|
||||
} else {
|
||||
style.appendChild(document.createTextNode(css));
|
||||
}
|
||||
|
||||
head.appendChild(style);
|
||||
}
|
||||
|
||||
var video;
|
||||
|
||||
function fixPlayer() {
|
||||
var controls = document.getElementsByClassName('VolumeControl')[0];
|
||||
controls.style.display = 'none';
|
||||
|
||||
video.setAttribute('webkit-playsinline', '');
|
||||
video.setAttribute('playsinline', '');
|
||||
video.webkitEnterFullscreen = undefined;
|
||||
|
||||
hidePlayButton();
|
||||
}
|
||||
|
||||
function play() {
|
||||
video.play();
|
||||
}
|
||||
|
||||
function pause() {
|
||||
video.pause();
|
||||
}
|
||||
|
||||
function showWatermark() {
|
||||
var logo = document.getElementsByClassName('vine-logo')[0];
|
||||
logo.style.display = 'block';
|
||||
}
|
||||
|
||||
function hideWatermark() {
|
||||
var logo = document.getElementsByClassName('vine-logo')[0];
|
||||
logo.style.display = 'none';
|
||||
}
|
||||
|
||||
function receiveMessage(evt) {
|
||||
if ((typeof evt.data) != 'string')
|
||||
return;
|
||||
|
||||
try {
|
||||
var obj = JSON.parse(evt.data);
|
||||
if (!obj.event || obj.event != 'inject')
|
||||
return;
|
||||
|
||||
if (obj.cmd == 'play')
|
||||
play();
|
||||
else if (obj.cmd == 'pause')
|
||||
pause();
|
||||
else if (obj.cmd == 'showWatermark')
|
||||
showWatermark();
|
||||
else if (obj.cmd == 'hideWatermark')
|
||||
hideWatermark();
|
||||
} catch (ex) { }
|
||||
}
|
||||
|
||||
window.addEventListener('message', receiveMessage, false);
|
||||
|
||||
var video = document.getElementsByTagName('video')[0];
|
||||
|
||||
fixPlayer();
|
||||
hidePlayButton();
|
||||
|
||||
video.addEventListener("playing", onPlaybackStart, false);
|
||||
|
||||
window.parent.postMessage(JSON.stringify({ "event": "src", "data": video.src }), '*');
|
||||
|
||||
function onPlaybackStart() {
|
||||
window.parent.postMessage('playbackStarted', '*');
|
||||
}
|
||||
@ -1,98 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { margin: 0; width:100%%; height:100%%; background-color:#000; }
|
||||
html { width:100%%; height:100%%; background-color:#000; }
|
||||
|
||||
.embed-container iframe,
|
||||
.embed-container object,
|
||||
.embed-container embed {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%% !important;
|
||||
height: 100%% !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="embed-container">
|
||||
<div id="player"></div>
|
||||
</div>
|
||||
<script src="https://www.youtube.com/iframe_api"></script>
|
||||
<script>
|
||||
var player;
|
||||
var iframe;
|
||||
var error = false;
|
||||
|
||||
function injectCmd(cmd) {
|
||||
var cmdStr = JSON.stringify({ "event": "inject", "cmd": cmd, "id": 1 });
|
||||
iframe.contentWindow.postMessage(cmdStr, "*");
|
||||
}
|
||||
|
||||
var playbackState = 0;
|
||||
var duration = 0.0;
|
||||
var position = 0.0;
|
||||
var downloadProgress = 0.0;
|
||||
var failed = false;
|
||||
var autostarted = false;
|
||||
|
||||
YT.ready(function() {
|
||||
player = new YT.Player('player', %@);
|
||||
player.setSize(window.innerWidth, window.innerHeight);
|
||||
|
||||
function getCurrentTime() {
|
||||
downloadProgress = player.getVideoLoadedFraction();
|
||||
position = player.getCurrentTime()
|
||||
|
||||
updateState();
|
||||
injectCmd('fixChrome');
|
||||
}
|
||||
|
||||
window.setInterval(getCurrentTime, 500);
|
||||
|
||||
injectCmd('initial');
|
||||
});
|
||||
|
||||
function updateState() {
|
||||
window.location.href = 'ytplayer://onState?failed= ' + failed + '&playback=' + playbackState + '&position=' + position + '&duration=' + duration + '&download=' + downloadProgress;
|
||||
}
|
||||
|
||||
function onReady(event) {
|
||||
window.location.href = 'ytplayer://onReady?data=' + event.data;
|
||||
iframe = document.getElementById('player');
|
||||
duration = player.getDuration();
|
||||
injectCmd('fixChrome');
|
||||
}
|
||||
|
||||
function onStateChange(event) {
|
||||
if (!error) {
|
||||
playbackState = event.data;
|
||||
updateState();
|
||||
}
|
||||
else {
|
||||
error = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onPlaybackQualityChange(event) {
|
||||
window.location.href = 'ytplayer://onPlaybackQualityChange?data=' + event.data;
|
||||
}
|
||||
|
||||
function onPlayerError(event) {
|
||||
if (event.data == 100) {
|
||||
error = true;
|
||||
}
|
||||
else if (event.data == 150) {
|
||||
failed = true;
|
||||
}
|
||||
updateState();
|
||||
}
|
||||
|
||||
window.onresize = function() {
|
||||
player.setSize(window.innerWidth, window.innerHeight);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,51 +0,0 @@
|
||||
function fixChrome() {
|
||||
var watermark = document.getElementsByClassName('ytp-watermark')[0];
|
||||
watermark.style.display = 'none';
|
||||
|
||||
var button = document.getElementsByClassName('ytp-large-play-button')[0];
|
||||
button.style.display = 'none';
|
||||
button.style.opacity = '0';
|
||||
|
||||
var progress = document.getElementsByClassName('ytp-spinner-container')[0];
|
||||
progress.style.display = 'none';
|
||||
progress.style.opacity = '0';
|
||||
|
||||
var video = document.getElementsByTagName('video')[0];
|
||||
video.setAttribute('webkit-playsinline', '');
|
||||
video.setAttribute('playsinline', '');
|
||||
video.webkitEnterFullscreen = undefined;
|
||||
}
|
||||
|
||||
function initial() {
|
||||
var css = 'video::-webkit-media-controls { display: none !important } video::--webkit-media-controls-play-button { display: none !important; -webkit-appearance: none; } video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }',
|
||||
head = document.head || document.getElementsByTagName('head')[0],
|
||||
style = document.createElement('style');
|
||||
|
||||
style.type = 'text/css';
|
||||
if (style.styleSheet){
|
||||
style.styleSheet.cssText = css;
|
||||
} else {
|
||||
style.appendChild(document.createTextNode(css));
|
||||
}
|
||||
|
||||
head.appendChild(style);
|
||||
}
|
||||
|
||||
function switchToPIP() {
|
||||
var video = document.getElementsByTagName('video')[0];
|
||||
video.webkitSetPresentationMode('picture-in-picture');
|
||||
}
|
||||
|
||||
function receiveMessage(evt) {
|
||||
try {
|
||||
var obj = JSON.parse(evt.data);
|
||||
if (obj.cmd == 'fixChrome')
|
||||
fixChrome();
|
||||
else if (obj.cmd == 'initial')
|
||||
initial();
|
||||
else if (obj.cmd == 'switchToPIP')
|
||||
switchToPIP();
|
||||
} catch (ex) { }
|
||||
}
|
||||
|
||||
window.addEventListener('message', receiveMessage, false);
|
||||
Loading…
x
Reference in New Issue
Block a user