2017-05-26 18:49:27 -04:00
|
|
|
<div id="threadContainer">
|
2017-05-27 00:22:50 -04:00
|
|
|
<div id="textNav"><a class="themeBlue" href="home">Home</a> » </div>
|
|
|
|
<hr />
|
|
|
|
<div class="threadStart table" style="width: 100%;">
|
|
|
|
<div class="userInfo tableCell">
|
|
|
|
<div class="userAvatar">
|
|
|
|
<i class="fa fa-user-secret" aria-hidden="true" style="font-size: 8em;"></i>
|
|
|
|
</div>
|
|
|
|
<a class="userProfileLink" href=""><span class="userTitle">_</span></a><br />
|
|
|
|
<span style="font-size: 9pt;" class="timePosted">_</span>
|
|
|
|
</div>
|
|
|
|
<div class="threadInfo tableCell">
|
|
|
|
<div class="threadTitle" style="float: left;">_</div>
|
|
|
|
<div style="float: right;" id="replyThreadCaption">
|
|
|
|
<i class="fa fa-reply" aria-hidden="true"></i>
|
|
|
|
Reply
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style="clear: both;"></div>
|
|
|
|
<div style="float: right; display: none;" id="editThreadCaption">
|
|
|
|
<i class="fa fa-pencil-square-o" aria-hidden="true"></i>
|
|
|
|
Edit
|
|
|
|
</div>
|
|
|
|
<div class="threadContent">_</div>
|
|
|
|
</div>
|
2017-05-26 18:49:27 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="postReplyContainer" style="display: none;">
|
2017-05-27 00:22:50 -04:00
|
|
|
<hr />
|
|
|
|
<div id="postReplyClose">
|
|
|
|
<i class="fa fa-times" aria-hidden="true"></i>
|
|
|
|
</div>
|
|
|
|
<div id="replyContentContainer">
|
|
|
|
<div class="alertBox">
|
|
|
|
</div>
|
|
|
|
<textarea placeholder="Reply content..." id="replyContentBox"></textarea>
|
|
|
|
<div id="submitReplyButton">
|
|
|
|
<i class="fa fa-reply" aria-hidden="true"></i>
|
|
|
|
</div>
|
2017-05-26 18:49:27 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
|
|
|
|
$( document ).on("actionEventLoad", function() {
|
|
|
|
|
|
|
|
$.getJSON("_thread?id=" + parseGet('id'), function(Response) {
|
|
|
|
|
|
|
|
if (Response.errorCode != null)
|
|
|
|
{
|
|
|
|
alert('error!');
|
|
|
|
}
|
|
|
|
$('#textNav').append('<a class="themeBlue" href="category?id=' + Response.Thread.threadCategory.id + '">' + Response.Thread.threadCategory.title + '</a> » ' + decodeURIComponent(Response.Thread.title));
|
|
|
|
$('.threadStart .userTitle').html(Response.Thread.author.username);
|
|
|
|
$('.threadStart .timePosted').html(getDate(Response.Thread.creationDate));
|
2017-10-11 17:49:02 -04:00
|
|
|
$('.threadStart .threadTitle').html(Response.Thread.title);
|
2017-05-26 18:49:27 -04:00
|
|
|
$('.threadStart a.userProfileLink').attr("href", "user?id=" + Response.Thread.author.id);
|
2017-10-11 17:49:02 -04:00
|
|
|
$('.threadStart .threadContent').html(Response.Thread.formattedContent);
|
2017-05-26 18:49:27 -04:00
|
|
|
if (Response.Thread.author.avatarURL != "")
|
|
|
|
$('.threadStart .userAvatar').html("").attr("style", "background-image:url('" + Response.Thread.author.avatarURL + "');'");
|
|
|
|
$('#replyThreadButton').attr("href", "postthread?threadid=" + Response.Thread.id);
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
if (user.user.id == Response.Thread.author.id)
|
|
|
|
$('#editThreadCaption').css("display", "block");
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
$.each(Response.Replies, function(i, eachReply) {
|
|
|
|
|
|
|
|
var cat = "<div class='threadStart table' style='width: 100%;'> \
|
|
|
|
<div class='userInfo tableCell'>";
|
|
|
|
|
|
|
|
|
|
|
|
if (eachReply.author.avatarURL == "")
|
|
|
|
cat += "<div class='userAvatar'><i class='fa fa-user-secret' aria-hidden='true' style='font-size: 8em;'></i>";
|
|
|
|
else
|
|
|
|
cat += "<div class='userAvatar' style=\"background-image:url('" + eachReply.author.avatarURL + "');\">";
|
|
|
|
cat +=
|
|
|
|
"</div> \
|
|
|
|
<a class='userProfileLink' href='user?id="+ eachReply.author.id +"'><span class='userTitle'>" + getColorForLevel(eachReply.author.ranking.name, eachReply.author.username) + "</span></a><br/> \
|
|
|
|
<span style='font-size: 9pt;' class='timePosted'>" + checkJustNow(eachReply.lastModificationString) + "</span> \
|
|
|
|
</div> \
|
|
|
|
<div class='threadInfo tableCell'> \
|
|
|
|
<i style=\"" + shouldHideAction(eachReply.author) + "\" replyid='" + eachReply.id + "' class=\"fa fa-times actionHover actionDelete\" aria-hidden=\"true\"></i> \
|
2017-05-27 00:22:50 -04:00
|
|
|
<i style=\"" + shouldHideAction(eachReply.author) + "\" replyid='" + eachReply.id + "' class=\"fa fa-pencil-square-o actionHover actionEdit\" aria-hidden=\"true\"></i> \
|
|
|
|
<div class='threadContent'>" + decodeURIComponent(eachReply.formattedContent) + "</div> \
|
2017-05-26 18:49:27 -04:00
|
|
|
</div> \
|
|
|
|
</div>";
|
|
|
|
|
|
|
|
$("#threadContainer").append(cat);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$('#replyThreadCaption').click(function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
$('#postReplyContainer').slideDown('fast');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#postReplyClose').click(function(e) {
|
|
|
|
$(this).parent().slideUp('fast');
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#submitReplyButton").click(function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
if ($('#postReplyContainer').attr("editthread") == "true") {
|
|
|
|
$.getJSON("_editthread",
|
|
|
|
{
|
|
|
|
content : $('#replyContentBox').val(),
|
|
|
|
title : $('#postReplyContainer').attr("threadtitle"),
|
|
|
|
id : parseGet("id"),
|
|
|
|
update: true
|
|
|
|
},
|
|
|
|
|
|
|
|
function(result) {
|
|
|
|
if (result["errorCode"] == 0)
|
|
|
|
window.location.replace(result["destination"]);
|
|
|
|
else {
|
|
|
|
showErrorMessage(result["errorCode"]);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else if ($('#postReplyContainer').attr("editreply") != "true") {
|
2017-05-26 18:49:27 -04:00
|
|
|
$.getJSON("_postthread",
|
|
|
|
{
|
|
|
|
content : $('#replyContentBox').val(),
|
|
|
|
title : "Reply",
|
|
|
|
threadid : parseGet("id")
|
|
|
|
},
|
|
|
|
|
|
|
|
function(result) {
|
|
|
|
if (result["errorCode"] == 0)
|
|
|
|
window.location.replace(result["destination"]);
|
|
|
|
else {
|
|
|
|
showErrorMessage(result["errorCode"]);
|
|
|
|
}
|
|
|
|
});
|
2017-05-27 00:22:50 -04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
|
|
|
$.getJSON("_editthread",
|
|
|
|
{
|
|
|
|
content : $('#replyContentBox').val(),
|
|
|
|
title : "Reply",
|
|
|
|
replyid : $('#postReplyContainer').attr("replyid"),
|
|
|
|
threadid : parseGet("id")
|
|
|
|
},
|
|
|
|
|
|
|
|
function(result) {
|
|
|
|
if (result["errorCode"] == 0)
|
|
|
|
window.location.replace(result["destination"]);
|
|
|
|
else {
|
|
|
|
showErrorMessage(result["errorCode"]);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$('#content').on('click', '.actionDelete', function(e) {
|
|
|
|
$.getJSON("_editthread",
|
|
|
|
{
|
|
|
|
replyid : $(this).attr("replyid"),
|
|
|
|
delete : true
|
|
|
|
},
|
|
|
|
function(response) {
|
|
|
|
if (response.success)
|
|
|
|
window.location.replace(response.destination);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-05-27 00:22:50 -04:00
|
|
|
|
|
|
|
$('#content').on('click', '.actionEdit', function (e) {
|
|
|
|
$('#postReplyContainer').slideDown('fast');
|
|
|
|
var id = $(this).attr("replyID")
|
|
|
|
$.getJSON("_thread?replyid=" + id, function(Response) {
|
|
|
|
|
|
|
|
$('#postReplyContainer').find("textarea").html(Response.content);
|
|
|
|
$('#postReplyContainer').attr("editReply", true);
|
|
|
|
$('#postReplyContainer').attr("replyid", id);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
/*$.getJSON("_editthread",
|
|
|
|
{
|
|
|
|
replyid: $(this).attr("replyid"),
|
|
|
|
delete: false
|
|
|
|
},
|
|
|
|
function (response) {
|
|
|
|
if (response.success)
|
|
|
|
window.location.replace(response.destination);
|
|
|
|
});*/
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$("#editThreadCaption").click(function(e) {
|
|
|
|
$('#postReplyContainer').slideDown('fast');
|
|
|
|
$.getJSON("_thread?id=" + parseGet("id"), function(Response) {
|
|
|
|
|
|
|
|
$('#postReplyContainer').find("textarea").html(Response.Thread.content);
|
|
|
|
$('#postReplyContainer').attr("editthread", true);
|
|
|
|
$('#postReplyContainer').attr("threadid", parseGet("id"));
|
|
|
|
$('#postReplyContainer').attr("threadtitle", Response.Thread.title);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-05-26 18:49:27 -04:00
|
|
|
</script>
|