Skip to content

Commit

Permalink
[new-owner-report] revert highlight trigger to onclick
Browse files Browse the repository at this point in the history
and use Windows libwebkit1-compatible javascript
  • Loading branch information
christopherlam committed Feb 15, 2020
1 parent 3ac60ed commit 555a467
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions gnucash/report/business-reports/new-owner-report.scm
Expand Up @@ -63,18 +63,22 @@
(define javascript "
<script>
function getID(cell) { return cell.getAttribute('link-id'); }
function mousedown(e) {
var id = getID(e.target);
var ishighlighted = e.target.classList.contains('highlight');
e.preventDefault ();
TDs.forEach(TD => TD.classList.remove('highlight'));

function clicky() {
var id = getID(this);
var ishighlighted = this.classList.contains('highlight');
TDs.forEach (function (item, idx) {
item.classList.remove('highlight')});
if (ishighlighted) return;
TDs
.filter (TD => getID(TD) == id)
.forEach (TD => TD.classList.add('highlight'));}
TDs.forEach (function (item, idx) {
if (getID(item) == id)
item.classList.add('highlight')})}

var TDs = document.getElementsByTagName('td');
TDs = [...TDs].filter(getID);
TDs.forEach(TD => TD.onmousedown = mousedown);
TDs = Array.prototype.slice.call (TDs);
TDs = TDs.filter (getID);
TDs.forEach(function (item, idx) {
item.addEventListener('click', clicky)});
</script>
")

Expand Down

0 comments on commit 555a467

Please sign in to comment.