From 72073fc3eabe95bfe433411d7968da1b47ad6920 Mon Sep 17 00:00:00 2001 From: Daniel Kats Date: Sun, 31 May 2026 18:03:39 +0200 Subject: [PATCH] Refactor: drop dead duplicate functions from renderer.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit renderer.js loads before the js/ feature scripts, so its definitions of showElemCoPanel, hideElemCoPanel, generateElemCoInput, copyElemCoInput and runJuliaCalculation were always overridden by the authoritative versions in js/elemco.js — they were dead code. Remove them (the runJuliaCalculation stub was also a no-op wrapper) and update the comment to point at the js/ feature scripts. The version-check IIFE and the DOM/window lifecycle listeners are unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) --- renderer.js | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/renderer.js b/renderer.js index 475fbcf..29db318 100644 --- a/renderer.js +++ b/renderer.js @@ -18,39 +18,11 @@ } })(); -function showElemCoPanel() { - document.getElementById('elemcoPanel').style.display = 'block'; - updateElemCoInput(); // Remove initializeElemCoListeners call since we handle it in DOMContentLoaded -} - -function hideElemCoPanel() { - document.getElementById('elemcoPanel').style.display = 'none'; -} - -function generateElemCoInput() { - updateElemCoInput(); - document.getElementById('status').innerHTML = 'ElemCo.jl input reset to default'; -} - -function copyElemCoInput() { - const input = document.getElementById('elemco-input'); - input.select(); - document.execCommand('copy'); - document.getElementById('status').innerHTML = 'Input copied to clipboard'; -} - -function runJuliaCalculation() { - // This function is defined in index.html and will be called from there - if (typeof window.runJuliaCalculation === 'function') { - window.runJuliaCalculation(); - } else { - document.getElementById('status').innerHTML = 'Julia calculation function not available'; - } -} - -// Note: showXtbPanel() and runXtb() are defined as globals in index.html's inline -// script (like the other panel handlers). No wrappers here — defining them again -// before that script loads would shadow the real implementations. +// Note: the ElemCo / Julia / xtb panel handlers (showElemCoPanel, hideElemCoPanel, +// generateElemCoInput, copyElemCoInput, runJuliaCalculation, showXtbPanel, runXtb, …) +// are defined as globals in the js/ feature scripts (js/elemco.js, js/xtb.js), which +// load after this file. We do NOT redefine them here — earlier definitions would just +// be overridden, and the feature-script versions are authoritative. // Add event listeners for input changes when the DOM is ready document.addEventListener('DOMContentLoaded', () => {