|
29 | 29 | overlay.style.padding = '180px 0 0'; |
30 | 30 |
|
31 | 31 | 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'); |
33 | 33 | closeBtn.style.cursor = 'pointer'; |
34 | 34 | closeBtn.style.position = 'fixed'; |
35 | 35 | closeBtn.style.top = '15px'; |
|
39 | 39 | overlay.appendChild(closeBtn); |
40 | 40 |
|
41 | 41 | 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'); |
43 | 43 | img.style.width = '218px'; |
44 | 44 | overlay.appendChild(img); |
45 | 45 |
|
46 | 46 | var h1 = document.createElement('h1'); |
47 | | - h1.innerText = _('Authorize uProxy to connect\u000Awith DigitalOcean'); |
| 47 | + h1.textContent = _('Authorize uProxy to connect\u000Awith DigitalOcean'); |
48 | 48 | h1.style.color = '#fff'; |
49 | 49 | h1.style.fontFamily = 'Roboto'; |
50 | 50 | h1.style.fontSize = '24px'; |
|
74 | 74 | proceedLink.style.fontSize = '16px'; |
75 | 75 | proceedLink.style.fontWeight = 'bold'; |
76 | 76 | proceedLink.style.padding = '16px 36px'; |
77 | | - proceedLink.innerText = _('Proceed to uProxy'); |
| 77 | + proceedLink.textContent = _('Proceed to uProxy'); |
78 | 78 | // This url should close the tab and open the uProxy extension, which |
79 | 79 | // instructs the user to click 'sign in' after creating the DO account. |
80 | 80 | // Requires: https://github.com/uproxy/uproxy/tree/bemasc-autoclose |
|
114 | 114 | } catch (e) { } |
115 | 115 |
|
116 | 116 | var applyButton = document.createElement('button'); |
117 | | - applyButton.innerText = 'Apply'; |
| 117 | + applyButton.textContent = 'Apply'; |
118 | 118 | applyButton.style.backgroundColor = '#155160'; |
119 | 119 | applyButton.style.border = '0'; |
120 | 120 | applyButton.style.borderRadius = '2px'; |
|
132 | 132 | promoInput.style.fontSize = '16px'; |
133 | 133 | resultText.style.color = '#fff'; |
134 | 134 | promoInput.style.margin = '16px auto'; |
135 | | - resultText.innerText = ' '; // no-break space |
| 135 | + resultText.textContent = ' '; // no-break space |
136 | 136 | promoContainer.appendChild(resultText); |
137 | 137 |
|
138 | 138 | applyButton.onclick = handleApply; |
|
158 | 158 | if (typeof data !== 'object' || data.status === 'invalid') { |
159 | 159 | return handlePromoFailure(); |
160 | 160 | } |
161 | | - resultText.innerText = _('Promo code accepted!'); |
| 161 | + resultText.textContent = _('Promo code accepted!'); |
162 | 162 | promoInput.disabled = true; |
163 | 163 | applyButton.disabled = true; |
164 | 164 | promoInput.style.opacity = '0.5'; |
|
168 | 168 | handlePromoFailure(); |
169 | 169 | }); |
170 | 170 | function handlePromoFailure() { |
171 | | - resultText.innerText = _('Could not apply promo.'); |
| 171 | + resultText.textContent = _('Could not apply promo.'); |
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
|
244 | 244 | return false; |
245 | 245 | } |
246 | 246 |
|
| 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 | + |
247 | 256 | (function modifyUI() { |
248 | 257 | (function hideEls() { |
249 | 258 | // hide elements for the following selectors on all pages |
|
0 commit comments