您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
改进迅雷云播的播放器页面
当前为
- // ==UserScript==
- // @name XunLei Yunbo Better Player
- // @namespace qixinglu.com
- // @description 改进迅雷云播的播放器页面
- // @grant none
- // @include http://vod.xunlei.com/iplay.html?*
- // @include http://vod.xunlei.com/nplay.html?*
- // @version 0.0.1.20140517140352
- // ==/UserScript==
- var addStyle = function(cssText) {
- var head = document.querySelector('head');
- var style = document.createElement('style');
- style.setAttribute('type', 'text/css');
- style.textContent = cssText;
- head.appendChild(style);
- };
- var changePlayerArea = function() {
- var wrapNode = document.querySelector('.wrap');
- wrapNode.style.width = 'auto';
- wrapNode.style.padding = '0 20px';
- var height = window.innerHeight - 100; // 100 像素大约是顶部标题的高度
- var width = Math.ceil(height * 16 / 9); // 按 16:9 比例算出对应的宽度
- var playerArea = document.querySelector('#XL_CLOUD_VOD_PLAYER');
- playerArea.style.width = width + 'px';
- playerArea.style.height = height + 'px';
- };
- var changeDownloadArea = function() {
- var lixian = 'http://lixian.vip.xunlei.com/lixian_login.html?furl='
- var originalNode = document.querySelector('#original_url');
- originalNode.textContent = originalNode.title;
- var downLink = document.createElement('a');
- downLink.href = lixian + originalNode.title;
- downLink.textContent = '离线下载';
- downLink.target = '_blank';
- downLink.style.display = 'block';
- downLink.style.color = '#808080';
- downLink.style.padding = '6px';
- downLink.style.margin = '0 0 0 32px';
- var copyBtn = document.querySelector('#mycopyer');
- copyBtn.replaceChild(downLink, document.querySelector('#copyer'));
- };
- var isOldVersion = location.pathname == '/iplay.html';
- if (isOldVersion) {
- addStyle('body { width: auto !important;');
- changePlayerArea();
- window.addEventListener('resize', changePlayerArea);
- setTimeout(changeDownloadArea, 2000);
- } else {
- location.href = location.href.replace('/nplay.html', '/iplay.html');
- }