|  |  | @@ -88,6 +88,42 @@ const connect = (username) => { | 
		
	
		
			
			|  |  |  | * BASE | 
		
	
		
			
			|  |  |  | * | 
		
	
		
			
			|  |  |  | */ | 
		
	
		
			
			|  |  |  | const Settings = { | 
		
	
		
			
			|  |  |  | get(key) { | 
		
	
		
			
			|  |  |  | try { | 
		
	
		
			
			|  |  |  | return JSON.parse(localStorage.getItem(key)) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | catch(error) { | 
		
	
		
			
			|  |  |  | return null | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | set(key, value) { | 
		
	
		
			
			|  |  |  | localStorage.setItem(key, JSON.stringify(value)) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | multiField: ([key, options]) => { | 
		
	
		
			
			|  |  |  | let current = Settings.get(key) | 
		
	
		
			
			|  |  |  | if(!options.includes(current)) { | 
		
	
		
			
			|  |  |  | Settings.set(key, options[0]) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | return m('.field', | 
		
	
		
			
			|  |  |  | m('label', key), | 
		
	
		
			
			|  |  |  | options.map(value => { | 
		
	
		
			
			|  |  |  | const style = { | 
		
	
		
			
			|  |  |  | fontWeight: Settings.get(key) == value ? 'bold' : 'unset' | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | const onclick = () => Settings.set(key, value) | 
		
	
		
			
			|  |  |  | return m('button', {style, onclick}, `${value}`) | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | ) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | view() { | 
		
	
		
			
			|  |  |  | return m('.settings', | 
		
	
		
			
			|  |  |  | Object.entries({ | 
		
	
		
			
			|  |  |  | blackBars: [true, false], | 
		
	
		
			
			|  |  |  | }).map(Settings.multiField) | 
		
	
		
			
			|  |  |  | ) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | const Base = { | 
		
	
		
			
			|  |  |  | oncreate: () => { | 
		
	
		
			
			|  |  |  | const randomName = ('' + Math.random()).substring(2) | 
		
	
	
		
			
			|  |  | @@ -143,7 +179,7 @@ const Base = { | 
		
	
		
			
			|  |  |  | State.isConnected ? [ | 
		
	
		
			
			|  |  |  | m(StreamContainer), | 
		
	
		
			
			|  |  |  | m(Chat), | 
		
	
		
			
			|  |  |  | ] : null, | 
		
	
		
			
			|  |  |  | ] : m(Settings), | 
		
	
		
			
			|  |  |  | ) | 
		
	
		
			
			|  |  |  | }, | 
		
	
		
			
			|  |  |  | } |