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