2019-10-15 23:42:47 -03:00
< head >
< title > [[USERNAME]]'s Profile< / title >
< meta charset = "utf-8" >
2021-07-04 15:50:49 -04:00
< link href = "../assets/css/browser.css" type = "text/css" rel = "stylesheet" >
2019-10-15 23:42:47 -03:00
< script async src = "https://www.googletagmanager.com/gtag/js?id=UA-135255146-3" > < / script > < script > window . dataLayer = window . dataLayer || [ ] ; function gtag ( ) { dataLayer . push ( arguments ) ; } gtag ( 'js' , new Date ( ) ) ; gtag ( 'config' , 'UA-135255146-3' ) ; < / script >
2021-12-23 19:15:33 -03:00
< link rel = "icon" href = "../icon/icon?form=cube&icon=[[ICON]]&col1=[[COL1]]&col2=[[COL2]]&glow=[[GLOW]]" >
2019-10-15 23:42:47 -03:00
< meta id = "meta-title" property = "og:title" content = "[[USERNAME]]'s profile" >
< meta id = "meta-desc" property = "og:description" content = "Stars: [[STARS]] | Diamonds: [[DIAMONDS]] | Coins: [[COINS]] | User Coins: [[USERCOINS]] | Demons: [[DEMONS]] | CP: [[CP]]" >
2021-12-23 19:15:33 -03:00
< meta id = "meta-image" name = "og:image" itemprop = "image" content = "https://gdbrowser.com/icon/icon?form=cube&icon=[[ICON]]&col1=[[COL1]]&col2=[[COL2]]&glow=[[GLOW]]" >
2021-01-21 22:28:04 -03:00
< meta name = "twitter:card" content = "summary" >
2019-10-15 23:42:47 -03:00
< / head >
2019-10-22 20:54:19 -03:00
< body class = "levelBG" onbeforeunload = "saveUrl()" >
2019-10-15 23:42:47 -03:00
< div id = "everything" >
2019-12-15 21:11:35 -03:00
< div class = "popup" id = "leavePost" >
< div class = "brownbox bounce center supercenter" style = "height: 68%; width: 110vh" >
< p style = "position:absolute; right: 1vh; margin-top: 0; text-align: left" id = "charcount" > 180< / p >
< h1 class = "smaller center" style = "font-size: 5.5vh" > Post Update< / h1 >
< textarea placeholder = "Insert comment" id = "content" maxlength = "180" style = "margin: 2% 0%" > < / textarea > < br >
< form action = "nothing lol" >
< h3 class = "center" style = "margin-top: 2%" > GD Password< / h3 >
< input type = "password" id = "password" maxlength = "50" style = "height: 8vh; width: 90%; text-align: center; margin-top: 0.5%" >
< / form >
< div style = "min-height: 20%; max-height: 20%" >
< p id = "message" style = "padding: 0% 10%; margin-top: 2%" > < / p >
< / div >
< img src = "../assets/btn-cancel.png" height = 11%; class = "postButton gdButton center" style = "margin-right: 1%" onclick = "$('#leavePost').hide(); $('textarea').val('')" >
< img src = "../assets/btn-submit.png" type = "submit" height = 11%; class = "postButton gdButton center" style = "margin-left: 1%" id = "submitComment" >
< / div >
< / div >
< div class = "popup" id = "likeComment" >
< div class = "brownbox bounce center supercenter" style = "height: 75%; width: 100vh" >
< h1 class = "smaller center" style = "font-size: 5.5vh" > Vote< / h1 >
< img src = "../assets/smashLike.png" id = "likebtn" class = "inline gdButton likeButton" > <!--
-->< img src = "../assets/smashDislike.png" id = "dislikebtn" class = "inline gdButton likeButton youAreNotTheOne" >
< form action = "nothing lol" >
< h3 class = "center" > GD Username< / h3 >
< input type = "text" name = "gdbrowser" id = "like-username" maxlength = "50" style = "height: 8vh; width: 90%; text-align: center; margin-top: 0.5%" >
< h3 class = "center" style = "margin-top: 2%" > GD Password< / h3 >
< input type = "password" id = "like-password" maxlength = "50" style = "height: 8vh; width: 90%; text-align: center; margin-top: 0.5%" >
< / form >
< div style = "min-height: 18%; max-height: 18%" >
< p id = "likeMessage" style = "padding: 0% 10%; margin-top: 2.5%" > < / p >
< / div >
< img src = "../assets/btn-cancel.png" height = 10%; class = "postButton gdButton center" style = "margin-right: 1%" onclick = "$('#likeComment').hide(); $('#likebtn').trigger('click');" >
< img src = "../assets/btn-submit.png" type = "submit" height = 10%; class = "postButton gdButton center" style = "margin-left: 1%" id = "submitVote" >
< / div >
< / div >
2019-10-15 23:42:47 -03:00
< div class = "popup" id = "settingsDiv" >
2019-10-21 12:40:56 -03:00
< div class = "fancybox bounce center supercenter" >
2019-10-15 23:42:47 -03:00
< h2 class = "smaller center" style = "font-size: 5.5vh" > User Info< / h2 >
< p class = "bigger center" id = "userInfo" style = "line-height: 5vh; margin-top: 1.5vh;" >
Friend Requests: [[REQS]]< br >
Private Messages: [[DMS]]< br >
Comment History: [[COMMENTS]]< br >
< / p >
< img src = "../assets/ok.png" width = 20%; class = "gdButton center" onclick = "$('#settingsDiv').hide()" >
< / div >
< / div >
< div style = "position:absolute; bottom: 0%; left: 0%; width: 100%" >
2019-10-18 17:48:33 -03:00
< img class = "cornerPiece" src = "../assets/corner.png" width = 7%; >
2019-10-15 23:42:47 -03:00
< / div >
< div style = "position:absolute; bottom: 0%; right: 0%; width: 100%; text-align: right;" >
2019-10-18 17:48:33 -03:00
< img class = "cornerPiece" src = "../assets/corner.png" width = 7%; style = "transform: scaleX(-1)" >
2019-10-15 23:42:47 -03:00
< / div >
< div style = "position:absolute; top: 2%; left: 1.5%; width: 10%; height: 25%; pointer-events: none" >
< img class = "gdButton yesClick" id = "backButton" src = "../assets/back.png" height = "30%" onclick = "backButton()" >
< / div >
< div class = "brownBox center supercenter" style = "width: 135vh; height: 82%; margin-top: -0.7%" >
2021-01-21 22:28:04 -03:00
< div id = "globalrank0" style = "position: absolute; left: 0.3%; top: 1.5%; width: 18%; text-align: left" >
2021-01-25 02:01:38 -03:00
< p style = "margin: 0;" > < img src = "../assets/trophy.png" class = "inline valign help" width = "22%" title = "Global Rank" > [[RANK]]< / p >
2021-01-21 22:28:04 -03:00
< / div >
2021-01-25 02:01:38 -03:00
< h1 class = "veryBig inline" style = "width: inherit" >
2021-01-21 22:28:04 -03:00
< img class = "inline valign" id = "modBadge1" style = "display: none; height: 7%; cursor:help" src = "../assets/mod.png" title = "[[USERNAME]] is a moderator!" > <!--
-->< img class = "inline valign" id = "modBadge2" style = "display: none; height: 7%; cursor:help" src = "../assets/mod-elder.png" title = "[[USERNAME]] is an elder moderator!" > <!--
-->< img class = "inline valign" id = "modBadge3" style = "display: none; height: 7%; cursor:help" src = "../assets/mod-extra.png" title = "[[USERNAME]] is a custom moderator! (tier [[MODERATOR]])" > <!--
2021-01-25 02:01:38 -03:00
-->< span style = "margin-left: 1%" > [[USERNAME]]< / span >
2019-10-15 23:42:47 -03:00
< / h1 >
2021-10-07 11:19:43 -03:00
< hr style = "margin-bottom: 2%" class = "profilePostHide" >
< h3 id = "collectibles" class = "profilePostHide" >
2021-01-25 02:01:38 -03:00
< span id = "stars" > [[STARS]]< / span > < img class = "help valign" src = "../assets/star.png" title = "Stars" >
< span id = "diamonds" > [[DIAMONDS]]< / span > < img class = "help valign" src = "../assets/diamond.png" title = "Diamonds" >
< span id = "coins" > [[COINS]]< / span > < img class = "help valign" src = "../assets/coin.png" title = "Secret Coins" >
< span id = "usercoins" > [[USERCOINS]]< / span > < img class = "help valign" src = "../assets/silvercoin.png" title = "User Coins" >
< span id = "demons" > [[DEMONS]]< / span > < img class = "help valign" src = "../assets/demon.png" title = "Demons" >
< span id = "creatorpoints" style = "display: none" > < span id = "cp" > [[CP]]< / span > < img class = "help valign" src = "../assets/cp.png" title = "Creator Points" > < / span >
2019-10-15 23:42:47 -03:00
< / h3 >
2021-10-07 11:19:43 -03:00
< div class = "lightBox center profilePostHide" id = "iconsDiv" style = "margin: 2% auto; width: 105vh" >
2020-11-12 22:32:15 -03:00
< img src = "../icon/icon?form=cube&icon=[[ICON]]&col1=[[COL1]]&col2=[[COL2]]&glow=[[GLOW]]" title = "Cube [[ICON]]" >
< img src = "../icon/icon?form=ship&icon=[[SHIP]]&col1=[[COL1]]&col2=[[COL2]]&glow=[[GLOW]]" title = "Ship [[SHIP]]" style = "height: 8%" >
< img src = "../icon/icon?form=ball&icon=[[BALL]]&col1=[[COL1]]&col2=[[COL2]]&glow=[[GLOW]]" title = "Ball [[BALL]]" >
< img src = "../icon/icon?form=ufo&icon=[[UFO]]&col1=[[COL1]]&col2=[[COL2]]&glow=[[GLOW]]" title = "UFO [[UFO]]" >
< img src = "../icon/icon?form=wave&icon=[[WAVE]]&col1=[[COL1]]&col2=[[COL2]]&glow=[[GLOW]]" title = "Wave [[WAVE]]" style = "height: 7%" >
< img src = "../icon/icon?form=robot&icon=[[ROBOT]]&col1=[[COL1]]&col2=[[COL2]]&glow=[[GLOW]]" title = "Robot [[ROBOT]]" >
< img src = "../icon/icon?form=spider&icon=[[SPIDER]]&col1=[[COL1]]&col2=[[COL2]]&glow=[[GLOW]]" title = "Spider [[SPIDER]]" >
2021-01-04 12:21:58 -03:00
< img src = "../assets/deatheffects/[[DEATHEFFECT]].png" title = "Death Effect [[DEATHEFFECT]]" id = "deatheffect" >
2019-10-15 23:42:47 -03:00
< / div >
2021-10-07 11:19:43 -03:00
< div class = "lightBox center dragscroll" id = "statusDiv" normalHeight = "36vh" compactHeight = "69vh" style = "margin: 2% auto; width: 105vh; height: 36vh; background-color: #BE6F3F" >
2019-10-15 23:42:47 -03:00
< / div >
2021-10-07 11:19:43 -03:00
< div class = "center profilePostHide" style = "margin: 1.5% auto 2.5% auto;" >
2019-12-29 20:59:29 -03:00
< a id = "msgA" target = "_blank" > < img src = "../assets/messages.png" height = "10%" id = "msgButton" class = "sideSpace gdButton" onclick = "$('#settingsDiv').show()" > < / a >
2019-10-15 23:42:47 -03:00
< img src = "../assets/friends.png" height = "10%" id = "friendButton" class = "sideSpace gdButton" onclick = "$('#settingsDiv').show()" >
2020-02-20 22:09:40 -03:00
< / div >
2021-10-07 11:19:43 -03:00
< div style = "position: absolute; bottom: 0%; left: 12%;" class = "profilePostHide" >
2020-02-20 22:09:40 -03:00
< p style = "text-align: left; font-size: 2.2vh; color: rgba(0, 0, 0, 0.5)" > Account ID: [[ACCOUNTID]]< br > Player ID: [[PLAYERID]]< / p >
2019-10-15 23:42:47 -03:00
< / div >
2021-10-07 11:19:43 -03:00
< img src = "../assets/follow-off.png" id = "followOff" class = "gdButton profilePostHide" style = "position: absolute; left: 4.5%; bottom: 1%; width: 6%" >
< img src = "../assets/follow-on.png" id = "followOn" class = "gdButton profilePostHide" style = "position: absolute; left: 4.5%; bottom: 1%; width: 6%; display: none" >
2019-12-15 21:11:35 -03:00
2019-10-15 23:42:47 -03:00
< a id = "commentA" > < img src = "../assets/comments.png" class = "gdButton" id = "commentButton" style = "position: absolute; right: 0.5%; bottom: 50%; width: 6%" onclick = "$('#settingsDiv').show()" > < / a >
2021-10-07 11:19:43 -03:00
< img src = "../assets/expanded-off.png" class = "gdButton" id = "compactMode" style = "position: absolute; left: 2%; bottom: 45%; width: 6%" >
2020-02-20 22:09:40 -03:00
< a href = "../search/[[USERNAME]]?user" > < img src = "../assets/levels.png" class = "gdButton" style = "position: absolute; right: 0.5%; bottom: 1%; width: 6%" > < / a >
2019-10-15 23:42:47 -03:00
< div style = "position: absolute; right: 0.5%; top: 0%; width: 6%" >
< a id = "youtube" style = "display: none" target = "_blank" href = "https://youtube.com/channel/[[YOUTUBE]]" > < img src = "../assets/youtube.png" class = "gdButton socialButton" > < / a >
< a id = "twitter" style = "display: none" target = "_blank" href = "https://twitter.com/[[TWITTER]]" > < img src = "../assets/twitter.png" class = "gdButton socialButton" > < / a >
< a id = "twitch" style = "display: none" target = "_blank" href = "https://twitch.tv/[[TWITCH]]" > < img src = "../assets/twitch.png" class = "gdButton socialButton" > < / a >
< / div >
2021-10-07 11:19:43 -03:00
< div class = "supercenter" style = "left: 5%; top: 65%; height: 10%" >
< img class = "gdButton" id = "pageDown" style = "display: none" src = "../assets/arrow-left.png" height = "95%" onclick = "page -= 1; appendComments()" >
2019-10-15 23:42:47 -03:00
< / div >
2021-10-07 11:19:43 -03:00
< div class = "supercenter" style = "left: 95%; top: 65%; height: 10%;" >
< img class = "gdButton" id = "pageUp" src = "../assets/arrow-right.png" height = "95%" onclick = "page += 1; appendComments()" >
2019-10-15 23:42:47 -03:00
< / div >
2020-02-20 22:09:40 -03:00
< div id = "postButton" style = "position:absolute; bottom: 0%; left: 0%; width: 14%; text-align: left; transform: translate(-35%, 40%);" >
2019-12-15 21:11:35 -03:00
< img class = "gdButton" src = "../assets/comment.png" width = "60%" onclick = "$('#content').trigger('input'); $('#leavePost').show();" >
< / div >
2019-10-15 23:42:47 -03:00
< / div >
< / div >
< / body >
2019-10-21 12:20:25 -03:00
< script type = "text/javascript" src = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" > < / script >
2021-01-18 23:54:18 -03:00
< script type = "text/javascript" src = "../sizecheck.js?" > < / script >
2021-01-04 12:21:58 -03:00
< script type = "text/javascript" src = "../dragscroll.js" > < / script >
2019-10-15 23:42:47 -03:00
< script >
2020-05-13 09:55:57 -04:00
function clean(text) {return text.replace(/& /g, "& ").replace(/< /g, "< ").replace(/>/g, "> ").replace(/=/g, "= ").replace(/"/g, "" ").replace(/'/g, "' ")}
2021-04-02 21:50:22 -03:00
// remove ID from URL
if (window.location.pathname.endsWith(".")) window.history.pushState({}, null, window.location.origin + `/u/[[USERNAME]]`);
2021-02-03 15:50:19 -03:00
let messageText = 'Your < cy > Geometry Dash password< / cy > will < cg > not be stored< / cg > anywhere on the site, both < ca > locally and server-side.< / ca > You can view the code used for profile posts < a class = "menuLink" target = "_blank" href = "https://github.com/GDColon/GDBrowser/blob/master/api/post/postProfileComment.js" > here< / a > .'
2019-12-15 21:11:35 -03:00
$('#message').html(messageText)
$('#likeMessage').html(messageText.replace("profile posts", "liking posts").replace("postProfileComment", "like"))
2019-10-15 23:42:47 -03:00
$('#modBadge[[MODERATOR]]').show()
2021-01-21 22:28:04 -03:00
if ("[[MODERATOR]]" > 3) $('#modBadge3').show()
2019-10-15 23:42:47 -03:00
$('#globalrank[[RANK]]').hide()
2020-03-13 22:07:54 -03:00
let followed = localStorage.followed ? JSON.parse(localStorage.followed) : []
if (followed.includes([[ACCOUNTID]])) {$('#followOff').hide(); $('#followOn').show()}
$('#followOff').click(function() {
2020-03-14 12:12:31 -03:00
followed = localStorage.followed ? JSON.parse(localStorage.followed) : []
2020-03-13 22:07:54 -03:00
followed.push([[ACCOUNTID]])
localStorage.followed = JSON.stringify(followed)
$('#followOff').hide()
$('#followOn').show()
})
$('#followOn').click(function() {
2020-03-14 12:12:31 -03:00
followed = localStorage.followed ? JSON.parse(localStorage.followed) : []
2021-01-15 12:29:46 -03:00
localStorage.followed = JSON.stringify(followed.filter(x => x != '[[ACCOUNTID]]'))
2020-03-13 22:07:54 -03:00
$('#followOff').show()
$('#followOn').hide()
})
2020-11-14 00:32:46 -03:00
if ([[DIAMONDS]] >= 65535) $('#diamonds').addClass('blue')
if ([[COINS]] >= 149) $('#coins').addClass('yellow')
if ([[STARS]] >= 100000) $('#stars').addClass('yellow')
if ([[DEMONS]] >= 1000) $('#demons').addClass('brightred')
if ([[USERCOINS]] >= 10000) $('#usercoins').addClass('brightblue')
if ([[CP]] >= 100) $('#cp').addClass('yellow')
if ([[CP]] > 0) $('#creatorpoints').show()
2019-10-15 23:42:47 -03:00
if (`[[YOUTUBE]]` != "null") $('#youtube').show()
if (`[[TWITTER]]` != "null") $('#twitter').show()
if (`[[TWITCH]]` != "null") $('#twitch').show()
let messages = "[[MESSAGES]]"
let commenthistory = "[[COMMENTHISTORY]]"
2021-02-03 15:50:19 -03:00
let reqMode = [[FRIENDREQUESTS]] ? "< cg > Enabled< / cg > " : "< cr > Disabled< / cr > "
let dmMode = messages == "all" ? "< cg > Public< / cg > " : messages == "friends" ? "< cy > Friends Only< / cy > " : "< cr > Disabled< / cr > "
let commentMode = commenthistory == "all" ? "< cg > Public< / cg > " : commenthistory == "friends" ? "< cy > Friends Only< / cy > " : "< cr > Disabled< / cr > "
2019-10-15 23:42:47 -03:00
if (commenthistory == "friends") $('#commentButton').attr('src', '../assets/comments-yellow.png')
else if (commenthistory == "off") $('#commentButton').attr('src', '../assets/comments-grey.png')
else {
$('#commentButton').attr('src', '../assets/comments.png').attr('onclick', '')
$('#commentA').attr('href', '../comments/[[USERNAME]]')
}
2019-12-29 20:59:29 -03:00
if (messages == "all") {
$('#msgButton').attr('onclick', '')
$('#msgA').attr('href', '../messages?sendTo=[[USERNAME]]')
}
2019-10-15 23:42:47 -03:00
if (messages == "friends") $('#msgButton').attr('src', '../assets/messages-yellow.png')
else if (messages == "off") $('#msgButton').attr('src', '../assets/messages-grey.png')
if (![[FRIENDREQUESTS]]) $('#friendButton').attr('src', '../assets/friends-grey.png')
$('#userInfo').html($('#userInfo').html()
.replace("[[REQS]]", reqMode)
.replace("[[DMS]]", dmMode)
2021-02-03 15:50:19 -03:00
.replace("[[COMMENTS]]", commentMode) + (messages == "friends" ? "< br style = 'line-height: 69%' > < a target = '_blank' style = 'color: lime' class = 'youCanClickThis2' href = '../messages?sendTo=[[USERNAME]]' > Send message< / a > < br > (if friended)" : ""))
2019-10-15 23:42:47 -03:00
function appendComments() {
if (loadingComments) return;
else loadingComments = true;
$('#statusDiv').html(`< div class = "supercenter" id = "loading" style = "height: 12%; top: 62%;" > < img class = "spin noSelect" src = "../assets/loading.png" height = "105%" > < / div > `)
if (page == 0) $('#pageDown').hide()
else $('#pageDown').show()
fetch(`../api/comments/[[ACCOUNTID]]?type=profile& page=${page}`).then(res => res.json()).then(res => {
if (res.length != 10) $('#pageUp').hide()
else $('#pageUp').show()
if (res == "-1") return $('#loading').hide()
res.forEach(x => {
$('#statusDiv').append(`
< div class = "commentBG" >
< div class = "comment" >
2021-10-07 11:19:43 -03:00
< img class = "inline statusIcon" src = "../icon/icon?form=cube&icon=[[ICON]]&col1=[[COL1]]&col2=[[COL2]]&glow=[[GLOW]]&size=auto" height = 21% style = "display: ${compactMode ? " inline-block " : " none " } ; margin-right: 0 . 8 % " >
< h2 class = "inline" > [[USERNAME]]< / h2 >
2019-10-15 23:42:47 -03:00
< div class = "commentAlign" >
2020-11-02 01:11:37 -03:00
< p class = "pre commentText" style = "color: rgb(${" [ [ USERNAME ] ] " = = " RobTop " ? " 50 , 255 , 255 " : " [ [ MODERATOR ] ] " = = " 2 " ? " 75 , 255 , 75 " : x . browserColor ? " 255 , 180 , 255 " : " 255 , 255 , 255 " } ) " > ${clean(x.content)}< / p >
2019-10-15 23:42:47 -03:00
< / div >
< / div >
< p class = "commentDate" > ${x.date}< / p >
< div class = "commentLikes" >
2019-12-15 21:11:35 -03:00
< img id = "likeImg" class = "likeComment gdButton inline" commentID = "${x.ID}" $ { x . likes < 0 ? " style = 'transform: translateY(25%)' " : " " } src = "../assets/${x.likes < 0 ? " dis " : " " } like . png " height = 20% style = "margin-right: 0.4%" >
2019-10-15 23:42:47 -03:00
< h3 class = "inline" > ${x.likes}< / h3 > < br >
< / div >
< / div > `)
})
$('.commentText').each(function() {
if ($(this).text().length > 100) {
let overflow = ($(this).text().length - 100) * 0.01
$(this).css('font-size', (3.5 - (overflow)) + 'vh')
}
});
$('#loading').hide()
})
loadingComments = false;
}
let page = 0
let loadingComments = false
appendComments()
2019-12-15 21:11:35 -03:00
$('#content').on('input', function() {
let remaining = 180-$('#content').val().length
$('#charcount').text(remaining)
})
$('#submitComment').click(function () {
let comment = $('#content').val()
let username = '[[USERNAME]]'
let password = $('#password').val()
let accountID = '[[ACCOUNTID]]'
if (!comment || !password || loadingComments) return $('#leavePost').hide()
$('#message').text("Posting...")
$('.postbutton').hide()
allowEsc = false
$.post("../postProfileComment", { comment, username, password, accountID, color: true })
.done(x => {
$('#content').val("")
$('#leavePost').hide()
$('.postbutton').show()
$('#message').html(messageText)
allowEsc = true
page = 0
appendComments()
})
.fail(e => { allowEsc = true; $('.postbutton').show(); $('#message').text(e.responseText.includes("DOCTYPE") ? "Something went wrong..." : e.responseText) })
})
let commentID = 0;
let likeCount, likeImg;
let likedComments;
let like = true;
$('#likebtn').click(function() {
$('#likebtn').removeClass('youAreNotTheOne')
$('#dislikebtn').addClass('youAreNotTheOne')
like = true
})
$('#dislikebtn').click(function() {
$('#likebtn').addClass('youAreNotTheOne')
$('#dislikebtn').removeClass('youAreNotTheOne')
like = false
})
$(document).on('click', '.likeComment', function(cmnt) {
commentID = $(this).attr('commentID')
likedComments = localStorage.likedComments ? JSON.parse(localStorage.likedComments) : []
if (likedComments.includes(commentID)) return;
lvID = $(this).attr('levelID') || 0
likeImg = $(this).find('img')
likeCount = $(this).parent().find('h3:not(.gold)')
$('#likeComment').show()
})
$('#submitVote').click(function() {
if (likedComments.includes(commentID)) return $('#likeMessage').text("You've already liked/disliked this comment!");
let ID = commentID
let username = $('#like-username').val()
let password = $('#like-password').val()
let extraID = lvID || window.location.pathname.split('/')[2]
let accountID = 0
let likeType = like ? "1" : "0"
if (!ID || !username || !password || loadingComments) return $('#postComment').hide()
$('#likeMessage').text(like ? "Liking..." : "Disliking... :(")
$('.postbutton').hide()
allowEsc = false
fetch(`../api/profile/${username}`).then(res => res.json()).then(res => {
if (!res || res == "-1") {allowEsc = true; $('.postbutton').show(); return $('#likeMessage').text("The username you provided doesn't exist!")}
else accountID = res.accountID
$.post("../like", { ID, accountID, password, like: likeType, type: 3, extraID: "[[ACCOUNTID]]" })
.done(x => {
let newCount = parseInt(likeCount.text()) + (like ? 1 : -1)
likeCount.text(newCount)
if (newCount < 0 ) likeImg . attr ( ' src ' , ' . . / assets / dislike . png ' ) . css ( ' transform ' , compact ? ' translateY ( 15 % ) ' : ' translateY ( 25 % ) ' )
else likeImg.attr('src', '../assets/like.png').removeAttr('style')
$('#likeComment').hide()
$('#likebtn').trigger('click')
$('.postbutton').show()
$('#likeMessage').html(messageText.replace("profile posts", "liking posts").replace("postProfileComment", "like"))
allowEsc = true
likedComments.push(commentID)
localStorage.setItem('likedComments', JSON.stringify(likedComments))
})
.fail(e => {allowEsc = true; $('.postbutton').show();$('#likeMessage').text(e.responseText.includes("DOCTYPE") ? "Something went wrong..." : e.responseText)})
})
})
2021-10-07 11:19:43 -03:00
let compactMode = false
$('#compactMode').click(function() {
compactMode = !compactMode
if (compactMode) {
$('.profilePostHide').hide()
$('.statusIcon').show()
$('#statusDiv').css('height', $('#statusDiv').attr('compactHeight'))
$(this).attr('src', "../assets/expanded-on.png")
}
else {
$('.profilePostHide').show()
$('.statusIcon').hide()
$('#statusDiv').css('height', $('#statusDiv').attr('normalHeight'))
$(this).attr('src', "../assets/expanded-off.png")
}
})
2019-12-29 20:59:29 -03:00
$('#leavePost').on("change keyup keydown paste click", "textarea", function () {
$('#content').val($('#content').val().replace(/[^\S ]+/g, ""))
})
$(document).keydown(function(k) {
2021-10-07 11:19:43 -03:00
if ($('#content').is(':visible')) {
if (k.which == 13) k.preventDefault() //enter
}
if (loadingComments || $('.popup').is(":visible")) return;
if (k.which == 37 & & $('#pageDown').is(":visible")) { //left
$('#pageDown').trigger('click')
}
if (k.which == 39 & & $('#pageUp').is(":visible")) { //right
$('#pageUp').trigger('click')
}
2019-12-29 20:59:29 -03:00
2019-12-21 16:33:32 -03:00
})
2019-10-22 20:54:19 -03:00
2019-11-10 18:18:52 -03:00
< / script >