wos

WOS数据库下载器

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name       wos
// @namespace  npm/vite-plugin-monkey
// @version    2025.12.17
// @icon       https://webofscience.clarivate.cn/wos/static/favicon.png
// @match      https://webofscience.clarivate.cn/wos/woscc/summary/*/relevance/*
// @require    https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.global.prod.js
// @grant      GM_addStyle
// @grant      GM_xmlhttpRequest
// @description WOS数据库下载器
// @license MIT
// ==/UserScript==

(function (vue) {
  'use strict';

  const d=new Set;const importCSS = async e=>{d.has(e)||(d.add(e),(t=>{typeof GM_addStyle=="function"?GM_addStyle(t):(document.head||document.documentElement).appendChild(document.createElement("style")).append(t);})(e));};

  const styleCss = "#bnt{margin-left:10px;padding:8px 20px;background-color:#008cba;color:#fff;border:none;border-radius:4px;transition:background-color .3s}#bnt:hover{background-color:#005f73}";
  importCSS(styleCss);
  var _GM_xmlhttpRequest = (() => typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : void 0)();
  const _sfc_main = {
    __name: "App",
    setup(__props) {
      const params = vue.reactive({
        QID: "",
        SID: "",
        Size: 1,
        Flag: true,
        Type: ""
      });
      _GM_xmlhttpRequest({
        method: "GET",
        url: "https://webofscience.clarivate.cn/",
        credentials: "include",
        headers: {
          "Content-Type": "application/json",
          "User-Agent": navigator.userAgent
        },
        onload: function(response) {
          const regex = /SID=([^&]+)/;
          const sid = response.finalUrl.match(regex);
          if (sid) {
            params.SID = sid[1];
          } else {
            alert("获取权限ID失败");
          }
        }
      });
      function ToNumber(str) {
        return Number(str.replace(/[,\s]/g, ""));
      }
      setInterval(() => {
        const url = window.location.href;
        if (url.includes("overlay:export")) {
          if (params.Flag) {
            const select = document.querySelector("div.flex-align.margin-top-20");
            if (select) {
              params.Flag = false;
              const newButton = document.createElement("button");
              newButton.textContent = "全部下载";
              newButton.id = "bnt";
              select.appendChild(newButton);
              const bnt = document.querySelector("#bnt");
              params.QID = url.match(/summary\/(.+?)\//)[1];
              const size = document.querySelector(".brand-blue");
              params.Size = ToNumber(size.textContent);
              params.Type = url.match(/export\/(.+?)\)/)[1];
              bnt.addEventListener(
                "click",
                () => {
                  openNewWindow();
                }
              );
            }
          }
        } else {
          params.Flag = true;
        }
      }, 1e3);
      function openNewWindow() {
        const url = `http://10.4.136.103:8002/?qid=${params.QID}&sid=${params.SID}&size=${params.Size}&type=${params.Type}`;
        const width = 1200;
        const height = 800;
        const left = (window.screen.width - width) / 2;
        const top = (window.screen.height - height) / 2;
        const windowFeatures = `
                width=${width},
                height=${height},
                left=${left},
                top=${top},
                toolbar=no,
                location=no,
                status=no,
                menubar=no,
                scrollbars=yes,
                resizable=yes
            `.replace(/\s+/g, "");
        window.open(url, "_blank", windowFeatures);
      }
      return () => {
      };
    }
  };
  const app = vue.createApp(_sfc_main);
  app.mount((() => {
    const app2 = document.createElement("div");
    document.body.append(app2);
    return app2;
  })());

})(Vue);