make CWs work
This commit is contained in:
parent
4409c90979
commit
25dfe192d6
|
@ -1 +1,2 @@
|
||||||
node_modules
|
node_modules
|
||||||
|
*.atom
|
||||||
|
|
|
@ -173,14 +173,17 @@ function buildUp(jsonObj,opts){
|
||||||
item.isReply = true;
|
item.isReply = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(item.categories){
|
if(item.summary){
|
||||||
item.hasCw = item.categories.indexOf('nsfw') > -1;
|
item.hasCw = true;
|
||||||
|
item.cw = item.summary;
|
||||||
if(item.hasCw){
|
|
||||||
item.cw = item.summary;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(item['activity:object'] && item['activity:object'].summary && item['activity:object'].summary['#']){
|
||||||
|
item.hasCw = true;
|
||||||
|
item.cw = item['activity:object'].summary['#'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// get a pagination ID for an entry
|
// get a pagination ID for an entry
|
||||||
item.paginationId = false;
|
item.paginationId = false;
|
||||||
if (item['atom:link']){
|
if (item['atom:link']){
|
||||||
|
@ -198,6 +201,7 @@ function buildUp(jsonObj,opts){
|
||||||
// href looks like this in pleroma (and we should ignore): https://social.fenwick.pizza/objects/1e2fa906-378c-43f8-98fa-271aae455758
|
// href looks like this in pleroma (and we should ignore): https://social.fenwick.pizza/objects/1e2fa906-378c-43f8-98fa-271aae455758
|
||||||
var href = link['@']['href'];
|
var href = link['@']['href'];
|
||||||
if (!href){return}
|
if (!href){return}
|
||||||
|
item.atomHref = href;
|
||||||
var match = href.match(/\/\d+.atom/);
|
var match = href.match(/\/\d+.atom/);
|
||||||
if(!match){return}
|
if(!match){return}
|
||||||
var id = match[0].replace(/\D/g,'');
|
var id = match[0].replace(/\D/g,'');
|
||||||
|
|
|
@ -55,9 +55,17 @@
|
||||||
<div class="author-fullname"> <%= item.author.fullName %> </div>
|
<div class="author-fullname"> <%= item.author.fullName %> </div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% if (item.hasCw){ %>
|
||||||
|
<% var cwId = (item.cw+item.atomHref).replace(/\W+/g,'') %>
|
||||||
|
<span class="cw"><%- item.cw %></span>
|
||||||
|
<input type="checkbox" class="showmore" id="<%- cwId %>">
|
||||||
|
<label class="button" for="<%- cwId %>">Show</label>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<div class="item-content">
|
<div class="item-content">
|
||||||
<%- item.content %>
|
<%- item.content %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if (item.enclosures.length > 0){ %>
|
<% if (item.enclosures.length > 0){ %>
|
||||||
<div class="enclosures">
|
<div class="enclosures">
|
||||||
<% for (var i = 0; i < item.enclosures.length; i ++){ var e = item.enclosures[i] %>
|
<% for (var i = 0; i < item.enclosures.length; i ++){ var e = item.enclosures[i] %>
|
||||||
|
@ -73,6 +81,7 @@
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<div class="date"><%= item.stringDate %></div>
|
<div class="date"><%= item.stringDate %></div>
|
||||||
</div>
|
</div>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
|
|
|
@ -46,11 +46,12 @@ a * {
|
||||||
border-top: solid 1px #626d80; }
|
border-top: solid 1px #626d80; }
|
||||||
|
|
||||||
.item-content,
|
.item-content,
|
||||||
|
.cw,
|
||||||
.title {
|
.title {
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
font-weight: lighter; }
|
font-weight: lighter; }
|
||||||
|
|
||||||
.item-content * {
|
.item-content *, .cw {
|
||||||
margin: 1rem 0;
|
margin: 1rem 0;
|
||||||
line-height: 1.4rem; }
|
line-height: 1.4rem; }
|
||||||
|
|
||||||
|
@ -124,4 +125,31 @@ a * {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
background: #2b90d9;
|
background: #2b90d9;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-weight: 400; }
|
font-weight: 400;
|
||||||
|
cursor: pointer;
|
||||||
|
text-transform: uppercase; }
|
||||||
|
|
||||||
|
label.button {
|
||||||
|
padding: 0.25rem 0.5rem;
|
||||||
|
margin: 0.4rem;
|
||||||
|
background: #626d80;
|
||||||
|
color: #282c37;
|
||||||
|
font-size: 0.8rem; }
|
||||||
|
|
||||||
|
input[type=checkbox] {
|
||||||
|
position: absolute;
|
||||||
|
left: -9999px; }
|
||||||
|
|
||||||
|
label {
|
||||||
|
-webkit-appearance: push-button;
|
||||||
|
-moz-appearance: button;
|
||||||
|
cursor: pointer; }
|
||||||
|
|
||||||
|
input[type=checkbox]:checked ~ label::after {
|
||||||
|
content: " Less"; }
|
||||||
|
|
||||||
|
input[type=checkbox]:not(:checked) ~ label::after {
|
||||||
|
content: " More"; }
|
||||||
|
|
||||||
|
input[type=checkbox]:not(:checked) ~ div {
|
||||||
|
display: none; }
|
||||||
|
|
|
@ -46,11 +46,12 @@ a * {
|
||||||
border-top: solid 1px #8494ab; }
|
border-top: solid 1px #8494ab; }
|
||||||
|
|
||||||
.item-content,
|
.item-content,
|
||||||
|
.cw,
|
||||||
.title {
|
.title {
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
font-weight: lighter; }
|
font-weight: lighter; }
|
||||||
|
|
||||||
.item-content * {
|
.item-content *, .cw {
|
||||||
margin: 1rem 0;
|
margin: 1rem 0;
|
||||||
line-height: 1.4rem; }
|
line-height: 1.4rem; }
|
||||||
|
|
||||||
|
@ -124,7 +125,34 @@ a * {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
background: #2b90d9;
|
background: #2b90d9;
|
||||||
color: #282c37;
|
color: #282c37;
|
||||||
font-weight: 400; }
|
font-weight: 400;
|
||||||
|
cursor: pointer;
|
||||||
|
text-transform: uppercase; }
|
||||||
|
|
||||||
|
label.button {
|
||||||
|
padding: 0.25rem 0.5rem;
|
||||||
|
margin: 0.4rem;
|
||||||
|
background: #8494ab;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 0.8rem; }
|
||||||
|
|
||||||
|
input[type=checkbox] {
|
||||||
|
position: absolute;
|
||||||
|
left: -9999px; }
|
||||||
|
|
||||||
|
label {
|
||||||
|
-webkit-appearance: push-button;
|
||||||
|
-moz-appearance: button;
|
||||||
|
cursor: pointer; }
|
||||||
|
|
||||||
|
input[type=checkbox]:checked ~ label::after {
|
||||||
|
content: " Less"; }
|
||||||
|
|
||||||
|
input[type=checkbox]:not(:checked) ~ label::after {
|
||||||
|
content: " More"; }
|
||||||
|
|
||||||
|
input[type=checkbox]:not(:checked) ~ div {
|
||||||
|
display: none; }
|
||||||
|
|
||||||
.item-content,
|
.item-content,
|
||||||
.description,
|
.description,
|
||||||
|
|
|
@ -64,13 +64,14 @@ a * {
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-content,
|
.item-content,
|
||||||
|
.cw,
|
||||||
.title {
|
.title {
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
font-weight:lighter;
|
font-weight:lighter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.item-content * {
|
.item-content *,.cw{
|
||||||
margin: 1rem 0;
|
margin: 1rem 0;
|
||||||
line-height:1.4rem;
|
line-height:1.4rem;
|
||||||
}
|
}
|
||||||
|
@ -154,4 +155,36 @@ a * {
|
||||||
background:$link;
|
background:$link;
|
||||||
color:$fg;
|
color:$fg;
|
||||||
font-weight:400;
|
font-weight:400;
|
||||||
|
cursor: pointer;
|
||||||
|
text-transform: uppercase;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
label.button{
|
||||||
|
padding: 0.25rem 0.5rem;
|
||||||
|
margin:0.4rem;
|
||||||
|
background:$dimmer;
|
||||||
|
color:$bg;
|
||||||
|
font-size:0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
// checkbox hack stuff
|
||||||
|
input[type=checkbox] {
|
||||||
|
position: absolute;
|
||||||
|
left: -9999px;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
-webkit-appearance: push-button;
|
||||||
|
-moz-appearance: button;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
input[type=checkbox]:checked ~ label::after{
|
||||||
|
content:" Less";
|
||||||
|
}
|
||||||
|
input[type=checkbox]:not(:checked) ~ label::after{
|
||||||
|
content:" More";
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=checkbox]:not(:checked) ~ div{
|
||||||
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue