Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==UserScript==
// @include http://*stackoverflow.com/*
// @include http://superuser.com/*
// @include http://serverfault.com/*
// An opera version of greasemonkeys cript adding favicons to most of commons tags, courtesy of "voyager" http://meta.stackoverflow.com/questions/42287/add-icon-to-java-tag
function waitForJQuery() {
if(typeof($) == typeof(Function)) {
$(window.document).ready(function() { GM_letsJQuery(); });
} else {
window.setTimeout(waitForJQuery, 100);
}
}
waitForJQuery();
// All your GM code must be inside this function
function GM_letsJQuery() {
var tags = [
[ /microsoft/ , "http://www.microsoft.com/favicon.ico"],
[ /windows/ , "http://www.microsoft.com/windows/Framework/images/favicon.ico"],
[ /ie6/ , "http://www.midwesttapes.com/img/ie6.png"],
[ /ie7|ie8|internet-explorer/ , "http://www.microsoft.com/library/media/1033/windows/images/possibilities/offers/icon_ie.gif"],
[ /j2me/ , "http://java.com/favicon.ico"],
[ /word/ , "http://www.microsoft.com/uk/education/common/images/icons/office2007/word2007.gif"],
[ /excel/ , "http://www.microsoft.com/library/media/5129/nz/digitallife/images/product/officeicon07-excel.gif"],
[ /office/ , "http://it-soft-sac.com/cursos/images/products/icons/ofice0307.png"],
[ /sql-server/ , "http://it-soft-sac.com/cursos/images/products/icons/sqlserver.png"],
[ /web-development|css/ , "http://www.w3.org/Icons/WWW/w3c_home"],
[ /postgres/ , "http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Postgresql_elephant.svg/40px-Postgresql_elephant.svg.png"],
[ /security/ , "http://home.comcast.net/~SupportCD/Images/Bruce_Schneier.gif"],
[ /prototype/ , "http://www.prototypejs.org/images/fav.png"],
[ /linux/ , "http://www.managenergy.tv/metv/images/linux_icon.gif"],
[ /^mac/ , "http://www.winterwolves.com/images/mac.gif"],
[ /osx/ , "http://eina.sourceforge.net/img/download-osx.png"],
[ /apple|iphone/ , "http://movies.apple.com/trailers/disney/toystory3/assets/images/apple.jpg"],
[ /google/ , "http://www.google.com/favicon.ico"],
[ /chrome/ , "http://www.google.com/tools/dlpage/res/chrome/images/chrome-16.png"],
[ /opera/, "http://www.opera.com/favicon.ico"],
[ /unicode/, "http://unicode.org/favicon.ico"],
[ /\.net/, "http://www.bitsontherun.com/static/uploads/images/net.png"],
[ /ponies/ , "http://www.gravatar.com/avatar/4f7c0c43b0fb87f905d369d42d2667ac?s=128&d=identicon&r=PG"],
[ /python/ , "http://python.org/favicon.ico"],
[ /ruby/ , "http://www.ruby-lang.org/favicon.ico"],
[ /jquery/ , "http://jquery.com/favicon.ico"],
[ /php/ , "http://php.net/favicon.ico"],
[ /json/ , "http://json.org/favicon.gif"],
[ /java/ , "http://java.com/favicon.ico"],
[ /ubuntu/ , "http://www.ubuntu.com/files/favicon-ubuntu.ico"],
[ /debian/ , "http://www.debian.org/favicon.ico"],
[ /greasemonkey/ , "http://wiki.greasespot.net/favicon.ico"],
[ /mysql/ , "http://mysql.com/favicon.ico"],
[ /django/ , "http://www.djangoproject.com/favicon.ico"],
[ /perl/ , "http://www.perl.org/favicon.ico"],
[ /eclipse/ , "http://eclipse.org/favicon.ico"],
[ /firefox|mozilla/ , "http://www.mozilla.com/favicon.ico"],
[ /apache/ , "http://apache.org/favicon.ico"],
[ /^hibernate/ , "http://hibernate.org/favicon.ico" ],
[ /nhibernate/ , "http://nhforge.org/favicon.ico" ],
[ /linux/ , "http://www.managenergy.tv/metv/images/linux_icon.gif"],
[ /postgres/ , "http://www.postgresql.org/favicon.ico" ],
[ /^gnu/ , "http://www.gnu.org/favicon.ico" ],
[ /subversion|svn/ , "http://subversion.tigris.org/favicon.ico" ],
[ /^git/ , "http://git-scm.com/favicon.png" ],
[ /^bsd$/ , "http://www.bsd.org/favicon.ico" ],
[ /freebsd/ , "http://www.freebsd.org/favicon.ico" ]
];
$(".post-tag").each(function(i, elt) {
var totest = elt.innerHTML;
for (var iter=0; iter < tags.length; iter++)
{
var re = tags[iter][0];
var source = tags[iter][1];
if(totest.match(re))
{
elt.innerHTML = "<img class=\"tagimg\" src=\"" + source + "\" width=\"16\" height=\"16\" />&nbsp;" + totest;
}
}
}
);
$(".tagimg").css({'vertical-align' : 'text-top'});
}
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.