Skip to content

Commit

Permalink
fix(style): 修改样式引入
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Mar 25, 2022
1 parent 27921d1 commit 8a6ab90
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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({
// 加载样式
Expand Down

0 comments on commit 8a6ab90

Please sign in to comment.