1 var proxy_url_form_name = 'poxy_url_form';
2 var proxy_settings_form_name = 'poxy_settings_form';
3 var flags_var_name = 'hl';
5 /* the variables above should match the $config variables in index.php */
7 var alpha1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
8 var alpha2 = 'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM';
9 var alnum = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._';
11 function str_rot13(str)
14 var curLet, curLetLoc;
16 for (var i = 0; i < str.length; i++)
18 curLet = str.charAt(i);
19 curLetLoc = alpha1.indexOf(curLet);
23 window.document.getElementById('proxy_form').action += str.substring(i, str.length)
26 newStr += (curLetLoc < 0) ? curLet : alpha2.charAt(curLetLoc);
34 /* base64 encode code below is not my own, although I did modify it. */
36 function base64_encode(str)
41 for (var i = 0; i < str.length; i += 3)
43 t = Math.min(3, str.length - i);
46 x = str.charCodeAt(i);
47 out += alnum.charAt((x >> 2));
48 out += alnum.charAt(((x & 0X00000003) << 4));
53 x = str.charCodeAt(i);
54 y = str.charCodeAt(i+1);
55 out += alnum.charAt((x >> 2));
56 out += alnum.charAt((((x & 0X00000003) << 4) | (y >> 4)));
57 out += alnum.charAt(((y & 0X0000000f) << 2));
62 x = str.charCodeAt(i);
63 y = str.charCodeAt(i+1);
64 z = str.charCodeAt(i+2);
65 out += alnum.charAt((x >> 2));
66 out += alnum.charAt((((x & 0x00000003) << 4) | (y >> 4)));
67 out += alnum.charAt((((y & 0X0000000f) << 2) | (z >> 6)));
68 out += alnum.charAt((z & 0X0000003f));
75 function submit_form()
77 var url = document.forms[proxy_settings_form_name].url.value;
79 var rotate13 = document.forms[proxy_settings_form_name].elements['ops[]'][5].checked
80 var base64 = document.forms[proxy_settings_form_name].elements['ops[]'][6].checked;
82 for (i = 0; i < document.forms[proxy_settings_form_name].elements['ops[]'].length; i++)
84 flags += (document.forms[proxy_settings_form_name].elements['ops[]'][i].checked == true) ? '1' : '0';
87 document.forms[proxy_url_form_name].elements[flags_var_name].value = flags;
88 document.forms[proxy_url_form_name].target = (document.forms[proxy_settings_form_name].new_window.checked == true) ? '_blank' : '_top';
96 url = base64_encode(url);
99 document.forms[proxy_url_form_name].url_input.value = url;
100 document.forms[proxy_url_form_name].submit();