Add PAC sandbox page for debug

This commit is contained in:
Ilya Ig. Petrov 2016-11-19 02:52:55 -08:00
parent ae8dd6676d
commit 4d7ef86f4e
7 changed files with 88 additions and 4 deletions

View File

@ -35,8 +35,8 @@
input:checked ~ .checked-radio-panel {
display: inline;
}
.button-panel {
margin-top: 1em;
footer {
margin: 2em 1em 1em;
}
</style>
</head>
@ -48,9 +48,10 @@
Обновлялись: <span class="update-date">...</span>
</div>
<div id="status">Загрузка...</div>
<div class="button-panel">
<footer>
<input type="button" value="Готово" class="close-button">
</div>
<a id="debug-link" href style="float: right; text-decoration: none">Отладка</a>
</footer>
<script src="./index.js"></script>
</body>
</html>

View File

@ -139,4 +139,8 @@ chrome.runtime.getBackgroundPage( backgroundPage => {
if (antiCensorRu.ifFirstInstall)
triggerChosenProvider();
// Debug
document.querySelector('#debug-link').onclick = () => chrome.tabs.create({ url: chrome.extension.getURL('./pages/debug/index.html') });
});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<title>PAC Sandbox</title>
<style type="text/css" media="screen">
html, body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
body {
display: flex;
flex-direction: column;
}
#editor {
width: 100%;
height: 100%;
}
nav {
text-align: center;
}
</style>
</head>
<body>
<nav>
<button id="read-button">READ</button>
<button id="save-button">SAVE</button>
</nav>
<div id="editor">Press READ button.</div>
<script src="./ace.js" type="text/javascript" charset="utf-8"></script>
<script src="./index.js"></script>
</body>
</html>

View File

@ -0,0 +1,29 @@
'use strict';
const editor = ace.edit("editor");
editor.getSession().setMode("ace/mode/javascript");
document.querySelector('#read-button').onclick = () => {
chrome.proxy.settings.get({}, (details) => {
editor.setValue( details.value.pacScript.data );
});
};
document.querySelector('#save-button').onclick = () => {
const config = {
mode: 'pac_script',
pacScript: {
mandatory: false,
data: editor.getValue()
}
};
chrome.proxy.settings.set( {value: config}, () => alert('Saved!') );
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long