diff --git a/bilibili-evolved.offline.user.js b/bilibili-evolved.offline.user.js index 5737144ce..635462d54 100644 --- a/bilibili-evolved.offline.user.js +++ b/bilibili-evolved.offline.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Bilibili Evolved (Offline) -// @version 250.88 +// @version 250.89 // @description Bilibili Evolved 的离线版, 所有功能都已内置于脚本中. // @author Grant Howard, Coulomb-G // @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G) @@ -1065,7 +1065,7 @@ class Resource { if (!document.querySelector(`#${id}`)) { - const element = this.getStyle(id); + const style = this.getStyle(id); // const priorStyle = this.getPriorStyle(); // if (priorStyle === null) // { @@ -1084,11 +1084,11 @@ class Resource // } if (important) { - $("html").append(element); + document.body.insertAdjacentHTML("beforeend", style); } else { - $("head").prepend(element); + document.head.insertAdjacentHTML("afterbegin", style); } } } @@ -1617,7 +1617,8 @@ class StyleManager } removeStyle(key) { - $(`#${this.getDefaultStyleId(key)}`).remove(); + const style = document.querySelector(`#${this.getDefaultStyleId(key)}`); + style && style.remove(); } applyImportantStyle(key, id) { @@ -1629,11 +1630,11 @@ class StyleManager } applyStyleFromText(text) { - $("head").prepend(text); + document.head.insertAdjacentHTML("afterbegin", text); } applyImportantStyleFromText(text) { - $("html").append(text); + document.body.insertAdjacentHTML("beforeend", text); } getStyle(key, id) { @@ -1885,7 +1886,7 @@ class ResourceManager { if (info.content) { - $(".widgets-container").append($(info.content)); + document.querySelector(".widgets-container").insertAdjacentHTML("beforeend", info.content); } if (info.success) { diff --git a/bilibili-evolved.preview-offline.user.js b/bilibili-evolved.preview-offline.user.js index 39b40196d..8d98e2b77 100644 --- a/bilibili-evolved.preview-offline.user.js +++ b/bilibili-evolved.preview-offline.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name Bilibili Evolved (Preview Offline) -// @version 250.88 +// @version 250.89 // @description Bilibili Evolved 的预览离线版, 可以抢先体验新功能, 并且所有功能都已内置于脚本中. // @author Grant Howard, Coulomb-G // @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G) @@ -1065,7 +1065,7 @@ class Resource { if (!document.querySelector(`#${id}`)) { - const element = this.getStyle(id); + const style = this.getStyle(id); // const priorStyle = this.getPriorStyle(); // if (priorStyle === null) // { @@ -1084,11 +1084,11 @@ class Resource // } if (important) { - $("html").append(element); + document.body.insertAdjacentHTML("beforeend", style); } else { - $("head").prepend(element); + document.head.insertAdjacentHTML("afterbegin", style); } } } @@ -1617,7 +1617,8 @@ class StyleManager } removeStyle(key) { - $(`#${this.getDefaultStyleId(key)}`).remove(); + const style = document.querySelector(`#${this.getDefaultStyleId(key)}`); + style && style.remove(); } applyImportantStyle(key, id) { @@ -1629,11 +1630,11 @@ class StyleManager } applyStyleFromText(text) { - $("head").prepend(text); + document.head.insertAdjacentHTML("afterbegin", text); } applyImportantStyleFromText(text) { - $("html").append(text); + document.body.insertAdjacentHTML("beforeend", text); } getStyle(key, id) { @@ -1885,7 +1886,7 @@ class ResourceManager { if (info.content) { - $(".widgets-container").append($(info.content)); + document.querySelector(".widgets-container").insertAdjacentHTML("beforeend", info.content); } if (info.success) { diff --git a/bilibili-evolved.preview.user.js b/bilibili-evolved.preview.user.js index a6880d736..4b072b34c 100644 --- a/bilibili-evolved.preview.user.js +++ b/bilibili-evolved.preview.user.js @@ -1013,7 +1013,7 @@ class Resource { if (!document.querySelector(`#${id}`)) { - const element = this.getStyle(id); + const style = this.getStyle(id); // const priorStyle = this.getPriorStyle(); // if (priorStyle === null) // { @@ -1032,11 +1032,11 @@ class Resource // } if (important) { - $("html").append(element); + document.body.insertAdjacentHTML("beforeend", style); } else { - $("head").prepend(element); + document.head.insertAdjacentHTML("afterbegin", style); } } } @@ -1565,7 +1565,8 @@ class StyleManager } removeStyle(key) { - $(`#${this.getDefaultStyleId(key)}`).remove(); + const style = document.querySelector(`#${this.getDefaultStyleId(key)}`); + style && style.remove(); } applyImportantStyle(key, id) { @@ -1577,11 +1578,11 @@ class StyleManager } applyStyleFromText(text) { - $("head").prepend(text); + document.head.insertAdjacentHTML("afterbegin", text); } applyImportantStyleFromText(text) { - $("html").append(text); + document.body.insertAdjacentHTML("beforeend", text); } getStyle(key, id) { @@ -1833,7 +1834,7 @@ class ResourceManager { if (info.content) { - $(".widgets-container").append($(info.content)); + document.querySelector(".widgets-container").insertAdjacentHTML("beforeend", info.content); } if (info.success) { diff --git a/bilibili-evolved.user.js b/bilibili-evolved.user.js index b45c76d6b..a99090554 100644 --- a/bilibili-evolved.user.js +++ b/bilibili-evolved.user.js @@ -1013,7 +1013,7 @@ class Resource { if (!document.querySelector(`#${id}`)) { - const element = this.getStyle(id); + const style = this.getStyle(id); // const priorStyle = this.getPriorStyle(); // if (priorStyle === null) // { @@ -1032,11 +1032,11 @@ class Resource // } if (important) { - $("html").append(element); + document.body.insertAdjacentHTML("beforeend", style); } else { - $("head").prepend(element); + document.head.insertAdjacentHTML("afterbegin", style); } } } @@ -1565,7 +1565,8 @@ class StyleManager } removeStyle(key) { - $(`#${this.getDefaultStyleId(key)}`).remove(); + const style = document.querySelector(`#${this.getDefaultStyleId(key)}`); + style && style.remove(); } applyImportantStyle(key, id) { @@ -1577,11 +1578,11 @@ class StyleManager } applyStyleFromText(text) { - $("head").prepend(text); + document.head.insertAdjacentHTML("afterbegin", text); } applyImportantStyleFromText(text) { - $("html").append(text); + document.body.insertAdjacentHTML("beforeend", text); } getStyle(key, id) { @@ -1833,7 +1834,7 @@ class ResourceManager { if (info.content) { - $(".widgets-container").append($(info.content)); + document.querySelector(".widgets-container").insertAdjacentHTML("beforeend", info.content); } if (info.success) { diff --git a/client/resource-manager.js b/client/resource-manager.js index 2677eb2ac..422b71e6f 100644 --- a/client/resource-manager.js +++ b/client/resource-manager.js @@ -208,7 +208,7 @@ export class ResourceManager { if (info.content) { - $(".widgets-container").append($(info.content)); + document.querySelector(".widgets-container").insertAdjacentHTML("beforeend", info.content); } if (info.success) { diff --git a/client/resource.js b/client/resource.js index b7c7d1107..4e2510010 100644 --- a/client/resource.js +++ b/client/resource.js @@ -151,7 +151,7 @@ export class Resource { if (!document.querySelector(`#${id}`)) { - const element = this.getStyle(id); + const style = this.getStyle(id); // const priorStyle = this.getPriorStyle(); // if (priorStyle === null) // { @@ -170,11 +170,11 @@ export class Resource // } if (important) { - $("html").append(element); + document.body.insertAdjacentHTML("beforeend", style); } else { - $("head").prepend(element); + document.head.insertAdjacentHTML("afterbegin", style); } } } diff --git a/client/style-manager.js b/client/style-manager.js index 04fae697c..01d9b56ba 100644 --- a/client/style-manager.js +++ b/client/style-manager.js @@ -19,7 +19,8 @@ export class StyleManager } removeStyle(key) { - $(`#${this.getDefaultStyleId(key)}`).remove(); + const style = document.querySelector(`#${this.getDefaultStyleId(key)}`); + style && style.remove(); } applyImportantStyle(key, id) { @@ -31,11 +32,11 @@ export class StyleManager } applyStyleFromText(text) { - $("head").prepend(text); + document.head.insertAdjacentHTML("afterbegin", text); } applyImportantStyleFromText(text) { - $("html").append(text); + document.body.insertAdjacentHTML("beforeend", text); } getStyle(key, id) {