特定のリンクにアイコンをつけるUserCSS
共通設定
外部リンクを区別するUserCSSを無効にする
流石に2つもアイコンがついているとうざい
code:style.css
div.line span:not(.modal-image):not(.pointing-device-map) > a.link:not(.icon):is(
href$=".pdf",
[href^="https://twitter.com"],
[href^="https://github.com"],
[href^="https://raw.githubusercontent.com"],
[href^="https://gist.github.com"],
[href^="https://ja.wikipedia.org"],
[href^="https://en.wikipedia.org"],
[href^="https://www.amazon.co.jp"],
[href^="https://amazon.co.jp"],
)::after {
display: none;
}
先頭にアイコンをつける
code:style.css
.line span:not(.deco-\.) > span > a.link:is(
href$=".pdf",
[href^="https://github.com"],
[href^="https://raw.githubusercontent.com"],
[href^="https://gist.github.com"],
[href^="https://ja.wikipedia.org"],
[href^="https://en.wikipedia.org"],
[href^="https://www.amazon.co.jp"],
[href^="https://amazon.co.jp"],
)::before {
display: inline-block;
width: 1em; /*16px;*/
height: 1em; /*16px;*/
vertical-align: -1px;/*-3px;*/
text-align: center;
background-size: contain;
background-repeat: no-repeat;
/* margin-right: 2px; */
}
PDF
サンプル
展開ヘルプ
Helpfeelのアイデアは増井俊之.iconさんの論文展開ヘルプ が元になっている
code:style.css
.line a.link:not(.icon)href$=".pdf"::before {
content: '\f1c1';
font-weight: 400; /* use Regular Style */
margin-right: 1px;
}
Github
サンプル
progfay/scrapbox-parser
これhttps://gist.github.com/yuiseki/60da2a5b743c4ce835d7b75c4ca89b33 を使うと、訪問したサイトのOGP画像を勝手にGyazoってくれるらしい
code:style.css
:is(.line, .line .deco) a.link:is(
[href^="https://github.com"],
[href^="https://raw.githubusercontent.com"],
[href^="https://gist.github.com"],
)::before {
content: '\f09b';
font-weight: 400;
margin-right: 1px;
}
Wikipedia
サンプル
増井俊之
『ご注文はうさぎですか?』は、日本の漫画家であるKoiによる4コマ漫画作品。略称は「ごちうさ」。『まんがタイムきららMAX』にて2010年12月号掲載の後、2011年3月号より連載中。https://ja.wikipedia.org/wiki/ご注文はうさぎですか?
code:style.css
:is(.line, .line .deco) a.link:is(
[href^="https://ja.wikipedia.org"],
[href^="https://en.wikipedia.org"],
)::before {
content: '\f266';
font-weight: 400;
margin-right: 3px;
}
リンクを出典アイコンにするUserCSSを使った場合は、wikipediaのタイトルだけを表示する
URLはhttps://ja.wikipedia.org/wiki/:pagenameという形式なので、先頭から30文字だけ非表示にすればいい
.char-indexはCSSの優先度を上げるために付けている
code:style.css
.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;
}
.line .deco-\. a.link:is(
[href^="https://ja.wikipedia.org"],
[href^="https://en.wikipedia.org"],
) span.char-index:nth-of-type(30) ~ span.char-index {
display: inherit;
width: inherit;
text-indent: inherit;
}
Amazon
サンプル
https://www.amazon.co.jp
code:style.css
:is(.line, .line .deco) a.link:is(
[href^="https://www.amazon.co.jp"],
[href^="https://amazon.co.jp"],
)::before {
content: '\f270';
font-weight: 400;
margin-right: 1px;
}
テンプレート
code:css
:is(.line, .line .deco) a.link:is(
[href^="https://<ドメイン>"], /* 複数記述できる */
)::before {
content: '\f266'; /* Font Awesomeのアイコンの文字コード */
font-weight: 400; /* 通常はnormal(400), SOLIDアイコンはbold(700以上) */
margin-right: 1px; /* アイコンとリンク文字の間隔(隙間) */
}