Version 1.3.2.0

+ Fix a problem with the badged_color settings
+ Message for Incognito mode
+ Suggestion #65 implemented
This commit is contained in:
Kevin Röbert
2018-06-19 18:13:44 +02:00
parent d7b30f7f70
commit 71ec21e871
4 changed files with 78 additions and 15 deletions

View File

@@ -86,16 +86,52 @@ function changeSwitchButton(id, storageID)
{
var element = $('#'+id);
changeVisibility(id, storageID);
element.on('change', function(){
core(function (ref){
ref.setData(storageID, element.is(':checked'));
if(storageID == "globalStatus") ref.changeIcon();
changeVisibility(id, storageID);
ref.saveOnExit();
});
});
}
/**
* Change the visibility of sections.
*/
function changeVisibility(id, storageID)
{
var element;
switch(storageID)
{
case "loggingStatus":
element = $('#log_section');
break;
case "statisticsStatus":
element = $('#statistic_section');
break;
default:
element = "undefine";
}
if(element != "undefine")
{
if($('#'+id).is(':checked'))
{
element.css('display', '');
element.css('display', '');
}
else {
element.css('display', 'none');
element.css('display', 'none');
}
}
}
/**
* Set the value of a switch button.
* @param {string} id HTML id
@@ -122,17 +158,31 @@ function resetGlobalCounter(){
});
}
getData();
if(!browser.extension.inIncognitoContext)
{
getData();
}
$(document).ready(function(){
init();
$('#reset_counter_btn').on("click", resetGlobalCounter);
changeSwitchButton("globalStatus", "globalStatus");
changeSwitchButton("tabcounter", "badgedStatus");
changeSwitchButton("logging", "loggingStatus");
changeSwitchButton("statistics", "statisticsStatus");
$('#loggingPage').attr('href', browser.extension.getURL('./html/log.html'));
$('#settings').attr('href', browser.extension.getURL('./html/settings.html'));
setText();
if(!browser.extension.inIncognitoContext)
{
init();
$('#reset_counter_btn').on("click", resetGlobalCounter);
changeSwitchButton("globalStatus", "globalStatus");
changeSwitchButton("tabcounter", "badgedStatus");
changeSwitchButton("logging", "loggingStatus");
changeSwitchButton("statistics", "statisticsStatus");
$('#loggingPage').attr('href', browser.extension.getURL('./html/log.html'));
$('#settings').attr('href', browser.extension.getURL('./html/settings.html'));
setText();
} else {
$('#config_section').remove();
$('#statistic_section').remove();
$('#status_section').remove();
$('#log_section').remove();
$('#incognito').css('display', '');
}
});
/**

View File

@@ -45,6 +45,8 @@ function save()
{
core(function (ref){
ref.setData('badged_color', $('input[name=badged_color]').val());
ref.setBadgedStatus();
ref.setData('ruleURL', $('input[name=rule_url]').val());
ref.setData('hashURL', $('input[name=hash_url]').val());
ref.saveOnExit();