Skip to content

Commit 61aa047

Browse files
zoraconChan Chak Shing
andauthored
Hotfix: EASE interstitial Link Failing for some Locales (EFForg#18737)
* Move network explainer link after paragraph - Moved due to in paragraph translation differs from the text beimg translated in a singular context in some locales - In order to not burden translators the link explainer is moved after paragraph for now * Add conditional if link replace fails Fixes EFForg#18702 * Satisfy linter * Update chromium/pages/cancel/ux.js Co-Authored-By: pipboy96 <pipboy96@protonmail.com> * Update chromium/pages/cancel/ux.js Co-Authored-By: Chan Chak Shing <ccspasu@gmail.com>
1 parent f0dca43 commit 61aa047

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

chromium/pages/cancel/style.css

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,17 @@ h1 img {
2727
}
2828

2929
button {
30-
font-size: 12pt;
31-
font-family: sans-serif;
32-
line-height: 150%;
3330
background-color: #ec1e1e;
3431
border: 1px solid #ec1e1e;
3532
border-radius: 4px;
3633
color: #fff;
3734
cursor: pointer;
3835
padding: 0.5em 1em;
3936
display: block;
40-
float: left;
41-
margin: 0 0.25em 0 0;
37+
float: none;
38+
font-size: 12pt;
39+
margin: 8px 0;
40+
line-height: 150%;
4241
}
4342

4443
button:hover {
@@ -53,6 +52,6 @@ button:last-child {
5352
@media screen and (max-width: 550px) {
5453
button {
5554
width: 100%;
56-
margin: 0 0 0.25em 0;
55+
margin: 8px 0;
5756
}
5857
}

chromium/pages/cancel/ux.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,23 @@ function replaceLink(explainer) {
2020
observer.disconnect();
2121
const linkText = chrome.i18n.getMessage("cancel_he_blocking_network");
2222
const link = document.createElement("a");
23+
link.classList.add("wikilink");
2324
link.href = "https://en.wikipedia.org/wiki/Downgrade_attack";
2425
link.innerText = linkText;
2526
explainer.innerHTML = explainer.innerHTML.replace(linkText, link.outerHTML);
27+
28+
/*
29+
In response to translation of i18n string "cancel_he_blocking_network".
30+
Within context of the paragraph and as a standalone string can be interpreted differently
31+
langauge to language.
32+
33+
So if link fails to swap in replace, this conditional is triggered
34+
*/
35+
if (document.getElementsByClassName("wikilink").length === 0) {
36+
link.innerText = linkText;
37+
explainer.after(link);
38+
}
39+
2640
}
2741

2842
function displayURL() {

0 commit comments

Comments
 (0)