// ==UserScript== // @name TOKIMEKI Quotes & Media Detail Linker // @namespace https://tokimeki.blue/ // @version 0.1.0 // @description Quotes一覧とMedia詳細から当該postへのリンクを追加する // @author mudo34 // @match https://tokimeki.blue/* // @icon https://www.google.com/s2/favicons?domain=tokimeki.blue // @grant none // @noframes // ==/UserScript== (function() { 'use strict'; function onContent(el, e) { const node = el.querySelector('.timeline__content'); if (!node) { return; } const aturi = node.getAttribute('data-aturi'); if (!aturi) { return; } const url = aturi.replace( /.+(did:plc:.+)\/app\.bsky\.feed\.post\/(.+)$/, '/profile/$1/post/$2' ); const a = document.createElement('a'); a.href = url; a.style.display = 'none'; document.body.appendChild(a); a.click(); a.remove(); } function attachLink(root, type, selector, handler) { root.addEventListener(type, e => { const el = e.target.closest(selector); if (el && root.contains(el)) { handler(el, e); } }); } attachLink(document, 'click', '.media-content .timeline__item .timeline__column', onContent); attachLink(document, 'click', '.quotes .timeline__item .timeline__column', onContent); })();