diff --git a/.gitignore b/.gitignore index 61b57c10..f7530209 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,7 @@ /vendor/ -tests/_output/* \ No newline at end of file +tests/_output/* + +# NetBeans Project Directory +/nbproject/* \ No newline at end of file diff --git a/include/config/admin_settings.inc.php b/include/config/admin_settings.inc.php index 3dd2a4da..36ff000b 100644 --- a/include/config/admin_settings.inc.php +++ b/include/config/admin_settings.inc.php @@ -97,6 +97,13 @@ $aSettings['website'][] = array( 'name' => 'website_notification_autohide', 'value' => $setting->getValue('website_notification_autohide'), 'tooltip' => 'Hides Notifications after 5 seconds.' ); +$aSettings['website'][] = array( + 'display' => 'Disable Block Notification Sound', 'type' => 'select', + 'options' => array( 0 => 'Do not notify', 1 => 'Notify when Block is found' ), + 'default' => 0, + 'name' => 'website_blockfinder_notification', 'value' => $setting->getValue('website_blockfinder_notification'), + 'tooltip' => 'Enable/Disable Blockfinder Sound.' +); $aSettings['blockchain'][] = array( 'display' => 'Disable Blockexplorer', 'type' => 'select', 'options' => array( 0 => 'No', 1 => 'Yes' ), diff --git a/include/smarty_globals.inc.php b/include/smarty_globals.inc.php index b0179f08..1aaab82c 100644 --- a/include/smarty_globals.inc.php +++ b/include/smarty_globals.inc.php @@ -119,6 +119,7 @@ $aGlobal['website']['transactionexplorer']['disabled'] = $setting->getValue('web $aGlobal['website']['chaininfo']['disabled'] = $setting->getValue('website_chaininfo_disabled'); $aGlobal['website']['donors']['disabled'] = $setting->getValue('disable_donors'); $aGlobal['website']['about']['disabled'] = $setting->getValue('disable_about'); +$aGlobal['website']['blockfindersound']['enabled'] = $setting->getValue('website_blockfinder_notification'); $setting->getValue('website_blockexplorer_url') ? $aGlobal['website']['blockexplorer']['url'] = $setting->getValue('website_blockexplorer_url') : $aGlobal['website']['blockexplorer']['url'] = 'http://explorer.litecoin.net/block/'; $setting->getValue('website_transactionexplorer_url') ? $aGlobal['website']['transactionexplorer']['url'] = $setting->getValue('website_transactionexplorer_url') : $aGlobal['website']['transactionexplorer']['url'] = 'http://explorer.litecoin.net/tx/'; $setting->getValue('website_chaininfo_url') ? $aGlobal['website']['chaininfo']['url'] = $setting->getValue('website_chaininfo_url') : $aGlobal['website']['chaininfo']['url'] = 'http://allchains.info'; diff --git a/templates/bootstrap/dashboard/blocks/default.tpl b/templates/bootstrap/dashboard/blocks/default.tpl index 83959217..d947f537 100644 --- a/templates/bootstrap/dashboard/blocks/default.tpl +++ b/templates/bootstrap/dashboard/blocks/default.tpl @@ -37,11 +37,13 @@ + {if $GLOBAL.website.blockfindersound.enabled|default:"1"}
+ {/if} {/if} \ No newline at end of file diff --git a/templates/bootstrap/dashboard/js/api.tpl b/templates/bootstrap/dashboard/js/api.tpl index d91bdc96..65255a28 100644 --- a/templates/bootstrap/dashboard/js/api.tpl +++ b/templates/bootstrap/dashboard/js/api.tpl @@ -4,8 +4,11 @@ {literal} $(document).ready(function(){ + {/literal} + {if $GLOBAL.website.blockfindersound.enabled|default:"1"} + {literal} + var playSound = localStorage.getItem('playsound') === 'False' ? false : true; var canCreateSoundJS = false; - // check if the default plugins can be loaded, if not, disable button and don't load soundjs if (!createjs.Sound.initializeDefaultPlugins()) { $('#togglesound').hide(); @@ -13,13 +16,23 @@ $(document).ready(function(){ } else if (createjs.BrowserDetect.isIOS || createjs.BrowserDetect.isAndroid || createjs.BrowserDetect.isBlackberry) { $('#togglesound').hide(); } else { - var audioPath = "{/literal}{$PATH}{literal}/audio/"; - var sound = [ {id:"ding", src:"ding.mp3"} ]; - var muteFlag = 1; - createjs.Sound.alternateExtensionseExtensions = ["mp3"]; - createjs.Sound.registerSounds(sound, audioPath); - canCreateSoundJS = true; + if (playSound) { + var audioPath = "{/literal}{$PATH}{literal}/audio/"; + var sound = [ {id:"ding", src:"ding.mp3"} ]; + var muteFlag = 1; + createjs.Sound.alternateExtensionseExtensions = ["mp3"]; + createjs.Sound.registerSounds(sound, audioPath); + canCreateSoundJS = true; + $('#muteButton').toggleClass("btn-xs btn-danger").toggleClass("btn-xs btn-success"); + $('#muteButton').find($(".fa")).removeClass('fa-volume-off').addClass('fa-volume-up'); + } else { + $('#muteButton').toggleClass("btn-xs btn-success").toggleClass("btn-xs btn-danger"); + $('#muteButton').find($(".fa")).removeClass('fa-volume-up').addClass('fa-volume-off'); + } } + {/literal} + {/if} + {literal} // Ajax API URL var url_dashboard = "{/literal}{$smarty.server.SCRIPT_NAME}?page=api&action=getdashboarddata&api_key={$GLOBAL.userdata.api_key}&id={$GLOBAL.userdata.id}{literal}"; @@ -273,11 +286,13 @@ $(document).ready(function(){ // Mute Button $('#muteButton').click(function(){ if(muteFlag == 2) { + localStorage.setItem('playsound', 'True'); muteFlag = 1; createjs.Sound.setMute(false); $(this).toggleClass("btn-xs btn-danger").toggleClass("btn-xs btn-success"); $(this).find($(".fa")).removeClass('fa-volume-off').addClass('fa-volume-up'); } else { + localStorage.setItem('playsound', 'False'); muteFlag = 2; createjs.Sound.setMute(true); $(this).toggleClass("btn-xs btn-success").toggleClass("btn-xs btn-danger");