Friend bar responsive

This commit is contained in:
Pierre 2017-06-03 15:41:04 +02:00
parent 84d53310dd
commit 204a3e7e0d
6 changed files with 136 additions and 29 deletions

View File

@ -4,38 +4,86 @@
* @author Pierre HUBERT * @author Pierre HUBERT
*/ */
/**
* For computers / tablets (any size)
*/
@media screen and (min-width: 513px) {
#friendsList { #friendsList {
position: fixed; position: fixed;
right: 0px; right: 0px;
border-left: 1px black solid; border-left: 1px black solid;
z-index: 999; z-index: 999;
background-color: #fff3ff80;
top: 0px; top: 0px;
height: 100%; height: 100%;
padding-top: 50px; padding-top: 50px;
}
}
/** /**
width: 50px; * For big screens
font-size: 70%;
transition: width 1s;
*/ */
@media screen and (min-width: 1200px) {
#friendsList {
width: 230px; width: 230px;
transition: right 1s; transition: right 1s;
right: -175px; right: -175px;
background-color: #fff3ff80;
display: block !important;
} }
#friendsList:hover { #friendsList:hover {
background-color: #ffffff; background-color: #ffffff;
right: 0px;
}
/** /**
width: 230px; * Hide friend button toggle
font-size: 100%;
padding: 10px;
padding-top: 50px;
*/ */
.friendToggleButton {
display: none !important;
}
}
/**
* For small screens / tablets
*/
@media screen and (max-width: 1200px) and (min-width: 513px) {
#friendsList {
right: 0px; right: 0px;
background-color: #ffffff;
}
}
/**
* Common to small screen / tablets / smartphones
*/
@media screen and (max-width: 1200px) {
#friendsList {
display: none;
}
#friendsList.visible-bar {
display: block;
}
}
/**
* Very small computers / tablets / smartphones
*/
@media screen and (max-width: 513px) {
#friendsList {
background-color: #ffffff;
padding-top: 50px;
position: fixed;
height: 100%;
width: 100%;
top: 0px;
left: 0px;
overflow: auto;
}
} }
#friendsList td { #friendsList td {
@ -52,4 +100,5 @@
#friendsList .statusRow { #friendsList .statusRow {
width: 48px; width: 48px;
text-align: center;
} }

View File

@ -409,6 +409,11 @@ var ComunicWeb = {
*/ */
addDropdown: function(navbarElem){}, addDropdown: function(navbarElem){},
/**
* Add user friends toggle button
*/
addFriendListButton: function(navbarElem){},
/** /**
* Add user name element * Add user name element
*/ */

View File

@ -56,7 +56,7 @@ ComunicWeb.common.system = {
*/ */
var autoRefresh = setInterval((function(){ var autoRefresh = setInterval((function(){
ComunicWeb.user.userLogin.refreshLoginState(); ComunicWeb.user.userLogin.refreshLoginState();
}), 15000); }), 20000);
//Sucess //Sucess
return true; return true;

View File

@ -138,4 +138,30 @@ ComunicWeb.components.friends.bar = {
}); });
}); });
}, },
/**
* Toogle show / hide friends bar
*
* @return {Boolean} True for a success
*/
toggleShowHide: function(){
//Get friends list element
var friendListElem = byId("friendsList");
//Log action
ComunicWeb.debug.logMessage("Toggle friends list");
//Check current bar state
if(friendListElem.className == ""){
//Show the bar
friendListElem.className = "visible-bar";
}
else
//Hide the bar
friendListElem.className = "";
//Success
return true;
}
} }

View File

@ -32,6 +32,9 @@ ComunicWeb.components.menuBar.authenticated = {
//Add user name //Add user name
this.addUserName(navbarRightElemList); this.addUserName(navbarRightElemList);
//Add friends list button
this.addFriendListButton(navbarRightElemList);
//Add dropdown menu //Add dropdown menu
this.addDropdown(navbarRightElemList); this.addDropdown(navbarRightElemList);
@ -79,6 +82,30 @@ ComunicWeb.components.menuBar.authenticated = {
return dropdownContent; return dropdownContent;
}, },
/**
* Add friendsList toggle button
*
* @param {HTMLElement} navbarElem The target navbarlist element
* @return {HTMLElement} The button element
*/
addFriendListButton: function(navbarElem){
//Create button
var friendButton = createElem("li", navbarElem);
friendButton.className = "friendToggleButton";
//Create link
var friendButtonLink = createElem("a", friendButton);
var friendIcon = createElem("i", friendButtonLink);
friendIcon.className = "fa fa-users";
//Makes link live
friendButtonLink.onclick = function(){
ComunicWeb.components.friends.bar.toggleShowHide();
};
return friendButtonLink;
},
/** /**
* Add user name element * Add user name element
* *

View File

@ -64,8 +64,8 @@ ComunicWeb.user.userLogin = {
ComunicWeb.user.userLogin.__userLogin = false; ComunicWeb.user.userLogin.__userLogin = false;
ComunicWeb.user.loginTokens.deleteLoginTokens(); ComunicWeb.user.loginTokens.deleteLoginTokens();
//Refresh the page //Restart the application
location.href = document.location; ComunicWeb.common.system.restart();
} }
//Perform next action //Perform next action