Click2Redirect

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

Versione datata 11/10/2024. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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);
})();