Light12306/RwTicketAssistantV3/app/pages/scripts/about.js

48 lines
1.3 KiB
JavaScript
Raw Normal View History

2015-07-03 21:04:37 +08:00
$(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/");
2015-07-03 21:04:37 +08:00
} 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 });
});
});