Difference between revisions of "MediaWiki:CampaignData.js"

From Orbis Wiki
Jump to navigation Jump to search
m
m
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
$(function() {
 
$(function() {
window.campaignData = [ {
+
const campaignData = [ {
 
}, {
 
}, {
 
name: 'Sleeping Giants',
 
name: 'Sleeping Giants',
 
games: [
 
games: [
{id: 0},
+
{id: 0, date: new Date(2017, 5, 6)},
{id: 1, date: new Date(2017, 6, 6)}
+
{id: 1, date: new Date(2017, 5, 6)},
 +
{id: 2, date: new Date(2017, 5, 20)},
 +
{id: 3, date: new Date(2017, 5, 27)},
 +
{id: 4, date: new Date(2017, 6, 10)},
 +
{id: 5, date: new Date(2017, 6, 18)},
 +
{id: 6, date: new Date(2017, 7, 8)},
 +
{id: 7, date: new Date(2017, 7, 22)},
 +
{id: 8, date: new Date(2017, 8, 5)},
 +
{id: 9, date: new Date(2017, 8, 19)},
 +
{id: 10, date: new Date(2017, 9, 3)},
 +
{id: 11, date: new Date(2017, 9, 18)},
 +
{id: 12, date: new Date(2017, 9, 30)},
 +
{id: 13, date: new Date(2017, 10, 14)},
 +
{id: 14, date: new Date(2017, 10, 28)},
 +
{id: 15, date: new Date(2017, 11, 12)},
 +
{id: 16, date: new Date(2018, 0, 31)},
 +
{id: 17, date: new Date(2018, 1, 6)},
 +
{id: 18, date: new Date(2018, 1, 27)},
 +
{id: 19, date: new Date(2018, 2, 13)},
 +
{id: 20, date: new Date(2018, 2, 27)},
 +
{id: 21, date: new Date(2018, 3, 8)},
 +
{id: 22, date: new Date(2018, 3, 15)},
 +
{id: 23, date: new Date(2018, 4, 3)},
 +
{id: 24, date: new Date(2018, 4, 16)},
 +
{id: 25, date: new Date(2018, 5, 12)},
 +
{id: 26, date: new Date(2018, 5, 26)},
 +
{id: 27, date: new Date(2018, 6, 10)},
 +
{id: 28, date: new Date(2018, 6, 24)},
 +
{id: 29, date: new Date(2018, 7, 7)},
 +
{id: 30, date: new Date(2018, 7, 21)},
 +
{id: 31, date: new Date(2018, 8, 4)},
 +
{id: 32, date: new Date(2018, 9, 2)},
 +
{id: 33, date: new Date(2018, 9, 16)},
 +
{id: 34, date: new Date(2018, 9, 30)},
 +
{id: 35, date: new Date(2018, 10, 13)},
 +
{id: 36, date: new Date(2018, 11, 15)},
 +
{id: 37, date: new Date(2019, 0, 12)},
 +
{id: 38, date: new Date(2019, 1, 2)},
 +
{id: 39, date: new Date(2019, 1, 26)},
 +
{id: 40, date: new Date(2019, 2, 12)},
 +
{id: 41, date: new Date(2019, 2, 26)},
 +
{id: 42, date: new Date(2019, 3, 14)},
 +
{id: 43, date: new Date(2019, 3, 23)},
 +
{id: 44, date: new Date(2019, 4, 14)},
 +
{id: 45, date: new Date(2019, 4, 21)},
 +
{id: 46, date: new Date(2019, 5, 2)},
 +
{id: 47, date: new Date(2019, 5, 11)},
 +
{id: 48, date: new Date(2019, 5, 25)},
 +
{id: 49, date: new Date(2019, 6, 2)},
 +
{id: 50, date: new Date(2019, 6, 10)},
 +
{id: 51, date: new Date(2019, 6, 16)},
 +
]
 +
}, {
 +
name: 'Dormian Mysteries',
 +
games: [
 +
{id: 0, date: new Date(2021, 4, 8)},
 +
{id: 1, date: new Date(2021, 4, 8)},
 +
{id: 2, date: new Date(2021, 4, 22)},
 +
{id: 3, date: new Date(2022, 0, 30)},
 
]
 
]
 
}
 
}
 
];
 
];
 
 
$('#1-1').innerText = "Sleeping Giants, Game 1 (2017, 6, 6)";
+
for(let i = 1; i < campaignData.length; i++) {
+
campaignData[i].games.forEach(game => {
window.fillCampaignData = (id) => {
+
$('#' + i + '-' + game.id).text(campaignData[i].name + ', Game ' + game.id + ' (' + game.date.toDateString() + ')');
let data = id.split('.');
+
});
let campaign = campaignData[parseInt(data[0])];
 
let game = campaign.games[parseInt(data[1])];
 
let text = campaign.name + ', Game ' + game.id + ' (' + game.date + ')';
 
$('#' + id).innerText = text;
 
 
}
 
}
 
}());
 
}());

