Skip to content

Instantly share code, notes, and snippets.

@parsakafi
Last active November 14, 2016 09:32
Show Gist options
  • Save parsakafi/990f4d9f84728285706d1aaf377ed6a0 to your computer and use it in GitHub Desktop.
Save parsakafi/990f4d9f84728285706d1aaf377ed6a0 to your computer and use it in GitHub Desktop.
t.co bypass
fairly self explanatory, but just in case, this package will replace t.co urls on twitter and tweetdeck by using other attributes in the anchor tag.
install in firefox with Greasmonkey addon and in google chrome with Tampermonkey
Install:
https://openuserjs.org/scripts/parsa-kafi/t.co_bypass
// ==UserScript==
// @name t.co bypass
// @namespace http://parsa.ws
// @include https://twitter.com/*
// @include https://tweetdeck.com/*
// @include https://tweetdeck.twitter.com/*
// @version 1.3
// @grant none
// @description fairly self explanatory, but just in case, this package will replace t.co urls on twitter and tweetdeck by using other attributes in the anchor tag. Programmer: Parsa Kafi , http://parsa.ws
// ==/UserScript==
if(window.attachEvent) {
window.attachEvent('onload', tcobp_start_timer);
} else {
if(window.onload) {
var curronload = window.onload;
var newonload = function() {
curronload();
tcobp_start_timer();
};
window.onload = newonload;
} else {
window.onload = tcobp_start_timer;
}
}
function tcobp_start_timer(){
var myVar = setInterval(function(){tcobp_change_link()}, 1500);
}
function tcobp_change_link(){
var host = window.location.host;
var max = 20;
var x = "";
var fbs = new RegExp("http://fb.me");
var res = false;
var i;
var u = "";
var h = "";
if(host == "twitter.com")
x = document.getElementsByClassName("twitter-timeline-link");
else
x = document.getElementsByClassName("url-ext");
for (i = 0; i < x.length, i <= max; i++) {
if(host == "twitter.com")
u = x[i].getAttribute("data-expanded-url");
else
u = x[i].getAttribute("data-full-url");
h = x[i].getAttribute("href");
if(h != u && u !== "" && u !== null){
res = fbs.test(u);
if(res)
u = u.replace("http://fb.me", "https://fb.me");
x[i].setAttribute('href', u);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment