<html><meta charset="utf-8"> <title>ubb2fen</title> <style> button { font-size:18pt; width:5em } #ta { outline:none } </style> <body> <p><button onclick="conv()">转换</button></p> <textarea style="" rows="25" cols="80" spellcheck=false id="ta"> [DhtmlXQ_binit]8979695949392919097717866646260600102030405060708012720323436383[/DhtmlXQ_binit] [DhtmlXQ_movelist]2625204217477062796763641927808109191031898862548858546646458161474872627773646527466555585566547363626763535473454443444844304153516164444531435575735419126461454254421242615142436762757051614654000243236242547361517060023223204130606251317361315120235041235342525383324239480304252442122423415083433041626440306173527269471232233332026414515633320232141030314323320210113132233332421114[/DhtmlXQ_movelist] </textarea> <script> function conv () {const O = '0'.charCodeAt(0), A = 'a'.charCodeAt(0)let i = x = y = 0let a2n = ()=>{ x = s.charCodeAt(i) - O; y = s.charCodeAt(i+1) - O }let n2a = ()=>{ f += String.fromCharCode(A + x, O + 9 - y) }let b = Array.from({length:10}, ()=>Array(9).fill(' '))let p = 'RNBAKABNRCCPPPPP'; p += p.toLowerCase()let f = ''let s = ta.value.match(/binit\]([\d]+)/)[1]for (i = 0; i < 64; i += 2) a2n(), b[y][x] = p[i / 2]for (y = 0; y < 10; y++) {let n = 0for (x = 0; x < 9; x++) {let c = b[y][x]if (c === ' ') ++nelse {if (n) f += nf += c; n = 0}}if (n) f += nif (y !== 9) f += '/'}f += ' r moves 's = ta.value.match(/movelist\]([\d]+)/)[1]for (i = 0; i < s.length; i += 2) {n2a(a2n())if (i % 4 === 2) f += ' '}navigator.clipboard.writeText(ta.value = f) }ta.addEventListener('keydown', (e)=>{ // 覆盖式粘贴if (e.ctrlKey && (e.key === 'v')) e.target.value = ''return true }) </script></body></html>