Dropdowns on avatars

master
Bob Mottram 2019-07-28 21:14:45 +01:00
parent 887feae5e5
commit 32a86f6e3a
2 changed files with 39 additions and 13 deletions

View File

@ -377,6 +377,23 @@ input[type=submit]:hover {
padding: 0px 0px;
}
.dropdown-timeline-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 100px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
/* Links inside the dropdown */
.dropdown-timeline-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
/* Change color of dropdown links on hover */
.dropdown-content a:hover {background-color: #ddd;}
@ -386,8 +403,10 @@ input[type=submit]:hover {
/* Change the background color of the dropdown button when the dropdown content is shown */
.dropdown:hover .dropbtn {background-color: #3e8e41;}
.dropdown-timeline-content a:hover {background-color: #ddd;}
/* Show the dropdown menu on hover */
.dropdown-timeline:hover .dropdown-content {display: block;}
.dropdown-timeline:hover .dropdown-timeline-content {display: block;}
/* Change the background color of the dropdown button when the dropdown content is shown */
.dropdown-timeline:hover .dropbtn {background-color: #3e8e41;}

View File

@ -416,7 +416,7 @@ def individualPostAsHtml(session,wfRequest: {},personCache: {}, \
fullDomain=domain
if port!=80 and port!=443:
fullDomain=domain+':'+str(port)
if fullDomain not in postJsonObject['actor']:
inboxUrl,pubKeyId,pubKey,fromPersonId,sharedInbox,capabilityAcquisition,avatarUrl2,preferredName = \
getPersonBox(session,wfRequest,personCache,'outbox')
@ -424,18 +424,25 @@ def individualPostAsHtml(session,wfRequest: {},personCache: {}, \
avatarUrl=avatarUrl2
if preferredName:
titleStr=preferredName+' '+titleStr
avatarDropdown= \
' <a href="'+postJsonObject['actor']+'">' \
' <img src="'+avatarUrl+'" title="Show profile" alt="Avatar"'+avatarPosition+'/></a>'
if fullDomain+'/users/'+nickname not in postJsonObject['actor']:
avatarDropdown= \
' <div class="dropdown-timeline">' \
' <img src="'+avatarUrl+'" alt="Avatar"'+avatarPosition+'/>' \
' <div class="dropdown-timeline-content">' \
' <a href="'+postJsonObject['actor']+'">Visit</a>'+ \
' <a href="/users/'+nickname+'?follow">Follow</a>' \
' <a href="/users/'+nickname+'?block">Block</a>' \
' <a href="/users/'+nickname+'?report">Report</a>' \
' </div>' \
' </div>'
return \
'<div class="'+containerClass+'">\n' \
' <div class="dropdown-timeline">' \
' <img src="'+avatarUrl+'" alt="Avatar"'+avatarPosition+'/>' \
' <div class="dropdown-content">' \
' <a href="'+postJsonObject['actor']+'">Visit</a>' \
' <a href="/users/'+nickname+'?follow">Follow</a>' \
' <a href="/users/'+nickname+'?block">Block</a>' \
' <a href="/users/'+nickname+'?report">Report</a>' \
' </div>' \
' </div>' \
'<div class="'+containerClass+'">\n'+ \
avatarDropdown+ \
'<p class="post-title">'+titleStr+'</p>'+ \
postJsonObject['object']['content']+'\n'+ \
attachmentStr+ \