commit 78f505c2139341e71538e77a975f7df9f81189d0 Author: Kathy Brade brade@pearlcrescent.com Date: Thu Mar 26 14:42:20 2015 -0400
Bug 13576: Tor Launcher strips "bridge" from the middle of bridge lines
Change the code that strips "bridge" to work on a line-by-line basis. Do not add a "bridge " prefix when displaying bridge configuration lines. To reduce user confusion, turn off word wrap for the custom bridge textbox. Improve alignment within bridge settings UI. Windows: Increase width of Tor Network Settings wizard slightly so it is more likely that a bridge line with a fingerprint will fit. Mac OS: Use a slightly smaller font within the custom bridge textbox. --- src/chrome/content/network-settings-overlay.xul | 5 ++--- src/chrome/content/network-settings.js | 13 +++++-------- src/chrome/skin/network-settings.css | 10 ++++++++-- 3 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/chrome/content/network-settings-overlay.xul b/src/chrome/content/network-settings-overlay.xul index 03171ec..af9ddf9 100644 --- a/src/chrome/content/network-settings-overlay.xul +++ b/src/chrome/content/network-settings-overlay.xul @@ -79,8 +79,7 @@ oncommand="onBridgeTypeRadioChange()"> <radio id="bridgeRadioDefault" label="&torsettings.useBridges.default;" selected="true" /> - <hbox align="baseline" style="margin-top: -5px"> - <spacer style="width: 1.9em" /> + <hbox id="bridgeDefaultEntry" align="baseline" style="margin-top: -5px"> <label id="defaultBridgeTypeLabel" value="&torsettings.useBridges.type;" control="defaultBridgeType"/> @@ -99,7 +98,7 @@ <vbox id="bridgeCustomEntry"> <label id="bridgeListLabel" style="margin-top:0px;" value="&torsettings.useBridges.label;" control="bridgeList"/> - <textbox id="bridgeList" multiline="true" rows="3" + <textbox id="bridgeList" multiline="true" rows="3" wrap="off" oninput="onCustomBridgesTextInput();" placeholder="&torsettings.useBridges.placeholder;" /> </vbox> diff --git a/src/chrome/content/network-settings.js b/src/chrome/content/network-settings.js index 3277553..e4ebeaa 100644 --- a/src/chrome/content/network-settings.js +++ b/src/chrome/content/network-settings.js @@ -69,6 +69,8 @@ function initDialog() var isWindows = TorLauncherUtil.isWindows; if (isWindows) document.documentElement.setAttribute("class", "os-windows"); + else if (TorLauncherUtil.isMac) + document.documentElement.setAttribute("class", "os-mac");
var forAssistance = document.getElementById("forAssistance"); if (forAssistance) @@ -1305,7 +1307,6 @@ function parseAndValidateBridges(aStr) return null;
var resultStr = aStr; - resultStr = resultStr.replace(/bridge/gi, ""); // Remove "bridge" everywhere. resultStr = resultStr.replace(/\r\n/g, "\n"); // Convert \r\n pairs into \n. resultStr = resultStr.replace(/\r/g, "\n"); // Convert \r into \n. resultStr = resultStr.replace(/\n\n/g, "\n"); // Condense blank lines. @@ -1314,7 +1315,8 @@ function parseAndValidateBridges(aStr) var tmpArray = resultStr.split('\n'); for (var i = 0; i < tmpArray.length; i++) { - let s = tmpArray[i].trim(); // Remove extraneous whitespace. + let s = tmpArray[i].trim(); // Remove extraneous white space. + s = s.replace(/^bridge\s+/i, ""); // Remove "bridge " from start of line. resultArray.push(s); }
@@ -1397,8 +1399,7 @@ function setElemValue(aID, aValue) // Returns true if one or more values were set. function setBridgeListElemValue(aBridgeArray) { - // To be consistent with bridges.torproject.org, pre-pend "bridge" to - // each line as it is displayed in the UI. + // Trim white space and only keep non-empty values. var bridgeList = []; if (aBridgeArray) { @@ -1406,11 +1407,7 @@ function setBridgeListElemValue(aBridgeArray) { var s = aBridgeArray[i].trim(); if (s.length > 0) - { - if (s.toLowerCase().indexOf("bridge") != 0) - s = "bridge " + s; bridgeList.push(s); - } } }
diff --git a/src/chrome/skin/network-settings.css b/src/chrome/skin/network-settings.css index 331ae42..646baa6 100644 --- a/src/chrome/skin/network-settings.css +++ b/src/chrome/skin/network-settings.css @@ -24,7 +24,7 @@ wizard { }
wizard.os-windows { - width: 46em; + width: 49em; height: 41em; }
@@ -99,8 +99,14 @@ wizard[tor_hide_browser_logo="true"] .tbb-logo-separator { display: none; }
+#bridgeDefaultEntry, #bridgeCustomEntry { - margin-left: 30px; + margin-left: 1.8em; +} + +dialog.os-mac #bridgeList, +wizard.os-mac #bridgeList { + font-size: 90%; }
wizardpage[pageid="startingTor"] description,
tor-commits@lists.torproject.org