root/trunk/uploadr/MacUploadr.app/Contents/Resources/chrome/content/uploadr/proxy.js

Revision 342, 1.9 kB (checked in by calh, 2 years ago)

got the proxy dialog into reasonable shape - much more simple, and it actually works

Line 
1 /*
2  * Flickr Uploadr
3  *
4  * Copyright (c) 2007-2008 Yahoo! Inc.  All rights reserved.  This library is
5  * free software; you can redistribute it and/or modify it under the terms of
6  * the GNU General Public License (GPL), version 2 only.  This library is
7  * distributed WITHOUT ANY WARRANTY, whether express or implied. See the GNU
8  * GPL for more details (http://www.gnu.org/licenses/gpl.html)
9  */
10
11 var gProxyDialog = {
12
13         beforeAccept: function (){
14
15                 var proxyTypePref = document.getElementById("network.proxy.type");
16
17                 if (proxyTypePref.value == 2) {
18                         this.doAutoconfigURLFixup();
19                         return true;
20                 }
21
22                 return true;
23         },
24
25         proxyTypeChanged: function (){
26
27                 var proxyTypePref = document.getElementById("network.proxy.type");
28
29                 document.getElementById("network.proxy.socks").disabled                 = proxyTypePref.value != 1;
30                 document.getElementById("network.proxy.socks_port").disabled            = proxyTypePref.value != 1;
31                 document.getElementById("network.proxy.socks_version").disabled         = proxyTypePref.value != 1;
32                 document.getElementById("network.proxy.autoconfig_url").disabled        = proxyTypePref.value != 2;
33                 document.getElementById("flickr.proxy.disable_reload_button").disabled  = proxyTypePref.value != 2;
34         },
35  
36         readProxyType: function(){
37
38                 this.proxyTypeChanged();
39                 return undefined;
40         },
41
42         reloadPAC: function (){
43
44                 var autoURL = document.getElementById("networkProxyAutoconfigURL");
45                 var pps = Components.classes["@mozilla.org/network/protocol-proxy-service;1"].getService(Components.interfaces.nsPIProtocolProxyService);
46                 pps.configureFromPAC(autoURL.value);
47         },
48
49         doAutoconfigURLFixup: function(){
50
51                 var autoURL = document.getElementById("networkProxyAutoconfigURL");
52                 var autoURLPref = document.getElementById("network.proxy.autoconfig_url");
53                 var URIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"].getService(Components.interfaces.nsIURIFixup);
54
55                 try {
56                         autoURLPref.value = autoURL.value = URIFixup.createFixupURI(autoURL.value, 0).spec;
57                 } catch(ex) {}
58         }
59
60 };
Note: See TracBrowser for help on using the browser.