mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Upgraded openUserPage function
This commit is contained in:
parent
665cbb8374
commit
51c248e463
@ -38,6 +38,19 @@ function openPage(pageURI, additionnalData){
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
function openUserPage(user){
|
||||
if(user.virtualDirectory == "")
|
||||
openUserPageFromID(user.userID);
|
||||
else
|
||||
openPage(user.virtualDirectory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a user page quickly from its user ID
|
||||
*
|
||||
* @param {String} user The ID of the user or its directory
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
function openUserPageFromID(user){
|
||||
return openPage("user/" + user);
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ ComunicWeb.components.friends.bar = {
|
||||
|
||||
//Make the link lives
|
||||
friendLink.onclick = function(){
|
||||
openUserPage(userIDorPath(userInfos));
|
||||
openUserPage(userInfos);
|
||||
|
||||
//For the responsive mode
|
||||
ComunicWeb.components.friends.bar.toggleShowHide();
|
||||
|
@ -213,7 +213,7 @@ ComunicWeb.components.friends.listModal = {
|
||||
userLink.onclick = function(){
|
||||
|
||||
//Open user page
|
||||
openUserPage(userIDorPath(users["user-" + id]));
|
||||
openUserPage(users["user-" + id]);
|
||||
|
||||
//Close all modals
|
||||
$(".modal").modal("hide");
|
||||
|
@ -55,7 +55,7 @@ ComunicWeb.components.friends.ui = {
|
||||
userLink.onclick = function(){
|
||||
|
||||
//Open user page
|
||||
openUserPage(userIDorPath(user));
|
||||
openUserPage(user);
|
||||
|
||||
//Close all modals
|
||||
$(".modal").modal("hide");
|
||||
|
@ -186,7 +186,7 @@ ComunicWeb.components.menuBar.authenticated = {
|
||||
userimage.src = userInfos.accountImage;
|
||||
|
||||
userlinkelement.onclick = function(){
|
||||
openUserPage(userIDorPath(userInfos));
|
||||
openUserPage(userInfos);
|
||||
}
|
||||
|
||||
}), true);
|
||||
|
@ -77,7 +77,7 @@ ComunicWeb.components.notifications.ui = {
|
||||
if(data.on_elem_type == "friend_request"){
|
||||
|
||||
//Open user page
|
||||
openUserPage(data.from_user_id);
|
||||
openUserPageFromID(data.from_user_id);
|
||||
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ ComunicWeb.components.posts.ui = {
|
||||
userName.innerHTML = result.firstName + " " + result.lastName;
|
||||
|
||||
userName.onclick = function(){
|
||||
openUserPage(userIDorPath(result));
|
||||
openUserPage(result);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -153,7 +153,7 @@ ComunicWeb.components.searchForm = {
|
||||
//Make user link element live
|
||||
userLinkElement.onclick = function() {
|
||||
ComunicWeb.components.searchForm.close();
|
||||
openUserPage(userIDorPath(userInfos));
|
||||
openUserPage(userInfos);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -104,7 +104,7 @@ ComunicWeb.components.textParser = {
|
||||
node.addEventListener("click", function(ev){
|
||||
|
||||
//Open user page
|
||||
openUserPage(userID);
|
||||
openPage(userID);
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ ComunicWeb.pages.userPage.friendshipStatus = {
|
||||
|
||||
else {
|
||||
//Reopen user page
|
||||
openUserPage(userID);
|
||||
openUserPageFromID(userID);
|
||||
}
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user