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