Created
October 11, 2017 13:19
-
-
Save oott123/f7168d488443438513e79ee5067a9fd3 to your computer and use it in GitHub Desktop.
pandatv auto fullscreen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name 熊猫自动网页全屏 | |
// @namespace oott123_panda_fullscreen | |
// @version 0.1 | |
// @description 自动网页全屏+网页全屏按钮 | |
// @author You | |
// @match *://*.panda.tv/* | |
// @grant none | |
// @run-at document-end | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function enterFullscreen () { | |
$('.h5-control').hasClass('h5player-control-status-fullscreen') || $('.h5player-control-bar-fullscreen').click(); | |
$('.pd-sc-content').hasClass('room-chat-collesped') || $('.room-chat-expand-btn').click(); | |
} | |
function leaveFullscreen () { | |
$('.h5-control').hasClass('h5player-control-status-fullscreen') && $('.h5player-control-bar-fullscreen').click(); | |
$('.pd-sc-content').hasClass('room-chat-collesped') && $('.room-chat-expand-btn').click(); | |
} | |
function isPlaying () { | |
return $('.h5-control').hasClass('h5player-control-status-playing'); | |
} | |
var $btn = $('<button>网页全屏</button>').css({ | |
position: 'absolute', | |
left: 160, | |
top: 20 | |
}).click(enterFullscreen); | |
var id = setInterval(function () { | |
if (!isPlaying()) return; | |
clearInterval(id); | |
$('.room-foot-box').append($btn); | |
enterFullscreen(); | |
}, 1000); | |
$(window).on('resize', function () { | |
setTimeout(function () { | |
enterFullscreen(); | |
}, 100); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment