Skip to content

Instantly share code, notes, and snippets.

@codexss
Forked from asportnoy/open-youtube-app.user.js
Last active December 4, 2022 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save codexss/eb5ae8fa5ff85112e091d6f4e0f48f3f to your computer and use it in GitHub Desktop.
Save codexss/eb5ae8fa5ff85112e091d6f4e0f48f3f to your computer and use it in GitHub Desktop.
Open Twitter App Userscript | See https://github.com/BandarHL/OpenTwitterSafariExtension
// ==UserScript==
// @name Open Twitter App
// @version 1.0.7
// @author Lentin
// @match https://twitter.com/*
// @match https://mobile.twitter.com/*
// @downloadURL https://gist.github.com/codexss/eb5ae8fa5ff85112e091d6f4e0f48f3f/raw/open-twitter-app.user.js
// @updateURL https://gist.github.com/codexss/eb5ae8fa5ff85112e091d6f4e0f48f3f/raw/open-twitter-app.user.js
// @homepage https://gist.github.com/codexss/eb5ae8fa5ff85112e091d6f4e0f48f3f/
// ==/UserScript==
var locationArr = window.location.pathname.split("/").reverse()
if (locationArr[0] && !locationArr[1]) {
if (locationArr[0] === "home") {
window.location.href = `twitter://timeline`
} else {
window.location.href = `twitter://user?screen_name=${locationArr[0]}`
}
} else if (locationArr[0] && locationArr[1] === "status") {
window.location.href = `twitter://status?id=${locationArr[0]}`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment