WME Place Interface Enhancements

Enhancements to various Place interfaces

当前为 2017-06-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name WME Place Interface Enhancements
  3. // @namespace https://greasyfork.org/users/30701-justins83-waze
  4. // @version 1.02.02
  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+sq5e6zi7JQhTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj6hc6MK2cfaS6jasbzENbTtWZalzLyioBk4GdPBu6ceuL6pR70aWrzRs3rblls2LmVZkOlXLfvj2oqTWa91uLRbsvmrYAAAAAAAAAAAAAAAAAAAAAAAAAACzLKh53zUPXs7Yrs+Jtt03a7+i6k9ut7s1bKgWMyj0nFtrXOS6vibVnad2to3jZqMouLaa2a6mi8oqAAPVdkqpKUJOMl2oxMb92YnbsmcLX+UMlf90v8AKILYv+KeuXymK7YXQUoSUovtRBMbd08Tv2ezDIAAAAAAAAAAAAAAAAAAAAAB4uuhj1yssl0YrmzMRMztDEzERvKAzdctv3jT9VDv7WWa44jurWyTPSGfoEIrDc11zlJ9JkWT5tkmLskyJMAAInVtI8+3dSvrPtR94npfbpKC9N+sICUXCTUk01zTLKsoAAAX8bMtxJ9Kqbj3rsZrNYt3bRaa9k5ha3VkbRt+qn48mVrY5jssVyRPdJJ7kSZUAAAAAAAAAAAAAAAAAAAAEHxHZLemv7Ozl8yxijvKvlntCFLCuzdN1KWBN7rpVy5x/VEd6cySl+VseNl1ZcOlVNS712oqzWa91qLRbsvGrYAAYuZp1OavXjtLsmuZvW017NLVi3dA5ukXYm8kvOV+9Hs+JZreLK1qTVgkiMAAAM3C1W7D2SfTr92X6EdqRZJW81bBhahVnQ3g9pLnF80VrVmvdZraLdmSaNwAAAAAAAAAAAAAAAAAAYGr4DzKE4f7kOtLv8CSluWeqO9eaGstOLaa2a7GXFNQD3XbOmalCTjJdqMTG/dmJ27JjC1/faGSv+8V/lEFsXrCeuXyma7I2xUoSUovtRBtsnid+z0YZAAEdm6LVk7yr+qs8OTJa5JjuitjieyBysK7DltZHZdklyZZraLdlaazXusGzUAAe6bp0WRnCXRkuTMTET0lmJmJ3htWBmLNx42Lqlyku5lO1eWdl2tuaN2SaNgAAAAAAAAAAAAAAAAAAYWdpVObvJroWe+v1JK3mqO1IsgczTbsJ7yj0oe/HkWa3iytak1Yhu0AL+Lm24c+lXLZdsXyZrasW7totNezZcDPhnVdJerNe1HuKlqzWVutotDKNG4AA8zhGyLjOKlF80zO+x3Q+boClvPHez9x8vkT1y/8le2LwhrK5UzcJxcZLmmTxMT1hBMbd3gywATPDkn07o/Z2TK+X0WMXqnSusAAAAAAAAAAAAAAAAAAAAUaUk01un2MCLzdCru3lQ/Nz93sf/0TVyTHdDbHE9kHfj2Y1nQsi4y/yWYmJ6wrTEx0laMsM/RbZV6hBLlLdNEeSN6pMc7WbOU1wAAAAGDquDHLx5SS+tgt0/0JKW5ZR3rzQ1cuKaqW72XWwNl0fCeJjtzW1k+truRUyW5p6LeOvLHVIESUAAAAAAAAAAAAAAAAAAAAAAxNTxoZOJYpL1opyi+5m9J2lpeImGqpNvZLdl1STui6ZKiXn7V0ZbbRi+zxK2S+/SFnHTbrKYIE4AAAALOZfHHxrLJPkurxZtWN52a2naN2sYmBdmy+rj6vbJ8kW7WivdUrWbdk9g6RVh7Sf1lvvPs+BWtebLFccVZ5GlAAAAAAAAAAAAAAAAAAAAAAAGJmqzKrdNPUpdUrHyS7l3m9doneWlt56QYemU4STiulP35cxa82K0irLNG4AAAAKSkorv8ABAYtuH6XNSv9iPs1Ll8X3m8W5ezSa83dlRioRUYpRS5JGjfsqAAAAAAAAAAAAAAAAAAAAAAAAUa3At5GVTh1Oy+2uitc52SUUvmzW160je07Q2rWbTtWN2p6r5XuEdIco26zTbNfYx07X/6po8nLxfRYfmyRP26/6elj4Zq8vak/z0axmftI8NUNqjGz8nxVcYr+7PMv7R6Svy1mf/vu9CvAdTPzTEI2f7Tump+pomXJfzWxRWn2mxemOfzCxHs/l9ckfgh+07prfr6JlxX8tsWI9psXrjn8wT7P5fTJH4SWH+0jw1e0r8bPxvF1xkv7Ms09o9Jb5qzH/wB91e3AdTHyzEtn0ryvcI6u4xq1mmqb+xkJ1P8A9kkeni4vos3y5Ij79P8Abz8nDNXi70n+OrbMfKpzKlbRbXdW+U65KSfzR61b1vG9Z3h5tqzWdrRtK6bNQAAAAAAAAAAAAAAAAAAAAAAAA1ni3yjaDwXW/wB45sfSNt441Xr2y+XZ89jzNXxHTaKP7tuviO6/ptDn1c/269PPo4rxT+0dq+oudWi41emUPqVtm1lr/Rfgzi9V7R58nw6eOWPPef06zTcCw065p5p/EOX6vxDqevXO3Uc/IzJvtusckvguSOZzajNnnfLaZ+7ocWDFhjbHWIR5XTgAAAAASGkcQ6noNyt07PyMOa7abHFP4rkyxh1GbBPNitMfZBlwYs0bZKxLp/Cv7R2r6c4Va1jV6nQup217V2r9H+COm0vtHnx/DqI5o/E/pz2p4Fhv1wzyz+Ydr4S8o2g8aVr93ZsfSNt5YtvqWx+Xb8tztNJxHTa2P7Vuvie7lNToc+kn+5Xp59GzHpvPAAAAAAAAAAAAAAAAAAAAwtX1nC0HBszNQya8TGrW8rLHsvh4vwIc2bHgpOTLO0QlxYr5rRTHG8uA8f8A7QmZqbtwuHVLBxeuLzJr62a/lX2V/f4HA6/2gyZd8el+GPPr/wCO00XBKY9r6jrPj0/9cdvvtyrp23WSttm95Tm9234s4+1ptPNad5dRERWNojows3UqNPhvbNJ9kV1tm9Mdsnywxa0V7sbSNXlqlt/qKFcNuiu35kmXFGKIa0vz7pMrpQCM17UfQcNxi9rbOqPh3ssYMfPbr2hFktywaDqPp2Goye9tfVLx7mM+Pkt07SY7c0JMrpQCM1fV5aXbR6inXPfpLt+RYxYoyxKK9+SYZOFqVGoQ3qmm+2L6miO+O2P5obVtFuzNovtxboW02Sqtg94zg9mn4M0raazzVnaWZiLRtMdHYeAP2g8zTHXh8RKWdi8llwX1sF/MvtL+/wATsNB7QZMW2PVfFHn1/wDXL63glMm99P0nx6f+O/6RrOFr2BXm6fk15WNYt42VvdfB9z8DvsObHnpGTFO8S4vLivhtNMkbSzSZEAAAAAAAAAAAAAAAANO8oHlP0rgHEavksnUJrerDrfrPxl7qPH4hxPDoK/F1t6Q9TRcPy623w9K+svmHjLjrVuONQeTqN7daf1WPDqrrXgv15nzLWa7Nrr8+WftHpD6DpdHh0dOXHH8+stePPXkdrmpPTsROH+7N7R37PEsYcfvLdeyLJblhptls7puc5OcnzbZ68RERtClM790/wjzyf+v6lDV+ixh9WyHnrQBo+s5jzc+yTfqxfRivBHs4aclIhQvbmsaNmPCz65J+rJ9GS8GM1OekwUty2bweMvgGt8Xc8b/t+h6Gk9VXN6ICu2dM1OEnCS5NMvzETG0q8Tt2bloepPUcRuf+7B7S27fE8jNj93bp2Xcd+aEiV0rYODuOtW4Hz1k6be1CTXncefXXYu5r9eZ6Gj12bQ358U/ePSVHVaPFrKcuSP59YfT/AJPvKfpXH+KlRL0bUILe3DsfrLxj7yPpvD+J4dfX4elvWP8A7u+fa3h+XRW+LrX0luJ7DywAAAAAAAAAAAAKN7Ld8gOP+U7y7Y2hK3TdAnDL1DrjPK9qul+HvS/sjkOJ8drg3xabrbz6R+5dRw/g9s22XUdK+PWXzvnZ+RqeXblZd08jItl0p22PeUmfPL5LZbTe87zLuKUrjrFaRtELBo3AIfiTAszMWE605Sre/RXNotae8UttPqgy1m0dGp9CTl0dn0u7brPV3juptu4d0+eFiSlYujZY93F9i7DydRki9to7Qu468sdUsVkwBo+rafZg5dilF9CTbjLsaPZxZIvWFC9ZrJpOn2Z2XWoxfQi05S7EhlyRSslKzaW8HjL4BE8RafPNxIyrXSsre6iu1dpZ0+SKW2ntKHLXmjo1HoSUujs+l3bdZ628d1JtnDeBZh4s52JxlY9+i+aR5WovF7bR6LmKs1jqmCqnAL+Dn5GmZdWViXTx8iqXShbXLaUX8TemS2K0XpO0w0vSuSs1vG8S+iPJh5dsfXfNabr84YmodUa8r2a7n4+7L+zPofDOO1z7YdT0t59J/UuH4hwe2HfLp+tfHrDsCe63XI69y6oAAAAAAAAABEcR8V6VwnhPK1TMrxa9vVjJ7zn4RjzZU1Oqw6SnPmtss4NNl1NuXFXd87+Uby5ahxWrcHS1PTdLfVJp7W3L+ZrkvBHzziPHMur3x4fhp/mXcaDhGPTbZMvxW/xDlxzDogAAAAePNQ6XS6Eel37dZneezGz2YZAAFJRjNbSSku5ob7MEYxgtopRXckN9xUMgADx5qHS6XQj0u/brM7z2Y2ezDIAAAAOo+Tny5ajwoqsHVFPUtLXVFt/W0r+VvmvBnT8O45l0m2PN8VP8w57XcIx6ne+L4bf4l9EcOcV6VxZhRytLzK8qtr1op7Tg+6UeaPoem1eHV058Nt3DZ9Nl01uXLXZLltWAAAABonlb42v4Q0WmGE1DOzJOELGt/NxXtSXj1r8TlvaDid+H4IjF89u0+PMva4Xo66rLM3+WrgP+pNW9L9J/eWX6Rvv5zz0t9/xPk/8AW6nn957y2/neXbf0+Hl5eSNvs2fJ8tfFb0mOLRfjxvS2eU6t7Gv8b+Ox0VPabWxjjHaY387df086OEaT3nPMTt49HL9Y1DUNUzJ5OpX3ZORLnZdJyZ5l89tRbnvbml72LHjx15ccbQxK6Z2vaEXJ+BFNor3SzOzOo0hvZ2y2/lRVtn/4o5v4ZteFTWuqtPxfWV5yXn1RzaZXfNQ9yP4Gm8+WN5eJ4tVi9auL+RtF7R2lneYYl+kQkt65OL7n1onrnmPmbxefVH3YltD9aD271yLVb1t2lJExK0k29kt2btmXRpltvXJebj3vmQ2zVr26tJvEM+rTKa+a6b75FW2a0opvMshU1xXVCK+RFzTPq13kdNcl1wi/kOaY9TeWPbplNnJdB98SWua0NovMMC/TLauuK85HvRarmrbv0SxeJYjTT2a2ZN3brtOJbe/Vg9u98jS1617y1mYhIUaRCK3sk5PuXUirbPM/Kjm8+jLhi1Vr1a4r5EE3tPeWm8y9+ah7kfwNd58sbytWYVNi660vFdRvGS8erMWmGFfpDXXVLf8AlkWa5/8Akki/lgWUzqe04uL8UWYtFuySJ3Zmj6hqGl5kMnTb7sbIjyspk4slpntp7c9LcsosuPHkry5I3h0/G8tfFa0mWLffjyva2WUqtrIr/G/jsepf2m1vu5x1mN/O3X9PBnhGk95zxE7ePRrP+pNW9L9J/eWX6Rvv5zz0t9/xOc/rdTz+895O/neXo/0+Hl5eSNvs795JONr+L9FuhmtTzsOShOxLbzkX7Mn49T/A+sez/E78QwTGX56958+JcTxTR10uWJp8tm9nUvFAOc+WnhHK4j0XGy8Kt3ZGFKUnVHrcoNLfZdrWyOO9peH5NZgrkwxvNN+n0l73CNVTT5JpknaLf7fPcouEnGScZJ7NNdaPkcxMTtLuu/ZQA0nzW4FEkuS2AqAAbgAAACijFPqSXyG8ioAAAAAAKOMW+tJ/IbyKgAAAwBkAKNJ81uASS5LYCoFYxc5KMU5Sb2SS3bERMztBM7dZfQnkW4RyuHNFycvNrdORmyjJVS6nGCT23XY3uz657NcPyaPBbJmjab7dPpDheL6qmoyRTHO8V/26Mdi8EAAadxh5LtH4u6V0q/Q85/8Ak0JJv/kuT/yc7xHgel4hvaY5b+Y/78vV0nEs2l+GJ3r4lxPi7yY6xwlYnZCOZjTbULqOvf4rmmfO9Z7O67S7zWvPXzH67urwcV02bpM8s/X9tSnCVbalFxa7GtjmrUtSdrRtL1otFo3rO4k5PZJt+CMRWbdIjdmZiO6RwuHs/Pa6FEoQf27PVR72k4Fr9ZMcmOYjzPSHm5+JabTx8V958R1bLpvBeNj7SypPIn7q6o//AKfQNB7J6bBtbVTz28do/cuX1PHM2T4cMcsf5TkNOxa4dCONUo93QR1tNDpaV5a4q7faHh21Oe0803nf7o3UOE8DNTcK/R7Per6l+B4et9mtBq4maV5LeY/XZ6Wn4vqcHS080fX9tYz+Es7DbdcPSa++vn+B881vsxrtLMzjjnr9O/4dTp+MabN0tPLP1/aHsqnVLo2QlB90lscvfFkxTtkrMT9YezW9bxvWd3kibsjG0/KzJJU49lnio9X4l7T6DVaqdsOOZ/j/ALVsupw4Y3yXiGwadwRbZtPMsVcf/jr63+J2+g9kMl9r623LHiO/57f7c7qeO0r8Onjf6z2bLiaJg4UUqsavf3pLpN/NnfabhGh0kbYsUfeY3n8y5nNrtTnne95/0pmaJg5kGrMavfb2orotfNDU8I0OrjbJij7xG0/mDDrtTgnel5/255bhuLfQe67mcBr/AGRyU3vo7c0eJ7/ns6fTccpb4dRG31hYlCUOcWjidRoNVpZ2zY5j+P8At0OLU4c0b47xLyUVkSbeyW5LTFkyztSszP0hpa9aRvadl2GNOfNdFeJ1Gi9mddqpickclfr3/DxtRxfTYelZ5p+n7ZEMaEOa6T8T6DovZvQaSIm1ee3mf12cvqOLanPO0Tyx9P2uOuL+yvwPcvodLevJbFWY+0POrqc1Z5ovO/3WbMSL64+q+7sOS1/snps+9tLPJPjvH7h7mm43mx9M0c0f5Y86Jw5x38UcBq+B6/RzPPjmY8x1h0+DiOmz/LfafE9Hg8KazXpMbPRiYnsLrZtSlsk7Ujefoxa0Vje07Nq4J8neo8bXWeYcMbFqaVl9u+yb7Eu1nS6P2c12q2m9eSvmf13eRqOK6bD0rPNP0/buXCHkx0bhFRtrq9LzkuvJvSbX/FckfReH8E0vD9rVjmv5n/rw5TVcRzarpM7V8Q286B5YAAAAMDW9KhrOm2409lJreEvdl2M2rPLO7ExvDj2VhKq+dV9UfOQk4yUop7NE1sWPJ1vWJ+8I4venyzs8Qprr9muEf+MUhXDjp8tYj+GbZL2+aZl7JUYAAAAPMq4z9qKl8VuaWpW/S0btotavaXhYtKe6prT8IIijTYIneKR+IbzmyT3tP5XEtlsupFiIiOkIu6oACkvZfwA5zL2n8TVuoYmN+knZToruX4EE6fDPWaR+ISRlyR2tP5EkiWtK0+WNmk2m3eVTdgAAAAFHFPmkyK2LHf5qxP8ADeL3r8szC9hYVmdl042PX07rZqEIpc2xXHjx/JWI+0E3tf5p3fTXCXDtXC+hY2BXs5xXStmvtzfNkUzvO7MRsmTDIAAAAAADRPKDofQnHUqo9Uto2pd/Y/0J8dvRHaPVpRMjAAAAAAAAAAABSXsv4Ac5l7T+Jq3UAAAAAAAAAAOr+RXhLzltmu5MPVhvXjJrm/tS/T8SK8+jasOwkLcAAAAAAAAs5eLXm41tFselXZFxaMxO3Ucg1bTbNJ1C7Fs5wfU/eXYy3E7xugmNmIZYAAAAAAAAAACkvZfwA5zL2n8TVuoAAAAAAAAAk+G9Cu4k1rG0+hPpWy9aXuR7X8kYmdo3I6vpzTdPp0rAow8eHQopgoRXgitPVKyTAAAAAAAAAANW470P07BWZVHe6hettzlDt/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?version=202721
  14. // @require https://greasyfork.org/scripts/27023-jscolor/code/JSColor.js
  15. // @license GPLv3
  16. // ==/UserScript==
  17. var UpdateObject, MultiAction;
  18.  
  19. (function() {
  20. 'use strict';
  21.  
  22. var curr_ver = "1.02.02"
  23. var settings = {};
  24. var placeMenuSelector = "#edit-buttons > div > div.toolbar-button.waze-icon-place.toolbar-submenu.toolbar-group.toolbar-group-venues.ItemInactive > menu";
  25.  
  26. var placementMode = false;
  27. var resCategory = "RESIDENCE_HOME";
  28. var wazePL;
  29.  
  30. //Layer definitions
  31. {
  32. var layerName = "WME PIE";
  33. var newPlaceLayer, PLSpotEstimatorLayer, PLSpotEstimatorCalibrationLayer;
  34. var PIEPlaceNameLayer;
  35. var showStopPointsLayer;
  36. }
  37.  
  38. //Drawing definitions
  39. {
  40. var drawPoly, PLSpotEstimatordrawControl, PLSpotEstimatorCalibrationdrawControl;
  41. var isDrawing;
  42. var pointStyle = {
  43. pointRadius: 6,
  44. fillOpacity: 0,
  45. strokeColor: '#00ece3',
  46. strokeWidth: '2',
  47. strokeLinecap: 'round'
  48. };
  49.  
  50. //Closest segment
  51. var lineStyleToNavPoint = {
  52. strokeWidth: 3,
  53. strokeColor: '#00ece3',
  54. strokeLinecap: 'round',
  55. strokeDashstyle: 'dash'
  56. },
  57. lineStyleToClosestSeg = {
  58. strokeWidth: 4,
  59. strokeColor: '#00ece3',
  60. strokeLinecap: 'round'
  61. },
  62. pointStyleNavPoint = {
  63. externalGraphic: 'http://i65.tinypic.com/28santx.gif',
  64. graphicWidth: 22,
  65. graphicHeight: 22
  66. },
  67. pointStyle = {
  68. pointRadius: 6,
  69. fillColor: 'white',
  70. fillOpacity: 1,
  71. strokeColor: '#00ece3',
  72. strokeWidth: '3',
  73. strokeLinecap: 'round'
  74. };
  75. }
  76.  
  77. function bootstrap(tries) {
  78. tries = tries || 1;
  79.  
  80. if (window.W &&
  81. window.W.map &&
  82. window.W.model &&
  83. window.W.loginManager.user &&
  84. $ && window.jscolor) {
  85. init();
  86. } else if (tries < 1000) {
  87. setTimeout(function () {bootstrap(tries++);}, 200);
  88. }
  89. }
  90.  
  91. bootstrap();
  92.  
  93. function init(){
  94. loadTranslations();
  95.  
  96. var $section = $("<div>", {style:"padding:8px 16px", id:"WMEPIESettings"});
  97. $section.html([
  98. '<h4 style="margin-bottom:0px;"><b>' + I18n.t('pie.prefs.title') + '</b></h4>',
  99. '<h6 style="margin-top:0px;">' + curr_ver + '</h6>',
  100. '<fieldset id="fieldPlacePanel" style="border: 1px solid silver; padding: 8px; border-radius: 4px;">',
  101. '<legend style="margin-bottom:0px; border-bottom-style:none;width:auto;"><h4>' + I18n.t('pie.prefs.PropertiesPanel') + '</h4></legend>',
  102. '<div class="controls-container pie-controls-container" id="divAreaPlaceSizeControls">',
  103. '<div id="divShowAreaPlaceSize" class="controls-container pie-controls-container"><input type="checkbox" id="_cbShowAreaPlaceSize" class="pieSettingsCheckbox" /><label for="_cbShowAreaPlaceSize">' + I18n.t('pie.prefs.ShowAreaPlaceSize') + '</label></div>',
  104. '<div id="divShowAreaPlaceSizeImperial"class="controls-container pie-controls-container" style="padding-left:20px;"><input type="checkbox" id="_cbShowAreaPlaceSizeImperial" class="pieSettingsCheckbox" disabled /><label for ="_cbShowAreaPlaceSizeImperial">' + I18n.t('pie.prefs.ShowImperial') + '</label></div>',
  105. '<div id="divShowAreaPlaceSizeMetric" class="controls-container pie-controls-container" style="padding-left:20px;"><input type="checkbox" id="_cbShowAreaPlaceSizeMetric" class="pieSettingsCheckbox" disabled /><label for ="_cbShowAreaPlaceSizeMetric">' + I18n.t('pie.prefs.ShowMetric') + '</label></div>',
  106. '</div>',
  107. '<div class="controls-container pie-controls-container" id="divShowLockButtonsRPP" title="' + I18n.t('pie.prefs.ShowRPPLockButtonsTitle') + '"><input type="checkbox" id="_cbShowLockButtonsRPP" class="pieSettingsCheckbox" /><label for="_cbShowLockButtonsRPP" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowRPPLockButtons') + '</label></div>',
  108. '<div class="controls-container pie-controls-container" id="divShowPlaceLocatorCrosshair" title="' + I18n.t('pie.prefs.ShowPlaceLocatorCrosshairTitle') + '" ><input type="checkbox" id="_cbShowPlaceLocatorCrosshair" class="pieSettingsCheckbox" /><label for="_cbShowPlaceLocatorCrosshair" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowPlaceLocatorCrosshair') + '</label></br>',
  109. '<span class="controls-container pie-controls-container" style="padding-left:30px;" title=""><input type="checkbox" id="_cbPlaceLocatorCrosshairProdPL" class="pieSettingsCheckbox" /><label for="_cbPlaceLocatorCrosshairProdPL" style="white-space:pre-line;">' + I18n.t('pie.prefs.ProdPL') + '</label></span></br>',
  110. '<span class="controls-container pie-controls-container" style="padding-left:30px;" title="' + I18n.t('pie.prefs.ZoomTitle') + '">' + I18n.t('pie.prefs.Zoom') + ' <select id="piePlaceZoom"><option value="10">10</option><option value="9">9</option><option value="8">8</option><option value="7">7</option><option value="6">6</option><option value="5">5</option><option value="4">4</option><option value="3">3</option><option value="2">2</option><option value="1">1</option><option value="0">0</option></select></span></div>',
  111. '<div class="controls-container pie-controls-container" id="divShowSearchButton" title="' + I18n.t('pie.prefs.ShowAddressSearchTitle') + '"><input type="checkbox" id="_cbShowSearchButton" class="pieSettingsCheckbox"/><label for="_cbShowSearchButton" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowAddressSearch') + '</label></div>',
  112. '<div class="controls-container pie-controls-container" id="divAddPlaceCategoriesButtons"><input type="checkbox" id="_cbAddPlaceCategoriesButtons" class="pieSettingsCheckbox"/><label for="_cbAddPlaceCategoriesButtons" style="white-space:pre-line;" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowPlaceCategoryButtons') + '</label></div>',
  113. '<div class="controls-container pie-controls-container" id="divShowParkingLotButton" title="' + I18n.t('pie.prefs.ShowPLAButtonTitle') + '" ><input type="checkbox" id="_cbShowParkingLotButton" class="pieSettingsCheckbox" /><label for="_cbShowParkingLotButton" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowPLAButton') + '</label></div>',
  114. '<div class="controls-container pie-controls-container" id="divShowCopyPlaceButton" title="' + I18n.t('pie.prefs.ShowCopyPlaceButtonTitle') + '" ><input type="checkbox" id="_cbShowCopyPlaceButton" class="pieSettingsCheckbox" /><label for="_cbShowCopyPlaceButton" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowCopyPlaceButton') + '</label></div>',
  115. '<div class="controls-container pie-controls-container" id="divShowExternalProviderTooltip" title="' + I18n.t('pie.prefs.ShowGPIDTooltipTitle') + '" ><input type="checkbox" id="_cbShowExternalProviderTooltip" class="pieSettingsCheckbox" /><label for="_cbShowExternalProviderTooltip" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowGPIDTooltip') + '</label></div>',
  116. '<div class="controls-container pie-controls-container" id="divClearDescription" title="' + I18n.t('pie.prefs.ClearDescriptionTitle') + '" ><input type="checkbox" id="_cbClearDescription" class="pieSettingsCheckbox" /><label for="_cbClearDescription" style="white-space:pre-line;">' + I18n.t('pie.prefs.ClearDescription') + '</label></div>',
  117. '<div class="controls-container pie-controls-container" id="divMoveAddress" title="' + I18n.t('pie.prefs.MoveAddressTitle') + '"><input type="checkbox" id="_cbMoveAddress" class="pieSettingsCheckbox"/><label for="_cbMoveAddress" style="white-space:pre-line;">' + I18n.t('pie.prefs.MoveAddress') + '</label></div>',
  118. '<div class="controls-container pie-controls-container" id="divMoveHNEntry" title="' + I18n.t('pie.prefs.MoveHNEntryTitle') + '"><input type="checkbox" id="_cbMoveHNEntry" class="pieSettingsCheckbox"/><label for="_cbMoveHNEntry" style="white-space:pre-line;">' + I18n.t('pie.prefs.MoveHNEntry') + '</label></div>',
  119. '</fieldset>',
  120.  
  121. '<fieldset id="fieldNewPlaces" style="border: 1px solid silver; padding: 8px; border-radius: 4px;">',
  122. '<legend style="margin-bottom:0px; border-bottom-style:none;width:auto;"><h4>' + I18n.t('pie.prefs.NewPlaces') + '</h4></legend>',
  123. '<div id="divEditRPPAfterCreated" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.EditRPPAfterCreateTitle') + '"><input type="checkbox" id="_cbEditRPPAfterCreated" class="pieSettingsCheckbox"><label for="_cbEditRPPAfterCreated" style="white-space:pre-line;">' + I18n.t('pie.prefs.EditRPPAfterCreate') + '</label></div>',
  124. '<div id="divUseStreetFromClosestSeg" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.UseStreetFromClosestSegmentTitle') + '"><input type="checkbox" id="_cbUseStreetFromClosestSeg" class="pieSettingsCheckbox"><label for="_cbUseStreetFromClosestSeg" style="white-space:pre-line;">' + I18n.t('pie.prefs.UseStreetFromClosestSegment') + '</label></div>',
  125. '<div id="divUseCityFromClosestSeg" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.UseCityFromClosestSegmentTitle') + '"><input type="checkbox" id="_cbUseCityFromClosestSeg" class="pieSettingsCheckbox"><label for="_cbUseCityFromClosestSeg" style="white-space:pre-line;">' + I18n.t('pie.prefs.UseCityFromClosestSegment') + '</label></div>',
  126. '<div id="divUseAltCity" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.ClosestSegmentAltCityTitle') + '" style="padding-left:20px; word-wrap: break-word;"><input type="checkbox" id="_cbUseAltCity" class="pieSettingsCheckbox"><label for="_cbUseAltCity" style="white-space:pre-line;">' + I18n.t('pie.prefs.ClosestSegmentAltCity') + '</label></div>',
  127. '<div id="divSkipPLR" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.ClosestSegmentIgnorePLRUnnamedPRTitle') + '"><input type="checkbox" id="_cbSkipPLR" class="pieSettingsCheckbox"/><label for="_cbSkipPLR" style="white-space:pre-line;">' + I18n.t('pie.prefs.ClosestSegmentIgnorePLRUnnamedPR') + '</label></div>',
  128. '<div id="divDefaultLockLevel" class="controls-container pie-controls-container" style="left:8px;" title="' + I18n.t('pie.prefs.LockLevelTitle') + '">' + I18n.t('pie.prefs.LockLevel') + '<select id="pieDefaultLockLevel">' + buildLockLevelsList() + '</select></div>',
  129. '</fieldset>',
  130.  
  131. '<fieldset id="fieldMapMods" style="border: 1px solid silver; padding: 8px; border-radius: 4px;">',
  132. '<legend style="margin-bottom:0px; border-bottom-style:none;width:auto;"><h4>' + I18n.t('pie.prefs.MapChanges') + '</h4></legend>',
  133. '<div id="divShowNames" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.ShowPlaceNames') + '"><input type="checkbox" id="_cbShowPlaceNames" class="pieSettingsCheckbox" /><label for="_cbShowPlaceNames">' + I18n.t('pie.prefs.ShowPlaceNames') + '</label></div>',
  134. '<div id="divShowNamesPoint"class="controls-container pie-controls-container" style="padding-left:20px;" title="' + I18n.t('pie.prefs.ShowPointNamesTitle') + '"><input type="checkbox" id="_cbShowPlaceNamesPoint" class="pieSettingsCheckbox" disabled /><label for ="_cbShowPlaceNamesPoint">' + I18n.t('pie.prefs.ShowPointNames') + '</label></div>',
  135. '<div id="divShowNamesArea"class="controls-container pie-controls-container" style="padding-left:20px;" title="' + I18n.t('pie.prefs.ShowAreaNamesTitle') + '"><input type="checkbox" id="_cbShowPlaceNamesArea" class="pieSettingsCheckbox" disabled /><label for ="_cbShowPlaceNamesArea">' + I18n.t('pie.prefs.ShowAreaNames') + '</label></div>',
  136. '<div id="divShowNamesPLA"class="controls-container pie-controls-container" style="padding-left:20px;" title="' + I18n.t('pie.prefs.ShowPLANameTitle') + '"><input type="checkbox" id="_cbShowPlaceNamesPLA" class="pieSettingsCheckbox" disabled /><label for ="_cbShowPlaceNamesPLA">' + I18n.t('pie.prefs.ShowPLAName') + '</label></div>',
  137. '<div id="divShowNamesLock"class="controls-container pie-controls-container" style="padding-left:20px;" title="' + I18n.t('pie.prefs.ShowLockLevelTitle') + '"><input type="checkbox" id="_cbShowPlaceNamesLock" class="pieSettingsCheckbox" disabled /><label for ="_cbShowPlaceNamesLock">' + I18n.t('pie.prefs.ShowLockLevel') + '</label></div>',
  138. '<div id="divPlaceNamesFontCustomization" class="controls-container pie-controls-container" style="padding-left:20px;">',
  139. I18n.t('pie.prefs.FontSize') + ' <input type="text" size="1" id="piePlaceNameFontSize"/>px</br>',
  140. I18n.t('pie.prefs.FontColor') + ' <button class="jscolor {valueElement:null,hash:true,closable:true}" style="width:15px; height:15px;border:2px solid black" id="colorPickerFont"></button></br>',
  141. '<input type="checkbox" id="_cbPlaceNameFontBold" class="pieSettingsCheckbox"/><label for ="_cbPlaceNameFontBold">' + I18n.t('pie.prefs.Bold') + '</label></br>',
  142. I18n.t('pie.prefs.FontOutlineColor') + ' <button class="jscolor {valueElement:null,hash:true,closable:true}" style="width:15px; height:15px;border:2px solid black" id="colorPickerFontOutline"></button></br>',
  143. I18n.t('pie.prefs.FontOutlineWidth') + ' <input type="text" size="1" id="piePlaceNameFontOutlineWidth"/>',
  144. '</div>',
  145. '<div id="divShowPLSpotEstimatorButton" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.PSEShowPSEButtonTitle') + '"><input type="checkbox" id="_cbShowPLSpotEstimatorButton" class="pieSettingsCheckbox" /><label for="_cbShowPLSpotEstimatorButton" style="white-space:pre-line;">' + I18n.t('pie.prefs.PSEShowPSEButton') + '</label></div>',
  146. '<div id="divShowNavPointClosestSegmentOnHover" class="controls-container pie-controls-container" title=""><input type="checkbox" id="_cbShowNavPointClosestSegmentOnHover" class="pieSettingsCheckbox" /><label for="_cbShowNavPointClosestSegmentOnHover" style="white-space:pre-line;">Display the nav point and closest segment line on hover</label></div>',
  147. '</fieldset>',
  148. '<div class="controls-container" id="divPlaceMenuCustomization">',
  149. '<b>' + I18n.t('pie.prefs.PlaceMenuCustomization') + '</b></br>',
  150. buildItemOption(1),
  151. buildItemOption(2),
  152. buildItemOption(3),
  153. buildItemOption(4),
  154. buildItemOption(5),
  155. buildItemOption(6),
  156. buildItemOption(7),
  157. buildItemOption(8),
  158. buildItemOption(9),
  159. buildItemOption(10),
  160. buildItemOption(11),
  161. '</div>'
  162.  
  163. ].join(' '));
  164.  
  165. UpdateObject = require("Waze/Action/UpdateObject");
  166. MultiAction = require("Waze/Action/MultiAction");
  167.  
  168. //Load settings
  169. loadSettings();
  170.  
  171. var style = new OpenLayers.Style({
  172. pointRadius: "${pointRadius}",
  173. label : "${labelText}",
  174. fontFamily: "Tahoma, Arial, Verdana",
  175. labelOutlineColor: settings.PlaceNameFontOutline,
  176. labelOutlineWidth: Number(settings.PlaceNameFontOutlineWidth),
  177. labelAlign: 'cm',
  178. fontColor: settings.PlaceNameFontColor,
  179. fontOpacity: 1.0,
  180. fontSize: settings.PlaceNameFontSize + "px",
  181. labelYOffset: "${yOffset}",
  182. fontStyle: "${style}",
  183. fontWeight: (settings.PlaceNameFontBold ? 'bold' : ''),
  184. pointRadius: 0
  185. });
  186.  
  187. PIEPlaceNameLayer = new OL.Layer.Vector("PIEPlaceNameLayer",{displayInLayerSwitcher: false,
  188. uniqueName: "__PIEPlaceNameLayer", styleMap: new OL.StyleMap(style)});
  189. W.map.addLayer(PIEPlaceNameLayer);
  190. PIEPlaceNameLayer.setVisibility(true);
  191.  
  192. newPlaceLayer = new OL.Layer.Vector(layerName,{displayInLayerSwitcher: false});
  193. W.map.addLayer(newPlaceLayer);
  194.  
  195. PLSpotEstimatorLayer = new OL.Layer.Vector("PIEPLSpotEstimatorLayer",{displayInLayerSwitcher: false, uniqueName: "__PIEPLSpotEstimatorLayer"});
  196. W.map.addLayer(PLSpotEstimatorLayer);
  197. PLSpotEstimatorLayer.setVisibility(true);
  198.  
  199. PLSpotEstimatorCalibrationLayer= new OL.Layer.Vector("PIEPLSpotEstimatorCalibrationLayer",{displayInLayerSwitcher: false, uniqueName: "__PIEPLSpotEstimatorCalibrationLayer"});
  200. W.map.addLayer(PLSpotEstimatorCalibrationLayer);
  201. PLSpotEstimatorCalibrationLayer.setVisibility(true);
  202.  
  203. showStopPointsLayer = new OL.Layer.Vector("PIEShowStopPointsLayer", {displayInLayerSwitcher: false, uniqueName: "__PIEShowStopPointsLayer"});
  204. W.map.addLayer(showStopPointsLayer);
  205. showStopPointsLayer.setVisibility(true);
  206.  
  207. var ctl = W.map.controls.find(function(ctrl) { return ctrl.displayClass ==="WazeControlSelectHighlightFeature"; });
  208. var ctlLayers = ctl.layers.clone();
  209. var myLayer = W.map.getLayersByName('PIEPlaceNameLayer')[0];
  210. ctlLayers.push(myLayer);
  211. ctl.setLayer(ctlLayers);
  212.  
  213. injectCss();
  214. new WazeWrap.Interface.Tab('PIE', $section.html(), init2);
  215. }
  216.  
  217. var highlightedVenue, highlighting;
  218. function drawNavPointClosestSegmentLines(){
  219. highlighting = false;
  220. if(highlightedVenue !== null)
  221. if(highlightedVenue === W.map.landmarkLayer.getFeatureBy("renderIntent","highlight"))
  222. highlighting = true;
  223. else
  224. showStopPointsLayer.removeAllFeatures();
  225. highlightedVenue = W.map.landmarkLayer.getFeatureBy("renderIntent","highlight");
  226.  
  227. if(highlightedVenue !== null && highlighting === false){
  228. let isArea = highlightedVenue.geometry.toString().match(/^POLYGON/);
  229. let navPoint = highlightedVenue.model.geometry;
  230. if(isArea)
  231. navPoint = highlightedVenue.model.geometry.getCentroid();
  232. if(highlightedVenue.model.attributes.entryExitPoints.length > 0)
  233. navPoint = highlightedVenue.model.attributes.entryExitPoints[0].point;
  234.  
  235. //nav point to closest segment
  236. let closestSeg = WazeWrap.Geometry.findClosestSegment(navPoint,false, false);
  237. let lineFeature = new OL.Feature.Vector(new OL.Geometry.LineString([navPoint, closestSeg.closestPoint]), {}, lineStyleToClosestSeg);
  238. let pointFeature = new OL.Feature.Vector(closestSeg.closestPoint, {}, pointStyle);
  239. showStopPointsLayer.addFeatures([lineFeature, pointFeature]);
  240.  
  241. //place center to nav point
  242. let startPt = highlightedVenue.geometry;
  243. if(isArea)
  244. startPt = highlightedVenue.model.geometry.getCentroid();
  245. lineFeature = new OL.Feature.Vector(new OL.Geometry.LineString([startPt, navPoint]), {}, lineStyleToNavPoint);
  246. pointFeature = new OL.Feature.Vector(navPoint, {}, pointStyleNavPoint);
  247. if(highlightedVenue.model.attributes.entryExitPoints.length > 0 || isArea)
  248. showStopPointsLayer.addFeatures([lineFeature, pointFeature]);
  249.  
  250. }
  251. if(highlightedVenue === null)
  252. showStopPointsLayer.removeAllFeatures();
  253. }
  254.  
  255. function buildNewPlaceList(){
  256. //Clear out the Places menu
  257. $(placeMenuSelector).empty();
  258. var cat = "";
  259. var icon = "";
  260. var i;
  261. for(i=0;i<11;i++){
  262. icon = "";
  263. cat = $('#pieItem' + (i+1))[0].value;
  264. icon = $('#pieItem' + (i+1))[0].options[$('#pieItem' + (i+1))[0].selectedIndex].getAttribute("data-icon");
  265. if(cat !== "PARKING_LOT" && cat !== resCategory)
  266. $(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>');
  267. else{
  268. if(cat === resCategory) //force point
  269. $(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>');
  270. else //Parking lot - force area
  271. $(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>');
  272. }
  273. }
  274.  
  275. $('[id^="piePlaceMainItem"]').click(function(e){
  276. startPlacementMode($('#' + this.id).data("category"), true);
  277. });
  278.  
  279. $('[id^="piePlaceAreaItem"]').click(function(e){
  280. e.stopPropagation();
  281. startPlacementMode($('#' + this.id).data("category"), false);
  282. });
  283. }
  284.  
  285. function init2(){
  286. $('#cboPlaceNameFontWeight').select2({placeholder: "No font weight set", allowClear: true});
  287. $('#divPlaceNamesFontCustomization .select2-choices').css("font-size", "10px");
  288.  
  289. initColorPicker();
  290. if ($('#colorPickerFont')[0].jscolor){
  291. $('#colorPickerFont')[0].jscolor.fromString(settings.PlaceNameFontColor);
  292. $('#colorPickerFontOutline')[0].jscolor.fromString(settings.PlaceNameFontOutline);
  293. }
  294.  
  295. //$('#divPlaceNamesFontCustomization .select2-input').remove()
  296. //Set up event handlers
  297. $('#_cbShowAreaPlaceSize').change(function() {
  298. if(this.checked) {
  299. attachPlaceSizeHandlers();
  300. updatePlaceSizeDisplay();
  301. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = false;
  302. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = false;
  303. }
  304. else
  305. {
  306. removePlaceSizeHandlers();
  307. $('#AreaSize').remove();
  308. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = true;
  309. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = true;
  310. }
  311. });
  312.  
  313. $('#_cbShowPlaceNames').change(function() {
  314. PIEPlaceNameLayer.setVisibility(this.checked);
  315. if(this.checked) {
  316. $('#_cbShowPlaceNamesPoint')[0].disabled = false;
  317. $('#_cbShowPlaceNamesArea')[0].disabled = false;
  318. $('#_cbShowPlaceNamesPLA')[0].disabled = false;
  319. $('#_cbShowPlaceNamesLock')[0].disabled = false;
  320. }
  321. else
  322. {
  323. $('#_cbShowPlaceNamesPoint')[0].disabled = true;
  324. $('#_cbShowPlaceNamesArea')[0].disabled = true;
  325. $('#_cbShowPlaceNamesPLA')[0].disabled = true;
  326. $('#_cbShowPlaceNamesLock')[0].disabled = true;
  327. }
  328. console.log(this.checked);
  329. DisplayPlaceNames();
  330. });
  331.  
  332. $('[id^="_cbShowPlaceNames"]').change(function(){
  333. DisplayPlaceNames();
  334. });
  335.  
  336. $('#_cbShowExternalProviderTooltip').change(function(){
  337. ToggleExternalProvidersCSS(this.checked);
  338. });
  339.  
  340. $('#_cbShowLockButtonsRPP').change(function() {
  341. if(this.checked)
  342. attachRPPLockButtonHandlers();
  343. else
  344. {
  345. $('#pieRPPLockButtonsContainer').remove();
  346. unregisterEvents(addLockButtons);
  347. }
  348. });
  349.  
  350. $('#_cbShowPlaceLocatorCrosshair').change(function(){
  351. if(this.checked)
  352. registerEvents(ShowPlaceLocatorCrosshair);
  353. else
  354. unregisterEvents(ShowPlaceLocatorCrosshair);
  355. });
  356.  
  357. $('#_cbShowParkingLotButton').change(function(){
  358. if(this.checked)
  359. registerEvents(ShowParkingLotButton);
  360. else
  361. unregisterEvents(ShowParkingLotButton);
  362. });
  363.  
  364. $('#_cbShowCopyPlaceButton').change(function(){
  365. if(this.checked)
  366. registerEvents(ShowCopyPlaceButton);
  367. else
  368. unregisterEvents(ShowCopyPlaceButton);
  369. });
  370.  
  371. $('#_cbShowSearchButton').change(function(){
  372. if(this.checked)
  373. registerEvents(ShowSearchButton);
  374. else
  375. unregisterEvents(ShowSearchButton);
  376. });
  377.  
  378. $('#_cbAddPlaceCategoriesButtons').change(function(){
  379. if(this.checked)
  380. registerEvents(AddPlaceCategoriesButtons);
  381. else
  382. unregisterEvents(AddPlaceCategoriesButtons);
  383. });
  384.  
  385. $('#_cbMoveAddress').change(function(){
  386. if(this.checked)
  387. registerEvents(MoveAddress);
  388. else
  389. unregisterEvents(MoveAddress);
  390. });
  391.  
  392. $('#_cbMoveHNEntry').change(function(){
  393. if(this.checked)
  394. registerEvents(MoveHNEntry);
  395. else
  396. unregisterEvents(MoveHNEntry);
  397. });
  398.  
  399. $('#_cbClearDescription').change(function(){
  400. if(this.checked)
  401. registerEvents(ShowClearDescription);
  402. else
  403. unregisterEvents(ShowClearDescription);
  404. });
  405.  
  406. $('#_cbShowPLSpotEstimatorButton').change(function(){
  407. if(this.checked)
  408. registerEvents(ShowPLSpotEstimatorButton);
  409. else
  410. unregisterEvents(ShowPLSpotEstimatorButton);
  411. });
  412.  
  413. $('#_cbShowNavPointClosestSegmentOnHover').change(function(){
  414. if(this.checked)
  415. W.map.events.register("mousemove", null, drawNavPointClosestSegmentLines);
  416. else
  417. W.map.events.unregister("mousemove", null, drawNavPointClosestSegmentLines);
  418. });
  419.  
  420. //Load settings to interface
  421. setChecked('_cbShowAreaPlaceSize', settings.ShowAreaPlaceSize);
  422. setChecked('_cbShowAreaPlaceSizeImperial', settings.ShowAreaPlaceSizeImperial);
  423. setChecked('_cbShowAreaPlaceSizeMetric', settings.ShowAreaPlaceSizeMetric);
  424. setChecked('_cbShowLockButtonsRPP', settings.ShowLockButtonsRPP);
  425. setChecked('_cbEditRPPAfterCreated', settings.EditRPPAfterCreated);
  426. setChecked('_cbUseStreetFromClosestSeg', settings.UseStreetFromClosestSeg);
  427. setChecked('_cbUseCityFromClosestSeg', settings.UseCityFromClosestSeg);
  428. setChecked('_cbShowPlaceLocatorCrosshair', settings.ShowPlaceLocatorCrosshair);
  429. setChecked('_cbShowParkingLotButton', settings.ShowParkingLotButton);
  430. setChecked('_cbShowCopyPlaceButton', settings.ShowCopyPlaceButton);
  431. setChecked('_cbShowExternalProviderTooltip', settings.ShowExternalProviderTooltip);
  432. setChecked('_cbUseAltCity', settings.UseAltCity);
  433. setChecked('_cbShowSearchButton', settings.ShowSearchButton);
  434. setChecked('_cbAddPlaceCategoriesButtons', settings.AddPlaceCategoriesButtons);
  435. setChecked('_cbSkipPLR', settings.SkipPLR);
  436. setChecked('_cbShowPlaceNames', settings.ShowPlaceNames);
  437. setChecked('_cbShowPlaceNamesPoint', settings.ShowPlaceNamesPoint);
  438. setChecked('_cbShowPlaceNamesArea', settings.ShowPlaceNamesArea);
  439. setChecked('_cbShowPlaceNamesPLA', settings.ShowPlaceNamesPLA);
  440. setChecked('_cbShowPlaceNamesLock', settings.ShowPlaceNamesLock);
  441. setChecked('_cbClearDescription', settings.ClearDescription);
  442. setChecked('_cbPlaceNameFontBold', settings.PlaceNameFontBold);
  443. setChecked('_cbPlaceLocatorCrosshairProdPL', settings.PlaceLocatorCrosshairProdPL);
  444. setChecked('_cbMoveAddress', settings.MoveAddress);
  445. setChecked('_cbMoveHNEntry', settings.MoveHNEntry);
  446. setChecked('_cbShowPLSpotEstimatorButton', settings.ShowPLSpotEstimatorButton);
  447. setChecked('_cbShowNavPointClosestSegmentOnHover', settings.ShowNavPointClosestSegmentOnHover);
  448. if(settings.ShowPlaceNames){
  449. $('#_cbShowPlaceNamesPoint')[0].disabled = false;
  450. $('#_cbShowPlaceNamesArea')[0].disabled = false;
  451. $('#_cbShowPlaceNamesPLA')[0].disabled = false;
  452. $('#_cbShowPlaceNamesLock')[0].disabled = false;
  453. }
  454. $('#piePlaceZoom')[0].value = settings.PlaceZoom;
  455. $('#pieDefaultLockLevel')[0].value = settings.DefaultLockLevel;
  456. $('#piePlaceNameFontSize')[0].value = settings.PlaceNameFontSize
  457. $('#piePlaceNameFontOutlineWidth')[0].value = settings.PlaceNameFontOutlineWidth
  458.  
  459. if(settings.ShowNavPointClosestSegmentOnHover){
  460. W.map.events.register("mousemove", null, drawNavPointClosestSegmentLines);
  461. }
  462.  
  463. if(settings.ShowAreaPlaceSize){
  464. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = false;
  465. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = false;
  466. attachPlaceSizeHandlers();
  467. }
  468.  
  469. if(settings.ShowPlaceLocatorCrosshair){
  470. registerEvents(ShowPlaceLocatorCrosshair);
  471. ShowPlaceLocatorCrosshair(); //in case the user opened a PL with a Place selected
  472. }
  473.  
  474. if(settings.ShowParkingLotButton){
  475. registerEvents(ShowParkingLotButton);
  476. ShowParkingLotButton(); //in case the user opened a PL with a Place selected
  477. }
  478.  
  479. if(settings.ShowCopyPlaceButton){
  480. registerEvents(ShowCopyPlaceButton);
  481. ShowCopyPlaceButton();
  482. }
  483.  
  484. if(settings.ShowExternalProviderTooltip){
  485. //registerEvents(ShowExternalProviderTooltip);
  486. //ShowExternalProviderTooltip();
  487.  
  488. var observer = new MutationObserver(function(mutations) {
  489. mutations.forEach(function(mutation) {
  490. if ($(mutation.target).hasClass('select2-chosen')) ShowExternalProviderTooltip();
  491. });
  492. });
  493.  
  494. observer.observe(document.getElementById('edit-panel'), { childList: true, subtree: true });
  495. }
  496.  
  497. if(settings.ShowSearchButton){
  498. registerEvents(ShowSearchButton);
  499. ShowSearchButton(); //in case the user opened a PL with a Place selected
  500. }
  501.  
  502. if(settings.AddPlaceCategoriesButtons){
  503. registerEvents(AddPlaceCategoriesButtons);
  504. AddPlaceCategoriesButtons();
  505. }
  506.  
  507. if(settings.ClearDescription){
  508. registerEvents(ShowClearDescription);
  509. ShowClearDescription();
  510. }
  511.  
  512. if(settings.MoveAddress){
  513. registerEvents(MoveAddress);
  514. MoveAddress();
  515. }
  516.  
  517. if(settings.MoveHNEntry){
  518. registerEvents(MoveHNEntry);
  519. MoveHNEntry();
  520. }
  521.  
  522. if(settings.ShowPLSpotEstimatorButton){
  523. registerEvents(ShowPLSpotEstimatorButton);
  524. ShowPLSpotEstimatorButton();
  525. }
  526.  
  527. if(settings.ShowLockButtonsRPP)
  528. attachRPPLockButtonHandlers();
  529.  
  530. if(settings.ShowExternalProviderTooltip)
  531. ToggleExternalProvidersCSS(true);
  532.  
  533. $('.pieSettingsCheckbox').change(function() {
  534. var settingName = $(this)[0].id.substr(3);
  535. settings[settingName] = this.checked;
  536. saveSettings();
  537. });
  538.  
  539. $('#piePlaceZoom').change(function(){
  540. var settingName = $(this)[0].id.substr(3);
  541. settings[settingName] = $(this)[0].value;
  542. saveSettings();
  543. });
  544.  
  545. $('#pieDefaultLockLevel').change(function(){
  546. settings[$(this)[0].id.substr(3)] = $(this)[0].value;
  547. saveSettings();
  548. });
  549.  
  550. $('#_cbPlaceNameFontBold').change(function(){
  551. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.fontWeight = (this.checked ? 'bold' :'');
  552. DisplayPlaceNames();
  553. });
  554.  
  555. $('#piePlaceNameFontSize').focusout(function(){
  556. var fontSize = $(this)[0].value;
  557. if(fontSize == "" || fontSize == "0")
  558. $(this)[0].value = 12;
  559. settings[$(this)[0].id.substr(3)] = fontSize;
  560. saveSettings();
  561. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.fontSize = fontSize + "px";
  562. DisplayPlaceNames();
  563. });
  564.  
  565. $('#piePlaceNameFontOutlineWidth').focusout(function(){
  566. var outlineWidth = $(this)[0].value;
  567. if(outlineWidth == "" || outlineWidth == "0")
  568. $(this)[0].value = 3;
  569. settings[$(this)[0].id.substr(3)] = outlineWidth;
  570. saveSettings();
  571. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.labelOutlineWidth = outlineWidth;
  572. DisplayPlaceNames();
  573. });
  574.  
  575. $('#piePlaceNameFontSize').keypress(function(event) {
  576. if ((event.which < 48 || event.which > 57))
  577. event.preventDefault();
  578. });
  579.  
  580. $('#piePlaceNameFontOutlineWidth').keypress(function(event) {
  581. if ((event.which < 48 || event.which > 57))
  582. event.preventDefault();
  583. });
  584.  
  585. var i;
  586. //Whenever a Place item is changed, read the settings and save to localStorage
  587. $('[id^="pieItem"]').change(function(){
  588. for(i=0;i<11;i++){
  589. settings.NewPlacesList[i] = $('#pieItem'+(i+1))[0].value;
  590. }
  591. saveSettings();
  592. buildNewPlaceList();
  593. });
  594.  
  595. //Load settings into Place Customization list options
  596. for(i=0; i<11;i++)
  597. $('#pieItem'+(i+1))[0].value = settings.NewPlacesList[i];
  598.  
  599. //Build our new menu
  600. buildNewPlaceList();
  601.  
  602. new WazeWrap.Interface.Shortcut('CreateResidentialPlaceShortcut', 'Creates a resdiential Place point', 'wmepie', 'Place Interface Enhancements', settings.CreateResidentialPlaceShortcut, function(){startPlacementMode(resCategory, true);}, null).add();
  603.  
  604. new WazeWrap.Interface.Shortcut('CreateParkingLotShortcut', 'Creates a parking lot Place', 'wmepie', 'Place Interface Enhancements', settings.CreateParkingLotShortcut, function(){startPlacementMode("PARKING_LOT", false);}, null).add();
  605.  
  606. window.addEventListener("beforeunload", function() {
  607. saveSettings();
  608. }, false);
  609.  
  610. //Trim whitespace from start and end of house number field on Places
  611. W.selectionManager.events.register("selectionchanged", null, function(){
  612. if(W.selectionManager.selectedItems.length > 0 && W.selectionManager.selectedItems[0].model.type === "venue")
  613. $('.form-control.house-number').focusout(function(){
  614. $('.form-control.house-number')[0].value = $('.form-control.house-number')[0].value.trim();
  615. });
  616. });
  617.  
  618. var observer = new MutationObserver(function(mutations) {
  619. mutations.forEach(function(mutation) {
  620. if ($('#dialog-region').find('.venue-image-dialog').length > 0 && $('#detailsWrap').length == 0) ImageDialogEnhancement();
  621. });
  622. });
  623.  
  624. observer.observe(document.getElementById('dialog-region'), { childList: true, subtree: true });
  625.  
  626. //Highlight the categories box when the old hospital category is present
  627. /*W.selectionManager.events.register("selectionchanged", null, highlightObsoleteHospitalCategory);
  628. W.model.actionManager.events.register("afterundoaction",null, highlightObsoleteHospitalCategory);
  629. W.model.actionManager.events.register("afterclearactions",null, highlightObsoleteHospitalCategory);
  630. W.model.actionManager.events.register("afteraction",null, highlightObsoleteHospitalCategory);*/
  631.  
  632. W.map.events.register("zoomend", null, DisplayPlaceNames);
  633. W.map.events.register("changelayer", null, DisplayPlaceNames);
  634.  
  635. //Shamelessly copied from URO+
  636. var MO_MPLayer = new MutationObserver(MPLayerChanged);
  637. MO_MPLayer.observe(W.map.problemLayer.div,{childList : true});
  638.  
  639. wazePL = document.querySelector('.WazeControlPermalink>a.fa-link');
  640. wazePL.id = 'wazePermalink';
  641. }
  642.  
  643. function initColorPicker(tries){
  644. tries = tries || 1;
  645.  
  646. if ($('#colorPickerFont')[0].jscolor ) {
  647. $('#colorPickerFont')[0].jscolor.fromString(settings.PlaceNameFontColor);
  648. $('[id^="colorPicker"]')[0].jscolor.closeText = 'Close';
  649. $('#colorPickerFont')[0].jscolor.onChange = jscolorChanged;
  650.  
  651. $('#colorPickerFontOutline')[0].jscolor.fromString(settings.PlaceNameFontOutline);
  652. $('#colorPickerFontOutline')[0].jscolor.onChange = jscolorChanged;
  653.  
  654.  
  655. } else if (tries < 1000) {
  656. setTimeout(function () {initColorPicker(tries++);}, 200);
  657. }
  658. }
  659.  
  660. function jscolorChanged(){
  661. settings.PlaceNameFontColor = "#" + $('#colorPickerFont')[0].jscolor.toString();
  662. settings.PlaceNameFontOutline = "#" + $('#colorPickerFontOutline')[0].jscolor.toString();
  663. saveSettings();
  664. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.fontColor = settings.PlaceNameFontColor;
  665. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.labelOutlineColor = settings.PlaceNameFontOutline;
  666. DisplayPlaceNames();
  667. }
  668.  
  669. function registerEvents(handler){
  670. W.selectionManager.events.register("selectionchanged", null, handler);
  671. W.model.actionManager.events.register("afterundoaction",null, handler);
  672. W.model.actionManager.events.register("afterclearactions",null, handler);
  673. W.model.actionManager.events.register("afteraction",null, handler);
  674. }
  675.  
  676. function unregisterEvents(handler){
  677. W.selectionManager.events.unregister("selectionchanged", null, handler);
  678. W.model.actionManager.events.unregister("afterundoaction",null, handler);
  679. W.model.actionManager.events.unregister("afterclearactions",null, handler);
  680. W.model.actionManager.events.unregister("afteraction",null, handler);
  681. }
  682.  
  683. function ToggleExternalProvidersCSS(truthiness){
  684. if(truthiness)
  685. injectCSSWithID('pieExternalProvidersTweaks', '#edit-panel .external-providers-view .select2-container {width:90%; margin-bottom:2px;}');
  686. else{
  687. var styles = document.getElementById('pieExternalProvidersTweaks');
  688. if(styles) styles.parentNode.removeChild(styles);
  689. }
  690. }
  691.  
  692. function DisplayPlaceNames(){
  693. PIEPlaceNameLayer.removeAllFeatures();
  694. var showPoint, showArea, showLock, showNames, showPLA;
  695. showNames = isChecked('_cbShowPlaceNames');
  696. showPoint = isChecked('_cbShowPlaceNamesPoint');
  697. showArea = isChecked('_cbShowPlaceNamesArea');
  698. showLock = isChecked('_cbShowPlaceNamesLock');
  699. showPLA = isChecked('_cbShowPlaceNamesPLA');
  700.  
  701. if(showNames){
  702. var isPoint;
  703. for (var placeID in W.model.venues.objects) {
  704. var venue = W.model.venues.get(placeID);
  705. isPoint = venue.geometry.toString().match(/^POINT/);
  706. if((isPoint && W.map.zoom >= 5) || (!isPoint && W.map.zoom >= 3)){
  707. if(WazeWrap.Geometry.isGeometryInMapExtent(venue.geometry)){
  708. if( (isPoint && showPoint) || (!isPoint && showArea && venue.attributes.categories[0] !== "PARKING_LOT") || (!isPoint && showPLA && venue.attributes.categories[0] === "PARKING_LOT")){
  709. var textLoc;
  710. if(isPoint)
  711. textLoc = new OpenLayers.Geometry.Point(venue.geometry.x, venue.geometry.y);
  712. else
  713. textLoc = venue.geometry.getCentroid();
  714. var placeName =WordWrap(venue.attributes.name.trim() + (showLock ? ' (L' + (venue.attributes.lockRank + 1) + ')' : ''));
  715. if(venue.attributes.categories[0] === "RESIDENCE_HOME")
  716. placeName = venue.attributes.houseNumber + (venue.attributes.name.trim() !== '' ? ' - ' + venue.attributes.name : '') + (showLock ? ' (L' + (venue.attributes.lockRank + 1) + ')' : '');
  717. var placeNameLabel = new OL.Feature.Vector(textLoc,{display: 'block',labelText: placeName.trim(), yOffset:(isPoint ? -13 - placeName.split("\n").length * 5 : 0)});
  718. PIEPlaceNameLayer.addFeatures([placeNameLabel]);
  719. }
  720. }
  721. }
  722. }
  723. }
  724. }
  725.  
  726. function WordWrap(text){
  727. var newName = "";
  728.  
  729. if(text !== ""){
  730. var splitName = text.match(/(.{1,35})(?:\s|$)/g);
  731. for(var i=0;i<splitName.length;i++){
  732. newName += splitName[i] + (i != splitName.length-1 ? '\n' : '');
  733. }
  734. }
  735. console.log()
  736. return newName;
  737. }
  738.  
  739. //Shamelessly copied from URO+
  740. function MPLayerChanged(){
  741. for(var mObj in W.map.problemLayer.markers){
  742. var mIcon = W.map.problemLayer.markers[mObj].icon.div;
  743. mIcon.addEventListener("click", MarkerClick, false);
  744. }
  745. }
  746.  
  747. function MarkerClick(){
  748. var markerType = GetMarkerType(this.className);
  749. if(markerType !== null){
  750. var markerID = this.attributes["data-id"].value;
  751. if(W.map.getLayerByUniqueName("problems").markers[markerID].model.attributes.subType === 71){
  752. var $PIECreatePLA = $("<div>", {style:"min-height:20px"});
  753. $PIECreatePLA.html([
  754. '<div id="PIECreatePLA">',
  755. '<div class="btn btn-block" id="PIECreatePLAButton" style="color: #fff; background-color: #92c2d1; border-color: #78b0bf; margin-top:5px;">Create Suggested PLA</div>',
  756. '</div>'
  757. ].join(' '));
  758.  
  759. setTimeout(function(){$('#panel-container > div > div > div.body > div.actions > div > div').append($PIECreatePLA); $('#PIECreatePLAButton').click(function(){createPLAFromMP(markerID);})}, 150);
  760. }
  761. }
  762. }
  763.  
  764. //Shamelessly copied from URO+
  765. function GetMarkerType(className){
  766. var markerType = null;
  767. if(className.indexOf('user-generated') !== -1) markerType = 'ur';
  768. else if(className.indexOf('map-problem') !== -1) markerType = 'mp';
  769. else if(className.indexOf('place-update') !== -1) markerType = 'pur';
  770. return markerType;
  771. }
  772.  
  773. function createPLAFromMP(MPID){
  774. var pos = W.model.problemDetails.objects[MPID].venueGeom;
  775.  
  776. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  777. var AddPlace = require("Waze/Action/AddLandmark");
  778. var NewPlace = new PlaceObject();
  779.  
  780. var points = [];
  781. var i;
  782. for(i=0;i<pos.components[0].components.length;i++){
  783. points.push(new OL.Geometry.Point(pos.components[0].components[i].x, pos.components[0].components[i].y));
  784. }
  785. var ring = new OpenLayers.Geometry.LinearRing(points);
  786. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  787.  
  788. NewPlace.attributes.categories.push("PARKING_LOT");
  789.  
  790. W.model.actionManager.add(new AddPlace(NewPlace));
  791. Waze.selectionManager.select([NewPlace]);
  792. }
  793.  
  794. function highlightObsoleteHospitalCategory(){
  795. if(W.selectionManager.selectedItems.length > 0 && W.selectionManager.selectedItems[0].model.type === "venue"){
  796. if(W.selectionManager.selectedItems[0].model.attributes.categories.contains("HOSPITAL_MEDICAL_CARE")){
  797. $('.select2-choices').css('animation-iteration-count', 'infinite');
  798. $('.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');
  799. $('.select2-choices').tooltip();
  800. }
  801. }
  802. }
  803.  
  804. var newPlaceCategory = "";
  805. function startPlacementMode(category, isPoint){
  806. if(category === "PARKING_LOT"){
  807. if(!isChecked("layer-switcher-item_parking_places")){
  808. if(!isChecked("layer-switcher-group_places"))
  809. $("#layer-switcher-group_places").click();
  810. $("#layer-switcher-item_parking_places").click();
  811. }
  812. }
  813. $('#edit-buttons > div > div.toolbar-button.waze-icon-place.toolbar-submenu.toolbar-group.toolbar-group-venues.ItemInactive').removeClass("open");
  814. newPlaceCategory = category;
  815. var polyDrawFeatureOptions = {callbacks : {"done": doneHandler}};
  816. if(isPoint){
  817. $("#map").on('mousemove', MouseMoveHandler);
  818. $("#map").click(function(){endPlacementMode(category, isPoint);});
  819. /*drawPoly = new OpenLayers.Control.DrawFeature(newPlaceLayer, OpenLayers.Handler.Polygon, polyDrawFeatureOptions);
  820. W.map.addControl(drawPoly);
  821. drawPoly.activate();*/
  822. }
  823. else{
  824. drawPoly = new OpenLayers.Control.DrawFeature(newPlaceLayer, OpenLayers.Handler.Polygon, polyDrawFeatureOptions);
  825. W.map.addControl(drawPoly);
  826. drawPoly.activate();
  827.  
  828. }
  829. document.addEventListener('keyup', keyUpHandler, false);
  830. }
  831.  
  832. var businessPLAPlaceName, businessPLAPlaceAddress;//, businessPLAPlacePhone, businessPLAPlaceURL;
  833. function startBusinessPLAPlacementMode(){
  834. var polyDrawFeatureOptions = {callbacks : {"done": doneHandlerBusinessPLAPlace}};
  835. drawPoly = new OpenLayers.Control.DrawFeature(newPlaceLayer, OpenLayers.Handler.Polygon, polyDrawFeatureOptions);
  836. W.map.addControl(drawPoly);
  837. drawPoly.activate();
  838. document.addEventListener('keyup', keyUpHandler, false);
  839. }
  840.  
  841. function doneHandlerBusinessPLAPlace(geom){
  842. drawPoly.destroy();
  843. BusinessPLAMode = false;
  844. CreateBusinesPLAPlace(geom, businessPLAPlaceName, businessPLAPlaceAddress);//, businessPLAPlacePhone, businessPLAPlaceURL);
  845. }
  846.  
  847. function CreateBusinesPLAPlace(geom, name, address){//, phone, url){
  848. drawPoly.destroy();
  849.  
  850. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  851. var AddPlace = require("Waze/Action/AddLandmark");
  852. var multiaction = new MultiAction();
  853. multiaction.setModel(W.model);
  854.  
  855. var NewPlace = new PlaceObject();
  856. var points = [];
  857. var i;
  858. for(i=0;i<geom.components[0].components.length;i++){
  859. points.push(new OL.Geometry.Point(geom.components[0].components[i].x, geom.components[0].components[i].y));
  860. }
  861. var ring = new OpenLayers.Geometry.LinearRing(points);
  862. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  863. NewPlace.attributes.categories.push("PARKING_LOT");
  864.  
  865. NewPlace.attributes.lockRank = Number(settings.DefaultLockLevel);
  866. NewPlace.attributes.name = "Parking - " + name;
  867. //NewPlace.attributes.phone = phone;
  868. //NewPlace.attributes.url = url;
  869. NewPlace.attributes.categoryAttributes.PARKING_LOT = {};
  870. NewPlace.attributes.categoryAttributes.PARKING_LOT.parkingType = "RESTRICTED";
  871. NewPlace.attributes.categoryAttributes.PARKING_LOT.lotType = ["STREET_LEVEL"];
  872. NewPlace.attributes.categoryAttributes.PARKING_LOT.costType = "FREE";
  873.  
  874. W.model.actionManager.add(new AddPlace(NewPlace));
  875.  
  876. if(address){
  877. var newAttributes, UpdateFeatureAddress = require('Waze/Action/UpdateFeatureAddress');
  878. newAttributes = {
  879. countryID: address.country.id,
  880. stateID: address.state.id,
  881. emptyCity: address.city.attributes.name ? null : true,
  882. emptyStreet: address.street.name ? null : true,
  883. houseNumber: address.houseNumber
  884. };
  885.  
  886. newAttributes.streetName = address.street.name;
  887.  
  888. var cityName = address.city.attributes.name;
  889.  
  890. if(cityName !== "")
  891. newAttributes.emptyCity = null;
  892. newAttributes.cityName = cityName;
  893.  
  894. }
  895. var UFA = new UpdateFeatureAddress(NewPlace, newAttributes);
  896. UFA.options.updateHouseNumber = true;
  897. multiaction.doSubAction(UFA);
  898. W.model.actionManager.add(multiaction);
  899.  
  900. Waze.selectionManager.select([NewPlace]);
  901. }
  902.  
  903. function doneHandler(geom){
  904. drawPoly.destroy();
  905. createPlace(geom, newPlaceCategory, false);
  906. }
  907.  
  908. function keyUpHandler(e){
  909. if (e.keyCode == 27){
  910. BusinessPLAMode = false;
  911. disablePlacementMode();
  912. if(drawPoly !== "undefined")
  913. drawPoly.destroy();
  914. }
  915. else if(e.keyCode == 90 && e.ctrlKey)
  916. drawPoly.undo();
  917. else if(e.keyCode == 89 && e.ctrlKey)
  918. drawPoly.redo();
  919. else if(e.keyCode == 13)
  920. drawPoly.finishSketch();
  921. }
  922.  
  923. function disablePlacementMode(){
  924. $("#map").off('click');//, endPlacementMode);
  925. $("#map").off('mousemove', MouseMoveHandler);
  926. clearLayer();
  927. document.removeEventListener('keyup', keyUpHandler);
  928. }
  929.  
  930. function endPlacementMode(category, isPoint){
  931. disablePlacementMode();
  932. createPlace(getMousePos900913(), category, isPoint);
  933. }
  934.  
  935. function getMousePos900913(){
  936. var mousePosition = $('.WazeControlMousePosition').text().split(" ");
  937. return WazeWrap.Geometry.ConvertTo900913(mousePosition[0], mousePosition[1]);
  938. }
  939.  
  940. function MouseMoveHandler(e){
  941. clearLayer();
  942. drawCircle(getMousePos900913());
  943. }
  944.  
  945. function clearLayer() {
  946. var layer = W.map.getLayersByName(layerName)[0];
  947. layer.removeAllFeatures();
  948. }
  949.  
  950. function drawCircle(e){
  951. var pointFeature = new OL.Feature.Vector(new OL.Geometry.Point(e.lon, e.lat), {}, pointStyle);
  952. W.map.getLayersByName(layerName)[0].addFeatures([pointFeature]);
  953. }
  954.  
  955. function createPlace(pos, category, isPoint){
  956. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  957. var AddPlace = require("Waze/Action/AddLandmark");
  958. var multiaction = new MultiAction();
  959. multiaction.setModel(W.model);
  960.  
  961. var NewPlace = new PlaceObject();
  962. if(isPoint)
  963. NewPlace.geometry = new OL.Geometry.Point(pos.lon, pos.lat);
  964. else{
  965. var points = [];
  966. var i;
  967. for(i=0;i<pos.components[0].components.length;i++){
  968. points.push(new OL.Geometry.Point(pos.components[0].components[i].x, pos.components[0].components[i].y));
  969. }
  970. var ring = new OpenLayers.Geometry.LinearRing(points);
  971. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  972.  
  973. }
  974.  
  975. NewPlace.attributes.categories.push(category);
  976. if(category === resCategory){
  977. NewPlace._originalResidential = true;
  978. NewPlace.attributes.residential = true;
  979. }
  980. NewPlace.attributes.lockRank = Number(settings.DefaultLockLevel);
  981.  
  982. var closestSeg = WazeWrap.Geometry.findClosestSegment(new OL.Geometry.Point(pos.lon, pos.lat), settings.SkipPLR, settings.SkipPLR);
  983.  
  984. W.model.actionManager.add(new AddPlace(NewPlace));
  985. Waze.selectionManager.select([NewPlace]);
  986.  
  987. if(closestSeg){ //if we were able to find a segment, try to pull the city and/or street name if the options are enabled
  988. var newAttributes, UpdateFeatureAddress = require('Waze/Action/UpdateFeatureAddress'), address = closestSeg.getAddress();
  989.  
  990. newAttributes = {
  991. countryID: address.country.id,
  992. stateID: address.state.id,
  993. emptyCity: address.city.attributes.name ? null : true,
  994. emptyStreet: address.street.name ? null : true
  995. };
  996.  
  997. if(settings.UseStreetFromClosestSeg)
  998. newAttributes.streetName = address.street.name;
  999. else
  1000. newAttributes.emptyStreet = true;
  1001.  
  1002. if(settings.UseCityFromClosestSeg){
  1003. var cityName = address.city.attributes.name;
  1004.  
  1005. if(settings.UseAltCity && cityName === ""){
  1006. if(address.altStreets.length > 0){ //segment has alt names
  1007. for(var j=0;j<closestSeg.attributes.streetIDs.length;j++){
  1008. var altCity = W.model.cities.get(W.model.streets.get(closestSeg.attributes.streetIDs[j]).cityID).attributes;
  1009.  
  1010. if(altCity.englishName !== null && altCity.englishName !== "")
  1011. cityName = altCity.englishName;
  1012. }
  1013. }
  1014. }
  1015. if(cityName !== "")
  1016. newAttributes.emptyCity = null;
  1017. newAttributes.cityName = cityName;
  1018. }
  1019. else
  1020. newAttributes.emptyCity = true;
  1021.  
  1022. multiaction.doSubAction(new UpdateFeatureAddress(NewPlace, newAttributes));
  1023. W.model.actionManager.add(multiaction);
  1024. }
  1025. else
  1026. console.log("WMEPIE - No segment found; cannot set street or city name.");
  1027.  
  1028. if(category === resCategory && settings.EditRPPAfterCreated)
  1029. editRPPAddress();
  1030. }
  1031.  
  1032. function editRPPAddress(rppTries){
  1033. rppTries = rppTries || 1;
  1034.  
  1035. if ($('.edit-button').length > 0) {
  1036. $('.edit-button').trigger("click");
  1037. $('.house-number:first').focus();
  1038.  
  1039. } else if (rppTries < 1000) {
  1040. console.log("not found");
  1041. setTimeout(function () {editRPPAddress(rppTries++);}, 200);
  1042. }
  1043. }
  1044.  
  1045. function buildItemOption(itemNumber){
  1046. var $section = $("<div>", {style:"padding:8px 16px", id:"piePlaceCat" + itemNumber});
  1047. $section.html([
  1048. I18n.t('pie.prefs.Item') + " ",
  1049. itemNumber,
  1050. buildItemList(itemNumber),
  1051. '</br>'
  1052. ].join(' '));
  1053.  
  1054. return $section.html();
  1055. }
  1056.  
  1057. function buildLockLevelsList(){
  1058. var $lockLevels = $("<div>");
  1059. for(var i=0;i<WazeWrap.User.Rank();i++){
  1060. $lockLevels.append("<option value=" + i + ">" + (i+1) + "</option>");
  1061. }
  1062. return $lockLevels.html();
  1063. }
  1064.  
  1065. function attachRPPLockButtonHandlers(){
  1066. $('#pieRPPLockButtonsContainer').remove();
  1067. W.selectionManager.events.register("selectionchanged", null, addLockButtons);
  1068. W.model.actionManager.events.register("afterundoaction",null, addLockButtons);
  1069. W.model.actionManager.events.register("afterclearactions",null, addLockButtons);
  1070. W.model.actionManager.events.register("afteraction",null, addLockButtons);
  1071. }
  1072.  
  1073. function attachPlaceSizeHandlers(){
  1074. W.selectionManager.events.register("selectionchanged", null, updatePlaceSizeDisplay);
  1075. W.model.actionManager.events.register("afteraction",null, updatePlaceSizeDisplay);
  1076. W.model.actionManager.events.register("afterundoaction",null, updatePlaceSizeDisplay);
  1077. W.model.actionManager.events.register("afterclearactions",null, updatePlaceSizeDisplay);
  1078. W.model.actionManager.events.register("noActions",null, noActions);
  1079. updatePlaceSizeDisplay();
  1080. }
  1081.  
  1082. function removePlaceSizeHandlers(){
  1083. W.selectionManager.events.unregister("selectionchanged", null, updatePlaceSizeDisplay);
  1084. W.model.actionManager.events.unregister("afteraction",null, updatePlaceSizeDisplay);
  1085. W.model.actionManager.events.unregister("afterundoaction",null, updatePlaceSizeDisplay);
  1086. W.model.actionManager.events.unregister("afterclearactions",null, updatePlaceSizeDisplay);
  1087. W.model.actionManager.events.unregister("noActions",null, noActions);
  1088. }
  1089.  
  1090. function ShowPlaceLocatorCrosshair(){
  1091. $('#pieCrosshairs').remove();
  1092. if(W.selectionManager.selectedItems.length > 0){
  1093. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  1094. var panelWidth = $('#landmark-edit-general').width();
  1095. var $crosshairs;
  1096. if(W.selectionManager.selectedItems[0].model.attributes.categories.contains("RESIDENCE_HOME")){
  1097. $('.landmark > .tab-content').css('position', 'relative');
  1098. $crosshairs = $('<div style="position:absolute; z-index:100; cursor:pointer; top:0; right:0;" id="pieCrosshairs" title="Zoom and center on Place"><i class="fa fa-crosshairs fa-lg" id="placeCrosshair" aria-hidden="true"></i></div>');
  1099. $('.landmark > .tab-content').append($crosshairs);
  1100. }
  1101. else{
  1102. $crosshairs = $('<div style="float:right; z-index:100; cursor:pointer; top:0; right:0;" id="pieCrosshairs" title="Zoom and center on Place"><i class="fa fa-crosshairs fa-lg" id="placeCrosshair" aria-hidden="true"></i></div>');
  1103. $('#landmark-edit-general > form > div:nth-child(1) > i').after($crosshairs);
  1104. }
  1105. $('#pieCrosshairs').click(function(){
  1106. CenterOnPlace(W.selectionManager.selectedItems[0].model, settings.PlaceZoom);
  1107. });
  1108.  
  1109. $('#pieCrosshairs').mouseenter(function(e) {
  1110. //var changedThisPl = getKMLPermalink(wazePL.getAttribute('href'));
  1111. window.addEventListener('keydown', copyPLHotkeyEvent, false);
  1112. });
  1113.  
  1114. $('#pieCrosshairs').mouseleave('mouseleave', function() {
  1115. window.removeEventListener('keydown', copyPLHotkeyEvent);
  1116. });
  1117. }
  1118. }
  1119. }
  1120.  
  1121. var copyPLHotkeyEvent = function(e) {
  1122. if ((e.metaKey || e.ctrlKey) && (e.which === 67))
  1123. copyToClipboard(getPermalink(wazePL.getAttribute('href')));
  1124. };
  1125.  
  1126. var BusinessPLAMode = false;
  1127. function ShowParkingLotButton(){
  1128. $('#piePLAButton').remove();
  1129.  
  1130. if(W.selectionManager.selectedItems.length > 0){
  1131. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  1132. var $PLAButton;
  1133. if(!(W.selectionManager.selectedItems[0].model.attributes.categories.contains("RESIDENCE_HOME") || W.selectionManager.selectedItems[0].model.attributes.categories.contains("PARKING_LOT"))){
  1134. $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>');
  1135. $('#landmark-edit-general > form > div:nth-child(1) > i').after($PLAButton);
  1136.  
  1137. $('#piePLAButton').click(function(){
  1138. if(!BusinessPLAMode){
  1139. BusinessPLAMode = true;
  1140. businessPLAPlaceName = W.selectionManager.selectedItems[0].model.attributes.name;
  1141. businessPLAPlaceAddress = W.selectionManager.selectedItems[0].model.getAddress().attributes;
  1142. //businessPLAPlacePhone = W.selectionManager.selectedItems[0].model.attributes.phone;
  1143. //businessPLAPlaceURL = W.selectionManager.selectedItems[0].model.attributes.url;
  1144. startBusinessPLAPlacementMode();
  1145. if(!isChecked("layer-switcher-item_parking_places")){
  1146. if(!isChecked("layer-switcher-group_places"))
  1147. $("#layer-switcher-group_places").click();
  1148. $("#layer-switcher-item_parking_places").click();
  1149. }
  1150. }
  1151. });
  1152. }
  1153. }
  1154. }
  1155. }
  1156.  
  1157. var extProviderTries = 0;
  1158. function ShowExternalProviderTooltip(){
  1159. if(isChecked('_cbShowExternalProviderTooltip'))
  1160. if(W.selectionManager.selectedItems.length > 0 && W.selectionManager.selectedItems[0].model.type === "venue"){
  1161. if($('.select2-container.uuid').length > 0)
  1162. for(var i=0; i < $('.select2-container.uuid').find('span.select2-chosen').length; i++){
  1163. extProviderTries = 0;
  1164. ReadExtProviderText(i, extProviderTries);
  1165. }
  1166. }
  1167. }
  1168.  
  1169. var calibratingAngledWidth = false;
  1170. function ShowPLSpotEstimatorButton(){
  1171. $('.PIEParkingSpotEstimatorButton').remove();
  1172.  
  1173. if(W.selectionManager.selectedItems.length > 0){
  1174. if(W.selectionManager.selectedItems[0].model.type === "venue" && W.selectionManager.selectedItems[0].model.attributes.categories.includes("PARKING_LOT")){
  1175. var $ParkingSpotEstimatorButton;
  1176. $ParkingSpotEstimatorButton = $('<div style="font-size:18px; float:right; z-index:100; cursor:pointer; top:0; right:0; margin-left:1px; margin-right:1px;" class="PIEParkingSpotEstimatorButton" title="' + I18n.t('pie.prefs.PSEDisplayButtonTitle') + '">#</div>');
  1177. $('#landmark-edit-general > form > div:nth-child(1) > i').after($ParkingSpotEstimatorButton);
  1178.  
  1179. $('select[name="estimatedNumberOfSpots"]').before($ParkingSpotEstimatorButton.clone())
  1180.  
  1181. $('.PIEParkingSpotEstimatorButton').click(ShowPLSpotEstimator);
  1182. }
  1183. }
  1184. else
  1185. $('#PIEParkingSpotEstimator').remove();//if they de-select the Place, remove the tool from the screen
  1186. }
  1187.  
  1188. function startPLSpotEstimatorDrawMode(){
  1189. let polyDrawFeatureOptions = {callbacks : {"done": PLSpotEstimatordoneHandler, "point": pointHandler}};
  1190.  
  1191. PLSpotEstimatordrawControl = new OpenLayers.Control.DrawFeature(PLSpotEstimatorLayer, OpenLayers.Handler.Path, polyDrawFeatureOptions);
  1192. W.map.addControl(PLSpotEstimatordrawControl);
  1193. PLSpotEstimatordrawControl.activate();
  1194.  
  1195. $('div#WazeMap.view-area.olMap').keydown(PLSpotEstimatorkeyUpHandler);
  1196. }
  1197.  
  1198. function startPLSpotEstimatorCalibrationMode(){
  1199. let polyDrawFeatureOptions = {callbacks : {"done": PLSpotEstimatorCalibrationdoneHandler, "point": pointHandler}};
  1200.  
  1201. PLSpotEstimatorCalibrationdrawControl = new OpenLayers.Control.DrawFeature(PLSpotEstimatorCalibrationLayer, OpenLayers.Handler.Path, polyDrawFeatureOptions);
  1202. W.map.addControl(PLSpotEstimatorCalibrationdrawControl);
  1203. PLSpotEstimatorCalibrationdrawControl.activate();
  1204.  
  1205. $('div#WazeMap.view-area.olMap').keydown(PLSpotEstimatorCalibrationkeyUpHandler);
  1206. }
  1207.  
  1208. function pointHandler() {
  1209. isDrawing = true;
  1210. }
  1211.  
  1212. function PLSpotEstimatorkeyUpHandler(e){
  1213. if (e.keyCode == 27){
  1214. if (isDrawing) {
  1215. PLSpotEstimatordrawControl.cancel();
  1216. isDrawing = false;
  1217. } else {
  1218. disablePLSpotEstimatorDrawMode();
  1219. if(PLSpotEstimatordrawControl !== "undefined")
  1220. PLSpotEstimatordrawControl.destroy();
  1221. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1222. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1223. }
  1224. e.stopPropagation();
  1225. }
  1226. else if(e.keyCode == 90 && e.ctrlKey)
  1227. PLSpotEstimatordrawControl.undo();
  1228. else if(e.keyCode == 89 && e.ctrlKey)
  1229. PLSpotEstimatordrawControl.redo();
  1230. else if(e.keyCode == 13)
  1231. PLSpotEstimatordrawControl.finishSketch();
  1232. }
  1233.  
  1234. function PLSpotEstimatorCalibrationkeyUpHandler(e){
  1235. if (e.keyCode == 27){
  1236. if (isDrawing) {
  1237. PLSpotEstimatorCalibrationdrawControl.cancel();
  1238. isDrawing = false;
  1239. } else {
  1240. disablePLSpotEstimatorCalibrationDrawMode();
  1241. if(PLSpotEstimatorCalibrationdrawControl !== "undefined")
  1242. PLSpotEstimatorCalibrationdrawControl.destroy();
  1243. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1244. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1245. }
  1246. e.stopPropagation();
  1247.  
  1248. }
  1249. else if(e.keyCode == 90 && e.ctrlKey)
  1250. PLSpotEstimatorCalibrationdrawControl.undo();
  1251. else if(e.keyCode == 89 && e.ctrlKey)
  1252. PLSpotEstimatorCalibrationdrawControl.redo();
  1253. else if(e.keyCode == 13)
  1254. PLSpotEstimatorCalibrationdrawControl.finishSketch();
  1255. }
  1256.  
  1257. function disablePLSpotEstimatorDrawMode(){
  1258. $("#map").off('click');
  1259. if(PLSpotEstimatordrawControl){
  1260. PLSpotEstimatordrawControl.deactivate();
  1261. PLSpotEstimatordrawControl.destroy();
  1262. }
  1263. PLSpotEstimatorLayer.removeAllFeatures();
  1264. $('div#WazeMap.view-area.olMap').off('keydown');
  1265. }
  1266.  
  1267. function disablePLSpotEstimatorCalibrationDrawMode(){
  1268. $("#map").off('click');
  1269. if(PLSpotEstimatorCalibrationdrawControl){
  1270. PLSpotEstimatorCalibrationdrawControl.deactivate();
  1271. PLSpotEstimatorCalibrationdrawControl.destroy();
  1272. }
  1273. PLSpotEstimatorCalibrationLayer.removeAllFeatures();
  1274. $('div#WazeMap.view-area.olMap').off('keydown');
  1275. }
  1276.  
  1277. function PLSpotEstimatordoneHandler(geom){
  1278. var style = {strokeWidth: 3, strokeColor: '#ee9900'};
  1279. PLSpotEstimatorLayer.addFeatures(new OL.Feature.Vector(geom,{}, style));
  1280.  
  1281. var totalSpots = 0;
  1282. PLSpotEstimatorLayer.features.forEach(function(f) {
  1283. var spots = Math.round(WazeWrap.Geometry.calculateDistance(f.geometry.components)/($('#PIE90DegreeSpotWidthDraw').hasClass("PSESelected") ? $('#PIE90DegreeSpotWidth')[0].value : $('#PIEAngledSpotWidth')[0].value));
  1284. totalSpots += spots;
  1285. });
  1286.  
  1287. $('#PIEPLSpotEstimatorTotal')[0].innerText = totalSpots;
  1288.  
  1289. if(totalSpots > 0)
  1290. $('#PIESetParkingSpacesToPlace').prop('disabled', false);
  1291. isDrawing = false;
  1292. }
  1293.  
  1294. function PLSpotEstimatorCalibrationdoneHandler(geom){
  1295. var style = {strokeWidth: 3, strokeColor: '#00ee00'};
  1296. PLSpotEstimatorCalibrationLayer.addFeatures(new OL.Feature.Vector(geom,{}, style));
  1297. let totalLength = 0;
  1298.  
  1299. PLSpotEstimatorCalibrationLayer.features.forEach(function(f) {
  1300. let length = Math.round(WazeWrap.Geometry.calculateDistance(f.geometry.components)*100)/100;
  1301. totalLength += length;
  1302. });
  1303.  
  1304. if(calibratingAngledWidth){
  1305. $('#PIEAngledSpotWidth')[0].value = totalLength;
  1306. settings.PLAngledSpotWidth = totalLength;
  1307. }
  1308. else{
  1309. $('#PIE90DegreeSpotWidth')[0].value = totalLength;
  1310. settings.PLNormalSpotWidth = totalLength;
  1311. }
  1312. saveSettings();
  1313.  
  1314. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1315. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1316.  
  1317. isDrawing = false;
  1318. disablePLSpotEstimatorCalibrationDrawMode();
  1319. }
  1320.  
  1321. function ShowPLSpotEstimator(){
  1322. if($('#PIEParkingSpotEstimator').length > 0)
  1323. $('#PIEParkingSpotEstimator').remove();
  1324. else{
  1325. if(W.selectionManager.selectedItems.length > 0){
  1326. if(W.selectionManager.selectedItems[0].model.type === "venue" && W.selectionManager.selectedItems[0].model.attributes.categories.includes("PARKING_LOT")){
  1327.  
  1328. var $PLSpotEstimator = $('<div>');
  1329. $PLSpotEstimator.html([
  1330. '<div style="position: absolute; text-align:center; z-index:1000; background-color:white; top:20px; left:300px; border-radius:20px; border: 2px solid; width: 300px; padding-left:10px; padding-right:10px; padding-bottom:5px;" id="PIEParkingSpotEstimator">',
  1331. '<span style="font-weight:bold;">' + I18n.t('pie.prefs.PSEParkingSpaceEstimator') + '</span><i class="fa fa-window-close-o" aria-hidden="true" style="float:right; cursor:pointer;" id="PIECloseParkingSpotEstimator"></i>',
  1332. '<hr>',
  1333. '<div style=" display:flex; justify-content:space-between;">',
  1334. '<div style="display: inline;">' + I18n.t('pie.prefs.PSELayoutType') + '<br/><br/>' + I18n.t('pie.prefs.PSESpotWidth') + '</div>',
  1335. '<div style="display: inline;">' + I18n.t('pie.prefs.PSE90degree') + '<br/><br/><input type="text" size=2 id="PIE90DegreeSpotWidth"><button id="PIE90DegreeSpotWidthCalibration" title="Measure the width of a single 90 degree parking spot">' + I18n.t('pie.prefs.PSECal') + '</button><br/><button id="PIE90DegreeSpotWidthDraw" class="fa fa-pencil" title="' + I18n.t('pie.prefs.PSEDraw90DegreeTitle') + '"></button></div>',
  1336. '<div style="display: inline;">' + I18n.t('pie.prefs.PSEAngled') + '<br/><br/><input type="text" size=2 id="PIEAngledSpotWidth"><button id="PIEAngledSpotWidthCalibration" title="Measure the width of a single angled degree parking spot">' + I18n.t('pie.prefs.PSECal') + '</button><br/><button id="PIEAngledSpotWidthDraw" class="fa fa-pencil" title="' + I18n.t('pie.prefs.PSEDrawAngledTitle') + '"></button></div>',
  1337. '</div>',
  1338. '<hr>',
  1339. '<div>' + I18n.t('pie.prefs.PSEEstimatedNumOfSpots') + '<span id="PIEPLSpotEstimatorTotal" style="color:blue; padding:0px 3px; font-weight:900; font-size:1.2em;" >0</span>&emsp;<div style="display:inline-block;"><button id="PIESetParkingSpacesToPlace" disabled>' + I18n.t('pie.prefs.PSESet') + '</button></div></div>',
  1340. '</div>'
  1341. ].join(' '));
  1342.  
  1343. $("#WazeMap").append($PLSpotEstimator.html());
  1344.  
  1345. $("#PIECloseParkingSpotEstimator").click(function(){
  1346. $('#PIEParkingSpotEstimator').remove();
  1347. disablePLSpotEstimatorDrawMode();
  1348. disablePLSpotEstimatorCalibrationDrawMode();
  1349. if(PLSpotEstimatordrawControl != null)
  1350. PLSpotEstimatordrawControl.destroy();
  1351. if(PLSpotEstimatorCalibrationdrawControl != null)
  1352. PLSpotEstimatorCalibrationdrawControl.destroy();
  1353. });
  1354.  
  1355. $('#PIEParkingSpotEstimator').keydown(function(e){
  1356. disablePLSpotEstimatorDrawMode();
  1357. disablePLSpotEstimatorCalibrationDrawMode();
  1358. if(PLSpotEstimatordrawControl != null)
  1359. PLSpotEstimatordrawControl.destroy();
  1360. if(PLSpotEstimatorCalibrationdrawControl != null)
  1361. PLSpotEstimatorCalibrationdrawControl.destroy();
  1362. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1363. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1364. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1365. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1366. });
  1367.  
  1368. $('#PIE90DegreeSpotWidth')[0].value = settings.PLNormalSpotWidth;
  1369. $('#PIEAngledSpotWidth')[0].value = settings.PLAngledSpotWidth;
  1370.  
  1371. $('#PIESetParkingSpacesToPlace').click(function(){
  1372. let spotCount = $('#PIEPLSpotEstimatorTotal')[0].innerText;
  1373. if(spotCount != "0"){
  1374. let myPlace = W.selectionManager.selectedItems[0].model;
  1375. let existingAttr = myPlace.attributes.categoryAttributes.PARKING_LOT;
  1376. let newAttr = {};
  1377. if (existingAttr) {
  1378. for (var prop in existingAttr) {
  1379. let value = existingAttr[prop];
  1380. if (Array.isArray(value)) value = value.clone();
  1381. newAttr[prop] = value;
  1382. };
  1383. }
  1384. let spotPropValue;
  1385. spotCount = parseInt(spotCount);
  1386. if(spotCount < 11)
  1387. spotPropValue = "R_1_TO_10"
  1388. else if(spotCount < 31)
  1389. spotPropValue = "R_11_TO_30"
  1390. else if(spotCount < 61)
  1391. spotPropValue = "R_31_TO_60"
  1392. else if(spotCount < 101)
  1393. spotPropValue = "R_61_TO_100"
  1394. else if(spotCount < 301)
  1395. spotPropValue = "R_101_TO_300"
  1396. else if(spotCount < 601)
  1397. spotPropValue = "R_301_TO_600"
  1398. else if(spotCount >= 601)
  1399. spotPropValue = "R_600_PLUS"
  1400.  
  1401. newAttr.estimatedNumberOfSpots = spotPropValue;
  1402. W.model.actionManager.add(new UpdateObject(myPlace, {'categoryAttributes': {PARKING_LOT: newAttr}}));
  1403. }
  1404. });
  1405.  
  1406. $('#PIE90DegreeSpotWidth').focusout(function(){
  1407. let width = $(this)[0].value;
  1408. if(width == "" || width == "0")
  1409. $(this)[0].value = 3.44;
  1410. settings.PLNormalSpotWidth = width;
  1411. saveSettings();
  1412. });
  1413.  
  1414. $('#PIEAngledSpotWidth').focusout(function(){
  1415. let width = $(this)[0].value;
  1416. if(width == "" || width == "0")
  1417. $(this)[0].value = 3;
  1418. settings.PLAngledSpotWidth = width;
  1419. saveSettings();
  1420. });
  1421.  
  1422. $('#PIE90DegreeSpotWidthDraw').click(function() {
  1423. if (PLSpotEstimatordrawControl && PLSpotEstimatordrawControl.active) {
  1424. PLSpotEstimatordrawControl.deactivate();
  1425. PLSpotEstimatordrawControl.destroy();
  1426. $('div#WazeMap.view-area.olMap').off('keyup');
  1427. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1428. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1429. } else {
  1430. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1431. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1432. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1433. $('#PIE90DegreeSpotWidthDraw').addClass("PSESelected");
  1434. startPLSpotEstimatorDrawMode();
  1435. }
  1436. });
  1437.  
  1438. $('#PIEAngledSpotWidthDraw').click(function() {
  1439. if (PLSpotEstimatordrawControl && PLSpotEstimatordrawControl.active) {
  1440. PLSpotEstimatordrawControl.deactivate();
  1441. PLSpotEstimatordrawControl.destroy();
  1442. $('div#WazeMap.view-area.olMap').off('keyup');
  1443. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1444. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1445. } else {
  1446. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1447. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1448. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1449. $('#PIEAngledSpotWidthDraw').addClass("PSESelected");
  1450. startPLSpotEstimatorDrawMode();
  1451. }
  1452. });
  1453.  
  1454. $('#PIE90DegreeSpotWidthCalibration').click(function(){
  1455. if(PLSpotEstimatordrawControl){
  1456. PLSpotEstimatordrawControl.deactivate();
  1457. PLSpotEstimatordrawControl.destroy();
  1458. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1459. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1460. }
  1461. if(PLSpotEstimatorCalibrationdrawControl){
  1462. PLSpotEstimatorCalibrationdrawControl.deactivate();
  1463. PLSpotEstimatorCalibrationdrawControl.destroy();
  1464. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1465. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1466. }
  1467. $('#PIE90DegreeSpotWidthCalibration').addClass("PSESelected");
  1468. calibratingAngledWidth = false;
  1469. startPLSpotEstimatorCalibrationMode();
  1470. });
  1471.  
  1472. $('#PIEAngledSpotWidthCalibration').click(function(){
  1473. if(PLSpotEstimatordrawControl){
  1474. PLSpotEstimatordrawControl.deactivate();
  1475. PLSpotEstimatordrawControl.destroy();
  1476. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1477. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1478. }
  1479. if(PLSpotEstimatorCalibrationdrawControl){
  1480. PLSpotEstimatorCalibrationdrawControl.deactivate();
  1481. PLSpotEstimatorCalibrationdrawControl.destroy();
  1482. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1483. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1484. }
  1485. $('#PIEAngledSpotWidthCalibration').addClass("PSESelected");
  1486. calibratingAngledWidth = true;
  1487. startPLSpotEstimatorCalibrationMode();
  1488. });
  1489. }
  1490. }
  1491. else{
  1492. disablePLSpotEstimatorDrawMode();
  1493. disablePLSpotEstimatorCalibrationDrawMode();
  1494. }
  1495. }
  1496. }
  1497.  
  1498. function ImageDialogEnhancement(){
  1499. $('.venue-image-dialog .details').wrap("<div id='detailsWrap'></div>");
  1500. $('#detailsWrap').append("<div style='position:absolute;right:12px; bottom:25px;'><i class='fa fa-trash-o fa-lg' id='DeleteFromImageDialog' style='cursor:pointer;' aria-hidden='true'></i></div>");
  1501. var dataID = $('#detailsWrap').parent().find('img')[0].src;
  1502. dataID = /_(.+)/g.exec(dataID)[1];
  1503. $('#DeleteFromImageDialog').click(function(){
  1504. $('div[data-id="' + dataID + '"] button.image-delete-button').click();
  1505. $('.venue-image-dialog').find('.close').click();
  1506. });
  1507.  
  1508. //Image dialog navigation arrows
  1509. if(W.selectionManager.selectedItems[0].model.attributes.images.length > 1){
  1510. let thisImageIndex;
  1511. let PlaceImages = W.selectionManager.selectedItems[0].model.attributes.images;
  1512. for(let i=0; i<PlaceImages.length; i++){
  1513. if(W.selectionManager.selectedItems[0].model.attributes.images[i].id === dataID){
  1514. thisImageIndex = i;
  1515. break;
  1516. }
  1517. }
  1518. $('.modal-body').addClass('imgcon');
  1519. $('.modal-body').prepend((thisImageIndex + 1) + "/" + W.selectionManager.selectedItems[0].model.attributes.images.length);
  1520. $('.imgcon').append('<div class="imnav"><div class="prim control"></div><div class="zmim control"></div><div class="neim control"></div></div>');
  1521. $('.prim').click(function(){
  1522. let prevIndex;
  1523.  
  1524. if(thisImageIndex == 0)
  1525. prevIndex = PlaceImages.length - 1;
  1526. else
  1527. prevIndex = thisImageIndex - 1;
  1528. dataID = PlaceImages[prevIndex].id;
  1529. $('div[data-id="' + dataID +'"] img').click();
  1530. });
  1531.  
  1532. $('.neim').click(function(){
  1533. let nextIndex;
  1534.  
  1535. if(thisImageIndex == PlaceImages.length - 1)
  1536. nextIndex = 0;
  1537. else
  1538. nextIndex = thisImageIndex + 1;
  1539. dataID = PlaceImages[nextIndex].id;
  1540. $('div[data-id="' + dataID +'"] img').click();
  1541. });
  1542. }
  1543. }
  1544.  
  1545. function ReadExtProviderText(index, extProviderTries){
  1546. var providersList = $('.select2-container.uuid').find('span.select2-chosen');
  1547. if($('.select2-container.uuid').find('span.select2-chosen')[index].innerHTML == "&nbsp;" && extProviderTries <= 20)
  1548. setTimeout(function(){ReadExtProviderText(index, extProviderTries++);}, 50);
  1549. else{
  1550. if($('#' + providersList[index].id).parent().parent().data('original-title') == null){
  1551. $('#' + providersList[index].id).parent().parent().attr('title', $('.select2-container.uuid').find('span.select2-chosen')[index].innerText);
  1552. $('#' + providersList[index].id).parent().parent().tooltip()
  1553. }
  1554. else
  1555. $('#' + providersList[index].id).parent().parent().attr('data-original-title', $('.select2-container.uuid').find('span.select2-chosen')[index].innerText);
  1556. }
  1557. }
  1558.  
  1559. function ShowCopyPlaceButton(){
  1560. $('#pieCopyPlaceButton').remove();
  1561.  
  1562. if(W.selectionManager.selectedItems.length > 0){
  1563. //W.selectionManager.selectedItems[0].model.attributes.id.match(/(\d+\.){2}\d+/)
  1564. if(W.selectionManager.selectedItems[0].model.type === "venue"){// && (typeof W.selectionManager.selectedItems[0].model.attributes.id === "string")){ //id is only a string if the Place has been saved - don't allow copying unsaved Places
  1565. var $PlaceCopyButton;
  1566. if(!W.selectionManager.selectedItems[0].model.attributes.categories.contains("RESIDENCE_HOME")){
  1567. $PlaceCopyButton = $('<div style="float:right; z-index:100; cursor:pointer; top:0; right:0; margin-left:1px; margin-right:1px;" id="pieCopyPlaceButton" title="Creates a copy of this Place"><i class="fa fa-files-o fa-lg" aria-hidden="true"></i></div>');
  1568. $('#landmark-edit-general > form > div:nth-child(1) > i').after($PlaceCopyButton);
  1569.  
  1570. $('#pieCopyPlaceButton').click(function(){
  1571. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  1572. var AddPlace = require("Waze/Action/AddLandmark");
  1573.  
  1574. var NewPlace = new PlaceObject();
  1575. var oldPlace = W.selectionManager.selectedItems[0].model;
  1576.  
  1577. NewPlace.attributes.name = oldPlace.attributes.name + " (copy)";
  1578. NewPlace.attributes.phone = oldPlace.attributes.phone;
  1579. NewPlace.attributes.url = oldPlace.attributes.url;
  1580. NewPlace.attributes.categories = oldPlace.attributes.categories.clone();
  1581. NewPlace.attributes.aliases = oldPlace.attributes.aliases.clone();
  1582. NewPlace.attributes.description = oldPlace.attributes.description;
  1583. NewPlace.attributes.houseNumber = oldPlace.attributes.houseNumber;
  1584. NewPlace.attributes.lockRank = oldPlace.attributes.lockRank;
  1585. NewPlace.attributes.geometry = oldPlace.attributes.geometry.clone();
  1586.  
  1587. if(oldPlace.attributes.geometry.toString().match(/^POLYGON/)){
  1588. var convertedCoords;
  1589. for(var i=0; i<NewPlace.attributes.geometry.components[0].components.length - 1; i++){
  1590. convertedCoords = WazeWrap.Geometry.ConvertTo4326(NewPlace.attributes.geometry.components[0].components[i].x, NewPlace.attributes.geometry.components[0].components[i].y);
  1591. convertedCoords.lon += WazeWrap.Geometry.CalculateLongOffsetGPS(5, convertedCoords.long, convertedCoords.lat);
  1592. NewPlace.attributes.geometry.components[0].components[i].x = WazeWrap.Geometry.ConvertTo900913(convertedCoords.lon, convertedCoords.lat).lon;
  1593. }
  1594. }
  1595. else{
  1596. var convertedCoords = WazeWrap.Geometry.ConvertTo4326(oldPlace.attributes.geometry.x, oldPlace.attributes.geometry.y);
  1597. convertedCoords.lon += WazeWrap.Geometry.CalculateLongOffsetGPS(5, convertedCoords.long, convertedCoords.lat);
  1598. NewPlace.attributes.geometry.x = WazeWrap.Geometry.ConvertTo900913(convertedCoords.lon, convertedCoords.lat).lon;
  1599. }
  1600.  
  1601. NewPlace.attributes.services = oldPlace.attributes.services.clone();
  1602. NewPlace.attributes.openingHours = oldPlace.attributes.openingHours.clone();
  1603. NewPlace.attributes.streetID = oldPlace.attributes.streetID;
  1604.  
  1605. if(NewPlace.attributes.categories.contains("GAS_STATION"))
  1606. NewPlace.attributes.brand = oldPlace.attributes.brand;
  1607.  
  1608. if(NewPlace.attributes.categories.contains("PARKING_LOT")){
  1609. NewPlace.attributes.categoryAttributes.PARKING_LOT = {};
  1610. var PLAttribute = oldPlace.attributes.categoryAttributes.PARKING_LOT;
  1611. if(!(PLAttribute.lotType == null))
  1612. NewPlace.attributes.categoryAttributes.PARKING_LOT.lotType = oldPlace.attributes.categoryAttributes.PARKING_LOT.lotType.clone();
  1613. if(!(PLAttribute.canExitWhileClosed == null))
  1614. NewPlace.attributes.categoryAttributes.PARKING_LOT.canExitWhileClosed = oldPlace.attributes.categoryAttributes.PARKING_LOT.canExitWhileClosed;
  1615. if(!(PLAttribute.costType == null))
  1616. NewPlace.attributes.categoryAttributes.PARKING_LOT.costType = oldPlace.attributes.categoryAttributes.PARKING_LOT.costType;
  1617. if(!(PLAttribute.estimatedNumberOfSpots == null))
  1618. NewPlace.attributes.categoryAttributes.PARKING_LOT.estimatedNumberOfSpots = oldPlace.attributes.categoryAttributes.PARKING_LOT.estimatedNumberOfSpots;
  1619. if(!(PLAttribute.hasTBR == null))
  1620. NewPlace.attributes.categoryAttributes.PARKING_LOT.hasTBR = oldPlace.attributes.categoryAttributes.PARKING_LOT.hasTBR;
  1621. if(!(PLAttribute.lotType == null))
  1622. NewPlace.attributes.categoryAttributes.PARKING_LOT.lotType = oldPlace.attributes.categoryAttributes.PARKING_LOT.lotType.clone();
  1623. if(!(PLAttribute.parkingType == null))
  1624. NewPlace.attributes.categoryAttributes.PARKING_LOT.parkingType = oldPlace.attributes.categoryAttributes.PARKING_LOT.parkingType;
  1625. if(!(PLAttribute.paymentType == null))
  1626. NewPlace.attributes.categoryAttributes.PARKING_LOT.paymentType = oldPlace.attributes.categoryAttributes.PARKING_LOT.paymentType.clone();
  1627. }
  1628.  
  1629. W.model.actionManager.add(new AddPlace(NewPlace));
  1630.  
  1631. var newAttributes, UpdateFeatureAddress = require('Waze/Action/UpdateFeatureAddress'), address = oldPlace.getAddress();
  1632. var MultiAction = require("Waze/Action/MultiAction");
  1633. var multiaction = new MultiAction();
  1634. multiaction.setModel(W.model);
  1635.  
  1636. console.log(address);
  1637. newAttributes = {
  1638. countryID: address.attributes.country.id,
  1639. stateID: address.attributes.state.id,
  1640. emptyCity: address.attributes.city.attributes.name ? null : true,
  1641. emptyStreet: address.attributes.street.name ? null : true
  1642. };
  1643.  
  1644. newAttributes.streetName = address.attributes.street.name;
  1645. var cityName = address.attributes.city.attributes.name;
  1646.  
  1647. if(cityName !== "")
  1648. newAttributes.emptyCity = null;
  1649. newAttributes.cityName = cityName;
  1650.  
  1651. var UFA = new UpdateFeatureAddress(NewPlace, newAttributes);
  1652. UFA.options.updateHouseNumber = true;
  1653. multiaction.doSubAction(UFA);
  1654. W.model.actionManager.add(multiaction);
  1655. Waze.selectionManager.select([NewPlace]);
  1656. });
  1657. }
  1658. }
  1659. }
  1660. }
  1661.  
  1662. function ShowSearchButton(){
  1663. $('#pieSearchButton').remove();
  1664. if(W.selectionManager.selectedItems.length > 0){
  1665. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  1666. 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>');
  1667. $('.address-edit-view').before($search);
  1668. $('#pieSearchButton').click(function(){
  1669. var address = $('.full-address')[0].innerHTML;
  1670. var noCity = I18n.translations[I18n.currentLocale()].edit.address.no_city;
  1671. var noStreet = I18n.translations[I18n.currentLocale()].edit.address.no_street;
  1672.  
  1673. address = address.replace(noCity + ",","");
  1674. if(address !== I18n.translations[I18n.currentLocale()].edit.landmark.no_address)
  1675. $('.search-query')[0].value = address;
  1676. });
  1677. }
  1678. }
  1679. }
  1680.  
  1681. function ShowClearDescription(){
  1682. $('#landmark-edit-general textarea').parent().append('<i class="fa fa-times-circle clearButton" style="position:absolute; top:0; right:0;"></i>');
  1683. $('#landmark-edit-general textarea').parent().css('position', 'relative');
  1684. $('.clearButton').click(function(){
  1685. W.model.actionManager.add(new UpdateObject( W.selectionManager.selectedItems[0].model, { description: "" }));
  1686. });
  1687. }
  1688.  
  1689. function MoveAddress(){
  1690. if(W.selectionManager.selectedItems.length > 0)
  1691. if(W.selectionManager.selectedItems[0].model.type === "venue")
  1692. $('#landmark-edit-general').prepend($('.address-edit.side-panel-section'));
  1693. }
  1694.  
  1695. function MoveHNEntry(){
  1696. if(W.selectionManager.selectedItems.length > 0)
  1697. if(W.selectionManager.selectedItems[0].model.type === "venue")
  1698. $('.edit-button').click(function(){
  1699. $('.street-name').parent().parent().before($('.house-number').parent().parent());
  1700. });
  1701. }
  1702.  
  1703. function AddPlaceCategoriesButtons(){
  1704. $('#piePlaceCategoriesButtonsContainer').remove();
  1705. if(W.selectionManager.selectedItems.length > 0){
  1706. if(W.selectionManager.selectedItems[0].model.type === "venue"){
  1707. var $container = $('<div>',{id:'piePlaceCategoriesButtonsContainer', style:'white-space: nowrap;'});
  1708. var categoryOptions = $('[id^=pieItem]');
  1709.  
  1710. var $button = $('<div>',{id:'btnPlaceCatClear', title:'Clear current categories', style:'display:inline-block; cursor:pointer'}).click(function() { onPlaceCategoriesButtonsClick(this.id); });
  1711. $button.append('<span class="fa fa-times" style="font-size:20px; color:red;"></span>');
  1712. $container.append($button);
  1713.  
  1714. for(var i=0;i<categoryOptions.length;i++){
  1715. var name = categoryOptions[i].options[categoryOptions[i].selectedIndex].innerHTML;
  1716. var icon = categoryOptions[i].options[categoryOptions[i].selectedIndex].getAttribute("data-icon");
  1717. var divid = 'btnPlaceCat' + categoryOptions[i].value;
  1718. if(categoryOptions[i].value !== resCategory && categoryOptions[i].value !== "PARKING_LOT"){
  1719. $button = $('<div>',{id:divid, title:name.replace('&amp;', '&'), style:'display:inline-block; cursor:pointer', 'data-category':categoryOptions[i].value}).click(function() { onPlaceCategoriesButtonsClick(this.id); });
  1720. $button.append('<span class="'+icon+'" style="font-size:20px;"></span>');
  1721.  
  1722. $container.append($button);
  1723. }
  1724. }
  1725. }
  1726.  
  1727. $('.categories.controls').before($container);
  1728. }
  1729. }
  1730.  
  1731. function onPlaceCategoriesButtonsClick(buttonid){
  1732. if(buttonid === "btnPlaceCatClear"){
  1733. var blankCategories = []; //W.selectionManager.selectedItems[0].model.attributes.categories.clone();
  1734. //console.log(blankCategories.length);
  1735. //blankCategories.splice(0, blankCategories.length);
  1736. //console.log(blankCategories);
  1737. W.model.actionManager.add(new UpdateObject(W.selectionManager.selectedItems[0].model, { categories: blankCategories }));
  1738. }
  1739. else{
  1740. var newCategories = W.selectionManager.selectedItems[0].model.attributes.categories.clone();
  1741. //console.log($('#'+buttonid)[0].getAttribute("data-category"));
  1742. newCategories.push($('#'+buttonid)[0].getAttribute("data-category"));
  1743. W.model.actionManager.add(new UpdateObject(W.selectionManager.selectedItems[0].model, {categories: newCategories}));
  1744. }
  1745. }
  1746.  
  1747. function CenterOnPlace(venue, zoom){
  1748. var centroid = venue.geometry.getCentroid();
  1749. W.map.setCenter([centroid.x, centroid.y], zoom);
  1750. }
  1751.  
  1752. function isChecked(checkboxId) {
  1753. return $('#' + checkboxId).is(':checked');
  1754. }
  1755.  
  1756. function setChecked(checkboxId, checked) {
  1757. $('#' + checkboxId).prop('checked', checked);
  1758. }
  1759.  
  1760. function noActions(){
  1761. 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.
  1762. }
  1763.  
  1764. function updatePlaceSizeDisplay(){
  1765. var count = W.selectionManager.selectedItems.length;
  1766. var metersArea = 0;
  1767. var bold = false;
  1768. if(count === 1){
  1769. var venue = W.selectionManager.selectedItems[0];
  1770. var isArea = venue.geometry.toString().match(/^POLYGON/);
  1771. //var isPoint = venue.geometry.toString().match(/^POINT/);
  1772.  
  1773. if(venue.model.type === "venue" && isArea){
  1774. if($('#AreaSize'))
  1775. $('#AreaSize').remove();
  1776. metersArea = W.selectionManager.selectedItems[0].model.geometry.getGeodesicArea(W.map.getProjectionObject());
  1777.  
  1778. if(metersArea > 0 && isArea){
  1779. var ftArea = Math.round(metersArea * 10.76391 *100)/100;
  1780.  
  1781. var list = $('#landmark-edit-general > ul')[0];
  1782. var newList = document.createElement("UL");
  1783. newList.id = "AreaSize";
  1784.  
  1785. var newItem = document.createElement("LI");
  1786. if(isChecked("_cbShowAreaPlaceSizeMetric")){
  1787. newItem.innerHTML = "Area: " + metersArea.toFixed(2) + " m<sup>2</sup>";
  1788. newList.appendChild(newItem);
  1789. }
  1790.  
  1791. if(isChecked("_cbShowAreaPlaceSizeImperial")){
  1792. newItem = document.createElement("LI");
  1793. newItem.innerHTML = "Area: " + ftArea.toFixed(2) + " ft<sup>2</sup>";
  1794. newList.appendChild(newItem);
  1795. }
  1796. if(metersArea < 500){
  1797. newItem = document.createElement("LI");
  1798. 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>";
  1799. newList.appendChild(newItem);
  1800. }
  1801. if(metersArea > 20000){
  1802. newItem = document.createElement("LI");
  1803. 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>";
  1804. newList.appendChild(newItem);
  1805. }
  1806. if(list.before != null)
  1807. list.before(newList);
  1808. else{
  1809. var parent = $('#landmark-edit-general > ul')[0].parentNode;
  1810. parent.insertBefore(newList,$('#landmark-edit-general > ul')[0]);
  1811. }
  1812.  
  1813. $('#AreaSize').addClass("list-unstyled");
  1814. $('#AreaSize').addClass("additional-attributes");
  1815. }
  1816. }
  1817. }
  1818. }
  1819.  
  1820. //Using the same display for lock buttons as ClickSaver (with permission from MapoMatic) - thanks MoM!
  1821. function addLockButtons() {
  1822. if(W.selectionManager.selectedItems.length > 0){
  1823. var item = W.selectionManager.selectedItems[0];
  1824. var isRPP = (item.model.type === "venue" && item.model.attributes.residential === true);
  1825.  
  1826. if(isRPP){
  1827. var attr = item.model.attributes;
  1828. var autoRank = attr.rank;
  1829. var manualRank = attr.lockRank;
  1830. var firstManualRank = manualRank;
  1831. var userRank = WazeWrap.User.Rank() - 1;
  1832. var maxAutoRank = autoRank;
  1833. var disabled = false;
  1834.  
  1835. var $div = $('#pieRPPLockButtonsContainer');
  1836. $div.remove();
  1837. $div = $('<div>',{id:'pieRPPLockButtonsContainer',style:'margin-bottom:5px;'});
  1838. $div.append('<label class="control-label">Lock</label>');
  1839. var btnInfos = [];
  1840.  
  1841. for(var iBtn=0;iBtn<=6;iBtn++){btnInfos.push({r:iBtn,val:iBtn});}
  1842. btnInfos.forEach(function(btnInfo){
  1843. var selected = (btnInfo.val == manualRank);
  1844. disabled = userRank < btnInfo.val;
  1845. if (btnInfo.val !== 6) {
  1846. $div.append(
  1847. $('<div>', {
  1848. class:'btn btn-lh' + (selected ? ' btn-lh-selected':'') + (btnInfo.r < 6 & (userRank < btnInfo.r || disabled) ? ' disabled' : '')
  1849. })
  1850. .text(btnInfo.hasOwnProperty('title') ? btnInfo.title : btnInfo.r + 1)
  1851. .data('val',btnInfo.hasOwnProperty('val') ? btnInfo.val : btnInfo.r + 1)
  1852. .hover(function() {})
  1853. .click(function() {
  1854. if((userRank >= $(this).data('val')) && (btnInfo.r < 6)) {
  1855. W.model.actionManager.add(new UpdateObject(item.model,{lockRank:($(this).data('val'))}));
  1856. addLockButtons();
  1857. }
  1858. })
  1859. );
  1860. }
  1861. });
  1862. $('#landmark-edit-general > div.address-edit.side-panel-section').after($div);
  1863. }
  1864. }
  1865. }
  1866.  
  1867. var getPermalink = function(currPl) {
  1868. var adjustedPL = currPl.substr(currPl.lastIndexOf('editor')).replace(/&[^&]*Filter=[^&]*|&s=(\d+)/ig,'');
  1869. var lon = adjustedPL.match(/lon=(-?\d+\.\d+)/)[1];
  1870. var lat = adjustedPL.match(/lat=(-?\d+\.\d+)/)[1];
  1871. var zoom = adjustedPL.match(/zoom=\d+/)[0];
  1872. var centroid = W.selectionManager.selectedItems[0].model.geometry.getCentroid();
  1873. adjustedPL = adjustedPL.replace(lon, WazeWrap.Geometry.ConvertTo4326(centroid.x,centroid.y).lon);
  1874. adjustedPL = adjustedPL.replace(lat, WazeWrap.Geometry.ConvertTo4326(centroid.x,centroid.y).lat);
  1875. adjustedPL = adjustedPL.replace(zoom, "zoom="+settings.PlaceZoom);
  1876. if(settings.PlaceLocatorCrosshairProdPL)
  1877. return 'https://www.waze.com/' + adjustedPL;
  1878. else
  1879. return location.origin + '/' + adjustedPL;
  1880. };
  1881.  
  1882. var copyToClipboard = function(str) {
  1883. var $temp = $('<input>');
  1884. $('body').append($temp);
  1885. $temp.val(str).select();
  1886. document.execCommand('copy');
  1887. $temp.remove();
  1888. };
  1889.  
  1890. function buildItemList(itemNumber){
  1891.  
  1892. var $places = $("<div>");
  1893. $places.html([
  1894. '<select id="pieItem' + itemNumber + '">',
  1895. '<option value="CAR_SERVICES" data-icon="waze-icon-place-car" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_SERVICES + '</option>',
  1896. '<option value="GAS_STATION" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.GAS_STATION + '</option>',
  1897. '<option value="GARAGE_AUTOMOTIVE_SHOP" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.GARAGE_AUTOMOTIVE_SHOP + '</option>',
  1898. '<option value="CAR_WASH" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_WASH + '</option>',
  1899. '<option value="CHARGING_STATION" data-icon="waze-icon-place-car">' + I18n.translations[I18n.currentLocale()].venues.categories.CHARGING_STATION + '</option>',
  1900. '<option value="TRANSPORTATION" data-icon="waze-icon-place-transportation" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.TRANSPORTATION + '</option>',
  1901. '<option value="AIRPORT" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.AIRPORT + '</option>',
  1902. '<option value="BUS_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.BUS_STATION + '</option>',
  1903. '<option value="FERRY_PIER" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.FERRY_PIER + '</option>',
  1904. '<option value="SEAPORT_MARINA_HARBOR" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.SEAPORT_MARINA_HARBOR + '</option>',
  1905. '<option value="SUBWAY_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.SUBWAY_STATION + '</option>',
  1906. '<option value="TRAIN_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TRAIN_STATION + '</option>',
  1907. '<option value="BRIDGE" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.BRIDGE + '</option>',
  1908. '<option value="TUNNEL" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TUNNEL + '</option>',
  1909. '<option value="TAXI_STATION" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TAXI_STATION + '</option>',
  1910. '<option value="JUNCTION_INTERCHANGE" data-icon="waze-icon-place-transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.JUNCTION_INTERCHANGE + '</option>',
  1911. '<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>',
  1912. '<option value="COLLEGE_UNIVERSITY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.COLLEGE_UNIVERSITY + '</option>',
  1913. '<option value="SCHOOL" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.SCHOOL + '</option>',
  1914. '<option value="CONVENTIONS_EVENT_CENTER" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.CONVENTIONS_EVENT_CENTER + '</option>',
  1915. '<option value="GOVERNMENT" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.GOVERNMENT + '</option>',
  1916. '<option value="LIBRARY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.LIBRARY + '</option>',
  1917. '<option value="CITY_HALL" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.CITY_HALL + '</option>',
  1918. '<option value="ORGANIZATION_OR_ASSOCIATION" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.ORGANIZATION_OR_ASSOCIATION + '</option>',
  1919. '<option value="PRISON_CORRECTIONAL_FACILITY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.PRISON_CORRECTIONAL_FACILITY + '</option>',
  1920. '<option value="COURTHOUSE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.COURTHOUSE + '</option>',
  1921. '<option value="CEMETERY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.CEMETERY + '</option>',
  1922. '<option value="FIRE_DEPARTMENT" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.FIRE_DEPARTMENT + '</option>',
  1923. '<option value="POLICE_STATION" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.POLICE_STATION + '</option>',
  1924. '<option value="MILITARY" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.MILITARY + '</option>',
  1925. '<option value="HOSPITAL_URGENT_CARE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.HOSPITAL_URGENT_CARE + '</option>',
  1926. '<option value="DOCTOR_CLINIC" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.DOCTOR_CLINIC + '</option>',
  1927. '<option value="OFFICES" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.OFFICES + '</option>',
  1928. '<option value="POST_OFFICE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.POST_OFFICE + '</option>',
  1929. '<option value="RELIGIOUS_CENTER" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.RELIGIOUS_CENTER + '</option>',
  1930. '<option value="KINDERGARTEN" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.KINDERGARDEN + '</option>',
  1931. '<option value="FACTORY_INDUSTRIAL" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.FACTORY_INDUSTRIAL + '</option>',
  1932. '<option value="EMBASSY_CONSULATE" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.EMBASSY_CONSULATE + '</option>',
  1933. '<option value="INFORMATION_POINT" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.INFORMATION_POINT + '</option>',
  1934. '<option value="EMERGENCY_SHELTER" data-icon="waze-icon-place-professional">' + I18n.translations[I18n.currentLocale()].venues.categories.EMERGENCY_SHELTER + '</option>',
  1935. '<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>',
  1936. '<option value="ARTS_AND_CRAFTS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.ARTS_AND_CRAFTS + '</option>',
  1937. '<option value="BANK_FINANCIAL" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.BANK_FINANCIAL + '</option>',
  1938. '<option value="SPORTING_GOODS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SPORTING_GOODS + '</option>',
  1939. '<option value="BOOKSTORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.BOOKSTORE + '</option>',
  1940. '<option value="PHOTOGRAPHY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PHOTOGRAPHY + '</option>',
  1941. '<option value="CAR_DEALERSHIP" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_DEALERSHIP + '</option>',
  1942. '<option value="FASHION_AND_CLOTHING" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.FASHION_AND_CLOTHING + '</option>',
  1943. '<option value="CONVENIENCE_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CONVENIENCE_STORE + '</option>',
  1944. '<option value="PERSONAL_CARE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PERSONAL_CARE + '</option>',
  1945. '<option value="DEPARTMENT_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.DEPARTMENT_STORE + '</option>',
  1946. '<option value="PHARMACY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PHARMACY + '</option>',
  1947. '<option value="ELECTRONICS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.ELECTRONICS + '</option>',
  1948. '<option value="FLOWERS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.FLOWERS + '</option>',
  1949. '<option value="FURNITURE_HOME_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.FURNITURE_HOME_STORE + '</option>',
  1950. '<option value="GIFTS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.GIFTS + '</option>',
  1951. '<option value="GYM_FITNESS" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.GYM_FITNESS + '</option>',
  1952. '<option value="SWIMMING_POOL" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SWIMMING_POOL + '</option>',
  1953. '<option value="HARDWARE_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.HARDWARE_STORE + '</option>',
  1954. '<option value="MARKET" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.MARKET + '</option>',
  1955. '<option value="SUPERMARKET_GROCERY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SUPERMARKET_GROCERY + '</option>',
  1956. '<option value="JEWELRY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.JEWELRY + '</option>',
  1957. '<option value="LAUNDRY_DRY_CLEAN" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.LAUNDRY_DRY_CLEAN + '</option>',
  1958. '<option value="SHOPPING_CENTER" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.SHOPPING_CENTER + '</option>',
  1959. '<option value="MUSIC_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSIC_STORE + '</option>',
  1960. '<option value="PET_STORE_VETERINARIAN_SERVICES" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.PET_STORE_VETERINARIAN_SERVICES + '</option>',
  1961. '<option value="TOY_STORE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.TOY_STORE + '</option>',
  1962. '<option value="TRAVEL_AGENCY" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.TRAVEL_AGENCY + '</option>',
  1963. '<option value="ATM" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.ATM + '</option>',
  1964. '<option value="CURRENCY_EXCHANGE" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CURRENCY_EXCHANGE + '</option>',
  1965. '<option value="CAR_RENTAL" data-icon="waze-icon-place-shopping">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_RENTAL + '</option>',
  1966. '<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>',
  1967. '<option value="RESTAURANT" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.RESTAURANT + '</option>',
  1968. '<option value="BAKERY" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.BAKERY + '</option>',
  1969. '<option value="DESSERT" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.DESSERT + '</option>',
  1970. '<option value="CAFE" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.CAFE + '</option>',
  1971. '<option value="FAST_FOOD" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.FAST_FOOD + '</option>',
  1972. '<option value="FOOD_COURT" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.FOOD_COURT + '</option>',
  1973. '<option value="BAR" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.BAR + '</option>',
  1974. '<option value="ICE_CREAM" data-icon="waze-icon-place-food-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.ICE_CREAM + '</option>',
  1975. '<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>',
  1976. '<option value="ART_GALLERY" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.ART_GALLERY + '</option>',
  1977. '<option value="CASINO" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.CASINO + '</option>',
  1978. '<option value="CLUB" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.CLUB + '</option>',
  1979. '<option value="TOURIST_ATTRACTION_HISTORIC_SITE" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.TOURIST_ATTRACTION_HISTORIC_SITE + '</option>',
  1980. '<option value="MOVIE_THEATER" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.MOVIE_THEATER + '</option>',
  1981. '<option value="MUSEUM" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSEUM + '</option>',
  1982. '<option value="MUSIC_VENUE" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSIC_VENUE + '</option>',
  1983. '<option value="PERFORMING_ARTS_VENUE" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.PERFORMING_ARTS_VENUE + '</option>',
  1984. '<option value="GAME_CLUB" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.GAME_CLUB + '</option>',
  1985. '<option value="STADIUM_ARENA" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.STADIUM_ARENA + '</option>',
  1986. '<option value="THEME_PARK" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.THEME_PARK + '</option>',
  1987. '<option value="ZOO_AQUARIUM" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.ZOO_AQUARIUM + '</option>',
  1988. '<option value="RACING_TRACK" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.RACING_TRACK + '</option>',
  1989. '<option value="THEATER" data-icon="waze-icon-place-culture">' + I18n.translations[I18n.currentLocale()].venues.categories.THEATER + '</option>',
  1990. '<option value="OTHER" data-icon="waze-icon-place" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.OTHER + '</option>',
  1991. '<option value="CONSTRUCTION_SITE" data-icon="">' + I18n.translations[I18n.currentLocale()].venues.categories.CONSTRUCTION_SITE + '</option>',
  1992. '<option value="LODGING" data-icon="waze-icon-place-lodging" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.LODGING + '</option>',
  1993. '<option value="HOTEL" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.HOTEL + '</option>',
  1994. '<option value="HOSTEL" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.HOSTEL + '</option>',
  1995. '<option value="CAMPING_TRAILER_PARK" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.CAMPING_TRAILER_PARK + '</option>',
  1996. '<option value="COTTAGE_CABIN" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.COTTAGE_CABIN + '</option>',
  1997. '<option value="BED_AND_BREAKFAST" data-icon="waze-icon-place-lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.BED_AND_BREAKFAST + '</option>',
  1998. '<option value="OUTDOORS" data-icon="waze-icon-place-outdoors" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.OUTDOORS + '</option>',
  1999. '<option value="PARK" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PARK + '</option>',
  2000. '<option value="PLAYGROUND" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PLAYGROUND + '</option>',
  2001. '<option value="BEACH" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.BEACH + '</option>',
  2002. '<option value="SPORTS_COURT" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SPORTS_COURT + '</option>',
  2003. '<option value="GOLF_COURSE" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.GOLF_COURSE + '</option>',
  2004. '<option value="PLAZA" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PLAZA + '</option>',
  2005. '<option value="PROMENADE" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PROMENADE + '</option>',
  2006. '<option value="POOL" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.POOL + '</option>',
  2007. '<option value="SCENIC_LOOKOUT_VIEWPOINT" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SCENIC_LOOKOUT_VIEWPOINT + '</option>',
  2008. '<option value="SKI_AREA" data-icon="waze-icon-place-outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SKI_AREA + '</option>',
  2009. '<option value="NATURAL_FEATURES" data-icon="waze-icon-place-natural" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.NATURAL_FEATURES + '</option>',
  2010. '<option value="ISLAND" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.ISLAND + '</option>',
  2011. '<option value="SEA_LAKE_POOL" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.SEA_LAKE_POOL + '</option>',
  2012. '<option value="RIVER_STREAM" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.RIVER_STREAM + '</option>',
  2013. '<option value="FOREST_GROVE" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.FOREST_GROVE + '</option>',
  2014. '<option value="FARM" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.FARM + '</option>',
  2015. '<option value="CANAL" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.CANAL + '</option>',
  2016. '<option value="SWAMP_MARSH" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.SWAMP_MARSH + '</option>',
  2017. '<option value="DAM" data-icon="waze-icon-place-natural">' + I18n.translations[I18n.currentLocale()].venues.categories.DAM + '</option>',
  2018. '<option value="PARKING_LOT" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.PARKING_LOT + '</option>',
  2019. '<option value="RESIDENCE_HOME" data-icon="waze-icon-house" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.RESIDENCE_HOME + '</option>',
  2020. '</select>'
  2021. ].join(' '));
  2022.  
  2023. return $places.html();
  2024. }
  2025.  
  2026. function injectCss() {
  2027. var css = [
  2028. // Lock button formatting
  2029. '.btn-lh {cursor:pointer;padding:1px 6px;height:22px;border:solid 1px #c1c1c1;margin-right:3px;}',
  2030. '.btn.btn-lh.btn-lh-selected {background-color:#6999ae;color:white}',
  2031. '.btn.btn-lh.btn-lh-selected:hover {color:white}',
  2032. '.btn.btn-lh.disabled {color:#909090;background-color:#f7f7f7;}',
  2033. '.btn.btn-lh.btn-lh-selected.disabled {color:white;background-color:#6999ae;}',
  2034. //Settings Panel
  2035. '#sidebar .controls-container.pie-controls-container {padding: 0px;}',
  2036. '.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;}',
  2037. //'@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;}}',
  2038. //Image Dialog Enhancement
  2039. '.imgcon {position:relative; margin:0 auto;}',
  2040. '.imnav {color: #ffffff; margin:0 auto; opacity:0.7; display:none; position:absolute; top:0; left:0px; width:100%; height:89%;}',
  2041. '.imgcon:hover .imnav{display:inline-block;}',
  2042. '.control {float:left; height:100%; width:33%; opacity:0;}',
  2043. '.control:hover {opacity:0.7;}',
  2044. '.prim {width:15%; background:url("http://i59.tinypic.com/294s94i.gif")left center no-repeat;}',
  2045. '.zmim {width:70%;}',
  2046. '.neim {width:15%; background:url("http://i62.tinypic.com/2cqfqxf.gif")right center no-repeat;}',
  2047. //PSE
  2048. '.PSESelected {border: 3px solid #ee9900;}'
  2049.  
  2050. ].join(' ');
  2051. $('<style type="text/css">' + css + '</style>').appendTo('head');
  2052. }
  2053.  
  2054. function injectCSSWithID(id, css){
  2055. $('<style type="text/css" id=' + id + '>' + css + '</style>').appendTo('head');
  2056. }
  2057.  
  2058. function loadSettings() {
  2059. var loadedSettings = $.parseJSON(localStorage.getItem("WMEPIE_Settings"));
  2060. var defaultSettings = {
  2061. ShowAreaPlaceSize: false,
  2062. ShowAreaPlaceSizeImperial: false,
  2063. ShowAreaPlaceSizeMetric: false,
  2064. ShowLockButtonsRPP: true,
  2065. NewPlacesList: W.Config.venues.categories.clone(),
  2066. EditRPPAfterCreated: false,
  2067. UseStreetFromClosestSeg: false,
  2068. UseCityFromClosestSeg: false,
  2069. ShowPlaceLocatorCrosshair: false,
  2070. PlaceZoom: 6,
  2071. DefaultLockLevel: 0,
  2072. CreateResidentialPlaceShortcut: "A+r",
  2073. CreateParkingLotShortcut: "A+p",
  2074. UseAltCity: false,
  2075. ShowSearchButton: false,
  2076. AddPlaceCategoriesButtons: false,
  2077. SkipPLR: false,
  2078. ShowParkingLotButton: false,
  2079. ShowPlaceNames: false,
  2080. ShowPlaceNamesPoint: false,
  2081. ShowPlaceNamesArea: false,
  2082. ShowPlaceNamesLock: false,
  2083. ShowCopyPlaceButton: false,
  2084. ShowExternalProviderTooltip: false,
  2085. ShowPlaceNamesPLA: false,
  2086. ClearDescription: true,
  2087. PlaceNameFontSize: "12",
  2088. PlaceNameFontOutlineWidth: 3,
  2089. PlaceNameFontBold: true,
  2090. PlaceNameFontColor: "#FFFFFF",
  2091. PlaceNameFontOutline: "#000000",
  2092. PlaceLocatorCrosshairProdPL: true,
  2093. MoveAddress: false,
  2094. MoveHNEntry: true,
  2095. PLNormalSpotWidth: 3.44,
  2096. PLAngledSpotWidth: 3,
  2097. ShowPLSpotEstimatorButton: false,
  2098. ShowNavPointClosestSegmentOnHover: true
  2099. };
  2100. settings = loadedSettings ? loadedSettings : defaultSettings;
  2101. for (var prop in defaultSettings) {
  2102. if (!settings.hasOwnProperty(prop))
  2103. settings[prop] = defaultSettings[prop];
  2104. }
  2105.  
  2106. if(settings.ShowAreaPlaceSizeImperial === false && settings.ShowAreaPlaceSizeMetric === false)
  2107. if(Waze.prefs.attributes.isImperial)
  2108. settings.ShowAreaPlaceSizeImperial = true;
  2109. else
  2110. settings.ShowAreaPlaceSizeMetric = true;
  2111. }
  2112.  
  2113. function saveSettings() {
  2114. if (localStorage) {
  2115. var localsettings = {
  2116. ShowAreaPlaceSize: settings.ShowAreaPlaceSize,
  2117. ShowAreaPlaceSizeImperial: settings.ShowAreaPlaceSizeImperial,
  2118. ShowAreaPlaceSizeMetric: settings.ShowAreaPlaceSizeMetric,
  2119. ShowLockButtonsRPP: settings.ShowLockButtonsRPP,
  2120. NewPlacesList: settings.NewPlacesList,
  2121. EditRPPAfterCreated: settings.EditRPPAfterCreated,
  2122. UseStreetFromClosestSeg: settings.UseStreetFromClosestSeg,
  2123. UseCityFromClosestSeg: settings.UseCityFromClosestSeg,
  2124. ShowPlaceLocatorCrosshair: settings.ShowPlaceLocatorCrosshair,
  2125. PlaceZoom: settings.PlaceZoom,
  2126. DefaultLockLevel: settings.DefaultLockLevel,
  2127. CreateResidentialPlaceShortcut: settings.CreateResidentialPlaceShortcut,
  2128. CreateParkingLotShortcut: settings.CreateParkingLotShortcut,
  2129. UseAltCity: settings.UseAltCity,
  2130. ShowSearchButton: settings.ShowSearchButton,
  2131. AddPlaceCategoriesButtons: settings.AddPlaceCategoriesButtons,
  2132. SkipPLR: settings.SkipPLR,
  2133. ShowParkingLotButton: settings.ShowParkingLotButton,
  2134. ShowPlaceNames: settings.ShowPlaceNames,
  2135. ShowPlaceNamesPoint: settings.ShowPlaceNamesPoint,
  2136. ShowPlaceNamesArea: settings.ShowPlaceNamesArea,
  2137. ShowPlaceNamesLock: settings.ShowPlaceNamesLock,
  2138. ShowCopyPlaceButton: settings.ShowCopyPlaceButton,
  2139. ShowExternalProviderTooltip: settings.ShowExternalProviderTooltip,
  2140. ShowPlaceNamesPLA: settings.ShowPlaceNamesPLA,
  2141. ClearDescription: settings.ClearDescription,
  2142. PlaceNameFontSize: settings.PlaceNameFontSize,
  2143. PlaceNameFontOutlineWidth: settings.PlaceNameFontOutlineWidth,
  2144. PlaceNameFontBold: settings.PlaceNameFontBold,
  2145. PlaceNameFontColor: settings.PlaceNameFontColor,
  2146. PlaceNameFontOutline: settings.PlaceNameFontOutline,
  2147. PlaceLocatorCrosshairProdPL: settings.PlaceLocatorCrosshairProdPL,
  2148. MoveAddress: settings.MoveAddress,
  2149. MoveHNEntry: settings.MoveHNEntry,
  2150. PLNormalSpotWidth: settings.PLNormalSpotWidth,
  2151. PLAngledSpotWidth: settings.PLAngledSpotWidth,
  2152. ShowPLSpotEstimatorButton: settings.ShowPLSpotEstimatorButton,
  2153. ShowNavPointClosestSegmentOnHover: settings.ShowNavPointClosestSegmentOnHover
  2154. };
  2155.  
  2156. for (var name in Waze.accelerators.Actions) {
  2157. var TempKeys = "";
  2158. if (Waze.accelerators.Actions[name].group == 'wmepie') {
  2159. if (Waze.accelerators.Actions[name].shortcut) {
  2160. if (Waze.accelerators.Actions[name].shortcut.altKey === true) {
  2161. TempKeys += 'A';
  2162. }
  2163. if (Waze.accelerators.Actions[name].shortcut.shiftKey === true) {
  2164. TempKeys += 'S';
  2165. }
  2166. if (Waze.accelerators.Actions[name].shortcut.ctrlKey === true) {
  2167. TempKeys += 'C';
  2168. }
  2169. if (TempKeys !== "") {
  2170. TempKeys += '+';
  2171. }
  2172. if (Waze.accelerators.Actions[name].shortcut.keyCode) {
  2173. TempKeys += Waze.accelerators.Actions[name].shortcut.keyCode;
  2174. }
  2175. } else {
  2176. TempKeys = "-1";
  2177. }
  2178. localsettings[name] = TempKeys;
  2179. }
  2180. }
  2181.  
  2182. localStorage.setItem("WMEPIE_Settings", JSON.stringify(localsettings));
  2183. }
  2184. }
  2185.  
  2186. function loadTranslations() {
  2187. setTranslations({
  2188. en: {
  2189. prefs: {
  2190. title: 'Place Interface Enhancements',
  2191. ShowAreaPlaceSize: 'Show area Place size',
  2192. ShowImperial: 'Show imperial',
  2193. ShowMetric: 'Show metric',
  2194. ShowRPPLockButtons: 'Show lock buttons for RPPs',
  2195. ShowRPPLockButtonsTitle: 'Displays lock level buttons for Residential Place Points',
  2196. ShowPlaceLocatorCrosshair: 'Show Place locator crosshair',
  2197. ShowPlaceLocatorCrosshairTitle: 'Centers the Place on screen and zooms to the defined level',
  2198. Zoom: 'Zoom',
  2199. ZoomTitle: 'The zoom level to use when centering on a Place',
  2200. ShowAddressSearch: 'Show search button next to address',
  2201. ShowAddressSearchTitle: "Show a magnifying glass next to the Place's address. Clicking this button will load the address into the search box",
  2202. ShowPlaceCategoryButtons: 'Add Place category buttons above the categories selection',
  2203. ShowPLAButton: 'Show parking lot button',
  2204. ShowPLAButtonTitle: "Starts creation mode for a Parking Lot Area Place and will set the name to match this Place\'s name when complete",
  2205. ShowCopyPlaceButton: 'Show copy Place button',
  2206. ShowCopyPlaceButtonTitle: 'Copies the selected Place to a new Place with identical settings',
  2207. ShowGPIDTooltip: 'Show External Provider tooltip',
  2208. ShowGPIDTooltipTitle: 'Displays a tooltip with the external provider information',
  2209. NewPlaces: 'New Places',
  2210. EditRPPAfterCreate: 'Edit RPP address after created',
  2211. EditRPPAfterCreateTitle: "Automatically opens the RPP address edit window and focuses on the House Number entry",
  2212. UseStreetFromClosestSegment: 'Use street name from closest segment',
  2213. UseStreetFromClosestSegmentTitle: "Pulls the street name from the closest visible segment and inserts into the new Place's address",
  2214. UseCityFromClosestSegment: 'Use city name from closest segment',
  2215. UseCityFromClosestSegmentTitle: "Pulls the city name from the closest visible segment and inserts into the new Place's address",
  2216. ClosestSegmentAltCity: 'When the primary is "No city" look for an alt city',
  2217. ClosestSegmentAltCityTitle: 'When the primary is \'No city\' try to find an alt street name with a city',
  2218. ClosestSegmentIgnorePLRUnnamedPR: "Ignore PLRs & unnamed PR when using closest segment's name and city",
  2219. ClosestSegmentIgnorePLRUnnamedPRTitle: "When looking for the closest segment, PLRs and unnamed PRs will be ignored",
  2220. LockLevel: 'Lock level',
  2221. LockLevelTitle: 'The lock level to set automatically when creating new Places',
  2222. MapChanges: 'Map Changes',
  2223. ShowPlaceNames: 'Show Place names',
  2224. ShowPlaceNamesTitle: '',
  2225. ShowPointNames: 'Show point names',
  2226. ShowPointNamesTitle: "Will display the Place's name below the Place point",
  2227. ShowAreaNames: 'Show area names',
  2228. ShowAreaNamesTitle: "Will display the Place's name in the middle of the Place area",
  2229. ShowLockLevel: 'Show lock level',
  2230. ShowLockLevelTitle: "Will display the Place's lock level in the middle of the Place area",
  2231. ShowPLAName: 'Show PLA name',
  2232. ShowPLANameTitle: '',
  2233. Item: 'Item',
  2234. PlaceMenuCustomization: "Place Menu Customization",
  2235. ClearDescription: "Show clear description button",
  2236. ClearDescriptionTitle: "Adds a clear button to the top right of the description entry that when clicked will clear all text in the entry field",
  2237. PropertiesPanel: "Properties Panel",
  2238. FontSize: "Font size",
  2239. FontColor: "Font color",
  2240. Bold: "Bold",
  2241. FontOutlineColor: "Font outline color",
  2242. FontOutlineWidth: "Font outline width",
  2243. ProdPL: "Force production PL",
  2244. MoveAddress: "Move address to top of panel",
  2245. MoveAddressTitle: "Moves the address editor to the top of the properties panel",
  2246. MoveHNEntry: "Move HN entry before street entry",
  2247. MoveHNEntryTitle: "Moves the House Number entry before the Street entry in the address editor",
  2248. ShowParkingSpaceEstimatorTool: "Show Parking Space Estimator tool",
  2249. ShowParkingSpaceEstimatorToolTitle: "Shows the button to launch the Parking Space Estimator tool",
  2250. PSEParkingSpaceEstimator: "Parking Space Estimator",
  2251. PSELayoutType: "Layout type",
  2252. PSE90degree: "90 degree",
  2253. PSEAngled: "Angled",
  2254. PSEEstimatedNumOfSpots: "Estimated # of spots: ",
  2255. PSESet: "Set",
  2256. PSESpotWidth: "Spot width (m)",
  2257. PSECal: "Cal",
  2258. PSEDraw90DegreeTitle: "Click to draw a line through an entire 90 degree parking space aisle. Double click to finish drawing and measure the spaces.",
  2259. PSEDrawAngledTitle: "Click to draw a line through an entire angled parking space aisle. Double click to finish drawing and measure the spaces.",
  2260. PSEShowPSEButton: "Show Parking Space Estimator tool button",
  2261. PSEShowPSEButtonTitle: "Shows the button to launch the Parking Space Estimator tool",
  2262. PSEDisplayButtonTitle: "Opens the Parking Space Estimator tool"
  2263. }
  2264. },
  2265. "es-419": {
  2266. prefs: {
  2267. title: 'Place Interface Enhancements',
  2268. ShowAreaPlaceSize: 'Mostrar tamaño del área',
  2269. ShowImperial: 'Sistema Imperial',
  2270. ShowMetric: 'Sistema Métrico',
  2271. ShowRPPLockButtons: 'Mostrar botones de bloqueo para RPPs',
  2272. ShowRPPLockButtonsTitle: 'Muestra los botones de nivel de bloqueo para lugares residenciales',
  2273. ShowPlaceLocatorCrosshair: 'Mostrar reticula localizadora del lugar',
  2274. ShowPlaceLocatorCrosshairTitle: 'Centra el lugar en la pantalla y acercamiento al nivel definido',
  2275. Zoom: 'Acercamiento',
  2276. ZoomTitle: 'Nivel de acercamiento a utilizar cuando se centra en un lugar',
  2277. ShowAddressSearch: 'Mostrar el botón de búsqueda junto a la dirección',
  2278. ShowAddressSearchTitle: "Muestra una lupa junto a la dirección del lugar. Al hacer clic en este botón, se cargará la dirección en la barra de búsqueda",
  2279. ShowPlaceCategoryButtons: 'Botones de categorías de lugares',
  2280. ShowPLAButton: 'Mostrar botón de PLAs',
  2281. ShowPLAButtonTitle: 'Inicia el modo de creación de un lugar del área de estacionamiento y establecerá el nombre del estacionamiento para que coincida con el nombre del lugar cuando se complete',
  2282. ShowCopyPlaceButton: 'Mostrar botón de copiado de lugar',
  2283. ShowCopyPlaceButtonTitle: 'Copia el lugar seleccionado en un lugar nuevo con configuraciones idénticas',
  2284. ShowGPIDTooltip: 'Mostrar información del proveedor externo',
  2285. ShowGPIDTooltipTitle: 'Muestra un texto con la información del proveedor externo',
  2286. NewPlaces: 'Nuevos lugares',
  2287. EditRPPAfterCreate: 'Editar la dirección del RPP una vez creada',
  2288. EditRPPAfterCreateTitle: "Automáticamente abre la ventana de edición en la dirección del lugar residencial y se enfoca en el campo de número de casa",
  2289. UseStreetFromClosestSegment: 'Utilizar el nombre de la calle del segmento más cercano',
  2290. UseStreetFromClosestSegmentTitle: "Extrae el nombre de la calle del segmento visible más cercano y lo agrega en la dirección del nuevo lugar",
  2291. UseCityFromClosestSegment: 'Usar el nombre de la ciudad del segmento más cercano',
  2292. UseCityFromClosestSegmentTitle: "Extrae el nombre de la ciudad del segmento visible más cercano y lo agrega en la dirección del nuevo lugar",
  2293. ClosestSegmentAltCity: 'Buscar una ciudad alternativa cuando la ciudad principal sea \'Ninguno\'',
  2294. ClosestSegmentAltCityTitle: 'Cuando la ciudad principal es "Ninguno" trata de encontrar un nombre de calle alternativo con una ciudad',
  2295. ClosestSegmentIgnorePLRUnnamedPR: "Ignorar los PLR y PR sin nombre cuando utilice el nombre y la ciudad del segmento más cercano",
  2296. ClosestSegmentIgnorePLRUnnamedPRTitle: "Ignorar segmentos de estacionamiento o privados al buscar el segmento mas cercano",
  2297. LockLevel: 'Nivel de bloqueo',
  2298. LockLevelTitle: 'El nivel de bloqueo para establecer automáticamente al crear nuevos lugares',
  2299. MapChanges: 'Cambios en el mapa',
  2300. ShowPlaceNames: 'Mostrar nombres de lugares',
  2301. ShowPlaceNamesTitle: '',
  2302. ShowPointNames: 'Mostrar nombres de punto',
  2303. ShowPointNamesTitle: "Muestra el nombre de lugares definidos como punto",
  2304. ShowAreaNames: 'Mostrar nombres de área',
  2305. ShowAreaNamesTitle: "Muestra el nombre de lugares definidos como área",
  2306. ShowLockLevel: 'Mostrar nivel de bloqueo',
  2307. ShowLockLevelTitle: "Muestra el nivel de bloqueo en el centro del lugar",
  2308. ShowPLAName: 'Mostrar nombre de PLA',
  2309. ShowPLANameTitle: 'Muestra el nombre de áreas de estacionamiento (PLAs)',
  2310. Item: 'Opción',
  2311. PlaceMenuCustomization: "Personalización del menú de lugares",
  2312. ClearDescription: "Mostrar botón de borrar descripción",
  2313. ClearDescriptionTitle: "Añade un botón de borrado en la parte superior derecha del campo de descripción que deja vacíos todos los campos",
  2314. PropertiesPanel: "Propiedades del panel",
  2315. FontSize: "Tamaño de letra",
  2316. FontColor: "Color de Letra",
  2317. Bold: "Negrita",
  2318. FontOutlineColor: "Color del contorno de la letra",
  2319. FontOutlineWidth: "Ancho del contorno de la letra",
  2320. ProdPL: "Forzar Permalink de producción",
  2321. MoveAddress: "Move address to top of panel",
  2322. MoveAddressTitle: "Moves the address editor to the top of the properties panel",
  2323. MoveHNEntry: "Move HN entry before street entry",
  2324. MoveHNEntryTitle: "Moves the House Number entry before the Street entry in the address editor",
  2325. ShowParkingSpaceEstimatorTool: "Show Parking Space Estimator tool",
  2326. ShowParkingSpaceEstimatorToolTitle: "Shows the button to launch the Parking Space Estimator tool",
  2327. PSEParkingSpaceEstimator: "Parking Space Estimator",
  2328. PSELayoutType: "Layout type",
  2329. PSE90degree: "90 degree",
  2330. PSEAngled: "Angled",
  2331. PSEEstimatedNumOfSpots: "Estimated # of spots: ",
  2332. PSESet: "Set",
  2333. PSESpotWidth: "Spot width (m)",
  2334. PSECal: "Cal",
  2335. PSEDraw90DegreeTitle: "Click to draw a line through an entire 90 degree parking space aisle. Double click to finish drawing and measure the spaces.",
  2336. PSEDrawAngledTitle: "Click to draw a line through an entire angled parking space aisle. Double click to finish drawing and measure the spaces.",
  2337. PSEShowPSEButton: "Show Parking Space Estimator tool button",
  2338. PSEShowPSEButtonTitle: "Shows the button to launch the Parking Space Estimator tool",
  2339. PSEDisplayButtonTitle: "Opens the Parking Space Estimator tool"
  2340. }
  2341. },
  2342. fr: {
  2343. prefs: {
  2344. title: 'Place Interface Enhancements',
  2345. ShowAreaPlaceSize: 'Afficher la tallie de la place',
  2346. ShowImperial: 'Afficher en imperial',
  2347. ShowMetric: 'Afficher en métrique',
  2348. ShowRPPLockButtons: 'Afficher les boutons de lock pour les résidentiels',
  2349. ShowRPPLockButtonsTitle: 'Affiche des boutons pour le niveau de verrouillage des lieux résidentiels',
  2350. ShowPlaceLocatorCrosshair: 'Afficher le repère de localisation du lieu',
  2351. ShowPlaceLocatorCrosshairTitle: "Centre le lieu à l'écran et zoome au niveau défini",
  2352. Zoom: 'Zoom',
  2353. ZoomTitle: "Niveau de zoom utilisé lorsqu'on se centre sur un lieu",
  2354. ShowAddressSearch: "Afficher icône de recherche à côté de l'adresse",
  2355. ShowAddressSearchTitle: "Affiche une loupe à côté de l'adresse du lieu. Cliquer ce bouton chargera l'adresse dans la barre de recherche",
  2356. ShowPlaceCategoryButtons: 'Ajouter des icônes de catégorie au dessus de la sélection de catégories',
  2357. ShowPLAButton: 'Afficher le bouton de création de parking',
  2358. ShowPLAButtonTitle: 'Démarre le mode création de parking pour tracer un parking qui aura le nom du lieu sélectionné',
  2359. ShowCopyPlaceButton: 'Afficher le bouton de clonage de lieu',
  2360. ShowCopyPlaceButtonTitle: 'Clone le lieu sélectionné en nouveau lieu avec les mêmes valeurs',
  2361. ShowGPIDTooltip: 'Afficher en infobulle le fournisseur externe',
  2362. ShowGPIDTooltipTitle: 'Affiche une infobulle avec les informations du fournisseur externe',
  2363. NewPlaces: 'Nouveaux Lieux',
  2364. EditRPPAfterCreate: "Editer l'adresse du résidentiel après création",
  2365. EditRPPAfterCreateTitle: "Ouvre automatiquement la zone d'édition de l'adresse du lieu résidentiel et se positionne sur la saisie du n° de rue",
  2366. UseStreetFromClosestSegment: 'Utiliser le nom de rue du segment le plus proche',
  2367. UseStreetFromClosestSegmentTitle: "Prend le nom de rue du segment visible le plus proche et l'insère dans l'adresse du nouveau lieu",
  2368. UseCityFromClosestSegment: 'Utiliser le nom de ville du segment le plus proche',
  2369. UseCityFromClosestSegmentTitle: "Prend le nom de ville du segment visible le plus proche et l'insère dans l'adresse du nouveau lieu",
  2370. ClosestSegmentAltCity: 'Lorsque le nom principal est «Hors ville» regarder le nom en alt',
  2371. ClosestSegmentAltCityTitle: 'Lorsque le nom principal est «Hors ville» essayer de trouver un nom de rue alternatif avec une ville',
  2372. ClosestSegmentIgnorePLRUnnamedPR: "Ignorer les parkings et voies privées non nommés",
  2373. ClosestSegmentIgnorePLRUnnamedPRTitle: "Lorsque le script regarde le nom du segment visible le plus proche, les parkings et voies privées non nommées seront ignorés",
  2374. LockLevel: 'Verrouillage ',
  2375. LockLevelTitle: 'Le niveau de verrouillage est appliqué automatiquement à la création du lieu',
  2376. MapChanges: 'Changements de carte',
  2377. ShowPlaceNames: 'Afficher le nom des lieux',
  2378. ShowPlaceNamesTitle: '',
  2379. ShowPointNames: 'Afficher le nom des lieux point',
  2380. ShowPointNamesTitle: "Affiche le nom du lieu sous le lieu point",
  2381. ShowAreaNames: 'Afficher le nom des lieux zone',
  2382. ShowAreaNamesTitle: "Affiche le nom du lieu au milieu du lieu zone",
  2383. ShowLockLevel: 'Afficher le niveau de verrouillage',
  2384. ShowLockLevelTitle: "Afficher le niveau de verrouillage du lieu au milieu du lieu zone",
  2385. ShowPLAName: 'Afficher le nom des parkings',
  2386. ShowPLANameTitle: 'Affiche le nom du parking au milieu du lieu zone',
  2387. Item: 'Option',
  2388. PlaceMenuCustomization: "Personnalisation du menu Lieu",
  2389. ClearDescription: "Afficher le bouton «Effacer description»",
  2390. ClearDescriptionTitle: "Ajoute un bouton «Effacer description» en haut à droite de l'entrée de description qui, lorsqu'il est cliqué, effacera tout le texte dans le champ de saisie",
  2391. PropertiesPanel: "Panneau des propriétés",
  2392. FontSize: "Font size",
  2393. FontColor: "Font color",
  2394. Bold: "Bold",
  2395. FontOutlineColor: "Font outline color",
  2396. FontOutlineWidth: "Font outline width",
  2397. ProdPL: "Force production PL",
  2398. MoveAddress: "Move address to top of panel",
  2399. MoveAddressTitle: "Moves the address editor to the top of the properties panel",
  2400. MoveHNEntry: "Move HN entry before street entry",
  2401. MoveHNEntryTitle: "Moves the House Number entry before the Street entry in the address editor",
  2402. ShowParkingSpaceEstimatorTool: "Show Parking Space Estimator tool",
  2403. ShowParkingSpaceEstimatorToolTitle: "Shows the button to launch the Parking Space Estimator tool",
  2404. PSEParkingSpaceEstimator: "Parking Space Estimator",
  2405. PSELayoutType: "Layout type",
  2406. PSE90degree: "90 degree",
  2407. PSEAngled: "Angled",
  2408. PSEEstimatedNumOfSpots: "Estimated # of spots: ",
  2409. PSESet: "Set",
  2410. PSESpotWidth: "Spot width (m)",
  2411. PSECal: "Cal",
  2412. PSEDraw90DegreeTitle: "Click to draw a line through an entire 90 degree parking space aisle. Double click to finish drawing and measure the spaces.",
  2413. PSEDrawAngledTitle: "Click to draw a line through an entire angled parking space aisle. Double click to finish drawing and measure the spaces.",
  2414. PSEShowPSEButton: "Show Parking Space Estimator tool button",
  2415. PSEShowPSEButtonTitle: "Shows the button to launch the Parking Space Estimator tool",
  2416. PSEDisplayButtonTitle: "Opens the Parking Space Estimator tool"
  2417. }
  2418. }
  2419. });
  2420. }
  2421.  
  2422. function setTranslations(translations) {
  2423. I18n.translations[I18n.currentLocale()].pie = translations.en;
  2424. for (var i = 0; i < Object.keys(translations).length; i++) {
  2425. var locale = Object.keys(translations)[i];
  2426. if (I18n.currentLocale() == locale) {
  2427. I18n.translations[locale].pie.prefs = translations[locale].prefs;
  2428. return;
  2429. }
  2430. }
  2431. }
  2432.  
  2433. function listPlaces(){
  2434. var category = "";
  2435. for(i=0; i<W.Config.venues.categories.length; i++){
  2436. category = W.Config.venues.categories[i];
  2437. console.log(category + " Main");
  2438. var subCategories = W.Config.venues.subcategories[category];
  2439. for(var j=0; j<subCategories.length;j++){
  2440. console.log(subCategories[j]);
  2441. }
  2442. }
  2443. }
  2444. })();