Интересно мнение о моем коде
Сори за говнокод
function openhide(){
document.querySelector('.hide_sett_passive').classList.add('hide_sett_active');
document.querySelector('.hide_sett_passive').classList.remove('hide_sett_passive');
}
function closehide(){
document.querySelector('.hide_sett_active').classList.add('hide_sett_passive');
document.querySelector('.hide_sett_active').classList.remove('hide_sett_active');
}
function openprebook(){
document.querySelector('.preblock_passive').classList.add('preblock_active');
document.querySelector('.preblock_passive').classList.remove('preblock_passive');
}
function closeprebook(){
document.querySelector('.preblock_active').classList.add('preblock_passive');
document.querySelector('.preblock_active').classList.remove('preblock_active');
}
function open_prebooksItems1(){
document.querySelector('.preblock_hs_itm1_passive').classList.add('preblock_hs_itm1_active');
document.querySelector('.preblock_hs_itm1_passive').classList.remove('preblock_hs_itm1_passive');
}
function close_prebooksItems1(){
document.querySelector('.preblock_hs_itm1_active').classList.add('preblock_hs_itm1_passive');
document.querySelector('.preblock_hs_itm1_active').classList.remove('preblock_hs_itm1_active');
}
function close_when_all_close(){
document.querySelector('.cl').addEventListener("click", function() {
closehide();
closeprebook();
close_prebooksItems1();
})
}
function MakeActive_hide_sett_passive(){
document.querySelector('.shesterenki').addEventListener("click", function() {
openhide();
});
}
function click_hs_itm1(){
document.querySelector('.hs_itm1').addEventListener("click", function() {
openprebook();
open_prebooksItems1();
});
}
document.addEventListener("DOMContentLoaded", function() {
close_when_all_close();
MakeActive_hide_sett_passive();
click_hs_itm1();
});
import React, { useState } from 'react';
const SelectTaxon = (props) => {
const [isShown, setIsShown] = useState(true);
const toggleFIeldset = () => setIsShown(!isShown);
let selectTaxonCheckbox = props.selectTaxonData.map((input) => (
<InputCheckbox
id={input.id}
htmlFor={input.htmlFor}
title={input.title} />
))
return (
<div className={styles.taxon}>
<h2 className={styles.h2} onClick={toggleFIeldset}>Назва Таксону</h2>
{isShown &&
<fieldset className={styles.fieldset + ' ' + styles.fieldsetActive}>
<legend className={styles.legend}>Охоронний статус</legend>
{selectTaxonCheckbox}
<legend className={styles.legend + ' ' + styles.legendTaxon}>
Джерело даних
</legend>
</fieldset>
}
</div>
)
}
const input = document.querySelector("input");
const button = document.querySelector("button");
button.disabled = true;
input.addEventListener("input", function() {
button.disabled = !this.value.length;
})
const enter = document.querySelector('.sign-in');
const backgroundForm = document.querySelector('.backgroundForm');
const login = document.querySelector('.login');
enter.addEventListener('click', function() {
backgroundForm.classList.toggle('active');
login.classList.toggle('active');
});
const btn = document.querySelector("#btn");
const box1 = document.querySelector("#box1");
const boxText = document.querySelector("#box-text");
const boxBackground = box1.style.backgroundColor;
btn.addEventListener("click", function() {
boxText.innerHTML = `background-color: ${boxBackground}`;
})
$("#btn").click(function() {
$("#box-text").text("background-color: " + $("#box1").css("background-color"));
});
$('.floor').click(function() {
$('.floor, .floorcase').each(function() {
$(this).addClass('fade');
});
});
$(document).mouseup(function(e) {
const floor = $('.floor');
const floorcase = $('.floorcase');
if (floor.has(e.target).length === 0 && floorcase.has(e.target).length === 0) {
floor.removeClass('fade');
floorcase.removeClass('fade');
}
});
document.querySelector(".main__order-items-wrapper").innerHTML(itemResult);
document.querySelector(".main__order-items-wrapper").innerHTML = itemResult;
let newArr =
{
"example": "name",
"word": 12,
"word": "noone",
"word": "2014",
"result": [
{
"name": "Ivan",
"age": "20"
},
{
"name": "OIga",
"age": "30"
}
]
};
let newArr2 = newArr.result.map(el => el.age * 2);
let newArr3 = newArr.result.map(el => {
return {name: el.name, age: el.age * 2};
});
console.log(newArr2);
console.log(newArr3);