Skip to content

Commit 6164c9c

Browse files
author
Павел Ахметчанов
committed
fixed syntax by comments from @davakh
1 parent 8b75649 commit 6164c9c

File tree

1 file changed

+23
-25
lines changed

1 file changed

+23
-25
lines changed

src/person-limits/PersonLimits.js

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export default class extends PageModification {
122122
this.avatarsList.id = 'avatars-limits';
123123
this.avatarsList.innerHTML = html;
124124

125-
this.avatarsList.onclick = this.onClickByAvatar();
125+
this.addEventListener(this.avatarsList, 'click', this.onClickAvatar);
126126
document.querySelector('#subnav-title').insertBefore(this.avatarsList, null);
127127
}
128128

@@ -135,31 +135,29 @@ export default class extends PageModification {
135135
});
136136
}
137137

138-
onClickByAvatar() {
139-
return event => {
140-
const name = event.target.title;
141-
const cardsNodeList = document.querySelectorAll('.ghx-issue');
142-
const cards = Array.from(cardsNodeList);
143-
let cardsVisibility = event.target.getAttribute('view-my-cards');
144-
145-
if (cardsVisibility !== 'none') {
146-
cardsVisibility = 'none';
147-
event.target.setAttribute('view-my-cards', cardsVisibility);
148-
event.target.style.border = 'solid 1px red';
149-
} else {
150-
cardsVisibility = 'block';
151-
event.target.setAttribute('view-my-cards', cardsVisibility);
152-
event.target.style.border = 'none';
153-
}
138+
onClickAvatar(event) {
139+
const name = event.target.title;
140+
const cardsNodeList = document.querySelectorAll('.ghx-issue');
141+
const cards = Array.from(cardsNodeList);
142+
let cardsVisibility = event.target.getAttribute('view-my-cards');
143+
144+
if (cardsVisibility !== 'none') {
145+
cardsVisibility = 'none';
146+
event.target.setAttribute('view-my-cards', cardsVisibility);
147+
event.target.style.border = 'solid 1px red';
148+
} else {
149+
cardsVisibility = 'block';
150+
event.target.setAttribute('view-my-cards', cardsVisibility);
151+
event.target.style.border = 'none';
152+
}
154153

155-
cards
156-
.filter(n => !n.querySelector(`[data-tooltip="Assignee: ${name}"]`))
157-
.forEach(n => {
158-
if (n instanceof HTMLElement) {
159-
n.style.display = cardsVisibility;
160-
}
161-
});
162-
};
154+
cards
155+
.filter(n => !n.querySelector(`[data-tooltip="Assignee: ${name}"]`))
156+
.forEach(n => {
157+
if (n instanceof HTMLElement) {
158+
n.style.display = cardsVisibility;
159+
}
160+
});
163161
}
164162

165163
hasCustomSwimlines() {

0 commit comments

Comments
 (0)