<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>无聊的下班提醒</title> </head> <body> <script> var choice = { A: [17, 30], B: [18, 00], C: [18, 30] }[(prompt('请选择下班时间:\nA:17:30\nB:18:00\nC:18:30', 'ABC')||'').toUpperCase()]; setTimeout(function(){ document.body.innerHTML = '<style>body{background:#fff}</' + 'style><div id="result"></div>'; }); if (!choice) { alert('靠,别逗我,我生气了'); setTimeout(function (_) { document.querySelector('#result').innerHTML = '<h1>非常生气并给你抛了个异常,进入F12查收</h1>'; setInterval(function (_) { return document.querySelector('h1').style.color = ['rgb(', [1, 2, 3].map(function (_) { return Math.ceil(Math.random() * 256); }).join(','), ')'].join(''); }); clearInterval(interval); (function () { var re = /(?:)/; var i = 1; re.toString = function () { re.toString = function () { if (i == 2) { console.log(tryDecode('%E5%8F%88%E7%9C%8B%E5%95%A5')); } i++; return tryDecode('%E5%93%88%E5%93%88%EF%BC%8C%E4%BD%A0%E7%9C%9F%E7%9A%84%E7%9C%8B%E5%95%8A'); }; }; console.log(re); })(); throw new Error(tryDecode('%E6%97%A0%E6%95%88%E7%9A%84%E9%80%89%E9%A1%B9')); }); } function tryDecode(str){ return str.indexOf('%') > -1 ? decodeURI(str) : str; } var interval = setInterval(function (_) { var t = new Date; var left = new Date(t.getFullYear(), t.getMonth(), t.getDate(), 18, 45) - new Date; if (left <= 0) { clearInterval(interval); document.querySelector('#result').innerHTML = '下班了'; alert('还在蹭空调,害臊吗?'); } else { document.querySelector('#result').innerHTML = "\u8DDD\u79BB\u4E0B\u73ED\u8FD8\u6709" + left + "\u6BEB\u79D2"; } }); //</script> </body> </html> 提示:你可以先修改部分代码再运行。 转载请注明:有爱前端 » 非常生气并给你抛了个异常 喜欢 (0)or分享 (0)