Skip to content

Commit

Permalink
Add support for skipping redirection url filtering within same domain
Browse files Browse the repository at this point in the history
Uses tldjs for domain name parsing.

implements #29
  • Loading branch information
tumpio committed Aug 17, 2018
1 parent 393ba5c commit 2ef925d
Show file tree
Hide file tree
Showing 41 changed files with 2,250 additions and 2,290 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ node_modules
coverage/
coverage.lcov
*.min.css

lib/tldjs/tld.js
3 changes: 3 additions & 0 deletions _locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -507,5 +507,8 @@
},
"report_bug_request_feature": {
"message": "Report bug/Request feature"
},
"skip_within_same_domain": {
"message": "Skip within same domain"
}
}
4 changes: 2 additions & 2 deletions lib/ImportExport.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @returns {Promise.<TResult>}
*/

function exportObject(name, object, replacer) {
export function exportObject(name, object, replacer) {
let mimeType = "application/json",
data = JSON.stringify(object, replacer, 2),
blob = new Blob([data], {type: mimeType});
Expand All @@ -26,7 +26,7 @@ function exportObject(name, object, replacer) {
* @param file json file
* @returns {Promise}
*/
function importFile(file) {
export function importFile(file) {
let reader = new FileReader();
return new Promise((resolve, reject) => {
reader.onload = function (e) {
Expand Down
2 changes: 1 addition & 1 deletion lib/OptionsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Options manager for WebExtensions local storage API
*/
function OptionsManager() {
export function OptionsManager() {
}

OptionsManager.prototype.saveOption = function (option, value) {
Expand Down
23 changes: 14 additions & 9 deletions lib/bootstrapHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,21 @@
* Helper functions for Bootstrap components.
*/

function onToggleButtonChange(e) {
export function onToggleButtonChange(e) {
setButtonChecked(e.target, e.target.checked);
}

function setButtonChecked(button, checked) {
button.checked = checked;
button.parentNode.classList.toggle("active", checked);
export function setButtonChecked(button, checked) {
button.checked = checked === true;
button.parentNode.classList.toggle("active", checked === true);
}

function toggleHidden(hidden) {
export function setButtonDisabled(button, disabled) {
button.disabled = disabled === true;
button.parentNode.classList.toggle("disabled", disabled === true);
}

export function toggleHidden(hidden) {
let hiddenClass = "d-none";
if (typeof hidden === "boolean") {
for (let i = 1; i < arguments.length; i++) {
Expand All @@ -27,7 +32,7 @@ function toggleHidden(hidden) {
}
}

function toggleDisabled(disabled) {
export function toggleDisabled(disabled) {
if (typeof disabled === "boolean") {
for (let i = 1; i < arguments.length; i++) {
arguments[i].disabled = disabled;
Expand All @@ -37,7 +42,7 @@ function toggleDisabled(disabled) {
}
}

function getSubPage(url) {
export function getSubPage(url) {
let request = new Request(url, {
method: "GET",
headers: {
Expand All @@ -53,7 +58,7 @@ function getSubPage(url) {
});
}

function changeTab(tab) {
export function changeTab(tab) {
let tabInfo = tab.split("#");
let tabSelector = document.querySelector(".tab-selector[data-tab=" + tabInfo[0] + "]");
if (!tabSelector || tabSelector.classList.contains("active")) {
Expand All @@ -72,7 +77,7 @@ function changeTab(tab) {
}
}

function setTabFromHash() {
export function setTabFromHash() {
let hash = window.location.hash;
if (hash.startsWith("#tab-")) {
changeTab(hash.substring(5));
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* attributes on DOMContentLoaded.
* @param documentNode
*/
function translateDocument(documentNode) {
export function translateDocument(documentNode) {
let textNodes = documentNode.querySelectorAll("[data-i18n]");
let titleNodes = documentNode.querySelectorAll("[data-i18n-title]");
let placeholderNodes = documentNode.querySelectorAll("[data-i18n-placeholder]");
Expand Down
2 changes: 1 addition & 1 deletion lib/tags-input
Submodule tags-input updated 1 files
+1 −1 src/tags-input.js
13 changes: 13 additions & 0 deletions lib/tldjs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright (c) 2017 Thomas Parisot

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion lib/toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @constructor
*/

function Toc(documentNode) {
export function Toc(documentNode) {
this.tree = new TocBlock("H2");
let headers = documentNode.querySelectorAll("h2, h3, h4, h5, h6");
let lastBlock = this.tree;
Expand Down
2 changes: 1 addition & 1 deletion lib/uuid.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function uuid() {
export function uuid() {
let hex = [];

for (let i = 0; i < 256; i++) {
Expand Down
8 changes: 1 addition & 7 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@
"default_popup": "src/popup/browser-action.html"
},
"background": {
"scripts": [
"src/RequestControl.js",
"lib/uuid.js",
"src/migrate.js",
"src/install.js",
"src/background.js"
]
"page": "src/background.html"
}
}
Loading

0 comments on commit 2ef925d

Please sign in to comment.