if a thread is locked, the reply buttons all now say "locked", and the

post reply window will not pop up
v1.18.x
Julian Lam 12 years ago
parent 922acc0f79
commit b6f3211ce7

@ -37,11 +37,16 @@
<script type="text/javascript">
(function() {
var locked = '{locked}';
jQuery('document').ready(function() {
var room = 'topic_' + '{topic_id}';
app.enter_room(room);
set_up_posts();
if (locked === '1') set_locked_state(true);
});
@ -106,11 +111,11 @@ function set_up_posts(div) {
else div = '#' + div;
jQuery(div + ' .post_reply').click(function() {
app.open_post_window('reply', "{topic_id}", "{topic_name}");
if (locked !== '1') app.open_post_window('reply', "{topic_id}", "{topic_name}");
});
jQuery(div + ' .quote').click(function() {
app.open_post_window('quote', "{topic_id}", "{topic_name}");
if (locked !== '1') app.open_post_window('quote', "{topic_id}", "{topic_name}");
// this needs to be looked at, obviously. only single line quotes work well I think maybe replace all \r\n with > ?
document.getElementById('post_content').innerHTML = '> ' + document.getElementById('content_' + this.id.replace('quote_', '')).innerHTML;
@ -139,4 +144,28 @@ function set_up_posts(div) {
}
});
}
function set_locked_state(locked) {
var threadReplyBtn = document.getElementById('post_reply'),
postReplyBtns = document.querySelectorAll('#post-container .post_reply'),
quoteBtns = document.querySelectorAll('#post-container .quote'),
numReplyBtns = postReplyBtns.length,
x;
if (locked === true) {
threadReplyBtn.disabled = true;
threadReplyBtn.innerHTML = 'Locked';
for(x=0;x<numReplyBtns;x++) {
postReplyBtns[x].innerHTML = 'Locked <i class="icon-lock"></i>';
quoteBtns[x].style.display = 'none';
}
} else {
threadReplyBtn.disabled = false;
threadReplyBtn.innerHTML = 'Reply';
for(x=0;x<numReplyBtns;x++) {
postReplyBtns[x].innerHTML = 'Reply <i class="icon-reply"></i>';
quoteBtns[x].style.display = 'inline-block';
}
}
}
})();
</script>

@ -340,7 +340,7 @@ passport.deserializeUser(function(uid, done) {
app.get('/test', function(req, res) {
global.modules.posts.get(function(data) {
res.send('<pre>' + JSON.stringify(data) + '</pre>');
res.send('<pre>' + JSON.stringify(data, null, 4) + '</pre>');
}, 1, 1);
});
}(WebServer));

Loading…
Cancel
Save