mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
142 lines
4.8 KiB
JavaScript
142 lines
4.8 KiB
JavaScript
// ==UserScript==
|
|
// @name Bilibili Evolved
|
|
// @namespace http://tampermonkey.net/
|
|
// @version 0.1.0
|
|
// @description Powerful tools for bilibili.
|
|
// @author Grant Howard
|
|
// @match *://*.bilibili.com/*
|
|
// @match *://*.bilibili.com
|
|
// @grant unsafeWindow
|
|
// @resource style https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/style/style.scss
|
|
// @resource touchPlayerStyle https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/style/style-touch-player.scss
|
|
// @resource oldStyle https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/style/style-old.scss
|
|
// @resource darkStyle https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/style/style-dark.scss
|
|
// @require https://static.hdslb.com/js/jquery.min.js
|
|
// @require https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/utils/common.min.js
|
|
// @require https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/utils/remove-ads.min.js
|
|
// @require https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/utils/watchlater.min.js
|
|
// @require https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/utils/expand-danmaku.min.js
|
|
// @require https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/touch/touch-navbar.min.js
|
|
// @require https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/touch/touch-player.min.js
|
|
// @require https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/style/new-styles.min.js
|
|
// @require https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/style/dark-styles.min.js
|
|
// ==/UserScript==
|
|
|
|
(self$ =>
|
|
{
|
|
const colors = {
|
|
red: "#E53935",
|
|
pink: "#F06292",
|
|
purple: "#AB47BC",
|
|
deepPurple: "#7E57C2",
|
|
indigo: "#7986CB",
|
|
blue: "#1E88E5",
|
|
lightBlue: "#00A0D8",
|
|
cyan: "#00ACC1",
|
|
teal: "#26A69A",
|
|
green: "#66BB6A",
|
|
lightGreen: "#8BC34A",
|
|
lime: "#CDDC39",
|
|
yellow: "#FFEB3B",
|
|
amber: "#FFC107",
|
|
orange: "#FF9800",
|
|
deepOrange: "#FF5722",
|
|
brown: "#795548",
|
|
grey: "#757575",
|
|
blueGrey: "#607D8B"
|
|
};
|
|
// User settings will overwrite default settings below
|
|
const userSettings = {
|
|
customStyleColor: colors.pink,
|
|
showBanner: false,
|
|
useDarkMode: true
|
|
};
|
|
const settings = {
|
|
// remove ads
|
|
removeAds: true,
|
|
// max retry count used for query elements
|
|
maxQueryRetry: 30,
|
|
// query retry interval (ms)
|
|
queryInterval: 500,
|
|
// touch support for nav bar (not compatible with Edge)
|
|
touchNavBar: true,
|
|
// (Experimental) touch support for video player
|
|
touchVideoPlayer: true,
|
|
// redirect to original sites in watchlater list
|
|
watchLaterRedirect: true,
|
|
// auto expand danmaku list
|
|
expandDanmakuList: true,
|
|
// use new styles for nav bar and player
|
|
useNewStyles: true,
|
|
// [New Styles]
|
|
// set theme color (must in #rrggbb format, not compatible with Edge)
|
|
customStyleColor: colors.pink,
|
|
// [New Styles]
|
|
// set background blur opacity of nav bar
|
|
blurBackgroundOpacity: 0.382,
|
|
// [New Styles]
|
|
// (Not Implemented) use dark mode
|
|
useDarkMode: true,
|
|
// [New Styles]
|
|
// (Experimental) use new nav bar in old sites
|
|
overrideNavBar: true,
|
|
// [New Styles -> Override Nav Bar]
|
|
// show top banner
|
|
showBanner: true
|
|
};
|
|
for (const key in userSettings)
|
|
{
|
|
settings[key] = userSettings[key];
|
|
}
|
|
const $ = unsafeWindow.$ || self$;
|
|
const getEventHandler = (element, event) =>
|
|
{
|
|
return element.data("events")[event][0].handler;
|
|
};
|
|
|
|
|
|
$(document).ready(() =>
|
|
{
|
|
if (settings.removeAds)
|
|
{
|
|
removeAds();
|
|
}
|
|
if (settings.touchNavBar)
|
|
{
|
|
touchNavBar();
|
|
}
|
|
if (settings.touchVideoPlayer)
|
|
{
|
|
touchVideoPlayer();
|
|
$(document).ajaxComplete(() =>
|
|
{
|
|
touchVideoPlayer();
|
|
});
|
|
}
|
|
if (settings.watchLaterRedirect)
|
|
{
|
|
watchlaterRedirect();
|
|
$(document).ajaxComplete(() =>
|
|
{
|
|
watchlaterRedirect();
|
|
});
|
|
}
|
|
if (settings.expandDanmakuList)
|
|
{
|
|
expandDanmakuList();
|
|
$(document).ajaxComplete(() =>
|
|
{
|
|
expandDanmakuList();
|
|
});
|
|
}
|
|
if (settings.useNewStyles)
|
|
{
|
|
newStyle();
|
|
}
|
|
if (settings.useDarkMode)
|
|
{
|
|
darkStyle();
|
|
}
|
|
});
|
|
})(window.jQuery.noConflict(true));
|