WME Place Interface Enhancements

Enhancements to various Place interfaces

当前为 2017-06-23 提交的版本,查看 最新版本

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