feat(v0.1.1): 周期表五大分区 / 分区与单格改色 / 全屏视线跟随 / 窗口图标 / 跨平台打包
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
const fs = require('fs')
|
||||
const p = 'E:/SodiumPet/WorkPlace/v0.1.1/src/renderer/src/detail/Detail.tsx'
|
||||
let c = fs.readFileSync(p, 'utf8')
|
||||
|
||||
const startMark = ' <div className="periodic-legend">'
|
||||
const start = c.indexOf(startMark)
|
||||
if (start < 0) {
|
||||
console.log('legend not found')
|
||||
process.exit(1)
|
||||
}
|
||||
const end = c.indexOf(' </div>', start)
|
||||
if (end < 0) {
|
||||
console.log('legend end not found')
|
||||
process.exit(1)
|
||||
}
|
||||
const oldBlock = c.slice(start, end + ' </div>'.length)
|
||||
|
||||
const newBlock = [
|
||||
' <div className="periodic-legend">',
|
||||
' {periodicZoneList(periodic).map((z) => (',
|
||||
' <span key={z.id} className="legend-item">',
|
||||
' <i style={{ background: z.color }} />',
|
||||
' {z.label}',
|
||||
' </span>',
|
||||
' ))}',
|
||||
' </div>'
|
||||
].join('\n')
|
||||
|
||||
c = c.replace(oldBlock, newBlock)
|
||||
if (!c.includes('periodicZoneList(periodic)')) {
|
||||
console.log('replace failed')
|
||||
process.exit(1)
|
||||
}
|
||||
c = c.replace(' periodicCellColor,', ' periodicCellColor,\n periodicZoneList,')
|
||||
fs.writeFileSync(p, c, 'utf8')
|
||||
console.log('detail legend patched')
|
||||
Reference in New Issue
Block a user