`;
subtitleLanguages.forEach((langInput, index) => {
const lang = langInput.value.trim();
const url = subtitleUrls[index].value.trim();
if (lang && url) {
embedCode += `
`;
}
});
embedCode += `
`;
// Display the embed code
document.getElementById('embed-code').textContent = embedCode;
}
// Copy embed code to clipboard
function copyEmbedCode() {
const embedCode = document.getElementById('embed-code').textContent;
const textArea = document.createElement('textarea');
textArea.value = embedCode;
document.body.appendChild(textArea);
textArea.select();
document.execCommand('copy');
document.body.removeChild(textArea);
alert('Embed code copied to clipboard!');
}