Skip to content

Instantly share code, notes, and snippets.

@oott123
Created October 11, 2017 13:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oott123/f7168d488443438513e79ee5067a9fd3 to your computer and use it in GitHub Desktop.
Save oott123/f7168d488443438513e79ee5067a9fd3 to your computer and use it in GitHub Desktop.
pandatv auto fullscreen
// ==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