// ==UserScript== // @name Slashdot title quote // @include http://www.slashdot.org // @include http://www.slashdot.org/* // @include http://*.slashdot.org // @include http://slashdot.org/* // @author fc // @namespace http://fc-unleashed.blogspot.com // @description the footer quote in the title // ==/UserScript== (function() { if ( document.getElementById ) { var footer = document.getElementById('footer'); if ( footer && footer.getElementsByTagName ) { var small = footer.getElementsByTagName('small'); if ( small && small[0] ) { document.title = small[0].firstChild.nodeValue; } } } })();
Showing posts with label userscript. Show all posts
Showing posts with label userscript. Show all posts
Thursday, February 28, 2008
Slashdot Userscript
The funny quote in the footer of slashdot has always held my attention...here's a userscript to make it the title of the window
Wednesday, July 06, 2005
Greasemonkey
I recently discovered Greasemonkey which is a really cool idea. Imagine you have the power to pick and choose the content that a website is throwing at you. If you have used the Web Developer you will know a little of what I'm talking about. What basically "Web Developer" allows you to do is control the various aspects of the page that is currently being displayed. For example you can turn off all the images, view response headers and a lot of cool stuff. But, "Web Developer" is limited that you have to manually go use its toolbar.(Like for example every time I have to login into Yahoo Mail I'll go to the "Web Developer" toolbar "Forms->Enable Auto Completion" so that I don't have to type in my email id because Yahoo disables autocompletion on the sign-in form)
Now with a "Greasemonkey" user-script which will automatically run whenever I go to Yahoo Mail I'm saved the arduos task of typing in my emailid :). I got so excited that I wrote a few in myself :). Here they are...
// ==UserScript==
// @name Yahoo Autocomplete
// @include http://mail.yahoo.com/*
// @include http://mail.yahoo.com
// @exclude
// @author fc
// @namespace http://fc-unleashed.blogspot.com/
// @description Enable autocomplete in Yahoo's login page
// ==/UserScript==
(function() {
var login = document.login_form;
login.setAttribute("autocomplete", "on");
})()
All you've got to do is put this into a file called YahooMail.user.js. You need the .user.js for Greaskmonkey to know that its our special user-script. Then write up a simple HTML page with a hyperlink to YahooMail.user.js (like <a href="YahooMail.user.js">Yahoo Mail</a>). Now, all you have to do is open up this HTML file in Firefox and right-click on the link (if you have installed Greasemonkey) the first item is "Install User Script...", select that and you are done. Now visit Yahoo Mail so that you'll never again have to type out your yahoo id :).
Here's another that tries to disable all the targets and javascript popups :)
// ==UserScript==
// @name Disable targets and javascript popups
// @include *
// @exclude
// @author fc
// @namespace http://fc-unleashed.blogspot.com/
// @description General disable targets and javascript popups
// ==/UserScript==
(function() {
if ( document.getElementsByTagName ) {
var anchors = document.getElementsByTagName("a");
for ( i = 0; i < anchors.length; i++ ) {
var targetVal = anchors[i].getAttribute("target");
var hrefVal = anchors[i].getAttribute("href");
if ( targetVal ) {
if ( targetVal.match(/^_[bB][lL][aA][nN][kK]$/) || targetVal.match(/^_[nN][eE][wW]$/) ) {
out = anchors[i].removeAttribute("target");
}
}
if ( hrefVal ) {
var myRegex = new RegExp("^javascript:[^(]+\\(['\"]([hH][tT][tT][pP]://[^'\"]+)['\"]\\).*");
if ( hrefVal.match(myRegex) ) {
var newVal = hrefVal.replace(myRegex, "$1");
anchors[i].setAttribute("href", newVal);
}
}
} // endfor i
}
})()
Subscribe to:
Posts (Atom)