Conversaciones » Desarrolladores
新人,第一次写的脚本,出了bug,求帮忙debug,谢谢!我写了一个脚本,使http://192.168.*.1/main.html*跳转到/cgi-bin/luci/web?goto=pc求这个脚本有什么错误,我安装测试,发现不执行// ==UserScript==// @name 小米路由器安卓自动跳转电脑网页// @description 安卓手机打开小米路由器管理页面时,自动跳转到电脑版网页。// @author Winloader// @license WTFPL// @version 1.0// @incompatible safari // @grant none// @match *://192.168.31.1/*// @match *://192.168.10.1/*// @match *://192.168.0.1/*// @match *://192.168.1.1/*// ==/UserScript==var url = window.location.href;if (url == "http://192.168.10.1/main.html#/login"){var newUrl = url.replace("main.html#", "cgi-bin/luci/web?goto=pc");window.location.href = newUrl;}if (url == "http://192.168.31.1/main.html#/login"){var newUrl = url.replace("main.html#", "cgi-bin/luci/web?goto=pc");window.location.href = newUrl;}if (url = "http://192.168.0.1/main.html#/login"){var newUrl == url.replace("main.html#", "cgi-bin/luci/web?goto=pc");window.location.href = newUrl;}if (url == "http://192.168.1.1/main.html#/login"){var newUrl = url.replace("main.html#", "cgi-bin/luci/web?goto=pc");window.location.href = newUrl;}if (url == "http://192.168.10.1/main.html#"){var newUrl = url.replace("main.html#", "cgi-bin/luci/web?goto=pc");window.location.href = newUrl;}if (url == "http://192.168.31.1/main.html#"){var newUrl = url.replace("main.html#", "cgi-bin/luci/web?goto=pc");window.location.href = newUrl;}if (url == "http://192.168.0.1/main.html#"){var newUrl = url.replace("main.html#", "cgi-bin/luci/web?goto=pc");window.location.href = newUrl;}if (url == "http://192.168.1.1/main.html#"){var newUrl = url.replace("main.html#", "cgi-bin/luci/web?goto=pc");window.location.href = newUrl;}if (url == "http://192.168.10.1/main.html"){var newUrl = url.replace("main.html", "cgi-bin/luci/web?goto=pc");window.location.href = newUrl;}if (url == "http://192.168.31.1/main.html"){var newUrl = url.replace("main.html", "cgi-bin/luci/web?goto=pc");window.location.href = newUrl;}if (url == "http://192.168.0.1/main.html"){var newUrl = url.replace("main.html", "cgi-bin/luci/web?goto=pc");window.location.href = newUrl;}if (url == "http://192.168.1.1/main.html"){var newUrl = url.replace("main.html", "cgi-bin/luci/web?goto=pc");window.location.href = newUrl;}
Inicia sesión para responder.
新人,第一次写的脚本,出了bug,求帮忙debug,谢谢!
我写了一个脚本,使
http://192.168.*.1/main.html*
跳转到/cgi-bin/luci/web?goto=pc
求这个脚本有什么错误,我安装测试,发现不执行
// ==UserScript==
// @name 小米路由器安卓自动跳转电脑网页
// @description 安卓手机打开小米路由器管理页面时,自动跳转到电脑版网页。
// @author Winloader
// @license WTFPL
// @version 1.0
// @incompatible safari
// @grant none
// @match *://192.168.31.1/*
// @match *://192.168.10.1/*
// @match *://192.168.0.1/*
// @match *://192.168.1.1/*
// ==/UserScript==
var url = window.location.href;
if (url == "http://192.168.10.1/main.html#/login")
{
var newUrl = url.replace("main.html#", "cgi-bin/luci/web?goto=pc");
window.location.href = newUrl;
}
if (url == "http://192.168.31.1/main.html#/login")
{
var newUrl = url.replace("main.html#", "cgi-bin/luci/web?goto=pc");
window.location.href = newUrl;
}
if (url = "http://192.168.0.1/main.html#/login")
{
var newUrl == url.replace("main.html#", "cgi-bin/luci/web?goto=pc");
window.location.href = newUrl;
}
if (url == "http://192.168.1.1/main.html#/login")
{
var newUrl = url.replace("main.html#", "cgi-bin/luci/web?goto=pc");
window.location.href = newUrl;
}
if (url == "http://192.168.10.1/main.html#")
{
var newUrl = url.replace("main.html#", "cgi-bin/luci/web?goto=pc");
window.location.href = newUrl;
}
if (url == "http://192.168.31.1/main.html#")
{
var newUrl = url.replace("main.html#", "cgi-bin/luci/web?goto=pc");
window.location.href = newUrl;
}
if (url == "http://192.168.0.1/main.html#")
{
var newUrl = url.replace("main.html#", "cgi-bin/luci/web?goto=pc");
window.location.href = newUrl;
}
if (url == "http://192.168.1.1/main.html#")
{
var newUrl = url.replace("main.html#", "cgi-bin/luci/web?goto=pc");
window.location.href = newUrl;
}
if (url == "http://192.168.10.1/main.html")
{
var newUrl = url.replace("main.html", "cgi-bin/luci/web?goto=pc");
window.location.href = newUrl;
}
if (url == "http://192.168.31.1/main.html")
{
var newUrl = url.replace("main.html", "cgi-bin/luci/web?goto=pc");
window.location.href = newUrl;
}
if (url == "http://192.168.0.1/main.html")
{
var newUrl = url.replace("main.html", "cgi-bin/luci/web?goto=pc");
window.location.href = newUrl;
}
if (url == "http://192.168.1.1/main.html")
{
var newUrl = url.replace("main.html", "cgi-bin/luci/web?goto=pc");
window.location.href = newUrl;
}