WME Place Interface Enhancements

Enhancements to various Place interfaces

目前为 2017-04-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name WME Place Interface Enhancements
  3. // @namespace https://greasyfork.org/users/30701-justins83-waze
  4. // @version 0.8.04
  5. // @description Enhancements to various Place interfaces
  6. // @include https://www.waze.com/editor/*
  7. // @include https://www.waze.com/*/editor/*
  8. // @include https://beta.waze.com/*
  9. // @exclude https://www.waze.com/user/editor*
  10. // @icon data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAEAAQADAREAAhEBAxEB/8QAHQABAAEFAQEBAAAAAAAAAAAAAAUBAwQGBwIICf/EAEAQAAICAQICBQgHBwQCAwAAAAABAgMEBREGMRIhQVFhBxMUIjJScYEXI0JUkZLBCBVVYpOhsRYzcoJEolPR4f/EABsBAQACAwEBAAAAAAAAAAAAAAADBAECBgUH/8QAMBEBAAIBAgUBCAEEAwEAAAAAAAECAwQRBRIhMVFBBhMiMmFxkdGBFCOhsVLB4fD/2gAMAwEAAhEDEQA/AP1TAAAAAAAAAAAAAAAAAAADwrFJtR9bbm+wyxu9mGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY+Vm04cd7JbPsiubNorNuzW1or3YONlW6tc0t6saPNJ9cvDckmsUj6o4tN5+iVjFQioxSSXJIhTKgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH1PWnVJ1UNdJdUp93wJ6Y9+soL5NukIOc5WScpScpPm2WdtleZ37tg4elF4ckvaU+sq5e6zi7JQhTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj6hc6MK2cfaS6jasbzENbTtWZalzLy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ANW470P07BWZVHe6hettzlDt/Alpbadmlo3c4LCIAAAAAAAAAAKS9l/ADnMvafxNW6gAAAAAAAADunke4S/c+kPVMiG2XmL1E11wr7Px5/gQXnedm8Q6IRtgAAAAAAAAAApKKlFprdPqaYGj5nk5ssyrZ0ZVddMpNxhKL3S7ieMiPlWfo2yfvlX5WPeR4OQ+jbJ++VflY95Hg5D6Nsn75V+Vj3keDkPo2yfvlX5WPeR4OQ+jbJ++VflY95Hg5D6Nsn75V+Vj3keDkPo2yfvlX5WPeR4OQ+jbJ++VflY95Hg5D6Nsn75V+Vj3keDkUfk1yWmvTKvyse8jwcjWH5B89tv96Y39ORj3kM8qn0D5/8AFMb+nIe8g5T6B8/+KY39OQ95Byn0D5/8Uxv6ch7yDlPoHz/4pjf05D3kHKfQPn/xTG/pyHvIOU+gfP8A4pjf05D3kHKfQPn/AMUxv6ch7yDlZWmeQy6jUMezM1Cm7FhNSsrhBpyS7DE3OV1yEI1xUYpRjFbJLkkRN3oAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//Z
  11. // @author JustinS83
  12. // @grant none
  13. // @require https://greasyfork.org/scripts/24851-wazewrap/code/WazeWrap.js
  14. // @license GPLv3
  15. // ==/UserScript==
  16. var UpdateObject, MultiAction;
  17.  
  18. (function() {
  19. 'use strict';
  20.  
  21. var settings = {};
  22. var placeMenuSelector = "#edit-buttons > div > div.toolbar-button.waze-icon-place.toolbar-submenu.toolbar-group.toolbar-group-venues.ItemInactive > menu";
  23. var pointStyle = {
  24. pointRadius: 6,
  25. fillOpacity: 0,
  26. strokeColor: '#00ece3',
  27. strokeWidth: '2',
  28. strokeLinecap: 'round'
  29. };
  30. var layerName = "WME PIE";
  31. var newPlaceLayer;
  32. var placementMode = false;
  33. var drawPoly;
  34. var resCategory = "RESIDENCE_HOME";
  35. var PIEPlacePointNamesLayer, PIEPlaceAreaNamesLayer;
  36.  
  37. function bootstrap(tries) {
  38. tries = tries || 1;
  39.  
  40. if (window.W &&
  41. window.W.map &&
  42. window.W.model &&
  43. window.W.loginManager.user &&
  44. $) {
  45. init();
  46. } else if (tries < 1000) {
  47. setTimeout(function () {bootstrap(tries++);}, 200);
  48. }
  49. }
  50.  
  51. bootstrap();
  52.  
  53. function init(){
  54. var $section = $("<div>", {style:"padding:8px 16px", id:"WMEPIESettings"});
  55. $section.html([
  56. '<h4><b>WME Place Interface Enhancements</b></h4>',
  57. '<div class="controls-container pie-controls-container" id="divAreaPlaceSizeControls">',
  58. '<div id="divShowAreaPlaceSize" class="controls-container pie-controls-container"><input type="checkbox" id="_cbShowAreaPlaceSize" class="pieSettingsCheckbox" /><label for="_cbShowAreaPlaceSize">Show area Place size</label></div>',
  59. '<div id="divShowAreaPlaceSizeImperial"class="controls-container pie-controls-container" style="padding-left:20px;"><input type="checkbox" id="_cbShowAreaPlaceSizeImperial" class="pieSettingsCheckbox" disabled /><label for ="_cbShowAreaPlaceSizeImperial"> Show imperial </label></div>',
  60. '<div id="divShowAreaPlaceSizeMetric" class="controls-container pie-controls-container" style="padding-left:20px;"><input type="checkbox" id="_cbShowAreaPlaceSizeMetric" class="pieSettingsCheckbox" disabled /><label for ="_cbShowAreaPlaceSizeMetric"> Show metric</label></div>',
  61. '</div>',
  62. '<div class="controls-container pie-controls-container" id="divShowLockButtonsRPP" title="Displays lock level buttons for Residential Place Points"><input type="checkbox" id="_cbShowLockButtonsRPP" class="pieSettingsCheckbox" /><label for="_cbShowLockButtonsRPP">Show lock buttons for RPPs</label></div>',
  63. '<div class="controls-container pie-controls-container" id="divShowPlaceLocatorCrosshair" title="Centers the Place on screen and zooms to the defined level" ><input type="checkbox" id="_cbShowPlaceLocatorCrosshair" class="pieSettingsCheckbox" /><label for="_cbShowPlaceLocatorCrosshair">Show Place locator crosshair</label></br>',
  64. '<span class="controls-container pie-controls-container" style="padding-left:30px;" title="The zoom level to use when centering on a Place">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>',
  65. '<div class="controls-container pie-controls-container" id="divShowSearchButton" title="Show a magnifying glass next to the Place&#39;s address. Clicking this button will load the address into the search box"><input type="checkbox" id="_cbShowSearchButton" class="pieSettingsCheckbox"/><label for="_cbShowSearchButton" style="white-space:pre-line;">Show search button next to address</label></div>',
  66. '<div class="controls-container pie-controls-container" id="divAddPlaceCategoriesButtons" title=""><input type="checkbox" id="_cbAddPlaceCategoriesButtons" class="pieSettingsCheckbox"/><label for="_cbAddPlaceCategoriesButtons" style="white-space:pre-line;">Add Place category buttons above the categories selection</label></div>',
  67. '<div class="controls-container pie-controls-container" id="divShowParkingLotButton" title="Starts creation mode for a Parking Lot Area Place and will set the name to match this Place\'s name when complete" ><input type="checkbox" id="_cbShowParkingLotButton" class="pieSettingsCheckbox" /><label for="_cbShowParkingLotButton">Show parking lot button</label></br>',
  68.  
  69. '<fieldset id="fieldNewPlaces" style="border: 1px solid silver; padding: 8px; border-radius: 4px;">',
  70. '<legend style="margin-bottom:0px; border-bottom-style:none;width:auto;"><h4>New Places</h4></legend>',
  71. '<div id="divEditRPPAfterCreated" class="controls-container pie-controls-container" title="Automatically opens the RPP address edit window and focuses on the House Number entry"><input type="checkbox" id="_cbEditRPPAfterCreated" class="pieSettingsCheckbox"><label for="_cbEditRPPAfterCreated" style="white-space:pre-line;">Edit RPP address after created</label></div>',
  72. '<div id="divUseStreetFromClosestSeg" class="controls-container pie-controls-container" title="Pulls the street name from the closest visible segment and inserts into the new Place&#39;s address"><input type="checkbox" id="_cbUseStreetFromClosestSeg" class="pieSettingsCheckbox"><label for="_cbUseStreetFromClosestSeg" style="white-space:pre-line;">Use street name from closest segment</label></div>',
  73. '<div id="divUseCityFromClosestSeg" class="controls-container pie-controls-container" title="Pulls the city name from the closest visible segment and inserts into the new Place&#39;s address"><input type="checkbox" id="_cbUseCityFromClosestSeg" class="pieSettingsCheckbox"><label for="_cbUseCityFromClosestSeg" style="white-space:pre-line;">Use city name from closest segment</label></div>',
  74. '<div id="divUseAltCity" class="controls-container pie-controls-container" title="When the primary is &quot;No city&quot; try to find an alt street name with a city" style="padding-left:20px; word-wrap: break-word;"><input type="checkbox" id="_cbUseAltCity" class="pieSettingsCheckbox"><label for="_cbUseAltCity" style="white-space:pre-line;">When the primary is &quot;No city&quot; look for an alt city</label></div>',
  75. '<div id="divSkipPLR" class="controls-container pie-controls-container"><input type="checkbox" id="_cbSkipPLR" class="pieSettingsCheckbox"/><label for="_cbSkipPLR" style="white-space:pre-line;">Ignore PLRs & unnamed PR when using closest segment&#39;s name and city</label></div>',
  76. '<div id="divDefaultLockLevel" class="controls-container pie-controls-container" style="left:8px;" title="The lock level to set automatically when creating new Places">Lock level <select id="pieDefaultLockLevel">' + buildLockLevelsList() + '</select></div>',
  77. '</fieldset>',
  78.  
  79. /*'<fieldset id="fieldMapMods" style="border: 1px solid silver; padding: 8px; border-radius: 4px;">',
  80. '<legend style="margin-bottom:0px; border-bottom-style:none;width:auto;"><h4>Map Changes</h4></legend>',
  81. '<div id="divShowNames" class="controls-container pie-controls-container"><input type="checkbox" id="_cbShowPlaceNames" class="pieSettingsCheckbox" /><label for="_cbShowPlaceNames">Show Place names</label></div>',
  82. '<div id="divShowNamesPoint"class="controls-container pie-controls-container" style="padding-left:20px;"><input type="checkbox" id="_cbShowPlaceNamesPoint" class="pieSettingsCheckbox" disabled /><label for ="_cbShowPlaceNamesPoint"> Show point names </label></div>',
  83. '<div id="divShowNamesArea"class="controls-container pie-controls-container" style="padding-left:20px;"><input type="checkbox" id="_cbShowPlaceNamesArea" class="pieSettingsCheckbox" disabled /><label for ="_cbShowPlaceNamesArea"> Show area names </label></div>',
  84. '<div id="divShowNamesLock"class="controls-container pie-controls-container" style="padding-left:20px;"><input type="checkbox" id="_cbShowPlaceNamesLock" class="pieSettingsCheckbox" disabled /><label for ="_cbShowPlaceNamesLock"> Show lock level </label></div>',
  85. '</fieldset>',*/
  86. '<div class="controls-container" id="divPlaceMenuCustomization">',
  87. '<b>Place Menu Customization</b></br>',
  88. buildItemOption(1),
  89. buildItemOption(2),
  90. buildItemOption(3),
  91. buildItemOption(4),
  92. buildItemOption(5),
  93. buildItemOption(6),
  94. buildItemOption(7),
  95. buildItemOption(8),
  96. buildItemOption(9),
  97. buildItemOption(10),
  98. buildItemOption(11),
  99. '</div>'
  100.  
  101. ].join(' '));
  102.  
  103. UpdateObject = require("Waze/Action/UpdateObject");
  104. MultiAction = require("Waze/Action/MultiAction");
  105.  
  106. newPlaceLayer = new OL.Layer.Vector(layerName,{displayInLayerSwitcher: false});
  107. W.map.addLayer(newPlaceLayer);
  108.  
  109. injectCss();
  110. new WazeWrap.Interface.Tab('PIE', $section.html(), init2);
  111. }
  112.  
  113. function buildNewPlaceList(){
  114. //Clear out the Places menu
  115. $(placeMenuSelector).empty();
  116. var cat = "";
  117. var icon = "";
  118. var i;
  119. for(i=0;i<11;i++){
  120. icon = "";
  121. cat = $('#pieItem' + (i+1))[0].value;
  122. icon = $('#pieItem' + (i+1))[0].options[$('#pieItem' + (i+1))[0].selectedIndex].getAttribute("data-icon");
  123. if(cat !== "PARKING_LOT" && cat !== resCategory)
  124. $(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>');
  125. else{
  126. if(cat === resCategory) //force point
  127. $(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>');
  128. else //Parking lot - force area
  129. $(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>');
  130. }
  131. }
  132.  
  133. $('[id^="piePlaceMainItem"]').click(function(e){
  134. startPlacementMode($('#' + this.id).data("category"), true);
  135. });
  136.  
  137. $('[id^="piePlaceAreaItem"]').click(function(e){
  138. e.stopPropagation();
  139. startPlacementMode($('#' + this.id).data("category"), false);
  140. });
  141. }
  142.  
  143. function init2(){
  144. //Load settings
  145. loadSettings();
  146. //Set up event handlers
  147. $('#_cbShowAreaPlaceSize').change(function() {
  148. if(this.checked) {
  149. attachPlaceSizeHandlers();
  150. updatePlaceSizeDisplay();
  151. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = false;
  152. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = false;
  153. }
  154. else
  155. {
  156. removePlaceSizeHandlers();
  157. $('#AreaSize').remove();
  158. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = true;
  159. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = true;
  160. }
  161. });
  162.  
  163. $('#_cbShowPlaceNames').change(function() {
  164. if(this.checked) {
  165. //PIEPlaceAreaNamesLayer.setVisibility(true);
  166. //PIEPlacePointNamesLayer.setVisibility(true);
  167. $('#_cbShowPlaceNamesPoint')[0].disabled = false;
  168. $('#_cbShowPlaceNamesArea')[0].disabled = false;
  169. $('#_cbShowPlaceNamesLock')[0].disabled = false;
  170. }
  171. else
  172. {
  173. //PIEPlaceAreaNamesLayer.setVisibility(false);
  174. //PIEPlacePointNamesLayer.setVisibility(false);
  175. $('#_cbShowPlaceNamesPoint')[0].disabled = true;
  176. $('#_cbShowPlaceNamesArea')[0].disabled = true;
  177. $('#_cbShowPlaceNamesLock')[0].disabled = true;
  178. }
  179. });
  180.  
  181. $('#_cbShowLockButtonsRPP').change(function() {
  182. if(this.checked) {
  183. attachRPPLockButtonHandlers();
  184. }
  185. else
  186. {
  187. $('#pieRPPLockButtonsContainer').remove();
  188. W.selectionManager.events.unregister("selectionchanged", null, addLockButtons);
  189. W.model.actionManager.events.unregister("afterundoaction",null, addLockButtons);
  190. W.model.actionManager.events.unregister("afterclearactions",null, addLockButtons);
  191. W.model.actionManager.events.unregister("afteraction",null, addLockButtons);
  192. }
  193. });
  194.  
  195. $('#_cbShowPlaceLocatorCrosshair').change(function(){
  196. if(this.checked){
  197. W.selectionManager.events.register("selectionchanged", null, ShowPlaceLocatorCrosshair);
  198. W.model.actionManager.events.register("afterundoaction",null, ShowPlaceLocatorCrosshair);
  199. W.model.actionManager.events.register("afterclearactions",null, ShowPlaceLocatorCrosshair);
  200. W.model.actionManager.events.register("afteraction",null, ShowPlaceLocatorCrosshair);
  201. }
  202. else{
  203. W.selectionManager.events.unregister("selectionchanged", null, ShowPlaceLocatorCrosshair);
  204. W.model.actionManager.events.unregister("afterundoaction",null, ShowPlaceLocatorCrosshair);
  205. W.model.actionManager.events.unregister("afterclearactions",null, ShowPlaceLocatorCrosshair);
  206. W.model.actionManager.events.unregister("afteraction",null, ShowPlaceLocatorCrosshair);
  207. }
  208. });
  209.  
  210. $('#_cbShowParkingLotButton').change(function(){
  211. if(this.checked){
  212. W.selectionManager.events.register("selectionchanged", null, ShowParkingLotButton);
  213. W.model.actionManager.events.register("afterundoaction",null, ShowParkingLotButton);
  214. W.model.actionManager.events.register("afterclearactions",null, ShowParkingLotButton);
  215. W.model.actionManager.events.register("afteraction",null, ShowParkingLotButton);
  216. }
  217. else{
  218. W.selectionManager.events.unregister("selectionchanged", null, ShowParkingLotButton);
  219. W.model.actionManager.events.unregister("afterundoaction",null, ShowParkingLotButton);
  220. W.model.actionManager.events.unregister("afterclearactions",null, ShowParkingLotButton);
  221. W.model.actionManager.events.unregister("afteraction",null, ShowParkingLotButton);
  222. }
  223. });
  224.  
  225. $('#_cbShowSearchButton').change(function(){
  226. if(this.checked){
  227. W.selectionManager.events.register("selectionchanged", null, ShowSearchButton);
  228. W.model.actionManager.events.register("afterundoaction",null, ShowSearchButton);
  229. W.model.actionManager.events.register("afterclearactions",null, ShowSearchButton);
  230. W.model.actionManager.events.register("afteraction",null, ShowSearchButton);
  231. }
  232. else{
  233. W.selectionManager.events.unregister("selectionchanged", null, ShowSearchButton);
  234. W.model.actionManager.events.unregister("afterundoaction",null, ShowSearchButton);
  235. W.model.actionManager.events.unregister("afterclearactions",null, ShowSearchButton);
  236. W.model.actionManager.events.unregister("afteraction",null, ShowSearchButton);
  237. }
  238. });
  239.  
  240. $('#_cbAddPlaceCategoriesButtons').change(function(){
  241. if(this.checked){
  242. W.selectionManager.events.register("selectionchanged", null, AddPlaceCategoriesButtons);
  243. W.model.actionManager.events.register("afterundoaction",null, AddPlaceCategoriesButtons);
  244. W.model.actionManager.events.register("afterclearactions",null, AddPlaceCategoriesButtons);
  245. W.model.actionManager.events.register("afteraction",null, AddPlaceCategoriesButtons);
  246. }
  247. else{
  248. W.selectionManager.events.unregister("selectionchanged", null, AddPlaceCategoriesButtons);
  249. W.model.actionManager.events.unregister("afterundoaction",null, AddPlaceCategoriesButtons);
  250. W.model.actionManager.events.unregister("afterclearactions",null, AddPlaceCategoriesButtons);
  251. W.model.actionManager.events.unregister("afteraction",null, AddPlaceCategoriesButtons);
  252. }
  253. });
  254.  
  255. //Load settings to interface
  256. setChecked('_cbShowAreaPlaceSize', settings.ShowAreaPlaceSize);
  257. setChecked('_cbShowAreaPlaceSizeImperial', settings.ShowAreaPlaceSizeImperial);
  258. setChecked('_cbShowAreaPlaceSizeMetric', settings.ShowAreaPlaceSizeMetric);
  259. setChecked('_cbShowLockButtonsRPP', settings.ShowLockButtonsRPP);
  260. setChecked('_cbEditRPPAfterCreated', settings.EditRPPAfterCreated);
  261. setChecked('_cbUseStreetFromClosestSeg', settings.UseStreetFromClosestSeg);
  262. setChecked('_cbUseCityFromClosestSeg', settings.UseCityFromClosestSeg);
  263. setChecked('_cbShowPlaceLocatorCrosshair', settings.ShowPlaceLocatorCrosshair);
  264. setChecked('_cbShowParkingLotButton', settings.ShowParkingLotButton);
  265. setChecked('_cbUseAltCity', settings.UseAltCity);
  266. setChecked('_cbShowSearchButton', settings.ShowSearchButton);
  267. setChecked('_cbAddPlaceCategoriesButtons', settings.AddPlaceCategoriesButtons);
  268. setChecked('_cbSkipPLR', settings.SkipPLR);
  269. setChecked('_cbShowPlaceNames', settings.ShowPlaceNames);
  270. setChecked('_cbShowPlaceNamesPoint', settings.ShowPlaceNamesPoint);
  271. setChecked('_cbShowPlaceNamesArea', settings.ShowPlaceNamesArea);
  272. setChecked('_cbShowPlaceNamesLock', settings.ShowPlaceNamesLock);
  273. $('#piePlaceZoom')[0].value = settings.PlaceZoom;
  274. $('#pieDefaultLockLevel')[0].value = settings.DefaultLockLevel;
  275.  
  276. if(settings.ShowAreaPlaceSize){
  277. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = false;
  278. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = false;
  279. attachPlaceSizeHandlers();
  280. }
  281.  
  282. if(settings.ShowPlaceLocatorCrosshair){
  283. W.selectionManager.events.register("selectionchanged", null, ShowPlaceLocatorCrosshair);
  284. W.model.actionManager.events.register("afterundoaction",null, ShowPlaceLocatorCrosshair);
  285. W.model.actionManager.events.register("afterclearactions",null, ShowPlaceLocatorCrosshair);
  286. W.model.actionManager.events.register("afteraction",null, ShowPlaceLocatorCrosshair);
  287. ShowPlaceLocatorCrosshair(); //in case the user opened a PL with a Place selected
  288. }
  289.  
  290. if(settings.ShowParkingLotButton){
  291. W.selectionManager.events.register("selectionchanged", null, ShowParkingLotButton);
  292. W.model.actionManager.events.register("afterundoaction",null, ShowParkingLotButton);
  293. W.model.actionManager.events.register("afterclearactions",null, ShowParkingLotButton);
  294. W.model.actionManager.events.register("afteraction",null, ShowParkingLotButton);
  295. ShowParkingLotButton(); //in case the user opened a PL with a Place selected
  296. }
  297.  
  298. if(settings.ShowSearchButton){
  299. W.selectionManager.events.register("selectionchanged", null, ShowSearchButton);
  300. W.model.actionManager.events.register("afterundoaction",null, ShowSearchButton);
  301. W.model.actionManager.events.register("afterclearactions",null, ShowSearchButton);
  302. W.model.actionManager.events.register("afteraction",null, ShowSearchButton);
  303. ShowSearchButton(); //in case the user opened a PL with a Place selected
  304. }
  305.  
  306. if(settings.AddPlaceCategoriesButtons){
  307. W.selectionManager.events.register("selectionchanged", null, AddPlaceCategoriesButtons);
  308. W.model.actionManager.events.register("afterundoaction",null, AddPlaceCategoriesButtons);
  309. W.model.actionManager.events.register("afterclearactions",null, AddPlaceCategoriesButtons);
  310. W.model.actionManager.events.register("afteraction",null, AddPlaceCategoriesButtons);
  311. AddPlaceCategoriesButtons();
  312. }
  313.  
  314. if(settings.ShowLockButtonsRPP)
  315. attachRPPLockButtonHandlers();
  316.  
  317. $('.pieSettingsCheckbox').change(function() {
  318. var settingName = $(this)[0].id.substr(3);
  319. settings[settingName] = this.checked;
  320. saveSettings();
  321. });
  322.  
  323. $('#piePlaceZoom').change(function(){
  324. var settingName = $(this)[0].id.substr(3);
  325. settings[settingName] = $(this)[0].value;
  326. saveSettings();
  327. });
  328.  
  329. $('#pieDefaultLockLevel').change(function(){
  330. settings[$(this)[0].id.substr(3)] = $(this)[0].value;
  331. saveSettings();
  332. });
  333.  
  334. var i;
  335. //Whenever a Place item is changed, read the settings and save to localStorage
  336. $('[id^="pieItem"]').change(function(){
  337. for(i=0;i<11;i++){
  338. settings.NewPlacesList[i] = $('#pieItem'+(i+1))[0].value;
  339. }
  340. saveSettings();
  341. buildNewPlaceList();
  342. });
  343.  
  344. //Load settings into Place Customization list options
  345. for(i=0; i<11;i++)
  346. $('#pieItem'+(i+1))[0].value = settings.NewPlacesList[i];
  347.  
  348. //Build our new menu
  349. buildNewPlaceList();
  350.  
  351. new WazeWrap.Interface.Shortcut('CreateResidentialPlaceShortcut', 'Creates a resdiential Place point', 'wmepie', 'Place Interface Enhancements', settings.CreateResidentialPlaceShortcut, function(){startPlacementMode(resCategory, true);}, null).add();
  352.  
  353. new WazeWrap.Interface.Shortcut('CreateParkingLotShortcut', 'Creates a parking lot Place', 'wmepie', 'Place Interface Enhancements', settings.CreateParkingLotShortcut, function(){startPlacementMode("PARKING_LOT", false);}, null).add();
  354.  
  355. window.addEventListener("beforeunload", function() {
  356. saveSettings();
  357. }, false);
  358.  
  359. W.selectionManager.events.register("selectionchanged", null, function(){
  360. if(W.selectionManager.selectedItems.length > 0 && W.selectionManager.selectedItems[0].model.type === "venue")
  361. $('.form-control.house-number').focusout(function(){
  362. $('.form-control.house-number')[0].value = $('.form-control.house-number')[0].value.trim();
  363. });
  364. });
  365.  
  366. //Highlight the categories box when the old hospital category is present
  367. W.selectionManager.events.register("selectionchanged", null, highlightObsoleteHospitalCategory);
  368. W.model.actionManager.events.register("afterundoaction",null, highlightObsoleteHospitalCategory);
  369. W.model.actionManager.events.register("afterclearactions",null, highlightObsoleteHospitalCategory);
  370. W.model.actionManager.events.register("afteraction",null, highlightObsoleteHospitalCategory);
  371.  
  372. //Shamelessly copied from URO+
  373. var MO_MPLayer = new MutationObserver(MPLayerChanged);
  374. MO_MPLayer.observe(W.map.problemLayer.div,{childList : true});
  375. }
  376.  
  377. //Shamelessly copied from URO+
  378. function MPLayerChanged()
  379. {
  380. for(var mObj in W.map.problemLayer.markers){
  381. var mIcon = W.map.problemLayer.markers[mObj].icon.div;
  382. mIcon.addEventListener("click", MarkerClick, false);
  383. }
  384. }
  385.  
  386. function MarkerClick()
  387. {
  388. var markerType = GetMarkerType(this.className);
  389. if(markerType !== null){
  390. var markerID = this.attributes["data-id"].value;
  391. if(W.map.getLayerByUniqueName("problems").markers[markerID].model.attributes.subType === 71){
  392. var $PIECreatePLA = $("<div>", {style:"min-height:20px", id:"Wazebar"});
  393. $PIECreatePLA.html([
  394. '<div id="PIECreatePLA">',
  395. '<div class="btn btn-block" id="PIECreatePLAButton" style="color: #fff; background-color: #92c2d1; border-color: #78b0bf; margin-top:5px;">Create Suggested PLA</div>',
  396. '</div>'
  397. ].join(' '));
  398.  
  399. setTimeout(function(){$('#panel-container > div > div > div.body > div.actions > div > div').append($PIECreatePLA); $('#PIECreatePLAButton').click(function(){createPLAFromMP(markerID);})}, 150);
  400. }
  401. }
  402. }
  403.  
  404. //Shamelessly copied from URO+
  405. function GetMarkerType(className)
  406. {
  407. var markerType = null;
  408. if(className.indexOf('user-generated') !== -1) markerType = 'ur';
  409. else if(className.indexOf('map-problem') !== -1) markerType = 'mp';
  410. else if(className.indexOf('place-update') !== -1) markerType = 'pur';
  411. return markerType;
  412. }
  413.  
  414. function createPLAFromMP(MPID){
  415. var pos = W.model.problemDetails.objects[MPID].venueGeom;
  416.  
  417. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  418. var AddPlace = require("Waze/Action/AddLandmark");
  419. var NewPlace = new PlaceObject();
  420.  
  421. var points = [];
  422. var i;
  423. for(i=0;i<pos.components[0].components.length;i++){
  424. points.push(new OL.Geometry.Point(pos.components[0].components[i].x, pos.components[0].components[i].y));
  425. }
  426. var ring = new OpenLayers.Geometry.LinearRing(points);
  427. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  428.  
  429. NewPlace.attributes.categories.push("PARKING_LOT");
  430.  
  431. W.model.actionManager.add(new AddPlace(NewPlace));
  432. Waze.selectionManager.select([NewPlace]);
  433. }
  434.  
  435. function highlightObsoleteHospitalCategory(){
  436. if(W.selectionManager.selectedItems.length > 0 && W.selectionManager.selectedItems[0].model.type === "venue"){
  437. if(W.selectionManager.selectedItems[0].model.attributes.categories.contains("HOSPITAL_MEDICAL_CARE")){
  438. $('.select2-choices').css('animation-iteration-count', 'infinite');
  439. $('.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');
  440. $('.select2-choices').tooltip();
  441. }
  442. }
  443. }
  444.  
  445. var newPlaceCategory = "";
  446. function startPlacementMode(category, isPoint){
  447. $('#edit-buttons > div > div.toolbar-button.waze-icon-place.toolbar-submenu.toolbar-group.toolbar-group-venues.ItemInactive').removeClass("open");
  448. newPlaceCategory = category;
  449. var polyDrawFeatureOptions = {callbacks : {"done": doneHandler}};
  450. if(isPoint){
  451. $("#map").on('mousemove', MouseMoveHandler);
  452. $("#map").click(function(){endPlacementMode(category, isPoint);});
  453. /*drawPoly = new OpenLayers.Control.DrawFeature(newPlaceLayer, OpenLayers.Handler.Polygon, polyDrawFeatureOptions);
  454. W.map.addControl(drawPoly);
  455. drawPoly.activate();*/
  456. }
  457. else{
  458. drawPoly = new OpenLayers.Control.DrawFeature(newPlaceLayer, OpenLayers.Handler.Polygon, polyDrawFeatureOptions);
  459. W.map.addControl(drawPoly);
  460. drawPoly.activate();
  461.  
  462. }
  463. document.addEventListener('keyup', keyUpHandler, false);
  464. }
  465.  
  466. var businessPLAPlaceName, businessPLAPlaceAddress;//, businessPLAPlacePhone, businessPLAPlaceURL;
  467. function startBusinessPLAPlacementMode(){
  468. var polyDrawFeatureOptions = {callbacks : {"done": doneHandlerBusinessPLAPlace}};
  469. drawPoly = new OpenLayers.Control.DrawFeature(newPlaceLayer, OpenLayers.Handler.Polygon, polyDrawFeatureOptions);
  470. W.map.addControl(drawPoly);
  471. drawPoly.activate();
  472. document.addEventListener('keyup', keyUpHandler, false);
  473. }
  474.  
  475. function doneHandlerBusinessPLAPlace(geom){
  476. drawPoly.destroy();
  477. CreateBusinesPLAPlace(geom, businessPLAPlaceName, businessPLAPlaceAddress);//, businessPLAPlacePhone, businessPLAPlaceURL);
  478. }
  479.  
  480. function CreateBusinesPLAPlace(geom, name, address){//, phone, url){
  481. drawPoly.destroy();
  482.  
  483. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  484. var AddPlace = require("Waze/Action/AddLandmark");
  485. var multiaction = new MultiAction();
  486. multiaction.setModel(W.model);
  487.  
  488. var NewPlace = new PlaceObject();
  489. var points = [];
  490. var i;
  491. for(i=0;i<geom.components[0].components.length;i++){
  492. points.push(new OL.Geometry.Point(geom.components[0].components[i].x, geom.components[0].components[i].y));
  493. }
  494. var ring = new OpenLayers.Geometry.LinearRing(points);
  495. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  496. NewPlace.attributes.categories.push("PARKING_LOT");
  497.  
  498. NewPlace.attributes.lockRank = Number(settings.DefaultLockLevel);
  499. NewPlace.attributes.name = "Parking - " + name;
  500. //NewPlace.attributes.phone = phone;
  501. //NewPlace.attributes.url = url;
  502. NewPlace.attributes.categoryAttributes.PARKING_LOT = {};
  503. NewPlace.attributes.categoryAttributes.PARKING_LOT.parkingType = "RESTRICTED";
  504.  
  505. W.model.actionManager.add(new AddPlace(NewPlace));
  506.  
  507. if(address){
  508. var newAttributes, UpdateFeatureAddress = require('Waze/Action/UpdateFeatureAddress');
  509. newAttributes = {
  510. countryID: address.country.id,
  511. stateID: address.state.id,
  512. emptyCity: address.city.attributes.name ? null : true,
  513. emptyStreet: address.street.name ? null : true,
  514. houseNumber: address.houseNumber
  515. };
  516.  
  517. newAttributes.streetName = address.street.name;
  518.  
  519. var cityName = address.city.attributes.name;
  520.  
  521. if(cityName !== "")
  522. newAttributes.emptyCity = null;
  523. newAttributes.cityName = cityName;
  524.  
  525. }
  526. var UFA = new UpdateFeatureAddress(NewPlace, newAttributes);
  527. UFA.options.updateHouseNumber = true;
  528. multiaction.doSubAction(UFA);
  529. W.model.actionManager.add(multiaction);
  530.  
  531. Waze.selectionManager.select([NewPlace]);
  532. }
  533.  
  534. function doneHandler(geom){
  535. drawPoly.destroy();
  536. createPlace(geom, newPlaceCategory, false);
  537. }
  538.  
  539. function keyUpHandler(e){
  540. if (e.keyCode == 27){
  541. disablePlacementMode();
  542. if(drawPoly !== "undefined")
  543. drawPoly.destroy();
  544. }
  545. else if(e.keyCode == 90 && e.ctrlKey)
  546. drawPoly.undo();
  547. else if(e.keyCode == 89 && e.ctrlKey)
  548. drawPoly.redo();
  549. else if(e.keyCode == 13)
  550. drawPoly.finishSketch();
  551. }
  552.  
  553. function disablePlacementMode(){
  554. $("#map").off('click');//, endPlacementMode);
  555. $("#map").off('mousemove', MouseMoveHandler);
  556. clearLayer();
  557. document.removeEventListener('keyup', keyUpHandler);
  558. }
  559.  
  560. function endPlacementMode(category, isPoint){
  561. disablePlacementMode();
  562. createPlace(getMousePos900913(), category, isPoint);
  563. }
  564.  
  565. function getMousePos900913(){
  566. var mousePosition = $('.WazeControlMousePosition').text().split(" ");
  567. return WazeWrap.Geometry.ConvertTo900913(mousePosition[0], mousePosition[1]);
  568. }
  569.  
  570. function MouseMoveHandler(e){
  571. clearLayer();
  572. drawCircle(getMousePos900913());
  573. }
  574.  
  575. function clearLayer() {
  576. var layer = W.map.getLayersByName(layerName)[0];
  577. layer.removeAllFeatures();
  578. }
  579.  
  580. function drawCircle(e){
  581. var pointFeature = new OL.Feature.Vector(new OL.Geometry.Point(e.lon, e.lat), {}, pointStyle);
  582. W.map.getLayersByName(layerName)[0].addFeatures([pointFeature]);
  583. }
  584.  
  585. function createPlace(pos, category, isPoint){
  586. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  587. var AddPlace = require("Waze/Action/AddLandmark");
  588. var multiaction = new MultiAction();
  589. multiaction.setModel(W.model);
  590.  
  591. var NewPlace = new PlaceObject();
  592. if(isPoint)
  593. NewPlace.geometry = new OL.Geometry.Point(pos.lon, pos.lat);
  594. else{
  595. var points = [];
  596. var i;
  597. for(i=0;i<pos.components[0].components.length;i++){
  598. points.push(new OL.Geometry.Point(pos.components[0].components[i].x, pos.components[0].components[i].y));
  599. }
  600. var ring = new OpenLayers.Geometry.LinearRing(points);
  601. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  602.  
  603. }
  604.  
  605. NewPlace.attributes.categories.push(category);
  606. if(category === resCategory){
  607. NewPlace._originalResidential = true;
  608. NewPlace.attributes.residential = true;
  609. }
  610. NewPlace.attributes.lockRank = Number(settings.DefaultLockLevel);
  611.  
  612. var closestSeg = WazeWrap.Geometry.findClosestSegment(new OL.Geometry.Point(pos.lon, pos.lat), settings.SkipPLR, settings.SkipPLR);
  613.  
  614. W.model.actionManager.add(new AddPlace(NewPlace));
  615. Waze.selectionManager.select([NewPlace]);
  616.  
  617. if(closestSeg){ //if we were able to find a segment, try to pull the city and/or street name if the options are enabled
  618. var newAttributes, UpdateFeatureAddress = require('Waze/Action/UpdateFeatureAddress'), address = closestSeg.getAddress();
  619.  
  620. newAttributes = {
  621. countryID: address.country.id,
  622. stateID: address.state.id,
  623. emptyCity: address.city.attributes.name ? null : true,
  624. emptyStreet: address.street.name ? null : true
  625. };
  626.  
  627. if(settings.UseStreetFromClosestSeg)
  628. newAttributes.streetName = address.street.name;
  629. else
  630. newAttributes.emptyStreet = true;
  631.  
  632. if(settings.UseCityFromClosestSeg){
  633. var cityName = address.city.attributes.name;
  634.  
  635. if(settings.UseAltCity && cityName === ""){
  636. if(address.altStreets.length > 0){ //segment has alt names
  637. for(var j=0;j<closestSeg.attributes.streetIDs.length;j++){
  638. var altCity = W.model.cities.get(W.model.streets.get(closestSeg.attributes.streetIDs[j]).cityID).attributes;
  639.  
  640. if(altCity.englishName !== null && altCity.englishName !== "")
  641. cityName = altCity.englishName;
  642. }
  643. }
  644. }
  645. if(cityName !== "")
  646. newAttributes.emptyCity = null;
  647. newAttributes.cityName = cityName;
  648. }
  649. else
  650. newAttributes.emptyCity = true;
  651.  
  652. multiaction.doSubAction(new UpdateFeatureAddress(NewPlace, newAttributes));
  653. W.model.actionManager.add(multiaction);
  654. }
  655. else
  656. console.log("WMEPIE - No segment found; cannot set street or city name.");
  657.  
  658. if(category === resCategory && settings.EditRPPAfterCreated)
  659. editRPPAddress();
  660. }
  661.  
  662. function editRPPAddress(rppTries){
  663. rppTries = rppTries || 1;
  664.  
  665. if ($('.edit-button').length > 0) {
  666. $('.edit-button').trigger("click");
  667. $('.house-number:first').focus();
  668.  
  669. } else if (rppTries < 1000) {
  670. console.log("not found");
  671. setTimeout(function () {editRPPAddress(rppTries++);}, 200);
  672. }
  673. }
  674.  
  675. function buildItemOption(itemNumber){
  676. var $section = $("<div>", {style:"padding:8px 16px", id:"piePlaceCat" + itemNumber});
  677. $section.html([
  678. 'Item ',
  679. itemNumber,
  680. buildItemList(itemNumber),
  681. '</br>'
  682. ].join(' '));
  683.  
  684. return $section.html();
  685. }
  686.  
  687. function buildLockLevelsList(){
  688. var $lockLevels = $("<div>");
  689. for(var i=0;i<WazeWrap.User.Rank();i++){
  690. $lockLevels.append("<option value=" + i + ">" + (i+1) + "</option>");
  691. }
  692. return $lockLevels.html();
  693. }
  694.  
  695. function attachRPPLockButtonHandlers(){
  696. $('#pieRPPLockButtonsContainer').remove();
  697. W.selectionManager.events.register("selectionchanged", null, addLockButtons);
  698. W.model.actionManager.events.register("afterundoaction",null, addLockButtons);
  699. W.model.actionManager.events.register("afterclearactions",null, addLockButtons);
  700. W.model.actionManager.events.register("afteraction",null, addLockButtons);
  701. }
  702.  
  703. function attachPlaceSizeHandlers(){
  704. W.selectionManager.events.register("selectionchanged", null, updatePlaceSizeDisplay);
  705. W.model.actionManager.events.register("afteraction",null, updatePlaceSizeDisplay);
  706. W.model.actionManager.events.register("afterundoaction",null, updatePlaceSizeDisplay);
  707. W.model.actionManager.events.register("afterclearactions",null, updatePlaceSizeDisplay);
  708. W.model.actionManager.events.register("noActions",null, noActions);
  709. updatePlaceSizeDisplay();
  710. }
  711.  
  712. function removePlaceSizeHandlers(){
  713. W.selectionManager.events.unregister("selectionchanged", null, updatePlaceSizeDisplay);
  714. W.model.actionManager.events.unregister("afteraction",null, updatePlaceSizeDisplay);
  715. W.model.actionManager.events.unregister("afterundoaction",null, updatePlaceSizeDisplay);
  716. W.model.actionManager.events.unregister("afterclearactions",null, updatePlaceSizeDisplay);
  717. W.model.actionManager.events.unregister("noActions",null, noActions);
  718. }
  719.  
  720. function ShowPlaceLocatorCrosshair(){
  721. $('#pieCrosshairs').remove();
  722. if(W.selectionManager.selectedItems.length > 0){
  723. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  724. var panelWidth = $('#landmark-edit-general').width();
  725. var $crosshairs;
  726. if(W.selectionManager.selectedItems[0].model.attributes.categories.contains("RESIDENCE_HOME")){
  727. $('.landmark > .tab-content').css('position', 'relative');
  728. $crosshairs = $('<div style="position:absolute; z-index:100; cursor:pointer; top:0; right:0;" id="pieCrosshairs" title="Zoom and center on Place"><i class="fa fa-crosshairs fa-lg" aria-hidden="true"></i></div>');
  729. $('.landmark > .tab-content').append($crosshairs);
  730. }
  731. else{
  732. $crosshairs = $('<div style="float:right; z-index:100; cursor:pointer; top:0; right:0;" id="pieCrosshairs" title="Zoom and center on Place"><i class="fa fa-crosshairs fa-lg" aria-hidden="true"></i></div>');
  733. $('#landmark-edit-general > form > div:nth-child(1) > i').after($crosshairs);
  734. }
  735. $('#pieCrosshairs').click(function(){
  736. CenterOnPlace(W.selectionManager.selectedItems[0].model, settings.PlaceZoom);
  737. });
  738. }
  739. }
  740. }
  741.  
  742. function ShowParkingLotButton(){
  743. $('#piePLAButton').remove();
  744.  
  745. if(W.selectionManager.selectedItems.length > 0){
  746. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  747. var $PLAButton;
  748. if(!(W.selectionManager.selectedItems[0].model.attributes.categories.contains("RESIDENCE_HOME") || W.selectionManager.selectedItems[0].model.attributes.categories.contains("PARKING_LOT"))){
  749. $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>');
  750. $('#landmark-edit-general > form > div:nth-child(1) > i').after($PLAButton);
  751.  
  752. $('#piePLAButton').click(function(){
  753. businessPLAPlaceName = W.selectionManager.selectedItems[0].model.attributes.name;
  754. businessPLAPlaceAddress = W.selectionManager.selectedItems[0].model.getAddress().attributes;
  755. //businessPLAPlacePhone = W.selectionManager.selectedItems[0].model.attributes.phone;
  756. //businessPLAPlaceURL = W.selectionManager.selectedItems[0].model.attributes.url;
  757. startBusinessPLAPlacementMode();
  758. });
  759. }
  760. }
  761. }
  762. }
  763.  
  764. function ShowSearchButton(){
  765. $('#pieSearchButton').remove();
  766. if(W.selectionManager.selectedItems.length > 0){
  767. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  768. 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>');
  769. $('.address-edit-view').before($search);
  770. $('#pieSearchButton').click(function(){
  771. var address = $('.full-address')[0].innerHTML;
  772. var noCity = I18n.translations[I18n.currentLocale()].edit.address.no_city;
  773. var noStreet = I18n.translations[I18n.currentLocale()].edit.address.no_street;
  774.  
  775. address = address.replace(noCity + ",","");
  776. if(address !== I18n.translations[I18n.currentLocale()].edit.landmark.no_address)
  777. $('.search-query')[0].value = address;
  778. });
  779. }
  780. }
  781. }
  782.  
  783. function AddPlaceCategoriesButtons(){
  784. $('#piePlaceCategoriesButtonsContainer').remove();
  785. if(W.selectionManager.selectedItems.length > 0){
  786. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  787. var $container = $('<div>',{id:'piePlaceCategoriesButtonsContainer', style:'white-space: nowrap;'});
  788. var categoryOptions = $('[id^=pieItem]');
  789.  
  790. var $button = $('<div>',{id:'btnPlaceCatClear', title:'Clear current categories', style:'display:inline-block; cursor:pointer'}).click(function() { onPlaceCategoriesButtonsClick(this.id); });
  791. $button.append('<span class="fa fa-times" style="font-size:20px; color:red;"></span>');
  792. $container.append($button);
  793.  
  794. for(var i=0;i<categoryOptions.length;i++){
  795. var name = categoryOptions[i].options[categoryOptions[i].selectedIndex].innerHTML;
  796. var icon = categoryOptions[i].options[categoryOptions[i].selectedIndex].getAttribute("data-icon");
  797. var divid = 'btnPlaceCat' + categoryOptions[i].value;
  798. if(categoryOptions[i].value !== resCategory && categoryOptions[i].value !== "PARKING_LOT"){
  799. $button = $('<div>',{id:divid, title:name.replace('&amp;', '&'), style:'display:inline-block; cursor:pointer', 'data-category':categoryOptions[i].value}).click(function() { onPlaceCategoriesButtonsClick(this.id); });
  800. $button.append('<span class="'+icon+'" style="font-size:20px;"></span>');
  801.  
  802. $container.append($button);
  803. }
  804. }
  805. }
  806.  
  807. $('.categories.controls').before($container);
  808. }
  809. }
  810.  
  811. function onPlaceCategoriesButtonsClick(buttonid){
  812. if(buttonid === "btnPlaceCatClear"){
  813. var blankCategories = []; //W.selectionManager.selectedItems[0].model.attributes.categories.clone();
  814. //console.log(blankCategories.length);
  815. //blankCategories.splice(0, blankCategories.length);
  816. //console.log(blankCategories);
  817. W.model.actionManager.add(new UpdateObject(W.selectionManager.selectedItems[0].model, { categories: blankCategories }));
  818. }
  819. else{
  820. var newCategories = W.selectionManager.selectedItems[0].model.attributes.categories.clone();
  821. //console.log($('#'+buttonid)[0].getAttribute("data-category"));
  822. newCategories.push($('#'+buttonid)[0].getAttribute("data-category"));
  823. W.model.actionManager.add(new UpdateObject(W.selectionManager.selectedItems[0].model, {categories: newCategories}));
  824. }
  825. }
  826.  
  827. function CenterOnPlace(venue, zoom){
  828. var centroid = venue.geometry.getCentroid();
  829. W.map.setCenter([centroid.x, centroid.y], zoom);
  830. }
  831.  
  832. function isChecked(checkboxId) {
  833. return $('#' + checkboxId).is(':checked');
  834. }
  835.  
  836. function setChecked(checkboxId, checked) {
  837. $('#' + checkboxId).prop('checked', checked);
  838. }
  839.  
  840. function noActions(){
  841. 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.
  842. }
  843.  
  844. function updatePlaceSizeDisplay(){
  845. var count = W.selectionManager.selectedItems.length;
  846. var metersArea = 0;
  847. var bold = false;
  848. if(count === 1){
  849. var venue = W.selectionManager.selectedItems[0];
  850. var isArea = venue.geometry.toString().match(/^POLYGON/);
  851. //var isPoint = venue.geometry.toString().match(/^POINT/);
  852.  
  853. if(venue.model.type === "venue" && isArea){
  854. if($('#AreaSize'))
  855. $('#AreaSize').remove();
  856. metersArea = W.selectionManager.selectedItems[0].model.geometry.getGeodesicArea(W.map.getProjectionObject());
  857.  
  858. if(metersArea > 0 && isArea){
  859. var ftArea = Math.round(metersArea * 10.76391 *100)/100;
  860.  
  861. var list = $('#landmark-edit-general > ul')[0];
  862. var newList = document.createElement("UL");
  863. newList.id = "AreaSize";
  864.  
  865. var newItem = document.createElement("LI");
  866. if(isChecked("_cbShowAreaPlaceSizeMetric")){
  867. newItem.innerHTML = "Area: " + metersArea.toFixed(2) + " m<sup>2</sup>";
  868. newList.appendChild(newItem);
  869. }
  870.  
  871. if(isChecked("_cbShowAreaPlaceSizeImperial")){
  872. newItem = document.createElement("LI");
  873. newItem.innerHTML = "Area: " + ftArea.toFixed(2) + " ft<sup>2</sup>";
  874. newList.appendChild(newItem);
  875. }
  876. if(metersArea < 500){
  877. newItem = document.createElement("LI");
  878. 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>";
  879. newList.appendChild(newItem);
  880. }
  881. if(metersArea > 20000){
  882. newItem = document.createElement("LI");
  883. 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>";
  884. newList.appendChild(newItem);
  885. }
  886. if(list.before != null)
  887. list.before(newList);
  888. else{
  889. var parent = $('#landmark-edit-general > ul')[0].parentNode;
  890. parent.insertBefore(newList,$('#landmark-edit-general > ul')[0]);
  891. }
  892.  
  893. $('#AreaSize').addClass("list-unstyled");
  894. $('#AreaSize').addClass("additional-attributes");
  895. }
  896. }
  897. }
  898. }
  899.  
  900. function loadSettings() {
  901. var loadedSettings = $.parseJSON(localStorage.getItem("WMEPIE_Settings"));
  902. var defaultSettings = {
  903. ShowAreaPlaceSize: false,
  904. ShowAreaPlaceSizeImperial: false,
  905. ShowAreaPlaceSizeMetric: false,
  906. ShowLockButtonsRPP: true,
  907. NewPlacesList: W.Config.venues.categories.clone(),
  908. EditRPPAfterCreated: false,
  909. UseStreetFromClosestSeg: false,
  910. UseCityFromClosestSeg: false,
  911. ShowPlaceLocatorCrosshair: false,
  912. PlaceZoom: 6,
  913. DefaultLockLevel: 0,
  914. CreateResidentialPlaceShortcut: "A+r",
  915. CreateParkingLotShortcut: "A+p",
  916. UseAltCity: false,
  917. ShowSearchButton: false,
  918. AddPlaceCategoriesButtons: false,
  919. SkipPLR: false,
  920. ShowParkingLotButton: false,
  921. ShowPlaceNames: false,
  922. ShowPlaceNamesPoint: false,
  923. ShowPlaceNamesArea: false,
  924. ShowPlaceNamesLock: false
  925. };
  926. settings = loadedSettings ? loadedSettings : defaultSettings;
  927. for (var prop in defaultSettings) {
  928. if (!settings.hasOwnProperty(prop))
  929. settings[prop] = defaultSettings[prop];
  930. }
  931.  
  932. if(settings.ShowAreaPlaceSizeImperial === false && settings.ShowAreaPlaceSizeMetric === false)
  933. if(Waze.prefs.attributes.isImperial)
  934. settings.ShowAreaPlaceSizeImperial = true;
  935. else
  936. settings.ShowAreaPlaceSizeMetric = true;
  937. }
  938.  
  939. function saveSettings() {
  940. if (localStorage) {
  941. var localsettings = {
  942. ShowAreaPlaceSize: settings.ShowAreaPlaceSize,
  943. ShowAreaPlaceSizeImperial: settings.ShowAreaPlaceSizeImperial,
  944. ShowAreaPlaceSizeMetric: settings.ShowAreaPlaceSizeMetric,
  945. ShowLockButtonsRPP: settings.ShowLockButtonsRPP,
  946. NewPlacesList: settings.NewPlacesList,
  947. EditRPPAfterCreated: settings.EditRPPAfterCreated,
  948. UseStreetFromClosestSeg: settings.UseStreetFromClosestSeg,
  949. UseCityFromClosestSeg: settings.UseCityFromClosestSeg,
  950. ShowPlaceLocatorCrosshair: settings.ShowPlaceLocatorCrosshair,
  951. PlaceZoom: settings.PlaceZoom,
  952. DefaultLockLevel: settings.DefaultLockLevel,
  953. CreateResidentialPlaceShortcut: settings.CreateResidentialPlaceShortcut,
  954. CreateParkingLotShortcut: settings.CreateParkingLotShortcut,
  955. UseAltCity: settings.UseAltCity,
  956. ShowSearchButton: settings.ShowSearchButton,
  957. AddPlaceCategoriesButtons: settings.AddPlaceCategoriesButtons,
  958. SkipPLR: settings.SkipPLR,
  959. ShowParkingLotButton: settings.ShowParkingLotButton,
  960. ShowPlaceNames: settings.ShowPlaceNames,
  961. ShowPlaceNamesPoint: settings.ShowPlaceNamesPoint,
  962. ShowPlaceNamesArea: settings.ShowPlaceNamesArea,
  963. ShowPlaceNamesLock: settings.ShowPlaceNamesLock
  964. };
  965.  
  966. for (var name in Waze.accelerators.Actions) {
  967. var TempKeys = "";
  968. if (Waze.accelerators.Actions[name].group == 'wmepie') {
  969. if (Waze.accelerators.Actions[name].shortcut) {
  970. if (Waze.accelerators.Actions[name].shortcut.altKey === true) {
  971. TempKeys += 'A';
  972. }
  973. if (Waze.accelerators.Actions[name].shortcut.shiftKey === true) {
  974. TempKeys += 'S';
  975. }
  976. if (Waze.accelerators.Actions[name].shortcut.ctrlKey === true) {
  977. TempKeys += 'C';
  978. }
  979. if (TempKeys !== "") {
  980. TempKeys += '+';
  981. }
  982. if (Waze.accelerators.Actions[name].shortcut.keyCode) {
  983. TempKeys += Waze.accelerators.Actions[name].shortcut.keyCode;
  984. }
  985. } else {
  986. TempKeys = "-1";
  987. }
  988. localsettings[name] = TempKeys;
  989. }
  990. }
  991.  
  992. localStorage.setItem("WMEPIE_Settings", JSON.stringify(localsettings));
  993. }
  994. }
  995.  
  996. //Using the same display for lock buttons as ClickSaver (with permission from MapoMatic) - thanks MoM!
  997. function addLockButtons() {
  998. if(W.selectionManager.selectedItems.length > 0){
  999. var item = W.selectionManager.selectedItems[0];
  1000. var isRPP = (item.model.type === "venue" && item.model.attributes.residential === true);
  1001.  
  1002. if(isRPP){
  1003. var attr = item.model.attributes;
  1004. var autoRank = attr.rank;
  1005. var manualRank = attr.lockRank;
  1006. var firstManualRank = manualRank;
  1007. var userRank = WazeWrap.User.Rank() - 1;
  1008. var maxAutoRank = autoRank;
  1009. var disabled = false;
  1010.  
  1011. var $div = $('#pieRPPLockButtonsContainer');
  1012. $div.remove();
  1013. $div = $('<div>',{id:'pieRPPLockButtonsContainer',style:'margin-bottom:5px;'});
  1014. $div.append('<label class="control-label">Lock</label>');
  1015. var btnInfos = [];
  1016.  
  1017. for(var iBtn=0;iBtn<=6;iBtn++){btnInfos.push({r:iBtn,val:iBtn});}
  1018. btnInfos.forEach(function(btnInfo){
  1019. var selected = (btnInfo.val == manualRank);
  1020. disabled = userRank < btnInfo.val;
  1021. if (btnInfo.val !== 6) {
  1022. $div.append(
  1023. $('<div>', {
  1024. class:'btn btn-lh' + (selected ? ' btn-lh-selected':'') + (btnInfo.r < 6 & (userRank < btnInfo.r || disabled) ? ' disabled' : '')
  1025. })
  1026. .text(btnInfo.hasOwnProperty('title') ? btnInfo.title : btnInfo.r + 1)
  1027. .data('val',btnInfo.hasOwnProperty('val') ? btnInfo.val : btnInfo.r + 1)
  1028. .hover(function() {})
  1029. .click(function() {
  1030. if((userRank >= $(this).data('val')) && (btnInfo.r < 6)) {
  1031. W.model.actionManager.add(new UpdateObject(item.model,{lockRank:($(this).data('val'))}));
  1032. addLockButtons();
  1033. }
  1034. })
  1035. );
  1036. }
  1037. });
  1038. $('#landmark-edit-general > div.address-edit.side-panel-section').after($div);
  1039. }
  1040. }
  1041. }
  1042.  
  1043. function buildItemList(itemNumber){
  1044.  
  1045. var $places = $("<div>");
  1046. $places.html([
  1047. '<select id="pieItem' + itemNumber + '">',
  1048. '<option value="CAR_SERVICES" data-icon="waze-icon-place-car" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_SERVICES + '</option>',
  1049. '<option value="GAS_STATION" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.GAS_STATION + '</option>',
  1050. '<option value="GARAGE_AUTOMOTIVE_SHOP" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.GARAGE_AUTOMOTIVE_SHOP + '</option>',
  1051. '<option value="CAR_WASH" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_WASH + '</option>',
  1052. '<option value="CHARGING_STATION" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.CHARGING_STATION + '</option>',
  1053. '<option value="TRANSPORTATION" data-icon="waze-icon-place-transportation" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.TRANSPORTATION + '</option>',
  1054. '<option value="AIRPORT" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.AIRPORT + '</option>',
  1055. '<option value="BUS_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.BUS_STATION + '</option>',
  1056. '<option value="FERRY_PIER" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.FERRY_PIER + '</option>',
  1057. '<option value="SEAPORT_MARINA_HARBOR" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.SEAPORT_MARINA_HARBOR + '</option>',
  1058. '<option value="SUBWAY_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.SUBWAY_STATION + '</option>',
  1059. '<option value="TRAIN_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TRAIN_STATION + '</option>',
  1060. '<option value="BRIDGE" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.BRIDGE + '</option>',
  1061. '<option value="TUNNEL" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TUNNEL + '</option>',
  1062. '<option value="TAXI_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TAXI_STATION + '</option>',
  1063. '<option value="JUNCTION_INTERCHANGE" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.JUNCTION_INTERCHANGE + '</option>',
  1064. '<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>',
  1065. '<option value="COLLEGE_UNIVERSITY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.COLLEGE_UNIVERSITY + '</option>',
  1066. '<option value="SCHOOL" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.SCHOOL + '</option>',
  1067. '<option value="CONVENTIONS_EVENT_CENTER" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.CONVENTIONS_EVENT_CENTER + '</option>',
  1068. '<option value="GOVERNMENT" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.GOVERNMENT + '</option>',
  1069. '<option value="LIBRARY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.LIBRARY + '</option>',
  1070. '<option value="CITY_HALL" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.CITY_HALL + '</option>',
  1071. '<option value="ORGANIZATION_OR_ASSOCIATION" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.ORGANIZATION_OR_ASSOCIATION + '</option>',
  1072. '<option value="PRISON_CORRECTIONAL_FACILITY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.PRISON_CORRECTIONAL_FACILITY + '</option>',
  1073. '<option value="COURTHOUSE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.COURTHOUSE + '</option>',
  1074. '<option value="CEMETERY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.CEMETERY + '</option>',
  1075. '<option value="FIRE_DEPARTMENT" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.FIRE_DEPARTMENT + '</option>',
  1076. '<option value="POLICE_STATION" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.POLICE_STATION + '</option>',
  1077. '<option value="MILITARY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.MILITARY + '</option>',
  1078. '<option value="HOSPITAL_URGENT_CARE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.HOSPITAL_URGENT_CARE + '</option>',
  1079. '<option value="DOCTOR_CLINIC" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.DOCTOR_CLINIC + '</option>',
  1080. '<option value="OFFICES" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.OFFICES + '</option>',
  1081. '<option value="POST_OFFICE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.POST_OFFICE + '</option>',
  1082. '<option value="RELIGIOUS_CENTER" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.RELIGIOUS_CENTER + '</option>',
  1083. '<option value="KINDERGARTEN" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.KINDERGARDEN + '</option>',
  1084. '<option value="FACTORY_INDUSTRIAL" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.FACTORY_INDUSTRIAL + '</option>',
  1085. '<option value="EMBASSY_CONSULATE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.EMBASSY_CONSULATE + '</option>',
  1086. '<option value="INFORMATION_POINT" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.INFORMATION_POINT + '</option>',
  1087. '<option value="EMERGENCY_SHELTER" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.EMERGENCY_SHELTER + '</option>',
  1088. '<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>',
  1089. '<option value="ARTS_AND_CRAFTS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.ARTS_AND_CRAFTS + '</option>',
  1090. '<option value="BANK_FINANCIAL" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.BANK_FINANCIAL + '</option>',
  1091. '<option value="SPORTING_GOODS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SPORTING_GOODS + '</option>',
  1092. '<option value="BOOKSTORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.BOOKSTORE + '</option>',
  1093. '<option value="PHOTOGRAPHY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PHOTOGRAPHY + '</option>',
  1094. '<option value="CAR_DEALERSHIP" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_DEALERSHIP + '</option>',
  1095. '<option value="FASHION_AND_CLOTHING" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.FASHION_AND_CLOTHING + '</option>',
  1096. '<option value="CONVENIENCE_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CONVENIENCE_STORE + '</option>',
  1097. '<option value="PERSONAL_CARE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PERSONAL_CARE + '</option>',
  1098. '<option value="DEPARTMENT_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.DEPARTMENT_STORE + '</option>',
  1099. '<option value="PHARMACY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PHARMACY + '</option>',
  1100. '<option value="ELECTRONICS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.ELECTRONICS + '</option>',
  1101. '<option value="FLOWERS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.FLOWERS + '</option>',
  1102. '<option value="FURNITURE_HOME_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.FURNITURE_HOME_STORE + '</option>',
  1103. '<option value="GIFTS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.GIFTS + '</option>',
  1104. '<option value="GYM_FITNESS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.GYM_FITNESS + '</option>',
  1105. '<option value="SWIMMING_POOL" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SWIMMING_POOL + '</option>',
  1106. '<option value="HARDWARE_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.HARDWARE_STORE + '</option>',
  1107. '<option value="MARKET" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.MARKET + '</option>',
  1108. '<option value="SUPERMARKET_GROCERY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SUPERMARKET_GROCERY + '</option>',
  1109. '<option value="JEWELRY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.JEWELRY + '</option>',
  1110. '<option value="LAUNDRY_DRY_CLEAN" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.LAUNDRY_DRY_CLEAN + '</option>',
  1111. '<option value="SHOPPING_CENTER" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SHOPPING_CENTER + '</option>',
  1112. '<option value="MUSIC_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSIC_STORE + '</option>',
  1113. '<option value="PET_STORE_VETERINARIAN_SERVICES" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PET_STORE_VETERINARIAN_SERVICES + '</option>',
  1114. '<option value="TOY_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.TOY_STORE + '</option>',
  1115. '<option value="TRAVEL_AGENCY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.TRAVEL_AGENCY + '</option>',
  1116. '<option value="ATM" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.ATM + '</option>',
  1117. '<option value="CURRENCY_EXCHANGE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CURRENCY_EXCHANGE + '</option>',
  1118. '<option value="CAR_RENTAL" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_RENTAL + '</option>',
  1119. '<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>',
  1120. '<option value="RESTAURANT" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.RESTAURANT + '</option>',
  1121. '<option value="BAKERY" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.BAKERY + '</option>',
  1122. '<option value="DESSERT" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.DESSERT + '</option>',
  1123. '<option value="CAFE" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.CAFE + '</option>',
  1124. '<option value="FAST_FOOD" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.FAST_FOOD + '</option>',
  1125. '<option value="FOOD_COURT" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.FOOD_COURT + '</option>',
  1126. '<option value="BAR" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.BAR + '</option>',
  1127. '<option value="ICE_CREAM" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.ICE_CREAM + '</option>',
  1128. '<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>',
  1129. '<option value="ART_GALLERY" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.ART_GALLERY + '</option>',
  1130. '<option value="CASINO" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.CASINO + '</option>',
  1131. '<option value="CLUB" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.CLUB + '</option>',
  1132. '<option value="TOURIST_ATTRACTION_HISTORIC_SITE" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.TOURIST_ATTRACTION_HISTORIC_SITE + '</option>',
  1133. '<option value="MOVIE_THEATER" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.MOVIE_THEATER + '</option>',
  1134. '<option value="MUSEUM" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSEUM + '</option>',
  1135. '<option value="MUSIC_VENUE" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSIC_VENUE + '</option>',
  1136. '<option value="PERFORMING_ARTS_VENUE" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.PERFORMING_ARTS_VENUE + '</option>',
  1137. '<option value="GAME_CLUB" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.GAME_CLUB + '</option>',
  1138. '<option value="STADIUM_ARENA" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.STADIUM_ARENA + '</option>',
  1139. '<option value="THEME_PARK" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.THEME_PARK + '</option>',
  1140. '<option value="ZOO_AQUARIUM" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.ZOO_AQUARIUM + '</option>',
  1141. '<option value="RACING_TRACK" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.RACING_TRACK + '</option>',
  1142. '<option value="THEATER" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.THEATER + '</option>',
  1143. '<option value="OTHER" data-icon="waze-icon-place" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.OTHER + '</option>',
  1144. '<option value="CONSTRUCTION_SITE" data-icon="">' + I18n.translations[I18n.currentLocale()].venues.categories.CONSTRUCTION_SITE + '</option>',
  1145. '<option value="LODGING" data-icon="waze-icon-place-lodging" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.LODGING + '</option>',
  1146. '<option value="HOTEL" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.HOTEL + '</option>',
  1147. '<option value="HOSTEL" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.HOSTEL + '</option>',
  1148. '<option value="CAMPING_TRAILER_PARK" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.CAMPING_TRAILER_PARK + '</option>',
  1149. '<option value="COTTAGE_CABIN" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.COTTAGE_CABIN + '</option>',
  1150. '<option value="BED_AND_BREAKFAST" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.BED_AND_BREAKFAST + '</option>',
  1151. '<option value="OUTDOORS" data-icon="waze-icon-place-outdoors" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.OUTDOORS + '</option>',
  1152. '<option value="PARK" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PARK + '</option>',
  1153. '<option value="PLAYGROUND" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PLAYGROUND + '</option>',
  1154. '<option value="BEACH" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.BEACH + '</option>',
  1155. '<option value="SPORTS_COURT" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SPORTS_COURT + '</option>',
  1156. '<option value="GOLF_COURSE" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.GOLF_COURSE + '</option>',
  1157. '<option value="PLAZA" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PLAZA + '</option>',
  1158. '<option value="PROMENADE" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PROMENADE + '</option>',
  1159. '<option value="POOL" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.POOL + '</option>',
  1160. '<option value="SCENIC_LOOKOUT_VIEWPOINT" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SCENIC_LOOKOUT_VIEWPOINT + '</option>',
  1161. '<option value="SKI_AREA" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SKI_AREA + '</option>',
  1162. '<option value="NATURAL_FEATURES" data-icon="waze-icon-place-natural" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.NATURAL_FEATURES + '</option>',
  1163. '<option value="ISLAND" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.ISLAND + '</option>',
  1164. '<option value="SEA_LAKE_POOL" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.SEA_LAKE_POOL + '</option>',
  1165. '<option value="RIVER_STREAM" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.RIVER_STREAM + '</option>',
  1166. '<option value="FOREST_GROVE" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.FOREST_GROVE + '</option>',
  1167. '<option value="FARM" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.FARM + '</option>',
  1168. '<option value="CANAL" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.CANAL + '</option>',
  1169. '<option value="SWAMP_MARSH" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.SWAMP_MARSH + '</option>',
  1170. '<option value="DAM" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.DAM + '</option>',
  1171. '<option value="PARKING_LOT" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.PARKING_LOT + '</option>',
  1172. '<option value="RESIDENCE_HOME" data-icon="waze-icon-house" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.RESIDENCE_HOME + '</option>',
  1173. '</select>'
  1174. ].join(' '));
  1175.  
  1176. return $places.html();
  1177. }
  1178.  
  1179. function injectCss() {
  1180. var css = [
  1181. // Lock button formatting
  1182. '.btn-lh {cursor:pointer;padding:1px 6px;height:22px;border:solid 1px #c1c1c1;margin-right:3px;}',
  1183. '.btn.btn-lh.btn-lh-selected {background-color:#6999ae;color:white}',
  1184. '.btn.btn-lh.btn-lh-selected:hover {color:white}',
  1185. '.btn.btn-lh.disabled {color:#909090;background-color:#f7f7f7;}',
  1186. '.btn.btn-lh.btn-lh-selected.disabled {color:white;background-color:#6999ae;}',
  1187. //Settings Panel
  1188. '#sidebar .controls-container.pie-controls-container {padding: 0px;}',
  1189. '.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;}',
  1190. '@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;}',
  1191.  
  1192. ].join(' ');
  1193. $('<style type="text/css">' + css + '</style>').appendTo('head');
  1194. }
  1195.  
  1196. function listPlaces(){
  1197. var category = "";
  1198. for(i=0; i<W.Config.venues.categories.length; i++){
  1199. category = W.Config.venues.categories[i];
  1200. console.log(category + " Main");
  1201. var subCategories = W.Config.venues.subcategories[category];
  1202. for(var j=0; j<subCategories.length;j++){
  1203. console.log(subCategories[j]);
  1204. }
  1205. }
  1206. }
  1207. })();