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