Skip to content

Commit

Permalink
Merge pull request #602 from onkelandy/http
Browse files Browse the repository at this point in the history
modules.http: fix window.pagelength if no datatable is present
  • Loading branch information
onkelandy authored Nov 1, 2023
2 parents d2d5be7 + a3a34d8 commit 847ea6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions modules/http/webif/gstatic/js/smarthomeng_pageupdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ $(window).on('load', function (e) {
//setCookie('update_active', '', 0, window.pluginname);
let cookie_interval = getCookie("update_interval");
let cookie_active = getCookie("update_active");
if (cookie_active !== "")
if (cookie_active !== "" && typeof cookie_active == 'boolean')
window.update_active = cookie_active;
if (cookie_interval !== "")
if (cookie_interval !== "" && typeof cookie_interval == 'number')
{
if (window.update_active == true)
refresh.set_interval(cookie_interval, false);
Expand Down
3 changes: 1 addition & 2 deletions modules/http/webif/gtemplates/base_plugin.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
window.toggle = 1;
window.pluginname = '{{ p.get_fullname() }}';
window.pageLength = getCookie("pagelength");
if (window.pageLength == "")
if (window.pageLength == "" || Object.keys(window.pageLength).length === 0)
{
window.pageLength = {}
let tabcount = 0;
Expand All @@ -77,7 +77,6 @@
pagelength = {{ webif_pagelength }};
{%- endif %}
window.pageLength["bodytab_"+i] = {'tableid': 'unknown', 'pagelength': parseInt(pagelength)};
console.log(window.pageLength);
}
setCookie("pagelength", window.pageLength, 3650, window.pluginname);
}
Expand Down

0 comments on commit 847ea6c

Please sign in to comment.