Template:autoPreviousNext

  • Revision slug: Template:autoPreviousNext
  • Revision title: Template:autoPreviousNext
  • Revision id: 32941
  • Created:
  • Creator: user01
  • Is current revision? No
  • Comment 1 words added, 1 words removed

Revision Content

var prevStr = {
  en: "Previous",
  de: "zurück",
  es: "Anterior",
  fr: "Précédent",
  ja: "前",
  ko: "이전",
  pl: "Poprzedni",
  ru: "Предыдущая статья",
  "zh-tw": "前頁",
  cn: "上一页"
};
var nextStr = {
  en: "Next",
  de: "weiter",
  es: "Siguiente",
  fr: "Suivant",
  ja: "次",
  ko: "다음",
  pl: "Następny",
  ru: "Следующая статья",
  "zh-tw": "次頁",
  cn: "下一页"
};
var chapterList = string.deserialize(wiki.template($0));
var i = 0;
if (!$1){
  i = list.indexOf(chapterList, uri.encode("/" + page.path));
  uri.encode("/" + page.path);}
else
  i = list.indexOf(chapterList, xml.text(getRelativeURL($1)));
if (i != -1){
  switch (i){
    case 0:
      

web.link(chapterList[1], localString(nextStr) + " »", wiki.getPage(chapterList[1]).title)

;       break;     case (#chapterList) - 1:      

web.link(chapterList[(#chapterList) - 2], "« " + localString(prevStr), wiki.getPage(chapterList[(#chapterList) - 2]).title)

;       break;     default: /* This should be done like

PreviousNext

but Internet Explorer 8 doesn't render it properly */      

web.link(chapterList[i - 1], "« " + localString(prevStr), wiki.getPage(chapterList[i - 1]).title)web.link(chapterList[i + 1], localString(nextStr) + " »", wiki.getPage(chapterList[i + 1]).title)

;   } }

Revision Source

<div>
<pre class="script" style="font-size: 16px; clear: both;">
var prevStr = {
  en: "Previous",
  de: "zurück",
  es: "Anterior",
  fr: "Précédent",
  ja: "前",
  ko: "이전",
  pl: "Poprzedni",
  ru: "Предыдущая статья",
  "zh-tw": "前頁",
  cn: "上一页"
};
var nextStr = {
  en: "Next",
  de: "weiter",
  es: "Siguiente",
  fr: "Suivant",
  ja: "次",
  ko: "다음",
  pl: "Następny",
  ru: "Следующая статья",
  "zh-tw": "次頁",
  cn: "下一页"
};
var chapterList = string.deserialize(wiki.template($0));
var i = 0;
if (!$1){
  i = list.indexOf(chapterList, uri.encode("/" + page.path));
  uri.encode("/" + page.path);}
else
  i = list.indexOf(chapterList, xml.text(getRelativeURL($1)));
if (i != -1){
  switch (i){
    case 0:
      <p style="text-align: right;">web.link(chapterList[1], localString(nextStr) + " »", wiki.getPage(chapterList[1]).title)</p>;
      break;
    case (#chapterList) - 1:
      <p>web.link(chapterList[(#chapterList) - 2], "« " + localString(prevStr), wiki.getPage(chapterList[(#chapterList) - 2]).title)</p>;
      break;
    default:
      /* This should be done like <p>Previous<span style="float: right;">Next</span></p>
         but Internet Explorer 8 doesn't render it properly */
      <p style="text-align: right;"><span style="float: left;">web.link(chapterList[i - 1], "« " + localString(prevStr), wiki.getPage(chapterList[i - 1]).title)</span>web.link(chapterList[i + 1], localString(nextStr) + " »", wiki.getPage(chapterList[i + 1]).title)</p>;
  }
}</pre>
</div>
Revert to this revision