Saturday, 16 February 2008

Add image in the blogger link list

I wanted to add link on my blog to blogs I read regularly.

Ok, I've found the Link List module, I add it. Add few link I like...

But, some of the blogs are in French other in English...

So I've obviously tried to insert some <img> or even <span>... nothing works...

So I used the hard way :

I've modified my template to add prototype +

<script src='' type='text/javascript'> </script>
<script src='' type='text/javascript'> </script>
<script src='' type='text/javascript'> </script>

I used the text inside the <a> as a prototype template.

For example :

#{fr} Rank My Day | Référencement

And wrote this code to change #{fr} into a nice flag (with many thanks to for his works on all great icons)

function linkListCustomize()
$$('#LinkList1 a').each(function(item){
item.innerHTML = (new Template(item.innerHTML).evaluate({en:'<img class="clickable" src="" alt="English written website"/>',fr:'<img class="clickable" src="" alt="French written website"/>'}));
function init()
linkListCustomize ();
/*taken from */
function callOnLoad(init)
if (window.addEventListener)
window.addEventListener("load", init, false);
else if (window.attachEvent)
window.attachEvent("onload", init);
window.onload = init;

You can have a look on i've added some customization of the <pre> html tag.
I'm working on syntax highlighting, but i'm having some trouble with cross domain ajax...

No comments: