mirror of
https://github.com/grocy/grocy.git
synced 2026-04-05 12:26:15 +02:00
This commit's contents were auto-generated. They wrap all viewjs
in functions and define a common prologue.
New file contents:
```js
function VIEWNAMEView(Grocy, scope = null)
{
var $scope = $;
if(scope != null)
{
$scope = $(scope).find;
}
// original contents indented with \t
}
```
50 lines
958 B
JavaScript
50 lines
958 B
JavaScript
function quantityunitpluraltestingView(Grocy, scope = null)
|
|
{
|
|
var $scope = $;
|
|
if (scope != null)
|
|
{
|
|
$scope = $(scope).find;
|
|
}
|
|
|
|
Grocy.Use("numberpicker");
|
|
|
|
$("#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.toString().isEmpty() || amount.toString().isEmpty())
|
|
{
|
|
return;
|
|
}
|
|
|
|
animateCSS("h2", "shake");
|
|
$("#result").text(__n(amount, singularForm, pluralForm));
|
|
}
|
|
|
|
if (GetUriParam("qu") !== undefined)
|
|
{
|
|
$("#qu_id").val(GetUriParam("qu"));
|
|
$("#qu_id").trigger("change");
|
|
}
|
|
|
|
$("#amount").focus();
|
|
|
|
}
|