##// END OF EJS Templates
fixed comment addition and deletion functionality on IE9
Dies Koper -
r2723:04aa0ea1 beta
parent child Browse files
Show More
@@ -398,7 +398,7 var createInlineForm = function(parent_t
398
398
399 // create event for hide button
399 // create event for hide button
400 form = new YAHOO.util.Element(form);
400 form = new YAHOO.util.Element(form);
401 var form_hide_button = new YAHOO.util.Element(form.getElementsByClassName('hide-inline-form')[0]);
401 var form_hide_button = new YAHOO.util.Element(YUD.getElementsByClassName('hide-inline-form',null,form)[0]);
402 form_hide_button.on('click', function(e) {
402 form_hide_button.on('click', function(e) {
403 var newtr = e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode;
403 var newtr = e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode;
404 if(YUD.hasClass(newtr.nextElementSibling,'inline-comments-button')){
404 if(YUD.hasClass(newtr.nextElementSibling,'inline-comments-button')){
@@ -422,12 +422,12 var injectInlineForm = function(tr){
422 return
422 return
423 }
423 }
424 var submit_url = AJAX_COMMENT_URL;
424 var submit_url = AJAX_COMMENT_URL;
425 var _td = tr.getElementsByClassName('code')[0];
425 var _td = YUD.getElementsByClassName('code',null,tr)[0];
426 if(YUD.hasClass(tr,'form-open') || YUD.hasClass(tr,'context') || YUD.hasClass(_td,'no-comment')){
426 if(YUD.hasClass(tr,'form-open') || YUD.hasClass(tr,'context') || YUD.hasClass(_td,'no-comment')){
427 return
427 return
428 }
428 }
429 YUD.addClass(tr,'form-open');
429 YUD.addClass(tr,'form-open');
430 var node = tr.parentNode.parentNode.parentNode.getElementsByClassName('full_f_path')[0];
430 var node = YUD.getElementsByClassName('full_f_path',null,tr.parentNode.parentNode.parentNode)[0];
431 var f_path = YUD.getAttribute(node,'path');
431 var f_path = YUD.getAttribute(node,'path');
432 var lineno = getLineNo(tr);
432 var lineno = getLineNo(tr);
433 var form = createInlineForm(tr, f_path, lineno, submit_url);
433 var form = createInlineForm(tr, f_path, lineno, submit_url);
@@ -447,8 +447,8 var injectInlineForm = function(tr){
447
447
448 var f = YUD.get(form);
448 var f = YUD.get(form);
449
449
450 var overlay = f.getElementsByClassName('overlay')[0];
450 var overlay = YUD.getElementsByClassName('overlay',null,f)[0];
451 var _form = f.getElementsByClassName('inline-form')[0];
451 var _form = YUD.getElementsByClassName('inline-form',null,f)[0];
452
452
453 form.on('submit',function(e){
453 form.on('submit',function(e){
454 YUE.preventDefault(e);
454 YUE.preventDefault(e);
@@ -568,8 +568,8 var placeAddButton = function(target_tr)
568 // next element are comments !
568 // next element are comments !
569 if(YUD.hasClass(n,'inline-comments')){
569 if(YUD.hasClass(n,'inline-comments')){
570 last_node = n;
570 last_node = n;
571 //also remove the comment button from previos
571 //also remove the comment button from previous
572 var comment_add_buttons = last_node.getElementsByClassName('add-comment');
572 var comment_add_buttons = YUD.getElementsByClassName('add-comment',null,last_node);
573 for(var i=0;i<comment_add_buttons.length;i++){
573 for(var i=0;i<comment_add_buttons.length;i++){
574 var b = comment_add_buttons[i];
574 var b = comment_add_buttons[i];
575 b.parentNode.removeChild(b);
575 b.parentNode.removeChild(b);
@@ -582,7 +582,7 var placeAddButton = function(target_tr)
582
582
583 var add = createInlineAddButton(target_tr);
583 var add = createInlineAddButton(target_tr);
584 // get the comment div
584 // get the comment div
585 var comment_block = last_node.getElementsByClassName('comment')[0];
585 var comment_block = YUD.getElementsByClassName('comment',null,last_node)[0];
586 // attach add button
586 // attach add button
587 YUD.insertAfter(add,comment_block);
587 YUD.insertAfter(add,comment_block);
588 }
588 }
@@ -889,7 +889,7 var readNotification = function(url, not
889 success:function(o){
889 success:function(o){
890 var obj = YUD.get(String("notification_"+notification_id));
890 var obj = YUD.get(String("notification_"+notification_id));
891 YUD.removeClass(obj, 'unread');
891 YUD.removeClass(obj, 'unread');
892 var r_button = obj.children[0].getElementsByClassName('read-notification')[0]
892 var r_button = YUD.getElementsByClassName('read-notification',null,obj.children[0])[0];
893
893
894 if(r_button.parentNode !== undefined){
894 if(r_button.parentNode !== undefined){
895 r_button.parentNode.removeChild(r_button);
895 r_button.parentNode.removeChild(r_button);
@@ -1737,4 +1737,4 var MultiSelectWidget = function(selecte
1737 }
1737 }
1738 });
1738 });
1739 }
1739 }
1740 } No newline at end of file
1740 }
@@ -149,6 +149,9
149 YUE.on(YUQ('.show-inline-comments'),'change',function(e){
149 YUE.on(YUQ('.show-inline-comments'),'change',function(e){
150 var show = 'none';
150 var show = 'none';
151 var target = e.currentTarget;
151 var target = e.currentTarget;
152 if(target == null){
153 target = this;
154 }
152 if(target.checked){
155 if(target.checked){
153 var show = ''
156 var show = ''
154 }
157 }
@@ -165,6 +168,9
165
168
166 YUE.on(YUQ('.line'),'click',function(e){
169 YUE.on(YUQ('.line'),'click',function(e){
167 var tr = e.currentTarget;
170 var tr = e.currentTarget;
171 if(tr == null){
172 tr = this;
173 }
168 injectInlineForm(tr);
174 injectInlineForm(tr);
169 });
175 });
170
176
General Comments 0
You need to be logged in to leave comments. Login now