mirror of
https://gitlab.com/KevinRoebert/ClearUrls
synced 2025-12-15 21:55:36 +07:00
Version 1.9.0
- Added #284 - Added #56 - Fixed #241 - Possible fix & workaround for #203 - Fixed bug in "history tracking injection protection". This option was not disabled, when the global filter switch are on off - Added an option to im-/export the log (requires the `downloads` permission) - Added an option to im-/export the settings (requires the `downloads` permission) - Added information page for blocked sites, when they are called in the `main_frame` - Added "multiple times URL encodes" recognition - Refactoring - Changed background script loading sequence to prevent that required functions are not yet loaded.
This commit is contained in:
@@ -26,7 +26,7 @@ var log = {};
|
||||
* Reset the global log
|
||||
*/
|
||||
function resetGlobalLog(){
|
||||
obj = {"log": []};
|
||||
let obj = {"log": []};
|
||||
|
||||
browser.runtime.sendMessage({
|
||||
function: "setData",
|
||||
@@ -53,11 +53,11 @@ function getLog()
|
||||
return b.timestamp - a.timestamp;
|
||||
});
|
||||
|
||||
var length = Object.keys(log.log).length;
|
||||
var row;
|
||||
if(length != 0)
|
||||
const length = Object.keys(log.log).length;
|
||||
let row;
|
||||
if(length !== 0)
|
||||
{
|
||||
for(var i=0; i<length;i++)
|
||||
for(let i=0; i<length;i++)
|
||||
{
|
||||
row = "<tr>" +
|
||||
"<td>"+log.log[i].before+"</td>" +
|
||||
@@ -81,11 +81,9 @@ function getLog()
|
||||
*/
|
||||
function getDataTableTranslation()
|
||||
{
|
||||
var lang = browser.i18n.getUILanguage();
|
||||
let lang = browser.i18n.getUILanguage();
|
||||
lang = lang.substring(0,2);
|
||||
var file = browser.extension.getURL('./external_js/dataTables/i18n/'+lang+'.lang');
|
||||
|
||||
return file;
|
||||
return browser.extension.getURL('./external_js/dataTables/i18n/' + lang + '.lang');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,6 +94,42 @@ function toDate(time)
|
||||
return new Date(time).toLocaleString();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function export the global log as json file.
|
||||
*/
|
||||
function exportGlobalLog() {
|
||||
browser.runtime.sendMessage({
|
||||
function: "getData",
|
||||
params: ['log']
|
||||
}).then((data) => {
|
||||
let blob = new Blob([JSON.stringify(data.response)], {type: 'application/json'});
|
||||
|
||||
browser.downloads.download({
|
||||
'url': URL.createObjectURL(blob),
|
||||
'filename': 'ClearURLsLogExport.json',
|
||||
'saveAs': true
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This function imports an exported global log and overwrites the old one.
|
||||
*/
|
||||
function importGlobalLog(evt) {
|
||||
let file = evt.target.files[0];
|
||||
let fileReader = new FileReader();
|
||||
|
||||
fileReader.onload = function(e) {
|
||||
browser.runtime.sendMessage({
|
||||
function: "setData",
|
||||
params: ["log", e.target.result]
|
||||
}).then(() => {
|
||||
location.reload();
|
||||
}, handleError);
|
||||
};
|
||||
fileReader.readAsText(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load only when document is ready
|
||||
*/
|
||||
@@ -103,6 +137,8 @@ $(document).ready(function(){
|
||||
setText();
|
||||
getLog();
|
||||
$('#reset_log_btn').on("click", resetGlobalLog);
|
||||
$('#export_log_btn').on("click", exportGlobalLog);
|
||||
$('#importLog').on("change", importGlobalLog);
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -122,12 +158,16 @@ function setText()
|
||||
{
|
||||
document.title = translate('log_html_page_title');
|
||||
$('#page_title').text(translate('log_html_page_title'));
|
||||
$('#reset_log_btn').text(translate('log_html_reset_button'));
|
||||
$('#log_html_reset_button').prop('title', translate('log_html_reset_button_title'));
|
||||
$('#reset_log_btn').text(translate('log_html_reset_button'))
|
||||
.prop('title', translate('log_html_reset_button_title'));
|
||||
$('#head_1').text(translate('log_html_table_head_1'));
|
||||
$('#head_2').text(translate('log_html_table_head_2'));
|
||||
$('#head_3').text(translate('log_html_table_head_3'));
|
||||
$('#head_4').text(translate('log_html_table_head_4'));
|
||||
$('#export_log_btn_text').text(translate('log_html_export_button'));
|
||||
$('#export_log_btn').prop('title', translate('log_html_export_button_title'));
|
||||
$('#import_log_btn_text').text(translate('log_html_import_button'));
|
||||
$('#import_log_btn').prop('title', translate('log_html_import_button_title'));
|
||||
}
|
||||
|
||||
function handleError(error) {
|
||||
|
||||
Reference in New Issue
Block a user