48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
$(function () {
|
|
|
|
message.sendAction("getVersionInfo", null, function (info) {
|
|
$("#versionInfo").html("v" + info.curVersion);
|
|
if (info.updateInfo && info.updateInfo.version && info.updateInfo.hasUpdate) {
|
|
$("#updatesFound").show().find("strong").html(info.updateInfo.version).end().find("a").attr("href", info.updateInfo.url || "http://www.liebao.cn/");
|
|
} else {
|
|
$("#updatesFound").hide();
|
|
}
|
|
});
|
|
});
|
|
|
|
$(function() {
|
|
var refreshSysConfig = function () {
|
|
$("input[data-sysconfigkey], select[data-sysconfigkey]").each(function () {
|
|
var ele = this;
|
|
var $ele = $(this);
|
|
var type = ele.type;
|
|
var key = ele.dataset.sysconfigkey;
|
|
|
|
var profile = sysConfig;
|
|
var propertyvalue = profile[key];
|
|
if (typeof propertyvalue == 'boolean') {
|
|
if (type == "radio") {
|
|
$("input[name=" + ele.name + "][value=" + (propertyvalue ? 1 : 0) + "]")[0].checked = true;
|
|
} else if (type == "checkbox") {
|
|
ele.checked = propertyvalue;
|
|
} else {
|
|
$ele.val(propertyvalue ? "1" : "0");
|
|
}
|
|
} else {
|
|
$ele.val(propertyvalue);
|
|
}
|
|
});
|
|
};
|
|
|
|
$(document).on("sysConfigUpdated", function () {
|
|
refreshSysConfig();
|
|
});
|
|
if (sysConfig)
|
|
refreshSysConfig();
|
|
|
|
$("#chkEnableAutoCaptcha").change(function () {
|
|
message.sendAction("setUserConfig", { enableAutoCaptcha: this.checked });
|
|
});
|
|
|
|
});
|