mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Merge branch 'preview'
This commit is contained in:
commit
8fa1551fc8
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@
|
||||
build-scripts/
|
||||
.node_modules/
|
||||
package-lock.json
|
||||
build.cache
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
// ==UserScript==
|
||||
// @name Bilibili Evolved (Preview)
|
||||
// @version 0.9.8
|
||||
// @version 1.0.0
|
||||
// @description 增强哔哩哔哩Web端体验. (预览版分支)
|
||||
// @author Grant Howard
|
||||
// @match *://*.bilibili.com/*
|
||||
@ -18,205 +18,199 @@
|
||||
(self$ =>
|
||||
{
|
||||
const $ = unsafeWindow.$ || self$;
|
||||
$(document).ready(() =>
|
||||
const settings = {
|
||||
removeAds: true,
|
||||
touchNavBar: false,
|
||||
touchVideoPlayer: false,
|
||||
watchLaterRedirect: true,
|
||||
expandDanmakuList: true,
|
||||
customStyleColor: "#00A0D8",
|
||||
blurBackgroundOpacity: 0.382,
|
||||
overrideNavBar: true,
|
||||
showBanner: true,
|
||||
useDarkStyle: false,
|
||||
useNewStyle: true
|
||||
};
|
||||
const ajaxReload = [
|
||||
"touchVideoPlayer",
|
||||
"watchLaterRedirect",
|
||||
"expandDanmakuList"
|
||||
];
|
||||
function waitForQuery()
|
||||
{
|
||||
const settings = {
|
||||
removeAds: true,
|
||||
touchNavBar: false,
|
||||
touchVideoPlayer: false,
|
||||
watchLaterRedirect: true,
|
||||
expandDanmakuList: true,
|
||||
customStyleColor: "#00A0D8",
|
||||
blurBackgroundOpacity: 0.382,
|
||||
overrideNavBar: true,
|
||||
showBanner: true,
|
||||
useDarkStyle: false,
|
||||
useNewStyle: true
|
||||
};
|
||||
const ajaxReload = [
|
||||
"touchVideoPlayer",
|
||||
"watchLaterRedirect",
|
||||
"expandDanmakuList"
|
||||
];
|
||||
function waitForQuery()
|
||||
const MaxRetry = 30;
|
||||
let retry = 0;
|
||||
const tryQuery = (query, condition, action, failed) =>
|
||||
{
|
||||
const MaxRetry = 30;
|
||||
let retry = 0;
|
||||
const tryQuery = (query, condition, action, failed) =>
|
||||
if (retry >= MaxRetry)
|
||||
{
|
||||
if (retry >= MaxRetry)
|
||||
if (failed)
|
||||
{
|
||||
if (failed)
|
||||
failed();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const result = query();
|
||||
if (condition(result))
|
||||
{
|
||||
action(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
retry++;
|
||||
setTimeout(() => tryQuery(query, condition, action, failed), 500);
|
||||
}
|
||||
}
|
||||
};
|
||||
return tryQuery;
|
||||
}
|
||||
function ajax(url, done)
|
||||
{
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("load", () => done(xhr.responseText));
|
||||
xhr.open("GET", url);
|
||||
xhr.send();
|
||||
}
|
||||
function loadSettings()
|
||||
{
|
||||
for (const key in settings)
|
||||
{
|
||||
settings[key] = GM_getValue(key, settings[key]);
|
||||
}
|
||||
settings.guiSettings = true;
|
||||
}
|
||||
function saveSettings(newSettings)
|
||||
{
|
||||
for (const key in settings)
|
||||
{
|
||||
GM_setValue(key, newSettings[key]);
|
||||
}
|
||||
}
|
||||
class ExternalResource
|
||||
{
|
||||
static get resourceUrls()
|
||||
{
|
||||
const root = "https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/";
|
||||
const urls = {
|
||||
style: "style/style.min.scss",
|
||||
oldStyle: "style/style-old.min.scss",
|
||||
darkStyle: "style/style-dark.min.scss",
|
||||
touchPlayerStyle: "style/style-touch-player.min.scss",
|
||||
navbarOverrideStyle: "style/style-navbar-override.min.css",
|
||||
noBannerStyle: "style/style-no-banner.min.css",
|
||||
guiSettingsStyle: "style/style-gui-settings.min.scss",
|
||||
guiSettingsDom: "utils/gui-settings.html",
|
||||
guiSettings: "utils/gui-settings.min.js",
|
||||
useDarkStyle: "style/dark-styles.min.js",
|
||||
useNewStyle: "style/new-styles.min.js",
|
||||
touchNavBar: "touch/touch-navbar.min.js",
|
||||
touchVideoPlayer: "touch/touch-player.min.js",
|
||||
expandDanmakuList: "utils/expand-danmaku.min.js",
|
||||
removeAds: "utils/remove-promotions.min.js",
|
||||
watchLaterRedirect: "utils/watchlater.min.js"
|
||||
};
|
||||
for (const key in urls)
|
||||
{
|
||||
urls[key] = root + urls[key];
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
constructor()
|
||||
{
|
||||
this.data = {};
|
||||
const foreground = (() =>
|
||||
{
|
||||
const regex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(settings.customStyleColor);
|
||||
const color = regex ? {
|
||||
r: parseInt(regex[1], 16),
|
||||
g: parseInt(regex[2], 16),
|
||||
b: parseInt(regex[3], 16)
|
||||
} : undefined;
|
||||
if (color)
|
||||
{
|
||||
const grey = 1 - (0.299 * color.r + 0.587 * color.g + 0.114 * color.b) / 255;
|
||||
if (grey < 0.35)
|
||||
{
|
||||
failed();
|
||||
return "#000";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "#fff";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const result = query();
|
||||
if (condition(result))
|
||||
return "#fff";
|
||||
}
|
||||
})();
|
||||
settings.foreground = foreground;
|
||||
settings.brightness = `${foreground === "#000" ? "100" : "0"}%`;
|
||||
settings.filterBrightness = foreground === "#000" ? "0" : "100";
|
||||
}
|
||||
ready(callback)
|
||||
{
|
||||
this.callback = callback;
|
||||
const replaceCustomColor = (style) =>
|
||||
{
|
||||
for (const key of Object.keys(settings))
|
||||
{
|
||||
style = style.replace(new RegExp("\\$" + key, "g"), settings[key]);
|
||||
}
|
||||
return style;
|
||||
};
|
||||
const urls = ExternalResource.resourceUrls;
|
||||
const resourceCount = Object.keys(urls).length;
|
||||
let downloadedCount = 0;
|
||||
for (const key in urls)
|
||||
{
|
||||
const url = urls[key];
|
||||
ajax(url, data =>
|
||||
{
|
||||
if (url.indexOf(".scss") !== -1)
|
||||
{
|
||||
action(result);
|
||||
this.data[key] = replaceCustomColor(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
retry++;
|
||||
setTimeout(() => tryQuery(query, condition, action, failed), 500);
|
||||
this.data[key] = data;
|
||||
}
|
||||
}
|
||||
};
|
||||
return tryQuery;
|
||||
downloadedCount++;
|
||||
if (downloadedCount >= resourceCount && this.callback)
|
||||
{
|
||||
this.callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function ajax(url, done)
|
||||
getStyle(key, id)
|
||||
{
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("load", () => done(xhr.responseText));
|
||||
xhr.open("GET", url);
|
||||
xhr.send();
|
||||
return `<style id='${id}'>${this.data[key]}</style>`;
|
||||
}
|
||||
function reload(resources)
|
||||
apply()
|
||||
{
|
||||
for (const key in settings)
|
||||
{
|
||||
if (settings[key] === true)
|
||||
{
|
||||
const func = eval(resources.data[key]);
|
||||
const func = eval(this.data[key]);
|
||||
if (func)
|
||||
{
|
||||
func(settings, resources);
|
||||
func(settings, this);
|
||||
if (ajaxReload.indexOf(key) !== -1)
|
||||
{
|
||||
$(document).ajaxComplete(() =>
|
||||
{
|
||||
func(settings, resources);
|
||||
func(settings, this);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function loadSettings()
|
||||
{
|
||||
for (const key in settings)
|
||||
{
|
||||
settings[key] = GM_getValue(key, settings[key]);
|
||||
}
|
||||
settings.guiSettings = true;
|
||||
}
|
||||
function saveSettings(newSettings)
|
||||
{
|
||||
for (const key in settings)
|
||||
{
|
||||
GM_setValue(key, newSettings[key]);
|
||||
}
|
||||
}
|
||||
class ExternalResource
|
||||
{
|
||||
static get resourceUrls()
|
||||
{
|
||||
const root = "https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/";
|
||||
const urls = {
|
||||
style: "style/style.min.scss",
|
||||
oldStyle: "style/style-old.min.scss",
|
||||
darkStyle: "style/style-dark.min.scss",
|
||||
touchPlayerStyle: "style/style-touch-player.min.scss",
|
||||
navbarOverrideStyle: "style/style-navbar-override.min.css",
|
||||
noBannerStyle: "style/style-no-banner.min.css",
|
||||
guiSettingsStyle: "style/style-gui-settings.min.scss",
|
||||
guiSettingsDom: "utils/gui-settings.html",
|
||||
guiSettings: "utils/gui-settings.min.js",
|
||||
useDarkStyle: "style/dark-styles.min.js",
|
||||
useNewStyle: "style/new-styles.min.js",
|
||||
touchNavBar: "touch/touch-navbar.min.js",
|
||||
touchVideoPlayer: "touch/touch-player.min.js",
|
||||
expandDanmakuList: "utils/expand-danmaku.min.js",
|
||||
removeAds: "utils/remove-promotions.min.js",
|
||||
watchLaterRedirect: "utils/watchlater.min.js"
|
||||
};
|
||||
for (const key in urls)
|
||||
{
|
||||
urls[key] = root + urls[key];
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
constructor()
|
||||
{
|
||||
this.data = {};
|
||||
const foreground = (() =>
|
||||
{
|
||||
const regex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(settings.customStyleColor);
|
||||
const color = regex ? {
|
||||
r: parseInt(regex[1], 16),
|
||||
g: parseInt(regex[2], 16),
|
||||
b: parseInt(regex[3], 16)
|
||||
} : undefined;
|
||||
if (color)
|
||||
{
|
||||
const grey = 1 - (0.299 * color.r + 0.587 * color.g + 0.114 * color.b) / 255;
|
||||
if (grey < 0.35)
|
||||
{
|
||||
return "#000";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "#fff";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "#fff";
|
||||
}
|
||||
})();
|
||||
settings.foreground = foreground;
|
||||
settings.brightness = `${foreground === "#000" ? "100" : "0"}%`;
|
||||
settings.filterBrightness = foreground === "#000" ? "0" : "100";
|
||||
}
|
||||
ready(callback)
|
||||
{
|
||||
this.callback = callback;
|
||||
const replaceCustomColor = (style) =>
|
||||
{
|
||||
for (const key of Object.keys(settings))
|
||||
{
|
||||
style = style.replace(new RegExp("\\$" + key, "g"), settings[key]);
|
||||
}
|
||||
return style;
|
||||
};
|
||||
const urls = ExternalResource.resourceUrls;
|
||||
const resourceCount = Object.keys(urls).length;
|
||||
let downloadedCount = 0;
|
||||
for (const key in urls)
|
||||
{
|
||||
const url = urls[key];
|
||||
ajax(url, data =>
|
||||
{
|
||||
if (url.indexOf(".scss") !== -1)
|
||||
{
|
||||
this.data[key] = replaceCustomColor(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.data[key] = data;
|
||||
}
|
||||
downloadedCount++;
|
||||
if (downloadedCount >= resourceCount && this.callback)
|
||||
{
|
||||
this.callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
getStyle(key, id)
|
||||
{
|
||||
return `<style id='${id}'>${this.data[key]}</style>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadSettings();
|
||||
const resources = new ExternalResource();
|
||||
resources.ready(() =>
|
||||
{
|
||||
reload(resources);
|
||||
});
|
||||
});
|
||||
loadSettings();
|
||||
const resources = new ExternalResource();
|
||||
resources.ready(resources.apply);
|
||||
})(window.jQuery.noConflict(true));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// ==UserScript==
|
||||
// @name Bilibili Evolved
|
||||
// @version 0.9.8
|
||||
// @version 1.0.0
|
||||
// @description 增强哔哩哔哩Web端体验.
|
||||
// @author Grant Howard
|
||||
// @match *://*.bilibili.com/*
|
||||
@ -18,205 +18,199 @@
|
||||
(self$ =>
|
||||
{
|
||||
const $ = unsafeWindow.$ || self$;
|
||||
$(document).ready(() =>
|
||||
const settings = {
|
||||
removeAds: true,
|
||||
touchNavBar: false,
|
||||
touchVideoPlayer: false,
|
||||
watchLaterRedirect: true,
|
||||
expandDanmakuList: true,
|
||||
customStyleColor: "#00A0D8",
|
||||
blurBackgroundOpacity: 0.382,
|
||||
overrideNavBar: true,
|
||||
showBanner: true,
|
||||
useDarkStyle: false,
|
||||
useNewStyle: true
|
||||
};
|
||||
const ajaxReload = [
|
||||
"touchVideoPlayer",
|
||||
"watchLaterRedirect",
|
||||
"expandDanmakuList"
|
||||
];
|
||||
function waitForQuery()
|
||||
{
|
||||
const settings = {
|
||||
removeAds: true,
|
||||
touchNavBar: false,
|
||||
touchVideoPlayer: false,
|
||||
watchLaterRedirect: true,
|
||||
expandDanmakuList: true,
|
||||
customStyleColor: "#00A0D8",
|
||||
blurBackgroundOpacity: 0.382,
|
||||
overrideNavBar: true,
|
||||
showBanner: true,
|
||||
useDarkStyle: false,
|
||||
useNewStyle: true
|
||||
};
|
||||
const ajaxReload = [
|
||||
"touchVideoPlayer",
|
||||
"watchLaterRedirect",
|
||||
"expandDanmakuList"
|
||||
];
|
||||
function waitForQuery()
|
||||
const MaxRetry = 30;
|
||||
let retry = 0;
|
||||
const tryQuery = (query, condition, action, failed) =>
|
||||
{
|
||||
const MaxRetry = 30;
|
||||
let retry = 0;
|
||||
const tryQuery = (query, condition, action, failed) =>
|
||||
if (retry >= MaxRetry)
|
||||
{
|
||||
if (retry >= MaxRetry)
|
||||
if (failed)
|
||||
{
|
||||
if (failed)
|
||||
failed();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const result = query();
|
||||
if (condition(result))
|
||||
{
|
||||
action(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
retry++;
|
||||
setTimeout(() => tryQuery(query, condition, action, failed), 500);
|
||||
}
|
||||
}
|
||||
};
|
||||
return tryQuery;
|
||||
}
|
||||
function ajax(url, done)
|
||||
{
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("load", () => done(xhr.responseText));
|
||||
xhr.open("GET", url);
|
||||
xhr.send();
|
||||
}
|
||||
function loadSettings()
|
||||
{
|
||||
for (const key in settings)
|
||||
{
|
||||
settings[key] = GM_getValue(key, settings[key]);
|
||||
}
|
||||
settings.guiSettings = true;
|
||||
}
|
||||
function saveSettings(newSettings)
|
||||
{
|
||||
for (const key in settings)
|
||||
{
|
||||
GM_setValue(key, newSettings[key]);
|
||||
}
|
||||
}
|
||||
class ExternalResource
|
||||
{
|
||||
static get resourceUrls()
|
||||
{
|
||||
const root = "https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/";
|
||||
const urls = {
|
||||
style: "style/style.min.scss",
|
||||
oldStyle: "style/style-old.min.scss",
|
||||
darkStyle: "style/style-dark.min.scss",
|
||||
touchPlayerStyle: "style/style-touch-player.min.scss",
|
||||
navbarOverrideStyle: "style/style-navbar-override.min.css",
|
||||
noBannerStyle: "style/style-no-banner.min.css",
|
||||
guiSettingsStyle: "style/style-gui-settings.min.scss",
|
||||
guiSettingsDom: "utils/gui-settings.html",
|
||||
guiSettings: "utils/gui-settings.min.js",
|
||||
useDarkStyle: "style/dark-styles.min.js",
|
||||
useNewStyle: "style/new-styles.min.js",
|
||||
touchNavBar: "touch/touch-navbar.min.js",
|
||||
touchVideoPlayer: "touch/touch-player.min.js",
|
||||
expandDanmakuList: "utils/expand-danmaku.min.js",
|
||||
removeAds: "utils/remove-promotions.min.js",
|
||||
watchLaterRedirect: "utils/watchlater.min.js"
|
||||
};
|
||||
for (const key in urls)
|
||||
{
|
||||
urls[key] = root + urls[key];
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
constructor()
|
||||
{
|
||||
this.data = {};
|
||||
const foreground = (() =>
|
||||
{
|
||||
const regex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(settings.customStyleColor);
|
||||
const color = regex ? {
|
||||
r: parseInt(regex[1], 16),
|
||||
g: parseInt(regex[2], 16),
|
||||
b: parseInt(regex[3], 16)
|
||||
} : undefined;
|
||||
if (color)
|
||||
{
|
||||
const grey = 1 - (0.299 * color.r + 0.587 * color.g + 0.114 * color.b) / 255;
|
||||
if (grey < 0.35)
|
||||
{
|
||||
failed();
|
||||
return "#000";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "#fff";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const result = query();
|
||||
if (condition(result))
|
||||
return "#fff";
|
||||
}
|
||||
})();
|
||||
settings.foreground = foreground;
|
||||
settings.brightness = `${foreground === "#000" ? "100" : "0"}%`;
|
||||
settings.filterBrightness = foreground === "#000" ? "0" : "100";
|
||||
}
|
||||
ready(callback)
|
||||
{
|
||||
this.callback = callback;
|
||||
const replaceCustomColor = (style) =>
|
||||
{
|
||||
for (const key of Object.keys(settings))
|
||||
{
|
||||
style = style.replace(new RegExp("\\$" + key, "g"), settings[key]);
|
||||
}
|
||||
return style;
|
||||
};
|
||||
const urls = ExternalResource.resourceUrls;
|
||||
const resourceCount = Object.keys(urls).length;
|
||||
let downloadedCount = 0;
|
||||
for (const key in urls)
|
||||
{
|
||||
const url = urls[key];
|
||||
ajax(url, data =>
|
||||
{
|
||||
if (url.indexOf(".scss") !== -1)
|
||||
{
|
||||
action(result);
|
||||
this.data[key] = replaceCustomColor(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
retry++;
|
||||
setTimeout(() => tryQuery(query, condition, action, failed), 500);
|
||||
this.data[key] = data;
|
||||
}
|
||||
}
|
||||
};
|
||||
return tryQuery;
|
||||
downloadedCount++;
|
||||
if (downloadedCount >= resourceCount && this.callback)
|
||||
{
|
||||
this.callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function ajax(url, done)
|
||||
getStyle(key, id)
|
||||
{
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("load", () => done(xhr.responseText));
|
||||
xhr.open("GET", url);
|
||||
xhr.send();
|
||||
return `<style id='${id}'>${this.data[key]}</style>`;
|
||||
}
|
||||
function reload(resources)
|
||||
apply()
|
||||
{
|
||||
for (const key in settings)
|
||||
{
|
||||
if (settings[key] === true)
|
||||
{
|
||||
const func = eval(resources.data[key]);
|
||||
const func = eval(this.data[key]);
|
||||
if (func)
|
||||
{
|
||||
func(settings, resources);
|
||||
func(settings, this);
|
||||
if (ajaxReload.indexOf(key) !== -1)
|
||||
{
|
||||
$(document).ajaxComplete(() =>
|
||||
{
|
||||
func(settings, resources);
|
||||
func(settings, this);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function loadSettings()
|
||||
{
|
||||
for (const key in settings)
|
||||
{
|
||||
settings[key] = GM_getValue(key, settings[key]);
|
||||
}
|
||||
settings.guiSettings = true;
|
||||
}
|
||||
function saveSettings(newSettings)
|
||||
{
|
||||
for (const key in settings)
|
||||
{
|
||||
GM_setValue(key, newSettings[key]);
|
||||
}
|
||||
}
|
||||
class ExternalResource
|
||||
{
|
||||
static get resourceUrls()
|
||||
{
|
||||
const root = "https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/";
|
||||
const urls = {
|
||||
style: "style/style.min.scss",
|
||||
oldStyle: "style/style-old.min.scss",
|
||||
darkStyle: "style/style-dark.min.scss",
|
||||
touchPlayerStyle: "style/style-touch-player.min.scss",
|
||||
navbarOverrideStyle: "style/style-navbar-override.min.css",
|
||||
noBannerStyle: "style/style-no-banner.min.css",
|
||||
guiSettingsStyle: "style/style-gui-settings.min.scss",
|
||||
guiSettingsDom: "utils/gui-settings.html",
|
||||
guiSettings: "utils/gui-settings.min.js",
|
||||
useDarkStyle: "style/dark-styles.min.js",
|
||||
useNewStyle: "style/new-styles.min.js",
|
||||
touchNavBar: "touch/touch-navbar.min.js",
|
||||
touchVideoPlayer: "touch/touch-player.min.js",
|
||||
expandDanmakuList: "utils/expand-danmaku.min.js",
|
||||
removeAds: "utils/remove-promotions.min.js",
|
||||
watchLaterRedirect: "utils/watchlater.min.js"
|
||||
};
|
||||
for (const key in urls)
|
||||
{
|
||||
urls[key] = root + urls[key];
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
constructor()
|
||||
{
|
||||
this.data = {};
|
||||
const foreground = (() =>
|
||||
{
|
||||
const regex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(settings.customStyleColor);
|
||||
const color = regex ? {
|
||||
r: parseInt(regex[1], 16),
|
||||
g: parseInt(regex[2], 16),
|
||||
b: parseInt(regex[3], 16)
|
||||
} : undefined;
|
||||
if (color)
|
||||
{
|
||||
const grey = 1 - (0.299 * color.r + 0.587 * color.g + 0.114 * color.b) / 255;
|
||||
if (grey < 0.35)
|
||||
{
|
||||
return "#000";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "#fff";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "#fff";
|
||||
}
|
||||
})();
|
||||
settings.foreground = foreground;
|
||||
settings.brightness = `${foreground === "#000" ? "100" : "0"}%`;
|
||||
settings.filterBrightness = foreground === "#000" ? "0" : "100";
|
||||
}
|
||||
ready(callback)
|
||||
{
|
||||
this.callback = callback;
|
||||
const replaceCustomColor = (style) =>
|
||||
{
|
||||
for (const key of Object.keys(settings))
|
||||
{
|
||||
style = style.replace(new RegExp("\\$" + key, "g"), settings[key]);
|
||||
}
|
||||
return style;
|
||||
};
|
||||
const urls = ExternalResource.resourceUrls;
|
||||
const resourceCount = Object.keys(urls).length;
|
||||
let downloadedCount = 0;
|
||||
for (const key in urls)
|
||||
{
|
||||
const url = urls[key];
|
||||
ajax(url, data =>
|
||||
{
|
||||
if (url.indexOf(".scss") !== -1)
|
||||
{
|
||||
this.data[key] = replaceCustomColor(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.data[key] = data;
|
||||
}
|
||||
downloadedCount++;
|
||||
if (downloadedCount >= resourceCount && this.callback)
|
||||
{
|
||||
this.callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
getStyle(key, id)
|
||||
{
|
||||
return `<style id='${id}'>${this.data[key]}</style>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadSettings();
|
||||
const resources = new ExternalResource();
|
||||
resources.ready(() =>
|
||||
{
|
||||
reload(resources);
|
||||
});
|
||||
});
|
||||
loadSettings();
|
||||
const resources = new ExternalResource();
|
||||
resources.ready(resources.apply);
|
||||
})(window.jQuery.noConflict(true));
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -122,7 +122,6 @@ div.con,
|
||||
.contribution-sidenav .contribution-item:hover,
|
||||
.my-album .tab-list,
|
||||
#page-setting #setting-new-tag,
|
||||
#page-setting #setting-new-tag-btn,
|
||||
.imagesbox .boost-img,
|
||||
.bui-slider .bui-track.bui-track-video-progress .bui-bar-wrap,
|
||||
.gui-settings-box,
|
||||
@ -136,12 +135,16 @@ div.con,
|
||||
.action-menu .menu-list:before,
|
||||
.list-item:hover,
|
||||
.list-item.active,
|
||||
.fans-medal-item .level,
|
||||
.emoji-box:after,
|
||||
.emotion-box,
|
||||
.emotion-box:after,
|
||||
.live-container,
|
||||
.img-content
|
||||
.img-content,
|
||||
.follow-sidenav .follow-list-container .follow-item:hover,
|
||||
.fans-action-follow,
|
||||
.fans-action-btn,
|
||||
#page-setting .setting-tag-list a,
|
||||
#pin-wrapper #pin-layer
|
||||
{
|
||||
background-color: #222 !important;
|
||||
}
|
||||
@ -266,7 +269,19 @@ a.more.tc-slate:hover,
|
||||
.message-list,
|
||||
.send-box,
|
||||
.emoji-box .emoji-item:hover,
|
||||
.emotion-item:hover .img
|
||||
.emotion-item:hover .img,
|
||||
.link-progress-tv,
|
||||
.ps.ps--in-scrolling.ps--y>.ps__scrollbar-y-rail,
|
||||
.ps.ps--in-scrolling.ps--x>.ps__scrollbar-x-rail,
|
||||
.ps:hover.ps--in-scrolling.ps--y>.ps__scrollbar-y-rail,
|
||||
.ps:hover.ps--in-scrolling.ps--x>.ps__scrollbar-x-rail,
|
||||
.ps:hover>.ps__scrollbar-y-rail:hover,
|
||||
.ps:hover>.ps__scrollbar-x-rail:hover,
|
||||
.fans-medal-item .level,
|
||||
.article-holder img,
|
||||
#page-follows .follow-main .follow-action-bottom .follow-action-fixtop,
|
||||
#pin-wrapper #pin-layer-search,
|
||||
.be-input_inner
|
||||
{
|
||||
background-color: #444 !important;
|
||||
}
|
||||
@ -298,7 +313,9 @@ li.context-menu-descipline a,
|
||||
}
|
||||
.btn-add span,
|
||||
.bui-bar-wrap,
|
||||
.bui-step-dot
|
||||
.bui-step-dot,
|
||||
.ps>.ps__scrollbar-y-rail>.ps__scrollbar-y,
|
||||
.ps>.ps__scrollbar-x-rail>.ps__scrollbar-x
|
||||
{
|
||||
background-color: #aaa !important;
|
||||
}
|
||||
@ -457,7 +474,18 @@ blockquote .color-yellow-04,
|
||||
.top .time,
|
||||
.bottom .text,
|
||||
.list .list-title,
|
||||
.medal-box
|
||||
.medal-box,
|
||||
.no-more,
|
||||
.msg-more,
|
||||
.i-pin-meta,
|
||||
.i-pin-desc,
|
||||
.article-con,
|
||||
.follow-sidenav .num,
|
||||
.list-item .desc,
|
||||
.fans-action-follow,
|
||||
.list-item .auth-description,
|
||||
.follow-main .follow-action-bottom .select-counter,
|
||||
.n .n-num
|
||||
{
|
||||
color: #aaa !important;
|
||||
}
|
||||
@ -704,11 +732,28 @@ div.con header,
|
||||
.space-right .space-right-top .title,
|
||||
.top .title,
|
||||
.action-menu .menu-list a,
|
||||
.card .config,
|
||||
.card.config,
|
||||
.dialog .title,
|
||||
.list-item .name,
|
||||
.message .message-content.not-img,
|
||||
.emoji-box .emoji-item
|
||||
.emoji-box .emoji-item,
|
||||
.i-live .i-live-text,
|
||||
.section-right-options .operation,
|
||||
.article-title,
|
||||
.follow-sidenav .follow-list-container .follow-item,
|
||||
.follow-sidenav .nav-title .text,
|
||||
.breadcrumb .batch,
|
||||
.follow-main .follow-action-top .back-to-info,
|
||||
.follow-main .follow-action-bottom li,
|
||||
.modal-container li,
|
||||
.fans-action-btn,
|
||||
.tag-list a,
|
||||
#pin-wrapper .pin-layer-header,
|
||||
#pin-wrapper .pin-layer-order-tip,
|
||||
#pin-wrapper #pin-layer-search,
|
||||
.modal-wrapper .modal-title,
|
||||
.be-input_inner,
|
||||
.follow-sidenav .follow-list-container .follow-item.cur .num
|
||||
{
|
||||
color: #eee !important;
|
||||
}
|
||||
@ -775,7 +820,8 @@ ul.bilibili-suggest,
|
||||
#page-setting #setting-new-tag-btn,
|
||||
.action-menu .menu-list,
|
||||
.action-menu .menu-list:before,
|
||||
.live-container
|
||||
.live-container,
|
||||
#page-setting .setting-tag-list a
|
||||
{
|
||||
border-color: #222 !important;
|
||||
}
|
||||
@ -839,7 +885,21 @@ div.bar>div.num,
|
||||
.list .list-title,
|
||||
.list-item,
|
||||
.whisper .list,
|
||||
.send-box
|
||||
.send-box,
|
||||
#page-index .channel .channel-item,
|
||||
.user .tags,
|
||||
.article-content,
|
||||
.s-content,
|
||||
.follow-sidenav,
|
||||
.follow-sidenav .nav-container.follow-container,
|
||||
.follow-main,
|
||||
.follow-main .follow-header.follow-header-info,
|
||||
.follow-main .follow-action-top .back-to-info,
|
||||
.follow-main .follow-action-top,
|
||||
.modal-container .modal-body .target-followlist,
|
||||
.fans-action-btn,
|
||||
#pin-wrapper .pin-layer-header,
|
||||
.modal-wrapper .modal-title
|
||||
{
|
||||
border-color: transparent !important;
|
||||
}
|
||||
@ -926,7 +986,10 @@ div.con header,
|
||||
.bui-button.bui-button-transparent,
|
||||
.bb-comment .comment-list .quote,
|
||||
.modal-wrapper .modal-title,
|
||||
.wrapper .edit-video-modal .modal-body
|
||||
.wrapper .edit-video-modal .modal-body,
|
||||
.up-info:before,
|
||||
#pin-wrapper #pin-layer-search,
|
||||
.be-input_inner
|
||||
{
|
||||
border-color: #444 !important
|
||||
}
|
||||
@ -996,7 +1059,8 @@ ul.up-nav li
|
||||
#page-index .col-1 .section .more,
|
||||
.elec .elec-status,
|
||||
.elec .elec-status-bg,
|
||||
.small-item .cover
|
||||
.small-item .cover,
|
||||
#page-follows .follow-main .follow-action-top .back-to-info
|
||||
{
|
||||
background-image: none !important;
|
||||
}
|
||||
@ -1045,7 +1109,8 @@ div.im-list-box,
|
||||
.col-full,
|
||||
.space-right .space-right-top .title,
|
||||
.card,
|
||||
.action-menu .menu-list
|
||||
.action-menu .menu-list,
|
||||
.list-item .cover img
|
||||
{
|
||||
box-shadow: none !important;
|
||||
}
|
||||
@ -1085,7 +1150,9 @@ div.desc-tips>span.arrow-left,
|
||||
.g-search .search-btn,
|
||||
.wrapper .elec-message-wrp .elec-triangle,
|
||||
img.source-img,
|
||||
canvas.cliper.is-img
|
||||
canvas.cliper.is-img,
|
||||
.loading .icon,
|
||||
.load-more .icon
|
||||
{
|
||||
display: none !important;
|
||||
}
|
||||
@ -1149,6 +1216,10 @@ canvas.cliper.is-img
|
||||
{
|
||||
filter: brightness(16%) !important;
|
||||
}
|
||||
#page-setting #setting-new-tag-btn
|
||||
{
|
||||
background: $customStyleColor !important;
|
||||
}
|
||||
|
||||
.c-clink:hover,
|
||||
.bili-tab-item.on,
|
||||
@ -1293,7 +1364,8 @@ a.s-btn:hover,
|
||||
.send-btn,
|
||||
.live-container .status,
|
||||
.video-container .types,
|
||||
.type-label
|
||||
.type-label,
|
||||
.follow-sidenav .follow-list-container .follow-item.cur
|
||||
{
|
||||
background-color: $customStyleColor !important;
|
||||
}
|
||||
@ -1441,7 +1513,9 @@ a.up-name:hover,
|
||||
.list .item:hover a,
|
||||
.list .item:hover:before,
|
||||
.bottom .link,
|
||||
.action-menu .menu-list a:hover
|
||||
.action-menu .menu-list a:hover,
|
||||
.article-title a:hover,
|
||||
#page-follows .follow-main .follow-action-bottom .select-cancel
|
||||
{
|
||||
color: $customStyleColor !important;
|
||||
}
|
||||
@ -1502,7 +1576,12 @@ a.s-btn:hover,
|
||||
.send-btn,
|
||||
.live-container .status,
|
||||
.video-container .types,
|
||||
.type-label
|
||||
.type-label,
|
||||
.section-right-options .operation:hover,
|
||||
.follow-sidenav .follow-list-container .follow-item.cur .num,
|
||||
.follow-sidenav .follow-list-container .follow-item.cur .text,
|
||||
.follow-sidenav .follow-list-container .follow-item.cur,
|
||||
#page-setting #setting-new-tag-btn
|
||||
{
|
||||
color: $foreground !important;
|
||||
}
|
||||
@ -1513,7 +1592,8 @@ a.s-btn:hover,
|
||||
.bilibili-player-video-danmaku-setting-left-block-content .bilibili-player-block-filter-type.disabled .bilibili-player-block-filter-image,
|
||||
.bilibili-player-mode-selection-container .bilibili-player-mode-selection-panel .bilibili-player-mode-selection-row.mode .selection-span.active,
|
||||
.bilibili-player-mode-selection-container .bilibili-player-mode-selection-panel .bilibili-player-mode-selection-row.mode .selection-span.active:hover,
|
||||
.bilibili-player-mode-selection-container .bilibili-player-mode-selection-panel .bilibili-player-mode-selection-row.mode .selection-span:hover
|
||||
.bilibili-player-mode-selection-container .bilibili-player-mode-selection-panel .bilibili-player-mode-selection-row.mode .selection-span:hover,
|
||||
#page-follows .follow-main .follow-action-top .back-to-info:hover
|
||||
{
|
||||
fill: $customStyleColor !important;
|
||||
}
|
||||
|
||||
@ -9,19 +9,20 @@
|
||||
const watchlaterList = items
|
||||
.map((_, it) =>
|
||||
{
|
||||
const match = $(it)
|
||||
.attr("href")
|
||||
.match(/av[\d]+/);
|
||||
if (match && match[0])
|
||||
const href = $(it).attr("href");
|
||||
if (href)
|
||||
{
|
||||
return "https://www.bilibili.com/" + match[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return "javascript:;";
|
||||
const match = href.match(/av[\d]+/);
|
||||
if (match && match[0])
|
||||
{
|
||||
return "https://www.bilibili.com/" + match[0];
|
||||
}
|
||||
}
|
||||
return "javascript:;";
|
||||
});
|
||||
items.each((index, it) => $(it).attr("href", watchlaterList[index]).attr("target", "_blank"));
|
||||
items.each((index, it) => $(it)
|
||||
.attr("href", watchlaterList[index])
|
||||
.attr("target", "_blank"));
|
||||
}
|
||||
};
|
||||
waitForQuery()(
|
||||
@ -29,6 +30,11 @@
|
||||
it => it.length > 0,
|
||||
items => redirectLinks(items)
|
||||
);
|
||||
waitForQuery()(
|
||||
() => $(".av-about>a"),
|
||||
it => it.length > 0,
|
||||
items => redirectLinks(items)
|
||||
);
|
||||
waitForQuery()(
|
||||
() => $("div.watch-later-m>ul>div>li>a"),
|
||||
it => it.length > 0,
|
||||
@ -47,13 +53,17 @@
|
||||
width: "auto"
|
||||
})
|
||||
);
|
||||
if (document.URL.indexOf("watchlater") !== -1 && document.URL.match(/av[\d]+/))
|
||||
{
|
||||
const av = document.URL.match(/av[\d]+/)[0];
|
||||
if (av)
|
||||
waitForQuery()(
|
||||
() => document.URL.match(/av[\d]+/),
|
||||
it => it && document.URL.indexOf("watchlater") !== -1,
|
||||
it =>
|
||||
{
|
||||
document.URL.replace(`https://www.bilibili.com/${av}`);
|
||||
const id = it[0];
|
||||
if (id)
|
||||
{
|
||||
window.location.replace(`https://www.bilibili.com/${id}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
})();
|
||||
|
||||
2
utils/watchlater.min.js
vendored
2
utils/watchlater.min.js
vendored
@ -1 +1 @@
|
||||
(()=>()=>{const t=t=>{if(0!==t.attr("href").indexOf("watchlater")){const a=t.map((t,a)=>{const e=$(a).attr("href").match(/av[\d]+/);return e&&e[0]?"https://www.bilibili.com/"+e[0]:"javascript:;"});t.each((t,e)=>$(e).attr("href",a[t]).attr("target","_blank"))}};if(waitForQuery()(()=>$(".av-item>a"),t=>t.length>0,a=>t(a)),waitForQuery()(()=>$("div.watch-later-m>ul>div>li>a"),t=>t.length>0,a=>t(a)),waitForQuery()(()=>$(".read-more.mr"),t=>t.length>0,t=>t.remove()),waitForQuery()(()=>$(".read-more-grp>.read-more"),t=>t.length>0,t=>t.css({float:"none",width:"auto"})),-1!==document.URL.indexOf("watchlater")&&document.URL.match(/av[\d]+/)){const t=document.URL.match(/av[\d]+/)[0];t&&document.URL.replace(`https://www.bilibili.com/${t}`)}})();
|
||||
(()=>()=>{const t=t=>{if(0!==t.attr("href").indexOf("watchlater")){const a=t.map((t,a)=>{const r=$(a).attr("href");if(r){const t=r.match(/av[\d]+/);if(t&&t[0])return"https://www.bilibili.com/"+t[0]}return"javascript:;"});t.each((t,r)=>$(r).attr("href",a[t]).attr("target","_blank"))}};waitForQuery()(()=>$(".av-item>a"),t=>t.length>0,a=>t(a)),waitForQuery()(()=>$(".av-about>a"),t=>t.length>0,a=>t(a)),waitForQuery()(()=>$("div.watch-later-m>ul>div>li>a"),t=>t.length>0,a=>t(a)),waitForQuery()(()=>$(".read-more.mr"),t=>t.length>0,t=>t.remove()),waitForQuery()(()=>$(".read-more-grp>.read-more"),t=>t.length>0,t=>t.css({float:"none",width:"auto"})),waitForQuery()(()=>document.URL.match(/av[\d]+/),t=>t&&-1!==document.URL.indexOf("watchlater"),t=>{const a=t[0];a&&window.location.replace(`https://www.bilibili.com/${a}`)})})();
|
||||
Loading…
Reference in New Issue
Block a user