barbass: поправки к ключу/видимости переменных

parent fc854341
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
*/ */
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
var time = 0; //время последнего запроса var etersoft_typos_time = 0; //время последнего запроса
window.document.onkeydown = function(e) { window.document.onkeydown = function(e) {
if (e.ctrlKey==1 && e.keyCode == 13) { if (e.ctrlKey==1 && e.keyCode == 13) {
...@@ -85,8 +85,8 @@ function ajax_query(url) { ...@@ -85,8 +85,8 @@ function ajax_query(url) {
e_typos_error("red", "Не отправляйте данные часто"); e_typos_error("red", "Не отправляйте данные часто");
return false; return false;
} else { } else {
time = this_time(); etersoft_typos_time = this_time();
set_storage("etersoft_typos/"+window.location.hostname+"", time); set_storage("etersoft_typos/"+window.location.hostname+"", etersoft_typos_time);
} }
request.open("POST", url, true); request.open("POST", url, true);
...@@ -122,7 +122,7 @@ function ajax_query(url) { ...@@ -122,7 +122,7 @@ function ajax_query(url) {
} }
request.onerror = function() { request.onerror = function() {
e_typos_error("red", "Ошибка отправки данных. Повторите позже"); e_typos_error("red", "Ошибка отправки данных. Повторите позже");
time = 0; etersoft_typos_time = 0;
} }
request.send(); request.send();
} }
...@@ -134,13 +134,13 @@ function e_typos_error(error, text) { ...@@ -134,13 +134,13 @@ function e_typos_error(error, text) {
} }
function timer() { function timer() {
sec = this_time(); var sec = this_time();
time_s = get_storage("etersoft_typos/"+window.location.hostname+""); var time_s = get_storage("etersoft_typos/"+window.location.hostname+"");
if (time_s != 0) { if (time_s != 0) {
time = time_s; etersoft_typos_time = time_s;
} }
if (this_time() - parseFloat(time) < 60000) { if (this_time() - parseFloat(etersoft_typos_time) < 60000) {
return 0; return 0;
} else { } else {
return 1; return 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment