ssb: Fix channel cycling key shortcut.
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				Build Tilde Friends / Build-All (push) Has been cancelled
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	Build Tilde Friends / Build-All (push) Has been cancelled
				
			This commit is contained in:
		@@ -112,27 +112,25 @@ class TfElement extends LitElement {
 | 
			
		||||
 | 
			
		||||
	keydown(event) {
 | 
			
		||||
		if (event.altKey && event.key == 'ArrowUp') {
 | 
			
		||||
			this.next_channel(1);
 | 
			
		||||
			this.next_channel(-1);
 | 
			
		||||
			event.preventDefault();
 | 
			
		||||
		} else if (event.altKey && event.key == 'ArrowDown') {
 | 
			
		||||
			this.next_channel(-1);
 | 
			
		||||
			this.next_channel(1);
 | 
			
		||||
			event.preventDefault();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	next_channel(delta) {
 | 
			
		||||
		let channel_names = ['', '@'].concat(this.channels);
 | 
			
		||||
		let channel_names = ['', '@', '🔐', ...this.channels.map(x => '#' + x)];
 | 
			
		||||
		let index = channel_names.indexOf(this.hash.substring(1));
 | 
			
		||||
		if (index != -1) {
 | 
			
		||||
			index += delta;
 | 
			
		||||
			this.set_hash(
 | 
			
		||||
		index = index != -1 ? index + delta : 0;
 | 
			
		||||
		tfrpc.rpc.setHash(
 | 
			
		||||
			'#' +
 | 
			
		||||
				encodeURIComponent(
 | 
			
		||||
					channel_names[(index + channel_names.length) % channel_names.length]
 | 
			
		||||
				)
 | 
			
		||||
		);
 | 
			
		||||
	}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	set_hash(hash) {
 | 
			
		||||
		this.hash = decodeURIComponent(hash || '#');
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user