// ==UserScript==
// @name 国家智慧教育公共服务平台助手(原国家中小学智慧教育平台书籍下载)
// @namespace github.com/hmjz100
// @version 1.0.3
// @description 《也许同类型中最好用?》系列 - 国家智慧教育公共服务平台辅助工具,顶栏毛玻璃,页脚一言诗,增强原有 PDFJS 预览页面,可使用网页全屏、下载 PDF 等功能,确保舒适地在线看书;国家中小学智慧教育平台支持免登录查看文档和单个视频,显示隐藏黑暗模式,教材原件 PDF 支持切换版本、多版本批量下载等
// @author hmjz100
// @match *://*.smartedu.cn/*
// @match *://*.edu.cn/*
// @match *://*.eduyun.cn/*
// @icon data:image/webp;base64,UklGRvYNAABXRUJQVlA4IOoNAACQUQCdASpoAWgBPlEok0YjoqIhIvR4iHAKCWVu/HyZcemVJf0/4weFdX7v/5MfmL849ffnv3t/KHl56x/wHoneQfpH/C/v35PfOn/Weon85/773BP0r/1P9s/JTuJeYD9ef2f97v0Of6D1CP6n/pusn9Cr9t/TT/cP4Zv26/bf2jv/z2f/Sn9bP8Z2v/5n9XutS9xTFbiv47+AYkHirqEewP9LvE4APrHxLeCbh+6AH6A9GDQI9chs21NqbU2ptTam1NqbU2ptTam1NqbU2ptTam1NqbU2ptTam1NqbU2ptTam1NqbU2ptTam1NqbU2ptTam1NqbU2ptTaW1lBgn1cbwPqsCJmOJOCNRA0BoDP411GD4cO0VgzHuKafHYn9zURfStq45mBBCCEEIEIF54yangINI9Ro9NFab2XOkqA0Bm1GjidEfXJiIqWPG/d1DmVVx/CxFvlfEzYEDtlcHpEIIQQdCEtgc4UvZ1ar5GfNpo+mJRBNCkXaBLDIq4LAZ5KqDzY2xtjGK/4NLmYZHihyA/8bvLgF3fO3bGfcr/FJ+ebbU2ptSzrBxUvyMkKikFiMzHy/bl+62dlifQaL2bJxPiefVWHluOs18wlKIk6EJRQoo9QN23nHP/P+sf7NcWFdN2BKepI7Bpn+V2R975eeCNRArynjHLtd4qEXztz3JE3+4k8n0uEMsz7XAAb7kqWG11A5Pe089wMHho9j+a0qQWAsBV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ul7s+B8SNpz1PnFqDI/yU+pClMzswBeUpPOGnZgEdol4MgZ1wW1cWz4an/8T9AN5dyjV/Z+SAeWgxnulM6MsA9Aa4lTYnihAov+OPOwu28by5B+03lkomjklj9V0kK7ak+9C242fGwb1l3/OXuDTPoD5sdezTKGb4KBnAGf5kjeQZyXhOArJ8cnewHvACWOyub90YtH7eRWqjCmwxMd8UNgncTnKqClTBq/FpscMuDtvf6n7GIkw5Y8KlBK8+/Gb9hCGnRUS4E2ZjYsYLz13ZH4W1/7/2J32ok3d31TELunCjJkzifLLCZcV6ig4uzv7zJ1ox/r4uUJ7lKK4HuawoFjKkfOzXnjvhDiCpBE0V9DARiiZCFBRcg1AjyJT/9BcduJmCMnlPM32gSHwLNgKgPHFSEayfB38zYYOMT0q++OuJno5YKBKL3tw5YYS3QY+eovOPweajK1tv7a0/waPJZM+PihtUk9IWukV1Fwhp+ZBeQlrqKd9HA/SQ8ieDOBLCbkSXNA3qCQodHARc+uM7ds/wuRy2e5YjcSepdyXd1kdEALbEPPjOLOY/EGjBGLZYHTRF6+BALDVEXKQXNskJ/0KIEPoxqE9qsOYrWdbsauiLwuzI5Ef4NCr/PhPF2wF8wNGlOcPpgK+je75Yn1rm0LQqAzgngHPDVbQE0MoCP24ASn17LwAa4Lg3EHI8KOM7wEopsXVFnhaUo6eIaVY8LsFt+cbLjlXS3IUGrzA7FU5nRsIgvw6X34WJXueUGF90AAAAAAAAAAAAA
// @license MIT
// @grant GM_getResourceText
// @grant GM_xmlHttpRequest
// @grant GM.xmlHttpRequest
// @grant unsafeWindow
// @connect smartedu.cn
// @connect edu.cn
// @connect eduyun.cn
// @connect ykt.cbern.com.cn
// @connect hitokoto.cn
// @require https://unpkg.com/jquery@3.6.3/dist/jquery.min.js
// @require https://unpkg.com/hls.js@1.5.10/dist/hls.min.js
// @require https://unpkg.com/artplayer@5.1.6/dist/artplayer.legacy.js
// ==/UserScript==
(async function SmartEduDownload() {
'use strict';
/*
防止代码因其他原因被执行多次
这段代码出自 Via轻插件,作者谷花泰
*/
const key = encodeURIComponent('国家中小学智慧教育平台助手:主代码');
if (unsafeWindow[key]) return;
unsafeWindow[key] = true;
Artplayer.LOG_VERSION = false
console.log("【国家中小学智慧教育平台助手】即时\n运行中…")
unsafeWindow.open = function (url, name, specs) {
const cUrl = new URL(location.href);
if (cUrl.searchParams.get('x-edu-theme') === 'dark') {
const xUrl = new URL(url, location.href);
if (xUrl.host === location.host) {
xUrl.searchParams.set('x-edu-theme', 'dark');
return window.open.call(window, xUrl.href, name, specs);
}
}
return window.open.call(window, url, name, specs);
};
addDownStyle();
// 给顶栏加个时钟
let img_question = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAYAAAAe2bNZAAAFr0lEQVRYR+2Yf0yUdRzH35/v3fHAHQgTTvwBp/grhkMrBfNHSm1WOsv0/FErHYhBq0XZXNocjaktV9NqljoTTlFXuWOZy5kxsZVpQpLatB8uhbt0IAcuAYG7555Pe+4AOTjuR7D+6rvdds/z/Xw/n9f38+v7PA9hgIOtU1MBcRYQc2npuUsDUUcDWayu5cNTZ0OI70G0kMyVxwai73+Y/rw3GJ5JhxA/gzCDzFVVgxomtmRFIrptDpaeKycCh6KcD6dF0/IrLaHIevLsy1kxtOiH5t7yfTzDZdMfASsVIOzFkqq8/oASV9YZJEmTSjInsoY0xMLBkuY3266424GguCwzF8y7IXgBLfmpvKdsXxgGoSzjAwAFAJXAXLmmG6iItSZ702IA2WCeAUDbyzADfImBQ26tq/TmnpF3e86zddrLAO0AUAFJeYqePO8z32/OsHXaNoBeh6D7aEnlH8nZjgwS+BhAaojhqGPwOnuJ8agnNNbpEwDld4COo1lvppxv24OGyWcnRzKS6ekqe3JOYw4Rb/PjiaBczPjQbol/i5mALzIeh9xaQcuvOP0tDFpNphzH8yCPRzyycQaicSM04uJ12S27g7J0CvB2W4mxKJh0QJik7KZ0IZRTACJURemjteL9NdFRKtCJC07XxtLWjmAGuuaZsMpenHAkkHxAGFOO4ygIWao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zCHv0OZtG5t3U61wRD7FgQ7/a7sH0Do/6ADV4MB6AZawZY2icwEKkMLl7vxsBLPIBnuvvkBx8mC6XFLEYXlsXL2miot3s1DBp2uUO121Jq5sPoaT78xyD6u3FCTvDjlGIp3Lf1rNp8ir1e0w/Bn+hwoub/zuYzem7Acrvx+CPVHjpXyXwP90cMDVxjeg3AAAAAElFTkSuQmCC"
waitForKeyElements('[class^="index-module_menu-container_"]', (element) => {
var timebar = $(`<div class="index-module_tip"><img src="${img_question}"/><span id="smartEduGreeting"></span>,现在是<span id="smartEduTime"></span>感谢您使用本脚本~</div>`);
timebar.append(`<a title="赏个好评" style="display: inline-flex"><svg id="smartEduGood"><use xlink:href="#web_icon_dianzan_fill"></use></svg></a>`);
timebar.find("#smartEduGood").on('click', function () {
window.open('https://greasyfork.org/scripts/459404/feedback', '_blank')
})
if (/((en.|)basic.smartedu.cn|(xue\-test|web\-bd|en\-test|test\d).ykt.eduyun.cn)/.test(location.host)) {
timebar.append(`<a title="更换主题" style="display: inline-flex"><svg id="smartEduTheme"><use xlink:href="#huabishezhi"></use></svg></a>`);
timebar.find("#smartEduTheme").on('click', function () {
let url = new URL(location);
if (url.searchParams.get("x-edu-theme") === 'dark') {
url.searchParams.delete('x-edu-theme');
} else {
url.searchParams.set("x-edu-theme", "dark");
}
$(this).remove();
location.href = url.toString();
});
// 默认收起侧栏
waitForKeyElements('[class^="index-module_collapse_"]', (element) => {
element.click();
}, true)
}
if (element && element.length > 0) {
element.after(timebar);
window.setInterval(function () {
timebar.find("#smartEduTime").text(Time());
timebar.find("#smartEduGreeting").text(Greeting());
}, 500);
}
}, true);
// 移除顶部客户端相关内容
if (location.host !== 'www.smartedu.cn') waitForKeyElements('[class^="index-module_top-bar"], [class^="index-module_download"], [class^="index-module_float-download"], #app div.bg-no-repeat div[class^="bg"], #app header.el-header.plang div.topLine1, div.header div.headbar', (element) => {
element.remove()
}, true)
// 给底栏增加个一言
waitForKeyElements('.main-wrapper #main-content div.content', (element) => {
var poembar = $(`<div class="index-module_tip"><img src="${img_question}"/><span class="todayPoem"></span></div>`)
if (element && element.length > 0) {
let text = poembar.find(".todayPoem")
element.after(poembar)
text.on('click', function () {
if (text.text() === "加载中……") return;
text.text("加载中……")
text.css({ "cursor": "default" });
Poem(text)
})
text.text("加载中……")
text.css({ "cursor": "default" });
Poem(text)
}
}, true)
// 教材选择页加个下载按钮
waitForKeyElements('li[class^="index-module_item"]', listElement);
function listElement(element) {
if (!element.find('[class^="index-module_cover"] img[src]')[0]) return;
let base = element.find('[class^="index-module_cover"] img[src]')[0].src.match(/r(\d)-ndr/)[1]
let contentId = element.find('[class^="index-module_cover"] img[src]')[0].src.match(/([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/i)[1]
let data = {
titleNew: element.find('[class^="index-module_line"] span[title]')[0].title,
titleOld: element.find('[class^="index-module_line"] span[title]')[0].title + " 旧版",
urlNew: `https://r${base}-ndr.ykt.cbern.com.cn/edu_product/esp/assets/${contentId}.pkg/pdf.pdf`,
urlOld: `https://r${base}-ndr.ykt.cbern.com.cn/edu_product/esp/assets_document/${contentId}.pkg/pdf.pdf`
}
element.css({ "border-bottom": "none" })
let button = $(`
<li style="display: flex;">
<div class="index-module_item read new">
<svg><use xlink:href="#web_icon_wodeyuedu"></use></svg>
<span class="text">阅读</span>
</div>
<div class="index-module_item download new">
<svg><use xlink:href="#pc_icon_xiazai-fill"></use></svg>
<span class="text">下载</span><span class="size"></span>
</div>
<div class="index-module_item read old">
<svg><use xlink:href="#web_icon_wodeyuedu"></use></svg>
<span class="text">阅读旧版</span>
</div>
<div class="index-module_item download old">
<svg><use xlink:href="#pc_icon_xiazai-fill"></use></svg>
<span class="text">下载旧版</span><span class="size"></span>
</div>
</li>`)
element.after(button)
getFileSize(data.urlNew).then(size => {
button.find('.index-module_item.download.new .size').text(`(${formatFileSize(size)})`);
}).catch(() => {
button.find('.index-module_item.read.new').off('click').text("暂无新版...");
button.find('.index-module_item.download.new').off('click').text("暂无新版...");
});
getFileSize(data.urlOld).then(size => {
button.find('.index-module_item.download.old .size').text(`(${formatFileSize(size)})`);
}).catch(() => {
button.find('.index-module_item.read.old').off('click').text("暂无旧版...");
button.find('.index-module_item.download.old').off('click').text("暂无旧版...");
});
button.find(".index-module_item.read.new").on('click', async function () {
unsafeWindow.window.open(`//${location.host}/tchMaterial/detail?contentType=assets_document&contentId=${contentId}&catalogType=tchMaterial&subCatalog=tchMaterial`, "_blank")
})
button.find(".index-module_item.read.old").on('click', async function () {
unsafeWindow.window.open(`//${location.host}/tchMaterial/detail?contentType=assets_document&contentId=${contentId}&catalogType=tchMaterial&subCatalog=tchMaterial&contentOld=true`, "_blank")
})
button.find(".index-module_item.download").on('click', async function () {
let element = $(this)
let ins = {};
let progress = {};
let index = element.data('index');
let orgtext = element.find('.text').text()
element.prop('disabled', true);
ins[index] = setInterval(function () {
let prog = +progress[index] || 0;
element.find('.text').text(prog + "%");
}, 10);
try {
let response = await fetch(element.hasClass('old') ? data.urlOld : data.urlNew);
if (!response.ok) throw new Error('网络响应失败');
let totalSize = response.headers.get('Content-Length') || 0;
let reader = response.body.getReader();
let receivedLength = 0;
let chunks = [];
while (true) {
const { done, value } = await reader.read();
if (done) break;
chunks.push(value);
receivedLength += value.length;
progress[index] = Math.floor((receivedLength / totalSize) * 100);
}
let blob = new Blob(chunks);
clearInterval(ins[index]);
progress[index] = 100;
element.find('.text').text("完成~");
// 下载文件
const downloadUrl = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = downloadUrl;
a.download = `${element.hasClass('old') ? data.titleOld : data.titleNew}.pdf`;
a.click();
URL.revokeObjectURL(downloadUrl);
setTimeout(function () {
element.find('.text').text(orgtext);
$(this).prop('disabled', false);
}.bind(this), 3000);
} catch (error) {
clearInterval(ins[index]);
element.find('.text').text("失败,重试?");
$(this).prop('disabled', false).one('click', async function () {
$(this).trigger('click');
});
}
});
// 使用 MutationObserver 监听 li 元素的删除
let observer = new MutationObserver((mutationsList) => {
for (let mutation of mutationsList) {
if (mutation.removedNodes.length > 0) {
mutation.removedNodes.forEach((node) => {
if (node === element[0]) {
button.remove();
observer.disconnect();
}
});
}
if (mutation.type === 'attributes' && mutation.attributeName === 'src') {
button.remove();
listElement(element);
observer.disconnect();
}
}
});
observer.observe(element.parent()[0], { childList: true });
observer.observe(element.find('[class^="index-module_cover"] img[src]')[0], { attributes: true });
}
let contentType = new URL(location.href).searchParams.get("contentType") || '';
let contentId = new URL(location.href).searchParams.get("contentId") || '';
let resourceId = new URL(location.href).searchParams.get("resourceId") || '';
let contentOld = new URL(location.href).searchParams.get("contentOld") || '';
// 若是教材阅读页
if (/^\/tchMaterial\/detail/.test(location.pathname) && (contentType === 'assets_document' || contentType === 'x_document') && contentId) {
try {
// 教材信息
let data = await Promise.any(["1", "2", "3"].map(async base => {
try {
let data = await request({
url: `https://s-file-${base}.ykt.cbern.com.cn/zxx/ndrv2/resources/tch_material/details/${contentId}.json`,
headers: {
"referer": "https://basic.smartedu.cn/",
'Cache-Control': 'no-cache'
}
});
let item = {
id: data.id,
title: data.global_title['zh-CN'],
cover: data.custom_properties?.thumbnails[0],
author: data.provider_list[0]?.name,
url: `https://r${base}-ndr.ykt.cbern.com.cn/edu_product/esp/assets/${contentId}.pkg/pdf.pdf`,
};
if (contentOld === "true") {
item.title = data.global_title['zh-CN'] + ' 旧版'
item.url = `https://r${base}-ndr.ykt.cbern.com.cn/edu_product/esp/assets_document/${contentId}.pkg/pdf.pdf`
}
return item
} catch (error) {
console.error('【国家中小学智慧教育平台助手】\n获取数据时发生错误:', error);
}
}));
// 遇到默认弹窗
waitForKeyElements('div.fish-modal-content div.fish-modal-body div.fish-modal-confirm-body-wrapper', (elemlogin) => {
if (!elemlogin.find('div.fish-modal-confirm-content').text().match("需要登录才可以查看")) return;
waitForKeyElements('div[class^="index-module_special-edu-detail_"] div[class^="index-module_content-wrap_"] div[class^="index-module_wrapper_"]', (element) => {
// 点击登录提示中隐藏的取消按钮
elemlogin.find('button[type="button"].fish-btn').filter(function () {
return $(this).text().includes("取 消");
}).click();
// 既然不给页面内容,那就抄一个放上去吧
element.html(`
<div class="imageList-module_special-edu-image_A7C2c">
<div class="index-module_header_tG-zz">
<h3 class="index-module_title_bnE9V">${data.title}</h3>
<div class="index-module_info_evO1d">
<span class="index-module_origin_nuihE">
<svg class="index-module_icon_dwVZ4"><use xlink:href="#icon_hotel_fill"></use></svg>
<span class="index-module_department_ewVZW">${data.author}</span>
<svg class="index-module_icon_dwVZ4"><use xlink:href="#icon_information_fill"></use></svg>
<span class="index-module_department_ewVZW" title="所有平台资源均免费使用,任何单位及个人不得用于商业行为">所有平台资源均免费使用,任何单位及个人不得用于商业行为</span>
</span>
<div class="index-module_extra_tUQog">
<span class="index-module_origin_nuihE">
<svg class="index-module_icon_dwVZ4"><use xlink:href="#icon_star_fill"></use></svg>
<div>感谢您使用本脚本~</div>
</span>
<!--div class="index-module_like-wrap_NbyLe ">
<svg class="index-module_like_qOb9K"><use xlink:href="#web_icon_dianzan_fill"></use></svg>
<div class="index-module_like-count_GXOGd" onclick="window.open('https://greasyfork.org/scripts/459404/feedback','_blank')">赏个好评?</div>
</div-->
</div>
</div>
</div>
<div class="index-module_divider_rI-lg"></div>
<div class="imageList-module_special-edu-image-list-wrapper_18zfs">
<div class="imageList-module_special-edu-image-list_+ywag" style="max-width: unset;">
<div class="course-document">
<div class="document-context" style="overflow: hidden; height: 100%">
<iframe id="pdfPlayerFirefox"
src="/pdfjs/2.13/web/viewer.html?file=${data.url}&disableAutoFetch=true&page=1"
frameborder="0" height="100%" width="100%"></iframe>
</div>
</div>
</div>
</div>
</div>`)
}, true)
})
} catch (error) {
console.error('【国家中小学智慧教育平台助手】\n获取数据时发生错误:', error);
}
}
// 若是文档阅读页
if ((contentType === 'assets_document' || contentType === 'x_document') && contentId && !/^\/tchMaterial\/detail/.test(location.pathname)) {
try {
// 文档信息
let data = await Promise.any([1, 2, 3].map(async base => {
try {
let data = await request({
url: `https://s-file-${base}.ykt.cbern.com.cn/zxx/ndrs/special_edu/resources/details/${contentId}.json`,
headers: {
"referer": "https://basic.smartedu.cn/",
'Cache-Control': 'no-cache'
}
});
let item = {
id: data.id,
title: data.global_title['zh-CN'],
cover: data.custom_properties?.thumbnails[0],
author: data.provider_list[0]?.name,
url: data.ti_items[0]?.ti_storages[base - 1]
};
return item
} catch (error) {
console.error('【国家中小学智慧教育平台助手】\n获取数据时发生错误:', error);
}
}));
waitForKeyElements("div.course-document div.viewerContainer", (element) => {
element.html(`
<div class="document-context" style="overflow: hidden; height: 100%;">
<iframe id="pdfPlayerFirefox"
src="/pdfjs/2.13/web/viewer.html?file=${data.url}&disableAutoFetch=true&page=1"
frameborder="0" height="100%" width="100%"></iframe>
</div>
`)
element.css({ "border-radius": "8px" })
element.parent().css({ "border-radius": "8px" })
element.parent().parent().css({ "border-radius": "8px" })
waitForKeyElements('div.course-document div[class^="doc-"]', (element) => {
element.css({ "display": "none" })
})
})
} catch (error) {
console.error('【国家中小学智慧教育平台助手】\n获取数据时发生错误:', error);
}
}
// 若是视频播放页
if ((contentType === 'assets_video' || contentType === 'x_video') && contentId) {
try {
// 视频信息
let data = await Promise.any([1, 2, 3].map(async base => {
try {
let data = await request({
url: `https://s-file-${base}.ykt.cbern.com.cn/zxx/ndrs/special_edu/resources/details/${contentId}.json`,
headers: {
"referer": "https://basic.smartedu.cn/",
'Cache-Control': 'no-cache'
}
});
let item = {
id: data.id,
title: data.global_title?.['zh-CN'],
cover: data.custom_properties?.thumbnails?.[0],
author: data.provider_list?.[0]?.name,
url: null,
urls: []
};
let seenMd5 = new Set();
let maxQuality = null;
data.ti_items.forEach(ti_item => {
let md5 = ti_item.ti_md5;
if (!seenMd5.has(md5) && ti_item?.custom_properties?.requirements) {
let quality = null;
ti_item.custom_properties.requirements.forEach(req => {
if (req.name === 'Height') {
quality = Number(req.value);
if (maxQuality === null || quality > maxQuality) {
maxQuality = quality;
}
}
});
let url = {
"url": ti_item.ti_storages[base - 1],
"html": quality <= 360 ? `流畅 ${quality}P` : quality <= 480 ? `标清 ${quality}P` : quality <= 720 ? `高清 ${quality}P` : quality <= 1080 ? `全高清 ${quality}P` : quality <= 1440 ? `2K ${quality}P` : quality <= 2160 ? `超高清 4K ${quality}P` : `${quality}P`,
"quality": quality
};
item.urls.push(url);
seenMd5.add(md5);
}
});
item.urls.sort((a, b) => (b.quality || 0) - (a.quality || 0));
item.urls.forEach(url => {
if (url.quality === maxQuality) {
url.default = true;
item.url = url.url
}
});
return item
} catch (error) {
console.error('【国家中小学智慧教育平台助手】\n获取数据时发生错误:', error);
}
}));
console.log(data)
waitForKeyElements("div.course-video div.fish-video", (element) => {
element.html(`
<div class="index-module_art-player" style="overflow: hidden; height: auto; width: auto; aspect-ratio: 16/9; border-radius: 8px;">
</div>
`)
play(data.id, data.url, data.urls, data.cover, (art) => {
art.controls.add({
name: 'hideList',
index: 50,
position: 'right',
html: '<i class="art-icon"><svg height="21" width="21"><use xlink:href="#icon-laoshixinxi-liner"></use></svg></i>',
tooltip: '宽屏模式',
click: function () {
$('[class^="index-module_comp-related-recommend"]').fadeToggle()
},
})
})
element.css({ "height": "auto", "width": "auto", "aspect-ratio": "16/9" })
element.parent().css({ "border-radius": "8px", "height": "auto", "width": "auto" })
element.parent().parent().css({ "border-radius": "8px", "height": "auto", "width": "auto" })
}, true)
} catch (error) {
console.error('【国家中小学智慧教育平台助手】\n获取数据时发生错误:', error);
}
}
/* 若是多视频播放页
if (contentType === 'thematic_course' && contentId) {
}*/
// 遇到 PDF 预览器的 iframe
waitForKeyElements("iframe[src*='/web/viewer.html']", (element) => {
let parent = element.parent();
let button = $(`
<div class="index-module_pdf-control left">
<button class="index-module_pdf-button index-module_pdf-rating" onclick="window.open('https://greasyfork.org/scripts/459404/feedback','_blank')">
<svg><use xlink:href="#web_icon_dianzan_fill"></use></svg>
<span class="text">赏个好评</span>
</button>
<button class="index-module_pdf-button index-module_pdf-refresh">
<svg><use xlink:href="#pc_icon_shuaxin_line"></use></svg>
<span class="text">刷新</span>
</button>
</div>
<div class="index-module_pdf-control right">
<button class="index-module_pdf-button index-module_pdf-download" title="如果此按钮无法下载,请点击下方工具栏的下载按钮">
<svg><use xlink:href="#pc_icon_xiazai-fill"></use></svg>
<span class="text">下载</span>
</button>
<button class="index-module_pdf-button index-module_pdf-fullscreen">
<svg><use xlink:href="#web_icon_fullscreen"></use></svg>
网页全屏 (Esc)
</button>
</div>`)
element.parent().parent().css({ "border-radius": "8px", "border": "5px solid #232d2a", "background": "#232d2a" })
element.parent().parent().parent().css({ "border-radius": "8px", "border": "5px solid #232d2a", "background": "#232d2a" })
element.css({ "background": "#232d2a" })
let pdfWindow = element[0].contentWindow
button.find('.index-module_pdf-refresh').on('click', function () {
let element = $(this)
element.find('.text').text('等待');
pdfWindow.location.reload();
pdfWindow.onload = element.find('.text').text('刷新');
})
button.find('.index-module_pdf-fullscreen').on('click', function () {
let element = $(this)
if (!parent.hasClass('fullscreen-div')) {
// 进入全屏模式
$('body').addClass('no-scroll');
parent.addClass('fullscreen-div');
element.html('<svg><use xlink:href="#web_icon_fullscreen-exit"></use></svg>退出全屏 (Esc)');
$('#header').fadeToggle();
button.find('.index-module_pdf-rating').fadeToggle();
button.find('.index-module_pdf-refresh').fadeToggle();
button.find('.index-module_pdf-download').fadeToggle();
} else {
// 退出全屏模式
$('body').removeClass('no-scroll');
parent.removeClass('fullscreen-div');
element.html('<svg><use xlink:href="#web_icon_fullscreen"></use></svg>网页全屏 (Esc)');
$('#header').fadeToggle();
button.find('.index-module_pdf-rating').fadeToggle();
button.find('.index-module_pdf-refresh').fadeToggle();
button.find('.index-module_pdf-download').fadeToggle();
}
});
$(document).off('keydown').on('keydown', function (event) {
if (event.key === 'Escape' || event.which === 27) button.find('.index-module_pdf-fullscreen').click();
});
element.on('load', function () {
const iframeDocument = this.contentDocument || this.contentWindow.document;
$(iframeDocument).off('keydown').on('keydown', function (event) {
if (event.key === 'Escape' || event.which === 27) {
button.find('.index-module_pdf-fullscreen').click();
}
});
});
button.find('.index-module_pdf-download').on('click', async function () {
let src = new URL(pdfWindow.location.href)
let title = $("document").find('[class^="index-module_line"] span[title]').attr("title") || document.title
let data = {
title: title,
url: src.searchParams.get("file")
}
let element = $(this)
let ins = {};
let progress = {};
let index = element.data('index');
element.prop('disabled', true);
ins[index] = setInterval(function () {
let prog = +progress[index] || 0;
element.find('.text').text(prog + "%");
}, 10);
try {
let response = await fetch(data.url);
if (!response.ok) throw new Error('网络响应失败');
let totalSize = response.headers.get('Content-Length') || 0;
let reader = response.body.getReader();
let receivedLength = 0;
let chunks = [];
while (true) {
const { done, value } = await reader.read();
if (done) break;
chunks.push(value);
receivedLength += value.length;
progress[index] = Math.floor((receivedLength / totalSize) * 100);
}
let blob = new Blob(chunks);
clearInterval(ins[index]);
progress[index] = 100;
element.find('.text').text("完成~");
// 下载文件
const downloadUrl = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = downloadUrl;
a.download = `${data.title}.pdf`;
a.click();
URL.revokeObjectURL(downloadUrl);
setTimeout(function () {
element.find('.text').text("下载");
$(this).prop('disabled', false);
}.bind(this), 3000);
} catch (error) {
clearInterval(ins[index]);
console.error("下载失败:", error);
element.find('.text').text("失败,重试?");
$(this).prop('disabled', false).one('click', async function () {
$(this).trigger('click');
});
}
});
element.before(button)
})
// 预览页面增强
if (/^\/pdfjs\/.*\/web\/viewer.html/.test(location.pathname) || /^\/web\/viewer.html/.test(location.pathname)) {
let file = new URL(location.href).searchParams.get("file");
if (file) {
let noPrivateFile = file.replace(/(r\d)-ndr-\w+/, '$1-ndr');
let url = new URL(`${location.origin}${location.pathname}?file=${noPrivateFile}&disableAutoFetch=true&page=1`).toString()
if (url !== location.href) location.replace(url);
}
if (file.includes("edu_product/esp/assets/") || file.includes("edu_product/esp/assets_document/")) {
let version
if (file.includes('edu_product/esp/assets/')) {
file = file.replace('edu_product/esp/assets/', 'edu_product/esp/assets_document/')
version = '旧版'
} else if (file.includes('edu_product/esp/assets_document/')) {
file = file.replace('edu_product/esp/assets_document/', 'edu_product/esp/assets/')
version = '新版'
}
let url = new URL(`${location.origin}${location.pathname}?file=${file}&disableAutoFetch=true&page=1`).toString()
getFileSize(file).then(size => {
let button = $(`
<style>
#switchVersion:before {
-webkit-mask-image: var(--secondaryToolbarButton-rotateCw-icon);
mask-image: var(--secondaryToolbarButton-rotateCw-icon);"
}
</style>
<button id="switchVersion" class="toolbarButton" title="切换到${version}教材(${formatFileSize(size)})" tabindex="12" aria-expanded="false">
<span>切换到${version}教材(${formatFileSize(size)})</span>
</button>`)
button.on('click', function () {
if (url !== location.href) location.replace(url);
})
$("#sidebarToggle").after(button)
});
}
$('html').css({
"background-color": "#232d2a",
"--body-bg-color": "#232d2a",
"--toolbar-bg-color": "#2a3632",
"--sidebar-toolbar-bg-color": "#2a3632",
"--doorhanger-border-color": "#232d2a",
"--doorhanger-bg-color": "#2a3632",
"--dropdown-btn-bg-color": "#232d2a",
"--button-hover-color": "#32403b",
"--doorhanger-hover-bg-color": "#32403b",
"--overlay-button-bg-color": "#232d2a",
"--overlay-button-hover-bg-color": "#32403b",
"--field-bg-color": "#232d2a",
"--field-border-color": "#32403b",
})
$('#loadingBar').css({ "height": "10px", "top": "-10px" })
$('#loadingBar .progress').css({ "border-radius": "50px" })
$('#toolbarViewerMiddle').attr('id', 'toolbarViewerLeft');
$('#viewerContainer').css({ "background-color": "#232d2a" })
$('#sidebarContent').css({ "background-color": "#2a3632" })
// 取消隐藏预览PDF页面的隐藏功能(例如下载等功能,打印没法用除外)
waitForKeyElements('button[hidden]:not(#print)', function (element) {
if (element.attr('hidden') !== undefined) {
element.removeAttr('hidden');
}
});
}
function Time() {
function repair(i) {
if (i >= 0 && i <= 9) {
return "0" + i;
} else {
return i;
}
}
var date = new Date();
var year = date.getFullYear();
var month = repair(date.getMonth() + 1);
var day = repair(date.getDate());
var hours = repair(date.getHours());
var minute = repair(date.getMinutes());
var second = repair(date.getSeconds());
var curTime = year + "年 - " + month + "月 - " + day + "日 " + hours + "时 : " + minute + "分 : " + second + "秒";
return curTime;
}
function Greeting() {
var date = new Date();
var hour = date.getHours();
var greeting = '';
if (hour >= 0 && hour <= 10) {
greeting = '早上好';
} else if (hour > 10 && hour <= 14) {
greeting = '中午好';
} else if (hour > 14 && hour <= 18) {
greeting = '下午好';
} else if (hour > 18 && hour <= 24) {
greeting = '晚上好';
}
return greeting;
}
async function Poem(element) {
try {
let data = await request({
data: "",
url: "https://v1.hitokoto.cn/?encode=json&c=i",
headers: {
"origin": "https://hitokoto.cn",
"referer": "https://hitokoto.cn",
'Cache-Control': 'no-cache'
}
})
// 使用数据更新页面元素
element.text(`「${data.hitokoto}」${data.from_who || ""}`);
element.css({ "cursor": "pointer" });
} catch (error) {
// 处理错误情况
console.error('获取诗词时发生错误:', error);
element.text('诗词加载失败');
element.css({ "cursor": "pointer" });
}
}
function request(option) {
return new Promise((resolve, reject) => {
let httpRequest = typeof GM_xmlhttpRequest !== "undefined" ? GM_xmlhttpRequest : GM.xmlHttpRequest;
httpRequest({
method: 'get',
...option,
onload: (response) => {
if (response.responseText === undefined) return;
let res = JSON.parse(response.responseText);
resolve(res);
},
onerror: (error) => {
reject(error);
},
});
});
}
function addStyle(id, tag, css) {
tag = tag || 'style';
let doc = document, styleDom = doc.getElementById(id);
if (styleDom) styleDom.remove();
let style = doc.createElement(tag);
style.rel = 'stylesheet';
style.id = id;
tag === 'style' ? style.innerHTML = css : style.href = css;
doc.getElementsByTagName('body')[0].appendChild(style);
}
function addDownStyle() {
const url = new URL(location);
let deColor = url.searchParams.get("x-edu-theme") === 'dark' ? "#0e9aff" : "#1e62ec";
let hvColor = url.searchParams.get("x-edu-theme") === 'dark' ? "#1e62ec" : "#4079ef";
let bgColor = url.searchParams.get("x-edu-theme") === 'dark' ? "rgba(42, 54, 50, 0.5)" : "rgba(255, 255, 255, 0.5)";
let spColor = url.searchParams.get("x-edu-theme") === 'dark' ? "#323e3a" : "#eee";
let css = `
a, button, ul li, ui, label, input, select {
transition: all 0.25s !important;
-webkit-transition: all 0.25s !important;
}
[class^="index-module_header-wrap_"], [class*="index-module_header"] {
height: auto !important;
}
[class^="index-module_header"] [class^="index-module_nav-normal"],
[class^="index-module_header-wrap_"] [class^="index-module_header"] .theme-menu-sticky {
height: auto !important;
-webkit-backdrop-filter: blur(15px);
backdrop-filter: blur(15px);
background-color: ${bgColor};
}
#smartEduTime{
margin: 0 5px;
color: ${deColor};
}
.index-module_tip {
cursor: default;
text-align: center;
display: inline-flex;
justify-content: center;
align-items: center;
margin: 10px 0;
width: 100%;
transition: all 0.3s !important;
-webkit-transition: all 0.3s !important;
}
.index-module_tip img,
.index-module_tip svg {
margin: 0 5px;
width: 20px;
height: 20px;
}
.index-module_tip svg {
color: ${deColor};
cursor: pointer;
}
.index-module_tip svg:hover {
color: ${hvColor};
transition: all 0.3s !important;
-webkit-transition: all 0.3s !important;
}
.index-module_pdf-control {
display: flex;
justify-content: center;
position: absolute;
top: 5%;
pointer-events: none;
width: auto !important;
height: auto !important;
}
.index-module_pdf-control.left {
left: 3%;
}
.index-module_pdf-control.right {
right: 3%;
}
.index-module_pdf-button {
background-color: ${deColor}cc;
text-align: center;
color: #fff;
padding: 7px 20px;
border-radius: 144.889px;
border: 0;
margin: 0 5px;
display: inline-flex;
vertical-align: middle;
pointer-events: all;
transition: all 0.3s !important;
-webkit-transition: all 0.3s !important;
}
.index-module_pdf-button:hover,.index-module_pdf-button:disabled {
background-color: ${hvColor}cc;
}
.index-module_pdf-button svg {
height: 18px;
width: 17px;
margin-right: 5px;
vertical-align: middle;
}
.index-module_item {
cursor: pointer;
font-size: 15px;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
vertical-align: middle;
display: flex;
align-items: center;
padding: 5px 0;
justify-content: center;
border-bottom: 1px solid ${spColor};
width: 25%;
transition: all 0.3s !important;
-webkit-transition: all 0.3s !important;
}
.index-module_item svg {
height: 20px;
width: 20px;
margin-right: 4px;
vertical-align: middle;
}
.index-module_item:hover {
color: #fff;
background-color: ${deColor};
}
div .fullscreen-div {
position: fixed !important;
top: 0 !important;
left: 0 !important;
width: 100% !important;
height: 100% !important;
z-index: 99999 !important;
}
::-webkit-scrollbar {
width: 10px;
height: 10px;
background-color: transparent;
z-index: 999999999999999;
}
::-webkit-scrollbar-thumb {
background: ${deColor};
border-radius: 3px;
z-index: 999999999999999;
}
::-webkit-scrollbar-thumb:hover {
background: ${hvColor};
z-index: 999999999999999;
}
.no-scroll {
overflow: hidden !important;
}
`;
addStyle('BasicSmartEdu-User', 'style', css);
return deColor
}
function play(id, url, urls, cover, actionFunction) {
var art = new Artplayer({
id: id,
container: '.index-module_art-player',
url: url,
volume: 1,
autoPlayback: true,
customType: {
m3u8: function (video, url, art) {
if (Hls.isSupported()) {
if (art.hls) art.hls.destroy();
const hls = new Hls();
hls.loadSource(url);
hls.attachMedia(video);
art.hls = hls;
art.on('destroy', () => hls.destroy());
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = url;
} else {
art.notice.show = 'Unsupported playback format: m3u8';
}
},
},
controls: [
{
name: 'goodRing',
index: 21,
position: 'left',
html: '<i class="art-icon"><svg height="21" width="21"><use xlink:href="#web_icon_dianzan_fill"></use></svg></i>',
tooltip: '赏个好评',
click: function () {
window.open('https://greasyfork.org/scripts/459404/feedback', '_blank')
},
}
],
icons: {
state: '<svg width="100" height="100" fill="none"><g opacity=".9"><path opacity=".5" d="M50 4.167C24.687 4.167 4.167 24.687 4.167 50c0 25.314 20.52 45.834 45.833 45.834 25.314 0 45.834-20.52 45.834-45.834 0-25.313-20.52-45.833-45.834-45.833Z" fill="#000"/><path d="M69.194 53.043 43.153 70.231a3.646 3.646 0 0 1-5.653-3.043V32.816a3.646 3.646 0 0 1 5.654-3.043l26.042 17.188c2.183 1.44 2.183 4.645 0 6.086-2.184 1.44 6.51-4.3-.002-.004Z" fill="#fff"/></g></svg>',
indicator: '<img width="16" heigth="16" style="border-radius:50px" src="data:image/webp;base64,UklGRvYNAABXR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njvhDiCpBE0V9DARiiZCFBRcg1AjyJT/9BcduJmCMnlPM32gSHwLNgKgPHFSEayfB38zYYOMT0q++OuJno5YKBKL3tw5YYS3QY+eovOPweajK1tv7a0/waPJZM+PihtUk9IWukV1Fwhp+ZBeQlrqKd9HA/SQ8ieDOBLCbkSXNA3qCQodHARc+uM7ds/wuRy2e5YjcSepdyXd1kdEALbEPPjOLOY/EGjBGLZYHTRF6+BALDVEXKQXNskJ/0KIEPoxqE9qsOYrWdbsauiLwuzI5Ef4NCr/PhPF2wF8wNGlOcPpgK+je75Yn1rm0LQqAzgngHPDVbQE0MoCP24ASn17LwAa4Lg3EHI8KOM7wEopsXVFnhaUo6eIaVY8LsFt+cbLjlXS3IUGrzA7FU5nRsIgvw6X34WJXueUGF90AAAAAAAAAAAAA">',
play: '<svg height="21" width="21"><use xlink:href="#app_icon_bofang_fill"></use></svg>',
pause: '<svg height="21" width="21"><use xlink:href="#app_icon_zanting_fill"></use></svg>',
setting: '<svg height="21" width="21"><use xlink:href="#app_icon_equipment_linear"></use></svg>',
fullscreenOn: '<svg height="21" width="21"><use xlink:href="#web_icon_fullscreen"></use></svg>',
fullscreenOff: '<svg height="21" width="21"><use xlink:href="#web_icon_fullscreen-exit"></use></svg>',
playbackRate: '<svg height="21" width="21"><use xlink:href="#web_icon_shijian_fill"></use></svg>',
aspectRatio: '<svg height="21" width="21"><use xlink:href="#ri-macbook-line"></use></svg>',
check: '<svg height="21" width="21"><use xlink:href="#ri-check-fill"></use></svg>',
flip: '<svg height="21" width="21"><use xlink:href="#PC_xuanzhuan"></use></svg>',
arrowUp: '<svg height="21" width="21"><use xlink:href="#icon_arrowUp_linear"></use></svg>',
arrowDown: '<svg height="21" width="21"><use xlink:href="#icon_arrowDown_linear"></use></svg>',
arrowLeft: '<svg height="21" width="21"><use xlink:href="#icon_arrowLeft_linear"></use></svg>',
arrowRight: '<svg height="21" width="21"><use xlink:href="#icon_arrowRight_linear"></use></svg>',
download: '<svg height="21" width="21"><use xlink:href="#pc_icon_xiazai-fill"></use></svg>',
info: '<svg height="17" width="17"><use xlink:href="#icon_information_fill"></use></svg>',
close: '<svg height="16" width="16"><use xlink:href="#pc_icon_guanbi_line"></use></svg>',
},
setting: true,
theme: addDownStyle(),
hotkey: true,
autoMini: true,
flip: true,
playbackRate: true,
aspectRatio: true,
miniProgressBar: true,
fullscreen: true,
fullscreenWeb: true,
})
cover ? (art.poster = cover) : ""
urls ? (art.quality = [...urls]) : ""
var contextmenuStyle = {
"display": "flex",
"justify-content": "center",
"align-items": "center",
"border-bottom": "none"
}
art.contextmenu.add({
name: 'appTitle',
index: 1,
html: `<img width="16" heigth="16" style="border-radius:50px" src="data:image/webp;base64,UklGRvYNAABXRUJQVlA4IOoNAACQUQCdASpoAWgBPlEok0YjoqIhIvR4iHAKCWVu/HyZcemVJf0/4weFdX7v/5MfmL849ffnv3t/KHl56x/wHoneQfpH/C/v35PfOn/Weon85/773BP0r/1P9s/JTuJeYD9ef2f97v0Of6D1CP6n/pusn9Cr9t/TT/cP4Zv26/bf2jv/z2f/Sn9bP8Z2v/5n9XutS9xTFbiv47+AYkHirqEewP9LvE4APrHxLeCbh+6AH6A9GDQI9chs21NqbU2ptTam1NqbU2ptTam1NqbU2ptTam1NqbU2ptTam1NqbU2ptTam1NqbU2ptTam1NqbU2ptTam1NqbU2ptTaW1lBgn1cbwPqsCJmOJOCNRA0BoDP411GD4cO0VgzHuKafHYn9zURfStq45mBBCCEEIEIF54yangINI9Ro9NFab2XOkqA0Bm1GjidEfXJiIqWPG/d1DmVVx/CxFvlfEzYEDtlcHpEIIQQdCEtgc4UvZ1ar5GfNpo+mJRBNCkXaBLDIq4LAZ5KqDzY2xtjGK/4NLmYZHihyA/8bvLgF3fO3bGfcr/FJ+ebbU2ptSzrBxUvyMkKikFiMzHy/bl+62dlifQaL2bJxPiefVWHluOs18wlKIk6EJRQoo9QN23nHP/P+sf7NcWFdN2BKepI7Bpn+V2R975eeCNRArynjHLtd4qEXztz3JE3+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FlfWeYHCFqzvoDYIj0rK8ikB3yfQ7hjRP/AOe1LSofUul7s+B8SNpz1PnFqDI/yU+pClMzswBeUpPOGnZgEdol4MgZ1wW1cWz4an/8T9AN5dyjV/Z+SAeWgxnulM6MsA9Aa4lTYnihAov+OPOwu28by5B+03lkomjklj9V0kK7ak+9C242fGwb1l3/OXuDTPoD5sdezTKGb4KBnAGf5kjeQZyXhOArJ8cnewHvACWOyub90YtH7eRWqjCmwxMd8UNgncTnKqClTBq/FpscMuDtvf6n7GIkw5Y8KlBK8+/Gb9hCGnRUS4E2ZjYsYLz13ZH4W1/7/2J32ok3d31TELunCjJkzifLLCZcV6ig4uzv7zJ1ox/r4uUJ7lKK4HuawoFjKkfOzXnjvhDiCpBE0V9DARiiZCFBRcg1AjyJT/9BcduJmCMnlPM32gSHwLNgKgPHFSEayfB38zYYOMT0q++OuJno5YKBKL3tw5YYS3QY+eovOPweajK1tv7a0/waPJZM+PihtUk9IWukV1Fwhp+ZBeQlrqKd9HA/SQ8ieDOBLCbkSXNA3qCQodHARc+uM7ds/wuRy2e5YjcSepdyXd1kdEALbEPPjOLOY/EGjBGLZYHTRF6+BALDVEXKQXNskJ/0KIEPoxqE9qsOYrWdbsauiLwuzI5Ef4NCr/PhPF2wF8wNGlOcPpgK+je75Yn1rm0LQqAzgngHPDVbQE0MoCP24ASn17LwAa4Lg3EHI8KOM7wEopsXVFnhaUo6eIaVY8LsFt+cbLjlXS3IUGrzA7FU5nRsIgvw6X34WJXueUGF90AAAAAAAAAAAAA">国家智慧教育公共服务平台助手`,
style: contextmenuStyle,
click: function () {
window.open('https://greasyfork.org/scripts/459404/feedback', '_blank')
},
})
art.contextmenu.update({
name: 'version',
index: 2,
html: `<img width="15" heigth="15" src="https://artplayer.org/assets/img/logo.png"/>Artplayer Ultra ${Artplayer.version}`,
click: function () {
window.open('https://artplayer.org/', '_blank')
},
style: contextmenuStyle
})
art.contextmenu.update({
name: 'info',
index: 40,
html: `${$(art.icons.info).html()}${art.i18n.language["Video Info"]}`,
style: contextmenuStyle
})
art.contextmenu.update({
name: 'close',
index: 50,
html: `${$(art.icons.close).html()}${art.i18n.language["Close"]}`,
style: contextmenuStyle
})
art.on('fullscreen', (state) => {
$('#header').fadeToggle();
$(art.controls.fullscreenWeb).toggle();
$(art.controls.hideList).toggle();
$(art.controls.goodRing).toggle();
if (!$('body').hasClass('no-scroll')) {
$('body').addClass('no-scroll');
} else {
$('body').removeClass('no-scroll');
}
});
art.on('fullscreenWeb', (state) => {
$('#header').fadeToggle();
$(art.controls.fullscreen).toggle();
$(art.controls.hideList).toggle();
$(art.controls.goodRing).toggle();
if (!$('body').hasClass('no-scroll')) {
$('body').addClass('no-scroll');
} else {
$('body').removeClass('no-scroll');
}
});
$(art.template.$container).find(".icon").removeClass("icon")
addStyle('Artplayer-User', 'style', `
.art-contextmenu svg, .art-contextmenu img {
vertical-align: top;
margin-right: 5px
}
`);
actionFunction ? actionFunction(art) : ""
}
// 格式化文件大小函数
function formatFileSize(bytes) {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
}
// 获取文件大小函数
function getFileSize(url) {
return new Promise((resolve, reject) => {
fetch(url, { method: 'HEAD' })
.then(response => {
if (!response.ok) throw new Error('网络响应失败');
let contentLength = response.headers.get('Content-Length');
resolve(parseInt(contentLength));
})
.catch(error => {
reject(error);
});
});
}
function waitForKeyElements(selectorTxt, actionFunction, bWaitOnce, iframeSelector) {
var targetbadges, btargetsFound;
if (typeof iframeSelector == "undefined")
targetbadges = $(selectorTxt);
else
targetbadges = $(iframeSelector).contents().find(selectorTxt);
if (targetbadges && targetbadges.length > 0) {
btargetsFound = true;
targetbadges.each(function () {
var jThis = $(this);
var alreadyFound = jThis.data('alreadyFound') || false;
if (!alreadyFound) {
var cancelFound = actionFunction(jThis);
if (cancelFound) {
btargetsFound = false;
} else {
jThis.data('alreadyFound', true);
}
}
});
} else {
btargetsFound = false;
}
var controlObj = waitForKeyElements.controlObj || {};
var controlKey = selectorTxt.replace(/[^\w]/g, "_");
var timeControl = controlObj[controlKey];
if (btargetsFound && bWaitOnce && timeControl) {
clearInterval(timeControl);
delete controlObj[controlKey];
} else {
if (!timeControl) {
timeControl = setInterval(function () {
waitForKeyElements(selectorTxt, actionFunction, bWaitOnce, iframeSelector);
}, 1000);
controlObj[controlKey] = timeControl;
}
}
waitForKeyElements.controlObj = controlObj;
}
$("head").before($(`
<svg aria-hidden="true" style="position: absolute; width: 0px; height: 0px; color: #fff; overflow: hidden;">
<symbol id="pc_icon_xiazai-fill" viewBox="0 0 1024 1024">
<path d="M815.402667 435.669333H549.973333V132.266667H474.026667v303.402666H208.64L512 739.072l303.402667-303.36zM853.333333 890.794667V814.933333H170.666667v75.861334h682.666666z" fill="#333333"></path>
</symbol>
<symbol id="icon_hotel_fill" viewBox="0 0 1024 1024">
<path d="M693.333333 843.861333h81.066667v-379.306666h-243.2v379.306666h81.066667V559.36h81.066666v284.458667z m-567.466666 0V132.693333C125.866667 106.538667 144 85.333333 166.4 85.333333h567.466667c22.4 0 40.533333 21.205333 40.533333 47.402667v237.056h81.066667v474.026667H896V938.666667H85.333333v-94.805334h40.533334z m162.133333-379.306666v94.848h81.066667V464.64h-81.066667z m0 189.653333v94.848h81.066667v-94.848h-81.066667z m0-379.264v94.848h81.066667V274.944h-81.066667z" fill="#333333"></path>
</symbol>
<symbol id="icon_question_fill" viewBox="0 0 1024 1024">
<path d="M512 938.666667C276.352 938.666667 85.333333 747.648 85.333333 512S276.352 85.333333 512 85.333333s426.666667 191.018667 426.666667 426.666667-191.018667 426.666667-426.666667 426.666667z m-42.666667-298.666667v85.333333h85.333334v-85.333333h-85.333334z m85.333334-70.186667A149.418667 149.418667 0 0 0 512 277.333333a149.376 149.376 0 0 0-146.474667 120.021334l83.712 16.768A64 64 0 1 1 512 490.666667a42.666667 42.666667 0 0 0-42.666667 42.666666V597.333333h85.333334v-27.52z">
</path>
</symbol>
<symbol id="icon_star_fill" viewBox="0 0 1024 1024">
<path d="M501.589333 821.504l-239.274666 133.930667a21.333333 21.333333 0 0 1-31.36-22.784l53.461333-268.928a21.333333 21.333333 0 0 0-6.442667-19.84l-201.386666-186.154667a21.333333 21.333333 0 0 1 11.989333-36.864l272.341333-32.298667a21.333333 21.333333 0 0 0 16.853334-12.245333l114.858666-249.002667a21.333333 21.333333 0 0 1 38.741334 0l114.858666 249.002667a21.333333 21.333333 0 0 0 16.853334 12.245333l272.341333 32.298667a21.333333 21.333333 0 0 1 11.946667 36.864l-201.344 186.154667a21.333333 21.333333 0 0 0-6.4 19.84l53.418666 268.928a21.333333 21.333333 0 0 1-31.36 22.784l-239.274666-133.930667a21.333333 21.333333 0 0 0-20.821334 0" fill="#333333"></path>
</symbol>
<symbol id="web_icon_dianzan_fill" viewBox="0 0 1024 1024">
<path d="M575.0784 133.48864L336.6912 371.79392a37.2736 37.2736 0 0 0-10.8544 26.33728v431.39072c0 20.56192 16.67072 37.2736 37.23264 37.2736h403.2512a37.2736 37.2736 0 0 0 34.44736-23.06048l115.26144-279.83872c3.6864-9.0112 5.57056-18.6368 5.57056-28.38528v-78.35648a74.46528 74.46528 0 0 0-74.46528-74.46528h-238.30528l42.92608-168.67328a55.86944 55.86944 0 0 0-20.60288-58.44992l-31.744-23.83872a18.59584 18.59584 0 0 0-24.3712 1.76128zM251.33056 419.92192H139.6736a37.2736 37.2736 0 0 0-37.23264 37.2736v372.3264c0 20.56192 16.67072 37.2736 37.2736 37.2736h111.65696v-446.8736z" fill="#333333"></path>
</symbol>
<symbol id="pc_icon_shuaxin_line" viewBox="0 0 1024 1024">
<path d="M512 128a382.506667 382.506667 0 0 0-251.008 93.44l38.272 68.906667A307.2 307.2 0 0 1 819.2 512h-115.2l122.496 220.416A384 384 0 0 0 512 128z m0 768a382.506667 382.506667 0 0 0 251.008-93.44l-38.272-68.906667A307.2 307.2 0 0 1 204.8 512h115.2L197.504 291.584A384 384 0 0 0 512 896z" fill="#333333"></path>
</symbol>
<symbol id="pc_icon_xiazai-fill" viewBox="0 0 1024 1024">
<path d="M815.402667 435.669333H549.973333V132.266667H474.026667v303.402666H208.64L512 739.072l303.402667-303.36zM853.333333 890.794667V814.933333H170.666667v75.861334h682.666666z" fill="#333333"></path>
</symbol>
<symbol id="web_icon_fullscreen" viewBox="0 0 1024 1024">
<path d="M682.666667 128h256v256h-85.333334V213.333333h-170.666666V128zM85.333333 128h256v85.333333H170.666667v170.666667H85.333333V128z m768 682.666667v-170.666667h85.333334v256h-256v-85.333333h170.666666zM170.666667 810.666667h170.666666v85.333333H85.333333v-256h85.333334v170.666667z" fill="#333333"></path>
</symbol>
<symbol id="web_icon_fullscreen-exit" viewBox="0 0 1024 1024">
<path d="M768 298.666667h170.666667v85.333333h-256V128h85.333333v170.666667zM341.333333 384H85.333333V298.666667h170.666667V128h85.333333v256z m426.666667 341.333333v170.666667h-85.333333v-256h256v85.333333h-170.666667zM341.333333 640v256H256v-170.666667H85.333333v-85.333333h256z" fill="#333333"></path>
</symbol>
<symbol id="huabishezhi" viewBox="0 0 1024 1024">
<path d="M189.013333 602.453333a176.341333 176.341333 0 0 1 39.808-80.256 177.28 177.28 0 0 1 246.613334-13.738666 176.810667 176.810667 0 0 1 60.245333 118.869333 176.341333 176.341333 0 0 1-39.936 126.976 331.477333 331.477333 0 0 1-176.768 105.472 332.373333 332.373333 0 0 1-205.226667-19.114667 118.613333 118.613333 0 0 0 81.749334-143.744c-1.408-1.450667-1.493333-3.2-1.621334-4.949333a176.426667 176.426667 0 0 1-4.821333-89.514667zM822.442667 85.333333c6.058667 0 11.946667 2.048 16.64 5.888a26.325333 26.325333 0 0 1 4.736 33.109334l-244.053334 372.693333a18.730667 18.730667 0 0 1-22.528 8.661333 18.816 18.816 0 0 1-7.338666-4.650666l-100.096-87.04a18.773333 18.773333 0 0 1-0.213334-28.928l336.213334-293.802667a26.325333 26.325333 0 0 1 16.64-5.930667zM337.066667 910.208h544.725333c-2.986667-2.986667-6.016-6.272-9.216-9.728-32.853333-36.138667-84.394667-92.8-348.245333-23.978667-101.205333 26.368-175.914667 33.706667-187.264 33.706667z">
</path>
</symbol>
</svg>
`))
})();