joeytwiddle / Github Notifications Dropdown

Heya joeytwiddle... I thought I'd give your script a whirl but there seems to be some issues with it currently.

  • You don't currently define @version so automatic updating won't ever occur for anyone.
  • You don't currently define @grant GM_addStyle so the script fails in Greasemonkey 2.0 to run at all.
  • In the error console I get a $ not defined... not sure if you are using jQuery or something else... so possibly the @require is missing? Since I can't guess on what you are using I can't even assist with any further suggestions.
  • It would awesome if you could use some of the OpenUserJs.org supported metadata block keys found here and also referenced currently in the far left pane when you add a script on this site.

Thanks and hope to see this come to fruition. :)

Re: @Marti:

Gosh so many bugs! Thanks for the feedback.

I have been using TamperMonkey in Chromium, but the script appears to work fine under my Firefox 28 too, so I could not have detected these myself! (Greasemonkey nightly 2014/04/16) (My Firefox is sick; she hangs for 4 minutes shortly after startup. I only have 20 extensions and 150 tabs open, so I dunno what's up.)

  • @version DONE
  • @grant GM_addStyle DONE (really, I have to do this now? :P )
  • @license I'd probably choose some communist nonsense like GPL so perhaps it's better I leave it as MIT :P
  • jQuery - this is a curious one. I assumed GitHub had included $ and so I was using it too. Perhaps GM is blocking it because of page scope? GM_grrr...

I didn't have time to click through and read the Greasemonkey Wiki. If you think @version (and other tags) are very important then perhaps they should also be featured in the left-hand column.

I'd really like computers to do more work, and me to do less, so I wish everything would just work without needing 20 @ tags in the header! Cheers!

"GreaseMonkey will be updated after you restart Firefox." I feel I'm going to regret this...

Marti, I would consider making you a collaborator, to help fix the issues with whatever crazy modern setup you are running. But I am concerned how this would work with the Github hook I am using. If you contribute changes on here, how could I get them back to Github? And isn't there a danger I might overwrite them without noticing, by pushing a new version to Github?

One thought also occurs, about this site in general. With its own "Issue tracker" isn't this site re-inventing the wheel and violating DRY? Shouldn't OpenUserJS.org instead be encouraging and enabling people to do collaboration on GitHub, rather than splitting the effort over the two services?

(I can think of one argument against that. Github is, ironically, not FOSS!)

After updating to the latest Greasemonkey (nightly 2014-06-23), this userscript is still running fine for me. I got $ and everything! So what's the beef, cowboy?

Re: @joeytwiddle:

After reinstalling the script and restarting Firefox again, it has now stopped working. THANKS A LOT MARTI!

Chromium indicates that it got $ from the CDN:

> window.$
function (t,e){return new Q.fn.init(t,e)}               frameworks-df9e4beac80276ed3dfa56be0d97b536d0f5ee12.js:2

Don't ask Firefox's Browser Console (Ctrl-Shift-J) about window.$, it will say undefined. Ask the Web Console instead (Ctrl-Shift-K), it will say [object Function]. But you still need the first one open to see all the error messages...

I can get somewhere in Greasemonkey by putting this at the top of my script:

var $ = unsafeWindow.$;

But then I get "Permission denied to access property 'handler'". The problem appears to be GreaseMonkey's long-problematic security enhancements. These make scripting a nightmare, especially since 90% of scripts run in page-scope, and don't need any special access. But it seems if I remove the @grant GM_addStyle then it seems the security locks turn off. So I did that.

Please give the latest version a try!

I thought I would use jQuery to save time. Of course I had forgotten about Greasemonkey ... :P

Re: @joeytwiddle:

@grant GM_addStyle DONE (really, I have to do this now? :P )

Are you sure it is done right now? Yes you do need to. Sniffing ended. Your current version removed the requirement since you aren't using the API anymore.

If you think @version (and other tags) are very important then perhaps they should also be featured in the left-hand column.

They are and there is a nice link at the top to explain all of the metadata block. One just needs to read. :)

If you contribute changes on here, how could I get them back to Github?

Do it on GH... those will always overwrite what is here.

With its own "Issue tracker" isn't this site re-inventing the wheel

No everyone is on GH.

and violating DRY?

Love acronyms that almost no one uses in real life... what is that? ;)

