mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea8344a4bc | ||
|
|
80d2a65a0c | ||
|
|
ea8ad8ba7c | ||
|
|
d613121b76 |
@@ -33,9 +33,9 @@ if (typeof auth !== 'undefined') {
|
||||
|
||||
if (liked) {
|
||||
liked_page = true
|
||||
document.querySelectorAll("span[id='likes_button_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='likes_button_emtpty_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='likes_button_text']")[0].innerText = ""
|
||||
document.querySelectorAll("span[id='button_likes_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='button_likes_emtpty_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='button_likes_text']")[0].innerText = ""
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,9 +47,9 @@ function like_article(id_likes) {
|
||||
docRef.get().then((doc) => {
|
||||
liked_page = true
|
||||
localStorage.setItem(id_likes, true);
|
||||
document.querySelectorAll("span[id='likes_button_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='likes_button_emtpty_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='likes_button_text']")[0].innerText = ""
|
||||
document.querySelectorAll("span[id='button_likes_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='button_likes_emtpty_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='button_likes_text']")[0].innerText = ""
|
||||
if (doc.exists) {
|
||||
db.collection('likes').doc(id_likes).update({
|
||||
likes: firebase.firestore.FieldValue.increment(1)
|
||||
@@ -75,9 +75,9 @@ function remove_like_article(id_likes) {
|
||||
docRef.get().then((doc) => {
|
||||
liked_page = false
|
||||
localStorage.removeItem(id_likes);
|
||||
document.querySelectorAll("span[id='likes_button_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='likes_button_emtpty_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='likes_button_text']")[0].innerText = "\xa0Like"
|
||||
document.querySelectorAll("span[id='button_likes_heart']")[0].style.display = "none"
|
||||
document.querySelectorAll("span[id='button_likes_emtpty_heart']")[0].style.display = ""
|
||||
document.querySelectorAll("span[id='button_likes_text']")[0].innerText = "\xa0Like"
|
||||
if (doc.exists) {
|
||||
db.collection('likes').doc(id_likes).update({
|
||||
likes: firebase.firestore.FieldValue.increment(-1)
|
||||
|
||||
@@ -8,6 +8,7 @@ if (typeof auth !== 'undefined') {
|
||||
|
||||
function toggleLoaders(node){
|
||||
var classesString = node.className;
|
||||
if(classesString == "") return
|
||||
var classes = classesString.split(" ");
|
||||
for(var i in classes){
|
||||
node.classList.toggle(classes[i])
|
||||
@@ -18,9 +19,11 @@ if (typeof auth !== 'undefined') {
|
||||
viewsCollection.doc(id).onSnapshot(doc => {
|
||||
var data = doc.data();
|
||||
if (data) {
|
||||
toggleLoaders(node)
|
||||
node.innerText = numberWithCommas(data.views)
|
||||
} else {
|
||||
node.innerText = 0
|
||||
}
|
||||
toggleLoaders(node)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -28,9 +31,12 @@ if (typeof auth !== 'undefined') {
|
||||
likesCollection.doc(id).onSnapshot(doc => {
|
||||
var data = doc.data();
|
||||
if (data) {
|
||||
toggleLoaders(node)
|
||||
node.innerText = numberWithCommas(data.likes)
|
||||
} else {
|
||||
node.innerText = 0
|
||||
}
|
||||
toggleLoaders(node)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<span>
|
||||
<button id="likes_button"
|
||||
<button id="button_likes"
|
||||
class="rounded-md border border-primary-400 px-1 py-[1px] text-xs font-normal text-primary-700 dark:border-primary-600 dark:text-primary-400"
|
||||
onclick="process_article()">
|
||||
<span id="likes_button_heart" style="display:none" class="inline-block align-text-bottom">{{ partial "icon.html" "heart" }} </span>
|
||||
<span id="likes_button_emtpty_heart" class="inline-block align-text-bottom">{{ partial "icon.html" "heart-empty" }}</span>
|
||||
<span id="likes_button_text"> Like</span>
|
||||
<span id="button_likes_heart" style="display:none" class="inline-block align-text-bottom">{{ partial "icon.html" "heart" }} </span>
|
||||
<span id="button_likes_emtpty_heart" class="inline-block align-text-bottom">{{ partial "icon.html" "heart-empty" }}</span>
|
||||
<span id="button_likes_text"> Like</span>
|
||||
</button>
|
||||
</span>
|
||||
{{- /* Trim EOF */ -}}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hugo-blowfish-theme",
|
||||
"version": "2.47.0",
|
||||
"version": "2.47.2",
|
||||
"description": "Blowfish theme for Hugo",
|
||||
"scripts": {
|
||||
"fullinstall": "npm run preinstall && npm install && npm run postinstall",
|
||||
|
||||
Reference in New Issue
Block a user