Skip to content

Commit e2679ce

Browse files
jabbemasc
authored andcommitted
fix DO overlay in FF (#2437)
1 parent e75fdf9 commit e2679ce

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/generic_ui/scripts/content_digitalocean.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
overlay.style.padding = '180px 0 0';
3030

3131
var closeBtn = document.createElement('img');
32-
closeBtn.src = chrome.extension.getURL('icons/cloud/ic_close_white_24dp.svg');
32+
closeBtn.src = uProxyAssetAbsoluteUrl('icons/cloud/ic_close_white_24dp.svg');
3333
closeBtn.style.cursor = 'pointer';
3434
closeBtn.style.position = 'fixed';
3535
closeBtn.style.top = '15px';
@@ -39,12 +39,12 @@
3939
overlay.appendChild(closeBtn);
4040

4141
var img = document.createElement('img');
42-
img.src = chrome.extension.getURL('icons/cloud/overlay_uproxy_do.svg');
42+
img.src = uProxyAssetAbsoluteUrl('icons/cloud/overlay_uproxy_do.svg');
4343
img.style.width = '218px';
4444
overlay.appendChild(img);
4545

4646
var h1 = document.createElement('h1');
47-
h1.innerText = _('Authorize uProxy to connect\u000Awith DigitalOcean');
47+
h1.textContent = _('Authorize uProxy to connect\u000Awith DigitalOcean');
4848
h1.style.color = '#fff';
4949
h1.style.fontFamily = 'Roboto';
5050
h1.style.fontSize = '24px';
@@ -74,7 +74,7 @@
7474
proceedLink.style.fontSize = '16px';
7575
proceedLink.style.fontWeight = 'bold';
7676
proceedLink.style.padding = '16px 36px';
77-
proceedLink.innerText = _('Proceed to uProxy');
77+
proceedLink.textContent = _('Proceed to uProxy');
7878
// This url should close the tab and open the uProxy extension, which
7979
// instructs the user to click 'sign in' after creating the DO account.
8080
// Requires: https://github.com/uproxy/uproxy/tree/bemasc-autoclose
@@ -114,7 +114,7 @@
114114
} catch (e) { }
115115

116116
var applyButton = document.createElement('button');
117-
applyButton.innerText = 'Apply';
117+
applyButton.textContent = 'Apply';
118118
applyButton.style.backgroundColor = '#155160';
119119
applyButton.style.border = '0';
120120
applyButton.style.borderRadius = '2px';
@@ -132,7 +132,7 @@
132132
promoInput.style.fontSize = '16px';
133133
resultText.style.color = '#fff';
134134
promoInput.style.margin = '16px auto';
135-
resultText.innerText = ' '; // no-break space
135+
resultText.textContent = ' '; // no-break space
136136
promoContainer.appendChild(resultText);
137137

138138
applyButton.onclick = handleApply;
@@ -158,7 +158,7 @@
158158
if (typeof data !== 'object' || data.status === 'invalid') {
159159
return handlePromoFailure();
160160
}
161-
resultText.innerText = _('Promo code accepted!');
161+
resultText.textContent = _('Promo code accepted!');
162162
promoInput.disabled = true;
163163
applyButton.disabled = true;
164164
promoInput.style.opacity = '0.5';
@@ -168,7 +168,7 @@
168168
handlePromoFailure();
169169
});
170170
function handlePromoFailure() {
171-
resultText.innerText = _('Could not apply promo.');
171+
resultText.textContent = _('Could not apply promo.');
172172
}
173173
}
174174
}
@@ -244,6 +244,15 @@
244244
return false;
245245
}
246246

247+
function uProxyAssetAbsoluteUrl(relativeUrl) {
248+
if (typeof chrome !== 'undefined') {
249+
return chrome.extension.getURL(relativeUrl);
250+
}
251+
// Assume Firefox
252+
// TODO: can we get this from glue.js, which can call self.data.url?
253+
return 'https://rawgit.com/uProxy/uproxy/master/src/' + relativeUrl;
254+
}
255+
247256
(function modifyUI() {
248257
(function hideEls() {
249258
// hide elements for the following selectors on all pages

0 commit comments

Comments
 (0)