small bug fix volume 2 - like button

This commit is contained in:
Nuno Coração 2023-12-06 22:17:39 +00:00
parent ea8ad8ba7c
commit 80d2a65a0c
3 changed files with 11 additions and 10 deletions

View file

@ -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)

View file

@ -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])

View file

@ -1,6 +1,6 @@
{
"name": "hugo-blowfish-theme",
"version": "2.47.1",
"version": "2.47.2",
"description": "Blowfish theme for Hugo",
"scripts": {
"fullinstall": "npm run preinstall && npm install && npm run postinstall",