Created
May 10, 2013 09:46
-
-
Save tomoconnor/5553479 to your computer and use it in GitHub Desktop.
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 t.co securifier | |
| // @version 0.2 | |
| // @description replace t.co link with https variant | |
| // @match https://twitter.com/* | |
| // @copyright 2013, Tom O'Connor | |
| // ==/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('href').search("https") == -1){ | |
| $(this).attr('href',$(this).attr('href').replace("http","https")); | |
| } | |
| }); | |
| }); | |
| } | |
| // load jQuery and execute the main function | |
| addJQuery(main); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment