Skip to content

Commit

Permalink
feat(remove-redirect): 适配推特(Twitter)
Browse files Browse the repository at this point in the history
  • Loading branch information
maomao1996 committed Apr 23, 2024
1 parent ea717f1 commit de23c5a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/stale-countries-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'remove-redirect': minor
---

适配推特(Twitter)
2 changes: 1 addition & 1 deletion packages/remove-redirect/metablock.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name:en": "Remove Redirect",
"namespace": "maomao1996.remove-redirect",
"version": "1.12.0",
"description": "修复跳转链接为站外直链(移除重定向),免去拦截页面点击步骤可直达站外;拦截页面自动跳转;已适配爱发电、百度搜索、CSDN、豆瓣、Facebook、码云、Google 搜索、Google 重定向页、花瓣网、InfoQ、Instagram、简书、掘金、金山文档、链滴、力扣(Leetcode)、51CTO 博客、NGA 玩家社区、牛客网、开源中国、pixiv、微信、微信开放社区、QQ 邮箱、PC 版 QQ、腾讯文档、腾讯兔小巢、360 搜索、少数派、腾讯云开发者社区、微博、YouTube、语雀、知乎、知乎专栏",
"description": "修复跳转链接为站外直链(移除重定向),免去拦截页面点击步骤可直达站外;拦截页面自动跳转;已适配爱发电、百度搜索、CSDN、豆瓣、Facebook、码云、Google 搜索、Google 重定向页、花瓣网、InfoQ、Instagram、简书、掘金、金山文档、链滴、力扣(Leetcode)、51CTO 博客、NGA 玩家社区、牛客网、开源中国、pixiv、微信、微信开放社区、QQ 邮箱、PC 版 QQ、腾讯文档、腾讯兔小巢、360 搜索、少数派、腾讯云开发者社区、推特(Twitter)、微博、YouTube、语雀、知乎、知乎专栏",
"author": "",
"homepage": "",
"supportURL": "",
Expand Down
1 change: 1 addition & 0 deletions packages/remove-redirect/src/sites/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export { default as qqCom } from './qq.com'
export { default as soCom } from './so.com'
export { default as sspaiCom } from './sspai.com'
export { default as tencentCom } from './tencent.com'
export { default as twitterCom } from './twitter.com'
export { default as weiboCom } from './weibo.com'
export { default as youtubeCom } from './youtube.com'
export { default as yuqueCom } from './yuque.com'
Expand Down
26 changes: 26 additions & 0 deletions packages/remove-redirect/src/sites/twitter.com.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { validateUrl } from '@femm/shared-utils'

/******************************************************************************
** Twitter
** - https://twitter.com
** - https://twitter.com/vuejs
******************************************************************************/
const sites: SiteModule = [
[
'推特(Twitter)',
'twitter.com',
{
transform: {
selector: 'a[href*="://t.co/"]',
customTransform(node) {
const originUrl = node.innerText
if (validateUrl(originUrl)) {
node.setAttribute('href', originUrl)
}
},
},
},
],
]

export default sites

0 comments on commit de23c5a

Please sign in to comment.