Click2Redirect

Inserts a floating button in the page and you can click it to get ariticles.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Click2Redirect
// @namespace    http://tampermonkey.net/
// @version      1.2
// @author       Encounter925
// @description  Inserts a floating button in the page and you can click it to get ariticles.
// @license      MIT
// @match        *://*.cnki.net/*
// @match        *://*.bj.cxstar.cn/*
// @match        *://*.blyun.com/*
// @match        *://*.zhizhen.com/*
// @match        *://qikan.chaoxing.com/*
// @match        *://*.innojoy.com/*
// @match        *://*.duxiu.com/*
// @match        *://*.epsnet.com.cn/*
// @match        *://*.keledge.com/*
// @match        *://*.qdexam.com/*
// @match        *://*.yjsexam.com/*
// @match        *://*.fenqubiao.com/*
// @match        *://*.engineeringvillage.com/*
// @match        *://*.emerald.com/*
// @match        *://*.nature.com/*
// @match        *://onepetro.org/*
// @match        *://*.onepetro.org/*
// @match        *://*.iresearchbook.cn/*
// @match        *://*.pqdtcn.com/*
// @match        *://*.sciencedirect.com/*
// @match        *://*.sciencemag.org/*
// @match        *://*.science.org/*
// @match        *://*.newacademic.net/*
// @match        *://*.wanfangdata.com.cn/*
// @match        *://*.wiley.com/*
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    var currentUrl = window.location.href; //get current url

    var urlObj = new URL(currentUrl);

    // 获取服务器地址(包括协议和主机名)
    var serverAddress = urlObj.origin;

    var modifiedAssress = serverAddress.replace(/\./g, '-');
    modifiedAssress = modifiedAssress+'-s.atrust.yangtzeu.edu.cn';

    // 获取文件路径(不包括服务器地址)
    var filePath = currentUrl.substring(serverAddress.length);

    var destiUrl = modifiedAssress+filePath;

    // Create container for buttons
    var container = document.createElement('div');
    container.style.position = 'fixed';
    container.style.top = '15%';
    container.style.right = '12px';
    container.style.zIndex = '9999';
    container.style.display = 'flex';
    container.style.flexDirection = 'column';
    container.style.gap = '10px';

    // Create first button
    var button1 = document.createElement('button');
    button1.innerHTML = '重定向';
    button1.style.padding = '10px';
    button1.style.cursor = 'pointer';
    button1.onclick = function() {
        // alert("Server:"+serverAddress+"\n"
        //     +"ModifiedServer:"+modifiedAssress+"\n"
        //     +"Path:"+filePath);
        alert("我们将跳转至:"+destiUrl);
        window.location.href = destiUrl;
        // window.open(destiUrl);
    };
    
    // Create second button
    var button2 = document.createElement('button');
    button2.innerHTML = '登陆';
    button2.style.padding = '10px';
    button2.style.cursor = 'pointer';
    button2.onclick = function() {
        // alert('Button 2 clicked!');
        window.open('https://atrust.yangtzeu.edu.cn:4443/');
    };

    // Add buttons to container
    container.appendChild(button1);
    container.appendChild(button2);

    // Add container to the body
    document.body.appendChild(container);
})();