From 5dfe3b8c21ca79300a1851d7658f8aa389b2733f Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Sat, 26 Jan 2013 03:31:05 -0600 Subject: BUGFIX: Clicking the 'mute' button doesn't save across all maps until page is refreshed --- includes/maps.php | 4 ++-- js/mapspecs.js | 21 ++++++++++++++++++++- 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 = ""; + $mutebutton = ""; } else { - $mutebutton = ""; + $mutebutton = ""; } 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) { - + "; $output .= $mapdatadiv; @@ -244,7 +244,7 @@ function createThumbnail($mapMatrix, $idprefix, $width, $height) {
- +
-- cgit v1.2.3