Click2Redirect

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

Verze ze dne 11. 10. 2024. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Click2Redirect
// @namespace    http://tampermonkey.net/
// @version      1.1
// @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 = 'Redirect';
    button1.style.padding = '10px';
    button1.style.cursor = 'pointer';
    button1.onclick = function() {
        // alert("Server:"+serverAddress+"\n"
        //     +"ModifiedServer:"+modifiedAssress+"\n"
        //     +"Path:"+filePath);
        alert("We will redirect to:"+destiUrl);
        window.location.href = destiUrl;
        // window.open(destiUrl);
    };
    
    // Create second button
    var button2 = document.createElement('login');
    button2.innerHTML = 'Button 2';
    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);
})();