I make a website on NetCat where a Yandex map is needed, but not simple - when clicking on a map, a balun should pop up with a form where information should be entered, among which there should be a line for entering the time in the hh: mm: ss format.
I made the map and the opening balun, since there are examples on the Yandex website, I also put the form in there, but when I decided to connect the jQuery Timepicker Addon 0.5 plug-in, there was a problem - this plug-in does not want to work inside the map script. Although if you just use it on the component page, then everything works. I appeal to you for help.
Here is the code of my card with the form and attempt to connect the plugin:
// ΠΠ°ΠΊ ΡΠΎΠ»ΡΠΊΠΎ Π±ΡΠ΄Π΅Ρ Π·Π°Π³ΡΡΠΆΠ΅Π½ API ΠΈ Π³ΠΎΡΠΎΠ² DOM, Π²ΡΠΏΠΎΠ»Π½ΡΠ΅ΠΌ ΠΈΠ½ΠΈΡΠΈΠ°Π»ΠΈΠ·Π°ΡΠΈΡ ymaps.ready(init); function init () { var myMap = new ymaps.Map('map', { center: [55.790833, 49.114444], // ΠΡΠ°ΡΠ½ΠΎΠ΅-Π½Π°-ΠΠΎΠ»Π³Π΅ zoom: 11 }, { balloonMaxWidth: 250 }); // ΠΠ±ΡΠ°Π±ΠΎΡΠΊΠ° ΡΠΎΠ±ΡΡΠΈΡ, Π²ΠΎΠ·Π½ΠΈΠΊΠ°ΡΡΠ΅Π³ΠΎ ΠΏΡΠΈ ΡΠ΅Π»ΡΠΊΠ΅ // Π»Π΅Π²ΠΎΠΉ ΠΊΠ½ΠΎΠΏΠΊΠΎΠΉ ΠΌΡΡΠΈ Π² Π»ΡΠ±ΠΎΠΉ ΡΠΎΡΠΊΠ΅ ΠΊΠ°ΡΡΡ. // ΠΡΠΈ Π²ΠΎΠ·Π½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΠΈ ΡΠ°ΠΊΠΎΠ³ΠΎ ΡΠΎΠ±ΡΡΠΈΡ ΠΎΡΠΊΡΠΎΠ΅ΠΌ Π±Π°Π»ΡΠ½. myMap.events.add('click', function (e) { if (!myMap.balloon.isOpen()) { var coords = e.get('coordPosition'); myMap.balloon.open(coords, { contentHeader: 'ΠΠΎΠ²Π°Ρ ΠΊΠΎΠ½ΡΡΠΎΠ»ΡΠ½Π°Ρ Π·ΠΎΠ½Π°', contentBody: '<form id=formadd action=/template/control_zones/outpoint.php method=post target=_self>'+ 'Π£ΡΡΡΠΎΠΉΡΡΠ²ΠΎ ΠΊ ΠΊΠΎΡΠΎΡΠΎΠΌΡ Π±ΡΠ΄Π΅Ρ Π΄ΠΎΠ±Π°Π²Π»Π΅Π½Π° ΠΊΠΎΠ½ΡΡΠΎΠ»ΡΠ½Π°Ρ Π·ΠΎΠ½Π° :'+ ' "; $res_devicesList = mysql_query(" SELECT * FROM `siteonfly_tracker`.`Message113` WHERE `User_ID` = '$current_user[User_ID]' "); $result .='<select name="deviceID" size="1" >'; while($list = mysql_fetch_assoc($res_devicesList)) { $result .= '<option value="'.$list[DeviceID].'">'.$list['Name'].' '.$list[DeviceID].'</option>';//Device_ID } $result .= '</select>'; $res_phone = mysql_query(" SELECT `Phone` FROM `siteonfly_tracker`.`User` WHERE `User_ID` = '$current_user[User_ID]' "); $phone_sel = mysql_fetch_assoc($res_phone); $phone = $phone_sel['Phone']; $result.=" '+ 'ΠΠ°Π·Π²Π°Π½ΠΈΠ΅ :<input type=text name=namepoint><br>'+ 'Π Π°Π΄ΠΈΡΡ :<input type=text name=radiuspoint><br>'+ ' "; $result .='<input type="text" name="testTime" style="width: 70px;" id="timepickerTestInMap" value="" />'; //$result .='<script type="text/javascript">'; $result .=' $(document).ready(function() {'; $result .=' $("#timepickerTestInMap").timepicker();'; $result .=' });'; //$result .=' </script>'; $result .=" '+ ' "; $result .= 'ΠΡΠ΅ΠΌΡ Π½Π°ΡΠ°Π»Π° ΠΊΠΎΠ½ΡΡΠΎΠ»Ρ (ΡΡ:ΠΌΠΌ:ΡΡ) :<input type="text" name="begintime" style="width: 70px;" id="timepickerBegin" value="">'; $result.=" '+ ' "; $result .= '<br>ΠΡΠ΅ΠΌΡ ΠΎΠΊΠΎΠ½ΡΠ°Π½ΠΈΡ ΠΊΠΎΠ½ΡΡΠΎΠ»Ρ (ΡΡ:ΠΌΠΌ:ΡΡ) :<input type="text" name="endtime" style="width: 70px;" id="timepickerEnd" value="">'; $result.=" '+ '<input type=submit name=submit_cz >'+ '<input name=pcoord type=hidden value='+coords[0].toPrecision(6)+';'+coords[1].toPrecision(6)+' />'+ '<input name=phone type=hidden value=$phone />'+ '</form>', contentFooter: '<p>ΠΠΎΠΎΡΠ΄ΠΈΠ½Π°ΡΡ ΠΊΠΎΠ½ΡΡΠΎΠ»ΡΠ½ΠΎΠΉ Π·ΠΎΠ½Ρ: ' + [ coords[0].toPrecision(6), coords[1].toPrecision(6) ].join(', ') + '</p>' }); } else { myMap.balloon.close(); } }); // ΠΠ±ΡΠ°Π±ΠΎΡΠΊΠ° ΡΠΎΠ±ΡΡΠΈΡ, Π²ΠΎΠ·Π½ΠΈΠΊΠ°ΡΡΠ΅Π³ΠΎ ΠΏΡΠΈ ΡΠ΅Π»ΡΠΊΠ΅ // ΠΏΡΠ°Π²ΠΎΠΉ ΠΊΠ½ΠΎΠΏΠΊΠΈ ΠΌΡΡΠΈ Π² Π»ΡΠ±ΠΎΠΉ ΡΠΎΡΠΊΠ΅ ΠΊΠ°ΡΡΡ. // ΠΡΠΈ Π²ΠΎΠ·Π½ΠΈΠΊΠ½ΠΎΠ²Π΅Π½ΠΈΠΈ ΡΠ°ΠΊΠΎΠ³ΠΎ ΡΠΎΠ±ΡΡΠΈΡ ΠΏΠΎΠΊΠ°ΠΆΠ΅ΠΌ Π²ΡΠΏΠ»ΡΠ²Π°ΡΡΡΡ ΠΏΠΎΠ΄ΡΠΊΠ°Π·ΠΊΡ. myMap.events.add('contextmenu', function (e) { myMap.hint.show(e.get('coordPosition'), 'ΠΡΠΎ-ΡΠΎ ΡΠ΅Π»ΠΊΠ½ΡΠ» ΠΏΡΠ°Π²ΠΎΠΉ ΠΊΠ½ΠΎΠΏΠΊΠΎΠΉ'); }); //ΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΠ΅ ΠΊΠ°ΡΡΠΎΠΉ myMap.behaviors.enable('scrollZoom') // ΠΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ ΡΡΠ°Π½Π΄Π°ΡΡΠ½ΠΎΠ³ΠΎ Π½Π°Π±ΠΎΡΠ° ΠΊΠ½ΠΎΠΏΠΎΠΊ myMap.controls.add('mapTools') // ΠΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ ΠΊΠ½ΠΎΠΏΠΊΠΈ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΡ ΠΌΠ°ΡΡΡΠ°Π±Π° .add('zoomControl') // ΠΠΎΠ±Π°Π²Π»Π΅Π½ΠΈΠ΅ ΡΠΏΠΈΡΠΊΠ° ΡΠΈΠΏΠΎΠ² ΠΊΠ°ΡΡΡ .add('typeSelector'); }
as you can see, I first tried to shove the script into the script, but then when meeting the internal </script>
external script of the map was closed, so I commented out this place, but now the code for calling the plugin function crawls out of the page.
PS for those who do not know - in NetCat php
code is inserted using this construct "; *[php ΠΊΠΎΠ΄]* $result.="
, Where everything
`echo '';`
need to be replaced by
>$result.='';