Fix direct link click action and simplify conditional href

This commit is contained in:
narcolepticinsomniac 2018-08-24 19:36:26 -04:00 committed by GitHub
parent 5ac7391c17
commit 256bcdcaed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -379,7 +379,8 @@ Object.assign(handleEvent, {
if (prefs.get('popupclick') === 1) { if (prefs.get('popupclick') === 1) {
this.checkbox.dispatchEvent(new MouseEvent('click')); this.checkbox.dispatchEvent(new MouseEvent('click'));
} else { } else {
$('.style-edit-link').click(); const entry = handleEvent.getClickedStyleElement(event);
$('.style-edit-link', entry).click();
} }
event.preventDefault(); event.preventDefault();
}, },
@ -489,7 +490,7 @@ Object.assign(handleEvent, {
event.preventDefault(); event.preventDefault();
getActiveTab() getActiveTab()
.then(activeTab => API.openURL({ .then(activeTab => API.openURL({
url: this.hasAttribute('href') && this.hasAttribute('data-href') === true ? this.dataset.href : this.href || this.dataset.href, url: this.hasAttribute('data-href') ? this.dataset.href : this.href,
index: activeTab.index + 1, index: activeTab.index + 1,
message: tryJSONparse(this.dataset.sendMessage), message: tryJSONparse(this.dataset.sendMessage),
})) }))