]>
Commit | Line | Data |
---|---|---|
1 | var $ = global.jquery = require('jquery'); | |
2 | ||
3 | $(document).ready(function () { | |
4 | $('#search-form').hide(); | |
5 | $('#bagit-form').hide(); | |
6 | $('#filter-form').hide(); | |
7 | $('#download-form').hide(); | |
8 | ||
9 | //--------------------------------------------------------------------------- | |
10 | // Toggle the 'Search' popup in the sidebar | |
11 | //--------------------------------------------------------------------------- | |
12 | function toggleSearch() { | |
13 | $('#search-form').toggle(); | |
14 | $('#search').toggleClass('current'); | |
15 | $('#search').toggleClass('active-current'); | |
16 | $('#search-arrow').toggleClass('arrow-down'); | |
17 | if ($('#search').hasClass('current')) { | |
18 | $('#content').addClass('opacity03'); | |
19 | } else { | |
20 | $('#content').removeClass('opacity03'); | |
21 | } | |
22 | } | |
23 | ||
24 | //--------------------------------------------------------------------------- | |
25 | // Toggle the 'Filter' popup on entries list | |
26 | //--------------------------------------------------------------------------- | |
27 | function toggleFilter() { | |
28 | $('#filter-form').toggle(); | |
29 | } | |
30 | ||
31 | //--------------------------------------------------------------------------- | |
32 | // Toggle the 'Download' popup on entries list | |
33 | //--------------------------------------------------------------------------- | |
34 | function toggleDownload() { | |
35 | $('#download-form').toggle(); | |
36 | } | |
37 | ||
38 | //--------------------------------------------------------------------------- | |
39 | // Toggle the 'Save a Link' popup in the sidebar | |
40 | //--------------------------------------------------------------------------- | |
41 | function toggleBagit() { | |
42 | $('#bagit-form').toggle(); | |
43 | $('#bagit').toggleClass('current'); | |
44 | $('#bagit').toggleClass('active-current'); | |
45 | $('#bagit-arrow').toggleClass('arrow-down'); | |
46 | if ($('#bagit').hasClass('current')) { | |
47 | $('#content').addClass('opacity03'); | |
48 | } else { | |
49 | $('#content').removeClass('opacity03'); | |
50 | } | |
51 | } | |
52 | ||
53 | //--------------------------------------------------------------------------- | |
54 | // Close all #links popups in the sidebar | |
55 | //--------------------------------------------------------------------------- | |
56 | function closePopups() { | |
57 | $('#links .messages').hide(); | |
58 | $('#links > li > a').removeClass('active-current'); | |
59 | $('#links > li > a').removeClass('current'); | |
60 | $('[id$=-arrow]').removeClass('arrow-down'); | |
61 | $('#content').removeClass('opacity03'); | |
62 | } | |
63 | ||
64 | $('#search').click(function () { | |
65 | closePopups(); | |
66 | toggleSearch(); | |
67 | $('#searchfield').focus(); | |
68 | }); | |
69 | ||
70 | $('.filter-btn').click(function () { | |
71 | closePopups(); | |
72 | toggleFilter(); | |
73 | }); | |
74 | ||
75 | $('.download-btn').click(function () { | |
76 | closePopups(); | |
77 | toggleDownload(); | |
78 | }); | |
79 | ||
80 | $('#bagit').click(function () { | |
81 | closePopups(); | |
82 | toggleBagit(); | |
83 | $('#plainurl').focus(); | |
84 | }); | |
85 | ||
86 | $('#search-form-close').click(function () { | |
87 | toggleSearch(); | |
88 | }); | |
89 | ||
90 | $('#filter-form-close').click(function () { | |
91 | toggleFilter(); | |
92 | }); | |
93 | ||
94 | $('#download-form-close').click(function () { | |
95 | toggleDownload(); | |
96 | }); | |
97 | ||
98 | $('#bagit-form-close').click(function () { | |
99 | toggleBagit(); | |
100 | }); | |
101 | }); |