From b98cdc6c2310577dc6a16b0a8a4bb0d1534495b8 Mon Sep 17 00:00:00 2001
From: Henry Gross-Hellsen <6283258+cowpod@users.noreply.github.com>
Date: Wed, 13 Nov 2024 01:45:01 -0800
Subject: [PATCH] merge shared js functions into global.js
---
index.php | 3 +-
resources/js/getQueryVariable.js | 12 -----
resources/js/global.js | 88 ++++++++++++++++++++++++++++++++
resources/js/slugify.js | 13 -----
4 files changed, 89 insertions(+), 27 deletions(-)
delete mode 100644 resources/js/getQueryVariable.js
create mode 100644 resources/js/global.js
delete mode 100644 resources/js/slugify.js
diff --git a/index.php b/index.php
index c55ec36..9dcbb5b 100644
--- a/index.php
+++ b/index.php
@@ -122,8 +122,7 @@ function uri($uri) {
-
-
+
diff --git a/resources/js/getQueryVariable.js b/resources/js/getQueryVariable.js
deleted file mode 100644
index e765be3..0000000
--- a/resources/js/getQueryVariable.js
+++ /dev/null
@@ -1,12 +0,0 @@
-function getQueryVariable(variable) {
- // alert('getQueryVariable called');
- var query = window.location.search.substring(1);
- var vars = query.split("&");
- for (var i=0;i parseInt(num, 10));
+ const v2 = version2.split('.').map(num => parseInt(num, 10));
+
+ // Compare each part
+ const length = Math.max(v1.length, v2.length);
+ for (let i = 0; i < length; i++) {
+ const val1 = v1[i] || 0; // If version 1 has fewer parts, treat as 0
+ const val2 = v2[i] || 0; // If version 2 has fewer parts, treat as 0
+
+ if (val1 < val2) return -1;
+ if (val1 > val2) return 1;
+ }
+
+ return 0; // Versions are equal
+}
+
+function slugify (str) {
+ str = str.replace(/^\s+|\s+$/g, '');
+ str = str.toLowerCase();
+ var from = "àáãäâèéëêìíïîòóöôùúüûñšç·/_,:;";
+ var to = "aaaaaeeeeiiiioooouuuunsc------";
+ for (var i=0, l=from.length ; i