// ==UserScript==
// @name 国家中小学智慧教育平台书籍下载
// @namespace https://github.com/hmjz100/
// @version 0.2
// @description 自动跳转到PDF页面,精简页面
// @author Hmjz100
// @match *://basic.smartedu.cn/*
// @match *://*.zxx.edu.cn/*
// @icon https://basic.smartedu.cn/favicon.ico
// @license MIT
// @require https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.all.min.js
// @downloadURL none
// ==/UserScript==
window.onload = (function() {
var html = location.href
let toast = Swal.mixin({
imageUrl: 'https://basic.smartedu.cn/img/logo-new.59a73b97.png',
allowOutsideClick: false,
showConfirmButton: false,
timer: 5000,
timerProgressBar: true,
});
const message = {
success: (text) => {
toast.fire({html: text, icon: 'success'});
},
error: (text) => {
toast.fire({html: text, icon: 'error'});
},
warning: (text) => {
toast.fire({html: text, icon: 'warning'});
},
info: (text) => {
toast.fire({html: text, icon: 'info'});
},
question: (text) => {
toast.fire({html: text, icon: 'question'});
}
};
//补0
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();
// 设置默认文字
let hourtext = ``;
// 获取小时
var hour = date.getHours();
// 判断当前时间段
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.indexOf("goTip") != -1){
let clickurl = document.getElementsByClassName("index-module_open_1MwDX")
if (clickurl) {
message.info("正在加载PDF页面请稍等
请不要进行任何操作直至PDF打开!");
setTimeout(function(){
clickurl[0].click()
},5000)
}
}
let notice = document.getElementsByClassName('index-module_header-content_Usvn5');//获取
if (notice){
setTimeout(function(){
notice[0].innerHTML += '