Skip to content

Commit

Permalink
fix DO overlay in FF (#2437)
Browse files Browse the repository at this point in the history
  • Loading branch information
jab authored and bemasc committed May 20, 2016
1 parent e75fdf9 commit e2679ce
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/generic_ui/scripts/content_digitalocean.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
overlay.style.padding = '180px 0 0';

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

var img = document.createElement('img');
img.src = chrome.extension.getURL('icons/cloud/overlay_uproxy_do.svg');
img.src = uProxyAssetAbsoluteUrl('icons/cloud/overlay_uproxy_do.svg');
img.style.width = '218px';
overlay.appendChild(img);

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

var applyButton = document.createElement('button');
applyButton.innerText = 'Apply';
applyButton.textContent = 'Apply';
applyButton.style.backgroundColor = '#155160';
applyButton.style.border = '0';
applyButton.style.borderRadius = '2px';
Expand All @@ -132,7 +132,7 @@
promoInput.style.fontSize = '16px';
resultText.style.color = '#fff';
promoInput.style.margin = '16px auto';
resultText.innerText = ' '; // no-break space
resultText.textContent = ' '; // no-break space
promoContainer.appendChild(resultText);

applyButton.onclick = handleApply;
Expand All @@ -158,7 +158,7 @@
if (typeof data !== 'object' || data.status === 'invalid') {
return handlePromoFailure();
}
resultText.innerText = _('Promo code accepted!');
resultText.textContent = _('Promo code accepted!');
promoInput.disabled = true;
applyButton.disabled = true;
promoInput.style.opacity = '0.5';
Expand All @@ -168,7 +168,7 @@
handlePromoFailure();
});
function handlePromoFailure() {
resultText.innerText = _('Could not apply promo.');
resultText.textContent = _('Could not apply promo.');
}
}
}
Expand Down Expand Up @@ -244,6 +244,15 @@
return false;
}

function uProxyAssetAbsoluteUrl(relativeUrl) {
if (typeof chrome !== 'undefined') {
return chrome.extension.getURL(relativeUrl);
}
// Assume Firefox
// TODO: can we get this from glue.js, which can call self.data.url?
return 'https://rawgit.com/uProxy/uproxy/master/src/' + relativeUrl;
}

(function modifyUI() {
(function hideEls() {
// hide elements for the following selectors on all pages
Expand Down

0 comments on commit e2679ce

Please sign in to comment.