📄 wm_base.js
字号:
jspp.using("mocom.WAPmo.Kernel");
jspp.using("mocom.WAPmo.OptionCard");
jspp.using("mocom.WAPmo.ImageBox");
function getPalette(objPtr, frmId, objId)
{
jspp.using("mocom.WAPmo.Palette");
Palette.show();
Palette.accept.onclick = function()
{
objPtr.style.backgroundColor = Palette.returnValue;
var frm = document.getElementById(frmId);
if (frm)
{
eval("frm." + objId + ".value = Palette.returnValue");
}
Palette.close();
};
}
function autoSetColor(me, objId)
{
if (me.value.isColor())
{
var obj = document.getElementById(objId);
obj.style.backgroundColor = me.value;
}
}
function chkModule(src)
{
for (var i = 1; i< arguments.length; i++)
{
arguments[i].disabled = (src.checked==false);
}
}
function CheckDown(frm, x)
{
frm.DownWidth.disabled = (x==1);
frm.DownHeight.disabled = (x==1);
frm.DownConfig.disabled = (x==0);
}
function IsRule(me, s)
{
var lst = me.options;
for (var i=0; i<lst.length; i++)
{
if (s.toUpperCase() == lst[i].value.toUpperCase()) return(true);
}
return(false);
}
function ChkSelect(me)
{
var arg = arguments;
for (var i=1; i<arg.length; i++)
{
arg[i].disabled = (me.selectedIndex==-1);
}
}
function SelectAll(dst)
{
for (var i=0; i<dst.length; i++)
{
dst[i].selected = true;
}
}
function ValidIP(s)
{
var reg = /^(\d+)\.(\d+)\.([*]|\d+)\.([*]|\d+)$/;
if (reg.test(s))
{
s.match(reg);
return((RegExp.$1 <= 255) && (RegExp.$1 >= 0)
&& (RegExp.$2 <= 255) && (RegExp.$2 >= 0)
&& (RegExp.$3=='*' || (RegExp.$3 <= 255 && RegExp.$3 >= 0))
&& (RegExp.$4=='*' || (RegExp.$4 <= 255 && RegExp.$4 >= 0))
);
}
return(false);
}
function SetIPRule(me)
{
switch (me.value)
{
case "0":
document.getElementById("IP_DIV0").style.display = "none";
document.getElementById("IP_DIV1").style.display = "none";
break;
case "1":
document.getElementById("IP_DIV0").style.display = "";
document.getElementById("IP_DIV1").style.display = "none";
break;
case "2":
document.getElementById("IP_DIV0").style.display = "none";
document.getElementById("IP_DIV1").style.display = "";
break;
}
}
function getFocus(me)
{
me.value = "";
me.focus();
}
function AddIPRule(dst, me)
{
if (me.value == null || me.value == "")
{
MessageBox.show(MSG_WARNING, "请先输入IP地址");
MessageBox.doAccept(function()
{
getFocus(me);
}, true);
}
else if (ValidIP(me.value)==false)
{
MessageBox.show(MSG_WARNING, "IP地址格式错误");
MessageBox.doAccept(function()
{
getFocus(me);
}, true);
}
else if (IsRule(dst, me.value)==true)
{
MessageBox.show(MSG_HINT, "该IP地址已在列表中了");
MessageBox.doAccept(function()
{
getFocus(me);
}, true);
}
else
{
dst.options[dst.options.length] = new Option(me.value, me.value);
getFocus(me);
}
}
function DelIPRule(dst, me)
{
var x = dst.selectedIndex;
if (x==-1)
{
MessageBox.show(MSG_HINT, "请先选择您要删除的IP地址");
}
else
{
dst.options[x] = null;
ChkSelect(dst, me);
}
}
function IPSubmit(me)
{
var frm = me.form;
if (frm.IPRule0) SelectAll(frm.IPRule0.options);
if (frm.IPRule1) SelectAll(frm.IPRule1.options);
Form.submit(me);
}
function UASubmit(me)
{
var frm = me.form;
if (frm.UARule) SelectAll(frm.UARule.options);
Form.submit(me);
}
function AddUARule(dst, me)
{
if (me.value == null || me.value == "")
{
MessageBox.show(MSG_WARNING, "请先输入终端标识");
MessageBox.doAccept(function()
{
getFocus(me);
}, true);
}
else if (IsRule(dst, me.value)==true)
{
MessageBox.show(MSG_WARNING, "该终端标识已在列表中了");
MessageBox.doAccept(function()
{
getFocus(me);
}, true);
}
else
{
dst.options[dst.options.length] = new Option(me.value, me.value);
getFocus(me);
}
}
function DelUARule(dst, me)
{
var x = dst.selectedIndex;
if (x==-1)
{
MessageBox.show(MSG_WARNING, "请先选择您要删除的终端标识");
}
else
{
dst.options[x] = null;
ChkSelect(dst, me);
}
}
jspp.Templet.list.push(["frmMain", "Templet"]);
window.onload = function()
{
var opt = new OptionCard();
opt.add("基本配置");
opt.add("首页配置");
opt.add("插件配置");
opt.add("上传下载配置");
opt.add("IP访问规则");
opt.add("用户终端规则");
opt.make(document.body, 5, 5);
opt.lock(jspp.Option);
Simulator.open("index.asp");
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -