Merge pull request #2510 from iAmShorty/block-notification

Disable Sound in Dashboard
This commit is contained in:
Sebastian Grewe 2016-06-30 12:39:37 +02:00 committed by GitHub
commit 9e8caa57ca
6 changed files with 44 additions and 13 deletions

3
.gitignore vendored
View File

@ -38,3 +38,6 @@
/vendor/ /vendor/
tests/_output/* tests/_output/*
# NetBeans Project Directory
/nbproject/*

View File

@ -18,7 +18,7 @@ branches:
install: install:
- wget http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.2.jar - wget http://selenium-release.storage.googleapis.com/2.42/selenium-server-standalone-2.42.2.jar
- composer global require "fxp/composer-asset-plugin:1.0.0-beta2" - composer global require "fxp/composer-asset-plugin:~1.1.1"
- composer install - composer install

View File

@ -97,6 +97,13 @@ $aSettings['website'][] = array(
'name' => 'website_notification_autohide', 'value' => $setting->getValue('website_notification_autohide'), 'name' => 'website_notification_autohide', 'value' => $setting->getValue('website_notification_autohide'),
'tooltip' => 'Hides Notifications after 5 seconds.' '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( $aSettings['blockchain'][] = array(
'display' => 'Disable Blockexplorer', 'type' => 'select', 'display' => 'Disable Blockexplorer', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes' ), 'options' => array( 0 => 'No', 1 => 'Yes' ),

View File

@ -119,6 +119,7 @@ $aGlobal['website']['transactionexplorer']['disabled'] = $setting->getValue('web
$aGlobal['website']['chaininfo']['disabled'] = $setting->getValue('website_chaininfo_disabled'); $aGlobal['website']['chaininfo']['disabled'] = $setting->getValue('website_chaininfo_disabled');
$aGlobal['website']['donors']['disabled'] = $setting->getValue('disable_donors'); $aGlobal['website']['donors']['disabled'] = $setting->getValue('disable_donors');
$aGlobal['website']['about']['disabled'] = $setting->getValue('disable_about'); $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_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_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'; $setting->getValue('website_chaininfo_url') ? $aGlobal['website']['chaininfo']['url'] = $setting->getValue('website_chaininfo_url') : $aGlobal['website']['chaininfo']['url'] = 'http://allchains.info';

View File

@ -37,11 +37,13 @@
</tbody> </tbody>
</table> </table>
</div> </div>
{if $GLOBAL.website.blockfindersound.enabled|default:"1"}
<div id="togglesound" class="togglesound"> <div id="togglesound" class="togglesound">
<div class="panel-footer text-right"> <div class="panel-footer text-right">
<button id="muteButton" type="button" class="btn-xs btn-success toggleSoundButton"><i class="fa fa-volume-up"></i></button> <button id="muteButton" type="button" class="btn-xs btn-success toggleSoundButton"><i class="fa fa-volume-up"></i></button>
</div> </div>
</div> </div>
{/if}
</div> </div>
</div> </div>
{/if} {/if}

View File

@ -4,8 +4,11 @@
{literal} {literal}
$(document).ready(function(){ $(document).ready(function(){
{/literal}
{if $GLOBAL.website.blockfindersound.enabled|default:"1"}
{literal}
var playSound = localStorage.getItem('playsound');
var canCreateSoundJS = false; var canCreateSoundJS = false;
// check if the default plugins can be loaded, if not, disable button and don't load soundjs // check if the default plugins can be loaded, if not, disable button and don't load soundjs
if (!createjs.Sound.initializeDefaultPlugins()) { if (!createjs.Sound.initializeDefaultPlugins()) {
$('#togglesound').hide(); $('#togglesound').hide();
@ -13,13 +16,25 @@ $(document).ready(function(){
} else if (createjs.BrowserDetect.isIOS || createjs.BrowserDetect.isAndroid || createjs.BrowserDetect.isBlackberry) { } else if (createjs.BrowserDetect.isIOS || createjs.BrowserDetect.isAndroid || createjs.BrowserDetect.isBlackberry) {
$('#togglesound').hide(); $('#togglesound').hide();
} else { } else {
var audioPath = "{/literal}{$PATH}{literal}/audio/"; if (playSound == 'True') {
var sound = [ {id:"ding", src:"ding.mp3"} ]; var audioPath = "{/literal}{$PATH}{literal}/audio/";
var muteFlag = 1; var sound = [ {id:"ding", src:"ding.mp3"} ];
createjs.Sound.alternateExtensionseExtensions = ["mp3"]; var playSound = 'True';
createjs.Sound.registerSounds(sound, audioPath); createjs.Sound.alternateExtensionseExtensions = ["mp3"];
canCreateSoundJS = true; createjs.Sound.registerSounds(sound, audioPath);
canCreateSoundJS = true;
$("#muteButton").removeClass();
$('#muteButton').addClass("btn-xs btn-success toggleSoundButton");
$('#muteButton').find($(".fa")).removeClass('fa-volume-off').addClass('fa-volume-up');
} else {
$("#muteButton").removeClass();
$('#muteButton').addClass("btn-xs btn-danger toggleSoundButton");
$('#muteButton').find($(".fa")).removeClass('fa-volume-up').addClass('fa-volume-off');
}
} }
{/literal}
{/if}
{literal}
// Ajax API URL // 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}"; var url_dashboard = "{/literal}{$smarty.server.SCRIPT_NAME}?page=api&action=getdashboarddata&api_key={$GLOBAL.userdata.api_key}&id={$GLOBAL.userdata.id}{literal}";
@ -272,13 +287,16 @@ $(document).ready(function(){
// Mute Button // Mute Button
$('#muteButton').click(function(){ $('#muteButton').click(function(){
if(muteFlag == 2) { //alert(playSound);
muteFlag = 1; if(playSound == 'False') {
localStorage.setItem('playsound', 'True');
playSound = 'True';
createjs.Sound.setMute(false); createjs.Sound.setMute(false);
$(this).toggleClass("btn-xs btn-danger").toggleClass("btn-xs btn-success"); $(this).toggleClass("btn-xs btn-danger").toggleClass("btn-xs btn-success");
$(this).find($(".fa")).removeClass('fa-volume-off').addClass('fa-volume-up'); $(this).find($(".fa")).removeClass('fa-volume-off').addClass('fa-volume-up');
} else { } else {
muteFlag = 2; localStorage.setItem('playsound', 'False');
playSound = 'False';
createjs.Sound.setMute(true); createjs.Sound.setMute(true);
$(this).toggleClass("btn-xs btn-success").toggleClass("btn-xs btn-danger"); $(this).toggleClass("btn-xs btn-success").toggleClass("btn-xs btn-danger");
$(this).find($(".fa")).removeClass('fa-volume-up').addClass('fa-volume-off'); $(this).find($(".fa")).removeClass('fa-volume-up').addClass('fa-volume-off');