Page up and down icons

master
Bob Mottram 2019-07-31 21:37:19 +01:00
parent be1104d0fc
commit 1cc81c5138
5 changed files with 35 additions and 8 deletions

View File

@ -82,7 +82,7 @@ import os
import sys
# maximum number of posts to list in outbox feed
maxPostsInFeed=20
maxPostsInFeed=4
# number of follows/followers per page
followsPerPage=12
@ -944,8 +944,14 @@ class PubServer(BaseHTTPRequestHandler):
if inboxFeed:
if 'text/html' in self.headers['Accept']:
nickname=self.path.replace('/users/','').replace('/inbox','')
pageNumber=1
if '?page=' in nickname:
pageNumber=nickname.split('?page=')[1]
nickname=nickname.split('?page=')[0]
if pageNumber.isdigit():
pageNumber=int(pageNumber)
else:
pageNumber=1
if 'page=' not in self.path:
# if no page was specified then show the first
inboxFeed=personBoxJson(self.server.baseDir, \
@ -956,7 +962,8 @@ class PubServer(BaseHTTPRequestHandler):
maxPostsInFeed, 'inbox', \
True,self.server.ocapAlways)
self._set_headers('text/html',cookie)
self.wfile.write(htmlInbox(self.server.session, \
self.wfile.write(htmlInbox(pageNumber,maxPostsInFeed, \
self.server.session, \
self.server.baseDir, \
self.server.cachedWebfingers, \
self.server.personCache, \
@ -990,8 +997,14 @@ class PubServer(BaseHTTPRequestHandler):
if outboxFeed:
if 'text/html' in self.headers['Accept']:
nickname=self.path.replace('/users/','').replace('/outbox','')
pageNumber=1
if '?page=' in nickname:
pageNumber=nickname.split('?page=')[1]
nickname=nickname.split('?page=')[0]
if pageNumber.isdigit():
pageNumber=int(pageNumber)
else:
pageNumber=1
if 'page=' not in self.path:
# if a page wasn't specified then show the first one
outboxFeed=personBoxJson(self.server.baseDir,self.server.domain, \
@ -1002,7 +1015,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.ocapAlways)
self._set_headers('text/html',cookie)
self.wfile.write(htmlOutbox(self.server.session, \
self.wfile.write(htmlOutbox(pageNumber,maxPostsInFeed, \
self.server.session, \
self.server.baseDir, \
self.server.cachedWebfingers, \
self.server.personCache, \

View File

@ -22,6 +22,10 @@ body, html {
display: none;
}
.pageicon {
width: 5%;
}
.timeline-banner {
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("banner.png");
height: 10%;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -597,7 +597,8 @@ def individualPostAsHtml(baseDir: str, \
contentStr+footerStr+ \
'</div>\n'
def htmlTimeline(session,baseDir: str,wfRequest: {},personCache: {}, \
def htmlTimeline(pageNumber: int,itemsPerPage: int,session,baseDir: str, \
wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int,timelineJson: {}, \
boxName: str) -> str:
"""Show the timeline as html
@ -642,25 +643,33 @@ def htmlTimeline(session,baseDir: str,wfRequest: {},personCache: {}, \
followApprovals+ \
'</div>'
tlStr+='<script>'+contentWarningScript()+'</script>'
if pageNumber>1:
tlStr+='<center><a href="'+actor+'/'+boxName+'?page='+str(pageNumber-1)+'"><img class="pageicon" src="/icons/pageup.png" title="Page up" alt="Page up"></a></center>'
itemCtr=0
for item in timelineJson['orderedItems']:
if item['type']=='Create' or item['type']=='Announce':
itemCtr+=1
tlStr+=individualPostAsHtml(baseDir,session,wfRequest,personCache, \
nickname,domain,port,item,None,True,showIndividualPostIcons)
if itemCtr>=itemsPerPage:
tlStr+='<center><a href="'+actor+'/'+boxName+'?page='+str(pageNumber+1)+'"><img class="pageicon" src="/icons/pagedown.png" title="Page down" alt="Page down"></a></center>'
tlStr+=htmlFooter()
return tlStr
def htmlInbox(session,baseDir: str,wfRequest: {},personCache: {}, \
def htmlInbox(pageNumber: int,itemsPerPage: int, \
session,baseDir: str,wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int,inboxJson: {}) -> str:
"""Show the inbox as html
"""
return htmlTimeline(session,baseDir,wfRequest,personCache, \
return htmlTimeline(pageNumber,itemsPerPage,session,baseDir,wfRequest,personCache, \
nickname,domain,port,inboxJson,'inbox')
def htmlOutbox(session,baseDir: str,wfRequest: {},personCache: {}, \
def htmlOutbox(pageNumber: int,itemsPerPage: int, \
session,baseDir: str,wfRequest: {},personCache: {}, \
nickname: str,domain: str,port: int,outboxJson: {}) -> str:
"""Show the Outbox as html
"""
return htmlTimeline(session,baseDir,wfRequest,personCache, \
return htmlTimeline(pageNumber,itemsPerPage,session,baseDir,wfRequest,personCache, \
nickname,domain,port,outboxJson,'outbox')
def htmlIndividualPost(baseDir: str,session,wfRequest: {},personCache: {}, \