Revision 3926:199b1f662109,
1.0 KB
checked in by franck <carnet.franck.paul@…>, 7 years ago
(diff) |
Switching from inline JS variables to JSON script. Filter controls are on the way
|
Line | |
---|
1 | /*global $, dotclear, getData */ |
---|
2 | 'use strict'; |
---|
3 | |
---|
4 | $(function() { |
---|
5 | // Get some DATA |
---|
6 | Object.assign(dotclear.msg, getData('filter_controls')); |
---|
7 | |
---|
8 | let reset_url = '?'; |
---|
9 | if (dotclear.filter_reset_url != undefined) { |
---|
10 | reset_url = dotclear.filter_reset_url; |
---|
11 | } |
---|
12 | |
---|
13 | const $filtersform = $('#filters-form'); |
---|
14 | $filtersform.before(`<p><a id="filter-control" class="form-control" href="${reset_url}" style="display:inline">${dotclear.msg.filter_posts_list}</a></p>`); |
---|
15 | |
---|
16 | if (!dotclear.msg.show_filters) { |
---|
17 | $filtersform.hide(); |
---|
18 | } else { |
---|
19 | $('#filter-control') |
---|
20 | .addClass('open') |
---|
21 | .text(dotclear.msg.cancel_the_filter); |
---|
22 | } |
---|
23 | |
---|
24 | $('#filter-control').click(function() { |
---|
25 | if ($(this).hasClass('open')) { |
---|
26 | if (dotclear.msg.show_filters) { |
---|
27 | return true; |
---|
28 | } else { |
---|
29 | $filtersform.hide(); |
---|
30 | $(this).removeClass('open') |
---|
31 | .text(dotclear.msg.filter_posts_list); |
---|
32 | } |
---|
33 | } else { |
---|
34 | $filtersform.show(); |
---|
35 | $(this).addClass('open') |
---|
36 | .text(dotclear.msg.cancel_the_filter); |
---|
37 | } |
---|
38 | return false; |
---|
39 | }); |
---|
40 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.