fucking NJFU WIFI

fucking NJFU WIFI!!

当前为 2020-11-04 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         fucking NJFU WIFI
// @namespace    https://zkwzkw.top
// @version      0.5
// @description  fucking NJFU WIFI!!
// @author       kaiwen zhou
// @include      http://*/a70.htm
// @include      http://*/0.htm
// @grant        none
// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js
// @require      https://cdn.bootcdn.net/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js
// ==/UserScript==

(function() {
    'use strict';
    // 请在下面下面两行中输入你的wifi账号和密码
    let username = ''
    let password = ''
    let url = window.location.href
    let reg_a70 = /a70.htm$/;
    let reg_0 = /0.htm$/;
    if (username === '' || password === ''){
        if($.cookie('username') === undefined || $.cookie('password') === undefined){
            // 添加cookie
            alert('这是你的第一次登陆,请先手动登陆一下,脚本会自动为你添加cookie, 或者你可以直接在js中设置你的账号与密码')
            if(reg_a70.test(url)){
                $('form[name=f3]').submit(function(){
                    username = $('.edit_lobo_cell')[1].value
                    password = $('.edit_lobo_cell')[2].value
                    // 保存cookie
                    $.cookie('username', username, { expires: 99999 });
                    $.cookie('password', password, { expires: 99999 });
                })
            }else if(reg_0.test(url)){
                $("input[name=0MKKey]").click(function(){
                    username = $("input[name=DDDDD]")[0].value
                    password = $("input[name=upass]")[0].value
                    // 保存cookie
                    $.cookie('username', username, { expires: 99999 });
                    $.cookie('password', password, { expires: 99999 });
                })
            }else{
                alert('添加cookie失败')
            }
        }else{
            username = $.cookie('username')
            password = $.cookie('password')
            if(reg_a70.test(url)){
                $('.edit_lobo_cell')[1].value = username
                $('.edit_lobo_cell')[2].value = password
                $('.edit_lobo_cell')[0].click()
            }else if(reg_0.test(url)){
                $("input[name=DDDDD]")[0].value = username
                $("input[name=upass]")[0].value = password
                $("input[name=0MKKey]").click()
            }
        }
    }else{
        if(reg_a70.test(url)){
            $('.edit_lobo_cell')[1].value = username
            $('.edit_lobo_cell')[2].value = password
            $('.edit_lobo_cell')[0].click()
        }else if(reg_0.test(url)){
            $("input[name=DDDDD]")[0].value = username
            $("input[name=upass]")[0].value = password
            $("input[name=0MKKey]").click()
        }else{
            alert('未能够成功匹配!!')
        }
    }
})();