Greasy Fork is available in English.

WME Place Interface Enhancements

Enhancements to various Place interfaces

Versión del día 5/5/2017. Echa un vistazo a la versión más reciente.

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