diff --git a/js/pihole/footer.js b/js/pihole/footer.js index b8a7dc24..974dcc50 100644 --- a/js/pihole/footer.js +++ b/js/pihole/footer.js @@ -42,12 +42,16 @@ var piholeVersion = $("#piholeVersion").html(); var webVersion = $("#webVersion").html(); // Credit for following function: https://gist.github.com/alexey-bass/1115557 +// Modified to discard any possible "v" in the string function versionCompare(left, right) { if (typeof left + typeof right != 'stringstring') return false; - var a = left.split('.') - , b = right.split('.') + var aa = left.split("v"), + bb = right.split("v"); + + var a = aa[aa.length-1].split(".") + , b = bb[bb.length-1].split(".") , i = 0, len = Math.max(a.length, b.length); for (; i < len; i++) { @@ -57,10 +61,10 @@ function versionCompare(left, right) { return -1; } } - return 0; } + // Update check $.getJSON("https://api.github.com/repos/pi-hole/pi-hole/releases/latest", function(json) { // Skip if on dev