mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
General improvements
This commit is contained in:
17
grocy.js
17
grocy.js
@@ -2,8 +2,11 @@
|
||||
|
||||
$(function()
|
||||
{
|
||||
var menuItem = $('.nav-sidebar').find("[data-nav-for-page='" + Grocy.ContentPage + "']");
|
||||
var menuItem = $('.nav').find("[data-nav-for-page='" + Grocy.ContentPage + "']");
|
||||
menuItem.addClass('active');
|
||||
|
||||
$.timeago.settings.allowFuture = true;
|
||||
$('time.timeago').timeago();
|
||||
});
|
||||
|
||||
Grocy.FetchJson = function(url, success, error)
|
||||
@@ -33,7 +36,7 @@ Grocy.FetchJson = function(url, success, error)
|
||||
|
||||
xhr.open('GET', url, true);
|
||||
xhr.send();
|
||||
}
|
||||
};
|
||||
|
||||
Grocy.PostJson = function(url, jsonData, success, error)
|
||||
{
|
||||
@@ -63,4 +66,12 @@ Grocy.PostJson = function(url, jsonData, success, error)
|
||||
xhr.open('POST', url, true);
|
||||
xhr.setRequestHeader('Content-type', 'application/json');
|
||||
xhr.send(JSON.stringify(jsonData));
|
||||
}
|
||||
};
|
||||
|
||||
Grocy.EmptyElementWhenMatches = function(selector, text)
|
||||
{
|
||||
if ($(selector).text() === text)
|
||||
{
|
||||
$(selector).text('');
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user