function copyServerPartToClipboard(text) {
    try {
        if (navigator.clipboard && navigator.clipboard.writeText) {
            // HTTPS 환경
            navigator.clipboard.writeText(text)
                .then(() => alert(text + "\n 복사되었습니다."))
                .catch(err => alert("실패: " + err));
        } else {
            // HTTP 환경 fallback
            const temp = document.createElement("textarea");
            temp.value = text;
            document.body.appendChild(temp);
            temp.select();
            // document.execCommand("copy"); --- DEPRECATED ---
            document.body.removeChild(temp);
            alert(text + "\n 복사되었습니다.");
        }
    } catch (err) {
        alert("복사 실패: " + err);
    }
}

function copyServerPartsToClipboard() {
    // 모든 .serverparts div에서 text-data 속성값 수집
    const elements = document.querySelectorAll(".serverparts");
    const texts = Array.from(elements).map(el => el.getAttribute("text-data") || "");
    // console.log(texts);
    const combined = texts.join("\n");
    copyServerPartToClipboard(combined);
}