]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - themes/baggy/js/init.js
merge epub with all the dev evolutions
[github/wallabag/wallabag.git] / themes / baggy / js / init.js
index 4a843548c92e9256de2e24a466c353c278311b75..74cbae683bbc3e9a9643d865087db721315eec3a 100755 (executable)
@@ -1,36 +1,51 @@
-$(document).ready(function() {
+$.fn.ready(function() {
+
+  var $listmode = $('#listmode'),
+      $listentries = $("#list-entries");
+
+  /* ==========================================================================
+     Menu
+     ========================================================================== */
 
   $("#menu").click(function(){
-    $("#links").toggle();
+    $("#links").toggleClass('menu--open');
+    if ($('#content').hasClass('opacity03')) {
+        $('#content').removeClass('opacity03');
+    }
   });
 
+  /* ==========================================================================
+     List mode or Table Mode
+     ========================================================================== */
 
-  $("#listmode").click(function(){
+  $listmode.click(function(){
     if ( $.cookie("listmode") == 1 ) {
-      $(".entrie").css("width", "");
-      $(".entrie").css("margin-left", "");
-
+      // Cookie
       $.removeCookie("listmode");
-      $("#listmode").removeClass("tablemode");
-      $("#listmode").addClass("listmode");
+
+      $listentries.removeClass("listmode");
+      $listmode.removeClass("tablemode");
+      $listmode.addClass("listmode");
     }
     else {
+      // Cookie
       $.cookie("listmode", 1, {expires: 365});
 
-      $(".entrie").css("width", "100%");
-      $(".entrie").css("margin-left", "0");
-      $("#listmode").removeClass("listmode");
-      $("#listmode").addClass("tablemode");
+      $listentries.addClass("listmode");
+      $listmode.removeClass("listmode");
+      $listmode.addClass("tablemode");
     }
 
   });
 
+  /* ==========================================================================
+     Cookie listmode
+     ========================================================================== */
+
   if ( $.cookie("listmode") == 1 ) {
-    $(".entrie").css("width", "100%");
-    $(".entrie").css("margin-left", "0");
-    $("#listmode").removeClass("listmode");
-    $("#listmode").addClass("tablemode");
+    $listentries.addClass("listmode");
+    $listmode.removeClass("listmode");
+    $listmode.addClass("tablemode");
   }
 
-
 });