fuc-new/public/theme/cool/assets/js/cool.js
hellcat 1fe8673f62 1
2025-10-01 13:34:29 +08:00

1183 lines
38 KiB
JavaScript

var menuSelect;
var _0x11a6ba = function () {
var e = true;
return function (t, o) {
var r = e ? function () {
if (o) {
var e = o.apply(t, arguments);
return o = null,
e
}
}
: function () { }
;
return e = false,
r
}
}()
, _0x14bf9e = _0x11a6ba(this, function () {
var e, t, r = window;
var a = function (e, t, o) {
if (e.length != t)
return false;
for (var r = 0; r < t; r++)
for (var i = 0; i < o.length; i += 2)
if (r == o[i] && e.charCodeAt(r) != o[i + 1])
return false;
return true
}
var n = function (e, t, o) {
return a(t, o, e)
}
var s = function (e, t, o) {
return n(t, e, o)
};
for (var l in r)
if (a(l, 8, [7, 116, 5, 101, 3, 117, 0, 100])) {
e = l;
break
}
for (var c in r[e])
if (s(c, [5, 110, 0, 100], 6)) {
y = c;
break
}
for (var u in r[e])
if (s(u, [7, 110, 0, 108], 8)) {
t = u;
break
}
if (!("~" > y))
for (var d in r[e][t])
if (n([7, 101, 0, 104], d, 8)) {
o = d;
break
}
});
function autopasswd(e, t, o) {
var r = ""
, i = t
, a = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
e && (i = Math.round(Math.random() * (o - t)) + t);
for (var n = 0; n < i; n++)
pos = Math.round(Math.random() * (a.length - 1)),
r += a[pos];
return r
}
function IsPC() {
for (var e = navigator.userAgent, t = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"], o = true, r = 0; r < t.length; r++)
if (e.indexOf(t[r]) > 0) {
o = false;
break
}
return o
}
function IsWindows() {
var e = navigator.userAgent.toLowerCase();
return e.indexOf("win32") >= 0 || e.indexOf("wow32") >= 0 || (e.indexOf("win64") >= 0 || e.indexOf("wow64") >= 0)
}
function IsMac() {
navigator.userAgent.toLowerCase();
return !!(/macintosh|mac os x/i.test(navigator.userAgent) && !window.MSStream)
}
function IsAndroid() {
var e = navigator.userAgent;
return e.indexOf("Android") > -1 || e.indexOf("Adr") > -1
}
function IsiOS() {
return !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
}
function darkToggle() {
$.ajax({
type: "GET",
url: "/user/panel/mod/toggle",
dataType: "json",
data: {
themeMod: themeMod
},
success: e => {
window.location.reload()
}
,
error: e => {
Swal.fire("发生错误", "点击确定后刷新重试", "error").then(function () {
window.location.reload()
})
}
})
}
function oneclickImport(e, t) {
if ("ssr" == e) {
var o = window.btoa(t);
if (IsWindows())
window.location.href = "sub://" + o;
else {
var r = {
title: "您的设备可能不支持",
html: "<code>SSR</code>一键导入仅支持<code>Windows</code>端<code>SSR 5.1</code>以上版本",
type: "warning",
showCancelButton: true,
confirmButtonText: "继续导入",
cancelButtonText: "取消"
};
Swal.fire(r).then(e => {
e.value && (window.location.href = "sub://" + o)
}
)
}
}
if ("clashr" == e)
if (IsWindows() || IsMac() || IsAndroid())
window.location.href = "clash://install-config?url=" + t;
else {
var i = {
title: "您的设备可能不支持",
html: "<code>ClashR</code>一键导入仅支持<code>Windows</code>、<code>Mac OS</code>和<code>Android</code>",
type: "warning",
showCancelButton: true,
confirmButtonText: "继续导入",
cancelButtonText: "取消"
};
Swal.fire(i).then(e => {
e.value && (window.location.href = "clash://install-config?url=" + t)
}
)
}
if ("clashx" == e)
if (IsWindows() || IsMac() || IsAndroid())
window.location.href = "clash://install-config?url=" + t;
else {
var a = {
title: "您的设备可能不支持",
html: "<code>ClashR</code>一键导入仅支持<code>Windows</code>、<code>Mac OS</code>和<code>Android</code>",
type: "warning",
showCancelButton: true,
confirmButtonText: "继续导入",
cancelButtonText: "取消"
};
Swal.fire(a).then(e => {
e.value && (window.location.href = "clash://install-config?url=" + t)
}
)
}
if ("clash" == e)
if (IsWindows() || IsMac() || IsAndroid() || IsiOS())
window.location.href = t;
else {
var a = {
title: "您的设备可能不支持",
html: "<code>clash-verge</code>一键导入仅支持<code>Windows</code>、<code>Mac OS</code>和<code>Android</code>",
type: "warning",
showCancelButton: true,
confirmButtonText: "继续导入",
cancelButtonText: "取消"
};
Swal.fire(a).then(e => {
e.value && (window.location.href = t)
}
)
}
if ("hiddify" == e)
if (IsWindows() || IsMac() || IsAndroid() || IsiOS())
window.location.href = t;
else {
var a = {
title: "您的设备可能不支持",
html: "<code>hiddify</code>一键导入仅支持<code>Windows</code>、<code>Mac OS</code>、<code>IOS</code>和<code>Android</code>",
type: "warning",
showCancelButton: true,
confirmButtonText: "继续导入",
cancelButtonText: "取消"
};
Swal.fire(a).then(e => {
e.value && (window.location.href = t)
}
)
}
if ("singbox" == e)
if (IsWindows() || IsMac() || IsAndroid() || IsiOS())
window.location.href = t;
else {
var a = {
title: "您的设备可能不支持",
html: "<code>singbox</code>一键导入仅支持<code>Windows</code>、<code>Mac OS</code>、<code>IOS</code>和<code>Android</code>",
type: "warning",
showCancelButton: true,
confirmButtonText: "继续导入",
cancelButtonText: "取消"
};
Swal.fire(a).then(e => {
e.value && (window.location.href = t)
}
)
}
if ("shadowrocket" == e) {
o = window.btoa(t);
if (IsiOS())
window.location.href = "sub://" + o;
else {
var n = {
title: "您的设备可能不支持",
html: "<code>Shadowrocket</code>一键导入仅支持<code>Apple iOS</code>端",
type: "warning",
showCancelButton: true,
confirmButtonText: "继续导入",
cancelButtonText: "取消"
};
Swal.fire(n).then(e => {
e.value && (window.location.href = "sub://" + o)
}
)
}
}
if ("quantumult" == e) {
var s = (o = window.btoa(t)).replace(/=/g, "");
if (IsiOS())
window.location.href = "quantumult://configuration?server=" + s;
else {
var l = {
title: "您的设备可能不支持",
html: "<code>Quantumult</code>一键导入仅支持<code>Apple iOS</code>端设备",
type: "warning",
showCancelButton: true,
confirmButtonText: "继续导入",
cancelButtonText: "取消"
};
Swal.fire(l).then(e => {
e.value && window.open("quantumult://configuration?server=" + s)
}
)
}
}
if ("quantumult_v2" == e) {
s = (o = window.btoa(t)).replace(/=/g, "");
if (IsiOS())
window.location.href = "quantumult://configuration?server=" + s;
else {
var c = {
title: "您的设备可能不支持",
html: "<code>Quantumult</code>一键导入仅支持<code>Apple iOS</code>端设备",
type: "warning",
showCancelButton: true,
confirmButtonText: "继续导入",
cancelButtonText: "取消"
};
Swal.fire(c).then(e => {
e.value && (window.location.href = "quantumult://configuration?server=" + s)
}
)
}
}
}
function qrcodeImport(e, t) {
switch (e) {
case "shadowrocket":
$("#qrcode-sublink-content").html('<div class="text-center"><p>使用 ' + e + ' 客户端扫码</p><div align="center" id="qrcode" style="padding-top:10px;"></div></div>');
var o = {};
o.text = t,
$("#qrcode").qrcode(o),
$("#qrcode-sublink-modal").modal()
}
}
/**
* 购买流量包
*/
function buyTrafficPackage() {
$(".buyTrafficPackage").text("购买中").attr("disabled", true),
$.ajax({
type: "POST",
url: "/user/shop/buytrafficpackage",
dataType: "json",
data: {
traffic: $(".touchspin-step").val(),
price: $("#traffic_price_2").val()
},
success: e => {
if (e.ret) {
$(".buyTrafficPackage").text("购买").attr("disabled", false);
var t = {
type: "success"
};
t.title = e.msg,
t.timer = 1500,
t.showConfirmButton = false,
Swal.fire(t),
window.setTimeout("location.href='/user'", 1e3)
} else {
$(".buyTrafficPackage").text("购买").attr("disabled", false);
var o = {
type: "error",
title: "出错啦"
};
o.html = e.msg,
Swal.fire(o)
}
}
})
}
function payasyougo() {
$.ajax({
type: "POST",
url: "quantitypay",
dataType: "json",
data: {},
success: function (e) {
if (e.ret) {
var t = {
type: "success"
};
t.title = e.msg,
t.showCloseButton = false,
swal.fire(t),
window.setTimeout("location.href='/user'", 1e3)
} else {
var o = {
type: "error",
title: "启用失败",
showCloseButton: true
};
o.text = e.msg,
swal.fire(o)
}
},
error: function (e) {
var t = {
type: "error",
title: "出现错误",
showCloseButton: true
};
t.text = data.msg,
swal.fire(t)
}
})
}
function delete_modal_show(e) {
var t = {};
t.id = e,
$.ajax({
type: "DELETE",
url: "/user/bought",
dataType: "json",
data: t,
success: function (e) {
if (e.ret) {
var t = {
type: "success"
};
t.title = e.msg,
t.showCloseButton = false,
swal.fire(t),
window.setTimeout("location.href='/user/code'", 1e3)
} else {
var o = {
type: "error",
title: "关闭失败",
showCloseButton: true
};
o.text = e.msg,
swal.fire(o)
}
},
error: function (e) {
var t = {
type: "error",
title: "出现错误",
showCloseButton: true
};
swal.fire(t)
}
})
}
function codeTopup() {
$.ajax({
type: "POST",
url: "code",
dataType: "json",
data: {
code: $("#pay_code").val()
},
success: function (e) {
if (e.ret) {
var t = {
type: "success"
};
t.title = e.msg,
t.timer = 1500,
t.showConfirmButton = false,
Swal.fire(t),
window.setTimeout("location.href=window.location.href", 1500)
} else {
var o = {
type: "error"
};
o.title = e.msg,
o.timer = 1500,
o.showConfirmButton = false,
Swal.fire(o)
}
},
error: function (e) {
Swal.fire({
type: "error",
title: "发生错误:" + e.status
})
}
})
}
function walletTopup(e) {
var t = parseFloat($(".code_pay").html());
"cool" == paymentSystem && coolpay(e, t)
}
function coolpay(e, t, o = 0) {
$.ajax({
url: "/user/payment/purchase/epay",
data: {
price: t,
type: e,
shopid: o,
coupon: $("#coupon").val()
},
dataType: "json",
type: "POST",
success: function (o) {
if (o.ret) {
var r = (i = document.location.toString().split("#")[0].split("?")[0]).split("//")[1].split("/")[2];
if ("url" == o.type)
"code" == r ? window.location.href = o.url : ($("#coolpay-modal").modal("show"),
$("#to-coolpay").attr("href", o.url));
else if ("qrcode" == o.type) {
var i = encodeURIComponent(o.url)
, a = "/user/qrcode?type=" + e + "&qrcode=" + i + "&tradeno=" + o.tradeno + "&price=" + t;
"code" == r ? window.location.href = a : ($("#coolpay-modal").modal("show"),
$("#to-coolpay").attr("href", a))
}
} else
Swal.fire("发生错误", o.msg, "error")
}
})
}
function topUp(e, t, o = null) {
"cool" == paymentSystem && coolpay(t, e, o)
}
function f() {
var e = {};
e.pid = pid,
$.ajax({
type: "POST",
url: "/payment/status",
dataType: "json",
data: e,
success: e => {
e.result && (Swal.fire({
title: "成功充值" + $(".code_pay").html() + "元",
icon: "success",
button: "确定"
}),
window.setTimeout("location.href='/user/code'", 1e3))
}
,
error: e => {
Swal.fire(e)
}
}),
tid = setTimeout(f, 1e3)
}
function Conversion() {
$.ajax({
type: "POST",
url: "/user/shop/packageconversion",
dataType: "json",
data: {},
success: function (e) {
if (e.ret)
$("#PackageConversion-modal").modal("show"),
$("#zs_name").text("商品名称:" + e.name),
$("#zs_type").text("计算模式:" + e.type),
$("#zs_the").text("返还金额:" + e.money_a),
$("#zs_ppt").text("手续费率:" + e.hdpr + "%"),
$("#zs_used").text("手续费用:" + e.hdfe),
$("#zs_money").text("实际返还:" + e.money);
else {
var t = {
type: "error"
};
t.title = e.msg,
Swal.fire(t)
}
},
error: function (e) {
var t = {
type: "error",
title: "发生错误"
};
Swal.fire(t)
}
})
}
function Readeem() {
$.ajax({
type: "POST",
url: "/user/redeem",
dataType: "json",
data: {
code: $("#code_goods").val()
},
success: function (e) {
if (e.ret) {
var t = {
type: "success"
};
t.title = e.msg,
Swal.fire(t),
window.setTimeout("location.href='/user'", 1500)
} else {
var o = {
type: "warning",
title: "兑换失败"
};
o.html = e.msg,
Swal.fire(o)
}
}
})
}
function edit_user(e) {
if (document.getElementById("customSwitch3").checked)
var t = 1;
else
t = 0;
$.ajax({
type: "POST",
url: "/user/agent/view/" + e,
dataType: "json",
data: {
mode: "edit_user",
name: $("#user_name").val(),
email: $("#email").val(),
passwd: $("#passwd").val(),
enable: t,
node_connector: $("#node_connector").val(),
node_speedlimit: $("#node_speedlimit").val()
},
success: function (e) {
if (e.ret) {
var t = {
type: "success"
};
t.title = e.msg,
t.timer = 1500,
t.allowOutsideClick = true,
t.showConfirmButton = false,
Swal.fire(t),
window.location.reload()
} else {
var o = {
type: "error"
};
o.title = e.msg,
o.timer = 1500,
o.allowOutsideClick = true,
o.showConfirmButton = false,
Swal.fire(o)
}
}
})
}
function edit_user_reset_link(e) {
$.ajax({
type: "POST",
url: "/user/agent/view/" + e,
dataType: "json",
data: {
mode: "reset_link"
},
success: function (e) {
if (e.ret) {
var t = {
type: "success"
};
t.title = e.msg,
t.timer = 1500,
t.allowOutsideClick = true,
t.showConfirmButton = false,
Swal.fire(t),
window.location.reload()
} else {
var o = {
type: "error"
};
o.title = e.msg,
o.timer = 1500,
o.allowOutsideClick = true,
o.showConfirmButton = false,
Swal.fire(o)
}
}
})
}
function buy_user_shop(e) {
$.ajax({
type: "POST",
url: "/user/agent/view/" + e,
dataType: "json",
data: {
mode: "buy_shop",
shopid: $("#edit_user_shop option:selected").val()
},
success: function (e) {
if (e.ret) {
var t = {
type: "success"
};
t.title = e.msg,
t.timer = 1500,
t.allowOutsideClick = true,
t.showConfirmButton = false,
Swal.fire(t),
window.location.reload()
} else {
var o = {
type: "error"
};
o.title = e.msg,
o.timer = 1500,
o.allowOutsideClick = true,
o.showConfirmButton = false,
Swal.fire(o)
}
}
})
}
function buy_Invite() {
$.ajax({
type: "POST",
url: "/user/buy_invite",
dataType: "json",
data: {
num: $("#buy-invite-num").val()
},
success: function (e) {
if (e.ret) {
var t = {
type: "success"
};
t.title = e.msg,
t.timer = 1500,
t.showConfirmButton = false,
Swal.fire(t),
window.setTimeout("location.href='/user/invite'", 1e3)
} else {
var o = {
type: "error"
};
o.title = e.msg,
o.timer = 1500,
o.showConfirmButton = false,
Swal.fire(o)
}
},
error: function (e) {
var t = {
type: "error"
};
t.title = data.msg,
t.html = "出现了一些错误",
t.timer = 1500,
t.showConfirmButton = false,
Swal.fire(t)
}
})
}
function custom_invite_confirm() {
$("#custom-invite-confirm").text("定制中").addClass("kt-spinner kt-spinner--right kt-spinner--sm kt-spinner--light").attr("disabled", true),
$.ajax({
type: "POST",
url: "/user/custom_invite",
dataType: "json",
data: {
customcode: $("#custom-invite-link").val()
},
success: e => {
if ($("#custom-invite-confirm").text("确定").removeClass("kt-spinner kt-spinner--right kt-spinner--sm kt-spinner--light").attr("disabled", false),
e.ret) {
var t = {
type: "success"
};
t.title = e.msg,
t.showConfirmButton = false,
Swal.fire(t),
setTimeout(function () {
window.location.reload()
}, 1500)
} else {
var o = {
type: "error",
title: "出错啦"
};
o.html = e.msg,
Swal.fire(o)
}
}
,
error: e => {
$("#custom-invite-confirm").text("确定").removeClass("kt-spinner kt-spinner--right kt-spinner--sm kt-spinner--light").attr("disabled", false);
var t = {
type: "error"
};
t.title = data.msg,
t.html = "出现了一些错误",
t.timer = 1500,
t.showConfirmButton = false,
Swal.fire(t)
}
})
}
function urlChange(e, t, o) {
var r = "./node/" + e + "?ismu=" + t + "&relay_rule=" + o;
if ("guide" == e) {
var i = document.getElementById("infoifram").contentWindow.document;
i.open(),
i.write('<img src="../images/node.gif" style="width: 100%;height: 100%; border: none;"/>'),
i.close()
} else
document.getElementById("infoifram").src = r;
$("#nodeinfo").modal()
}
function UsernodeInfo() {
var e = {
type: "warning",
title: "友情提示",
html: "请通过订阅方式来获得节点信息!"
};
Swal.fire(e)
}
function nodeFilterSave() {
var e = [];
$("[name = nodes_id-filter]:checkbox").each(function (t) {
1 == $(this).prop("checked") && e.push($(this).val())
}),
$.ajax({
type: "POST",
url: "/user/node_filter",
dataType: "json",
data: {
filter_mode: $("#filter_mode option:selected").val(),
filter_sort: $("#filter_sort option:selected").val(),
nodes_class_value: $("input[name='radio-nodes_class-filter']:checked").val(),
nodes_id: e
},
success: function (e) {
e.ret ? (swal({
type: "success",
title: "请求成功",
text: e.msg
}),
window.setTimeout("location.href='/user/node'", 1500)) : Swal.fire("发生错误", e.msg, "error")
}
})
}
//function UserClassinsufficient() {
// var e = {
// type: "error",
// title: "等级不足",
// html: "您当前套餐等级不支持使用此节点"
// };
// Swal.fire(e)
//}
_0x14bf9e(),
// $(function () {
// for (var e = window.location, t = $(".sidebarnav a").filter(function () {
// return this.href == e
// }).addClass("active").parent().addClass("active"); t.is("li");)
// t = t.parent().addClass("in").parent().addClass("active")
// }),
$(function () {
var $activeLink;
if (typeof menuSelect == 'undefined') {
$activeLink = $(".sidebarnav a").filter(function () {
return this.href == window.location;
});
} else {
$activeLink = $(".sidebarnav a").filter(function () {
return this.href == window.location.origin+menuSelect;
});
}
var $parentListItem = $activeLink.addClass("active").parent().addClass("active");
for (; $parentListItem.is("li");) {
$parentListItem = $parentListItem.parent().addClass("in").parent().addClass("active");
}
}),
$(function () {
new ClipboardJS(".copy-text")
}),
$(".copy-text").click(function () {
var e = {
type: "success",
title: "已复制到剪贴板",
timer: 1500,
allowOutsideClick: true,
showConfirmButton: false
};
Swal.fire(e)
}),
$("#checkin").click(function () {
$("#checkin").text("正在签到").attr("disabled", true),
$.ajax({
type: "POST",
url: "/user/checkin",
dataType: "json",
success: function (e) {
Swal.fire("签到成功", e.msg, "success").then(function () {
window.location.reload()
})
},
error: function (e) {
Swal.fire("发生错误", e.status, "error").then(function () {
window.location.reload()
})
}
})
}),
$("#ga-enable-false").click(function () {
if ("" != $("#ga-passwd").val())
$("#ga-enable-false").text("正在关闭").attr("disabled", true),
$.ajax({
type: "POST",
url: "gaset",
dataType: "json",
data: {
enable: 0,
passwd: $("#ga-passwd").val()
},
success: e => {
if (e.ret) {
var t = {
type: "success"
};
t.title = e.msg,
t.timer = 1500,
t.allowOutsideClick = true,
t.showConfirmButton = false,
Swal.fire(t),
window.setTimeout("location.href='/user/profile'", 1e3)
} else {
var o = {
type: "error"
};
o.title = e.msg,
o.timer = 1500,
o.allowOutsideClick = true,
o.showConfirmButton = false,
Swal.fire(o),
window.setTimeout("location.href='/user/profile'", 1e3)
}
}
,
error: e => {
var t = {
type: "error",
title: "出现错误"
};
t.html = data.msg,
t.timer = 1500,
t.allowOutsideClick = true,
t.showConfirmButton = false,
Swal.fire(t)
}
});
else {
var e = {
type: "error",
title: "请输入密码",
timer: 1500,
allowOutsideClick: true,
showConfirmButton: false
};
Swal.fire(e)
}
}),
$(".ga_passwd-password").click(function () {
$("#ga_passwd-none").toggle(),
$("#ga_passwd-show").toggle(),
"password" == $("#ga-passwd").attr("type") ? $("#ga-passwd").attr("type", "text") : $("#ga-passwd").attr("type", "password")
}),
$("#unblock").click(function () {
$.ajax({
type: "POST",
url: "unblock",
dataType: "json",
data: {},
success: function (e) {
if (e.ret) {
var t = {
type: "success",
title: "提交成功",
timer: 1500,
allowOutsideClick: true,
showConfirmButton: false
};
Swal.fire(t),
window.setTimeout("location.href='/user/profile'", 1e3)
} else {
var o = {
type: "error"
};
o.title = e.msg,
o.timer = 1500,
o.allowOutsideClick = true,
o.showConfirmButton = false,
Swal.fire(o)
}
},
error: function (e) {
Swal.fire({
type: "error",
title: "提示",
html: data.msg + " 出现了一些错误。",
timer: 1500,
allowOutsideClick: true,
showConfirmButton: false
})
}
})
}),
$(".delete_passwd-password").click(function () {
$("#delete_passwd-none").toggle(),
$("#delete_passwd-show").toggle(),
"password" == $("#delete_passwd").attr("type") ? $("#delete_passwd").attr("type", "text") : $("#delete_passwd").attr("type", "password")
}),
$("#Conversion_ok").click(function () {
var e = {
ok: "ok"
};
$.ajax({
type: "POST",
url: "/user/shop/packageconversion",
dataType: "json",
data: e,
success: function (e) {
if (e.ret) {
var t = {
type: "success",
title: "操作成功"
};
t.html = e.msg,
Swal.fire(t),
window.setTimeout("location.href='/user/code'", 1500)
} else {
var o = {
type: "error"
};
o.title = e.msg,
Swal.fire(o)
}
},
error: function (e) {
var t = {
type: "error",
title: "发生错误"
};
Swal.fire(t)
}
})
}),
$(function () {
$.fn.modal.Constructor.prototype._enforceFocus = function () { }
,
new ClipboardJS(".copy-modal")
}),
$(".copy-modal").click(function () {
var e = {
type: "success",
title: "已复制到剪贴板",
timer: 1500,
allowOutsideClick: true,
showConfirmButton: false
};
Swal.fire(e)
}),
$("#ss-random-password").click(function () {
let e = Math.random().toString(36).substr(2);
$("#ss-password").attr("value", e)
}),
$("#ss-pwd-update").click(function () {
$.ajax({
type: "POST",
url: "sspwd",
dataType: "json",
data: {
sspwd: $("#ss-password").val()
},
success: function (e) {
if (e.ret) {
var t = {
type: "success",
title: "修改成功",
timer: 1500,
allowOutsideClick: true,
showConfirmButton: false
};
Swal.fire(t),
setTimeout(function () {
window.location.reload()
}, 1500)
} else {
var o = {
type: "error",
title: "修改失败",
timer: 1500,
allowOutsideClick: true,
showConfirmButton: false
};
Swal.fire(o)
}
}
})
}),
$("#method-confirm").click(function () {
$.ajax({
type: "POST",
url: "method",
dataType: "json",
data: {
method: $("#method-select").val()
},
success: function (e) {
if (e.ret) {
var t = {
type: "success",
title: "修改成功",
timer: 1500,
allowOutsideClick: true,
showConfirmButton: false
};
Swal.fire(t),
setTimeout(function () {
window.location.reload()
}, 1500)
} else {
var o = {
type: "error",
title: "修改失败",
timer: 1500,
allowOutsideClick: true,
showConfirmButton: false
};
Swal.fire(o)
}
}
})
}),
$("#reset-port").click(function () {
$.ajax({
type: "POST",
url: "resetport",
dataType: "json",
data: {},
success: function (e) {
if (e.ret)
Swal.fire({
type: "success",
title: "重置成功",
html: "新端口是 " + e.msg,
timer: 2500,
allowOutsideClick: true,
showConfirmButton: false
}),
setTimeout(function () {
window.location.reload()
}, 1500);
else {
var t = {
type: "error"
};
t.title = e.msg,
t.timer = 1500,
t.allowOutsideClick = true,
t.showConfirmButton = false,
Swal.fire(t)
}
}
})
}),
$("#port-specify-set").click(function () {
$.ajax({
type: "POST",
url: "specifyport",
dataType: "json",
data: {
port: $("#port-specify-reset").val()
},
success: function (e) {
if (e.ret) {
var t = {
type: "success"
};
t.title = e.msg,
t.timer = 1500,
t.allowOutsideClick = true,
t.showConfirmButton = false,
Swal.fire(t),
setTimeout(function () {
window.location.reload()
}, 1500)
} else {
var o = {
type: "error"
};
o.title = e.msg,
o.timer = 1500,
o.allowOutsideClick = true,
o.showConfirmButton = false,
Swal.fire(o)
}
}
})
}),
$("#protocol-obfs-confirm").click(function () {
$.ajax({
type: "POST",
url: "ssr",
dataType: "json",
data: {
protocol: $("#protocol-selection").val(),
obfs: $("#obfs").val(),
obfs_param: $("#obfs-param").val()
},
success: function (e) {
if (e.ret) {
var t = {
type: "success",
title: "修改成功"
};
t.html = e.msg,
t.timer = 2500,
t.allowOutsideClick = true,
t.showConfirmButton = false,
Swal.fire(t),
setTimeout(function () {
window.location.reload()
}, 1500)
} else {
var o = {
type: "error",
title: "修改失败"
};
o.html = e.msg,
o.timer = 1500,
o.allowOutsideClick = true,
o.showConfirmButton = false,
Swal.fire(o)
}
}
})
});