Hello, you have come here looking for the meaning of the word
User:Erutuon/scripts/BC-AD.js. In DICTIOUS you will not only get to know all the dictionary meanings for the word
User:Erutuon/scripts/BC-AD.js, but we will also tell you about its etymology, its characteristics and you will know how to say
User:Erutuon/scripts/BC-AD.js in singular and plural. Everything you need to know about the word
User:Erutuon/scripts/BC-AD.js you have here. The definition of the word
User:Erutuon/scripts/BC-AD.js will help you to be more precise and correct when speaking or writing your texts. Knowing the definition of
User:Erutuon/scripts/BC-AD.js, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.
// <nowiki>
// Switches the year-numbering system from BCE/CE to BC/AD
/* jshint undef: true */
/* globals $, mw */
"use strict";
function yearFormatSwitch() {
/*
* This code supports date labels formatted using the following wikitext.
* (See {{B.C.E}} and {{C.E.}}.) BCE can be replaced by CE:
<small class="ce-date">]</small>
*/
var convert = { "BCE": "BC", "B.C.E.": "B.C.", "CE": "AD", "C.E.": "A.D." };
var datetags = document.getElementsByClassName("ce-date");
var articlePath = mw.config.get("wgArticlePath");
var links = {
BC: articlePath.replace("$1", "Appendix:Glossary#BC"),
AD: articlePath.replace("$1", "Appendix:Glossary#AD")
};
for (var i = 0; i < datetags.length; i++) {
var datetag = datetags,
link = datetag && datetag.firstChild,
innerSpan = link && link.firstChild,
abbreviation = innerSpan && innerSpan.firstChild && innerSpan.firstChild.nodeValue;
if (!(link && innerSpan && abbreviation))
continue;
if (abbreviation === "CE" || abbreviation === "C.E.") {
link.href = links.AD;
innerSpan.innerHTML = convert;
// Change position of year number: 10 CE → AD 10.
var beforeDatetag = datetag.previousSibling;
if (!beforeDatetag)
continue;
var patt = /((?:\d{1,4} ?(?:-|–|to) ?)?\d{1,4}) ?$/g; // first if hyphen-minus, then en-dash
var matches = beforeDatetag.nodeValue.match(patt);
if (matches === null)
continue;
var yearNumber = matches;
beforeDatetag.nodeValue = beforeDatetag.nodeValue.substring(0, beforeDatetag.nodeValue.length - yearNumber.length);
if(!datetag.nextSibling)
datetag.parentElement.appendChild(document.createTextNode(" " + yearNumber));
else
datetag.nextSibling.nodeValue = " " + yearNumber + datetag.nextSibling.nodeValue;
} else if (abbreviation === "BCE" || abbreviation === "B.C.E.") {
datetag.firstChild.href = links.BC;
innerSpan.innerHTML = convert;
}
}
/*
* This code handles dates with the class ce-date2:
* <small class="ce-date2">CE</small>
*/
var datetags2 = document.getElementsByClassName("ce-date2");
for (i = 0; i < datetags2.length; ++i ) {
var datetag2 = datetags2;
datetag2.innerHTML = convert;
}
}
$(yearFormatSwitch);
// </nowiki>