Update Toolbar.js

Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
This commit is contained in:
Juraj Oravec 2019-06-20 20:43:32 +02:00
parent 4a404898ca
commit e214dd08f6
No known key found for this signature in database
GPG Key ID: 63ACB65056BC8D07

View File

@ -34,16 +34,16 @@ function addListeners(){
document.getElementById('style-button').addEventListener("click", toolbarService);
var lightButton = document.getElementById('light-button');
lightButton.addEventListener("click", function(){switchToLight(lightButton);});
lightButton.addEventListener("click", function(){switchToLight();});
var sepiaButton = document.getElementById('sepia-button');
sepiaButton.addEventListener("click", function(){switchToSepia(sepiaButton);});
sepiaButton.addEventListener("click", function(){switchToSepia();});
var darkButton = document.getElementById('dark-button');
darkButton.addEventListener("click", function(){switchToDark(darkButton);});
darkButton.addEventListener("click", function(){switchToDark();});
var serifButton = document.getElementById('serif-button');
serifButton.addEventListener("click", function(){switchToSerif(serifButton);});
serifButton.addEventListener("click", function(){switchToSerif();});
var sansSerifButton = document.getElementById('sans-serif-button');
sansSerifButton.addEventListener("click", function(){switchToSansSerif(sansSerifButton);});
sansSerifButton.addEventListener("click", function(){switchToSansSerif();});
var fontSizePlusButton = document.getElementById('font-size-plus');
fontSizePlusButton.addEventListener("click", fontSizePlus);
@ -62,11 +62,10 @@ function toolbarService(){
element.classList.remove('open');
} else {
element.classList.add('open');
}
}
function switchToLight(item){
function switchToLight(){
document.body.classList.remove('sepia', 'dark');
document.body.classList.add('light');
@ -74,10 +73,10 @@ function switchToLight(item){
for (var j = items.length - 1; j >= 0; j--) {
items[j].classList.remove("selected");
}
item.classList.add('selected');
document.getElementById('light-button').classList.add('selected');
}
function switchToSepia(item){
function switchToSepia(){
document.body.classList.remove('light', 'dark');
document.body.classList.add('sepia');
@ -85,10 +84,10 @@ function switchToSepia(item){
for (var j = items.length - 1; j >= 0; j--) {
items[j].classList.remove("selected");
}
item.classList.add('selected');
document.getElementById('sepia-button').classList.add('selected');
}
function switchToDark(item){
function switchToDark(){
document.body.classList.remove('sepia', 'light');
document.body.classList.add('dark');
@ -96,21 +95,21 @@ function switchToDark(item){
for (var j = items.length - 1; j >= 0; j--) {
items[j].classList.remove("selected");
}
item.classList.add('selected');
document.getElementById('dark-button').classList.add('selected');
}
function switchToSerif(item){
function switchToSerif(){
document.body.classList.remove('sans-serif');
document.body.classList.add('serif');
document.getElementById('sans-serif-button').classList.remove('selected');
item.classList.add('selected');
document.getElementById('serif-button').classList.add('selected');
}
function switchToSansSerif(item){
function switchToSansSerif(){
document.body.classList.remove('serif');
document.body.classList.add('sans-serif');
document.getElementById('serif-button').classList.remove('selected');
item.classList.add('selected');
document.getElementById('sans-serif-button').classList.add('selected');
}
function fontSizePlus(){