mirror of
https://github.com/twisterarmy/twister-html.git
synced 2025-01-13 00:18:15 +00:00
initial very basic post preview
This commit is contained in:
parent
a245bc449f
commit
3b696e336a
@ -206,6 +206,12 @@
|
||||
<li class="ancestor module post">
|
||||
</li>
|
||||
|
||||
<div id="post-preview-template">
|
||||
<div id="post-preview">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<li id="post-template" class="module post" data-time="">
|
||||
<div class="post-data" data-userpost="" data-content_to_rt="" data-content_to_sigrt=""
|
||||
data-screen-name="" data-id="" data-text="" data-text-mentions="">
|
||||
|
@ -298,6 +298,11 @@
|
||||
<li class="ancestor module post">
|
||||
</li>
|
||||
|
||||
<div id="post-preview-template">
|
||||
<div id="post-preview">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<li id="post-template" class="module post" data-time="">
|
||||
<div class="post-data" data-userpost="" data-content_to_rt="" data-content_to_sigrt=""
|
||||
data-screen-name="" data-id="" data-text="" data-text-mentions="">
|
||||
|
@ -578,6 +578,15 @@ function composeNewPost(e, postAreaNew) {
|
||||
postAreaNew.find('textarea:last').focus();
|
||||
}
|
||||
|
||||
function posPostPreview(event) {
|
||||
var textArea = $(event.target);
|
||||
var postPreview = textArea.siblings('#post-preview');
|
||||
if (!postPreview.length)
|
||||
postPreview = $('#post-preview-template').children().clone();
|
||||
postPreview.html(htmlFormatMsg(textArea[0].value, []))
|
||||
textArea.before(postPreview);
|
||||
}
|
||||
|
||||
// Reduz Área do Novo post
|
||||
function unfocusThis() {
|
||||
$(this).removeClass('open');
|
||||
@ -680,6 +689,8 @@ function replyTextInput(event) {
|
||||
textArea.caret(caretPos);
|
||||
}
|
||||
}
|
||||
|
||||
textAreaForm.find('#post-preview').html(htmlFormatMsg(textArea[0].value, []));
|
||||
}
|
||||
|
||||
function getPostSplitingPML() {
|
||||
@ -1372,6 +1383,7 @@ function initInterfaceCommon() {
|
||||
.clickoutside(unfocusThis)
|
||||
.children('textarea')
|
||||
.on({
|
||||
'focus': posPostPreview,
|
||||
'input': replyTextInput, // input event fires in modern browsers (IE9+) on any changes in textarea (and copypasting with mouse too)
|
||||
'input focus': replyTextUpdateRemaining,
|
||||
'keyup': replyTextKeySend
|
||||
|
@ -26,6 +26,7 @@ function initializeTwister( redirectNetwork, redirectLogin, cbFunc, cbArg ) {
|
||||
// reply text counter both newmsg and dmchat
|
||||
$('.post-area-new textarea')
|
||||
.off('input keyup')
|
||||
.on('focus', posPostPreview)
|
||||
.on('keyup', replyTextInput)
|
||||
.on('keyup', function() { replyTextUpdateRemaining(this); })
|
||||
;
|
||||
|
@ -718,6 +718,11 @@
|
||||
</div>
|
||||
</li> <!-- post-template -->
|
||||
|
||||
<div id="post-preview-template">
|
||||
<div id="post-preview">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<li id="post-template-post" class="module post" data-time="">
|
||||
<img class="avatar" src="img/grayed_avatar_placeholder_24.png" alt="user-photo"/>
|
||||
<div class="post-data" data-userpost="" data-content_to_rt="" data-content_to_sigrt=""
|
||||
|
Loading…
Reference in New Issue
Block a user