Template:PreviousNext

  • Revision slug: Template:PreviousNext
  • Revision title: Template:PreviousNext
  • Revision id: 432021
  • Created:
  • Creator: ethertank
  • Is current revision? No
  • Comment for RTL

Revision Content

<%/* Parameter $0 (first parameter): path of Previous page $1 (second parameter): path of Next page Issue 1: Broken output in LTR page 2: Problem of Apostrophe (https://developer.mozilla.org/fr/docs/JavaScript_Guide/Op%C3%A9rateurs/Op%C3%A9rateurs_sp%C3%A9ciaux) */ var lang = env.locale; var strPrevious = ""; var strNext = "
"; var s_PreviousNext = mdn.localString({ "en-US": ["« Previous", "Next »"], "cs": ["« Předchozí", "Následující »"], "de": ["« zurück", "weiter »"], "es": ["« Anterior", "Siguiente »"], "fr": ["« Précédent", "Suivant »"], "ja": ["« 前のページ", "次のページ »"], "ko": ["« 이전", "다음 »"], "pl": ["« Poprzedni", "Następny »"], "pt-PT": ["« Anterior", "Próxima »"], "ru": ["« Предыдущая статья", "Следующая статья »"], "zh-CN": ["« 上一页", "下一页 »"], "zh-TW": ["« 前頁", "次頁 »"] }); // for RTL var textAlign = "right"; var floatValue = "left"; switch(lang) { case "he": case "ar": textAlign = "left"; floatValue = "right"; break; default: break; } if ($0) { strPrevious = '' + s_PreviousNext[0] + ''; } if ($1) { strNext = '' + s_PreviousNext[1] + ''; } %>

<%- strPrevious %><%- strNext %>

Revision Source

<%/*

Parameter
    $0 (first parameter):  path of Previous page
    $1 (second parameter): path of Next page

Issue
    1: Broken output in LTR page
    2: Problem of Apostrophe (https://developer.mozilla.org/fr/docs/JavaScript_Guide/Op%C3%A9rateurs/Op%C3%A9rateurs_sp%C3%A9ciaux)

*/

var lang = env.locale;
var strPrevious = "";
var strNext = "<br>";

var s_PreviousNext = mdn.localString({
  "en-US": ["« Previous", "Next »"],
  "cs":    ["« Předchozí", "Následující »"],
  "de":    ["« zurück", "weiter »"],
  "es":    ["« Anterior", "Siguiente »"],
  "fr":    ["« Précédent", "Suivant »"],
  "ja":    ["« 前のページ", "次のページ »"],
  "ko":    ["« 이전", "다음 »"],
  "pl":    ["« Poprzedni", "Następny »"],
  "pt-PT": ["« Anterior", "Próxima »"],
  "ru":    ["« Предыдущая статья", "Следующая статья »"],
  "zh-CN": ["« 上一页", "下一页 »"],
  "zh-TW": ["« 前頁", "次頁 »"]
});


// for RTL
var textAlign = "right";
var floatValue = "left";

switch(lang) {
    case "he":
    case "ar":
        textAlign = "left";
        floatValue = "right";
        break;
    default:
        break;
}


if ($0) {
    strPrevious = '<a style="float:' + floatValue + ';" href="/' + lang + '/docs/' + string.replace($0, ' ', '_') + '">' + s_PreviousNext[0] + '</a>';
}

if ($1) {
    strNext = '<a href="/' + lang + '/docs/' + string.replace($1, ' ', '_') + '">' + s_PreviousNext[1] + '</a>';
}



%><div class="prevnext" style="text-align:<%- textAlign %>;">
    <p><%- strPrevious %><%- strNext %></p>
</div>
Revert to this revision