Comments on: Using YUI in Greasemonkey Scripts http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/ News and Artilces about Designing and Developing with Yahoo! Libraries. Thu, 04 Dec 2008 13:15:54 +0000 http://wordpress.org/?v=2.3.3 By: binky http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-332810 binky Sun, 30 Mar 2008 01:04:33 +0000 http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-332810 eric, that might be due to the latest version of the GM extension having tightened its security up. it no longer lets you call the GM_ built in functions like gm_xmlhttprequest from within the unsafewindow scope. eric, that might be due to the latest version of the GM extension having tightened its security up. it no longer lets you call the GM_ built in functions like gm_xmlhttprequest from within the unsafewindow scope.

]]>
By: Eric http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-306265 Eric Fri, 15 Feb 2008 23:37:25 +0000 http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-306265 This does not work for me. Has something new in Greasemonkey or YUI broken this? I just get a regular text, but no panel formatting whatsoever. Thanks. This does not work for me. Has something new in Greasemonkey or YUI broken this? I just get a regular text, but no panel formatting whatsoever.

Thanks.

]]>
By: Where Are The Wise Men? » Blog Archive » Mike Dives Into Greasemonkey http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-213027 Where Are The Wise Men? » Blog Archive » Mike Dives Into Greasemonkey Fri, 19 Oct 2007 18:55:44 +0000 http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-213027 [...] Dive Into Greasemonkey, which is really his Greasemonkey Hacks book online.  Next step: Using YUI in GreaseMonkey Scripts.  Then the outside-world website hacking will begin!!Powered by [...] […] Dive Into Greasemonkey, which is really his Greasemonkey Hacks book online.  Next step: Using YUI in GreaseMonkey Scripts.  Then the outside-world website hacking will begin!!Powered by […]

]]>
By: Annesley Newholm http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-190127 Annesley Newholm Thu, 13 Sep 2007 14:43:03 +0000 http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-190127 Hi, The code in the last post didn't come out too well! Here is the address of a GreaseMonkey script that uses the GM_IncludeOnce loader: http://dharmafly.com/hackhud/hackhud.user.js Enjoy! Annesley Hi,

The code in the last post didn’t come out too well! Here is the address of a GreaseMonkey script that uses the GM_IncludeOnce loader:

http://dharmafly.com/hackhud/hackhud.user.js

Enjoy!

