Skip to content

Commit a03e40b

Browse files
committed
update
1 parent 6cab6f6 commit a03e40b

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

‎console.log.html‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>有趣的console.log()</title>
8+
<style>
9+
h1 {
10+
text-align: center;
11+
}
12+
13+
p {
14+
text-align: center;
15+
font-size: 1.2em;
16+
color: blue;
17+
}
18+
</style>
19+
</head>
20+
21+
<body>
22+
<h1>有趣的console.log()</h1>
23+
<hr>
24+
<p>
25+
打开浏览器控制台(console)看看效果吧~
26+
</p>
27+
<script>
28+
let t = 'text-shadow:0.7px -1px 0 rgb(255 255 255 / 100%),1.4px -2px 0 rgb(255 255 255 / 96%),2.0999999999999996px -3px 0 rgb(255 255 255 / 92%),2.8px -4px 0 rgb(255 255 255 / 88%),-1px 1px 2px rgb(0 0 0 / 70%),-2px 2px 4px rgb(0 0 0 / 70%),-3px 3px 6px rgb(0 0 0 / 70%)';
29+
console.log("%c知乎 ฅ՞•ﻌ•՞ฅ", "color:#1772F6;font-weight:bold;font-size:6em;padding:10px 30px;".concat(t, ";").concat("background: linear-gradient(to right top,oklab(58.2% -0.04 -0.21),oklab(58.2% -0.376 -0.21));"));
30+
</script>
31+
32+
<script>
33+
function openDevTools() {
34+
try {
35+
36+
// 尝试使用非标准方法打开开发者工具(仅部分浏览器支持)
37+
if (window.chrome && window.chrome.devtools) {
38+
window.chrome.devtools.open();
39+
return;
40+
}
41+
42+
// chrome.browserAction.onClicked.addListener(function(tab) {
43+
// chrome.tabs.executeScript(tab.id, {code: 'openDevTools();'});
44+
// });
45+
46+
// 触发 F12 快捷键
47+
const event = new KeyboardEvent("keydown", {
48+
key: "F12",
49+
code: "F12",
50+
keyCode: 123, // 可能需要根据浏览器调整
51+
which: 123, // 可能需要根据浏览器调整
52+
ctrlKey: true, // 对于Chrome,通常需要Ctrl+Shift+I
53+
shiftKey: true // 对于Chrome,通常需要Ctrl+Shift+I
54+
});
55+
56+
// 派发事件(触发F12) 打开开发者工具
57+
// document.dispatchEvent(event);
58+
window.dispatchEvent(event);
59+
60+
} catch (e) {
61+
// 忽略错误
62+
console.error(e);
63+
}
64+
}
65+
66+
// 延时调用以确保页面加载完成
67+
window.onload = function () {
68+
openDevTools();
69+
};
70+
</script>
71+
</body>
72+
73+
</html>

0 commit comments

Comments
 (0)