@@ -384,6 +384,17 @@ function domString(type) {
384
384
</div>
385
385
</div><br/>
386
386
</div>
387
+ <div class="col-5 custom-notify-sound-work-time-end">
388
+ <label>
389
+ ${ i18n . __ ( "custom-notify-sound" ) }
390
+ </label>
391
+ </div>
392
+ <div class="col-7 text-right custom-notify-sound-work-time-end">
393
+ <input id="custom-notify-sound-work-time-end" name="custom-notify-sound-work-time-end"
394
+ type="text" class="hotkey-set-input extreme-small text-right"
395
+ placeholder="${ i18n . __ ( 'input-url' ) } "
396
+ onkeyup="store.set('custom-work-time-end-sound',$('#custom-notify-sound-work-time-end').val());" />
397
+ </div><br/>
387
398
<div class="col-7">
388
399
<label>
389
400
${ i18n . __ ( "personalization-notify-sound-msg-all-end" ) }
@@ -400,6 +411,17 @@ function domString(type) {
400
411
</div>
401
412
</div><br/>
402
413
</div>
414
+ <div class="col-5 custom-notify-sound-all-time-end">
415
+ <label>
416
+ ${ i18n . __ ( "custom-notify-sound" ) }
417
+ </label>
418
+ </div>
419
+ <div class="col-7 text-right custom-notify-sound-all-time-end">
420
+ <input id="custom-notify-sound-all-time-end" name="custom-notify-sound-all-time-end" type="text"
421
+ class="hotkey-set-input extreme-small text-right"
422
+ placeholder="${ i18n . __ ( 'input-url' ) } "
423
+ onkeyup="store.set('custom-all-time-end-sound',$('#custom-notify-sound-all-time-end').val());"/>
424
+ </div><br/>
403
425
</div><br/>` ;
404
426
break ;
405
427
case "i18n" :
@@ -760,47 +782,67 @@ function personalizedNotification() {
760
782
761
783
//personalization sound
762
784
function personalizationSoundInitializer ( ) {
785
+ if ( store . has ( "custom-work-time-end-sound" ) )
786
+ $ ( "#custom-notify-sound-work-time-end" ) . val ( store . get ( "custom-work-time-end-sound" ) ) ;
787
+ if ( store . has ( "custom-all-time-end-sound" ) )
788
+ $ ( "#custom-notify-sound-all-time-end" ) . val ( store . get ( "custom-work-all-end-sound" ) ) ;
763
789
let player = document . createElement ( "audio" ) ; //alert player
764
- let soundList = [ 'alarming' , 'beep' , 'clock' , 'tick' , 'trumpet' , 'whistle' , 'horns' , 'magic' , 'piano' ] ;
790
+ let soundList = [ 'alarming' , 'beep' , 'clock' , 'tick' , 'trumpet' , 'whistle' , 'horns' , 'magic' , 'piano' , i18n . __ ( 'custom' ) ] ;
765
791
for ( let i in soundList ) {
766
792
$ ( "#work-time-end-sound-select" ) . append ( "\
767
793
<a class='dropdown-item' href='javascript:workTimeEndSoundSetting(\"" + soundList [ i ] + "\")'>"
768
794
+ soundList [ i ] + "</a>" ) ;
769
795
}
770
796
$ ( "#work-time-end-sound-dropdown-button" ) . text ( store . has ( "time-end-sound" ) ? store . get ( "time-end-sound" ) : "tick" ) ;
797
+ if ( store . get ( "time-end-sound" ) === i18n . __ ( 'custom' ) )
798
+ $ ( ".custom-notify-sound-work-time-end" ) . css ( "display" , "inline-block" ) ;
799
+ else
800
+ $ ( ".custom-notify-sound-work-time-end" ) . css ( "display" , "none" ) ;
771
801
772
802
for ( let i in soundList ) {
773
803
$ ( "#all-time-end-sound-select" ) . append ( "\
774
804
<a class='dropdown-item' href='javascript:allTimeEndSoundSetting(\"" + soundList [ i ] + "\")'>"
775
805
+ soundList [ i ] + "</a>" ) ;
776
806
}
777
807
$ ( "#all-time-end-sound-dropdown-button" ) . text ( store . has ( "all-end-sound" ) ? store . get ( "all-end-sound" ) : "piano" ) ;
808
+ if ( store . get ( "all-end-sound" ) === i18n . __ ( 'custom' ) )
809
+ $ ( ".custom-notify-sound-all-time-end" ) . css ( "display" , "inline-block" ) ;
810
+ else
811
+ $ ( ".custom-notify-sound-all-time-end" ) . css ( "display" , "none" ) ;
778
812
}
779
813
780
814
function workTimeEndSoundSetting ( val ) {
781
- try {
782
- let player = document . createElement ( "audio" ) ; //alert player
783
- store . set ( "time-end-sound" , val ) ;
784
- $ ( "#work-time-end-sound-dropdown-button" ) . text ( val ) ;
785
- player . src = path . join ( __dirname , "\\res\\sound\\" + val + ".mp3" ) ;
786
- player . loop = false ;
787
- player . play ( ) ;
788
- } catch ( e ) {
789
- console . log ( e ) ;
790
- }
815
+ store . set ( "time-end-sound" , val ) ;
816
+ $ ( "#work-time-end-sound-dropdown-button" ) . text ( val ) ;
817
+ if ( val !== i18n . __ ( 'custom' ) )
818
+ try {
819
+ $ ( ".custom-notify-sound-work-time-end" ) . css ( "display" , "none" ) ;
820
+ let player = document . createElement ( "audio" ) ; //alert player
821
+ player . src = path . join ( __dirname , "\\res\\sound\\" + val + ".mp3" ) ;
822
+ player . loop = false ;
823
+ player . play ( ) ;
824
+ } catch ( e ) {
825
+ console . log ( e ) ;
826
+ }
827
+ else
828
+ $ ( ".custom-notify-sound-work-time-end" ) . css ( "display" , "inline-block" ) ;
791
829
}
792
830
793
831
function allTimeEndSoundSetting ( val ) {
794
- try {
795
- let player = document . createElement ( "audio" ) ; //alert player
796
- store . set ( "all-end-sound" , val ) ;
797
- $ ( "#all-time-end-sound-dropdown-button" ) . text ( val ) ;
798
- player . src = path . join ( __dirname , "\\res\\sound\\" + val + ".mp3" ) ;
799
- player . loop = false ;
800
- player . play ( ) ;
801
- } catch ( e ) {
802
- console . log ( e ) ;
803
- }
832
+ store . set ( "all-end-sound" , val ) ;
833
+ $ ( "#all-time-end-sound-dropdown-button" ) . text ( val ) ;
834
+ if ( val !== i18n . __ ( 'custom' ) )
835
+ try {
836
+ $ ( ".custom-notify-sound-all-time-end" ) . css ( "display" , "none" ) ;
837
+ let player = document . createElement ( "audio" ) ; //alert player
838
+ player . src = path . join ( __dirname , "\\res\\sound\\" + val + ".mp3" ) ;
839
+ player . loop = false ;
840
+ player . play ( ) ;
841
+ } catch ( e ) {
842
+ console . log ( e ) ;
843
+ }
844
+ else
845
+ $ ( ".custom-notify-sound-all-time-end" ) . css ( "display" , "inline-block" ) ;
804
846
}
805
847
806
848
//language settings
0 commit comments