Annesley

]]>
By: Annesley Newholm http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-187576 Annesley Newholm Sat, 08 Sep 2007 10:09:42 +0000 http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-187576 Hi, I wanted to create a more generic version of this script (GM_includeOnce for example) which was able to be more secure (not use unsafeWindow) if required. Also I wanted to remove what I believe is un-necessary polling in this script. Here is what I came up with (please tear it to bits/make it better): try {test=GM_includeOnce;} catch (err) { GM_log('adding GM_includeOnce function'); function GM_includeOnce(assets, callbackOnComplete, callbackOnTimeout, timeout, context) { /* GM_includeOnce(assets[, callbackOnComplete[, callbackOnTimeout[, timeout[, context]]]]) assets = [{url:'', existenceTest:func[, type: typeEnum]}] type is calculated from extension if not included no callback is made without callbackOnComplete default timeout is 10000 (10 seconds) context is the object that the scripts are run on, defaults to this callbackOnComplete is sent a closure style function as its only parameter which allows access to the variables created in the scripts */ //private functions var numAssets=assets.length, numJSAssets=0, numJSLoaded=0; var timeoutTimer=setTimeout(callbackOnTimeout, timeout||10000); var allScript='', allCSS='', importScript=''; var asset, type, styleLink; function accessFunc(localVar) {try{return eval(localVar);} catch (err) {}} function allScriptsLoaded() { GM_log('allScriptsLoaded'); clearTimeout(timeoutTimer); //it may be better to add these scripts immediately rather than compiling the big string in some circumstances GM_log('compiling scripts'); for (var a=0;a Hi,

I wanted to create a more generic version of this script (GM_includeOnce for example) which was able to be more secure (not use unsafeWindow) if required. Also I wanted to remove what I believe is un-necessary polling in this script.

Here is what I came up with (please tear it to bits/make it better):

try {test=GM_includeOnce;}
catch (err) {
GM_log(’adding GM_includeOnce function’);
function GM_includeOnce(assets, callbackOnComplete, callbackOnTimeout, timeout, context) {
/*
GM_includeOnce(assets[, callbackOnComplete[, callbackOnTimeout[, timeout[, context]]]])
assets = [{url:”, existenceTest:func[, type: typeEnum]}] type is calculated from extension if not included
no callback is made without callbackOnComplete
default timeout is 10000 (10 seconds)
context is the object that the scripts are run on, defaults to this
callbackOnComplete is sent a closure style function as its only parameter which allows access to the variables
created in the scripts
*/

//private functions
var numAssets=assets.length, numJSAssets=0, numJSLoaded=0;
var timeoutTimer=setTimeout(callbackOnTimeout, timeout||10000);
var allScript=”, allCSS=”, importScript=”;
var asset, type, styleLink;

function accessFunc(localVar) {try{return eval(localVar);} catch (err) {}}

function allScriptsLoaded() {
GM_log(’allScriptsLoaded’);
clearTimeout(timeoutTimer);
//it may be better to add these scripts immediately rather than compiling the big string in some circumstances
GM_log(’compiling scripts’);
for (var a=0;a

]]>
By: links for 2007-04-17 « Joost’s weblog http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-93027 links for 2007-04-17 « Joost’s weblog Tue, 17 Apr 2007 09:01:33 +0000 http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-93027 [...] Using YUI in Greasemonkey Scripts (Yahoo! User Interface Blog) Title says it all, interesting! (tags: api code webdev YUI yahoo javascript greasemonkey) [...] […] Using YUI in Greasemonkey Scripts (Yahoo! User Interface Blog) Title says it all, interesting! (tags: api code webdev YUI yahoo javascript greasemonkey) […]

]]>
By: miles http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-65734 miles Wed, 14 Mar 2007 23:49:57 +0000 http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-65734 For those reading this post Feb 2007, Yahoo does now host the yui files: http://developer.yahoo.com/yui/articles/hosting/ For those reading this post Feb 2007, Yahoo does now host the yui files:
http://developer.yahoo.com/yui/articles/hosting/

]]>
By: Sam http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-29178 Sam Fri, 05 Jan 2007 22:20:26 +0000 http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-29178 I had a go at this a while back and got distracted apparently. The issue I was grappling with was the use of the unsafeWindow - which as I understand it potentially opens a hole allowing a page author to gain access to the greater privileges Greasemonkey has on your machine. I went down a rat-hole loading the files via GM_xmlhttprequest and trying to eval them (in the protected userscript scope). But I see now that even if that could work, the need to load CSS into the document puts you back where you (I) started. I think the power of loading in a library like YUI (or Dojo via AOL's CDN) is /huge/ and should drive the design of future versions of Greasemonkey if there's not a safe and elegant way to do it now. I know the topic has been aired in the Greasemonkey mailing list. Btw. I'm right there with you on prototyping and testing out new ideas on applications and pages. Even though I might in theory have access to those apps' code, in practice its much easier (and cooler) this way. I had a go at this a while back and got distracted apparently. The issue I was grappling with was the use of the unsafeWindow - which as I understand it potentially opens a hole allowing a page author to gain access to the greater privileges Greasemonkey has on your machine.

I went down a rat-hole loading the files via GM_xmlhttprequest and trying to eval them (in the protected userscript scope). But I see now that even if that could work, the need to load CSS into the document puts you back where you (I) started.

I think the power of loading in a library like YUI (or Dojo via AOL’s CDN) is /huge/ and should drive the design of future versions of Greasemonkey if there’s not a safe and elegant way to do it now. I know the topic has been aired in the Greasemonkey mailing list.

Btw. I’m right there with you on prototyping and testing out new ideas on applications and pages. Even though I might in theory have access to those apps’ code, in practice its much easier (and cooler) this way.

]]>
By: Internet Vibes » Blog Archive » Using YUI in GreaseMonkey Scripts http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-28816 Internet Vibes » Blog Archive » Using YUI in GreaseMonkey Scripts Thu, 04 Jan 2007 08:36:15 +0000 http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-28816 [...] You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your ownsite. [...] […] You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your ownsite. […]

]]>
By: Eric Miraglia http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-28744 Eric Miraglia Thu, 04 Jan 2007 03:58:21 +0000 http://yuiblog.com/blog/2007/01/03/yui-greasemonkey/#comment-28744 Peter, Thanks for the comment. Opening up hosting of YUI would benefit lots of developers -- not just Greasemonkey developers -- but it would be especially nice in the GM context, absolutely. I hear you loud and clear. -Eric Peter,

Thanks for the comment. Opening up hosting of YUI would benefit lots of developers — not just Greasemonkey developers — but it would be especially nice in the GM context, absolutely. I hear you loud and clear.

-Eric

]]>