11// Retriving user options
22chrome . extension . sendMessage ( { } , function ( settings ) {
33 initOnHashChangeAction ( settings [ 'Domains' ] )
4- initShortcuts ( settings [ 'Shortcut' ] , settings [ 'BackgroundShortcut' ] )
4+ initShortcuts ( settings [ 'Shortcut' ] , settings [ 'BackgroundShortcut' ] , settings [ 'MuteShortcut' ] )
5+
56 initListViewShortcut ( )
67 initForInbox ( )
78} )
@@ -51,9 +52,10 @@ function initOnHashChangeAction(domains) {
5152 url = github_links [ github_links . length - 2 ] . href
5253 muteLink = document . createElement ( 'button' )
5354 muteLink . type = 'button'
54- muteLink . className = 'ithub -mute-button T-I J-J5-Ji lS T-I-ax7 ar7'
55+ muteLink . className = 'github -mute-button T-I J-J5-Ji lS T-I-ax7 ar7'
5556 muteLink . innerText = 'Mute thread'
5657 muteLink . addEventListener ( 'click' , function ( ) {
58+ muteLink . innerHTML = '⋯'
5759 fetch ( muteURL , { mode : 'no-cors' } ) . then ( function ( ) {
5860 muteLink . innerText = 'Muted!'
5961 muteLink . disabled = 'disabled'
@@ -93,7 +95,7 @@ function initOnHashChangeAction(domains) {
9395 }
9496}
9597
96- function initShortcuts ( shortcut , backgroundShortcut ) {
98+ function initShortcuts ( shortcut , backgroundShortcut , muteShortcut ) {
9799 document . addEventListener ( 'keydown' , function ( event ) {
98100 // Shortcut: bind user's combination, if a button exist and event not in a textarea
99101 if ( document . querySelector ( '.gE' ) ) {
@@ -112,6 +114,11 @@ function initShortcuts(shortcut, backgroundShortcut) {
112114 if ( processRightCombinationBasedOnShortcut ( backgroundShortcut , event ) && window . idled && getVisible ( document . getElementsByClassName ( 'github-link' ) ) && notAnInput ( event . target ) ) {
113115 triggerGitHubLink ( true )
114116 }
117+
118+ // Mute Shortcut: bind user's combination, if a button exist and event not in a textarea
119+ if ( processRightCombinationBasedOnShortcut ( muteShortcut , event ) && window . idled && getVisible ( document . getElementsByClassName ( 'github-mute-button' ) ) && notAnInput ( event . target ) ) {
120+ getVisible ( document . getElementsByClassName ( 'github-mute-button' ) ) . click ( )
121+ }
115122 } )
116123}
117124
0 commit comments