WME Place Interface Enhancements

Enhancements to various Place interfaces

当前为 2017-10-24 提交的版本,查看 最新版本

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