diff options
author | Thomas LEBEAU <thomas.lebeau@g-nova.fr> | 2014-03-08 13:47:15 +0100 |
---|---|---|
committer | Thomas LEBEAU <thomas.lebeau@g-nova.fr> | 2014-03-08 13:47:15 +0100 |
commit | 4744cb0e1df8ee7c1cd10c9fbd67caec73051024 (patch) | |
tree | 0f67fff421a82bbfe4cc7cdc09fb54a61ce9ee53 /themes/baggy/js | |
parent | b3f7b7d200dfb56334dd68135750739c3c55b05a (diff) | |
download | wallabag-4744cb0e1df8ee7c1cd10c9fbd67caec73051024.tar.gz wallabag-4744cb0e1df8ee7c1cd10c9fbd67caec73051024.tar.zst wallabag-4744cb0e1df8ee7c1cd10c9fbd67caec73051024.zip |
bagit link + overlay save link + listmode
Diffstat (limited to 'themes/baggy/js')
-rwxr-xr-x | themes/baggy/js/init.js | 71 |
1 files changed, 55 insertions, 16 deletions
diff --git a/themes/baggy/js/init.js b/themes/baggy/js/init.js index 4a843548..99bffd09 100755 --- a/themes/baggy/js/init.js +++ b/themes/baggy/js/init.js | |||
@@ -1,36 +1,75 @@ | |||
1 | $(document).ready(function() { | 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 | ========================================================================== */ | ||
2 | 11 | ||
3 | $("#menu").click(function(){ | 12 | $("#menu").click(function(){ |
4 | $("#links").toggle(); | 13 | $("#links").toggle(); |
5 | }); | 14 | }); |
6 | 15 | ||
16 | /* ========================================================================== | ||
17 | List mode or Table Mode | ||
18 | ========================================================================== */ | ||
7 | 19 | ||
8 | $("#listmode").click(function(){ | 20 | $listmode.click(function(){ |
9 | if ( $.cookie("listmode") == 1 ) { | 21 | if ( $.cookie("listmode") == 1 ) { |
10 | $(".entrie").css("width", ""); | 22 | // Cookie |
11 | $(".entrie").css("margin-left", ""); | ||
12 | |||
13 | $.removeCookie("listmode"); | 23 | $.removeCookie("listmode"); |
14 | $("#listmode").removeClass("tablemode"); | 24 | |
15 | $("#listmode").addClass("listmode"); | 25 | $listentries.removeClass("listmode"); |
26 | $listmode.removeClass("tablemode"); | ||
27 | $listmode.addClass("listmode"); | ||
16 | } | 28 | } |
17 | else { | 29 | else { |
30 | // Cookie | ||
18 | $.cookie("listmode", 1, {expires: 365}); | 31 | $.cookie("listmode", 1, {expires: 365}); |
19 | 32 | ||
20 | $(".entrie").css("width", "100%"); | 33 | $listentries.addClass("listmode"); |
21 | $(".entrie").css("margin-left", "0"); | 34 | $listmode.removeClass("listmode"); |
22 | $("#listmode").removeClass("listmode"); | 35 | $listmode.addClass("tablemode"); |
23 | $("#listmode").addClass("tablemode"); | ||
24 | } | 36 | } |
25 | 37 | ||
26 | }); | 38 | }); |
27 | 39 | ||
40 | /* ========================================================================== | ||
41 | Cookie listmode | ||
42 | ========================================================================== */ | ||
43 | |||
28 | if ( $.cookie("listmode") == 1 ) { | 44 | if ( $.cookie("listmode") == 1 ) { |
29 | $(".entrie").css("width", "100%"); | 45 | $listentries.addClass("listmode"); |
30 | $(".entrie").css("margin-left", "0"); | 46 | $listmode.removeClass("listmode"); |
31 | $("#listmode").removeClass("listmode"); | 47 | $listmode.addClass("tablemode"); |
32 | $("#listmode").addClass("tablemode"); | ||
33 | } | 48 | } |
34 | 49 | ||
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 | |||
35 | 74 | ||
36 | }); | 75 | }); \ No newline at end of file |