File: options.html

package info (click to toggle)
flashproxy 1.7-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 928 kB
  • ctags: 874
  • sloc: python: 3,708; sh: 819; makefile: 243; lisp: 15
file content (166 lines) | stat: -rw-r--r-- 4,067 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
body {
	font-family: Calibri, Arial, sans-serif;
	font-size: small;
	background-color: #E7D19A;
	text-align: center;
}
.content {
	width: 760px;
	margin: 0 auto;
	background-color: white;
	text-align: left;
	border-style: solid;
	border-width: 1px;
	border-color: #D0A760;
}
h1 {
	padding: 18px 7px;
	margin: 0 auto;
	background-color: #900;
	color: white;
	font-size: 200%;
	font-weight: bold;
}
p {
	margin: 7px;
}
button {
	margin: 0px 7px 7px;
}
#badge-state {
	font-size: 36px;
	text-align: center;
	padding: 10px 0;
	margin: 0;
	color: white;
}
#badge-state { display: none; }
</style>
<title>Flash proxy options</title>
</head>
<body>
<div class="content">
<div>
<h1>Flash proxy options</h1>
<p>
This page enables you to use your web browser as a proxy to help
censored Internet users. When you click yes, your browser will act as a
censorship circumvention proxy as long as you are viewing a page with
the flash proxy badge.
</p>
<p>
<a href="http://crypto.stanford.edu/flashproxy/">For more information on this system click here</a>.
</p>
<p>Do you want your browser to act as a proxy?</p>
</div>
<noscript>
<p>
While JavaScript is disabled, your computer will not be a proxy. Enable
JavaScript to change your options.
</p>
</noscript>
<div id="buttons" style="display: none;">
  <button onclick="set_allowed()">Yes</button>
  <button onclick="set_disallowed()">No</button>
</div>
<div id="badge-state">
  <p id="inactive">Proxy disabled</p>
  <p id="active">Proxy enabled</p>
</div>
<div id="cookies_disabled" style="display: none;">
<p>
It seems your browser has cookies disabled. You will need to enable them
in order to set flash proxy settings.
</p>
</div>
</div>
<script type="text/javascript">

var COOKIE_NAME = "flashproxy-allow";
/* max-age is not supported in IE. */
var COOKIE_LIFETIME = "Thu, 01 Jan 2038 00:00:00 GMT";

function set_cookie_allowed() {
    document.cookie = COOKIE_NAME + "=1 ;path=/ ;expires=" + COOKIE_LIFETIME;
}

function set_cookie_disallowed() {
    document.cookie = COOKIE_NAME + "=0 ;path=/ ;expires=" + COOKIE_LIFETIME;
}

function set_allowed() {
    set_cookie_allowed();
    refresh();
}

function set_disallowed() {
    set_cookie_disallowed();
    refresh();
}

function parse_cookie_string(cookies) {
    var strings;
    var result;

    result = {};
    if (cookies)
        strings = cookies.split(";");
    else
        strings = [];
    for (var i = 0; i < strings.length; i++) {
        var string = strings[i];
        var j, name, value;

        j = string.indexOf("=");
        if (j === -1) {
            return null;
        }
        name = decodeURIComponent(string.substr(0, j).trim());
        value = decodeURIComponent(string.substr(j + 1).trim());

        if (!(name in result))
             result[name] = value;
    }

    return result;
}

/* Returns the value of the cookie, or undefined
   if the cookie is not present. */
function read_cookie() {
    var cookies = parse_cookie_string(document.cookie);
    return cookies[COOKIE_NAME];
}

/* Updates the text telling the user what his current setting is.*/
function refresh() {
    var value = read_cookie();

    if (value === undefined || value === "1") {
        document.getElementById("active").style.display = "block";
        document.getElementById("inactive").style.display = "none";
        document.getElementById("badge-state").style.backgroundColor = "darkgreen";
    } else {
        document.getElementById("inactive").style.display = "block";
        document.getElementById("active").style.display = "none";
        document.getElementById("badge-state").style.backgroundColor = "red";
    }
}

window.onload = function() {
    if (navigator.cookieEnabled) {
        document.getElementById("buttons").style.display = "block";
        document.getElementById("badge-state").style.display = "block";
        refresh();
    } else {
        document.getElementById("cookies_disabled").style.display = "block";
    }
}
</script>
</body>
</html>