Greasy Fork

Greasy Fork is available in English.

Automatically Literature Validation for NUS Staff 新加坡国立大学职工自动文献验证自动登录脚本

2022/02/12 22:00:29

当前为 2022-10-31 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Automatically Literature Validation for NUS Staff 新加坡国立大学职工自动文献验证自动登录脚本
// @namespace   NUS
// @grant       none
// @version     3.0
// @license MIT
// @author      Naibo Wang
// @match       proxylogin.nus.edu.sg/libproxy1/public/*
// @match       proxylogin-nus-edu-sg.libproxy1.nus.edu.sg/libproxy1*
// @match        www.sciencedirect.com/*
// @match        ieeexplore.ieee.org/*
// @match        dl.acm.org/*
// @match        *.springer.com/*
// @match        onlinelibrary.wiley.com/doi/*
// @match        www.ncbi.nlm.nih.gov/pubmed/*
// @match        epubs.siam.org/*
// @match        www.nature.com/*
// @match        pubsonline.informs.org/*
// @match        *.serialssolutions.com/*
// @match        *.ezlibproxy1.ntu.edu.sg/*
// @description 2022/02/12 22:00:29
// ==/UserScript==

(function() {
        'use strict';
    var url = window.location.href;
    console.log("url:",url);
    if(url.indexOf("nus") >=0 || url.indexOf("serialssolutions") >=0){
        setTimeout(function(){
            var username = ""; //input your username here to access the website such as scienceDirect without manually click
            var password = ""; //input your password here to access the website such as scienceDirect without manually click
            setTimeout(function(){document.querySelector("#mobile-main-page > div > div.row-fluid.section.single-results > div > a").click()},500);
            console.log(document.querySelector("#mobile-main-page > div > div.row-fluid.section.single-results > div > a"));
            document.querySelector("body > table:nth-child(3) > tbody > tr:nth-child(3) > td:nth-child(4) > div:nth-child(4) > form > table > tbody > tr:nth-child(1) > td:nth-child(2) > select").value = "NUSSTF";
            if(username!=""){
                document.querySelector("body > table:nth-child(3) > tbody > tr:nth-child(3) > td:nth-child(4) > div:nth-child(4) > form > table > tbody > tr:nth-child(2) > td:nth-child(2) > input[type=text]").value = username;
            }
            if(password!=""){
                document.querySelector("body > table:nth-child(3) > tbody > tr:nth-child(3) > td:nth-child(4) > div:nth-child(4) > form > table > tbody > tr:nth-child(3) > td:nth-child(2) > input[type=password]").value = password;
            }

            setTimeout(function(){
                if(document.querySelector("body > table:nth-child(3) > tbody > tr:nth-child(3) > td:nth-child(4) > div:nth-child(4) > form > table > tbody > tr:nth-child(2) > td:nth-child(2) > input[type=text]").value!=""){
                    document.querySelector("body > table:nth-child(3) > tbody > tr:nth-child(3) > td:nth-child(4) > div:nth-child(4) > form > input[type=submit]:nth-child(4)").click();
                }
            },100);

        },500);

        setTimeout(function(){
            document.querySelector("form[name='frmMain'] > input[type=submit]").click();
        },500);
    } else{
        location.href = "http://libproxy1.nus.edu.sg/login?url=" + location.href;
    }
})();