console
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>安全作品集 | John Doe</title>
<style>
:root {
--primary-color: #2c3e50;
--accent-color: #e74c3c;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
user-select: none;
-webkit-user-drag: none;
}
body {
background: #111;
font-family: 'Segoe UI', system-ui, sans-serif;
line-height: 1.6;
overflow-x: hidden;
}
#dynamic-overlay {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
pointer-events: none;
z-index: -1;
opacity: 0.1;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
position: relative;
z-index: 2;
}
.portfolio-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
margin-top: 3rem;
}
.portfolio-item {
background: rgba(255, 255, 255, 0.05);
border-radius: 10px;
overflow: hidden;
transition: transform 0.3s ease;
}
.portfolio-item:hover {
transform: translateY(-5px);
}
.portfolio-img {
width: 100%;
height: 250px;
object-fit: cover;
border-bottom: 2px solid var(--accent-color);
}
.portfolio-content {
padding: 1.5rem;
}
.security-alert {
position: fixed;
top: 20px;
right: -300px;
background: rgba(0, 0, 0, 0.9);
color: #fff;
padding: 1rem 2rem;
border-radius: 5px;
transition: right 0.5s ease;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}
.security-alert.active {
right: 20px;
}
@media (max-width: 768px) {
.container {
padding: 1rem;
}
}
</style>
</head>
<body>
<canvas id="dynamic-overlay"></canvas>
<div class="security-alert" id="alert">安全系统已激活</div>
<div class="container">
<header>
<h1 style="color: #fff; margin-bottom: 1rem;">John Doe 作品集</h1>
<p style="color: #888;">交互设计师 | 数字艺术创作者</p>
</header>
<div class="portfolio-grid">
<div class="portfolio-item">
<img src="project1.jpg" class="portfolio-img" alt="项目1">
<div class="portfolio-content">
<h3 style="color: #fff;">沉浸式交互装置</h3>
<p style="color: #aaa;">2023年数字艺术展参展作品</p>
</div>
</div>
</div>
</div>
<script>
class SecuritySystem {
constructor() {
this.initCanvas();
this.bindEvents();
this.detectDevTools();
}
initCanvas() {
const canvas = document.getElementById('dynamic-overlay');
const ctx = canvas.getContext('2d');
const resize = () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
};
const draw = () => {
ctx.fillStyle = '#000';
ctx.fillRect(0, 0, canvas.width, canvas.height);
for(let i = 0; i < 50; i++) {
ctx.fillStyle = `hsla(${Math.random()*360}, 70%, 50%, 0.05)`;
ctx.beginPath();
ctx.arc(
Math.random() * canvas.width,
Math.random() * canvas.height,
Math.random() * 3,
0,
Math.PI * 2
);
ctx.fill();
}
requestAnimationFrame(draw);
};
window.addEventListener('resize', resize);
resize();
draw();
}
bindEvents() {
document.addEventListener('contextmenu', e => e.preventDefault());
document.addEventListener('keydown', e => {
if (e.key === 'PrintScreen' || e.ctrlKey && e.key === 's') {
e.preventDefault();
this.showAlert();
}
});
document.addEventListener('visibilitychange', () => {
if (document.hidden) this.handleBreach();
});
}
detectDevTools() {
const check = () => {
const threshold = 160;
const widthDiff = window.outerWidth - window.innerWidth;
const heightDiff = window.outerHeight - window.innerHeight;
if (widthDiff > threshold || heightDiff > threshold) {
this.handleBreach();
}
};
setInterval(check, 1000);
}
showAlert() {
const alert = document.getElementById('alert');
alert.classList.add('active');
setTimeout(() => alert.classList.remove('active'), 3000);
}
handleBreach() {
this.showAlert();
document.body.style.opacity = '0.5';
setTimeout(() => document.body.style.opacity = '1', 3000);
}
}
new SecuritySystem();
document.addEventListener('click', () => {
if (!document.fullscreenElement) {
document.documentElement.requestFullscreen();
}
});
</script>
</body>
</html>