The-Ultimate-Pokemon-Picker/wiki.html
cajun b1891f9a1b Translation Update
#23: Added support for Portuguese, French, Spanish & Latin American Spanish, German, Italian, Japanese, and Korean
Updated Favorite type symbols to the PLA symbols rather than english words on PMD backgrounds.
Close #32: Added Favorite Baby and Favorite New Evo boxes
Close #46: Fix Castform, missing Pikas, GMax Melmetal
overhaul CSS to be simpler (removed over 1000 lines woo)
2023-05-07 19:52:05 -05:00

113 lines
2.8 KiB
HTML

<html>
<head>
<style>
#input-wrapper {
position: absolute;
display: block;
width: 50%;
}
#side-wrapper {
position: absolute;
display: block;
left: 52%;
top: 30px;
}
</style>
<script language="JavaScript">
function processUniverse(tag) {
var data = document.getElementById("import").value;
if(!data)
return;
data = data.split(/\r?\n/);
var pairs = [];
for(var d in data) {
var pair = data[d].match(/([^:]+): ?(.*)/);
if(pair) {
pairs.push([pair[1], pair[2]])
}else if(pairs.length){
pairs[pairs.length-1].push(data[d])
}
}
var output = "";
for(var i=0; i<pairs.length; i++) {
output += `#<section `
if(i < pairs.length-1) {
output += `begin="${pairs[i+1][0]}p${tag}" `
}
if(i > 0) {
output += `begin="${pairs[i-1][0]}n${tag}" `
}
output += `/>[[${pairs[i][1]}]]<section `
if(i < pairs.length-1) {
output += `end="${pairs[i+1][0]}p${tag}" `
}
if(i > 0) {
output += `end="${pairs[i-1][0]}n${tag}" `
}
output += `/>\n`;
if(pairs[i][2]) {
output += `#[[${pairs[i][1]}|${pairs[i][2]}]]\n`
}
}
document.getElementById("output").value = output;
}
function processStory() {
var output = "";
var d = document.getElementById("import").value;
if(!d)
return;
d = d.replace(/[ ][ ]+/g, "");
var ar = d.split(/\r?\n/);
for(var i = 0; i < ar.length; i++) {
output += `#<section `
if(i < ar.length-1) {
output += `begin="${cleanTag(ar[i+1])}_PS" `
}
if(i > 0) {
output += `begin="${cleanTag(ar[i-1])}_NS" `
}
output += `/>${ar[i]}<section `
if(i < ar.length-1) {
output += `end="${cleanTag(ar[i+1])}_PS" `
}
if(i > 0) {
output += `end="${cleanTag(ar[i-1])}_NS" `
}
output += `/>\n`;
}
document.getElementById("output").value = output;
}
function cleanTag(tag) {
tag = tag.replace(/"/g, "&#34;")
tag = tag.replace(/&/g, "&#38;")
tag = tag.replace(/'/g, "&#39;")
return tag;
}
</script>
</head>
<body>
<div id="input-wrapper">
Post your list to section tag below, then click Convert to Universe or Convert to StoryLink<br>
<textarea id="import" rows="13" cols="80" spellcheck="false"></textarea>
<input type="button" value="Convert to Universe Release Order" onclick="processUniverse('r');"></input>
<input type="button" value="Convert to Universe Chronological Order" onclick="processUniverse('c');"></input>
<input type="button" value="Convert to StoryLink" onclick="processStory();"></input><br>
<b>Output:</b><br>
<textarea id="output" rows="13" cols="200" spellcheck="false"></textarea>
</div>
<div id="side-wrapper">
<b>For Universes</b><br>
Give a list of CODE: Wiki Page Name, for example<br>
AFM: Aftermath<br>
VTM: Villain: The Musical<br>
ALR: Alara (set)<br>
<br>
<b>For StoryLink</b><br>
Give a list of Wiki Page Names, for example<br>
Meanwhile in Entela<br>
Deus ex Machina (Windyverse)<br>
Sanctuary
</div>
</body>
</html>