-
Notifications
You must be signed in to change notification settings - Fork 0
/
tcoAwayScript.user.js
32 lines (32 loc) · 1.21 KB
/
tcoAwayScript.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// ==UserScript==
// @name t.coAway
// @namespace http://userscripts.org/scripts/show/151019
// @version 0.1
// @downloadURL https://github.com/nindogo/test_repo/raw/master/tcoAwayScript.user.js
// @description replace t.co link into original link on twitter web page
// @match https://twitter.com/*
// @copyright 2012, Herolee; 2014 nindogo
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "https://ajax.microsoft.com/ajax/jquery/jquery-1.8.2.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
// the guts of this userscript
function main(){
$().ready(function(){
$('a.twitter-timeline-link').each(function(){
if($(this).attr('data-expanded-url')){
$(this).attr('href',$(this).attr('data-expanded-url'));
}
});
});
}
// load jQuery and execute the main function
addJQuery(main);