-
Notifications
You must be signed in to change notification settings - Fork 10
/
script.js
62 lines (53 loc) · 1.35 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* Copy all the navigational links into a single mobile menu
*/
jQuery(function () {
var $mobilemenu = jQuery('<div>')
.addClass('mobile-menu');
var $logo = jQuery('#p-logo')
.clone()
.removeAttr('id')
.addClass('mobile-logo')
;
var $search = jQuery('#p-search form')
.clone()
.removeAttr('id')
.addClass('mobile-search');
$search.find('#simpleSearch').removeAttr('id');
$search.find('button').text('🔍');
$mobilemenu.append($search);
jQuery([
'p-navigation',
'left-navigation',
'right-navigation',
'p-coll-print_export',
'p-tb',
'p-personal'
]).each(function (i, name) {
var ul = jQuery('<ul>');
$mobilemenu.append(ul);
var filter = '#' + name + ' li';
ul.addClass('mobile-' + name);
ul.append(
jQuery(filter)
.not('.selected')
.clone()
.removeAttr('id')
);
});
var $hamburger = jQuery('<div>')
.addClass('mobile-hamburger')
.click(function () {
$mobilemenu.toggleClass('open');
$hamburger.toggleClass('open')
});
jQuery('body')
.append([
$mobilemenu,
$hamburger
])
.prepend(
$logo
)
;
});