blob: 363170825a2d3090cfdb560e28fb6f164c0e3073 (
plain) (
blame)
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
|
jQuery(function () {
'use strict';
const $searchForm = jQuery('.search-results-form');
if (!$searchForm.length) {
return;
}
const $toggleAssistanceButton = jQuery('<button>')
.addClass('toggleAssistant')
.attr('type', 'button')
.attr('aria-expanded', 'false')
.text(LANG.search_toggle_tools)
.prependTo($searchForm.find('fieldset'))
;
$toggleAssistanceButton.on('click', function () {
jQuery('.advancedOptions').toggle(0, function () {
var $me = jQuery(this);
if ($me.attr('aria-hidden')) {
$me.removeAttr('aria-hidden');
$toggleAssistanceButton.attr('aria-expanded', 'true');
DokuCookie.setValue('sa', 'on');
} else {
$me.attr('aria-hidden', 'true');
$toggleAssistanceButton.attr('aria-expanded', 'false');
DokuCookie.setValue('sa', 'off');
}
});
});
if (DokuCookie.getValue('sa') === 'on') {
$toggleAssistanceButton.click();
}
$searchForm.find('.advancedOptions .toggle div.current').on('click', function () {
var $me = jQuery(this);
$me.parent().siblings().removeClass('open');
$me.parent().siblings().find('ul:first').attr('aria-expanded', 'false');
$me.parent().toggleClass('open');
if ($me.parent().hasClass('open')) {
$me.parent().find('ul:first').attr('aria-expanded', 'true');
} else {
$me.parent().find('ul:first').attr('aria-expanded', 'false');
}
});
});
|