// ==UserScript== // @name clearonclick // @namespace http://rampion.myopenid.com // @description clear onclick behaviour from html links // @include http://andrewsullivan.theatlantic.com/the_daily_dish/* // ==/UserScript== try { GM_log("called"); const links = document.getElementsByTagName('a'); for (var i = links.length - 1; i >= 0; i--) { (function(link){ link.addEventListener('click', function(ev) { try { GM_log('clicked '+link.href); // ev.preventDefault(); // doesn't seem to be sufficient link.wrappedJSObject.onclick = null; // can't find a better way to do this. } catch (e) { GM_log(e); } return false; }, false); })(links[i]); } } catch (e) { GM_log(e); }