160 // first condition here is checking it's not clicked via a 'show comments' link |
160 // first condition here is checking it's not clicked via a 'show comments' link |
161 if (e.target.get("target") == "_blank") { |
161 if (e.target.get("target") == "_blank") { |
162 var link = e.target ; |
162 var link = e.target ; |
163 var showCommentUrl = sv_site_url + sv_text_view_show_comment_url ; |
163 var showCommentUrl = sv_site_url + sv_text_view_show_comment_url ; |
164 if (link.get('href').indexOf(showCommentUrl) == 0) { |
164 if (link.get('href').indexOf(showCommentUrl) == 0) { |
165 var res = (new RegExp('comment_key=([^&]*)', "g")).exec(link.get('href')) ; |
165 var res = (new RegExp('comment_id_key=([^&]*)', "g")).exec(link.get('href')) ; |
166 if (res != null) { |
166 if (res != null) { |
167 // open new comment .... we'll suppose it satisfies the filter for now |
167 // open new comment .... we'll suppose it satisfies the filter for now |
168 // TODO : should we reset the filter in this case ? instead of having the link open in a new window |
168 // TODO : should we reset the filter in this case ? instead of having the link open in a new window |
169 var key = res[1] ; |
169 var id_key = res[1] ; |
170 var comment = gDb.getCommentByKey(key) ; |
170 var comment = gDb.getCommentByIdKey(id_key) ; |
171 if (comment != null) { |
171 if (comment != null) { |
172 e.halt() ; |
172 e.halt() ; |
173 if (!link.hasClass("c-permalink")) {// clicking on the permalink itself should do anything |
173 if (!link.hasClass("c-permalink")) {// clicking on the permalink itself should do anything |
174 checkForOpenedDialog(null, function() { |
174 checkForOpenedDialog(null, function() { |
175 gSync.showSingleComment(comment) ; |
175 gSync.showSingleComment(comment) ; |