compare text fix

add event javascript
This commit is contained in:
levinsv 2019-12-25 22:31:30 +05:00
parent 1948887f29
commit 3f85d7710f
3 changed files with 58 additions and 4 deletions

Binary file not shown.

View file

@ -237,10 +237,12 @@ label {
.has_difference {
background: #97D397;
width: 1em;
user-select: none;
}
.diff_header, .diff_next {
vertical-align:top;
background: #dedede;
user-select: none;
}
.diff_next {padding-top:2px;}
.diff_remove {background: Pink;}
@ -281,7 +283,59 @@ $tables$
<script>
function c(t)
{
console.log(t.parentNode)
console.log(t.parentNode.parentNode.parentNode)
var myTab= t.parentNode.parentNode.parentNode;
var text='';
var j=t.cellIndex;
console.log('cellIndex='+t.cellIndex);
for (i = 0; i < myTab.rows.length; i++) {
text = text + myTab.rows.item(i).cells.item(j+2).innerText +'\n';
}
var node = document.createElement('textarea');
var selection = document.getSelection();
node.textContent = text;
document.body.appendChild(node);
selection.removeAllRanges();
node.select();
document.execCommand('copy');
selection.removeAllRanges();
document.body.removeChild(node);
alert('SQL copy to clipbord Length: '+text.length);
}
function d(t)
{
console.log(t.parentNode)
var myTab= t.parentNode.parentNode.parentNode;
var text='';
var j=t.cellIndex;
console.log('cellIndex='+t.cellIndex);
for (i = 0; i < myTab.rows.length; i++) {
var sel=myTab.rows.item(i).cells.item(j+1);
// sel.setAttribute("style", "color:grey; user-select: none;");
console.log(sel.style.userSelect);
if (sel.style.userSelect=="") { sel.setAttribute("style", "color:grey; user-select: none;");}
else
{sel.style.userSelect = null; sel.style.color= null;}
//console.log(sel.style)
}
}
</script>
</body></html>

View file

@ -1779,12 +1779,12 @@ std::wstring reportCompareFactory::printdiff(std::wstring str1, std::wstring str
// )&&(!modify)) modify=true;
// ôîðìèðóåì êîëîíêè
//left
tableline+=L"<tr><td class=\"diff_next\"></td>";
tableline+= modify ? L"<td class=\"has_difference\">"+ncur_l+"</td>" : L"<td class=\"diff_header\">"+ncur_l+"</td>";
tableline+=L"<tr><td class=\"diff_next\" onclick=\"c(this)\"></td>";
tableline+= modify ? L"<td class=\"has_difference\" onclick=\"d(this)\">"+ncur_l+"</td>" : L"<td class=\"diff_header\" onclick=\"d(this)\">"+ncur_l+"</td>";
tableline+=L"<td class=\"lineContent\"><pre>"+t_cur_l+"</pre></td>";
// right
tableline+=L"<td class=\"diff_next\"></td>";
tableline+= modify ? L"<td class=\"has_difference\">"+ncur_r+"</td>" : L"<td class=\"diff_header\">"+ncur_r+"</td>";
tableline+=L"<td class=\"diff_next\" onclick=\"c(this)\"></td>";
tableline+= modify ? L"<td class=\"has_difference\" onclick=\"d(this)\">"+ncur_r+"</td>" : L"<td class=\"diff_header\" onclick=\"d(this)\">"+ncur_r+"</td>";
tableline+=L"<td class=\"lineContent\"><pre>"+t_cur_r+"</pre></td>";
tableline+=L"</tr>";