mozilla

Revision 379331 of Template:expTrevorh3

  • Revision slug: Template:expTrevorh3
  • Revision title: Template:expTrevorh3
  • Revision id: 379331
  • Created:
  • Creator: trevorh
  • Is current revision? No
  • Comment

Revision Content

    <% /* * $0 max version to list * */ var maxVersion = $0; var minVersion = maxVersion - 30; if (minVersion < 4) { minVersion = 4 } // for content var s1 = "Firefox ", s2 = " for developers"; // old versions var ov = ["3.6", "3.5", "3", "2", "1.5"], ovlen = ov.length; var i; var loc = mdn.localString({ "en-US" : "en-US", "ja": "ja", "zh-CN": "zh-CN" }); // for newer version for (var i = maxVersion; i >= minVersion; i--) { listItem(i); } // for older version if (minVersion == 4) { for(i = 0; i < ovlen; i++) { listItem(ov[i]); } } function listItem(ver) { %>
  • <%-s1%><%-ver%><%-s2%>
  • <%} /* This template is difficult. Because, old "fr" page have other rule... If the URL of your country's page is the same as the English pages, You just have to add your country into the object in argument of mdn.localString. And, some old pages have this link: "https://developer.mozilla.org/en-US/docs/Updating_web_applications_for_Firefox_3" */ %>

Revision Source

<div class="cols-2">
<ul>
<%
/*
 * $0 max version to list
 *
 */
  
var maxVersion = $0;
var minVersion = maxVersion - 30;
if (minVersion < 4) { minVersion = 4 }

// for content
var s1 = "Firefox ",  s2 = " for developers";

// old versions
var ov = ["3.6", "3.5", "3", "2", "1.5"],  ovlen = ov.length;

var i;

var loc = mdn.localString({
    "en-US" : "en-US",
    "ja": "ja",
    "zh-CN": "zh-CN"
});

// for newer version
for (var i = maxVersion; i >= minVersion; i--) {
    listItem(i);
}

// for older version
if (minVersion == 4) {
for(i = 0; i < ovlen; i++) {
    listItem(ov[i]);
}
}

function listItem(ver) { %>
    <li><a href="/<%-loc%>/docs/Mozilla/Firefox/Releases/<%-ver%>" title="/<%-loc%>/docs/Mozilla/Firefox/Releases/<%-ver%>"><%-s1%><%-ver%><%-s2%></a></li>
<%}

/*
    This template is difficult. Because, old "fr" page have other rule...
    If the URL of your country's page is the same as the English pages,
    You just have to add your country into the object in argument of mdn.localString.
    
    And, some old pages have this link: "https://developer.mozilla.org/en-US/docs/Updating_web_applications_for_Firefox_3"
*/
 
 
%></ul>
</div>