Commit 1a8d5e31222d12188d4df96037374dbe6cf87100
1 parent
32e196f0
Exists in
master
minor behaviour fix
Showing
2 changed files
with
52 additions
and
74 deletions
Show diff stats
public/comment_paragraph_macro.js
... | ... | @@ -42,11 +42,12 @@ jQuery(document).ready(function($) { |
42 | 42 | </a>'); |
43 | 43 | |
44 | 44 | $('.side-comments-counter').click(function(){ |
45 | - hideAllComments(); | |
46 | - var paragraphId = $(this).data('paragraph') | |
47 | - $('#side_comment_' + paragraphId).show(); | |
48 | - $('#comments_list_toggle_paragraph_' + paragraphId).show(); | |
49 | - console.log(paragraphId); | |
45 | + var paragraphId = $(this).data('paragraph'); | |
46 | + hideAllCommentsExcept(paragraphId); | |
47 | + hideAllSelectedAreasExcept(paragraphId); | |
48 | + $('#comment-bubble').hide(); | |
49 | + $('#side_comment_' + paragraphId).toggle(); | |
50 | + $('#side_comment_' + paragraphId).find().toggle(); | |
50 | 51 | //Loads the comments |
51 | 52 | var url = $('#link_to_ajax_comments_' + paragraphId).data('url'); |
52 | 53 | $.ajax({ |
... | ... | @@ -62,10 +63,10 @@ jQuery(document).ready(function($) { |
62 | 63 | |
63 | 64 | $('#comment-bubble').click(function(event){ |
64 | 65 | $(this).hide(); |
65 | - hideAllComments(); | |
66 | 66 | $("#comment-bubble").css({top: 0, left: 0, position:'absolute'}); |
67 | 67 | var url = $("#comment-bubble").data('url'); |
68 | 68 | var paragraphId = $("#comment-bubble").data("paragraphId"); |
69 | + hideAllCommentsExcept(paragraphId); | |
69 | 70 | $('#side_comment_' + paragraphId).show(); |
70 | 71 | $.ajax({ |
71 | 72 | dataType: "script", |
... | ... | @@ -86,8 +87,29 @@ jQuery(document).ready(function($) { |
86 | 87 | $('.required-field').removeClass("required-field"); |
87 | 88 | } |
88 | 89 | |
89 | - function hideAllComments(){ | |
90 | - $(".side-comment").hide(); | |
90 | +// function hideAllComments(){ | |
91 | +// $(".side-comment").hide(); | |
92 | +// $(".side-comment").find().hide(); | |
93 | +// } | |
94 | + | |
95 | + function hideAllCommentsExcept(clickedParagraph){ | |
96 | + $(".side-comment").each(function(){ | |
97 | + paragraph = $(this).data('paragraph'); | |
98 | + if(paragraph != clickedParagraph){ | |
99 | + $(this).hide(); | |
100 | + $(this).find().hide(); | |
101 | + } | |
102 | + }); | |
103 | + } | |
104 | + | |
105 | + function hideAllSelectedAreasExcept(clickedParagraph){ | |
106 | + $(".comment_paragraph").each(function(){ | |
107 | + paragraph = $(this).data('paragraph'); | |
108 | + if(paragraph != clickedParagraph){ | |
109 | +// $(".commented-area").contents().unwrap(); | |
110 | + $(this).find(".commented-area").contents().unwrap(); | |
111 | + } | |
112 | + }); | |
91 | 113 | } |
92 | 114 | |
93 | 115 | $("#comment-bubble").hide(); |
... | ... | @@ -153,13 +175,11 @@ jQuery(document).ready(function($) { |
153 | 175 | function processAnchor(){ |
154 | 176 | var anchor = window.location.hash; |
155 | 177 | if(anchor.length==0) return; |
156 | - | |
157 | 178 | var val = anchor.split('-'); //anchor format = #comment-\d+ |
158 | 179 | if(val.length!=2 || val[0]!='#comment') return; |
159 | 180 | if($('div[data-macro=comment_paragraph_plugin\\/allow_comment]').length==0) return; //comment_paragraph_plugin/allow_comment div must exists |
160 | 181 | var comment_id = val[1]; |
161 | 182 | if(!/^\d+$/.test(comment_id)) return; //test for integer |
162 | - | |
163 | 183 | comment_paragraph_anchor = anchor; |
164 | 184 | var url = '/plugin/comment_paragraph/public/comment_paragraph/'+comment_id; |
165 | 185 | $.ajax({ |
... | ... | @@ -209,19 +229,21 @@ jQuery(document).ready(function($) { |
209 | 229 | }); |
210 | 230 | }); // End of jQuery(document).ready(function($) |
211 | 231 | |
212 | -function toggleParagraph(paragraph) { | |
213 | - var div = jQuery('div.comments_list_toggle_paragraph_'+paragraph); | |
214 | - var visible = div.is(':visible'); | |
215 | - if(!visible) | |
216 | - jQuery('div.comment-paragraph-loading-' + paragraph).addClass('comment-button-loading'); | |
217 | - div.toggle('fast'); | |
218 | - return visible; | |
219 | -} | |
220 | - | |
221 | -function loadCompleted(paragraph) { | |
222 | - jQuery('div.comment-paragraph-loading-'+paragraph).removeClass('comment-button-loading') | |
223 | - if(comment_paragraph_anchor) { | |
224 | - jQuery.scrollTo(jQuery(comment_paragraph_anchor)); | |
225 | - comment_paragraph_anchor = null; | |
226 | - } | |
227 | -} | |
228 | 232 | \ No newline at end of file |
233 | +//Seens that this code is not beeing used anymore | |
234 | + | |
235 | +//function toggleParagraph(paragraph) { | |
236 | +// var div = jQuery('div.comments_list_toggle_paragraph_'+paragraph); | |
237 | +// var visible = div.is(':visible'); | |
238 | +// if(!visible) | |
239 | +// jQuery('div.comment-paragraph-loading-' + paragraph).addClass('comment-button-loading'); | |
240 | +// div.toggle('fast'); | |
241 | +// return visible; | |
242 | +//} | |
243 | + | |
244 | +//function loadCompleted(paragraph) { | |
245 | +// jQuery('div.comment-paragraph-loading-'+paragraph).removeClass('comment-button-loading') | |
246 | +// if(comment_paragraph_anchor) { | |
247 | +// jQuery.scrollTo(jQuery(comment_paragraph_anchor)); | |
248 | +// comment_paragraph_anchor = null; | |
249 | +// } | |
250 | +//} | |
229 | 251 | \ No newline at end of file | ... | ... |
public/style.css
... | ... | @@ -124,54 +124,10 @@ div[class^='comment-paragraph-loading-'] { |
124 | 124 | z-index: 99; |
125 | 125 | } |
126 | 126 | |
127 | -/*label[for="comment_title"]{ | |
128 | - display: none; | |
129 | -}*/ | |
130 | - | |
131 | -#comments_list{ | |
132 | - display: none; | |
127 | +.side-comment{ | |
128 | + z-index: 199; | |
133 | 129 | } |
134 | 130 | |
135 | -/* Hides old style counter*/ | |
136 | -/*.comment-count{ | |
131 | +#comments_list{ | |
137 | 132 | display: none; |
138 | -}*/ | |
139 | - | |
140 | - | |
141 | - | |
142 | - | |
143 | - | |
144 | - | |
145 | -/*.comment-details{ | |
146 | - width: 365px; | |
147 | -}*/ | |
148 | - | |
149 | -/*.side-comments-text{ | |
150 | - word-wrap: break-word; | |
151 | -}*/ | |
152 | - | |
153 | -/*.side-comments-box{ | |
154 | - position: absolute; | |
155 | - top: 0px; | |
156 | - border-style: solid; | |
157 | - border-width: 1px; | |
158 | - border-color: black; | |
159 | - z-index: 99; | |
160 | - width: 350px; | |
161 | - height: auto; | |
162 | - overflow-y: auto; | |
163 | - display: none; | |
164 | - background: #FFFFFF; | |
165 | -}*/ | |
166 | - | |
167 | - | |
168 | -/* | |
169 | -element.style { | |
170 | -position: relative; | |
171 | -right: -442px; | |
172 | -width: 365px; | |
173 | -top: -56px; | |
174 | -background: gray; | |
175 | -border: 1px solid; | |
176 | -} | |
177 | -*/ | |
133 | +} | |
178 | 134 | \ No newline at end of file | ... | ... |