PageSourceSearch

https://furnitrade.ru/wp-content/themes/furnitrade/js/regions_map.js?v=30.08.19_2&ver=4.9.20

js furnitrade.ru collected 2026-10-08 16:41:57 UTC 4,344 bytes, 156 lines download raw bytes

1
2var curObj, lastObj;
3
4function setRegionLink(e){
5
6  var svgMap = $('#svgMap');
7  //var viewBox = svgMap.attr('viewBox');
8  var viewBox = document.getElementById('svgMap').getAttribute('viewBox');
9
10  var ar = viewBox.split(' ');
11  var dX = parseInt(ar[0]);
12  var dY = parseInt(ar[1]);
13  var maxX = parseInt(ar[2]);
14  var maxY = parseInt(ar[3]);
15
16  var max_x = parseInt(svgMap.css('width'));
17  var max_y = parseInt(svgMap.css('height'));
18
19  function getX(x){ return (x/max_x)*maxX + dX;}
20  function getY(y){ return (y/max_y)*maxY + dY;}
21
22  if(typeof e.offsetX == 'undefined'){
23    var rect = document.getElementById(curObj).getClientRects();
24
25    var curO = $('#'+curObj);
26    var offset = curO.offset();
27
28    var curW = parseInt(rect[0].width);
29    var curH = parseInt(rect[0].height);
30    var offsetMap = svgMap.offset();
31    var x = offset.left - offsetMap.left + curW/2;
32    var y = offset.top - offsetMap.top + curH/2;
33  }else{
34    var x =  e.offsetX;
35    var y = e.offsetY;
36    clearInterval(intervalMarRandID);
37  }
38  var X = getX(x);
39  var Y = getY(y);
40
41  console.log('X: '+X+', Y: '+Y);
42  if($('#svg-coordinator').length > 0){
43    $('#svg-coordinator').html('X: '+X+', Y: '+Y);
44  }
45
46  if($('#mapInfo').is(':hidden')){
47    return;
48  }
49
50  if(typeof curObj != 'undefined' && curObj != lastObj){
51    $('#circlePoint').attr('cx', X).attr('cy', Y).show();
52
53    var DL = 30;
54    var linkDY = getY(max_y);
55    var linkDXL = getX(max_x/2 - DL/2);
56    var linkDXR = getX(max_x/2 + DL/2);
57    var d = 'M'+linkDXL+' '+linkDY+'L'+linkDXR+' '+linkDY+'L'+X+' '+Y+'z'
58    $('#regionLink').attr('d', d).show();
59    $('.mapInfoClear').show();
60    lastObj = curObj;
61  }
62}
63
64var intervalMarRandID;
65function chRandRegOnMap(){
66  var objs = $('#svgMap g');
67  var g = Math.floor(Math.random() * (objs.length + 1));
68  objs.eq(g).find('.path').first().click();
69}
70
71$(function(){
72  var coordinatorTimeout = 0;
73  $( document ).tooltip({track: true});
74  //$('#mapContent').lazy();
75 
76    $('#svgMap g .path').each(function(e){
77      var reg = map_data[$(this).attr('id')];
78      if(typeof reg != 'undefined' && reg['cnt'] > 0){
79        $(this).addClass('clientRegion');
80      }
81    });
82
83    $('#svgMap').click(function(e){
84      setRegionLink(e);
85
86      if($('#svg-coordinator').length > 0){
87        var x = e.clientX;
88        var y = e.clientY;
89        //var newposX = x - 200;
90        //var newposY = y + 600;
91        var newposX = x;
92        var newposY = y + $('#svgMap').height()-30;
93
94        /*var offset = $('#svgMap').offset();
95        var bottom = $(window).height() - offset.top - $('#svgMap').height();
96        bottom = bottom - offset.top;
97        var right = $(window).width() - $('#svgMap').width();
98        right = offset.left - right;*/
99
100
101        $('#svg-coordinator').css("transform","translate3d("+newposX+"px,"+newposY+"px,0px)");
102        $('#svg-coordinator').show();
103
104        if(coordinatorTimeout != 0){
105          clearTimeout(coordinatorTimeout);
106        }
107        coordinatorTimeout = setTimeout(function()
108        {
109          $('#svg-coordinator').hide();
110        }, 10000);
111      }
112
113    });
114    function mapInfoRender(code){
115      //$('#mapInfo').html(allRegions[code]);
116      if(typeof map_data[code] !== 'undefined'){
117        $('#mapInfo').html(map_data[code].html);
118        $('#mapInfo').show();
119        $('#regionLink').show();
120
121        $('.close_mapinfo').click(function(e){
122          e.preventDefault();
123          $('#mapInfo').hide();
124          $('#regionLink').hide();
125        });
126      } else {
127        $('#mapInfo').hide();
128        $('#regionLink').hide();
129      }
130    }
131
132    $('#svgMap g .path').click(function(e){
133      curObj = $(this).parent().find('[id]').attr('id');
134      console.log(curObj+', координаты:');
135     
136      var targetBlock = document.getElementById("svgMap").getElementsByClassName("active")[0];
137      if(typeof targetBlock !== 'undefined'){
138        targetBlock.classList.remove("active");
139      }
140
141      this.parentNode.classList.add("active");
142      $('#mapInfo').html('');
143      var code = $(this).parent().find('[id]').attr('id');
144      mapInfoRender(code);
145      
146    });
147
148    $('#svgMap g title').each(function(){
149      $(this).parent().attr('title', $(this).text());
150      $(this).remove();
151    });
152
153    intervalMarRandID = window.setInterval(function(){
154      chRandRegOnMap();
155    },5000);
156});

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.