demote getClickedStyle* to its local usage scope
This commit is contained in:
parent
eb0c57d716
commit
db83ce8dc3
|
@ -36,8 +36,6 @@ globals:
|
|||
tDocLoader: false
|
||||
# dom.js
|
||||
onDOMready: false
|
||||
getClickedStyleId: false
|
||||
getClickedStyleElement: false
|
||||
scrollElementIntoView: false
|
||||
animateElement: false
|
||||
$: false
|
||||
|
|
10
dom.js
10
dom.js
|
@ -25,16 +25,6 @@ function onDOMready() {
|
|||
}
|
||||
|
||||
|
||||
function getClickedStyleId(event) {
|
||||
return (getClickedStyleElement(event) || {}).styleId;
|
||||
}
|
||||
|
||||
|
||||
function getClickedStyleElement(event) {
|
||||
return event.target.closest('.entry');
|
||||
}
|
||||
|
||||
|
||||
function scrollElementIntoView(element) {
|
||||
// align to the top/bottom of the visible area if wasn't visible
|
||||
const bounds = element.getBoundingClientRect();
|
||||
|
|
14
popup.js
14
popup.js
|
@ -238,6 +238,14 @@ function createStyleElement({
|
|||
|
||||
Object.assign(handleEvent, {
|
||||
|
||||
getClickedStyleId(event) {
|
||||
return (handleEvent.getClickedStyleElement(event) || {}).styleId;
|
||||
},
|
||||
|
||||
getClickedStyleElement(event) {
|
||||
return event.target.closest('.entry');
|
||||
},
|
||||
|
||||
name(event) {
|
||||
this.checkbox.click();
|
||||
event.preventDefault();
|
||||
|
@ -245,13 +253,13 @@ Object.assign(handleEvent, {
|
|||
|
||||
toggle(event) {
|
||||
saveStyle({
|
||||
id: getClickedStyleId(event),
|
||||
id: handleEvent.getClickedStyleId(event),
|
||||
enabled: this.type == 'checkbox' ? this.checked : this.matches('.enable'),
|
||||
});
|
||||
},
|
||||
|
||||
delete(event) {
|
||||
const id = getClickedStyleId(event);
|
||||
const id = handleEvent.getClickedStyleId(event);
|
||||
const box = $('#confirm');
|
||||
box.dataset.display = true;
|
||||
box.style.cssText = '';
|
||||
|
@ -281,7 +289,7 @@ Object.assign(handleEvent, {
|
|||
},
|
||||
|
||||
indicator(event) {
|
||||
const entry = getClickedStyleElement(event);
|
||||
const entry = handleEvent.getClickedStyleElement(event);
|
||||
const info = template.regexpProblemExplanation.cloneNode(true);
|
||||
$$('#' + info.id).forEach(el => el.remove());
|
||||
$$('a', info).forEach(el => (el.onclick = handleEvent.openURLandHide));
|
||||
|
|
Loading…
Reference in New Issue
Block a user