From 8a6ab903ef661b89bc81bdc2298cdb28c2f40f9e Mon Sep 17 00:00:00 2001 From: enncy <877526278@qq.com> Date: Fri, 25 Mar 2022 15:19:41 +0800 Subject: [PATCH] =?UTF-8?q?fix(style):=20=E4=BF=AE=E6=94=B9=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E5=BC=95=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4eea7e6a..11b312a3 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,13 @@ var resource = (url) => fetch(url).then((res) => res.text()); const style = await resource("https://cdn.jsdelivr.net/npm/ocsjs@latest/dist/style/common.css"); const ocsjs = await resource("https://cdn.jsdelivr.net/npm/ocsjs@latest/dist/js/index.min.js"); + // 加载 bootstrap icons 图标样式 + const link = document.createElement("link"); + link.href = "https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css"; + link.rel = "stylesheet"; + link.type = "text/css"; + document.head.appendChild(link); + const script = document.createElement("script"); script.innerText = ocsjs; document.body.appendChild(script); @@ -88,7 +95,6 @@ var resource = (url) => fetch(url).then((res) => res.text()); // @match *://*.zhihuishu.com/* // @require https://cdn.jsdelivr.net/npm/ocsjs@latest/dist/js/index.min.js // @resource OCS_STYLE https://cdn.jsdelivr.net/npm/ocsjs@latest/dist/style/common.css -// @resource BootstrapIcons https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css // @grant unsafeWindow // @grant GM_getResourceText // @run-at document-start @@ -103,9 +109,11 @@ var resource = (url) => fetch(url).then((res) => res.text()); unsafeWindow.OCS = OCS; // 加载 bootstrap icons 图标样式 - const style = document.createElement("style"); - style.innerText = GM_getResourceText("BootstrapIcons"); - document.head.appendChild(style); + const link = document.createElement("link"); + link.href = "https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css"; + link.rel = "stylesheet"; + link.type = "text/css"; + document.head.appendChild(link); OCS.start({ // 加载样式