(refs #13)Fix real-time validation for filename and Add line wrap mode switcher

This commit is contained in:
Naoki Takezoe
2014-04-28 10:39:32 +09:00
parent 7da2c650d2
commit 1c24090c14
3 changed files with 49 additions and 31 deletions

View File

@@ -44,4 +44,26 @@ function displayErrors(data){
}
i++;
});
}
}
(function($){
$.fn.watch = function(callback){
var timer = null;
var prevValue = this.val();
this.on('focus', function(e){
window.clearInterval(timer);
timer = window.setInterval(function(){
var newValue = $(e.target).val();
if(prevValue != newValue){
callback();
}
prevValue = newValue;
}, 10);
});
this.on('blur', function(){
window.clearInterval(timer);
});
};
})(jQuery);