<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <style> .thread-container { line-height: 1.2rem; margin-bottom: 30px; text-align: left; padding: 24px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); text-decoration: none !important; color: white !important; background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 10%, rgba(0, 0, 0, 1) 90%), url(https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/56e6e56d-738a-41a9-961f-73029fcb5c83/dbuzj1o-b4dbbbe7-e08e-4831-8432-fba53674ae0b.gif?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcLzU2ZTZlNTZkLTczOGEtNDFhOS05NjFmLTczMDI5ZmNiNWM4M1wvZGJ1emoxby1iNGRiYmJlNy1lMDhlLTQ4MzEtODQzMi1mYmE1MzY3NGFlMGIuZ2lmIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmZpbGUuZG93bmxvYWQiXX0.VO60OrZAb_TYEafcSSkEuxhvYUkrhNOPR5hzjtLJMok); } .thread-container a.community { font-size: 16px; font-weight: 600; text-decoration: none !important; } .thread-comment { line-height: 1.2rem; margin-bottom: 30px; text-align: left; padding: 24px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); text-decoration: none !important; color: white !important; background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 10%, rgba(0, 0, 0, 1) 90%), url(https://pa1.aminoapps.com/7021/f1347e7e9026b20a425a61b7f15cdaf86c5c70e5r1-350-350_00.gif); } h1.pTtl { display: none; } .th-header { position: relative; top: 20px; margin-bottom: 30px; } .thread-container i { opacity: 0.5; cursor: pointer; } .thread-comment i { opacity: 0.5; cursor: pointer; } .country { position: absolute; width: 16px; height: 16px; left: 0; bottom: 0; } .largeFont { font-size: 20px !important; } .smallFont { font-size: 12px !important; } .lowOpacity { opacity: 0.7; } .bold { font-weight: 600; } .light { font-weight: 400 !important; } .th-body { width: 100%; margin-bottom: 20px; margin-top: 10px; } .th-body p { line-height: 1.4rem; } .th-footer { padding-bottom: 20px; } .th-body h4 { opacity: 0.8; border-top: 1px solid white; } .thread-container .profile, .thread-comment .profile { width: 40px; height: 40px; border-radius: 50%; border: 1.7px solid gray; float: left; } .thread-container span, .thread-comment span { margin: 0px 3px 0px 3px; display: inline-block; } .th-body .attachments { margin-top: 5px; } .attachments>img { width: 100%; } .smallImg { max-width: 200px; } div.relative { position: relative; } div.left { float: left; } .floatRight { float: right; } .cursorPointer { cursor: pointer; } div.borderBottom { border-bottom: 1px solid white; } a.username { color: white !important; margin-left: 5px; } div.reply { color: #000; border-left: 5px solid red; padding: 5px; background: #F9FAFA; margin: 20px 0 20px 0; opacity: 0.9; cursor: pointer; } .ql-editor { background: transparent; color: white; } .comment-editor { display: block; width: 100%; vertical-align: top; margin: 0 -20px 0 -10px; margin-bottom: 40px; } .comment-editor span { line-height: 1.2rem; display: block; } .comment-editor img { display: inline-block; width: 50px !important; height: 50px !important; margin: 5px; } .comment-editor textarea { display: inline-block; all: unset; padding: 5px; color: white; line-height: 1.2rem; font-size: 16px; width:97%; padding: 10px; border: 1px double white; } .comment-editor button { all: unset; text-align: center; background: #262A31; color: white; line-height: 1.2rem; font-size: 14px; border: 1px solid white; margin: 1px; opacity: 0.8; padding: 0px 10px 0px 10px; } .comment-editor button:active { opacity: 0.5; } .comment-editor input { opacity: 0.8; background: black; color: white; } #loader-wrapper { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; background-color: rgba(0, 0, 0, 0.3); } #loader { display: block; position: relative; left: 50%; top: 50%; width: 100px; height: 100px; margin: -50px 0 0 -50px; border-radius: 50%; border: 3px solid transparent; border-top-color: #3498db; -webkit-animation: spin 2s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ animation: spin 2s linear infinite; /* Chrome, Firefox 16+, IE 10+, Opera */ } #loader:before { content: ""; position: absolute; top: 5px; left: 5px; right: 5px; bottom: 5px; border-radius: 50%; border: 3px solid transparent; border-top-color: #e74c3c; -webkit-animation: spin 3s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ animation: spin 3s linear infinite; /* Chrome, Firefox 16+, IE 10+, Opera */ } #loader:after { content: ""; position: absolute; top: 15px; left: 15px; right: 15px; bottom: 15px; border-radius: 50%; border: 3px solid transparent; border-top-color: #f9c922; -webkit-animation: spin 1.5s linear infinite; /* Chrome, Opera 15+, Safari 5+ */ animation: spin 1.5s linear infinite; /* Chrome, Firefox 16+, IE 10+, Opera */ } @-webkit-keyframes spin { 0% { -webkit-transform: rotate(0deg); /* Chrome, Opera 15+, Safari 3.1+ */ -ms-transform: rotate(0deg); /* IE 9 */ transform: rotate(0deg); /* Firefox 16+, IE 10+, Opera */ } 100% { -webkit-transform: rotate(360deg); /* Chrome, Opera 15+, Safari 3.1+ */ -ms-transform: rotate(360deg); /* IE 9 */ transform: rotate(360deg); /* Firefox 16+, IE 10+, Opera */ } } @keyframes spin { 0% { -webkit-transform: rotate(0deg); /* Chrome, Opera 15+, Safari 3.1+ */ -ms-transform: rotate(0deg); /* IE 9 */ transform: rotate(0deg); /* Firefox 16+, IE 10+, Opera */ } 100% { -webkit-transform: rotate(360deg); /* Chrome, Opera 15+, Safari 3.1+ */ -ms-transform: rotate(360deg); /* IE 9 */ transform: rotate(360deg); /* Firefox 16+, IE 10+, Opera */ } } </style> <style> .locked-link { display: flex; padding: 12px; -webkit-box-shadow: inset 0px 0px 28px 10px rgba(0,0,0,0.75); -moz-box-shadow: inset 0px 0px 28px 10px rgba(0,0,0,0.75); box-shadow: inset 0px 0px 28px 10px rgba(0,0,0,0.75); cursor: pointer; line-height: 1.2rem; align-items: center; max-width: 200px; overflow-x: hidden; margin: 10px; color: #000 !important; background: #1DA1F2; border-radius: 10px; font-weight: 600; } .locked-link i { font-size: 24px; float: left; } .link-info { margin-left: 10px; display: flex; flex-direction: column; } .zer-comment-animation-overlay { width: 100%; height: 100%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #000a; opacity: 1; transition: .1s; } /* animation ================= */ .zer-comLoader { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } .zer-comLoader { width: calc(40% / cos(45deg)); height: 1.4rem; background: repeating-linear-gradient(-45deg,#eee 0 15px,#0000 0 20px) left/200% 100%; animation: l3 4s infinite linear; } @keyframes l3 { 100% { background-position:right } } </style> <div mythread></div> <template thread-template> <div class="thread-container"> <a class='community' href='https://storehaccounts.blogspot.com/p/battle-cats-gamer-community.html'><i class="fa fa-home"></i> Back to Community</a> <div class="th-header"> <div class='relative left'><img class="profile" loading="lazy" profile-img="" src=""><img class="country" loading="lazy" src="" th-country=""></div> <a username-link class="username"><i class="fa fa-user"></i><span class="bold" th-username=""></span></a> <span class='rank'><i class="fa fa-flag"></i><span th-rank class='lowOpacity light smallFont'>Novice</span></span> <span class="date"><i class="fa fa-clock-o"></i><span class="lowOpacity light smallFont" th-date=""></span></span> <br> <span class="tags"><i class="fa fa-thumb-tack"></i><span class="lowOpacity light smallFont" th-tags=""></span></span> </div> <div class="th-body"> <h4 class="title-th" th-title=""></h4> <p class="body" th-body=""></p> <div th-images class="attachments"></div> </div> <div class="th-footer"> <span class="heart largeFont"><i upvote-btn onclick='upvoteThread()' class="fa fa-heart"></i><span th-upvotes="">1</span></span> <span class="comments largeFont"><i onclick="readyComment();" class="fa fa-comments"></i><span th-comments="">0</span></span> <span class="heart largeFont floatRight"><i share-link class="fa fa-share-alt"></i><span th-upvotes=""></span></span> </div> </div> </template> <div default-comment-place> <div comment-child></div> </div> <div comment-editor class='comment-editor'></div> <h4 comment-count></h4> <div mycomment></div> <template comment-template> <div class="thread-comment"> <div class="cm-header"> <div class='relative left'><img class="profile" cm-profile-img="" loading="lazy" src=""><img class="country" cm-country="" loading="lazy" src=""></div> <a user-link class="username"><i class="fa fa-user"></i><span class="bold" cm-username="">ptcrebornofficial</span></a> <span class='rank'><i class="fa fa-flag"></i><span cm-rank class='lowOpacity light smallFont'>Novice</span></span><br> <span class="date"><i class="fa fa-clock-o"></i><span cm-date class="lowOpacity light smallFont" cm-date="">7 hours ago</span></span> <span cm-number class='floatRight'></span> </div> <div class="th-body"> <div cm-reply class='reply bold'></div> <p class="body" cm-body=""></p> <div cm-images class="attachments smallImg"><img loading="lazy" src=""/></div> </div> <div class="th-footer"> <span class="heart largeFont floatRight"><i share-link class="fa fa-share-alt"></i><span cm-upvotes=""></span></span> <span onclick='insertElement(this.parentNode)' class="cursorPointer heart largeFont floatRight"><i class="fa fa-reply"></i><span>Reply</span></span> </div> </div> </template> <script> window.addEventListener('load', function () { if (typeof threadId !== 'undefined') { buildThread(); buildComments(); initializeComment(); } else { window.alert('Error link!'); window.location.href = 'https://storehaccounts.blogspot.com/p/battle-cats-gamer-community.html'; } }, false); let url = window.location.href; url = url.replace('?m=1', '').replace('&m=1', ''); let threadId = ''; let commentId = ''; let reply_id = ''; let commentHL = ''; let new_comment_id = ''; let active_user = ''; if(localStorage.getItem('ptc_user')) active_user = JSON.parse(localStorage.getItem('ptc_user')).user; threadId = url.split('?')[1]; let requestedThread = threadId; if (threadId.includes('#')) { commentHL = threadId.split('#')[1] threadId = threadId.split('#')[0] requestedThread = threadId; } function qpro(str) { return document.querySelector('[' + str + ']'); } function query(str) { return document.getElementById(str); } function insertElement(elem) { let newElem = qpro('comment-editor'); reply_id = elem.parentNode.id; elem.parentNode.insertBefore(newElem, elem.nextSibling); } async function buildThread() { let threadData = await FirebaseModule.get('https://storehaccounts-threads-default-rtdb.firebaseio.com/threads/' + threadId + '.json'); threadData = JSON.parse(threadData); let myDoc = qpro('thread-template').content.cloneNode(true).children[0]; let tempDiv = document.createElement('div'); document.title = threadData.content.title; myDoc.id = threadId; myDoc.querySelector('[th-title]').innerText = threadData.content.title; myDoc.querySelector('[th-comments]').innerText = threadData.details.hasOwnProperty('comments') ? threadData.details.comments : '0'; myDoc.querySelector('[th-upvotes]').innerText = threadData.details.upvote; myDoc.querySelector('[th-tags]').innerText = threadData.action.val + ' in ' + threadData.category; myDoc.querySelector('[th-date]').innerText = moment(parseInt(threadData.details.date)).fromNow(); myDoc.querySelector('[share-link]').setAttribute('onclick', 'copyLink(' + threadId + ')'); qpro('comment-count').innerText = threadData.details.hasOwnProperty('comments') ? threadData.details.comments + ' comments' : 'Be the first to comment!'; qpro('mythread').appendChild(myDoc); // user info JBLOBFunctions.getBlobRecord('https://jsonblob.com/api/jsonBlob/' + threadData.author.userid, function (data) { data = JSON.parse(data); query(threadId).setAttribute('user-id', threadData.author.userid); query(threadId).querySelector('[profile-img]').src = data.prof_image; query(threadId).querySelector('[th-username]').innerText = data.nickname; query(threadId).querySelector('[username-link]').href = 'https://storehaccounts.blogspot.com/p/your-account-page.html?' + threadData.author.userid; if (data.hasOwnProperty('country') && data.country.length > 0) { tempDiv.innerHTML = data.country; query(threadId).querySelector('[th-country]').src = tempDiv.querySelector('img').src; } else query(threadId).querySelector('[th-country]').src = 'https://img.freepik.com/premium-vector/philippines-flag-cartoon-is-slip-banana-peel-cute-design_152558-42286.jpg'; query(threadId).querySelector('[th-rank]').innerText = Ranks.getRank(data).name; // post info JBLOBFunctions.getBlobRecord('https://jsonblob.com/api/jsonBlob/' + threadData.content.body, function (data) { data = JSON.parse(data); query(threadId).querySelector('[th-body]').innerHTML = data.description; //data.description.replace(/(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*))/g, (x) => "<div onclick=\"window.location.href=\'https://storehaccounts.blogspot.com/p/link-terminal.html#" + btoa(x) + "\'\" class='locked-link'><i class='fa fa-lock'></i><div class='link-info'><span style='margin-bottom: 5px;'>Link Locked <span style='font-size: 12px; line-height: 1rem;'>(Bypass to Unlock)</span></span><small style='font-style: italic; text-decoration: underline; font-size: 12px; line-height: 1rem;'>" + new URL(x).hostname + "</small></div></div>"); let attachments = data.imgs; if (data.hasOwnProperty('imgs')) for (i = 0; i < attachments.length; i++) query(threadId).querySelector('[th-images]').innerHTML += '<img class="cursorPointer" onclick="window.open(\'' + attachments[i] + '\')" src="' + attachments[i] + '"/>'; }); }); } async function buildComments() { let data = await FirebaseModule.get('https://storehaccounts-talks-default-rtdb.firebaseio.com/' + threadId + '.json'); if (data != null && data != 'null') { data = JSON.parse(data); data = Object.entries(data); for (let i = 0; i < data.length; i++) { let id = data[i][0]; let content = data[i][1]; let myDoc = qpro('comment-template').content.cloneNode(true).children[0]; let tempDiv = document.createElement('div'); myDoc.id = id; myDoc.querySelector('[cm-body]').innerHTML = content.msg; //content.msg.replace(/(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*))/g, (x) => "<a target='_blank' href='https://storehaccounts.blogspot.com/p/link-terminal.html#" + btoa(x) + "' class='locked-link'><i class='fa fa-lock'></i><div class='link-info'><span class='marginBottom'>Link Locked <span class='small'>(Bypass to Unlock)</span></span><span class='italic underline small'>" + new URL(x).pathname + "</span></div></a>"); myDoc.querySelector('[cm-reply]').innerHTML = content.reply; myDoc.querySelector('[cm-reply]').querySelector('div').style = ''; if (myDoc.querySelector('[cm-reply]').querySelector('span')) myDoc.querySelector('[cm-reply]').querySelector('span').style = ''; if (myDoc.querySelector('[cm-reply]').innerText == '') myDoc.querySelector('[cm-reply]').remove(); myDoc.querySelector('[cm-number]').innerText = '#' + i; myDoc.querySelector('[user-link]').href = 'https://storehaccounts.blogspot.com/p/your-account-page.html?' + content.userid; myDoc.setAttribute('user-id', content.userid); myDoc.querySelector('[cm-date]').innerText = moment(parseInt(id)).fromNow(); myDoc.querySelector('[share-link]').setAttribute('onclick', 'copyLink(' + id + ')'); // attachment of images if (content.hasOwnProperty('imgs')) for (let j = 0; j < content.imgs.length; j++) myDoc.querySelector('[cm-images]').innerHTML = '<img class="cursorPointer" onclick="window.open(\'' + content.imgs[j] + '\')" src="' + content.imgs[j] + '"/>'; qpro('mycomment').appendChild(myDoc); JBLOBFunctions.getBlobRecord('https://jsonblob.com/api/jsonBlob/' + content.userid, function (data) { data = JSON.parse(data); if (data.hasOwnProperty('country') && data.country.length > 0) { tempDiv.innerHTML = data.country; query(id).querySelector('[cm-country]').src = tempDiv.querySelector('img').src; } else query(id).querySelector('[cm-country]').src = 'https://static.vecteezy.com/system/resources/previews/011/802/346/original/8-bit-pixel-banana-fruits-in-the-illustration-of-game-asset-8-bit-vector.jpg'; query(id).querySelector('[cm-rank]').innerText = Ranks.getRank(data).name; query(id).querySelector('[cm-profile-img]').src = data.prof_image; query(id).querySelector('[cm-username]').innerText = data.nickname; }); if (commentHL == id) { setTimeout(function () { scrollToElem(document.getElementById(id)); }, 2000); } } } } function scrollToElem(elem) { const yOffset = -170; const y = elem.getBoundingClientRect().top + window.pageYOffset + yOffset; window.scrollTo({ top: y, behavior: 'smooth' }); elem.style.borderLeft = '3px solid white'; setTimeout(function () { elem.style.borderLeft = '3px solid transparent'; }, 1500); } function textAreaAdjust(element) { element.style.height = 'auto'; element.style.height = (element.scrollHeight) + "px"; } async function upvoteThread() { qpro('upvote-btn').style.pointerEvents = 'none'; qpro('upvote-btn').style.opacity = '0.7'; let total = 0; let data = await FirebaseModule.get('https://storehaccounts-threads-default-rtdb.firebaseio.com/threads/' + threadId + '/details/upvote.json'); total = parseInt(data) + 1; data = { "upvote": parseInt(data) + 1 }; await FirebaseModule.patch('https://storehaccounts-threads-default-rtdb.firebaseio.com/threads/' + threadId + '/details.json', JSON.stringify(data)); qpro('th-upvotes').innerText = total; if(localStorage.getItem('ptc_user') && query(requestedThread).getAttribute('user-id') != active_user) await notifyUser( query(requestedThread).getAttribute('user-id'), "upvoted", "https://storehaccounts.blogspot.com/p/ptc-post-official.html?" + requestedThread, qpro('comment-editor').querySelector('img').src, qpro('comment-editor').querySelectorAll('span')[1].innerText, query(requestedThread).querySelector('h4').innerText, (qpro('th-images').hasChildNodes() ? qpro('th-images').querySelectorAll('img')[0].src : 'https://lh3.googleusercontent.com/7lhPPsjwnZe1LlUU5nHRiqwQ-xfc7S-8BzXDEjaF2R7In1-9z7Dgh0Tm_LuVWYvsCbA'), "i like this post!" ); } async function initializeComment() { // check if the user is logged in let user = localStorage.getItem('ptc_user'); if (user) { user = JSON.parse(user).user; userid = user; let data = await JBLOBFunctions.getBlobRecordSync('https://jsonblob.com/api/jsonBlob/' + user, null); data = JSON.parse(data); let comm_img = data.prof_image; let comm_nick = data.nickname; qpro('comment-editor').style.position = 'relative'; qpro('comment-editor').innerHTML = "<img style='float: left;' src='" + comm_img + "'/><span>Comment as</span><span><b>" + comm_nick + "</b></span><textarea comment-textarea onkeyup='textAreaAdjust(this)' placeholder='Enter comment.'></textarea> <div img-attached></div><br><div><button comment-submit onclick='makeComment();'>Comment</button><label for='comm_imgupload1' style='font-size: 14px; padding: 0 3px 0 3px; background: #262A31; color: white; opacity: 0.8; border: 1px solid white; margin: 3px;'>Upload Image</label><input style='display: none;' id='comm_imgupload1' type='file' accept='image/png, image/gif, image/jpeg, image/bmp' /></div>"; uploadedInit(); } else { qpro('comment-editor').innerHTML = '<h4 style="color: red;">Please log in or create an account to create comment!</h4>'; } } function uploadedInit() { comm_imgupload1.addEventListener("change", ev => { qpro('comment-submit').style.pointerEvents = 'none'; qpro('comment-submit').innerText = 'Please wait uploading image...'; const formdata = new FormData(); formdata.append("image", ev.target.files[0]) fetch("https://api.imgbb.com/1/upload?key=07f1351d4e674784012d92ae6e03b49d", { method: "post", body: formdata }).then(data => data.json()).then(data => { let url = data.data.image.url; let img = document.createElement('img'); img.src = url; img.style.maxWidth = "150px"; img.style.margin = '5px'; img.style.objectFit = 'cover'; qpro('img-attached').appendChild(img); qpro('comment-submit').style.pointerEvents = 'auto'; qpro('comment-submit').innerText = 'Comment'; }).catch((data) => { window.alert("Error in uploading! Try uploading again."); qpro('comment-submit').style.pointerEvents = 'auto'; qpro('comment-submit').innerText = 'Comment'; }); }); } function readyComment() { if (qpro('comment-textarea')) { reply_id = ''; insertElement(qpro('comment-child')); scrollToElem(qpro('comment-textarea')); } else { window.alert('Please login first to create a comment.'); } } async function makeComment() { qpro('comment-editor').style.pointerEvents = 'none'; qpro('comment-submit').innerText = 'Posting...'; let tempLoadingDoc = document.createElement('div'); tempLoadingDoc.innerHTML = '<div class="zer-comment-animation-overlay"><div class="zer-comLoader"></div></div>'; //tempLoadingDoc.innerHTML = ' <div id="loader-wrapper"><div id="loader"></div></div>'; qpro('comment-editor').appendChild(tempLoadingDoc); let comment_msg = qpro('comment-textarea').value.replaceAll('\n', '<br/>'); let comment_reply = makeReply(); let imgs = []; let id = new Date().getTime(); new_comment_id = id; let imgs_temp = qpro('img-attached').querySelectorAll('img'); if (qpro('comment-textarea').value.length > 2 || imgs_temp.length > 0) { for (i = 0; i < imgs_temp.length; i++) imgs.push(imgs_temp[i].src); // check first if the thread already has comment record // if not then create one let existingComment = await FirebaseModule.get('https://storehaccounts-threads-default-rtdb.firebaseio.com/threads/' + requestedThread + '/details/comments.json'); if (!existingComment) { let temp_comm_data = { "comments": requestedThread } await FirebaseModule.patch('https://storehaccounts-threads-default-rtdb.firebaseio.com/threads/' + requestedThread + '/details.json', JSON.stringify(temp_comm_data)); } let existingTalk = await FirebaseModule.get('https://storehaccounts-talks-default-rtdb.firebaseio.com/' + requestedThread + '.json'); if (existingTalk) { let talk_data = { [id]: { "msg": comment_msg, "userid": userid, "reply": comment_reply, "imgs": imgs } } await FirebaseModule.patch('https://storehaccounts-talks-default-rtdb.firebaseio.com/' + requestedThread + '.json', JSON.stringify(talk_data)); } else { let talk_data = { [requestedThread]: { [id]: { "msg": comment_msg, "userid": userid, "reply": comment_reply, "imgs": imgs } } } // this append the activity to the talks activity await FirebaseModule.patch('https://storehaccounts-talks-default-rtdb.firebaseio.com/.json', JSON.stringify(talk_data)); } await addCommentCount(); } else { window.alert('Please type something at least 3 characters or upload something!'); qpro('comment-editor').style.opacity = '1'; qpro('comment-editor').style.pointerEvents = 'auto'; query('loader-wrapper').remove(); qpro('comment-submit').innerText = 'Comment'; } } function makeReply() { // first get the comment id // second get the content of the comment to be replied // get the nickname of the user to be replied // create a reply let myDiv = document.createElement('div'); if (reply_id.length > 0) { let toReplyElem = document.getElementById(reply_id); myDiv.style.padding = "3px"; myDiv.style.color = "white"; myDiv.style.margin = "0 !important"; myDiv.style.marginBottom = "10px"; myDiv.setAttribute('onclick', 'javascript:scrollToElem(document.getElementById(\"' + reply_id + '\"))'); myDiv.innerHTML = '<span><b>' + toReplyElem.querySelector('a>span').innerText + '</b> said: <br>' + toReplyElem.querySelector('.th-body>p').innerText.replaceAll('\n', '. ').substring(0, 150) + '...</span>'; } return myDiv.outerHTML; } async function makeLogs() { let bloblink = 'https://jsonblob.com/api/jsonBlob/' + userid; let thumb = ''; // check whether there's an attachment in the post if(qpro('th-images').querySelector('img')) { thumb = qpro('th-images').querySelector('img').src; } else { // else get the profile picture of the poster... if(qpro('profile-img')) { thumb = qpro('profile-img').src; } } let action = (reply_id.length > 0 ? 'replied to a comment' : 'commented to a thread'); let title = document.title; let date = new Date().getTime(); let link = 'https://storehaccounts.blogspot.com/p/ptc-post-official.html?' + requestedThread + '#' + new_comment_id; // notify respective users with this action // Adding Notification Update to the user. if (reply_id.length > 0 && query(reply_id).getAttribute('user-id') != active_user) { await notifyUser( query(reply_id).getAttribute('user-id'), "replied", "'https://storehaccounts.blogspot.com/p/ptc-post-official.html?" + requestedThread + '#' + new_comment_id, qpro('comment-editor').querySelector('img').src, qpro('comment-editor').querySelectorAll('span')[1].innerText, query(requestedThread).querySelector('h4').innerText, (qpro('th-images').hasChildNodes() ? qpro('th-images').querySelectorAll('img')[0].src : 'https://lh3.googleusercontent.com/7lhPPsjwnZe1LlUU5nHRiqwQ-xfc7S-8BzXDEjaF2R7In1-9z7Dgh0Tm_LuVWYvsCbA'), qpro('comment-editor').querySelector('textarea').value ); } if(query(requestedThread).getAttribute('user-id') != active_user) await notifyUser( query(requestedThread).getAttribute('user-id'), "commented", "'https://storehaccounts.blogspot.com/p/ptc-post-official.html?" + requestedThread + '#' + new_comment_id, qpro('comment-editor').querySelector('img').src, qpro('comment-editor').querySelectorAll('span')[1].innerText, query(requestedThread).querySelector('h4').innerText, (qpro('th-images').hasChildNodes() ? qpro('th-images').querySelectorAll('img')[0].src : 'https://lh3.googleusercontent.com/7lhPPsjwnZe1LlUU5nHRiqwQ-xfc7S-8BzXDEjaF2R7In1-9z7Dgh0Tm_LuVWYvsCbA'), qpro('comment-editor').querySelector('textarea').value ); // this append the activity to user profile await RecordUserLogs(bloblink, thumb, action, title, date, link); let commentLogsData = { [new Date().getTime()]: { "content": qpro('comment-textarea').value.replaceAll('\n', '<br/>'), "link": link, "userimg": document.querySelector('.comment-editor img').src } } // this append the activity to general comment logs await FirebaseModule.patch('https://storehaccounts-comments-default-rtdb.firebaseio.com/comments.json', JSON.stringify(commentLogsData)); window.location.href = link; setTimeout(() => window.location.reload(), 300); } function RecordUserLogs(blobLink, thumb, action, title, date, link) { return new Promise(function (resolve, reject) { JBLOBFunctions.PUTRecordBlob(blobLink, function (new_data) { let logs_data = { "thumbnail": thumb, "action": action, "title": title, "link": link, "date": date }; if (new_data.hasOwnProperty('logs')) { new_data.logs.push(logs_data); } else { new_data["logs"] = [logs_data]; } return new_data; }, function (new_data) { resolve(new_data); }); }); } function copyLink(id) { navigator.clipboard.writeText('https://storehaccounts.blogspot.com/p/ptc-post-official.html?' + requestedThread + '#' + id); window.alert('Link copied to your clipboard!'); } function addCommentCount() { JBLOBFunctions.PUTRecordBlob('https://jsonblob.com/api/jsonBlob/' + userid, function(data) { if(data.hasOwnProperty('comments')) { data.comments = parseInt(data.comments) + 1; } else { data["comments"] = 1; } return data; }, async function(d) { let data = await FirebaseModule.get('https://storehaccounts-threads-default-rtdb.firebaseio.com/threads/' + requestedThread + '/details/comments.json'); if(data == 'null') { let new_data = {"comments": "1"}; await FirebaseModule.patch('https://storehaccounts-threads-default-rtdb.firebaseio.com/threads/' + requestedThread + '/details.json', JSON.stringify(new_data)); } else { let cur_data = parseInt(data.replace('\"', '')) + 1; let new_dataa = {"comments": cur_data}; await FirebaseModule.patch('https://storehaccounts-threads-default-rtdb.firebaseio.com/threads/' + requestedThread + '/details.json', JSON.stringify(new_dataa)); } makeLogs(); }); } async function notifyUser(userID, action, link, prof_img, nickname, title, thumb, snippet) { // You need to notify the respective users. // whether in upvoting or in commenting. let notif_data = { [new Date().getTime()]: { "nickname": nickname, "action": action, "prof_img": prof_img, "webtitle": title, "link": link, "read": false, "thumb": thumb, "snippet": snippet } } await FirebaseModule.patch('https://storehaccounts-notifications-default-rtdb.firebaseio.com/' + userID + '.json', JSON.stringify(notif_data)); } </script>
7 hours ago