mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
(refs #13)Fix real-time validation for filename and Add line wrap mode switcher
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user