Index: desktop-options.js |
=================================================================== |
--- a/desktop-options.js |
+++ b/desktop-options.js |
@@ -533,16 +533,11 @@ |
function findParentData(element, dataName, returnElement) |
{ |
- while (element) |
+ element = element.closest(`[data-${dataName}]`); |
Thomas Greiner
2018/01/18 16:20:46
Nice, I wasn't even aware of this method. :)
|
+ if (element) |
Thomas Greiner
2018/01/18 16:20:46
Detail: We can save one level of indentation by re
a.giammarchi
2018/01/19 17:02:28
Done.
|
{ |
- if (element.hasAttribute("data-" + dataName)) |
- { |
- if (returnElement) |
- return element; |
- return element.getAttribute("data-" + dataName); |
- } |
- |
- element = element.parentElement; |
+ if (returnElement) return element; |
Thomas Greiner
2018/01/18 16:20:46
Detail: We tend to avoid single-line if-statements
a.giammarchi
2018/01/19 11:16:48
to be honest, there's no way I am going to remembe
Thomas Greiner
2018/01/19 13:55:16
Our coding style wasn't written with compatibility
a.giammarchi
2018/01/19 14:16:28
it's good you mentioned that ... 'cause I need a C
a.giammarchi
2018/01/19 17:02:28
Done.
a.giammarchi
2018/01/19 17:02:28
Done.
Thomas Greiner
2018/01/22 13:06:38
That's a very noble approach. I'd be curious to he
|
+ return element.getAttribute(`data-${dataName}`); |
} |
return null; |
} |
@@ -918,10 +913,10 @@ |
{ |
setLinks("enable-acceptable-ads-description", link); |
}); |
- setElementText(E("tracking-warning-1"), "options_tracking_warning_1", |
+ setElementText(E("tracking-warning-1"), "options_tracking_warning_1", |
[getMessage("common_feature_privacy_title"), |
- getMessage("options_acceptableAds_ads_label")]); |
- setElementText(E("tracking-warning-3"), "options_tracking_warning_3", |
+ getMessage("options_acceptableAds_ads_label")]); |
+ setElementText(E("tracking-warning-3"), "options_tracking_warning_3", |
[getMessage("options_acceptableAds_privacy_label")]); |
getDocLink("privacy_friendly_ads", (link) => |
@@ -1295,7 +1290,7 @@ |
updateSubscription(subscription); |
break; |
case "added": |
- let {url, recommended} = subscription; |
+ let {url} = subscription; |
// Handle custom subscription |
if (/^~user/.test(url)) |
{ |