]> git.immae.eu Git - github/wallabag/wallabag.git/blame - app/Resources/static/themes/baggy/js/popupForm.js
Merge pull request #2309 from mruminski/2.1
[github/wallabag/wallabag.git] / app / Resources / static / themes / baggy / js / popupForm.js
CommitLineData
0743287f 1var $ = global.jquery = require('jquery');
19f2f11e 2
0743287f
TC
3$(document).ready(function () {
4 $('#search-form').hide();
5 $('#bagit-form').hide();
6 $('#filter-form').hide();
7 $('#download-form').hide();
19f2f11e 8
0743287f
TC
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');
19f2f11e 21 }
0743287f 22 }
19f2f11e 23
0743287f
TC
24 //---------------------------------------------------------------------------
25 // Toggle the 'Filter' popup on entries list
26 //---------------------------------------------------------------------------
27 function toggleFilter() {
28 $('#filter-form').toggle();
29 }
d2fcbf5d 30
0743287f
TC
31 //---------------------------------------------------------------------------
32 // Toggle the 'Download' popup on entries list
33 //---------------------------------------------------------------------------
34 function toggleDownload() {
35 $('#download-form').toggle();
36 }
5ecdfcd0 37
0743287f
TC
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');
19f2f11e 50 }
0743287f 51 }
19f2f11e 52
0743287f
TC
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 }
19f2f11e 63
0743287f
TC
64 $('#search').click(function () {
65 closePopups();
66 toggleSearch();
67 $('#searchfield').focus();
68 });
19f2f11e 69
0743287f
TC
70 $('.filter-btn').click(function () {
71 closePopups();
72 toggleFilter();
73 });
d2fcbf5d 74
0743287f
TC
75 $('.download-btn').click(function () {
76 closePopups();
77 toggleDownload();
78 });
5ecdfcd0 79
0743287f
TC
80 $('#bagit').click(function () {
81 closePopups();
82 toggleBagit();
83 $('#plainurl').focus();
84 });
19f2f11e 85
0743287f
TC
86 $('#search-form-close').click(function () {
87 toggleSearch();
88 });
19f2f11e 89
0743287f
TC
90 $('#filter-form-close').click(function () {
91 toggleFilter();
92 });
d2fcbf5d 93
0743287f
TC
94 $('#download-form-close').click(function () {
95 toggleDownload();
96 });
5ecdfcd0 97
0743287f
TC
98 $('#bagit-form-close').click(function () {
99 toggleBagit();
100 });
19f2f11e 101});