Redirect to UNSW Library

Redirect IEEE link to UNSW library

目前为 2024-04-19 提交的版本。查看 最新版本

// ==UserScript==
// @name Redirect to UNSW Library
// @version 1.0
// @description Redirect IEEE link to UNSW library
// @author  Caikun-Peng
// @license MIT
// @match https://ieeexplore.ieee.org/*
// @exclude https://ieeexplore-ieee-org.wwwproxy1.library.unsw.edu.au/*
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
// @grant GM_setClipboard
// @grant GM_registerMenuCommand
// @run-at document-end
// @namespace https://gf.qytechs.cn/users/1290404
// ==/UserScript==

(function(){
    let ip
    let URL

    GM_registerMenuCommand("Manual Redirection", redirectManually)
    function redirectManually(){
        document.addEventListener(('click', changeURL))
    }

    GM_registerMenuCommand("Go to the UNSW Library", goToLibrary)
    function goToLibrary(){
        document.addEventListener(('click', window.open("https://www.library.unsw.edu.au/")))
    }

    function getIP(){
        GM_xmlhttpRequest({
            method: "GET",
            url: "http://api.ipify.org",
            onload: function(response) {
                ip = response.response
                if (ip.includes("129.94")) {
                } else{
                    changeURL();
                }
            }
        })
    }

    function changeURL(){
        URL = window.location.href.replace(/https\:\/\/ieeexplore.ieee.org/, 'https://ieeexplore-ieee-org.wwwproxy1.library.unsw.edu.au');
        window.open(URL,'_self');
    }

    var origin = window.location.origin;
    if (origin == "https://ieeexplore.ieee.org"){
        getIP();
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址