<script async='async' src='https://rawgit.com/moment/moment/2.2.1/min/moment.min.js'></script> <style> .comment-head { display: block; background: transparent; width: 100%; padding: 5px; position: relative; } .comment-head img { width: 64px !important; height: 64px !important; object-fit: cover; border-radius: 50%; } .comment-head a { all: unset; color: white; text-decoration: none !important; font-weight: 600; } .comment-head span { position: absolute; margin-left: 5px; margin-right: 10px; } .comment-body, .comment-replied { display: block; background: transparent; width: 100%; padding: 10px; } .comment-stats { display: block; background: transparent; width: 100%; padding: 5px; font-size: 14px; opacity: 0.7; } .comment-stats span { margin-right: 10px; } .parent-comments { background: linear-gradient(rgb(45,45,48, 0.7), rgb(45, 45, 48)) !important; min-width: 300px; max-width: 1280px; width: 95%; color: white; float: right; margin-bottom: 20px; padding: 10px; } .comment-images { display: block; background: transparent; width: 30%; padding: 5px; } .comment-images img { max-height: 300px; object-fit: cover; } .votes-and-reply { display: block; background: transparent; width: 100%; padding-bottom: 7px; text-align: center; } .votes-and-reply button { all:unset; background: rgb(226,231,233); padding: 0 10px 0 10px; display:inline-block; width: max-content; margin: 5px; font-weight: 700; float: left; color: black; } .votes-and-reply button:hover { opacity: 0.8; } </style> <style> .ptc-editor { width: 100%; min-height: 200px; resize: vertical; background: linear-gradient(rgb(61, 56, 50), rgb(41, 36, 30)) !important; color: #F9F9F9 !important; font-size: 16px; outline: none !important; padding-top: 50px !important; padding-left: 10px !important; } .ptc-controls { display: none; min-width: 150px; max-width: 1280px; width: 95%; float: right; margin-top: -20px; margin-bottom: 20px; } .ptc-controls .comment-title { position: relative; top: 50px; left: 5px; font-size: 12px; opacity: 0.8; } .ptc-controls input[type=file] { width: 100%; color: white !important; display: none; } .ptc-controls label { display: inline-block; font-size: 16px; vertical-align: super; } .ptc-controls label img { position: relative; top: 8px; width: 24px; height: 24px; border-radius: 20px; } .ptc-images img { display: inline-block; width: 150px; margin: 5px; } .ptc-controls button { display: inline-block; float: right; background: linear-gradient(rgb(61, 56, 50), rgb(41, 36, 30)) !important; color: white; outline: none; padding: 0 5px 0 5px; margin: 5px; font-size: 16px; } </style> <style> .ptc-comment-block { display: block; width: 100%; background: linear-gradient(rgb(45,45,48, 0.7), rgb(45, 45, 48)) !important; color: #F9F9F9 !important; font-size: 14px; padding: 20px 10px 10px 10px; } .user-info img { display: block; width: 128px; height: 128px; margin: 0 auto; } .user-info { text-align: center; display: block; margin: 0 auto; } .user-info p { display: block; margin: 0 auto; opacity: 0.9; } .user-info small { display: inline-block; /*background: #b33e0c;*/ padding: 0 10px 0 10px; opacity: 0.7; border-radius: 20px; color: white; } .user-message { width: 100%; font-size: 18px; } .user-message p { text-align: justify; padding: 5px; margin: 0 auto; opacity: 0.9; } .user-info a { display: block; text-decoration: underline; color: white; padding: 5px; margin: 0 auto; } .user-message img { background: white; opacity: 0.7; } .user-message a { word-wrap: break-word; font-size: 12px; } .user-message small { color: white; opacity: 0.6; } .ptc-comment-block button { width: 100%; padding: 0 10px 0 10px; color: white; background: transparent; opacity: 0.8; } .ptc-reply-snippet { color: black; background: white; opacity: 0.7; display: block; width: 100%; padding: 10px; max-height: 200px; overflow-y: auto; overflow-x: hidden; margin-bottom: 10px; cursor: pointer; } .ptc-reply-snippet img { max-height: 150px; } .ptc-reply-snippet a { color: black; word-wrap: break-word; } .ptc-reply-snippet p { margin: 0 auto; } </style> <style> .loader { width: 150px; } .loader-wheel { animation: spin 1s infinite linear; border: 2px solid rgba(30, 30, 30, 0.5); border-left: 4px solid #fff; border-radius: 50%; height: 150px; margin-bottom: 10px; width: 150px; } .loader-text { color: #fff; font-family: arial, sans-serif; } .loader-text:after { content: 'Loading Post data'; animation: load 2s linear infinite; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } @keyframes load { 0% { content: 'Loading Post data'; } 33% { content: 'Loading Post data.'; } 67% { content: 'Loading Post data..'; } 100% { content: 'Loading Post data...'; } } div.pInf, div.brdCmb, h1.pTtl { display: none; } </style> <div id='loading' style='align-items: center; display: flex; height: 100%; justify-content: center; margin: 0;'> <div class="loader"> <div class="loader-wheel"></div> <div class="loader-text"></div> </div> </div> <div id='parent'></div> <h4 id='comment-count'></h4> <h4><a href="https://storehaccounts.blogspot.com/p/login_20.html" id="not-login-comment" style="display: none;">Please login to comment...</a></h4> <button id='add-comment' class='button-7' style='display: none; width: 100% !important;' onclick='addElementToNext(this, query("comment-form-ptc"), "comment-form-ptc")'>Add Comment</button> <div id='comments'></div> <form id='comment-form-ptc' class='ptc-controls' action='javascript:createComment()'> <label for='comment-editor' class='comment-title'><img id="comment-user-img" style="width: 32px !important; height: 32px !important; object-fit: cover;"/>_Enter your comment...</label> <textarea minlength='10' required id='comment-editor' class='ptc-editor'></textarea> <label id='uploadImg' for='comm_imgupload1'>🖼️ Add Image <input style='display: none;' id='comm_imgupload1' accept="image/png, image/gif, image/jpeg, image/bmp" type="file" /></label> <button id='post_btn' type='submit'>Comment</button> <div class='ptc-images'></div> <div id='comm_form_attached_images'></div> </form> <script> window.addEventListener('load', function () { if(isUserLoggedIn) { query('not-login-comment').style.display = 'none'; query('comment-form-ptc').style.display = 'block'; } else { query('not-login-comment').style.display = 'block'; query('comment-form-ptc').style.display = 'none'; } getPostDetail(); query('comment-user-img').src = document.querySelector('.header-user-profile img').src; }, false); let url_host = window.location.href; let url_post_blob_id = ''; let isUserLoggedIn = localStorage.getItem('ptc_user'); url_host = url_host.replaceAll('?m=1', ''); url_host = url_host.replaceAll('&m=1', ''); if (url_host.includes('&')) { url_post_blob_id = url_host.split('?')[1].split('&')[0]; } else { url_post_blob_id = url_host.split('?')[1]; } function getPostDetail() { JBLOBFunctions.getBlobRecord('https://jsonblob.com/api/jsonBlob/' + url_post_blob_id, function (dataC) { if (dataC != '404') { dataC = JSON.parse(dataC); let userId = dataC.user; let username = ''; let userimg = ''; let postdate = moment(parseInt(dataC.date)).fromNow(); let category = dataC.category; let title = dataC.title; let mod = dataC.mod; let reactions = dataC.reactions; let description = dataC.description; let imgs = document.createElement('div'); buildComments(dataC.comments); JBLOBFunctions.getBlobRecord('https://jsonblob.com/api/jsonBlob/' + userId, function (dataB) { dataB = JSON.parse(dataB); username = dataB.nickname; userimg = dataB.prof_image; for (j = 0; j < dataC.images.length; j++) { imgs.innerHTML += "<img src='" + dataC.images[j] + "' style='margin: 5px 0 5px 0; display: inline-block; vertical-align: middle; width: 100%;'/>"; } if (dataC.images.length > 0) imgs.innerHTML += '<br>'; document.querySelector('#parent').innerHTML += "<div id='" + url_post_blob_id + "' style='background-image: linear-gradient(to bottom, #3D3832 , #29241E); padding: 10px; overflow: hidden; font-size: 14px;'><img src='" + userimg + "' style='display: inline-block; vertical-align: middle; object-fit: cover; height: 48px !important; width: 48px !important;'/> <a href='https://storehaccounts.blogspot.com/p/your-account-page.html?" + userId + "' style='margin-left: 5px; background: red; color: white; padding: 0px 7px; text-decoration: none; font-weight: bold;display: inline-block;'>" + username + "</a><a style='margin-left: 5px; background: blue; color: white; padding: 0px 7px; text-decoration: none; font-weight: bold;display: inline-block;'>" + category + "</a><a href='https://storehaccounts.blogspot.com/p/battle-cats-gamer-community.html?" + mod + "' style='margin-left: 5px; background: green; color: white; padding: 0px 7px; text-decoration: none; font-weight: bold;display: inline-block;'>" + mod + "</a><span style='color: gray;'> shared 📆 </span><span style='color: gray;'>" + postdate + "</span> <span class='voteCount' style='color: rgba(255,255,255,0.6);'>" + reactions + " voted</span> <span style='color: rgba(255,255,255,0.6);'>" + reactions + " commented</span><br><h4 style='margin: 0 auto;'>" + title + "</h4><p style='margin: 0 auto; font-size: 14px; line-height: 1.2rem'>" + description + "</p>" + imgs.innerHTML + "<a style='margin: 10px 10px 0px 0px; background: red; color: white; padding: 0px 7px; text-decoration: none; font-weight: bold;display: inline-block;' onclick='upvote(this, \"" + url_post_blob_id + "\")'>Upvote</a><a style='margin: 10px 10px 0px 0px; background: red; color: white; padding: 0px 7px; text-decoration: none; font-weight: bold;display: inline-block;' href='javascript:;' onclick='copyLink(this, \"https://storehaccounts.blogspot.com/p/ptc-post-official.html?" + url_post_blob_id + "\")'>Copy Link</a><a style='margin: 10px 10px 0px 0px; background: red; color: white; padding: 0px 7px; text-decoration: none; font-weight: bold;display: inline-block;' href='https://storehaccounts.blogspot.com/p/battle-cats-gamer-community.html'>Back to Community</a></div><br/>"; document.querySelector('#loading').remove(); }); } }); } function copyLink(elem, url) { navigator.clipboard.writeText(url); disableElem(true, elem, "Copied!"); setTimeout(function () { disableElem(false, elem, "Copy Link"); }, 500); } function disableElem(isTrue, elem, str) { if (isTrue) { elem.style.pointerEvents = 'none'; elem.style.opacity = '0.7'; elem.innerText = str; } else { elem.style.pointerEvents = 'auto'; elem.style.opacity = '1'; elem.innerText = str; } } function upvote(elem, id) { let num_votes = 0; disableElem(true, elem, "Upvoting..."); JBLOBFunctions.PUTRecordBlob('https://jsonblob.com/api/jsonBlob/' + id, function (data) { data.reactions = data.reactions + 1; num_votes = data.reactions; return data; }, function (data) { document.getElementById(id).querySelector('span.voteCount').innerText = num_votes + ' voted'; disableElem(true, elem, num_votes + " voted!"); }); } </script> <script> let reply_to_id = ''; function query(str) { return document.getElementById(str); } async function buildComments(comments) { query('comment-count').innerText = comments.length + " comments"; for (i = 0; i < comments.length; i++) { let commentId = comments[i]; await JBLOBFunctions.getBlobRecordSync('https://jsonblob.com/api/jsonBlob/' + comments[i], async function (data) { data = JSON.parse(data); let temp_elem = document.createElement('div'); temp_elem.setAttribute('class', 'parent-comments'); temp_elem.id = commentId; let commenter_nickname = ''; let commenter_image = ''; await JBLOBFunctions.getBlobRecordSync('https://jsonblob.com/api/jsonBlob/' + data.userid, function (dataB) { dataB = JSON.parse(dataB); commenter_nickname = dataB.nickname; commenter_image = dataB.prof_image; let attachments_parent = document.createElement('div'); for (j = 0; j < data.images.length; j++) attachments_parent.innerHTML += '<img src="' + data.images[j] + '"/>'; temp_elem.innerHTML += "<div class='comment-head'><img src='" + commenter_image + "'/><span><a href='https://storehaccounts.blogspot.com/p/your-account-page.html?" + data.userid + "'>" + commenter_nickname + "</a></span><span style='top: 25px;'>" + moment(parseInt(data.commentid)).fromNow() + "</span><span class='reactions' style='top: 45px;'>" + data.reactions + " voted</span></div>" + (data.replied.length > 0 ? '<div class=\"comment-replied\">' + data.replied + '</div>' : '') + "<div class='comment-body'>" + data.content + "</div><div class='comment-images'>" + attachments_parent.innerHTML + "</div><div class='votes-and-reply'><button class='comment-vote' onclick='upvoteComment(this, \"" + commentId + "\")'>[" + data.reactions + "] Upvote</button>" + (isUserLoggedIn ? "<button onclick='addElementToNext(this.parentNode, query(\"comment-form-ptc\"), this.parentNode.parentNode.id)'>Reply</button>": "") + "</div>"; query('comments').innerHTML += temp_elem.outerHTML; }); }); } } function renderComments(comments_json) { comments_json = comments_json.sort(function (a, b) { return b.vote - a.vote; }); query('comments').innerHTML = ''; for (k = 0; k < comments_json.length; k++) query('comments').innerHTML += comments_json[k].content; } function createComment() { /* data structure{ user: blob_id id: comment_id (date) content: string images: [] reactions: int } */ let url = url_host; if (url.includes('&')) url = url.substring(0, url_host.indexOf('&')); let postid = url.split('?')[1]; let userid = JSON.parse(localStorage.getItem('ptc_user')).user; let commentid = new Date().getTime(); let content = query('comment-editor').value.replaceAll('\n', '<br/>'); let images = []; let image_attachments = query('comm_form_attached_images').querySelectorAll('img'); let reactions = 1; let comment_blob_id = ''; for (i = 0; i < image_attachments.length; i++) images.push(image_attachments[i].src); let data = { "userid": userid, "commentid": commentid, "content": content, "images": images, "replied": (reply_to_id.length > 0 ? reply_to_id : ''), "reactions": reactions } JBLOBFunctions.createRecordBlob(JSON.stringify(data), function (data) { comment_blob_id = data.replace('\r', '').replace('\n', '').split('jsonBlob/')[1]; }); JBLOBFunctions.PUTRecordBlob('https://jsonblob.com/api/jsonBlob/' + postid, function (data) { data.comments.push(comment_blob_id); return data; }, function (data) { let attachments_parent = document.createElement('div'); for (j = 0; j < images.length; j++) attachments_parent.innerHTML += '<img src="' + images[j] + '"/>'; let temp_elem = document.createElement('div'); temp_elem.setAttribute('class', 'parent-comments'); temp_elem.id = commentid; temp_elem.innerHTML += "<div class='comment-head'><img src='" + document.querySelector('.header-user-profile img').src + "'/><span><a href='https://storehaccounts.blogspot.com/p/your-account-page.html?" + userid + "'>" + document.querySelector('.header-user-profile span').innerText.replace('Welcome back, ', '') + "</a></span><span style='top: 25px;'>" + moment(parseInt(commentid)).fromNow() + "</span><span class='reactions' style='top: 45px;'>" + reactions + " voted</span></div>" + (reply_to_id.length > 0 ? '<div class=\"comment-replied\">' + reply_to_id + '</div>' : '') + "<div class='comment-body'>" + content + "</div><div class='comment-images'>" + attachments_parent.innerHTML + "</div><div class='votes-and-reply'><button class='comment-vote' onclick='upvoteComment(this, \"" + comment_blob_id + "\")'>[" + reactions + "] Upvote</button>" + (isUserLoggedIn ? "<button onclick='addElementToNext(this.parentNode, query(\"comment-form-ptc\"), this.parentNode.parentNode.id)'>Reply</button>": "") + "</div>"; query('comments').innerHTML += temp_elem.outerHTML; query('comment-form-ptc').querySelector('textarea').value = ''; setTimeout(function () { scrollToTargetAdjusted(commentid); }, 800); }); } comm_imgupload1.addEventListener("change", ev => { query('post_btn').style.pointerEvents = 'none'; query('post_btn').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'; query('comm_form_attached_images').appendChild(img); query('post_btn').style.pointerEvents = 'auto'; query('post_btn').innerText = 'Comment'; }).catch((data) => { window.alert("Error in uploading! Try uploading again."); query('post_btn').style.pointerEvents = 'auto'; query('post_btn').innerText = 'Comment'; }); }); function scrollToTargetAdjusted(id) { var element = document.getElementById(id); var headerOffset = 150; var elementPosition = element.getBoundingClientRect().top; var offsetPosition = elementPosition + window.pageYOffset - headerOffset; window.scrollTo({ top: offsetPosition, behavior: "smooth" }); query(id).style.border = '3px solid white'; setTimeout(function () { query(id).style.border = '0px solid black'; }, 1300); } function addElementToNext(thisElement, newElement, id) { reply_to_id = '<blockquote onclick="scrollToTargetAdjusted(\'' + id + '\')" style="cursor: pointer; background: black;" class="comment-body">↺ ' + thisElement.parentNode.querySelector('div.comment-body').innerHTML + '</blockquote>'; thisElement.parentNode.insertBefore(newElement, thisElement.nextSibling); query('add-comment').style.display = 'block'; } function upvoteComment(elem, id) { elem.style.pointerEvents = 'none'; elem.style.opacity = '0.7'; elem.innerText = "Voting..."; JBLOBFunctions.PUTRecordBlob('https://jsonblob.com/api/jsonBlob/' + id, function (data) { data.reactions = data.reactions + 1; num_votes = data.reactions; return data; }, function (data) { elem.innerText = "[" + num_votes + "] voted!"; }); } </script>