mirror of
https://github.com/pi-hole/web.git
synced 2025-12-25 05:05:33 +00:00
Clean up JS
* remove unused variables/functions * use the dot notation * use explicit coercion * remove unneeded else * use `textContent` instead of `innerHTML` * cache a few `getElementById` calls * fix a couple of undefined variables * various assorted lint tweaks Signed-off-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* This file is copyright under the latest version of the EUPL.
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
var offset, timer, pre, scrolling = true;
|
||||
|
||||
// Check every 200msec for fresh data
|
||||
@@ -14,13 +15,13 @@ function reloadData(){
|
||||
clearTimeout(timer);
|
||||
$.getJSON("scripts/pi-hole/php/tailLog.php?offset="+offset, function (data)
|
||||
{
|
||||
pre.append(data["lines"]);
|
||||
pre.append(data.lines);
|
||||
|
||||
if(scrolling && offset !== data["offset"]) {
|
||||
if(scrolling && offset !== data.offset) {
|
||||
pre.scrollTop(pre[0].scrollHeight);
|
||||
}
|
||||
|
||||
offset = data["offset"];
|
||||
offset = data.offset;
|
||||
});
|
||||
|
||||
timer = setTimeout(reloadData, interval);
|
||||
@@ -30,7 +31,7 @@ $(function(){
|
||||
// Get offset at first loading of page
|
||||
$.getJSON("scripts/pi-hole/php/tailLog.php", function (data)
|
||||
{
|
||||
offset = data["offset"];
|
||||
offset = data.offset;
|
||||
});
|
||||
pre = $("#output");
|
||||
// Trigger function that looks for new data
|
||||
|
||||
Reference in New Issue
Block a user