You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

temp.js 452 B

123456789101112
  1. const fs = require('fs');
  2. const path = require('path');
  3. const OpenCC = require('opencc');
  4. const converter = new OpenCC('s2t.json');
  5. const code = fs.readFileSync("script-json_data.js", {encoding:"utf-8"});
  6. function toCHT(match, p1){
  7. const cht = converter.convertSync(p1);
  8. return `{chs:"${p1}",cht:"${cht}"}`;
  9. }
  10. let newcode = code.replaceAll(/\{chs:"(.+)?"\}/ig, toCHT);
  11. fs.writeFileSync("script-json_data2.js", newcode, {encoding:"utf-8"})

智龙迷城队伍图制作工具