まつど
code:script.js
$('body').attr('data-daiiz-icon-button', 'on'); // 'on' or 'off'
/niwatolog/Scrapboxに赤シート機能をつける
code:script.js
$('body').attr('data-daiiz-rel-bubble', 'off'); // 関連ページを吹き出し表示する
$('body').attr('data-daiiz-text-bubble', 'on'); // リンク先ページのテキストを表示する
$('body').attr('data-daiiz-icon-button', 'on'); // アイコンをボタンにする
$('body').attr('data-daiiz-paste-url-title', 'ctrl'); // URL titleの形でペーストする
/customize/daiiz製のChrome拡張機能
https://gist.github.com/kn1cht/911ca1e4c3e92c636a603dce940eae99
code:script.js
scrapbox.PopupMenu.addButton({
title : 'Embed Tweet',
onClick : text => {
const convertContent = content => {
const replaced = content
.replace(/<a href="(https?:.*?)">(.*?)<\/a>/g, '$1 $2')
.replace(/<br>/g, '\n>');
const elem = document.createElement('div');
elem.innerHTML = replaced;
return elem.innerText;
}
const tweetRegex = /<blockquote\w"\-= *><p\w"\-= *>(?<content>.*)<\/p>&mdash;(?<author>.*)(?<link><a.*>)<\/blockquote>/;
const match = text.match(tweetRegex);
if(!match) return;
const {content, author, link} = match.groups;
return text.replace(tweetRegex, >${convertContent(content)}\n>\t—${author} ${convertContent(link)});
}
})
/kn1cht/embed-tweet