Light Modus hinzugefügt
This commit is contained in:
		
							
								
								
									
										23
									
								
								settings/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								settings/index.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
<html>
 | 
			
		||||
  <head>
 | 
			
		||||
    <meta charset="utf-8">
 | 
			
		||||
  </head>
 | 
			
		||||
 | 
			
		||||
  <body>
 | 
			
		||||
    <form>
 | 
			
		||||
      <h2>Ressourcen</h2>
 | 
			
		||||
      <label>
 | 
			
		||||
        <input type="checkbox" id="light">
 | 
			
		||||
        <b>Light Modus</b><br>
 | 
			
		||||
        Verringert die Prozessorlast durch abschalten der interaktiven Elemente
 | 
			
		||||
      </label>
 | 
			
		||||
      <br>
 | 
			
		||||
      <br>
 | 
			
		||||
      <button type="submit">Speichen</button>
 | 
			
		||||
    </form>
 | 
			
		||||
 | 
			
		||||
    <script src="settings.js"></script>
 | 
			
		||||
 | 
			
		||||
  </body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										23
									
								
								settings/settings.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								settings/settings.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
function saveOptions(e) {
 | 
			
		||||
  e.preventDefault();
 | 
			
		||||
  browser.storage.local.set({
 | 
			
		||||
    light: document.querySelector("#light").checked
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function restoreOptions() {
 | 
			
		||||
 | 
			
		||||
  function setCurrentChoice(result) {
 | 
			
		||||
    document.querySelector("#light").checked = result.light || false;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function onError(error) {
 | 
			
		||||
    console.log(`Error: ${error}`);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  var getting = browser.storage.local.get("light");
 | 
			
		||||
  getting.then(setCurrentChoice, onError);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
document.addEventListener("DOMContentLoaded", restoreOptions);
 | 
			
		||||
document.querySelector("form").addEventListener("submit", saveOptions);
 | 
			
		||||
		Reference in New Issue
	
	Block a user