Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Userscript that filters the forks

a minimal user script that hides forks without content. If you don't know, how to build you own user script click here to load my version.

Tested in Fx 4 + Scriptish. It does not work in Chrome.

mfG Hase

jQuery("span.description"). // selects all spanners
filter(":contains('140byt.es -- Click')"). // clicks them if they filter their contents for 140bytes.
closest("li").hide() // Hides Li in the closet.
jQuery("span.description").filter(":contains('140byt.es -- Click')").closest("li").hide()
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Kambfhase
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
{
"name": "notALibrary",
"description": "foo",
"keywords": [
"140bytes",
"gist",
"userscript"
]
}
@mathiasbynens

This comment has been minimized.

Copy link

commented Jun 2, 2011

Couldn’t this be shortened into $("span.description:contains('140byt.es -- Click')").closest("li").hide()? ;)

@Kambfhase

This comment has been minimized.

Copy link
Owner Author

commented Jun 2, 2011

Yeah cool, ... wait ... no. :contains('') is not a valid QSA selector and relies on Sizzle. Therefor its faster. You out of all JavaScripties should know best ;)

I could stick with the $ though ... and put unsafeWIndow. in front of it, while I am a it.

@mathiasbynens

This comment has been minimized.

Copy link

commented Jun 2, 2011

I wasn’t talking about speed – just trying to save bytes. Isn’t that what @140bytes is all about? :)

@Kambfhase

This comment has been minimized.

Copy link
Owner Author

commented Jun 2, 2011

As long as it is below 140bytes I should be ok. If this was a valid entry anyways.

@atk

This comment has been minimized.

Copy link

commented Jun 22, 2011

How about not using jQuery (relying on other libraries is not very 140byt.ish):

(function(i,l){i=document.getElementsByTagName('li');l=i.length;while(l--){i[l].style.display=/140byt\.es -- Click/.test(i[l].innerHTML)?'none':''}})()

@Kambfhase

This comment has been minimized.

Copy link
Owner Author

commented Jun 22, 2011

GitHub uses jQuery, so I get it for free.

@atk

This comment has been minimized.

Copy link

commented Jun 22, 2011

If this is limited to github using jQuery, you could use "$" instead of jQuery, too.

@Kambfhase

This comment has been minimized.

Copy link
Owner Author

commented Jun 22, 2011

As long as it is below 140bytes I should be ok. If this was a valid entry anyways.

@mathiasbynens

This comment has been minimized.

Copy link

commented Jun 22, 2011

Golfing down @atk’s suggestion for the lulz:

(function(i,l){l=i.length;while(l--){i[l].style.display=/140byt\.es -- Click/.test(i[l].innerHTML)?'none':''}})(document.getElementsByTagName('li'))

You could even shorten the regex a little bit (although that would make it slightly less “robust”).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.