unofficial port of the ln.ht bookmarklet to a chromium extension because i use arc and can't use bookmarklets >:C
1function openLnHt () {
2 window.open(`https://ln.ht/_/add?url=${encodeURIComponent(document.location)}&title=${encodeURIComponent(document.title)}¬es=${document.querySelector('meta[name="description"]') !== null ? document.querySelector('meta[name="description"]').content : ''}&tags=${document.querySelector('meta[name="keywords"]') !== null ? document.querySelector('meta[name="keywords"]').content : ''}`);
3}
4
5chrome.action.onClicked.addListener((tab) => {
6 if (!tab.url.includes('chrome://')) {
7 chrome.scripting.executeScript({
8 target: { tabId: tab.id },
9 function: openLnHt
10 });
11 }
12});