Skip to content

Instantly share code, notes, and snippets.

@Kambfhase
Forked from 140bytes/LICENSE.txt
Created June 1, 2011 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kambfhase/1002999 to your computer and use it in GitHub Desktop.
Save Kambfhase/1002999 to your computer and use it in GitHub Desktop.
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
Copy link

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

@Kambfhase
Copy link
Author

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
Copy link

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

@Kambfhase
Copy link
Author

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

@atk
Copy link

atk 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
Copy link
Author

GitHub uses jQuery, so I get it for free.

@atk
Copy link

atk commented Jun 22, 2011

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

@Kambfhase
Copy link
Author

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

@mathiasbynens
Copy link

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