Skip to content

Commit

Permalink
naming consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
ritwickdey committed May 17, 2018
1 parent 50b8d6d commit 4f5d293
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

'use strict';

const SETUP_STRING = 'live-reload-extension-new-setup';
const SETUP_STRING = 'live-reload-extension-new-setup-v2';

function sendMsgToAllContainPage(req, data) {
chrome.tabs.query({}, tabs => {
Expand Down
4 changes: 2 additions & 2 deletions popup/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

<div class="row">
<div>
<input type="checkbox" id="proxyCheckBox">
<label for="proxyCheckBox">I don't want proxy setup</label>
<input type="checkbox" id="noProxyCheckBox">
<label for="noProxyCheckBox">I don't want proxy setup</label>
</div>
</div>

Expand Down
15 changes: 8 additions & 7 deletions popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'use strict';

const liveReloadCheck = document.getElementById('liveReloadCheck');
const proxyCheckBox = document.getElementById('proxyCheckBox');
const noProxyCheckBox = document.getElementById('noProxyCheckBox');
const actualServerAddress = document.getElementById('actualServer');
const liveServerAddress = document.getElementById('liveServer');
const submitBtn = document.getElementById('submitBtn');
Expand All @@ -13,7 +13,7 @@
function submitForm() {
const formData = {
isEnable: liveReloadCheck.checked,
proxySetup: proxyCheckBox.checked,
proxySetup: !noProxyCheckBox.checked,
actualUrl: actualServerAddress.value || '',
liveServerUrl: liveServerAddress.value || ''
}
Expand All @@ -27,23 +27,24 @@
liveReloadCheck.onclick = () => {
submitForm();
}
proxyCheckBox.onchange = () => {
noProxyCheckBox.onchange = () => {
submitForm();
}

proxyCheckBox.onclick = () => {
serverSetupDiv.className = proxyCheckBox.checked ? 'show' : 'hide';
noProxyCheckBox.onclick = () => {
serverSetupDiv.className = noProxyCheckBox.checked ? 'show' : 'hide';
}

document.addEventListener('DOMContentLoaded', () => {
chrome.runtime.sendMessage({
req: 'get-live-server-config'
}, (data) => {
console.log('popupwidnow')
liveReloadCheck.checked = data.isEnable || false;
proxyCheckBox.checked = data.proxySetup || false;
noProxyCheckBox.checked = data.proxySetup || false;
actualServerAddress.value = data.actualUrl || '';
liveServerAddress.value = data.liveServerUrl || '';
serverSetupDiv.className = proxyCheckBox.checked ? 'show' : 'hide';
serverSetupDiv.className = noProxyCheckBox.checked ? 'show' : 'hide';
});
});

Expand Down

0 comments on commit 4f5d293

Please sign in to comment.