@@ -373,7 +373,7 @@ function domString(type) {
373373 <div class="w-100 row align-items-center">
374374 <div class="col-7">
375375 <label>
376- ${ i18n . __ ( "personalization-notify-sound-msg-time -end" ) }
376+ ${ i18n . __ ( "personalization-notify-sound-msg-work -end" ) }
377377 </label>
378378 </div>
379379 <div class="col-5 text-right">
@@ -400,6 +400,34 @@ function domString(type) {
400400 onkeyup="store.set('custom-work-time-end-sound',$('#custom-notify-sound-work-time-end').val());" />
401401 </div><br/>
402402 <div class="col-7">
403+ <label>
404+ ${ i18n . __ ( "personalization-notify-sound-msg-rest-end" ) }
405+ </label>
406+ </div>
407+ <div class="col-5 text-right">
408+ <div class="dropdown">
409+ <a aria-expanded="false"
410+ aria-haspopup="true" class="btn btn-outline-secondary dropdown-toggle"
411+ data-toggle="dropdown"
412+ id="rest-time-end-sound-dropdown-button">
413+ </a>
414+ <div aria-labelledby="rest-time-end-sound-dropdown-button" class="dropdown-menu"
415+ id="rest-time-end-sound-select">
416+ </div>
417+ </div><br/>
418+ </div>
419+ <div class="col-5 custom-notify-sound-rest-time-end">
420+ <label>
421+ ${ i18n . __ ( "custom-notify-sound" ) }
422+ </label>
423+ </div>
424+ <div class="col-7 text-right custom-notify-sound-rest-time-end">
425+ <input id="custom-notify-sound-rest-time-end" name="custom-notify-sound-rest-time-end"
426+ type="text" class="hotkey-set-input extreme-small text-right"
427+ placeholder="${ i18n . __ ( 'input-url' ) } "
428+ onkeyup="store.set('custom-rest-time-end-sound',$('#custom-notify-sound-rest-time-end').val());" />
429+ </div><br/>
430+ <div class="col-7">
403431 <label>
404432 ${ i18n . __ ( "personalization-notify-sound-msg-all-end" ) }
405433 </label>
@@ -788,34 +816,54 @@ function personalizedNotification() {
788816function personalizationSoundInitializer ( ) {
789817 if ( store . has ( "custom-work-time-end-sound" ) )
790818 $ ( "#custom-notify-sound-work-time-end" ) . val ( store . get ( "custom-work-time-end-sound" ) ) ;
819+ if ( store . has ( "custom-rest-time-end-sound" ) )
820+ $ ( "#custom-notify-sound-rest-time-end" ) . val ( store . get ( "custom-rest-time-end-sound" ) ) ;
791821 if ( store . has ( "custom-all-time-end-sound" ) )
792- $ ( "#custom-notify-sound-all-time-end" ) . val ( store . get ( "custom-work- all-end-sound" ) ) ;
822+ $ ( "#custom-notify-sound-all-time-end" ) . val ( store . get ( "custom-all-time -end-sound" ) ) ;
793823 let player = document . createElement ( "audio" ) ; //alert player
794824 let soundList = [ 'alarming' , 'beep' , 'clock' , 'tick' , 'trumpet' , 'whistle' , 'horns' , 'magic' , 'piano' , i18n . __ ( 'custom' ) ] ;
795825 for ( let i in soundList ) {
796826 $ ( "#work-time-end-sound-select" ) . append ( "\
797827 <a class='dropdown-item' href='javascript:workTimeEndSoundSetting(\"" + soundList [ i ] + "\")'>"
798828 + soundList [ i ] + "</a>" ) ;
799829 }
800- $ ( "#work-time-end-sound-dropdown-button" ) . text ( store . has ( "time-end-sound" ) ? store . get ( "time-end-sound" ) : "tick" ) ;
801- if ( store . get ( "time-end-sound" ) === i18n . __ ( 'custom' ) )
802- $ ( ".custom-notify-sound-work-time-end" ) . css ( "display" , "inline-block" ) ;
803- else
804- $ ( ".custom-notify-sound-work-time-end" ) . css ( "display" , "none" ) ;
805-
830+ for ( let i in soundList ) {
831+ $ ( "#rest-time-end-sound-select" ) . append ( "\
832+ <a class='dropdown-item' href='javascript:restTimeEndSoundSetting(\"" + soundList [ i ] + "\")'>"
833+ + soundList [ i ] + "</a>" ) ;
834+ }
806835 for ( let i in soundList ) {
807836 $ ( "#all-time-end-sound-select" ) . append ( "\
808837 <a class='dropdown-item' href='javascript:allTimeEndSoundSetting(\"" + soundList [ i ] + "\")'>"
809838 + soundList [ i ] + "</a>" ) ;
810839 }
811- $ ( "#all-time-end-sound-dropdown-button" ) . text ( store . has ( "all-end-sound" ) ? store . get ( "all-end-sound" ) : "piano" ) ;
812- if ( store . get ( "all-end-sound" ) === i18n . __ ( 'custom' ) )
840+
841+ let workSelection = store . has ( "work-time-end-sound" ) ? store . get ( "work-time-end-sound" )
842+ : ( store . has ( "time-end-sound" ) ? store . get ( "time-end-sound" ) : "tick" ) ;
843+ $ ( "#work-time-end-sound-dropdown-button" ) . text ( workSelection ) ;
844+ if ( workSelection === i18n . __ ( 'custom' ) )
845+ $ ( ".custom-notify-sound-work-time-end" ) . css ( "display" , "inline-block" ) ;
846+ else
847+ $ ( ".custom-notify-sound-work-time-end" ) . css ( "display" , "none" ) ;
848+
849+ let restSelection = store . has ( "rest-time-end-sound" ) ? store . get ( "rest-time-end-sound" )
850+ : ( store . has ( "time-end-sound" ) ? store . get ( "time-end-sound" ) : "tick" ) ;
851+ $ ( "#rest-time-end-sound-dropdown-button" ) . text ( restSelection ) ;
852+ if ( restSelection === i18n . __ ( 'custom' ) )
853+ $ ( ".custom-notify-sound-rest-time-end" ) . css ( "display" , "inline-block" ) ;
854+ else
855+ $ ( ".custom-notify-sound-rest-time-end" ) . css ( "display" , "none" ) ;
856+
857+ let allSelection = store . has ( "all-end-sound" ) ? store . get ( "all-end-sound" ) : "piano" ;
858+ $ ( "#all-time-end-sound-dropdown-button" ) . text ( allSelection ) ;
859+ if ( allSelection === i18n . __ ( 'custom' ) )
813860 $ ( ".custom-notify-sound-all-time-end" ) . css ( "display" , "inline-block" ) ;
814861 else
815862 $ ( ".custom-notify-sound-all-time-end" ) . css ( "display" , "none" ) ;
816863}
817864
818865function workTimeEndSoundSetting ( val ) {
866+ store . set ( "work-time-end-sound" , val ) ;
819867 store . set ( "time-end-sound" , val ) ;
820868 $ ( "#work-time-end-sound-dropdown-button" ) . text ( val ) ;
821869 if ( val !== i18n . __ ( 'custom' ) )
@@ -832,6 +880,23 @@ function workTimeEndSoundSetting(val) {
832880 $ ( ".custom-notify-sound-work-time-end" ) . css ( "display" , "inline-block" ) ;
833881}
834882
883+ function restTimeEndSoundSetting ( val ) {
884+ store . set ( "rest-time-end-sound" , val ) ;
885+ $ ( "#rest-time-end-sound-dropdown-button" ) . text ( val ) ;
886+ if ( val !== i18n . __ ( 'custom' ) )
887+ try {
888+ $ ( ".custom-notify-sound-rest-time-end" ) . css ( "display" , "none" ) ;
889+ let player = document . createElement ( "audio" ) ; //alert player
890+ player . src = path . join ( __dirname , "\\res\\sound\\" + val + ".mp3" ) ;
891+ player . loop = false ;
892+ player . play ( ) ;
893+ } catch ( e ) {
894+ console . log ( e ) ;
895+ }
896+ else
897+ $ ( ".custom-notify-sound-rest-time-end" ) . css ( "display" , "inline-block" ) ;
898+ }
899+
835900function allTimeEndSoundSetting ( val ) {
836901 store . set ( "all-end-sound" , val ) ;
837902 $ ( "#all-time-end-sound-dropdown-button" ) . text ( val ) ;
0 commit comments