got rid of a lot of junk markup and unused css classes; standardized the pulling of pid/uid across post.js code

v1.18.x
psychobunny 12 years ago
parent 6e164e61aa
commit 06809ab5fc

@ -230,24 +230,6 @@
border-radius: 0; border-radius: 0;
} }
.main-avatar:hover .hover-overlay {
opacity: 0.75;
}
.hover-overlay {
margin: 5px;
position: absolute;
bottom: 0px;
height: 35px;
padding-top: 2px;
width: 80px;
font-size: 13px;
line-height: 16px;
background: #000;
opacity: 0;
transition: opacity 0.3s;
}
.post-content { .post-content {
min-height: 80px; min-height: 80px;
} }

@ -246,9 +246,8 @@
}); });
$('.post-container').on('click', '.favourite', function() { $('.post-container').on('click', '.favourite', function() {
var ids = this.id.replace('favs_', '').split('_'), var pid = $(this).parents('li').attr('data-pid');
pid = ids[0], var uid = $(this).parents('li').attr('data-uid');
uid = ids[1];
var element = $(this).find('i'); var element = $(this).find('i');
if(element.attr('class') == 'icon-star-empty') { if(element.attr('class') == 'icon-star-empty') {
@ -260,9 +259,8 @@
}); });
$('.post-container').delegate('.edit', 'click', function(e) { $('.post-container').delegate('.edit', 'click', function(e) {
var pid = ($(this).attr('id') || $(this.parentNode).attr('id')).split('_')[1]; var pid = $(this).parents('li').attr('data-pid'),
main = $(this).parents('.main-post');
var main = $(this).parents('.main-post');
require(['composer'], function(cmp) { require(['composer'], function(cmp) {
cmp.push(null, null, pid); cmp.push(null, null, pid);
@ -270,10 +268,10 @@
}); });
$('.post-container').delegate('.delete', 'click', function(e) { $('.post-container').delegate('.delete', 'click', function(e) {
var pid = ($(this).attr('id') || $(this.parentNode).attr('id')).split('_')[1], var pid = $(this).parents('li').attr('data-pid'),
postEl = $(document.querySelector('#post-container li[data-pid="' + pid + '"]')), postEl = $(document.querySelector('#post-container li[data-pid="' + pid + '"]')),
deleteAction = !postEl.hasClass('deleted') ? true : false, deleteAction = !postEl.hasClass('deleted') ? true : false,
confirmDel = confirm((deleteAction ? 'Delete' : 'Restore') + ' this post?'); confirmDel = confirm((deleteAction ? 'Delete' : 'Restore') + ' this post?');
if (confirmDel) { if (confirmDel) {
deleteAction ? deleteAction ?

@ -12,9 +12,6 @@
</ol> </ol>
<ul id="post-container" class="post-container container" data-tid="{topic_id}"> <ul id="post-container" class="post-container container" data-tid="{topic_id}">
<!-- BEGIN main_posts --> <!-- BEGIN main_posts -->
<a id="post_anchor_{main_posts.pid}" name="{main_posts.pid}"></a> <a id="post_anchor_{main_posts.pid}" name="{main_posts.pid}"></a>
<li class="row post-row main-post" data-pid="{main_posts.pid}" data-uid="{main_posts.uid}" data-username="{main_posts.username}" data-deleted="{main_posts.deleted}"> <li class="row post-row main-post" data-pid="{main_posts.pid}" data-uid="{main_posts.uid}" data-username="{main_posts.username}" data-deleted="{main_posts.deleted}">
@ -23,11 +20,6 @@
<div class="main-post-buttons"> <div class="main-post-buttons">
<a class="main-avatar" href="/users/{main_posts.userslug}"> <a class="main-avatar" href="/users/{main_posts.userslug}">
<img src="{main_posts.picture}" align="left" class="img-thumbnail" width=150 height=150 /><br /> <img src="{main_posts.picture}" align="left" class="img-thumbnail" width=150 height=150 /><br />
<!--<div class="hover-overlay">
{main_posts.username}<br />
<i class="icon-star"></i><span class="user_rep_{main_posts.uid}">{main_posts.user_rep}</span>
<i class="icon-pencil"></i><span class="user_posts_{main_posts.uid}">{main_posts.user_postcount}</span>
</div>-->
</a> </a>
<h3><p id="topic_title_{main_posts.pid}" class="topic-title">{topic_name}</p></h3> <h3><p id="topic_title_{main_posts.pid}" class="topic-title">{topic_name}</p></h3>
@ -37,30 +29,27 @@
<span class="username-field" href="/users/{main_posts.userslug}">{main_posts.username}&nbsp;</span> <span class="username-field" href="/users/{main_posts.userslug}">{main_posts.username}&nbsp;</span>
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="#">Profile</a></li> <li><a href="#">Profile</a></li>
<li><a href="#">Chat</a></li> <li><a href="#">Chat</a></li>
</ul> </ul>
</div> </div>
<div class="btn-group"> <div class="btn-group">
<button class="btn btn-sm btn-default follow" type="button" title="Be notified of new replies in this topic"><i class="icon-eye-open"></i></button> <button class="btn btn-sm btn-default follow" type="button" title="Be notified of new replies in this topic"><i class="icon-eye-open"></i></button>
<button id="favs_{main_posts.pid}_{main_posts.uid}" class="favourite btn btn-sm btn-default {main_posts.fav_button_class}" type="button"> <button class="favourite btn btn-sm btn-default {main_posts.fav_button_class}" type="button">
<span class="favourite-text">Favourite</span> <span class="favourite-text">Favourite</span>
<span class="post_rep_{main_posts.pid}">{main_posts.post_rep} </span><i class="{main_posts.fav_star_class}"></i> <span class="post_rep_{main_posts.pid}">{main_posts.post_rep} </span><i class="{main_posts.fav_star_class}"></i>
</button> </button>
</div> </div>
<div class="btn-group"> <div class="btn-group">
<button id="quote_{main_posts.pid}_{main_posts.uid}" class="btn btn-sm btn-default quote" type="button" title="Quote"><i class="icon-quote-left"></i></button> <button class="btn btn-sm btn-default quote" type="button" title="Quote"><i class="icon-quote-left"></i></button>
<button class="btn btn-sm btn-primary btn post_reply" type="button">Reply <i class="icon-reply"></i></button> <button class="btn btn-sm btn-primary btn post_reply" type="button">Reply <i class="icon-reply"></i></button>
</div> </div>
<div class="btn-group pull-right post-tools"> <div class="btn-group pull-right post-tools">
<button id="ids_{main_posts.pid}_{main_posts.uid}" class="btn btn-sm btn-default edit {main_posts.display_moderator_tools}" type="button" title="Edit"><i class="icon-pencil"></i></button> <button class="btn btn-sm btn-default edit {main_posts.display_moderator_tools}" type="button" title="Edit"><i class="icon-pencil"></i></button>
<button id="ids_{main_posts.pid}_{main_posts.uid}" class="btn btn-sm btn-default delete {main_posts.display_moderator_tools}" type="button" title="Delete"><i class="icon-trash"></i></button> <button class="btn btn-sm btn-default delete {main_posts.display_moderator_tools}" type="button" title="Delete"><i class="icon-trash"></i></button>
</div> </div>
</div> </div>
<div style="clear:both; margin-bottom: 10px;"></div> <div style="clear:both; margin-bottom: 10px;"></div>
@ -79,19 +68,7 @@
<span class="{main_posts.edited-class}">| last edited by <strong><a href="/users/{main_posts.editorslug}">{main_posts.editorname}</a></strong> {main_posts.relativeEditTime} ago</span> <span class="{main_posts.edited-class}">| last edited by <strong><a href="/users/{main_posts.editorslug}">{main_posts.editorname}</a></strong> {main_posts.relativeEditTime} ago</span>
</span> </span>
<div style="clear:both;"></div> <div style="clear:both;"></div>
</div> </div>
<!--<div class="profile-block">-->
<!--Posted {main_posts.relativeTime} ago
<span class="{main_posts.edited-class} hidden-xs">| last edited by <strong><a href="/users/{main_posts.editorslug}">{main_posts.editorname}</a></strong> {main_posts.relativeEditTime} ago</span>
<span class="{main_posts.edited-class}"><i class="icon-edit visible-xs" title="edited by {main_posts.editorname} {main_posts.relativeEditTime} ago"></i></span>
<div class="post-buttons visible-xs">
<button class="post_reply btn-link"><i class="icon-reply"></i></button>
</div>-->
<!--<div class="post-buttons">
<a href="../{topic_id}.rss" target="_blank"><i class="icon-rss"></i></a>
</div>-->
<!--</div>-->
</div> </div>
</div> </div>
</li> </li>
@ -101,28 +78,25 @@
<a id="post_anchor_{posts.pid}" name="{posts.pid}"></a> <a id="post_anchor_{posts.pid}" name="{posts.pid}"></a>
<li class="row post-row sub-posts" data-pid="{posts.pid}" data-uid="{posts.uid}" data-username="{posts.username}" data-deleted="{posts.deleted}"> <li class="row post-row sub-posts" data-pid="{posts.pid}" data-uid="{posts.uid}" data-username="{posts.username}" data-deleted="{posts.deleted}">
<div class="col-md-1 profile-image-block hidden-xs hidden-sm"> <div class="col-md-1 profile-image-block hidden-xs hidden-sm">
<!--<i class="icon-spinner icon-spin icon-2x pull-left"></i>-->
<a href="/users/{posts.userslug}"> <a href="/users/{posts.userslug}">
<img src="{posts.picture}" align="left" class="img-thumbnail" /> <img src="{posts.picture}" align="left" class="img-thumbnail" />
</a> </a>
<!--<div class="stats"> <!--<div class="stats">
<i class="icon-star"></i><span class="user_rep_{posts.uid} formatted-number">{posts.user_rep}</span> <i class="icon-star"></i><span class="user_rep_{posts.uid} formatted-number">{posts.user_rep}</span>
<div id="ids_{posts.pid}_{posts.uid}" class="chat hidden-xs" title="Chat"><i class="icon-comment"></i></div> <div class="chat hidden-xs" title="Chat"><i class="icon-comment"></i></div>
</div>--> </div>-->
<span class="label label-danger {posts.show_banned}">banned</span> <span class="label label-danger {posts.show_banned}">banned</span>
</div> </div>
<div class="col-md-11"> <div class="col-md-11">
<div class="post-block speech-bubble"> <div class="post-block speech-bubble">
<div class="post-buttons"> <div class="post-buttons">
<div class="topic-buttons <div class="topic-buttons">
">
<div class="btn-group"> <div class="btn-group">
<button class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" type="button" title="Posted by {posts.username}"> <button class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" type="button" title="Posted by {posts.username}">
<span class="username-field" href="/users/{posts.userslug}">{posts.username}&nbsp;</span> <span class="username-field" href="/users/{posts.userslug}">{posts.username}&nbsp;</span>
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="#">Profile</a></li> <li><a href="#">Profile</a></li>
<li><a href="#">Chat</a></li> <li><a href="#">Chat</a></li>
@ -130,20 +104,19 @@
</div> </div>
<div class="btn-group"> <div class="btn-group">
<button id="favs_{posts.pid}_{posts.uid}" class="favourite btn btn-sm btn-default {posts.fav_button_class}" type="button"> <button class="favourite btn btn-sm btn-default {posts.fav_button_class}" type="button">
<span class="favourite-text">Favourite</span> <span class="favourite-text">Favourite</span>
<span class="post_rep_{posts.pid}">{posts.post_rep} </span><i class="{posts.fav_star_class}"></i> <span class="post_rep_{posts.pid}">{posts.post_rep} </span><i class="{posts.fav_star_class}"></i>
</button> </button>
</div> </div>
<div class="btn-group"> <div class="btn-group">
<button id="quote_{posts.pid}_{posts.uid}" class="btn btn-sm btn-default quote" type="button" title="Quote"><i class="icon-quote-left"></i></button> <button class="btn btn-sm btn-default quote" type="button" title="Quote"><i class="icon-quote-left"></i></button>
<button class="btn btn-sm btn-primary btn post_reply" type="button">Reply <i class="icon-reply"></i></button> <button class="btn btn-sm btn-primary btn post_reply" type="button">Reply <i class="icon-reply"></i></button>
</div> </div>
<div class="btn-group pull-right post-tools"> <div class="btn-group pull-right post-tools">
<button id="ids_{posts.pid}_{posts.uid}" class="btn btn-sm btn-default edit {posts.display_moderator_tools}" type="button" title="Edit"><i class="icon-pencil"></i></button> <button class="btn btn-sm btn-default edit {posts.display_moderator_tools}" type="button" title="Edit"><i class="icon-pencil"></i></button>
<button id="ids_{posts.pid}_{posts.uid}" class="btn btn-sm btn-default delete {posts.display_moderator_tools}" type="button" title="Delete"><i class="icon-trash"></i></button> <button class="btn btn-sm btn-default delete {posts.display_moderator_tools}" type="button" title="Delete"><i class="icon-trash"></i></button>
</div> </div>
</div> </div>
<div style="clear:both; margin-bottom: 7px;"></div> <div style="clear:both; margin-bottom: 7px;"></div>
@ -164,18 +137,6 @@
<div style="clear:both;"></div> <div style="clear:both;"></div>
</div> </div>
<!--<div class="profile-block">-->
<!--<span class="post-buttons">
<button id="ids_{posts.pid}_{posts.uid}" class="edit {posts.display_moderator_tools} btn-link" title="Edit"><i class="icon-pencil"></i></button>
<button id="ids_{posts.pid}_{posts.uid}" class="delete {posts.display_moderator_tools} btn-link" title="Delete"><i class="icon-trash"></i></button>
<button id="favs_{posts.pid}_{posts.uid}" class="favourite btn-link" title="Favourite"><span class="post_rep_{posts.pid}">{posts.post_rep} </span><i class="{posts.fav_star_class}"></i></button>
<button id="quote_{posts.pid}_{posts.uid}" class="quote btn-link" title="Quote"><i class="icon-quote-left"></i></button>
<button class="post_reply btn-link" title="Reply"><i class="icon-reply"></i></button>
</span>-->
<!--Posted by <strong><a class="username-field" href="/users/{posts.userslug}">{posts.username}</a></strong> {posts.relativeTime} ago-->
<!--<span class="{posts.edited-class}">| last edited by <strong><a href="/users/{posts.editorslug}">{posts.editorname}</a></strong> {posts.relativeEditTime} ago</span>
<span class="{posts.edited-class}"><i class="icon-edit visible-xs" title="edited by {posts.editorname} {posts.relativeEditTime} ago"></i></span>
</div>-->
</div> </div>
</div> </div>
</li> </li>
@ -201,7 +162,7 @@
<div class="post-author-info"> <div class="post-author-info">
<div class="row"> <div class="row">
<div class="col-xs-3"> <div class="col-xs-3">
<img id="post-author-image" src="http://www.gravatar.com/avatar/ec001b26766105ea038160c98a317956?size=128&default=identicon&rating=pg" width=50 height=50 /> <img id="post-author-image" src="" width=50 height=50 />
</div> </div>
<div class="col-xs-9"> <div class="col-xs-9">
<h4><div id="post-author-info"></div></h4> <h4><div id="post-author-info"></div></h4>

Loading…
Cancel
Save