mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Fix bugs
This commit is contained in:
parent
10a0eb26f5
commit
793cdc2f20
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -125,10 +125,20 @@ const fixedSettings = {
|
||||
};
|
||||
function loadSettings()
|
||||
{
|
||||
for (const key in fixedSettings)
|
||||
{
|
||||
settings[key] = fixedSettings[key];
|
||||
GM_setValue(key, fixedSettings[key]);
|
||||
}
|
||||
for (const key in settings)
|
||||
{
|
||||
let value = GM_getValue(key, settings[key]);
|
||||
if (settings[key] !== undefined && value.constructor === Object)
|
||||
let value = GM_getValue(key);
|
||||
if (value === undefined)
|
||||
{
|
||||
value = settings[key];
|
||||
GM_setValue(key, settings[key]);
|
||||
}
|
||||
else if (settings[key] !== undefined && value.constructor === Object)
|
||||
{
|
||||
value = Object.assign(settings[key], value);
|
||||
}
|
||||
@ -152,10 +162,6 @@ function loadSettings()
|
||||
// settings[key] = value;
|
||||
// }
|
||||
}
|
||||
for (const key in fixedSettings)
|
||||
{
|
||||
settings[key] = fixedSettings[key];
|
||||
}
|
||||
}
|
||||
function saveSettings(newSettings)
|
||||
{
|
||||
@ -1043,7 +1049,9 @@ class Resource
|
||||
}
|
||||
if (typeof offlineData === "undefined")
|
||||
{
|
||||
settings.cache[key] = this.text;
|
||||
settings.cache = Object.assign(settings.cache, {
|
||||
[key]: this.text
|
||||
});
|
||||
saveSettings(settings);
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,10 +125,20 @@ const fixedSettings = {
|
||||
};
|
||||
function loadSettings()
|
||||
{
|
||||
for (const key in fixedSettings)
|
||||
{
|
||||
settings[key] = fixedSettings[key];
|
||||
GM_setValue(key, fixedSettings[key]);
|
||||
}
|
||||
for (const key in settings)
|
||||
{
|
||||
let value = GM_getValue(key, settings[key]);
|
||||
if (settings[key] !== undefined && value.constructor === Object)
|
||||
let value = GM_getValue(key);
|
||||
if (value === undefined)
|
||||
{
|
||||
value = settings[key];
|
||||
GM_setValue(key, settings[key]);
|
||||
}
|
||||
else if (settings[key] !== undefined && value.constructor === Object)
|
||||
{
|
||||
value = Object.assign(settings[key], value);
|
||||
}
|
||||
@ -152,10 +162,6 @@ function loadSettings()
|
||||
// settings[key] = value;
|
||||
// }
|
||||
}
|
||||
for (const key in fixedSettings)
|
||||
{
|
||||
settings[key] = fixedSettings[key];
|
||||
}
|
||||
}
|
||||
function saveSettings(newSettings)
|
||||
{
|
||||
@ -1043,7 +1049,9 @@ class Resource
|
||||
}
|
||||
if (typeof offlineData === "undefined")
|
||||
{
|
||||
settings.cache[key] = this.text;
|
||||
settings.cache = Object.assign(settings.cache, {
|
||||
[key]: this.text
|
||||
});
|
||||
saveSettings(settings);
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +87,9 @@ export class Resource
|
||||
}
|
||||
if (typeof offlineData === "undefined")
|
||||
{
|
||||
settings.cache[key] = this.text;
|
||||
settings.cache = Object.assign(settings.cache, {
|
||||
[key]: this.text
|
||||
});
|
||||
saveSettings(settings);
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,10 +100,20 @@ const fixedSettings = {
|
||||
};
|
||||
export function loadSettings()
|
||||
{
|
||||
for (const key in fixedSettings)
|
||||
{
|
||||
settings[key] = fixedSettings[key];
|
||||
GM_setValue(key, fixedSettings[key]);
|
||||
}
|
||||
for (const key in settings)
|
||||
{
|
||||
let value = GM_getValue(key, settings[key]);
|
||||
if (settings[key] !== undefined && value.constructor === Object)
|
||||
let value = GM_getValue(key);
|
||||
if (value === undefined)
|
||||
{
|
||||
value = settings[key];
|
||||
GM_setValue(key, settings[key]);
|
||||
}
|
||||
else if (settings[key] !== undefined && value.constructor === Object)
|
||||
{
|
||||
value = Object.assign(settings[key], value);
|
||||
}
|
||||
@ -127,10 +137,6 @@ export function loadSettings()
|
||||
// settings[key] = value;
|
||||
// }
|
||||
}
|
||||
for (const key in fixedSettings)
|
||||
{
|
||||
settings[key] = fixedSettings[key];
|
||||
}
|
||||
}
|
||||
export function saveSettings(newSettings)
|
||||
{
|
||||
|
||||
2
min/toast.min.js
vendored
2
min/toast.min.js
vendored
@ -1 +1 @@
|
||||
(()=>{return(t,e)=>{class s{constructor(t="",e="",s="default"){this.type=s;this.message=t;this.title=e;this.duration=3e3;this.element=$(this.cardHtml)[0];document.querySelector(".toast-card-container").insertAdjacentElement("beforeend",this.element)}show(){this.element.classList.add("visible");this.element.querySelector(".toast-card-dismiss").addEventListener("click",()=>this.dismiss());if(this.duration){setTimeout(()=>this.dismiss(),this.duration)}}dismiss(){if(this.element.classList.contains("visible")){this.element.addEventListener("transitionend",()=>this.element.remove());this.element.classList.remove("visible")}}get cardHtml(){return`\n <div class="toast-card icons-enabled toast-${this.type}">\n <div class="toast-card-header">\n <h1 class="toast-card-title">${this.title}</h1>\n <div class="toast-card-dismiss">\n <i class="icon-cancel"></i>\n </div>\n </div>\n <div class="toast-card-message">${this.message}</div>\n </div>\n `}static get container(){return document.querySelector(".toast-card-container")}static createToastContainer(){if(!document.querySelector(".toast-card-container")){document.body.insertAdjacentHTML("beforeend",`<div class="toast-card-container"></div>`)}}static internalShow(t,e,i,n){const a=new s(t,e,n);a.duration=i;a.show();return a}static show(t,e,s){return this.internalShow(t,e,s,"default")}static info(t,e,s){return this.internalShow(t,e,s,"info")}static success(t,e,s){return this.internalShow(t,e,s,"success")}static error(t,e,s){return this.internalShow(t,e,s,"error")}}e.applyStyle("toastStyle");s.createToastContainer();return{export:s}}})();
|
||||
(()=>{return(t,e)=>{class s{constructor(t="",e="",s="default"){this.type=s;this.message=t;this.title=e;this.duration=3e3;this.element=$(this.cardHtml)[0];document.querySelector(".toast-card-container").insertAdjacentElement("beforeend",this.element)}show(){this.element.classList.add("visible");this.element.querySelector(".toast-card-dismiss").addEventListener("click",()=>this.dismiss());if(this.duration){setTimeout(()=>this.dismiss(),this.duration)}}dismiss(){if(this.element.classList.contains("visible")){this.element.addEventListener("transitionend",()=>this.element.remove());this.element.classList.remove("visible")}}get cardHtml(){return`\n <div class="toast-card icons-enabled toast-${this.type}">\n <div class="toast-card-header">\n <h1 class="toast-card-title">${this.title}</h1>\n <div class="toast-card-dismiss">\n <svg style="width:22px;height:22px" viewBox="0 0 24 24">\n <path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" />\n </svg>\n </div>\n </div>\n <div class="toast-card-message">${this.message}</div>\n </div>\n `}static get container(){return document.querySelector(".toast-card-container")}static createToastContainer(){if(!document.querySelector(".toast-card-container")){document.body.insertAdjacentHTML("beforeend",`<div class="toast-card-container"></div>`)}}static internalShow(t,e,i,n){const a=new s(t,e,n);a.duration=i;a.show();return a}static show(t,e,s){return this.internalShow(t,e,s,"default")}static info(t,e,s){return this.internalShow(t,e,s,"info")}static success(t,e,s){return this.internalShow(t,e,s,"success")}static error(t,e,s){return this.internalShow(t,e,s,"error")}}e.applyStyle("toastStyle");s.createToastContainer();return{export:s}}})();
|
||||
@ -33,7 +33,9 @@ class Toast
|
||||
<div class="toast-card-header">
|
||||
<h1 class="toast-card-title">${this.title}</h1>
|
||||
<div class="toast-card-dismiss">
|
||||
<i class="icon-cancel"></i>
|
||||
<svg style="width:22px;height:22px" viewBox="0 0 24 24">
|
||||
<path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<div class="toast-card-message">${this.message}</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user