特定のリンクにアイコンをつけるUserCSS
URLに応じてアイコンを変えるUserCSS
リンクを出典アイコンにするUserCSSといっしょに用いるとこんな感じになる
元ネタ:/noratetsu/●特定のリンクにfaviconをつける
共通設定
先頭にアイコンをつける
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*=".wikipedia.org",
[href^="https://www.amazon.co.jp"],
[href^="https://amazon.co.jp"],
[href^="https://youtube.com/"],
[href^="https://www.youtube.com/"],
[href^="https://archlinux.org"],
[href^="https://aur.archlinux.org"],
[href^="https://wiki.archlinux.org"],
[href^="https://wiki.archlinux.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; */
}
リンクを出典アイコンにするUserCSS
個別の設定
Font Awesomeを常時使えるようにするUserCSSを入れている前提で書いているので、font-familyは省略しました
アイコンの位置がちょっと微妙かもtakker.icon
直していただけると嬉しいです
PDF:サンプル(展開ヘルプ)、サンプル展開ヘルプ
code:style.css
.line a.link:not(.icon)href$=".pdf"::before {
content: '\f1c1';
font-weight: 400;
margin-right: 1px;
}
Github:サンプル(progfay/scrapbox-parser)サンプルhttps://gist.github.com/yuiseki/60da2a5b743c4ce835d7b75c4ca89b33
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:サンプル(増井俊之)増井俊之
任意の言語の Wikipedia (例:ဗမာနိုင်ငံတော်)に適応されるようにする。Summer498.icon
code:style.css
:is(.line, .line .deco) a.link:is(
href*=".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*=".wikipedia.org"
) span.char-index {
display: inline-block;
width: 0;
text-indent: -9999px;
}
.line .deco-\. a.link:is(
href*=".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;
}
YouTube:サンプル()
code:style.css
:is(.line, .line .deco) a.link:is(
[href^="https://youtube.com/"],
[href^="https://www.youtube.com/"]
)::before {
content: '\f167';
font-weight: 400;
margin-right: 1px;
}
Arch Linux
code:css
:is(.line, .line .deco) a.link:is(
[href^="https://archlinux.org"],
[href^="https://aur.archlinux.org"],
[href^="https://wiki.archlinux.org"],
[href^="https://wiki.archlinux.jp"]
)::before {
content: ' ';
background-image: url("https://i.gyazo.com/7031deebce32df5fd696879df98c34e0.png");
font-weight: 400;
margin-right: 1px;
}
テンプレート
code:css
:is(.line, .line .deco) a.link:is(
[href^="https://<ドメイン>"], /* 複数記述できる */
[href^="https://<ドメイン>"] /* 末尾はコンマなし */
)::before {
content: '\f266'; /* Font Awesomeのアイコンの文字コード */
font-weight: 400; /* 通常はnormal(400), SOLIDアイコンはbold(700以上) */
margin-right: 1px; /* アイコンとリンク文字の間隔(隙間) */
}
URL 追加の方法
1. 共通設定にURLを追加
2. テンプレートを複製
3. テンプレート内の https://<ドメイン> の書き換え
4. テンプレート内の content: 書き換え
リンクを出典アイコンにするUserCSSとの連携テスト
意識(いしき、Consciousness)は、一般に、「起きている状態にあること(覚醒)」または「自分の今ある状態や、周囲の状況などを認識できている状態のこと」を指すhttps://ja.wikipedia.org/wiki/意識
Settings.icon
UserCSS.icon
アーカイブ: 特定のリンクにアイコンをつけるUserCSS ver.0