// ==UserScript== // @name 国家中小学智慧教育平台书籍下载 // @namespace https://github.com/hmjz100/ // @version 0.1 // @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== (function() { 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'}); } }; var html = location.href function GetUrl () { if(html !== null && html.indexOf("catalogType") != -1){ return html.replace(/&catalogType+=[A-Za-z0-9]+/,"") } } function GetLastUrl () { if(html !== null && html.indexOf("assets_document") != -1){ return GetUrl().replace("assets_document","x_url") } } if(html !== null && html.indexOf("assets_document") != -1){ message.success("已替换该页面的书籍地址,正在加载PDF页面请稍等
如提示跳转到其他网站点击继续访问即可跳转PDF。
"); setTimeout(function(){ window.onload = window.location.href=GetLastUrl (); },5000) } })();