WME Place Interface Enhancements

Enhancements to various Place interfaces

当前为 2017-04-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name WME Place Interface Enhancements
  3. // @namespace https://greasyfork.org/users/30701-justins83-waze
  4. // @version 1.00.05
  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,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAEAAQADAREAAhEBAxEB/8QAHQABAAEFAQEBAAAAAAAAAAAAAAUBAwQGBwIICf/EAEAQAAICAQICBQgHBwQCAwAAAAABAgMEBREGMRIhQVFhBxMUIjJScYEXI0JUkZLBCBVVYpOhsRYzcoJEolPR4f/EABsBAQACAwEBAAAAAAAAAAAAAAADBAECBgUH/8QAMBEBAAIBAgUBCAEEAwEAAAAAAAECAwQRBRIhMVFBBhMiMmFxkdGBFCOhsVLB4fD/2gAMAwEAAhEDEQA/AP1TAAAAAAAAAAAAAAAAAAADwrFJtR9bbm+wyxu9mGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY+Vm04cd7JbPsiubNorNuzW1or3YONlW6tc0t6saPNJ9cvDckmsUj6o4tN5+iVjFQioxSSXJIhTKgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH1PWnVJ1UNdJdUp93wJ6Y9+soL5NukIOc5WScpScpPm2WdtleZ37tg4elF4ckvaU+sq5e6zi7JQhTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj6hc6MK2cfaS6jasbzENbTtWZalzLy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ANW470P07BWZVHe6hettzlDt/Alpbadmlo3c4LCIAAAAAAAAAAKS9l/ADnMvafxNW6gAAAAAAAADunke4S/c+kPVMiG2XmL1E11wr7Px5/gQXnedm8Q6IRtgAAAAAAAAAApKKlFprdPqaYGj5nk5ssyrZ0ZVddMpNxhKL3S7ieMiPlWfo2yfvlX5WPeR4OQ+jbJ++VflY95Hg5D6Nsn75V+Vj3keDkPo2yfvlX5WPeR4OQ+jbJ++VflY95Hg5D6Nsn75V+Vj3keDkPo2yfvlX5WPeR4OQ+jbJ++VflY95Hg5D6Nsn75V+Vj3keDkUfk1yWmvTKvyse8jwcjWH5B89tv96Y39ORj3kM8qn0D5/8AFMb+nIe8g5T6B8/+KY39OQ95Byn0D5/8Uxv6ch7yDlPoHz/4pjf05D3kHKfQPn/xTG/pyHvIOU+gfP8A4pjf05D3kHKfQPn/AMUxv6ch7yDlZWmeQy6jUMezM1Cm7FhNSsrhBpyS7DE3OV1yEI1xUYpRjFbJLkkRN3oAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//Z
  11. // @author JustinS83
  12. // @grant none
  13. // @require https://greasyfork.org/scripts/24851-wazewrap/code/WazeWrap.js
  14. // @license GPLv3
  15. // ==/UserScript==
  16. var UpdateObject, MultiAction;
  17.  
  18. (function() {
  19. 'use strict';
  20.  
  21. var settings = {};
  22. var placeMenuSelector = "#edit-buttons > div > div.toolbar-button.waze-icon-place.toolbar-submenu.toolbar-group.toolbar-group-venues.ItemInactive > menu";
  23. var pointStyle = {
  24. pointRadius: 6,
  25. fillOpacity: 0,
  26. strokeColor: '#00ece3',
  27. strokeWidth: '2',
  28. strokeLinecap: 'round'
  29. };
  30. var layerName = "WME PIE";
  31. var newPlaceLayer;
  32. var placementMode = false;
  33. var drawPoly;
  34. var resCategory = "RESIDENCE_HOME";
  35. var PIEPlaceNameLayer;
  36.  
  37. function bootstrap(tries) {
  38. tries = tries || 1;
  39.  
  40. if (window.W &&
  41. window.W.map &&
  42. window.W.model &&
  43. window.W.loginManager.user &&
  44. $) {
  45. init();
  46. } else if (tries < 1000) {
  47. setTimeout(function () {bootstrap(tries++);}, 200);
  48. }
  49. }
  50.  
  51. bootstrap();
  52.  
  53. function init(){
  54. loadTranslations();
  55.  
  56.  
  57. var $section = $("<div>", {style:"padding:8px 16px", id:"WMEPIESettings"});
  58. $section.html([
  59. '<h4><b>' + I18n.t('pie.prefs.title') + '</b></h4>',
  60. '<div class="controls-container pie-controls-container" id="divAreaPlaceSizeControls">',
  61. '<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>',
  62. '<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>',
  63. '<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>',
  64. '</div>',
  65. '<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">' + I18n.t('pie.prefs.ShowRPPLockButtons') + '</label></div>',
  66. '<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">' + I18n.t('pie.prefs.ShowPlaceLocatorCrosshair') + '</label></br>',
  67. '<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>',
  68. '<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>',
  69. '<div class="controls-container pie-controls-container" id="divAddPlaceCategoriesButtons"><input type="checkbox" id="_cbAddPlaceCategoriesButtons" class="pieSettingsCheckbox"/><label for="_cbAddPlaceCategoriesButtons" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowPlaceCategoryButtons') + '</label></div>',
  70. '<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">' + I18n.t('pie.prefs.ShowPLAButton') + '</label></div>',
  71. '<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">' + I18n.t('pie.prefs.ShowCopyPlaceButton') + '</label></div>',
  72. '<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">' + I18n.t('pie.prefs.ShowGPIDTooltip') + '</label></div>',
  73. '<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">' + I18n.t('pie.prefs.ClearDescription') + '</label></div>',
  74.  
  75. '<fieldset id="fieldNewPlaces" style="border: 1px solid silver; padding: 8px; border-radius: 4px;">',
  76. '<legend style="margin-bottom:0px; border-bottom-style:none;width:auto;"><h4>' + I18n.t('pie.prefs.NewPlaces') + '</h4></legend>',
  77. '<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>',
  78. '<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>',
  79. '<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>',
  80. '<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>',
  81. '<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>',
  82. '<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>',
  83. '</fieldset>',
  84.  
  85. '<fieldset id="fieldMapMods" 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.MapChanges') + '</h4></legend>',
  87. '<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>',
  88. '<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>',
  89. '<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>',
  90. '<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>',
  91. '<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>',
  92. '</fieldset>',
  93. '<div class="controls-container" id="divPlaceMenuCustomization">',
  94. '<b>' + I18n.t('pie.prefs.PlaceMenuCustomization') + '</b></br>',
  95. buildItemOption(1),
  96. buildItemOption(2),
  97. buildItemOption(3),
  98. buildItemOption(4),
  99. buildItemOption(5),
  100. buildItemOption(6),
  101. buildItemOption(7),
  102. buildItemOption(8),
  103. buildItemOption(9),
  104. buildItemOption(10),
  105. buildItemOption(11),
  106. '</div>'
  107.  
  108. ].join(' '));
  109.  
  110. UpdateObject = require("Waze/Action/UpdateObject");
  111. MultiAction = require("Waze/Action/MultiAction");
  112.  
  113. newPlaceLayer = new OL.Layer.Vector(layerName,{displayInLayerSwitcher: false});
  114. W.map.addLayer(newPlaceLayer);
  115.  
  116. var style = new OpenLayers.Style({
  117. pointRadius: "${pointRadius}",
  118. label : "${labelText}",
  119. fontFamily: "Tahoma, Arial, Verdana",
  120. labelOutlineColor: '#FFEEEE',
  121. labelOutlineWidth: 2,
  122. labelAlign: 'cm',
  123. fontColor: "#301130",
  124. fontOpacity: 1.0,
  125. fontSize: "12px",
  126. labelYOffset: "${yOffset}",
  127. fontStyle: "${style}",
  128. pointRadius: 0
  129. });
  130.  
  131. PIEPlaceNameLayer = new OL.Layer.Vector("PIEPlaceNameLayer",{displayInLayerSwitcher: false,
  132. uniqueName: "__PIEPlaceNameLayer", styleMap: new OL.StyleMap(style)});
  133. W.map.addLayer(PIEPlaceNameLayer);
  134. PIEPlaceNameLayer.setVisibility(true);
  135.  
  136. injectCss();
  137. new WazeWrap.Interface.Tab('PIE', $section.html(), init2);
  138. }
  139.  
  140. function buildNewPlaceList(){
  141. //Clear out the Places menu
  142. $(placeMenuSelector).empty();
  143. var cat = "";
  144. var icon = "";
  145. var i;
  146. for(i=0;i<11;i++){
  147. icon = "";
  148. cat = $('#pieItem' + (i+1))[0].value;
  149. icon = $('#pieItem' + (i+1))[0].options[$('#pieItem' + (i+1))[0].selectedIndex].getAttribute("data-icon");
  150. if(cat !== "PARKING_LOT" && cat !== resCategory)
  151. $(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>');
  152. else{
  153. if(cat === resCategory) //force point
  154. $(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>');
  155. else //Parking lot - force area
  156. $(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>');
  157. }
  158. }
  159.  
  160. $('[id^="piePlaceMainItem"]').click(function(e){
  161. startPlacementMode($('#' + this.id).data("category"), true);
  162. });
  163.  
  164. $('[id^="piePlaceAreaItem"]').click(function(e){
  165. e.stopPropagation();
  166. startPlacementMode($('#' + this.id).data("category"), false);
  167. });
  168. }
  169.  
  170. function init2(){
  171. //Load settings
  172. loadSettings();
  173. //Set up event handlers
  174. $('#_cbShowAreaPlaceSize').change(function() {
  175. if(this.checked) {
  176. attachPlaceSizeHandlers();
  177. updatePlaceSizeDisplay();
  178. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = false;
  179. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = false;
  180. }
  181. else
  182. {
  183. removePlaceSizeHandlers();
  184. $('#AreaSize').remove();
  185. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = true;
  186. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = true;
  187. }
  188. });
  189.  
  190. $('#_cbShowPlaceNames').change(function() {
  191. PIEPlaceNameLayer.setVisibility(this.checked);
  192. if(this.checked) {
  193. $('#_cbShowPlaceNamesPoint')[0].disabled = false;
  194. $('#_cbShowPlaceNamesArea')[0].disabled = false;
  195. $('#_cbShowPlaceNamesPLA')[0].disabled = false;
  196. $('#_cbShowPlaceNamesLock')[0].disabled = false;
  197. }
  198. else
  199. {
  200. $('#_cbShowPlaceNamesPoint')[0].disabled = true;
  201. $('#_cbShowPlaceNamesArea')[0].disabled = true;
  202. $('#_cbShowPlaceNamesPLA')[0].disabled = true;
  203. $('#_cbShowPlaceNamesLock')[0].disabled = true;
  204. }
  205. console.log(this.checked);
  206. DisplayPlaceNames();
  207. });
  208.  
  209. $('[id^="_cbShowPlaceNames"]').change(function(){
  210. DisplayPlaceNames();
  211. });
  212.  
  213. $('#_cbShowExternalProviderTooltip').change(function(){
  214. ToggleExternalProvidersCSS(this.checked);
  215. });
  216.  
  217. $('#_cbShowLockButtonsRPP').change(function() {
  218. if(this.checked)
  219. attachRPPLockButtonHandlers();
  220. else
  221. {
  222. $('#pieRPPLockButtonsContainer').remove();
  223. unregisterEvents(addLockButtons);
  224. }
  225. });
  226.  
  227. $('#_cbShowPlaceLocatorCrosshair').change(function(){
  228. if(this.checked)
  229. registerEvents(ShowPlaceLocatorCrosshair);
  230. else
  231. unregisterEvents(ShowPlaceLocatorCrosshair);
  232. });
  233.  
  234. $('#_cbShowParkingLotButton').change(function(){
  235. if(this.checked)
  236. registerEvents(ShowParkingLotButton);
  237. else
  238. unregisterEvents(ShowParkingLotButton);
  239. });
  240.  
  241. $('#_cbShowCopyPlaceButton').change(function(){
  242. if(this.checked)
  243. registerEvents(ShowCopyPlaceButton);
  244. else
  245. unregisterEvents(ShowCopyPlaceButton);
  246. });
  247.  
  248. $('#_cbShowSearchButton').change(function(){
  249. if(this.checked)
  250. registerEvents(ShowSearchButton);
  251. else
  252. unregisterEvents(ShowSearchButton);
  253. });
  254.  
  255. $('#_cbAddPlaceCategoriesButtons').change(function(){
  256. if(this.checked)
  257. registerEvents(AddPlaceCategoriesButtons);
  258. else
  259. unregisterEvents(AddPlaceCategoriesButtons);
  260. });
  261.  
  262. //Load settings to interface
  263. setChecked('_cbShowAreaPlaceSize', settings.ShowAreaPlaceSize);
  264. setChecked('_cbShowAreaPlaceSizeImperial', settings.ShowAreaPlaceSizeImperial);
  265. setChecked('_cbShowAreaPlaceSizeMetric', settings.ShowAreaPlaceSizeMetric);
  266. setChecked('_cbShowLockButtonsRPP', settings.ShowLockButtonsRPP);
  267. setChecked('_cbEditRPPAfterCreated', settings.EditRPPAfterCreated);
  268. setChecked('_cbUseStreetFromClosestSeg', settings.UseStreetFromClosestSeg);
  269. setChecked('_cbUseCityFromClosestSeg', settings.UseCityFromClosestSeg);
  270. setChecked('_cbShowPlaceLocatorCrosshair', settings.ShowPlaceLocatorCrosshair);
  271. setChecked('_cbShowParkingLotButton', settings.ShowParkingLotButton);
  272. setChecked('_cbShowCopyPlaceButton', settings.ShowCopyPlaceButton);
  273. setChecked('_cbShowExternalProviderTooltip', settings.ShowExternalProviderTooltip);
  274. setChecked('_cbUseAltCity', settings.UseAltCity);
  275. setChecked('_cbShowSearchButton', settings.ShowSearchButton);
  276. setChecked('_cbAddPlaceCategoriesButtons', settings.AddPlaceCategoriesButtons);
  277. setChecked('_cbSkipPLR', settings.SkipPLR);
  278. setChecked('_cbShowPlaceNames', settings.ShowPlaceNames);
  279. setChecked('_cbShowPlaceNamesPoint', settings.ShowPlaceNamesPoint);
  280. setChecked('_cbShowPlaceNamesArea', settings.ShowPlaceNamesArea);
  281. setChecked('_cbShowPlaceNamesPLA', settings.ShowPlaceNamesPLA);
  282. setChecked('_cbShowPlaceNamesLock', settings.ShowPlaceNamesLock);
  283. setChecked('_cbClearDescription', settings.ClearDescription);
  284. if(settings.ShowPlaceNames){
  285. $('#_cbShowPlaceNamesPoint')[0].disabled = false;
  286. $('#_cbShowPlaceNamesArea')[0].disabled = false;
  287. $('#_cbShowPlaceNamesPLA')[0].disabled = false;
  288. $('#_cbShowPlaceNamesLock')[0].disabled = false;
  289. }
  290. $('#piePlaceZoom')[0].value = settings.PlaceZoom;
  291. $('#pieDefaultLockLevel')[0].value = settings.DefaultLockLevel;
  292.  
  293. if(settings.ShowAreaPlaceSize){
  294. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = false;
  295. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = false;
  296. attachPlaceSizeHandlers();
  297. }
  298.  
  299. if(settings.ShowPlaceLocatorCrosshair){
  300. registerEvents(ShowPlaceLocatorCrosshair);
  301. ShowPlaceLocatorCrosshair(); //in case the user opened a PL with a Place selected
  302. }
  303.  
  304. if(settings.ShowParkingLotButton){
  305. registerEvents(ShowParkingLotButton);
  306. ShowParkingLotButton(); //in case the user opened a PL with a Place selected
  307. }
  308.  
  309. if(settings.ShowCopyPlaceButton){
  310. registerEvents(ShowCopyPlaceButton);
  311. ShowCopyPlaceButton();
  312. }
  313.  
  314. if(settings.ShowExternalProviderTooltip){
  315. //registerEvents(ShowExternalProviderTooltip);
  316. //ShowExternalProviderTooltip();
  317.  
  318. var observer = new MutationObserver(function(mutations) {
  319. mutations.forEach(function(mutation) {
  320. if ($(mutation.target).hasClass('select2-chosen')) ShowExternalProviderTooltip();
  321. });
  322. });
  323.  
  324. observer.observe(document.getElementById('edit-panel'), { childList: true, subtree: true });
  325. }
  326.  
  327. if(settings.ShowSearchButton){
  328. registerEvents(ShowSearchButton);
  329. ShowSearchButton(); //in case the user opened a PL with a Place selected
  330. }
  331.  
  332. if(settings.AddPlaceCategoriesButtons){
  333. registerEvents(AddPlaceCategoriesButtons);
  334. AddPlaceCategoriesButtons();
  335. }
  336.  
  337. if(settings.ClearDescription){
  338. registerEvents(ShowClearDescription);
  339. ShowClearDescription();
  340. }
  341.  
  342. if(settings.ShowLockButtonsRPP)
  343. attachRPPLockButtonHandlers();
  344.  
  345. if(settings.ShowExternalProviderTooltip)
  346. ToggleExternalProvidersCSS(true);
  347.  
  348. $('.pieSettingsCheckbox').change(function() {
  349. debugger;
  350. var settingName = $(this)[0].id.substr(3);
  351. settings[settingName] = this.checked;
  352. saveSettings();
  353. });
  354.  
  355. $('#piePlaceZoom').change(function(){
  356. var settingName = $(this)[0].id.substr(3);
  357. settings[settingName] = $(this)[0].value;
  358. saveSettings();
  359. });
  360.  
  361. $('#pieDefaultLockLevel').change(function(){
  362. settings[$(this)[0].id.substr(3)] = $(this)[0].value;
  363. saveSettings();
  364. });
  365.  
  366. var i;
  367. //Whenever a Place item is changed, read the settings and save to localStorage
  368. $('[id^="pieItem"]').change(function(){
  369. for(i=0;i<11;i++){
  370. settings.NewPlacesList[i] = $('#pieItem'+(i+1))[0].value;
  371. }
  372. saveSettings();
  373. buildNewPlaceList();
  374. });
  375.  
  376. //Load settings into Place Customization list options
  377. for(i=0; i<11;i++)
  378. $('#pieItem'+(i+1))[0].value = settings.NewPlacesList[i];
  379.  
  380. //Build our new menu
  381. buildNewPlaceList();
  382.  
  383. new WazeWrap.Interface.Shortcut('CreateResidentialPlaceShortcut', 'Creates a resdiential Place point', 'wmepie', 'Place Interface Enhancements', settings.CreateResidentialPlaceShortcut, function(){startPlacementMode(resCategory, true);}, null).add();
  384.  
  385. new WazeWrap.Interface.Shortcut('CreateParkingLotShortcut', 'Creates a parking lot Place', 'wmepie', 'Place Interface Enhancements', settings.CreateParkingLotShortcut, function(){startPlacementMode("PARKING_LOT", false);}, null).add();
  386.  
  387. window.addEventListener("beforeunload", function() {
  388. saveSettings();
  389. }, false);
  390.  
  391. //Trim whitespace from start and end of house number field on Places
  392. W.selectionManager.events.register("selectionchanged", null, function(){
  393. if(W.selectionManager.selectedItems.length > 0 && W.selectionManager.selectedItems[0].model.type === "venue")
  394. $('.form-control.house-number').focusout(function(){
  395. $('.form-control.house-number')[0].value = $('.form-control.house-number')[0].value.trim();
  396. });
  397. });
  398.  
  399. //Highlight the categories box when the old hospital category is present
  400. W.selectionManager.events.register("selectionchanged", null, highlightObsoleteHospitalCategory);
  401. W.model.actionManager.events.register("afterundoaction",null, highlightObsoleteHospitalCategory);
  402. W.model.actionManager.events.register("afterclearactions",null, highlightObsoleteHospitalCategory);
  403. W.model.actionManager.events.register("afteraction",null, highlightObsoleteHospitalCategory);
  404.  
  405. W.map.events.register("zoomend", null, DisplayPlaceNames);
  406. W.map.events.register("changelayer", null, DisplayPlaceNames);
  407. //map.events.register("mouseout", null, wmepn_showLandmarkNames);
  408. //Waze.selectionManager.events.register("selectionchanged", null, wmepn_showLandmarkNames);
  409.  
  410. //Shamelessly copied from URO+
  411. var MO_MPLayer = new MutationObserver(MPLayerChanged);
  412. MO_MPLayer.observe(W.map.problemLayer.div,{childList : true});
  413. }
  414.  
  415. function registerEvents(handler){
  416. W.selectionManager.events.register("selectionchanged", null, handler);
  417. W.model.actionManager.events.register("afterundoaction",null, handler);
  418. W.model.actionManager.events.register("afterclearactions",null, handler);
  419. W.model.actionManager.events.register("afteraction",null, handler);
  420. }
  421.  
  422. function unregisterEvents(handler){
  423. W.selectionManager.events.unregister("selectionchanged", null, handler);
  424. W.model.actionManager.events.unregister("afterundoaction",null, handler);
  425. W.model.actionManager.events.unregister("afterclearactions",null, handler);
  426. W.model.actionManager.events.unregister("afteraction",null, handler);
  427. }
  428.  
  429. function ToggleExternalProvidersCSS(truthiness){
  430. if(truthiness)
  431. injectCSSWithID('pieExternalProvidersTweaks', '#edit-panel .external-providers-view .select2-container {width:90%; margin-bottom:2px;}');
  432. else{
  433. var styles = document.getElementById('pieExternalProvidersTweaks');
  434. if(styles) styles.parentNode.removeChild(styles);
  435. }
  436. }
  437.  
  438. function DisplayPlaceNames(){
  439. PIEPlaceNameLayer.removeAllFeatures();
  440. var showPoint, showArea, showLock, showNames, showPLA;
  441. showNames = isChecked('_cbShowPlaceNames');
  442. showPoint = isChecked('_cbShowPlaceNamesPoint');
  443. showArea = isChecked('_cbShowPlaceNamesArea');
  444. showLock = isChecked('_cbShowPlaceNamesLock');
  445. showPLA = isChecked('_cbShowPlaceNamesPLA');
  446.  
  447. if(showNames){
  448. var isPoint;
  449. for (var placeID in W.model.venues.objects) {
  450. var venue = W.model.venues.get(placeID);
  451. isPoint = venue.geometry.toString().match(/^POINT/);
  452. if((isPoint && W.map.zoom >= 5) || (!isPoint && W.map.zoom >= 3)){
  453. if(WazeWrap.Geometry.isGeometryInMapExtent(venue.geometry)){
  454. if( (isPoint && showPoint) || (!isPoint && showArea && venue.attributes.categories[0] !== "PARKING_LOT") || (!isPoint && showPLA && venue.attributes.categories[0] === "PARKING_LOT")){
  455. var textLoc;
  456. if(isPoint)
  457. textLoc = new OpenLayers.Geometry.Point(venue.geometry.x, venue.geometry.y);
  458. else
  459. textLoc = venue.geometry.getCentroid();
  460. var placeName =WordWrap(venue.attributes.name.trim() + (showLock ? ' (L' + (venue.attributes.lockRank + 1) + ')' : ''));
  461. if(venue.attributes.categories[0] === "RESIDENCE_HOME")
  462. placeName = venue.attributes.houseNumber + (venue.attributes.name.trim() !== '' ? ' - ' + venue.attributes.name : '') + (showLock ? ' (L' + (venue.attributes.lockRank + 1) + ')' : '');
  463. var placeNameLabel = new OL.Feature.Vector(textLoc,{display: 'block',labelText: placeName.trim(), yOffset:(isPoint ? -18 - placeName.split("\n").length * 5 : 0)});
  464. PIEPlaceNameLayer.addFeatures([placeNameLabel]);
  465. }
  466. }
  467. }
  468. }
  469. }
  470. }
  471.  
  472. function WordWrap(text){
  473. var newName = "";
  474.  
  475. if(text !== ""){
  476. var splitName = text.match(/(.{1,35})(?:\s|$)/g);
  477. for(var i=0;i<splitName.length;i++){
  478. newName += splitName[i] + (i != splitName.length-1 ? '\n' : '');
  479. }
  480. }
  481. console.log()
  482. return newName;
  483. }
  484.  
  485. //Shamelessly copied from URO+
  486. function MPLayerChanged()
  487. {
  488. for(var mObj in W.map.problemLayer.markers){
  489. var mIcon = W.map.problemLayer.markers[mObj].icon.div;
  490. mIcon.addEventListener("click", MarkerClick, false);
  491. }
  492. }
  493.  
  494. function MarkerClick()
  495. {
  496. var markerType = GetMarkerType(this.className);
  497. if(markerType !== null){
  498. var markerID = this.attributes["data-id"].value;
  499. if(W.map.getLayerByUniqueName("problems").markers[markerID].model.attributes.subType === 71){
  500. var $PIECreatePLA = $("<div>", {style:"min-height:20px", id:"Wazebar"});
  501. $PIECreatePLA.html([
  502. '<div id="PIECreatePLA">',
  503. '<div class="btn btn-block" id="PIECreatePLAButton" style="color: #fff; background-color: #92c2d1; border-color: #78b0bf; margin-top:5px;">Create Suggested PLA</div>',
  504. '</div>'
  505. ].join(' '));
  506.  
  507. setTimeout(function(){$('#panel-container > div > div > div.body > div.actions > div > div').append($PIECreatePLA); $('#PIECreatePLAButton').click(function(){createPLAFromMP(markerID);})}, 150);
  508. }
  509. }
  510. }
  511.  
  512. //Shamelessly copied from URO+
  513. function GetMarkerType(className)
  514. {
  515. var markerType = null;
  516. if(className.indexOf('user-generated') !== -1) markerType = 'ur';
  517. else if(className.indexOf('map-problem') !== -1) markerType = 'mp';
  518. else if(className.indexOf('place-update') !== -1) markerType = 'pur';
  519. return markerType;
  520. }
  521.  
  522. function createPLAFromMP(MPID){
  523. var pos = W.model.problemDetails.objects[MPID].venueGeom;
  524.  
  525. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  526. var AddPlace = require("Waze/Action/AddLandmark");
  527. var NewPlace = new PlaceObject();
  528.  
  529. var points = [];
  530. var i;
  531. for(i=0;i<pos.components[0].components.length;i++){
  532. points.push(new OL.Geometry.Point(pos.components[0].components[i].x, pos.components[0].components[i].y));
  533. }
  534. var ring = new OpenLayers.Geometry.LinearRing(points);
  535. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  536.  
  537. NewPlace.attributes.categories.push("PARKING_LOT");
  538.  
  539. W.model.actionManager.add(new AddPlace(NewPlace));
  540. Waze.selectionManager.select([NewPlace]);
  541. }
  542.  
  543. function highlightObsoleteHospitalCategory(){
  544. if(W.selectionManager.selectedItems.length > 0 && W.selectionManager.selectedItems[0].model.type === "venue"){
  545. if(W.selectionManager.selectedItems[0].model.attributes.categories.contains("HOSPITAL_MEDICAL_CARE")){
  546. $('.select2-choices').css('animation-iteration-count', 'infinite');
  547. $('.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');
  548. $('.select2-choices').tooltip();
  549. }
  550. }
  551. }
  552.  
  553. var newPlaceCategory = "";
  554. function startPlacementMode(category, isPoint){
  555. $('#edit-buttons > div > div.toolbar-button.waze-icon-place.toolbar-submenu.toolbar-group.toolbar-group-venues.ItemInactive').removeClass("open");
  556. newPlaceCategory = category;
  557. var polyDrawFeatureOptions = {callbacks : {"done": doneHandler}};
  558. if(isPoint){
  559. $("#map").on('mousemove', MouseMoveHandler);
  560. $("#map").click(function(){endPlacementMode(category, isPoint);});
  561. /*drawPoly = new OpenLayers.Control.DrawFeature(newPlaceLayer, OpenLayers.Handler.Polygon, polyDrawFeatureOptions);
  562. W.map.addControl(drawPoly);
  563. drawPoly.activate();*/
  564. }
  565. else{
  566. drawPoly = new OpenLayers.Control.DrawFeature(newPlaceLayer, OpenLayers.Handler.Polygon, polyDrawFeatureOptions);
  567. W.map.addControl(drawPoly);
  568. drawPoly.activate();
  569.  
  570. }
  571. document.addEventListener('keyup', keyUpHandler, false);
  572. }
  573.  
  574. var businessPLAPlaceName, businessPLAPlaceAddress;//, businessPLAPlacePhone, businessPLAPlaceURL;
  575. function startBusinessPLAPlacementMode(){
  576. var polyDrawFeatureOptions = {callbacks : {"done": doneHandlerBusinessPLAPlace}};
  577. drawPoly = new OpenLayers.Control.DrawFeature(newPlaceLayer, OpenLayers.Handler.Polygon, polyDrawFeatureOptions);
  578. W.map.addControl(drawPoly);
  579. drawPoly.activate();
  580. document.addEventListener('keyup', keyUpHandler, false);
  581. }
  582.  
  583. function doneHandlerBusinessPLAPlace(geom){
  584. drawPoly.destroy();
  585. BusinessPLAMode = false;
  586. CreateBusinesPLAPlace(geom, businessPLAPlaceName, businessPLAPlaceAddress);//, businessPLAPlacePhone, businessPLAPlaceURL);
  587. }
  588.  
  589. function CreateBusinesPLAPlace(geom, name, address){//, phone, url){
  590. drawPoly.destroy();
  591.  
  592. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  593. var AddPlace = require("Waze/Action/AddLandmark");
  594. var multiaction = new MultiAction();
  595. multiaction.setModel(W.model);
  596.  
  597. var NewPlace = new PlaceObject();
  598. var points = [];
  599. var i;
  600. for(i=0;i<geom.components[0].components.length;i++){
  601. points.push(new OL.Geometry.Point(geom.components[0].components[i].x, geom.components[0].components[i].y));
  602. }
  603. var ring = new OpenLayers.Geometry.LinearRing(points);
  604. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  605. NewPlace.attributes.categories.push("PARKING_LOT");
  606.  
  607. NewPlace.attributes.lockRank = Number(settings.DefaultLockLevel);
  608. NewPlace.attributes.name = "Parking - " + name;
  609. //NewPlace.attributes.phone = phone;
  610. //NewPlace.attributes.url = url;
  611. NewPlace.attributes.categoryAttributes.PARKING_LOT = {};
  612. NewPlace.attributes.categoryAttributes.PARKING_LOT.parkingType = "RESTRICTED";
  613. NewPlace.attributes.categoryAttributes.PARKING_LOT.lotType = ["STREET_LEVEL"];
  614.  
  615. W.model.actionManager.add(new AddPlace(NewPlace));
  616.  
  617. if(address){
  618. var newAttributes, UpdateFeatureAddress = require('Waze/Action/UpdateFeatureAddress');
  619. newAttributes = {
  620. countryID: address.country.id,
  621. stateID: address.state.id,
  622. emptyCity: address.city.attributes.name ? null : true,
  623. emptyStreet: address.street.name ? null : true,
  624. houseNumber: address.houseNumber
  625. };
  626.  
  627. newAttributes.streetName = address.street.name;
  628.  
  629. var cityName = address.city.attributes.name;
  630.  
  631. if(cityName !== "")
  632. newAttributes.emptyCity = null;
  633. newAttributes.cityName = cityName;
  634.  
  635. }
  636. var UFA = new UpdateFeatureAddress(NewPlace, newAttributes);
  637. UFA.options.updateHouseNumber = true;
  638. multiaction.doSubAction(UFA);
  639. W.model.actionManager.add(multiaction);
  640.  
  641. Waze.selectionManager.select([NewPlace]);
  642. }
  643.  
  644. function doneHandler(geom){
  645. drawPoly.destroy();
  646. createPlace(geom, newPlaceCategory, false);
  647. }
  648.  
  649. function keyUpHandler(e){
  650. if (e.keyCode == 27){
  651. BusinessPLAMode = false;
  652. disablePlacementMode();
  653. if(drawPoly !== "undefined")
  654. drawPoly.destroy();
  655. }
  656. else if(e.keyCode == 90 && e.ctrlKey)
  657. drawPoly.undo();
  658. else if(e.keyCode == 89 && e.ctrlKey)
  659. drawPoly.redo();
  660. else if(e.keyCode == 13)
  661. drawPoly.finishSketch();
  662. }
  663.  
  664. function disablePlacementMode(){
  665. $("#map").off('click');//, endPlacementMode);
  666. $("#map").off('mousemove', MouseMoveHandler);
  667. clearLayer();
  668. document.removeEventListener('keyup', keyUpHandler);
  669. }
  670.  
  671. function endPlacementMode(category, isPoint){
  672. disablePlacementMode();
  673. createPlace(getMousePos900913(), category, isPoint);
  674. }
  675.  
  676. function getMousePos900913(){
  677. var mousePosition = $('.WazeControlMousePosition').text().split(" ");
  678. return WazeWrap.Geometry.ConvertTo900913(mousePosition[0], mousePosition[1]);
  679. }
  680.  
  681. function MouseMoveHandler(e){
  682. clearLayer();
  683. drawCircle(getMousePos900913());
  684. }
  685.  
  686. function clearLayer() {
  687. var layer = W.map.getLayersByName(layerName)[0];
  688. layer.removeAllFeatures();
  689. }
  690.  
  691. function drawCircle(e){
  692. var pointFeature = new OL.Feature.Vector(new OL.Geometry.Point(e.lon, e.lat), {}, pointStyle);
  693. W.map.getLayersByName(layerName)[0].addFeatures([pointFeature]);
  694. }
  695.  
  696. function createPlace(pos, category, isPoint){
  697. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  698. var AddPlace = require("Waze/Action/AddLandmark");
  699. var multiaction = new MultiAction();
  700. multiaction.setModel(W.model);
  701.  
  702. var NewPlace = new PlaceObject();
  703. if(isPoint)
  704. NewPlace.geometry = new OL.Geometry.Point(pos.lon, pos.lat);
  705. else{
  706. var points = [];
  707. var i;
  708. for(i=0;i<pos.components[0].components.length;i++){
  709. points.push(new OL.Geometry.Point(pos.components[0].components[i].x, pos.components[0].components[i].y));
  710. }
  711. var ring = new OpenLayers.Geometry.LinearRing(points);
  712. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  713.  
  714. }
  715.  
  716. NewPlace.attributes.categories.push(category);
  717. if(category === resCategory){
  718. NewPlace._originalResidential = true;
  719. NewPlace.attributes.residential = true;
  720. }
  721. NewPlace.attributes.lockRank = Number(settings.DefaultLockLevel);
  722.  
  723. var closestSeg = WazeWrap.Geometry.findClosestSegment(new OL.Geometry.Point(pos.lon, pos.lat), settings.SkipPLR, settings.SkipPLR);
  724.  
  725. W.model.actionManager.add(new AddPlace(NewPlace));
  726. Waze.selectionManager.select([NewPlace]);
  727.  
  728. if(closestSeg){ //if we were able to find a segment, try to pull the city and/or street name if the options are enabled
  729. var newAttributes, UpdateFeatureAddress = require('Waze/Action/UpdateFeatureAddress'), address = closestSeg.getAddress();
  730.  
  731. newAttributes = {
  732. countryID: address.country.id,
  733. stateID: address.state.id,
  734. emptyCity: address.city.attributes.name ? null : true,
  735. emptyStreet: address.street.name ? null : true
  736. };
  737.  
  738. if(settings.UseStreetFromClosestSeg)
  739. newAttributes.streetName = address.street.name;
  740. else
  741. newAttributes.emptyStreet = true;
  742.  
  743. if(settings.UseCityFromClosestSeg){
  744. var cityName = address.city.attributes.name;
  745.  
  746. if(settings.UseAltCity && cityName === ""){
  747. if(address.altStreets.length > 0){ //segment has alt names
  748. for(var j=0;j<closestSeg.attributes.streetIDs.length;j++){
  749. var altCity = W.model.cities.get(W.model.streets.get(closestSeg.attributes.streetIDs[j]).cityID).attributes;
  750.  
  751. if(altCity.englishName !== null && altCity.englishName !== "")
  752. cityName = altCity.englishName;
  753. }
  754. }
  755. }
  756. if(cityName !== "")
  757. newAttributes.emptyCity = null;
  758. newAttributes.cityName = cityName;
  759. }
  760. else
  761. newAttributes.emptyCity = true;
  762.  
  763. multiaction.doSubAction(new UpdateFeatureAddress(NewPlace, newAttributes));
  764. W.model.actionManager.add(multiaction);
  765. }
  766. else
  767. console.log("WMEPIE - No segment found; cannot set street or city name.");
  768.  
  769. if(category === resCategory && settings.EditRPPAfterCreated)
  770. editRPPAddress();
  771. }
  772.  
  773. function editRPPAddress(rppTries){
  774. rppTries = rppTries || 1;
  775.  
  776. if ($('.edit-button').length > 0) {
  777. $('.edit-button').trigger("click");
  778. $('.house-number:first').focus();
  779.  
  780. } else if (rppTries < 1000) {
  781. console.log("not found");
  782. setTimeout(function () {editRPPAddress(rppTries++);}, 200);
  783. }
  784. }
  785.  
  786. function buildItemOption(itemNumber){
  787. var $section = $("<div>", {style:"padding:8px 16px", id:"piePlaceCat" + itemNumber});
  788. $section.html([
  789. I18n.t('pie.prefs.Item') + " ",
  790. itemNumber,
  791. buildItemList(itemNumber),
  792. '</br>'
  793. ].join(' '));
  794.  
  795. return $section.html();
  796. }
  797.  
  798. function buildLockLevelsList(){
  799. var $lockLevels = $("<div>");
  800. for(var i=0;i<WazeWrap.User.Rank();i++){
  801. $lockLevels.append("<option value=" + i + ">" + (i+1) + "</option>");
  802. }
  803. return $lockLevels.html();
  804. }
  805.  
  806. function attachRPPLockButtonHandlers(){
  807. $('#pieRPPLockButtonsContainer').remove();
  808. W.selectionManager.events.register("selectionchanged", null, addLockButtons);
  809. W.model.actionManager.events.register("afterundoaction",null, addLockButtons);
  810. W.model.actionManager.events.register("afterclearactions",null, addLockButtons);
  811. W.model.actionManager.events.register("afteraction",null, addLockButtons);
  812. }
  813.  
  814. function attachPlaceSizeHandlers(){
  815. W.selectionManager.events.register("selectionchanged", null, updatePlaceSizeDisplay);
  816. W.model.actionManager.events.register("afteraction",null, updatePlaceSizeDisplay);
  817. W.model.actionManager.events.register("afterundoaction",null, updatePlaceSizeDisplay);
  818. W.model.actionManager.events.register("afterclearactions",null, updatePlaceSizeDisplay);
  819. W.model.actionManager.events.register("noActions",null, noActions);
  820. updatePlaceSizeDisplay();
  821. }
  822.  
  823. function removePlaceSizeHandlers(){
  824. W.selectionManager.events.unregister("selectionchanged", null, updatePlaceSizeDisplay);
  825. W.model.actionManager.events.unregister("afteraction",null, updatePlaceSizeDisplay);
  826. W.model.actionManager.events.unregister("afterundoaction",null, updatePlaceSizeDisplay);
  827. W.model.actionManager.events.unregister("afterclearactions",null, updatePlaceSizeDisplay);
  828. W.model.actionManager.events.unregister("noActions",null, noActions);
  829. }
  830.  
  831. function ShowPlaceLocatorCrosshair(){
  832. $('#pieCrosshairs').remove();
  833. if(W.selectionManager.selectedItems.length > 0){
  834. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  835. var panelWidth = $('#landmark-edit-general').width();
  836. var $crosshairs;
  837. if(W.selectionManager.selectedItems[0].model.attributes.categories.contains("RESIDENCE_HOME")){
  838. $('.landmark > .tab-content').css('position', 'relative');
  839. $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" aria-hidden="true"></i></div>');
  840. $('.landmark > .tab-content').append($crosshairs);
  841. }
  842. else{
  843. $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" aria-hidden="true"></i></div>');
  844. $('#landmark-edit-general > form > div:nth-child(1) > i').after($crosshairs);
  845. }
  846. $('#pieCrosshairs').click(function(){
  847. CenterOnPlace(W.selectionManager.selectedItems[0].model, settings.PlaceZoom);
  848. });
  849. }
  850. }
  851. }
  852.  
  853. var BusinessPLAMode = false;
  854. function ShowParkingLotButton(){
  855. $('#piePLAButton').remove();
  856.  
  857. if(W.selectionManager.selectedItems.length > 0){
  858. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  859. var $PLAButton;
  860. if(!(W.selectionManager.selectedItems[0].model.attributes.categories.contains("RESIDENCE_HOME") || W.selectionManager.selectedItems[0].model.attributes.categories.contains("PARKING_LOT"))){
  861. $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>');
  862. $('#landmark-edit-general > form > div:nth-child(1) > i').after($PLAButton);
  863.  
  864. $('#piePLAButton').click(function(){
  865. if(!BusinessPLAMode)
  866. {
  867. BusinessPLAMode = true;
  868. businessPLAPlaceName = W.selectionManager.selectedItems[0].model.attributes.name;
  869. businessPLAPlaceAddress = W.selectionManager.selectedItems[0].model.getAddress().attributes;
  870. //businessPLAPlacePhone = W.selectionManager.selectedItems[0].model.attributes.phone;
  871. //businessPLAPlaceURL = W.selectionManager.selectedItems[0].model.attributes.url;
  872. startBusinessPLAPlacementMode();
  873. }
  874. });
  875. }
  876. }
  877. }
  878. }
  879.  
  880. var extProviderTries = 0;
  881. function ShowExternalProviderTooltip(){
  882. if(isChecked('_cbShowExternalProviderTooltip'))
  883. if(W.selectionManager.selectedItems.length > 0 && W.selectionManager.selectedItems[0].model.type === "venue"){
  884. if($('.select2-container.uuid').length > 0)
  885. for(var i=0; i < $('.select2-container.uuid').find('span.select2-chosen').length; i++){
  886. extProviderTries = 0;
  887. ReadExtProviderText(i, extProviderTries);
  888. }
  889. }
  890. }
  891.  
  892. function ReadExtProviderText(index, extProviderTries){
  893. var providersList = $('.select2-container.uuid').find('span.select2-chosen');
  894. if($('.select2-container.uuid').find('span.select2-chosen')[index].innerHTML == "&nbsp;" && extProviderTries <= 20)
  895. setTimeout(function(){ReadExtProviderText(index, extProviderTries++);}, 50);
  896. else{
  897. if($('#' + providersList[index].id).parent().parent().data('original-title') == null){
  898. $('#' + providersList[index].id).parent().parent().attr('title', $('.select2-container.uuid').find('span.select2-chosen')[index].innerText);
  899. $('#' + providersList[index].id).parent().parent().tooltip()
  900. }
  901. else
  902. $('#' + providersList[index].id).parent().parent().attr('data-original-title', $('.select2-container.uuid').find('span.select2-chosen')[index].innerText);
  903. }
  904. }
  905.  
  906. function ShowCopyPlaceButton(){
  907. $('#pieCopyPlaceButton').remove();
  908.  
  909. if(W.selectionManager.selectedItems.length > 0){
  910. //W.selectionManager.selectedItems[0].model.attributes.id.match(/(\d+\.){2}\d+/)
  911. 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
  912. var $PlaceCopyButton;
  913. if(!W.selectionManager.selectedItems[0].model.attributes.categories.contains("RESIDENCE_HOME")){
  914. $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>');
  915. $('#landmark-edit-general > form > div:nth-child(1) > i').after($PlaceCopyButton);
  916.  
  917. $('#pieCopyPlaceButton').click(function(){
  918. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  919. var AddPlace = require("Waze/Action/AddLandmark");
  920.  
  921. var NewPlace = new PlaceObject();
  922. var oldPlace = W.selectionManager.selectedItems[0].model;
  923.  
  924. NewPlace.attributes.name = oldPlace.attributes.name + " (copy)";
  925. NewPlace.attributes.phone = oldPlace.attributes.phone;
  926. NewPlace.attributes.url = oldPlace.attributes.url;
  927. NewPlace.attributes.categories = oldPlace.attributes.categories.clone();
  928. NewPlace.attributes.aliases = oldPlace.attributes.aliases.clone();
  929. NewPlace.attributes.description = oldPlace.attributes.description;
  930. NewPlace.attributes.houseNumber = oldPlace.attributes.houseNumber;
  931. NewPlace.attributes.lockRank = oldPlace.attributes.lockRank;
  932. NewPlace.attributes.geometry = oldPlace.attributes.geometry.clone();
  933.  
  934. if(oldPlace.attributes.geometry.toString().match(/^POLYGON/)){
  935. var convertedCoords;
  936. for(var i=0; i<NewPlace.attributes.geometry.components[0].components.length - 1; i++){
  937. convertedCoords = WazeWrap.Geometry.ConvertTo4326(NewPlace.attributes.geometry.components[0].components[i].x, NewPlace.attributes.geometry.components[0].components[i].y);
  938. convertedCoords.lon += WazeWrap.Geometry.CalculateLongOffsetGPS(5, convertedCoords.long, convertedCoords.lat);
  939. NewPlace.attributes.geometry.components[0].components[i].x = WazeWrap.Geometry.ConvertTo900913(convertedCoords.lon, convertedCoords.lat).lon;
  940. }
  941. }
  942. else{
  943. var convertedCoords = WazeWrap.Geometry.ConvertTo4326(oldPlace.attributes.geometry.x, oldPlace.attributes.geometry.y);
  944. convertedCoords.lon += WazeWrap.Geometry.CalculateLongOffsetGPS(5, convertedCoords.long, convertedCoords.lat);
  945. NewPlace.attributes.geometry.x = WazeWrap.Geometry.ConvertTo900913(convertedCoords.lon, convertedCoords.lat).lon;
  946. }
  947.  
  948. NewPlace.attributes.services = oldPlace.attributes.services.clone();
  949. NewPlace.attributes.openingHours = oldPlace.attributes.openingHours.clone();
  950. NewPlace.attributes.streetID = oldPlace.attributes.streetID;
  951.  
  952. if(NewPlace.attributes.categories.contains("GAS_STATION"))
  953. NewPlace.attributes.brand = oldPlace.attributes.brand;
  954.  
  955. if(NewPlace.attributes.categories.contains("PARKING_LOT")){
  956. NewPlace.attributes.categoryAttributes.PARKING_LOT = {};
  957. var PLAttribute = oldPlace.attributes.categoryAttributes.PARKING_LOT;
  958. if(!(PLAttribute.lotType == null))
  959. NewPlace.attributes.categoryAttributes.PARKING_LOT.lotType = oldPlace.attributes.categoryAttributes.PARKING_LOT.lotType.clone();
  960. if(!(PLAttribute.canExitWhileClosed == null))
  961. NewPlace.attributes.categoryAttributes.PARKING_LOT.canExitWhileClosed = oldPlace.attributes.categoryAttributes.PARKING_LOT.canExitWhileClosed;
  962. if(!(PLAttribute.costType == null))
  963. NewPlace.attributes.categoryAttributes.PARKING_LOT.costType = oldPlace.attributes.categoryAttributes.PARKING_LOT.costType;
  964. if(!(PLAttribute.estimatedNumberOfSpots == null))
  965. NewPlace.attributes.categoryAttributes.PARKING_LOT.estimatedNumberOfSpots = oldPlace.attributes.categoryAttributes.PARKING_LOT.estimatedNumberOfSpots;
  966. if(!(PLAttribute.hasTBR == null))
  967. NewPlace.attributes.categoryAttributes.PARKING_LOT.hasTBR = oldPlace.attributes.categoryAttributes.PARKING_LOT.hasTBR;
  968. if(!(PLAttribute.lotType == null))
  969. NewPlace.attributes.categoryAttributes.PARKING_LOT.lotType = oldPlace.attributes.categoryAttributes.PARKING_LOT.lotType.clone();
  970. if(!(PLAttribute.parkingType == null))
  971. NewPlace.attributes.categoryAttributes.PARKING_LOT.parkingType = oldPlace.attributes.categoryAttributes.PARKING_LOT.parkingType;
  972. if(!(PLAttribute.paymentType == null))
  973. NewPlace.attributes.categoryAttributes.PARKING_LOT.paymentType = oldPlace.attributes.categoryAttributes.PARKING_LOT.paymentType.clone();
  974. }
  975.  
  976. W.model.actionManager.add(new AddPlace(NewPlace));
  977.  
  978. var newAttributes, UpdateFeatureAddress = require('Waze/Action/UpdateFeatureAddress'), address = oldPlace.getAddress();
  979. var MultiAction = require("Waze/Action/MultiAction");
  980. var multiaction = new MultiAction();
  981. multiaction.setModel(W.model);
  982.  
  983. console.log(address);
  984. newAttributes = {
  985. countryID: address.attributes.country.id,
  986. stateID: address.attributes.state.id,
  987. emptyCity: address.attributes.city.attributes.name ? null : true,
  988. emptyStreet: address.attributes.street.name ? null : true
  989. };
  990.  
  991. newAttributes.streetName = address.attributes.street.name;
  992. var cityName = address.attributes.city.attributes.name;
  993.  
  994. if(cityName !== "")
  995. newAttributes.emptyCity = null;
  996. newAttributes.cityName = cityName;
  997.  
  998. var UFA = new UpdateFeatureAddress(NewPlace, newAttributes);
  999. UFA.options.updateHouseNumber = true;
  1000. multiaction.doSubAction(UFA);
  1001. W.model.actionManager.add(multiaction);
  1002. Waze.selectionManager.select([NewPlace]);
  1003. });
  1004. }
  1005. }
  1006. }
  1007. }
  1008.  
  1009. function ShowSearchButton(){
  1010. $('#pieSearchButton').remove();
  1011. if(W.selectionManager.selectedItems.length > 0){
  1012. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  1013. 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>');
  1014. $('.address-edit-view').before($search);
  1015. $('#pieSearchButton').click(function(){
  1016. var address = $('.full-address')[0].innerHTML;
  1017. var noCity = I18n.translations[I18n.currentLocale()].edit.address.no_city;
  1018. var noStreet = I18n.translations[I18n.currentLocale()].edit.address.no_street;
  1019.  
  1020. address = address.replace(noCity + ",","");
  1021. if(address !== I18n.translations[I18n.currentLocale()].edit.landmark.no_address)
  1022. $('.search-query')[0].value = address;
  1023. });
  1024. }
  1025. }
  1026. }
  1027.  
  1028. function ShowClearDescription(){
  1029. $('#landmark-edit-general textarea').parent().append('<i class="fa fa-times-circle clearButton" style="position:absolute; top:0; right:0;"></i>');
  1030. $('#landmark-edit-general textarea').parent().css('position', 'relative');
  1031. $('.clearButton').click(function(){
  1032. W.model.actionManager.add(new UpdateObject( W.selectionManager.selectedItems[0].model, { description: "" }));
  1033. });
  1034. }
  1035.  
  1036. function AddPlaceCategoriesButtons(){
  1037. $('#piePlaceCategoriesButtonsContainer').remove();
  1038. if(W.selectionManager.selectedItems.length > 0){
  1039. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  1040. var $container = $('<div>',{id:'piePlaceCategoriesButtonsContainer', style:'white-space: nowrap;'});
  1041. var categoryOptions = $('[id^=pieItem]');
  1042.  
  1043. var $button = $('<div>',{id:'btnPlaceCatClear', title:'Clear current categories', style:'display:inline-block; cursor:pointer'}).click(function() { onPlaceCategoriesButtonsClick(this.id); });
  1044. $button.append('<span class="fa fa-times" style="font-size:20px; color:red;"></span>');
  1045. $container.append($button);
  1046.  
  1047. for(var i=0;i<categoryOptions.length;i++){
  1048. var name = categoryOptions[i].options[categoryOptions[i].selectedIndex].innerHTML;
  1049. var icon = categoryOptions[i].options[categoryOptions[i].selectedIndex].getAttribute("data-icon");
  1050. var divid = 'btnPlaceCat' + categoryOptions[i].value;
  1051. if(categoryOptions[i].value !== resCategory && categoryOptions[i].value !== "PARKING_LOT"){
  1052. $button = $('<div>',{id:divid, title:name.replace('&amp;', '&'), style:'display:inline-block; cursor:pointer', 'data-category':categoryOptions[i].value}).click(function() { onPlaceCategoriesButtonsClick(this.id); });
  1053. $button.append('<span class="'+icon+'" style="font-size:20px;"></span>');
  1054.  
  1055. $container.append($button);
  1056. }
  1057. }
  1058. }
  1059.  
  1060. $('.categories.controls').before($container);
  1061. }
  1062. }
  1063.  
  1064. function onPlaceCategoriesButtonsClick(buttonid){
  1065. if(buttonid === "btnPlaceCatClear"){
  1066. var blankCategories = []; //W.selectionManager.selectedItems[0].model.attributes.categories.clone();
  1067. //console.log(blankCategories.length);
  1068. //blankCategories.splice(0, blankCategories.length);
  1069. //console.log(blankCategories);
  1070. W.model.actionManager.add(new UpdateObject(W.selectionManager.selectedItems[0].model, { categories: blankCategories }));
  1071. }
  1072. else{
  1073. var newCategories = W.selectionManager.selectedItems[0].model.attributes.categories.clone();
  1074. //console.log($('#'+buttonid)[0].getAttribute("data-category"));
  1075. newCategories.push($('#'+buttonid)[0].getAttribute("data-category"));
  1076. W.model.actionManager.add(new UpdateObject(W.selectionManager.selectedItems[0].model, {categories: newCategories}));
  1077. }
  1078. }
  1079.  
  1080. function CenterOnPlace(venue, zoom){
  1081. var centroid = venue.geometry.getCentroid();
  1082. W.map.setCenter([centroid.x, centroid.y], zoom);
  1083. }
  1084.  
  1085. function isChecked(checkboxId) {
  1086. return $('#' + checkboxId).is(':checked');
  1087. }
  1088.  
  1089. function setChecked(checkboxId, checked) {
  1090. $('#' + checkboxId).prop('checked', checked);
  1091. }
  1092.  
  1093. function noActions(){
  1094. 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.
  1095. }
  1096.  
  1097. function updatePlaceSizeDisplay(){
  1098. var count = W.selectionManager.selectedItems.length;
  1099. var metersArea = 0;
  1100. var bold = false;
  1101. if(count === 1){
  1102. var venue = W.selectionManager.selectedItems[0];
  1103. var isArea = venue.geometry.toString().match(/^POLYGON/);
  1104. //var isPoint = venue.geometry.toString().match(/^POINT/);
  1105.  
  1106. if(venue.model.type === "venue" && isArea){
  1107. if($('#AreaSize'))
  1108. $('#AreaSize').remove();
  1109. metersArea = W.selectionManager.selectedItems[0].model.geometry.getGeodesicArea(W.map.getProjectionObject());
  1110.  
  1111. if(metersArea > 0 && isArea){
  1112. var ftArea = Math.round(metersArea * 10.76391 *100)/100;
  1113.  
  1114. var list = $('#landmark-edit-general > ul')[0];
  1115. var newList = document.createElement("UL");
  1116. newList.id = "AreaSize";
  1117.  
  1118. var newItem = document.createElement("LI");
  1119. if(isChecked("_cbShowAreaPlaceSizeMetric")){
  1120. newItem.innerHTML = "Area: " + metersArea.toFixed(2) + " m<sup>2</sup>";
  1121. newList.appendChild(newItem);
  1122. }
  1123.  
  1124. if(isChecked("_cbShowAreaPlaceSizeImperial")){
  1125. newItem = document.createElement("LI");
  1126. newItem.innerHTML = "Area: " + ftArea.toFixed(2) + " ft<sup>2</sup>";
  1127. newList.appendChild(newItem);
  1128. }
  1129. if(metersArea < 500){
  1130. newItem = document.createElement("LI");
  1131. 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>";
  1132. newList.appendChild(newItem);
  1133. }
  1134. if(metersArea > 20000){
  1135. newItem = document.createElement("LI");
  1136. 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>";
  1137. newList.appendChild(newItem);
  1138. }
  1139. if(list.before != null)
  1140. list.before(newList);
  1141. else{
  1142. var parent = $('#landmark-edit-general > ul')[0].parentNode;
  1143. parent.insertBefore(newList,$('#landmark-edit-general > ul')[0]);
  1144. }
  1145.  
  1146. $('#AreaSize').addClass("list-unstyled");
  1147. $('#AreaSize').addClass("additional-attributes");
  1148. }
  1149. }
  1150. }
  1151. }
  1152.  
  1153. function loadSettings() {
  1154. var loadedSettings = $.parseJSON(localStorage.getItem("WMEPIE_Settings"));
  1155. var defaultSettings = {
  1156. ShowAreaPlaceSize: false,
  1157. ShowAreaPlaceSizeImperial: false,
  1158. ShowAreaPlaceSizeMetric: false,
  1159. ShowLockButtonsRPP: true,
  1160. NewPlacesList: W.Config.venues.categories.clone(),
  1161. EditRPPAfterCreated: false,
  1162. UseStreetFromClosestSeg: false,
  1163. UseCityFromClosestSeg: false,
  1164. ShowPlaceLocatorCrosshair: false,
  1165. PlaceZoom: 6,
  1166. DefaultLockLevel: 0,
  1167. CreateResidentialPlaceShortcut: "A+r",
  1168. CreateParkingLotShortcut: "A+p",
  1169. UseAltCity: false,
  1170. ShowSearchButton: false,
  1171. AddPlaceCategoriesButtons: false,
  1172. SkipPLR: false,
  1173. ShowParkingLotButton: false,
  1174. ShowPlaceNames: false,
  1175. ShowPlaceNamesPoint: false,
  1176. ShowPlaceNamesArea: false,
  1177. ShowPlaceNamesLock: false,
  1178. ShowCopyPlaceButton: false,
  1179. ShowExternalProviderTooltip: false,
  1180. ShowPlaceNamesPLA: false,
  1181. ClearDescription: true
  1182. };
  1183. settings = loadedSettings ? loadedSettings : defaultSettings;
  1184. for (var prop in defaultSettings) {
  1185. if (!settings.hasOwnProperty(prop))
  1186. settings[prop] = defaultSettings[prop];
  1187. }
  1188.  
  1189. if(settings.ShowAreaPlaceSizeImperial === false && settings.ShowAreaPlaceSizeMetric === false)
  1190. if(Waze.prefs.attributes.isImperial)
  1191. settings.ShowAreaPlaceSizeImperial = true;
  1192. else
  1193. settings.ShowAreaPlaceSizeMetric = true;
  1194. }
  1195.  
  1196. function saveSettings() {
  1197. if (localStorage) {
  1198. var localsettings = {
  1199. ShowAreaPlaceSize: settings.ShowAreaPlaceSize,
  1200. ShowAreaPlaceSizeImperial: settings.ShowAreaPlaceSizeImperial,
  1201. ShowAreaPlaceSizeMetric: settings.ShowAreaPlaceSizeMetric,
  1202. ShowLockButtonsRPP: settings.ShowLockButtonsRPP,
  1203. NewPlacesList: settings.NewPlacesList,
  1204. EditRPPAfterCreated: settings.EditRPPAfterCreated,
  1205. UseStreetFromClosestSeg: settings.UseStreetFromClosestSeg,
  1206. UseCityFromClosestSeg: settings.UseCityFromClosestSeg,
  1207. ShowPlaceLocatorCrosshair: settings.ShowPlaceLocatorCrosshair,
  1208. PlaceZoom: settings.PlaceZoom,
  1209. DefaultLockLevel: settings.DefaultLockLevel,
  1210. CreateResidentialPlaceShortcut: settings.CreateResidentialPlaceShortcut,
  1211. CreateParkingLotShortcut: settings.CreateParkingLotShortcut,
  1212. UseAltCity: settings.UseAltCity,
  1213. ShowSearchButton: settings.ShowSearchButton,
  1214. AddPlaceCategoriesButtons: settings.AddPlaceCategoriesButtons,
  1215. SkipPLR: settings.SkipPLR,
  1216. ShowParkingLotButton: settings.ShowParkingLotButton,
  1217. ShowPlaceNames: settings.ShowPlaceNames,
  1218. ShowPlaceNamesPoint: settings.ShowPlaceNamesPoint,
  1219. ShowPlaceNamesArea: settings.ShowPlaceNamesArea,
  1220. ShowPlaceNamesLock: settings.ShowPlaceNamesLock,
  1221. ShowCopyPlaceButton: settings.ShowCopyPlaceButton,
  1222. ShowExternalProviderTooltip: settings.ShowExternalProviderTooltip,
  1223. ShowPlaceNamesPLA: settings.ShowPlaceNamesPLA,
  1224. ClearDescription: settings.ClearDescription
  1225. };
  1226.  
  1227. for (var name in Waze.accelerators.Actions) {
  1228. var TempKeys = "";
  1229. if (Waze.accelerators.Actions[name].group == 'wmepie') {
  1230. if (Waze.accelerators.Actions[name].shortcut) {
  1231. if (Waze.accelerators.Actions[name].shortcut.altKey === true) {
  1232. TempKeys += 'A';
  1233. }
  1234. if (Waze.accelerators.Actions[name].shortcut.shiftKey === true) {
  1235. TempKeys += 'S';
  1236. }
  1237. if (Waze.accelerators.Actions[name].shortcut.ctrlKey === true) {
  1238. TempKeys += 'C';
  1239. }
  1240. if (TempKeys !== "") {
  1241. TempKeys += '+';
  1242. }
  1243. if (Waze.accelerators.Actions[name].shortcut.keyCode) {
  1244. TempKeys += Waze.accelerators.Actions[name].shortcut.keyCode;
  1245. }
  1246. } else {
  1247. TempKeys = "-1";
  1248. }
  1249. localsettings[name] = TempKeys;
  1250. }
  1251. }
  1252.  
  1253. localStorage.setItem("WMEPIE_Settings", JSON.stringify(localsettings));
  1254. }
  1255. }
  1256.  
  1257. //Using the same display for lock buttons as ClickSaver (with permission from MapoMatic) - thanks MoM!
  1258. function addLockButtons() {
  1259. if(W.selectionManager.selectedItems.length > 0){
  1260. var item = W.selectionManager.selectedItems[0];
  1261. var isRPP = (item.model.type === "venue" && item.model.attributes.residential === true);
  1262.  
  1263. if(isRPP){
  1264. var attr = item.model.attributes;
  1265. var autoRank = attr.rank;
  1266. var manualRank = attr.lockRank;
  1267. var firstManualRank = manualRank;
  1268. var userRank = WazeWrap.User.Rank() - 1;
  1269. var maxAutoRank = autoRank;
  1270. var disabled = false;
  1271.  
  1272. var $div = $('#pieRPPLockButtonsContainer');
  1273. $div.remove();
  1274. $div = $('<div>',{id:'pieRPPLockButtonsContainer',style:'margin-bottom:5px;'});
  1275. $div.append('<label class="control-label">Lock</label>');
  1276. var btnInfos = [];
  1277.  
  1278. for(var iBtn=0;iBtn<=6;iBtn++){btnInfos.push({r:iBtn,val:iBtn});}
  1279. btnInfos.forEach(function(btnInfo){
  1280. var selected = (btnInfo.val == manualRank);
  1281. disabled = userRank < btnInfo.val;
  1282. if (btnInfo.val !== 6) {
  1283. $div.append(
  1284. $('<div>', {
  1285. class:'btn btn-lh' + (selected ? ' btn-lh-selected':'') + (btnInfo.r < 6 & (userRank < btnInfo.r || disabled) ? ' disabled' : '')
  1286. })
  1287. .text(btnInfo.hasOwnProperty('title') ? btnInfo.title : btnInfo.r + 1)
  1288. .data('val',btnInfo.hasOwnProperty('val') ? btnInfo.val : btnInfo.r + 1)
  1289. .hover(function() {})
  1290. .click(function() {
  1291. if((userRank >= $(this).data('val')) && (btnInfo.r < 6)) {
  1292. W.model.actionManager.add(new UpdateObject(item.model,{lockRank:($(this).data('val'))}));
  1293. addLockButtons();
  1294. }
  1295. })
  1296. );
  1297. }
  1298. });
  1299. $('#landmark-edit-general > div.address-edit.side-panel-section').after($div);
  1300. }
  1301. }
  1302. }
  1303.  
  1304. function buildItemList(itemNumber){
  1305.  
  1306. var $places = $("<div>");
  1307. $places.html([
  1308. '<select id="pieItem' + itemNumber + '">',
  1309. '<option value="CAR_SERVICES" data-icon="waze-icon-place-car" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_SERVICES + '</option>',
  1310. '<option value="GAS_STATION" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.GAS_STATION + '</option>',
  1311. '<option value="GARAGE_AUTOMOTIVE_SHOP" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.GARAGE_AUTOMOTIVE_SHOP + '</option>',
  1312. '<option value="CAR_WASH" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_WASH + '</option>',
  1313. '<option value="CHARGING_STATION" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.CHARGING_STATION + '</option>',
  1314. '<option value="TRANSPORTATION" data-icon="waze-icon-place-transportation" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.TRANSPORTATION + '</option>',
  1315. '<option value="AIRPORT" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.AIRPORT + '</option>',
  1316. '<option value="BUS_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.BUS_STATION + '</option>',
  1317. '<option value="FERRY_PIER" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.FERRY_PIER + '</option>',
  1318. '<option value="SEAPORT_MARINA_HARBOR" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.SEAPORT_MARINA_HARBOR + '</option>',
  1319. '<option value="SUBWAY_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.SUBWAY_STATION + '</option>',
  1320. '<option value="TRAIN_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TRAIN_STATION + '</option>',
  1321. '<option value="BRIDGE" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.BRIDGE + '</option>',
  1322. '<option value="TUNNEL" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TUNNEL + '</option>',
  1323. '<option value="TAXI_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TAXI_STATION + '</option>',
  1324. '<option value="JUNCTION_INTERCHANGE" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.JUNCTION_INTERCHANGE + '</option>',
  1325. '<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>',
  1326. '<option value="COLLEGE_UNIVERSITY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.COLLEGE_UNIVERSITY + '</option>',
  1327. '<option value="SCHOOL" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.SCHOOL + '</option>',
  1328. '<option value="CONVENTIONS_EVENT_CENTER" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.CONVENTIONS_EVENT_CENTER + '</option>',
  1329. '<option value="GOVERNMENT" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.GOVERNMENT + '</option>',
  1330. '<option value="LIBRARY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.LIBRARY + '</option>',
  1331. '<option value="CITY_HALL" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.CITY_HALL + '</option>',
  1332. '<option value="ORGANIZATION_OR_ASSOCIATION" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.ORGANIZATION_OR_ASSOCIATION + '</option>',
  1333. '<option value="PRISON_CORRECTIONAL_FACILITY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.PRISON_CORRECTIONAL_FACILITY + '</option>',
  1334. '<option value="COURTHOUSE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.COURTHOUSE + '</option>',
  1335. '<option value="CEMETERY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.CEMETERY + '</option>',
  1336. '<option value="FIRE_DEPARTMENT" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.FIRE_DEPARTMENT + '</option>',
  1337. '<option value="POLICE_STATION" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.POLICE_STATION + '</option>',
  1338. '<option value="MILITARY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.MILITARY + '</option>',
  1339. '<option value="HOSPITAL_URGENT_CARE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.HOSPITAL_URGENT_CARE + '</option>',
  1340. '<option value="DOCTOR_CLINIC" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.DOCTOR_CLINIC + '</option>',
  1341. '<option value="OFFICES" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.OFFICES + '</option>',
  1342. '<option value="POST_OFFICE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.POST_OFFICE + '</option>',
  1343. '<option value="RELIGIOUS_CENTER" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.RELIGIOUS_CENTER + '</option>',
  1344. '<option value="KINDERGARTEN" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.KINDERGARDEN + '</option>',
  1345. '<option value="FACTORY_INDUSTRIAL" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.FACTORY_INDUSTRIAL + '</option>',
  1346. '<option value="EMBASSY_CONSULATE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.EMBASSY_CONSULATE + '</option>',
  1347. '<option value="INFORMATION_POINT" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.INFORMATION_POINT + '</option>',
  1348. '<option value="EMERGENCY_SHELTER" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.EMERGENCY_SHELTER + '</option>',
  1349. '<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>',
  1350. '<option value="ARTS_AND_CRAFTS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.ARTS_AND_CRAFTS + '</option>',
  1351. '<option value="BANK_FINANCIAL" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.BANK_FINANCIAL + '</option>',
  1352. '<option value="SPORTING_GOODS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SPORTING_GOODS + '</option>',
  1353. '<option value="BOOKSTORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.BOOKSTORE + '</option>',
  1354. '<option value="PHOTOGRAPHY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PHOTOGRAPHY + '</option>',
  1355. '<option value="CAR_DEALERSHIP" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_DEALERSHIP + '</option>',
  1356. '<option value="FASHION_AND_CLOTHING" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.FASHION_AND_CLOTHING + '</option>',
  1357. '<option value="CONVENIENCE_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CONVENIENCE_STORE + '</option>',
  1358. '<option value="PERSONAL_CARE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PERSONAL_CARE + '</option>',
  1359. '<option value="DEPARTMENT_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.DEPARTMENT_STORE + '</option>',
  1360. '<option value="PHARMACY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PHARMACY + '</option>',
  1361. '<option value="ELECTRONICS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.ELECTRONICS + '</option>',
  1362. '<option value="FLOWERS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.FLOWERS + '</option>',
  1363. '<option value="FURNITURE_HOME_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.FURNITURE_HOME_STORE + '</option>',
  1364. '<option value="GIFTS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.GIFTS + '</option>',
  1365. '<option value="GYM_FITNESS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.GYM_FITNESS + '</option>',
  1366. '<option value="SWIMMING_POOL" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SWIMMING_POOL + '</option>',
  1367. '<option value="HARDWARE_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.HARDWARE_STORE + '</option>',
  1368. '<option value="MARKET" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.MARKET + '</option>',
  1369. '<option value="SUPERMARKET_GROCERY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SUPERMARKET_GROCERY + '</option>',
  1370. '<option value="JEWELRY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.JEWELRY + '</option>',
  1371. '<option value="LAUNDRY_DRY_CLEAN" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.LAUNDRY_DRY_CLEAN + '</option>',
  1372. '<option value="SHOPPING_CENTER" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SHOPPING_CENTER + '</option>',
  1373. '<option value="MUSIC_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSIC_STORE + '</option>',
  1374. '<option value="PET_STORE_VETERINARIAN_SERVICES" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PET_STORE_VETERINARIAN_SERVICES + '</option>',
  1375. '<option value="TOY_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.TOY_STORE + '</option>',
  1376. '<option value="TRAVEL_AGENCY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.TRAVEL_AGENCY + '</option>',
  1377. '<option value="ATM" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.ATM + '</option>',
  1378. '<option value="CURRENCY_EXCHANGE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CURRENCY_EXCHANGE + '</option>',
  1379. '<option value="CAR_RENTAL" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_RENTAL + '</option>',
  1380. '<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>',
  1381. '<option value="RESTAURANT" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.RESTAURANT + '</option>',
  1382. '<option value="BAKERY" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.BAKERY + '</option>',
  1383. '<option value="DESSERT" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.DESSERT + '</option>',
  1384. '<option value="CAFE" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.CAFE + '</option>',
  1385. '<option value="FAST_FOOD" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.FAST_FOOD + '</option>',
  1386. '<option value="FOOD_COURT" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.FOOD_COURT + '</option>',
  1387. '<option value="BAR" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.BAR + '</option>',
  1388. '<option value="ICE_CREAM" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.ICE_CREAM + '</option>',
  1389. '<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>',
  1390. '<option value="ART_GALLERY" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.ART_GALLERY + '</option>',
  1391. '<option value="CASINO" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.CASINO + '</option>',
  1392. '<option value="CLUB" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.CLUB + '</option>',
  1393. '<option value="TOURIST_ATTRACTION_HISTORIC_SITE" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.TOURIST_ATTRACTION_HISTORIC_SITE + '</option>',
  1394. '<option value="MOVIE_THEATER" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.MOVIE_THEATER + '</option>',
  1395. '<option value="MUSEUM" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSEUM + '</option>',
  1396. '<option value="MUSIC_VENUE" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSIC_VENUE + '</option>',
  1397. '<option value="PERFORMING_ARTS_VENUE" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.PERFORMING_ARTS_VENUE + '</option>',
  1398. '<option value="GAME_CLUB" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.GAME_CLUB + '</option>',
  1399. '<option value="STADIUM_ARENA" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.STADIUM_ARENA + '</option>',
  1400. '<option value="THEME_PARK" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.THEME_PARK + '</option>',
  1401. '<option value="ZOO_AQUARIUM" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.ZOO_AQUARIUM + '</option>',
  1402. '<option value="RACING_TRACK" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.RACING_TRACK + '</option>',
  1403. '<option value="THEATER" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.THEATER + '</option>',
  1404. '<option value="OTHER" data-icon="waze-icon-place" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.OTHER + '</option>',
  1405. '<option value="CONSTRUCTION_SITE" data-icon="">' + I18n.translations[I18n.currentLocale()].venues.categories.CONSTRUCTION_SITE + '</option>',
  1406. '<option value="LODGING" data-icon="waze-icon-place-lodging" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.LODGING + '</option>',
  1407. '<option value="HOTEL" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.HOTEL + '</option>',
  1408. '<option value="HOSTEL" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.HOSTEL + '</option>',
  1409. '<option value="CAMPING_TRAILER_PARK" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.CAMPING_TRAILER_PARK + '</option>',
  1410. '<option value="COTTAGE_CABIN" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.COTTAGE_CABIN + '</option>',
  1411. '<option value="BED_AND_BREAKFAST" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.BED_AND_BREAKFAST + '</option>',
  1412. '<option value="OUTDOORS" data-icon="waze-icon-place-outdoors" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.OUTDOORS + '</option>',
  1413. '<option value="PARK" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PARK + '</option>',
  1414. '<option value="PLAYGROUND" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PLAYGROUND + '</option>',
  1415. '<option value="BEACH" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.BEACH + '</option>',
  1416. '<option value="SPORTS_COURT" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SPORTS_COURT + '</option>',
  1417. '<option value="GOLF_COURSE" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.GOLF_COURSE + '</option>',
  1418. '<option value="PLAZA" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PLAZA + '</option>',
  1419. '<option value="PROMENADE" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PROMENADE + '</option>',
  1420. '<option value="POOL" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.POOL + '</option>',
  1421. '<option value="SCENIC_LOOKOUT_VIEWPOINT" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SCENIC_LOOKOUT_VIEWPOINT + '</option>',
  1422. '<option value="SKI_AREA" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SKI_AREA + '</option>',
  1423. '<option value="NATURAL_FEATURES" data-icon="waze-icon-place-natural" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.NATURAL_FEATURES + '</option>',
  1424. '<option value="ISLAND" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.ISLAND + '</option>',
  1425. '<option value="SEA_LAKE_POOL" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.SEA_LAKE_POOL + '</option>',
  1426. '<option value="RIVER_STREAM" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.RIVER_STREAM + '</option>',
  1427. '<option value="FOREST_GROVE" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.FOREST_GROVE + '</option>',
  1428. '<option value="FARM" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.FARM + '</option>',
  1429. '<option value="CANAL" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.CANAL + '</option>',
  1430. '<option value="SWAMP_MARSH" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.SWAMP_MARSH + '</option>',
  1431. '<option value="DAM" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.DAM + '</option>',
  1432. '<option value="PARKING_LOT" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.PARKING_LOT + '</option>',
  1433. '<option value="RESIDENCE_HOME" data-icon="waze-icon-house" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.RESIDENCE_HOME + '</option>',
  1434. '</select>'
  1435. ].join(' '));
  1436.  
  1437. return $places.html();
  1438. }
  1439.  
  1440. function injectCss() {
  1441. var css = [
  1442. // Lock button formatting
  1443. '.btn-lh {cursor:pointer;padding:1px 6px;height:22px;border:solid 1px #c1c1c1;margin-right:3px;}',
  1444. '.btn.btn-lh.btn-lh-selected {background-color:#6999ae;color:white}',
  1445. '.btn.btn-lh.btn-lh-selected:hover {color:white}',
  1446. '.btn.btn-lh.disabled {color:#909090;background-color:#f7f7f7;}',
  1447. '.btn.btn-lh.btn-lh-selected.disabled {color:white;background-color:#6999ae;}',
  1448. //Settings Panel
  1449. '#sidebar .controls-container.pie-controls-container {padding: 0px;}',
  1450. '.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;}',
  1451. '@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;}',
  1452.  
  1453. ].join(' ');
  1454. $('<style type="text/css">' + css + '</style>').appendTo('head');
  1455. }
  1456.  
  1457. function injectCSSWithID(id, css){
  1458. $('<style type="text/css" id=' + id + '>' + css + '</style>').appendTo('head');
  1459. }
  1460.  
  1461. function loadTranslations() {
  1462. setTranslations({
  1463. en: {
  1464. prefs: {
  1465. title: 'Place Interface Enhancements',
  1466. ShowAreaPlaceSize: 'Show area Place size',
  1467. ShowImperial: 'Show imperial',
  1468. ShowMetric: 'Show metric',
  1469. ShowRPPLockButtons: 'Show lock buttons for RPPs',
  1470. ShowRPPLockButtonsTitle: 'Displays lock level buttons for Residential Place Points',
  1471. ShowPlaceLocatorCrosshair: 'Show Place locator crosshair',
  1472. ShowPlaceLocatorCrosshairTitle: 'Centers the Place on screen and zooms to the defined level',
  1473. Zoom: 'Zoom',
  1474. ZoomTitle: 'The zoom level to use when centering on a Place',
  1475. ShowAddressSearch: 'Show search button next to address',
  1476. ShowAddressSearchTitle: "Show a magnifying glass next to the Place's address. Clicking this button will load the address into the search box",
  1477. ShowPlaceCategoryButtons: 'Add Place category buttons above the categories selection',
  1478. ShowPLAButton: 'Show parking lot button',
  1479. ShowPLAButtonTitle: "Starts creation mode for a Parking Lot Area Place and will set the name to match this Place\'s name when complete",
  1480. ShowCopyPlaceButton: 'Show copy Place button',
  1481. ShowCopyPlaceButtonTitle: 'Copies the selected Place to a new Place with identical settings',
  1482. ShowGPIDTooltip: 'Show External Provider tooltip',
  1483. ShowGPIDTooltipTitle: 'Displays a tooltip with the external provider information',
  1484. NewPlaces: 'New Places',
  1485. EditRPPAfterCreate: 'Edit RPP address after created',
  1486. EditRPPAfterCreateTitle: "Automatically opens the RPP address edit window and focuses on the House Number entry",
  1487. UseStreetFromClosestSegment: 'Use street name from closest segment',
  1488. UseStreetFromClosestSegmentTitle: "Pulls the street name from the closest visible segment and inserts into the new Place's address",
  1489. UseCityFromClosestSegment: 'Use city name from closest segment',
  1490. UseCityFromClosestSegmentTitle: "Pulls the city name from the closest visible segment and inserts into the new Place's address",
  1491. ClosestSegmentAltCity: 'When the primary is "No city" look for an alt city',
  1492. ClosestSegmentAltCityTitle: 'When the primary is \'No city\' try to find an alt street name with a city',
  1493. ClosestSegmentIgnorePLRUnnamedPR: "Ignore PLRs & unnamed PR when using closest segment's name and city",
  1494. ClosestSegmentIgnorePLRUnnamedPRTitle: "When looking for the closest segment, PLRs and unnamed PRs will be ignored",
  1495. LockLevel: 'Lock level',
  1496. LockLevelTitle: 'The lock level to set automatically when creating new Places',
  1497. MapChanges: 'Map Changes',
  1498. ShowPlaceNames: 'Show Place names',
  1499. ShowPlaceNamesTitle: '',
  1500. ShowPointNames: 'Show point names',
  1501. ShowPointNamesTitle: "Will display the Place's name below the Place point",
  1502. ShowAreaNames: 'Show area names',
  1503. ShowAreaNamesTitle: "Will display the Place's name in the middle of the Place area",
  1504. ShowLockLevel: 'Show lock level',
  1505. ShowLockLevelTitle: "Will display the Place's lock level in the middle of the Place area",
  1506. ShowPLAName: 'Show PLA name',
  1507. ShowPLANameTitle: '',
  1508. Item: 'Item',
  1509. PlaceMenuCustomization: "Place Menu Customization",
  1510. ClearDescription: "Show clear description button",
  1511. ClearDescriptionTitle: "Adds a clear button to the top right of the description entry that when clicked will clear all text in the entry field"
  1512. }
  1513. },
  1514. "es-419": {
  1515. prefs: {
  1516. title: 'Place Interface Enhancements',
  1517. ShowAreaPlaceSize: 'Mostrar tamaño del área',
  1518. ShowImperial: 'Sistema Imperial',
  1519. ShowMetric: 'Sistema Métrico',
  1520. ShowRPPLockButtons: 'Mostrar botones de bloqueo para RPPs',
  1521. ShowRPPLockButtonsTitle: 'Muestra los botones de nivel de bloqueo para lugares residenciales',
  1522. ShowPlaceLocatorCrosshair: 'Mostrar reticula localizadora del lugar',
  1523. ShowPlaceLocatorCrosshairTitle: 'Centra el lugar en la pantalla y acercamiento al nivel definido',
  1524. Zoom: 'Acercamiento',
  1525. ZoomTitle: 'Nivel de acercamiento a utilizar cuando se centra en un lugar',
  1526. ShowAddressSearch: 'Mostrar el botón de búsqueda junto a la dirección',
  1527. 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",
  1528. ShowPlaceCategoryButtons: 'Botones de categorías de lugares',
  1529. ShowPLAButton: 'Mostrar botón de PLAs',
  1530. 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',
  1531. ShowCopyPlaceButton: 'Mostrar botón de copiado de lugar',
  1532. ShowCopyPlaceButtonTitle: 'Copia el lugar seleccionado en un lugar nuevo con configuraciones idénticas',
  1533. ShowGPIDTooltip: 'Mostrar información del proveedor externo',
  1534. ShowGPIDTooltipTitle: 'Muestra un texto con la información del proveedor externo',
  1535. NewPlaces: 'Nuevos lugares',
  1536. EditRPPAfterCreate: 'Editar la dirección del RPP una vez creada',
  1537. 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",
  1538. UseStreetFromClosestSegment: 'Utilice el nombre de la calle del segmento más cercano',
  1539. UseStreetFromClosestSegmentTitle: "Extrae el nombre de la calle del segmento visible más cercano y lo agrega en la dirección del nuevo lugar",
  1540. UseCityFromClosestSegment: 'Usar el nombre de la ciudad del segmento más cercano',
  1541. UseCityFromClosestSegmentTitle: "Extrae el nombre de la ciudad del segmento visible más cercano y lo agrega en la dirección del nuevo lugar",
  1542. ClosestSegmentAltCity: 'Cuando la ciudad principal es \'Ninguno\' busca una ciudad alternativa',
  1543. ClosestSegmentAltCityTitle: 'Cuando la ciudad principal es "Ninguno" trata de encontrar un nombre de calle alternativo con una ciudad',
  1544. ClosestSegmentIgnorePLRUnnamedPR: "Ignora los PLR y PR sin nombre cuando utilice el nombre y la ciudad del segmento más cercano",
  1545. ClosestSegmentIgnorePLRUnnamedPRTitle: "Ignorar segmentos de estacionamiento o privados al buscar el segmento mas cercano",
  1546. LockLevel: 'Nivel de bloqueo',
  1547. LockLevelTitle: 'El nivel de bloqueo para establecer automáticamente al crear nuevos lugares',
  1548. MapChanges: 'Cambios en el mapa',
  1549. ShowPlaceNames: 'Mostrar nombres de lugares',
  1550. ShowPlaceNamesTitle: '',
  1551. ShowPointNames: 'Mostrar nombres de punto',
  1552. ShowPointNamesTitle: "Muestra el nombre de lugares definidos como punto",
  1553. ShowAreaNames: 'Mostrar nombres de área',
  1554. ShowAreaNamesTitle: "Muestra el nombre de lugares definidos como área",
  1555. ShowLockLevel: 'Mostrar nivel de bloqueo',
  1556. ShowLockLevelTitle: "Muestra el nivel de bloqueo en el centro del lugar",
  1557. ShowPLAName: 'Mostrar nombre de PLA',
  1558. ShowPLANameTitle: 'Muestra el nombre de áreas de estacionamiento (PLAs)',
  1559. Item: 'Opción',
  1560. PlaceMenuCustomization: "Personalización del menú de lugares",
  1561. ClearDescription: "Show clear description button",
  1562. ClearDescriptionTitle: "Adds a clear button to the top right of the description entry that when clicked will clear all text in the entry field"
  1563. }
  1564. }
  1565. });
  1566. }
  1567.  
  1568. function setTranslations(translations) {
  1569. I18n.translations[I18n.currentLocale()].pie = translations.en;
  1570. for (var i = 0; i < Object.keys(translations).length; i++) {
  1571. var locale = Object.keys(translations)[i];
  1572. if (I18n.currentLocale() == locale) {
  1573. I18n.translations[locale].pie.prefs = translations[locale].prefs;
  1574. return;
  1575. }
  1576. }
  1577. }
  1578.  
  1579. function listPlaces(){
  1580. var category = "";
  1581. for(i=0; i<W.Config.venues.categories.length; i++){
  1582. category = W.Config.venues.categories[i];
  1583. console.log(category + " Main");
  1584. var subCategories = W.Config.venues.subcategories[category];
  1585. for(var j=0; j<subCategories.length;j++){
  1586. console.log(subCategories[j]);
  1587. }
  1588. }
  1589. }
  1590. })();