ブックマークレット
Tekenoteには2つのブックマークレットがある
code:web-clip.js
(function(){
function getOGPInfo() {
if (!ogImage) {
ogImage = document.querySelector("#landingImage")?.src
}
if (!ogImage) {
ogImage = document.querySelector("img")?.src
}
if (ogImage) {
return ![OGP Image](${ogImage});
} else {
return "";
}
}
const title = window.prompt(Scrap ${document.title} to Tekenote, document.title)
if (!title) return
let lines = [[${document.title}](${window.location.href})]
const quote = window.getSelection().toString()
if (quote.trim()) {
lines = lines.concat(quote.split(/\n/).map((q) => > ${q}))
}
const ogpLine = getOGPInfo();
if (ogpLine) {
lines = lines.concat(ogpLine);
}
const body=encodeURIComponent(lines.join('\n'))
window.open(
https://tekenote.com/cards/new?title=${encodeURIComponent(${title.trim()})}&body=${body}
)
})();