WME Place Interface Enhancements

Enhancements to various Place interfaces

目前為 2017-06-13 提交的版本,檢視 最新版本

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