diff options
-rw-r--r-- | includes/maps.php | 4 | ||||
-rw-r--r-- | js/mapspecs.js | 21 | ||||
-rw-r--r-- | pages/admin.php | 4 |
3 files changed, 24 insertions, 5 deletions
diff --git a/includes/maps.php b/includes/maps.php index 03bcd81..d41505a 100644 --- a/includes/maps.php +++ b/includes/maps.php @@ -155,9 +155,9 @@ function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL) }
if (isset($_COOKIE['pref_mute']) && $_COOKIE['pref_mute'] == "true") {
- $mutebutton = "<label><input onclick='savePref(\"mute\", this.checked)' type='checkbox' id='$idprefix,mute' checked='checked' />Mute</label>";
+ $mutebutton = "<label><input onclick='setMute(this.checked)' type='checkbox' id='$idprefix,mute' class='checkbox_mute' checked='checked' />Mute</label>";
} else {
- $mutebutton = "<label><input onclick='savePref(\"mute\", this.checked)' type='checkbox' id='$idprefix,mute' />Mute</label>";
+ $mutebutton = "<label><input onclick='setMute(this.checked)' type='checkbox' id='$idprefix,mute' class='checkbox_mute' />Mute</label>";
}
diff --git a/js/mapspecs.js b/js/mapspecs.js index b9d0aa4..5c4141d 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -830,10 +830,29 @@ function rgbStringToHex(rgbString) { return hexString ='#'+parts.join('').toUpperCase(); // "#0070FF"
}
+var ignoreMuteChecks = false;
+function setMute(value)
+{
+ if(!ignoreMuteChecks)
+ {
+ //Prevent changes to other checkboxes from calling this function:
+ ignoreMuteChecks = true;
+
+ //Set all other checkboxes
+ var muteButtons = document.getElementsByClassName("checkbox_mute");
+ for(var i=0; i < muteButtons.length; i++)
+ {
+ muteButtons[i].checked = value;
+ }
+ savePref('mute', value);
+
+ ignoreMuteChecks = false;
+ }
+}
function savePref(pref, value) {
- setCookie('pref_'+pref, value,31);
+ setCookie('pref_'+pref, value, 9999);
}
//Cookie functions from w3schools.com
diff --git a/pages/admin.php b/pages/admin.php index dddacaa..e6c0164 100644 --- a/pages/admin.php +++ b/pages/admin.php @@ -203,7 +203,7 @@ function createThumbnail($mapMatrix, $idprefix, $width, $height) { <input type='radio' name='$idprefix,speed' id='$idprefix,spdslow' checked=true />
<input type='radio' name='$idprefix,speed' id='$idprefix,spdmed' />
<input type='radio' name='$idprefix,speed' id='$idprefix,spdfast' />
- <input type='checkbox' id='$idprefix,mute' checked=true />
+ <input type='checkbox' id='$idprefix,mute' checked=true class='checkbox_mute' />
</div>
";
$output .= $mapdatadiv;
@@ -244,7 +244,7 @@ function createThumbnail($mapMatrix, $idprefix, $width, $height) { </div>
<div class='grid_dsp_mid dsp_16'>
- <label><input type='checkbox' id='$idprefix,mute' />Mute</label>
+ <label><input type='checkbox' id='$idprefix,mute' class='checkbox_mute' />Mute</label>
</div>
<div id='$idprefix,dspbr' class='grid_dsp_right dsp_33'>
|