Greasy Fork is available in English.
ツイートの下にエンゲージメント画面に飛ぶリンクを追加します。結構自分用。
当前为
// ==UserScript==
// @name Twitter Engagement Button
// @namespace http://tampermonkey.net/
// @version 0.1
// @description ツイートの下にエンゲージメント画面に飛ぶリンクを追加します。結構自分用。
// @author sambaquiz
// @match https://twitter.com/*
// @match https://mobile.twitter.com/*
// @match https://pbs.twimg.com/media/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @license MIT
// @grant none
// ==/UserScript==
const EB = (function() {
'use strict';
return {
inject: function (article) {
let tweets = document.querySelectorAll('article[data-testid="tweet"]');
if (article.getAttribute('data-testid') === 'tweet') {
let username = article.querySelector('a[href^="/"]').href.split('/')[3];
let status_id = article.querySelector('a[href*="/status/"]').href.split('/status/').pop().split('/').shift();
let myA = document.createElement('a');
myA.className = 'myA';
myA.href = `/${username}/status/${status_id}/quotes`;
myA.target= '_blank';
myA.textContent = `エンゲージメント確認`;
article.appendChild(myA);
}
article.dataset.EBinjected = 'true';
article.style.flexDirection = 'column';
}
}
})();
(function () {
const callback = ms => ms.forEach(m => m.addedNodes.forEach(node => {
const article = node.tagName == 'ARTICLE' && node || node.tagName == 'DIV' && (node.querySelector('article') || node.closest('article'));
if (article && !article.dataset.EBinjected) EB.inject(article);
}));
const observer = new MutationObserver(callback)
observer.observe(document.body, {childList: true, subtree: true});
})();