Long years ago, you have to wear two sets of eye glasses, then doctors discovered the lens at the bifocal eye-glasses, then recently they do the same thing.
Website Source Code Combiner
Website Source Code Combiner
Masukkan Kod HTML
Masukkan Kod CSS
Masukkan Kod JavaScript
Kod Gabungan
');
}
bodySections.push('');
combined.push(bodySections.join('\n'));
// Bahagian penutup
combined.push('');
// Gabungkan semua bahagian
var finalOutput = combined.join('\n');
combinedOutput.value = finalOutput;
console.log('combineCode completed. Output: ' + finalOutput);
}
// Fungsi untuk simpan kod
function saveCode() {
console.log('Starting saveCode...');
if (!combinedOutput.value) {
alert('Sila gabungkan kod terlebih dahulu!');
return;
}
var blob = new Blob([combinedOutput.value], { type: 'text/html' });
var url = URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = 'combined_output_' + new Date().toISOString().slice(0, 10) + '.html';
a.click();
URL.revokeObjectURL(url);
alert('Kod telah disimpan!');
console.log('saveCode completed');
}
// Tambah event listener untuk butang gabung dan simpan
var combineBtn = document.getElementById('combineBtn');
var saveBtn = document.getElementById('saveBtn');
console.log('Combine button: ' + (combineBtn ? 'found' : 'not found'));
console.log('Save button: ' + (saveBtn ? 'found' : 'not found'));
if (combineBtn) {
combineBtn.addEventListener('click', function() {
console.log('Combine button clicked');
combineCode();
});
}
if (saveBtn) {
saveBtn.addEventListener('click', function() {
console.log('Save button clicked');
saveCode();
});
}
console.log('Event listeners added successfully');
});
console.log('Script execution completed at: ' + new Date().toISOString());