Created
August 12, 2022 14:36
-
-
Save fbbp/cb9ab19ee4e9ab5c0da14e86c2e35d18 to your computer and use it in GitHub Desktop.
引用RT一覧ページのリンクをクリックした際別タブでツイートURLを検索キーとした検索ページを開くTampermonkeyのユーザースクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Twitter:Open quote tweets page | |
// @namespace https://github.com/fbbp | |
// @version 0.1 | |
// @description 引用RT一覧ページのリンクをクリックした際別タブでツイートURLを検索キーとした検索ページを開く | |
// @author fbbp | |
// @match *://twitter.com/* | |
// @grant GM_openInTab | |
// @run-at document-start | |
'use strict'; | |
function openQuoteTweetsPage(event) | |
{ | |
const url = event.target.parentElement.parentElement.href || event.target.parentElement.parentElement.parentElement.parentElement.href; | |
if (url&&url.match(/https:\/\/twitter.com\/.+with_comments$/)) { | |
event.preventDefault(); | |
GM_openInTab('https://twitter.com/search?q='+encodeURIComponent(url.replace('retweets/with_comments',''))+'&f=live', {active: true}); | |
return; | |
} | |
} | |
addEventListener('click', openQuoteTweetsPage, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment