Searching single table column with jQuery

In Codeigniter 1.7.2 there is no way to change the style of an individual cell with the Table class, this is not good and everyone is much looking forward to 2.0 where this sort of magic is apparently going to be included (go to this page and search for “individual cells”). So, say you have a table that contains specific values in some cells that need extra attention – if the table contains no colspan or rowspan then you’re emphatically in luck and can do the following trick with jQuery without custom id tagging of your content:


$('td:nth-child(10)').each(function () { // search 'Deposit'
content = $(this).text();
if (content.indexOf("No") != -1) {
$(this).css('background-color','#ff0000');
} else if (content.indexOf("Waiting") != -1) {
$(this).css('background-color','#fef612');
} else if (content.indexOf("Yes") != -1) {
$(this).css('background-color','#0abd09');
}
});

That will select the 10th column and search it for specific value and change the container cells depending thereupon, result can be seen in screenshot. Ah yes. Side-note: of course you would need to wrap your jQuery code in the pre-requisite $(document).ready(function() and so forth (Google is our mutual friend).

Resources used in connection to above snippet:
http://www.javascripttoolbox.com/temp/table_cellindex.html
http://tylermuth.wordpress.com/2008/12/17/jquery-selectors-will-change-your-life/

Chrome Desktop Notifications and why they are useless

Responding mainly to the optimistic vibe in the article and comment section on 0xfe’s brilliant article on webkit notifications I have the following brief’ish commentary:  first of all the chrome dev’s need to get the window-on-top-feature under their belt, otherwise these messages/notifications are simply going to disappear in mass numbers into the land of behind-the-app. [edit: thnx to NoFancyNick for pointing out that my browser is broken]

Secondarily I’m in 2 minds about the permission asking (same with localstorage i html5) – as in: is there any web-developers that will make use of features that demands their non-super-geek-userbase to press novel and scary invented-for-the-occasion buttons in their browsers before their site/app will work as intended? I seriously wonder: if I am to construct a notification (which is actually the case in regards to the db admin shell I’m currently working on) it is obviously better for me to use a jQuery attention grabber (like Tim Benniks’ “growl-like”). It would in essence never work for my no-tech users that they had to take into consideration whether a yellow bar is asking them some obscure message about accessing their desktop during their admin session.. it would spell out consistent and reoccurring user problems!

Lastly, while these app-like features are definitely needed we do need to find another option than the permission asking game – it works for users that are installing Firefox add-ons as second-nature thing but the rest of humanity have just come around to NOT clicking every single thing asking them for permission because it caused their computer to die of virus overload (which you and I had to fix for them). Not good.