-
-
Save jerodsanto/1137337 to your computer and use it in GitHub Desktop.
(function() { | |
function uncrippleFrame() { | |
var body = this.contentWindow.document.getElementsByTagName('body')[0]; | |
this.contentWindow.onclick = null; | |
body._frame = this; | |
body.onmousemove = function() { | |
this._frame.contentWindow.onclick = null; | |
this.setAttribute('style', '-webkit-user-select: auto;'); | |
this.oncontextmenu = body.onselectstart = null; | |
}; | |
body.onmousemove(); | |
}; | |
var container = document.getElementsByTagName('iframe')[0].contentWindow; | |
var frames = container.document.getElementsByTagName('iframe'); | |
for (var i = 0; i < frames.length; i++) { | |
uncrippleFrame.call(frames[i]); | |
frames[i].onload = uncrippleFrame; | |
} | |
})(); |
@trrichard Amazon was loading jQuery into the global context, but it appears they aren't anymore. The bookmarklet now fails for me as well. I was just using jQuery because it was available and makes getting at elements easier. I'll rewrite it to use vanilla js dom tools instead.
Hey @sant0sk1 I forked and patched the bookmarklet so it loads jquery now before modifying the iframes. I recommend you merge till you fix it to work with out jquery.
@trrichard cool, I actually have a rewritten copy on my desktop, but haven't published it yet because amazon changed the way it works and they are resetting the original state anytime you reload content (when the loading spinner appears, not when navigating a single page).
I wanted to get that working first, but if you prefer I'll publish what I have.
works great as of today. I'm going to make this a glimmerblocker plugin so it just always runs =)
i'm pretty new at this. downloaded the file, but can't get it to open in any of my browsers (tried IE and firefox). any suggestions?
Just tried it with Safari 5.1.4 on my Mac and it doesn't work at all. No errors in the dev console either.
@sant0sk1 I'm experiencing the same problem as @kerim. It is probably related to jquery which defines the $('id') function as find component by ID. Your JS code work when run from the Chrome development console, just not as a bookmarklet. You should probably rewrite your bookmarklet to be independent of, or include the code to jquery.