Sha256: feeab41fa8e6d676d683d558715cbf4a583ff867a542136f7ace82ce7228082b

Contents?: true

Size: 871 Bytes

Versions: 3

Compression:

Stored size: 871 Bytes

Contents

var $form = $('form#comment_form');
if ($form.find('span#t').length == 0) {
    var time_elapsed = <%= @time_elapsed %>;
    var $error_text = $form.find("span#error_text");
    var $submit = $form.find('#comment_submit');
    var $message = $('<span>Чтобы оставить новый комментарий, Вам необходимо подождать <span id="t"><%= @time_elapsed %></span> сек</span>');
    var $time_elapsed = $message.find('span#t');
    $error_text.append($message);

    var refreshTimer = function () {
        time_elapsed -= 1;
        if (time_elapsed == 0) {
            $error_text.html('');
            $submit.removeClass('loading').removeAttr("disabled");
            clearInterval(interval);
        } else {
            $time_elapsed.text(time_elapsed);
        }
    };
    var interval = setInterval(refreshTimer, 1000);
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
c80_news_tz-0.1.1.26 app/views/c80_news_tz/comments/antispam.js.erb
c80_news_tz-0.1.1.25 app/views/c80_news_tz/comments/antispam.js.erb
c80_news_tz-0.1.1.24 app/views/c80_news_tz/comments/antispam.js.erb