-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
43 lines (34 loc) · 1.13 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
jQuery(function(){
/*
* set class 'curid' on all navigation entries that point to the current page
*/
baseurl = window.location.protocol + '//' + window.location.hostname;
paths = window.location.pathname.split('/');
path2 = paths.slice(0,2).join('/');
path3 = paths.slice(0,3).join('/');
path4 = paths.slice(0,4).join('/');
patharr = [path2, path3, path4];
for (p in patharr) {
if (patharr[p].substr(-1) === "/") {
patharr.push(patharr[p]+'start');
}
}
// keep only unique entries
var patharrtmp = patharr;
patharr = patharrtmp.sort().filter(function(item, pos, ary) {
return !pos || item != ary[pos - 1];
});
// wrap with curid-span as php would do
for (p in patharr) {
dest = patharr[p];
linkstocur = jQuery('div.sidebar_box a[href="'+baseurl+dest+'"]');
linkstocur.wrap("<span class='curid'></div>");
}
/*
* toggle the menu onclick in mobile view
*/
jQuery("#toggle_space").on("click touchstart", function(e) {
jQuery("#left-row").slideToggle("slow");
e.preventDefault();
});
});