You know how it's like. You start to use a javascript library and you tend to stick with it. I've been drifting between Prototype.js and Moo. I've looked at jQuery but stuck to Prototype/Moo since I "knew it".
Last night I decided to rewrite my old check for new ImageManager version routine. Being a script junkie, I thought I give jQuery a chance. It was a joy .. I really like jQuery!
BTW, here's the result:
[sourcecode language='js']
[/sourcecode]
Explained:
- jQuery(document).ready(function() {
- Wait until the DOM is loaded
- jQuery.get('https://soderlind.no/imagemanagerversion.txt', function(newversion){
- Get https://soderlind.no/imagemanagerversion.txt, and put its content into the variable newversion
- jQuery('#plugins td.name').filter(':contains(ImageManager)').append('<small>new version available</small>').css('color','red');
- In the <div id=plugins>, find <td class=name> which contains the text ImageManager
- and append <small>new version available</small>. Using css, set the text color to red.