]> git.immae.eu Git - github/wallabag/wallabag.git/blame - themes/baggy/js/init.js
bagit link + overlay save link + listmode
[github/wallabag/wallabag.git] / themes / baggy / js / init.js
CommitLineData
4744cb0e
TL
1$.fn.ready(function() {
2
3 var $listmode = $('#listmode'),
4 $listentries = $("#list-entries"),
5 $bagit = $('#bagit'),
6 $bagitForm = $('#bagit-form');
7
8 /* ==========================================================================
9 Menu
10 ========================================================================== */
36a733af
MR
11
12 $("#menu").click(function(){
13 $("#links").toggle();
14 });
15
4744cb0e
TL
16 /* ==========================================================================
17 List mode or Table Mode
18 ========================================================================== */
36a733af 19
4744cb0e 20 $listmode.click(function(){
36a733af 21 if ( $.cookie("listmode") == 1 ) {
4744cb0e 22 // Cookie
36a733af 23 $.removeCookie("listmode");
4744cb0e
TL
24
25 $listentries.removeClass("listmode");
26 $listmode.removeClass("tablemode");
27 $listmode.addClass("listmode");
943ac3c7 28 }
36a733af 29 else {
4744cb0e 30 // Cookie
36a733af
MR
31 $.cookie("listmode", 1, {expires: 365});
32
4744cb0e
TL
33 $listentries.addClass("listmode");
34 $listmode.removeClass("listmode");
35 $listmode.addClass("tablemode");
36a733af
MR
36 }
37
943ac3c7 38 });
36a733af 39
4744cb0e
TL
40 /* ==========================================================================
41 Cookie listmode
42 ========================================================================== */
43
36a733af 44 if ( $.cookie("listmode") == 1 ) {
4744cb0e
TL
45 $listentries.addClass("listmode");
46 $listmode.removeClass("listmode");
47 $listmode.addClass("tablemode");
36a733af
MR
48 }
49
4744cb0e
TL
50 /* ==========================================================================
51 bag it link
52 ========================================================================== */
53
54 $bagit.click(function(){
55 $bagitForm.toggle();
56 });
57
58 /* ==========================================================================
59 Keyboard gestion
60 ========================================================================== */
61
62 $(window).keydown(function(e){
63 switch (e.keyCode) {
64 // s letter
65 case 83:
66 $bagitForm.toggle();
67 break;
68 case 27:
69 $bagitForm.hide();
70 break;
71 }
72 })
73
36a733af 74
4744cb0e 75});