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;
}
.hidden {
.cwText {
display: none;
}

View File

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