These make scripting a nightmare, especially since 90% of scripts run in page-scope

Mine work just fine and Sandboxing has been around before your 90% came along. :)

Please give the latest version a try!

When I get back to my dev machine I'll give it a whirl. Thanks

Re: @Marti:

Greasemonkey is awesome but.

What is the point of the sandbox? To protect site scripts from using Greasemonkey's GM_xmlHttpRequest and GM_getValue. But at what cost?

90% of scripts don't even need those functions, and could safely run in page scope. Yet they have to deal with the excessively limiting sandbox in order to run, which manages to interfere with even the most trivial things like event handler callbacks.

Sure you can workaround these limitations with .wrappedObject or just break the security with unsafeWindow when you get desperate. But working this way means your script now cannot work without a Firefox Greasemonkey environment. It will break in Chrome and it won't run as a normal script or as a bookmarklet. I prefer to write portable code!

I recall having to change my script three times in a row because each new Greasemonkey release changed the workarounds I had to do to deal with the sandbox. Yes, occasionally GM_XHR and GM_set/getValue are awesome features, but only in 10% of the scripts. The rest of the time it's just an uphill struggle for no great benefit.

Anyway I'm glad to see that nowadays if we don't use any GM_ functions we can run outside the sandbox. But still it's a shame to be sandboxed when I just want to use GM_addStyle.

Anyway just wanted to get that off my chest!

DRY

DRY is Don't Repeat Yourself. Although it doesn't exactly apply here, I just notice that with the issues feature and collaboration this site is solving problems we already have a solution for. I would say "we should encourage people to get onto GitHub" because it is an awesome place for collaborative development, but the fact it is a non-free platform gives me pause. I am very glad to see OpenUserJS is a GNU project from the outset! :) Anyway no problem, we can collaborate on Github or on here, so it seems we have the best of both worlds!

Syncing changes?

But I am concerned if a collaborator contributes to a script on here, I might not notice the changes, and end up clobbering it with a small update and a push to Github. If your changes were complex ... well diff and patch I guess! :P I notice there is no "script history" here at the moment. (That is quite a useful feature on USO which might dissuade help malicious users from injecting evil stuff into their script before uploading a clean version.)

Minimum Meta Tags

My suggestion is that meta-tags which you think are really important could go in a section just above the "OpenUserJS.org Specific" block. I only suggest it because I didn't have time to click and read the links when I was uploading. There are quite a few more tags than when I last looked. The links are good!

After this long post, you had better like my userscript!

I wrote GrimeApe a while back, which is how I learned that synchronous XHRs are bad! That had no security concerns. By which I mean, it had no concern for security! :D I always meant to rewrite it in Node but never did... it could have gone the way of TOMODO had I done it right.

Anyway, Greasemonkey, TamperMonkey and userscripts rock. Down with GM_*!

Thanks both, I have now updated all my active scripts with @grant and @version tags. (I notice @grant none is no longer needed since GM 2.0, but it is still useful for legacy users, and to indicate that the script has been vetted.)

Regarding the tag listings on the /add/scripts page, I don't think @description is OUJS-specific! Since that is listed, I think we could also list @version and recommend authors to fill that in too. Although I will have to get into the habit of incrementing that ... I wonder if I should make a git hook. Or perhaps it could be a feature of this site, to auto increment @version when the author uploads or pushes a new version!

Perhaps GM is blocking it because of page scope?

Bad assumption. It's when page scripts are disallowed. You might want to note that in your user-content area that it requires page JavaScript to be enabled. ;)

I didn't have time to click through and read the Greasemonkey Wiki.

Make the time... It will make your presentation better for your script for other potential users. :)

I'd really like computers to do more work, and me to do less, so I wish everything would just work without needing 20 @ tags in the header!

Nothing is for free. You have to do the effort in order to achieve what is wanted.

90% of scripts don't even need those functions, and could safely run in page scope.

Another bad assumption and interesting making up of stats. Where is your empirical data on this? ;)

After this long post, you had better like my userscript!

LOL... well it works now which is an important thing... continuance is another. :)

Down with GM_*!

Never. The other child browsers still have some catching up to do. ;)

I don't think @description is OUJS-specific!

It's specially handled. If we list all of the keys we'll run out of page space. If you feel the need for an enhancement please make a single, refined, issue for it upstream on GH after searching first to see if it's already been reported.