Ask Your Question
0

Customize fedora 17 countdown logo

asked 2012-05-09 09:57:57 -0500

ztank1013 gravatar image

updated 2014-09-28 17:41:15 -0500

mether gravatar image

Any chance to have the fedora 17 countdown logo smaller (or bigger)?

http://fedoraproject.org/en/counter

Apparently this is the only code available at the moment and it does not seem to be customizable (height/width) to fit some smaller website layout.

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

Ideas?

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
1

answered 2012-05-10 11:20:30 -0500

ztank1013 gravatar image

Nice challenge @shaiton, this is what I was able to reproduce in a website of mine, please take a look:

http://fedora17counter.avezzanolug.org/

I basically took the code here http://fedoraproject.org/static/js/release-counter-ext.js and customized it to be able to parse an additional (width) parameter in the URL and get back the fedora 17 dynamic countdown logo with the given width.

To get the new script working with both lang and width parameters I replaced the following portion:

var lang_match = script.src.match(/release-counter-ext\.js\?lang=(.*)$/);

if (lang_match) {
    for (var i = 0; i < available_langs.length; ++i) {
        if (available_langs[i] == lang_match[1]) {
            lang = lang_match[1];
            break;
        }
    }
}

with:

function getParam ( sname )
{
  // url uses ? at the beginning of parameters list
  var params = script.src.substr(script.src.indexOf("?")+1);
  var sval = "";
  // url uses & to split parameters
  params = params.split("&");
    for (var i=0; i<params.length; i++)
       {
         temp = params[i].split("=");
         if ( [temp[0]] == sname ) { sval = temp[1]; }
       }
  return sval;
}
var lang = getParam("lang");
var width = getParam("width");

and I added this line where the other bannerimg attributes are also set:

bannerimg.setAttribute("width", width);

I am currently using my code in avezzanolug.org website with a custom lang=it and width=170 that perfectly fit my upper right block layout!

Note: The getParam function assumes there are no other ? or & in the url. Of course there is a lot of room to introduce robustness in the function code (if you like @shaiton) but for my purpose it works quite well!

Reference: Inspired by http://ziemecki.net/content/javascript-parsing-url-parameters

edit flag offensive delete link more
1

answered 2012-05-10 03:44:45 -0500

shaiton gravatar image

Thanks FranciscoD_ to have asked us on our mailing list.

The [countdown] banner is designed by the design team. You could find the original (svg and png) ones on the wiki.

As our script only provide facilities to choose the right day and the right language, we don't have yet the possibility to resize it (we only store the png format on the website).

Of course, you can get in touch with us and propose a smart solution.

edit flag offensive delete link more
1

answered 2012-05-12 06:42:45 -0500

shaiton gravatar image

Thanks to @ztank1013 I've updated our JS script, you can now add a width parameter. Simply use the following url: http://fedoraproject.org/static/js/release-counter-ext.js?lang=fr&width=200px".

More details at http://fedoraproject.org/counter.html

Please let me know If it does not work as expected.

edit flag offensive delete link more

Comments

@ztank1013: please mark the answer as correct if it's working now :)

FranciscoD_ gravatar imageFranciscoD_ ( 2012-05-12 11:13:51 -0500 )edit
0

answered 2012-05-09 23:31:00 -0500

FranciscoD_ gravatar image

Hrm, I'll get in touch with the websites SIG and see what they have to say.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2012-05-09 09:57:57 -0500

Seen: 550 times

Last updated: May 12 '12