Merge pull request #227 from pi-hole/FIXversionCompare

fix versionCompare
This commit is contained in:
Mcat12
2016-12-08 16:51:41 -05:00
committed by GitHub
+7 -3
View File
@@ -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