Whitelabel Error Page 页面看小说(摸鱼)

Whitelabel Error Page 页面看小说

功能说明

0、为了摸鱼做的页面,所以每次只显示一行,不容易被发现
1、需要自己下载小说文档,且必须为txt格式的,选择小说文件后,会使用浏览器缓存小说内容和看的行数,清理浏览器缓存后,需要重新选择文件。
2、下载压缩包,只有两个文件,一个html,一个js。用浏览器打开html页面(文件压缩包连接在最后)
3、页面打开默认为正常页面状态:Whitelabel Error Page页面,网站常见的错误页。小说就在这个页面看
正常页面状态
4、按 ↑ 键,来回切换看小说状态和正常页面状态
status=小说总行数,
code=当前行数,
选择文件后,文件输入框自动隐藏,按 ↓ 可以显示文件选择框,重新选择文件
看小说状态5、← → 换行,点击“code=”后面的数字,可以手动输入行数,按回车跳转
6、除上下左右、数字、小键盘数字、num lock、back、enter外的键均为老板键,按了页面就会切换回正常页面状态
页面zip文件(一个html、一个js文件),不需要积分就能下载

页面代码👇👇👇,需要自己下载jquery.js

<!DOCTYPE html">
<html>
<head>
<title>Whitelabel Error Page</title>
<script type="text/javascript" src="jquery.min.js"></script>
</head>
<body>
<h1>Whitelabel Error Page</h1>
<p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p>
<div id="created">Fri Jul 26 11:40:04 CST 2024</div>
<div>There was an unexpected error (type=Not Found, status=<span id="total1" style="display:inline">404</span><span id="total2" style="display:none">404</span>, code=<span id="current1" style="display:inline">404</span><span id="current2" style="display:none">404</span><input type="number" id="currentInput" style="display:none">)</div>
<div id="fileContent1" style="display:inline">No message available</div>
<div id="fileContent2" style="display:none">请先选择文件</div>
<input type="file" id="inputFile" accept=".txt" style="display:none" >
<input type="text" id="showStatus" style="display:none" value="1">

<script type="text/javascript">
//本地缓存行数key
var localStorageKey = "Whitelabel Error Page asdfaweffgwefasdf";
//本地缓存txt key
var localStorageTxt = "Whitelabel Error Page txt";

var total = 0;
var selectedFile = 0;
var numberArray = [8,13,48,49,50,51,52,53,54,55,56,57,96,97,98,99,100,101,102,103,104,105,144];
var showStatus = document.getElementById("showStatus").value;
var inputFile = document.getElementById('inputFile');
var fileContent1 = document.getElementById('fileContent1');
var fileContent2 = document.getElementById('fileContent2');
var total1 = document.getElementById('total1');
var total2 = document.getElementById('total2');
var current1 = document.getElementById('current1');
var current2 = document.getElementById('current2');
var currentInput = document.getElementById('currentInput');
//当前页码
var current = localStorage.getItem(localStorageKey);
if(!current){
	current = 0;
}else{
	current = current * 1;
}
var a;
//缓存的小说
var txt =  localStorage.getItem(localStorageTxt);
if(txt){
	console.log(txt)
	a = JSON.parse(txt);
	selectedFile = 1;
	total = a.length;
	total2.textContent = total;
	if(current >= total){
		current = total;
		localStorage.setItem(localStorageKey, current);
	}
	current2.textContent = current;
	fileContent2.textContent = a[current];
}

current2.addEventListener("click", function() {
	current2.style.display = 'none';
	currentInput.value = current;
	currentInput.style.display = 'inline';
})

currentInput.addEventListener("keydown", function(event) {
	const key = event.keyCode || event.which;
	// ENTER
    if (key == 13) {
		currentInput.style.display = 'none';
		current2.style.display = 'inline';
		current = currentInput.value * 1
		localStorage.setItem(localStorageKey, current);
		current2.textContent = current;
		if(selectedFile != 0){
			fileContent2.textContent = a[current];
		}
    }
})

//选择文件监听
inputFile.addEventListener("change", function() {
	const file = this.files[0];
	const reader = new FileReader();
	reader.readAsText(file);
	reader.onload = function(e) {
		selectedFile = 1;
		inputFile.style.display = 'none';
		const contents = e.target.result;
		const noK = contents.replaceAll(" ","")
		a = noK.split(/\r?\n/).filter(item => item !== "");
		localStorage.setItem(localStorageTxt, JSON.stringify(a));
		total = a.length;
		total2.textContent = total;
		if(current >= total){
			current = total;
			localStorage.setItem(localStorageKey, current);
		}
		current2.textContent = current;
		fileContent2.textContent = a[current];
	};
});

document.addEventListener('keydown', function(event) {
    const key = event.keyCode || event.which;
    // 上键
    if (key == 38) {
		if(showStatus == 1){
			// 隐藏元素
			fileContent1.style.display = 'none';
			total1.style.display = 'none';
			current1.style.display = 'none';
			//显示元素
			fileContent2.style.display = 'inline';
			if(selectedFile != 1){
				inputFile.style.display = 'block';
			}
			total2.style.display = 'inline';
			current2.style.display = 'inline';
			current2.textContent = current;
		}else{
			// 显示元素
			fileContent1.style.display = 'inline';
			total1.style.display = 'inline';
			current1.style.display = 'inline';
			// 隐藏元素
			fileContent2.style.display = 'none';
			inputFile.style.display = 'none';
			total2.style.display = 'none';
			current2.style.display = 'none';
		}
		showStatus = -showStatus;
    }
    // 下键
    else if (key == 40) {
        //隐藏文件上传标签
		var fileShowStatus = inputFile.style.display
		if(showStatus == -1){
			if(fileShowStatus == "none"){
				inputFile.style.display = 'block';
			}else{
				inputFile.style.display = 'none';
			}
		}
    }
    // 左键
    else if (key == 37) {
		if(selectedFile == 1){
			current = current - 1;
			if(current <= 0){
				current = 0;
			}
			localStorage.setItem(localStorageKey, current);
			fileContent2.textContent = a[current];
			current2.textContent = current;
		}else{
			fileContent2.textContent = "请先选择文件";
		}
    }
    // 右键
    else if (key == 39) {
		if(selectedFile == 1){
			current = current + 1;
			if(current >= total){
				current = total;
			}
			localStorage.setItem(localStorageKey, current);
			fileContent2.textContent = a[current];
			current2.textContent = current;
		}else{
			fileContent2.textContent = "请先选择文件";
		}
    }
    else{
		//除上下左右、数字、小键盘数字、num lock、back、enter外的键均为老板键
		if(numberArray.indexOf(key) != -1){
			return;
		}
		// 显示元素
		fileContent1.style.display = 'inline';
		total1.style.display = 'inline';
		current1.style.display = 'inline';
		// 隐藏元素
		fileContent2.style.display = 'none';
		inputFile.style.display = 'none';
		total2.style.display = 'none';
		current2.style.display = 'none';
		showStatus = 1;
	}
});
</script>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值