scrapbox-url-customizer-2-settings
code:script.js
const format = text => text
.trim().replace(/\n\r\f/g, '').replace(' ?'[').replace(' ?', ']'); export const config = [
Qiita
code:script.js
{
match: /https:\/\/qiita\.com/,
text: ({url, title, dom, hash}) => {
const span = dom.getElementById(hash);
if (!span) return [${url} ${format(title)}];
const subtitle = span.parentNode.textContent;
return [${url} ${format(subtitle)} | ${format(title)}];
},
},
github.ioのレポジトリのトップページ
code:script.js
{
match: /https:\/\/github\.com\/^\/+\/^\/+\/?$/, text: ({title: title_, url, dom, hash}) => {
const title = title_.split(':')0; const a = dom.getElementById(user-content-${hash});
if (!a) return [/icons/github.icon][${url} ${format(title)}];
const subtitle = a.parentNode.textContent;
return [/icons/github.icon][${url} ${format(subtitle)} | ${format(title)}];
},
},
deno.landのリンク
code:script.js
{
match: /https:\/\/deno\.land/,
text: ({url}) => [/icons2/deno.icon]${url},
},
Wikiwand
urlをwikipediaに変更する
code:script.js
{
match: /https:\/\/www\.wikiwand\.com/,
text: ({pureURL, dom, hash}) => {
const lang, pageName = pureURL.match(/www\.wikiwand\.com\/(^\/+)\/(^\/+)\/?/); const title = ${pageName} - Wikipedia;
const url = https://${lang}.wikipedia.org/wiki/${pageName};
const subtitle = dom.getElementById(toc_btn_${hash.slice(1)})?.textContent;
return !subtitle ?
[${url} ${format(title)}] :
[${url}#${hash.slice(1)} ${format(subtitle)} | ${format(title)}];
},
},
code:script.js
{
match: /https:\/\/wikiwiki\.jp\/rage2050/,
text: ({title, url, dom, hash}) => {
const subtitle = dom.getElementById(hash)?.previousSibling?.textContent;
return !subtitle ?
[${url} ${format(title)}] :
[${url} ${format(subtitle)} | ${format(title)}];
},
},
code:script.js
{
match: /https:\/\/note\.com/,
text: ({title, url, dom, hash}) => {
const subtitle = dom.querySelector([name="${hash}"])?.firstChild?.textContent;
return !subtitle ?
[${url} ${format(title)}] :
[${url} ${format(subtitle)} | ${format(title)}];
},
},
code:script.js
];