function message(status, shake=false, id="") {
  if (shake) {
    $("#"+id).effect("shake", {direction: "right", times: 2, distance: 8}, 250);
  } 
  document.getElementById('feedback').innerHTML = status;
  $("#feedback").show().delay(2000).fadeOut();
}

function error(type) {
  $("."+type).css("border-color", "#E14448");
}

var login = function() {
  $.post({
    type: "POST",
    url: "/",
    data: {"username": $("#login-user").val(), 
           "password": $("#login-pass").val()},
    success: function(response){
      var status = JSON.parse(response)['status'];
      if (status === 'Login successful') {location.reload();}
      else {error('login-input');}}
  });
}

$(document).ready(function() {
  
  $(document).on("click", "#login-button", login);
  $(document).keypress(function(e) {if(e.which === 13) {login();}});
  
  $(document).on("click", "#signup-button", function() {
    $.post({
      type: "POST",
      url: "/signup",
      data: {"username": $("#signup-user").val(), 
             "password": $("#signup-pass").val(), 
             "email": $("#signup-mail").val()},
      success: function(response) {
        var status = JSON.parse(response)['status'];
        if (status === 'Signup successful') {location.reload();}
        else {message(status, shake=true, id="signup-box");}
      }
    });
  });

  $(document).on("click", "#save", function() {
    $.post({
      type: "POST",
      url: "/settings",
      data: {"username": $("#settings-user").val(), 
             "password": $("#settings-pass").val(), 
             "email": $("#settings-mail").val()},
      success: function(response){
        message(JSON.parse(response)['status']);
      }
    });
  });
});

// Open or Close mobile & tablet menu
// https://github.com/jgthms/bulma/issues/856
$('#navbar-burger-id').click(function () {
  if($('#navbar-burger-id').hasClass('is-active')){
    $('#navbar-burger-id').removeClass('is-active');
    $('#navbar-menu-id').removeClass('is-active');
  }else {
    $('#navbar-burger-id').addClass('is-active');
    $('#navbar-menu-id').addClass('is-active');
  }
});
@@ -175,17 +175,17 @@
 yId(
-'
+%22
 feedback
 ').i
@@ -180,17 +180,17 @@
 feedback
-'
+%22
 ).innerH
@@ -573,32 +573,32 @@
 e(response)%5B
-'
+%22
 status
-'
+%22
 %5D;%0D%0A      if
@@ -610,17 +610,17 @@
 tus === 
-'
+%22
 Login su
@@ -619,33 +619,33 @@
 Login successful
-'
+%22
 ) %7Blocation.relo
@@ -670,17 +670,17 @@
  %7Berror(
-'
+%22
 login-in
@@ -682,17 +682,17 @@
 in-input
-'
+%22
 );%7D%7D%0D%0A  
@@ -693,24 +693,25 @@
 %7D%7D%0D%0A  %7D);%0D%0A%7D
+;
 %0D%0A%0D%0A$(docume
@@ -1212,24 +1212,24 @@
 sponse)%5B
-'
+%22
 status
-'
+%22
 %5D;%0D%0A    
@@ -1247,17 +1247,17 @@
 tus === 
-'
+%22
 Signup s
@@ -1265,17 +1265,17 @@
 ccessful
-'
+%22
 ) %7Blocat
@@ -1853,17 +1853,17 @@
 /856%0D%0A$(
-'
+%22
 #navbar-
@@ -1871,17 +1871,17 @@
 urger-id
-'
+%22
 ).click(
@@ -1902,17 +1902,17 @@
 %0A  if($(
-'
+%22
 #navbar-
@@ -1920,17 +1920,17 @@
 urger-id
-'
+%22
 ).hasCla
@@ -1928,25 +1928,25 @@
 %22).hasClass(
-'
+%22
 is-active'))
@@ -1942,17 +1942,17 @@
 s-active
-'
+%22
 ))%7B%0D%0A   
@@ -1946,33 +1946,33 @@
 tive%22))%7B%0D%0A    $(
-'
+%22
 #navbar-burger-i
@@ -1972,17 +1972,17 @@
 urger-id
-'
+%22
 ).remove
@@ -1979,33 +1979,33 @@
 d%22).removeClass(
-'
+%22
 is-active');%0D%0A  
@@ -1989,33 +1989,33 @@
 Class(%22is-active
-'
+%22
 );%0D%0A    $('#navb
@@ -2000,33 +2000,33 @@
 ctive%22);%0D%0A    $(
-'
+%22
 #navbar-menu-id'
@@ -2024,17 +2024,17 @@
 -menu-id
-'
+%22
 ).remove
@@ -2035,25 +2035,25 @@
 removeClass(
-'
+%22
 is-active');
@@ -2045,25 +2045,25 @@
 s(%22is-active
-'
+%22
 );%0D%0A  %7Delse 
@@ -2063,33 +2063,33 @@
  %7Delse %7B%0D%0A    $(
-'
+%22
 #navbar-burger-i
@@ -2089,17 +2089,17 @@
 urger-id
-'
+%22
 ).addCla
@@ -2093,33 +2093,33 @@
 r-id%22).addClass(
-'
+%22
 is-active');%0D%0A  
@@ -2107,25 +2107,25 @@
 s(%22is-active
-'
+%22
 );%0D%0A    $('#
@@ -2122,17 +2122,17 @@
 %0D%0A    $(
-'
+%22
 #navbar-
@@ -2138,17 +2138,17 @@
 -menu-id
-'
+%22
 ).addCla
@@ -2150,17 +2150,17 @@
 ddClass(
-'
+%22
 is-activ
@@ -2160,17 +2160,17 @@
 s-active
-'
+%22
 );%0D%0A  %7D%0D

Fix code style issues