WME Place Interface Enhancements

Enhancements to various Place interfaces

当前为 2017-08-27 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name WME Place Interface Enhancements
  3. // @namespace https://greasyfork.org/users/30701-justins83-waze
  4. // @version 1.02.19
  5. // @description Enhancements to various Place interfaces
  6. // @include https://www.waze.com/editor*
  7. // @include https://www.waze.com/*/editor*
  8. // @include https://beta.waze.com*
  9. // @exclude https://www.waze.com/user/editor*
  10. // @icon data:image/jpeg;base64,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
  11. // @author JustinS83
  12. // @grant none
  13. // @require https://greasyfork.org/scripts/24851-wazewrap/code/WazeWrap.js?version=212685
  14. // @require https://greasyfork.org/scripts/27023-jscolor/code/JSColor.js
  15. // @license GPLv3
  16. // ==/UserScript==
  17. var UpdateObject, MultiAction;
  18.  
  19. (function() {
  20. 'use strict';
  21.  
  22. var curr_ver = "1.02.19";
  23. var settings = {};
  24. var placeMenuSelector = "#edit-buttons > div > div.toolbar-button.waze-icon-place.toolbar-submenu.toolbar-group.toolbar-group-venues.ItemInactive > menu";
  25.  
  26. var placementMode = false;
  27. var resCategory = "RESIDENCE_HOME";
  28. var wazePL;
  29.  
  30. //Layer definitions
  31. {
  32. var layerName = "WME PIE";
  33. var newPlaceLayer, PLSpotEstimatorLayer, PLSpotEstimatorCalibrationLayer;
  34. var PIEPlaceNameLayer;
  35. var showStopPointsLayer;
  36. var closestSegmentLayer;
  37. }
  38.  
  39. //Drawing definitions
  40. {
  41. var drawPoly, PLSpotEstimatordrawControl, PLSpotEstimatorCalibrationdrawControl;
  42. var isDrawing;
  43. var pointStyle = {
  44. pointRadius: 6,
  45. fillOpacity: 0,
  46. strokeColor: '#00ece3',
  47. strokeWidth: '2',
  48. strokeLinecap: 'round'
  49. };
  50.  
  51. //Closest segment
  52. var lineStyleToNavPoint = {
  53. strokeWidth: 3,
  54. strokeColor: '#00ece3',
  55. strokeLinecap: 'round',
  56. strokeDashstyle: 'dash'
  57. },
  58. lineStyleToClosestSeg = {
  59. strokeWidth: 4,
  60. strokeColor: '#00ece3',
  61. strokeLinecap: 'round'
  62. },
  63. pointStyleNavPoint = {
  64. externalGraphic: 'http://i65.tinypic.com/28santx.gif',
  65. graphicWidth: 22,
  66. graphicHeight: 22
  67. },
  68. pointStyle = {
  69. pointRadius: 6,
  70. fillColor: 'white',
  71. fillOpacity: 1,
  72. strokeColor: '#00ece3',
  73. strokeWidth: '3',
  74. strokeLinecap: 'round'
  75. };
  76. }
  77.  
  78. function bootstrap(tries) {
  79. tries = tries || 1;
  80.  
  81. if (window.W &&
  82. window.W.map &&
  83. window.W.model &&
  84. window.W.loginManager.user &&
  85. $ && window.jscolor) {
  86. init();
  87. } else if (tries < 1000) {
  88. setTimeout(function () {bootstrap(tries++);}, 200);
  89. }
  90. }
  91.  
  92. bootstrap();
  93.  
  94. function init(){
  95. loadTranslations();
  96.  
  97. var $section = $("<div>", {style:"padding:8px 16px", id:"WMEPIESettings"});
  98. $section.html([
  99. '<h4 style="margin-bottom:0px;"><b>' + I18n.t('pie.prefs.title') + '</b></h4>',
  100. '<h6 style="margin-top:0px;">' + curr_ver + '</h6>',
  101. '<fieldset id="fieldPlacePanel" style="border: 1px solid silver; padding: 8px; border-radius: 4px;">',
  102. '<legend style="margin-bottom:0px; border-bottom-style:none;width:auto;"><h4>' + I18n.t('pie.prefs.PropertiesPanel') + '</h4></legend>',
  103. '<div class="controls-container pie-controls-container" id="divAreaPlaceSizeControls">',
  104. '<div id="divShowAreaPlaceSize" class="controls-container pie-controls-container"><input type="checkbox" id="_cbShowAreaPlaceSize" class="pieSettingsCheckbox" /><label for="_cbShowAreaPlaceSize">' + I18n.t('pie.prefs.ShowAreaPlaceSize') + '</label></div>',
  105. '<div id="divShowAreaPlaceSizeImperial"class="controls-container pie-controls-container" style="padding-left:20px;"><input type="checkbox" id="_cbShowAreaPlaceSizeImperial" class="pieSettingsCheckbox" disabled /><label for ="_cbShowAreaPlaceSizeImperial">' + I18n.t('pie.prefs.ShowImperial') + '</label></div>',
  106. '<div id="divShowAreaPlaceSizeMetric" class="controls-container pie-controls-container" style="padding-left:20px;"><input type="checkbox" id="_cbShowAreaPlaceSizeMetric" class="pieSettingsCheckbox" disabled /><label for ="_cbShowAreaPlaceSizeMetric">' + I18n.t('pie.prefs.ShowMetric') + '</label></div>',
  107. '</div>',
  108. '<div class="controls-container pie-controls-container" id="divShowLockButtonsRPP" title="' + I18n.t('pie.prefs.ShowRPPLockButtonsTitle') + '"><input type="checkbox" id="_cbShowLockButtonsRPP" class="pieSettingsCheckbox" /><label for="_cbShowLockButtonsRPP" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowRPPLockButtons') + '</label></div>',
  109. '<div class="controls-container pie-controls-container" id="divShowPlaceLocatorCrosshair" title="' + I18n.t('pie.prefs.ShowPlaceLocatorCrosshairTitle') + '" ><input type="checkbox" id="_cbShowPlaceLocatorCrosshair" class="pieSettingsCheckbox" /><label for="_cbShowPlaceLocatorCrosshair" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowPlaceLocatorCrosshair') + '</label></br>',
  110. '<span class="controls-container pie-controls-container" style="padding-left:30px;" title=""><input type="checkbox" id="_cbPlaceLocatorCrosshairProdPL" class="pieSettingsCheckbox" /><label for="_cbPlaceLocatorCrosshairProdPL" style="white-space:pre-line;">' + I18n.t('pie.prefs.ProdPL') + '</label></span></br>',
  111. '<span class="controls-container pie-controls-container" style="padding-left:30px;" title="' + I18n.t('pie.prefs.ZoomTitle') + '">' + I18n.t('pie.prefs.Zoom') + ' <select id="piePlaceZoom"><option value="10">10</option><option value="9">9</option><option value="8">8</option><option value="7">7</option><option value="6">6</option><option value="5">5</option><option value="4">4</option><option value="3">3</option><option value="2">2</option><option value="1">1</option><option value="0">0</option></select></span></div>',
  112. '<div class="controls-container pie-controls-container" id="divShowSearchButton" title="' + I18n.t('pie.prefs.ShowAddressSearchTitle') + '"><input type="checkbox" id="_cbShowSearchButton" class="pieSettingsCheckbox"/><label for="_cbShowSearchButton" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowAddressSearch') + '</label></div>',
  113. '<div class="controls-container pie-controls-container" id="divAddPlaceCategoriesButtons"><input type="checkbox" id="_cbAddPlaceCategoriesButtons" class="pieSettingsCheckbox"/><label for="_cbAddPlaceCategoriesButtons" style="white-space:pre-line;" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowPlaceCategoryButtons') + '</label></div>',
  114. '<div class="controls-container pie-controls-container" id="divShowParkingLotButton" title="' + I18n.t('pie.prefs.ShowPLAButtonTitle') + '" ><input type="checkbox" id="_cbShowParkingLotButton" class="pieSettingsCheckbox" /><label for="_cbShowParkingLotButton" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowPLAButton') + '</label></div>',
  115. '<div class="controls-container pie-controls-container" id="divShowCopyPlaceButton" title="' + I18n.t('pie.prefs.ShowCopyPlaceButtonTitle') + '" ><input type="checkbox" id="_cbShowCopyPlaceButton" class="pieSettingsCheckbox" /><label for="_cbShowCopyPlaceButton" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowCopyPlaceButton') + '</label></div>',
  116. '<div class="controls-container pie-controls-container" id="divShowExternalProviderTooltip" title="' + I18n.t('pie.prefs.ShowGPIDTooltipTitle') + '" ><input type="checkbox" id="_cbShowExternalProviderTooltip" class="pieSettingsCheckbox" /><label for="_cbShowExternalProviderTooltip" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowGPIDTooltip') + '</label></div>',
  117. '<div class="controls-container pie-controls-container" id="divClearDescription" title="' + I18n.t('pie.prefs.ClearDescriptionTitle') + '" ><input type="checkbox" id="_cbClearDescription" class="pieSettingsCheckbox" /><label for="_cbClearDescription" style="white-space:pre-line;">' + I18n.t('pie.prefs.ClearDescription') + '</label></div>',
  118. '<div class="controls-container pie-controls-container" id="divMoveAddress" title="' + I18n.t('pie.prefs.MoveAddressTitle') + '"><input type="checkbox" id="_cbMoveAddress" class="pieSettingsCheckbox"/><label for="_cbMoveAddress" style="white-space:pre-line;">' + I18n.t('pie.prefs.MoveAddress') + '</label></div>',
  119. '<div class="controls-container pie-controls-container" id="divMoveHNEntry" title="' + I18n.t('pie.prefs.MoveHNEntryTitle') + '"><input type="checkbox" id="_cbMoveHNEntry" class="pieSettingsCheckbox"/><label for="_cbMoveHNEntry" style="white-space:pre-line;">' + I18n.t('pie.prefs.MoveHNEntry') + '</label></div>',
  120. '<div class="controls-container pie-controls-container" id="divNavLink" title="' + I18n.t('pie.prefs.NavLinkTitle') + '"><input type="checkbox" id="_cbNavLink" class="pieSettingsCheckbox"/><label for="_cbNavLink" style="white-space:pre-line;">' + I18n.t('pie.prefs.NavLink') + '</label></div>',
  121. '</fieldset>',
  122.  
  123. '<fieldset id="fieldNewPlaces" style="border: 1px solid silver; padding: 8px; border-radius: 4px;">',
  124. '<legend style="margin-bottom:0px; border-bottom-style:none;width:auto;"><h4>' + I18n.t('pie.prefs.NewPlaces') + '</h4></legend>',
  125. '<div id="divEditRPPAfterCreated" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.EditRPPAfterCreateTitle') + '"><input type="checkbox" id="_cbEditRPPAfterCreated" class="pieSettingsCheckbox"><label for="_cbEditRPPAfterCreated" style="white-space:pre-line;">' + I18n.t('pie.prefs.EditRPPAfterCreate') + '</label></div>',
  126. '<div id="divUseStreetFromClosestSeg" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.UseStreetFromClosestSegmentTitle') + '"><input type="checkbox" id="_cbUseStreetFromClosestSeg" class="pieSettingsCheckbox"><label for="_cbUseStreetFromClosestSeg" style="white-space:pre-line;">' + I18n.t('pie.prefs.UseStreetFromClosestSegment') + '</label></div>',
  127. '<div id="divUseCityFromClosestSeg" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.UseCityFromClosestSegmentTitle') + '"><input type="checkbox" id="_cbUseCityFromClosestSeg" class="pieSettingsCheckbox"><label for="_cbUseCityFromClosestSeg" style="white-space:pre-line;">' + I18n.t('pie.prefs.UseCityFromClosestSegment') + '</label></div>',
  128. '<div id="divUseAltCity" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.ClosestSegmentAltCityTitle') + '" style="padding-left:20px; word-wrap: break-word;"><input type="checkbox" id="_cbUseAltCity" class="pieSettingsCheckbox"><label for="_cbUseAltCity" style="white-space:pre-line;">' + I18n.t('pie.prefs.ClosestSegmentAltCity') + '</label></div>',
  129. '<div id="divSkipPLR" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.ClosestSegmentIgnorePLRUnnamedPRTitle') + '"><input type="checkbox" id="_cbSkipPLR" class="pieSettingsCheckbox"/><label for="_cbSkipPLR" style="white-space:pre-line;">' + I18n.t('pie.prefs.ClosestSegmentIgnorePLRUnnamedPR') + '</label></div>',
  130. '<div id="divDefaultLockLevel" class="controls-container pie-controls-container" style="left:8px;" title="' + I18n.t('pie.prefs.LockLevelTitle') + '">' + I18n.t('pie.prefs.LockLevel') + '<select id="pieDefaultLockLevel">' + buildLockLevelsList() + '</select></div>',
  131. '</fieldset>',
  132.  
  133. '<fieldset id="fieldMapMods" style="border: 1px solid silver; padding: 8px; border-radius: 4px;">',
  134. '<legend style="margin-bottom:0px; border-bottom-style:none;width:auto;"><h4>' + I18n.t('pie.prefs.MapChanges') + '</h4></legend>',
  135. '<div id="divShowNames" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.ShowPlaceNames') + '"><input type="checkbox" id="_cbShowPlaceNames" class="pieSettingsCheckbox" /><label for="_cbShowPlaceNames">' + I18n.t('pie.prefs.ShowPlaceNames') + '</label></div>',
  136. '<div id="divShowNamesPoint"class="controls-container pie-controls-container" style="padding-left:20px;" title="' + I18n.t('pie.prefs.ShowPointNamesTitle') + '"><input type="checkbox" id="_cbShowPlaceNamesPoint" class="pieSettingsCheckbox" disabled /><label for ="_cbShowPlaceNamesPoint">' + I18n.t('pie.prefs.ShowPointNames') + '</label></div>',
  137. '<div id="divShowNamesArea"class="controls-container pie-controls-container" style="padding-left:20px;" title="' + I18n.t('pie.prefs.ShowAreaNamesTitle') + '"><input type="checkbox" id="_cbShowPlaceNamesArea" class="pieSettingsCheckbox" disabled /><label for ="_cbShowPlaceNamesArea">' + I18n.t('pie.prefs.ShowAreaNames') + '</label></div>',
  138. '<div id="divShowNamesPLA"class="controls-container pie-controls-container" style="padding-left:20px;" title="' + I18n.t('pie.prefs.ShowPLANameTitle') + '"><input type="checkbox" id="_cbShowPlaceNamesPLA" class="pieSettingsCheckbox" disabled /><label for ="_cbShowPlaceNamesPLA">' + I18n.t('pie.prefs.ShowPLAName') + '</label></div>',
  139. '<div id="divShowNamesLock"class="controls-container pie-controls-container" style="padding-left:20px;" title="' + I18n.t('pie.prefs.ShowLockLevelTitle') + '"><input type="checkbox" id="_cbShowPlaceNamesLock" class="pieSettingsCheckbox" disabled /><label for ="_cbShowPlaceNamesLock">' + I18n.t('pie.prefs.ShowLockLevel') + '</label></div>',
  140. '<div id="divPlaceNamesFontCustomization" class="controls-container pie-controls-container" style="padding-left:20px;">',
  141. I18n.t('pie.prefs.FontSize') + ' <input type="text" size="1" id="piePlaceNameFontSize"/>px</br>',
  142. I18n.t('pie.prefs.FontColor') + ' <button class="jscolor {valueElement:null,hash:true,closable:true}" style="width:15px; height:15px;border:2px solid black" id="colorPickerFont"></button></br>',
  143. '<input type="checkbox" id="_cbPlaceNameFontBold" class="pieSettingsCheckbox"/><label for ="_cbPlaceNameFontBold">' + I18n.t('pie.prefs.Bold') + '</label></br>',
  144. I18n.t('pie.prefs.FontOutlineColor') + ' <button class="jscolor {valueElement:null,hash:true,closable:true}" style="width:15px; height:15px;border:2px solid black" id="colorPickerFontOutline"></button></br>',
  145. I18n.t('pie.prefs.FontOutlineWidth') + ' <input type="text" size="1" id="piePlaceNameFontOutlineWidth"/>',
  146. '</div>',
  147. '<div id="divShowPLSpotEstimatorButton" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.PSEShowPSEButtonTitle') + '"><input type="checkbox" id="_cbShowPLSpotEstimatorButton" class="pieSettingsCheckbox" /><label for="_cbShowPLSpotEstimatorButton" style="white-space:pre-line;">' + I18n.t('pie.prefs.PSEShowPSEButton') + '</label></div>',
  148. '<div id="divShowNavPointClosestSegmentOnHover" class="controls-container pie-controls-container" title=""><input type="checkbox" id="_cbShowNavPointClosestSegmentOnHover" class="pieSettingsCheckbox" /><label for="_cbShowNavPointClosestSegmentOnHover" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowNavPointClosestSegmentOnHover') + '</label></div>',
  149. '<div id="divShowClosestSegmentSelected" class="controls-container pie-controls-container" title=""><input type="checkbox" id="_cbShowClosestSegmentSelected" class="pieSettingsCheckbox" /><label for="_cbShowClosestSegmentSelected" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowClosestSegmentSelected') + '</label></div>',
  150. '</fieldset>',
  151. '<div class="controls-container" id="divPlaceMenuCustomization">',
  152. '<b>' + I18n.t('pie.prefs.PlaceMenuCustomization') + '</b></br>',
  153. buildItemOption(1),
  154. buildItemOption(2),
  155. buildItemOption(3),
  156. buildItemOption(4),
  157. buildItemOption(5),
  158. buildItemOption(6),
  159. buildItemOption(7),
  160. buildItemOption(8),
  161. buildItemOption(9),
  162. buildItemOption(10),
  163. buildItemOption(11),
  164. '</div>'
  165.  
  166. ].join(' '));
  167.  
  168. UpdateObject = require("Waze/Action/UpdateObject");
  169. MultiAction = require("Waze/Action/MultiAction");
  170.  
  171. //Load settings
  172. loadSettings();
  173.  
  174. var style = new OpenLayers.Style({
  175. pointRadius: "${pointRadius}",
  176. label : "${labelText}",
  177. fontFamily: "Tahoma, Arial, Verdana",
  178. labelOutlineColor: settings.PlaceNameFontOutline,
  179. labelOutlineWidth: Number(settings.PlaceNameFontOutlineWidth),
  180. labelAlign: 'cm',
  181. fontColor: settings.PlaceNameFontColor,
  182. fontOpacity: 1.0,
  183. fontSize: settings.PlaceNameFontSize + "px",
  184. labelYOffset: "${yOffset}",
  185. fontStyle: "${style}",
  186. fontWeight: (settings.PlaceNameFontBold ? 'bold' : ''),
  187. pointRadius: 0
  188. });
  189.  
  190. PIEPlaceNameLayer = new OL.Layer.Vector("PIEPlaceNameLayer",{displayInLayerSwitcher: false,
  191. uniqueName: "__PIEPlaceNameLayer", styleMap: new OL.StyleMap(style)});
  192. W.map.addLayer(PIEPlaceNameLayer);
  193. PIEPlaceNameLayer.setVisibility(true);
  194.  
  195. newPlaceLayer = new OL.Layer.Vector(layerName,{displayInLayerSwitcher: false});
  196. W.map.addLayer(newPlaceLayer);
  197.  
  198. PLSpotEstimatorLayer = new OL.Layer.Vector("PIEPLSpotEstimatorLayer",{displayInLayerSwitcher: false, uniqueName: "__PIEPLSpotEstimatorLayer"});
  199. W.map.addLayer(PLSpotEstimatorLayer);
  200. PLSpotEstimatorLayer.setVisibility(true);
  201.  
  202. PLSpotEstimatorCalibrationLayer= new OL.Layer.Vector("PIEPLSpotEstimatorCalibrationLayer",{displayInLayerSwitcher: false, uniqueName: "__PIEPLSpotEstimatorCalibrationLayer"});
  203. W.map.addLayer(PLSpotEstimatorCalibrationLayer);
  204. PLSpotEstimatorCalibrationLayer.setVisibility(true);
  205.  
  206. showStopPointsLayer = new OL.Layer.Vector("PIEShowStopPointsLayer", {displayInLayerSwitcher: false, uniqueName: "__PIEShowStopPointsLayer"});
  207. W.map.addLayer(showStopPointsLayer);
  208. showStopPointsLayer.setVisibility(true);
  209.  
  210. closestSegmentLayer = new OL.Layer.Vector("PIEClosestSegment", {displayInLayerSwitcher: false, uniqueName:"__PIEClosesetSegmentLayer"});
  211. W.map.addLayer(closestSegmentLayer);
  212. closestSegmentLayer.setVisibility(true);
  213.  
  214. var ctl = W.map.controls.find(function(ctrl) { return ctrl.displayClass ==="WazeControlSelectHighlightFeature"; });
  215. var ctlLayers = ctl.layers.clone();
  216. var myLayer = W.map.getLayersByName('PIEPlaceNameLayer')[0];
  217. ctlLayers.push(myLayer);
  218. ctl.setLayer(ctlLayers);
  219.  
  220. injectCss();
  221. new WazeWrap.Interface.Tab('PIE', $section.html(), init2);
  222. }
  223.  
  224. function init2(){
  225. $('#cboPlaceNameFontWeight').select2({placeholder: "No font weight set", allowClear: true});
  226. $('#divPlaceNamesFontCustomization .select2-choices').css("font-size", "10px");
  227.  
  228. initColorPicker();
  229. if ($('#colorPickerFont')[0].jscolor){
  230. $('#colorPickerFont')[0].jscolor.fromString(settings.PlaceNameFontColor);
  231. $('#colorPickerFontOutline')[0].jscolor.fromString(settings.PlaceNameFontOutline);
  232. }
  233.  
  234. //$('#divPlaceNamesFontCustomization .select2-input').remove()
  235. //Set up event handlers
  236. $('#_cbShowAreaPlaceSize').change(function() {
  237. if(this.checked) {
  238. attachPlaceSizeHandlers();
  239. updatePlaceSizeDisplay();
  240. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = false;
  241. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = false;
  242. }
  243. else
  244. {
  245. removePlaceSizeHandlers();
  246. $('#AreaSize').remove();
  247. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = true;
  248. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = true;
  249. }
  250. });
  251.  
  252. $('#_cbShowPlaceNames').change(function() {
  253. PIEPlaceNameLayer.setVisibility(this.checked);
  254. if(this.checked) {
  255. $('#_cbShowPlaceNamesPoint')[0].disabled = false;
  256. $('#_cbShowPlaceNamesArea')[0].disabled = false;
  257. $('#_cbShowPlaceNamesPLA')[0].disabled = false;
  258. $('#_cbShowPlaceNamesLock')[0].disabled = false;
  259. }
  260. else
  261. {
  262. $('#_cbShowPlaceNamesPoint')[0].disabled = true;
  263. $('#_cbShowPlaceNamesArea')[0].disabled = true;
  264. $('#_cbShowPlaceNamesPLA')[0].disabled = true;
  265. $('#_cbShowPlaceNamesLock')[0].disabled = true;
  266. }
  267. console.log(this.checked);
  268. DisplayPlaceNames();
  269. });
  270.  
  271. $('[id^="_cbShowPlaceNames"]').change(function(){
  272. DisplayPlaceNames();
  273. });
  274.  
  275. $('#_cbShowExternalProviderTooltip').change(function(){
  276. ToggleExternalProvidersCSS(this.checked);
  277. });
  278.  
  279. $('#_cbShowLockButtonsRPP').change(function() {
  280. if(this.checked)
  281. attachRPPLockButtonHandlers();
  282. else
  283. {
  284. $('#pieRPPLockButtonsContainer').remove();
  285. unregisterEvents(addLockButtons);
  286. }
  287. });
  288.  
  289. $('#_cbShowPlaceLocatorCrosshair').change(function(){
  290. if(this.checked)
  291. registerEvents(ShowPlaceLocatorCrosshair);
  292. else
  293. unregisterEvents(ShowPlaceLocatorCrosshair);
  294. });
  295.  
  296. $('#_cbShowParkingLotButton').change(function(){
  297. if(this.checked)
  298. registerEvents(ShowParkingLotButton);
  299. else
  300. unregisterEvents(ShowParkingLotButton);
  301. });
  302.  
  303. $('#_cbShowCopyPlaceButton').change(function(){
  304. if(this.checked)
  305. registerEvents(ShowCopyPlaceButton);
  306. else
  307. unregisterEvents(ShowCopyPlaceButton);
  308. });
  309.  
  310. $('#_cbShowSearchButton').change(function(){
  311. if(this.checked)
  312. registerEvents(ShowSearchButton);
  313. else
  314. unregisterEvents(ShowSearchButton);
  315. });
  316.  
  317. $('#_cbAddPlaceCategoriesButtons').change(function(){
  318. if(this.checked)
  319. registerEvents(AddPlaceCategoriesButtons);
  320. else
  321. unregisterEvents(AddPlaceCategoriesButtons);
  322. });
  323.  
  324. $('#_cbMoveAddress').change(function(){
  325. if(this.checked)
  326. registerEvents(MoveAddress);
  327. else
  328. unregisterEvents(MoveAddress);
  329. });
  330.  
  331. $('#_cbMoveHNEntry').change(function(){
  332. if(this.checked)
  333. registerEvents(MoveHNEntry);
  334. else
  335. unregisterEvents(MoveHNEntry);
  336. });
  337.  
  338. $('#_cbClearDescription').change(function(){
  339. if(this.checked)
  340. registerEvents(ShowClearDescription);
  341. else
  342. unregisterEvents(ShowClearDescription);
  343. });
  344.  
  345. $('#_cbShowPLSpotEstimatorButton').change(function(){
  346. if(this.checked)
  347. registerEvents(ShowPLSpotEstimatorButton);
  348. else
  349. unregisterEvents(ShowPLSpotEstimatorButton);
  350. });
  351.  
  352. $('#_cbShowNavPointClosestSegmentOnHover').change(function(){
  353. if(this.checked)
  354. W.map.events.register("mousemove", null, drawNavPointClosestSegmentLines);
  355. else
  356. W.map.events.unregister("mousemove", null, drawNavPointClosestSegmentLines);
  357. });
  358.  
  359. $('#_cbShowClosestSegmentSelected').change(function(){
  360. if(this.checked){
  361. W.model.actionManager.events.register('afterundoaction', this, checkSelection);
  362. W.model.actionManager.events.register('afteraction', this, checkSelection);
  363. W.selectionManager.events.register('selectionchanged', this, checkSelection);
  364. W.model.venues.on('objectschanged', ObjectsChanged);
  365. }
  366. else{
  367. W.model.actionManager.events.unregister('afterundoaction', this, checkSelection);
  368. W.model.actionManager.events.unregister('afteraction', this, checkSelection);
  369. W.selectionManager.events.unregister('selectionchanged', this, checkSelection);
  370. W.model.venues.off('objectschanged', ObjectsChanged);
  371. }
  372. });
  373.  
  374. //Load settings to interface
  375. setChecked('_cbShowAreaPlaceSize', settings.ShowAreaPlaceSize);
  376. setChecked('_cbShowAreaPlaceSizeImperial', settings.ShowAreaPlaceSizeImperial);
  377. setChecked('_cbShowAreaPlaceSizeMetric', settings.ShowAreaPlaceSizeMetric);
  378. setChecked('_cbShowLockButtonsRPP', settings.ShowLockButtonsRPP);
  379. setChecked('_cbEditRPPAfterCreated', settings.EditRPPAfterCreated);
  380. setChecked('_cbUseStreetFromClosestSeg', settings.UseStreetFromClosestSeg);
  381. setChecked('_cbUseCityFromClosestSeg', settings.UseCityFromClosestSeg);
  382. setChecked('_cbShowPlaceLocatorCrosshair', settings.ShowPlaceLocatorCrosshair);
  383. setChecked('_cbShowParkingLotButton', settings.ShowParkingLotButton);
  384. setChecked('_cbShowCopyPlaceButton', settings.ShowCopyPlaceButton);
  385. setChecked('_cbShowExternalProviderTooltip', settings.ShowExternalProviderTooltip);
  386. setChecked('_cbUseAltCity', settings.UseAltCity);
  387. setChecked('_cbShowSearchButton', settings.ShowSearchButton);
  388. setChecked('_cbAddPlaceCategoriesButtons', settings.AddPlaceCategoriesButtons);
  389. setChecked('_cbSkipPLR', settings.SkipPLR);
  390. setChecked('_cbShowPlaceNames', settings.ShowPlaceNames);
  391. setChecked('_cbShowPlaceNamesPoint', settings.ShowPlaceNamesPoint);
  392. setChecked('_cbShowPlaceNamesArea', settings.ShowPlaceNamesArea);
  393. setChecked('_cbShowPlaceNamesPLA', settings.ShowPlaceNamesPLA);
  394. setChecked('_cbShowPlaceNamesLock', settings.ShowPlaceNamesLock);
  395. setChecked('_cbClearDescription', settings.ClearDescription);
  396. setChecked('_cbPlaceNameFontBold', settings.PlaceNameFontBold);
  397. setChecked('_cbPlaceLocatorCrosshairProdPL', settings.PlaceLocatorCrosshairProdPL);
  398. setChecked('_cbMoveAddress', settings.MoveAddress);
  399. setChecked('_cbMoveHNEntry', settings.MoveHNEntry);
  400. setChecked('_cbShowPLSpotEstimatorButton', settings.ShowPLSpotEstimatorButton);
  401. setChecked('_cbShowNavPointClosestSegmentOnHover', settings.ShowNavPointClosestSegmentOnHover);
  402. setChecked('_cbShowClosestSegmentSelected', settings.ShowClosestSegmentSelected);
  403. setChecked('_cbNavLink', settings.NavLink);
  404. if(settings.ShowPlaceNames){
  405. $('#_cbShowPlaceNamesPoint')[0].disabled = false;
  406. $('#_cbShowPlaceNamesArea')[0].disabled = false;
  407. $('#_cbShowPlaceNamesPLA')[0].disabled = false;
  408. $('#_cbShowPlaceNamesLock')[0].disabled = false;
  409. }
  410. $('#piePlaceZoom')[0].value = settings.PlaceZoom;
  411. $('#pieDefaultLockLevel')[0].value = settings.DefaultLockLevel;
  412. $('#piePlaceNameFontSize')[0].value = settings.PlaceNameFontSize;
  413. $('#piePlaceNameFontOutlineWidth')[0].value = settings.PlaceNameFontOutlineWidth;
  414.  
  415. if(settings.ShowNavPointClosestSegmentOnHover){
  416. W.map.events.register("mousemove", null, drawNavPointClosestSegmentLines);
  417. }
  418.  
  419. if(settings.ShowAreaPlaceSize){
  420. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = false;
  421. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = false;
  422. attachPlaceSizeHandlers();
  423. }
  424.  
  425. if(settings.ShowPlaceLocatorCrosshair){
  426. registerEvents(ShowPlaceLocatorCrosshair);
  427. ShowPlaceLocatorCrosshair(); //in case the user opened a PL with a Place selected
  428. }
  429.  
  430. if(settings.ShowParkingLotButton){
  431. registerEvents(ShowParkingLotButton);
  432. ShowParkingLotButton(); //in case the user opened a PL with a Place selected
  433. }
  434.  
  435. if(settings.ShowCopyPlaceButton){
  436. registerEvents(ShowCopyPlaceButton);
  437. ShowCopyPlaceButton();
  438. }
  439.  
  440. if(settings.ShowExternalProviderTooltip){
  441. //registerEvents(ShowExternalProviderTooltip);
  442. //ShowExternalProviderTooltip();
  443.  
  444. var observer = new MutationObserver(function(mutations) {
  445. mutations.forEach(function(mutation) {
  446. if ($(mutation.target).hasClass('select2-chosen')) ShowExternalProviderTooltip();
  447. });
  448. });
  449.  
  450. observer.observe(document.getElementById('edit-panel'), { childList: true, subtree: true });
  451. }
  452.  
  453. if(settings.ShowSearchButton){
  454. registerEvents(ShowSearchButton);
  455. ShowSearchButton(); //in case the user opened a PL with a Place selected
  456. }
  457.  
  458. if(settings.AddPlaceCategoriesButtons){
  459. registerEvents(AddPlaceCategoriesButtons);
  460. AddPlaceCategoriesButtons();
  461. }
  462.  
  463. if(settings.ClearDescription){
  464. registerEvents(ShowClearDescription);
  465. ShowClearDescription();
  466. }
  467.  
  468. if(settings.MoveAddress){
  469. registerEvents(MoveAddress);
  470. MoveAddress();
  471. }
  472.  
  473. if(settings.MoveHNEntry){
  474. registerEvents(MoveHNEntry);
  475. MoveHNEntry();
  476. }
  477.  
  478. if(settings.ShowPLSpotEstimatorButton){
  479. registerEvents(ShowPLSpotEstimatorButton);
  480. ShowPLSpotEstimatorButton();
  481. }
  482.  
  483. if(settings.ShowLockButtonsRPP)
  484. attachRPPLockButtonHandlers();
  485.  
  486. if(settings.ShowExternalProviderTooltip)
  487. ToggleExternalProvidersCSS(true);
  488.  
  489. if(settings.ShowClosestSegmentSelected){
  490. W.model.actionManager.events.register('afterundoaction', this, checkSelection);
  491. W.model.actionManager.events.register('afteraction', this, checkSelection);
  492. W.selectionManager.events.register('selectionchanged', this, checkSelection);
  493. W.model.venues.on('objectschanged', ObjectsChanged);
  494. }
  495.  
  496. $('.pieSettingsCheckbox').change(function() {
  497. var settingName = $(this)[0].id.substr(3);
  498. settings[settingName] = this.checked;
  499. saveSettings();
  500. });
  501.  
  502. $('#piePlaceZoom').change(function(){
  503. var settingName = $(this)[0].id.substr(3);
  504. settings[settingName] = $(this)[0].value;
  505. saveSettings();
  506. });
  507.  
  508. $('#pieDefaultLockLevel').change(function(){
  509. settings[$(this)[0].id.substr(3)] = $(this)[0].value;
  510. saveSettings();
  511. });
  512.  
  513. $('#_cbPlaceNameFontBold').change(function(){
  514. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.fontWeight = (this.checked ? 'bold' :'');
  515. DisplayPlaceNames();
  516. });
  517.  
  518. $('#piePlaceNameFontSize').focusout(function(){
  519. var fontSize = $(this)[0].value;
  520. if(fontSize == "" || fontSize == "0")
  521. $(this)[0].value = 12;
  522. settings[$(this)[0].id.substr(3)] = fontSize;
  523. saveSettings();
  524. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.fontSize = fontSize + "px";
  525. DisplayPlaceNames();
  526. });
  527.  
  528. $('#piePlaceNameFontOutlineWidth').focusout(function(){
  529. var outlineWidth = $(this)[0].value;
  530. if(outlineWidth == "" || outlineWidth == "0")
  531. $(this)[0].value = 3;
  532. settings[$(this)[0].id.substr(3)] = outlineWidth;
  533. saveSettings();
  534. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.labelOutlineWidth = outlineWidth;
  535. DisplayPlaceNames();
  536. });
  537.  
  538. $('#piePlaceNameFontSize').keypress(function(event) {
  539. if ((event.which < 48 || event.which > 57))
  540. event.preventDefault();
  541. });
  542.  
  543. $('#piePlaceNameFontOutlineWidth').keypress(function(event) {
  544. if ((event.which < 48 || event.which > 57))
  545. event.preventDefault();
  546. });
  547.  
  548. var i;
  549. //Whenever a Place item is changed, read the settings and save to localStorage
  550. $('[id^="pieItem"]').change(function(){
  551. for(i=0;i<11;i++){
  552. settings.NewPlacesList[i] = $('#pieItem'+(i+1))[0].value;
  553. }
  554. saveSettings();
  555. buildNewPlaceList();
  556. });
  557.  
  558. //Load settings into Place Customization list options
  559. for(i=0; i<11;i++)
  560. $('#pieItem'+(i+1))[0].value = settings.NewPlacesList[i];
  561.  
  562. //Build our new menu
  563. buildNewPlaceList();
  564.  
  565. new WazeWrap.Interface.Shortcut('CreateResidentialPlaceShortcut', 'Creates a resdiential Place point', 'wmepie', 'Place Interface Enhancements', settings.CreateResidentialPlaceShortcut, function(){startPlacementMode(resCategory, true);}, null).add();
  566.  
  567. new WazeWrap.Interface.Shortcut('CreateParkingLotShortcut', 'Creates a parking lot Place', 'wmepie', 'Place Interface Enhancements', settings.CreateParkingLotShortcut, function(){startPlacementMode("PARKING_LOT", false);}, null).add();
  568.  
  569. window.addEventListener("beforeunload", function() {
  570. saveSettings();
  571. }, false);
  572.  
  573. let extprovobserver = new MutationObserver(function(mutations) {
  574. mutations.forEach(function(mutation) {
  575. if ($(mutation.target).hasClass('external-providers-view'))
  576. if(W.loginManager.user.normalizedLevel <= 2)
  577. $('.external-providers-view').parent().parent().remove();
  578. });
  579. });
  580.  
  581. extprovobserver.observe(document.getElementById('edit-panel'), { childList: true, subtree: true });
  582.  
  583. W.selectionManager.events.register("selectionchanged", null, function(){
  584. if(W.selectionManager.selectedItems.length > 0 && W.selectionManager.selectedItems[0].model.type === "venue"){
  585. //Trim whitespace from start and end of house number field on Places
  586. $('.form-control.house-number').focusout(function(){
  587. $('.form-control.house-number')[0].value = $('.form-control.house-number')[0].value.trim();
  588. });
  589.  
  590. //Make Website label a clickable link to the set website
  591. let placeURL = W.selectionManager.selectedItems[0].model.attributes.url || "";
  592.  
  593. $('input[name="url"]').focusout(function(){
  594. placeURL = $('input[name="url"]')[0].value.trim();
  595. if(placeURL == ""){
  596. $('input[name="url"]').parent().parent().find('label').unwrap();
  597. return;
  598. }
  599. if(!placeURL.startsWith("http"))
  600. placeURL = "https://" + placeURL;
  601. if($('#websiteLink').length == 0)
  602. $('input[name="url"]').parent().parent().find('label').wrap('<a href="' + placeURL + '" id="websiteLink" target="_blank" style="cursor:pointer;"></a>');
  603. else
  604. $('#websiteLink').attr('href', placeURL);
  605. });
  606. if(placeURL != ""){
  607. if(!placeURL.startsWith("http"))
  608. placeURL = "https://" + placeURL;
  609. $('input[name="url"]').parent().parent().find('label').wrap('<a href="' + placeURL + '" id="websiteLink" target="_blank" style="cursor:pointer;"></a>');
  610. }
  611. }
  612. });
  613.  
  614. W.selectionManager.events.register("selectionchanged", null, function(){
  615. if(W.selectionManager.selectedItems.length > 0 && W.selectionManager.selectedItems[0].model.type === "mapComment")
  616. if((W.geometryEditing.activeEditor.mode & OpenLayers.Control.ModifyFeature.RESHAPE) == 0){
  617. W.geometryEditing.activeEditor.mode |= OpenLayers.Control.ModifyFeature.RESHAPE;
  618. W.geometryEditing.activeEditor.resetVertices();
  619. }
  620. });
  621.  
  622. //Always display the link when a point Place is selected, but default to un-linked
  623. W.selectionManager.events.register("selectionchanged", null, ShowNavPointLink);
  624. W.model.actionManager.events.register('afterundoaction', this, ShowNavPointLink);
  625. W.selectionManager.events.register('selectionchanged', this, ShowNavPointLink);
  626. W.model.venues.on('objectschanged', ShowNavPointLink);
  627.  
  628. W.model.actionManager.events.register('afteraction', this, function(){
  629. ShowNavPointLink();
  630. if(W.selectionManager.selectedItems.length > 0 && W.selectionManager.selectedItems[0].model.type == "venue" && W.selectionManager.selectedItems[0].model.isPoint()){
  631. if($('#placeNavLink').attr("class") == "fa fa-link fa-lg"){
  632. let myPlaceAttr = W.selectionManager.selectedItems[0].model.attributes;
  633. //We only want to do this if the last item changed is our selected Place && it was moved.
  634. if(W.model.actionManager.actions[W.model.actionManager.index].feature != undefined && (W.model.actionManager.actions[W.model.actionManager.index].feature.attributes.id == myPlaceAttr.id) && typeof W.model.actionManager.actions[W.model.actionManager.index].oldGeometry != "undefined"){
  635. if(W.selectionManager.selectedItems[0].model.attributes.entryExitPoints.length > 0){ //We only want to do this if there is an existing nav point
  636. let newAttr = {};
  637. let existingAttr = myPlaceAttr.entryExitPoints[0];
  638. if (existingAttr) {
  639. for (var prop in existingAttr) {
  640. if (existingAttr.hasOwnProperty(prop)){
  641. let value = existingAttr[prop];
  642. if (Array.isArray(value)) value = value.clone();
  643. newAttr[prop] = value;
  644. }
  645. }
  646. }
  647. newAttr.point = new OL.Geometry.Point(myPlaceAttr.geometry.x, myPlaceAttr.geometry.y);
  648. W.model.actionManager.add(new UpdateObject(W.selectionManager.selectedItems[0].model, {'entryExitPoints': [newAttr]}));
  649. }
  650. //NewPlace.attributes.entryExitPoints.push({entry: true, exit: true, name:"", primary: false, point: new OL.Geometry.Point(pos.lon, pos.lat)})
  651. }
  652. }
  653. }
  654. });
  655.  
  656. var observer = new MutationObserver(function(mutations) {
  657. mutations.forEach(function(mutation) {
  658. if ($('#dialog-region').find('.venue-image-dialog').length > 0 && $('#detailsWrap').length == 0) ImageDialogEnhancement();
  659. });
  660. });
  661.  
  662. observer.observe(document.getElementById('dialog-region'), { childList: true, subtree: true });
  663.  
  664. //Highlight the categories box when the old hospital category is present
  665. /*W.selectionManager.events.register("selectionchanged", null, highlightObsoleteHospitalCategory);
  666. W.model.actionManager.events.register("afterundoaction",null, highlightObsoleteHospitalCategory);
  667. W.model.actionManager.events.register("afterclearactions",null, highlightObsoleteHospitalCategory);
  668. W.model.actionManager.events.register("afteraction",null, highlightObsoleteHospitalCategory);*/
  669.  
  670. W.map.events.register("zoomend", null, DisplayPlaceNames);
  671. W.map.events.register("changelayer", null, DisplayPlaceNames);
  672.  
  673. //Shamelessly copied from URO+
  674. var MO_MPLayer = new MutationObserver(MPLayerChanged);
  675. MO_MPLayer.observe(W.map.problemLayer.div,{childList : true});
  676.  
  677. wazePL = document.querySelector('.WazeControlPermalink>a.fa-link');
  678. wazePL.id = 'wazePermalink';
  679. }
  680.  
  681. var highlightedVenue, highlighting;
  682. function drawNavPointClosestSegmentLines(){
  683. highlighting = false;
  684. if(highlightedVenue !== null)
  685. if(highlightedVenue === W.map.landmarkLayer.getFeatureBy("renderIntent","highlight"))
  686. highlighting = true;
  687. else
  688. showStopPointsLayer.removeAllFeatures();
  689. highlightedVenue = W.map.landmarkLayer.getFeatureBy("renderIntent","highlight");
  690.  
  691. if(highlightedVenue !== null && highlightedVenue.model && highlighting === false && W.map.zoom >= 4){
  692. let isArea = !highlightedVenue.model.isPoint();
  693. let navPoint = highlightedVenue.model.getNavigationPoint();
  694.  
  695. //nav point to closest segment
  696. let closestSeg = WazeWrap.Geometry.findClosestSegment(navPoint.point,false, false);
  697. let lineFeature = new OL.Feature.Vector(new OL.Geometry.LineString([navPoint.point, closestSeg.closestPoint]), {}, lineStyleToClosestSeg);
  698. let pointFeature = new OL.Feature.Vector(closestSeg.closestPoint, {}, pointStyle);
  699. showStopPointsLayer.addFeatures([lineFeature, pointFeature]);
  700.  
  701. //place center to nav point
  702. let startPt = highlightedVenue.geometry;
  703. if(isArea)
  704. startPt = highlightedVenue.model.geometry.getCentroid();
  705. lineFeature = new OL.Feature.Vector(new OL.Geometry.LineString([startPt, navPoint.point]), {}, lineStyleToNavPoint);
  706. pointFeature = new OL.Feature.Vector(navPoint.point, {}, pointStyleNavPoint);
  707. if(highlightedVenue.model.attributes.entryExitPoints.length > 0 || isArea)
  708. showStopPointsLayer.addFeatures([lineFeature, pointFeature]);
  709.  
  710. }
  711. if(highlightedVenue === null || W.map.zoom < 4)
  712. showStopPointsLayer.removeAllFeatures();
  713. }
  714.  
  715. function ObjectsChanged(){
  716. if(W.map.getLayerByUniqueName('landmarks').selectedFeatures.length >0)
  717. if(placeIsPoint && W.geometryEditing.activeEditor.vertices.length > 0){
  718. removeDragCallbacks();
  719. checkSelection();
  720. }
  721. }
  722.  
  723. function handleNavPointOffScreen() {
  724. if (selectedItem !== W.selectionManager.selectedItems.first() ||
  725. WazeWrap.Geometry.isGeometryInMapExtent(ClosestSegmentNavPoint.lonlat.toPoint())) {
  726. W.map.events.unregister('moveend', window, handleNavPointOffScreen);
  727. checkSelection();
  728. }
  729. }
  730.  
  731. function clearClosesetSegmentLayerFeatures() {
  732. return closestSegmentLayer.features.length > 0 && closestSegmentLayer.removeAllFeatures();
  733. }
  734.  
  735. function checkConditions() {
  736. 'use strict';
  737. var a = W.map.getZoom() > 3,
  738. b = W.map.landmarkLayer.getVisibility(),
  739. c = closestSegmentLayer.getVisibility(),
  740. d = !$('#map-lightbox').is(':visible'),/* Check for HN editing */
  741. e = (W.selectionManager.hasSelectedItems() && W.selectionManager.selectedItems[0].model.type !== "bigJunction");
  742.  
  743. if (a && b && c && d && e) {
  744. return true;
  745. } else {
  746. return false;
  747. }
  748. }
  749.  
  750. function drawLine(start, end, lStyle, pStyle) {
  751. 'use strict';
  752. var lineFeature, pointFeature;
  753.  
  754. lineFeature = new OL.Feature.Vector(new OL.Geometry.LineString([start, end]), {}, lStyle);
  755. pointFeature = new OL.Feature.Vector(end, {}, pStyle);
  756. closestSegmentLayer.addFeatures([lineFeature, pointFeature]);
  757. }
  758.  
  759. function findNearestSegment(navPoint) {
  760. 'use strict';
  761. var closestSegment = {};
  762. if(navPoint.element)
  763. navPoint = W.geometryEditing.activeEditor._navigationPointMarker.lonlat.toPoint();
  764.  
  765. closestSegment = WazeWrap.Geometry.findClosestSegment(navPoint,false, false);
  766.  
  767. clearClosesetSegmentLayerFeatures();
  768. drawLine(navPoint, closestSegment.closestPoint, lineStyleToClosestSeg, pointStyle);
  769. }
  770.  
  771. var placeIsPoint = false;
  772. function checkSelection() {
  773. 'use strict';
  774.  
  775. var ClosestSegmentNavPoint;
  776.  
  777. if (!checkConditions()) {
  778. removeDragCallbacks();
  779. } else {
  780. ClosestSegmentNavPoint = W.geometryEditing.activeEditor._navigationPointMarker;
  781. if (W.selectionManager.hasSelectedItems()) {
  782. let selectedItem = W.selectionManager.selectedItems[0];
  783.  
  784. if ('venue' !== selectedItem.model.type) {
  785. removeDragCallbacks();
  786. clearClosesetSegmentLayerFeatures();
  787. } else {
  788.  
  789. placeIsPoint = selectedItem.model.isPoint();
  790. if (placeIsPoint && W.geometryEditing.activeEditor.navigationPoint == null) {
  791. //Event when the Place is moved
  792. W.geometryEditing.activeEditor.dragControl.onDrag = function (e, t) {
  793. W.geometryEditing.activeEditor.dragVertex.apply(W.geometryEditing.activeEditor, [e, t]);
  794. findNearestSegment(selectedItem.model.getNavigationPoint().point);
  795. };
  796. ClosestSegmentNavPoint.events.register('drag', W.geometryEditing.activeEditor, findNearestSegment);
  797. findNearestSegment(selectedItem.model.getNavigationPoint().point);
  798. } else {
  799. if (null !== typeof ClosestSegmentNavPoint) {
  800. //Event when the nav point is moved
  801. ClosestSegmentNavPoint.events.register('drag', W.geometryEditing.activeEditor, findNearestSegment);
  802. if (WazeWrap.Geometry.isGeometryInMapExtent(ClosestSegmentNavPoint.lonlat.toPoint())) {
  803. findNearestSegment(ClosestSegmentNavPoint.lonlat.toPoint());
  804. } else {
  805. W.map.events.register('moveend', window, handleNavPointOffScreen);
  806. }
  807. }
  808. }
  809. }
  810. } else {
  811. removeDragCallbacks();
  812. clearClosesetSegmentLayerFeatures();
  813. }
  814. }
  815. }
  816.  
  817. function removeDragCallbacks() {
  818. if(!W.geometryEditing.activeEditor == null){
  819. W.geometryEditing.activeEditor.dragControl.onDrag = function (e, t) {
  820. W.geometryEditing.activeEditor.dragVertex.apply(W.geometryEditing.activeEditor, [e, t]);
  821. };
  822. if (null !== typeof ClosestSegmentNavPoint) {
  823. try {
  824. ClosestSegmentNavPoint.events.unregister('drag', W.geometryEditing.activeEditor, findNearestSegment);
  825. } catch (err) { }
  826. }
  827. }
  828. clearClosesetSegmentLayerFeatures();
  829. }
  830.  
  831. function buildNewPlaceList(){
  832. //Clear out the Places menu
  833. $(placeMenuSelector).empty();
  834. var cat = "";
  835. var icon = "";
  836. var i;
  837. for(i=0;i<11;i++){
  838. icon = "";
  839. cat = $('#pieItem' + (i+1))[0].value;
  840. icon = $('#pieItem' + (i+1))[0].options[$('#pieItem' + (i+1))[0].selectedIndex].getAttribute("data-icon");
  841. if(cat !== "PARKING_LOT" && cat !== resCategory)
  842. $(placeMenuSelector).append('<div class="toolbar-group-item WazeControlDrawFeature ItemInactive" style="' + (icon !== "" ? "padding-left:0px;" : "") + ' height:40px;" id="piePlaceMainItem' + (i+1) + '" data-category="'+ cat + '"><span class="menu-title ' + icon + '" style="font-size:26px;"><span style="font-size:12px;">' + $('#pieItem' + (i+1))[0].options[$('#pieItem' + (i+1))[0].selectedIndex].innerHTML + '</span></span><div class="drawing-controls"><span class="drawing-control polygon secondary-control" id="piePlaceAreaItem' + (i+1) + '" data-category="' + cat + '" title="Place (area)"></span><span class="drawing-control main-control point" id="piePlacePointItem' + (i+1) + '" data-category="' + cat + '" title="Place (point)"></span></div></div>');
  843. else{
  844. if(cat === resCategory) //force point
  845. $(placeMenuSelector).append('<div class="toolbar-group-item WazeControlDrawFeature ItemInactive" style="padding-left:0px; height:40px;" id="piePlaceMainItem' + (i+1) + '" data-category="'+ cat + '"><span class="menu-title ' + icon + '" style="font-size:26px;"><span style="font-size:12px;">' + $('#pieItem' + (i+1))[0].options[$('#pieItem' + (i+1))[0].selectedIndex].innerHTML + '</span></span></div>');
  846. else //Parking lot - force area
  847. $(placeMenuSelector).append('<div class="toolbar-group-item WazeControlDrawFeature ItemInactive" style="padding-left:1px; height40px;" id="piePlaceAreaItem' + (i+1) + '" data-category="'+ cat + '"><i class="fa fa-product-hunt fa-2x" style="font-size:20px;padding-top:9px;margin-right:5px;"></i><span class="menu-title" style="flex-grow:1;">' + $('#pieItem' + (i+1))[0].options[$('#pieItem' + (i+1))[0].selectedIndex].innerHTML + '</span></div>');
  848. }
  849. }
  850.  
  851. $('[id^="piePlaceMainItem"]').click(function(e){
  852. startPlacementMode($('#' + this.id).data("category"), true);
  853. });
  854.  
  855. $('[id^="piePlaceAreaItem"]').click(function(e){
  856. e.stopPropagation();
  857. startPlacementMode($('#' + this.id).data("category"), false);
  858. });
  859. }
  860.  
  861. function initColorPicker(tries){
  862. tries = tries || 1;
  863.  
  864. if ($('#colorPickerFont')[0].jscolor ) {
  865. $('#colorPickerFont')[0].jscolor.fromString(settings.PlaceNameFontColor);
  866. $('[id^="colorPicker"]')[0].jscolor.closeText = 'Close';
  867. $('#colorPickerFont')[0].jscolor.onChange = jscolorChanged;
  868.  
  869. $('#colorPickerFontOutline')[0].jscolor.fromString(settings.PlaceNameFontOutline);
  870. $('#colorPickerFontOutline')[0].jscolor.onChange = jscolorChanged;
  871.  
  872.  
  873. } else if (tries < 1000) {
  874. setTimeout(function () {initColorPicker(tries++);}, 200);
  875. }
  876. }
  877.  
  878. function jscolorChanged(){
  879. settings.PlaceNameFontColor = "#" + $('#colorPickerFont')[0].jscolor.toString();
  880. settings.PlaceNameFontOutline = "#" + $('#colorPickerFontOutline')[0].jscolor.toString();
  881. saveSettings();
  882. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.fontColor = settings.PlaceNameFontColor;
  883. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.labelOutlineColor = settings.PlaceNameFontOutline;
  884. DisplayPlaceNames();
  885. }
  886.  
  887. function registerEvents(handler){
  888. W.selectionManager.events.register("selectionchanged", null, handler);
  889. W.model.actionManager.events.register("afterundoaction",null, handler);
  890. W.model.actionManager.events.register("afterclearactions",null, handler);
  891. W.model.actionManager.events.register("afteraction",null, handler);
  892. }
  893.  
  894. function unregisterEvents(handler){
  895. W.selectionManager.events.unregister("selectionchanged", null, handler);
  896. W.model.actionManager.events.unregister("afterundoaction",null, handler);
  897. W.model.actionManager.events.unregister("afterclearactions",null, handler);
  898. W.model.actionManager.events.unregister("afteraction",null, handler);
  899. }
  900.  
  901. function ToggleExternalProvidersCSS(truthiness){
  902. if(truthiness)
  903. injectCSSWithID('pieExternalProvidersTweaks', '#edit-panel .external-providers-view .select2-container {width:90%; margin-bottom:2px;}');
  904. else{
  905. var styles = document.getElementById('pieExternalProvidersTweaks');
  906. if(styles) styles.parentNode.removeChild(styles);
  907. }
  908. }
  909.  
  910. function DisplayPlaceNames(){
  911. PIEPlaceNameLayer.removeAllFeatures();
  912. var showPoint, showArea, showLock, showNames, showPLA;
  913. showNames = isChecked('_cbShowPlaceNames');
  914. showPoint = isChecked('_cbShowPlaceNamesPoint');
  915. showArea = isChecked('_cbShowPlaceNamesArea');
  916. showLock = isChecked('_cbShowPlaceNamesLock');
  917. showPLA = isChecked('_cbShowPlaceNamesPLA');
  918.  
  919. if(showNames){
  920. var isPoint;
  921. for (var placeID in W.model.venues.objects) {
  922. var venue = W.model.venues.get(placeID);
  923. isPoint = venue.isPoint();
  924. if((isPoint && W.map.zoom >= 5) || (!isPoint && W.map.zoom >= 3)){
  925. if(WazeWrap.Geometry.isGeometryInMapExtent(venue.geometry)){
  926. if( (isPoint && showPoint) || (!isPoint && showArea && !venue.isParkingLot()) || (!isPoint && showPLA && venue.isParkingLot())){
  927. var textLoc;
  928. if(isPoint)
  929. textLoc = new OpenLayers.Geometry.Point(venue.geometry.x, venue.geometry.y);
  930. else
  931. textLoc = venue.geometry.getCentroid();
  932. var placeName =WordWrap(venue.attributes.name.trim() + (showLock ? ' (L' + (venue.attributes.lockRank + 1) + ')' : ''));
  933. if(venue.attributes.categories[0] === "RESIDENCE_HOME")
  934. placeName = venue.attributes.houseNumber + (venue.attributes.name.trim() !== '' ? ' - ' + venue.attributes.name : '') + (showLock ? ' (L' + (venue.attributes.lockRank + 1) + ')' : '');
  935. var placeNameLabel = new OL.Feature.Vector(textLoc,{display: 'block',labelText: placeName.trim(), yOffset:(isPoint ? -13 - placeName.split("\n").length * 5 : 0)});
  936. PIEPlaceNameLayer.addFeatures([placeNameLabel]);
  937. }
  938. }
  939. }
  940. }
  941. }
  942. }
  943.  
  944. function WordWrap(text){
  945. var newName = "";
  946.  
  947. if(text !== ""){
  948. var splitName = text.match(/(.{1,35})(?:\s|$)/g);
  949. for(var i=0;i<splitName.length;i++){
  950. newName += splitName[i] + (i != splitName.length-1 ? '\n' : '');
  951. }
  952. }
  953. console.log()
  954. return newName;
  955. }
  956.  
  957. //Shamelessly copied from URO+
  958. function MPLayerChanged(){
  959. for(var mObj in W.map.problemLayer.markers){
  960. var mIcon = W.map.problemLayer.markers[mObj].icon.div;
  961. mIcon.addEventListener("click", MarkerClick, false);
  962. }
  963. }
  964.  
  965. function MarkerClick(){
  966. var markerType = GetMarkerType(this.className);
  967. if(markerType !== null){
  968. var markerID = this.attributes["data-id"].value;
  969. if(W.map.getLayerByUniqueName("problems").markers[markerID].model.attributes.subType === 71){
  970. var $PIECreatePLA = $("<div>", {style:"min-height:20px"});
  971. $PIECreatePLA.html([
  972. '<div id="PIECreatePLA">',
  973. '<div class="btn btn-block" id="PIECreatePLAButton" style="color: #fff; background-color: #92c2d1; border-color: #78b0bf; margin-top:5px;">Create Suggested PLA</div>',
  974. '</div>'
  975. ].join(' '));
  976.  
  977. setTimeout(function(){$('#panel-container > div > div > div.body > div.actions > div > div').append($PIECreatePLA); $('#PIECreatePLAButton').click(function(){createPLAFromMP(markerID);});}, 150);
  978. }
  979. }
  980. }
  981.  
  982. //Shamelessly copied from URO+
  983. function GetMarkerType(className){
  984. var markerType = null;
  985. if(className.indexOf('user-generated') !== -1) markerType = 'ur';
  986. else if(className.indexOf('map-problem') !== -1) markerType = 'mp';
  987. else if(className.indexOf('place-update') !== -1) markerType = 'pur';
  988. return markerType;
  989. }
  990.  
  991. function createPLAFromMP(MPID){
  992. var pos = W.model.problemDetails.objects[MPID].venueGeom;
  993.  
  994. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  995. var AddPlace = require("Waze/Action/AddLandmark");
  996. var NewPlace = new PlaceObject();
  997.  
  998. var points = [];
  999. var i;
  1000. for(i=0;i<pos.components[0].components.length;i++){
  1001. points.push(new OL.Geometry.Point(pos.components[0].components[i].x, pos.components[0].components[i].y));
  1002. }
  1003. var ring = new OpenLayers.Geometry.LinearRing(points);
  1004. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  1005.  
  1006. NewPlace.attributes.categories.push("PARKING_LOT");
  1007.  
  1008. W.model.actionManager.add(new AddPlace(NewPlace));
  1009. Waze.selectionManager.select([NewPlace]);
  1010. }
  1011.  
  1012. function highlightObsoleteHospitalCategory(){
  1013. if(W.selectionManager.selectedItems.length > 0 && W.selectionManager.selectedItems[0].model.type === "venue"){
  1014. if(W.selectionManager.selectedItems[0].model.attributes.categories.contains("HOSPITAL_MEDICAL_CARE")){
  1015. $('.select2-choices').css('animation-iteration-count', 'infinite');
  1016. $('.select2-choices').attr('title', 'The "Hospital / Medical Care" category is no longer valid.\n\nPlease change it to "Hospital / Urgent Care" or "Doctor / Clinic", whichever is most appropriate');
  1017. $('.select2-choices').tooltip();
  1018. }
  1019. }
  1020. }
  1021.  
  1022. var newPlaceCategory = "";
  1023. function startPlacementMode(category, isPoint){
  1024. if(category === "PARKING_LOT"){
  1025. if(!isChecked("layer-switcher-item_parking_places")){
  1026. if(!isChecked("layer-switcher-group_places"))
  1027. $("#layer-switcher-group_places").click();
  1028. $("#layer-switcher-item_parking_places").click();
  1029. }
  1030. }
  1031. $('#edit-buttons > div > div.toolbar-button.waze-icon-place.toolbar-submenu.toolbar-group.toolbar-group-venues.ItemInactive').removeClass("open");
  1032. newPlaceCategory = category;
  1033. var polyDrawFeatureOptions = {callbacks : {"done": doneHandler}};
  1034. if(isPoint){
  1035. $("#map").on('mousemove', MouseMoveHandler);
  1036. $("#map").click(function(){endPlacementMode(category, isPoint);});
  1037. /*drawPoly = new OpenLayers.Control.DrawFeature(newPlaceLayer, OpenLayers.Handler.Polygon, polyDrawFeatureOptions);
  1038. W.map.addControl(drawPoly);
  1039. drawPoly.activate();*/
  1040. }
  1041. else{
  1042. drawPoly = new OpenLayers.Control.DrawFeature(newPlaceLayer, OpenLayers.Handler.Polygon, polyDrawFeatureOptions);
  1043. W.map.addControl(drawPoly);
  1044. drawPoly.activate();
  1045.  
  1046. }
  1047. document.addEventListener('keyup', keyUpHandler, false);
  1048. }
  1049.  
  1050. var businessPLAPlaceName, businessPLAPlaceAddress;//, businessPLAPlacePhone, businessPLAPlaceURL;
  1051. function startBusinessPLAPlacementMode(){
  1052. var polyDrawFeatureOptions = {callbacks : {"done": doneHandlerBusinessPLAPlace}};
  1053. drawPoly = new OpenLayers.Control.DrawFeature(newPlaceLayer, OpenLayers.Handler.Polygon, polyDrawFeatureOptions);
  1054. W.map.addControl(drawPoly);
  1055. drawPoly.activate();
  1056. document.addEventListener('keyup', keyUpHandler, false);
  1057. }
  1058.  
  1059. function doneHandlerBusinessPLAPlace(geom){
  1060. drawPoly.destroy();
  1061. BusinessPLAMode = false;
  1062. CreateBusinesPLAPlace(geom, businessPLAPlaceName, businessPLAPlaceAddress);//, businessPLAPlacePhone, businessPLAPlaceURL);
  1063. }
  1064.  
  1065. function CreateBusinesPLAPlace(geom, name, address){//, phone, url){
  1066. drawPoly.destroy();
  1067.  
  1068. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  1069. var AddPlace = require("Waze/Action/AddLandmark");
  1070. var multiaction = new MultiAction();
  1071. multiaction.setModel(W.model);
  1072.  
  1073. var NewPlace = new PlaceObject();
  1074. var points = [];
  1075. var i;
  1076. for(i=0;i<geom.components[0].components.length;i++){
  1077. points.push(new OL.Geometry.Point(geom.components[0].components[i].x, geom.components[0].components[i].y));
  1078. }
  1079. var ring = new OpenLayers.Geometry.LinearRing(points);
  1080. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  1081. NewPlace.attributes.categories.push("PARKING_LOT");
  1082.  
  1083. NewPlace.attributes.lockRank = Number(settings.DefaultLockLevel);
  1084. NewPlace.attributes.name = "Parking - " + name;
  1085. //NewPlace.attributes.phone = phone;
  1086. //NewPlace.attributes.url = url;
  1087. NewPlace.attributes.categoryAttributes.PARKING_LOT = {};
  1088. NewPlace.attributes.categoryAttributes.PARKING_LOT.parkingType = "RESTRICTED";
  1089. NewPlace.attributes.categoryAttributes.PARKING_LOT.lotType = ["STREET_LEVEL"];
  1090. NewPlace.attributes.categoryAttributes.PARKING_LOT.costType = "FREE";
  1091.  
  1092. W.model.actionManager.add(new AddPlace(NewPlace));
  1093.  
  1094. if(address){
  1095. var newAttributes, UpdateFeatureAddress = require('Waze/Action/UpdateFeatureAddress');
  1096. newAttributes = {
  1097. countryID: address.country.id,
  1098. stateID: address.state.id,
  1099. emptyCity: address.city.attributes.name ? null : true,
  1100. emptyStreet: address.street.name ? null : true,
  1101. houseNumber: address.houseNumber
  1102. };
  1103.  
  1104. newAttributes.streetName = address.street.name;
  1105.  
  1106. var cityName = address.city.attributes.name;
  1107.  
  1108. if(cityName !== "")
  1109. newAttributes.emptyCity = null;
  1110. newAttributes.cityName = cityName;
  1111.  
  1112. }
  1113. var UFA = new UpdateFeatureAddress(NewPlace, newAttributes);
  1114. UFA.options.updateHouseNumber = true;
  1115. multiaction.doSubAction(UFA);
  1116. W.model.actionManager.add(multiaction);
  1117.  
  1118. Waze.selectionManager.select([NewPlace]);
  1119. }
  1120.  
  1121. function doneHandler(geom){
  1122. drawPoly.destroy();
  1123. createPlace(geom, newPlaceCategory, false);
  1124. }
  1125.  
  1126. function keyUpHandler(e){
  1127. if (e.keyCode == 27){
  1128. BusinessPLAMode = false;
  1129. disablePlacementMode();
  1130. if(drawPoly !== "undefined")
  1131. drawPoly.destroy();
  1132. }
  1133. else if(e.keyCode == 90 && e.ctrlKey)
  1134. drawPoly.undo();
  1135. else if(e.keyCode == 89 && e.ctrlKey)
  1136. drawPoly.redo();
  1137. else if(e.keyCode == 13)
  1138. drawPoly.finishSketch();
  1139. }
  1140.  
  1141. function disablePlacementMode(){
  1142. $("#map").off('click');//, endPlacementMode);
  1143. $("#map").off('mousemove', MouseMoveHandler);
  1144. clearLayer();
  1145. document.removeEventListener('keyup', keyUpHandler);
  1146. }
  1147.  
  1148. function endPlacementMode(category, isPoint){
  1149. disablePlacementMode();
  1150. createPlace(getMousePos900913(), category, isPoint);
  1151. }
  1152.  
  1153. function getMousePos900913(){
  1154. var mousePosition = $('.WazeControlMousePosition').text().split(" ");
  1155. return WazeWrap.Geometry.ConvertTo900913(mousePosition[0], mousePosition[1]);
  1156. }
  1157.  
  1158. function MouseMoveHandler(e){
  1159. clearLayer();
  1160. drawCircle(getMousePos900913());
  1161. }
  1162.  
  1163. function clearLayer() {
  1164. var layer = W.map.getLayersByName(layerName)[0];
  1165. layer.removeAllFeatures();
  1166. }
  1167.  
  1168. function drawCircle(e){
  1169. var pointFeature = new OL.Feature.Vector(new OL.Geometry.Point(e.lon, e.lat), {}, pointStyle);
  1170. W.map.getLayersByName(layerName)[0].addFeatures([pointFeature]);
  1171. }
  1172.  
  1173. function createPlace(pos, category, isPoint){
  1174. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  1175. var AddPlace = require("Waze/Action/AddLandmark");
  1176. var multiaction = new MultiAction();
  1177. multiaction.setModel(W.model);
  1178.  
  1179. var NewPlace = new PlaceObject();
  1180. if(isPoint)
  1181. NewPlace.geometry = new OL.Geometry.Point(pos.lon, pos.lat);
  1182. else{
  1183. var points = [];
  1184. var i;
  1185. for(i=0;i<pos.components[0].components.length;i++){
  1186. points.push(new OL.Geometry.Point(pos.components[0].components[i].x, pos.components[0].components[i].y));
  1187. }
  1188. var ring = new OpenLayers.Geometry.LinearRing(points);
  1189. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  1190.  
  1191. }
  1192.  
  1193. NewPlace.attributes.categories.push(category);
  1194. if(category === resCategory){
  1195. NewPlace._originalResidential = true;
  1196. NewPlace.attributes.residential = true;
  1197. NewPlace.attributes.entryExitPoints.push({entry: true, exit: true, name:"", primary: false, point: new OL.Geometry.Point(pos.lon, pos.lat)});
  1198. }
  1199. NewPlace.attributes.lockRank = Number(settings.DefaultLockLevel);
  1200.  
  1201. var closestSeg = WazeWrap.Geometry.findClosestSegment(new OL.Geometry.Point(pos.lon, pos.lat), settings.SkipPLR, settings.SkipPLR);
  1202.  
  1203. W.model.actionManager.add(new AddPlace(NewPlace));
  1204. Waze.selectionManager.select([NewPlace]);
  1205.  
  1206. if(closestSeg){ //if we were able to find a segment, try to pull the city and/or street name if the options are enabled
  1207. var newAttributes, UpdateFeatureAddress = require('Waze/Action/UpdateFeatureAddress'), address = closestSeg.getAddress();
  1208.  
  1209. newAttributes = {
  1210. countryID: address.country.id,
  1211. stateID: address.state.id,
  1212. emptyCity: address.city.attributes.name ? null : true,
  1213. emptyStreet: address.street.name ? null : true
  1214. };
  1215.  
  1216. if(settings.UseStreetFromClosestSeg)
  1217. newAttributes.streetName = address.street.name;
  1218. else
  1219. newAttributes.emptyStreet = true;
  1220.  
  1221. if(settings.UseCityFromClosestSeg){
  1222. var cityName = address.city.attributes.name;
  1223.  
  1224. if(settings.UseAltCity && cityName === ""){
  1225. if(address.altStreets.length > 0){ //segment has alt names
  1226. for(var j=0;j<closestSeg.attributes.streetIDs.length;j++){
  1227. var altCity = W.model.cities.get(W.model.streets.get(closestSeg.attributes.streetIDs[j]).cityID).attributes;
  1228.  
  1229. if(altCity.englishName !== null && altCity.englishName !== "")
  1230. cityName = altCity.englishName;
  1231. }
  1232. }
  1233. }
  1234. if(cityName !== "")
  1235. newAttributes.emptyCity = null;
  1236. newAttributes.cityName = cityName;
  1237. }
  1238. else
  1239. newAttributes.emptyCity = true;
  1240.  
  1241. multiaction.doSubAction(new UpdateFeatureAddress(NewPlace, newAttributes));
  1242. W.model.actionManager.add(multiaction);
  1243. }
  1244. else
  1245. console.log("WMEPIE - No segment found; cannot set street or city name.");
  1246.  
  1247. if(category === resCategory && settings.EditRPPAfterCreated)
  1248. editRPPAddress();
  1249. }
  1250.  
  1251. function editRPPAddress(rppTries){
  1252. rppTries = rppTries || 1;
  1253.  
  1254. if ($('.edit-button').length > 0) {
  1255. $('.edit-button').trigger("click");
  1256. $('.house-number:first').focus();
  1257.  
  1258. } else if (rppTries < 1000) {
  1259. console.log("not found");
  1260. setTimeout(function () {editRPPAddress(rppTries++);}, 200);
  1261. }
  1262. }
  1263.  
  1264. function buildItemOption(itemNumber){
  1265. var $section = $("<div>", {style:"padding:8px 16px", id:"piePlaceCat" + itemNumber});
  1266. $section.html([
  1267. I18n.t('pie.prefs.Item') + " ",
  1268. itemNumber,
  1269. buildItemList(itemNumber),
  1270. '</br>'
  1271. ].join(' '));
  1272.  
  1273. return $section.html();
  1274. }
  1275.  
  1276. function buildLockLevelsList(){
  1277. var $lockLevels = $("<div>");
  1278. for(var i=0;i<WazeWrap.User.Rank();i++){
  1279. $lockLevels.append("<option value=" + i + ">" + (i+1) + "</option>");
  1280. }
  1281. return $lockLevels.html();
  1282. }
  1283.  
  1284. function attachRPPLockButtonHandlers(){
  1285. $('#pieRPPLockButtonsContainer').remove();
  1286. W.selectionManager.events.register("selectionchanged", null, addLockButtons);
  1287. W.model.actionManager.events.register("afterundoaction",null, addLockButtons);
  1288. W.model.actionManager.events.register("afterclearactions",null, addLockButtons);
  1289. W.model.actionManager.events.register("afteraction",null, addLockButtons);
  1290. }
  1291.  
  1292. function attachPlaceSizeHandlers(){
  1293. W.selectionManager.events.register("selectionchanged", null, updatePlaceSizeDisplay);
  1294. W.model.actionManager.events.register("afteraction",null, updatePlaceSizeDisplay);
  1295. W.model.actionManager.events.register("afterundoaction",null, updatePlaceSizeDisplay);
  1296. W.model.actionManager.events.register("afterclearactions",null, updatePlaceSizeDisplay);
  1297. W.model.actionManager.events.register("noActions",null, noActions);
  1298. updatePlaceSizeDisplay();
  1299. }
  1300.  
  1301. function removePlaceSizeHandlers(){
  1302. W.selectionManager.events.unregister("selectionchanged", null, updatePlaceSizeDisplay);
  1303. W.model.actionManager.events.unregister("afteraction",null, updatePlaceSizeDisplay);
  1304. W.model.actionManager.events.unregister("afterundoaction",null, updatePlaceSizeDisplay);
  1305. W.model.actionManager.events.unregister("afterclearactions",null, updatePlaceSizeDisplay);
  1306. W.model.actionManager.events.unregister("noActions",null, noActions);
  1307. }
  1308.  
  1309. var currLinkClass = []; //We have to keep track of the current status in case the user toggled the linking due to the panel getting rebuilt after every action
  1310. function ShowNavPointLink(){
  1311. $('#pieNavLink').remove();
  1312. if(W.selectionManager.selectedItems.length > 0){
  1313. if(W.selectionManager.selectedItems[0].model.type === "venue" && W.selectionManager.selectedItems[0].model.isPoint()){
  1314. if(currLinkClass.length == 0 || currLinkClass[0] != W.selectionManager.selectedItems[0].model.attributes.id){ //First time this place has been selected
  1315. currLinkClass[0] = W.selectionManager.selectedItems[0].model.attributes.id;
  1316. currLinkClass[1] = (settings.NavLink ? "fa fa-link fa-lg" : "fa fa-chain-broken fa-lg");
  1317. }
  1318. var $NavLink;
  1319. if(W.selectionManager.selectedItems[0].model.attributes.categories.contains("RESIDENCE_HOME")){
  1320. $NavLink = $('<div style="display:inline-block; z-index:100; cursor:pointer;" id="pieNavLink" title=""><i class="' + currLinkClass[1] + '" id="placeNavLink" aria-hidden="true"></i></div>');
  1321. $('.address-edit.side-panel-section').before($NavLink);
  1322. }
  1323. else{
  1324. $NavLink = $('<div style="float:right; z-index:100; cursor:pointer; top:0; right:0;" id="pieNavLink" title=""><i class="' + currLinkClass[1] + '" id="placeNavLink" aria-hidden="true"></i></div>');
  1325. $('#landmark-edit-general > form > div:nth-child(1) > i').after($NavLink);
  1326. }
  1327. $('#pieNavLink').click(function(){
  1328. if($('#placeNavLink').attr("class") == "fa fa-link fa-lg"){
  1329. $('#placeNavLink').attr("class", "fa fa-chain-broken fa-lg");
  1330. currLinkClass[1] = "fa fa-chain-broken fa-lg";
  1331. }
  1332. else{
  1333. $('#placeNavLink').attr("class", "fa fa-link fa-lg");
  1334. currLinkClass[1] = "fa fa-link fa-lg";
  1335. }
  1336. });
  1337. }
  1338. }
  1339. else
  1340. currLinkClass = [];
  1341. }
  1342.  
  1343. function ShowPlaceLocatorCrosshair(){
  1344. $('#pieCrosshairs').remove();
  1345. if(W.selectionManager.selectedItems.length > 0){
  1346. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  1347. var $crosshairs;
  1348. if(W.selectionManager.selectedItems[0].model.attributes.categories.contains("RESIDENCE_HOME")){
  1349. $('.landmark > .tab-content').css('position', 'relative');
  1350. $crosshairs = $('<div style="position:absolute; z-index:100; cursor:pointer; top:0; right:0;" id="pieCrosshairs" title="Zoom and center on Place"><i class="fa fa-crosshairs fa-lg" id="placeCrosshair" aria-hidden="true"></i></div>');
  1351. //$('.address-edit.side-panel-section').before($crosshairs);
  1352. $('.landmark > .tab-content').append($crosshairs);
  1353. }
  1354. else{
  1355. $crosshairs = $('<div style="float:right; z-index:100; cursor:pointer; top:0; right:0;" id="pieCrosshairs" title="Zoom and center on Place"><i class="fa fa-crosshairs fa-lg" id="placeCrosshair" aria-hidden="true"></i></div>');
  1356. $('#landmark-edit-general > form > div:nth-child(1) > i').after($crosshairs);
  1357. }
  1358. $('#pieCrosshairs').click(function(){
  1359. CenterOnPlace(W.selectionManager.selectedItems[0].model, settings.PlaceZoom);
  1360. });
  1361.  
  1362. $('#pieCrosshairs').mouseenter(function(e) {
  1363. //var changedThisPl = getKMLPermalink(wazePL.getAttribute('href'));
  1364. window.addEventListener('keydown', copyPLHotkeyEvent, false);
  1365. });
  1366.  
  1367. $('#pieCrosshairs').mouseleave('mouseleave', function() {
  1368. window.removeEventListener('keydown', copyPLHotkeyEvent);
  1369. });
  1370. }
  1371. }
  1372. }
  1373.  
  1374. var copyPLHotkeyEvent = function(e) {
  1375. if ((e.metaKey || e.ctrlKey) && (e.which === 67))
  1376. copyToClipboard(getPermalink(wazePL.getAttribute('href')));
  1377. };
  1378.  
  1379. var BusinessPLAMode = false;
  1380. function ShowParkingLotButton(){
  1381. $('#piePLAButton').remove();
  1382.  
  1383. if(W.selectionManager.selectedItems.length > 0){
  1384. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  1385. var $PLAButton;
  1386. if(!(W.selectionManager.selectedItems[0].model.attributes.categories.contains("RESIDENCE_HOME") || W.selectionManager.selectedItems[0].model.attributes.categories.contains("PARKING_LOT"))){
  1387. $PLAButton = $('<div style="float:right; z-index:100; cursor:pointer; top:0; right:0;" id="piePLAButton" title="Create a Parking Lot Area for this Place"><i class="fa fa-product-hunt fa-lg" aria-hidden="true"></i></div>');
  1388. $('#landmark-edit-general > form > div:nth-child(1) > i').after($PLAButton);
  1389.  
  1390. $('#piePLAButton').click(function(){
  1391. if(!BusinessPLAMode){
  1392. BusinessPLAMode = true;
  1393. businessPLAPlaceName = W.selectionManager.selectedItems[0].model.attributes.name;
  1394. businessPLAPlaceAddress = W.selectionManager.selectedItems[0].model.getAddress().attributes;
  1395. //businessPLAPlacePhone = W.selectionManager.selectedItems[0].model.attributes.phone;
  1396. //businessPLAPlaceURL = W.selectionManager.selectedItems[0].model.attributes.url;
  1397. startBusinessPLAPlacementMode();
  1398. if(!isChecked("layer-switcher-item_parking_places")){
  1399. if(!isChecked("layer-switcher-group_places"))
  1400. $("#layer-switcher-group_places").click();
  1401. $("#layer-switcher-item_parking_places").click();
  1402. }
  1403. }
  1404. });
  1405. }
  1406. }
  1407. }
  1408. }
  1409.  
  1410. var extProviderTries = 0;
  1411. function ShowExternalProviderTooltip(){
  1412. if(isChecked('_cbShowExternalProviderTooltip'))
  1413. if(W.selectionManager.selectedItems.length > 0 && W.selectionManager.selectedItems[0].model.type === "venue"){
  1414. if($('.select2-container.uuid').length > 0)
  1415. for(var i=0; i < $('.select2-container.uuid').find('span.select2-chosen').length; i++){
  1416. extProviderTries = 0;
  1417. ReadExtProviderText(i, extProviderTries);
  1418. }
  1419. }
  1420. }
  1421.  
  1422. var calibratingAngledWidth = false;
  1423. function ShowPLSpotEstimatorButton(){
  1424. $('.PIEParkingSpotEstimatorButton').remove();
  1425.  
  1426. if(W.selectionManager.selectedItems.length > 0){
  1427. if(W.selectionManager.selectedItems[0].model.type === "venue" && W.selectionManager.selectedItems[0].model.attributes.categories.includes("PARKING_LOT")){
  1428. var $ParkingSpotEstimatorButton;
  1429. $ParkingSpotEstimatorButton = $('<div style="font-size:18px; float:right; z-index:100; cursor:pointer; top:0; right:0; margin-left:1px; margin-right:1px;" class="PIEParkingSpotEstimatorButton" title="' + I18n.t('pie.prefs.PSEDisplayButtonTitle') + '">#</div>');
  1430. $('#landmark-edit-general > form > div:nth-child(1) > i').after($ParkingSpotEstimatorButton);
  1431.  
  1432. $('select[name="estimatedNumberOfSpots"]').before($ParkingSpotEstimatorButton.clone());
  1433.  
  1434. $('.PIEParkingSpotEstimatorButton').click(ShowPLSpotEstimator);
  1435. totalSpots = 0;
  1436. }
  1437. }
  1438. else
  1439. $('#PIEParkingSpotEstimator').remove();//if they de-select the Place, remove the tool from the screen
  1440. }
  1441.  
  1442. function startPLSpotEstimatorDrawMode(){
  1443. let polyDrawFeatureOptions = {callbacks : {"done": PLSpotEstimatordoneHandler, "point": pointHandler}};
  1444.  
  1445. PLSpotEstimatordrawControl = new OpenLayers.Control.DrawFeature(PLSpotEstimatorLayer, OpenLayers.Handler.Path, polyDrawFeatureOptions);
  1446. W.map.addControl(PLSpotEstimatordrawControl);
  1447. PLSpotEstimatordrawControl.activate();
  1448.  
  1449. $('div#WazeMap.view-area.olMap').keydown(PLSpotEstimatorkeyUpHandler);
  1450. }
  1451.  
  1452. function startPLSpotEstimatorCalibrationMode(){
  1453. let polyDrawFeatureOptions = {callbacks : {"done": PLSpotEstimatorCalibrationdoneHandler, "point": pointHandler}};
  1454.  
  1455. PLSpotEstimatorCalibrationdrawControl = new OpenLayers.Control.DrawFeature(PLSpotEstimatorCalibrationLayer, OpenLayers.Handler.Path, polyDrawFeatureOptions);
  1456. W.map.addControl(PLSpotEstimatorCalibrationdrawControl);
  1457. PLSpotEstimatorCalibrationdrawControl.activate();
  1458.  
  1459. $('div#WazeMap.view-area.olMap').keydown(PLSpotEstimatorCalibrationkeyUpHandler);
  1460. }
  1461.  
  1462. function pointHandler() {
  1463. isDrawing = true;
  1464. }
  1465.  
  1466. function PLSpotEstimatorkeyUpHandler(e){
  1467. if (e.keyCode == 27){
  1468. if (isDrawing) {
  1469. PLSpotEstimatordrawControl.cancel();
  1470. isDrawing = false;
  1471. } else {
  1472. disablePLSpotEstimatorDrawMode();
  1473. if(PLSpotEstimatordrawControl !== "undefined")
  1474. PLSpotEstimatordrawControl.destroy();
  1475. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1476. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1477. }
  1478. e.stopPropagation();
  1479. }
  1480. else if(e.keyCode == 90 && e.ctrlKey)
  1481. PLSpotEstimatordrawControl.undo();
  1482. else if(e.keyCode == 89 && e.ctrlKey)
  1483. PLSpotEstimatordrawControl.redo();
  1484. else if(e.keyCode == 13)
  1485. PLSpotEstimatordrawControl.finishSketch();
  1486. }
  1487.  
  1488. function PLSpotEstimatorCalibrationkeyUpHandler(e){
  1489. if (e.keyCode == 27){
  1490. if (isDrawing) {
  1491. PLSpotEstimatorCalibrationdrawControl.cancel();
  1492. isDrawing = false;
  1493. } else {
  1494. disablePLSpotEstimatorCalibrationDrawMode();
  1495. if(PLSpotEstimatorCalibrationdrawControl !== "undefined")
  1496. PLSpotEstimatorCalibrationdrawControl.destroy();
  1497. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1498. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1499. }
  1500. e.stopPropagation();
  1501.  
  1502. }
  1503. else if(e.keyCode == 90 && e.ctrlKey)
  1504. PLSpotEstimatorCalibrationdrawControl.undo();
  1505. else if(e.keyCode == 89 && e.ctrlKey)
  1506. PLSpotEstimatorCalibrationdrawControl.redo();
  1507. else if(e.keyCode == 13)
  1508. PLSpotEstimatorCalibrationdrawControl.finishSketch();
  1509. }
  1510.  
  1511. function disablePLSpotEstimatorDrawMode(){
  1512. $("#map").off('click');
  1513. if(PLSpotEstimatordrawControl){
  1514. PLSpotEstimatordrawControl.deactivate();
  1515. PLSpotEstimatordrawControl.destroy();
  1516. }
  1517. PLSpotEstimatorLayer.removeAllFeatures();
  1518. $('div#WazeMap.view-area.olMap').off('keydown');
  1519. }
  1520.  
  1521. function disablePLSpotEstimatorCalibrationDrawMode(){
  1522. $("#map").off('click');
  1523. if(PLSpotEstimatorCalibrationdrawControl){
  1524. PLSpotEstimatorCalibrationdrawControl.deactivate();
  1525. PLSpotEstimatorCalibrationdrawControl.destroy();
  1526. }
  1527. PLSpotEstimatorCalibrationLayer.removeAllFeatures();
  1528. $('div#WazeMap.view-area.olMap').off('keydown');
  1529. }
  1530.  
  1531. var totalSpots = 0;
  1532. function PLSpotEstimatordoneHandler(geom){
  1533. let style = {strokeWidth: 3, strokeColor: '#ee9900'};
  1534. PLSpotEstimatorLayer.addFeatures(new OL.Feature.Vector(geom,{}, style));
  1535.  
  1536. let spots = Math.round(WazeWrap.Geometry.calculateDistance(geom.components)/($('#PIE90DegreeSpotWidthDraw').hasClass("PSESelected") ? $('#PIE90DegreeSpotWidth')[0].value : $('#PIEAngledSpotWidth')[0].value));
  1537. totalSpots += spots;
  1538.  
  1539. $('#PIEPLSpotEstimatorTotal')[0].innerText = totalSpots;
  1540.  
  1541. if(totalSpots > 0)
  1542. $('#PIESetParkingSpacesToPlace').prop('disabled', false);
  1543. isDrawing = false;
  1544. }
  1545.  
  1546. function PLSpotEstimatorCalibrationdoneHandler(geom){
  1547. var style = {strokeWidth: 3, strokeColor: '#00ee00'};
  1548. PLSpotEstimatorCalibrationLayer.addFeatures(new OL.Feature.Vector(geom,{}, style));
  1549. let totalLength = 0;
  1550.  
  1551. PLSpotEstimatorCalibrationLayer.features.forEach(function(f) {
  1552. let length = Math.round(WazeWrap.Geometry.calculateDistance(f.geometry.components)*100)/100;
  1553. totalLength += length;
  1554. });
  1555.  
  1556. if(calibratingAngledWidth){
  1557. $('#PIEAngledSpotWidth')[0].value = totalLength;
  1558. settings.PLAngledSpotWidth = totalLength;
  1559. }
  1560. else{
  1561. $('#PIE90DegreeSpotWidth')[0].value = totalLength;
  1562. settings.PLNormalSpotWidth = totalLength;
  1563. }
  1564. saveSettings();
  1565.  
  1566. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1567. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1568.  
  1569. isDrawing = false;
  1570. disablePLSpotEstimatorCalibrationDrawMode();
  1571. }
  1572.  
  1573. function ShowPLSpotEstimator(){
  1574. if($('#PIEParkingSpotEstimator').length > 0)
  1575. $('#PIEParkingSpotEstimator').remove();
  1576. else{
  1577. if(W.selectionManager.selectedItems.length > 0){
  1578. if(W.selectionManager.selectedItems[0].model.type === "venue" && W.selectionManager.selectedItems[0].model.attributes.categories.includes("PARKING_LOT")){
  1579.  
  1580. var $PLSpotEstimator = $('<div>');
  1581. $PLSpotEstimator.html([
  1582. '<div style="position: absolute; text-align:center; z-index:1000; background-color:white; top:20px; left:300px; border-radius:20px; border: 2px solid; width: 300px; padding-left:10px; padding-right:10px; padding-bottom:5px;" id="PIEParkingSpotEstimator">',
  1583. '<span style="font-weight:bold;">' + I18n.t('pie.prefs.PSEParkingSpaceEstimator') + '</span><i class="fa fa-window-close-o" aria-hidden="true" style="float:right; cursor:pointer;" id="PIECloseParkingSpotEstimator"></i>',
  1584. '<hr>',
  1585. '<div style=" display:flex; justify-content:space-between;">',
  1586. '<div style="display: inline;">' + I18n.t('pie.prefs.PSELayoutType') + '<br/><br/>' + I18n.t('pie.prefs.PSESpotWidth') + '</div>',
  1587. '<div style="display: inline;">' + I18n.t('pie.prefs.PSE90degree') + '<br/><br/><input type="text" size=2 id="PIE90DegreeSpotWidth"><button id="PIE90DegreeSpotWidthCalibration" title="Measure the width of a single 90 degree parking spot">' + I18n.t('pie.prefs.PSECal') + '</button><br/><button id="PIE90DegreeSpotWidthDraw" class="fa fa-pencil" title="' + I18n.t('pie.prefs.PSEDraw90DegreeTitle') + '"></button></div>',
  1588. '<div style="display: inline;">' + I18n.t('pie.prefs.PSEAngled') + '<br/><br/><input type="text" size=2 id="PIEAngledSpotWidth"><button id="PIEAngledSpotWidthCalibration" title="Measure the width of a single angled degree parking spot">' + I18n.t('pie.prefs.PSECal') + '</button><br/><button id="PIEAngledSpotWidthDraw" class="fa fa-pencil" title="' + I18n.t('pie.prefs.PSEDrawAngledTitle') + '"></button></div>',
  1589. '</div>',
  1590. '<hr>',
  1591. '<div>' + I18n.t('pie.prefs.PSEEstimatedNumOfSpots') + '<span id="PIEPLSpotEstimatorTotal" style="color:blue; padding:0px 3px; font-weight:900; font-size:1.2em;" >0</span>&emsp;<div style="display:inline-block;"><button id="PIESetParkingSpacesToPlace" disabled>' + I18n.t('pie.prefs.PSESet') + '</button></div></div>',
  1592. '</div>'
  1593. ].join(' '));
  1594.  
  1595. $("#WazeMap").append($PLSpotEstimator.html());
  1596.  
  1597. $("#PIECloseParkingSpotEstimator").click(function(){
  1598. $('#PIEParkingSpotEstimator').remove();
  1599. disablePLSpotEstimatorDrawMode();
  1600. disablePLSpotEstimatorCalibrationDrawMode();
  1601. if(PLSpotEstimatordrawControl != null)
  1602. PLSpotEstimatordrawControl.destroy();
  1603. if(PLSpotEstimatorCalibrationdrawControl != null)
  1604. PLSpotEstimatorCalibrationdrawControl.destroy();
  1605. });
  1606.  
  1607. $('#PIEParkingSpotEstimator').keydown(function(e){
  1608. disablePLSpotEstimatorDrawMode();
  1609. disablePLSpotEstimatorCalibrationDrawMode();
  1610. if(PLSpotEstimatordrawControl != null)
  1611. PLSpotEstimatordrawControl.destroy();
  1612. if(PLSpotEstimatorCalibrationdrawControl != null)
  1613. PLSpotEstimatorCalibrationdrawControl.destroy();
  1614. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1615. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1616. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1617. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1618. });
  1619.  
  1620. $('#PIE90DegreeSpotWidth')[0].value = settings.PLNormalSpotWidth;
  1621. $('#PIEAngledSpotWidth')[0].value = settings.PLAngledSpotWidth;
  1622.  
  1623. $('#PIESetParkingSpacesToPlace').click(function(){
  1624. let spotCount = $('#PIEPLSpotEstimatorTotal')[0].innerText;
  1625. if(spotCount != "0"){
  1626. let myPlace = W.selectionManager.selectedItems[0].model;
  1627. let existingAttr = myPlace.attributes.categoryAttributes.PARKING_LOT;
  1628. let newAttr = {};
  1629. if (existingAttr) {
  1630. for (var prop in existingAttr) {
  1631. let value = existingAttr[prop];
  1632. if (Array.isArray(value)) value = value.clone();
  1633. newAttr[prop] = value;
  1634. }
  1635. }
  1636. let spotPropValue;
  1637. spotCount = parseInt(spotCount);
  1638. if(spotCount < 11)
  1639. spotPropValue = "R_1_TO_10";
  1640. else if(spotCount < 31)
  1641. spotPropValue = "R_11_TO_30";
  1642. else if(spotCount < 61)
  1643. spotPropValue = "R_31_TO_60";
  1644. else if(spotCount < 101)
  1645. spotPropValue = "R_61_TO_100";
  1646. else if(spotCount < 301)
  1647. spotPropValue = "R_101_TO_300";
  1648. else if(spotCount < 601)
  1649. spotPropValue = "R_301_TO_600";
  1650. else if(spotCount >= 601)
  1651. spotPropValue = "R_600_PLUS";
  1652.  
  1653. newAttr.estimatedNumberOfSpots = spotPropValue;
  1654. W.model.actionManager.add(new UpdateObject(myPlace, {'categoryAttributes': {PARKING_LOT: newAttr}}));
  1655. }
  1656. });
  1657.  
  1658. $('#PIE90DegreeSpotWidth').focusout(function(){
  1659. let width = $(this)[0].value;
  1660. if(width == "" || width == "0")
  1661. $(this)[0].value = 3.44;
  1662. settings.PLNormalSpotWidth = width;
  1663. saveSettings();
  1664. });
  1665.  
  1666. $('#PIEAngledSpotWidth').focusout(function(){
  1667. let width = $(this)[0].value;
  1668. if(width == "" || width == "0")
  1669. $(this)[0].value = 3;
  1670. settings.PLAngledSpotWidth = width;
  1671. saveSettings();
  1672. });
  1673.  
  1674. $('#PIE90DegreeSpotWidthDraw').click(function() {
  1675. if (PLSpotEstimatordrawControl && PLSpotEstimatordrawControl.active) {
  1676. PLSpotEstimatordrawControl.deactivate();
  1677. PLSpotEstimatordrawControl.destroy();
  1678. $('div#WazeMap.view-area.olMap').off('keyup');
  1679. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1680. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1681. } else {
  1682. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1683. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1684. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1685. $('#PIE90DegreeSpotWidthDraw').addClass("PSESelected");
  1686. startPLSpotEstimatorDrawMode();
  1687. }
  1688. });
  1689.  
  1690. $('#PIEAngledSpotWidthDraw').click(function() {
  1691. if (PLSpotEstimatordrawControl && PLSpotEstimatordrawControl.active) {
  1692. PLSpotEstimatordrawControl.deactivate();
  1693. PLSpotEstimatordrawControl.destroy();
  1694. $('div#WazeMap.view-area.olMap').off('keyup');
  1695. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1696. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1697. } else {
  1698. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1699. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1700. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1701. $('#PIEAngledSpotWidthDraw').addClass("PSESelected");
  1702. startPLSpotEstimatorDrawMode();
  1703. }
  1704. });
  1705.  
  1706. $('#PIE90DegreeSpotWidthCalibration').click(function(){
  1707. if(PLSpotEstimatordrawControl){
  1708. PLSpotEstimatordrawControl.deactivate();
  1709. PLSpotEstimatordrawControl.destroy();
  1710. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1711. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1712. }
  1713. if(PLSpotEstimatorCalibrationdrawControl){
  1714. PLSpotEstimatorCalibrationdrawControl.deactivate();
  1715. PLSpotEstimatorCalibrationdrawControl.destroy();
  1716. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1717. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1718. }
  1719. $('#PIE90DegreeSpotWidthCalibration').addClass("PSESelected");
  1720. calibratingAngledWidth = false;
  1721. startPLSpotEstimatorCalibrationMode();
  1722. });
  1723.  
  1724. $('#PIEAngledSpotWidthCalibration').click(function(){
  1725. if(PLSpotEstimatordrawControl){
  1726. PLSpotEstimatordrawControl.deactivate();
  1727. PLSpotEstimatordrawControl.destroy();
  1728. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1729. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1730. }
  1731. if(PLSpotEstimatorCalibrationdrawControl){
  1732. PLSpotEstimatorCalibrationdrawControl.deactivate();
  1733. PLSpotEstimatorCalibrationdrawControl.destroy();
  1734. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1735. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1736. }
  1737. $('#PIEAngledSpotWidthCalibration').addClass("PSESelected");
  1738. calibratingAngledWidth = true;
  1739. startPLSpotEstimatorCalibrationMode();
  1740. });
  1741. }
  1742. }
  1743. else{
  1744. disablePLSpotEstimatorDrawMode();
  1745. disablePLSpotEstimatorCalibrationDrawMode();
  1746. }
  1747. }
  1748. }
  1749.  
  1750. function ImageDialogEnhancement(){
  1751. $('.venue-image-dialog .details').wrap("<div id='detailsWrap'></div>");
  1752. $('#detailsWrap').append("<div style='position:absolute;right:12px; bottom:25px;'><i class='fa fa-trash-o fa-lg' id='DeleteFromImageDialog' style='cursor:pointer;' aria-hidden='true'></i></div>");
  1753. var dataID = $('#detailsWrap').parent().find('img')[0].src;
  1754. dataID = /_(.+)/g.exec(dataID)[1];
  1755. $('#DeleteFromImageDialog').click(function(){
  1756. $('div[data-id="' + dataID + '"] button.image-delete-button').click();
  1757. $('.venue-image-dialog').find('.close').click();
  1758. });
  1759.  
  1760. //Image dialog navigation arrows
  1761. if(W.selectionManager.selectedItems[0].model.attributes.images.length > 1){
  1762. let thisImageIndex;
  1763. let PlaceImages = W.selectionManager.selectedItems[0].model.attributes.images;
  1764. for(let i=0; i<PlaceImages.length; i++){
  1765. if(W.selectionManager.selectedItems[0].model.attributes.images[i].id === dataID){
  1766. thisImageIndex = i;
  1767. break;
  1768. }
  1769. }
  1770. $('.modal-body').addClass('imgcon');
  1771. $('.modal-body').prepend((thisImageIndex + 1) + "/" + W.selectionManager.selectedItems[0].model.attributes.images.length);
  1772. $('.imgcon').append('<div class="imnav"><div class="prim control"></div><div class="zmim control"></div><div class="neim control"></div></div>');
  1773. $('.prim').click(function(){
  1774. let prevIndex;
  1775.  
  1776. if(thisImageIndex == 0)
  1777. prevIndex = PlaceImages.length - 1;
  1778. else
  1779. prevIndex = thisImageIndex - 1;
  1780. dataID = PlaceImages[prevIndex].id;
  1781. $('div[data-id="' + dataID +'"] img').click();
  1782. });
  1783.  
  1784. $('.neim').click(function(){
  1785. let nextIndex;
  1786.  
  1787. if(thisImageIndex == PlaceImages.length - 1)
  1788. nextIndex = 0;
  1789. else
  1790. nextIndex = thisImageIndex + 1;
  1791. dataID = PlaceImages[nextIndex].id;
  1792. $('div[data-id="' + dataID +'"] img').click();
  1793. });
  1794. }
  1795. }
  1796.  
  1797. function ReadExtProviderText(index, extProviderTries){
  1798. var providersList = $('.select2-container.uuid').find('span.select2-chosen');
  1799. if($('.select2-container.uuid').find('span.select2-chosen')[index].innerHTML == "&nbsp;" && extProviderTries <= 20)
  1800. setTimeout(function(){ReadExtProviderText(index, extProviderTries++);}, 50);
  1801. else{
  1802. if($('#' + providersList[index].id).parent().parent().data('original-title') == null){
  1803. $('#' + providersList[index].id).parent().parent().attr('title', $('.select2-container.uuid').find('span.select2-chosen')[index].innerText);
  1804. $('#' + providersList[index].id).parent().parent().tooltip()
  1805. }
  1806. else
  1807. $('#' + providersList[index].id).parent().parent().attr('data-original-title', $('.select2-container.uuid').find('span.select2-chosen')[index].innerText);
  1808. }
  1809. }
  1810.  
  1811. function ShowCopyPlaceButton(){
  1812. $('#pieCopyPlaceButton').remove();
  1813.  
  1814. if(W.selectionManager.selectedItems.length > 0){
  1815. //W.selectionManager.selectedItems[0].model.attributes.id.match(/(\d+\.){2}\d+/)
  1816. if(W.selectionManager.selectedItems[0].model.type === "venue"){// && (typeof W.selectionManager.selectedItems[0].model.attributes.id === "string")){ //id is only a string if the Place has been saved - don't allow copying unsaved Places
  1817. var $PlaceCopyButton;
  1818. if(!W.selectionManager.selectedItems[0].model.attributes.categories.contains("RESIDENCE_HOME")){
  1819. $PlaceCopyButton = $('<div style="float:right; z-index:100; cursor:pointer; top:0; right:0; margin-left:1px; margin-right:1px;" id="pieCopyPlaceButton" title="Creates a copy of this Place"><i class="fa fa-files-o fa-lg" aria-hidden="true"></i></div>');
  1820. $('#landmark-edit-general > form > div:nth-child(1) > i').after($PlaceCopyButton);
  1821.  
  1822. $('#pieCopyPlaceButton').click(function(){
  1823. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  1824. var AddPlace = require("Waze/Action/AddLandmark");
  1825.  
  1826. var NewPlace = new PlaceObject();
  1827. var oldPlace = W.selectionManager.selectedItems[0].model;
  1828.  
  1829. NewPlace.attributes.name = oldPlace.attributes.name + " (copy)";
  1830. NewPlace.attributes.phone = oldPlace.attributes.phone;
  1831. NewPlace.attributes.url = oldPlace.attributes.url;
  1832. NewPlace.attributes.categories = oldPlace.attributes.categories.clone();
  1833. NewPlace.attributes.aliases = oldPlace.attributes.aliases.clone();
  1834. NewPlace.attributes.description = oldPlace.attributes.description;
  1835. NewPlace.attributes.houseNumber = oldPlace.attributes.houseNumber;
  1836. NewPlace.attributes.lockRank = oldPlace.attributes.lockRank;
  1837. NewPlace.attributes.geometry = oldPlace.attributes.geometry.clone();
  1838.  
  1839. if(oldPlace.attributes.geometry.toString().match(/^POLYGON/)){
  1840. var convertedCoords;
  1841. for(var i=0; i<NewPlace.attributes.geometry.components[0].components.length - 1; i++){
  1842. convertedCoords = WazeWrap.Geometry.ConvertTo4326(NewPlace.attributes.geometry.components[0].components[i].x, NewPlace.attributes.geometry.components[0].components[i].y);
  1843. convertedCoords.lon += WazeWrap.Geometry.CalculateLongOffsetGPS(5, convertedCoords.long, convertedCoords.lat);
  1844. NewPlace.attributes.geometry.components[0].components[i].x = WazeWrap.Geometry.ConvertTo900913(convertedCoords.lon, convertedCoords.lat).lon;
  1845. }
  1846. }
  1847. else{
  1848. var convertedCoords = WazeWrap.Geometry.ConvertTo4326(oldPlace.attributes.geometry.x, oldPlace.attributes.geometry.y);
  1849. convertedCoords.lon += WazeWrap.Geometry.CalculateLongOffsetGPS(5, convertedCoords.long, convertedCoords.lat);
  1850. NewPlace.attributes.geometry.x = WazeWrap.Geometry.ConvertTo900913(convertedCoords.lon, convertedCoords.lat).lon;
  1851. }
  1852.  
  1853. NewPlace.attributes.services = oldPlace.attributes.services.clone();
  1854. NewPlace.attributes.openingHours = oldPlace.attributes.openingHours.clone();
  1855. NewPlace.attributes.streetID = oldPlace.attributes.streetID;
  1856.  
  1857. if(NewPlace.attributes.categories.contains("GAS_STATION"))
  1858. NewPlace.attributes.brand = oldPlace.attributes.brand;
  1859.  
  1860. if(NewPlace.attributes.categories.contains("PARKING_LOT")){
  1861. NewPlace.attributes.categoryAttributes.PARKING_LOT = {};
  1862. var PLAttribute = oldPlace.attributes.categoryAttributes.PARKING_LOT;
  1863. if(!(PLAttribute.lotType == null))
  1864. NewPlace.attributes.categoryAttributes.PARKING_LOT.lotType = oldPlace.attributes.categoryAttributes.PARKING_LOT.lotType.clone();
  1865. if(!(PLAttribute.canExitWhileClosed == null))
  1866. NewPlace.attributes.categoryAttributes.PARKING_LOT.canExitWhileClosed = oldPlace.attributes.categoryAttributes.PARKING_LOT.canExitWhileClosed;
  1867. if(!(PLAttribute.costType == null))
  1868. NewPlace.attributes.categoryAttributes.PARKING_LOT.costType = oldPlace.attributes.categoryAttributes.PARKING_LOT.costType;
  1869. if(!(PLAttribute.estimatedNumberOfSpots == null))
  1870. NewPlace.attributes.categoryAttributes.PARKING_LOT.estimatedNumberOfSpots = oldPlace.attributes.categoryAttributes.PARKING_LOT.estimatedNumberOfSpots;
  1871. if(!(PLAttribute.hasTBR == null))
  1872. NewPlace.attributes.categoryAttributes.PARKING_LOT.hasTBR = oldPlace.attributes.categoryAttributes.PARKING_LOT.hasTBR;
  1873. if(!(PLAttribute.lotType == null))
  1874. NewPlace.attributes.categoryAttributes.PARKING_LOT.lotType = oldPlace.attributes.categoryAttributes.PARKING_LOT.lotType.clone();
  1875. if(!(PLAttribute.parkingType == null))
  1876. NewPlace.attributes.categoryAttributes.PARKING_LOT.parkingType = oldPlace.attributes.categoryAttributes.PARKING_LOT.parkingType;
  1877. if(!(PLAttribute.paymentType == null))
  1878. NewPlace.attributes.categoryAttributes.PARKING_LOT.paymentType = oldPlace.attributes.categoryAttributes.PARKING_LOT.paymentType.clone();
  1879. }
  1880.  
  1881. W.model.actionManager.add(new AddPlace(NewPlace));
  1882.  
  1883. var newAttributes, UpdateFeatureAddress = require('Waze/Action/UpdateFeatureAddress'), address = oldPlace.getAddress();
  1884. var MultiAction = require("Waze/Action/MultiAction");
  1885. var multiaction = new MultiAction();
  1886. multiaction.setModel(W.model);
  1887.  
  1888. console.log(address);
  1889. newAttributes = {
  1890. countryID: address.attributes.country.id,
  1891. stateID: address.attributes.state.id,
  1892. emptyCity: address.attributes.city.attributes.name ? null : true,
  1893. emptyStreet: address.attributes.street.name ? null : true
  1894. };
  1895.  
  1896. newAttributes.streetName = address.attributes.street.name;
  1897. var cityName = address.attributes.city.attributes.name;
  1898.  
  1899. if(cityName !== "")
  1900. newAttributes.emptyCity = null;
  1901. newAttributes.cityName = cityName;
  1902.  
  1903. var UFA = new UpdateFeatureAddress(NewPlace, newAttributes);
  1904. UFA.options.updateHouseNumber = true;
  1905. multiaction.doSubAction(UFA);
  1906. W.model.actionManager.add(multiaction);
  1907. Waze.selectionManager.select([NewPlace]);
  1908. });
  1909. }
  1910. }
  1911. }
  1912. }
  1913.  
  1914. function ShowSearchButton(){
  1915. $('#pieSearchButton').remove();
  1916. if(W.selectionManager.selectedItems.length > 0){
  1917. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  1918. var $search = $('<div style="float:left; margin-right:5px; position:relative; left:-10px; cursor:pointer;" id="pieSearchButton" title="Fills the search bar with the address"><i class="fa fa-search" aria-hidden="true"></i></div>');
  1919. $('.address-edit-view').before($search);
  1920. $('#pieSearchButton').click(function(){
  1921. var address = $('.full-address')[0].innerHTML;
  1922. var noCity = I18n.translations[I18n.currentLocale()].edit.address.no_city;
  1923. var noStreet = I18n.translations[I18n.currentLocale()].edit.address.no_street;
  1924.  
  1925. address = address.replace(noCity + ",","");
  1926. if(address !== I18n.translations[I18n.currentLocale()].edit.landmark.no_address)
  1927. $('.search-query')[0].value = address;
  1928. });
  1929. }
  1930. }
  1931. }
  1932.  
  1933. function ShowClearDescription(){
  1934. $('#landmark-edit-general textarea').parent().append('<i class="fa fa-times-circle clearButton" style="position:absolute; top:0; right:0;"></i>');
  1935. $('#landmark-edit-general textarea').parent().css('position', 'relative');
  1936. $('.clearButton').click(function(){
  1937. W.model.actionManager.add(new UpdateObject( W.selectionManager.selectedItems[0].model, { description: "" }));
  1938. });
  1939. }
  1940.  
  1941. function MoveAddress(){
  1942. if(W.selectionManager.selectedItems.length > 0)
  1943. if(W.selectionManager.selectedItems[0].model.type === "venue")
  1944. $('#landmark-edit-general').prepend($('.address-edit.side-panel-section'));
  1945. }
  1946.  
  1947. function MoveHNEntry(){
  1948. if(W.selectionManager.selectedItems.length > 0)
  1949. if(W.selectionManager.selectedItems[0].model.type === "venue")
  1950. $('.edit-button').click(function(){
  1951. $('.street-name').parent().parent().before($('.house-number').parent().parent());
  1952. });
  1953. }
  1954.  
  1955. function AddPlaceCategoriesButtons(){
  1956. $('#piePlaceCategoriesButtonsContainer').remove();
  1957. if(W.selectionManager.selectedItems.length > 0){
  1958. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  1959. var $container = $('<div>',{id:'piePlaceCategoriesButtonsContainer', style:'white-space: nowrap;'});
  1960. var categoryOptions = $('[id^=pieItem]');
  1961.  
  1962. var $button = $('<div>',{id:'btnPlaceCatClear', title:'Clear current categories', style:'display:inline-block; cursor:pointer'}).click(function() { onPlaceCategoriesButtonsClick(this.id); });
  1963. $button.append('<span class="fa fa-times" style="font-size:20px; color:red;"></span>');
  1964. $container.append($button);
  1965.  
  1966. for(var i=0;i<categoryOptions.length;i++){
  1967. var name = categoryOptions[i].options[categoryOptions[i].selectedIndex].innerHTML;
  1968. var icon = categoryOptions[i].options[categoryOptions[i].selectedIndex].getAttribute("data-icon");
  1969. var divid = 'btnPlaceCat' + categoryOptions[i].value;
  1970. if(categoryOptions[i].value !== resCategory && categoryOptions[i].value !== "PARKING_LOT"){
  1971. $button = $('<div>',{id:divid, title:name.replace('&amp;', '&'), style:'display:inline-block; cursor:pointer', 'data-category':categoryOptions[i].value}).click(function() { onPlaceCategoriesButtonsClick(this.id); });
  1972. $button.append('<span class="'+icon+'" style="font-size:20px;"></span>');
  1973.  
  1974. $container.append($button);
  1975. }
  1976. }
  1977. }
  1978.  
  1979. $('.categories.controls').before($container);
  1980. }
  1981. }
  1982.  
  1983. function onPlaceCategoriesButtonsClick(buttonid){
  1984. if(buttonid === "btnPlaceCatClear"){
  1985. var blankCategories = []; //W.selectionManager.selectedItems[0].model.attributes.categories.clone();
  1986. //console.log(blankCategories.length);
  1987. //blankCategories.splice(0, blankCategories.length);
  1988. //console.log(blankCategories);
  1989. W.model.actionManager.add(new UpdateObject(W.selectionManager.selectedItems[0].model, { categories: blankCategories }));
  1990. }
  1991. else{
  1992. var newCategories = W.selectionManager.selectedItems[0].model.attributes.categories.clone();
  1993. //console.log($('#'+buttonid)[0].getAttribute("data-category"));
  1994. newCategories.push($('#'+buttonid)[0].getAttribute("data-category"));
  1995. W.model.actionManager.add(new UpdateObject(W.selectionManager.selectedItems[0].model, {categories: newCategories}));
  1996. }
  1997. }
  1998.  
  1999. function CenterOnPlace(venue, zoom){
  2000. var centroid = venue.geometry.getCentroid();
  2001. W.map.setCenter([centroid.x, centroid.y], zoom);
  2002. }
  2003.  
  2004. function isChecked(checkboxId) {
  2005. return $('#' + checkboxId).is(':checked');
  2006. }
  2007.  
  2008. function setChecked(checkboxId, checked) {
  2009. $('#' + checkboxId).prop('checked', checked);
  2010. }
  2011.  
  2012. function noActions(){
  2013. setTimeout(updatePlaceSizeDisplay, 100 ); //have to put in a delay for when the user uses undo to clear all actions - WME updates on top of my changes otherwise.
  2014. }
  2015.  
  2016. function updatePlaceSizeDisplay(){
  2017. var count = W.selectionManager.selectedItems.length;
  2018. var metersArea = 0;
  2019. var bold = false;
  2020. if(count === 1){
  2021. var venue = W.selectionManager.selectedItems[0];
  2022. var isArea = venue.geometry.toString().match(/^POLYGON/);
  2023. //var isPoint = venue.geometry.toString().match(/^POINT/);
  2024.  
  2025. if(venue.model.type === "venue" && isArea){
  2026. if($('#AreaSize'))
  2027. $('#AreaSize').remove();
  2028. metersArea = W.selectionManager.selectedItems[0].model.geometry.getGeodesicArea(W.map.getProjectionObject());
  2029.  
  2030. if(metersArea > 0 && isArea){
  2031. var ftArea = Math.round(metersArea * 10.76391 *100)/100;
  2032.  
  2033. var list = $('#landmark-edit-general > ul')[0];
  2034. var newList = document.createElement("UL");
  2035. newList.id = "AreaSize";
  2036.  
  2037. var newItem = document.createElement("LI");
  2038. if(isChecked("_cbShowAreaPlaceSizeMetric")){
  2039. newItem.innerHTML = "Area: " + metersArea.toFixed(2) + " m<sup>2</sup>";
  2040. newList.appendChild(newItem);
  2041. }
  2042.  
  2043. if(isChecked("_cbShowAreaPlaceSizeImperial")){
  2044. newItem = document.createElement("LI");
  2045. newItem.innerHTML = "Area: " + ftArea.toFixed(2) + " ft<sup>2</sup>";
  2046. newList.appendChild(newItem);
  2047. }
  2048. if(metersArea < 500){
  2049. newItem = document.createElement("LI");
  2050. newItem.innerHTML = "<span style='color:red; font-weight:bold;'>Places smaller than 500 m<sup>2</sup>/5382 ft<sup>2</sup> will not show in the client</span>";
  2051. newList.appendChild(newItem);
  2052. }
  2053. if(metersArea > 20000){
  2054. newItem = document.createElement("LI");
  2055. newItem.innerHTML = "<span style='color:red; font-weight:bold;'>Places larger than 20000 m<sup>2</sup>/215278.2 ft<sup>2</sup> will <i>always</i> show in the client</span>";
  2056. newList.appendChild(newItem);
  2057. }
  2058. if(list.before != null)
  2059. list.before(newList);
  2060. else{
  2061. var parent = $('#landmark-edit-general > ul')[0].parentNode;
  2062. parent.insertBefore(newList,$('#landmark-edit-general > ul')[0]);
  2063. }
  2064.  
  2065. $('#AreaSize').addClass("list-unstyled");
  2066. $('#AreaSize').addClass("additional-attributes");
  2067. }
  2068. }
  2069. }
  2070. }
  2071.  
  2072. //Using the same display for lock buttons as ClickSaver (with permission from MapoMatic) - thanks MoM!
  2073. function addLockButtons() {
  2074. if(W.selectionManager.selectedItems.length > 0){
  2075. var item = W.selectionManager.selectedItems[0];
  2076. var isRPP = (item.model.type === "venue" && item.model.attributes.residential === true);
  2077.  
  2078. if(isRPP){
  2079. var attr = item.model.attributes;
  2080. var autoRank = attr.rank;
  2081. var manualRank = attr.lockRank;
  2082. var firstManualRank = manualRank;
  2083. var userRank = WazeWrap.User.Rank() - 1;
  2084. var maxAutoRank = autoRank;
  2085. var disabled = false;
  2086.  
  2087. var $div = $('#pieRPPLockButtonsContainer');
  2088. $div.remove();
  2089. $div = $('<div>',{id:'pieRPPLockButtonsContainer',style:'margin-bottom:5px;'});
  2090. $div.append('<label class="control-label">Lock</label>');
  2091. var btnInfos = [];
  2092.  
  2093. for(var iBtn=0;iBtn<=6;iBtn++){btnInfos.push({r:iBtn,val:iBtn});}
  2094. btnInfos.forEach(function(btnInfo){
  2095. var selected = (btnInfo.val == manualRank);
  2096. disabled = userRank < btnInfo.val;
  2097. if (btnInfo.val !== 6) {
  2098. $div.append(
  2099. $('<div>', {
  2100. class:'btn btn-lh' + (selected ? ' btn-lh-selected':'') + (btnInfo.r < 6 & (userRank < btnInfo.r || disabled) ? ' disabled' : '')
  2101. })
  2102. .text(btnInfo.hasOwnProperty('title') ? btnInfo.title : btnInfo.r + 1)
  2103. .data('val',btnInfo.hasOwnProperty('val') ? btnInfo.val : btnInfo.r + 1)
  2104. .hover(function() {})
  2105. .click(function() {
  2106. if((userRank >= $(this).data('val')) && (btnInfo.r < 6)) {
  2107. W.model.actionManager.add(new UpdateObject(item.model,{lockRank:($(this).data('val'))}));
  2108. addLockButtons();
  2109. }
  2110. })
  2111. );
  2112. }
  2113. });
  2114. $('#landmark-edit-general > div.address-edit.side-panel-section').after($div);
  2115. }
  2116. }
  2117. }
  2118.  
  2119. var getPermalink = function(currPl) {
  2120. var adjustedPL = currPl.substr(currPl.lastIndexOf('editor')).replace(/&[^&]*Filter=[^&]*|&s=(\d+)/ig,'');
  2121. var lon = adjustedPL.match(/lon=(-?\d+\.\d+)/)[1];
  2122. var lat = adjustedPL.match(/lat=(-?\d+\.\d+)/)[1];
  2123. var zoom = adjustedPL.match(/zoom=\d+/)[0];
  2124. var centroid = W.selectionManager.selectedItems[0].model.geometry.getCentroid();
  2125. adjustedPL = adjustedPL.replace(lon, WazeWrap.Geometry.ConvertTo4326(centroid.x,centroid.y).lon);
  2126. adjustedPL = adjustedPL.replace(lat, WazeWrap.Geometry.ConvertTo4326(centroid.x,centroid.y).lat);
  2127. adjustedPL = adjustedPL.replace(zoom, "zoom="+settings.PlaceZoom);
  2128. if(settings.PlaceLocatorCrosshairProdPL)
  2129. return 'https://www.waze.com/' + adjustedPL;
  2130. else
  2131. return location.origin + '/' + adjustedPL;
  2132. };
  2133.  
  2134. var copyToClipboard = function(str) {
  2135. var $temp = $('<input>');
  2136. $('body').append($temp);
  2137. $temp.val(str).select();
  2138. document.execCommand('copy');
  2139. $temp.remove();
  2140. };
  2141.  
  2142. function buildItemList(itemNumber){
  2143.  
  2144. var $places = $("<div>");
  2145. $places.html([
  2146. '<select id="pieItem' + itemNumber + '">',
  2147. '<option value="CAR_SERVICES" data-icon="waze-icon-place-car" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_SERVICES + '</option>',
  2148. '<option value="GAS_STATION" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.GAS_STATION + '</option>',
  2149. '<option value="GARAGE_AUTOMOTIVE_SHOP" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.GARAGE_AUTOMOTIVE_SHOP + '</option>',
  2150. '<option value="CAR_WASH" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_WASH + '</option>',
  2151. '<option value="CHARGING_STATION" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.CHARGING_STATION + '</option>',
  2152. '<option value="TRANSPORTATION" data-icon="waze-icon-place-transportation" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.TRANSPORTATION + '</option>',
  2153. '<option value="AIRPORT" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.AIRPORT + '</option>',
  2154. '<option value="BUS_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.BUS_STATION + '</option>',
  2155. '<option value="FERRY_PIER" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.FERRY_PIER + '</option>',
  2156. '<option value="SEAPORT_MARINA_HARBOR" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.SEAPORT_MARINA_HARBOR + '</option>',
  2157. '<option value="SUBWAY_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.SUBWAY_STATION + '</option>',
  2158. '<option value="TRAIN_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TRAIN_STATION + '</option>',
  2159. '<option value="BRIDGE" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.BRIDGE + '</option>',
  2160. '<option value="TUNNEL" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TUNNEL + '</option>',
  2161. '<option value="TAXI_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TAXI_STATION + '</option>',
  2162. '<option value="JUNCTION_INTERCHANGE" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.JUNCTION_INTERCHANGE + '</option>',
  2163. '<option value="PROFESSIONAL_AND_PUBLIC" data-icon="waze-icon-place-professional" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.PROFESSIONAL_AND_PUBLIC + '</option>',
  2164. '<option value="COLLEGE_UNIVERSITY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.COLLEGE_UNIVERSITY + '</option>',
  2165. '<option value="SCHOOL" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.SCHOOL + '</option>',
  2166. '<option value="CONVENTIONS_EVENT_CENTER" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.CONVENTIONS_EVENT_CENTER + '</option>',
  2167. '<option value="GOVERNMENT" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.GOVERNMENT + '</option>',
  2168. '<option value="LIBRARY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.LIBRARY + '</option>',
  2169. '<option value="CITY_HALL" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.CITY_HALL + '</option>',
  2170. '<option value="ORGANIZATION_OR_ASSOCIATION" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.ORGANIZATION_OR_ASSOCIATION + '</option>',
  2171. '<option value="PRISON_CORRECTIONAL_FACILITY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.PRISON_CORRECTIONAL_FACILITY + '</option>',
  2172. '<option value="COURTHOUSE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.COURTHOUSE + '</option>',
  2173. '<option value="CEMETERY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.CEMETERY + '</option>',
  2174. '<option value="FIRE_DEPARTMENT" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.FIRE_DEPARTMENT + '</option>',
  2175. '<option value="POLICE_STATION" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.POLICE_STATION + '</option>',
  2176. '<option value="MILITARY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.MILITARY + '</option>',
  2177. '<option value="HOSPITAL_URGENT_CARE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.HOSPITAL_URGENT_CARE + '</option>',
  2178. '<option value="DOCTOR_CLINIC" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.DOCTOR_CLINIC + '</option>',
  2179. '<option value="OFFICES" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.OFFICES + '</option>',
  2180. '<option value="POST_OFFICE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.POST_OFFICE + '</option>',
  2181. '<option value="RELIGIOUS_CENTER" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.RELIGIOUS_CENTER + '</option>',
  2182. '<option value="KINDERGARTEN" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.KINDERGARDEN + '</option>',
  2183. '<option value="FACTORY_INDUSTRIAL" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.FACTORY_INDUSTRIAL + '</option>',
  2184. '<option value="EMBASSY_CONSULATE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.EMBASSY_CONSULATE + '</option>',
  2185. '<option value="INFORMATION_POINT" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.INFORMATION_POINT + '</option>',
  2186. '<option value="EMERGENCY_SHELTER" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.EMERGENCY_SHELTER + '</option>',
  2187. '<option value="SHOPPING_AND_SERVICES" data-icon="waze-icon-place-shopping" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.SHOPPING_AND_SERVICES + '</option>',
  2188. '<option value="ARTS_AND_CRAFTS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.ARTS_AND_CRAFTS + '</option>',
  2189. '<option value="BANK_FINANCIAL" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.BANK_FINANCIAL + '</option>',
  2190. '<option value="SPORTING_GOODS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SPORTING_GOODS + '</option>',
  2191. '<option value="BOOKSTORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.BOOKSTORE + '</option>',
  2192. '<option value="PHOTOGRAPHY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PHOTOGRAPHY + '</option>',
  2193. '<option value="CAR_DEALERSHIP" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_DEALERSHIP + '</option>',
  2194. '<option value="FASHION_AND_CLOTHING" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.FASHION_AND_CLOTHING + '</option>',
  2195. '<option value="CONVENIENCE_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CONVENIENCE_STORE + '</option>',
  2196. '<option value="PERSONAL_CARE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PERSONAL_CARE + '</option>',
  2197. '<option value="DEPARTMENT_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.DEPARTMENT_STORE + '</option>',
  2198. '<option value="PHARMACY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PHARMACY + '</option>',
  2199. '<option value="ELECTRONICS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.ELECTRONICS + '</option>',
  2200. '<option value="FLOWERS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.FLOWERS + '</option>',
  2201. '<option value="FURNITURE_HOME_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.FURNITURE_HOME_STORE + '</option>',
  2202. '<option value="GIFTS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.GIFTS + '</option>',
  2203. '<option value="GYM_FITNESS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.GYM_FITNESS + '</option>',
  2204. '<option value="SWIMMING_POOL" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SWIMMING_POOL + '</option>',
  2205. '<option value="HARDWARE_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.HARDWARE_STORE + '</option>',
  2206. '<option value="MARKET" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.MARKET + '</option>',
  2207. '<option value="SUPERMARKET_GROCERY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SUPERMARKET_GROCERY + '</option>',
  2208. '<option value="JEWELRY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.JEWELRY + '</option>',
  2209. '<option value="LAUNDRY_DRY_CLEAN" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.LAUNDRY_DRY_CLEAN + '</option>',
  2210. '<option value="SHOPPING_CENTER" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SHOPPING_CENTER + '</option>',
  2211. '<option value="MUSIC_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSIC_STORE + '</option>',
  2212. '<option value="PET_STORE_VETERINARIAN_SERVICES" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PET_STORE_VETERINARIAN_SERVICES + '</option>',
  2213. '<option value="TOY_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.TOY_STORE + '</option>',
  2214. '<option value="TRAVEL_AGENCY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.TRAVEL_AGENCY + '</option>',
  2215. '<option value="ATM" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.ATM + '</option>',
  2216. '<option value="CURRENCY_EXCHANGE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CURRENCY_EXCHANGE + '</option>',
  2217. '<option value="CAR_RENTAL" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_RENTAL + '</option>',
  2218. '<option value="FOOD_AND_DRINK" data-icon="waze-icon-place-food-drink" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.FOOD_AND_DRINK + '</option>',
  2219. '<option value="RESTAURANT" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.RESTAURANT + '</option>',
  2220. '<option value="BAKERY" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.BAKERY + '</option>',
  2221. '<option value="DESSERT" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.DESSERT + '</option>',
  2222. '<option value="CAFE" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.CAFE + '</option>',
  2223. '<option value="FAST_FOOD" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.FAST_FOOD + '</option>',
  2224. '<option value="FOOD_COURT" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.FOOD_COURT + '</option>',
  2225. '<option value="BAR" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.BAR + '</option>',
  2226. '<option value="ICE_CREAM" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.ICE_CREAM + '</option>',
  2227. '<option value="CULTURE_AND_ENTERTAINEMENT" data-icon="waze-icon-place-culture" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.CULTURE_AND_ENTERTAINEMENT + '</option>',
  2228. '<option value="ART_GALLERY" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.ART_GALLERY + '</option>',
  2229. '<option value="CASINO" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.CASINO + '</option>',
  2230. '<option value="CLUB" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.CLUB + '</option>',
  2231. '<option value="TOURIST_ATTRACTION_HISTORIC_SITE" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.TOURIST_ATTRACTION_HISTORIC_SITE + '</option>',
  2232. '<option value="MOVIE_THEATER" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.MOVIE_THEATER + '</option>',
  2233. '<option value="MUSEUM" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSEUM + '</option>',
  2234. '<option value="MUSIC_VENUE" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSIC_VENUE + '</option>',
  2235. '<option value="PERFORMING_ARTS_VENUE" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.PERFORMING_ARTS_VENUE + '</option>',
  2236. '<option value="GAME_CLUB" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.GAME_CLUB + '</option>',
  2237. '<option value="STADIUM_ARENA" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.STADIUM_ARENA + '</option>',
  2238. '<option value="THEME_PARK" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.THEME_PARK + '</option>',
  2239. '<option value="ZOO_AQUARIUM" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.ZOO_AQUARIUM + '</option>',
  2240. '<option value="RACING_TRACK" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.RACING_TRACK + '</option>',
  2241. '<option value="THEATER" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.THEATER + '</option>',
  2242. '<option value="OTHER" data-icon="waze-icon-place" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.OTHER + '</option>',
  2243. '<option value="CONSTRUCTION_SITE" data-icon="">' + I18n.translations[I18n.currentLocale()].venues.categories.CONSTRUCTION_SITE + '</option>',
  2244. '<option value="LODGING" data-icon="waze-icon-place-lodging" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.LODGING + '</option>',
  2245. '<option value="HOTEL" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.HOTEL + '</option>',
  2246. '<option value="HOSTEL" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.HOSTEL + '</option>',
  2247. '<option value="CAMPING_TRAILER_PARK" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.CAMPING_TRAILER_PARK + '</option>',
  2248. '<option value="COTTAGE_CABIN" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.COTTAGE_CABIN + '</option>',
  2249. '<option value="BED_AND_BREAKFAST" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.BED_AND_BREAKFAST + '</option>',
  2250. '<option value="OUTDOORS" data-icon="waze-icon-place-outdoors" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.OUTDOORS + '</option>',
  2251. '<option value="PARK" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PARK + '</option>',
  2252. '<option value="PLAYGROUND" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PLAYGROUND + '</option>',
  2253. '<option value="BEACH" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.BEACH + '</option>',
  2254. '<option value="SPORTS_COURT" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SPORTS_COURT + '</option>',
  2255. '<option value="GOLF_COURSE" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.GOLF_COURSE + '</option>',
  2256. '<option value="PLAZA" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PLAZA + '</option>',
  2257. '<option value="PROMENADE" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PROMENADE + '</option>',
  2258. '<option value="POOL" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.POOL + '</option>',
  2259. '<option value="SCENIC_LOOKOUT_VIEWPOINT" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SCENIC_LOOKOUT_VIEWPOINT + '</option>',
  2260. '<option value="SKI_AREA" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SKI_AREA + '</option>',
  2261. '<option value="NATURAL_FEATURES" data-icon="waze-icon-place-natural" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.NATURAL_FEATURES + '</option>',
  2262. '<option value="ISLAND" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.ISLAND + '</option>',
  2263. '<option value="SEA_LAKE_POOL" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.SEA_LAKE_POOL + '</option>',
  2264. '<option value="RIVER_STREAM" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.RIVER_STREAM + '</option>',
  2265. '<option value="FOREST_GROVE" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.FOREST_GROVE + '</option>',
  2266. '<option value="FARM" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.FARM + '</option>',
  2267. '<option value="CANAL" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.CANAL + '</option>',
  2268. '<option value="SWAMP_MARSH" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.SWAMP_MARSH + '</option>',
  2269. '<option value="DAM" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.DAM + '</option>',
  2270. '<option value="PARKING_LOT" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.PARKING_LOT + '</option>',
  2271. '<option value="RESIDENCE_HOME" data-icon="waze-icon-house" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.RESIDENCE_HOME + '</option>',
  2272. '</select>'
  2273. ].join(' '));
  2274.  
  2275. return $places.html();
  2276. }
  2277.  
  2278. function injectCss() {
  2279. var css = [
  2280. // Lock button formatting
  2281. '.btn-lh {cursor:pointer;padding:1px 6px;height:22px;border:solid 1px #c1c1c1;margin-right:3px;}',
  2282. '.btn.btn-lh.btn-lh-selected {background-color:#6999ae;color:white}',
  2283. '.btn.btn-lh.btn-lh-selected:hover {color:white}',
  2284. '.btn.btn-lh.disabled {color:#909090;background-color:#f7f7f7;}',
  2285. '.btn.btn-lh.btn-lh-selected.disabled {color:white;background-color:#6999ae;}',
  2286. //Settings Panel
  2287. '#sidebar .controls-container.pie-controls-container {padding: 0px;}',
  2288. '.select2-choices {-webkit-animation-name: oldCategoryDetected; -webkit-animation-duration: 10s; -webkit-animation-iteration-count: 0; animation-name: oldCategoryDetected; animation-duration: 3s; animation-iteration-count: 0;}',
  2289. //'@keyframes oldCategoryDetected {0% {border-color:rgb(204, 204, 204); border-width:3px;} 50% {border-color:red; border-width:3px;} 100% {border-color:rgb(204, 204, 204); border-width:3px;}}',
  2290. //Image Dialog Enhancement
  2291. '.imgcon {position:relative; margin:0 auto;}',
  2292. '.imnav {color: #ffffff; margin:0 auto; opacity:0.7; display:none; position:absolute; top:0; left:0px; width:100%; height:89%;}',
  2293. '.imgcon:hover .imnav{display:inline-block;}',
  2294. '.control {float:left; height:100%; width:33%; opacity:0;}',
  2295. '.control:hover {opacity:0.7;}',
  2296. '.prim {width:15%; background:url("http://i59.tinypic.com/294s94i.gif")left center no-repeat;}',
  2297. '.zmim {width:70%;}',
  2298. '.neim {width:15%; background:url("http://i62.tinypic.com/2cqfqxf.gif")right center no-repeat;}',
  2299. //PSE
  2300. '.PSESelected {border: 3px solid #ee9900;}'
  2301.  
  2302. ].join(' ');
  2303. $('<style type="text/css">' + css + '</style>').appendTo('head');
  2304. }
  2305.  
  2306. function injectCSSWithID(id, css){
  2307. $('<style type="text/css" id=' + id + '>' + css + '</style>').appendTo('head');
  2308. }
  2309.  
  2310. function loadSettings() {
  2311. var loadedSettings = $.parseJSON(localStorage.getItem("WMEPIE_Settings"));
  2312. var defaultSettings = {
  2313. ShowAreaPlaceSize: false,
  2314. ShowAreaPlaceSizeImperial: false,
  2315. ShowAreaPlaceSizeMetric: false,
  2316. ShowLockButtonsRPP: true,
  2317. NewPlacesList: W.Config.venues.categories.clone(),
  2318. EditRPPAfterCreated: false,
  2319. UseStreetFromClosestSeg: false,
  2320. UseCityFromClosestSeg: false,
  2321. ShowPlaceLocatorCrosshair: false,
  2322. PlaceZoom: 6,
  2323. DefaultLockLevel: 0,
  2324. CreateResidentialPlaceShortcut: "A+r",
  2325. CreateParkingLotShortcut: "A+p",
  2326. UseAltCity: false,
  2327. ShowSearchButton: false,
  2328. AddPlaceCategoriesButtons: false,
  2329. SkipPLR: false,
  2330. ShowParkingLotButton: false,
  2331. ShowPlaceNames: false,
  2332. ShowPlaceNamesPoint: false,
  2333. ShowPlaceNamesArea: false,
  2334. ShowPlaceNamesLock: false,
  2335. ShowCopyPlaceButton: false,
  2336. ShowExternalProviderTooltip: false,
  2337. ShowPlaceNamesPLA: false,
  2338. ClearDescription: true,
  2339. PlaceNameFontSize: "12",
  2340. PlaceNameFontOutlineWidth: 3,
  2341. PlaceNameFontBold: true,
  2342. PlaceNameFontColor: "#FFFFFF",
  2343. PlaceNameFontOutline: "#000000",
  2344. PlaceLocatorCrosshairProdPL: true,
  2345. MoveAddress: false,
  2346. MoveHNEntry: true,
  2347. PLNormalSpotWidth: 3.44,
  2348. PLAngledSpotWidth: 3,
  2349. ShowPLSpotEstimatorButton: false,
  2350. ShowNavPointClosestSegmentOnHover: true,
  2351. ShowClosestSegmentSelected: false,
  2352. NavLink: false
  2353. };
  2354. settings = loadedSettings ? loadedSettings : defaultSettings;
  2355. for (var prop in defaultSettings) {
  2356. if (!settings.hasOwnProperty(prop))
  2357. settings[prop] = defaultSettings[prop];
  2358. }
  2359.  
  2360. if(settings.ShowAreaPlaceSizeImperial === false && settings.ShowAreaPlaceSizeMetric === false)
  2361. if(Waze.prefs.attributes.isImperial)
  2362. settings.ShowAreaPlaceSizeImperial = true;
  2363. else
  2364. settings.ShowAreaPlaceSizeMetric = true;
  2365. }
  2366.  
  2367. function saveSettings() {
  2368. if (localStorage) {
  2369. var localsettings = {
  2370. ShowAreaPlaceSize: settings.ShowAreaPlaceSize,
  2371. ShowAreaPlaceSizeImperial: settings.ShowAreaPlaceSizeImperial,
  2372. ShowAreaPlaceSizeMetric: settings.ShowAreaPlaceSizeMetric,
  2373. ShowLockButtonsRPP: settings.ShowLockButtonsRPP,
  2374. NewPlacesList: settings.NewPlacesList,
  2375. EditRPPAfterCreated: settings.EditRPPAfterCreated,
  2376. UseStreetFromClosestSeg: settings.UseStreetFromClosestSeg,
  2377. UseCityFromClosestSeg: settings.UseCityFromClosestSeg,
  2378. ShowPlaceLocatorCrosshair: settings.ShowPlaceLocatorCrosshair,
  2379. PlaceZoom: settings.PlaceZoom,
  2380. DefaultLockLevel: settings.DefaultLockLevel,
  2381. CreateResidentialPlaceShortcut: settings.CreateResidentialPlaceShortcut,
  2382. CreateParkingLotShortcut: settings.CreateParkingLotShortcut,
  2383. UseAltCity: settings.UseAltCity,
  2384. ShowSearchButton: settings.ShowSearchButton,
  2385. AddPlaceCategoriesButtons: settings.AddPlaceCategoriesButtons,
  2386. SkipPLR: settings.SkipPLR,
  2387. ShowParkingLotButton: settings.ShowParkingLotButton,
  2388. ShowPlaceNames: settings.ShowPlaceNames,
  2389. ShowPlaceNamesPoint: settings.ShowPlaceNamesPoint,
  2390. ShowPlaceNamesArea: settings.ShowPlaceNamesArea,
  2391. ShowPlaceNamesLock: settings.ShowPlaceNamesLock,
  2392. ShowCopyPlaceButton: settings.ShowCopyPlaceButton,
  2393. ShowExternalProviderTooltip: settings.ShowExternalProviderTooltip,
  2394. ShowPlaceNamesPLA: settings.ShowPlaceNamesPLA,
  2395. ClearDescription: settings.ClearDescription,
  2396. PlaceNameFontSize: settings.PlaceNameFontSize,
  2397. PlaceNameFontOutlineWidth: settings.PlaceNameFontOutlineWidth,
  2398. PlaceNameFontBold: settings.PlaceNameFontBold,
  2399. PlaceNameFontColor: settings.PlaceNameFontColor,
  2400. PlaceNameFontOutline: settings.PlaceNameFontOutline,
  2401. PlaceLocatorCrosshairProdPL: settings.PlaceLocatorCrosshairProdPL,
  2402. MoveAddress: settings.MoveAddress,
  2403. MoveHNEntry: settings.MoveHNEntry,
  2404. PLNormalSpotWidth: settings.PLNormalSpotWidth,
  2405. PLAngledSpotWidth: settings.PLAngledSpotWidth,
  2406. ShowPLSpotEstimatorButton: settings.ShowPLSpotEstimatorButton,
  2407. ShowNavPointClosestSegmentOnHover: settings.ShowNavPointClosestSegmentOnHover,
  2408. ShowClosestSegmentSelected: settings.ShowClosestSegmentSelected,
  2409. NavLink: settings.NavLink
  2410. };
  2411.  
  2412. for (var name in Waze.accelerators.Actions) {
  2413. var TempKeys = "";
  2414. if (Waze.accelerators.Actions[name].group == 'wmepie') {
  2415. if (Waze.accelerators.Actions[name].shortcut) {
  2416. if (Waze.accelerators.Actions[name].shortcut.altKey === true) {
  2417. TempKeys += 'A';
  2418. }
  2419. if (Waze.accelerators.Actions[name].shortcut.shiftKey === true) {
  2420. TempKeys += 'S';
  2421. }
  2422. if (Waze.accelerators.Actions[name].shortcut.ctrlKey === true) {
  2423. TempKeys += 'C';
  2424. }
  2425. if (TempKeys !== "") {
  2426. TempKeys += '+';
  2427. }
  2428. if (Waze.accelerators.Actions[name].shortcut.keyCode) {
  2429. TempKeys += Waze.accelerators.Actions[name].shortcut.keyCode;
  2430. }
  2431. } else {
  2432. TempKeys = "-1";
  2433. }
  2434. localsettings[name] = TempKeys;
  2435. }
  2436. }
  2437.  
  2438. localStorage.setItem("WMEPIE_Settings", JSON.stringify(localsettings));
  2439. }
  2440. }
  2441.  
  2442. function loadTranslations() {
  2443. setTranslations({
  2444. en: {
  2445. prefs: {
  2446. title: 'Place Interface Enhancements',
  2447. ShowAreaPlaceSize: 'Show area Place size',
  2448. ShowImperial: 'Show imperial',
  2449. ShowMetric: 'Show metric',
  2450. ShowRPPLockButtons: 'Show lock buttons for RPPs',
  2451. ShowRPPLockButtonsTitle: 'Displays lock level buttons for Residential Place Points',
  2452. ShowPlaceLocatorCrosshair: 'Show Place locator crosshair',
  2453. ShowPlaceLocatorCrosshairTitle: 'Centers the Place on screen and zooms to the defined level',
  2454. Zoom: 'Zoom',
  2455. ZoomTitle: 'The zoom level to use when centering on a Place',
  2456. ShowAddressSearch: 'Show search button next to address',
  2457. ShowAddressSearchTitle: "Show a magnifying glass next to the Place's address. Clicking this button will load the address into the search box",
  2458. ShowPlaceCategoryButtons: 'Add Place category buttons above the categories selection',
  2459. ShowPLAButton: 'Show parking lot button',
  2460. ShowPLAButtonTitle: "Starts creation mode for a Parking Lot Area Place and will set the name to match this Place\'s name when complete",
  2461. ShowCopyPlaceButton: 'Show copy Place button',
  2462. ShowCopyPlaceButtonTitle: 'Copies the selected Place to a new Place with identical settings',
  2463. ShowGPIDTooltip: 'Show External Provider tooltip',
  2464. ShowGPIDTooltipTitle: 'Displays a tooltip with the external provider information',
  2465. NewPlaces: 'New Places',
  2466. EditRPPAfterCreate: 'Edit RPP address after created',
  2467. EditRPPAfterCreateTitle: "Automatically opens the RPP address edit window and focuses on the House Number entry",
  2468. UseStreetFromClosestSegment: 'Use street name from closest segment',
  2469. UseStreetFromClosestSegmentTitle: "Pulls the street name from the closest visible segment and inserts into the new Place's address",
  2470. UseCityFromClosestSegment: 'Use city name from closest segment',
  2471. UseCityFromClosestSegmentTitle: "Pulls the city name from the closest visible segment and inserts into the new Place's address",
  2472. ClosestSegmentAltCity: 'When the primary is "No city" look for an alt city',
  2473. ClosestSegmentAltCityTitle: 'When the primary is \'No city\' try to find an alt street name with a city',
  2474. ClosestSegmentIgnorePLRUnnamedPR: "Ignore PLRs & unnamed PR when using closest segment's name and city",
  2475. ClosestSegmentIgnorePLRUnnamedPRTitle: "When looking for the closest segment, PLRs and unnamed PRs will be ignored",
  2476. LockLevel: 'Lock level',
  2477. LockLevelTitle: 'The lock level to set automatically when creating new Places',
  2478. MapChanges: 'Map Changes',
  2479. ShowPlaceNames: 'Show Place names',
  2480. ShowPlaceNamesTitle: '',
  2481. ShowPointNames: 'Show point names',
  2482. ShowPointNamesTitle: "Will display the Place's name below the Place point",
  2483. ShowAreaNames: 'Show area names',
  2484. ShowAreaNamesTitle: "Will display the Place's name in the middle of the Place area",
  2485. ShowLockLevel: 'Show lock level',
  2486. ShowLockLevelTitle: "Will display the Place's lock level in the middle of the Place area",
  2487. ShowPLAName: 'Show PLA name',
  2488. ShowPLANameTitle: '',
  2489. Item: 'Item',
  2490. PlaceMenuCustomization: "Place Menu Customization",
  2491. ClearDescription: "Show clear description button",
  2492. ClearDescriptionTitle: "Adds a clear button to the top right of the description entry that when clicked will clear all text in the entry field",
  2493. PropertiesPanel: "Properties Panel",
  2494. FontSize: "Font size",
  2495. FontColor: "Font color",
  2496. Bold: "Bold",
  2497. FontOutlineColor: "Font outline color",
  2498. FontOutlineWidth: "Font outline width",
  2499. ProdPL: "Force production PL",
  2500. MoveAddress: "Move address to top of panel",
  2501. MoveAddressTitle: "Moves the address editor to the top of the properties panel",
  2502. MoveHNEntry: "Move HN entry before street entry",
  2503. MoveHNEntryTitle: "Moves the House Number entry before the Street entry in the address editor",
  2504. ShowParkingSpaceEstimatorTool: "Show Parking Space Estimator tool",
  2505. ShowParkingSpaceEstimatorToolTitle: "Shows the button to launch the Parking Space Estimator tool",
  2506. PSEParkingSpaceEstimator: "Parking Space Estimator",
  2507. PSELayoutType: "Layout type",
  2508. PSE90degree: "90 degree",
  2509. PSEAngled: "Angled",
  2510. PSEEstimatedNumOfSpots: "Estimated # of spots: ",
  2511. PSESet: "Set",
  2512. PSESpotWidth: "Spot width (m)",
  2513. PSECal: "Cal",
  2514. PSEDraw90DegreeTitle: "Click to draw a line through an entire 90 degree parking space aisle. Double click to finish drawing and measure the spaces.",
  2515. PSEDrawAngledTitle: "Click to draw a line through an entire angled parking space aisle. Double click to finish drawing and measure the spaces.",
  2516. PSEShowPSEButton: "Show Parking Space Estimator tool button",
  2517. PSEShowPSEButtonTitle: "Shows the button to launch the Parking Space Estimator tool",
  2518. PSEDisplayButtonTitle: "Opens the Parking Space Estimator tool",
  2519. ShowNavPointClosestSegmentOnHover: "Display the nav point and closest segment line on hover",
  2520. ShowClosestSegmentSelected: "Display a line from the nav point to the point on the closest segment",
  2521. NavLink: "Link nav point",
  2522. NavLinkTitle: "Enables the nav point link on all point Places. When linked, the nav point will move to the location of the point Place when the Place is moved"
  2523. }
  2524. },
  2525. "es-419": {
  2526. prefs: {
  2527. title: 'Place Interface Enhancements',
  2528. ShowAreaPlaceSize: 'Mostrar tamaño del área',
  2529. ShowImperial: 'Sistema Imperial',
  2530. ShowMetric: 'Sistema Métrico',
  2531. ShowRPPLockButtons: 'Mostrar botones de bloqueo para RPPs',
  2532. ShowRPPLockButtonsTitle: 'Muestra los botones de nivel de bloqueo para lugares residenciales',
  2533. ShowPlaceLocatorCrosshair: 'Mostrar reticula localizadora del lugar',
  2534. ShowPlaceLocatorCrosshairTitle: 'Centra el lugar en la pantalla y acercamiento al nivel definido',
  2535. Zoom: 'Acercamiento',
  2536. ZoomTitle: 'Nivel de acercamiento a utilizar cuando se centra en un lugar',
  2537. ShowAddressSearch: 'Mostrar el botón de búsqueda junto a la dirección',
  2538. ShowAddressSearchTitle: "Muestra una lupa junto a la dirección del lugar. Al hacer clic en este botón, se cargará la dirección en la barra de búsqueda",
  2539. ShowPlaceCategoryButtons: 'Botones de categorías de lugares',
  2540. ShowPLAButton: 'Mostrar botón de PLAs',
  2541. ShowPLAButtonTitle: 'Inicia el modo de creación de un lugar del área de estacionamiento y establecerá el nombre del estacionamiento para que coincida con el nombre del lugar cuando se complete',
  2542. ShowCopyPlaceButton: 'Mostrar botón de copiado de lugar',
  2543. ShowCopyPlaceButtonTitle: 'Copia el lugar seleccionado en un lugar nuevo con configuraciones idénticas',
  2544. ShowGPIDTooltip: 'Mostrar información del proveedor externo',
  2545. ShowGPIDTooltipTitle: 'Muestra un texto con la información del proveedor externo',
  2546. NewPlaces: 'Nuevos lugares',
  2547. EditRPPAfterCreate: 'Editar la dirección del RPP una vez creada',
  2548. EditRPPAfterCreateTitle: "Automáticamente abre la ventana de edición en la dirección del lugar residencial y se enfoca en el campo de número de casa",
  2549. UseStreetFromClosestSegment: 'Utilizar el nombre de la calle del segmento más cercano',
  2550. UseStreetFromClosestSegmentTitle: "Extrae el nombre de la calle del segmento visible más cercano y lo agrega en la dirección del nuevo lugar",
  2551. UseCityFromClosestSegment: 'Usar el nombre de la ciudad del segmento más cercano',
  2552. UseCityFromClosestSegmentTitle: "Extrae el nombre de la ciudad del segmento visible más cercano y lo agrega en la dirección del nuevo lugar",
  2553. ClosestSegmentAltCity: 'Buscar una ciudad alternativa cuando la ciudad principal sea \'Ninguno\'',
  2554. ClosestSegmentAltCityTitle: 'Cuando la ciudad principal es "Ninguno" trata de encontrar un nombre de calle alternativo con una ciudad',
  2555. ClosestSegmentIgnorePLRUnnamedPR: "Ignorar los PLR y PR sin nombre cuando utilice el nombre y la ciudad del segmento más cercano",
  2556. ClosestSegmentIgnorePLRUnnamedPRTitle: "Ignorar segmentos de estacionamiento o privados al buscar el segmento mas cercano",
  2557. LockLevel: 'Nivel de bloqueo',
  2558. LockLevelTitle: 'El nivel de bloqueo para establecer automáticamente al crear nuevos lugares',
  2559. MapChanges: 'Cambios en el mapa',
  2560. ShowPlaceNames: 'Mostrar nombres de lugares',
  2561. ShowPlaceNamesTitle: '',
  2562. ShowPointNames: 'Mostrar nombres de punto',
  2563. ShowPointNamesTitle: "Muestra el nombre de lugares definidos como punto",
  2564. ShowAreaNames: 'Mostrar nombres de área',
  2565. ShowAreaNamesTitle: "Muestra el nombre de lugares definidos como área",
  2566. ShowLockLevel: 'Mostrar nivel de bloqueo',
  2567. ShowLockLevelTitle: "Muestra el nivel de bloqueo en el centro del lugar",
  2568. ShowPLAName: 'Mostrar nombre de PLA',
  2569. ShowPLANameTitle: 'Muestra el nombre de áreas de estacionamiento (PLAs)',
  2570. Item: 'Opción',
  2571. PlaceMenuCustomization: "Personalización del menú de lugares",
  2572. ClearDescription: "Mostrar botón de borrar descripción",
  2573. ClearDescriptionTitle: "Añade un botón de borrado en la parte superior derecha del campo de descripción que deja vacíos todos los campos",
  2574. PropertiesPanel: "Propiedades del panel",
  2575. FontSize: "Tamaño de letra",
  2576. FontColor: "Color de Letra",
  2577. Bold: "Negrita",
  2578. FontOutlineColor: "Color del contorno de la letra",
  2579. FontOutlineWidth: "Ancho del contorno de la letra",
  2580. ProdPL: "Forzar Permalink de producción",
  2581. MoveAddress: "Move address to top of panel",
  2582. MoveAddressTitle: "Moves the address editor to the top of the properties panel",
  2583. MoveHNEntry: "Move HN entry before street entry",
  2584. MoveHNEntryTitle: "Moves the House Number entry before the Street entry in the address editor",
  2585. ShowParkingSpaceEstimatorTool: "Show Parking Space Estimator tool",
  2586. ShowParkingSpaceEstimatorToolTitle: "Shows the button to launch the Parking Space Estimator tool",
  2587. PSEParkingSpaceEstimator: "Parking Space Estimator",
  2588. PSELayoutType: "Layout type",
  2589. PSE90degree: "90 degree",
  2590. PSEAngled: "Angled",
  2591. PSEEstimatedNumOfSpots: "Estimated # of spots: ",
  2592. PSESet: "Set",
  2593. PSESpotWidth: "Spot width (m)",
  2594. PSECal: "Cal",
  2595. PSEDraw90DegreeTitle: "Click to draw a line through an entire 90 degree parking space aisle. Double click to finish drawing and measure the spaces.",
  2596. PSEDrawAngledTitle: "Click to draw a line through an entire angled parking space aisle. Double click to finish drawing and measure the spaces.",
  2597. PSEShowPSEButton: "Show Parking Space Estimator tool button",
  2598. PSEShowPSEButtonTitle: "Shows the button to launch the Parking Space Estimator tool",
  2599. PSEDisplayButtonTitle: "Opens the Parking Space Estimator tool",
  2600. ShowNavPointClosestSegmentOnHover: "Display the nav point and closest segment line on hover",
  2601. ShowClosestSegmentSelected: "Display a line from the nav point to the point on the closest segment",
  2602. NavLink: "Link nav point",
  2603. NavLinkTitle: "Enables the nav point link on all point Places. When linked, the nav point will move to the location of the point Place when the Place is moved"
  2604. }
  2605. },
  2606. fr: {
  2607. prefs: {
  2608. title: 'Place Interface Enhancements',
  2609. ShowAreaPlaceSize: 'Afficher la tallie de la place',
  2610. ShowImperial: 'Afficher en imperial',
  2611. ShowMetric: 'Afficher en métrique',
  2612. ShowRPPLockButtons: 'Afficher les boutons de lock pour les résidentiels',
  2613. ShowRPPLockButtonsTitle: 'Affiche des boutons pour le niveau de verrouillage des lieux résidentiels',
  2614. ShowPlaceLocatorCrosshair: 'Afficher le repère de localisation du lieu',
  2615. ShowPlaceLocatorCrosshairTitle: "Centre le lieu à l'écran et zoome au niveau défini",
  2616. Zoom: 'Zoom',
  2617. ZoomTitle: "Niveau de zoom utilisé lorsqu'on se centre sur un lieu",
  2618. ShowAddressSearch: "Afficher icône de recherche à côté de l'adresse",
  2619. ShowAddressSearchTitle: "Affiche une loupe à côté de l'adresse du lieu. Cliquer ce bouton chargera l'adresse dans la barre de recherche",
  2620. ShowPlaceCategoryButtons: 'Ajouter des icônes de catégorie au dessus de la sélection de catégories',
  2621. ShowPLAButton: 'Afficher le bouton de création de parking',
  2622. ShowPLAButtonTitle: 'Démarre le mode création de parking pour tracer un parking qui aura le nom du lieu sélectionné',
  2623. ShowCopyPlaceButton: 'Afficher le bouton de clonage de lieu',
  2624. ShowCopyPlaceButtonTitle: 'Clone le lieu sélectionné en nouveau lieu avec les mêmes valeurs',
  2625. ShowGPIDTooltip: 'Afficher en infobulle le fournisseur externe',
  2626. ShowGPIDTooltipTitle: 'Affiche une infobulle avec les informations du fournisseur externe',
  2627. NewPlaces: 'Nouveaux Lieux',
  2628. EditRPPAfterCreate: "Editer l'adresse du résidentiel après création",
  2629. EditRPPAfterCreateTitle: "Ouvre automatiquement la zone d'édition de l'adresse du lieu résidentiel et se positionne sur la saisie du n° de rue",
  2630. UseStreetFromClosestSegment: 'Utiliser le nom de rue du segment le plus proche',
  2631. UseStreetFromClosestSegmentTitle: "Prend le nom de rue du segment visible le plus proche et l'insère dans l'adresse du nouveau lieu",
  2632. UseCityFromClosestSegment: 'Utiliser le nom de ville du segment le plus proche',
  2633. UseCityFromClosestSegmentTitle: "Prend le nom de ville du segment visible le plus proche et l'insère dans l'adresse du nouveau lieu",
  2634. ClosestSegmentAltCity: 'Lorsque le nom principal est «Hors ville» regarder le nom en alt',
  2635. ClosestSegmentAltCityTitle: 'Lorsque le nom principal est «Hors ville» essayer de trouver un nom de rue alternatif avec une ville',
  2636. ClosestSegmentIgnorePLRUnnamedPR: "Ignorer les parkings et voies privées non nommés",
  2637. ClosestSegmentIgnorePLRUnnamedPRTitle: "Lorsque le script regarde le nom du segment visible le plus proche, les parkings et voies privées non nommées seront ignorés",
  2638. LockLevel: 'Verrouillage ',
  2639. LockLevelTitle: 'Le niveau de verrouillage est appliqué automatiquement à la création du lieu',
  2640. MapChanges: 'Changements de carte',
  2641. ShowPlaceNames: 'Afficher le nom des lieux',
  2642. ShowPlaceNamesTitle: '',
  2643. ShowPointNames: 'Afficher le nom des lieux point',
  2644. ShowPointNamesTitle: "Affiche le nom du lieu sous le lieu point",
  2645. ShowAreaNames: 'Afficher le nom des lieux zone',
  2646. ShowAreaNamesTitle: "Affiche le nom du lieu au milieu du lieu zone",
  2647. ShowLockLevel: 'Afficher le niveau de verrouillage',
  2648. ShowLockLevelTitle: "Afficher le niveau de verrouillage du lieu au milieu du lieu zone",
  2649. ShowPLAName: 'Afficher le nom des parkings',
  2650. ShowPLANameTitle: 'Affiche le nom du parking au milieu du lieu zone',
  2651. Item: 'Option',
  2652. PlaceMenuCustomization: "Personnalisation du menu Lieu",
  2653. ClearDescription: "Afficher le bouton «Effacer description»",
  2654. ClearDescriptionTitle: "Ajoute un bouton «Effacer description» en haut à droite de l'entrée de description qui, lorsqu'il est cliqué, effacera tout le texte dans le champ de saisie",
  2655. PropertiesPanel: "Panneau des propriétés",
  2656. FontSize: "Taille de police",
  2657. FontColor: "Couleur de police",
  2658. Bold: "Gras",
  2659. FontOutlineColor: "Couleur surlignage police",
  2660. FontOutlineWidth: "Épaisseur surlignage police",
  2661. ProdPL: "Force production PL",
  2662. MoveAddress: "Déplacer l'adresse en haut du panneau",
  2663. MoveAddressTitle: "Déplace l'édition d'adresse en haut du panneau de propritétés",
  2664. MoveHNEntry: "Placer n° de rue avant nom de rue",
  2665. MoveHNEntryTitle: "Place l'édition du numéro de rue avant le nom de la rue dans l'éditeur d'adresse",
  2666. ShowParkingSpaceEstimatorTool: "Afficher le simulateur de places de stationnement",
  2667. ShowParkingSpaceEstimatorToolTitle: "Affiche un bouton pour lancer le simulateur de places de stationnement",
  2668. PSEParkingSpaceEstimator: "Simulateur places de stationnement",
  2669. PSELayoutType: "Emplacements:",
  2670. PSE90degree: "A 90 degrés",
  2671. PSEAngled: "Inclinés",
  2672. PSEEstimatedNumOfSpots: "Nombre estimé de places: ",
  2673. PSESet: "Set",
  2674. PSESpotWidth: "Largeur place (m)",
  2675. PSECal: "Cal",
  2676. PSEDraw90DegreeTitle: "Cliquez pour dessiner une ligne passant à travers les emplacements de parking à 90°. Double-cliquez pour terminer le tracé et mesurer les espaces.",
  2677. PSEDrawAngledTitle: "Cliquez pour dessiner une ligne passant à travers les emplacements de parking inclinés. Double-cliquez pour terminer le tracé et mesurer les espaces.",
  2678. PSEShowPSEButton: "Afficher le simulateur de places de stationnement",
  2679. PSEShowPSEButtonTitle: "Affiche un bouton pour lancer le simulateur de places de stationnement",
  2680. PSEDisplayButtonTitle: "Ouvre le simulateur de places de stationnement",
  2681. ShowNavPointClosestSegmentOnHover: "Affiche une ligne entre le point d'entrée et le segment le plus proche",
  2682. ShowClosestSegmentSelected: "Display a line from the nav point to the point on the closest segment",
  2683. NavLink: "Link nav point",
  2684. NavLinkTitle: "Enables the nav point link on all point Places. When linked, the nav point will move to the location of the point Place when the Place is moved"
  2685. }
  2686. }
  2687. });
  2688. }
  2689.  
  2690. function setTranslations(translations) {
  2691. I18n.translations[I18n.currentLocale()].pie = translations.en;
  2692. for (var i = 0; i < Object.keys(translations).length; i++) {
  2693. var locale = Object.keys(translations)[i];
  2694. if (I18n.currentLocale() == locale) {
  2695. I18n.translations[locale].pie.prefs = translations[locale].prefs;
  2696. return;
  2697. }
  2698. }
  2699. }
  2700.  
  2701. function listPlaces(){
  2702. var category = "";
  2703. for(i=0; i<W.Config.venues.categories.length; i++){
  2704. category = W.Config.venues.categories[i];
  2705. console.log(category + " Main");
  2706. var subCategories = W.Config.venues.subcategories[category];
  2707. for(var j=0; j<subCategories.length;j++){
  2708. console.log(subCategories[j]);
  2709. }
  2710. }
  2711. }
  2712. })();