fixes #547
This commit is contained in:
30
app/assets/javascripts/artists.js
Normal file
30
app/assets/javascripts/artists.js
Normal file
@@ -0,0 +1,30 @@
|
||||
(function() {
|
||||
Danbooru.Artist = {};
|
||||
|
||||
Danbooru.Artist.initialize_all = function() {
|
||||
if ($("#c-artists").length) {
|
||||
Danbooru.Artist.initialize_check_name_link();
|
||||
}
|
||||
}
|
||||
|
||||
Danbooru.Artist.initialize_check_name_link = function() {
|
||||
$("#check-name-link").click(function(e) {
|
||||
var artist_name = $("#artist_name").val();
|
||||
$.get("/artists.json?name=" + artist_name,
|
||||
function(data) {
|
||||
if (data.length) {
|
||||
$("#check-name-result").html("Taken")
|
||||
} else {
|
||||
$("#check-name-result").html("OK")
|
||||
}
|
||||
}
|
||||
);
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
Danbooru.Artist.initialize_all();
|
||||
});
|
||||
Reference in New Issue
Block a user