HTML CSS:
接著用JavaScript寫個夜間模式plus:
<script><div class="codebody" id="code65469">var brightness;<BR>//顯示遮罩<BR>function cover(brightness) {<BR> if (typeof(div) == 'undefined') {<BR> ('div');<BR> div.setAttribute('style', 'position:fixed;top:0;left:0;outline:5000px solid;z-index:99999;') . .appendChild(div);<BR> } else {<BR> div.style.display = '';<BR> }<BR> 並且';<BR>}<BR>//事件監聽<BR>window.addEventListener('keydown', function(e) {<BR> if (e.altKey && e.keyCode == 90) { //Alt Z :開啟夜間模式<BR> cover(brightness = 0.3);<BR> }<BR> if (e.altKey && e.keyCode == 88) {Š if (e。 ;<BR> }<BR> if (e.altKey && e.keyCode == 38) { //Alt ↑:增加亮度<BR> if (brightness -🎜> if (brightness - 🎜> if (brightness - 🎜> if (brightness - 🎜) > 0.0050. > }<BR> if (e.altKey && e.keyCode == 40) { //Alt ↓:降低亮度<BR> if (brightness 0.05 < 0.95) 095); }, false);<BR></script>
也可以寫成GreaseMonkey腳本,作為瀏覽器擴充給任意頁面增加夜間模式