Commit 24e2f3aa authored by Arthur Edelstein's avatar Arthur Edelstein Committed by Georg Koppen
Browse files

Bug 20614: Add links to Tor Browser User Manual

parent 745c80d9
......@@ -241,7 +241,18 @@ window.addEventListener("pageshow", function() {
<div class="bubble">
<h1>&aboutTor.whatnextQuestion.label;</h1>
<p>&aboutTor.whatnextAnswer.label;</p>
<a class="tips" href="&aboutTor.whatnext.link;">&aboutTor.whatnext.label;</a>
<ul>
<li>
<a href="&aboutTor.whatnext.link;">
&aboutTor.whatnext.label;
</a>
</li>
<li class="showForManual">
<a href="&aboutTor.torbrowser_user_manual.link;">
&aboutTor.torbrowser_user_manual.label;
</a>
</li>
</ul>
</div>
<div class="bubble">
......
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- Mode: HTML -*- -->
<!-- Bug 18905: Hide unused help menu items -->
<!DOCTYPE overlay SYSTEM "chrome://torbutton/locale/torbutton.dtd">
<overlay id="torbutton-menu-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<menupopup id="menu_HelpPopup">
<!-- Bug 18905: Hide unused help menu items -->
<menuitem id="menu_openHelp" removeelement="true"/>
<menuitem id="menu_openTour" removeelement="true"/>
<menuitem id="healthReport" removeelement="true"/>
......@@ -14,5 +16,12 @@
<!-- dummy elements to avoid 'getElementById' errors -->
<box id="menu_HelpPopup_reportPhishingtoolmenu"/>
<box id="menu_HelpPopup_reportPhishingErrortoolmenu"/>
<!-- Add Tor Browser manual link -->
<menuitem name="torBrowserUserManual"
id="torBrowserUserManual"
position="1"
label="&torbutton.torbrowser_user_manual.label;"
accesskey="&torbutton.torbrowser_user_manual.accesskey;"
oncommand="torbutton_open_torbrowser_user_manual()" />
</menupopup>
</overlay>
......@@ -12,6 +12,7 @@ let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
let { showDialog } = Cu.import("resource://torbutton/modules/utils.js", {});
let { unescapeTorString } = Cu.import("resource://torbutton/modules/utils.js", {});
let SecurityPrefs = Cu.import("resource://torbutton/modules/security-prefs.js", {});
let { bindPrefAndInit } = Cu.import("resource://torbutton/modules/utils.js", {});
const k_tb_last_browser_version_pref = "extensions.torbutton.lastBrowserVersion";
const k_tb_browser_update_needed_pref = "extensions.torbutton.updateNeeded";
......@@ -362,7 +363,7 @@ function torbutton_init() {
window.addEventListener("aftercustomization", function() {
torbutton_update_all_abouttor_pages(undefined, undefined);
}, false);
//setting up context menu
//var contextMenu = document.getElementById("contentAreaContextMenu");
//if (contextMenu)
......@@ -399,6 +400,8 @@ function torbutton_init() {
quantizeBrowserSize(window, 100, 100);
torbutton_init_user_manual_links();
torbutton_log(3, 'init completed');
}
......@@ -630,6 +633,11 @@ function torbutton_update_abouttor_doc(aDoc, aTorOn, aUpdateNeeded) {
else
aDoc.body.removeAttribute("torNeedsUpdate");
if (torbutton_show_torbrowser_manual())
aDoc.body.setAttribute("showmanual", "yes");
else
aDoc.body.removeAttribute("showmanual");
// Display product name and TBB version.
try {
const kBrandBundle = "chrome://branding/locale/brand.properties";
......@@ -2437,5 +2445,26 @@ function torbutton_update_noscript_button()
}, 0);
}
// Opens the Tor Browser User Manual in a new tab
function torbutton_open_torbrowser_user_manual() {
gBrowser.selectedTab = gBrowser.addTab("https://tb-manual.torproject.org");
}
// Returns true if we should show the tor browser manual.
function torbutton_show_torbrowser_manual() {
let locale = torbutton_get_general_useragent_locale();
return locale.startsWith("en");
}
// Makes sure the item in the Help Menu and the link in about:tor
// for the Tor Browser User Manual are only visible when
// torbutton_show_torbrowser_manual() returns true.
function torbutton_init_user_manual_links() {
let menuitem = document.getElementById("torBrowserUserManual");
bindPrefAndInit("general.useragent.locale", val => {
menuitem.hidden = !torbutton_show_torbrowser_manual();
torbutton_update_all_abouttor_pages(undefined, undefined);
});
}
//vim:set ts=4
......@@ -32,6 +32,8 @@
<!ENTITY aboutTor.whatnextAnswer.label "Tor is NOT all you need to browse anonymously! You may need to change some of your browsing habits to ensure your identity stays safe.">
<!ENTITY aboutTor.whatnext.label "Tips On Staying Anonymous »">
<!ENTITY aboutTor.whatnext.link "https://www.torproject.org/download/download.html.en#warning">
<!ENTITY aboutTor.torbrowser_user_manual.label "Tor Browser User Manual »">
<!ENTITY aboutTor.torbrowser_user_manual.link "https://tb-manual.torproject.org">
<!ENTITY aboutTor.helpInfo1.label "You Can Help!">
<!ENTITY aboutTor.helpInfo2.label "There are many ways you can help make the Tor Network faster and stronger:">
<!ENTITY aboutTor.helpInfo3.label "Run a Tor Relay Node »">
......
......@@ -59,3 +59,5 @@
<!ENTITY torbutton.prefs.sec_webfonts_desc "Some fonts and icons may display incorrectly.">
<!ENTITY torbutton.prefs.sec_webfonts_desc_tooltip "Website-provided font files are blocked.">
<!ENTITY torbutton.circuit_display.title "Tor circuit for this site">
<!ENTITY torbutton.torbrowser_user_manual.label "Tor Browser User Manual">
<!ENTITY torbutton.torbrowser_user_manual.accesskey "M">
......@@ -132,6 +132,10 @@ body[toron] .top h1 {
color: #600060;
}
body:not([showmanual]) .showForManual {
display: none;
}
div.hideIfTorIsUpToDate,
body .top div.hideIfTorIsUpToDate h1 {
color: black;
......@@ -201,11 +205,6 @@ body .top div.hideIfTorIsUpToDate h1.hideIfTorOff {
margin-bottom: 10px;
}
#middle a.tips {
display: block;
margin-top: 1.6em;
}
#middle ul {
padding: 5px 0 0 22px;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment