Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <script type="text/javascript">
- var active = false;
- var tor_config = {
- mode: "fixed_servers",
- rules: {
- proxyForHttp: {
- scheme: "http",
- host: "127.0.0.1",
- port: 8118
- },
- proxyForHttps: {
- scheme: "http",
- host: "127.0.0.1",
- port: 8118
- },
- proxyForFtp: {
- scheme: "http",
- host: "127.0.0.1",
- port: 8118
- },
- fallbackProxy: {
- scheme: "socks5",
- host: "127.0.0.1",
- port: 9050
- }
- }
- };
- var default_config = {
- mode: "direct"
- };
- chrome.experimental.proxy.settings.get(
- {'incognito': false},
- function(config)
- {console.log(JSON.stringify(config.value.mode));
- if(config.value.mode == "fixed_servers")
- {
- active = true;
- chrome.browserAction.setBadgeText({text : "TOR" });
- }
- });
- chrome.browserAction.onClicked.addListener(function() {
- var config = active ? default_config : tor_config;
- active = !active;
- var status = active ? "TOR" : "";
- //var icon_url = active ? "/icon_on.png" : "/icon_off.png";
- chrome.experimental.proxy.settings.set(
- {'value': config, 'incognito':false}
- );
- chrome.browserAction.setBadgeText({text : status });
- //chrome.browserAction.setIcon({path: icon_url});
- });
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement