Greasy Fork is available in English.

国家中小学智慧教育平台教材PDF电子课本链接与下载工具

教材列表页与预览页添加了PDF按钮,免登录查看或下载电子课本与课外书籍,可批量下载,支持新课标教材

// ==UserScript==
// @name         国家中小学智慧教育平台教材PDF电子课本链接与下载工具
// @namespace    https://greasyfork.org/zh-CN/scripts/466598
// @version      2.1
// @description  教材列表页与预览页添加了PDF按钮,免登录查看或下载电子课本与课外书籍,可批量下载,支持新课标教材
// @match        *://basic.smartedu.cn/*
// @match        *://www.zxx.edu.cn/*
// @match        *.ykt.cbern.com.cn/*
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASAAAAEgCAYAAAAUg66AAAAACXBIWXMAACE4AAAhOAFFljFgAAAFyWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4wLWMwMDAgNzkuMTcxYzI3ZiwgMjAyMi8wOC8xNi0xODowMjo0MyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8x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BkoR7dp2ym5WtoxARYsnt1gplNyi7URo41W42AUoqJ2JC45T9SIxxPxQiQswvPKuUfV/ZpcpelxyW2rh6TstbuKa9svuU3aqsP34232tCTCU8cBJw0gGB5mP5+KH5FKBUr2uqGAGt8coCfO8JKZjoVIgxkh29e16UPBcWF0KAUuktRtvXycqGJbwiekaE5FZ0YJ8q+5sYYZKC1fAVWoBS6a7sQjECXsOV9VDmTb5OXjeEnJHYgGplu5StFiOm8w9lJ8zwAs0kQKn4xIgZDVBWrmxs4nP8WVtlbRJfQwgxCCs7LsZ4dYjN2oTgoEh4m7J9ia8xFf8PFcGK2BWm86QAAAAASUVORK5CYII=
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    if (window.location.href.includes("-private") && window.location.href.includes("=download")) {
        window.location.replace(window.location.href.replace("-private", ""));
    }

    const toolbarViewerRight = document.querySelector("#toolbarViewerRight");
    if (toolbarViewerRight && document.referrer.includes("basic.smartedu.cn")) { // 仅限 basic.smartedu.cn,排除全屏授课页面
        const hiddenElements = toolbarViewerRight.querySelectorAll("[hidden][data-l10n-id='download']");
        hiddenElements.forEach(function(element) {
            element.removeAttribute("hidden");
        });
    }

    // 样式
    const style = document.createElement("style");
    style.innerHTML = `
        /* iframe 全屏按钮样式 */
        .fullscreenMode:before {
            -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g><path d="M13,13h-2.7v2H14c0.6,0,1-0.4,1-1v-3.7h-2L13,13z"/><path d="M3,10.3H1V14c0,0.6,0.4,1,1,1h3.7v-2H3V10.3z"/><path d="M1,2v3.7h2V3h2.7V1H2C1.4,1,1,1.4,1,2z"/><path d="M14,1h-3.7v2H13v2.7h2V2C15,1.4,14.6,1,14,1z"/></g></svg>');
            mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g><path d="M13,13h-2.7v2H14c0.6,0,1-0.4,1-1v-3.7h-2L13,13z"/><path d="M3,10.3H1V14c0,0.6,0.4,1,1,1h3.7v-2H3V10.3z"/><path d="M1,2v3.7h2V3h2.7V1H2C1.4,1,1,1.4,1,2z"/><path d="M14,1h-3.7v2H13v2.7h2V2C15,1.4,14.6,1,14,1z"/></g></svg>');
        }
        /* 视频去水印 */
        .vjs-watermark {
            display: none !important;
        }
    `;
    document.head.append(style);

    function fullscreenSwitch() {
        const courseDocument = document.querySelector(".course-document");
        const html = document.querySelector("html");
        if (courseDocument.classList.contains("full-screen")) { // 当前处于"全屏状态",切换为"非全屏状态"
            courseDocument.classList.remove("full-screen");
            html.style.overflow = "";
        } else { // 当前处于"非全屏状态",切换为"全屏状态"
            courseDocument.classList.add("full-screen");
            html.style.overflow = "hidden";
        }
    }

    // iframe 向主页面发送全屏切换消息
    const iframeDownloadBtn = document.querySelector("#download");
    if (iframeDownloadBtn && !iframeDownloadBtn.hidden) {
        const fullscreenBtn = document.createElement("button");
        fullscreenBtn.className = "toolbarButton fullscreenMode";
        fullscreenBtn.title = "切换全屏模式";
        fullscreenBtn.innerHTML = `<span>全屏模式</span>`;
        iframeDownloadBtn.parentNode.insertBefore(fullscreenBtn, iframeDownloadBtn.nextSibling);
        fullscreenBtn.addEventListener("click", () => {
            console.log("点击全屏按钮");
            window.parent.postMessage("full-screen mode switches"); // iframe 向主页面发送消息
        });
    }

    // 主页面等待全屏指令
    window.addEventListener("message", function(event) {
        if (event.data === "full-screen mode switches") {
            console.log("Received message from iframe:", event.data);
            fullscreenSwitch();
        }
    }, false);

    function AddBtnsToListPg(i, title, pdfUrl) {
        const container = document.querySelectorAll("li.index-module_item_GfOnF")[i];
        container?.querySelector(".PDF-btns")?.remove(); // 去除旧按钮
        const PDF_btns = document.createElement("div"); // 创建 PDF_btns
        PDF_btns.setAttribute("class", "PDF-btns");
        PDF_btns.innerHTML = `
            <a type="button" class="fish-btn" style="margin-left: 24px; margin-bottom: 5px;" href="${pdfUrl}" target="_blank">查看PDF</a>
            <a type="button" class="fish-btn fish-btn-primary" style="margin-left: 24px; margin-bottom: 5px;">下载PDF</a>
        `;
        container.appendChild(PDF_btns); // 将 PDF_btns 添加到父元素中
        document.querySelectorAll(".index-module_content_KmLzG")[i].style.width = "550px"; // 统一 content 宽度
        PDF_btns.addEventListener("click", function(event) { // 停止 PDF_btns 的点击事件向上一层元素传播
            event.stopPropagation();
        });
        const element2 = PDF_btns.querySelector("a.fish-btn.fish-btn-primary");
        element2.addEventListener("click", function(event) { // 点击下载
            var fileUrl = pdfUrl;
            var xhr = new XMLHttpRequest();
            xhr.open("GET", fileUrl);
            xhr.responseType = "blob";
            xhr.onloadstart = function() { // 初始化进度
                element2.innerText = "下载中 ...";
            };
            xhr.onprogress = function(event) {
                if (event.lengthComputable) {
                    var progress = Math.round((event.loaded / event.total) * 100);
                    element2.innerText = "下载中 (" + progress + "%)";
                }
            };
            xhr.onload = function() {
                if (xhr.status === 200) {
                    var blob = xhr.response;
                    var downloadLink = document.createElement("a");
                    downloadLink.href = URL.createObjectURL(blob);
                    downloadLink.download = title || document.querySelectorAll("div.index-module_line_LgJAC")[i].querySelector("span").getAttribute("title"); // 文件名
                    downloadLink.dispatchEvent(new MouseEvent("click"));
                    element2.innerText = "下载PDF"; // 下载完成后恢复按钮文字
                }
            };
            xhr.send(); // 发送请求
        });
    }

    let title, pdfUrl; // 内页 pdfURL
    let pdfUrls = []; // 声明空数组

    // Resources requested via XHR
    const originalOpen = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function(method, url) {
        // console.log("Intercepted URL:", url);
        if (window.location.pathname === "/tchMaterial" && url.includes("query?res_ids=")) { // 获取列表页各 id
            const ids = url.match(/res_ids=([^&]+)/)[1].split(","); // 多个 id 构成的数组 // 匹配出 url 中“query?res_ids=”之后的内容,并将匹配出来的内容以其中的“,”隔开,形成多个“id”
            console.log(ids);
            const baseUrl = "https://s-file-1.ykt.cbern.com.cn/zxx/ndrv2/resources/tch_material/details/";
            const jsonUrls = ids.map(id => `${baseUrl}${id}.json`); // 多个 jsonURL 构成的数组
            console.log(jsonUrls);
            const baseUrlThe2nd = "https://s-file-1.ykt.cbern.com.cn/zxx/ndrs/special_edu/thematic_course/";
            const jsonUrlsThe2nd = ids.map(id => `${baseUrlThe2nd}${id}/resources/list.json`); // 多个 jsonURL 构成的数组
            console.log(jsonUrlsThe2nd);
            pdfUrls.length = 0; // 清空 pdfUrls 数组
            for (let i = 0; i < jsonUrls.length; i++) {
                fetch(jsonUrls[i])
                    .then(response => {
                        return response.text();
                    })
                    .then(text => {
                        let title = text.match(/(?<="title":\s*")[^"]+/g)[0];
                        let pdfUrl = text.match(/\bhttps?:\/\/[^"]*pkg[^"]*\.pdf\b/g).slice(-1)[0].replace("-private", ""); // 不存在则报错
                        pdfUrls.splice(i, 0, pdfUrl);
                        console.log(`pdf${i + 1}:`, title, pdfUrl);
                        AddBtnsToListPg(i, title, pdfUrl);
                    })
                    .catch(error => {
                        // console.log(error);
                        fetch(jsonUrlsThe2nd[i])
                            .then(response => {
                                return response.text();
                            })
                            .then(text => {
                                let pdfUrl = text.match(/\bhttps?:\/\/[^"]*pkg[^"]*\.pdf\b/g).slice(-1)[0].replace("-private", ""); // 不存在则报错
                                pdfUrls.splice(i, 0, pdfUrl);
                                console.log(`pdf${i + 1}:`, pdfUrl);
                                AddBtnsToListPg(i, undefined, pdfUrl);
                            })
                            .catch(error => {
                                console.log(error);
                                let pdfUrl = `notfound`;
                                pdfUrls.splice(i, 0, pdfUrl);
                                console.log(`pdf${i + 1}:`, pdfUrl);
                            });
                    });
            }
            console.log("pdfURLs:", pdfUrls);
        } else if (window.location.pathname === "/tchMaterial/detail" && (/resources\/tch_material\/details|special_edu\/thematic_course.*list\.json/).test(url)) { // 内页 pdfUrl
            const originalOnReadyStateChange = this.onreadystatechange;
            this.onreadystatechange = () => {
                if (this.readyState === 4 && this.status === 200) {
                    try {
                        const text = this.responseText;
                        if (url.includes("resources/tch_material/details")) {
                            title = text.match(/(?<="title":\s*")[^"]+/g)[0];
                            pdfUrl = text.match(/\bhttps?:\/\/[^"]*pkg[^"]*\.pdf\b/g).slice(-1)[0].replace("-private", ""); // 不存在则报错
                            console.log(title, pdfUrl);
                        } else if (url.includes("special_edu/thematic_course") && url.endsWith("list.json")) {
                            const urlList = text.match(/\bhttps?:\/\/(?!r1|r2)[^"]*pkg[^"]*\.(pdf|pptx?)\b/g); // 必须包含 pkg 以排除无效链接
                            console.log(urlList);
                            const errorText = document.querySelector(".index-module_error_IC0KJ > .index-module_text_1noC9");
                            if (errorText) {
                                errorText.innerHTML = "哎呀,该内容不需要登录也能查看";
                                const div = document.createElement("div");
                                div.className = "urls";
                                div.style = "display: flex;flex-direction: column";
                                errorText.insertAdjacentElement("afterend", div);
                                for (let i = 0; i < urlList.length; i++) {
                                    urlList[i] = urlList[i].replace("-private", "");
                                    div.innerHTML += `<a href="${urlList[i]}" target="_blank" class="fish-btn">${urlList[i]}</a>`;
                                }
                            }
                        }
                    } catch (e) {
                        console.error(e);
                    }
                }
                if (originalOnReadyStateChange) {
                    originalOnReadyStateChange.apply(this, arguments);
                }
            };
        } else if (url.endsWith(".mp3")) { // MP3 链接
            let modifiedURL = url.replace("-private", "");
            console.log("Requested MP3 (modified URL):", modifiedURL);
            const element1 = document.querySelector("a.mp3"); // 按钮 element1
            if (element1) {
                element1.href = modifiedURL; // 修改 element1 的 URL
            }
            const suggestBtn = document.getElementsByClassName("index-module_suggestion-wrap_s+Ii+")[0];
            if (suggestBtn && !document.querySelector(".mp3")) {
                const div = document.createElement("div");
                div.setAttribute("style", "display: flex; align-items: center; margin-left: 30px");
                div.innerHTML = `<a class="mp3" href="${modifiedURL}" target="_blank" style="color: #888;">📼 查看MP3</a>`;
                suggestBtn.insertAdjacentElement("afterend", div);
            }
        }
        return originalOpen.apply(this, arguments);
    };

    const maxTimeToCheck = 15000; // 最多检查 15000 毫秒,即 15 秒
    let elapsedTime = 0;

    // 免登录内页
    function checkLoginModal() {
        const loginModal = document.querySelector(".fish-modal-root");
        if (loginModal) {
            clearInterval(intervalId1); // 清除定时器
            // 去除阻碍
            loginModal.remove(); // 去除遮罩
            const body = document.querySelector("html > body"); // 去除 body 属性
            body.removeAttribute("class");
            body.removeAttribute("style");
            // 添加阅读器
            const indexModuleWrapperECeCo = document.querySelector(".index-module_wrapper_ECeCo");
            if (indexModuleWrapperECeCo) {
                indexModuleWrapperECeCo.innerHTML = `
<div class="index-module_wrapper_ECeCo">
<div class="imageList-module_special-edu-image_A7C2c">
  <div class="index-module_header_tG-zz">
    <h3 class="index-module_title_bnE9V">${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">智慧中小学</span>
      </span>
      <div class="index-module_assesment-detail_jhGLz">
        <div class="index-module_assessment-content_06v6Z">
          <div class="fish-dropdown-trigger index-module_assessment-rate_euPTQ">
            <ul class="fish-rate fish-rate-disabled" tabindex="-1" role="radiogroup">
              <li class="fish-rate-star fish-rate-star-full">
                <div role="radio" aria-checked="true" aria-posinset="1" aria-setsize="5" tabindex="-1">
                  <div class="fish-rate-star-first">
                    <div class="custom-star-wrap" style="width: 100%;">
                      <div class="custom-star">
                      </div>
                    </div>
                  </div>
                  <div class="fish-rate-star-second">
                    <div class="custom-star-wrap" style="width: 100%;">
                      <div class="custom-star">
                      </div>
                    </div>
                  </div>
                </div>
              </li>
              <li class="fish-rate-star fish-rate-star-full">
                <div role="radio" aria-checked="true" aria-posinset="2" aria-setsize="5" tabindex="-1">
                  <div class="fish-rate-star-first">
                    <div class="custom-star-wrap" style="width: 100%;">
                      <div class="custom-star">
                      </div>
                    </div>
                  </div>
                  <div class="fish-rate-star-second">
                    <div class="custom-star-wrap" style="width: 100%;">
                      <div class="custom-star">
                      </div>
                    </div>
                  </div>
                </div>
              </li>
              <li class="fish-rate-star fish-rate-star-full">
                <div role="radio" aria-checked="true" aria-posinset="3" aria-setsize="5" tabindex="-1">
                  <div class="fish-rate-star-first">
                    <div class="custom-star-wrap" style="width: 100%;">
                      <div class="custom-star">
                      </div>
                    </div>
                  </div>
                  <div class="fish-rate-star-second">
                    <div class="custom-star-wrap" style="width: 100%;">
                      <div class="custom-star">
                      </div>
                    </div>
                  </div>
                </div>
              </li>
              <li class="fish-rate-star fish-rate-star-full">
                <div role="radio" aria-checked="true" aria-posinset="4" aria-setsize="5" tabindex="-1">
                  <div class="fish-rate-star-first">
                    <div class="custom-star-wrap" style="width: 100%;">
                      <div class="custom-star">
                      </div>
                    </div>
                  </div>
                  <div class="fish-rate-star-second">
                    <div class="custom-star-wrap" style="width: 100%;">
                      <div class="custom-star">
                      </div>
                    </div>
                  </div>
                </div>
              </li>
              <li class="fish-rate-star fish-rate-star-zero">
                <div role="radio" aria-checked="true" aria-posinset="5" aria-setsize="5" tabindex="-1">
                  <div class="fish-rate-star-first">
                    <div class="custom-star-wrap" style="width: 100%;">
                      <div class="custom-star">
                      </div>
                    </div>
                  </div>
                  <div class="fish-rate-star-second">
                    <div class="custom-star-wrap" style="width: 100%;">
                      <div class="custom-star">
                      </div>
                    </div>
                  </div>
                </div>
              </li>
            </ul>
            <span class="index-module_text_rukZW">5.0分</span>
          </div>
        </div>
        <span class="fish-dropdown-trigger index-module_assessment-btn_6imdF ">
          <button type="button" class="fish-btn fish-btn-round">
            <svg class="index-module_rate-icon_YM1Lc">
              <use xlink:href="#icon_evaluate_fill">
              </use>
            </svg>
            <span class="index-module_assessment-btn-text_fw-+Z">评价</span>
          </button>
        </span>
      </div>
      <div class="index-module_extra_tUQog">
        <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">100万+</div>
        </div>
        <div class="index-module_suggestion-wrap_s+Ii+ ">
          <svg class="index-module_suggestion-icon_IrRxU">
            <use xlink:href="#icon_feedback_fill">
            </use>
          </svg>
          <div>建议</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: 95%;">
          <embed src="${pdfUrl}" width="100%" height="100%">
        </div>
        <div class="doc-toolbar">
          <div class="left">
          </div>
          <div class="center">
          </div>
          <div class="right">
            <div class="split-line">
            </div>
            <div class="tool-btn fullscreen" title="全屏">
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</div>
                `;
            }
            // 全屏切换
            const fullscreenBtn = document.querySelector(".tool-btn.fullscreen");
            fullscreenBtn.addEventListener("click", fullscreenSwitch);
            // 重定向至登录页
            const toLogin = [
                document.querySelector(".fish-dropdown-trigger.index-module_assessment-btn_6imdF"),
                document.querySelector(".index-module_like-wrap_NbyLe"),
                document.querySelector(".index-module_suggestion-wrap_s\\+Ii\\+")
            ];
            toLogin.forEach(element => {
                element.addEventListener("click", () => {
                    window.open("https://auth.smartedu.cn/uias/login/");
                });
            });
        } else {
            elapsedTime += 100;
            if (elapsedTime >= maxTimeToCheck) {
                clearInterval(intervalId1); // 清除定时器,停止检查
            }
        }
    }
    const intervalId1 = setInterval(checkLoginModal, 100); // 每隔 100 毫秒检查一次 .fish-modal-root 元素是否存在

    // 内页
    function checkIndexModule() {
        const container = document.querySelector(".index-module_extra_tUQog"); // 找到要添加按钮的容器元素
        if (container && !document.querySelector(".Btns")) {
            clearInterval(intervalId2); // 清除定时器
            const div = document.createElement("div");
            div.className = "Btns";
            div.innerHTML = `<a class="link" href="${pdfUrl}" style="margin-left: 24px; color: #888;">📓 查看PDF</a><a class="download" style="margin-left: 24px; color: #888;">📓 下载PDF</a>`;
            container.appendChild(div); // 将按钮添加到网页中
            const element1 = div.querySelector("a.link");
            if (element1) {
                element1.addEventListener("mouseover", function() {
                    this.innerHTML = "📘 查看PDF";
                    this.style.color = "#1e62ec"; // 鼠标移入时修改元素的样式
                });
                element1.addEventListener("mouseout", function() {
                    this.innerHTML = "📓 查看PDF";
                    this.style.color = "#888"; // 鼠标移出时恢复原来的样式
                });
            }
            const element2 = div.querySelector("a.download");
            if (element2) {
                element2.addEventListener("click", function(event) { // 点击下载
                    var fileUrl = pdfUrl;
                    var xhr = new XMLHttpRequest();
                    xhr.open("GET", fileUrl);
                    xhr.responseType = "blob";
                    xhr.onloadstart = function() { // 初始化进度
                        element2.innerText = "📓 下载中 ...";
                    };
                    xhr.onprogress = function(event) {
                        if (event.lengthComputable) {
                            var progress = Math.round((event.loaded / event.total) * 100);
                            element2.innerText = "📓 下载中 (" + progress + "%)";
                        }
                    };
                    xhr.onload = function() {
                        if (xhr.status === 200) {
                            var blob = xhr.response;
                            var downloadLink = document.createElement("a");
                            downloadLink.href = URL.createObjectURL(blob);
                            downloadLink.download = title || document.querySelector(".index-module_title_bnE9V").innerText; // 文件名
                            downloadLink.dispatchEvent(new MouseEvent("click"));
                            element2.innerText = "📓 下载PDF"; // 下载完成后恢复按钮文字
                        }
                    };
                    xhr.send(); // 发送请求
                });
            }
            setTimeout(function() { // 等待 iframe 加载;教材内页主文档通过 iframe 获取 URL 以更新链接
                const iframe = document.querySelector("iframe");
                if (iframe) {
                    const iframeSrc = iframe.src;
                    const iframeSrcExtracted = iframeSrc.match(/file=([^&#]+)/)?.[1]?.replace("-private", "");
                    console.log("iframeSrcExtracted:", iframeSrcExtracted);
                    const element1 = div.querySelector("a.link"); // 按钮 element1
                    if (element1) {
                        element1.href = iframeSrcExtracted; // 更新 element1 的 URL
                    }
                    pdfUrl = iframeSrcExtracted; // 更新 element2 的 URL
                }
            }, 3000);
        } else {
            elapsedTime += 100;
            if (elapsedTime >= maxTimeToCheck) {
                clearInterval(intervalId2); // 清除定时器,停止检查
            }
        }
    }
    const intervalId2 = setInterval(checkIndexModule, 100); // 每隔 100 毫秒检查一次 index-module_extra_tUQog 元素是否存在

    // PDF fetched
    const originalFetch = window.fetch;
    window.fetch = function (url, options) {
        return originalFetch(url, options) // 调用原始 fetch 函数
            .then(response => {
                if (response.status === 200 && url.endsWith(".pdf")) {
                    let modifiedURL = url.replace("-private", "");
                    console.log("Fetched PDF (modified valid URL):", modifiedURL);
                    const element1 = document.querySelector("a.link"); // 按钮 element1
                    if (element1) { // iframe 内部不存在此元素;可在主文档中通过 iframe 获取文件 URL
                        element1.href = modifiedURL; // 修改 element1 的 URL
                    }
                    pdfUrl = modifiedURL; // 修改 element2 的 URL
                    const syncClassSuggestion = document.getElementsByClassName("index-module_suggestion-wrap_s+Ii+")[0];
                    if (syncClassSuggestion && !document.querySelector("div > .link")) {
                        const div = document.createElement("div");
                        div.setAttribute("style", "display: flex; align-items: center; margin-left: 30px");
                        div.innerHTML = `<a class="link" href="${modifiedURL}" target="_blank" style="color: #888;">📓 查看PDF</a>`;
                        syncClassSuggestion.insertAdjacentElement("afterend", div);
                    }
                }
                return response;
            })
            .catch(error => {
                console.error(error);
            });
    };

})();