06 February 2007

DLTP Labels widget updated

Thanks to Cyberbuff for pointing this out. I've become a little forgetful :( The code was (by mistake) set to get the labels from my personal blog, because I was testing it there. Get the updated code from below, and see the instruction! Sorry!


That's "Don't leave the page" Labels widget ;) Here's a quick update since people asked me for it and I thought the script could use it. If you want the original without frills, check it out. This update makes a few cosmetic changes, nothing more. So most of your people won't need to change your code. This update adds:

  • A +/- (toggling) sign before the label name, to give it a more hierarchical appearance. You can modify the code yourself to change the symbol to anything, I've marked it out in the code, but you'll have to download it to edit it (get it from here).

  • A loading animated image for all your huge list of posts which take a while to load. The script pre-loads the image, so there will be no delay in showing it. But if you don't see it, don't worry. It just means you have a stinkin' fast connection ;)

Add this line in (replace the previous code if you implemented the original --Sumesh pointed out a potential confusion):

<script>//<![CDATA[
var labels_blog = '<BLOGNAME>';
//]]></script>
<script type='text/javascript' src='http://aditya.vm.googlepages.com/labels.js'/>

Replace <BLOGNAME> with the name of your blog. You'll have to edit your widget code a little. Replace the line which generates the link:

<a href='#category' onclick='javascript:showLabel(this.innerHTML)'><data:label.name/></a>

With this:

<span expr:id='data:label.name + "-tog"'>+ </span><a href='#category' onclick='javascript:showLabel(this.innerHTML)'><data:label.name/></a>

You can change the symbol within the span tags to whatever you want :) Cool? Good!
Have a good day!


14 comments

GG said...

so great!thank you very much~~:-)

GG said...

another problem~~if the "loading"not show up,some people may be can't wait to click on the other lable.and if he do so,he will see the reasults will be come from the first lable.and he can't close the reasults by click the second lable he just clicked. because the result was the first lable's.

please add a "loading"text to let people wait,thank you for your kindness ~~:-)

Aditya said...

I don't think I was clear :) I said the image is there, and it will get preloaded so that it shows immediately the moment the person clicks a label.

If 'you' don't see it, however, it doesn't mean it's not there. It just means you have a very fast connection :)

GG said...

it seems not work out on my blog.
some times it just waiting for 5-6 sec. but no loading shows...

another friend's blog who can't speak any english have more than 400 articles have the same problem as I am.

Aditya said...

Oww.. drats! I see what's wrong! How stupid can one be :( I'm sorry for the rather stupid update... I know what the problem is. I can fix it, but it'd require you to import the 'prototype.js' library, which'd add another 50Kb to your page load.

Can you do with the extra heaviness? I'll code it up then!

GG said...

can we just add a text "loading",and don't use the 'prototype.js'?50KB is so big~~~god@_@!

Aditya said...

Ok, I hacked my hack to add the loader. See if you like it? Otherwise Prototype it'll have to be! :|

GG said...

it's great in firefox.but can't work in IE....55555555

please fix it~~~

Aditya said...

Oh no! I don't do IE, and are you saying IE 5? Man, that's old! 8|

In any case, I don't know what codes and functions or methods work in IE, so I don't both to code for it either!

Sorry!

Deepak said...

IE? LOL
It takes away half of your life to tweak your template/code to work in IE.

BTW, I got to see Vista live..
Old wine in a new bottle. :D

Aditya said...

True, true! That's why I got my principle thing going. No coding for IE ;)

I, for one, will be stickin' it out with Windows XP for the next one and a half years. I think XP with 1-2 GB of RAM is the best thing to happen to PCs. Vista is just a load of bling bling. True, it throws in some stuff, but I ain't go no use for em!

I'll be switching to Apple after this. Enough of this nonsense! :|

Anonymous said...

@deepak you are right! They have nothing new to sell.
@aditya you forgot to mention one thing: the labels.js you provided has three halves as the default site. We got to change it!

GG said...

I find two photo match you blog color to use on this hack.

I will glad if you like it:)

Aditya said...

@GG: Thanks a ton mate, but I'm actually keeping away from piling up too many icons and all that jazz in my sidebar.

That was the reason I didn't go for the triangles, but used +/- toggle symbols :) Simplicity is nice!

But thanks anyways :) Cheers!