Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function refresh()
- {
- console.log(global);
- $('#favorites').html("");
- // List of bottles
- if (global == null || (global.params != null && Object.keys(global.params).length == 0) || (global.params && global.params.page))
- {
- app.GetRum().GetBottle().ListFavorites().then(function(res)
- {
- if (res.result == 200)
- {
- var list = [];
- for (var i = 0; i < res.favorites.length; i++)
- {
- list[i] = res.favorites[i].bottle_id;
- }
- app.GetRum().GetBottle().ListBottles(list).then(function(res)
- {
- if (res.result == 200)
- {
- var html = "";
- html += "<ul class=\"collection left-align\">\n";
- for (var i = 0; i < res.data.length; i++)
- {
- html += "<li class=\"collection-item left-align\">"
- html += " <div>";
- html += " <a class='internal' href=\"" + app.GetBaseURL() + "page/rum_search/bottle/" + res.data[i].id + "\">" + res.data[i].name + "</a>";
- html += " </div>";
- html += " <div>";
- html += " <i>(volume: " + res.data[i].size + "ml)</i>";
- html += " </div>";
- html += "</li>";
- }
- html += "</ul>\n";
- $('#favorites').html(html);
- }
- else
- {
- app.Error("Error " + res.result + ": " + res.error);
- }
- });
- }
- else
- {
- app.Error("Error " + res.result + ": " + res.error);
- }
- });
- }
- }
- $(document).ready(refresh);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement