中小学智慧教育云平台教材预览修复
// ==UserScript==
// @name 中小学智慧教育云平台教材预览修复
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 自动跳过PDFJS查看器并修复-private子域名问题,由deepseek-r辅助制作
// @match https://basic.smartedu.cn/pdfjs/2.13/web/viewer.html*
// @match *://*.ykt.cbern.com.cn/*
// @run-at document-start
// @grant none
// @author larbais (基于DeepSeek-R技术辅助开发)
// @license MIT
// ==/UserScript==
/*
* 免责声明:
* 本脚本为技术研究用途,不保证在所有环境下稳定运行
* 使用者应遵守目标网站的服务条款,违规使用导致的后果自行承担
*/
(function() {
'use strict';
// 处理PDF预览修复
if (window.location.href.includes('/pdfjs/2.13/web/viewer.html')) {
const queryParams = new URLSearchParams(window.location.search);
const encodedPdfUrl = queryParams.get('file');
if (encodedPdfUrl) {
window.location.href = decodeURIComponent(encodedPdfUrl);
return; // 跳转后立即终止后续执行
}
}
// 处理域名修复(仅在未触发PDF跳转时执行)
const currentHost = window.location.hostname;
if (currentHost.includes('-private') && currentHost.endsWith('.ykt.cbern.com.cn')) {
const newHost = currentHost.replace(/-private(?=\.)/g, '');
const newUrl = window.location.href.replace(currentHost, newHost);
if (newUrl !== window.location.href) {
window.location.replace(newUrl);
}
}
})();