From a7ee139aa4021adb5caf053c8d1e20ba660db853 Mon Sep 17 00:00:00 2001 From: Pavel Date: Thu, 23 Jul 2015 11:47:17 +0500 Subject: [PATCH 1/5] * Now using jquery.ddYmap-1.4. --- ddYMap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ddYMap.php b/ddYMap.php index f9ba3a9..1d458c5 100644 --- a/ddYMap.php +++ b/ddYMap.php @@ -51,7 +51,7 @@ //Подключаем библиотеку карт $modx->regClientStartupScript('http://api-maps.yandex.ru/2.1/?lang='.$lang, array('name' => 'api-maps.yandex.ru', 'version' => '2.1')); //Подключаем $.ddYMap - $modx->regClientStartupScript($modx->getConfig('site_url').'assets/js/jquery.ddYMap-1.3.1.min.js', array('name' => '$.ddYMap', 'version' => '1.3.1')); + $modx->regClientStartupScript($modx->getConfig('site_url').'assets/js/jquery.ddYMap-1.4.min.js', array('name' => '$.ddYMap', 'version' => '1.4')); //Инлайн-скрипт инициализации $inlineScript = '(function($){$(function(){$("'.$mapElement.'").ddYMap({placemarks: new Array('.$geoPos.')'; From e9abd966ef812703796f871835d64178cbcc868f Mon Sep 17 00:00:00 2001 From: lavrov Date: Fri, 15 Sep 2017 03:42:59 +0300 Subject: [PATCH 2/5] =?UTF-8?q?*=20Fixed=20javascript=20error=20=C2=ABMixe?= =?UTF-8?q?d=20Content:=20the=20content=20must=20be=20served=20over=20HTTP?= =?UTF-8?q?S.=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ddYMap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ddYMap.php b/ddYMap.php index 1d458c5..2c3a75e 100644 --- a/ddYMap.php +++ b/ddYMap.php @@ -49,7 +49,7 @@ if (empty($mapElement)){$mapElement = '#map';} //Подключаем библиотеку карт - $modx->regClientStartupScript('http://api-maps.yandex.ru/2.1/?lang='.$lang, array('name' => 'api-maps.yandex.ru', 'version' => '2.1')); + $modx->regClientStartupScript('//api-maps.yandex.ru/2.1/?lang='.$lang, array('name' => 'api-maps.yandex.ru', 'version' => '2.1')); //Подключаем $.ddYMap $modx->regClientStartupScript($modx->getConfig('site_url').'assets/js/jquery.ddYMap-1.4.min.js', array('name' => '$.ddYMap', 'version' => '1.4')); From 3f985c6b08cda9b2381734a35bcc910e3f2a0e69 Mon Sep 17 00:00:00 2001 From: lavrov Date: Thu, 26 Oct 2017 02:25:26 +0300 Subject: [PATCH 3/5] * Minnor refactoring --- assets/js/jquery.ddYMap-1.3.1.min.js | 31 --------------------------- assets/js/jquery.ddYMap-1.4.min.js | 32 ++++++++++++++++++++++++++++ ddYMap.php | 5 ++--- 3 files changed, 34 insertions(+), 34 deletions(-) delete mode 100644 assets/js/jquery.ddYMap-1.3.1.min.js create mode 100644 assets/js/jquery.ddYMap-1.4.min.js diff --git a/assets/js/jquery.ddYMap-1.3.1.min.js b/assets/js/jquery.ddYMap-1.3.1.min.js deleted file mode 100644 index 09541ae..0000000 --- a/assets/js/jquery.ddYMap-1.3.1.min.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * jQuery ddYMap Plugin - * @version 1.3.1 (2014-07-24) - * - * @desc A jQuery library that allows Yandex.Maps to be rendered on a page in a simple way. - * - * @uses jQuery 1.10.2. - * @uses Yandex.Maps 2.1. - * - * Parameters of the “$.fn.ddYMap” method (transferred as plain object). - * @param placemarks {array} - Array of placemarks to be put on the map. If there is more than one placemark, the map will be scaled to make all the placemarks visible. Also, a pair of coordinates still can be passed (like it was in 1.2 and earlier). @required - * @param placemarks[i] {plain object} - Placemark data. @required - * @param placemarks[i].latLng {array} - Placemark coordinates (latitude and longitude). @required - * @param placemarks[i].content {string: html} - Balloon content. Default: ''. - * @param defaultZoom {integer} - Default map zoom. Default: 15. - * @param defaultType {'map'; 'satellite'; 'hybrid'; 'publicMap'; 'publicMapHybrid'} - Default map type: 'map' — schematic map, 'satellite' — satellite map, 'hybrid' — hybrid map, 'publicMap' — public map, 'publicMapHybrid' - hybrid public map. Default: 'map'; - * @param scrollZoom {boolean} - Allow zoom while scrolling. Default: false. - * @param mapCenterOffset {array} - Center offset of the map with respect to the center of the map container in pixels. Default: [0, 0]. - * @param placemarkOptions {plain object} - Placemark options. Default: {}. - * - * @link http://code.divandesign.biz/jquery/ddymap/1.3.1 - * - * @copyright 2014, DivanDesign - * http://www.DivanDesign.biz - */ - -(function(b){b.extend(!0,{ddYMap:{defaults:{placemarks:[],element:"map",defaultZoom:15,defaultType:"map",scrollZoom:!1,mapCenterOffset:!1,placemarkOptions:{}},verifyRenamedParams:function(a,e){var c={},f=[];b.each(e,function(d,e){"undefined"!=b.type(a[e])&&"undefined"==b.type(a[d])&&(c[d]=a[e],f.push("\u201c"+e+"\u201d must be renamed as \u201c"+d+"\u201d;"))});if(0 Date: Fri, 27 Oct 2017 00:37:52 +0300 Subject: [PATCH 4/5] =?UTF-8?q?+=20Added=20parameter=20=E2=80=9CscriptsLoc?= =?UTF-8?q?ation=E2=80=9D,=20indicating=20where=20jQuery=20scripts=20are?= =?UTF-8?q?=20included.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ddYMap.php | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/ddYMap.php b/ddYMap.php index 7de66c9..b4d3fae 100644 --- a/ddYMap.php +++ b/ddYMap.php @@ -21,6 +21,7 @@ * @param $scrollZoom {0; 1} - Allow zoom while scrolling. Default: 0. * @param $mapCenterOffset {comma separated string} - Center offset of the map with respect to the center of the map container in pixels. Default: '0,0'. * @param $lang {'ru_RU'; 'en_US'; 'ru_UA'; 'uk_UA'; 'tr_TR'} - Map language — locale ID. See http://api.yandex.com/maps/doc/jsapi/2.x/dg/concepts/load.xml for more information. Default: 'ru_RU'. + * @param $scriptsLocation {'head'; 'body';} - The tag where jQuery scripts are included. Default: 'head'. * * @link http://code.divandesign.biz/modx/ddymap/1.5 * @@ -42,16 +43,14 @@ $geoPos = $geoPos[$docField]; } +//Где должны быть подключены скрипты +$scriptsLocation = isset($scriptsLocation) ? $scriptsLocation : 'head'; + //Если координаты заданы и не пустые if (!empty($geoPos)){ if (empty($lang)){$lang = 'ru_RU';} if (empty($mapElement)){$mapElement = '#map';} - //Подключаем библиотеку карт - $modx->regClientStartupScript('//api-maps.yandex.ru/2.1/?lang='.$lang, array('name' => 'api-maps.yandex.ru', 'version' => '2.1')); - //Подключаем $.ddYMap - $modx->regClientStartupScript($modx->getConfig('site_url').'assets/js/jquery.ddYMap-1.4.min.js', array('name' => '$.ddYMap', 'version' => '1.4')); - //Инлайн-скрипт инициализации $inlineScript = '(function($){$(function(){$("'.$mapElement.'").ddYMap({placemarks: new Array('.$geoPos.')'; @@ -98,7 +97,20 @@ $inlineScript .= '});});})(jQuery);'; - //Подключаем инлайн-скрипт с инициализацией - $modx->regClientStartupScript('', array('plaintext' => true)); + if ($scriptsLocation == 'head') { + //Подключаем библиотеку карт + $modx->regClientStartupScript('//api-maps.yandex.ru/2.1/?lang=' . $lang, array('name' => 'api-maps.yandex.ru', 'version' => '2.1')); + //Подключаем $.ddYMap + $modx->regClientStartupScript($modx->getConfig('site_url') . 'assets/js/jquery.ddYMap-1.4.min.js', array('name' => '$.ddYMap', 'version' => '1.4')); + //Подключаем инлайн-скрипт с инициализацией + $modx->regClientStartupScript('', array('plaintext' => true)); + }else{ + //Подключаем библиотеку карт + $modx->regClientScript("", array('name' => 'api-maps.yandex.ru', 'version' => '2.1')); + //Подключаем $.ddYMap + $modx->regClientScript("", array('name' => '$.ddYMap', 'version' => '1.4')); + //Подключаем инлайн-скрипт с инициализацией + $modx->regClientScript("", array('plaintext' => true)); + } } ?> From 4beb52387d617ab04851df090529e7e846324aa2 Mon Sep 17 00:00:00 2001 From: lavrov Date: Tue, 28 Nov 2017 09:44:59 +0300 Subject: [PATCH 5/5] Prerelease 1.6 --- ddYMap.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ddYMap.php b/ddYMap.php index b4d3fae..33b77d4 100644 --- a/ddYMap.php +++ b/ddYMap.php @@ -1,7 +1,7 @@