Created At: 2026-06-14T16:20:06Z
Completed At: 2026-06-14T16:20:06Z
File Path: `file:///c:/Users/HP/Downloads/climate-system/climate-system/index.php`
Total Lines: 4014
Total Bytes: 169805
Showing lines 3480 to 3540
The following code has been modified to include a line number before every line, in the format: <line_number>: <original_line>. Please note that any changes targeting the original code should remove the line number, colon, and leading space.
3480:         container2.style.opacity = '0';
3481:         setTimeout(() => { container2.style.opacity = '1'; }, 10);
3482:         btn1.classList.remove('active');
3483:         btn2.classList.add('active');
3484:       }
3485:     }
3486:     
3487:     function nextClimateMap() {
3488:       const nextIndex = currentMapIndex === 1 ? 2 : 1;
3489:       switchClimateMap(nextIndex);
3490:     }
3491:     
3492:     function prevClimateMap() {
3493:       const prevIndex = currentMapIndex === 2 ? 1 : 2;
3494:       switchClimateMap(prevIndex);
3495:     }
3496: 
3497:     // Pemanggilan AJAX ke PHP untuk filter Future Climate
3498:     async function applyFutureFilter() {
3499:       const lokasi = document.getElementById('futureLocation').value;
3500:       const variable = document.getElementById('futureVariable').value;
3501:       const period = document.getElementById('futurePeriod').value;
3502:       const statistic = document.getElementById('futureStatistic').value;
3503:       const startYear = document.getElementById('futureStartYear').value;
3504:       const endYear = document.getElementById('futureEndYear').value;
3505: 
3506:       if (!lokasi || !variable || !period) {
3507:         alert('Silakan pilih lokasi, variabel, dan periode terlebih dahulu.');
3508:         return;
3509:       }
3510: 
3511:       document.getElementById('futureDataInfo').innerHTML =
3512:         'Lokasi: ' + lokasi + '<br>' +
3513:         'Variable: ' + variable + '<br>' +
3514:         'Period: ' + period + '<br>' +
3515:         'Kategori: Proyeksi Perubahan Iklim';
3516: 
3517:       // A. Muat data CSV secara asinkron berdasarkan filter lokasi, variabel, statistik, tahun awal, tahun akhir
3518:       let loadedCSV = false;
3519:       try {
3520:         const csvRes = await fetch(`?action=get_future_csv&location=${encodeURIComponent(lokasi)}&variable=${encodeURIComponent(variable)}&statistic=${encodeURIComponent(statistic)}&start_year=${encodeURIComponent(startYear)}&end_year=${encodeURIComponent(endYear)}`);
3521:         const csvResult = await csvRes.json();
3522:         if (csvResult.success && csvResult.mean && csvResult.mean.length > 0) {
3523:           renderFutureCSVChart(csvResult, variable, statistic, startYear, endYear);
3524:           loadedCSV = true;
3525:         } else if (csvResult.error) {
3526:           console.warn("Gagal memuat data CSV:", csvResult.error);
3527:         }
3528:       } catch (err) {
3529:         console.error("Kesalahan AJAX CSV:", err);
3530:       }
3531: 
3532:       // B. Jika CSV gagal dimuat, fallback ke grafik interaktif simulasi bawaan DB
3533:       if (!loadedCSV) {
3534:         renderFutureClimateChart(variable, null, period);
3535:       }
3536: 
3537:       try {
3538:         const res = await fetch(`?action=get_future&location=${encodeURIComponent(lokasi)}&variable=${encodeURIComponent(variable)}&period=${encodeURIComponent(period)}`);
3539:         const result = await res.json();
3540: 
The above content does NOT show the entire file contents. If you need to view any lines of the file which were not shown to complete your task, call this tool again to view those lines.
