0.0.339
This commit is contained in:
@@ -675,6 +675,7 @@ function open_curtain (left=null,right=null,overlay=null,close=null){
|
||||
let curtain = ''
|
||||
let left_curtain = document.querySelector(".menu_buttons.left")
|
||||
let right_curtain = document.querySelector(".menu_buttons.right")
|
||||
|
||||
if (left || right){
|
||||
if (left){
|
||||
if (left_curtain){
|
||||
@@ -698,28 +699,51 @@ function open_curtain (left=null,right=null,overlay=null,close=null){
|
||||
}
|
||||
} else {
|
||||
curtain = getOpenCurtain()
|
||||
curtain_name = getNameCurtain()
|
||||
curtain_name = getInfoCurtain(null,null,'name')['name']
|
||||
}
|
||||
if (!curtain){
|
||||
curtain = getCurtainWIncreaceZindex(left_curtain,right_curtain)
|
||||
}
|
||||
let body = document.querySelector('body')
|
||||
if (close){
|
||||
// curtain = getOpenCurtain()
|
||||
if (curtain[0]){
|
||||
let type_curt = getTypeOfData(curtain)
|
||||
let handler_text = ''
|
||||
if (type_curt === 'object'){
|
||||
curtain = curtain[0]
|
||||
}
|
||||
handler_text = curtain.querySelector('.text_f_curtain')
|
||||
}
|
||||
if (close){
|
||||
// curtain = getOpenCurtain()
|
||||
|
||||
let handler_text = curtain.querySelector('.text_f_curtain')
|
||||
|
||||
handler_text.innerHTML = curtain_name
|
||||
curtain.classList.remove("open")
|
||||
curtain.classList.add("close")
|
||||
closeOverlay()
|
||||
} else {
|
||||
closeOverlay()
|
||||
|
||||
curtain.classList.toggle("close")
|
||||
curtain.classList.toggle("open")
|
||||
|
||||
newCurtainZIndex()
|
||||
let curtain_check = getOpenCurtain()
|
||||
if (curtain_check.length > 1){
|
||||
let curtain_old = getCurtainWIncreaceZindex(curtain_check,'decreace')['increace']
|
||||
curtain_old.classList.toggle("close")
|
||||
curtain_old.classList.toggle("open")
|
||||
}
|
||||
if (curtain_check.length > 0){
|
||||
let overlay = document.querySelector('.block_overlay.show')
|
||||
if (!overlay){
|
||||
let overlay_clear = document.querySelector(".block_overlay")
|
||||
overlay_clear.classList.toggle('show')
|
||||
overlay_clear.classList.toggle('hidden')
|
||||
}
|
||||
} else {
|
||||
|
||||
closeOverlay()
|
||||
|
||||
}
|
||||
let handler_text = curtain.querySelector('.text_f_curtain')
|
||||
if (curtain.classList.contains('open')){
|
||||
handler_text.innerHTML = 'Закрыть'
|
||||
@@ -762,18 +786,54 @@ function newCurtainZIndex (curtain) {
|
||||
|
||||
}
|
||||
|
||||
function getNameCurtain () {
|
||||
let curtain = getOpenCurtain()
|
||||
let type_curt = getTypeOfData(curtain)
|
||||
if (type_curt === 'object'){
|
||||
curtain = curtain[0]
|
||||
}
|
||||
let dataset = curtain.dataset
|
||||
let name = ''
|
||||
if (dataset){
|
||||
name = dataset['name']
|
||||
return name
|
||||
function getInfoCurtain (curtain,zIndex,name) {
|
||||
let data = {}
|
||||
if (curtain){
|
||||
let type_curt = getTypeOfData(curtain)
|
||||
if (curtain[0] && type_curt === 'object'){
|
||||
curtain = curtain[0]
|
||||
}
|
||||
if (name){
|
||||
let dataset = curtain.dataset
|
||||
let name = ''
|
||||
if (dataset){
|
||||
name = dataset['name']
|
||||
data['name'] = name
|
||||
}
|
||||
}
|
||||
if (zIndex){
|
||||
if (curtain.style.zIndex){
|
||||
data['zIndex'] = curtain.style.zIndex
|
||||
} else{
|
||||
data['zIndex'] = 'z-index not finded'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
let new_curtain = getOpenCurtain()
|
||||
let type_curt = getTypeOfData(new_curtain)
|
||||
if (type_curt === 'object'){
|
||||
new_curtain = new_curtain[0]
|
||||
}
|
||||
if (name){
|
||||
let dataset = new_curtain.dataset
|
||||
let name = ''
|
||||
if (dataset){
|
||||
name = dataset['name']
|
||||
data['name'] = name
|
||||
}
|
||||
}
|
||||
if (zIndex){
|
||||
if (new_curtain.style.zIndex){
|
||||
data['zIndex'] = new_curtain.style.zIndex
|
||||
} else{
|
||||
data['zIndex'] = 'z-index not finded'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
function getOpenCurtain () {
|
||||
@@ -806,4 +866,35 @@ function getOpenCurtain () {
|
||||
function getTypeOfData (data) {
|
||||
let type = typeof data
|
||||
return type
|
||||
}
|
||||
}
|
||||
|
||||
function getCurtainWIncreaceZindex (curtains,decreace) {
|
||||
let first = getInfoCurtain(curtains[0],'zIndex')
|
||||
let second = getInfoCurtain(curtains[1],'zIndex')
|
||||
let el_increace = ''
|
||||
if (first['zIndex'] > second['zIndex']){
|
||||
el_increace = first
|
||||
if (decreace){
|
||||
return {
|
||||
'increace': curtains[0],
|
||||
'decreace': curtains[1]
|
||||
}
|
||||
} else {
|
||||
return curtains[0]
|
||||
}
|
||||
|
||||
}
|
||||
if (second['zIndex'] > first['zIndex']){
|
||||
el_increace = second
|
||||
if (decreace){
|
||||
return {
|
||||
'increace': curtains[1],
|
||||
'decreace': curtains[0]
|
||||
}
|
||||
} else {
|
||||
return curtains[1]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user