review changes for user-agent-rewriter

This commit is contained in:
Will Bamberg
2016-01-05 15:29:53 -08:00
parent 315084cf47
commit 34e6689847
4 changed files with 18 additions and 16 deletions

View File

@@ -23,8 +23,6 @@ function rewriteUserAgentHeader(e) {
return {requestHeaders: e.requestHeaders};
}
chrome.runtime.onMessage.addListener(setUaString);
function setUaString(message) {
ua = uaStrings[message.uaString];
function setUaString(uaString) {
ua = uaStrings[uaString];
}

View File

@@ -1,14 +1,19 @@
html, body {
html, body, .ua-choices {
height: 100px;
width: 100px;
margin: 0;
}
.ua-choices {
display: flex;
flex-direction: column;
justify-content: space-around;
}
.ua-choice {
height: 20%;
width: 90%;
margin: 3% auto;
padding: 8% 6% 0 6%;
margin: 0.2em;
padding: 0.2em;
background-color: #E5F2F2;
cursor: pointer;
}

View File

@@ -8,9 +8,11 @@
<body>
<div class="ua-choice">Firefox 41</div>
<div class="ua-choice">Chrome 41</div>
<div class="ua-choice">IE 11</div>
<div class="ua-choices">
<div class="ua-choice">Firefox 41</div>
<div class="ua-choice">Chrome 41</div>
<div class="ua-choice">IE 11</div>
</div>
<script src="choose_ua.js"></script>
</body>

View File

@@ -4,9 +4,6 @@ document.addEventListener("click", function(e) {
}
var chosenUa = e.target.textContent;
chrome.runtime.sendMessage({
"command": "set-user-agent",
"uaString": chosenUa
});
var backgroundPage = chrome.extension.getBackgroundPage();
backgroundPage.setUaString(chosenUa);
});