///
///
import { Style, toCSSText, writeText } from "./deps.ts";
import {
generateExternalLinkStyle,
generateLinkIconStyle,
LinkInit,
} from "./stylesheetGenerator.ts";
/**
* CSSの生成に使用するオブジェクト
*/
const externalLinks: LinkInit[] = [{
// PDF
url: {
url: ".pdf",
selectorSyntax: "$=",
},
style: {
"content": "'\\f1c1'",
"font-weight": 400, /* use Regular Style */
"margin-right": "1px",
},
}, {
// GitHub
url: [
"https://github.com",
"https://raw.githubusercontent.com",
"https://gist.github.com",
],
style: {
"content": "'\\f09b'",
"font-weight": 400,
"margin-right": "1px",
},
}, {
// Wikipedia
url: [
"https://ja.wikipedia.org",
"https://en.wikipedia.org",
],
style: {
"content": "'\\f266'",
"font-weight": 400,
"margin-right": "3px",
},
}, {
// Amazon
url: [
"https://www.amazon.co.jp",
"https://amazon.co.jp",
],
style: {
"content": "'\\f270'",
"font-weight": 400,
"margin-right": "1px",
},
}, {
// Twitter
url: [
"https://twitter.com"
],
style: {} // 標準でアイコンがあるので不要
}, {
// YouTube
url: [
"https:www.youtube.com",
"https:youtube.com",
],
style: {
"content": "'\\f167'",
"font-weight": 400,
"margin-right": "1px"
}
}];
/**
* [特定のリンクにアイコンをつけるUserCSS#26a3f9](https://scrapbox.io/villagepump/特定のリンクにアイコンをつけるUserCSS#61ffa1ce1280f0000026a3f9)
* を実装するためのやつ
*/
const extraStyle: Style = {
[
".line .deco-\\. a.link:is(" +
'[href^="https://ja.wikipedia.org"],' +
'[href^="https://en.wikipedia.org"],' +
") span.char-index"
]: {
"display": "inline-block",
"width": 0,
"text-indent": "-9999px",
"&:nth-of-type(30) ~ span.char-index": {
"display": "inherit",
"width": "inherit",
"text-indent": "inherit",
},
},
};
const elStyle: Style = generateExternalLinkStyle(externalLinks);
const liStyle: Style = generateLinkIconStyle(externalLinks);
await writeText(toCSSText({ ...elStyle, ...liStyle, ...extraStyle }));