Changeset 0330bfe in fedora-web


Ignore:
Timestamp:
05/12/12 10:43:50 (2 years ago)
Author:
Kévin Raymond <shaiton@…>
Branches:
f17-beta
Children:
5734b28
Parents:
f3f2e2d
git-author:
Kévin Raymond <shaiton@…> (05/10/12 22:55:15)
git-committer:
Kévin Raymond <shaiton@…> (05/12/12 10:43:50)
Message:

fpo adding the countdown banner width in parameter. If kept, should do it for the release banner also.

Thanks to ztank1013 on ask.fedoraproject.org/question/1641

Location:
fedoraproject.org
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fedoraproject.org/data/content/counter.html

    r6be8684b r0330bfe  
    3434                <h4>${_('How to add the counter to your website')}</h4> 
    3535                <p>${Markup(_('To add a Fedora Release counter to your own site, simply place the following code wherever you want it to appear:'))}</p> 
    36                 <textarea rows="2" cols="62" style="width: 95%; font-size: 2.35ex;">&lt;script id="fedora-banner" type="text/javascript" src="http://fedoraproject.org/static/js/release-counter-ext.js?lang=${lang}"&gt;&lt;/script&gt;</textarea> 
     36                <textarea rows="2" cols="62" style="width: 95%; font-size: 2.35ex;">&lt;script id="fedora-banner" type="text/javascript" src="http://fedoraproject.org/static/js/release-counter-ext.js?lang=${lang}&amp;width=200px"&gt;&lt;/script&gt;</textarea> 
    3737                <p>${Markup(_('The lang parameter can be changed to display the counter in a different language. Currently, the values %(codelang)s are supported. When no language is specified, English will be used.') % {'codelang':'ar, bg, bn_IN, cs, da, de, el, en, es, fi, fr, gu, he, hi, hr, hu, id, is, it, ja, kn, ko, ks, ml, nl, pa, pl, pt, pt_BR, ro, ru, si, sr, sv, th, tr, uk, vi_VN, zh_CN, zh_TW'} )}</p> 
    38  
     38                <p>${_('The width parameter could be changed to get a smaller banner. This is a CSS scale, you will loose quality. Better to keep the default value (by omitting this parameter).')}</p> 
    3939            </div> 
    4040        </div> 
  • fedoraproject.org/static/js/release-counter-ext.js

    rf3f2e2d r0330bfe  
    66var millisBetweenDates = release - today; 
    77var days = Math.ceil(millisBetweenDates/1000/60/60/24); 
     8var url = "https://fedoraproject.org/wiki/Releases/17/Schedule"; 
    89 
    910var script = document.getElementById('fedora-banner'); 
    1011var lang = "en" 
    11 var lang_match = script.src.match(/release-counter-ext\.js\?lang=(.*)$/); 
    1212 
     13 
     14// getParam split the GET parameters and return the value 
     15// of the input `sname' parameter if found or en empty string. 
     16function getParam (sname) { 
     17  var params = script.src.substr(script.src.indexOf("?")+1); 
     18 
     19  params = params.split("&"); 
     20  for (var i=0; i<params.length; i++) { 
     21      temp = params[i].split("="); 
     22      if ([temp[0]] == sname) 
     23        return temp[1]; 
     24  } 
     25  return ""; 
     26} 
     27 
     28 
     29var lang_match = getParam("lang"); 
    1330if (lang_match) { 
    1431    for (var i = 0; i < available_langs.length; ++i) { 
     
    2037} 
    2138 
    22 var url = "https://fedoraproject.org/wiki/Releases/17/Schedule"; 
     39var width = getParam("width"); 
     40if (!width) 
     41  width = "200px"; 
     42 
    2343 
    2444var banner = document.createElement('div'); 
    25  
    2645var bannerlink = document.createElement('a'); 
    27  
    2846var bannerimg = document.createElement("img"); 
    2947bannerimg.style.border = "none"; 
    3048bannerimg.style.width = width; 
     49 
    3150 
    3251if (days <= 0) { 
     
    3756    bannerimg.setAttribute("src", "https://fedoraproject.org/static/images/counter/" + lang + "/fedora17-countdown-banner-" + days + "." + lang + "." + "png"); 
    3857    bannerimg.setAttribute("alt", "Fedora 17 Beefy Miracle released in " + days + " days."); 
     58    bannerimg.style.width = width; 
    3959} 
    4060 
Note: See TracChangeset for help on using the changeset viewer.