Skip to content

Commit

Permalink
chore: big update
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricerenck committed Apr 17, 2020
1 parent eccbfba commit 6c3f57f
Show file tree
Hide file tree
Showing 61 changed files with 9,511 additions and 2,807 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@
/vendor/symfony
/vendor/theseer
/vendor/webmozart
/.cache
/node_modules
74 changes: 66 additions & 8 deletions assets/komments.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,68 @@
function replyToComment(self) {
document.querySelector('.komment-reply-indicator .komment-gravatar').innerHTML = '<img src="https://www.gravatar.com/avatar/' + self.dataset.gravatar + '?s=100" alt="gravatar">';
document.querySelector('.komment-reply-indicator .komment-author').innerHTML = '@' + self.dataset.author;
document.querySelector('#replyTo').value = self.dataset.slug;
}

window.onload = function () {
[...document.querySelectorAll('.komment-reply')]
.forEach(a => { a.onclick = function() { replyToComment(this) }; });

const komment = document.querySelector('#kommentform #komment')
const kommentEmail = document.querySelector('#kommentform #email')
const kommentAuthor = document.querySelector('#kommentform #author')
const kommentUrl = document.querySelector('#kommentform #author_url')
const timeField = document.querySelector('#kommentform .cts')
const submitField = document.querySelector('#kommentform input[type=submit]')
const spamIndicatorProgress = document.querySelector('#kommentform .spam-indicator .progress')

let duration = {
start: 0,
end: 0,
indicator: 0,
timer: null
}

const setIndicator = () => {

if (duration.indicator > 0) {
return
}

submitField.disabled = true;

duration.timer = window.setInterval(() => {
duration.indicator += 10;
spamIndicatorProgress.style.width = `${duration.indicator}%`

// TODO
if (duration.indicator > 25) {
spamIndicatorProgress.style.background = 'orange'
}

if (duration.indicator > 50) {
spamIndicatorProgress.style.background = 'yellowgreen'
}

if (duration.indicator > 75) {
spamIndicatorProgress.style.background = 'green'
}

if (duration.indicator >= 100) {
spamIndicatorProgress.style.background = 'green'
spamIndicatorProgress.style.height = '0';
submitField.disabled = false;

duration.end = Math.round(Date.now() / 1000);
timeField.value = duration.end - duration.start

window.clearInterval(duration.timer)
}
}, 1000)
}

kommentEmail.style.display = 'none';
kommentAuthor.style.display = 'none';
kommentUrl.style.display = 'none';

komment.addEventListener('focus', () => {
duration.start = Math.round(Date.now() / 1000);
setIndicator();
kommentEmail.style.display = 'block';
kommentAuthor.style.display = 'block';
kommentUrl.style.display = 'block';
});

};
20 changes: 0 additions & 20 deletions blueprints/pages/komment.yml

This file was deleted.

4 changes: 0 additions & 4 deletions blueprints/pages/komments.yml

This file was deleted.

79 changes: 55 additions & 24 deletions blueprints/tabs/komments.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,57 @@
label: Komments
icon: quote
columns:
- width: 1/2
sections:
published:
type: pages
headline: Veröffentlicht
status: published
info: " {{ page.date.toDate('Y-m-d') }}"
size: small
sortBy: date desc
parent: page.find("komments")
text: "{{ page.author }}: {{ page.title }}"
empty: No public komments
- width: 1/2
sections:
drafts:
type: pages
headline: Awaiting moderation
status: draft
parent: page.find("komments")
sortBy: date desc
text: "{{ page.author }}: {{ page.title }}"
empty: No waiting komments
info: " {{ page.date.toDate('Y-m-d') }}"
- width: 1/1
sections:
kommentsWebmentions:
type: fields
fields:
kommentsInbox:
type: structure
label: Inbox
fields:
avatar:
type: url
label: Avatar
author:
type: text
label: Author
authorUrl:
type: url
label: Author Url
wmSource:
type: url
label: Source
wmTarget:
type: url
label: Target
mentionOf:
type: url
label: Mentioned
wmProperty:
type: text
label: Type
published:
type: date
label: Published
time: true
komment:
type: textarea
label: Komment
quote:
type: textarea
label: Quote
status:
type: toggle
label: Status
honey:
type: text
label: Honeypot
columns:
author:
width: 1/4
wmSource:
width: 1/4
komment:
width: 1/4
status:
width: 1/4
15 changes: 0 additions & 15 deletions blueprints/users/komments.yml

This file was deleted.

16 changes: 9 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "mauricerenck/komments",
"description": "A comment plugin for Kirby 3",
"version": "0.0.2",
"description": "A webmention and comments plugin for Kirby 3",
"type": "kirby-plugin",
"license": "MIT",
"authors": [
Expand All @@ -9,17 +10,18 @@
"email": "[email protected]"
}
],
"version": "0.0.1",
"autoload": {
"files": [
"utils/readKomments.php",
"utils/writeKomments.php"
"utils/sendMastodon.php",
"utils/sendWebmention.php",
"utils/receiveWebmention.php"
]
},
"require": {
"getkirby/composer-installer": "^1.1"
"getkirby/composer-installer": "^1.1",
"indieweb/mention-client": "^1.2"
},
"require-dev": {
"phpunit/phpunit": "^7.2"
"config": {
"optimize-autoloader": true
}
}
Loading

0 comments on commit 6c3f57f

Please sign in to comment.