Various fixes to New UI.

Add proper styling for spoiler blocks. (#6)
Fixed minor issue with relative url replacement regex.
Upgraded eslint@5.5.0
This commit is contained in:
Daniel Scalzi
2018-09-05 02:30:26 -04:00
parent 7851fdbefb
commit 2a9db6c646
4 changed files with 99 additions and 104 deletions

View File

@@ -2387,6 +2387,31 @@ input:checked + .toggleSwitchSlider:before {
border-radius: 10px;
box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.50);
}
.bbCodeSpoilerButton {
background: none;
border: none;
outline: none;
cursor: pointer;
font-size: 16px;
transition: 0.25s ease;
width: 100%;
border-bottom: 1px solid white;
padding-bottom: 15px;
}
.bbCodeSpoilerButton:hover,
.bbCodeSpoilerButton:focus {
text-shadow: 0px 0px 20px #ffffff, 0px 0px 20px #ffffff, 0px 0px 20px #ffffff;
}
.bbCodeSpoilerButton:active {
color: #c7c7c7;
text-shadow: 0px 0px 20px #c7c7c7, 0px 0px 20px #c7c7c7, 0px 0px 20px #c7c7c7;
}
.bbCodeSpoilerText {
display: none;
padding: 15px 0px;
border-bottom: 1px solid white;
}
#newsArticleContentWrapper {
width: 80%;

View File

@@ -1028,6 +1028,12 @@ function displayArticle(articleObject, index){
newsArticleComments.innerHTML = articleObject.comments
newsArticleComments.href = articleObject.commentsLink
newsArticleContentScrollable.innerHTML = '<div id="newsArticleContentWrapper"><div class="newsArticleSpacerTop"></div>' + articleObject.content + '<div class="newsArticleSpacerBot"></div></div>'
Array.from(newsArticleContentScrollable.getElementsByClassName('bbCodeSpoilerButton')).forEach(v => {
v.onclick = () => {
const text = v.parentElement.getElementsByClassName('bbCodeSpoilerText')[0]
text.style.display = text.style.display === 'block' ? 'none' : 'block'
}
})
newsNavigationStatus.innerHTML = index + ' of ' + newsArr.length
newsContent.setAttribute('article', index-1)
}
@@ -1061,10 +1067,10 @@ function loadNews(){
// Fix relative links in content.
let content = el.find('content\\:encoded').text()
let regex = /src="(?!http:\/\/|https:\/\/)(.+)"/g
let regex = /src="(?!http:\/\/|https:\/\/)(.+?)"/g
let matches
while((matches = regex.exec(content))){
content = content.replace(matches[1], newsHost + matches[1])
content = content.replace(`"${matches[1]}"`, `"${newsHost + matches[1]}"`)
}
let link = el.find('link').text()