// ==UserScript==
// @name 国家中小学智慧教育平台书籍下载
// @namespace github.com/hmjz100
// @version 0.5
// @description 自动跳转到PDF页面,精简页面
// @author Hmjz100
// @match *://basic.smartedu.cn/*
// @match *://*.zxx.edu.cn/*
// @icon https://basic.smartedu.cn/favicon.ico
// @license MIT
// @require https://unpkg.com/sweetalert2@11/dist/sweetalert2.all.min.js
// @downloadURL none
// ==/UserScript==
(window.onload = function () {
'use strict';
var html = location.href;
var toast = Swal.mixin({
imageUrl: 'https://basic.smartedu.cn/img/logo-new.59a73b97.png',
allowOutsideClick: false,
showConfirmButton: false,
timerProgressBar: true,
showCloseButton: true,
});
var message = {
success: function (text) {
toast.fire({ html: text, icon: 'success' });
},
error: function (text) {
toast.fire({ html: text, icon: 'error' });
},
warning: function (text) {
toast.fire({ html: text, icon: 'warning' });
},
info: function (text) {
toast.fire({ html: text, icon: 'info' });
},
question: function (text) {
toast.fire({ html: text, icon: 'question' });
}
};
function repair(i) {
if (i >= 0 && i <= 9) {
return "0" + i;
} else {
return i;
}
}
function timer() {
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 APM() {
var date = new Date();
var hour = date.getHours();
var hourtext = '';
if (hour >= 0 && hour <= 10) {
hourtext = '早上好';
} else if (hour > 10 && hour <= 14) {
hourtext = '中午好';
} else if (hour > 14 && hour <= 18) {
hourtext = '下午好';
} else if (hour > 18 && hour <= 24) {
hourtext = '晚上好';
}
return hourtext;
}
if (html !== null && html.match("goTip") != -1) {
var clickurl = document.getElementsByClassName("index-module_open_1MwDX");
let link = document.querySelector(".index-module_link_QB2h9")
if (clickurl && link) {
let tips = clickurl[0].innerHTML.replace("继续访问", "打开链接(安全)");
clickurl[0].innerHTML = tips;
message.info('链接获取成功!
您可以右键点击下面的“点击直接跳转”按钮
并选择“链接另存为...”来另存教材PDF,
部分浏览器支持点击按钮后直接预览教材
(加载预览速度较慢)
点击直接跳转');
//setTimeout(function () {
// clickurl[0].click();
//}, 3000);
}
}
var notice = document.getElementsByClassName('index-module_header-content_Usvn5');
if (notice) {
setTimeout(function () {
notice[0].innerHTML += '