From c2b9bf78aacfee0073d7ca49b88d7d5d07b3d4c9 Mon Sep 17 00:00:00 2001 From: Georgy Shive Date: Thu, 24 Jul 2025 01:12:53 +0700 Subject: [PATCH] =?UTF-8?q?=D0=B8=D0=B7=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D1=81=D1=8F=20=D0=BE=D1=82=20jquery?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/PotreeViewerDirect.tsx | 99 ++++++++++++++++---------------- 1 file changed, 48 insertions(+), 51 deletions(-) diff --git a/src/pages/PotreeViewerDirect.tsx b/src/pages/PotreeViewerDirect.tsx index ba6070c..486db1f 100644 --- a/src/pages/PotreeViewerDirect.tsx +++ b/src/pages/PotreeViewerDirect.tsx @@ -13,7 +13,6 @@ import 'spectrum-colorpicker/spectrum.css'; // Импортируем зависимости как ES модули import * as THREE from 'three'; -import $ from 'jquery'; import * as d3 from 'd3'; import proj4 from 'proj4'; import i18next from 'i18next'; @@ -121,8 +120,6 @@ const PotreeViewerDirect: React.FC = () => { // Устанавливаем глобальные переменные для совместимости с Potree window.THREE = THREE; - window.$ = $; - window.jQuery = $; window.d3 = d3; window.proj4 = proj4; window.i18next = i18next; @@ -131,12 +128,12 @@ const PotreeViewerDirect: React.FC = () => { // Загружаем jQuery UI динамически - await loadJQueryUI(); + // await loadJQueryUI(); console.log('✅ Все модули готовы:', { THREE: !!window.THREE, - jQuery: !!window.$, - jQueryUI: !!window.$.ui, + jQuery: false, + jQueryUI: false, d3: !!window.d3, proj4: !!window.proj4, i18next: !!window.i18next, @@ -154,58 +151,58 @@ const PotreeViewerDirect: React.FC = () => { }; // Функция для загрузки jQuery UI - const loadJQueryUI = (): Promise => { - return new Promise((resolve, reject) => { - // Проверяем, не загружен ли уже jQuery UI - if (window.$ && window.$.ui) { - console.log('jQuery UI уже загружен'); - resolve(); - return; - } + // const loadJQueryUI = (): Promise => { + // return new Promise((resolve, reject) => { + // // Проверяем, не загружен ли уже jQuery UI + // if (window.$ && window.$.ui) { + // console.log('jQuery UI уже загружен'); + // resolve(); + // return; + // } - // Загружаем CSS для jQuery UI - const loadCSS = (href: string) => { - if (!document.querySelector(`link[href="${href}"]`)) { - const link = document.createElement('link'); - link.rel = 'stylesheet'; - link.type = 'text/css'; - link.href = href; - document.head.appendChild(link); - } - }; + // // Загружаем CSS для jQuery UI + // const loadCSS = (href: string) => { + // if (!document.querySelector(`link[href="${href}"]`)) { + // const link = document.createElement('link'); + // link.rel = 'stylesheet'; + // link.type = 'text/css'; + // link.href = href; + // document.head.appendChild(link); + // } + // }; - // Пробуем загрузить CSS из public/libs - loadCSS('/libs/jquery-ui/jquery-ui.min.css'); + // // Пробуем загрузить CSS из public/libs + // loadCSS('/libs/jquery-ui/jquery-ui.min.css'); - const script = document.createElement('script'); - script.src = '/libs/jquery-ui/jquery-ui.min.js'; // Используем из public/libs - script.async = false; + // const script = document.createElement('script'); + // script.src = '/libs/jquery-ui/jquery-ui.min.js'; // Используем из public/libs + // script.async = false; - script.onload = () => { - console.log('✅ jQuery UI загружен'); - resolve(); - }; + // script.onload = () => { + // console.log('✅ jQuery UI загружен'); + // resolve(); + // }; - script.onerror = (error) => { - console.warn('⚠️ Не удалось загрузить jQuery UI из public/libs, пробуем из node_modules'); + // script.onerror = (error) => { + // console.warn('⚠️ Не удалось загрузить jQuery UI из public/libs, пробуем из node_modules'); - // Fallback - пробуем загрузить из node_modules - const fallbackScript = document.createElement('script'); - fallbackScript.src = '/node_modules/jquery-ui-dist/jquery-ui.min.js'; - fallbackScript.onload = () => { - console.log('✅ jQuery UI загружен из node_modules'); - resolve(); - }; - fallbackScript.onerror = () => { - console.warn('⚠️ Продолжаем без jQuery UI'); - resolve(); // Не блокируем выполнение - }; - document.head.appendChild(fallbackScript); - }; + // // Fallback - пробуем загрузить из node_modules + // const fallbackScript = document.createElement('script'); + // fallbackScript.src = '/node_modules/jquery-ui-dist/jquery-ui.min.js'; + // fallbackScript.onload = () => { + // console.log('✅ jQuery UI загружен из node_modules'); + // resolve(); + // }; + // fallbackScript.onerror = () => { + // console.warn('⚠️ Продолжаем без jQuery UI'); + // resolve(); // Не блокируем выполнение + // }; + // document.head.appendChild(fallbackScript); + // }; - document.head.appendChild(script); - }); - }; + // document.head.appendChild(script); + // }); + // }; useEffect(() => { console.log('🚀🚀🚀 PotreeViewerDirect useEffect started - ES МОДУЛИ POTREE.JS 🚀🚀🚀');