first commit
This commit is contained in:
100
templates/instytut_dendrologii_/js/wcagFont.js
Normal file
100
templates/instytut_dendrologii_/js/wcagFont.js
Normal file
@@ -0,0 +1,100 @@
|
||||
window.addEventListener('load', () => {
|
||||
setidAll();
|
||||
// wcagFont();
|
||||
getID();
|
||||
})
|
||||
const fontArray = new Map();
|
||||
function setidAll() {
|
||||
var idall = 0;
|
||||
var bodyhtml = '';
|
||||
var sero = '';
|
||||
document.querySelectorAll('div,a,p,span,table,td,ul,li,input,label,div >*, div p,div a').forEach(items => {
|
||||
idall++;
|
||||
if (items.hasAttribute('id')) {} else {
|
||||
items.setAttribute('id', 'str' + idall);
|
||||
var fontofSet = document.querySelector('#str' + idall).style.getPropertyValue('font-size');
|
||||
fontArray.set('str' + idall, fontofSet);
|
||||
}
|
||||
})
|
||||
}
|
||||
function getID() {
|
||||
console.log(fontArray.get('str22') + "odczytane id str1");
|
||||
}
|
||||
function wcagFont() {
|
||||
var idall = 0;
|
||||
var bodyhtml = '';
|
||||
var sero = '';
|
||||
document.querySelector('.btn-icon-small--medium').addEventListener('click', () => {
|
||||
reset();
|
||||
document.querySelectorAll('div,a,p,table,td,input,label,div >*, div p,div a').forEach(fonts1 => {
|
||||
if (fonts1.hasAttribute('style') && fonts1.style.getPropertyValue('font-size').replaceAll('px', '').replaceAll('rem', '').replaceAll('vw', '').replaceAll('%', '').replaceAll('em', '').replaceAll('vmin', '').replaceAll('vmax', '').replaceAll('vh', '').replaceAll('ex', '') > 0) {
|
||||
var serox = fonts1.style.getPropertyValue('font-size').replaceAll('px', '').replaceAll('rem', '');
|
||||
var serox1 = new Number(serox) + 9;
|
||||
fonts1.style.setProperty('font-size', serox1 + 'px','important');
|
||||
} else {
|
||||
fonts1.style.setProperty('font-size', '101%','important');
|
||||
}
|
||||
})
|
||||
document.querySelectorAll('ul,li').forEach(fonts1 => {
|
||||
fonts1.style.setProperty('font-size', '110%','important');
|
||||
})
|
||||
|
||||
document.querySelectorAll('h1,h2,h3,h4,h5,h6').forEach(hfonts => {
|
||||
hfonts.style.removeProperty('font-size');
|
||||
var serok = window.getComputedStyle(hfonts).getPropertyValue('font-size').replaceAll('px', '').replaceAll('rem', '');
|
||||
var sero1 = new Number(serok) + 10;
|
||||
hfonts.style.setProperty('font-size', sero1 + 'px');
|
||||
})
|
||||
document.querySelectorAll('span').forEach(fonts1 => {
|
||||
fonts1.parentNode.style.removeProperty('font-size');
|
||||
fonts1.style.setProperty('font-size', '120%');
|
||||
})
|
||||
})
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
document.querySelector('.btn-icon-small--large').addEventListener('click', () => {
|
||||
reset();
|
||||
document.querySelectorAll('div,a,p,table,td,input,label,div >*, div p,div a').forEach(fonts => {
|
||||
if (fonts.hasAttribute('style') && fonts.style.getPropertyValue('font-size').replaceAll('px', '').replaceAll('rem', '').replaceAll('vw', '').replaceAll('%', '').replaceAll('em', '').replaceAll('vmin', '').replaceAll('vmax', '').replaceAll('vh', '').replaceAll('ex', '') > 0) {
|
||||
var serox = fonts.style.getPropertyValue('font-size').replaceAll('px', '').replaceAll('rem', '');
|
||||
var serox1 = new Number(serox) + 15;
|
||||
fonts.style.setProperty('font-size', serox1 + 'px','important');
|
||||
} else {
|
||||
fonts.style.setProperty('font-size', '102%','important');
|
||||
}
|
||||
})
|
||||
document.querySelectorAll('ul,li').forEach(fonts1 => {
|
||||
fonts1.style.setProperty('font-size', '110%','important');
|
||||
})
|
||||
|
||||
document.querySelectorAll('h1,h2,h3,h4,h5,h6').forEach(hfonts => {
|
||||
hfonts.style.removeProperty('font-size');
|
||||
var seroh = window.getComputedStyle(hfonts).getPropertyValue('font-size').replaceAll('px', '').replaceAll('rem', '');
|
||||
var sero1 = new Number(seroh) + 15;
|
||||
hfonts.style.setProperty('font-size', sero1 + 'px','important');
|
||||
})
|
||||
document.querySelectorAll('span').forEach(fonts1 => {
|
||||
fonts1.parentNode.style.removeProperty('font-size');
|
||||
fonts1.style.setProperty('font-size', '130%','important');
|
||||
})
|
||||
})
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
document.querySelector('.btn-icon-small--small').addEventListener('click', () => {
|
||||
document.querySelectorAll('div,a,p,span,table,td,h1,h2,h3,h4,h6,ul,li,input,label,div >*, div p,div a,html > *,html ').forEach(fonts2 => {
|
||||
if (fonts2.hasAttribute('style') || fonts2.style.getPropertyValue('font-size').replaceAll('px', '') > 0) {
|
||||
fonts2.style.setProperty('font-size', fontArray.get(fonts2.id),'important');
|
||||
} else {
|
||||
fonts2.style.removeProperty('font-size','important');
|
||||
}
|
||||
})
|
||||
document.querySelectorAll('h1,h2,h3,h4,h5,h6').forEach(hfonts => {
|
||||
hfonts.style.removeProperty('font-size','important');
|
||||
})
|
||||
})
|
||||
console.log(bodyhtml);
|
||||
}
|
||||
function reset() {
|
||||
document.querySelectorAll('div,a,p,span,table,td,h1,h2,h3,h4,h6,ul,li,input,label,div >*, div p,div a,html > *,html ').forEach(fonts2 => {
|
||||
fonts2.style.removeProperty('font-size');
|
||||
fonts2.style.setProperty('font-size', fontArray.get(fonts2.id));
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user