function saveConfig() {
var configName = document.title;
if (!localStorage) return;
var Config = {};
var index = 0;
var inputs = $('#searchForm input');
inputs.each(function (ind, input) {
var type = input.type;
switch (type) {
case "text": Config[index] = input.value; break;
case "checkbox": Config[index] = input.checked; break;
case "hidden": Config[index] = input.value; break;
default: console.error("unknow type");
}
index++;
});
localStorage.setItem(configName, JSON.stringify(Config));
console.log(configName + " - " + JSON.stringify(Config));
}
function loadConfig() {
var configName = document.title;
if (localStorage && localStorage.getItem(configName)) {
Config = JSON.parse(localStorage.getItem(configName));
var index = 0;
var inputs = $('#searchForm input');
inputs.each(function (ind, input) {
var type = input.type;
switch (type) {
case "text": input.value = Config[index]; break;
case "checkbox": input.checked = Config[index]; break;
case "hidden": input.value = Config[index]; break;
default: console.error("unknow type");
}
index++;
});
}
}