您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
【宽屏模式支持视频/番剧/列表】此插件主要是为了兼容在宽屏模式下直接滚动至最上方会导致播放器不完整,所以把标题栏和头像移至视频下方,附赠一些其他功能
当前为
// ==UserScript== // @name MR哔哩哔哩助手-自动宽屏模式/智能连播/宽屏模式体验优化标题栏下移 // @namespace https://github.com/iMortRex // @version 0.2.1 // @description 【宽屏模式支持视频/番剧/列表】此插件主要是为了兼容在宽屏模式下直接滚动至最上方会导致播放器不完整,所以把标题栏和头像移至视频下方,附赠一些其他功能 // @author Mort Rex // @run-at document-end // @match *.bilibili.com/video/* // @match *.bilibili.com/bangumi/* // @match *.bilibili.com/medialist/* // @include *.bilibili.com/video/* // @include *.bilibili.com/bangumi/* // @include *.bilibili.com/medialist/* // @require https://code.jquery.com/jquery-3.6.0.min.js // @icon https://www.bilibili.com/favicon.ico // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @grant GM_registerMenuCommand // @grant GM_unregisterMenuCommand // @license MIT // ==/UserScript== // 初始化全局变量 if (GM_getValue('autoWidescreenSwitch') == null) { // 默认打开自动宽屏模式 GM_setValue('autoWidescreenSwitch', 1); } if (GM_getValue('smartNextPlaySwitch') == null) { // 默认打开自动宽屏模式 GM_setValue('smartNextPlaySwitch', 1); } // 菜单按钮 GM_registerMenuCommand('开关自动宽屏模式', function () { autoWidescreenClick(); }); GM_registerMenuCommand('开关智能连播', function () { smartNextPlayClick(); }); // 点击菜单按钮后触发事件 function autoWidescreenClick() { if (GM_getValue('autoWidescreenSwitch') == 1) { GM_setValue('autoWidescreenSwitch', 2); alert('已关闭自动宽屏模式\n请刷新网页更新状态'); } else { GM_setValue('autoWidescreenSwitch', 1); alert('已开启自动宽屏模式\n请刷新网页更新状态'); } } function smartNextPlayClick() { if (GM_getValue('smartNextPlaySwitch') == 1) { GM_setValue('smartNextPlaySwitch', 2); alert('已关闭智能连播\n请刷新网页更新状态'); } else { GM_setValue('smartNextPlaySwitch', 1); alert('已开启智能连播\n分P/合集/列表/番剧页自动连播,单集不连播\n请刷新网页更新状态'); } } // 执行代码 (function () { 'use strict'; // 自动宽屏模式 if (GM_getValue('autoWidescreenSwitch') == 1) { // 当开启自动宽屏模式时再执行脚本 var autoWidescreenEtime = 0; autoWidescreen(); function autoWidescreen() { if (window.location.href.match('bilibili.com/bangumi/')) { console.log('哔哩哔哩宽屏优化-当前页面是:番剧'); autoWidescreenBangumi(); function autoWidescreenBangumi() { if (document.getElementsByClassName('squirtle-video-widescreen squirtle-video-item')[0]) { // 检测番剧页面宽屏模式相关元素是否加载完毕 if (!document.getElementsByClassName('squirtle-video-widescreen squirtle-video-item active')[0]) { // 如果当前不是宽屏模式则点击宽屏模式按钮 document.getElementsByClassName('squirtle-video-widescreen squirtle-video-item')[0].click(); } } else { // 每100毫秒检测一次,8秒后不再执行 autoWidescreenEtime += 100; if (autoWidescreenEtime < 8000) { setTimeout(autoWidescreenBangumi, 100); } } } } else if (window.location.href.match('bilibili.com/video/')) { console.log('哔哩哔哩宽屏优化-当前页面是:视频'); autoWidescreenVideo(); function autoWidescreenVideo() { if (document.getElementsByClassName('bpx-player-ctrl-btn bpx-player-ctrl-wide')[0]) { // 检测视频页面宽屏模式相关元素是否加载完毕 if (!document.getElementsByClassName('bpx-player-ctrl-btn bpx-player-ctrl-wide bpx-state-entered')[0]) { // 检测当前是否已是宽屏模式 document.getElementsByClassName('bpx-player-ctrl-btn bpx-player-ctrl-wide')[0].click(); } } else { // 每100毫秒检测一次,8秒后不再执行 autoWidescreenEtime += 100; if (autoWidescreenEtime < 8000) { setTimeout(autoWidescreenVideo, 100); } } } } else { console.log('哔哩哔哩宽屏优化-当前页面是:列表'); autoWidescreenVideo(); function autoWidescreenVideo() { if (document.getElementsByClassName('bilibili-player-video-btn bilibili-player-video-btn-widescreen')[0]) { // 检测视频页面宽屏模式相关元素是否加载完毕 if (!document.getElementsByClassName('bilibili-player-video-btn bilibili-player-video-btn-widescreen closed')[0]) { // 检测当前是否已是宽屏模式 document.getElementsByClassName('bilibili-player-video-btn bilibili-player-video-btn-widescreen')[0].click(); } } else { // 每100毫秒检测一次,8秒后不再执行 autoWidescreenEtime += 100; if (autoWidescreenEtime < 8000) { setTimeout(autoWidescreenVideo, 100); } } } } } } // 智能切集 if (GM_getValue('smartNextPlaySwitch') == 1) { var smartNextPlayLock = 0; smartNextPlay(); function smartNextPlay() { let smartNextPlayCurrentTime = ''; let smartNextPlayDurationTime = ''; let smartNextPlayNextBtn; // 如果集数大于1则连播,如果只有一集则不连播 if (document.getElementById('multi_page') && document.getElementsByClassName('list-box')[0].childElementCount > 1) { // 分P if (document.getElementsByClassName('bpx-player-progress-schedule-current')[0]) { smartNextPlayCurrentTime = document.getElementsByClassName('bpx-player-progress-schedule-current')[0].style.transform; smartNextPlayDurationTime = 'scaleX(1)'; } if (document.getElementsByClassName('bpx-player-ctrl-btn bpx-player-ctrl-next')[0]) { smartNextPlayNextBtn = document.getElementsByClassName('bpx-player-ctrl-btn bpx-player-ctrl-next')[0]; } // 自动改成“播完暂停” if (document.getElementsByClassName('bui-radio-text')[1]) { document.getElementsByClassName('bui-radio-text')[1].click(); } } else if (document.getElementsByClassName('base-video-sections')[0] && document.getElementsByClassName('video-section-list section-0')[0].childElementCount > 1) { // 合集 if (document.getElementsByClassName('bpx-player-progress-schedule-current')[0]) { smartNextPlayCurrentTime = document.getElementsByClassName('bpx-player-progress-schedule-current')[0].style.transform; smartNextPlayDurationTime = 'scaleX(1)'; } if (document.getElementsByClassName('bpx-player-ctrl-btn bpx-player-ctrl-next')[0]) { smartNextPlayNextBtn = document.getElementsByClassName('bpx-player-ctrl-btn bpx-player-ctrl-next')[0]; } // 自动改成“播完暂停” if (document.getElementsByClassName('bui-radio-text')[1]) { document.getElementsByClassName('bui-radio-text')[1].click(); } } else if (document.getElementsByClassName('player-auxiliary-collapse-playlist bui bui-collapse')[0] && document.getElementsByClassName('player-auxiliary-playlist-list')[0].childElementCount > 1) { // 列表 if (document.getElementsByClassName('bui-bar bui-bar-normal')[0]) { smartNextPlayCurrentTime = document.getElementsByClassName('bui-bar bui-bar-normal')[0].style.transform; smartNextPlayDurationTime = 'scaleX(1)'; } if (document.getElementsByClassName('bilibili-player-video-btn bilibili-player-video-btn-next')[0]) { smartNextPlayNextBtn = document.getElementsByClassName('bilibili-player-video-btn bilibili-player-video-btn-next')[0]; } // 自动改成“播完暂停” if (document.getElementsByClassName('bui-radio-text')[1]) { document.getElementsByClassName('bui-radio-text')[1].click(); } } else if (window.location.href.match('bilibili.com/bangumi/')) { // 番剧 if (document.getElementsByClassName('squirtle-progress-timeline squirtle-progress-bar')[0]) { smartNextPlayCurrentTime = document.getElementsByClassName('squirtle-progress-timeline squirtle-progress-bar')[0].style.transform; smartNextPlayDurationTime = 'scaleX(1) translateZ(0px)'; } if (document.getElementsByClassName('squirtle-iconfont squirtle-video-next squirtle-video-item')[0]) { smartNextPlayNextBtn = document.getElementsByClassName('squirtle-iconfont squirtle-video-next squirtle-video-item')[0]; } // 自动改成“播完暂停” if (document.getElementsByClassName('squirtle-single-setting-choice squirtle-aspect-handoff-choice squirtle-handoff-pause')[0]) { document.getElementsByClassName('squirtle-single-setting-choice squirtle-aspect-handoff-choice squirtle-handoff-pause')[0].click(); } } if ((smartNextPlayCurrentTime == smartNextPlayDurationTime) && smartNextPlayCurrentTime != '' && smartNextPlayDurationTime != '' && smartNextPlayLock == 0) { if (smartNextPlayNextBtn) { smartNextPlayLock = 1; smartNextPlayNextBtn.click(); console.log('哔哩哔哩宽屏优化-自动切换下一集'); } } if (smartNextPlayCurrentTime != smartNextPlayDurationTime) { smartNextPlayLock = 0; } setTimeout(smartNextPlay, 100) } } var wideCheckEtime = 0; wideCheck(); console.log('哔哩哔哩宽屏优化-正在检测宽屏模式'); function wideCheck() { if (window.location.href.match('bilibili.com/bangumi/')) { // 当前为番剧页 if (document.getElementsByClassName('squirtle-video-widescreen squirtle-video-item active')[0]) { console.log('哔哩哔哩宽屏优化-宽屏模式已开启'); mainScript(); } else { wideCheckEtime += 100; if (wideCheckEtime >= 8000) { mainScript(); } else { setTimeout(wideCheck, 100); } } } else if (window.location.href.match('bilibili.com/video/')) { // 当前为视频页 if (document.getElementsByClassName('bpx-player-ctrl-btn bpx-player-ctrl-wide bpx-state-entered')[0]) { console.log('哔哩哔哩宽屏优化-宽屏模式已开启'); mainScript(); } else { wideCheckEtime += 100; if (wideCheckEtime >= 8000) { mainScript(); } else { setTimeout(wideCheck, 100); } } } else { // 当前为列表页 if (document.getElementsByClassName('bilibili-player-video-btn bilibili-player-video-btn-widescreen closed')[0]) { console.log('哔哩哔哩宽屏优化-宽屏模式已开启'); mainScript(); } else { wideCheckEtime += 100; if (wideCheckEtime >= 8000) { mainScript(); } else { setTimeout(wideCheck, 100); } } } } function mainScript() { if (window.location.href.match('bilibili.com/bangumi/')) { // 当前为番剧页 } else if (window.location.href.match('bilibili.com/video/')) { // 当前为视频页 var viewboxCheckEtime = 0; viewboxCheck(); function viewboxCheck() { if (document.getElementById('viewbox_report')) { // 把标题栏移至视频下方 $('#viewbox_report').insertAfter('#playerWrap'); } else { viewboxCheckEtime += 100; if (viewboxCheckEtime >= 8000) { $('#viewbox_report').insertAfter('#playerWrap'); } else { setTimeout(viewboxCheck, 100); } } } // var upinfoCheckEtime = 0; upinfoCheck(); function upinfoCheck() { // 把头像栏移至标题栏下方 if (document.getElementById('v_upinfo')) { // 检测头像栏是否加载完毕,如果是则继续运行 $('#v_upinfo').insertAfter('#viewbox_report'); } else { upinfoCheckEtime += 100; if (upinfoCheckEtime >= 8000) { $('#v_upinfo').insertAfter('#viewbox_report'); } else { setTimeout(upinfoCheck, 100); } } } // if (document.getElementsByClassName('v-wrap')[0]) { // 旧版界面 console.log('哔哩哔哩宽屏优化-当前为旧版界面'); // // 调整标题栏样式 /* 为标题栏添加底部横线:横线[border-bottom] 调整标题栏高度和上下距离:高度[height]顶部间隙[padding-top]底部间隙[padding-bottom] */ // 正常使用.css方法无法添加important后缀,使用cssText强行添加important后缀,想添加某个元素就用cssText,例如:$('a').css('cssText', 'b'),删除某个元素就把后方变量留空,例如:$('a').css('b', ''); // 移除所有style样式:$('a').removeAttr('style'); // 改变style样式:由于cssText每次设定都会清除所有style值,所以用document.querySelector('a').style.cssText += '; 1: 1;' document.getElementById('viewbox_report').style.cssText += 'border-bottom: 1px solid ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important; height: 80px !important; padding-top: 16px !important; padding-bottom: 12px !important;'; // // 调整头像栏样式 /* 为头像栏添加底部横线:横线[border-bottom] 调整头像栏高度与标题栏一致:高度[height]顶部间隙[padding-top]底部间隙[padding-bottom] */ if (document.getElementsByClassName('members-info')[0]) { // 联合投稿头像栏额外操作 $('.members-info').insertAfter('#viewbox_report'); document.getElementsByClassName('members-info')[0].style.cssText += 'border-bottom: 1px solid ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important; padding-top: 16px !important; padding-bottom: 12px !important;'; if (document.getElementsByClassName('members-info__header')[0]) { document.getElementsByClassName('members-info__header')[0].style.cssText += 'margin-top: 0 !important;'; } else if (document.getElementsByClassName('wide-members__title')[0]) { document.getElementsByClassName('wide-members__title')[0].style.cssText += 'margin-top: 0 !important;'; } } else { document.getElementsByClassName('up-info report-wrap-module report-scroll-module')[0].style.cssText += 'border-bottom: 1px solid ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important; height: 80px !important; padding-top: 16px !important; padding-bottom: 12px !important;'; // 调整头像栏宽度 /* 宽度[width]位置布局[margin] */ document.getElementsByClassName('up-info_right')[0].style.cssText += 'width: 100% !important; margin: 6px 0px 0px 62px !important;'; // 调整头像右边距离 /* 位置布局[margin] */ document.getElementsByClassName('u-face')[0].style.cssText += 'margin: 2px -48px 0px 0px !important;'; // 调整名称 /* 调整名称高度:高度[line-height] 调整名称左边间距:位置布局[margin] */ // document.getElementsByClassName('name')[0].style.cssText += 'line-height: 24px !important; margin: 4px 0px 0px 62px !important'; // 调整介绍 /* 调整介绍高度:顶部距离[margin-top] 调整介绍宽度:宽度[width] */ // document.getElementsByClassName('desc')[0].style.cssText += 'width: 45% !important;'; // 调整充电和关注按钮 /* 调整充电和关注按钮与头像平齐:位置布局[margin] 调整充电和关注按钮高度和宽度:高度[height]位置布局[margin] */ document.getElementsByClassName('default-btn follow-btn btn-transition b-gz')[0].style.cssText += 'height: 48px !important; margin: 0px 0px 0px auto !important;'; document.getElementsByClassName('btn-panel')[0].style.cssText += 'margin: -44px 6px 0px 0px !important;'; if (document.getElementsByClassName('default-btn charge-btn')[0]) { document.getElementsByClassName('default-btn charge-btn btn-transition')[0].style.cssText += 'height: 48px !important;'; // 如果存在充电按钮则移除关注按钮的一个布局属性 document.getElementsByClassName('default-btn follow-btn btn-transition b-gz')[0].style.margin = ''; } } // 调整三连栏底部横线样式 /* 横线[border-bottom] */ document.getElementsByClassName('video-toolbar report-wrap-module report-scroll-module')[0].style.cssText += 'border-bottom: 1px solid ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important;'; // 额外循环判断底部横线颜色,快速循环8秒后进入缓慢循环判断模式 var borderColorCheckEtime = 0; var borderColorCheckForeverSwitch = 0; borderColorCheck(); function borderColorCheck() { function borderColorCheckFunction() { // 标题栏的横线颜色 document.getElementsByClassName('video-info report-wrap-module report-scroll-module')[0].style.cssText += 'border-bottom-color: ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important;'; // 头像栏的横线颜色 if (!document.getElementsByClassName('members-info')[0]) { document.getElementsByClassName('up-info report-wrap-module report-scroll-module')[0].style.cssText += 'border-bottom-color: ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important;'; } else { // 联合投稿头像栏额外操作 document.getElementsByClassName('members-info')[0].style.cssText += 'border-bottom-color: ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important;'; if (document.getElementsByClassName('members-info__header')[0]) { document.getElementsByClassName('members-info__header')[0].style.cssText += 'margin-top: 0 !important;'; } else if (document.getElementsByClassName('wide-members__title')[0]) { document.getElementsByClassName('wide-members__title')[0].style.cssText += 'margin-top: 0 !important;'; } } // 三连栏的横线颜色 document.getElementsByClassName('video-toolbar report-wrap-module report-scroll-module')[0].style.cssText += 'border-bottom-color: ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important;'; } // 判断自定义的横线和标准横线的颜色是否一致,如果你想用JQ写可以用$('xxx').css('cssText', $('xxx').css('cssText') + 'XXX !important;'); if (document.getElementsByClassName('video-info report-wrap-module report-scroll-module')[0].style.borderBottomColor != window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color']) { borderColorCheckFunction(); // 开启永久循环判断 borderColorCheckForeverSwitch = 1; } else { borderColorCheckEtime += 100; if (borderColorCheckEtime >= 8000) { borderColorCheckFunction(); // 开启永久循环判断 borderColorCheckForeverSwitch = 1; } else { setTimeout(borderColorCheck, 100); } } if (borderColorCheckForeverSwitch == 1) { borderColorCheckFunction(); // 每隔一段时间判断一次 setTimeout(borderColorCheck, 1000); } } } else { // 新版界面 console.log('哔哩哔哩宽屏优化-当前为新版界面'); // // 调整标题栏样式 /* 为标题栏添加底部横线:横线[border-bottom] 调整标题栏高度:高度[height]顶部间隙[padding-top]底部间隙[padding-bottom] */ document.getElementsByClassName('video-info-v1')[0].style.cssText += 'border-bottom: 1px solid ' + window.getComputedStyle(document.getElementsByClassName('s_tag-v1')[0], null)['border-bottom-color'] + ' !important; height: 86px !important; padding-top: 16px !important; padding-bottom: 12px !important;'; // // 调整头像栏样式 /* 为头像栏添加底部横线:横线[border-bottom] 调整头像栏高度与标题栏一致:高度[height]顶部间隙[padding-top]底部间隙[padding-bottom]位置布局[margin] */ if (document.getElementsByClassName('members-info-v1')[0]) { // 联合投稿头像栏额外操作 $('.members-info-v1').insertAfter('#viewbox_report'); document.getElementsByClassName('members-info-v1')[0].style.cssText += 'border-bottom: 1px solid ' + window.getComputedStyle(document.getElementsByClassName('s_tag-v1')[0], null)['border-bottom-color'] + ' !important; padding-top: 16px !important; padding-bottom: 12px !important;'; } else { // 当不是联合投稿时 document.getElementsByClassName('up-info-v1')[0].style.cssText += 'border-bottom: 1px solid ' + window.getComputedStyle(document.getElementsByClassName('s_tag-v1')[0], null)['border-bottom-color'] + ' !important; height: 86px !important; padding-top: 16px !important; padding-bottom: 12px !important; margin: 0px 0px 0px 0px !important;'; // 调整头像右侧信息/关注宽度 /* 宽度[width]左侧距离[margin-left] */ document.getElementsByClassName('up-info_right')[0].style.cssText += 'width: 100% !important; margin-left: 0px !important;'; // 调整头像位置 /* 位置布局[margin] */ if (document.getElementsByClassName('u-face')[0]) { document.getElementsByClassName('u-face')[0].style.cssText += 'margin: 4px 0px 0px 0px !important;'; } // 调整头像栏有装饰时的位置 /* 宽度[width]高度[height]布局中位置[position] */ if (document.getElementsByClassName('u-face has-pendant')[0]) { // 存在头像装饰 document.getElementsByClassName('u-face has-pendant')[0].style.cssText += 'width: 48px !important; height: 48px !important;'; document.getElementsByClassName('u-face__avatar avatar-loaded')[0].style.cssText += 'width: 40px !important; height: 40px !important; position: unset !important;'; } // 调整名称 /* 调整名称高度:位置布局[margin] */ document.getElementsByClassName('up-info_right')[0].style.cssText += 'padding-top: 4px !important; margin: 0px 0px 0px 14px !important;'; // 调整介绍 /* 调整介绍高度:位置布局[margin] 调整介绍宽度:宽度[width]顶部间隙[padding-top] */ document.getElementsByClassName('desc')[0].style.cssText += 'margin: 0px 0px 0px 0px !important; width: 54% !important;'; // 调整充电和关注按钮 /* 调整充电和关注按钮与头像平齐:位置布局[margin]对其位置[float] 调整充电和关注按钮高度和宽度:高度[height]宽度[width]右侧距离[margin-right] */ // 整体 document.getElementsByClassName('btn-panel')[0].style.cssText += 'margin: -42px 0px 0px 0px !important; float: right !important; height: 48px !important;'; // 关注按钮 document.getElementsByClassName('default-btn follow-btn btn-transition b-gz')[0].style.cssText += 'width: 120px !important; margin-right: 10px !important; height: 48px !important;'; // 充电按钮 if (document.getElementsByClassName('default-btn charge-btn btn-transition')[0]) { document.getElementsByClassName('default-btn charge-btn btn-transition')[0].style.cssText += 'width: 70px !important; height: 48px !important;'; } } // // 额外循环判断底部横线颜色 var borderColorCheckEtime = 0; var borderColorCheckForeverSwitch = 0; borderColorCheck(); function borderColorCheck() { function borderColorCheckFunction() { // 判断自定义的横线和标准横线的颜色是否一致,如果不一致则改为一致 // 标题栏的横线颜色 document.getElementsByClassName('video-info-v1')[0].style.cssText += 'border-bottom-color: ' + window.getComputedStyle(document.getElementsByClassName('s_tag-v1')[0], null)['border-bottom-color'] + ' !important;'; // 头像栏的横线颜色 if (!document.getElementsByClassName('members-info-v1')[0]) { document.getElementsByClassName('up-info-v1')[0].style.cssText += 'border-bottom-color: ' + window.getComputedStyle(document.getElementsByClassName('s_tag-v1')[0], null)['border-bottom-color'] + ' !important;'; } else { document.getElementsByClassName('members-info-v1')[0].style.cssText += 'border-bottom-color: ' + window.getComputedStyle(document.getElementsByClassName('s_tag-v1')[0], null)['border-bottom-color'] + ' !important;'; } } if (document.getElementsByClassName('video-info-v1')[0].style.borderBottomColor != window.getComputedStyle(document.getElementsByClassName('s_tag-v1')[0], null)['border-bottom-color']) { borderColorCheckFunction(); // 开启永久循环判断 borderColorCheckForeverSwitch = 1; } else { borderColorCheckEtime = borderColorCheckEtime + 100; if (borderColorCheckEtime >= 8000) { borderColorCheckFunction(); // 开启永久循环判断 borderColorCheckForeverSwitch = 1; } else { setTimeout(borderColorCheck, 100); } if (borderColorCheckForeverSwitch == 1) { borderColorCheckFunction(); // 每隔一段时间判断一次 setTimeout(borderColorCheck, 1000); } } } } } else { // 当前为列表页 console.log('哔哩哔哩宽屏优化-当前为列表界面'); var viewboxCheckEtime = 0; viewboxCheck(); function viewboxCheck() { if (document.getElementById('viewbox_report')) { // 把标题栏移至视频下方 $('#viewbox_report').insertAfter('#video-player'); } else { viewboxCheckEtime += 100; if (viewboxCheckEtime >= 8000) { $('#viewbox_report').insertAfter('#video-player'); } else { setTimeout(viewboxCheck, 100); } } // // 调整标题栏样式 /* 为标题栏添加底部横线:横线颜色[border-bottom-color]横线粗细[border-bottom] 调整标题栏高度和上下距离:高度[height]顶部间隙[padding-top]底部间隙[padding-bottom] */ // 正常使用.css方法无法添加important后缀,使用cssText强行添加important后缀,想添加某个元素就用cssText,例如:$('a').css('cssText', 'b'),删除某个元素就把后方变量留空,例如:$('a').css('b', ''); document.getElementsByClassName('video-info report-wrap-module report-scroll-module')[0].style.cssText += 'border-bottom: 1px solid ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important; height: 80px !important; padding-top: 16px !important; padding-bottom: 12px !important;'; } // var upinfoCheckEtime = 0; upinfoCheck(); function upinfoCheck() { // 把头像栏移至标题栏下方 if (document.getElementById('v_upinfo')) { // 检测头像栏是否加载完毕,如果是则继续运行 $('#v_upinfo').insertAfter('#viewbox_report'); } else { upinfoCheckEtime += 100; if (upinfoCheckEtime >= 8000) { $('#v_upinfo').insertAfter('#viewbox_report'); } else { setTimeout(upinfoCheck, 100); } } // // 调整头像栏样式 /* 为头像蓝添加底部横线:横线颜色[border-bottom-color]横线粗细[border-bottom] 调整头像栏高度与标题栏一致:高度[height]顶部间隙[padding-top]底部间隙[padding-bottom] */ if (document.getElementsByClassName('members-info')[0]) { //联合投稿头像栏额外操作 $('.members-info').insertAfter('#viewbox_report'); document.getElementsByClassName('members-info')[0].style.cssText += 'border-bottom: 1px solid ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important; padding-top: 16px !important; padding-bottom: 12px !important;'; if (document.getElementsByClassName('members-info__header')[0]) { document.getElementsByClassName('members-info__header')[0].style.cssText += 'margin-top: 0 !important;'; } else if (document.getElementsByClassName('wide-members__title')[0]) { document.getElementsByClassName('wide-members__title')[0].style.cssText += 'margin-top: 0 !important;'; } } else if (document.getElementById('v_upinfo')) { document.getElementsByClassName('up-info report-wrap-module report-scroll-module')[0].style.cssText += 'border-bottom: 1px solid ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important; height: 80px !important; padding-top: 16px !important; padding-bottom: 12px !important;'; // 调整头像栏宽度 /* 宽度[width]位置布局[margin] */ document.getElementsByClassName('up-info_right')[0].style.cssText += 'width: 100% !important; margin: 6px 0px 0px 62px !important;'; // 调整头像右边距离 /* 位置布局[margin] */ document.getElementsByClassName('u-face')[0].style.cssText += 'margin: 2px -48px 0px 0px !important;'; // 调整名称 /* 调整名称高度:高度[line-height] 调整名称左边间距:位置布局[margin] */ // 调整介绍 /* 调整介绍高度:顶部距离[margin-top] 调整介绍宽度:宽度[width] */ // document.getElementsByClassName('desc')[0].style.cssText += 'width: 45% !important;'; // $('.up-info.up-info_right.name').css('cssText', 'line-height: 24px !important; margin: 4px 0px 0px 62px !important'); // 调整充电和关注按钮 /* 调整充电和关注按钮与头像平齐:位置布局[margin] 调整充电和关注按钮高度和宽度:高度[height]位置布局[margin] */ document.getElementsByClassName('default-btn follow-btn btn-transition b-gz')[0].style.cssText += 'height: 48px !important; margin: 0px 0px 0px auto !important;'; document.getElementsByClassName('btn-panel')[0].style.cssText += 'margin: -44px 6px 0px 0px !important;'; if (document.getElementsByClassName('default-btn charge-btn')[0]) { document.getElementsByClassName('default-btn charge-btn btn-transition')[0].style.cssText += 'height: 48px !important;'; // 如果存在充电按钮则移除关注按钮的一个布局属性 document.getElementsByClassName('default-btn follow-btn btn-transition b-gz')[0].style.margin = ''; } } } // var mediaListCheckEtime = 0; mediaListScript(); function mediaListScript() { if (document.getElementsByClassName('v-wrap')[0]) { // 调整三连栏底部横线样式 /* 横线[border-bottom] */ document.getElementsByClassName('video-toolbar report-wrap-module report-scroll-module')[0].style.cssText += 'border-bottom: 1px solid ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important;'; // 额外循环判断底部横线颜色 var borderColorCheckEtime = 0; var borderColorCheckForeverSwitch = 0; borderColorCheck(); function borderColorCheck() { function borderColorCheckFunction() { document.getElementsByClassName('video-info report-wrap-module report-scroll-module')[0].style.cssText += 'border-bottom-color: ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important;'; // 头像栏的横线颜色 if (document.getElementById('v_upinfo')) { document.getElementsByClassName('up-info report-wrap-module report-scroll-module')[0].style.cssText += 'border-bottom-color: ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important;'; } else if (document.getElementsByClassName('members-info')[0]) { //联合投稿头像栏额外操作 document.getElementsByClassName('members-info')[0].style.cssText += 'border-bottom-color: ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important;'; if (document.getElementsByClassName('members-info__header')[0]) { document.getElementsByClassName('members-info__header')[0].style.cssText += 'margin-top: 0 !important;'; } else if (document.getElementsByClassName('wide-members__title')[0]) { document.getElementsByClassName('wide-members__title')[0].style.cssText += 'margin-top: 0 !important;'; } } // 三连栏的横线颜色 document.getElementsByClassName('video-toolbar report-wrap-module report-scroll-module')[0].style.cssText += 'border-bottom-color: ' + window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color'] + ' !important;'; } if (document.getElementsByClassName('video-info report-wrap-module report-scroll-module')[0].style.borderBottomColor != window.getComputedStyle(document.getElementsByClassName('s_tag')[0], null)['border-bottom-color']) { // 判断自定义的横线和标准横线的颜色是否一致,如果不一致则改为一致 // 标题栏的横线颜色 borderColorCheckFunction(); // 开启永久循环判断 borderColorCheckForeverSwitch = 1; } else { borderColorCheckEtime = borderColorCheckEtime + 100; if (borderColorCheckEtime >= 8000) { // 标题栏的横线颜色 borderColorCheckFunction(); // 开启永久循环判断 borderColorCheckForeverSwitch = 1; } else { setTimeout(borderColorCheck, 100); } } if (borderColorCheckForeverSwitch == 1) { borderColorCheckFunction(); // 每隔一段时间判断一次 setTimeout(borderColorCheck, 1000); } } } else { mediaListCheckEtime = mediaListCheckEtime + 100; if (mediaListCheckEtime < 5000) { setTimeout(mediaListScript, 100); } } } } window.scrollTo(0, 0); } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址