>Форум Mozilla Россия http://forum.mozilla-russia.org/index.php >Разработка http://forum.mozilla-russia.org/viewforum.php?id=18 >Не меняются настройки http://forum.mozilla-russia.org/viewtopic.php?id=41732 |
witherok > 10-11-2009 15:21:29 |
Xul файл: скрытый текст Выделить код Код:<?xml version="1.0"?> <overlay xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'> <script type="application/x-javascript" src="Overlay.js"/> <statusbar id="status-bar"> <statusbarpanel id="PBstatusPanel"> <image id="PBProxyCheck" onclick="ProxyBar_Apply();" width="16" height="16" src="chrome://ProxyBar/content/Images/green.png" style="margin-top:-3px"/> <checkbox id="pb_checkbox" label="Use" checked="false"/> <textbox id="PBProxy" width="130" style="margin-top:-7px; margin-bottom:-5px"/> </statusbarpanel> </statusbar> </overlay> js файл скрытый текст Выделить код Код:const pb_prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService); function ProxyBar_Apply() { var proxy = document.getElementById("PBProxy").value.split(':'); var port = parseInt(proxy[1]); pb_prefs.setCharPref("network.proxy.http", myPrxIP[0]); pb_prefs.setIntPref("network.proxy.http_port", myPrxPort); if (document.getElementById("pb_checkbox").checked == true) { pb_prefs.setIntPref("network.proxy.type", 1); } else { pb_prefs.setIntPref("network.proxy.type", 0); } } Простейшая вещь, а настройки не меняются. Ничего просто не происходит при клике на картинку. |
witherok > 10-11-2009 15:57:18 |
Выделить код Код:const pb_prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService); function ProxyBar_Apply() { alert('Start') var proxy = document.getElementById("PBProxy").value.split(':'); alert('1') var port = parseInt(proxy[1]); alert('2') pb_prefs.setCharPref("network.proxy.http", myPrxIP[0]); alert('3') pb_prefs.setIntPref("network.proxy.http_port", myPrxPort); alert('4') alert('Done') if (document.getElementById("pb_checkbox").checked == true) { pb_prefs.setIntPref("network.proxy.type", 1); alert('On') } else { pb_prefs.setIntPref("network.proxy.type", 0); alert('Off') } } Доходит до 2 |
witherok > 10-11-2009 18:07:34 |
Да все, разобрался. |