handle CardInfo for translation

This commit is contained in:
WEBXOSS 2016-11-07 23:15:34 +08:00
parent ece12a0952
commit 364fefaa4a

View file

@ -62,7 +62,7 @@ function handleCardInfo () {
// document.body.appendChild(textarea); // document.body.appendChild(textarea);
// textarea.select(); // textarea.select();
} }
function handleCardInfo_ru () { function handleCardInfo_ko (min, max) {
var props = [ var props = [
"name", "name",
"actionEffectTexts", "actionEffectTexts",
@ -81,7 +81,8 @@ function handleCardInfo_ru () {
] ]
var arr = []; var arr = [];
for (var x in CardInfo) { for (var x in CardInfo) {
if (x <= 1762) continue; // if (x <= 1762) continue;
if (x < min || x > max) continue;
var info = CardInfo[x]; var info = CardInfo[x];
var obj = { var obj = {
pid: info.pid, pid: info.pid,
@ -93,11 +94,11 @@ function handleCardInfo_ru () {
// if (!info[prop]) return; // if (!info[prop]) return;
// obj[prop] = info[prop]; // obj[prop] = info[prop];
// }); // });
obj[rawprop+"_ru"] = info[rawprop+"_en"]; obj[rawprop+"_ko"] = info[rawprop+"_en"];
}); });
arr.push(obj); arr.push(obj);
} }
window.arr = arr; down(arr, `${min}-${max}.json`)
} }
function fetchAndHandleRuJson (url) { function fetchAndHandleRuJson (url) {
let CardInfo_ru = {}; let CardInfo_ru = {};
@ -156,6 +157,17 @@ function getNewCardNames () {
} }
return names; return names;
} }
function down (content, filename = 'down.txt') {
if (typeof content === 'object') {
content = JSON.stringify(content, null, ' ')
}
let blob = new Blob([content], { type: 'application/octet-stream' })
let url = URL.createObjectURL(blob)
let link = document.createElement('a')
link.href = url
link.download = filename
link.click()
}
</script> </script>
<script src="util.js"></script> <script src="util.js"></script>
<script src="random.min.js"></script> <script src="random.min.js"></script>