diff --git a/kumascript/macros/Firefox_for_developers.ejs b/kumascript/macros/Firefox_for_developers.ejs
index a0e326041541..775b03b8abd5 100644
--- a/kumascript/macros/Firefox_for_developers.ejs
+++ b/kumascript/macros/Firefox_for_developers.ejs
@@ -1,58 +1,67 @@
-
-
<%
/*
+ * This macro generates a list of links to Firefox release notes.
+ * It should be used under the "Mozilla/Firefox/Releases" tree.
+ *
* Parameters:
- * $0 = max version to show in the list
+ * None
*/
-var CURRENT_MAX_VERSION = $0;
+// for content
+const str = mdn.localString({
+ "en-US": ["Firefox ", " for developers"],
+ "fr" : ["Firefox ", " pour les développeurs"],
+ "ko": ["Firefox", "릴리즈노트"],
+ "ru": ["Firefox ", " для разработчиков"],
+ "zh-CN": ["Firefox ", " 的开发者说明"],
+});
-var maxVersion = CURRENT_MAX_VERSION;
-var minVersion = maxVersion - 30;
+const locale = env.locale;
+const slug = env.slug;
-if (minVersion < 4) { minVersion = 4 }
+const oldVersion = ["3.6", "3.5", "3", "2", "1.5"];
-// for href attr
-var slug = mdn.localString({
- "en-US" : "Releases",
- "fr" : "Versions"
-});
+const versionStr = slug.split("/").at(-1);
+let maxVersion = Number(versionStr);
-// for content
-var str = mdn.localString({
- "en-US": ["Firefox ", " for developers"],
- "fr" : ["Firefox ", " pour les développeurs"],
- "ko": ["Firefox", "릴리즈노트"],
- "ru": ["Firefox ", " для разработчиков"]
-});
+let oldVersionStartIdx = 0;
+
+// determine the start index of old version and the max version
+if (maxVersion < 4) {
+ oldVersionStartIdx = oldVersion.indexOf(versionStr) + 1;
+} else {
+ maxVersion--;
+}
+
+let minVersion = maxVersion - 30;
-var loc = env.locale;
+if (minVersion < 4) {
+ minVersion = 4;
+}
+
+// generate release links
+const releaseLinks = [];
+
+function generateReleaseLink(version) {
+ return `- ${str[0]}${version}${str[1]}
`;
+}
// for newer version
-for (var i = maxVersion; i >= minVersion; i--) {
- %>- <%- str[0] %><%- i %><%- str[1] %>
<%
+for (let i = maxVersion; i >= minVersion; i--) {
+ releaseLinks.push(generateReleaseLink(i));
}
// for older version
-if (minVersion == 4) {
- var ov = ["3.6", "3.5", "3", "2", "1.5"];
- var ovStart = ov.indexOf($0);
- if (ovStart == -1) {
- ovStart = 0;
- }
- for(var i = ovStart; i < ov.length; i++) {
- %>- <%- str[0] %><%-ov[i]%><%- str[1] %>
<%
+if (minVersion === 4) {
+ for (let i = oldVersionStartIdx; i < oldVersion.length; i++) {
+ releaseLinks.push(generateReleaseLink(oldVersion[i]));
}
}
-/*
- 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"
-*/
-
-%>
+const output = releaseLinks.join("");
+%>
+