Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Thomas Rientjes
tor-browser-settings
Commits
f29ea6bb
Commit
f29ea6bb
authored
Dec 12, 2016
by
Thomas Rientjes
Browse files
Add logic for selecting existing settings tabs
parent
ba0572f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main.js
View file @
f29ea6bb
...
...
@@ -14,6 +14,14 @@
*/
const
BROWSER_NAME
=
'
Orfox
'
;
/**
* The location of the settings page.
*
* @constant SETTINGS_URI
* @type {String}
*/
const
SETTINGS_URI
=
'
chrome://tor-browser-settings/content/settings.html
'
;
/**
* Application settings module.
*
...
...
@@ -61,12 +69,32 @@ exports.main = function () {
name
:
_
(
'
settings_label
'
,
BROWSER_NAME
),
callback
:
function
()
{
let
tabBrowser
=
chromeWindow
.
BrowserApp
;
let
tabBrowser
,
settingsTab
;
tabBrowser
=
chromeWindow
.
BrowserApp
;
settingsTab
=
null
;
tabBrowser
.
addTab
(
'
chrome://tor-browser-settings/content/settings.html
'
,
{
selected
:
true
,
parentId
:
tabBrowser
.
selectedTab
.
id
tabBrowser
.
tabs
.
some
(
function
(
tab
)
{
if
(
tab
.
browser
.
currentURI
.
spec
===
SETTINGS_URI
)
{
settingsTab
=
tab
;
return
true
;
}
return
false
;
});
if
(
settingsTab
===
null
)
{
tabBrowser
.
addTab
(
SETTINGS_URI
,
{
selected
:
true
,
parentId
:
tabBrowser
.
selectedTab
.
id
});
}
else
{
tabBrowser
.
selectTab
(
settingsTab
);
}
}
});
};
...
...
src/settings.js
View file @
f29ea6bb
...
...
@@ -16,6 +16,14 @@
*/
const
BROWSER_NAME
=
'
Orfox
'
;
/**
* The location of the settings page.
*
* @constant SETTINGS_URI
* @type {String}
*/
const
SETTINGS_URI
=
'
chrome://tor-browser-settings/content/settings.html
'
;
/**
* Can be used to get localization entries by key name.
*
...
...
@@ -50,7 +58,7 @@ var settings = require('sdk/simple-prefs').prefs;
exports
.
initialize
=
function
()
{
pageMod
.
PageMod
({
include
:
'
chrome://tor-browser-settings/content/settings.html
'
,
include
:
SETTINGS_URI
,
contentScriptFile
:
self
.
data
.
url
(
'
content-scripts/settings.js
'
),
contentScriptWhen
:
'
ready
'
,
onAttach
:
startListening
...
...
Thomas Rientjes
@Synzvato
mentioned in issue
#8 (closed)
·
Apr 07, 2017
mentioned in issue
#8 (closed)
mentioned in issue #8
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment