1(function($){var WidgetRegionSelectorHandler=function($scope,$){console.log("JO element_ready for nahiro_map_widget triggered");console.log("WidgetRegionSelectorHandler triggered with delay");var mapCont=$scope.find(".map-contenedor")[0];console.log("mapCont:",mapCont);if(mapCont){console.log("mapCont found:",mapCont);var arrPath=mapCont.querySelectorAll("svg path");var map=mapCont.querySelector("svg");var divSelector=document.querySelector('#regionSelector');var selectInput=divSelector.querySelector('select');var hcord=divSelector.querySelector('.h-cord');var vcord=divSelector.querySelector('.v-cord');map.addEventListener("click",function(e){const mapRect=map.getBoundingClientRect();const relativeX=e.clientX-mapRect.left;const relativeY=e.clientY-mapRect.top;const normalizedX=relativeX/mapRect.width;const normalizedY=relativeY/mapRect.height;const scaledX=normalizedX*570;const scaledY=normalizedY*810;hcord.textContent=Math.round(scaledX);vcord.textContent=Math.round(scaledY)});arrPath.forEach((path)=>{var pathTitle=path.getAttribute('title');var opt=document.createElement('option');opt.value=pathTitle;opt.text=pathTitle;selectInput.add(opt)});function getCoordinatesOfPath(path){const bbox=path.getBBox();const centerX=bbox.x+bbox.width/2;const centerY=bbox.y+bbox.height/2;hcord.textContent=Math.round(centerX)-20;vcord.textContent=Math.round(centerY)} 2function showMapRegion(e){const isInitialLoad=!e;const storedTitle=localStorage.getItem('selectedMapRegion');const title=isInitialLoad?(storedTitle||selectInput.value):e.target.value;if(!isInitialLoad){localStorage.setItem('selectedMapRegion',title)} 3if(isInitialLoad&&storedTitle){selectInput.value=storedTitle} 4const pathRegion=document.querySelector(`.map-contenedor svg path[title="${title}"]`);if(pathRegion){mapCont.querySelectorAll('svg path').forEach((pathx)=>{pathx.style.cssText='filter: none'});pathRegion.style.cssText='filter: brightness(0.5)';getCoordinatesOfPath(pathRegion)}} 5selectInput.addEventListener('change',showMapRegion);showMapRegion()}else{console.log("mapCont not found.")}};var WidgetRegionSelectorDrag=function($scope,$){var regionSelectorD=document.getElementById("regionSelector");const storedPos=localStorage.getItem('nhRegionSelectorPosY');if(storedPos!=null){regionSelectorD.style.top=storedPos+"px"} 6dragElement(regionSelectorD);function dragElement(elmnt){var pos1=0,pos2=0,pos3=0,pos4=0,currentY=0;
6if(document.getElementById(elmnt.id+"Move")){document.getElementById(elmnt.id+"Move").onmousedown=dragMouseDown}else{elmnt.onmousedown=dragMouseDown} 7function dragMouseDown(e){e=e;e.preventDefault();console.log('offsetTop',elmnt.offsetTop,'event',e);pos3=e.clientX;pos4=e.clientY;document.onmouseup=closeDragElement;document.onmousemove=elementDrag} 8function elementDrag(e){e=e;e.preventDefault();pos1=pos3-e.clientX;pos2=pos4-e.clientY;pos3=e.clientX;pos4=e.clientY;elmnt.style.top=(elmnt.offsetTop-pos2)+"px";elmnt.style.left=(elmnt.offsetLeft-pos1)+"px";currentY=elmnt.offsetTop-pos2;localStorage.setItem('nhRegionSelectorPosY',currentY)} 9function closeDragElement(){document.onmouseup=null;document.onmousemove=null}}} 10$(window).on('elementor/frontend/init',function(){console.log("JO Elementor frontend initialized");elementorFrontend.hooks.addAction('frontend/element_ready/nahiro_map_widget.default',WidgetRegionSelectorHandler);elementorFrontend.hooks.addAction('frontend/element_ready/nahiro_map_widget.default',WidgetRegionSelectorDrag)})})(jQuery)
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.