User scripts on userstyles.org

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

User scripts on userstyles.org

Jason Barnabe (np)

I'm the administrator of userstyles.org. I want to start offering my
styles to Greasemonkey (and similar) users. For applicable styles on
userstyles.org, just plunk "/style.user.js" at the end of the URL. (For
example, http://userstyles.org/style/show/242/style.user.js ). Not all
styles on the site can be converted into user scripts. For example,
those affecting chrome wouldn't work. Those styles will return a 404 if
you try to open their styles.

I'd like some feedback on the format I'm using. Is the code the best it
can be, are there problems with meta-data, etc. Thanks.
--
  Jason Barnabe
  [hidden email]

--
http://www.fastmail.fm - I mean, what is it about a decent email service?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/greasemonkey-users
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: User scripts on userstyles.org

RodMcguire

Quoting Jason Barnabe <[hidden email]>:

> I'm the administrator of userstyles.org. I want to start offering my
> styles to Greasemonkey (and similar) users. ...

Nice hack. One thing I didn't like was putting "var css = ..." all on one line
which makes it hard to read and involves a lot of right-scrolling.

Personally, I have been using Stylish in distinction from Greasemonkey. Stylish
just modifies style while GM goes beyond that.

BTW. Where does Stylish keep its styles on local disk? I poked around once and
couldn't find them.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/greasemonkey-users
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: User scripts on userstyles.org

Jason Barnabe (np)

Rod McGuire wrote:
> Nice hack. One thing I didn't like was putting "var css = ..." all on one line
> which makes it hard to read and involves a lot of right-scrolling.

What do you suggest instead? Breaking lines and concatenating where
linebreaks exist in the CSS?

> BTW. Where does Stylish keep its styles on local disk? I poked around once and
> couldn't find them.

stylish.rdf in the profile folder.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/greasemonkey-users
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: User scripts on userstyles.org

esquifit-2
In reply to this post by Jason Barnabe (np)
2006/10/24, Jason Barnabe <[hidden email]>:
> [...] For applicable styles on
> userstyles.org, just plunk "/style.user.js" at the end of the URL. (For
> example, http://userstyles.org/style/show/242/style.user.js ).

This seems like a typical task for GM ;).  I've sketched a quick hack
that should add a link to each style on
http://userstyles.org/style/show/NN.  On clicking on it, a userscript
should be dynamically generated from the userstyle and offered for
installation.

I cannot test it right now, I'm bound to IE in a corporate network,
and my PortableFirefox is unwilling to start :(  May be someone among
you is interested in trying and fixing it...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/greasemonkey-users
-~----------~----~----~----~------~----~------~--~---

style2script.user.js (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: User scripts on userstyles.org

Jason Barnabe (np)

> This seems like a typical task for GM ;).  I've sketched a quick hack
> that should add a link to each style on
> http://userstyles.org/style/show/NN.  On clicking on it, a userscript
> should be dynamically generated from the userstyle and offered for
> installation.

I don't think you understand... I'm the administrator of the site and I
plan to change the site to make the user script version available. I'm
just looking for feedback on the format of the output.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/greasemonkey-users
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: User scripts on userstyles.org

esquifit-2

2006/10/24, Jason Barnabe (np) <[hidden email]>:

>
> > This seems like a typical task for GM ;).  I've sketched a quick hack
> > that should add a link to each style on
> > http://userstyles.org/style/show/NN.  On clicking on it, a userscript
> > should be dynamically generated from the userstyle and offered for
> > installation.
>
> I don't think you understand... I'm the administrator of the site and I
> plan to change the site to make the user script version available. I'm
> just looking for feedback on the format of the output.

Oh yes, I do understand.  I just felt tempted to try to achieve a
similar result without resorting to server-side cooperation.  The
basic idea is that lots of things that are normally served from a web
server can be locally generated and included into the page (together
with the correct content-type) via a "data:" url, making no difference
to the browser.  I'm doing similar things with other scripts right
now.

This attempt was just an exercise motivated by the service you've just
started providing, and it has no connection with your request for
feedback, I apologise in case you consider it was off-topic.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/greasemonkey-users
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: User scripts on userstyles.org

jdunck
In reply to this post by Jason Barnabe (np)

On 10/23/06, Jason Barnabe <[hidden email]> wrote:
> I'd like some feedback on the format I'm using. Is the code the best it
> can be, are there problems with meta-data, etc. Thanks.

meta looks good.

In the example .user.js provided, there are no doublequotes in the
CSS, though this is possible.  Are you escaping those, or would they
break your string literal?

In your error message, you should probably suggest what -would- be
supported (or what's required).

"Whatever user JavaScript method you're using isn't supported."
->
"Unable to inject CSS; please use Greasemonkey, Turnabout, or another
injection system which provides GM_addStyle or addStyle."

...Or something like that.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/greasemonkey-users
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: User scripts on userstyles.org

Jason Barnabe (np)

Jeremy Dunck wrote:
> In the example .user.js provided, there are no doublequotes in the
> CSS, though this is possible.  Are you escaping those, or would they
> break your string literal?

Escaping. " becomes \".

> In your error message, you should probably suggest what -would- be
> supported (or what's required).

Sounds good.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/greasemonkey-users
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: User scripts on userstyles.org

Johan Sundström
In reply to this post by jdunck

I'd remove the dependency on those convenience functions (as it is a
short and function that doesn't require chrome privileges) and always
succeed instead, using something like:

var node = document.createElement('style');
node.type = 'text/css';
node.innerHTML = css;
document.getElementsByTagName('head')[0].appendChild(node);

If you do keep the tests, though, try testing with if( typeof
GM_addStyle != "undefined" ) instead; your present take won't survive
a nonexistant GM_addStyle.

--
 / Johan Sundström, http://ecmanaut.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/greasemonkey-users
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: User scripts on userstyles.org

Jason Barnabe (np)

Johan Sundström wrote:
> I'd remove the dependency on those convenience functions (as it is a
> short and function that doesn't require chrome privileges) and always
> succeed instead

I'm concerned that other user script extensions would have different
ways of applying the style. For example, maybe in browser X innerHTML
isn't supported so the developer of the extension for browser X used
appendChild(createTextNode) instead. Or in browser Y there's some other
way of doing it so that it doesn't affect the DOM of the page, yet
equally loads the style (which would be better, because inserting
random DOM elements into a page can break pages). I think I'll keep the
function checks and use something similar to the code you posted as a
third option rather than showing the error alert.

Thanks for the heads up on the function check/undefined thing (I find
JavaScript's undefined behaviour a little inconsistent...).


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/greasemonkey-users
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: User scripts on userstyles.org

Johan Sundström

On 10/25/06, Jason Barnabe (np) <[hidden email]> wrote:
> Thanks for the heads up on the function check/undefined thing (I find
> JavaScript's undefined behaviour a little inconsistent...).

if( typeof GM_addStyle != "undefined" )
  /* there is a GM_addStyle defined, of some type */;

is at least always consistent, across all implementations. (I would
guess you mean the automatic type coercion, which is a somewhat messy
affair.)

--
 / Johan Sundström, http://ecmanaut.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "greasemonkey-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/greasemonkey-users
-~----------~----~----~----~------~----~------~--~---