您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
检测到校园网后自动打开认证页面,让 Chrome 处理自动填充登录
// ==UserScript== // @name 校园网自动打开认证页面(南昌航空大学) // @namespace http://tampermonkey.net/ // @version 1.0 // @description 检测到校园网后自动打开认证页面,让 Chrome 处理自动填充登录 // @match *://*/* // @grant GM_xmlhttpRequest // @run-at document-start // @license MIT // ==/UserScript== (function() { 'use strict'; const loginPageURL = "http://10.1.88.4"; // 你的校园网认证页面地址 const checkURL = "http://10.1.88.4/cgi-bin/rad_user_info"; // 用于检测是否已登录 // 发送请求检查是否已登录 function checkLoginStatus() { GM_xmlhttpRequest({ method: "GET", url: checkURL, timeout: 3000, // 3秒超时 onload: function(response) { if (!response.responseText.includes("username")) { console.log("未登录,打开认证页面..."); window.open(loginPageURL, "_blank"); } else { console.log("已登录,无需操作。"); } }, onerror: function() { console.log("无法连接校园网,可能未连接 WiFi"); } }); } // 每隔 30 秒检测一次 setInterval(checkLoginStatus, 30000); // 初次运行时立即检测 checkLoginStatus(); })();