...
|
...
|
@@ -1330,6 +1330,74 @@ define('yohood', function(require, exports) { |
|
|
$(this).attr('src', src + '?1');
|
|
|
});
|
|
|
|
|
|
({
|
|
|
key: (function() {
|
|
|
var href = location.href.split("/"),
|
|
|
index = href.indexOf("onlinereg");
|
|
|
return href[index + 1];
|
|
|
}()),
|
|
|
|
|
|
setStroage: function(data) {
|
|
|
var dataString = JSON.stringify(data),
|
|
|
href = location.href.split("/"),
|
|
|
index = href.indexOf("onlinereg");
|
|
|
|
|
|
key = href[index + 1];
|
|
|
|
|
|
window.localStorage.setItem(this.key, dataString)
|
|
|
},
|
|
|
getStroage: function(key) {
|
|
|
return JSON.parse(window.localStorage.getItem(key));
|
|
|
},
|
|
|
clearStroage: function(key) {
|
|
|
window.localStorage.removeItem(key);
|
|
|
},
|
|
|
computedData: function(data) {
|
|
|
var $form = $("form"),
|
|
|
$elem = $form.find("input, textarea"),
|
|
|
key = "",
|
|
|
len = 0;
|
|
|
|
|
|
for (key in data) {
|
|
|
if (data.hasOwnProperty(key)) {
|
|
|
$elem = $form.find("input[name=" + key + "], textarea[name=" + key + "]");
|
|
|
if ($elem.size() > 0) {
|
|
|
if ($elem.attr("type") === "radio") {
|
|
|
console.log($elem.parent("div").find("input[value=" + data[key] + "]"));
|
|
|
$elem.parent("div").find("input[value=" + data[key] + "]")[0].checked = true;
|
|
|
} else {
|
|
|
$elem.val(data[key]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
var that = this,
|
|
|
data = {};
|
|
|
|
|
|
data = this.getStroage(this.key);
|
|
|
|
|
|
this.computedData(data);
|
|
|
|
|
|
$("input,textarea").on("keyup", function() {
|
|
|
getFormData(that.setStroage);
|
|
|
});
|
|
|
|
|
|
$("input[type=radio]").on("change", function() {
|
|
|
getFormData(that.setStroage);
|
|
|
});
|
|
|
|
|
|
$(".content-header a").on("click", function() {
|
|
|
that.clearStroage(that.key);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
}).init();
|
|
|
|
|
|
function getFormData(callback) {
|
|
|
|
|
|
var $formBox;
|
...
|
...
|
@@ -1388,6 +1456,7 @@ define('yohood', function(require, exports) { |
|
|
code: code,
|
|
|
type: type
|
|
|
};
|
|
|
|
|
|
callback(resData);
|
|
|
}
|
|
|
|
...
|
...
|
|