WME Place Interface Enhancements

Enhancements to various Place interfaces

目前為 2017-03-27 提交的版本,檢視 最新版本

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