Zum Hauptinhalt springen
clawam tools
Werkzeuge Dokumente Daoark EN Startseite Startseite / Leben & Alltag› { btn.classList.toggle('active', btn.dataset.type === type); }); } function calculate() { const input = document.getElementById('lengthInput').value; const length = parseFloat(input); if (isNaN(length) || length <= 0) { alert('请输入有效的长度值(大于0)'); return; } const remainder = length % CYCLE; const positions = currentType === 'yang' ? YANG_POSITIONS : YIN_POSITIONS; const positionIndex = Math.floor(remainder * positions.length / CYCLE) % positions.length; const position = positions[positionIndex]; const info = POSITION_TYPES[position]; const display = document.getElementById('resultDisplay'); const rulerTitle = document.getElementById('rulerTitle'); const rulerBar = document.getElementById('rulerBar'); const rulerVisual = document.getElementById('rulerVisual'); display.innerHTML = '
' + position + '
' + (currentType === 'yang' ? '阳尺' : '阴尺(丁兰尺)') + ' · 余数 ' + remainder.toFixed(2) + 'cm
' + FORTUNE_LABELS[info.fortune] + '
' + info.meaning + '
'; rulerTitle.textContent = currentType === 'yang' ? '阳尺' : '阴尺'; rulerBar.innerHTML = ''; positions.forEach(function(pos, idx) { var seg = document.createElement('div'); seg.className = 'ruler-segment ' + (POSITION_TYPES[pos].color) + (idx === positionIndex ? ' highlighted' : ''); seg.textContent = pos; seg.title = POSITION_TYPES[pos].meaning; rulerBar.appendChild(seg); }); rulerVisual.style.display = 'block'; } document.getElementById('btnYang').addEventListener('click', function() { setRulerType('yang'); }); document.getElementById('btnYin').addEventListener('click', function() { setRulerType('yin'); }); document.getElementById('calcBtn').addEventListener('click', calculate); document.getElementById('lengthInput').addEventListener('keypress', function(e) { if (e.key === 'Enter') calculate(); }); window.onload = function() { var params = new URLSearchParams(window.location.search); var type = params.get('type'); var len = params.get('length'); if (type === 'yin') setRulerType('yin'); if (len) { document.getElementById('lengthInput').value = len; calculate(); } };
clawam tools

clawam.com · Agent JSON API · built by Daoark

Navegação

Werkzeuge Dokumente Daoark

Machine Readable

sitemap.xml robots.txt

苏ICP备2025187298号-28 · clawam.com · built by Daoark