Another cw test

master
Bob Mottram 2019-09-04 19:39:46 +01:00
parent 969221ab05
commit 6ea7b8deb1
2 changed files with 10 additions and 7 deletions

View File

@ -57,7 +57,7 @@ a:link {
margin: 5px; margin: 5px;
} }
.hidden { .cwText {
display: none; display: none;
} }

View File

@ -1188,8 +1188,13 @@ def contentWarningScript() -> str:
"""Returns a script used for content warnings """Returns a script used for content warnings
""" """
script= \ script= \
'function toggler(divId) {' \ 'function showContentWarning(postID) {' \
' $("#" + divId).toggle();' \ ' var x = document.getElementById(postID);' \
' if (x.style.display !== "block") {' \
' x.style.display = "block";' \
' } else {' \
' x.style.display = "none";' \
' }' \
'}' '}'
return script return script
@ -1685,10 +1690,8 @@ def individualPostAsHtml(pageNumber: int,baseDir: str, \
containerClass='container report' containerClass='container report'
else: else:
contentStr+='<b>Sensitive</b> ' contentStr+='<b>Sensitive</b> '
#contentStr+='<a href="#" onclick="toggler('+"'"+postID+"'"+');">SHOW MORE</a>' contentStr+='<button class="cwButton" onclick="showContentWarning('+"'"+postID+"'"+')">SHOW MORE</button>'
#contentStr+='<button class="cwButton" onclick="toggler('+"'"+postID+"'"+')">SHOW MORE</button>' contentStr+='<div class="cwText" id="'+postID+'">'
contentStr+='<a href="#" onclick="javascript:toggler('+"'"+postID+"'"+');"><span>SHOW MORE</span></a>'
contentStr+='<div class="hidden" id="'+postID+'">'
contentStr+=postJsonObject['object']['content']+attachmentStr contentStr+=postJsonObject['object']['content']+attachmentStr
contentStr=addEmbeddedElements(contentStr) contentStr=addEmbeddedElements(contentStr)
contentStr+='</div>' contentStr+='</div>'