From 7f011d34a2d5e13ba312b44ce6871e48a495ea8f Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sat, 8 Jun 2024 18:10:06 +0200 Subject: replace js/misc.js file with js/version.js module --- src/app/index.html | 1 - src/app/js/misc.js | 44 -------------------------------------------- src/app/js/version.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/app/main.js | 1 + 4 files changed, 45 insertions(+), 45 deletions(-) delete mode 100644 src/app/js/misc.js create mode 100644 src/app/js/version.js diff --git a/src/app/index.html b/src/app/index.html index 87a1029..1297d0a 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -333,7 +333,6 @@ - diff --git a/src/app/js/misc.js b/src/app/js/misc.js deleted file mode 100644 index b35f239..0000000 --- a/src/app/js/misc.js +++ /dev/null @@ -1,44 +0,0 @@ -version = { - is_newer: (version1, version2) => { - version1 = version.format(version1, true).split("."); - version2 = version.format(version2, true).split("."); - - for (let i = 0; i < version1.length; i++) { - - - let nums = [ - parseInt(version1[i]) || 0, - parseInt(version2[i]) || 0 - ]; - if (nums[0] > nums[1]) { - return true; - } else if (nums[0] < nums[1]) { - return false; - } - } - - return false; - }, - format: (version_number, no_leading_v) => { - version_number = version_number.trim(); - - if (no_leading_v) { - if (version_number[0] == "v") { - return version_number.slice(1, version_number.length); - } - - return version_number; - if (no_leading_v) { - return version_number - } - - return "v" + version_number; - } else { - if (version_number[0] != "v") { - return "v" + version_number; - } - } - - return version_number; - } -} diff --git a/src/app/js/version.js b/src/app/js/version.js new file mode 100644 index 0000000..97223f9 --- /dev/null +++ b/src/app/js/version.js @@ -0,0 +1,44 @@ +module.exports = { + is_newer: (version1, version2) => { + version1 = version.format(version1, true).split("."); + version2 = version.format(version2, true).split("."); + + for (let i = 0; i < version1.length; i++) { + + + let nums = [ + parseInt(version1[i]) || 0, + parseInt(version2[i]) || 0 + ]; + if (nums[0] > nums[1]) { + return true; + } else if (nums[0] < nums[1]) { + return false; + } + } + + return false; + }, + format: (version_number, no_leading_v) => { + version_number = version_number.trim(); + + if (no_leading_v) { + if (version_number[0] == "v") { + return version_number.slice(1, version_number.length); + } + + return version_number; + if (no_leading_v) { + return version_number + } + + return "v" + version_number; + } else { + if (version_number[0] != "v") { + return "v" + version_number; + } + } + + return version_number; + } +} diff --git a/src/app/main.js b/src/app/main.js index 2ed3053..11f5853 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -30,6 +30,7 @@ const kill = require("./js/kill"); const update = require("./js/update"); const events = require("./js/events"); const launch = require("./js/launch"); +const version = require("./js/version"); const request = require("./js/request"); const process = require("./js/process"); const settings = require("./js/settings"); -- cgit v1.2.3