Files
SodiumPet/tools/patch-ped-stats.cjs
T

15 lines
753 B
JavaScript

const fs = require('fs')
const p = 'E:/SodiumPet/WorkPlace/v0.1.1/src/main/index.ts'
let c = fs.readFileSync(p, 'utf8')
const from =
"JSON.stringify({ cells: document.querySelectorAll('.ped-cell').length, zones: document.querySelectorAll('.color-row').length, s: getComputedStyle(document.querySelector('.ped-cell')).backgroundColor })"
const to =
"JSON.stringify({ cells: document.querySelectorAll('.ped-cell').length, zones: document.querySelectorAll('.color-row').length, colors: [0,4,25,28,56,117].map(i => getComputedStyle(document.querySelectorAll('.ped-cell')[i]).backgroundColor) })"
if (!c.includes(from)) {
console.log('MISS stats')
process.exit(1)
}
c = c.replace(from, to)
fs.writeFileSync(p, c, 'utf8')
console.log('stats patched')