Show More
@@ -27,6 +27,7 b" var REPLY_TO_MSG = '.reply-to-message';" | |||||
27 | var REPLY_TO_MSG_ID = '#reply-to-message-id'; |
|
27 | var REPLY_TO_MSG_ID = '#reply-to-message-id'; | |
28 |
|
28 | |||
29 | var $html = $("html, body"); |
|
29 | var $html = $("html, body"); | |
|
30 | var $quoteButton = $("#quote-button"); | |||
30 |
|
31 | |||
31 | function moveCaretToEnd(el) { |
|
32 | function moveCaretToEnd(el) { | |
32 | var newPos = el.val().length; |
|
33 | var newPos = el.val().length; | |
@@ -78,8 +79,7 b' function addQuickReply(postId) {' | |||||
78 | function addQuickQuote() { |
|
79 | function addQuickQuote() { | |
79 | var textAreaJq = getPostTextarea(); |
|
80 | var textAreaJq = getPostTextarea(); | |
80 |
|
81 | |||
81 | var quoteButton = $("#quote-button"); |
|
82 | var postId = $quoteButton.attr('data-post-id'); | |
82 | var postId = quoteButton.attr('data-post-id'); |
|
|||
83 | if (postId != null) { |
|
83 | if (postId != null) { | |
84 | addQuickReply(postId); |
|
84 | addQuickReply(postId); | |
85 | } |
|
85 | } | |
@@ -87,7 +87,7 b' function addQuickQuote() {' | |||||
87 | var textToAdd = ''; |
|
87 | var textToAdd = ''; | |
88 | var selection = window.getSelection().toString(); |
|
88 | var selection = window.getSelection().toString(); | |
89 | if (selection.length == 0) { |
|
89 | if (selection.length == 0) { | |
90 | selection = quoteButton.attr('data-text'); |
|
90 | selection = $quoteButton.attr('data-text'); | |
91 | } |
|
91 | } | |
92 | if (selection.length > 0) { |
|
92 | if (selection.length > 0) { | |
93 | textToAdd += '[quote]' + selection + '[/quote]\n'; |
|
93 | textToAdd += '[quote]' + selection + '[/quote]\n'; | |
@@ -98,6 +98,8 b' function addQuickQuote() {' | |||||
98 | textAreaJq.focus(); |
|
98 | textAreaJq.focus(); | |
99 |
|
99 | |||
100 | moveCaretToEnd(textAreaJq); |
|
100 | moveCaretToEnd(textAreaJq); | |
|
101 | ||||
|
102 | $quoteButton.hide(); | |||
101 | } |
|
103 | } | |
102 |
|
104 | |||
103 | function scrollToBottom() { |
|
105 | function scrollToBottom() { | |
@@ -106,14 +108,13 b' function scrollToBottom() {' | |||||
106 |
|
108 | |||
107 | function showQuoteButton() { |
|
109 | function showQuoteButton() { | |
108 | var selection = window.getSelection().getRangeAt(0).getBoundingClientRect(); |
|
110 | var selection = window.getSelection().getRangeAt(0).getBoundingClientRect(); | |
109 | var quoteButton = $("#quote-button"); |
|
|||
110 | if (selection.width > 0) { |
|
111 | if (selection.width > 0) { | |
111 | // quoteButton.offset({ top: selection.top - selection.height, left: selection.left }); |
|
112 | // quoteButton.offset({ top: selection.top - selection.height, left: selection.left }); | |
112 | quoteButton.css({top: selection.top + $(window).scrollTop() - 30, left: selection.left}); |
|
113 | $quoteButton.css({top: selection.top + $(window).scrollTop() - 30, left: selection.left}); | |
113 | quoteButton.show(); |
|
114 | $quoteButton.show(); | |
114 |
|
115 | |||
115 | var text = window.getSelection().toString(); |
|
116 | var text = window.getSelection().toString(); | |
116 | quoteButton.attr('data-text', text); |
|
117 | $quoteButton.attr('data-text', text); | |
117 |
|
118 | |||
118 | var rect = window.getSelection().getRangeAt(0).getBoundingClientRect(); |
|
119 | var rect = window.getSelection().getRangeAt(0).getBoundingClientRect(); | |
119 | var element = $(document.elementFromPoint(rect.x, rect.y)); |
|
120 | var element = $(document.elementFromPoint(rect.x, rect.y)); | |
@@ -126,9 +127,9 b' function showQuoteButton() {' | |||||
126 | postId = postParent.attr('id'); |
|
127 | postId = postParent.attr('id'); | |
127 | } |
|
128 | } | |
128 | } |
|
129 | } | |
129 | quoteButton.attr('data-post-id', postId); |
|
130 | $quoteButton.attr('data-post-id', postId); | |
130 | } else { |
|
131 | } else { | |
131 | quoteButton.hide(); |
|
132 | $quoteButton.hide(); | |
132 | } |
|
133 | } | |
133 | } |
|
134 | } | |
134 |
|
135 |
General Comments 0
You need to be logged in to leave comments.
Login now