Created
February 10, 2015 23:30
-
-
Save vinilios/e5680705b81e0d1e47af to your computer and use it in GitHub Desktop.
thepressproject.gr userscript
This file contains 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
// @name thepressproject.gr clicker | |
// @namespace http://thepressproject.gr/#clickerscript | |
// @version 0.0.1 | |
// @author Kostas Papadimitriou <[email protected]> | |
// @description Fix thepressproject.gr links and context menu annoyances. | |
// @domain thepressproject.gr | |
// @domain www.thepressproject.gr | |
// @match http://www.thepressproject.gr/* | |
// @match https://www.thepressproject.gr/* | |
// @match https://thepressproject.gr/* | |
// @match http://thepressproject.gr/* | |
// @run-at document-end | |
// @priority 9001 | |
// @license MIT | |
// ==/UserScript== | |
// https://stackoverflow.com/questions/2246901/how-can-i-use-jquery-in-greasemonkey-scripts-in-google-chrome | |
function addJQuery(callback) { | |
var script = document.createElement("script"); | |
script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"); | |
script.addEventListener('load', function() { | |
var script = document.createElement("script"); | |
script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();"; | |
document.body.appendChild(script); | |
}, false); | |
document.body.appendChild(script); | |
} | |
function main() { | |
$("div[onclick*=goto]").each(function(i,e) { | |
var link= $(e).attr("onclick").match(/goto\('(.*)'\)/); | |
if (!link || link.length < 2) { return } | |
$(e).wrap("<a style='display:block' href='"+ link[1] +"'a></a>") }).attr( | |
"onclick", ""); | |
$(document).unbind("rightclick"); | |
} | |
addJQuery(main); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment