MediaWiki:Common.js: Difference between revisions
Tag: Undo |
No edit summary |
||
| Line 1,881: | Line 1,881: | ||
return !!p.doc; | return !!p.doc; | ||
}); | }); | ||
// Reading order = the order the book prints the | |||
// commentaries in, which a document states as doc.order. | |||
// findCommentarySubpages gets its list from | |||
// action=query&list=allpages, and that is ALPHABETICAL BY | |||
// TITLE - so Vadiraja came before Vyasatirtha, and the | |||
// checkbox list, the colour slots and the interleaved | |||
// blocks all inherited that same wrong order, since every | |||
// one of them is derived from this array. Sorting here | |||
// fixes all three at once. A document with no doc.order | |||
// (anything published before this field existed) keeps its | |||
// existing relative position rather than jumping to the | |||
// front, so mixed pages stay stable. | |||
pairs = pairs.map(function (p, i) { return { p: p, i: i }; }) | |||
.sort(function (a, b) { | |||
var ao = a.p.doc && a.p.doc.doc && a.p.doc.doc.order; | |||
var bo = b.p.doc && b.p.doc.doc && b.p.doc.doc.order; | |||
if (typeof ao === 'number' && typeof bo === 'number' && ao !== bo) return ao - bo; | |||
if (typeof ao === 'number' && typeof bo !== 'number') return -1; | |||
if (typeof bo === 'number' && typeof ao !== 'number') return 1; | |||
return a.i - b.i; | |||
}) | |||
.map(function (x) { return x.p; }); | |||
var topDocs = pairs.map(function (p) { return p.doc; }); | var topDocs = pairs.map(function (p) { return p.doc; }); | ||
| Line 2,545: | Line 2,569: | ||
var HL = '.gra-qe-footnote-highlight'; | var HL = '.gra-qe-footnote-highlight'; | ||
var LIST = '.gra-qe-footnotes'; | var LIST = '.gra-qe-footnotes'; | ||
// data-gra-type on the <li>. The names the converter writes, and the | |||
pathantara: 'पाठान्तरम्', | // ones a QuickEdit button could write later, land in the same map. | ||
source: ' | var TYPES = { | ||
note: 'टिप्पणी' | pathantara: 'पाठान्तरम्', // a variant reading | ||
locus: 'प्रमाणम्', // where a quotation is from — ऋ.सं.७.९९ | |||
source: 'प्रमाणम्', | |||
note: 'टिप्पणी' // an editorial remark | |||
}; | }; | ||