User-scripts in Google Chrome aren't GreaseMonkey scripts
This weekend I was playing around with writing a GreaseMonkey script to force the new Twitter layout to take up the full screen width for the list of tweets.
What I expected to be a 5 minute job turned into an hour and a half. The main issue was that it turns out I wasn't writing a GreaseMonkey script. While the user-scripts in Google Chrome are very similar to GreaseMonkey scripts, they differ in how they handle security (as well as some other more minor differences such as no @require). Eventually I found a helpful page on the Chromiumn wiki explaining the differences.
For me the biggest difference was the absence of unsafeWindow. The easiest way I found to workaround this limitation (which is just a sensible security protect) was to inject the javascript to execute into the document.
The resulting code isn't pretty and is a little harder to debug, but it works and I now don't have large areas of blank screen space when using Twitter.
No comments:
Post a Comment