##// END OF EJS Templates
Added quotation button over the selection
neko259 -
r1521:dd31aeac default
parent child Browse files
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
@@ -566,3 +566,13 b' ul {'
566 .post-blink {
566 .post-blink {
567 background-color: #000;
567 background-color: #000;
568 }
568 }
569
570 #quote-button {
571 background-color: black;
572 border: solid white 1px;
573 padding: 2px;
574 }
575
576 #quote-button:hover {
577 background-color: #2d3955;
578 } 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
@@ -95,15 +95,13 b' function addQuickReply(postId) {'
95 }
95 }
96 }
96 }
97
97
98 function addQuickQuote(postId) {
98 function addQuickQuote() {
99 if (getForm().prev().attr('id') != postId) {
100 addQuickReply(postId);
101 }
102
103 var textToAdd = '';
99 var textToAdd = '';
104 var textAreaJq = $('textarea');
100 var textAreaJq = $('textarea');
105 var postLinkRaw = '[post]' + postId + '[/post]'
106 var selection = window.getSelection().toString();
101 var selection = window.getSelection().toString();
102 if (selection.length == 0) {
103 selection = $("#quote-button").attr('data-text');
104 }
107 if (selection.length > 0) {
105 if (selection.length > 0) {
108 textToAdd += '[quote]' + selection + '[/quote]\n';
106 textToAdd += '[quote]' + selection + '[/quote]\n';
109 }
107 }
@@ -120,3 +118,26 b' function scrollToBottom() {'
120 $html.animate({scrollTop: $html.height()}, "fast");
118 $html.animate({scrollTop: $html.height()}, "fast");
121 }
119 }
122
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
@@ -42,8 +42,7 b''
42 {% endif %}
42 {% endif %}
43 {% endif %}
43 {% endif %}
44 {% if reply_link and not thread.is_archived %}
44 {% if reply_link and not thread.is_archived %}
45 <a href="#form" onclick="addQuickReply('{{ post.id }}'); return false;">{% trans 'Reply' %}</a> |
45 <a href="#form" onclick="addQuickReply('{{ post.id }}'); return false;">{% trans 'Reply' %}</a>
46 <a href="#form" onclick="addQuickQuote('{{ post.id }}'); return false;">{% trans 'Quote' %}</a>
47 {% endif %}
46 {% endif %}
48
47
49 {% if perms.boards.change_post or perms.boards.delete_post or perms.boards.change_thread or perms_boards.delete_thread %}
48 {% if perms.boards.change_post or perms.boards.delete_post or perms.boards.change_thread or perms_boards.delete_thread %}
@@ -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