diff --git a/.gitignore b/.gitignore
index 3c3629e..5bda9f6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
-node_modules
+node_modules
+*.atom
diff --git a/lib/convert.js b/lib/convert.js
index c320956..b37cc11 100644
--- a/lib/convert.js
+++ b/lib/convert.js
@@ -173,14 +173,17 @@ function buildUp(jsonObj,opts){
item.isReply = true;
}
- if(item.categories){
- item.hasCw = item.categories.indexOf('nsfw') > -1;
-
- if(item.hasCw){
- item.cw = item.summary;
- }
+ if(item.summary){
+ item.hasCw = true;
+ 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
item.paginationId = false;
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
var href = link['@']['href'];
if (!href){return}
+ item.atomHref = href;
var match = href.match(/\/\d+.atom/);
if(!match){return}
var id = match[0].replace(/\D/g,'');
diff --git a/lib/template.ejs b/lib/template.ejs
index 4618a11..16bd872 100644
--- a/lib/template.ejs
+++ b/lib/template.ejs
@@ -55,9 +55,17 @@
<%= item.author.fullName %>
+ <% if (item.hasCw){ %>
+ <% var cwId = (item.cw+item.atomHref).replace(/\W+/g,'') %>
+ <%- item.cw %>
+
+
+ <% } %>
+
<%- item.content %>
+
<% if (item.enclosures.length > 0){ %>
<% for (var i = 0; i < item.enclosures.length; i ++){ var e = item.enclosures[i] %>
@@ -73,6 +81,7 @@
<% } %>
<% } %>
+
<%= item.stringDate %>
<% }); %>
diff --git a/static/dark.css b/static/dark.css
index ed2c8dd..1dba568 100644
--- a/static/dark.css
+++ b/static/dark.css
@@ -46,11 +46,12 @@ a * {
border-top: solid 1px #626d80; }
.item-content,
+.cw,
.title {
font-size: 1.1rem;
font-weight: lighter; }
-.item-content * {
+.item-content *, .cw {
margin: 1rem 0;
line-height: 1.4rem; }
@@ -124,4 +125,31 @@ a * {
text-decoration: none;
background: #2b90d9;
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; }
diff --git a/static/light.css b/static/light.css
index 775c358..9067190 100644
--- a/static/light.css
+++ b/static/light.css
@@ -46,11 +46,12 @@ a * {
border-top: solid 1px #8494ab; }
.item-content,
+.cw,
.title {
font-size: 1.1rem;
font-weight: lighter; }
-.item-content * {
+.item-content *, .cw {
margin: 1rem 0;
line-height: 1.4rem; }
@@ -124,7 +125,34 @@ a * {
text-decoration: none;
background: #2b90d9;
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,
.description,
diff --git a/stylesrc/base.scss b/stylesrc/base.scss
index d909354..c080dce 100644
--- a/stylesrc/base.scss
+++ b/stylesrc/base.scss
@@ -64,13 +64,14 @@ a * {
}
.item-content,
+.cw,
.title {
font-size: 1.1rem;
font-weight:lighter;
}
-.item-content * {
+.item-content *,.cw{
margin: 1rem 0;
line-height:1.4rem;
}
@@ -154,4 +155,36 @@ a * {
background:$link;
color:$fg;
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;
}