@@ -53,8 +53,9 @@ section: Extend:Update Sites
53
53
54
54
<label class =" heading " >Compare To:</label >
55
55
<div class =" widgets " >
56
- <select id="op" onchange="updateChart()">
57
- <option value="+">+</option>
56
+ <select id="op" onchange="updateCompareMode(); updateChart()">
57
+ <option value=""></option>
58
+ <option value="+" selected>+</option>
58
59
<option value="/">/</option>
59
60
<option value="%">%</option>
60
61
</select>
@@ -105,6 +106,21 @@ section: Extend:Update Sites
105
106
return { site, op, site2, timeWindow, countType, rollingAverage };
106
107
}
107
108
109
+ function updateCompareMode () {
110
+ const op = document .getElementById (' op' ).value ;
111
+ const site2Select = document .getElementById (' site2' );
112
+
113
+ if (op === ' ' ) {
114
+ // Single site mode
115
+ site2Select .disabled = true ;
116
+ site2Select .style .opacity = ' 0.5' ;
117
+ } else {
118
+ // Comparison mode
119
+ site2Select .disabled = false ;
120
+ site2Select .style .opacity = ' 1' ;
121
+ }
122
+ }
123
+
108
124
function updateRollingAverageState () {
109
125
const { timeWindow } = getSelectedValues ();
110
126
const checkbox = document .getElementById (' rolling-average' );
@@ -359,8 +375,8 @@ section: Extend:Update Sites
359
375
};
360
376
}
361
377
362
- // If site2 is selected, fetch and combine data
363
- if (site2 && site2 !== site) {
378
+ // If comparison mode is enabled and site2 is selected
379
+ if (op && site2 && site2 !== site) {
364
380
const rawData2 = await fetchStatsData (site2, timeWindow, countType);
365
381
const filledData2 = fillDateGaps (rawData2, timeWindow);
366
382
@@ -442,7 +458,8 @@ section: Extend:Update Sites
442
458
site2Select .appendChild (site2Option);
443
459
}
444
460
445
- // Initial chart update
461
+ // Initialize compare mode state and chart
462
+ updateCompareMode ();
446
463
updateChart ();
447
464
448
465
} catch (error) {
@@ -461,6 +478,7 @@ section: Extend:Update Sites
461
478
siteSelect .appendChild (siteOption);
462
479
site2Select .appendChild (site2Option);
463
480
}
481
+ updateCompareMode ();
464
482
updateChart ();
465
483
}
466
484
}
0 commit comments