aboutsummaryrefslogtreecommitdiffstats
path: root/public/install/view/javascript/common.js
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2019-08-18 21:14:58 -0500
committerJesús <heckyel@hyperbola.info>2019-08-18 21:14:58 -0500
commit2eed7b082f83630301e51f57ca8394de228a8605 (patch)
tree1d19962d22d30f99317d9276e4bae7744fc93fc2 /public/install/view/javascript/common.js
downloadlibrecart-2eed7b082f83630301e51f57ca8394de228a8605.tar.lz
librecart-2eed7b082f83630301e51f57ca8394de228a8605.tar.xz
librecart-2eed7b082f83630301e51f57ca8394de228a8605.zip
first commit
Diffstat (limited to 'public/install/view/javascript/common.js')
-rw-r--r--public/install/view/javascript/common.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/public/install/view/javascript/common.js b/public/install/view/javascript/common.js
new file mode 100644
index 0000000..751a096
--- /dev/null
+++ b/public/install/view/javascript/common.js
@@ -0,0 +1,41 @@
+function getURLVar(key) {
+ var value = [];
+
+ var query = String(document.location).split('?');
+
+ if (query[1]) {
+ var part = query[1].split('&');
+
+ for (i = 0; i < part.length; i++) {
+ var data = part[i].split('=');
+
+ if (data[0] && data[1]) {
+ value[data[0]] = data[1];
+ }
+ }
+
+ if (value[key]) {
+ return value[key];
+ } else {
+ return '';
+ }
+ }
+}
+
+$(document).ready(function() {
+ route = getURLVar('route');
+
+ if (!route) {
+ $('#menu #home').addClass('active');
+ } else {
+ part = route.split('/');
+
+ url = part[0];
+
+ if (part[1]) {
+ url += '/' + part[1];
+ }
+
+ $('#menu a[href*=\'index.php?route=' + url + '\']').parents('li[id]').addClass('active');
+ }
+}); \ No newline at end of file