Show More
@@ -154,3 +154,8 b' textarea, input {' | |||||
154 | -webkit-filter: grayscale(100%); |
|
154 | -webkit-filter: grayscale(100%); | |
155 | } |
|
155 | } | |
156 |
|
156 | |||
|
157 | #quote-button { | |||
|
158 | position: absolute; | |||
|
159 | display: none; | |||
|
160 | cursor: pointer; | |||
|
161 | } No newline at end of file |
@@ -571,3 +571,13 b' ul {' | |||||
571 | .post-blink { |
|
571 | .post-blink { | |
572 | background-color: #000; |
|
572 | background-color: #000; | |
573 | } |
|
573 | } | |
|
574 | ||||
|
575 | #quote-button { | |||
|
576 | background-color: black; | |||
|
577 | border: solid white 1px; | |||
|
578 | padding: 2px; | |||
|
579 | } | |||
|
580 | ||||
|
581 | #quote-button:hover { | |||
|
582 | background-color: #2d3955; | |||
|
583 | } No newline at end of file |
@@ -381,3 +381,13 b' input[type="submit"]:hover {' | |||||
381 | .post-blink { |
|
381 | .post-blink { | |
382 | background-color: #333; |
|
382 | background-color: #333; | |
383 | } |
|
383 | } | |
|
384 | ||||
|
385 | #quote-button { | |||
|
386 | background-color: #e2c48f; | |||
|
387 | border: solid #000000 1px; | |||
|
388 | padding: 2px; | |||
|
389 | } | |||
|
390 | ||||
|
391 | #quote-button:hover { | |||
|
392 | background-color: #bde2a6; | |||
|
393 | } No newline at end of file |
@@ -416,3 +416,13 b' audio {' | |||||
416 | .post-blink { |
|
416 | .post-blink { | |
417 | background-color: #ccc; |
|
417 | background-color: #ccc; | |
418 | } |
|
418 | } | |
|
419 | ||||
|
420 | #quote-button { | |||
|
421 | background-color: #99a3e2; | |||
|
422 | border: solid #000000 1px; | |||
|
423 | padding: 2px; | |||
|
424 | } | |||
|
425 | ||||
|
426 | #quote-button:hover { | |||
|
427 | background-color: #b9c4e2; | |||
|
428 | } No newline at end of file |
@@ -67,12 +67,10 b' function addQuickReply(postId) {' | |||||
67 | if (getForm().prev().attr('id') == postId) { |
|
67 | if (getForm().prev().attr('id') == postId) { | |
68 | resetFormPosition(); |
|
68 | resetFormPosition(); | |
69 | } else { |
|
69 | } else { | |
|
70 | var blockToInsert = null; | |||
|
71 | var textAreaJq = $('textarea'); | |||
70 | var postLinkRaw = '[post]' + postId + '[/post]' |
|
72 | var postLinkRaw = '[post]' + postId + '[/post]' | |
71 |
|
73 | var textToAdd = ''; | ||
72 | var textToAdd = ''; |
|
|||
73 | var blockToInsert = null; |
|
|||
74 |
|
||||
75 | var textAreaJq = $('textarea'); |
|
|||
76 |
|
74 | |||
77 | if (postId != null) { |
|
75 | if (postId != null) { | |
78 | var post = $('#' + postId); |
|
76 | var post = $('#' + postId); | |
@@ -83,27 +81,63 b' function addQuickReply(postId) {' | |||||
83 | textToAdd += postLinkRaw + '\n'; |
|
81 | textToAdd += postLinkRaw + '\n'; | |
84 | } |
|
82 | } | |
85 |
|
83 | |||
|
84 | textAreaJq.val(textAreaJq.val()+ textToAdd); | |||
86 | blockToInsert = post; |
|
85 | blockToInsert = post; | |
87 | } else { |
|
86 | } else { | |
88 | blockToInsert = $('.thread'); |
|
87 | blockToInsert = $('.thread'); | |
89 | } |
|
88 | } | |
90 |
|
89 | showFormAfter(blockToInsert); | ||
91 | var selection = window.getSelection().toString(); |
|
90 | ||
92 | if (selection.length > 0) { |
|
91 | textAreaJq.focus(); | |
93 | textToAdd += '[quote]' + selection + '[/quote]\n'; |
|
|||
94 | } |
|
|||
95 |
|
92 | |||
96 | textAreaJq.val(textAreaJq.val()+ textToAdd); |
|
|||
97 |
|
||||
98 | showFormAfter(blockToInsert); |
|
|||
99 |
|
||||
100 | textAreaJq.focus(); |
|
|||
101 | var textarea = document.getElementsByTagName('textarea')[0]; |
|
93 | var textarea = document.getElementsByTagName('textarea')[0]; | |
102 | moveCaretToEnd(textarea); |
|
94 | moveCaretToEnd(textarea); | |
103 | } |
|
95 | } | |
104 | } |
|
96 | } | |
105 |
|
97 | |||
|
98 | function addQuickQuote() { | |||
|
99 | var textToAdd = ''; | |||
|
100 | var textAreaJq = $('textarea'); | |||
|
101 | var selection = window.getSelection().toString(); | |||
|
102 | if (selection.length == 0) { | |||
|
103 | selection = $("#quote-button").attr('data-text'); | |||
|
104 | } | |||
|
105 | if (selection.length > 0) { | |||
|
106 | textToAdd += '[quote]' + selection + '[/quote]\n'; | |||
|
107 | } | |||
|
108 | ||||
|
109 | textAreaJq.val(textAreaJq.val()+ textToAdd); | |||
|
110 | ||||
|
111 | textAreaJq.focus(); | |||
|
112 | ||||
|
113 | var textarea = document.getElementsByTagName('textarea')[0]; | |||
|
114 | moveCaretToEnd(textarea); | |||
|
115 | } | |||
|
116 | ||||
106 | function scrollToBottom() { |
|
117 | function scrollToBottom() { | |
107 | $html.animate({scrollTop: $html.height()}, "fast"); |
|
118 | $html.animate({scrollTop: $html.height()}, "fast"); | |
108 | } |
|
119 | } | |
109 |
|
120 | |||
|
121 | function showQuoteButton() { | |||
|
122 | var selection = window.getSelection().getRangeAt(0).getBoundingClientRect(); | |||
|
123 | var quoteButton = $("#quote-button"); | |||
|
124 | if (selection.width > 0) { | |||
|
125 | // quoteButton.offset({ top: selection.top - selection.height, left: selection.left }); | |||
|
126 | quoteButton.css({top: selection.top + $(window).scrollTop() - 30, left: selection.left}); | |||
|
127 | quoteButton.show(); | |||
|
128 | ||||
|
129 | var text = window.getSelection().toString(); | |||
|
130 | quoteButton.attr('data-text', text); | |||
|
131 | } else { | |||
|
132 | quoteButton.hide(); | |||
|
133 | } | |||
|
134 | } | |||
|
135 | ||||
|
136 | $(document).ready(function() { | |||
|
137 | $('body').on('mouseup', function() { | |||
|
138 | showQuoteButton(); | |||
|
139 | }); | |||
|
140 | $("#quote-button").click(function() { | |||
|
141 | addQuickQuote(); | |||
|
142 | }) | |||
|
143 | }); No newline at end of file |
@@ -9,6 +9,8 b'' | |||||
9 | {% get_current_language as LANGUAGE_CODE %} |
|
9 | {% get_current_language as LANGUAGE_CODE %} | |
10 | {% get_current_timezone as TIME_ZONE %} |
|
10 | {% get_current_timezone as TIME_ZONE %} | |
11 |
|
11 | |||
|
12 | <div id="quote-button">{% trans 'Quote' %}</div> | |||
|
13 | ||||
12 | <div class="tag_info"> |
|
14 | <div class="tag_info"> | |
13 | <h2> |
|
15 | <h2> | |
14 | <form action="{% url 'thread' opening_post.id %}" method="post" class="post-button-form"> |
|
16 | <form action="{% url 'thread' opening_post.id %}" method="post" class="post-button-form"> |
General Comments 0
You need to be logged in to leave comments.
Login now