Anything can go here, in any language... except my native language Sinhala. Be cool... anybody is warmly welcomed! :)

Fedora Counters For Your Blog

The upcoming version of Fedora, Fedora 11 (Leonidas ) is to be released on May 26th, 2009 [schedule].

They have prepared a counter badge that anybody interested can put it in his/her own web site. I have also put one in my Sinhala blog. So, dear reader, if you also have a blog/ site, please put a badge on your site and help spread the power of human knowledge (human knowledge - that's how Richard M Stallman defines free software).

But there is a problem with the badge. They provide a script (hosted on their servers) so it may not be available in the size you prefer. In my Sinhala blog, my preferred size is 120 pixels. The code they previde is this:


<script id="fedora-banner" type="text/javascript" src="http://fedoraproject.org/static/js/release-counter-ext.js?lang=en"></script>


So I had to download the script and modify it. So here's the modified code and you can simply copy-paste it into a HTML/Javascript widget in your blog. You can modify the 23rd line (bannerimg.setAttribute("width", "120px");) of this code to adjust the badge size.


<script id="fedora-banner" type="text/javascript" language="javascript">

var available_langs = [ "en", "it" ];


var today = new Date();
var release = new Date("May 26, 2009 14:00:00 UTC");
var millisBetweenDates = release - today;
var days = Math.ceil(millisBetweenDates/1000/60/60/24);

var script = document.getElementById('fedora-banner');
var lang = "en"

var url = "http://fedoraproject.org/wiki/Releases/11/Schedule";

var banner = document.createElement('div');

var bannerlink = document.createElement('a');

var bannerimg = document.createElement("img");
bannerimg.style.border = "none";

bannerimg.setAttribute("width", "120px");

if (days <= 0) {
    // TODO: Get an actual image here!
    bannerimg.setAttribute("src", "http://fedoraproject.org/static/images/banners/f11release.png");
    bannerimg.setAttribute("alt", "Fedora 11 is here!");
    url = "http://fedoraproject.org/get-fedora";
} else {
    bannerimg.setAttribute("src", "http://fedoraproject.org/static/images/counter/" + lang + "/fedora11-countdown-banner-" + days + "." + lang + "." + "png");
    bannerimg.setAttribute("alt", "Fedora 11 Leonidas released in " + days + " days.");
}

bannerlink.setAttribute("href", url);

bannerlink.appendChild(bannerimg);
banner.appendChild(bannerlink);

script.parentNode.insertBefore(banner, script);

</script>


If you are interested, please put a counter on your blog too.

Thank you for reading.

Comments (0)

Followers

Subscription Options

 Subscribe in a reader

or

Enter your email address:

and
to inscrease

and make me happy. :)

Other Blogs by the Author

The Author

www.flickr.com
ශාකුන්තල | Shaakunthala's items Go to ශාකුන්තල | Shaakunthala's photostream
free counters
TopOfBlogs
Related Posts with Thumbnails