Commit e0ffbda7 authored by Thomas Rientjes's avatar Thomas Rientjes
Browse files

Add project files

parent 05a43050
*.xpi
\ No newline at end of file
.jpmignore
.gitignore
*.xpi
test
.git
content tor-browser-settings chrome/
/**
* Element Selectors
*/
a {
color: #555;
font-weight: 500;
}
body {
background-color: #fafafa;
font-family: "Roboto", Helvetica, sans-serif;
margin: 0;
padding: 0;
}
h1 {
font-size: 19px;
font-weight: 500;
padding: 22px 0;
}
h2 {
font-size: 19px;
font-weight: 500;
padding: 20px 0;
}
header {
background-color: #32373b;
color: #fafafa;
padding: 0 15px;
}
/**
* Attribute Selectors
*/
[data-active='true'] {
font-weight: 500;
}
[data-hidden='true'] {
display: none;
}
/**
* Class Selectors
*/
.title {
margin: 0;
}
.settings-container {
display: flex;
flex-direction: column;
margin: 20px 0;
padding: 0 20px;
}
.settings-item {
margin: 20px 0;
}
.notice {
background-color: #fff;
box-shadow: 4px 4px 4px #efefef;
border-top: 5px solid #ededed;
padding: 15px;
}
.footnote {
margin: 0;
text-align: right;
width: 100%
}
.slider-input {
background: none;
border: none;
width: 100%;
margin: 0;
}
.slider-legend {
display: flex;
justify-content: space-between;
width: 100%;
margin: 0;
}
.slider-legend-item {
width: 85px;
}
.selected {
font-weight: 500;
}
.text-left {
text-align: left;
}
.text-center {
text-align: center;
}
.text-right {
text-align: right;
}
/**
* Pseudo Selectors
*/
.slider-input::-moz-focus-outer {
border: 0;
}
.slider-input::-moz-range-thumb {
background: #32373b;
border: 0px solid #000000;
border-radius: 25px;
height: 16px;
width: 16px;
}
.slider-input::-moz-range-track {
width: 100%;
height: 4px;
background: #363b40;
border-radius: 25px;
border: 0px solid #000101;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title data-l10n="settings_label"></title>
<link rel="stylesheet" type="text/css" href="css/settings.css">
</head>
<body>
<header>
<h1 class="title" data-l10n="settings_label"></h1>
</header>
<div class="settings-container">
<h2 class="title" data-l10n="security_label"></h2>
<div class="settings-item slider">
<input class="slider-input" type="range" max="2" value="0" id="slider-input" onchange="changed()">
<div class="slider-legend">
<div class="slider-legend-item text-left" data-l10n="standard_label"></div>
<div class="slider-legend-item text-center" data-l10n="safer_label"></div>
<div class="slider-legend-item text-right" data-l10n="safest_label"></div>
</div>
</div>
<div class="settings-item notice">
<div class="notice-body">
<div data-l10n="standard_description"></div>
</div>
</div>
<div class="settings-item notice">
<div class="notice-body">
<div data-l10n="safer_description"></div>
<span data-l10n="safer_list_label"></span>&#58;
<ul style="padding-left: 20px; font-size: 12.5px;">
<li>JavaScript is disabled on non-HTTPS sites.</li>
<li>Audio and video (HTML5 media) are tap-to-play.</li>
<li>Some fonts and math symbols are disabled.</li>
</ul>
</div>
</div>
<div class="settings-item notice">
<div class="notice-body">
<div data-l10n="safest_description"></div>
<span data-l10n="safest_list_label"></span>&#58;
<ul style="padding-left: 20px; font-size: 12.5px;">
<li>JavaScript is disabled by default on all sites.</li>
<li>Audio and video (HTML5 media) are tap-to-play.</li>
<li>Some fonts, icons, math symbols and images are disabled.</li>
</ul>
</div>
</div>
<div class="footnote">
<a href="https://tb-manual.torproject.org/linux/en-US/security-slider.html" target="_blank" data-l10n="learn_more_label"></a>
</div>
</div>
</body>
</html>
/**
* Event Handlers
*/
self.port.once('preferences:initialized', function (details) {
var localizationKeys = Object.keys(details.l10n);
localizationKeys.forEach(function (localizationKey) {
var elements = document.querySelectorAll('[data-l10n="' + localizationKey + '"]');
for (let element of elements) {
element.textContent = details.l10n[localizationKey];
}
});
});
self.port.on('preference:fetched', function () {
// TODO Re-render the user interface.
});
/**
* Private Functions
*/
function fetchPreference (preferenceKey) {
self.port.emit('preference:fetch', preferenceKey);
}
/**
* Emitters
*/
self.port.emit('preference:changed', {
key: 'sliderPosition',
value: 2
});
icon.png

3.09 KB

icon64.png

4.33 KB

settings_label = %s Settings
security_label = Security
standard_label = Standard
standard_description = All %s and website features are enabled.
safer_label = Safer
safer_description = Disables website features that are often dangerous, causing some sites to lose functionality.
safer_list_label = At this safer setting
safest_label = Safest
safest_description = Only allows website features required for static and basic services. These changes affect images, media, and scripts.
safest_list_label = At the safest setting
learn_more_label = Learn More
{
"title": "Tor Browser Settings",
"name": "tor-browser-settings",
"version": "1.0.0",
"description": "Customize Orfox-related settings.",
"main": "src/main.js",
"author": "Thomas Rientjes",
"permissions": {
"private-browsing": true
},
"engines": {
"fennec": ">=38.0a1"
},
"keywords": [
"browser",
"preferences",
"settings",
"tor"
]
}
/**
* Main
*/
'use strict';
/**
* Imports
*/
var { Services } = require('resource://gre/modules/Services.jsm');
var _ = require('sdk/l10n').get;
var pageMod = require('sdk/page-mod');
var self = require("sdk/self");
/**
* Constants
*/
const BROWSER_NAME = 'Orfox';
/**
* Variables
*/
var browserWindow = Services.wm.getMostRecentWindow('navigator:browser');
var browserWindowIdentifier = null;
/**
* Public Functions
*/
exports.main = function () {
pageMod.PageMod({
include: 'chrome://tor-browser-settings/content/settings.html',
contentScriptFile: self.data.url('content-scripts/settings.js'),
contentScriptWhen: 'ready',
onAttach: startListening
});
browserWindowIdentifier = browserWindow.NativeWindow.menu.add({
name: _('settings_label', BROWSER_NAME),
callback: function () {
var tabBrowser = browserWindow.BrowserApp;
tabBrowser.addTab('chrome://tor-browser-settings/content/settings.html', {
selected: true,
parentId: tabBrowser.selectedTab.id
});
}
});
};
exports.onUnload = function () {
// Clean up add-on state.
browserWindow.NativeWindow.menu.remove(browserWindowIdentifier);
};
/**
* Private Functions
*/
function startListening (worker) {
worker.port.emit('preferences:initialized', {
l10n: {
settings_label: _('settings_label', BROWSER_NAME),
security_label: _('security_label'),
standard_label: _('standard_label'),
standard_description: _('standard_description', BROWSER_NAME),
safer_label: _('safer_label'),
safer_description: _('safer_description'),
safest_label: _('safest_label'),
safest_description: _('safest_description'),
learn_more_label: _('learn_more_label')
}
});
worker.port.on('preference:fetch', function (details) {
// TODO Get the preference value using the Add-on SDK.
});
worker.port.on('preference:save', function (details) {
// TODO Persist the preference using the Add-on SDK.
});
}
var main = require("../");
exports["test main"] = function(assert) {
assert.pass("Unit test running!");
};
exports["test main async"] = function(assert, done) {
assert.pass("Asynchronous unit test running!");
done();
};
require("sdk/test").run(exports);
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