Last active
May 8, 2020 07:39
-
-
Save Sentinel-7/ce60ffd361634ca65a55a041c042e9ab to your computer and use it in GitHub Desktop.
mFilter2 google map company
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
в head | |
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script> | |
<script src="https://maps.google.com/maps/api/js?language=ru&key=AIzaSyBkYlYr9e5MXFICXWBIxDZgg8N53X_WiSU"></script> | |
<script src="/assets/js/infobox.min.js"></script> | |
<script src="/assets/js/markerclusterer.js"></script> | |
======================================================= | |
вызов в шаблоне | |
{if $.get.tpl == '0' || $.get.tpl == ''} | |
{var $limitParent = '0'} | |
{else} | |
{var $limitParent = '30'} | |
{var $sortby = 'resource|longtitle:asc'} | |
{/if} | |
{'!mFilter2' | snippet : [ | |
'class' => 'msProduct', | |
'element' => 'msProducts', | |
'limit' => $limitParent, | |
'parents' => '54', | |
'setMeta' => '1', | |
'showUnpublished' => '1', | |
'includeTVs' => 'map,dilers,urlDiler,emailDiler,emailDiler2,emailDiler3,telDiler,introt', | |
'tvPrefix' => 'tv.', | |
'includeThumbs' => 'maps', | |
'processTVs' => '1', | |
'prepareTVs' => '1', | |
'sort' => $sortby, | |
'filters' => 'tv|dilers:DefaultMy', | |
'suggestionsRadio' => 'tv|dilers:radio', | |
'filterOptions' => '{"autoLoad":0}', | |
'tpls' => 'tpl.msProducts.dtls1.row,tpl.msProducts.dtls2.row', | |
'tplOuter' => 'tpl.mFilter2.outer.dtls', | |
'tplFilter.row.tv|dilers' => 'tpl.mFilter2.filter.checkbox.dtls', | |
'tplPageWrapper'=>'@INLINE <ul class="uk-pagination">[[+first]][[+prev]][[+pages]][[+next]][[+last]]</ul>', | |
'tplPageFirst'=>'@INLINE <li><a href="[[+href]]"><i class="uk-icon-angle-left"></i><i class="uk-icon-angle-left"></i></a></li>', | |
'tplPageLast'=>'@INLINE <li><a href="[[+href]]"><i class="uk-icon-angle-right"></i><i class="uk-icon-angle-right"></i></a></li>', | |
'tplPage'=>'@INLINE <li><a href="[[+href]]">[[+pageNo]]</a></li>', | |
'tplPageActive'=>'@INLINE <li class="uk-active"><span>[[+pageNo]]</span></li>', | |
'tplPagePrev'=>'@INLINE <li><a href="[[+href]]"><i class="uk-icon-angle-left"></i></a></li>', | |
'tplPageNext'=>'@INLINE <li><a href="[[+href]]"><i class="uk-icon-angle-right"></i></a></li>', | |
'tplPagePrevEmpty'=>'@INLINE <li class="page-item disabled"><a href="[[+href]]"><i class="uk-icon-angle-left"></i></a></li>', | |
'tplPageNextEmpty'=>'@INLINE <li class="page-item disabled"><a href="[[+href]]"><i class="uk-icon-angle-right"></i></a></li>', | |
'tplPageFirstEmpty'=>'', | |
'tplPageLastEmpty'=>'' | |
]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// @name getTvDisplayName | |
// @author Nick Crossland - www.rckt.co.uk | |
// @version 1.1-pl | |
// @description Output filter to get TV display name | |
/* | |
An output filter to retrieve the display value of a TV, given the stored value. | |
For example, if you have a TV which is a checkbox or listbox, you may have specified separate | |
labels and values such as: | |
For the money==1||For the show==2||To get ready==3||Go cat go==4 | |
If you then output the value of the TV in a template using | |
[[*elvis]] | |
it will output something like: | |
3 | |
If you use this snippet as an output filter, it will instead retrieve the labels associated with | |
the values that you have specified in your TV setup. So put in your template | |
[[*elvis:getTvDisplayName]] | |
it will output | |
To get ready | |
Sometimes the filter will have trouble because the TV name isn't put in the code exactly as it is set | |
up in the manager - for example in a getResources template chunk, by default TV names are prefixed with | |
tv. | |
To work round this, you can supply the prefix to ignore as the parameter, e.g. | |
[[+elvis:getTvDisplayName=`tv.`]] | |
If a TV type allows more than one value to be selected (e.g. checkboxes, list (multi)) you should set an output option for the TV of "delimiter" which will separate the values with a delimiter of your choice, for example a comma. | |
This snippet will replace every value, based on the delimiter. You should ensure your delimiter isn't going to occur in your TV display options - e.g. if your TV display options contain commas, don't choose comma as your delimiter. You might want to choose an unusual character such as §. | |
You may want to further format the display of your TV values using other output filters such as :replace, e.g. | |
[[+elvis:getTvDisplayName=`tv.`:replace=`,==<br/>`]] | |
to display each item on a new line. | |
*/ | |
// Code below... | |
// The $name may have a prefix, for example where this is part of a getResources template | |
// We can specify a prefix to remove via an option | |
if (isset($options) && strpos($name, $options) == 0) { | |
$name = substr($name, strlen($options) ); | |
} | |
// Get the template variable which has called this | |
$resourceQuery = new xPDOCriteria($modx, "SELECT * FROM {$modx->getTableName('modTemplateVar')} WHERE name = '$name'"); | |
$tv = $modx->getObject('modTemplateVar', $resourceQuery); | |
// If we can't find this TV, do nothing and return the original value | |
if (count($tv) == 0) { | |
return $input; | |
} | |
$elements = $tv->get('elements'); | |
$output_properties = $tv->get('output_properties'); | |
// Get all the possible values | |
$options = explode('||', $elements); | |
$lookup = array(); | |
foreach ($options as $o) { | |
list($name, $value) = explode('==', $o); | |
$lookup[$value] = $name; | |
} | |
// Is there a delimiter? If so, do this for every item | |
if (isset( $output_properties['delimiter'] )) { | |
$delimiter = $output_properties['delimiter']; | |
$values = explode($delimiter, $input); | |
} else { | |
$delimiter = ''; | |
$values = array($input); | |
} | |
// Put the values back together using the same delimiter | |
$return_values = array(); | |
foreach ($values as $v) { | |
$return_values[] = '<div class=uk-badge>' . $lookup[$v] . '</div>'; | |
} | |
return implode( $delimiter, $return_values); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7 8(a){a=a||{};r.s.1R.2k(2,3d);2.Q=a.1v||"";2.1H=a.1B||J;2.S=a.1G||0;2.H=a.1z||1h r.s.1Y(0,0);2.B=a.U||1h r.s.2E(0,0);2.15=a.13||t;2.1p=a.1t||"2h";2.1m=a.F||{};2.1E=a.1C||"3g";2.P=a.1j||"3b://38.r.33/2Y/2T/2N/1r.2K";3(a.1j===""){2.P=""}2.1f=a.1x||1h r.s.1Y(1,1);3(q a.A==="p"){3(q a.18==="p"){a.A=L}v{a.A=!a.18}}2.w=!a.A;2.17=a.1n||J;2.1I=a.2g||"2e";2.16=a.1l||J;2.4=t;2.z=t;2.14=t;2.V=t;2.E=t;2.R=t}8.9=1h r.s.1R();8.9.25=7(){5 i;5 f;5 a;5 d=2;5 c=7(e){e.20=L;3(e.1i){e.1i()}};5 b=7(e){e.30=J;3(e.1Z){e.1Z()}3(!d.16){c(e)}};3(!2.4){2.4=1e.2S("2Q");2.1d();3(q 2.Q.1u==="p"){2.4.O=2.G()+2.Q}v{2.4.O=2.G();2.4.1a(2.Q)}2.2J()[2.1I].1a(2.4);2.1w();3(2.4.6.D){2.R=L}v{3(2.S!==0&&2.4.Z>2.S){2.4.6.D=2.S;2.4.6.2D="2A";2.R=L}v{a=2.1P();2.4.6.D=(2.4.Z-a.W-a.11)+"12";2.R=J}}2.1F(2.1H);3(!2.16){2.E=[];f=["2t","1O","2q","2p","1M","2o","2n","2m","2l"];1o(i=0;i<f.1L;i++){2.E.1K(r.s.u.19(2.4,f[i],c))}2.E.1K(r.s.u.19(2.4,"1O",7(e){2.6.1J="2j"}))}2.V=r.s.u.19(2.4,"2i",b);r.s.u.T(2,"2f")}};8.9.G=7(){5 a="";3(2.P!==""){a="<2d";a+=" 2c=\'"+2.P+"\'";a+=" 2b=11";a+=" 6=\'";a+=" U: 2a;";a+=" 1J: 29;";a+=" 28: "+2.1E+";";a+="\'>"}K a};8.9.1w=7(){5 a;3(2.P!==""){a=2.4.3n;2.z=r.s.u.19(a,"1M",2.27())}v{2.z=t}};8.9.27=7(){5 a=2;K 7(e){e.20=L;3(e.1i){e.1i()}r.s.u.T(a,"3m");a.1r()}};8.9.1F=7(d){5 m;5 n;5 e=0,I=0;3(!d){m=2.1D();3(m 3l r.s.3k){3(!m.26().3h(2.B)){m.3f(2.B)}n=m.26();5 a=m.3e();5 h=a.Z;5 f=a.24;5 k=2.H.D;5 l=2.H.1k;5 g=2.4.Z;5 b=2.4.24;5 i=2.1f.D;5 j=2.1f.1k;5 o=2.23().3c(2.B);3(o.x<(-k+i)){e=o.x+k-i}v 3((o.x+g+k+i)>h){e=o.x+g+k+i-h}3(2.17){3(o.y<(-l+j+b)){I=o.y+l-j-b}v 3((o.y+l+j)>f){I=o.y+l+j-f}}v{3(o.y<(-l+j)){I=o.y+l-j}v 3((o.y+b+l+j)>f){I=o.y+b+l+j-f}}3(!(e===0&&I===0)){5 c=m.3a();m.39(e,I)}}}};8.9.1d=7(){5 i,F;3(2.4){2.4.37=2.1p;2.4.6.36="";F=2.1m;1o(i 35 F){3(F.34(i)){2.4.6[i]=F[i]}}2.4.6.32="31(0)";3(q 2.4.6.X!=="p"&&2.4.6.X!==""){2.4.6.2Z="\\"2X:2W.2V.2U(2R="+(2.4.6.X*1X)+")\\"";2.4.6.2P="2O(X="+(2.4.6.X*1X)+")"}2.4.6.U="2M";2.4.6.M=\'1c\';3(2.15!==t){2.4.6.13=2.15}}};8.9.1P=7(){5 c;5 a={1b:0,1g:0,W:0,11:0};5 b=2.4;3(1e.1s&&1e.1s.1W){c=b.2L.1s.1W(b,"");3(c){a.1b=C(c.1V,10)||0;a.1g=C(c.1U,10)||0;a.W=C(c.1T,10)||0;a.11=C(c.1S,10)||0}}v 3(1e.2I.N){3(b.N){a.1b=C(b.N.1V,10)||0;a.1g=C(b.N.1U,10)||0;a.W=C(b.N.1T,10)||0;a.11=C(b.N.1S,10)||0}}K a};8.9.2H=7(){3(2.4){2.4.2G.2F(2.4);2.4=t}};8.9.1y=7(){2.25();5 a=2.23().2C(2.B);2.4.6.W=(a.x+2.H.D)+"12";3(2.17){2.4.6.1g=-(a.y+2.H.1k)+"12"}v{2.4.6.1b=(a.y+2.H.1k)+"12"}3(2.w){2.4.6.M="1c"}v{2.4.6.M="A"}};8.9.2B=7(a){3(q a.1t!=="p"){2.1p=a.1t;2.1d()}3(q a.F!=="p"){2.1m=a.F;2.1d()}3(q a.1v!=="p"){2.1Q(a.1v)}3(q a.1B!=="p"){2.1H=a.1B}3(q a.1G!=="p"){2.S=a.1G}3(q a.1z!=="p"){2.H=a.1z}3(q a.1n!=="p"){2.17=a.1n}3(q a.U!=="p"){2.1q(a.U)}3(q a.13!=="p"){2.22(a.13)}3(q a.1C!=="p"){2.1E=a.1C}3(q a.1j!=="p"){2.P=a.1j}3(q a.1x!=="p"){2.1f=a.1x}3(q a.18!=="p"){2.w=a.18}3(q a.A!=="p"){2.w=!a.A}3(q a.1l!=="p"){2.16=a.1l}3(2.4){2.1y()}};8.9.1Q=7(a){2.Q=a;3(2.4){3(2.z){r.s.u.Y(2.z);2.z=t}3(!2.R){2.4.6.D=""}3(q a.1u==="p"){2.4.O=2.G()+a}v{2.4.O=2.G();2.4.1a(a)}3(!2.R){2.4.6.D=2.4.Z+"12";3(q a.1u==="p"){2.4.O=2.G()+a}v{2.4.O=2.G();2.4.1a(a)}}2.1w()}r.s.u.T(2,"2z")};8.9.1q=7(a){2.B=a;3(2.4){2.1y()}r.s.u.T(2,"21")};8.9.22=7(a){2.15=a;3(2.4){2.4.6.13=a}r.s.u.T(2,"2y")};8.9.2x=7(a){2.w=!a;3(2.4){2.4.6.M=(2.w?"1c":"A")}};8.9.2w=7(){K 2.Q};8.9.1A=7(){K 2.B};8.9.2v=7(){K 2.15};8.9.2u=7(){5 a;3((q 2.1D()==="p")||(2.1D()===t)){a=J}v{a=!2.w}K a};8.9.3i=7(){2.w=J;3(2.4){2.4.6.M="A"}};8.9.3j=7(){2.w=L;3(2.4){2.4.6.M="1c"}};8.9.2s=7(c,b){5 a=2;3(b){2.B=b.1A();2.14=r.s.u.2r(b,"21",7(){a.1q(2.1A())})}2.1N(c);3(2.4){2.1F()}};8.9.1r=7(){5 i;3(2.z){r.s.u.Y(2.z);2.z=t}3(2.E){1o(i=0;i<2.E.1L;i++){r.s.u.Y(2.E[i])}2.E=t}3(2.14){r.s.u.Y(2.14);2.14=t}3(2.V){r.s.u.Y(2.V);2.V=t}2.1N(t)};',62,210,'||this|if|div_|var|style|function|InfoBox|prototype||||||||||||||||undefined|typeof|google|maps|null|event|else|isHidden_|||closeListener_|visible|position_|parseInt|width|eventListeners_|boxStyle|getCloseBoxImg_|pixelOffset_|yOffset|false|return|true|visibility|currentStyle|innerHTML|closeBoxURL_|content_|fixedWidthSet_|maxWidth_|trigger|position|contextListener_|left|opacity|removeListener|offsetWidth||right|px|zIndex|moveListener_|zIndex_|enableEventPropagation_|alignBottom_|isHidden|addDomListener|appendChild|top|hidden|setBoxStyle_|document|infoBoxClearance_|bottom|new|stopPropagation|closeBoxURL|height|enableEventPropagation|boxStyle_|alignBottom|for|boxClass_|setPosition|close|defaultView|boxClass|nodeType|content|addClickHandler_|infoBoxClearance|draw|pixelOffset|getPosition|disableAutoPan|closeBoxMargin|getMap|closeBoxMargin_|panBox_|maxWidth|disableAutoPan_|pane_|cursor|push|length|click|setMap|mouseover|getBoxWidths_|setContent|OverlayView|borderRightWidth|borderLeftWidth|borderBottomWidth|borderTopWidth|getComputedStyle|100|Size|preventDefault|cancelBubble|position_changed|setZIndex|getProjection|offsetHeight|createInfoBoxDiv_|getBounds|getCloseClickHandler_|margin|pointer|relative|align|src|img|floatPane|domready|pane|infoBox|contextmenu|default|apply|touchmove|touchend|touchstart|dblclick|mouseup|mouseout|addListener|open|mousedown|getVisible|getZIndex|getContent|setVisible|zindex_changed|content_changed|auto|setOptions|fromLatLngToDivPixel|overflow|LatLng|removeChild|parentNode|onRemove|documentElement|getPanes|gif|ownerDocument|absolute|mapfiles|alpha|filter|div|Opacity|createElement|en_us|Alpha|Microsoft|DXImageTransform|progid|intl|MsFilter|returnValue|translateZ|WebkitTransform|com|hasOwnProperty|in|cssText|className|www|panBy|getCenter|http|fromLatLngToContainerPixel|arguments|getDiv|setCenter|2px|contains|show|hide|Map|instanceof|closeclick|firstChild'.split('|'),0,{})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ClusterIcon(a,b){a.getMarkerClusterer().extend(ClusterIcon,google.maps.OverlayView),this.cluster_=a,this.className_=a.getMarkerClusterer().getClusterClass(),this.styles_=b,this.center_=null,this.div_=null,this.sums_=null,this.visible_=!1,this.setMap(a.getMap())}function Cluster(a){this.markerClusterer_=a,this.map_=a.getMap(),this.gridSize_=a.getGridSize(),this.minClusterSize_=a.getMinimumClusterSize(),this.averageCenter_=a.getAverageCenter(),this.markers_=[],this.center_=null,this.bounds_=null,this.clusterIcon_=new ClusterIcon(this,a.getStyles())}function MarkerClusterer(a,b,c){this.extend(MarkerClusterer,google.maps.OverlayView),b=b||[],c=c||{},this.markers_=[],this.clusters_=[],this.listeners_=[],this.activeMap_=null,this.ready_=!1,this.gridSize_=c.gridSize||60,this.minClusterSize_=c.minimumClusterSize||2,this.maxZoom_=c.maxZoom||null,this.styles_=c.styles||[],this.title_=c.title||"",this.zoomOnClick_=!0,void 0!==c.zoomOnClick&&(this.zoomOnClick_=c.zoomOnClick),this.averageCenter_=!1,void 0!==c.averageCenter&&(this.averageCenter_=c.averageCenter),this.ignoreHidden_=!1,void 0!==c.ignoreHidden&&(this.ignoreHidden_=c.ignoreHidden),this.enableRetinaIcons_=!1,void 0!==c.enableRetinaIcons&&(this.enableRetinaIcons_=c.enableRetinaIcons),this.imagePath_=c.imagePath||MarkerClusterer.IMAGE_PATH,this.imageExtension_=c.imageExtension||MarkerClusterer.IMAGE_EXTENSION,this.imageSizes_=c.imageSizes||MarkerClusterer.IMAGE_SIZES,this.calculator_=c.calculator||MarkerClusterer.CALCULATOR,this.batchSize_=c.batchSize||MarkerClusterer.BATCH_SIZE,this.batchSizeIE_=c.batchSizeIE||MarkerClusterer.BATCH_SIZE_IE,this.clusterClass_=c.clusterClass||"cluster",navigator.userAgent.toLowerCase().indexOf("msie")!==-1&&(this.batchSize_=this.batchSizeIE_),this.setupStyles_(),this.addMarkers(b,!0),this.setMap(a)}ClusterIcon.prototype.onAdd=function(){var b,c,a=this;this.div_=document.createElement("div"),this.div_.className=this.className_,this.visible_&&this.show(),this.getPanes().overlayMouseTarget.appendChild(this.div_),this.boundsChangedListener_=google.maps.event.addListener(this.getMap(),"bounds_changed",function(){c=b}),google.maps.event.addDomListener(this.div_,"mousedown",function(){b=!0,c=!1}),google.maps.event.addDomListener(this.div_,"click",function(d){if(b=!1,!c){var e,f,g=a.cluster_.getMarkerClusterer();google.maps.event.trigger(g,"click",a.cluster_),google.maps.event.trigger(g,"clusterclick",a.cluster_),g.getZoomOnClick()&&(f=g.getMaxZoom(),e=a.cluster_.getBounds(),g.getMap().fitBounds(e),setTimeout(function(){g.getMap().fitBounds(e),null!==f&&g.getMap().getZoom()>f&&g.getMap().setZoom(f+1)},100)),d.cancelBubble=!0,d.stopPropagation&&d.stopPropagation()}}),google.maps.event.addDomListener(this.div_,"mouseover",function(){var b=a.cluster_.getMarkerClusterer();google.maps.event.trigger(b,"mouseover",a.cluster_)}),google.maps.event.addDomListener(this.div_,"mouseout",function(){var b=a.cluster_.getMarkerClusterer();google.maps.event.trigger(b,"mouseout",a.cluster_)})},ClusterIcon.prototype.onRemove=function(){this.div_&&this.div_.parentNode&&(this.hide(),google.maps.event.removeListener(this.boundsChangedListener_),google.maps.event.clearInstanceListeners(this.div_),this.div_.parentNode.removeChild(this.div_),this.div_=null)},ClusterIcon.prototype.draw=function(){if(this.visible_){var a=this.getPosFromLatLng_(this.center_);this.div_.style.top=a.y+"px",this.div_.style.left=a.x+"px"}},ClusterIcon.prototype.hide=function(){this.div_&&(this.div_.style.display="none"),this.visible_=!1},ClusterIcon.prototype.show=function(){if(this.div_){var a="",b=this.backgroundPosition_.split(" "),c=parseInt(b[0].replace(/^\s+|\s+$/g,""),10),d=parseInt(b[1].replace(/^\s+|\s+$/g,""),10),e=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(e),a="<img src='"+this.url_+"' style='position: absolute; top: "+d+"px; left: "+c+"px; ",this.cluster_.getMarkerClusterer().enableRetinaIcons_||(a+="clip: rect("+-1*d+"px, "+(-1*c+this.width_)+"px, "+(-1*d+this.height_)+"px, "+-1*c+"px);"),a+="'>",this.div_.innerHTML=a+"<div class='cluster' style='position: absolute;top: "+this.anchorText_[0]+"px;left: "+this.anchorText_[1]+"px;color: "+this.textColor_+";font-size: "+this.textSize_+"px;font-family: "+this.fontFamily_+";font-weight: "+this.fontWeight_+";font-style: "+this.fontStyle_+";text-decoration: "+this.textDecoration_+";text-align: center;width: "+this.width_+"px;line-height:"+this.height_+"px;'>"+this.sums_.text+"</div>","undefined"==typeof this.sums_.title||""===this.sums_.title?this.div_.title=this.cluster_.getMarkerClusterer().getTitle():this.div_.title=this.sums_.title,this.div_.style.display=""}this.visible_=!0},ClusterIcon.prototype.useStyle=function(a){this.sums_=a;var b=Math.max(0,a.index-1);b=Math.min(this.styles_.length-1,b);var c=this.styles_[b];this.url_=c.url,this.height_=c.height,this.width_=c.width,this.anchorText_=c.anchorText||[0,0],this.anchorIcon_=c.anchorIcon||[parseInt(this.height_/2,10),parseInt(this.width_/2,10)],this.textColor_=c.textColor||"black",this.textSize_=c.textSize||11,this.textDecoration_=c.textDecoration||"none",this.fontWeight_=c.fontWeight||"bold",this.fontStyle_=c.fontStyle||"normal",this.fontFamily_=c.fontFamily||"Arial,sans-serif",this.backgroundPosition_=c.backgroundPosition||"0 0"},ClusterIcon.prototype.setCenter=function(a){this.center_=a},ClusterIcon.prototype.createCss=function(a){var b=[];return b.push("cursor: pointer;"),b.push("position: absolute; top: "+a.y+"px; left: "+a.x+"px;"),b.push("width: "+this.width_+"px; height: "+this.height_+"px;"),b.join("")},ClusterIcon.prototype.getPosFromLatLng_=function(a){var b=this.getProjection().fromLatLngToDivPixel(a);return b.x-=this.anchorIcon_[1],b.y-=this.anchorIcon_[0],b.x=parseInt(b.x,10),b.y=parseInt(b.y,10),b},Cluster.prototype.getSize=function(){return this.markers_.length},Cluster.prototype.getMarkers=function(){return this.markers_},Cluster.prototype.getCenter=function(){return this.center_},Cluster.prototype.getMap=function(){return this.map_},Cluster.prototype.getMarkerClusterer=function(){return this.markerClusterer_},Cluster.prototype.getBounds=function(){var a,b=new google.maps.LatLngBounds(this.center_,this.center_),c=this.getMarkers();for(a=0;a<c.length;a++)b.extend(c[a].getPosition());return b},Cluster.prototype.remove=function(){this.clusterIcon_.setMap(null),this.markers_=[],delete this.markers_},Cluster.prototype.addMarker=function(a){var b,c,d;if(this.isMarkerAlreadyAdded_(a))return!1;if(this.center_){if(this.averageCenter_){var e=this.markers_.length+1,f=(this.center_.lat()*(e-1)+a.getPosition().lat())/e,g=(this.center_.lng()*(e-1)+a.getPosition().lng())/e;this.center_=new google.maps.LatLng(f,g),this.calculateBounds_()}}else this.center_=a.getPosition(),this.calculateBounds_();if(a.isAdded=!0,this.markers_.push(a),c=this.markers_.length,d=this.markerClusterer_.getMaxZoom(),null!==d&&this.map_.getZoom()>d)a.getMap()!==this.map_&&a.setMap(this.map_);else if(c<this.minClusterSize_)a.getMap()!==this.map_&&a.setMap(this.map_);else if(c===this.minClusterSize_)for(b=0;b<c;b++)this.markers_[b].setMap(null);else a.setMap(null);return this.updateIcon_(),!0},Cluster.prototype.isMarkerInClusterBounds=function(a){return this.bounds_.contains(a.getPosition())},Cluster.prototype.calculateBounds_=function(){var a=new google.maps.LatLngBounds(this.center_,this.center_);this.bounds_=this.markerClusterer_.getExtendedBounds(a)},Cluster.prototype.updateIcon_=function(){var a=this.markers_.length,b=this.markerClusterer_.getMaxZoom();if(null!==b&&this.map_.getZoom()>b)return void this.clusterIcon_.hide();if(a<this.minClusterSize_)return void this.clusterIcon_.hide();var c=this.markerClusterer_.getStyles().length,d=this.markerClusterer_.getCalculator()(this.markers_,c);this.clusterIcon_.setCenter(this.center_),this.clusterIcon_.useStyle(d),this.clusterIcon_.show()},Cluster.prototype.isMarkerAlreadyAdded_=function(a){var b;if(this.markers_.indexOf)return this.markers_.indexOf(a)!==-1;for(b=0;b<this.markers_.length;b++)if(a===this.markers_[b])return!0;return!1},MarkerClusterer.prototype.onAdd=function(){var a=this;this.activeMap_=this.getMap(),this.ready_=!0,this.repaint(),this.listeners_=[google.maps.event.addListener(this.getMap(),"zoom_changed",function(){a.resetViewport_(!1),this.getZoom()!==(this.get("minZoom")||0)&&this.getZoom()!==this.get("maxZoom")||google.maps.event.trigger(this,"idle")}),google.maps.event.addListener(this.getMap(),"idle",function(){a.redraw_()})]},MarkerClusterer.prototype.onRemove=function(){var a;for(a=0;a<this.markers_.length;a++)this.markers_[a].getMap()!==this.activeMap_&&this.markers_[a].setMap(this.activeMap_);for(a=0;a<this.clusters_.length;a++)this.clusters_[a].remove();for(this.clusters_=[],a=0;a<this.listeners_.length;a++)google.maps.event.removeListener(this.listeners_[a]);this.listeners_=[],this.activeMap_=null,this.ready_=!1},MarkerClusterer.prototype.draw=function(){},MarkerClusterer.prototype.setupStyles_=function(){var a,b;if(!(this.styles_.length>0))for(a=0;a<this.imageSizes_.length;a++)b=this.imageSizes_[a],this.styles_.push({url:this.imagePath_+(a+1)+"."+this.imageExtension_,height:b,width:b})},MarkerClusterer.prototype.fitMapToMarkers=function(){var a,b=this.getMarkers(),c=new google.maps.LatLngBounds;for(a=0;a<b.length;a++)c.extend(b[a].getPosition());this.getMap().fitBounds(c)},MarkerClusterer.prototype.getGridSize=function(){return this.gridSize_},MarkerClusterer.prototype.setGridSize=function(a){this.gridSize_=a},MarkerClusterer.prototype.getMinimumClusterSize=function(){return this.minClusterSize_},MarkerClusterer.prototype.setMinimumClusterSize=function(a){this.minClusterSize_=a},MarkerClusterer.prototype.getMaxZoom=function(){return this.maxZoom_},MarkerClusterer.prototype.setMaxZoom=function(a){this.maxZoom_=a},MarkerClusterer.prototype.getStyles=function(){return this.styles_},MarkerClusterer.prototype.setStyles=function(a){this.styles_=a},MarkerClusterer.prototype.getTitle=function(){return this.title_},MarkerClusterer.prototype.setTitle=function(a){this.title_=a},MarkerClusterer.prototype.getZoomOnClick=function(){return this.zoomOnClick_},MarkerClusterer.prototype.setZoomOnClick=function(a){this.zoomOnClick_=a},MarkerClusterer.prototype.getAverageCenter=function(){return this.averageCenter_},MarkerClusterer.prototype.setAverageCenter=function(a){this.averageCenter_=a},MarkerClusterer.prototype.getIgnoreHidden=function(){return this.ignoreHidden_},MarkerClusterer.prototype.setIgnoreHidden=function(a){this.ignoreHidden_=a},MarkerClusterer.prototype.getEnableRetinaIcons=function(){return this.enableRetinaIcons_},MarkerClusterer.prototype.setEnableRetinaIcons=function(a){this.enableRetinaIcons_=a},MarkerClusterer.prototype.getImageExtension=function(){return this.imageExtension_},MarkerClusterer.prototype.setImageExtension=function(a){this.imageExtension_=a},MarkerClusterer.prototype.getImagePath=function(){return this.imagePath_},MarkerClusterer.prototype.setImagePath=function(a){this.imagePath_=a},MarkerClusterer.prototype.getImageSizes=function(){return this.imageSizes_},MarkerClusterer.prototype.setImageSizes=function(a){this.imageSizes_=a},MarkerClusterer.prototype.getCalculator=function(){return this.calculator_},MarkerClusterer.prototype.setCalculator=function(a){this.calculator_=a},MarkerClusterer.prototype.getBatchSizeIE=function(){return this.batchSizeIE_},MarkerClusterer.prototype.setBatchSizeIE=function(a){this.batchSizeIE_=a},MarkerClusterer.prototype.getClusterClass=function(){return this.clusterClass_},MarkerClusterer.prototype.setClusterClass=function(a){this.clusterClass_=a},MarkerClusterer.prototype.getMarkers=function(){return this.markers_},MarkerClusterer.prototype.getTotalMarkers=function(){return this.markers_.length},MarkerClusterer.prototype.getClusters=function(){return this.clusters_},MarkerClusterer.prototype.getTotalClusters=function(){return this.clusters_.length},MarkerClusterer.prototype.addMarker=function(a,b){this.pushMarkerTo_(a),b||this.redraw_()},MarkerClusterer.prototype.addMarkers=function(a,b){var c;for(c in a)a.hasOwnProperty(c)&&this.pushMarkerTo_(a[c]);b||this.redraw_()},MarkerClusterer.prototype.pushMarkerTo_=function(a){if(a.getDraggable()){var b=this;google.maps.event.addListener(a,"dragend",function(){b.ready_&&(this.isAdded=!1,b.repaint())})}a.isAdded=!1,this.markers_.push(a)},MarkerClusterer.prototype.removeMarker=function(a,b){var c=this.removeMarker_(a);return!b&&c&&this.repaint(),c},MarkerClusterer.prototype.removeMarkers=function(a,b){var c,d,e=!1;for(c=0;c<a.length;c++)d=this.removeMarker_(a[c]),e=e||d;return!b&&e&&this.repaint(),e},MarkerClusterer.prototype.removeMarker_=function(a){var b,c=-1;if(this.markers_.indexOf)c=this.markers_.indexOf(a);else for(b=0;b<this.markers_.length;b++)if(a===this.markers_[b]){c=b;break}return c!==-1&&(a.setMap(null),this.markers_.splice(c,1),!0)},MarkerClusterer.prototype.clearMarkers=function(){this.resetViewport_(!0),this.markers_=[]},MarkerClusterer.prototype.repaint=function(){var a=this.clusters_.slice();this.clusters_=[],this.resetViewport_(!1),this.redraw_(),setTimeout(function(){var b;for(b=0;b<a.length;b++)a[b].remove()},0)},MarkerClusterer.prototype.getExtendedBounds=function(a){var b=this.getProjection(),c=new google.maps.LatLng(a.getNorthEast().lat(),a.getNorthEast().lng()),d=new google.maps.LatLng(a.getSouthWest().lat(),a.getSouthWest().lng()),e=b.fromLatLngToDivPixel(c);e.x+=this.gridSize_,e.y-=this.gridSize_;var f=b.fromLatLngToDivPixel(d);f.x-=this.gridSize_,f.y+=this.gridSize_;var g=b.fromDivPixelToLatLng(e),h=b.fromDivPixelToLatLng(f);return a.extend(g),a.extend(h),a},MarkerClusterer.prototype.redraw_=function(){this.createClusters_(0)},MarkerClusterer.prototype.resetViewport_=function(a){var b,c;for(b=0;b<this.clusters_.length;b++)this.clusters_[b].remove();for(this.clusters_=[],b=0;b<this.markers_.length;b++)c=this.markers_[b],c.isAdded=!1,a&&c.setMap(null)},MarkerClusterer.prototype.distanceBetweenPoints_=function(a,b){var c=6371,d=(b.lat()-a.lat())*Math.PI/180,e=(b.lng()-a.lng())*Math.PI/180,f=Math.sin(d/2)*Math.sin(d/2)+Math.cos(a.lat()*Math.PI/180)*Math.cos(b.lat()*Math.PI/180)*Math.sin(e/2)*Math.sin(e/2),g=2*Math.atan2(Math.sqrt(f),Math.sqrt(1-f)),h=c*g;return h},MarkerClusterer.prototype.isMarkerInBounds_=function(a,b){return b.contains(a.getPosition())},MarkerClusterer.prototype.addToClosestCluster_=function(a){var b,c,d,e,f=4e4,g=null;for(b=0;b<this.clusters_.length;b++)d=this.clusters_[b],e=d.getCenter(),e&&(c=this.distanceBetweenPoints_(e,a.getPosition()),c<f&&(f=c,g=d));g&&g.isMarkerInClusterBounds(a)?g.addMarker(a):(d=new Cluster(this),d.addMarker(a),this.clusters_.push(d))},MarkerClusterer.prototype.createClusters_=function(a){var b,c,d,e=this;if(this.ready_){0===a&&(google.maps.event.trigger(this,"clusteringbegin",this),"undefined"!=typeof this.timerRefStatic&&(clearTimeout(this.timerRefStatic),delete this.timerRefStatic)),d=this.getMap().getZoom()>3?new google.maps.LatLngBounds(this.getMap().getBounds().getSouthWest(),this.getMap().getBounds().getNorthEast()):new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472,-178.48388434375),new google.maps.LatLng(-85.08136444384544,178.00048865625));var f=this.getExtendedBounds(d),g=Math.min(a+this.batchSize_,this.markers_.length);for(b=a;b<g;b++)c=this.markers_[b],!c.isAdded&&this.isMarkerInBounds_(c,f)&&(!this.ignoreHidden_||this.ignoreHidden_&&c.getVisible())&&this.addToClosestCluster_(c);g<this.markers_.length?this.timerRefStatic=setTimeout(function(){e.createClusters_(g)},0):(delete this.timerRefStatic,google.maps.event.trigger(this,"clusteringend",this))}},MarkerClusterer.prototype.extend=function(a,b){return function(a){var b;for(b in a.prototype)this.prototype[b]=a.prototype[b];return this}.apply(a,[b])},MarkerClusterer.CALCULATOR=function(a,b){for(var c=0,d="",e=a.length.toString(),f=e;0!==f;)f=parseInt(f/10,10),c++;return c=Math.min(c,b),{text:e,index:c,title:d}},MarkerClusterer.BATCH_SIZE=2e3,MarkerClusterer.BATCH_SIZE_IE=500,MarkerClusterer.IMAGE_PATH="../images/m",MarkerClusterer.IMAGE_EXTENSION="png",MarkerClusterer.IMAGE_SIZES=[53,56,66,78,90]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="uk-grid msearch2" id="mse2_mfilter" data-uk-grid-match data-uk-grid-margin> | |
<div class="uk-width-large-1-4 uk-width-medium-1-1 tm-sidebar-left"> | |
<div class="uk-panel"> | |
<div class="uk-h4" style="line-height:35px;">Выбор дилера</div> | |
<form action="[[~[[*id]]]]" method="post" id="mse2_filters" class="tm-catalog"> | |
[[+filters]] | |
[[+filters:isnot=``:then=` | |
<div class="uk-padding-top-remove uk-contrast uk-text-center"> | |
<button type="submit" class="uk-button uk-button-primary tm-button-nav hidden">Отфильтровать</button> | |
</div> | |
<div class="uk-margin-small-top uk-margin-small-bottom uk-contrast uk-text-center"> | |
<button type="reset" class="tm-button-filter-reset hidden">[[%mse2_reset]]</button> | |
</div> | |
`]] | |
</form> | |
</div> | |
</div> | |
<div class="uk-width-large-3-4 uk-width-medium-1-1"> | |
<div class="uk-panel" > | |
{set $mse2Tpl = $_modx->getPlaceholder('mse2_tpl')} | |
[[+tpls:notempty=` | |
<ul class="uk-tab tm-tab-noline uk-text-center"> | |
<li{if $mse2Tpl == ''} class="uk-active"{/if}><a href="/dilers?tpl=0">Карта</a></li> | |
<li{if $mse2Tpl == '1'} class="uk-active"{/if}><a href="/dilers?tpl=1">Список</a></li> | |
</ul> | |
`]] | |
<div class="uk-switcher tm-dilers-switcher uk-margin-top"> | |
<div class="uk-active" id="mse2_results"> | |
{if $mse2Tpl == ''} | |
<div class="google-map-container"> | |
<!-- Map --> | |
<div id="map-container"> | |
<div id="map" data-map-zoom="3" data-map-scroll="true"> | |
</div> | |
<!-- Map Navigation --> | |
<a href="#" id="geoLocation" title="Найти рядом">Найти рядом</a> | |
<ul id="mapnav-buttons" class="top"> | |
<li><a href="#" id="prevpoint" title="Назад">Назад</a></li> | |
<li><a href="#" id="nextpoint" title="Вперед">Вперед</a></li> | |
</ul> | |
</div> | |
<script> | |
(function($) { | |
"use strict"; | |
var markerIcon = { | |
path: 'M19.9,0c-0.2,0-1.6,0-1.8,0C8.8,0.6,1.4,8.2,1.4,17.8c0,1.4,0.2,3.1,0.5,4.2c-0.1-0.1,0.5,1.9,0.8,2.6c0.4,1,0.7,2.1,1.2,3 c2,3.6,6.2,9.7,14.6,18.5c0.2,0.2,0.4,0.5,0.6,0.7c0,0,0,0,0,0c0,0,0,0,0,0c0.2-0.2,0.4-0.5,0.6-0.7c8.4-8.7,12.5-14.8,14.6-18.5 c0.5-0.9,0.9-2,1.3-3c0.3-0.7,0.9-2.6,0.8-2.5c0.3-1.1,0.5-2.7,0.5-4.1C36.7,8.4,29.3,0.6,19.9,0z M2.2,22.9 C2.2,22.9,2.2,22.9,2.2,22.9C2.2,22.9,2.2,22.9,2.2,22.9C2.2,22.9,3,25.2,2.2,22.9z M19.1,26.8c-5.2,0-9.4-4.2-9.4-9.4 s4.2-9.4,9.4-9.4c5.2,0,9.4,4.2,9.4,9.4S24.3,26.8,19.1,26.8z M36,22.9C35.2,25.2,36,22.9,36,22.9C36,22.9,36,22.9,36,22.9 C36,22.9,36,22.9,36,22.9z M13.8,17.3a5.3,5.3 0 1,0 10.6,0a5.3,5.3 0 1,0 -10.6,0', | |
strokeOpacity: 0, | |
strokeWeight: 1, | |
fillColor: '#274abb', | |
fillOpacity: 1, | |
rotation: 0, | |
scale: 1, | |
anchor: new google.maps.Point(19, 50) | |
} | |
$(window).on('load resize', function() { | |
var topbarHeight = $("#top-bar").height(); | |
var headerHeight = $("#header").innerHeight() + topbarHeight; | |
$(".fs-container").css('height', '' + $(window).height() - headerHeight + 'px'); | |
}); | |
function mainMap() { | |
function locationData(locationURL, locationPrice, locationPriceDetails, locationImg, locationTitle, locationAddress) { | |
return ('<a href="' + locationURL + '" class="listing-img-container"><div class="infoBox-close uk-close"><i class="fa fa-times"></i></div><div class="listing-img-content"><span class="listing-price">' + locationPrice + '<i>' + locationPriceDetails + '</i></span></div><img src="' + locationImg + '" alt=""></a><div class="listing-content"><div class="listing-title"><h6>' + locationTitle + '</h6><p>' + locationAddress + '</p></div></div>') | |
} | |
var locations = [ | |
[[+results]] | |
]; | |
var mapZoomAttr = $('#map').attr('data-map-zoom'); | |
var mapScrollAttr = $('#map').attr('data-map-scroll'); | |
if (typeof mapZoomAttr !== typeof undefined && mapZoomAttr !== false) { | |
var zoomLevel = parseInt(mapZoomAttr); | |
} else { | |
var zoomLevel = 5; | |
} | |
if (typeof mapScrollAttr !== typeof undefined && mapScrollAttr !== false) { | |
var scrollEnabled = parseInt(mapScrollAttr); | |
} else { | |
var scrollEnabled = false; | |
} | |
var map = new google.maps.Map(document.getElementById('map'), { | |
zoom: zoomLevel, | |
scrollwheel: scrollEnabled, | |
center: new google.maps.LatLng(52.4000000, 54.9833300), | |
mapTypeId: google.maps.MapTypeId.ROADMAP, | |
zoomControl: false, | |
mapTypeControl: false, | |
scaleControl: false, | |
panControl: false, | |
navigationControl: false, | |
streetViewControl: false, | |
gestureHandling: 'cooperative', | |
styles: [{ | |
"featureType": "poi", | |
"elementType": "labels.text.fill", | |
"stylers": [{ | |
"color": "#747474" | |
}, { | |
"lightness": "23" | |
}] | |
}, { | |
"featureType": "poi.attraction", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#f38eb0" | |
}] | |
}, { | |
"featureType": "poi.government", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#ced7db" | |
}] | |
}, { | |
"featureType": "poi.medical", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#ffa5a8" | |
}] | |
}, { | |
"featureType": "poi.park", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#c7e5c8" | |
}] | |
}, { | |
"featureType": "poi.place_of_worship", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#d6cbc7" | |
}] | |
}, { | |
"featureType": "poi.school", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#c4c9e8" | |
}] | |
}, { | |
"featureType": "poi.sports_complex", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#b1eaf1" | |
}] | |
}, { | |
"featureType": "road", | |
"elementType": "geometry", | |
"stylers": [{ | |
"lightness": "100" | |
}] | |
}, { | |
"featureType": "road", | |
"elementType": "labels", | |
"stylers": [{ | |
"visibility": "off" | |
}, { | |
"lightness": "100" | |
}] | |
}, { | |
"featureType": "road.highway", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#ffd4a5" | |
}] | |
}, { | |
"featureType": "road.arterial", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#ffe9d2" | |
}] | |
}, { | |
"featureType": "road.local", | |
"elementType": "all", | |
"stylers": [{ | |
"visibility": "simplified" | |
}] | |
}, { | |
"featureType": "road.local", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"weight": "3.00" | |
}] | |
}, { | |
"featureType": "road.local", | |
"elementType": "geometry.stroke", | |
"stylers": [{ | |
"weight": "0.30" | |
}] | |
}, { | |
"featureType": "road.local", | |
"elementType": "labels.text", | |
"stylers": [{ | |
"visibility": "on" | |
}] | |
}, { | |
"featureType": "road.local", | |
"elementType": "labels.text.fill", | |
"stylers": [{ | |
"color": "#747474" | |
}, { | |
"lightness": "36" | |
}] | |
}, { | |
"featureType": "road.local", | |
"elementType": "labels.text.stroke", | |
"stylers": [{ | |
"color": "#e9e5dc" | |
}, { | |
"lightness": "30" | |
}] | |
}, { | |
"featureType": "transit.line", | |
"elementType": "geometry", | |
"stylers": [{ | |
"visibility": "on" | |
}, { | |
"lightness": "100" | |
}] | |
}, { | |
"featureType": "water", | |
"elementType": "all", | |
"stylers": [{ | |
"color": "#d2e7f7" | |
}] | |
}] | |
}); | |
var boxText = document.createElement("div"); | |
boxText.className = 'map-box' | |
var currentInfobox; | |
var boxOptions = { | |
content: boxText, | |
disableAutoPan: true, | |
alignBottom: true, | |
maxWidth: 0, | |
pixelOffset: new google.maps.Size(-60, -55), | |
zIndex: null, | |
boxStyle: { | |
width: "260px" | |
}, | |
closeBoxMargin: "0", | |
closeBoxURL: "", | |
infoBoxClearance: new google.maps.Size(1, 1), | |
isHidden: false, | |
pane: "floatPane", | |
enableEventPropagation: false, | |
}; | |
var markerCluster, marker, i; | |
var allMarkers = []; | |
var clusterStyles = [{ | |
textColor: 'white', | |
url: '', | |
height: 50, | |
width: 50 | |
}]; | |
var zoomControlDiv = document.createElement('div'); | |
var zoomControl = new ZoomControl(zoomControlDiv, map); | |
function ZoomControl(controlDiv, map) { | |
zoomControlDiv.index = 1; | |
map.controls[google.maps.ControlPosition.RIGHT_CENTER].push(zoomControlDiv); | |
controlDiv.style.padding = '5px'; | |
var controlWrapper = document.createElement('div'); | |
controlDiv.appendChild(controlWrapper); | |
var zoomInButton = document.createElement('div'); | |
zoomInButton.className = "custom-zoom-in"; | |
controlWrapper.appendChild(zoomInButton); | |
var zoomOutButton = document.createElement('div'); | |
zoomOutButton.className = "custom-zoom-out"; | |
controlWrapper.appendChild(zoomOutButton); | |
google.maps.event.addDomListener(zoomInButton, 'click', function() { | |
map.setZoom(map.getZoom() + 1); | |
}); | |
google.maps.event.addDomListener(zoomOutButton, 'click', function() { | |
map.setZoom(map.getZoom() - 1); | |
}); | |
} | |
for (i = 0; i < locations.length; i++) { | |
marker = new google.maps.Marker({ | |
position: new google.maps.LatLng(locations[i][1], locations[i][2]), | |
icon: locations[i][4], | |
id: i | |
}); | |
allMarkers.push(marker); | |
var ib = new InfoBox(); | |
google.maps.event.addListener(marker, 'click', (function(marker, i) { | |
return function() { | |
ib.setOptions(boxOptions); | |
boxText.innerHTML = locations[i][0]; | |
ib.open(map, marker); | |
currentInfobox = marker.id; | |
var latLng = new google.maps.LatLng(locations[i][1], locations[i][2]); | |
map.panTo(latLng); | |
map.panBy(0, -180); | |
google.maps.event.addListener(ib, 'domready', function() { | |
$('.infoBox-close').click(function(e) { | |
e.preventDefault(); | |
ib.close(); | |
}); | |
}); | |
} | |
})(marker, i)); | |
} | |
var options = { | |
imagePath: 'images/', | |
styles: clusterStyles, | |
minClusterSize: 2 | |
}; | |
markerCluster = new MarkerClusterer(map, allMarkers, options); | |
google.maps.event.addDomListener(window, "resize", function() { | |
var center = map.getCenter(); | |
google.maps.event.trigger(map, "resize"); | |
map.setCenter(center); | |
}); | |
var scrollEnabling = $('#scrollEnabling'); | |
$(scrollEnabling).click(function(e) { | |
e.preventDefault(); | |
$(this).toggleClass("enabled"); | |
if ($(this).is(".enabled")) { | |
map.setOptions({ | |
'scrollwheel': true | |
}); | |
} else { | |
map.setOptions({ | |
'scrollwheel': false | |
}); | |
} | |
}) | |
$("#geoLocation").click(function(e) { | |
e.preventDefault(); | |
geolocate(); | |
}); | |
// check for Geolocation support | |
if (navigator.geolocation) { | |
console.log('Geolocation is supported!'); | |
} | |
else { | |
console.log('Geolocation is not supported for this Browser/OS version yet.'); | |
} | |
function geolocate() { | |
if (navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(function(position) { | |
var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); | |
map.setCenter(pos); | |
map.setZoom(10); | |
}); | |
} | |
} | |
$('#nextpoint').click(function(e) { | |
e.preventDefault(); | |
map.setZoom(15); | |
var index = currentInfobox; | |
if (index + 1 < allMarkers.length) { | |
google.maps.event.trigger(allMarkers[index + 1], 'click'); | |
} else { | |
google.maps.event.trigger(allMarkers[0], 'click'); | |
} | |
}); | |
$('#prevpoint').click(function(e) { | |
e.preventDefault(); | |
map.setZoom(15); | |
if (typeof(currentInfobox) == "undefined") { | |
google.maps.event.trigger(allMarkers[allMarkers.length - 1], 'click'); | |
} else { | |
var index = currentInfobox; | |
if (index - 1 < 0) { | |
google.maps.event.trigger(allMarkers[allMarkers.length - 1], 'click'); | |
} else { | |
google.maps.event.trigger(allMarkers[index - 1], 'click'); | |
} | |
} | |
}); | |
} | |
var map = document.getElementById('map'); | |
if (typeof(map) != 'undefined' && map != null) { | |
google.maps.event.addDomListener(window, 'load', mainMap); | |
google.maps.event.addDomListener(window, 'resize', mainMap); | |
} | |
function singlePropertyMap() { | |
var myLatLng = { | |
lng: $('#propertyMap').data('longitude'), | |
lat: $('#propertyMap').data('latitude'), | |
}; | |
var single_map = new google.maps.Map(document.getElementById('propertyMap'), { | |
zoom: 10, | |
center: myLatLng, | |
scrollwheel: false, | |
zoomControl: false, | |
mapTypeControl: false, | |
scaleControl: false, | |
panControl: false, | |
navigationControl: false, | |
streetViewControl: false, | |
styles: [{ | |
"featureType": "poi", | |
"elementType": "labels.text.fill", | |
"stylers": [{ | |
"color": "#747474" | |
}, { | |
"lightness": "23" | |
}] | |
}, { | |
"featureType": "poi.attraction", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#f38eb0" | |
}] | |
}, { | |
"featureType": "poi.government", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#ced7db" | |
}] | |
}, { | |
"featureType": "poi.medical", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#ffa5a8" | |
}] | |
}, { | |
"featureType": "poi.park", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#c7e5c8" | |
}] | |
}, { | |
"featureType": "poi.place_of_worship", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#d6cbc7" | |
}] | |
}, { | |
"featureType": "poi.school", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#c4c9e8" | |
}] | |
}, { | |
"featureType": "poi.sports_complex", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#b1eaf1" | |
}] | |
}, { | |
"featureType": "road", | |
"elementType": "geometry", | |
"stylers": [{ | |
"lightness": "100" | |
}] | |
}, { | |
"featureType": "road", | |
"elementType": "labels", | |
"stylers": [{ | |
"visibility": "off" | |
}, { | |
"lightness": "100" | |
}] | |
}, { | |
"featureType": "road.highway", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#ffd4a5" | |
}] | |
}, { | |
"featureType": "road.arterial", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"color": "#ffe9d2" | |
}] | |
}, { | |
"featureType": "road.local", | |
"elementType": "all", | |
"stylers": [{ | |
"visibility": "simplified" | |
}] | |
}, { | |
"featureType": "road.local", | |
"elementType": "geometry.fill", | |
"stylers": [{ | |
"weight": "3.00" | |
}] | |
}, { | |
"featureType": "road.local", | |
"elementType": "geometry.stroke", | |
"stylers": [{ | |
"weight": "0.30" | |
}] | |
}, { | |
"featureType": "road.local", | |
"elementType": "labels.text", | |
"stylers": [{ | |
"visibility": "on" | |
}] | |
}, { | |
"featureType": "road.local", | |
"elementType": "labels.text.fill", | |
"stylers": [{ | |
"color": "#747474" | |
}, { | |
"lightness": "36" | |
}] | |
}, { | |
"featureType": "road.local", | |
"elementType": "labels.text.stroke", | |
"stylers": [{ | |
"color": "#e9e5dc" | |
}, { | |
"lightness": "30" | |
}] | |
}, { | |
"featureType": "transit.line", | |
"elementType": "geometry", | |
"stylers": [{ | |
"visibility": "on" | |
}, { | |
"lightness": "100" | |
}] | |
}, { | |
"featureType": "water", | |
"elementType": "all", | |
"stylers": [{ | |
"color": "#d2e7f7" | |
}] | |
}] | |
}); | |
var marker = new google.maps.Marker({ | |
position: myLatLng, | |
map: single_map, | |
icon: markerIcon | |
}); | |
var zoomControlDiv = document.createElement('div'); | |
var zoomControl = new ZoomControl(zoomControlDiv, single_map); | |
function ZoomControl(controlDiv, single_map) { | |
zoomControlDiv.index = 1; | |
single_map.controls[google.maps.ControlPosition.RIGHT_CENTER].push(zoomControlDiv); | |
controlDiv.style.padding = '5px'; | |
var controlWrapper = document.createElement('div'); | |
controlDiv.appendChild(controlWrapper); | |
var zoomInButton = document.createElement('div'); | |
zoomInButton.className = "custom-zoom-in"; | |
controlWrapper.appendChild(zoomInButton); | |
var zoomOutButton = document.createElement('div'); | |
zoomOutButton.className = "custom-zoom-out"; | |
controlWrapper.appendChild(zoomOutButton); | |
google.maps.event.addDomListener(zoomInButton, 'click', function() { | |
single_map.setZoom(single_map.getZoom() + 1); | |
}); | |
google.maps.event.addDomListener(zoomOutButton, 'click', function() { | |
single_map.setZoom(single_map.getZoom() - 1); | |
}); | |
} | |
$('#streetView').click(function(e) { | |
e.preventDefault(); | |
single_map.getStreetView().setOptions({ | |
visible: true, | |
position: myLatLng | |
}); | |
$(this).css('display', 'none') | |
}); | |
} | |
var single_map = document.getElementById('propertyMap'); | |
if (typeof(single_map) != 'undefined' && single_map != null) { | |
google.maps.event.addDomListener(window, 'load', singlePropertyMap); | |
google.maps.event.addDomListener(window, 'resize', singlePropertyMap); | |
} | |
})(this.jQuery); | |
</script> | |
</div> | |
{else} | |
<div class="uk-panel uk-overflow-container"> | |
<table class="uk-table tm-dilers-table"> | |
<thead> | |
<tr> | |
<td> | |
<span>Город</span> | |
{if 54 | resource : 'tul_name' != ''} | |
<i class="tm-icon-question" data-uk-tooltip title="{54 | resource : 'tul_name'}"></i> | |
{/if} | |
</td> | |
<td> | |
<span>Дилер</span> | |
{if 54 | resource : 'tul_city' != ''} | |
<i class="tm-icon-question" data-uk-tooltip title="{54 | resource : 'tul_city'}"></i> | |
{/if} | |
</td> | |
<td> | |
<span>Купить</span> | |
{if 54 | resource : 'tul_price2' != ''} | |
<i class="tm-icon-question" data-uk-tooltip title="{54 | resource : 'tul_price2'}"></i> | |
{/if} | |
</td> | |
<td> | |
<span>Запас</span> | |
{if 54 | resource : 'tul_stock' != ''} | |
<i class="tm-icon-question" data-uk-tooltip title="{54 | resource : 'tul_stock'}"></i> | |
{/if} | |
</td> | |
<td> | |
<span>Монтаж</span> | |
{if 54 | resource : 'tul_installation' != ''} | |
<i class="tm-icon-question" data-uk-tooltip title="{54 | resource : 'tul_installation'}"></i> | |
{/if} | |
</td> | |
<td> | |
<span>Консуль­тация</span> | |
{if 54 | resource : 'tul_consultation' != ''} | |
<i class="tm-icon-question" data-uk-tooltip title="{54 | resource : 'tul_consultation'}"></i> | |
{/if} | |
</td> | |
<td> | |
<span>Аксес­суары</span> | |
{if 54 | resource : 'tul_accessories' != ''} | |
<i class="tm-icon-question" data-uk-tooltip title="{54 | resource : 'tul_accessories'}"></i> | |
{/if} | |
</td> | |
</tr> | |
</thead> | |
<tbody> | |
[[+results]] | |
</tbody> | |
</table> | |
<div> | |
[[!+page.nav]] | |
</div> | |
</div> | |
{/if} | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[locationData(' [[+tv.urlDiler:is=``:then=`javascript:event.preventDefault()`:else=`[[+tv.urlDiler]]`]]', '[[+pagetitle]]', ' ', '[[+maps]]', '[[+tv.map:JSONtoChunk=`map_address`]]<br>{$_pls['tv.telDiler']}<br>{$_pls['tv.emailDiler']}<br>{if $_pls['tv.emailDiler2']?}{$_pls['tv.emailDiler2']}{/if}<br>{if $_pls['tv.emailDiler3']?}{$_pls['tv.emailDiler3']}{/if}<br>{if $_pls['tv.introt']?} <br>{$_pls['tv.introt']}{else} {/if}' , "[[+tv.dilers:getTvDisplayName=`tv.`:replace=`,== `]] "), [[+tv.map:JSONtoChunk=`map_latitude`]], [[+tv.map:JSONtoChunk=`map_longitude`]], [[+idx]], markerIcon], |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment