Save manu state with cookie
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
// Toggle menu
|
// Toggle menu
|
||||||
$("#own-profile-picture, #open-notifications").click(function() {
|
$("#own-profile-picture, #open-notifications").click(function() {
|
||||||
if ($("#notification-center").css('right') == "-256px") {
|
if ($("#notification-center").css('right') == "-256px") {
|
||||||
@@ -8,12 +7,22 @@ $(document).ready(function() {
|
|||||||
$(".modal").width("calc(100% - 512px)");
|
$(".modal").width("calc(100% - 512px)");
|
||||||
$(".content").css("margin-right", "256px");
|
$(".content").css("margin-right", "256px");
|
||||||
$("#notification-center").css("right", "0px");
|
$("#notification-center").css("right", "0px");
|
||||||
|
|
||||||
|
// Add cookie so the menu stays open on other pages
|
||||||
|
document.cookie = "menu=open; path=/";
|
||||||
} else {
|
} else {
|
||||||
// Make the menu invisible and move the content to the right.
|
// Make the menu invisible and move the content to the right.
|
||||||
$("#chat-history").width("calc(100% - 331px)");
|
$("#chat-history").width("calc(100% - 331px)");
|
||||||
$(".modal").width("calc(100% - 256px)");
|
$(".modal").width("calc(100% - 256px)");
|
||||||
$(".content").css("margin-right", "0px");
|
$(".content").css("margin-right", "0px");
|
||||||
$("#notification-center").css("right", "-256px");
|
$("#notification-center").css("right", "-256px");
|
||||||
|
|
||||||
|
// Change menu cookie to close
|
||||||
|
document.cookie = "menu=closed; path=/";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (getCookie("menu") == "open") {
|
||||||
|
$("#own-profile-picture").click();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
function getCookie(key) {
|
||||||
|
cookies = document.cookie.split("; ");
|
||||||
|
for (var i in cookies) {
|
||||||
|
cookie = cookies[i].split("=");
|
||||||
|
if (cookie[0] == key) {
|
||||||
|
return cookie[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function editFriendship(userID, value) {
|
function editFriendship(userID, value) {
|
||||||
$.post("API/editFriendship.php", { usr: userID, action: value })
|
$.post("API/editFriendship.php", { usr: userID, action: value })
|
||||||
.done(function() {
|
.done(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user