My blog has moved into Beta!



Please note that my blog has changed addresses! It's all new and improved. Hence this old friend of mine had to be left alone. You can visit me at The Last Word (beta). It's all warmed up for you! :)

« Home

Vista, too complex for Microsoft?Native Blog SearchJSON and the dynamic <script> tagAbout BloggerattoMicrosoft At It Again!Hack UpgradesMicrosoft PowerShellLightbox!!Organise your life, Google style!Printing Blog Pages, CSS style!  »





It was only about a month ago that I wrote about how automating tasks to reduce human intervention wasn't as good an idea at this point of time because of the lack of technological intelligence (Credibility Of Automation). That being said, it also makes no sense not to use the speed and tireless working habits of machines to automate easy and repititive tasks so that we don't have to manually execute them again and again!

There are some very basic and fundamental uses of these, which can be furthur extended to be used to complicated and more efficient, useful tasks. They take away the pain of hardcoding everything into your document. You can leave subtle, easy to enter hints for your script to look for, and once found, alter the line in some way or do something else. With Javascripts regexps as strong and useful as they are, there is no reason why people with enough coding knowledge shouldn't exploit them.

I employed something like this on my blog last night. A nagging but very visible problem that I have been having is differentiating between external and internal links in my posts. I always want my external links to open in a new window for the user, but I needed a way of telling them that the link would open a new window. Now, the fool's way would be to hard-code some kind of identifier inside the link tag to let the person know, but I decided a better way. Why not let a script run through my links, and alter them if they are marked as external links?

So I made up a simple but useful script! It checks the rel attribute of all links, and whenever it finds a match for external or ext, it'll append an image to it, and make its target="_blank". Simple, unobtrusive, and saves tons of hardcoding time. Although a problem arises if you want certain links not to be affected, yet keep them external. But for that, you can always use a third value for rel.

This is only one of the basic uses of scripts to do repititive tasks. Scripts are powerful things, and should be used whenever their need be sensed. Ofcourse, don't go overboard otherwise your page will have ten's of scripts running at page load and hence will slow down the loading times. That is not good! :) So find innovative ways of using this, you won't regret it!

[Info]: The auto external links script is something like Kirk's over at Phydeaux3. I'll admit the idea stemmed from there! :)


0 Comments




Leave your comment
You can use some HTML tags, such as <b>, <i>, <a>

Or you can sign in as a different user.







Categories

Latest Updated

Subscriptions

Get My Blog In Your Mail!

Powered by Yutter

add this button to your site/blog as a link to this page! « link to me!
coComments my coComments
my claimID

subscribe to feed
Widgetize!
Google Reader add to google
del.icio.us The Last Word add to del.icio.us
Add to My Yahoo! add to yahoo!
Subscribe with Bloglines add to bloglines
add to msn
Add to netvibes add to Netvibes!
myFeedster add to feedster
Furl The Last Word add to furl


Archive Pages
January 2006 February 2006 March 2006 April 2006 May 2006 June 2006 July 2006 August 2006 October 2006 November 2006 December 2006

Advertisement


Song Of The Day:




Creative Commons License Widgetize!
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.
Aditya Mukherjee © 2005-06 | Powered by Blogger