mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
38 lines
721 B
JavaScript
38 lines
721 B
JavaScript
$("#qu_id").change(function(event)
|
|
{
|
|
RefreshQuPluralTestingResult();
|
|
});
|
|
|
|
$("#amount").keyup(function(event)
|
|
{
|
|
RefreshQuPluralTestingResult();
|
|
});
|
|
|
|
$("#amount").change(function(event)
|
|
{
|
|
RefreshQuPluralTestingResult();
|
|
});
|
|
|
|
function RefreshQuPluralTestingResult()
|
|
{
|
|
var singularForm = $("#qu_id option:selected").data("singular-form");
|
|
var pluralForm = $("#qu_id option:selected").data("plural-form");
|
|
var amount = $("#amount").val();
|
|
|
|
if (!singularForm || !amount)
|
|
{
|
|
return;
|
|
}
|
|
|
|
animateCSS("h2", "shake");
|
|
$("#result").text(__n(amount, singularForm, pluralForm, true));
|
|
}
|
|
|
|
if (GetUriParam("qu") !== undefined)
|
|
{
|
|
$("#qu_id").val(GetUriParam("qu"));
|
|
$("#qu_id").trigger("change");
|
|
}
|
|
|
|
$("#amount").focus();
|