var lineComments = []; function comment() { if (document.getElementById("CommentBox").style.display=="block") { document.getElementById("CommentBox").style.display="none"; } else { document.getElementById("CommentBox").style.display="block"; document.getElementById("CommentText").focus(); } } function clear_comment() { document.getElementById("CommentText").value = ""; comment(); return true; } function del_line_comment(ev) { var td = ev.target.parentNode; while (td.childNodes.length) { td.removeChild(td.lastChild) } if (td.tagName == "TD") { var tr = td.parentNode; if (td.cellIndex > 1) { /* right cell. check left */ if (tr.cells[1] .getElementsByTagName("TEXTAREA").length == 0) { var tbl = tr.parentNode; tbl.removeChild(tr); } } else { /* left. check right */ if (tr.cells.length > 4 && tr.cells[4].getElementsByTagName("TEXTAREA").length == 0 || tr.cells.length == 2) { var tbl = tr.parentNode; tbl.removeChild(tr); } } } else { var pn = td.parentNode; pn.removeChild(td); } return false; } function add_u_static_comment(line, comments) { var div = document.getElementById(line); var base = document.getElementById("ds"+line) if (!base) { base = document.createElement('DIV'); base.id = 'ds_'+line; base.className = "lineStaticComment"; div.parentNode.insertBefore(base, div); } add_inline_dl(line, base, comments); } function add_udiff_comment(el) { if (el.tagName != "DIV" && el.tagName != "SPAN") return null; while (el && el.parentNode.className != "diff_div") { el = el.parentNode; } if (!el) return null; if (el.previousSibling && el.previousSibling.className == "lineComment") return null; if (el.id.charAt(0) != 'l' && el.id.charAt(0) != 'r' || parseInt(el.id.substr(1)) == NaN) return null; var base = document.createElement('DIV'); base.className = "lineComment"; el.parentNode.insertBefore(base, el); return add_inline_ta(el.id, base); } function add_s_static_comment(line, comments) { // line: [ [ time, author, comment ] var td0 = document.getElementById(line); var left = td0.cellIndex < 2; var tr = td0.parentNode; var tds = tr.getElementsByTagName('TD'); var tag_id = left ? tds[0].id : tds[3].id; if (!tag_id) return null; var tr_new = null; var td = null; var i = 0; if (tr.previousSibling && tr.previousSibling.className == "lineStaticComment") { tds = tr.previousSibling.getElementsByTagName('TD'); td = tds[(left || tr.className != 'tr_diff')?1:4] if (td.getElementsByTagName('DL').length > 0) return null; tr_new = tr.previousSibling; } else { tr_new = document.getElementById('diff_table').insertRow(tr.rowIndex); tr_new.className = 'lineStaticComment'; tr_new.insertCell(i++); /* left line number */ var td1 = tr_new.insertCell(i++); /* comment */ td1.align = "left"; if (tr.className == 'tr_diff') { tr_new.insertCell(i++); /* */ tr_new.insertCell(i++); var td3 = tr_new.insertCell(i++); td3.align = "left"; td = left ? td1:td3; } else { /* comment for both columns*/ td1.colSpan = 5; td = td1; } } return add_inline_dl(line, td, comments); } function add_sdiff_comment(el) { if (el.tagName != "TD" && el.tagName != "SPAN" && el.tagName != "TR") return null; while (el && el.tagName != "TD") { el = el.parentNode; } if (!el) return null; var left = el.cellIndex < 2; while (el && el.tagName != "TR") { el = el.parentNode; } if (!el || el.className == "lineComment") return null; var tds = el.getElementsByTagName('TD'); var tag_id = left ? tds[0].id : tds[3].id; if (!tag_id) return null; var tr = null; var td = null; var i = 0; if (el.previousSibling && el.previousSibling.className == "lineComment") { tds = el.previousSibling.getElementsByTagName('TD'); td = tds[(left || el.className != 'tr_diff')?1:4] if (td.getElementsByTagName('TEXTAREA').length > 0) return null; tr = el.previousSibling; } else { tr = document.getElementById('diff_table').insertRow(el.rowIndex); tr.className = 'lineComment'; tr.insertCell(i++); /* left line number */ var td1 = tr.insertCell(i++); /* comment */ td1.align = "center"; if (el.className == 'tr_diff') { tr.insertCell(i++); /* */ tr.insertCell(i++); var td3 = tr.insertCell(i++); td3.align = "center"; td = left ? td1:td3; } else { /* comment for both columns*/ td1.colSpan = 5; td = td1; } } return add_inline_ta(tag_id, td); } function add_inline_dl(line, base, comments) { // line: [ [ time, author, comment ] comments.sort(function(a,b) { return a[0] > b[0]; }); var dl = document.createElement('DL'); dl.id = "dl_"+line; dl.className = "x"; dl.name = "inline_static_comment"; base.appendChild(dl); var comment; var name = getCookie('rp_name'); for (var i=0; i