1 <!doctype html> 2 <html> 3 <head> 4 <script> 5 6 function save() { 7 var prefs = JSON.parse(localStorage.prefs); 8 prefs.use_notifications = document.getElementById("notifications").checked; 9 localStorage.prefs = JSON.stringify(prefs); 10 } 11 12 // Make sure the checkbox checked state gets properly initialized from the 13 // saved preference. 14 window.onload = function() { 15 var prefs = JSON.parse(localStorage.prefs); 16 document.getElementById("notifications").checked = prefs.use_notifications; 17 } 18 19 </script> 20 </head> 21 <body> 22 <h2>Options for Chromium Buildbot Monitor</h2> 23 <br> 24 Use desktop notifications: <input id="notifications" type="checkbox" onclick="save()"> 25 26 </body> 27 </html> 28