##// END OF EJS Templates
js: cleanup unused javascript code.
marcink -
r1328:8d66569e default
parent child Browse files
Show More
@@ -182,6 +182,12 b' var showRepoStats = function(target, dat'
182
182
183 };
183 };
184
184
185 // returns a node from given html;
186 var fromHTML = function(html){
187 var _html = document.createElement('element');
188 _html.innerHTML = html;
189 return _html;
190 };
185
191
186 // Toggle Collapsable Content
192 // Toggle Collapsable Content
187 function collapsableContent() {
193 function collapsableContent() {
@@ -25,59 +25,6 b' var firefoxAnchorFix = function() {'
25 }
25 }
26 };
26 };
27
27
28 // returns a node from given html;
29 var fromHTML = function(html){
30 var _html = document.createElement('element');
31 _html.innerHTML = html;
32 return _html;
33 };
34
35 var tableTr = function(cls, body){
36 var _el = document.createElement('div');
37 var _body = $(body).attr('id');
38 var comment_id = fromHTML(body).children[0].id.split('comment-')[1];
39 var id = 'comment-tr-{0}'.format(comment_id);
40 var _html = ('<table><tbody><tr id="{0}" class="{1}">'+
41 '<td class="add-comment-line tooltip tooltip" title="Add Comment"><span class="add-comment-content"></span></td>'+
42 '<td></td>'+
43 '<td></td>'+
44 '<td></td>'+
45 '<td>{2}</td>'+
46 '</tr></tbody></table>').format(id, cls, body);
47 $(_el).html(_html);
48 return _el.children[0].children[0].children[0];
49 };
50
51 function bindDeleteCommentButtons() {
52 $('.delete-comment').one('click', function() {
53 var comment_id = $(this).data("comment-id");
54
55 if (comment_id){
56 deleteComment(comment_id);
57 }
58 });
59 }
60
61 var deleteComment = function(comment_id) {
62 var url = AJAX_COMMENT_DELETE_URL.replace('__COMMENT_ID__', comment_id);
63 var postData = {
64 '_method': 'delete',
65 'csrf_token': CSRF_TOKEN
66 };
67
68 var success = function(o) {
69 window.location.reload();
70 };
71 ajaxPOST(url, postData, success);
72 };
73
74
75 var bindToggleButtons = function() {
76 $('.comment-toggle').on('click', function() {
77 $(this).parent().nextUntil('tr.line').toggle('inline-comments');
78 });
79 };
80
81 var linkifyComments = function(comments) {
28 var linkifyComments = function(comments) {
82 /* TODO: marcink: remove this - it should no longer needed */
29 /* TODO: marcink: remove this - it should no longer needed */
83 for (var i = 0; i < comments.length; i++) {
30 for (var i = 0; i < comments.length; i++) {
@@ -181,7 +128,6 b' var bindToggleButtons = function() {'
181 $(self.statusChange).select2('readonly', true);
128 $(self.statusChange).select2('readonly', true);
182 }, 10);
129 }, 10);
183
130
184
185 var resolvedInfo = (
131 var resolvedInfo = (
186 '<li class="">' +
132 '<li class="">' +
187 '<input type="hidden" id="resolve_comment_{0}" name="resolve_comment_{0}" value="{0}">' +
133 '<input type="hidden" id="resolve_comment_{0}" name="resolve_comment_{0}" value="{0}">' +
@@ -364,7 +310,6 b' var bindToggleButtons = function() {'
364 } else {
310 } else {
365 $('#injected_page_comments').append(o.rendered_text);
311 $('#injected_page_comments').append(o.rendered_text);
366 self.resetCommentFormState();
312 self.resetCommentFormState();
367 bindDeleteCommentButtons();
368 timeagoActivate();
313 timeagoActivate();
369
314
370 // mark visually which comment was resolved
315 // mark visually which comment was resolved
@@ -769,7 +714,6 b' var CommentsController = function() {'
769 // re trigger the linkification of next/prev navigation
714 // re trigger the linkification of next/prev navigation
770 linkifyComments($('.inline-comment-injected'));
715 linkifyComments($('.inline-comment-injected'));
771 timeagoActivate();
716 timeagoActivate();
772 bindDeleteCommentButtons();
773 commentForm.setActionButtonsDisabled(false);
717 commentForm.setActionButtonsDisabled(false);
774
718
775 };
719 };
@@ -779,7 +723,6 b' var CommentsController = function() {'
779 commentForm.submitAjaxPOST(
723 commentForm.submitAjaxPOST(
780 commentForm.submitUrl, postData, submitSuccessCallback, submitFailCallback);
724 commentForm.submitUrl, postData, submitSuccessCallback, submitFailCallback);
781 });
725 });
782
783 }
726 }
784
727
785 $form.addClass('comment-inline-form-open');
728 $form.addClass('comment-inline-form-open');
@@ -842,7 +785,6 b' var CommentsController = function() {'
842 // since order of injection is random, we're now re-iterating
785 // since order of injection is random, we're now re-iterating
843 // from correct order and filling in links
786 // from correct order and filling in links
844 linkifyComments($('.inline-comment-injected'));
787 linkifyComments($('.inline-comment-injected'));
845 bindDeleteCommentButtons();
846 firefoxAnchorFix();
788 firefoxAnchorFix();
847 };
789 };
848
790
General Comments 0
You need to be logged in to leave comments. Login now