notebook/app/assets/javascripts/generators.js.js
Euan Kemp d1301b74e2 decaffeinate the coffeescript
This commit is the result of just running
https://decaffeinate-project.org/ and making no additional changes.
2020-09-18 20:00:49 -07:00

47 lines
1.2 KiB
JavaScript

/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
$(document).ready(function() {
// Character name generator
$('.character_name_generator').click(function() {
const target = $(this).closest('.row').find('input[type=text]');
$.ajax({
dataType: 'text',
url: '/generate/character/name',
success(data) {
return target.val(data);
}
});
return 0;
});
// Character age generator
$('.character_age_generator').click(function() {
const target = $(this).closest('.row').find('input[type=text]');
$.ajax({
dataType: 'text',
url: '/generate/character/age',
success(data) {
return target.val(data);
}
});
return 0;
});
// Location name generator
return $('.location_name_generator').click(function() {
const target = $(this).closest('.row').find('input[type=text]');
$.ajax({
dataType: 'text',
url: '/generate/location/name',
success(data) {
return target.val(data);
}
});
return 0;
});
});