mobile === false

This commit is contained in:
SBD
2023-12-29 12:49:13 +05:00
parent 1dae86f0e7
commit f80e2844bf
2 changed files with 50 additions and 22 deletions

View File

@@ -17,31 +17,52 @@ function middleWareJS(){
let footer = document.querySelector("footer") let footer = document.querySelector("footer")
let body = document.querySelector("body") let body = document.querySelector("body")
let type = getInfoAboutUser() let type = getInfoAboutUser()
if (type !== 'mobile'){ // if (type !== 'mobile'){
if (document.querySelector(".menu_buttons.curtain.left") || window.location.href.includes('support') || window.location.href.includes('chat')){ if (document.querySelector(".menu_buttons.curtain.left") || window.location.href.includes('support') || window.location.href.includes('chat')){
footer.style.display = "none" footer.style.display = "none"
body.style.overflow = "hidden" body.style.overflow = "hidden"
} else { } else {
footer.style.display = "" footer.style.display = ""
body.style.overflow = "" body.style.overflow = ""
}
} }
// }/
} }
function changeTopStrMobile (){ function changeTopStrMobile (){
let body = document.querySelector("body") let body = document.querySelector("body")
if (!window.location.href.includes("mobile")){ // if (!window.location.href.includes("mobile")){
if (!window.location.href.includes("mobile") && !window.location.href.includes("route_search_results")){ // if (!window.location.href.includes("mobile") && !window.location.href.includes("route_search_results")){
window.location.href = window.location.href + `?mobile=${getInfoAboutUser() === 'mobile'}` // window.location.href = window.location.href + `?mobile=${getInfoAboutUser() === 'mobile'}`
} // }
body.style.opacity = '' body.style.opacity = ''
body.style.transition = '500ms' body.style.transition = '500ms'
} else { // } else {
body.style.display = '' body.style.display = ''
body.style.transition = '500ms' body.style.transition = '500ms'
// }
}
function openOrCloseCurtainSupportChat (){
if (window.location.href.includes("support")){
let type_screen = getInfoAboutUser()
let chat_block = document.querySelector(".block-chat")
let name_ticket = document.querySelector(".name_ticket")
let str = 'menu_buttons curtain left'
if (type_screen === 'mobile'){
if (!chat_block){
str = `${str} open`
} else {
str = `${str} close`
}
} else {
str = `${str} open`
}
if (name_ticket){
str = `${str} margin`
}
document.querySelector(".menu_buttons").class = str
} }
} }

View File

@@ -45,13 +45,13 @@ function select_tab_profile (el,url,owner_type=null) {
let confirm_url_f_lang_ru = '' let confirm_url_f_lang_ru = ''
let confirm_url_f_lang_en = '' let confirm_url_f_lang_en = ''
if (owner_type){ if (owner_type){
window.history.pushState(null, null, `/${document.documentElement.lang}/profile/page/${profile_tabs_f_static_map.get(`${url}_${owner_type}`)}/?mobile=${getInfoAboutUser() === 'mobile'}`) window.history.pushState(null, null, `/${document.documentElement.lang}/profile/page/${profile_tabs_f_static_map.get(`${url}_${owner_type}`)}`)
confirm_url_f_lang_ru = `/ru/profile/page/${profile_tabs_f_static_map.get(`${url}_${owner_type}`)}/?mobile=${getInfoAboutUser() === 'mobile'}` confirm_url_f_lang_ru = `/ru/profile/page/${profile_tabs_f_static_map.get(`${url}_${owner_type}`)}/`
confirm_url_f_lang_en = `/en/profile/page/${profile_tabs_f_static_map.get(`${url}_${owner_type}`)}/?mobile=${getInfoAboutUser() === 'mobile'}` confirm_url_f_lang_en = `/en/profile/page/${profile_tabs_f_static_map.get(`${url}_${owner_type}`)}/`
} else { } else {
window.history.pushState(null, null, `/${document.documentElement.lang}/profile/page/${profile_tabs_f_static_map.get(url)}/?mobile=${getInfoAboutUser() === 'mobile'}`) window.history.pushState(null, null, `/${document.documentElement.lang}/profile/page/${profile_tabs_f_static_map.get(url)}/`)
confirm_url_f_lang_ru = `/ru/profile/page/${profile_tabs_f_static_map.get(url)}/?mobile=${getInfoAboutUser() === 'mobile'}` confirm_url_f_lang_ru = `/ru/profile/page/${profile_tabs_f_static_map.get(url)}/`
confirm_url_f_lang_en = `/en/profile/page/${profile_tabs_f_static_map.get(url)}/?mobile=${getInfoAboutUser() === 'mobile'}` confirm_url_f_lang_en = `/en/profile/page/${profile_tabs_f_static_map.get(url)}/`
} }
document.querySelector("#ru_lang").href = confirm_url_f_lang_ru document.querySelector("#ru_lang").href = confirm_url_f_lang_ru
document.querySelector("#en_lang").href = confirm_url_f_lang_en document.querySelector("#en_lang").href = confirm_url_f_lang_en
@@ -116,7 +116,7 @@ function clickONTHEAPROfileBTN (el) {
function changeHrefCl (el) { function changeHrefCl (el) {
let dataset = el.dataset let dataset = el.dataset
let old_href = dataset['href'] let old_href = dataset['href']
let new_href = old_href + `?mobile=${getInfoAboutUser() === 'mobile'}` let new_href = old_href
el.setAttribute('href',new_href) el.setAttribute('href',new_href)
} }
@@ -534,6 +534,13 @@ function selectedUserMessenger (ticket_id=null,user_id=null,el){
document.querySelector(".enter-message-inp").focus() document.querySelector(".enter-message-inp").focus()
document.querySelector(".tab_user_messanger.select").scrollIntoView({behavior: "smooth",block:'end',inline:'end'}); document.querySelector(".tab_user_messanger.select").scrollIntoView({behavior: "smooth",block:'end',inline:'end'});
if (getInfoAboutUser() === 'mobile' || getInfoAboutUser() === 'laptop'){
window.scrollTo({
top: 0,
left: 0
// behavior: "smooth",
});
}
// if (window.location.host.includes('support') && user_type !== 'mobile' && user_type !== 'laptop'){ // if (window.location.host.includes('support') && user_type !== 'mobile' && user_type !== 'laptop'){
// let menu = document.querySelector(".menu_buttons.curtain.left") // let menu = document.querySelector(".menu_buttons.curtain.left")
// let container_user_messenger = document.querySelector(".container-messenger") // let container_user_messenger = document.querySelector(".container-messenger")
@@ -856,7 +863,7 @@ function set_curtain_z_index (curtain) {
} }
function close_open_curtain () { function close_open_curtain () {
if (getInfoAboutUser() === 'mobile' || !window.location.href.includes("profile")){ if (getInfoAboutUser() === 'mobile' || getInfoAboutUser() === 'laptop' || !window.location.href.includes("profile")){
let curtains = document.querySelectorAll('.curtain.open') let curtains = document.querySelectorAll('.curtain.open')
if (curtains.length >= 2) { if (curtains.length >= 2) {
if (last_open_curtain) { if (last_open_curtain) {