<style> * { box-sizing: border-box; padding: 0; margin: 0; } #main-div { /* --- positioning --- */ /* --- styling --- */ background:linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.5)), url(https://steamuserimages-a.akamaihd.net/ugc/91597306696671294/9BD668FCEA9B14C84CD2EFEE71A3C8E2A3F572B6/?imw=5000&imh=5000&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=false) center; background-size: cover; border: 0px none black; border-radius: 15px; box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3); max-width: 700px; } #top-div { height: 50px; } #body-div { height: auto !important; } #top-div, #body-div { padding: 15px; position: relative; /* width: 300px; */ } /* #top-div h3, #main-div hr, #body-div label { position: absolute; } */ /* --- h3 --- */ #top-div h3 { position: absolute; top: 50%; transform: translatey(-50%); } /* --- horizontal line --- */ #main-div hr { height: 1px; outline: none; border: none; background: grey; } /* --- textarea --- */ #input { /* position: absolute; */ width: 90%; height: 80px; resize: none; background: transparent; outline: none; border: none; color: white; } /* --- text color --- */ #main-div { color: white; } #input ::placeholder, #main-div input[type="file"] { color: rgba(255, 255, 255, 0.5) } #title::placeholder { padding: 10px; font-size: 24px; } #title { font-size: 24px; padding: 15px; } /* --- ^^^ --- */ #box-shadow { height: 100vh; width: 100%; background: rgba(0, 0, 0, 0.5); } /* --- input --- */ #body-div input { position: absolute; display: none; } /* --- label as button --- */ #body-div label { position: absolute; background: rgba(255, 255, 255, 0.2); padding: 4px 15px; border-radius: 5px; margin: 15px; } /* --- inputs' position --- */ #img { left: 0; bottom: 0; } #post { right: 0; bottom: 0; } /* --- image icon --- */ #imgupload { display: inline-block; margin-bottom: -3px; margin-right: 5px; width: 17px; height: 17px; } @media only screen and (min-width: 400px) { #top-div, body-div { width: 500px; } #body-div { font-size: 20px; height: 200px; } #input { width: 100%; height: 120px; } #imgupload { width: 20px; height: auto; } #body-div label { padding: 5px 30px; } #img { left: 0; } #post { right: 0; } } div#ptc_post_images img { padding: 10px; height: 100px !important; } </style> <div id="main-div" style='height: auto;'> <div id="top-div" style='height: auto;'> <h4><img id="info_profile_img" style="border-radius: 10px; width: 32px; height: 32px;"/><span style='background: -webkit-linear-gradient(#FFA531, #00D158);-webkit-background-clip: text;-webkit-text-fill-color: transparent;' id='info_name'></span><br>.. what's on your cats mind?? </h4> </div> <!--- body div ---> <input id='form_title' type='text' style='font-size: 24px !important; background:linear-gradient(to bottom, rgba(255,255,255,0.1) 0%, rgba(0,0,0,1)); padding-left: 15px;' placeholder='Title'/> <div id="body-div"> <!--- <center> ---> <textarea style='resize: none; width: 100%; border-radius: 30px; background:linear-gradient(to bottom, rgba(255,255,255,0.1) 0%, rgba(0,0,0,0.3)); height: 310px !important; font-size: 20px !important;' id="input" rows="" cols="" placeholder="Description"></textarea> <br /> <!--- image label ---> <label id="img"> <span> <img id="imgupload" src="https://dompetsosial.id/assets/images/slider/noimage.png" /> Add Image </span> <input id='imgupload1' accept="image/png, image/gif, image/jpeg, image/bmp" type="file" /> </label> <!--- post label ---> <label id="post"> <span> Post <input onclick='post();' type="submit" /> </span> </label> <!--- </center> ---> </div> <br><br> <!-- Community Feeds H --> <ins class="adsbygoogle" style="display:inline-block;width:100%;height:90px" data-ad-client="ca-pub-6328531102448868" data-ad-slot="8763156309"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <br><br> <select id='form_labels' style='background: black; color: white; width: 100%; font-size: 20px;'> <option>-- Select Category --</option> <option value='bcupack'>BCU Pack</option> <option value='sprite'>Sprite</option> <option value='fanart'>Fan Art/Fan Made</option> <option value='meme'>Meme</option> <option value='offtopic'>Off Topic</option> <option value='bcmods'>BC Mods</option> <option value='accounts'>Accounts</option> <option value='others'>Others</option> </select> <div id='form_attached_images' style='display: block;'></div> </div> <!--- box shadow ---> <script> window.addEventListener('DOMContentLoaded', checkUser(), false); let username = JSON.parse(localStorage.getItem('ptc_credentials')).username; let info_name = ''; let info_profile_img = ''; let data_title; let data_label; let data_images = []; let data_description; let img_uploading = false; let post_id = ''; const file = document.getElementById("imgupload1") file.addEventListener("change", ev => { img_uploading = true; document.querySelector('#img').style.pointerEvents = 'none'; document.querySelector('#img').style.opacity = '0.7'; let numImgs = 0; const formdata = new FormData() for(i=0; i<ev.target.files.length; i++) { formdata.append("image", ev.target.files[i]) fetch("https://api.imgbb.com/1/upload?key=07f1351d4e674784012d92ae6e03b49d", { method: "post", body: formdata }).then(data => data.json()).then(data => { numImgs++; if(numImgs == ev.target.files.length) img_uploading = false; document.querySelector('#img').style.pointerEvents = 'auto'; document.querySelector('#img').style.opacity = '1'; let img = document.createElement('img'); img.src = data.data.url; img.setAttribute('style', 'display: inline-block; margin: 5px; width: 150px !important'); document.querySelector('#form_attached_images').appendChild(img); //addImages(data.data.url); //url.innerText = data.data.link }) } }); function post() { checkTitle(); checkDescription(); checkImages(); checkCategory(); if(data_title && data_description && data_label && !img_uploading) { document.querySelector('#main-div').style,opacity = '0.7'; document.querySelector('#main-div').style.pointerEvents = 'none'; console.log(data_label); console.log(data_title); console.log(data_description); console.log(data_images); post_id = new Date().getTime() + '&' + username; let data = { [post_id]: { "title": data_title, "description": data_description, "images": data_images } } PUTsend('https://getpantry.cloud/apiv1/pantry/91c9a2f3-be20-4b3b-8c9e-94a81264de7a/basket/feeds', data, null, successFeedSent); } } function successFeedSent() { // after sending to feeds, send to labels. let data = { [data_label]: [post_id] } PUTsend('https://getpantry.cloud/apiv1/pantry/91c9a2f3-be20-4b3b-8c9e-94a81264de7a/basket/labels', data, null, successLabelSent); } function successLabelSent() { window.location.href = 'https://storehaccounts.blogspot.com/p/community-post.html?' + post_id; } function checkTitle() { if(document.querySelector('#form_title').value.length > 0) { data_title = document.querySelector('#form_title').value; } else window.alert("Opps, your forgot the title."); } function checkImages() { if(img_uploading) window.alert('Your image is still uploading...'); if(document.querySelector('#form_attached_images').hasChildNodes()) { let imgup = document.querySelectorAll('#form_attached_images img'); for(i=0 ; i<imgup.length; i++) { data_images[i] = imgup[i].src; } } } function checkDescription() { if(document.querySelector('#input').value.length > 0) { data_description = document.querySelector('#input').value; } else window.alert("Opps, your forgot the description."); } function checkCategory() { if(document.querySelector('#form_labels').value != '-- Select Category --') { data_label = document.querySelector('#form_labels').value; } else { data_label = null; window.alert('Please choose a category.'); } } function checkUser() { if(localStorage.getItem('ptc_credentials')) { try { let data = JSON.parse(localStorage.getItem('ptc_credentials')); document.querySelector('#info_name').innerText = data.name; document.querySelector('#info_profile_img').src = data.img; } catch(err) { window.location.href = 'https://storehaccounts.blogspot.com/p/login_20.html'; } } else window.location.href = 'https://storehaccounts.blogspot.com/p/login_20.html'; } // MISC function PUTsend(pantry, data, logs, callback) { data = JSON.stringify(data); let req = new XMLHttpRequest(); req.open('PUT', pantry, true); req.setRequestHeader('Content-Type', 'application/json'); req.onload = () => { if(req.readyState == XMLHttpRequest.DONE) if(req.status == 200) { if(logs != null) logs.innerText = 'Accepted by server..'; callback(); } } req.onerror = () => { if(logs != null) logs.innerText = 'Server overloads retrying in 5 seconds...'; setTimeout(function() { PUTsend(pantry, data, logs, callback); }, 5000); } try { req.send(data); } catch(err) { if(logs != null) logs.innerText = 'Server overloads retrying in 5 seconds... ' + err; setTimeout(function() { PUTsend(pantry, data, logs, callback); }, 5000); } } </script>