跳到正文

个人记录

壁纸查看

zhouhaoGG约 6 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年4月11日
篇幅
约 6 分钟

版本

  1. v1当前

boom.html

HTML
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>boom!</title>
	</head>
	<body>
		<noscript>请开启JavaScript! / 不要禁用JavaScript!<br></noscript>
		<a href="https://www.luogu.com.cn/user/1232423">by:zhouhaoGG</a>
		<br>
		<a href="https://www.luogu.com.cn/article/cmrvybh8">源代码</a>
		<p id="count_num"></p>
		<button onclick="updateimg()">生成一张/下一张</button>
		<br>
		<p>图片大小:</p>
		<input type="range" min="200" max="1500" value="500"
			oninput="document.getElementById('beautiful_img1').width=this.value;document.getElementById('beautiful_img2').width=this.value;">
		<br>
		<button id="auto_flush_btn" onclick="auto_flush=!auto_flush;
			if(auto_flush){document.getElementById('auto_flush_btn').innerHTML='关闭自动刷新';auto_flush_id=setInterval(updateimg,auto_flush_time);}
			else{document.getElementById('auto_flush_btn').innerHTML='开启自动刷新';clearInterval(auto_flush_id);}">开启自动刷新</button>
		<input type="number" id="flush_time" value="2" min="1" max="600"
			onchange="auto_flush_time=this.value*1000;if(auto_flush){clearInterval(auto_flush_id);auto_flush_id=setInterval(updateimg,auto_flush_time);}">
		<br>
		<p>图源:</p>
		<!-- 图源菜单 -->
		<select id="img_src_menu" onchange="img_src=this.value;
			document.getElementById('beautiful_img'+(nextimg+1)).src=gen_img_src(this.value);">
			<option value="1">随机图源(若慢可选第三)</option>
			<option value="2">t.alcy.cc/ycy</option>
			<option value="3">api.mysqil.com/pc</option>
		</select>
		<br>
		<img id="beautiful_img1" width="500" height="auto" style="display:none" />
		<img id="beautiful_img2" width="500" height="auto" style="display:none" />
		<script>
			var count=0,auto_flush=false,auto_flush_id,auto_flush_time=2000;
			var nextimg=1;
			document.getElementById("beautiful_img1").src=gen_img_src(document.getElementById("img_src_menu").value);
			document.getElementById("count_num").innerHTML="你已经看了 "+count+" 张图片";
			function gen_img_src(t){
				if(t==1) return gen_img_src(Math.floor(Math.random()*2)+1);
				else if(t==2) return "https://t.alcy.cc/ycy?"+new Date().getTime();
				else if(t==3) return "https://api.mysqil.com/pc/"+(Math.floor(Math.random()*493)+1)+".webp";
			}
			function updateimg(){
				if(nextimg==0){
					var img=document.getElementById("beautiful_img1");
					img.src=gen_img_src(document.getElementById("img_src_menu").value);
					document.getElementById("beautiful_img2").style.display="block";
					img.style.display="none";
				}else{
					var img=document.getElementById("beautiful_img2");
					img.src=gen_img_src(document.getElementById("img_src_menu").value);
					document.getElementById("beautiful_img1").style.display="block";
					img.style.display="none";
				}
				count++;nextimg=1-nextimg;
				document.getElementById("count_num").innerHTML="你已经看了 "+count+" 张图片";
			}
		</script>
		<script src="https://fastly.jsdelivr.net/npm/live2d-widgets@0/autoload.js"></script>
	</body>
</html>

增加图片大小,图片细节更清晰
增加自动刷新,自动更换更方便
增加图源菜单,图片来源更丰富
增加图双缓冲,图片加载更流畅
增 加 live2D ,看图互动更多样

原文