Latest revision as of 16:37, 3 February 2022

$(function() {
	const campaignData = [ {
		}, {
			name: 'Sleeping Giants',
			games: [
				{id: 0, date: new Date(2017, 5, 6)},
				{id: 1, date: new Date(2017, 5, 6)},
				{id: 2, date: new Date(2017, 5, 20)},
				{id: 3, date: new Date(2017, 5, 27)},
				{id: 4, date: new Date(2017, 6, 10)},
				{id: 5, date: new Date(2017, 6, 18)},
				{id: 6, date: new Date(2017, 7, 8)},
				{id: 7, date: new Date(2017, 7, 22)},
				{id: 8, date: new Date(2017, 8, 5)},
				{id: 9, date: new Date(2017, 8, 19)},
				{id: 10, date: new Date(2017, 9, 3)},
				{id: 11, date: new Date(2017, 9, 18)},
				{id: 12, date: new Date(2017, 9, 30)},
				{id: 13, date: new Date(2017, 10, 14)},
				{id: 14, date: new Date(2017, 10, 28)},
				{id: 15, date: new Date(2017, 11, 12)},
				{id: 16, date: new Date(2018, 0, 31)},
				{id: 17, date: new Date(2018, 1, 6)},
				{id: 18, date: new Date(2018, 1, 27)},
				{id: 19, date: new Date(2018, 2, 13)},
				{id: 20, date: new Date(2018, 2, 27)},
				{id: 21, date: new Date(2018, 3, 8)},
				{id: 22, date: new Date(2018, 3, 15)},
				{id: 23, date: new Date(2018, 4, 3)},
				{id: 24, date: new Date(2018, 4, 16)},
				{id: 25, date: new Date(2018, 5, 12)},
				{id: 26, date: new Date(2018, 5, 26)},
				{id: 27, date: new Date(2018, 6, 10)},
				{id: 28, date: new Date(2018, 6, 24)},
				{id: 29, date: new Date(2018, 7, 7)},
				{id: 30, date: new Date(2018, 7, 21)},
				{id: 31, date: new Date(2018, 8, 4)},
				{id: 32, date: new Date(2018, 9, 2)},
				{id: 33, date: new Date(2018, 9, 16)},
				{id: 34, date: new Date(2018, 9, 30)},
				{id: 35, date: new Date(2018, 10, 13)},
				{id: 36, date: new Date(2018, 11, 15)},
				{id: 37, date: new Date(2019, 0, 12)},
				{id: 38, date: new Date(2019, 1, 2)},
				{id: 39, date: new Date(2019, 1, 26)},
				{id: 40, date: new Date(2019, 2, 12)},
				{id: 41, date: new Date(2019, 2, 26)},
				{id: 42, date: new Date(2019, 3, 14)},
				{id: 43, date: new Date(2019, 3, 23)},
				{id: 44, date: new Date(2019, 4, 14)},
				{id: 45, date: new Date(2019, 4, 21)},
				{id: 46, date: new Date(2019, 5, 2)},
				{id: 47, date: new Date(2019, 5, 11)},
				{id: 48, date: new Date(2019, 5, 25)},
				{id: 49, date: new Date(2019, 6, 2)},
				{id: 50, date: new Date(2019, 6, 10)},
				{id: 51, date: new Date(2019, 6, 16)},
			]
		}, {
			name: 'Dormian Mysteries',
			games: [
				{id: 0, date: new Date(2021, 4, 8)},
				{id: 1, date: new Date(2021, 4, 8)},
				{id: 2, date: new Date(2021, 4, 22)},
				{id: 3, date: new Date(2022, 0, 30)},
			]
		}
	];
	
	for(let i = 1; i < campaignData.length; i++) {
		campaignData[i].games.forEach(game => {
			$('#' + i + '-' + game.id).text(campaignData[i].name + ', Game ' + game.id + ' (' + game.date.toDateString() + ')');
		});
	}
}());