Greasy Fork is available in English.

WME Place Interface Enhancements

Enhancements to various Place interfaces

Stan na 18-05-2018. Zobacz najnowsza wersja.

  1. // ==UserScript==
  2. // @name WME Place Interface Enhancements
  3. // @namespace https://greasyfork.org/users/30701-justins83-waze
  4. // @version 2018.05.18.01
  5. // @description Enhancements to various Place interfaces
  6. // @include https://www.waze.com/editor*
  7. // @include https://www.waze.com/*/editor*
  8. // @include https://beta.waze.com*
  9. // @exclude https://www.waze.com/user/editor*
  10. // @icon data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAEAAQADAREAAhEBAxEB/8QAHQABAAEFAQEBAAAAAAAAAAAAAAUBAwQGBwIICf/EAEAQAAICAQICBQgHBwQCAwAAAAABAgMEBREGMRIhQVFhBxMUIjJScYEXI0JUkZLBCBVVYpOhsRYzcoJEolPR4f/EABsBAQACAwEBAAAAAAAAAAAAAAADBAECBgUH/8QAMBEBAAIBAgUBCAEEAwEAAAAAAAECAwQRBRIhMVFBBhMiMmFxkdGBFCOhsVLB4fD/2gAMAwEAAhEDEQA/AP1TAAAAAAAAAAAAAAAAAAADwrFJtR9bbm+wyxu9mGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY+Vm04cd7JbPsiubNorNuzW1or3YONlW6tc0t6saPNJ9cvDckmsUj6o4tN5+iVjFQioxSSXJIhTKgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH1PWnVJ1UNdJdUp93wJ6Y9+soL5NukIOc5WScpScpPm2WdtleZ37tg4elF4ckvaU+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/24870-wazewrapbeta/code/WazeWrapBeta.js
  14. // @require https://greasyfork.org/scripts/27023-jscolor/code/JSColor.js
  15. // @require https://greasyfork.org/scripts/37486-wme-utils-hoursparser.js
  16. // @require https://greasyfork.org/scripts/38421-wme-utils-navigationpoint/code/WME%20Utils%20-%20NavigationPoint.js?version=251065
  17. // @require https://greasyfork.org/scripts/39208-wme-utils-google-link-enhancer/code/WME%20Utils%20-%20Google%20Link%20Enhancer.js?version=264663
  18. // @license GPLv3
  19. // ==/UserScript==
  20.  
  21. /* jshint esnext:true*/
  22. /* jshint esversion:6*/
  23. /* globals W */
  24. /* globals WazeWrap */
  25.  
  26. var UpdateObject, MultiAction;
  27.  
  28. (function() {
  29. 'use strict';
  30.  
  31. var curr_ver = "2018.05.18.01";
  32. var settings = {};
  33. var placeMenuSelector = "#edit-buttons > div > div.toolbar-submenu.toolbar-group.toolbar-group-venues.ItemInactive > menu";//"#edit-buttons > div > div.toolbar-button.waze-icon-place.toolbar-submenu.toolbar-group.toolbar-group-venues.ItemInactive > menu";
  34. //"#edit-buttons > div > div.toolbar-submenu.toolbar-group.toolbar-group-venues.ItemInactive > menu";
  35. var placementMode = false;
  36. var resCategory = "RESIDENCE_HOME";
  37. var wazePL;
  38. let hoursparser;
  39. let GLE;
  40.  
  41. //Layer definitions
  42. {
  43. var layerName = "WME PIE";
  44. var newPlaceLayer, PLSpotEstimatorLayer, PLSpotEstimatorCalibrationLayer;
  45. var PIEPlaceNameLayer;
  46. var showStopPointsLayer;
  47. var closestSegmentLayer;
  48. }
  49.  
  50. //Drawing definitions
  51. {
  52. var drawPoly, PLSpotEstimatordrawControl, PLSpotEstimatorCalibrationdrawControl;
  53. var isDrawing;
  54. var pointStyle = {
  55. pointRadius: 6,
  56. fillOpacity: 0,
  57. strokeColor: '#00ece3',
  58. strokeWidth: '2',
  59. strokeLinecap: 'round'
  60. };
  61.  
  62. //Closest segment
  63. var lineStyleToNavPoint = {
  64. strokeWidth: 3,
  65. strokeColor: '#00ece3',
  66. strokeLinecap: 'round',
  67. strokeDashstyle: 'dash'
  68. },
  69. lineStyleToClosestSeg = {
  70. strokeWidth: 4,
  71. strokeColor: '#00ece3',
  72. strokeLinecap: 'round'
  73. },
  74. pointStyleNavPoint = {
  75. externalGraphic: 'data:image/gif;base64,R0lGODlhFgAWAPZ/AD09PT8/Pj8/P0M9PUA/P1s9PUBAPz09Qz09Zz09c0M9SWc9bT9AQD1DT0FBQEJBQURDQkRDQ0JGRkZFRUlIRklIR0lISElJSVFPTFJPTlJQTVNQTlNRT1ZTT1lWUlhWU11ZVmFbSXNDW2FhT2diXUlDYUNJbVtDc1thYWBgYGFhYWxsbG1tbZE9PbZzPaRVVZFnSbZzQ7BtYbB/Z8J/Q7yFW4uRbZGLc8iLYdqkZ8iqeeCwZ+y8cz09iz09kT1Dlz1nlz1JpENbkUNztmGFvD2R1EOR1H+wyG2w4HO25nO27Hm88p2dnZ6enraXl7a2ts7Cl/jIi/LOkfjUkf/Ukf/Ul//gqv/mtoW22pe22pfCzovI8pfU+KTa/7zs/8LCwsLOzs7Ozs/Pz9rOzubUzuzazvLgyP/syP//1P/42v//2s7U5s744NTm+Nrs/87y/8j4/9T//+bm5v//4P//5v//7ODy/+b///Pz8/jy8v//8vL4////+Pj//////wAAACH5BAUAAH8ALAAAAAAWABYAAAf+gH+CgyQeFQ8AAAQTHiSDj48ZDAIAlJWVAhyQjw8CAitMYXh4YUwrlQ+bf54VX36vsK9fEwKpnAIgcrBpTll9sHIgDLZ/GQITurBUAD1xsXIWAhmCnq6wZjMACFhusV+VfxyfsHw5JjfaNiVcsSsCHRUATLA8Qm9WBUFxUydesEwAKhgQEOaVmhddYr3KYcTPrzC1KOFRIwOEAhRbYNXBEaIBCSR+8CRKhAdNi5FKNLoIEABAkZCJWobhQwbKAi3dYJXRAQRMGz8QIVQQMM+PHhpJ/NQZs6YPnRhL/gmo8AfAClhXRGCRwoxNjSF3YJ2iJsCanzMwMB0gEvbVE09GgsQhixVFQA84z6JdGERLRTI/VQb8cPZKjgoBECAROGY2zx5YT6IJUNXpU6hRpdzVUhXXk6VEngx44PwIxAQJiSRUAKEqEAA7',
  76. graphicWidth: 22,
  77. graphicHeight: 22
  78. },
  79. pointStyle = {
  80. pointRadius: 6,
  81. fillColor: 'white',
  82. fillOpacity: 1,
  83. strokeColor: '#00ece3',
  84. strokeWidth: '3',
  85. strokeLinecap: 'round'
  86. };
  87. }
  88.  
  89. function bootstrap(tries = 1) {
  90. if (W &&
  91. W.map &&
  92. W.model &&
  93. W.loginManager.user &&
  94. $ && jscolor &&
  95. WazeWrap.Ready) {
  96. init();
  97. } else if (tries < 1000) {
  98. setTimeout(function () {bootstrap(tries++);}, 200);
  99. }
  100. }
  101.  
  102. bootstrap();
  103.  
  104. function init(){
  105. loadTranslations();
  106. GLE = new GoogleLinkEnhancer();
  107. hoursparser = new HoursParser();
  108.  
  109. var $section = $("<div>", {style:"padding:8px 16px", id:"WMEPIESettings"});
  110. $section.html([
  111. '<h4 style="margin-bottom:0px;"><b>' + I18n.t('pie.prefs.title') + '</b></h4>',
  112. '<h6 style="margin-top:0px;">' + curr_ver + '</h6>',
  113. '<fieldset id="fieldPlaceFilter" style="border: 1px solid silver; padding: 8px; border-radius: 4px;">',
  114. '<legend style="margin-bottom:0px; border-bottom-style:none;width:auto;"><h4>' + I18n.t('pie.filter.PlaceFilterPanel') + '</h4></legend>',
  115. '<div class="controls-container pie-controls-container" id="divPlaceFilter">' + I18n.t('pie.filter.filter') + ' <input type="text" name="txtPlaceFilter" id="piePlaceFilter" style="border: 1px solid #000000"/></div>',
  116. '</br>',
  117. '<div class="controls-container pie-controls-container" id="divPlaceFilterOptions"><input type="radio" id="_rbHidePlaces" name="PlaceFilterToggle" checked><label for="_rbHidePlaces">' + I18n.t('pie.filter.Hide') + '</label><input type="radio" id="_rbOnlyShowPlaces" name="PlaceFilterToggle"><label for="_rbOnlyShowPlaces">' + I18n.t('pie.filter.Show') + '</label></div>',
  118. '</fieldset>',
  119.  
  120. '<fieldset id="fieldPlacePanel" style="border: 1px solid silver; padding: 8px; border-radius: 4px;">',
  121. '<legend style="margin-bottom:0px; border-bottom-style:none;width:auto;"><h4>' + I18n.t('pie.prefs.PropertiesPanel') + '</h4></legend>',
  122. '<div class="controls-container pie-controls-container" id="divAreaPlaceSizeControls">',
  123. '<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>',
  124. '<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>',
  125. '<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>',
  126. '</div>',
  127. '<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>',
  128. '<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>',
  129. '<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>',
  130. '<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>',
  131. '<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>',
  132. '<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>',
  133. '<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>',
  134. '<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>',
  135. '<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>',
  136. '<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>',
  137. //'<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>',
  138. '<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>',
  139. '<div class="controls-container pie-controls-container" id="divNavLink" title="' + I18n.t('pie.prefs.NavLinkTitle') + '"><input type="checkbox" id="_cbNavLink" class="pieSettingsCheckbox" disabled/><label for="_cbNavLink" style="white-space:pre-line;">' + I18n.t('pie.prefs.NavLink') + '</label></div>',
  140. '<br>',
  141. '<div class="controls-container pie-controls-container" id="divHidePaymentType" title="' + I18n.t('pie.prefs.HidePaymentTypeTitle') + '"><input type="checkbox" id="_cbHidePaymentType" class="pieSettingsCheckbox" /><label for="_cbHidePaymentType" style="white-space:pre-line;">' + I18n.t('pie.prefs.HidePaymentType') + '</label></div>',
  142. '<div class="controls-container pie-controls-container" id="divGeometryMods" title="' + I18n.t('pie.prefs.GeometryModsTitle') + '"><input type="checkbox" id="_cbGeometryMods" class="pieSettingsCheckbox" /><label for="_cbGeometryMods" style="white-space:pre-line;">' + I18n.t('pie.prefs.GeometryMods') + '</label></div>',
  143. '</fieldset>',
  144.  
  145. '<fieldset id="fieldNewPlaces" style="border: 1px solid silver; padding: 8px; border-radius: 4px;">',
  146. '<legend style="margin-bottom:0px; border-bottom-style:none;width:auto;"><h4>' + I18n.t('pie.prefs.NewPlaces') + '</h4></legend>',
  147. '<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>',
  148. '<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>',
  149. '<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>',
  150. '<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>',
  151. '<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>',
  152. '<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>',
  153. '</fieldset>',
  154.  
  155. '<fieldset id="fieldMapMods" style="border: 1px solid silver; padding: 8px; border-radius: 4px;">',
  156. '<legend style="margin-bottom:0px; border-bottom-style:none;width:auto;"><h4>' + I18n.t('pie.prefs.MapChanges') + '</h4></legend>',
  157. '<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>',
  158. '<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>',
  159. '<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>',
  160. '<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>',
  161. '<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>',
  162. '<div id="divPlaceNamesFontCustomization" class="controls-container pie-controls-container" style="padding-left:20px;">',
  163. I18n.t('pie.prefs.FontSize') + ' <input type="text" size="1" id="piePlaceNameFontSize"/>px</br>',
  164. 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>',
  165. '<input type="checkbox" id="_cbPlaceNameFontBold" class="pieSettingsCheckbox"/><label for ="_cbPlaceNameFontBold">' + I18n.t('pie.prefs.Bold') + '</label></br>',
  166. 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>',
  167. I18n.t('pie.prefs.FontOutlineWidth') + ' <input type="text" size="1" id="piePlaceNameFontOutlineWidth"/>',
  168. '</div>',
  169. '<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>',
  170. '<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;">' + I18n.t('pie.prefs.ShowNavPointClosestSegmentOnHover') + '</label></div>',
  171. '<div id="divShowClosestSegmentSelected" class="controls-container pie-controls-container" title=""><input type="checkbox" id="_cbShowClosestSegmentSelected" class="pieSettingsCheckbox" /><label for="_cbShowClosestSegmentSelected" style="white-space:pre-line;">' + I18n.t('pie.prefs.ShowClosestSegmentSelected') + '</label></div>',
  172. '<div id="divEnableGLE" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.EnableGLETitle') + '"><input type="checkbox" id="_cbEnableGLE" class="pieSettingsCheckbox"/><label for="_cbEnableGLE" style="white-space:pre-line;">' + I18n.t('pie.prefs.EnableGLE') + '</label></div>',
  173. '<div id="divOpenPUR" class="controls-container pie-controls-container" title="' + I18n.t('pie.prefs.OpenPURTitle') + '"><input type="checkbox" id="_cbOpenPUR" class="pieSettingsCheckbox"/><label for="_cbOpenPUR" style="white-space:pre-line;">' + I18n.t('pie.prefs.OpenPUR') + '</label></div>',
  174. '</fieldset>',
  175. '<div class="controls-container" id="divPlaceMenuCustomization">',
  176. '<b>' + I18n.t('pie.prefs.PlaceMenuCustomization') + '</b></br>',
  177. buildItemOption(1),
  178. buildItemOption(2),
  179. buildItemOption(3),
  180. buildItemOption(4),
  181. buildItemOption(5),
  182. buildItemOption(6),
  183. buildItemOption(7),
  184. buildItemOption(8),
  185. buildItemOption(9),
  186. buildItemOption(10),
  187. buildItemOption(11),
  188. '</div>'
  189. ].join(' '));
  190.  
  191. UpdateObject = require("Waze/Action/UpdateObject");
  192. MultiAction = require("Waze/Action/MultiAction");
  193.  
  194. //Load settings
  195. loadSettings();
  196.  
  197. var style = new OL.Style({
  198. pointRadius: "${pointRadius}",
  199. label : "${labelText}",
  200. fontFamily: "Tahoma, Arial, Verdana",
  201. labelOutlineColor: settings.PlaceNameFontOutline,
  202. labelOutlineWidth: Number(settings.PlaceNameFontOutlineWidth),
  203. labelAlign: 'cm',
  204. fontColor: settings.PlaceNameFontColor,
  205. fontOpacity: 1.0,
  206. fontSize: settings.PlaceNameFontSize + "px",
  207. labelYOffset: "${yOffset}",
  208. fontStyle: "${style}",
  209. fontWeight: (settings.PlaceNameFontBold ? 'bold' : ''),
  210. pointRadius: 0
  211. });
  212.  
  213. PIEPlaceNameLayer = new OL.Layer.Vector("PIEPlaceNameLayer",{displayInLayerSwitcher: false,
  214. uniqueName: "__PIEPlaceNameLayer", styleMap: new OL.StyleMap(style)});
  215. W.map.addLayer(PIEPlaceNameLayer);
  216. PIEPlaceNameLayer.setVisibility(true);
  217.  
  218. newPlaceLayer = new OL.Layer.Vector(layerName,{displayInLayerSwitcher: false});
  219. W.map.addLayer(newPlaceLayer);
  220.  
  221. PLSpotEstimatorLayer = new OL.Layer.Vector("PIEPLSpotEstimatorLayer",{displayInLayerSwitcher: false, uniqueName: "__PIEPLSpotEstimatorLayer"});
  222. W.map.addLayer(PLSpotEstimatorLayer);
  223. PLSpotEstimatorLayer.setVisibility(true);
  224.  
  225. PLSpotEstimatorCalibrationLayer= new OL.Layer.Vector("PIEPLSpotEstimatorCalibrationLayer",{displayInLayerSwitcher: false, uniqueName: "__PIEPLSpotEstimatorCalibrationLayer"});
  226. W.map.addLayer(PLSpotEstimatorCalibrationLayer);
  227. PLSpotEstimatorCalibrationLayer.setVisibility(true);
  228.  
  229. showStopPointsLayer = new OL.Layer.Vector("PIEShowStopPointsLayer", {displayInLayerSwitcher: false, uniqueName: "__PIEShowStopPointsLayer"});
  230. W.map.addLayer(showStopPointsLayer);
  231. showStopPointsLayer.setVisibility(true);
  232.  
  233. closestSegmentLayer = new OL.Layer.Vector("PIEClosestSegment", {displayInLayerSwitcher: false, uniqueName:"__PIEClosesetSegmentLayer"});
  234. W.map.addLayer(closestSegmentLayer);
  235. closestSegmentLayer.setVisibility(true);
  236.  
  237. /*var ctl = W.map.controls.find(function(ctrl) { return ctrl.displayClass ==="WazeControlSelectHighlightFeature"; });
  238. var ctlLayers = [].concat(ctl.layers);
  239. var myLayer = W.map.getLayersByName('PIEPlaceNameLayer')[0];
  240. ctlLayers.push(myLayer);
  241. ctl.setLayer(ctlLayers);*/
  242.  
  243. //***** Set Google Link Enhancer translations *****
  244. GLE.strings.closedPlace = I18n.t('pie.GLE.closedPlace');
  245. GLE.strings.multiLinked = I18n.t('pie.GLE.multiLinked');
  246. GLE.strings.linkedToThisPlace = I18n.t('pie.GLE.linkedToThisPlace');
  247. GLE.strings.linkedNearby = I18n.t('pie.GLE.linkedNearby');
  248. GLE.strings.linkedToXPlaces = I18n.t('pie.GLE.linkedToXPlaces');
  249. GLE.strings.badLink = I18n.t('pie.GLE.badLink');
  250. GLE.strings.tooFar = I18n.t('pie.GLE.tooFar');
  251.  
  252. injectCss();
  253. new WazeWrap.Interface.Tab('PIE', $section.html(), init2);
  254. }
  255.  
  256. function getActiveEditor(tries = 1) {
  257. return new Promise((resolve, reject) => {
  258. if (W.geometryEditing.activeEditor) {
  259. resolve(W.geometryEditing.activeEditor);
  260. } else {
  261. if(tries <= 10)
  262. setTimeout(() => resolve(getActiveEditor()), 100);
  263. }
  264. });
  265. }
  266.  
  267. function init2(){
  268. $('#cboPlaceNameFontWeight').select2({placeholder: "No font weight set", allowClear: true});
  269. $('#divPlaceNamesFontCustomization .select2-choices').css("font-size", "10px");
  270.  
  271. initColorPicker();
  272. if ($('#colorPickerFont')[0].jscolor){
  273. $('#colorPickerFont')[0].jscolor.fromString(settings.PlaceNameFontColor);
  274. $('#colorPickerFontOutline')[0].jscolor.fromString(settings.PlaceNameFontOutline);
  275. }
  276.  
  277. //$('#divPlaceNamesFontCustomization .select2-input').remove()
  278. //Set up event handlers
  279. $('#_cbShowAreaPlaceSize').change(function() {
  280. if(this.checked) {
  281. attachPlaceSizeHandlers();
  282. updatePlaceSizeDisplay();
  283. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = false;
  284. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = false;
  285. }
  286. else
  287. {
  288. removePlaceSizeHandlers();
  289. $('#AreaSize').remove();
  290. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = true;
  291. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = true;
  292. }
  293. });
  294.  
  295. $('#_cbShowPlaceNames').change(function() {
  296. PIEPlaceNameLayer.setVisibility(this.checked);
  297. if(this.checked) {
  298. $('#_cbShowPlaceNamesPoint')[0].disabled = false;
  299. $('#_cbShowPlaceNamesArea')[0].disabled = false;
  300. $('#_cbShowPlaceNamesPLA')[0].disabled = false;
  301. $('#_cbShowPlaceNamesLock')[0].disabled = false;
  302. }
  303. else
  304. {
  305. $('#_cbShowPlaceNamesPoint')[0].disabled = true;
  306. $('#_cbShowPlaceNamesArea')[0].disabled = true;
  307. $('#_cbShowPlaceNamesPLA')[0].disabled = true;
  308. $('#_cbShowPlaceNamesLock')[0].disabled = true;
  309. }
  310. console.log(this.checked);
  311. DisplayPlaceNames();
  312. });
  313.  
  314. $('[id^="_cbShowPlaceNames"]').change(function(){
  315. DisplayPlaceNames();
  316. });
  317.  
  318. $('#_cbShowExternalProviderTooltip').change(function(){
  319. ToggleExternalProvidersCSS(this.checked);
  320. });
  321.  
  322. $('#_cbShowLockButtonsRPP').change(function() {
  323. if(this.checked)
  324. attachRPPLockButtonHandlers();
  325. else
  326. {
  327. $('#pieRPPLockButtonsContainer').remove();
  328. unregisterEvents(addLockButtons);
  329. }
  330. });
  331.  
  332. $('#_cbShowPlaceLocatorCrosshair').change(function(){
  333. if(this.checked)
  334. registerEvents(ShowPlaceLocatorCrosshair);
  335. else
  336. unregisterEvents(ShowPlaceLocatorCrosshair);
  337. });
  338.  
  339. $('#_cbShowParkingLotButton').change(function(){
  340. if(this.checked)
  341. registerEvents(ShowParkingLotButton);
  342. else
  343. unregisterEvents(ShowParkingLotButton);
  344. });
  345.  
  346. $('#_cbShowCopyPlaceButton').change(function(){
  347. if(this.checked)
  348. registerEvents(ShowCopyPlaceButton);
  349. else
  350. unregisterEvents(ShowCopyPlaceButton);
  351. });
  352.  
  353. $('#_cbShowSearchButton').change(function(){
  354. if(this.checked)
  355. registerEvents(ShowSearchButton);
  356. else
  357. unregisterEvents(ShowSearchButton);
  358. });
  359.  
  360. $('#_cbAddPlaceCategoriesButtons').change(function(){
  361. if(this.checked)
  362. registerEvents(AddPlaceCategoriesButtons);
  363. else
  364. unregisterEvents(AddPlaceCategoriesButtons);
  365. });
  366.  
  367. $('#_cbMoveAddress').change(function(){
  368. //This is now supported natively in WME (beta as of 2017-10-16)
  369. /*if(this.checked)
  370. registerEvents(MoveAddress);
  371. else
  372. unregisterEvents(MoveAddress);*/
  373. });
  374.  
  375. $('#_cbMoveHNEntry').change(function(){
  376. if(this.checked)
  377. registerEvents(MoveHNEntry);
  378. else
  379. unregisterEvents(MoveHNEntry);
  380. });
  381.  
  382. $('#_cbClearDescription').change(function(){
  383. if(this.checked)
  384. registerEvents(ShowClearDescription);
  385. else
  386. unregisterEvents(ShowClearDescription);
  387. });
  388.  
  389. $('#_cbShowPLSpotEstimatorButton').change(function(){
  390. if(this.checked)
  391. registerEvents(ShowPLSpotEstimatorButton);
  392. else
  393. unregisterEvents(ShowPLSpotEstimatorButton);
  394. });
  395.  
  396. $('#_cbShowNavPointClosestSegmentOnHover').change(function(){
  397. if(this.checked)
  398. W.map.events.register("mousemove", null, drawNavPointClosestSegmentLines);
  399. else
  400. W.map.events.unregister("mousemove", null, drawNavPointClosestSegmentLines);
  401. });
  402.  
  403. $('#_cbShowClosestSegmentSelected').change(function(){
  404. if(this.checked){
  405. W.model.actionManager.events.register('afterundoaction', this, checkSelection);
  406. W.model.actionManager.events.register('afteraction', this, checkSelection);
  407. W.selectionManager.events.register('selectionchanged', this, checkSelection);
  408. W.model.venues.on('objectschanged', ObjectsChanged);
  409. }
  410. else{
  411. W.model.actionManager.events.unregister('afterundoaction', this, checkSelection);
  412. W.model.actionManager.events.unregister('afteraction', this, checkSelection);
  413. W.selectionManager.events.unregister('selectionchanged', this, checkSelection);
  414. W.model.venues.off('objectschanged', ObjectsChanged);
  415. }
  416. });
  417.  
  418. $('#_cbOpenPUR').change(function(){
  419. if(this.checked)
  420. W.selectionManager.events.register('selectionchanged', this, openPUR);
  421. else
  422. W.selectionManager.events.unregister('selectionchanged', this, openPUR);
  423. });
  424.  
  425. $('#_cbEnableGLE').change(function(){
  426. if(this.checked)
  427. GLE.enable();
  428. else
  429. GLE.disable();
  430. });
  431.  
  432. $('#_cbHidePaymentType').change(function(){
  433. if(this.checked)
  434. registerEvents(HidePaymentTypePlaceSelected);
  435. else
  436. unregisterEvents(HidePaymentTypePlaceSelected);
  437. });
  438.  
  439. $('#_cbGeometryMods').change(function(){
  440. if(this.checked)
  441. registerEvents(InsertGeometryMods);
  442. else
  443. unregisterEvents(InsertGeometryMods);
  444. });
  445.  
  446. //Load settings to interface
  447. setChecked('_cbShowAreaPlaceSize', settings.ShowAreaPlaceSize);
  448. setChecked('_cbShowAreaPlaceSizeImperial', settings.ShowAreaPlaceSizeImperial);
  449. setChecked('_cbShowAreaPlaceSizeMetric', settings.ShowAreaPlaceSizeMetric);
  450. setChecked('_cbShowLockButtonsRPP', settings.ShowLockButtonsRPP);
  451. setChecked('_cbEditRPPAfterCreated', settings.EditRPPAfterCreated);
  452. setChecked('_cbUseStreetFromClosestSeg', settings.UseStreetFromClosestSeg);
  453. setChecked('_cbUseCityFromClosestSeg', settings.UseCityFromClosestSeg);
  454. setChecked('_cbShowPlaceLocatorCrosshair', settings.ShowPlaceLocatorCrosshair);
  455. setChecked('_cbShowParkingLotButton', settings.ShowParkingLotButton);
  456. setChecked('_cbShowCopyPlaceButton', settings.ShowCopyPlaceButton);
  457. setChecked('_cbShowExternalProviderTooltip', settings.ShowExternalProviderTooltip);
  458. setChecked('_cbUseAltCity', settings.UseAltCity);
  459. setChecked('_cbShowSearchButton', settings.ShowSearchButton);
  460. setChecked('_cbAddPlaceCategoriesButtons', settings.AddPlaceCategoriesButtons);
  461. setChecked('_cbSkipPLR', settings.SkipPLR);
  462. setChecked('_cbShowPlaceNames', settings.ShowPlaceNames);
  463. setChecked('_cbShowPlaceNamesPoint', settings.ShowPlaceNamesPoint);
  464. setChecked('_cbShowPlaceNamesArea', settings.ShowPlaceNamesArea);
  465. setChecked('_cbShowPlaceNamesPLA', settings.ShowPlaceNamesPLA);
  466. setChecked('_cbShowPlaceNamesLock', settings.ShowPlaceNamesLock);
  467. setChecked('_cbClearDescription', settings.ClearDescription);
  468. setChecked('_cbPlaceNameFontBold', settings.PlaceNameFontBold);
  469. setChecked('_cbPlaceLocatorCrosshairProdPL', settings.PlaceLocatorCrosshairProdPL);
  470. //setChecked('_cbMoveAddress', settings.MoveAddress); //Native support as of 2017-10-24
  471. setChecked('_cbMoveHNEntry', settings.MoveHNEntry);
  472. setChecked('_cbShowPLSpotEstimatorButton', settings.ShowPLSpotEstimatorButton);
  473. setChecked('_cbShowNavPointClosestSegmentOnHover', settings.ShowNavPointClosestSegmentOnHover);
  474. setChecked('_cbShowClosestSegmentSelected', settings.ShowClosestSegmentSelected);
  475. setChecked('_cbNavLink', settings.NavLink);
  476. setChecked('_cbEnableGLE', settings.EnableGLE);
  477. setChecked('_cbOpenPUR', settings.OpenPUR);
  478. setChecked('_cbHidePaymentType', settings.HidePaymentType);
  479. setChecked('_cbGeometryMods', settings.GeometryMods);
  480. if(settings.ShowPlaceNames){
  481. $('#_cbShowPlaceNamesPoint')[0].disabled = false;
  482. $('#_cbShowPlaceNamesArea')[0].disabled = false;
  483. $('#_cbShowPlaceNamesPLA')[0].disabled = false;
  484. $('#_cbShowPlaceNamesLock')[0].disabled = false;
  485. }
  486. $('#piePlaceZoom')[0].value = settings.PlaceZoom;
  487. $('#pieDefaultLockLevel')[0].value = settings.DefaultLockLevel;
  488. $('#piePlaceNameFontSize')[0].value = settings.PlaceNameFontSize;
  489. $('#piePlaceNameFontOutlineWidth')[0].value = settings.PlaceNameFontOutlineWidth;
  490.  
  491. if(settings.ShowNavPointClosestSegmentOnHover){
  492. W.map.events.register("mousemove", null, drawNavPointClosestSegmentLines);
  493. }
  494.  
  495. if(settings.ShowAreaPlaceSize){
  496. $('#_cbShowAreaPlaceSizeImperial')[0].disabled = false;
  497. $('#_cbShowAreaPlaceSizeMetric')[0].disabled = false;
  498. attachPlaceSizeHandlers();
  499. }
  500.  
  501. if(settings.ShowPlaceLocatorCrosshair){
  502. registerEvents(ShowPlaceLocatorCrosshair);
  503. ShowPlaceLocatorCrosshair(); //in case the user opened a PL with a Place selected
  504. }
  505.  
  506. if(settings.ShowParkingLotButton){
  507. registerEvents(ShowParkingLotButton);
  508. ShowParkingLotButton(); //in case the user opened a PL with a Place selected
  509. }
  510.  
  511. if(settings.ShowCopyPlaceButton){
  512. registerEvents(ShowCopyPlaceButton);
  513. ShowCopyPlaceButton();
  514. }
  515.  
  516. if(settings.ShowExternalProviderTooltip){
  517. //registerEvents(ShowExternalProviderTooltip);
  518. //ShowExternalProviderTooltip();
  519. var observer = new MutationObserver(function(mutations) {
  520. mutations.forEach(function(mutation) {
  521. if ($(mutation.target).hasClass('select2-chosen')) ShowExternalProviderTooltip();
  522. });
  523. });
  524.  
  525. observer.observe(document.getElementById('edit-panel'), { childList: true, subtree: true });
  526. }
  527.  
  528. if(settings.ShowSearchButton){
  529. registerEvents(ShowSearchButton);
  530. ShowSearchButton(); //in case the user opened a PL with a Place selected
  531. }
  532.  
  533. if(settings.AddPlaceCategoriesButtons){
  534. registerEvents(AddPlaceCategoriesButtons);
  535. AddPlaceCategoriesButtons();
  536. }
  537.  
  538. if(settings.ClearDescription){
  539. registerEvents(ShowClearDescription);
  540. ShowClearDescription();
  541. }
  542.  
  543. //Native support as of 2017-10-24
  544. /*if(settings.MoveAddress){
  545. registerEvents(MoveAddress);
  546. MoveAddress();
  547. }*/
  548.  
  549. if(settings.MoveHNEntry){
  550. registerEvents(MoveHNEntry);
  551. MoveHNEntry();
  552. }
  553.  
  554. if(settings.ShowPLSpotEstimatorButton){
  555. registerEvents(ShowPLSpotEstimatorButton);
  556. ShowPLSpotEstimatorButton();
  557. }
  558.  
  559. if(settings.ShowLockButtonsRPP)
  560. attachRPPLockButtonHandlers();
  561.  
  562. if(settings.ShowExternalProviderTooltip)
  563. ToggleExternalProvidersCSS(true);
  564.  
  565. if(settings.ShowClosestSegmentSelected){
  566. W.model.actionManager.events.register('afterundoaction', null, checkSelection);
  567. W.model.actionManager.events.register('afteraction', null, checkSelection);
  568. W.selectionManager.events.register('selectionchanged', null, checkSelection);
  569. W.model.venues.on('objectschanged', ObjectsChanged);
  570. }
  571.  
  572. if(settings.OpenPUR){
  573. W.selectionManager.events.register('selectionchanged', null, openPUR);
  574. }
  575.  
  576. if(settings.EnableGLE){
  577. GLE.enable();
  578. }
  579.  
  580. if(settings.HidePaymentType){
  581. registerEvents(HidePaymentTypePlaceSelected);
  582. HidePaymentTypePlaceSelected();
  583. }
  584.  
  585. if(settings.GeometryMods){
  586. registerEvents(InsertGeometryMods);
  587. InsertGeometryMods();
  588. }
  589.  
  590. $('.pieSettingsCheckbox').change(function() {
  591. var settingName = $(this)[0].id.substr(3);
  592. settings[settingName] = this.checked;
  593. saveSettings();
  594. });
  595.  
  596. $('#piePlaceZoom').change(function(){
  597. var settingName = $(this)[0].id.substr(3);
  598. settings[settingName] = $(this)[0].value;
  599. saveSettings();
  600. });
  601.  
  602. $('#pieDefaultLockLevel').change(function(){
  603. settings[$(this)[0].id.substr(3)] = $(this)[0].value;
  604. saveSettings();
  605. });
  606.  
  607. $('#_cbPlaceNameFontBold').change(function(){
  608. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.fontWeight = (this.checked ? 'bold' :'');
  609. DisplayPlaceNames();
  610. });
  611.  
  612. $('#piePlaceNameFontSize').focusout(function(){
  613. var fontSize = $(this)[0].value;
  614. if(fontSize == "" || fontSize == "0")
  615. $(this)[0].value = 12;
  616. settings[$(this)[0].id.substr(3)] = fontSize;
  617. saveSettings();
  618. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.fontSize = fontSize + "px";
  619. DisplayPlaceNames();
  620. });
  621.  
  622. $('#piePlaceNameFontOutlineWidth').focusout(function(){
  623. var outlineWidth = $(this)[0].value;
  624. if(outlineWidth == "" || outlineWidth == "0")
  625. $(this)[0].value = 3;
  626. settings[$(this)[0].id.substr(3)] = outlineWidth;
  627. saveSettings();
  628. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.labelOutlineWidth = outlineWidth;
  629. DisplayPlaceNames();
  630. });
  631.  
  632. $('#piePlaceNameFontSize').keypress(function(event) {
  633. if ((event.which < 48 || event.which > 57))
  634. event.preventDefault();
  635. });
  636.  
  637. $('#piePlaceNameFontOutlineWidth').keypress(function(event) {
  638. if ((event.which < 48 || event.which > 57))
  639. event.preventDefault();
  640. });
  641.  
  642. var i;
  643. //Whenever a Place item is changed, read the settings and save to localStorage
  644. $('[id^="pieItem"]').change(function(){
  645. for(i=0;i<11;i++){
  646. settings.NewPlacesList[i] = $('#pieItem'+(i+1))[0].value;
  647. }
  648. saveSettings();
  649. buildNewPlaceList();
  650. });
  651.  
  652. //Load settings into Place Customization list options
  653. for(i=0; i<11;i++)
  654. $('#pieItem'+(i+1))[0].value = settings.NewPlacesList[i];
  655.  
  656. //Build our new menu
  657. buildNewPlaceList();
  658. //coming back from the HN edit mode now rebuilds the Place menu.
  659. W.editingMediator.on('change:editingHouseNumbers', buildNewPlaceList);
  660.  
  661. new WazeWrap.Interface.Shortcut('CreateResidentialPlaceShortcut', 'Creates a resdiential Place point', 'wmepie', 'Place Interface Enhancements', settings.CreateResidentialPlaceShortcut, function(){startPlacementMode(resCategory, true);}, null).add();
  662.  
  663. new WazeWrap.Interface.Shortcut('CreateParkingLotShortcut', 'Creates a parking lot Place', 'wmepie', 'Place Interface Enhancements', settings.CreateParkingLotShortcut, function(){startPlacementMode("PARKING_LOT", false);}, null).add();
  664. new WazeWrap.Interface.Shortcut('HideAreaPlacesShortcut', 'Toggle hiding area Places', 'wmepie', 'Place Interface Enhancements', settings.ToggleAreaPlacesShortcut, ToggleHideAreaPlaces, null).add();
  665.  
  666. $("#piePlaceFilter").on("propertychange keyup paste input", UpdatePlaceFilter);
  667. $('input[type=radio][name=PlaceFilterToggle]').change(UpdatePlaceFilter);
  668.  
  669.  
  670. window.addEventListener("beforeunload", function() {
  671. saveSettings();
  672. }, false);
  673.  
  674. let extprovobserver = new MutationObserver(function(mutations) {
  675. mutations.forEach(function(mutation) {
  676.  
  677. /*if ($(mutation.target).hasClass('external-providers-view'))
  678. if(W.loginManager.user.normalizedLevel === 1)
  679. $('.external-providers-view').parent().parent().remove();
  680. */
  681.  
  682. for (var i = 0; i < mutation.addedNodes.length; i++) {
  683. var addedNode = mutation.addedNodes[i];
  684. // Only fire up if it's a node
  685. if (addedNode.nodeType === Node.ELEMENT_NODE && $(addedNode).hasClass('address-edit-view')) {
  686. addLockButtons();
  687. updatePlaceSizeDisplay();
  688. AddPlaceCategoriesButtons();
  689. AddHoursParserInterface();
  690. AddEEPJumpButtons();
  691. AddMakePrimaryButtons();
  692. if(settings.ShowPlaceLocatorCrosshair)
  693. ShowPlaceLocatorCrosshair();
  694. if(settings.ShowSearchButton)
  695. ShowSearchButton();
  696. ShowNavPointLink();
  697. if(settings.ShowParkingLotButton)
  698. ShowParkingLotButton();
  699. if(settings.ShowCopyPlaceButton)
  700. ShowCopyPlaceButton();
  701. if(settings.GeometryMods)
  702. InsertGeometryMods();
  703. }
  704. else if(addedNode.nodeType === Node.ELEMENT_NODE && $(addedNode).hasClass('payment-checkbox')){
  705. if(settings.HidePaymentType)
  706. _hidePaymentType();
  707. }
  708. }
  709. });
  710. });
  711.  
  712. extprovobserver.observe(document.getElementById('edit-panel'), { childList: true, subtree: true });
  713.  
  714. W.selectionManager.events.register("selectionchanged", null, function(){
  715. if(WazeWrap.getSelectedFeatures().length > 0 && WazeWrap.getSelectedFeatures()[0].model.type === "venue"){
  716. //Trim whitespace from start and end of house number field on Places
  717. $('.form-control.house-number').focusout(function(){
  718. $('.form-control.house-number')[0].value = $('.form-control.house-number')[0].value.trim();
  719. });
  720.  
  721. //Make Website label a clickable link to the set website
  722. let placeURL = WazeWrap.getSelectedFeatures()[0].model.attributes.url || "";
  723.  
  724. $('input[name="url"]').focusout(function(){
  725. placeURL = $('input[name="url"]')[0].value.trim();
  726. if(placeURL == ""){
  727. $('input[name="url"]').parent().parent().find('label').unwrap();
  728. return;
  729. }
  730. if(!placeURL.startsWith("http"))
  731. placeURL = "https://" + placeURL;
  732. if($('#websiteLink').length == 0)
  733. $('input[name="url"]').parent().parent().find('label').wrap('<a href="' + placeURL + '" id="websiteLink" target="_blank" style="cursor:pointer;"></a>');
  734. else
  735. $('#websiteLink').attr('href', placeURL);
  736. });
  737. if(placeURL != ""){
  738. if(!placeURL.startsWith("http"))
  739. placeURL = "https://" + placeURL;
  740. $('input[name="url"]').parent().parent().find('label').wrap('<a href="' + placeURL + '" id="websiteLink" target="_blank" style="cursor:pointer;"></a>');
  741. $('input[name="url"]').parent().parent().find('label').css('text-decoration', 'underline');
  742. $('input[name="url"]').parent().parent().find('label').css('cursor', 'pointer');
  743. }
  744. }
  745. });
  746.  
  747. //No one really uses this and it is causing issues due to the rotate handle persisting after de-selecting a MC
  748. /*W.selectionManager.events.register("selectionchanged", null, function(){
  749. let selectedItems = WazeWrap.getSelectedFeatures();
  750. if(selectedItems.length > 0 && selectedItems[0].model.type === "mapComment")
  751. getActiveEditor().then(val => {
  752. if((val.mode & OL.Control.ModifyFeature.ROTATE) == 0){
  753. val.mode |= OL.Control.ModifyFeature.ROTATE;
  754. val.resetVertices();
  755. }
  756. });
  757. });*/
  758.  
  759. //Always display the link when a point Place is selected, but default to un-linked
  760. W.selectionManager.events.register("selectionchanged", null, ShowNavPointLink);
  761. W.model.actionManager.events.register('afterundoaction', null, ShowNavPointLink);
  762. W.selectionManager.events.register('selectionchanged', null, ShowNavPointLink);
  763. W.model.venues.on('objectschanged', ShowNavPointLink);
  764.  
  765. W.model.actionManager.events.register('afteraction', null, function(){
  766. ShowNavPointLink();
  767. if(WazeWrap.getSelectedFeatures().length > 0 && WazeWrap.getSelectedFeatures()[0].model.type == "venue" && WazeWrap.getSelectedFeatures()[0].model.isPoint()){
  768. if($('#placeNavLink').attr("class") == "fa fa-link fa-lg"){
  769. let myPlaceAttr = WazeWrap.getSelectedFeatures()[0].model.attributes;
  770. //We only want to do this if the last item changed is our selected Place && it was moved.
  771. if(W.model.actionManager.actions[W.model.actionManager.index].feature != undefined && (W.model.actionManager.actions[W.model.actionManager.index].feature.attributes.id == myPlaceAttr.id) && typeof W.model.actionManager.actions[W.model.actionManager.index].oldGeometry != "undefined"){
  772. if(WazeWrap.getSelectedFeatures()[0].model.attributes.entryExitPoints.length > 0){ //We only want to do this if there is an existing nav point
  773. let newAttr = {};
  774. let existingAttr = myPlaceAttr.entryExitPoints[0];
  775. if (existingAttr) {
  776. for (var prop in existingAttr) {
  777. if (existingAttr.hasOwnProperty(prop)){
  778. let value = existingAttr[prop];
  779. if (Array.isArray(value)) value = [].concat(value);
  780. newAttr[prop] = value;
  781. }
  782. }
  783. }
  784. newAttr._point = new OL.Geometry.Point(myPlaceAttr.geometry.x, myPlaceAttr.geometry.y);
  785. newAttr.__proto__.getPoint = function()
  786. {
  787. return this._point.clone();
  788. };
  789. W.model.actionManager.add(new UpdateObject(WazeWrap.getSelectedFeatures()[0].model, {'entryExitPoints': [newAttr]}));
  790. }
  791. //NewPlace.attributes.entryExitPoints.push({entry: true, exit: true, name:"", primary: false, point: new OL.Geometry.Point(pos.lon, pos.lat)})
  792. }
  793. }
  794. }
  795. });
  796.  
  797. //Obsoleted by WME update released 2017-10-24
  798. /*var observer = new MutationObserver(function(mutations) {
  799. mutations.forEach(function(mutation) {
  800. if ($('#dialog-region').find('.venue-image-dialog').length > 0 && $('#detailsWrap').length == 0) ImageDialogEnhancement();
  801. });
  802. });*/
  803.  
  804. //observer.observe(document.getElementById('dialog-region'), { childList: true, subtree: true });
  805.  
  806. //Highlight the categories box when the old hospital category is present
  807. /*W.selectionManager.events.register("selectionchanged", null, highlightObsoleteHospitalCategory);
  808. W.model.actionManager.events.register("afterundoaction",null, highlightObsoleteHospitalCategory);
  809. W.model.actionManager.events.register("afterclearactions",null, highlightObsoleteHospitalCategory);
  810. W.model.actionManager.events.register("afteraction",null, highlightObsoleteHospitalCategory);*/
  811.  
  812. W.map.events.register("zoomend", null, DisplayPlaceNames);
  813. W.map.events.register("changelayer", null, DisplayPlaceNames);
  814.  
  815. //Shamelessly copied from URO+
  816. var MO_MPLayer = new MutationObserver(MPLayerChanged);
  817. MO_MPLayer.observe(W.map.problemLayer.div,{childList : true});
  818.  
  819. wazePL = document.querySelector('.WazeControlPermalink>a.fa-link');
  820. if(wazePL == null)
  821. wazePL = document.querySelector('.permalink');
  822. wazePL.id = 'wazePermalink';
  823.  
  824. /******** Hours Parser ************/
  825. registerEvents(AddHoursParserInterface);
  826. AddHoursParserInterface();
  827.  
  828. registerEvents(AddEEPJumpButtons);
  829. AddEEPJumpButtons();
  830.  
  831. registerEvents(AddMakePrimaryButtons);
  832. AddMakePrimaryButtons();
  833. }
  834.  
  835. function AddHoursParserInterface(){
  836. if(WazeWrap.hasSelectedFeatures())
  837. if(WazeWrap.getSelectedFeatures()[0].model.type === "venue"){
  838. var $PIEHoursParser = $("<div>", {style:"min-height:20px"});
  839. if(!$('#PIEHoursParserDiv').length){
  840. $PIEHoursParser.html([
  841. '<div id="PIEHoursParserDiv" style="margin-top:5px">',
  842. '<textarea id="PIE-hourspaste" placeholder="' + I18n.t('pie.hoursParser.defaultText') + '" wrap="off" autocomplete="off" style="overflow: auto; width: 85%; max-width: 85%; min-width: 85%; font-size: 0.85em; height: 24px; min-height: 24px; max-height: 300px; padding-left: 3px; color: rgb(153, 153, 153);"></textarea>',
  843. '<input class="btn btn-default btn-xs" id="PIEAppendHours" title="' + I18n.t('pie.hoursParser.AddHoursTitle') + '" type="button" value="' + I18n.t('pie.hoursParser.AddHours') + '" style="margin-bottom:4px">',
  844. '<input class="btn btn-default btn-xs" id="PIEReplaceHours" title="' + I18n.t('pie.hoursParser.ReplaceHoursTitle') + '" type="button" value="' + I18n.t('pie.hoursParser.ReplaceHours') + '" style="margin-bottom:4px">',
  845. '<span id="PIEHoursParserError" style="display:block; color:red"></span>',
  846. '</div>'
  847. ].join(' '));
  848. $('.opening-hours > div > .add.waze-btn').parent().append($PIEHoursParser.html());
  849. $('#PIEAppendHours').click(function(){ addHours(false);});
  850. $('#PIEReplaceHours').click(function(){ addHours(true);});
  851.  
  852. // Enter = Add hours, shift || ctrl + Enter = new line
  853. $("#PIE-hourspaste").keydown(function(event){
  854. if (event.keyCode === 13) {
  855. if (event.ctrlKey) {
  856. // Simulate a newline event (shift + enter)
  857. var text = this.value;
  858. var selStart = this.selectionStart;
  859. this.value = text.substr(0, selStart) + '\n' + text.substr(this.selectionEnd, text.length-1);
  860. this.selectionStart = selStart+1;
  861. this.selectionEnd = selStart+1;
  862. return true;
  863. } else if(!(event.shiftKey||event.ctrlKey) && $('#PIE-hourspaste').val() !== '' ){
  864. event.stopPropagation();
  865. event.preventDefault();
  866. event.returnValue = false;
  867. event.cancelBubble = true;
  868. addHours(false);
  869. return false;
  870. }
  871. }
  872. });
  873. }
  874. }
  875. }
  876.  
  877. function addHours(replaceAll = false) {
  878. var pasteHours = $('#PIE-hourspaste').val();
  879. if (pasteHours.trim() === "") {
  880. return;
  881. }
  882.  
  883. if(!replaceAll)
  884. pasteHours = pasteHours + ',' + getOpeningHours(WazeWrap.getSelectedFeatures()[0].model).join(',');
  885. var parserResult = hoursparser.parseHours(pasteHours);
  886. if (parserResult.hours && parserResult.overlappingHours === false && parserResult.sameOpenAndCloseTimes === false && parserResult.parseError === false) {
  887. W.model.actionManager.add(new UpdateObject(WazeWrap.getSelectedFeatures()[0].model, { openingHours: parserResult.hours }));
  888. $('#PIEHoursParserError').empty();
  889. } else {
  890. $('#PIE-hourspaste').css({'background-color':'#FDD'});//.attr({title:bannButt.noHours.getTitle(parserResult.hours)});
  891. if(parserResult.overlappingHours)
  892. $('#PIEHoursParserError').text(I18n.t('pie.hoursParser.errorOverlappingHours'));
  893. else if(parserResult.sameOpenAndCloseTimes)
  894. $('#PIEHoursParserError').text(I18n.t('pie.hoursParser.errorSameOpenClose'));
  895. else
  896. $('#PIEHoursParserError').text(I18n.t('pie.hoursParser.errorCannotParse'));
  897. }
  898. }
  899.  
  900. //******* Taken from WMEPH for hours parsing
  901. // Formats "hour object" into a string.
  902. function formatOpeningHour(hourEntry) {
  903. var dayNames = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
  904. var hours = hourEntry.attributes.fromHour + '-' + hourEntry.attributes.toHour;
  905. return hourEntry.attributes.days.map(day => dayNames[day] + ' ' + hours).join(', ');
  906. }
  907.  
  908. // Pull natural text from opening hours
  909. function getOpeningHours(venue) {
  910. return venue && venue.getOpeningHours && venue.getOpeningHours().map(formatOpeningHour);
  911. }
  912. //*******/
  913. function UpdatePlaceFilter(){
  914. let index = W.map.landmarkLayer.styleMap.styles.default.rules.findIndex(function(e){ return e.name == "PIEPlaceFilter";});
  915. if(index > -1)
  916. {
  917. W.map.landmarkLayer.styleMap.styles.default.rules.splice(index, 1);
  918. W.map.landmarkLayer.redraw();
  919. }
  920. if($('#piePlaceFilter').val().trim() != "")
  921. {
  922. let myRule = new W.Rule({
  923. filter: new OL.Filter.Comparison({
  924. type: '==',
  925. evaluate: function(venue) {
  926. if($("#_rbHidePlaces").prop("checked"))
  927. return (new RegExp($('#piePlaceFilter').val(), "ig").exec(venue.model.attributes.name));
  928. else
  929. return !(new RegExp($('#piePlaceFilter').val(), "ig").exec(venue.model.attributes.name));
  930. }
  931. }),
  932. symbolizer: {
  933. display: 'none'
  934. },
  935. name: "PIEPlaceFilter"
  936. });
  937. W.map.landmarkLayer.styleMap.styles['default'].rules.push(myRule);
  938. W.map.landmarkLayer.redraw();
  939. }
  940. }
  941.  
  942. function ToggleHideAreaPlaces(){
  943. let index = W.map.landmarkLayer.styleMap.styles.default.rules.findIndex(function(e){ return e.name == "PIEHide";});
  944. if(index === -1)
  945. {
  946. let myRule = new W.Rule({
  947. filter: new OL.Filter.Comparison({
  948. type: '==',
  949. evaluate: function(venue) {
  950. return (/POLYGON/i.test(venue.geometry.id));
  951. }
  952. }),
  953. symbolizer: {
  954. display: 'none'
  955. },
  956. name: "PIEHide"
  957. });
  958. W.map.landmarkLayer.styleMap.styles['default'].rules.push(myRule);
  959. W.map.landmarkLayer.redraw();
  960. }
  961. else{
  962. W.map.landmarkLayer.styleMap.styles.default.rules.splice(index, 1);
  963. W.map.landmarkLayer.redraw();
  964. }
  965. }
  966.  
  967. var highlightedVenue, highlighting;
  968. function drawNavPointClosestSegmentLines(){
  969. try{
  970. highlighting = false;
  971. if(highlightedVenue !== null)
  972. if(highlightedVenue === W.map.landmarkLayer.getFeatureBy("renderIntent","highlight"))
  973. highlighting = true;
  974. else
  975. showStopPointsLayer.removeAllFeatures();
  976. highlightedVenue = W.map.landmarkLayer.getFeatureBy("renderIntent","highlight");
  977.  
  978. if(highlightedVenue !== null && highlightedVenue.model && highlighting === false && W.map.zoom >= 4){
  979. let isArea = !highlightedVenue.model.isPoint();
  980. let navPoint;
  981.  
  982. if(highlightedVenue.model.getNavigationPoints().length > 0)
  983. navPoint = highlightedVenue.model.getNavigationPoints()[0]._point;
  984. else{
  985. if(isArea)
  986. navPoint = highlightedVenue.model.geometry.getCentroid();
  987. else
  988. navPoint = highlightedVenue.model.geometry.clone();
  989. }
  990.  
  991. //nav point to closest segment
  992. let closestSeg = WazeWrap.Geometry.findClosestSegment(navPoint,false, false);
  993. let lineFeature = new OL.Feature.Vector(new OL.Geometry.LineString([navPoint, closestSeg.closestPoint]), {}, lineStyleToClosestSeg);
  994. let pointFeature = new OL.Feature.Vector(closestSeg.closestPoint, {}, pointStyle);
  995. showStopPointsLayer.addFeatures([lineFeature, pointFeature]);
  996.  
  997. //place center to nav point
  998. let startPt = highlightedVenue.geometry;
  999. if(isArea)
  1000. startPt = highlightedVenue.model.geometry.getCentroid();
  1001. lineFeature = new OL.Feature.Vector(new OL.Geometry.LineString([startPt, navPoint]), {}, lineStyleToNavPoint);
  1002. pointFeature = new OL.Feature.Vector(navPoint, {}, pointStyleNavPoint);
  1003. if(highlightedVenue.model.attributes.entryExitPoints.length > 0 || isArea)
  1004. showStopPointsLayer.addFeatures([lineFeature, pointFeature]);
  1005.  
  1006. }
  1007. if(highlightedVenue === null || W.map.zoom < 4)
  1008. showStopPointsLayer.removeAllFeatures();
  1009. }
  1010. catch(err){
  1011. console.log(err.message);
  1012. }
  1013. }
  1014.  
  1015. function ObjectsChanged(){
  1016. if(W.map.getLayerByUniqueName('landmarks').selectedFeatures.length >0)
  1017. getActiveEditor().then(val => {
  1018. if(placeIsPoint && val.vertices.length > 0){
  1019. removeDragCallbacks();
  1020. checkSelection();
  1021. }
  1022. });
  1023. }
  1024.  
  1025. function handleNavPointOffScreen() {
  1026. if (selectedItem !== WazeWrap.getSelectedFeatures().first() ||
  1027. WazeWrap.Geometry.isGeometryInMapExtent(ClosestSegmentNavPoint.lonlat.toPoint())) {
  1028. W.map.events.unregister('moveend', window, handleNavPointOffScreen);
  1029. checkSelection();
  1030. }
  1031. }
  1032.  
  1033. function clearClosesetSegmentLayerFeatures() {
  1034. return closestSegmentLayer.features.length > 0 && closestSegmentLayer.removeAllFeatures();
  1035. }
  1036.  
  1037. function checkConditions() {
  1038. var a = W.map.getZoom() > 3,
  1039. b = W.map.landmarkLayer.getVisibility(),
  1040. c = closestSegmentLayer.getVisibility(),
  1041. d = !$('#map-lightbox > div').is(':visible'),//$('#map-lightbox > div').length === 0,/* Check for HN editing */
  1042. e = (WazeWrap.hasSelectedFeatures() && WazeWrap.getSelectedFeatures()[0].model.type !== "bigJunction");
  1043.  
  1044. if (a && b && c && d && e) {
  1045. return true;
  1046. } else {
  1047. return false;
  1048. }
  1049. }
  1050.  
  1051. function drawLine(start, end, lStyle, pStyle) {
  1052. var lineFeature, pointFeature;
  1053.  
  1054. lineFeature = new OL.Feature.Vector(new OL.Geometry.LineString([start, end]), {}, lStyle);
  1055. pointFeature = new OL.Feature.Vector(end, {}, pStyle);
  1056. closestSegmentLayer.addFeatures([lineFeature, pointFeature]);
  1057. }
  1058.  
  1059. function findNearestSegment(navPoint) {
  1060. var closestSegment = {};
  1061. if(navPoint.element)
  1062. navPoint = W.geometryEditing.activeEditor._navigationPointMarker.lonlat.toPoint();
  1063.  
  1064. closestSegment = WazeWrap.Geometry.findClosestSegment(navPoint,false, false);
  1065.  
  1066. clearClosesetSegmentLayerFeatures();
  1067. drawLine(navPoint, closestSegment.closestPoint, lineStyleToClosestSeg, pointStyle);
  1068. }
  1069.  
  1070. var placeIsPoint = false;
  1071. function checkSelection() {
  1072.  
  1073. var ClosestSegmentNavPoint;
  1074.  
  1075. if (!checkConditions()) {
  1076. removeDragCallbacks();
  1077. } else {
  1078. getActiveEditor().then(val => {
  1079. if (WazeWrap.hasSelectedFeatures()) {
  1080. let selectedItem = WazeWrap.getSelectedFeatures()[0];
  1081.  
  1082. if ('venue' !== selectedItem.model.type) {
  1083. removeDragCallbacks();
  1084. clearClosesetSegmentLayerFeatures();
  1085. } else {
  1086. placeIsPoint = selectedItem.model.isPoint();
  1087. if (placeIsPoint) {
  1088. //Event when the Place is moved
  1089. /*
  1090. val.dragControl.onDrag = function (e, t) {
  1091. val.dragVertex.apply(val, [e, t]);
  1092. let entryExitPoint = selectedItem.model.geometry.clone();
  1093. if(selectedItem.model.getNavigationPoints().length > 0)
  1094. entryExitPoint = selectedItem.model.attributes.entryExitPoints[0]._point;
  1095. findNearestSegment(entryExitPoint);
  1096. };*/
  1097. let entryExitPoint = selectedItem.model.geometry.clone();
  1098. if(selectedItem.model.getNavigationPoints().length > 0)
  1099. entryExitPoint = selectedItem.model.attributes.entryExitPoints[0]._point;
  1100. findNearestSegment(entryExitPoint);
  1101. } else {
  1102. if(selectedItem.model.getNavigationPoints().length === 0)
  1103. findNearestSegment(selectedItem.model.geometry.getCentroid());
  1104. else{
  1105. for(let i=0;i<selectedItem.model.getNavigationPoints().length;i++){
  1106. findNearestSegment(selectedItem.model.getNavigationPoints()[i]._point);
  1107. }
  1108. }
  1109. }
  1110. }
  1111. } else {
  1112. removeDragCallbacks();
  1113. clearClosesetSegmentLayerFeatures();
  1114. }
  1115. });
  1116. }
  1117. }
  1118.  
  1119. function removeDragCallbacks() {
  1120. if(!W.geometryEditing.activeEditor == null){
  1121. W.geometryEditing.activeEditor.dragControl.onDrag = function (e, t) {
  1122. W.geometryEditing.activeEditor.dragVertex.apply(W.geometryEditing.activeEditor, [e, t]);
  1123. };
  1124. if (null !== typeof ClosestSegmentNavPoint) {
  1125. try {
  1126. ClosestSegmentNavPoint.events.unregister('drag', W.geometryEditing.activeEditor, findNearestSegment);
  1127. } catch (err) { }
  1128. }
  1129. }
  1130. clearClosesetSegmentLayerFeatures();
  1131. }
  1132.  
  1133. function buildNewPlaceList(){
  1134. //Clear out the Places menu
  1135. $(placeMenuSelector).empty();
  1136. var cat = "";
  1137. var icon = "";
  1138. var i;
  1139. for(i=0;i<11;i++){
  1140. icon = "";
  1141. cat = $('#pieItem' + (i+1))[0].value;
  1142. icon = $('#pieItem' + (i+1))[0].options[$('#pieItem' + (i+1))[0].selectedIndex].getAttribute("data-icon");
  1143. if(cat !== "PARKING_LOT" && cat !== resCategory && cat !== "GAS_STATION")
  1144. $(placeMenuSelector).append('<div class="toolbar-group-item WazeControlDrawFeature ItemInactive ' + icon +'" id="piePlaceMainItem' + (i+1) + '" data-category="'+ cat + '"><div class="item-icon"></div><span class="menu-title">' + $('#pieItem' + (i+1))[0].options[$('#pieItem' + (i+1))[0].selectedIndex].innerHTML + '</span><div class="drawing-controls"><span class="drawing-control polygon secondary-control waze-tooltip" data-toggle="tooltip" title="" id="piePlaceAreaItem' + (i+1) + '" data-category="'+ cat + '" data-original-title="Create Area"></span><span class="drawing-control main-control point waze-tooltip" data-toggle="tooltip" title="" data-original-title="Create Point"></span></div></div>');
  1145. else{
  1146. //$(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>'); else{
  1147. if(cat === resCategory) //force point
  1148. //$(placeMenuSelector).append('<div class="toolbar-group-item WazeControlDrawFeature ItemInactive ' + icon +'" id="piePlaceMainItem' + (i+1) + '" data-category="'+ cat + '"><div class="item-icon"></div><span class="menu-title">' + $('#pieItem' + (i+1))[0].options[$('#pieItem' + (i+1))[0].selectedIndex].innerHTML + '</span></div>');
  1149. $(placeMenuSelector).append('<div class="toolbar-group-item WazeControlDrawFeature ItemInactive ' + icon + '" id="piePlaceMainItem' + (i+1) + '" data-category="'+ cat + '"><div class="item-icon"></div><span class="menu-title"><span style="font-size:12px;">' + $('#pieItem' + (i+1))[0].options[$('#pieItem' + (i+1))[0].selectedIndex].innerHTML + '</span></span></div>');
  1150. else //Parking lot & gas station - force area
  1151. $(placeMenuSelector).append('<div class="toolbar-group-item WazeControlDrawFeature ItemInactive ' + icon +'" id="piePlaceAreaItem' + (i+1) + '" data-category="'+ cat + '"><div class="item-icon"></div><span class="menu-title">' + $('#pieItem' + (i+1))[0].options[$('#pieItem' + (i+1))[0].selectedIndex].innerHTML + '</span></div>');
  1152. //$(placeMenuSelector).append('<div class="toolbar-group-item WazeControlDrawFeature ItemInactive" id="piePlaceAreaItem' + (i+1) + '" data-category="'+ cat + '"> <span class="menu-title" style="flex-grow:1;">' + $('#pieItem' + (i+1))[0].options[$('#pieItem' + (i+1))[0].selectedIndex].innerHTML + '</span></div>');
  1153. }
  1154. }
  1155.  
  1156. $('[id^="piePlaceMainItem"]').click(function(e){
  1157. $('.toolbar-group-venues').removeClass('open');
  1158. startPlacementMode($('#' + this.id).data("category"), true);
  1159. });
  1160.  
  1161. $('[id^="piePlaceAreaItem"]').click(function(e){
  1162. e.stopPropagation();
  1163. $('.toolbar-group-venues').removeClass('open');
  1164. startPlacementMode($('#' + this.id).data("category"), false);
  1165. });
  1166. }
  1167.  
  1168. function initColorPicker(tries){
  1169. tries = tries || 1;
  1170.  
  1171. if ($('#colorPickerFont')[0].jscolor ) {
  1172. $('#colorPickerFont')[0].jscolor.fromString(settings.PlaceNameFontColor);
  1173. $('[id^="colorPicker"]')[0].jscolor.closeText = 'Close';
  1174. $('#colorPickerFont')[0].jscolor.onChange = jscolorChanged;
  1175.  
  1176. $('#colorPickerFontOutline')[0].jscolor.fromString(settings.PlaceNameFontOutline);
  1177. $('#colorPickerFontOutline')[0].jscolor.onChange = jscolorChanged;
  1178.  
  1179.  
  1180. } else if (tries < 1000) {
  1181. setTimeout(function () {initColorPicker(tries++);}, 200);
  1182. }
  1183. }
  1184.  
  1185. function jscolorChanged(){
  1186. settings.PlaceNameFontColor = "#" + $('#colorPickerFont')[0].jscolor.toString();
  1187. settings.PlaceNameFontOutline = "#" + $('#colorPickerFontOutline')[0].jscolor.toString();
  1188. saveSettings();
  1189. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.fontColor = settings.PlaceNameFontColor;
  1190. PIEPlaceNameLayer.styleMap.styles.default.defaultStyle.labelOutlineColor = settings.PlaceNameFontOutline;
  1191. DisplayPlaceNames();
  1192. }
  1193.  
  1194. function registerEvents(handler){
  1195. W.selectionManager.events.register("selectionchanged", null, handler);
  1196. W.model.actionManager.events.register("afterundoaction",null, handler);
  1197. W.model.actionManager.events.register("afterclearactions",null, handler);
  1198. W.model.actionManager.events.register("afteraction",null, handler);
  1199. }
  1200.  
  1201. function unregisterEvents(handler){
  1202. W.selectionManager.events.unregister("selectionchanged", null, handler);
  1203. W.model.actionManager.events.unregister("afterundoaction",null, handler);
  1204. W.model.actionManager.events.unregister("afterclearactions",null, handler);
  1205. W.model.actionManager.events.unregister("afteraction",null, handler);
  1206. }
  1207.  
  1208. function ToggleExternalProvidersCSS(truthiness){
  1209. if(truthiness)
  1210. injectCSSWithID('pieExternalProvidersTweaks', '#edit-panel .external-providers-view .select2-container {width:90%; margin-bottom:2px;}');
  1211. else{
  1212. var styles = document.getElementById('pieExternalProvidersTweaks');
  1213. if(styles) styles.parentNode.removeChild(styles);
  1214. }
  1215. }
  1216.  
  1217. function DisplayPlaceNames(){
  1218. PIEPlaceNameLayer.removeAllFeatures();
  1219. var showPoint, showArea, showLock, showNames, showPLA;
  1220. showNames = isChecked('_cbShowPlaceNames');
  1221. showPoint = isChecked('_cbShowPlaceNamesPoint');
  1222. showArea = isChecked('_cbShowPlaceNamesArea');
  1223. showLock = isChecked('_cbShowPlaceNamesLock');
  1224. showPLA = isChecked('_cbShowPlaceNamesPLA');
  1225.  
  1226. if(showNames){
  1227. var isPoint;
  1228. for (var placeID in W.model.venues.objects) {
  1229. var venue = W.model.venues.get(placeID);
  1230. isPoint = venue.isPoint();
  1231. if((isPoint && W.map.zoom >= 5) || (!isPoint && W.map.zoom >= 3)){
  1232. if(WazeWrap.Geometry.isGeometryInMapExtent(venue.geometry)){
  1233. if( (isPoint && showPoint) || (!isPoint && showArea && !venue.isParkingLot()) || (!isPoint && showPLA && venue.isParkingLot())){
  1234. var textLoc;
  1235. if(isPoint)
  1236. textLoc = new OL.Geometry.Point(venue.geometry.x, venue.geometry.y);
  1237. else
  1238. textLoc = venue.geometry.getCentroid();
  1239. var placeName =WordWrap(venue.attributes.name.trim() + (showLock ? ' (L' + (venue.attributes.lockRank + 1) + ')' : ''));
  1240. if(venue.attributes.categories[0] === "RESIDENCE_HOME")
  1241. placeName = venue.attributes.houseNumber + (venue.attributes.name.trim() !== '' ? ' - ' + venue.attributes.name : '') + (showLock ? ' (L' + (venue.attributes.lockRank + 1) + ')' : '');
  1242. var placeNameLabel = new OL.Feature.Vector(textLoc,{display: 'block',labelText: placeName.trim(), yOffset:(isPoint ? -13 - placeName.split("\n").length * 5 : 0)});
  1243. PIEPlaceNameLayer.addFeatures([placeNameLabel]);
  1244. }
  1245. }
  1246. }
  1247. }
  1248. }
  1249. }
  1250.  
  1251. function WordWrap(text){
  1252. var newName = "";
  1253.  
  1254. if(text !== ""){
  1255. var splitName = text.match(/(.{1,35})(?:\s|$)/g);
  1256. for(var i=0;i<splitName.length;i++){
  1257. newName += splitName[i] + (i != splitName.length-1 ? '\n' : '');
  1258. }
  1259. }
  1260. console.log();
  1261. return newName;
  1262. }
  1263.  
  1264. //Shamelessly copied from URO+
  1265. function MPLayerChanged(){
  1266. for(var mObj in W.map.problemLayer.markers){
  1267. var mIcon = W.map.problemLayer.markers[mObj].icon.div;
  1268. mIcon.addEventListener("click", MarkerClick, false);
  1269. }
  1270. }
  1271.  
  1272. function MarkerClick(){
  1273. var markerType = GetMarkerType(this.className);
  1274. if(markerType !== null){
  1275. var markerID = this.attributes["data-id"].value;
  1276. if(W.map.getLayerByUniqueName("problems").markers[markerID].model.attributes.subType === 71){
  1277. var $PIECreatePLA = $('<div id="PIECreatePLA">', {style:"min-height:20px"});
  1278. $PIECreatePLA.html([
  1279. '<div class="btn btn-block" id="PIECreatePLAButton" style="color: #fff; background-color: #92c2d1; border-color: #78b0bf; margin-top:5px; width:67%; margin: 0 auto;">Create Suggested PLA</div>',
  1280. ].join(' '));
  1281.  
  1282. setTimeout(function(){$('#panel-container > div > div > div.actions > div > div > form').append($PIECreatePLA); $('#PIECreatePLAButton').click(function(){createPLAFromMP(markerID);});}, 150);
  1283. }
  1284. }
  1285. }
  1286.  
  1287. //Shamelessly copied from URO+
  1288. function GetMarkerType(className){
  1289. var markerType = null;
  1290. if(className.indexOf('user-generated') !== -1) markerType = 'ur';
  1291. else if(className.indexOf('map-problem') !== -1) markerType = 'mp';
  1292. else if(className.indexOf('place-update') !== -1) markerType = 'pur';
  1293. return markerType;
  1294. }
  1295.  
  1296. function createPLAFromMP(MPID){
  1297. var pos = W.model.problemDetails.objects[MPID].venueGeom;
  1298.  
  1299. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  1300. var AddPlace = require("Waze/Action/AddLandmark");
  1301. var NewPlace = new PlaceObject();
  1302.  
  1303. var points = [];
  1304. var i;
  1305. for(i=0;i<pos.components[0].components.length;i++){
  1306. points.push(new OL.Geometry.Point(pos.components[0].components[i].x, pos.components[0].components[i].y));
  1307. }
  1308. var ring = new OL.Geometry.LinearRing(points);
  1309. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  1310.  
  1311. NewPlace.attributes.categories.push("PARKING_LOT");
  1312.  
  1313. W.model.actionManager.add(new AddPlace(NewPlace));
  1314. W.selectionManager.setSelectedModels([NewPlace]);
  1315. }
  1316.  
  1317. function highlightObsoleteHospitalCategory(){
  1318. if(WazeWrap.getSelectedFeatures().length > 0 && WazeWrap.getSelectedFeatures()[0].model.type === "venue"){
  1319. if(_.contains(WazeWrap.getSelectedFeatures()[0].model.attributes.categories,"HOSPITAL_MEDICAL_CARE")){
  1320. $('.select2-choices').css('animation-iteration-count', 'infinite');
  1321. $('.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');
  1322. $('.select2-choices').tooltip();
  1323. }
  1324. }
  1325. }
  1326.  
  1327. var newPlaceCategory = "";
  1328. function startPlacementMode(category, isPoint){
  1329. if(category === "PARKING_LOT"){
  1330. if(!isChecked("layer-switcher-item_parking_places")){
  1331. if(!isChecked("layer-switcher-group_places"))
  1332. $("#layer-switcher-group_places").click();
  1333. $("#layer-switcher-item_parking_places").click();
  1334. }
  1335. }
  1336. else if(category === resCategory)
  1337. {
  1338. if(!isChecked("layer-switcher-item_residential_places")){
  1339. if(!isChecked("layer-switcher-group_places"))
  1340. $("#layer-switcher-group_places").click();
  1341. $("#layer-switcher-item_residential_places").click();
  1342. }
  1343. }
  1344. $('#edit-buttons > div > div.toolbar-button.waze-icon-place.toolbar-submenu.toolbar-group.toolbar-group-venues.ItemInactive').removeClass("open");
  1345. newPlaceCategory = category;
  1346. var polyDrawFeatureOptions = {callbacks : {"done": doneHandler}};
  1347. if(isPoint){
  1348. $(".olMapViewport").on('mousemove', MouseMoveHandler);
  1349. $(".olMapViewport").click(function(){endPlacementMode(category, isPoint);});
  1350. /*drawPoly = new OL.Control.DrawFeature(newPlaceLayer, OL.Handler.Polygon, polyDrawFeatureOptions);
  1351. W.map.addControl(drawPoly);
  1352. drawPoly.activate();*/
  1353. }
  1354. else{
  1355. if(drawPoly != null && drawPoly.events != null)
  1356. drawPoly.deactivate();
  1357. drawPoly = new OL.Control.DrawFeature(newPlaceLayer, OL.Handler.Polygon, polyDrawFeatureOptions);
  1358. W.map.addControl(drawPoly);
  1359. drawPoly.activate();
  1360.  
  1361. }
  1362. document.addEventListener('keyup', keyUpHandler, false);
  1363. }
  1364.  
  1365. var businessPLAPlaceName, businessPLAPlaceAddress;//, businessPLAPlacePhone, businessPLAPlaceURL;
  1366. function startBusinessPLAPlacementMode(){
  1367. var polyDrawFeatureOptions = {callbacks : {"done": doneHandlerBusinessPLAPlace}};
  1368. drawPoly = new OL.Control.DrawFeature(newPlaceLayer, OL.Handler.Polygon, polyDrawFeatureOptions);
  1369. W.map.addControl(drawPoly);
  1370. drawPoly.activate();
  1371. document.addEventListener('keyup', keyUpHandler, false);
  1372. }
  1373.  
  1374. function doneHandlerBusinessPLAPlace(geom){
  1375. drawPoly.destroy();
  1376. BusinessPLAMode = false;
  1377. CreateBusinesPLAPlace(geom, businessPLAPlaceName, businessPLAPlaceAddress);//, businessPLAPlacePhone, businessPLAPlaceURL);
  1378. }
  1379.  
  1380. function CreateBusinesPLAPlace(geom, name, address){//, phone, url){
  1381. drawPoly.destroy();
  1382.  
  1383. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  1384. var AddPlace = require("Waze/Action/AddLandmark");
  1385. var multiaction = new MultiAction();
  1386. multiaction.setModel(W.model);
  1387.  
  1388. var NewPlace = new PlaceObject();
  1389. var points = [];
  1390. var i;
  1391. for(i=0;i<geom.components[0].components.length;i++){
  1392. points.push(new OL.Geometry.Point(geom.components[0].components[i].x, geom.components[0].components[i].y));
  1393. }
  1394. var ring = new OL.Geometry.LinearRing(points);
  1395. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  1396. NewPlace.attributes.categories.push("PARKING_LOT");
  1397.  
  1398. NewPlace.attributes.lockRank = Number(settings.DefaultLockLevel);
  1399. NewPlace.attributes.name = "Parking - " + name;
  1400. //NewPlace.attributes.phone = phone;
  1401. //NewPlace.attributes.url = url;
  1402. NewPlace.attributes.categoryAttributes.PARKING_LOT = {};
  1403. NewPlace.attributes.categoryAttributes.PARKING_LOT.parkingType = "RESTRICTED";
  1404. NewPlace.attributes.categoryAttributes.PARKING_LOT.lotType = ["STREET_LEVEL"];
  1405. NewPlace.attributes.categoryAttributes.PARKING_LOT.costType = "FREE";
  1406.  
  1407. if(address){
  1408. var newAttributes, UpdateFeatureAddress = require('Waze/Action/UpdateFeatureAddress');
  1409. newAttributes = {
  1410. countryID: address.country.id,
  1411. stateID: address.state.id,
  1412. emptyCity: address.city.attributes.name ? null : true,
  1413. emptyStreet: address.street.name ? null : true,
  1414. houseNumber: address.houseNumber
  1415. };
  1416.  
  1417. newAttributes.streetName = address.street.name;
  1418.  
  1419. var cityName = address.city.attributes.name;
  1420.  
  1421. if(cityName !== "")
  1422. newAttributes.emptyCity = null;
  1423. newAttributes.cityName = cityName;
  1424. }
  1425.  
  1426.  
  1427. W.model.actionManager.add(new AddPlace(NewPlace));
  1428.  
  1429. var UFA = new UpdateFeatureAddress(NewPlace, newAttributes);
  1430. UFA.options.updateHouseNumber = true;
  1431. multiaction.doSubAction(UFA);
  1432. W.model.actionManager.add(multiaction);
  1433.  
  1434. W.selectionManager.setSelectedModels([NewPlace]);
  1435. }
  1436.  
  1437. function doneHandler(geom){
  1438. drawPoly.destroy();
  1439. createPlace(geom, newPlaceCategory, false);
  1440. }
  1441.  
  1442. function keyUpHandler(e){
  1443. if (e.keyCode == 27){
  1444. BusinessPLAMode = false;
  1445. disablePlacementMode();
  1446. if(drawPoly !== "undefined")
  1447. drawPoly.destroy();
  1448. }
  1449. else if(e.keyCode == 90 && e.ctrlKey)
  1450. drawPoly.undo();
  1451. else if(e.keyCode == 89 && e.ctrlKey)
  1452. drawPoly.redo();
  1453. else if(e.keyCode == 13)
  1454. drawPoly.finishSketch();
  1455. }
  1456.  
  1457. function disablePlacementMode(){
  1458. $(".olMapViewport").off('click');//, endPlacementMode);
  1459. $(".olMapViewport").off('mousemove', MouseMoveHandler);
  1460. clearLayer();
  1461. document.removeEventListener('keyup', keyUpHandler);
  1462. }
  1463.  
  1464. function endPlacementMode(category, isPoint){
  1465. disablePlacementMode();
  1466. createPlace(getMousePos900913(), category, isPoint);
  1467. }
  1468.  
  1469. function getMousePos900913(){
  1470. var mousePosition = $('.WazeControlMousePosition').text().split(" ");
  1471. return WazeWrap.Geometry.ConvertTo900913(mousePosition[0], mousePosition[1]);
  1472. }
  1473.  
  1474. function MouseMoveHandler(e){
  1475. clearLayer();
  1476. drawCircle(getMousePos900913());
  1477. }
  1478.  
  1479. function clearLayer() {
  1480. var layer = W.map.getLayersByName(layerName)[0];
  1481. layer.removeAllFeatures();
  1482. }
  1483.  
  1484. function drawCircle(e){
  1485. var pointFeature = new OL.Feature.Vector(new OL.Geometry.Point(e.lon, e.lat), {}, pointStyle);
  1486. W.map.getLayersByName(layerName)[0].addFeatures([pointFeature]);
  1487. }
  1488.  
  1489. function createPlace(pos, category, isPoint){
  1490. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  1491. var AddPlace = require("Waze/Action/AddLandmark");
  1492. var multiaction = new MultiAction();
  1493. multiaction.setModel(W.model);
  1494.  
  1495. var NewPlace = new PlaceObject();
  1496. if(isPoint)
  1497. NewPlace.geometry = new OL.Geometry.Point(pos.lon, pos.lat);
  1498. else{
  1499. var points = [];
  1500. var i;
  1501. for(i=0;i<pos.components[0].components.length;i++){
  1502. points.push(new OL.Geometry.Point(pos.components[0].components[i].x, pos.components[0].components[i].y));
  1503. }
  1504. var ring = new OL.Geometry.LinearRing(points);
  1505. NewPlace.geometry = new OL.Geometry.Polygon([ring]);
  1506.  
  1507. }
  1508.  
  1509. NewPlace.attributes.categories.push(category);
  1510. if(category === resCategory){
  1511. NewPlace._originalResidential = true;
  1512. NewPlace.attributes.residential = true;
  1513. let eep = new NavigationPoint(new OL.Geometry.Point(pos.lon, pos.lat));
  1514. NewPlace.attributes.entryExitPoints.push(eep);
  1515. }
  1516. NewPlace.attributes.lockRank = Number(settings.DefaultLockLevel);
  1517.  
  1518. var closestSeg = WazeWrap.Geometry.findClosestSegment(new OL.Geometry.Point(pos.lon, pos.lat), settings.SkipPLR, settings.SkipPLR);
  1519.  
  1520. W.model.actionManager.add(new AddPlace(NewPlace));
  1521. W.selectionManager.setSelectedModels([NewPlace]);
  1522.  
  1523. if(closestSeg){ //if we were able to find a segment, try to pull the city and/or street name if the options are enabled
  1524. var newAttributes, UpdateFeatureAddress = require('Waze/Action/UpdateFeatureAddress'), address = closestSeg.getAddress();
  1525.  
  1526. newAttributes = {
  1527. countryID: address.attributes.country.id,
  1528. stateID: address.attributes.state.id,
  1529. emptyCity: address.attributes.city.attributes.name ? null : true,
  1530. emptyStreet: address.attributes.street.name ? null : true
  1531. };
  1532.  
  1533. if(settings.UseStreetFromClosestSeg)
  1534. newAttributes.streetName = address.attributes.street.name;
  1535. else
  1536. newAttributes.emptyStreet = true;
  1537.  
  1538. if(settings.UseCityFromClosestSeg){
  1539. var cityName = address.attributes.city.attributes.name;
  1540.  
  1541. if(settings.UseAltCity && cityName === ""){
  1542. if(address.attributes.altStreets.length > 0){ //segment has alt names
  1543. for(var j=0;j<closestSeg.attributes.streetIDs.length;j++){
  1544. var altCity = W.model.cities.get(W.model.streets.get(closestSeg.attributes.streetIDs[j]).cityID).attributes;
  1545.  
  1546. if(altCity.englishName !== null && altCity.englishName !== "")
  1547. cityName = altCity.englishName;
  1548. }
  1549. }
  1550. }
  1551. if(cityName !== "")
  1552. newAttributes.emptyCity = null;
  1553. newAttributes.cityName = cityName;
  1554. }
  1555. else
  1556. newAttributes.emptyCity = true;
  1557.  
  1558. multiaction.doSubAction(new UpdateFeatureAddress(NewPlace, newAttributes));
  1559. W.model.actionManager.add(multiaction);
  1560. }
  1561. else
  1562. console.log("WMEPIE - No segment found; cannot set street or city name.");
  1563.  
  1564. if(category === resCategory && settings.EditRPPAfterCreated)
  1565. setTimeout(editRPPAddress, 50);
  1566. }
  1567.  
  1568. function editRPPAddress(rppTries){
  1569. rppTries = rppTries || 1;
  1570.  
  1571. if ($('.address-edit-view').length > 0) {
  1572. $('.full-address').trigger("click");
  1573. $('.house-number:first').focus();
  1574.  
  1575. } else if (rppTries < 1000) {
  1576. console.log("not found");
  1577. setTimeout(function () {editRPPAddress(rppTries++);}, 200);
  1578. }
  1579. }
  1580.  
  1581. function buildItemOption(itemNumber){
  1582. var $section = $("<div>", {style:"padding:8px 16px", id:"piePlaceCat" + itemNumber});
  1583. $section.html([
  1584. I18n.t('pie.prefs.Item') + " ",
  1585. itemNumber,
  1586. buildItemList(itemNumber),
  1587. '</br>'
  1588. ].join(' '));
  1589.  
  1590. return $section.html();
  1591. }
  1592.  
  1593. function buildLockLevelsList(){
  1594. var $lockLevels = $("<div>");
  1595. for(var i=0;i<WazeWrap.User.Rank();i++){
  1596. $lockLevels.append("<option value=" + i + ">" + (i+1) + "</option>");
  1597. }
  1598. return $lockLevels.html();
  1599. }
  1600.  
  1601. function attachRPPLockButtonHandlers(){
  1602. $('#pieRPPLockButtonsContainer').remove();
  1603. W.selectionManager.events.register("selectionchanged", null, addLockButtons);
  1604. W.model.actionManager.events.register("afterundoaction",null, addLockButtons);
  1605. W.model.actionManager.events.register("afterclearactions",null, addLockButtons);
  1606. W.model.actionManager.events.register("afteraction",null, addLockButtons);
  1607. }
  1608.  
  1609. function attachPlaceSizeHandlers(){
  1610. W.selectionManager.events.register("selectionchanged", null, updatePlaceSizeDisplay);
  1611. W.model.actionManager.events.register("afteraction",null, updatePlaceSizeDisplay);
  1612. W.model.actionManager.events.register("afterundoaction",null, updatePlaceSizeDisplay);
  1613. W.model.actionManager.events.register("afterclearactions",null, updatePlaceSizeDisplay);
  1614. W.model.actionManager.events.register("noActions",null, noActions);
  1615. updatePlaceSizeDisplay();
  1616. }
  1617.  
  1618. function removePlaceSizeHandlers(){
  1619. W.selectionManager.events.unregister("selectionchanged", null, updatePlaceSizeDisplay);
  1620. W.model.actionManager.events.unregister("afteraction",null, updatePlaceSizeDisplay);
  1621. W.model.actionManager.events.unregister("afterundoaction",null, updatePlaceSizeDisplay);
  1622. W.model.actionManager.events.unregister("afterclearactions",null, updatePlaceSizeDisplay);
  1623. W.model.actionManager.events.unregister("noActions",null, noActions);
  1624. }
  1625.  
  1626. var currLinkClass = []; //We have to keep track of the current status in case the user toggled the linking due to the panel getting rebuilt after every action
  1627. function ShowNavPointLink(){
  1628. $('#pieNavLink').remove();
  1629. return;
  1630. if(WazeWrap.getSelectedFeatures().length > 0){
  1631. if(WazeWrap.getSelectedFeatures()[0].model.type === "venue" && WazeWrap.getSelectedFeatures()[0].model.isPoint()){
  1632. if(currLinkClass.length == 0 || currLinkClass[0] != WazeWrap.getSelectedFeatures()[0].model.attributes.id){ //First time this place has been selected
  1633. currLinkClass[0] = WazeWrap.getSelectedFeatures()[0].model.attributes.id;
  1634. currLinkClass[1] = (settings.NavLink ? "fa fa-link fa-lg" : "fa fa-chain-broken fa-lg");
  1635. }
  1636. var $NavLink;
  1637. if(_.contains(WazeWrap.getSelectedFeatures()[0].model.attributes.categories,"RESIDENCE_HOME")){
  1638. $NavLink = $('<div style="display:inline-block; z-index:100; cursor:pointer;" id="pieNavLink" title=""><i class="' + currLinkClass[1] + '" id="placeNavLink" aria-hidden="true"></i></div>');
  1639. $('.address-edit.side-panel-section').before($NavLink);
  1640. }
  1641. else{
  1642. $NavLink = $('<div style="float:right; z-index:100; cursor:pointer; top:0; right:0;" id="pieNavLink" title=""><i class="' + currLinkClass[1] + '" id="placeNavLink" aria-hidden="true"></i></div>');
  1643. $('#landmark-edit-general > form > div:nth-child(2) > i').after($NavLink);
  1644. }
  1645. $('#pieNavLink').click(function(){
  1646. if($('#placeNavLink').attr("class") == "fa fa-link fa-lg"){
  1647. $('#placeNavLink').attr("class", "fa fa-chain-broken fa-lg");
  1648. currLinkClass[1] = "fa fa-chain-broken fa-lg";
  1649. }
  1650. else{
  1651. $('#placeNavLink').attr("class", "fa fa-link fa-lg");
  1652. currLinkClass[1] = "fa fa-link fa-lg";
  1653. }
  1654. });
  1655. }
  1656. }
  1657. else
  1658. currLinkClass = [];
  1659. }
  1660.  
  1661. function openPUR(){
  1662. if(WazeWrap.hasSelectedFeatures() && WazeWrap.getSelectedFeatures()[0].model.type === "venue" && $('.pending-changes-alert').length > 0){
  1663. if(typeof WazeWrap.getSelectedFeatures()[0].model.state === 'undefined' || WazeWrap.getSelectedFeatures()[0].model.state === null)
  1664. W.commands.execute("place_updates:list", WazeWrap.getSelectedFeatures()[0].model); // W.model.venues.get(WazeWrap.getSelectedFeatures()[0].model.attributes.id)
  1665. }
  1666. }
  1667.  
  1668. function _hidePaymentType(){
  1669. if(WazeWrap.hasSelectedFeatures() && _.contains(WazeWrap.getSelectedFeatures()[0].model.attributes.categories, "PARKING_LOT")){
  1670. let attr = WazeWrap.getSelectedFeatures()[0].model.attributes;
  1671. if(attr.categoryAttributes.PARKING_LOT.costType && attr.categoryAttributes.PARKING_LOT.costType === "FREE"){
  1672. if(!$('#landmark-edit-more-info > div > form > fieldset > div:nth-child(3) > div:nth-child(2)').hasClass("collapse"))
  1673. $('#landmark-edit-more-info > div > form > fieldset > div:nth-child(3) > div:nth-child(2)').addClass("collapse");
  1674. }
  1675. else{
  1676. if($('#landmark-edit-more-info > div > form > fieldset > div:nth-child(3) > div:nth-child(2)').hasClass("collapse"))
  1677. $('#landmark-edit-more-info > div > form > fieldset > div:nth-child(3) > div:nth-child(2)').removeClass("collapse");
  1678. }
  1679. }
  1680. }
  1681.  
  1682. function HidePaymentTypePlaceSelected(){
  1683. if(WazeWrap.hasSelectedFeatures() && WazeWrap.getSelectedFeatures()[0].model.type === "venue")
  1684. _hidePaymentType();
  1685. }
  1686.  
  1687. function InsertGeometryMods(){
  1688. $('#pieGeometryMods').remove();
  1689. if(WazeWrap.hasPlaceSelected() && WazeWrap.getSelectedFeatures()[0].model.geometry.toString().match(/^POLYGON/)){
  1690. var $GeomMods = $(`<div class="form-group" id="pieGeometryMods"><label class="control-label">Geometry</label><div class="controls"><div><i id="pieorthogonalize" title="Orthogonalize" class="fa fa-plus-square-o fa-2x" aria-hidden="true" style="cursor:pointer;"></i> <i id="pierotate" title="Allow rotating the Place" class="fa fa-repeat fa-2x" aria-hidden="true" style="cursor:pointer; color:${settings.Rotate ? 'rgb(0,180,0)': 'black'}"></i> <i id="pieresize" title="Allow resizing the Place. While enabled the geometry cannot be modified" class="fa fa-expand fa-2x" aria-hidden="true" style="cursor:pointer; color:${settings.Resize ? 'rgb(0,180,0)': 'black'}"></i></div></div></div>`);
  1691. $('#landmark-edit-general > form > div:nth-child(7)').after($GeomMods);
  1692.  
  1693. $('#pieorthogonalize').click(function(){
  1694. let selected = WazeWrap.getSelectedFeatures()[0].model;
  1695. var newGeom = WazeWrap.Util.OrthogonalizeGeometry(selected.geometry.clone().components[0].components);
  1696. var UFG = require("Waze/Action/UpdateFeatureGeometry");
  1697. var originalGeometry = selected.geometry.clone();
  1698.  
  1699. selected.geometry.components[0].components = [].concat(newGeom);
  1700. selected.geometry.components[0].clearBounds();
  1701.  
  1702. var action = new UFG(selected, W.model.venues, originalGeometry, selected.geometry);
  1703. W.model.actionManager.add(action);
  1704. });
  1705.  
  1706. $('#pierotate').click(function(){
  1707. settings.Rotate = !settings.Rotate;
  1708. $('#pierotate').css('color', settings.Rotate ? 'rgb(0,180,0)': 'black');
  1709. saveSettings();
  1710. getActiveEditor().then(val => {
  1711. if((val.mode & OL.Control.ModifyFeature.ROTATE) == 0)
  1712. val.mode |= OL.Control.ModifyFeature.ROTATE;
  1713. else
  1714. val.mode &= ~OL.Control.ModifyFeature.ROTATE;
  1715. val.resetVertices();
  1716. });
  1717. });
  1718.  
  1719. $('#pieresize').click(function(){
  1720. settings.Resize = !settings.Resize;
  1721. $('#pieresize').css('color', settings.Resize ? 'rgb(0,180,0)': 'black');
  1722. saveSettings();
  1723. getActiveEditor().then(val => {
  1724. if((val.mode & OL.Control.ModifyFeature.RESIZE) == 0)
  1725. val.mode |= OL.Control.ModifyFeature.RESIZE;
  1726. else
  1727. val.mode &= ~OL.Control.ModifyFeature.RESIZE;
  1728. val.resetVertices();
  1729. });
  1730. });
  1731.  
  1732. //activate the changes when a Place is selected
  1733. if(settings.Rotate){
  1734. getActiveEditor().then(val => {
  1735. if((val.mode & OL.Control.ModifyFeature.ROTATE) == 0)
  1736. val.mode |= OL.Control.ModifyFeature.ROTATE;
  1737. val.resetVertices();
  1738. });
  1739. }
  1740.  
  1741. if(settings.Resize){
  1742. getActiveEditor().then(val => {
  1743. if((val.mode & OL.Control.ModifyFeature.RESIZE) == 0)
  1744. val.mode |= OL.Control.ModifyFeature.RESIZE;
  1745. val.resetVertices();
  1746. });
  1747. }
  1748. }
  1749. else if(!WazeWrap.hasSelectedFeatures() && W.geometryEditing.activeEditor){
  1750. if(W.geometryEditing.activeEditor.radiusHandle)
  1751. W.geometryEditing.activeEditor.radiusHandle.destroy();
  1752. }
  1753. }
  1754.  
  1755. function ShowPlaceLocatorCrosshair(){
  1756. $('#pieCrosshairs').remove();
  1757. if(WazeWrap.getSelectedFeatures().length > 0){
  1758. if(WazeWrap.getSelectedFeatures()[0].model.type === "venue"){
  1759. var $crosshairs;
  1760. if(_.contains(WazeWrap.getSelectedFeatures()[0].model.attributes.categories,"RESIDENCE_HOME")){
  1761. $('.landmark > .tab-content').css('position', 'relative');
  1762. $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>');
  1763. //$('.address-edit.side-panel-section').before($crosshairs);
  1764. $('.landmark > .tab-content').append($crosshairs);
  1765. }
  1766. else{
  1767. $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>');
  1768. $('#landmark-edit-general > form > div:nth-child(2) > i').after($crosshairs);
  1769. }
  1770. $('#pieCrosshairs').click(function(){
  1771. CenterOnPlace(WazeWrap.getSelectedFeatures()[0].model, settings.PlaceZoom);
  1772. });
  1773.  
  1774. $('#pieCrosshairs').mouseenter(function(e) {
  1775. //var changedThisPl = getKMLPermalink(wazePL.getAttribute('href'));
  1776. window.addEventListener('keydown', copyPLHotkeyEvent, false);
  1777. });
  1778.  
  1779. $('#pieCrosshairs').mouseleave('mouseleave', function() {
  1780. window.removeEventListener('keydown', copyPLHotkeyEvent);
  1781. });
  1782. }
  1783. }
  1784. }
  1785.  
  1786. var copyPLHotkeyEvent = function(e) {
  1787. if ((e.metaKey || e.ctrlKey) && (e.which === 67))
  1788. copyToClipboard(getPermalink(wazePL.getAttribute('href')));
  1789. };
  1790.  
  1791. var BusinessPLAMode = false;
  1792. function ShowParkingLotButton(){
  1793. $('#piePLAButton').remove();
  1794.  
  1795. if(WazeWrap.getSelectedFeatures().length > 0){
  1796. if(WazeWrap.getSelectedFeatures()[0].model.type === "venue"){
  1797. var $PLAButton;
  1798. if(!(_.contains(WazeWrap.getSelectedFeatures()[0].model.attributes.categories,"RESIDENCE_HOME") || _.contains(WazeWrap.getSelectedFeatures()[0].model.attributes.categories,"PARKING_LOT"))){
  1799. $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>');
  1800. $('#landmark-edit-general > form > div:nth-child(2) > i').after($PLAButton);
  1801.  
  1802. $('#piePLAButton').click(function(){
  1803. if(!BusinessPLAMode){
  1804. BusinessPLAMode = true;
  1805. businessPLAPlaceName = WazeWrap.getSelectedFeatures()[0].model.attributes.name;
  1806. businessPLAPlaceAddress = WazeWrap.getSelectedFeatures()[0].model.getAddress().attributes;
  1807. //businessPLAPlacePhone = WazeWrap.getSelectedFeatures()[0].model.attributes.phone;
  1808. //businessPLAPlaceURL = WazeWrap.getSelectedFeatures()[0].model.attributes.url;
  1809. startBusinessPLAPlacementMode();
  1810. if(!isChecked("layer-switcher-item_parking_places")){
  1811. if(!isChecked("layer-switcher-group_places"))
  1812. $("#layer-switcher-group_places").click();
  1813. $("#layer-switcher-item_parking_places").click();
  1814. }
  1815. }
  1816. });
  1817. }
  1818. }
  1819. }
  1820. }
  1821.  
  1822. var extProviderTries = 0;
  1823. function ShowExternalProviderTooltip(){
  1824. if(isChecked('_cbShowExternalProviderTooltip'))
  1825. if(WazeWrap.getSelectedFeatures().length > 0 && WazeWrap.getSelectedFeatures()[0].model.type === "venue"){
  1826. if($('.select2-container.uuid').length > 0)
  1827. for(var i=0; i < $('.select2-container.uuid').find('span.select2-chosen').length; i++){
  1828. extProviderTries = 0;
  1829. ReadExtProviderText(i, extProviderTries);
  1830. }
  1831. }
  1832. }
  1833.  
  1834. var calibratingAngledWidth = false;
  1835. function ShowPLSpotEstimatorButton(){
  1836. $('.PIEParkingSpotEstimatorButton').remove();
  1837.  
  1838. if(WazeWrap.getSelectedFeatures().length > 0){
  1839. if(WazeWrap.getSelectedFeatures()[0].model.type === "venue" && WazeWrap.getSelectedFeatures()[0].model.attributes.categories.includes("PARKING_LOT")){
  1840. var $ParkingSpotEstimatorButton;
  1841. $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>');
  1842. $('#landmark-edit-general > form > div:nth-child(2) > i').after($ParkingSpotEstimatorButton);
  1843.  
  1844. $('select[name="estimatedNumberOfSpots"]').before($ParkingSpotEstimatorButton.clone());
  1845.  
  1846. $('.PIEParkingSpotEstimatorButton').click(ShowPLSpotEstimator);
  1847. totalSpots = 0;
  1848. }
  1849. }
  1850. else
  1851. $('#PIEParkingSpotEstimator').remove();//if they de-select the Place, remove the tool from the screen
  1852. }
  1853.  
  1854. function startPLSpotEstimatorDrawMode(){
  1855. let polyDrawFeatureOptions = {callbacks : {"done": PLSpotEstimatordoneHandler, "point": pointHandler}};
  1856.  
  1857. PLSpotEstimatordrawControl = new OL.Control.DrawFeature(PLSpotEstimatorLayer, OL.Handler.Path, polyDrawFeatureOptions);
  1858. W.map.addControl(PLSpotEstimatordrawControl);
  1859. PLSpotEstimatordrawControl.activate();
  1860.  
  1861. $('div#WazeMap.view-area.olMap').keydown(PLSpotEstimatorkeyUpHandler);
  1862. }
  1863.  
  1864. function startPLSpotEstimatorCalibrationMode(){
  1865. let polyDrawFeatureOptions = {callbacks : {"done": PLSpotEstimatorCalibrationdoneHandler, "point": pointHandler}};
  1866.  
  1867. PLSpotEstimatorCalibrationdrawControl = new OL.Control.DrawFeature(PLSpotEstimatorCalibrationLayer, OL.Handler.Path, polyDrawFeatureOptions);
  1868. W.map.addControl(PLSpotEstimatorCalibrationdrawControl);
  1869. PLSpotEstimatorCalibrationdrawControl.activate();
  1870.  
  1871. $('div#WazeMap.view-area.olMap').keydown(PLSpotEstimatorCalibrationkeyUpHandler);
  1872. }
  1873.  
  1874. function pointHandler() {
  1875. isDrawing = true;
  1876. }
  1877.  
  1878. function PLSpotEstimatorkeyUpHandler(e){
  1879. if (e.keyCode == 27){
  1880. if (isDrawing) {
  1881. PLSpotEstimatordrawControl.cancel();
  1882. isDrawing = false;
  1883. } else {
  1884. disablePLSpotEstimatorDrawMode();
  1885. if(PLSpotEstimatordrawControl !== "undefined")
  1886. PLSpotEstimatordrawControl.destroy();
  1887. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  1888. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  1889. }
  1890. e.stopPropagation();
  1891. }
  1892. else if(e.keyCode == 90 && e.ctrlKey)
  1893. PLSpotEstimatordrawControl.undo();
  1894. else if(e.keyCode == 89 && e.ctrlKey)
  1895. PLSpotEstimatordrawControl.redo();
  1896. else if(e.keyCode == 13)
  1897. PLSpotEstimatordrawControl.finishSketch();
  1898. }
  1899.  
  1900. function PLSpotEstimatorCalibrationkeyUpHandler(e){
  1901. if (e.keyCode == 27){
  1902. if (isDrawing) {
  1903. PLSpotEstimatorCalibrationdrawControl.cancel();
  1904. isDrawing = false;
  1905. } else {
  1906. disablePLSpotEstimatorCalibrationDrawMode();
  1907. if(PLSpotEstimatorCalibrationdrawControl !== "undefined")
  1908. PLSpotEstimatorCalibrationdrawControl.destroy();
  1909. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1910. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1911. }
  1912. e.stopPropagation();
  1913.  
  1914. }
  1915. else if(e.keyCode == 90 && e.ctrlKey)
  1916. PLSpotEstimatorCalibrationdrawControl.undo();
  1917. else if(e.keyCode == 89 && e.ctrlKey)
  1918. PLSpotEstimatorCalibrationdrawControl.redo();
  1919. else if(e.keyCode == 13)
  1920. PLSpotEstimatorCalibrationdrawControl.finishSketch();
  1921. }
  1922.  
  1923. function disablePLSpotEstimatorDrawMode(){
  1924. $("#map").off('click');
  1925. if(PLSpotEstimatordrawControl){
  1926. PLSpotEstimatordrawControl.deactivate();
  1927. PLSpotEstimatordrawControl.destroy();
  1928. }
  1929. PLSpotEstimatorLayer.removeAllFeatures();
  1930. $('div#WazeMap.view-area.olMap').off('keydown');
  1931. }
  1932.  
  1933. function disablePLSpotEstimatorCalibrationDrawMode(){
  1934. $("#map").off('click');
  1935. if(PLSpotEstimatorCalibrationdrawControl){
  1936. PLSpotEstimatorCalibrationdrawControl.deactivate();
  1937. PLSpotEstimatorCalibrationdrawControl.destroy();
  1938. }
  1939. PLSpotEstimatorCalibrationLayer.removeAllFeatures();
  1940. $('div#WazeMap.view-area.olMap').off('keydown');
  1941. }
  1942.  
  1943. var totalSpots = 0;
  1944. function PLSpotEstimatordoneHandler(geom){
  1945. let style = {strokeWidth: 3, strokeColor: '#ee9900'};
  1946. PLSpotEstimatorLayer.addFeatures(new OL.Feature.Vector(geom,{}, style));
  1947.  
  1948. let spots = Math.round(WazeWrap.Geometry.calculateDistance(geom.components)/($('#PIE90DegreeSpotWidthDraw').hasClass("PSESelected") ? $('#PIE90DegreeSpotWidth')[0].value : $('#PIEAngledSpotWidth')[0].value));
  1949. totalSpots += spots;
  1950.  
  1951. $('#PIEPLSpotEstimatorTotal')[0].innerText = totalSpots;
  1952.  
  1953. if(totalSpots > 0)
  1954. $('#PIESetParkingSpacesToPlace').prop('disabled', false);
  1955. isDrawing = false;
  1956. }
  1957.  
  1958. function PLSpotEstimatorCalibrationdoneHandler(geom){
  1959. var style = {strokeWidth: 3, strokeColor: '#00ee00'};
  1960. PLSpotEstimatorCalibrationLayer.addFeatures(new OL.Feature.Vector(geom,{}, style));
  1961. let totalLength = 0;
  1962.  
  1963. PLSpotEstimatorCalibrationLayer.features.forEach(function(f) {
  1964. let length = Math.round(WazeWrap.Geometry.calculateDistance(f.geometry.components)*100)/100;
  1965. totalLength += length;
  1966. });
  1967.  
  1968. if(calibratingAngledWidth){
  1969. $('#PIEAngledSpotWidth')[0].value = totalLength;
  1970. settings.PLAngledSpotWidth = totalLength;
  1971. }
  1972. else{
  1973. $('#PIE90DegreeSpotWidth')[0].value = totalLength;
  1974. settings.PLNormalSpotWidth = totalLength;
  1975. }
  1976. saveSettings();
  1977.  
  1978. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  1979. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  1980.  
  1981. isDrawing = false;
  1982. disablePLSpotEstimatorCalibrationDrawMode();
  1983. }
  1984.  
  1985. function ShowPLSpotEstimator(){
  1986. if($('#PIEParkingSpotEstimator').length > 0)
  1987. $('#PIEParkingSpotEstimator').remove();
  1988. else{
  1989. if(WazeWrap.getSelectedFeatures().length > 0){
  1990. if(WazeWrap.getSelectedFeatures()[0].model.type === "venue" && WazeWrap.getSelectedFeatures()[0].model.attributes.categories.includes("PARKING_LOT")){
  1991.  
  1992. var $PLSpotEstimator = $('<div>');
  1993. $PLSpotEstimator.html([
  1994. '<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">',
  1995. '<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>',
  1996. '<hr>',
  1997. '<div style=" display:flex; justify-content:space-between;">',
  1998. '<div style="display: inline;">' + I18n.t('pie.prefs.PSELayoutType') + '<br/><br/>' + I18n.t('pie.prefs.PSESpotWidth') + '</div>',
  1999. '<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>',
  2000. '<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>',
  2001. '</div>',
  2002. '<hr>',
  2003. '<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>',
  2004. '</div>'
  2005. ].join(' '));
  2006.  
  2007. $("#WazeMap").append($PLSpotEstimator.html());
  2008.  
  2009. $("#PIECloseParkingSpotEstimator").click(function(){
  2010. $('#PIEParkingSpotEstimator').remove();
  2011. disablePLSpotEstimatorDrawMode();
  2012. disablePLSpotEstimatorCalibrationDrawMode();
  2013. if(PLSpotEstimatordrawControl != null)
  2014. PLSpotEstimatordrawControl.destroy();
  2015. if(PLSpotEstimatorCalibrationdrawControl != null)
  2016. PLSpotEstimatorCalibrationdrawControl.destroy();
  2017. });
  2018.  
  2019. $('#PIEParkingSpotEstimator').keydown(function(e){
  2020. disablePLSpotEstimatorDrawMode();
  2021. disablePLSpotEstimatorCalibrationDrawMode();
  2022. if(PLSpotEstimatordrawControl != null)
  2023. PLSpotEstimatordrawControl.destroy();
  2024. if(PLSpotEstimatorCalibrationdrawControl != null)
  2025. PLSpotEstimatorCalibrationdrawControl.destroy();
  2026. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  2027. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  2028. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  2029. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  2030. });
  2031.  
  2032. $('#PIE90DegreeSpotWidth')[0].value = settings.PLNormalSpotWidth;
  2033. $('#PIEAngledSpotWidth')[0].value = settings.PLAngledSpotWidth;
  2034.  
  2035. $('#PIESetParkingSpacesToPlace').click(function(){
  2036. let spotCount = $('#PIEPLSpotEstimatorTotal')[0].innerText;
  2037. if(spotCount != "0"){
  2038. let myPlace = WazeWrap.getSelectedFeatures()[0].model;
  2039. let existingAttr = myPlace.attributes.categoryAttributes.PARKING_LOT;
  2040. let newAttr = {};
  2041. if (existingAttr) {
  2042. for (var prop in existingAttr) {
  2043. let value = existingAttr[prop];
  2044. if (Array.isArray(value)) value = [].concat(value);
  2045. newAttr[prop] = value;
  2046. }
  2047. }
  2048. let spotPropValue;
  2049. spotCount = parseInt(spotCount);
  2050. if(spotCount < 11)
  2051. spotPropValue = "R_1_TO_10";
  2052. else if(spotCount < 31)
  2053. spotPropValue = "R_11_TO_30";
  2054. else if(spotCount < 61)
  2055. spotPropValue = "R_31_TO_60";
  2056. else if(spotCount < 101)
  2057. spotPropValue = "R_61_TO_100";
  2058. else if(spotCount < 301)
  2059. spotPropValue = "R_101_TO_300";
  2060. else if(spotCount < 601)
  2061. spotPropValue = "R_301_TO_600";
  2062. else if(spotCount >= 601)
  2063. spotPropValue = "R_600_PLUS";
  2064.  
  2065. newAttr.estimatedNumberOfSpots = spotPropValue;
  2066. W.model.actionManager.add(new UpdateObject(myPlace, {'categoryAttributes': {PARKING_LOT: newAttr}}));
  2067. }
  2068. });
  2069.  
  2070. $('#PIE90DegreeSpotWidth').focusout(function(){
  2071. let width = $(this)[0].value;
  2072. if(width == "" || width == "0")
  2073. $(this)[0].value = 3.44;
  2074. settings.PLNormalSpotWidth = width;
  2075. saveSettings();
  2076. });
  2077.  
  2078. $('#PIEAngledSpotWidth').focusout(function(){
  2079. let width = $(this)[0].value;
  2080. if(width == "" || width == "0")
  2081. $(this)[0].value = 3;
  2082. settings.PLAngledSpotWidth = width;
  2083. saveSettings();
  2084. });
  2085.  
  2086. $('#PIE90DegreeSpotWidthDraw').click(function() {
  2087. if (PLSpotEstimatordrawControl && PLSpotEstimatordrawControl.active) {
  2088. PLSpotEstimatordrawControl.deactivate();
  2089. PLSpotEstimatordrawControl.destroy();
  2090. $('div#WazeMap.view-area.olMap').off('keyup');
  2091. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  2092. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  2093. } else {
  2094. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  2095. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  2096. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  2097. $('#PIE90DegreeSpotWidthDraw').addClass("PSESelected");
  2098. startPLSpotEstimatorDrawMode();
  2099. }
  2100. });
  2101.  
  2102. $('#PIEAngledSpotWidthDraw').click(function() {
  2103. if (PLSpotEstimatordrawControl && PLSpotEstimatordrawControl.active) {
  2104. PLSpotEstimatordrawControl.deactivate();
  2105. PLSpotEstimatordrawControl.destroy();
  2106. $('div#WazeMap.view-area.olMap').off('keyup');
  2107. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  2108. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  2109. } else {
  2110. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  2111. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  2112. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  2113. $('#PIEAngledSpotWidthDraw').addClass("PSESelected");
  2114. startPLSpotEstimatorDrawMode();
  2115. }
  2116. });
  2117.  
  2118. $('#PIE90DegreeSpotWidthCalibration').click(function(){
  2119. if(PLSpotEstimatordrawControl){
  2120. PLSpotEstimatordrawControl.deactivate();
  2121. PLSpotEstimatordrawControl.destroy();
  2122. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  2123. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  2124. }
  2125. if(PLSpotEstimatorCalibrationdrawControl){
  2126. PLSpotEstimatorCalibrationdrawControl.deactivate();
  2127. PLSpotEstimatorCalibrationdrawControl.destroy();
  2128. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  2129. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  2130. }
  2131. $('#PIE90DegreeSpotWidthCalibration').addClass("PSESelected");
  2132. calibratingAngledWidth = false;
  2133. startPLSpotEstimatorCalibrationMode();
  2134. });
  2135.  
  2136. $('#PIEAngledSpotWidthCalibration').click(function(){
  2137. if(PLSpotEstimatordrawControl){
  2138. PLSpotEstimatordrawControl.deactivate();
  2139. PLSpotEstimatordrawControl.destroy();
  2140. $('#PIE90DegreeSpotWidthDraw').removeClass("PSESelected");
  2141. $('#PIEAngledSpotWidthDraw').removeClass("PSESelected");
  2142. }
  2143. if(PLSpotEstimatorCalibrationdrawControl){
  2144. PLSpotEstimatorCalibrationdrawControl.deactivate();
  2145. PLSpotEstimatorCalibrationdrawControl.destroy();
  2146. $('#PIE90DegreeSpotWidthCalibration').removeClass("PSESelected");
  2147. $('#PIEAngledSpotWidthCalibration').removeClass("PSESelected");
  2148. }
  2149. $('#PIEAngledSpotWidthCalibration').addClass("PSESelected");
  2150. calibratingAngledWidth = true;
  2151. startPLSpotEstimatorCalibrationMode();
  2152. });
  2153. }
  2154. }
  2155. else{
  2156. disablePLSpotEstimatorDrawMode();
  2157. disablePLSpotEstimatorCalibrationDrawMode();
  2158. }
  2159. }
  2160. }
  2161.  
  2162. function ReadExtProviderText(index, extProviderTries){
  2163. var providersList = $('.select2-container.uuid').find('span.select2-chosen');
  2164. if($('.select2-container.uuid').find('span.select2-chosen')[index].innerHTML == "&nbsp;" && extProviderTries <= 20)
  2165. setTimeout(function(){ReadExtProviderText(index, extProviderTries++);}, 50);
  2166. else{
  2167. if($('#' + providersList[index].id).parent().parent().data('original-title') == null){
  2168. $('#' + providersList[index].id).parent().parent().attr('title', $('.select2-container.uuid').find('span.select2-chosen')[index].innerText);
  2169. $('#' + providersList[index].id).parent().parent().tooltip();
  2170. }
  2171. else
  2172. $('#' + providersList[index].id).parent().parent().attr('data-original-title', $('.select2-container.uuid').find('span.select2-chosen')[index].innerText);
  2173. }
  2174. }
  2175.  
  2176. function ShowCopyPlaceButton(){
  2177. $('#pieCopyPlaceButton').remove();
  2178.  
  2179. if(WazeWrap.getSelectedFeatures().length > 0){
  2180. //WazeWrap.getSelectedFeatures()[0].model.attributes.id.match(/(\d+\.){2}\d+/)
  2181. if(WazeWrap.getSelectedFeatures()[0].model.type === "venue"){// && (typeof WazeWrap.getSelectedFeatures()[0].model.attributes.id === "string")){ //id is only a string if the Place has been saved - don't allow copying unsaved Places
  2182. var $PlaceCopyButton;
  2183. if(!_.contains(WazeWrap.getSelectedFeatures()[0].model.attributes.categories,"RESIDENCE_HOME")){
  2184. $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>');
  2185. $('#landmark-edit-general > form > div:nth-child(2) > i').after($PlaceCopyButton);
  2186.  
  2187. $('#pieCopyPlaceButton').click(function(){
  2188. var PlaceObject = require("Waze/Feature/Vector/Landmark");
  2189. var AddPlace = require("Waze/Action/AddLandmark");
  2190.  
  2191. var NewPlace = new PlaceObject();
  2192. var oldPlace = WazeWrap.getSelectedFeatures()[0].model;
  2193.  
  2194. NewPlace.attributes.name = oldPlace.attributes.name + " (copy)";
  2195. NewPlace.attributes.phone = oldPlace.attributes.phone;
  2196. NewPlace.attributes.url = oldPlace.attributes.url;
  2197. NewPlace.attributes.categories = [].concat(oldPlace.attributes.categories);
  2198. NewPlace.attributes.aliases = [].concat(oldPlace.attributes.aliases);
  2199. NewPlace.attributes.description = oldPlace.attributes.description;
  2200. NewPlace.attributes.houseNumber = oldPlace.attributes.houseNumber;
  2201. NewPlace.attributes.lockRank = oldPlace.attributes.lockRank;
  2202. NewPlace.attributes.geometry = oldPlace.attributes.geometry.clone();
  2203.  
  2204. let convertedCoords;
  2205. if(oldPlace.attributes.geometry.toString().match(/^POLYGON/)){
  2206. for(var i=0; i<NewPlace.attributes.geometry.components[0].components.length - 1; i++){
  2207. convertedCoords = WazeWrap.Geometry.ConvertTo4326(NewPlace.attributes.geometry.components[0].components[i].x, NewPlace.attributes.geometry.components[0].components[i].y);
  2208. convertedCoords.lon += WazeWrap.Geometry.CalculateLongOffsetGPS(5, convertedCoords.long, convertedCoords.lat);
  2209. NewPlace.attributes.geometry.components[0].components[i].x = WazeWrap.Geometry.ConvertTo900913(convertedCoords.lon, convertedCoords.lat).lon;
  2210. }
  2211. }
  2212. else{
  2213. convertedCoords = WazeWrap.Geometry.ConvertTo4326(oldPlace.attributes.geometry.x, oldPlace.attributes.geometry.y);
  2214. convertedCoords.lon += WazeWrap.Geometry.CalculateLongOffsetGPS(5, convertedCoords.long, convertedCoords.lat);
  2215. NewPlace.attributes.geometry.x = WazeWrap.Geometry.ConvertTo900913(convertedCoords.lon, convertedCoords.lat).lon;
  2216. }
  2217.  
  2218. NewPlace.attributes.services = [].concat(oldPlace.attributes.services);
  2219. NewPlace.attributes.openingHours = [].concat(oldPlace.attributes.openingHours);
  2220. NewPlace.attributes.streetID = oldPlace.attributes.streetID;
  2221.  
  2222. if(_.contains(NewPlace.attributes.categories,"GAS_STATION"))
  2223. NewPlace.attributes.brand = oldPlace.attributes.brand;
  2224.  
  2225. if(_.contains(NewPlace.attributes.categories,"PARKING_LOT")){
  2226. NewPlace.attributes.categoryAttributes.PARKING_LOT = {};
  2227. var PLAttribute = oldPlace.attributes.categoryAttributes.PARKING_LOT;
  2228. if((PLAttribute.lotType != null))
  2229. NewPlace.attributes.categoryAttributes.PARKING_LOT.lotType = [].concat(oldPlace.attributes.categoryAttributes.PARKING_LOT.lotType);
  2230. if((PLAttribute.canExitWhileClosed != null))
  2231. NewPlace.attributes.categoryAttributes.PARKING_LOT.canExitWhileClosed = oldPlace.attributes.categoryAttributes.PARKING_LOT.canExitWhileClosed;
  2232. if((PLAttribute.costType != null))
  2233. NewPlace.attributes.categoryAttributes.PARKING_LOT.costType = oldPlace.attributes.categoryAttributes.PARKING_LOT.costType;
  2234. if((PLAttribute.estimatedNumberOfSpots != null))
  2235. NewPlace.attributes.categoryAttributes.PARKING_LOT.estimatedNumberOfSpots = oldPlace.attributes.categoryAttributes.PARKING_LOT.estimatedNumberOfSpots;
  2236. if((PLAttribute.hasTBR != null))
  2237. NewPlace.attributes.categoryAttributes.PARKING_LOT.hasTBR = oldPlace.attributes.categoryAttributes.PARKING_LOT.hasTBR;
  2238. if((PLAttribute.lotType != null))
  2239. NewPlace.attributes.categoryAttributes.PARKING_LOT.lotType = [].concat(oldPlace.attributes.categoryAttributes.PARKING_LOT.lotType);
  2240. if((PLAttribute.parkingType != null))
  2241. NewPlace.attributes.categoryAttributes.PARKING_LOT.parkingType = oldPlace.attributes.categoryAttributes.PARKING_LOT.parkingType;
  2242. if((PLAttribute.paymentType != null))
  2243. NewPlace.attributes.categoryAttributes.PARKING_LOT.paymentType = [].concat(oldPlace.attributes.categoryAttributes.PARKING_LOT.paymentType);
  2244. }
  2245.  
  2246. W.model.actionManager.add(new AddPlace(NewPlace));
  2247.  
  2248. var newAttributes, UpdateFeatureAddress = require('Waze/Action/UpdateFeatureAddress'), address = oldPlace.getAddress();
  2249. var multiaction = new MultiAction();
  2250. multiaction.setModel(W.model);
  2251.  
  2252. console.log(address);
  2253. newAttributes = {
  2254. countryID: address.attributes.country.id,
  2255. stateID: address.attributes.state.id,
  2256. emptyCity: address.attributes.city.attributes.name ? null : true,
  2257. emptyStreet: address.attributes.street.name ? null : true
  2258. };
  2259.  
  2260. newAttributes.streetName = address.attributes.street.name;
  2261. var cityName = address.attributes.city.attributes.name;
  2262.  
  2263. if(cityName !== "")
  2264. newAttributes.emptyCity = null;
  2265. newAttributes.cityName = cityName;
  2266.  
  2267. var UFA = new UpdateFeatureAddress(NewPlace, newAttributes);
  2268. UFA.options.updateHouseNumber = true;
  2269. multiaction.doSubAction(UFA);
  2270. W.model.actionManager.add(multiaction);
  2271. W.selectionManager.setSelectedModels([NewPlace]);
  2272. });
  2273. }
  2274. }
  2275. }
  2276. }
  2277.  
  2278. function ShowSearchButton(){
  2279. $('#pieSearchButton').remove();
  2280. if(WazeWrap.getSelectedFeatures().length > 0){
  2281. if(WazeWrap.getSelectedFeatures()[0].model.type === "venue"){
  2282. var $search = $('<i class="fa fa-search" id="pieSearchButton" title="Fills the search bar with the address" aria-hidden="true" style="display:inline; margin:5px;"></i>');
  2283. $('.address-edit-view').parent().parent().find('.control-label').attr("style", "display:inline");
  2284. $('.address-edit').before($search);
  2285. $('#pieSearchButton').click(function(){
  2286. var address = $('.full-address')[0].innerHTML;
  2287. var noCity = I18n.translations[I18n.currentLocale()].edit.address.no_city;
  2288. var noStreet = I18n.translations[I18n.currentLocale()].edit.address.no_street;
  2289.  
  2290. address = address.replace(noCity + ",","");
  2291. if(address !== I18n.translations[I18n.currentLocale()].edit.landmark.no_address)
  2292. $('.search-query')[0].value = address;
  2293. });
  2294. }
  2295. }
  2296. }
  2297.  
  2298. function ShowClearDescription(){
  2299. $('#landmark-edit-general textarea').parent().append('<i class="fa fa-times-circle clearButton" style="position:absolute; top:0; right:0;"></i>');
  2300. $('#landmark-edit-general textarea').parent().css('position', 'relative');
  2301. $('.clearButton').click(function(){
  2302. W.model.actionManager.add(new UpdateObject( WazeWrap.getSelectedFeatures()[0].model, { description: "" }));
  2303. });
  2304. }
  2305.  
  2306. function MoveAddress(){
  2307. if(WazeWrap.getSelectedFeatures().length > 0)
  2308. if(WazeWrap.getSelectedFeatures()[0].model.type === "venue")
  2309. $('#landmark-edit-general').prepend($('.address-edit.side-panel-section'));
  2310. }
  2311.  
  2312. function MoveHNEntry(){
  2313. if(WazeWrap.getSelectedFeatures().length > 0)
  2314. if(WazeWrap.getSelectedFeatures()[0].model.type === "venue")
  2315. $('.full-address').click(function(){
  2316. $('.street-name').parent().parent().before($('.house-number').parent().parent());
  2317. });
  2318. }
  2319.  
  2320. function AddMakePrimaryButtons(){
  2321. if(WazeWrap.hasSelectedFeatures() && WazeWrap.getSelectedFeatures()[0].model.type === "venue"){
  2322. if($('#landmark-edit-general > form > div:nth-child(1) > div > div > div > ul > li').length > 0){
  2323. var $button = $('<div>', {class:'makePrimary'}).text("Make primary").click(function(){
  2324. let obj = WazeWrap.getSelectedFeatures()[0].model;
  2325. let toPrimary = $(this).prev().prev().val();
  2326. let aliases = obj.attributes.aliases.filter(function(i) {
  2327. return i != toPrimary;
  2328. });
  2329. aliases.push(obj.attributes.name);
  2330. var multiaction = new MultiAction();
  2331. multiaction.setModel(W.model);
  2332. multiaction.doSubAction(new UpdateObject(obj, {aliases: aliases}));
  2333. multiaction.doSubAction(new UpdateObject(obj, {name: toPrimary}));
  2334. W.model.actionManager.add(multiaction);
  2335. });
  2336. $('#landmark-edit-general > form > div:nth-child(1) > div > div > div > ul > li').find('.delete').after($button);
  2337. }
  2338. }
  2339. }
  2340.  
  2341. function AddEEPJumpButtons(){
  2342. $('.navigation-point-list-item').find('.buttons').prepend('<div><i id="EEPCrosshair" class="fa fa-crosshairs" style="color:#2f799b" aria-hidden="true"></i></div>');
  2343. $('#EEPCrosshair').click(function(){
  2344. let point = WazeWrap.getSelectedFeatures()[0].model.attributes.entryExitPoints[0]._point;
  2345. W.map.setCenter([point.x, point.y], W.map.zoom);
  2346. });
  2347. }
  2348.  
  2349. function AddPlaceCategoriesButtons(){
  2350. $('#piePlaceCategoriesButtonsContainer').remove();
  2351. if(WazeWrap.getSelectedFeatures().length > 0){
  2352. var $container = $('<div>',{id:'piePlaceCategoriesButtonsContainer', style:'white-space: nowrap;'});
  2353. if(WazeWrap.getSelectedFeatures()[0].model.type === "venue"){
  2354. var categoryOptions = $('[id^=pieItem]');
  2355.  
  2356. var $button = $('<div>',{id:'btnPlaceCatClear', title:'Clear current categories', style:'display:inline-block; cursor:pointer'}).click(function() { onPlaceCategoriesButtonsClick(this.id); });
  2357. $button.append('<span class="fa fa-times" style="font-size:20px; color:red;"></span>');
  2358. $container.append($button);
  2359.  
  2360. for(var i=0;i<categoryOptions.length;i++){
  2361. var name = categoryOptions[i].options[categoryOptions[i].selectedIndex].innerHTML;
  2362. var icon = categoryOptions[i].options[categoryOptions[i].selectedIndex].getAttribute("data-icon");
  2363.  
  2364. var divid = 'btnPlaceCat' + categoryOptions[i].value;
  2365. if(categoryOptions[i].value !== resCategory && categoryOptions[i].value !== "PARKING_LOT"){
  2366. $button = $('<div>',{ class:'pie-'+icon, id:divid, title:name.replace('&amp;', '&'), style:'display:inline-block; cursor:pointer', 'data-category':categoryOptions[i].value}).click(function() { onPlaceCategoriesButtonsClick(this.id); });
  2367. $button.append('<span style="font-size:20px;"></span>');
  2368.  
  2369. $container.append($button);
  2370. }
  2371. }
  2372. }
  2373.  
  2374. $('.categories.controls').before($container);
  2375. }
  2376. }
  2377.  
  2378. function onPlaceCategoriesButtonsClick(buttonid){
  2379. if(buttonid === "btnPlaceCatClear"){
  2380. var blankCategories = []; //WazeWrap.getSelectedFeatures()[0].model.attributes.categories.clone();
  2381. //console.log(blankCategories.length);
  2382. //blankCategories.splice(0, blankCategories.length);
  2383. //console.log(blankCategories);
  2384. W.model.actionManager.add(new UpdateObject(WazeWrap.getSelectedFeatures()[0].model, { categories: blankCategories }));
  2385. }
  2386. else{
  2387. var newCategories = [].concat(WazeWrap.getSelectedFeatures()[0].model.attributes.categories);
  2388. //console.log($('#'+buttonid)[0].getAttribute("data-category"));
  2389. newCategories.push($('#'+buttonid)[0].getAttribute("data-category"));
  2390. W.model.actionManager.add(new UpdateObject(WazeWrap.getSelectedFeatures()[0].model, {categories: newCategories}));
  2391. }
  2392. }
  2393.  
  2394. function CenterOnPlace(venue, zoom){
  2395. var centroid = venue.geometry.getCentroid();
  2396. W.map.setCenter([centroid.x, centroid.y], zoom);
  2397. }
  2398.  
  2399. function isChecked(checkboxId) {
  2400. return $('#' + checkboxId).is(':checked');
  2401. }
  2402.  
  2403. function setChecked(checkboxId, checked) {
  2404. $('#' + checkboxId).prop('checked', checked);
  2405. }
  2406.  
  2407. function noActions(){
  2408. 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.
  2409. }
  2410.  
  2411. function updatePlaceSizeDisplay(){
  2412. var count = WazeWrap.getSelectedFeatures().length;
  2413. var metersArea = 0;
  2414. var bold = false;
  2415. if(count === 1){
  2416. var venue = WazeWrap.getSelectedFeatures()[0];
  2417. var isArea = venue.geometry.toString().match(/^POLYGON/);
  2418. //var isPoint = venue.geometry.toString().match(/^POINT/);
  2419.  
  2420. if(venue.model.type === "venue" && isArea){
  2421. if($('#AreaSize'))
  2422. $('#AreaSize').remove();
  2423. metersArea = WazeWrap.getSelectedFeatures()[0].model.geometry.getGeodesicArea(W.map.getProjectionObject());
  2424.  
  2425. if(metersArea > 0 && isArea){
  2426. var ftArea = Math.round(metersArea * 10.76391 *100)/100;
  2427.  
  2428. var list = $('#landmark-edit-general > ul')[0];
  2429. var newList = document.createElement("UL");
  2430. newList.id = "AreaSize";
  2431.  
  2432. var newItem = document.createElement("LI");
  2433. if(isChecked("_cbShowAreaPlaceSizeMetric")){
  2434. newItem.innerHTML = "Area: " + metersArea.toFixed(2) + " m<sup>2</sup>";
  2435. newList.appendChild(newItem);
  2436. }
  2437.  
  2438. if(isChecked("_cbShowAreaPlaceSizeImperial")){
  2439. newItem = document.createElement("LI");
  2440. newItem.innerHTML = "Area: " + ftArea.toFixed(2) + " ft<sup>2</sup>";
  2441. newList.appendChild(newItem);
  2442. }
  2443. if(metersArea < 500){
  2444. newItem = document.createElement("LI");
  2445. 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>";
  2446. newList.appendChild(newItem);
  2447. }
  2448. if(metersArea > 20000){
  2449. newItem = document.createElement("LI");
  2450. 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>";
  2451. newList.appendChild(newItem);
  2452. }
  2453. if(list.before != null)
  2454. list.before(newList);
  2455. else{
  2456. var parent = $('#landmark-edit-general > ul')[0].parentNode;
  2457. parent.insertBefore(newList,$('#landmark-edit-general > ul')[0]);
  2458. }
  2459.  
  2460. $('#AreaSize').addClass("list-unstyled");
  2461. $('#AreaSize').addClass("additional-attributes");
  2462. }
  2463. }
  2464. }
  2465. }
  2466.  
  2467. //Using the same display for lock buttons as ClickSaver (with permission from MapoMatic) - thanks MoM!
  2468. function addLockButtons() {
  2469. if(WazeWrap.getSelectedFeatures().length > 0){
  2470. var item = WazeWrap.getSelectedFeatures()[0];
  2471. var isRPP = item.model.type === "venue" && item.model.isResidential(); //(item.model.type === "venue" && item.model.attributes.residential === true);
  2472.  
  2473. if(isRPP){
  2474. var attr = item.model.attributes;
  2475. var autoRank = attr.rank;
  2476. var manualRank = attr.lockRank;
  2477. var firstManualRank = manualRank;
  2478. var userRank = WazeWrap.User.Rank() - 1;
  2479. var maxAutoRank = autoRank;
  2480. var disabled = false;
  2481.  
  2482. var $div = $('#pieRPPLockButtonsContainer');
  2483. $div.remove();
  2484. $div = $('<div>',{id:'pieRPPLockButtonsContainer',style:'margin-bottom:5px;'});
  2485. $div.append('<label class="control-label">Lock</label>');
  2486. var $controls = $('<div>', {class:'waze-radio-container'});
  2487. var btnInfos = [];
  2488.  
  2489. for(var iBtn=0;iBtn<=6;iBtn++){btnInfos.push({r:iBtn,val:iBtn});}
  2490. btnInfos.forEach(function(btnInfo){
  2491. var selected = (btnInfo.val == manualRank);
  2492. disabled = userRank < btnInfo.val;
  2493. if (btnInfo.val !== 6) {
  2494. $controls.append(
  2495. $(`<input type="radio" name="lockRank" value="${btnInfo.r}" id="lockRank-${btnInfo.r}" data-type="numeric" data-nullable="true" ${btnInfo.val == manualRank ? "checked" : ""} ${disabled ? "disabled" : ""}><label for="lockRank-${btnInfo.r}" value="${btnInfo.r}">${btnInfo.r+1}</label>`)
  2496. .click(function() {
  2497. if((userRank >= parseInt($(this).attr('value'))) && (btnInfo.r < 6)) {
  2498. W.model.actionManager.add(new UpdateObject(item.model,{lockRank:(parseInt($(this).attr('value')))}));
  2499. addLockButtons();
  2500. }
  2501. })
  2502. );
  2503. }
  2504. });
  2505. $div.append($controls);
  2506. $('#landmark-edit-general > form.attributes-form.side-panel-section').after($div);
  2507. }
  2508. }
  2509. }
  2510.  
  2511. var getPermalink = function(currPl) {
  2512. var adjustedPL = currPl.substr(currPl.lastIndexOf('editor')).replace(/&[^&]*Filter=[^&]*|&s=(\d+)/ig,'');
  2513. var lon = adjustedPL.match(/lon=(-?\d+\.\d+)/)[1];
  2514. var lat = adjustedPL.match(/lat=(-?\d+\.\d+)/)[1];
  2515. var zoom = adjustedPL.match(/zoom=\d+/)[0];
  2516. var centroid = WazeWrap.getSelectedFeatures()[0].model.geometry.getCentroid();
  2517. adjustedPL = adjustedPL.replace(lon, WazeWrap.Geometry.ConvertTo4326(centroid.x,centroid.y).lon);
  2518. adjustedPL = adjustedPL.replace(lat, WazeWrap.Geometry.ConvertTo4326(centroid.x,centroid.y).lat);
  2519. adjustedPL = adjustedPL.replace(zoom, "zoom="+settings.PlaceZoom);
  2520. if(settings.PlaceLocatorCrosshairProdPL)
  2521. return 'https://www.waze.com/' + adjustedPL;
  2522. else
  2523. return location.origin + '/' + adjustedPL;
  2524. };
  2525.  
  2526. var copyToClipboard = function(str) {
  2527. var $temp = $('<input>');
  2528. $('body').append($temp);
  2529. $temp.val(str).select();
  2530. document.execCommand('copy');
  2531. $temp.remove();
  2532. };
  2533.  
  2534. function buildItemList(itemNumber){
  2535.  
  2536. var $places = $("<div>");
  2537. $places.html([
  2538. '<select id="pieItem' + itemNumber + '">',
  2539. '<option value="CAR_SERVICES" data-icon="car-services" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_SERVICES + '</option>',
  2540. '<option value="GAS_STATION" data-icon="car-services">' + I18n.translations[I18n.currentLocale()].venues.categories.GAS_STATION + '</option>',
  2541. '<option value="GARAGE_AUTOMOTIVE_SHOP" data-icon="car-services">' + I18n.translations[I18n.currentLocale()].venues.categories.GARAGE_AUTOMOTIVE_SHOP + '</option>',
  2542. '<option value="CAR_WASH" data-icon="car-services">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_WASH + '</option>',
  2543. '<option value="CHARGING_STATION" data-icon="car-services">' + I18n.translations[I18n.currentLocale()].venues.categories.CHARGING_STATION + '</option>',
  2544. '<option value="TRANSPORTATION" data-icon="transportation" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.TRANSPORTATION + '</option>',
  2545. '<option value="AIRPORT" data-icon="transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.AIRPORT + '</option>',
  2546. '<option value="BUS_STATION" data-icon="transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.BUS_STATION + '</option>',
  2547. '<option value="FERRY_PIER" data-icon="transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.FERRY_PIER + '</option>',
  2548. '<option value="SEAPORT_MARINA_HARBOR" data-icon="transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.SEAPORT_MARINA_HARBOR + '</option>',
  2549. '<option value="SUBWAY_STATION" data-icon="transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.SUBWAY_STATION + '</option>',
  2550. '<option value="TRAIN_STATION" data-icon="transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TRAIN_STATION + '</option>',
  2551. '<option value="BRIDGE" data-icon="transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.BRIDGE + '</option>',
  2552. '<option value="TUNNEL" data-icon="transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TUNNEL + '</option>',
  2553. '<option value="TAXI_STATION" data-icon="transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.TAXI_STATION + '</option>',
  2554. '<option value="JUNCTION_INTERCHANGE" data-icon="transportation">' + I18n.translations[I18n.currentLocale()].venues.categories.JUNCTION_INTERCHANGE + '</option>',
  2555. '<option value="PROFESSIONAL_AND_PUBLIC" data-icon="professional-and-public" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.PROFESSIONAL_AND_PUBLIC + '</option>',
  2556. '<option value="COLLEGE_UNIVERSITY" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.COLLEGE_UNIVERSITY + '</option>',
  2557. '<option value="SCHOOL" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.SCHOOL + '</option>',
  2558. '<option value="CONVENTIONS_EVENT_CENTER" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.CONVENTIONS_EVENT_CENTER + '</option>',
  2559. '<option value="GOVERNMENT" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.GOVERNMENT + '</option>',
  2560. '<option value="LIBRARY" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.LIBRARY + '</option>',
  2561. '<option value="CITY_HALL" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.CITY_HALL + '</option>',
  2562. '<option value="ORGANIZATION_OR_ASSOCIATION" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.ORGANIZATION_OR_ASSOCIATION + '</option>',
  2563. '<option value="PRISON_CORRECTIONAL_FACILITY" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.PRISON_CORRECTIONAL_FACILITY + '</option>',
  2564. '<option value="COURTHOUSE" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.COURTHOUSE + '</option>',
  2565. '<option value="CEMETERY" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.CEMETERY + '</option>',
  2566. '<option value="FIRE_DEPARTMENT" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.FIRE_DEPARTMENT + '</option>',
  2567. '<option value="POLICE_STATION" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.POLICE_STATION + '</option>',
  2568. '<option value="MILITARY" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.MILITARY + '</option>',
  2569. '<option value="HOSPITAL_URGENT_CARE" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.HOSPITAL_URGENT_CARE + '</option>',
  2570. '<option value="DOCTOR_CLINIC" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.DOCTOR_CLINIC + '</option>',
  2571. '<option value="OFFICES" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.OFFICES + '</option>',
  2572. '<option value="POST_OFFICE" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.POST_OFFICE + '</option>',
  2573. '<option value="RELIGIOUS_CENTER" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.RELIGIOUS_CENTER + '</option>',
  2574. '<option value="KINDERGARTEN" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.KINDERGARDEN + '</option>',
  2575. '<option value="FACTORY_INDUSTRIAL" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.FACTORY_INDUSTRIAL + '</option>',
  2576. '<option value="EMBASSY_CONSULATE" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.EMBASSY_CONSULATE + '</option>',
  2577. '<option value="INFORMATION_POINT" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.INFORMATION_POINT + '</option>',
  2578. '<option value="EMERGENCY_SHELTER" data-icon="professional-and-public">' + I18n.translations[I18n.currentLocale()].venues.categories.EMERGENCY_SHELTER + '</option>',
  2579. '<option value="SHOPPING_AND_SERVICES" data-icon="shopping-and-services" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.SHOPPING_AND_SERVICES + '</option>',
  2580. '<option value="ARTS_AND_CRAFTS" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.ARTS_AND_CRAFTS + '</option>',
  2581. '<option value="BANK_FINANCIAL" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.BANK_FINANCIAL + '</option>',
  2582. '<option value="SPORTING_GOODS" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.SPORTING_GOODS + '</option>',
  2583. '<option value="BOOKSTORE" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.BOOKSTORE + '</option>',
  2584. '<option value="PHOTOGRAPHY" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.PHOTOGRAPHY + '</option>',
  2585. '<option value="CAR_DEALERSHIP" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_DEALERSHIP + '</option>',
  2586. '<option value="FASHION_AND_CLOTHING" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.FASHION_AND_CLOTHING + '</option>',
  2587. '<option value="CONVENIENCE_STORE" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.CONVENIENCE_STORE + '</option>',
  2588. '<option value="PERSONAL_CARE" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.PERSONAL_CARE + '</option>',
  2589. '<option value="DEPARTMENT_STORE" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.DEPARTMENT_STORE + '</option>',
  2590. '<option value="PHARMACY" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.PHARMACY + '</option>',
  2591. '<option value="ELECTRONICS" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.ELECTRONICS + '</option>',
  2592. '<option value="FLOWERS" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.FLOWERS + '</option>',
  2593. '<option value="FURNITURE_HOME_STORE" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.FURNITURE_HOME_STORE + '</option>',
  2594. '<option value="GIFTS" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.GIFTS + '</option>',
  2595. '<option value="GYM_FITNESS" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.GYM_FITNESS + '</option>',
  2596. '<option value="SWIMMING_POOL" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.SWIMMING_POOL + '</option>',
  2597. '<option value="HARDWARE_STORE" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.HARDWARE_STORE + '</option>',
  2598. '<option value="MARKET" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.MARKET + '</option>',
  2599. '<option value="SUPERMARKET_GROCERY" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.SUPERMARKET_GROCERY + '</option>',
  2600. '<option value="JEWELRY" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.JEWELRY + '</option>',
  2601. '<option value="LAUNDRY_DRY_CLEAN" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.LAUNDRY_DRY_CLEAN + '</option>',
  2602. '<option value="SHOPPING_CENTER" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.SHOPPING_CENTER + '</option>',
  2603. '<option value="MUSIC_STORE" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSIC_STORE + '</option>',
  2604. '<option value="PET_STORE_VETERINARIAN_SERVICES" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.PET_STORE_VETERINARIAN_SERVICES + '</option>',
  2605. '<option value="TOY_STORE" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.TOY_STORE + '</option>',
  2606. '<option value="TRAVEL_AGENCY" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.TRAVEL_AGENCY + '</option>',
  2607. '<option value="ATM" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.ATM + '</option>',
  2608. '<option value="CURRENCY_EXCHANGE" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.CURRENCY_EXCHANGE + '</option>',
  2609. '<option value="CAR_RENTAL" data-icon="shopping-and-services">' + I18n.translations[I18n.currentLocale()].venues.categories.CAR_RENTAL + '</option>',
  2610. '<option value="FOOD_AND_DRINK" data-icon="food-and-drink" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.FOOD_AND_DRINK + '</option>',
  2611. '<option value="RESTAURANT" data-icon="food-and-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.RESTAURANT + '</option>',
  2612. '<option value="BAKERY" data-icon="food-and-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.BAKERY + '</option>',
  2613. '<option value="DESSERT" data-icon="food-and-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.DESSERT + '</option>',
  2614. '<option value="CAFE" data-icon="food-and-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.CAFE + '</option>',
  2615. '<option value="FAST_FOOD" data-icon="food-and-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.FAST_FOOD + '</option>',
  2616. '<option value="FOOD_COURT" data-icon="food-and-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.FOOD_COURT + '</option>',
  2617. '<option value="BAR" data-icon="food-and-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.BAR + '</option>',
  2618. '<option value="ICE_CREAM" data-icon="food-and-drink">' + I18n.translations[I18n.currentLocale()].venues.categories.ICE_CREAM + '</option>',
  2619. '<option value="CULTURE_AND_ENTERTAINEMENT" data-icon="culture-and-entertainement" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.CULTURE_AND_ENTERTAINEMENT + '</option>',
  2620. '<option value="ART_GALLERY" data-icon="culture-and-entertainement">' + I18n.translations[I18n.currentLocale()].venues.categories.ART_GALLERY + '</option>',
  2621. '<option value="CASINO" data-icon="culture-and-entertainement">' + I18n.translations[I18n.currentLocale()].venues.categories.CASINO + '</option>',
  2622. '<option value="CLUB" data-icon="culture-and-entertainement">' + I18n.translations[I18n.currentLocale()].venues.categories.CLUB + '</option>',
  2623. '<option value="TOURIST_ATTRACTION_HISTORIC_SITE" data-icon="culture-and-entertainement">' + I18n.translations[I18n.currentLocale()].venues.categories.TOURIST_ATTRACTION_HISTORIC_SITE + '</option>',
  2624. '<option value="MOVIE_THEATER" data-icon="culture-and-entertainement">' + I18n.translations[I18n.currentLocale()].venues.categories.MOVIE_THEATER + '</option>',
  2625. '<option value="MUSEUM" data-icon="culture-and-entertainement">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSEUM + '</option>',
  2626. '<option value="MUSIC_VENUE" data-icon="culture-and-entertainement">' + I18n.translations[I18n.currentLocale()].venues.categories.MUSIC_VENUE + '</option>',
  2627. '<option value="PERFORMING_ARTS_VENUE" data-icon="culture-and-entertainement">' + I18n.translations[I18n.currentLocale()].venues.categories.PERFORMING_ARTS_VENUE + '</option>',
  2628. '<option value="GAME_CLUB" data-icon="culture-and-entertainement">' + I18n.translations[I18n.currentLocale()].venues.categories.GAME_CLUB + '</option>',
  2629. '<option value="STADIUM_ARENA" data-icon="culture-and-entertainement">' + I18n.translations[I18n.currentLocale()].venues.categories.STADIUM_ARENA + '</option>',
  2630. '<option value="THEME_PARK" data-icon="culture-and-entertainement">' + I18n.translations[I18n.currentLocale()].venues.categories.THEME_PARK + '</option>',
  2631. '<option value="ZOO_AQUARIUM" data-icon="culture-and-entertainement">' + I18n.translations[I18n.currentLocale()].venues.categories.ZOO_AQUARIUM + '</option>',
  2632. '<option value="RACING_TRACK" data-icon="culture-and-entertainement">' + I18n.translations[I18n.currentLocale()].venues.categories.RACING_TRACK + '</option>',
  2633. '<option value="THEATER" data-icon="culture-and-entertainement">' + I18n.translations[I18n.currentLocale()].venues.categories.THEATER + '</option>',
  2634. '<option value="OTHER" data-icon="other" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.OTHER + '</option>',
  2635. '<option value="CONSTRUCTION_SITE" data-icon="">' + I18n.translations[I18n.currentLocale()].venues.categories.CONSTRUCTION_SITE + '</option>',
  2636. '<option value="LODGING" data-icon="lodging" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.LODGING + '</option>',
  2637. '<option value="HOTEL" data-icon="lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.HOTEL + '</option>',
  2638. '<option value="HOSTEL" data-icon="lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.HOSTEL + '</option>',
  2639. '<option value="CAMPING_TRAILER_PARK" data-icon="lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.CAMPING_TRAILER_PARK + '</option>',
  2640. '<option value="COTTAGE_CABIN" data-icon="lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.COTTAGE_CABIN + '</option>',
  2641. '<option value="BED_AND_BREAKFAST" data-icon="lodging">' + I18n.translations[I18n.currentLocale()].venues.categories.BED_AND_BREAKFAST + '</option>',
  2642. '<option value="OUTDOORS" data-icon="outdoors" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.OUTDOORS + '</option>',
  2643. '<option value="PARK" data-icon="outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PARK + '</option>',
  2644. '<option value="PLAYGROUND" data-icon="outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PLAYGROUND + '</option>',
  2645. '<option value="BEACH" data-icon="outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.BEACH + '</option>',
  2646. '<option value="SPORTS_COURT" data-icon="outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SPORTS_COURT + '</option>',
  2647. '<option value="GOLF_COURSE" data-icon="outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.GOLF_COURSE + '</option>',
  2648. '<option value="PLAZA" data-icon="outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PLAZA + '</option>',
  2649. '<option value="PROMENADE" data-icon="outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.PROMENADE + '</option>',
  2650. '<option value="POOL" data-icon="outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.POOL + '</option>',
  2651. '<option value="SCENIC_LOOKOUT_VIEWPOINT" data-icon="outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SCENIC_LOOKOUT_VIEWPOINT + '</option>',
  2652. '<option value="SKI_AREA" data-icon="outdoors">' + I18n.translations[I18n.currentLocale()].venues.categories.SKI_AREA + '</option>',
  2653. '<option value="NATURAL_FEATURES" data-icon="natural-feature" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.NATURAL_FEATURES + '</option>',
  2654. '<option value="ISLAND" data-icon="natural-feature">' + I18n.translations[I18n.currentLocale()].venues.categories.ISLAND + '</option>',
  2655. '<option value="SEA_LAKE_POOL" data-icon="natural-feature">' + I18n.translations[I18n.currentLocale()].venues.categories.SEA_LAKE_POOL + '</option>',
  2656. '<option value="RIVER_STREAM" data-icon="natural-feature">' + I18n.translations[I18n.currentLocale()].venues.categories.RIVER_STREAM + '</option>',
  2657. '<option value="FOREST_GROVE" data-icon="natural-feature">' + I18n.translations[I18n.currentLocale()].venues.categories.FOREST_GROVE + '</option>',
  2658. '<option value="FARM" data-icon="natural-feature">' + I18n.translations[I18n.currentLocale()].venues.categories.FARM + '</option>',
  2659. '<option value="CANAL" data-icon="natural-feature">' + I18n.translations[I18n.currentLocale()].venues.categories.CANAL + '</option>',
  2660. '<option value="SWAMP_MARSH" data-icon="natural-feature">' + I18n.translations[I18n.currentLocale()].venues.categories.SWAMP_MARSH + '</option>',
  2661. '<option value="DAM" data-icon="natural-feature">' + I18n.translations[I18n.currentLocale()].venues.categories.DAM + '</option>',
  2662. '<option value="PARKING_LOT" data-icon="parking-lot" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.PARKING_LOT + '</option>',
  2663. '<option value="RESIDENCE_HOME" data-icon="residential" style="font-weight:bold;">' + I18n.translations[I18n.currentLocale()].venues.categories.RESIDENCE_HOME + '</option>',
  2664. '</select>'
  2665. ].join(' '));
  2666.  
  2667. return $places.html();
  2668. }
  2669.  
  2670. function injectCss() {
  2671. var css = [
  2672. // Lock button formatting
  2673. '.btn-lh {cursor:pointer;padding:1px 6px;height:22px;border:solid 1px #c1c1c1;margin-right:3px;}',
  2674. '.btn.btn-lh.btn-lh-selected {background-color:#6999ae;color:white}',
  2675. '.btn.btn-lh.btn-lh-selected:hover {color:white}',
  2676. '.btn.btn-lh.disabled {color:#909090;background-color:#f7f7f7;}',
  2677. '.btn.btn-lh.btn-lh-selected.disabled {color:white;background-color:#6999ae;}',
  2678. //Settings Panel
  2679. '#sidebar .controls-container.pie-controls-container {padding: 0px;}',
  2680. '.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;}',
  2681. //'@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;}}',
  2682. //Image Dialog Enhancement
  2683. '.imgcon {position:relative; margin:0 auto;}',
  2684. '.imnav {color: #ffffff; margin:0 auto; opacity:0.7; display:none; position:absolute; top:0; left:0px; width:100%; height:89%;}',
  2685. '.imgcon:hover .imnav{display:inline-block;}',
  2686. '.control {float:left; height:100%; width:33%; opacity:0;}',
  2687. '.control:hover {opacity:0.7;}',
  2688. '.prim {width:15%; background:url("http://i59.tinypic.com/294s94i.gif")left center no-repeat;}',
  2689. '.zmim {width:70%;}',
  2690. '.neim {width:15%; background:url("http://i62.tinypic.com/2cqfqxf.gif")right center no-repeat;}',
  2691. //PSE
  2692. '.PSESelected {border: 3px solid #ee9900;}',
  2693. //hijacking new WME Place icons
  2694. '.pie-car-services {background-image: url(//editor-assets.waze.com/beta/img/toolbar022c8e4d1f16c3825705364ff337bf1b.png); background-position: -29px -63px; width: 14px; height: 13px; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { .pie-car-services {background-image: url(//editor-assets.waze.com/beta/img/toolbar@2xcd8b2ab08e978d00eeee7817e1a0edda.png); background-size: 99px 87px; } }',
  2695. '.pie-transportation {background-image: url(//editor-assets.waze.com/beta/img/toolbar022c8e4d1f16c3825705364ff337bf1b.png); background-position: -56px -63px; width: 12px; height: 12px; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {.pie-transportation {background-image: url(//editor-assets.waze.com/beta/img/toolbar@2xcd8b2ab08e978d00eeee7817e1a0edda.png);background-size: 99px 87px; } }',
  2696. '.pie-professional-and-public {background-image: url(//editor-assets.waze.com/beta/img/toolbar022c8e4d1f16c3825705364ff337bf1b.png); background-position: 0px -76px; width: 13px; height: 11px; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {.pie-professional-and-public {background-image:url(//editor-assets.waze.com/beta/img/toolbar@2xcd8b2ab08e978d00eeee7817e1a0edda.png); background-size: 99px 87px; } }',
  2697. '.pie-shopping-and-services {background-image: url(//editor-assets.waze.com/beta/img/toolbar022c8e4d1f16c3825705364ff337bf1b.png); background-position: -88px 0px; width: 11px; height: 13px; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {.pie-shopping-and-services {background-image:url(//editor-assets.waze.com/beta/img/toolbar@2xcd8b2ab08e978d00eeee7817e1a0edda.png); background-size: 99px 87px; } }',
  2698. '.pie-food-and-drink {background-image: url(//editor-assets.waze.com/beta/img/toolbar022c8e4d1f16c3825705364ff337bf1b.png); background-position: -65px 0px; width: 13px; height: 16px; } @mediait-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {.pie-food-and-drink {background-image:ditor-assets.waze.com/beta/img/toolbar@2xcd8b2ab08e978d00eeee7817e1a0edda.png); background-size: 99px 87px; } }',
  2699. '.pie-culture-and-entertainement {background-image: url(//editor-assets.waze.com/beta/img/toolbar022c8e4d1f16c3825705364ff337bf1b.png); background-position: -30px -37px; width: 16px; height: 14px; }edia (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {.pie-culture-and-entertainement {background-image:ditor-assets.waze.com/beta/img/toolbar@2xcd8b2ab08e978d00eeee7817e1a0edda.png); background-size: 99px 87px; } }',
  2700. '.pie-other {background-image: url(//editor-assets.waze.com/beta/img/toolbar022c8e4d1f16c3825705364ff337bf1b.png); background-position: 0px -63px; width: 15px; height: 13px; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {.pie-other {background-image:url(//editor-assets.waze.com/beta/img/toolbar@2xcd8b2ab08e978d00eeee7817e1a0edda.png); background-size: 99px 87px; } }',
  2701. '.pie-lodging {background-image: url(//editor-assets.waze.com/beta/img/toolbar022c8e4d1f16c3825705364ff337bf1b.png); background-position: -20px -52px; width: 17px; height: 10px; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {.pie-lodging {background-image:url(//editor-assets.waze.com/beta/img/toolbar@2xcd8b2ab08e978d00eeee7817e1a0edda.png); background-size: 99px 87px; } }',
  2702. '.pie-outdoors {background-image: url(//editor-assets.waze.com/beta/img/toolbar022c8e4d1f16c3825705364ff337bf1b.png); background-position: 0px -52px; width: 20px; height: 11px; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {.pie-outdoors {background-image:url(//editor-assets.waze.com/beta/img/toolbar@2xcd8b2ab08e978d00eeee7817e1a0edda.png); background-size: 99px 87px; } }',
  2703. '.pie-natural-features {background-image: url(//editor-assets.waze.com/beta/img/toolbar022c8e4d1f16c3825705364ff337bf1b.png); background-position: -16px -21px; width: 17px; height: 15px; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {.pie-natural-features {background-image:url(//editor-assets.waze.com/beta/img/toolbar@2xcd8b2ab08e978d00eeee7817e1a0edda.png); background-size: 99px 87px; } }',
  2704. '.pie-parking-lot {background-image: url(//editor-assets.waze.com/beta/img/toolbar022c8e4d1f16c3825705364ff337bf1b.png); background-position: -65px -48px; width: 13px; height: 13px; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {.pie-parking-lot {background-image:url(//editor-assets.waze.com/beta/img/toolbar@2xcd8b2ab08e978d00eeee7817e1a0edda.png); background-size: 99px 87px; } }',
  2705. '.pie-residential {background-image: url(//editor-assets.waze.com/beta/img/toolbar022c8e4d1f16c3825705364ff337bf1b.png); background-position: -15px -37px; width: 15px; height: 14px; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {.pie-residential {background-image:url(//editor-assets.waze.com/beta/img/toolbar@2xcd8b2ab08e978d00eeee7817e1a0edda.png); background-size: 99px 87px; } }',
  2706. '#edit-buttons .residential .item-icon::after {background-image: url(//editor-assets.waze.com/beta/img/toolbar022c8e4d1f16c3825705364ff337bf1b.png); background-position: -15px -37px; width: 15px; height: 14px; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {#edit-buttons .residential .item-icon::after {background-image: url(//editor-assets.waze.com/beta/img/toolbar@2xcd8b2ab08e978d00eeee7817e1a0edda.png); background-size: 99px 87px; } }',
  2707. '.makePrimary {border:1px solid gray; display:inline-block; cursor:pointer; margin-left:5px; border-radius:5px; padding:0px 4px 0px 4px; user-select: none; font-size:11px;}',
  2708. '.makePrimary:hover {border-color: #26bae8; color: #26bae8}'
  2709. ].join(' ');
  2710. $('<style type="text/css">' + css + '</style>').appendTo('head');
  2711. }
  2712.  
  2713. function injectCSSWithID(id, css){
  2714. $('<style type="text/css" id=' + id + '>' + css + '</style>').appendTo('head');
  2715. }
  2716.  
  2717. function loadSettings() {
  2718. var loadedSettings = $.parseJSON(localStorage.getItem("WMEPIE_Settings"));
  2719. var defaultSettings = {
  2720. ShowAreaPlaceSize: false,
  2721. ShowAreaPlaceSizeImperial: false,
  2722. ShowAreaPlaceSizeMetric: false,
  2723. ShowLockButtonsRPP: true,
  2724. NewPlacesList: [].concat(W.Config.venues.categories),
  2725. EditRPPAfterCreated: false,
  2726. UseStreetFromClosestSeg: false,
  2727. UseCityFromClosestSeg: false,
  2728. ShowPlaceLocatorCrosshair: false,
  2729. PlaceZoom: 6,
  2730. DefaultLockLevel: 0,
  2731. CreateResidentialPlaceShortcut: "A+r",
  2732. CreateParkingLotShortcut: "A+p",
  2733. UseAltCity: false,
  2734. ShowSearchButton: false,
  2735. AddPlaceCategoriesButtons: false,
  2736. SkipPLR: false,
  2737. ShowParkingLotButton: false,
  2738. ShowPlaceNames: false,
  2739. ShowPlaceNamesPoint: false,
  2740. ShowPlaceNamesArea: false,
  2741. ShowPlaceNamesLock: false,
  2742. ShowCopyPlaceButton: false,
  2743. ShowExternalProviderTooltip: false,
  2744. ShowPlaceNamesPLA: false,
  2745. ClearDescription: true,
  2746. PlaceNameFontSize: "12",
  2747. PlaceNameFontOutlineWidth: 3,
  2748. PlaceNameFontBold: true,
  2749. PlaceNameFontColor: "#FFFFFF",
  2750. PlaceNameFontOutline: "#000000",
  2751. PlaceLocatorCrosshairProdPL: true,
  2752. MoveAddress: false,
  2753. MoveHNEntry: false,
  2754. PLNormalSpotWidth: 3.44,
  2755. PLAngledSpotWidth: 3,
  2756. ShowPLSpotEstimatorButton: false,
  2757. ShowNavPointClosestSegmentOnHover: true,
  2758. ShowClosestSegmentSelected: false,
  2759. NavLink: false,
  2760. ToggleAreaPlacesShortcut: 'CS+a',
  2761. EnableGLE: true,
  2762. OpenPUR: true,
  2763. HidePaymentType: false,
  2764. GeometryMods: true,
  2765. Rotate: false,
  2766. Resize: false
  2767. };
  2768. settings = loadedSettings ? loadedSettings : defaultSettings;
  2769. for (var prop in defaultSettings) {
  2770. if (!settings.hasOwnProperty(prop))
  2771. settings[prop] = defaultSettings[prop];
  2772. }
  2773.  
  2774. if(settings.ShowAreaPlaceSizeImperial === false && settings.ShowAreaPlaceSizeMetric === false)
  2775. if(W.prefs.attributes.isImperial)
  2776. settings.ShowAreaPlaceSizeImperial = true;
  2777. else
  2778. settings.ShowAreaPlaceSizeMetric = true;
  2779. }
  2780.  
  2781. function saveSettings() {
  2782. if (localStorage) {
  2783. var localsettings = {
  2784. ShowAreaPlaceSize: settings.ShowAreaPlaceSize,
  2785. ShowAreaPlaceSizeImperial: settings.ShowAreaPlaceSizeImperial,
  2786. ShowAreaPlaceSizeMetric: settings.ShowAreaPlaceSizeMetric,
  2787. ShowLockButtonsRPP: settings.ShowLockButtonsRPP,
  2788. NewPlacesList: settings.NewPlacesList,
  2789. EditRPPAfterCreated: settings.EditRPPAfterCreated,
  2790. UseStreetFromClosestSeg: settings.UseStreetFromClosestSeg,
  2791. UseCityFromClosestSeg: settings.UseCityFromClosestSeg,
  2792. ShowPlaceLocatorCrosshair: settings.ShowPlaceLocatorCrosshair,
  2793. PlaceZoom: settings.PlaceZoom,
  2794. DefaultLockLevel: settings.DefaultLockLevel,
  2795. CreateResidentialPlaceShortcut: settings.CreateResidentialPlaceShortcut,
  2796. CreateParkingLotShortcut: settings.CreateParkingLotShortcut,
  2797. UseAltCity: settings.UseAltCity,
  2798. ShowSearchButton: settings.ShowSearchButton,
  2799. AddPlaceCategoriesButtons: settings.AddPlaceCategoriesButtons,
  2800. SkipPLR: settings.SkipPLR,
  2801. ShowParkingLotButton: settings.ShowParkingLotButton,
  2802. ShowPlaceNames: settings.ShowPlaceNames,
  2803. ShowPlaceNamesPoint: settings.ShowPlaceNamesPoint,
  2804. ShowPlaceNamesArea: settings.ShowPlaceNamesArea,
  2805. ShowPlaceNamesLock: settings.ShowPlaceNamesLock,
  2806. ShowCopyPlaceButton: settings.ShowCopyPlaceButton,
  2807. ShowExternalProviderTooltip: settings.ShowExternalProviderTooltip,
  2808. ShowPlaceNamesPLA: settings.ShowPlaceNamesPLA,
  2809. ClearDescription: settings.ClearDescription,
  2810. PlaceNameFontSize: settings.PlaceNameFontSize,
  2811. PlaceNameFontOutlineWidth: settings.PlaceNameFontOutlineWidth,
  2812. PlaceNameFontBold: settings.PlaceNameFontBold,
  2813. PlaceNameFontColor: settings.PlaceNameFontColor,
  2814. PlaceNameFontOutline: settings.PlaceNameFontOutline,
  2815. PlaceLocatorCrosshairProdPL: settings.PlaceLocatorCrosshairProdPL,
  2816. MoveAddress: settings.MoveAddress,
  2817. MoveHNEntry: settings.MoveHNEntry,
  2818. PLNormalSpotWidth: settings.PLNormalSpotWidth,
  2819. PLAngledSpotWidth: settings.PLAngledSpotWidth,
  2820. ShowPLSpotEstimatorButton: settings.ShowPLSpotEstimatorButton,
  2821. ShowNavPointClosestSegmentOnHover: settings.ShowNavPointClosestSegmentOnHover,
  2822. ShowClosestSegmentSelected: settings.ShowClosestSegmentSelected,
  2823. NavLink: settings.NavLink,
  2824. ToggleAreaPlacesShortcut: settings.ToggleAreaPlacesShortcut,
  2825. EnableGLE: settings.EnableGLE,
  2826. OpenPUR: settings.OpenPUR,
  2827. HidePaymentType: settings.HidePaymentType,
  2828. GeometryModes: settings.GeometryMods,
  2829. Rotate: settings.Rotate,
  2830. Resize: settings.Resize
  2831. };
  2832.  
  2833. for (var name in W.accelerators.Actions) {
  2834. var TempKeys = "";
  2835. if (W.accelerators.Actions[name].group == 'wmepie') {
  2836. if (W.accelerators.Actions[name].shortcut) {
  2837. if (W.accelerators.Actions[name].shortcut.altKey === true) {
  2838. TempKeys += 'A';
  2839. }
  2840. if (W.accelerators.Actions[name].shortcut.shiftKey === true) {
  2841. TempKeys += 'S';
  2842. }
  2843. if (W.accelerators.Actions[name].shortcut.ctrlKey === true) {
  2844. TempKeys += 'C';
  2845. }
  2846. if (TempKeys !== "") {
  2847. TempKeys += '+';
  2848. }
  2849. if (W.accelerators.Actions[name].shortcut.keyCode) {
  2850. TempKeys += W.accelerators.Actions[name].shortcut.keyCode;
  2851. }
  2852. } else {
  2853. TempKeys = "-1";
  2854. }
  2855. localsettings[name] = TempKeys;
  2856. }
  2857. }
  2858.  
  2859. localStorage.setItem("WMEPIE_Settings", JSON.stringify(localsettings));
  2860. }
  2861. }
  2862.  
  2863. function loadTranslations() {
  2864. setTranslations({
  2865. en: {
  2866. prefs: {
  2867. title: 'Place Interface Enhancements',
  2868. ShowAreaPlaceSize: 'Show area Place size',
  2869. ShowImperial: 'Show imperial',
  2870. ShowMetric: 'Show metric',
  2871. ShowRPPLockButtons: 'Show lock buttons for RPPs',
  2872. ShowRPPLockButtonsTitle: 'Displays lock level buttons for Residential Place Points',
  2873. ShowPlaceLocatorCrosshair: 'Show Place locator crosshair',
  2874. ShowPlaceLocatorCrosshairTitle: 'Centers the Place on screen and zooms to the defined level',
  2875. Zoom: 'Zoom',
  2876. ZoomTitle: 'The zoom level to use when centering on a Place',
  2877. ShowAddressSearch: 'Show search button next to address',
  2878. ShowAddressSearchTitle: "Show a magnifying glass next to the Place's address. Clicking this button will load the address into the search box",
  2879. ShowPlaceCategoryButtons: 'Add Place category buttons above the categories selection',
  2880. ShowPLAButton: 'Show parking lot button',
  2881. ShowPLAButtonTitle: "Starts creation mode for a Parking Lot Area Place and will set the name to match this Place\'s name when complete",
  2882. ShowCopyPlaceButton: 'Show copy Place button',
  2883. ShowCopyPlaceButtonTitle: 'Copies the selected Place to a new Place with identical settings',
  2884. ShowGPIDTooltip: 'Show External Provider tooltip',
  2885. ShowGPIDTooltipTitle: 'Displays a tooltip with the external provider information',
  2886. NewPlaces: 'New Places',
  2887. EditRPPAfterCreate: 'Edit RPP address after created',
  2888. EditRPPAfterCreateTitle: "Automatically opens the RPP address edit window and focuses on the House Number entry",
  2889. UseStreetFromClosestSegment: 'Use street name from closest segment',
  2890. UseStreetFromClosestSegmentTitle: "Pulls the street name from the closest visible segment and inserts into the new Place's address",
  2891. UseCityFromClosestSegment: 'Use city name from closest segment',
  2892. UseCityFromClosestSegmentTitle: "Pulls the city name from the closest visible segment and inserts into the new Place's address",
  2893. ClosestSegmentAltCity: 'When the primary is "No city" look for an alt city',
  2894. ClosestSegmentAltCityTitle: 'When the primary is \'No city\' try to find an alt street name with a city',
  2895. ClosestSegmentIgnorePLRUnnamedPR: "Ignore PLRs & unnamed PR when using closest segment's name and city",
  2896. ClosestSegmentIgnorePLRUnnamedPRTitle: "When looking for the closest segment, PLRs and unnamed PRs will be ignored",
  2897. LockLevel: 'Lock level',
  2898. LockLevelTitle: 'The lock level to set automatically when creating new Places',
  2899. MapChanges: 'Map Changes',
  2900. ShowPlaceNames: 'Show Place names',
  2901. ShowPlaceNamesTitle: '',
  2902. ShowPointNames: 'Show point names',
  2903. ShowPointNamesTitle: "Will display the Place's name below the Place point",
  2904. ShowAreaNames: 'Show area names',
  2905. ShowAreaNamesTitle: "Will display the Place's name in the middle of the Place area",
  2906. ShowLockLevel: 'Show lock level',
  2907. ShowLockLevelTitle: "Will display the Place's lock level in the middle of the Place area",
  2908. ShowPLAName: 'Show PLA name',
  2909. ShowPLANameTitle: '',
  2910. Item: 'Item',
  2911. PlaceMenuCustomization: "Place Menu Customization",
  2912. ClearDescription: "Show clear description button",
  2913. ClearDescriptionTitle: "Adds a clear button to the top right of the description entry that when clicked will clear all text in the entry field",
  2914. PropertiesPanel: "Properties Panel",
  2915. FontSize: "Font size",
  2916. FontColor: "Font color",
  2917. Bold: "Bold",
  2918. FontOutlineColor: "Font outline color",
  2919. FontOutlineWidth: "Font outline width",
  2920. ProdPL: "Force production PL",
  2921. MoveAddress: "Move address to top of panel",
  2922. MoveAddressTitle: "Moves the address editor to the top of the properties panel",
  2923. MoveHNEntry: "Move HN entry before street entry",
  2924. MoveHNEntryTitle: "Moves the House Number entry before the Street entry in the address editor",
  2925. ShowParkingSpaceEstimatorTool: "Show Parking Space Estimator tool",
  2926. ShowParkingSpaceEstimatorToolTitle: "Shows the button to launch the Parking Space Estimator tool",
  2927. PSEParkingSpaceEstimator: "Parking Space Estimator",
  2928. PSELayoutType: "Layout type",
  2929. PSE90degree: "90 degree",
  2930. PSEAngled: "Angled",
  2931. PSEEstimatedNumOfSpots: "Estimated # of spots: ",
  2932. PSESet: "Set",
  2933. PSESpotWidth: "Spot width (m)",
  2934. PSECal: "Cal",
  2935. PSEDraw90DegreeTitle: "Click to draw a line through an entire 90 degree parking space aisle. Double click to finish drawing and measure the spaces.",
  2936. PSEDrawAngledTitle: "Click to draw a line through an entire angled parking space aisle. Double click to finish drawing and measure the spaces.",
  2937. PSEShowPSEButton: "Show Parking Space Estimator tool button",
  2938. PSEShowPSEButtonTitle: "Shows the button to launch the Parking Space Estimator tool",
  2939. PSEDisplayButtonTitle: "Opens the Parking Space Estimator tool",
  2940. ShowNavPointClosestSegmentOnHover: "Display the nav point and closest segment line on hover",
  2941. ShowClosestSegmentSelected: "Display a line from the nav point to the point on the closest segment",
  2942. NavLink: "Link nav point",
  2943. NavLinkTitle: "Enables the nav point link on all point Places. When linked, the nav point will move to the location of the point Place when the Place is moved",
  2944. EnableGLE: "Enable Google Link Enhancer",
  2945. EnableGLETitle: "Highlights closed Google links in red, linked Google POIs > 400m from the Waze Place in teal, invalid Google links in magenta, Google POIs linked multiple times in orange, already linked POI in gray (autocomplete menu)",
  2946. OpenPUR: "Automatically open PUR",
  2947. OpenPURTitle: "Automatically opens the PUR associated with the selected Place",
  2948. HidePaymentType: "Hide payment type",
  2949. HidePaymentTypeTitle: "Hide the Payment Type section when the cost is set to Free",
  2950. GeometryMods: "Enable geometry modification options",
  2951. GeometryModsTitle: "Enables options for modifying the geometry such as: orthogonalization, ability to rotate or resize (scale up/down) area Places"
  2952. },
  2953. filter: {
  2954. PlaceFilterPanel: 'Place Filtering',
  2955. filter: 'Filter',
  2956. Hide: 'Hide',
  2957. Show: 'Show only'
  2958. },
  2959. hoursParser: {
  2960. defaultText: 'Paste Hours Here',
  2961. AddHours: 'Add hours',
  2962. AddHoursTitle: 'Add pasted hours to existing',
  2963. ReplaceHours: 'Replace all hours',
  2964. ReplaceHoursTitle: 'Replace existing hours with pasted hours',
  2965. errorSameOpenClose: 'Same open and close times detected',
  2966. errorOverlappingHours: 'Overlapping hours detected',
  2967. errorCannotParse: 'Unable to parse the provided hours'
  2968. },
  2969. GLE:{
  2970. closedPlace: 'Google indicates this place is permanently closed.\nVerify with other sources or your editor community before deleting.',
  2971. multiLinked: 'Linked more than once already. Please find and remove multiple links.',
  2972. linkedToThisPlace: 'Already linked to this place',
  2973. linkedNearby: 'Already linked to a nearby place',
  2974. linkedToXPlaces: 'This is linked to {0} places',
  2975. badLink: 'Invalid Google link. Please remove it.',
  2976. tooFar: 'The Google linked place is more than {0} meters from the Waze place. Please verify the link is correct.'
  2977. }
  2978. },
  2979. "es-419": {
  2980. prefs: {
  2981. title: 'Place Interface Enhancements',
  2982. ShowAreaPlaceSize: 'Mostrar tamaño del área',
  2983. ShowImperial: 'Sistema Imperial',
  2984. ShowMetric: 'Sistema Métrico',
  2985. ShowRPPLockButtons: 'Mostrar botones de bloqueo para RPPs',
  2986. ShowRPPLockButtonsTitle: 'Muestra los botones de nivel de bloqueo para lugares residenciales',
  2987. ShowPlaceLocatorCrosshair: 'Mostrar reticula localizadora del lugar',
  2988. ShowPlaceLocatorCrosshairTitle: 'Centra el lugar en la pantalla y acercamiento al nivel definido',
  2989. Zoom: 'Acercamiento',
  2990. ZoomTitle: 'Nivel de acercamiento a utilizar cuando se centra en un lugar',
  2991. ShowAddressSearch: 'Mostrar el botón de búsqueda junto a la dirección',
  2992. 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",
  2993. ShowPlaceCategoryButtons: 'Botones de categorías de lugares',
  2994. ShowPLAButton: 'Mostrar botón de PLAs',
  2995. 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',
  2996. ShowCopyPlaceButton: 'Mostrar botón de copiado de lugar',
  2997. ShowCopyPlaceButtonTitle: 'Copia el lugar seleccionado en un lugar nuevo con configuraciones idénticas',
  2998. ShowGPIDTooltip: 'Mostrar información del proveedor externo',
  2999. ShowGPIDTooltipTitle: 'Muestra un texto con la información del proveedor externo',
  3000. NewPlaces: 'Nuevos lugares',
  3001. EditRPPAfterCreate: 'Editar la dirección del RPP una vez creada',
  3002. 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",
  3003. UseStreetFromClosestSegment: 'Utilizar el nombre de la calle del segmento más cercano',
  3004. UseStreetFromClosestSegmentTitle: "Extrae el nombre de la calle del segmento visible más cercano y lo agrega en la dirección del nuevo lugar",
  3005. UseCityFromClosestSegment: 'Usar el nombre de la ciudad del segmento más cercano',
  3006. UseCityFromClosestSegmentTitle: "Extrae el nombre de la ciudad del segmento visible más cercano y lo agrega en la dirección del nuevo lugar",
  3007. ClosestSegmentAltCity: 'Buscar una ciudad alternativa cuando la ciudad principal sea \'Ninguno\'',
  3008. ClosestSegmentAltCityTitle: 'Cuando la ciudad principal es "Ninguno" trata de encontrar un nombre de calle alternativo con una ciudad',
  3009. ClosestSegmentIgnorePLRUnnamedPR: "Ignorar los PLR y PR sin nombre cuando utilice el nombre y la ciudad del segmento más cercano",
  3010. ClosestSegmentIgnorePLRUnnamedPRTitle: "Ignorar segmentos de estacionamiento o privados al buscar el segmento mas cercano",
  3011. LockLevel: 'Nivel de bloqueo',
  3012. LockLevelTitle: 'El nivel de bloqueo para establecer automáticamente al crear nuevos lugares',
  3013. MapChanges: 'Cambios en el mapa',
  3014. ShowPlaceNames: 'Mostrar nombres de lugares',
  3015. ShowPlaceNamesTitle: '',
  3016. ShowPointNames: 'Mostrar nombres de punto',
  3017. ShowPointNamesTitle: "Muestra el nombre de lugares definidos como punto",
  3018. ShowAreaNames: 'Mostrar nombres de área',
  3019. ShowAreaNamesTitle: "Muestra el nombre de lugares definidos como área",
  3020. ShowLockLevel: 'Mostrar nivel de bloqueo',
  3021. ShowLockLevelTitle: "Muestra el nivel de bloqueo en el centro del lugar",
  3022. ShowPLAName: 'Mostrar nombre de PLA',
  3023. ShowPLANameTitle: 'Muestra el nombre de áreas de estacionamiento (PLAs)',
  3024. Item: 'Opción',
  3025. PlaceMenuCustomization: "Personalización del menú de lugares",
  3026. ClearDescription: "Mostrar botón de borrar descripción",
  3027. 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",
  3028. PropertiesPanel: "Propiedades del panel",
  3029. FontSize: "Tamaño de letra",
  3030. FontColor: "Color de Letra",
  3031. Bold: "Negrita",
  3032. FontOutlineColor: "Color del contorno de la letra",
  3033. FontOutlineWidth: "Ancho del contorno de la letra",
  3034. ProdPL: "Forzar Permalink de producción",
  3035. MoveAddress: "Move address to top of panel",
  3036. MoveAddressTitle: "Moves the address editor to the top of the properties panel",
  3037. MoveHNEntry: "Move HN entry before street entry",
  3038. MoveHNEntryTitle: "Moves the House Number entry before the Street entry in the address editor",
  3039. ShowParkingSpaceEstimatorTool: "Show Parking Space Estimator tool",
  3040. ShowParkingSpaceEstimatorToolTitle: "Shows the button to launch the Parking Space Estimator tool",
  3041. PSEParkingSpaceEstimator: "Parking Space Estimator",
  3042. PSELayoutType: "Layout type",
  3043. PSE90degree: "90 degree",
  3044. PSEAngled: "Angled",
  3045. PSEEstimatedNumOfSpots: "Estimated # of spots: ",
  3046. PSESet: "Set",
  3047. PSESpotWidth: "Spot width (m)",
  3048. PSECal: "Cal",
  3049. PSEDraw90DegreeTitle: "Click to draw a line through an entire 90 degree parking space aisle. Double click to finish drawing and measure the spaces.",
  3050. PSEDrawAngledTitle: "Click to draw a line through an entire angled parking space aisle. Double click to finish drawing and measure the spaces.",
  3051. PSEShowPSEButton: "Show Parking Space Estimator tool button",
  3052. PSEShowPSEButtonTitle: "Shows the button to launch the Parking Space Estimator tool",
  3053. PSEDisplayButtonTitle: "Opens the Parking Space Estimator tool",
  3054. ShowNavPointClosestSegmentOnHover: "Display the nav point and closest segment line on hover",
  3055. ShowClosestSegmentSelected: "Display a line from the nav point to the point on the closest segment",
  3056. NavLink: "Link nav point",
  3057. NavLinkTitle: "Enables the nav point link on all point Places. When linked, the nav point will move to the location of the point Place when the Place is moved",
  3058. EnableGLE: "Habilitar mejoras en links de Google",
  3059. EnableGLETitle: "Resalta los GPIDs a lugares cerrados en rojo, GPIDs a mas de 400m del lugar en Waze en verde azulado, GPIDs no válidos en magenta, GPIDs vinculados varias veces en naranja, GPIDs ya vinculados en gris (menú de autocompletar)",
  3060. OpenPUR: "Automatically open PUR",
  3061. OpenPURTitle: "Automatically opens the PUR associated with the selected Place",
  3062. HidePaymentType: "Hide payment type",
  3063. HidePaymentTypeTitle: "Hide the Payment Type section when the cost is set to Free",
  3064. GeometryMods: "Enable geometry modification options",
  3065. GeometryModsTitle: "Enables options for modifying the geometry such as: orthogonalization, ability to rotate or resize (scale up/down) area Places"
  3066. },
  3067. filter: {
  3068. PlaceFilterPanel: 'Place Filtering',
  3069. filter: 'Filter',
  3070. Hide: 'Hide',
  3071. Show: 'Show only'
  3072. },
  3073. hoursParser: {
  3074. defaultText: 'Paste Hours Here',
  3075. AddHours: 'Add hours',
  3076. AddHoursTitle: 'Add pasted hours to existing',
  3077. ReplaceHours: 'Replace all hours',
  3078. ReplaceHoursTitle: 'Replace existing hours with pasted hours',
  3079. errorSameOpenClose: 'Same open and close times detected',
  3080. errorOverlappingHours: 'Overlapping hours detected',
  3081. errorCannotParse: 'Unable to parse the provided hours'
  3082. },
  3083. GLE:{
  3084. closedPlace: 'Google indica que este lugar está permanentemente cerrado. Verifica con otras fuentes o tu comunidad de edición antes de eliminar.',
  3085. multiLinked: 'Vinculado más de una vez. Encuentra y elimina enlaces múltiples.',
  3086. linkedToThisPlace: 'Ya vinculado a este lugar',
  3087. linkedNearby: 'Ya vinculado a un lugar cercano',
  3088. linkedToXPlaces: 'Esto está vinculado a {0} lugares',
  3089. badLink: 'Enlace de Google no válido. Por favor elimínalo.',
  3090. tooFar: 'El lugar vinculado a Google está a más de {0} metros del lugar de Waze. Verifica que el enlace sea correcto.'
  3091. }
  3092. },
  3093. fr: {
  3094. prefs: {
  3095. title: 'Place Interface Enhancements',
  3096. ShowAreaPlaceSize: 'Afficher la tallie de la place',
  3097. ShowImperial: 'Afficher en imperial',
  3098. ShowMetric: 'Afficher en métrique',
  3099. ShowRPPLockButtons: 'Afficher les boutons de lock pour les résidentiels',
  3100. ShowRPPLockButtonsTitle: 'Affiche des boutons pour le niveau de verrouillage des lieux résidentiels',
  3101. ShowPlaceLocatorCrosshair: 'Afficher le repère de localisation du lieu',
  3102. ShowPlaceLocatorCrosshairTitle: "Centre le lieu à l'écran et zoome au niveau défini",
  3103. Zoom: 'Zoom',
  3104. ZoomTitle: "Niveau de zoom utilisé lorsqu'on se centre sur un lieu",
  3105. ShowAddressSearch: "Afficher icône de recherche à côté de l'adresse",
  3106. ShowAddressSearchTitle: "Affiche une loupe à côté de l'adresse du lieu. Cliquer ce bouton chargera l'adresse dans la barre de recherche",
  3107. ShowPlaceCategoryButtons: 'Ajouter des icônes de catégorie au dessus de la sélection de catégories',
  3108. ShowPLAButton: 'Afficher le bouton de création de parking',
  3109. ShowPLAButtonTitle: 'Démarre le mode création de parking pour tracer un parking qui aura le nom du lieu sélectionné',
  3110. ShowCopyPlaceButton: 'Afficher le bouton de clonage de lieu',
  3111. ShowCopyPlaceButtonTitle: 'Clone le lieu sélectionné en nouveau lieu avec les mêmes valeurs',
  3112. ShowGPIDTooltip: 'Afficher en infobulle le fournisseur externe',
  3113. ShowGPIDTooltipTitle: 'Affiche une infobulle avec les informations du fournisseur externe',
  3114. NewPlaces: 'Nouveaux Lieux',
  3115. EditRPPAfterCreate: "Editer l'adresse du résidentiel après création",
  3116. EditRPPAfterCreateTitle: "Ouvre automatiquement la zone d'édition de l'adresse du lieu résidentiel et se positionne sur la saisie du n° de rue",
  3117. UseStreetFromClosestSegment: 'Utiliser le nom de rue du segment le plus proche',
  3118. UseStreetFromClosestSegmentTitle: "Prend le nom de rue du segment visible le plus proche et l'insère dans l'adresse du nouveau lieu",
  3119. UseCityFromClosestSegment: 'Utiliser le nom de ville du segment le plus proche',
  3120. UseCityFromClosestSegmentTitle: "Prend le nom de ville du segment visible le plus proche et l'insère dans l'adresse du nouveau lieu",
  3121. ClosestSegmentAltCity: 'Lorsque le nom principal est «Hors ville» regarder le nom en alt',
  3122. ClosestSegmentAltCityTitle: 'Lorsque le nom principal est «Hors ville» essayer de trouver un nom de rue alternatif avec une ville',
  3123. ClosestSegmentIgnorePLRUnnamedPR: "Ignorer les parkings et voies privées non nommés",
  3124. 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",
  3125. LockLevel: 'Verrouillage ',
  3126. LockLevelTitle: 'Le niveau de verrouillage est appliqué automatiquement à la création du lieu',
  3127. MapChanges: 'Changements de carte',
  3128. ShowPlaceNames: 'Afficher le nom des lieux',
  3129. ShowPlaceNamesTitle: '',
  3130. ShowPointNames: 'Afficher le nom des lieux point',
  3131. ShowPointNamesTitle: "Affiche le nom du lieu sous le lieu point",
  3132. ShowAreaNames: 'Afficher le nom des lieux zone',
  3133. ShowAreaNamesTitle: "Affiche le nom du lieu au milieu du lieu zone",
  3134. ShowLockLevel: 'Afficher le niveau de verrouillage',
  3135. ShowLockLevelTitle: "Afficher le niveau de verrouillage du lieu au milieu du lieu zone",
  3136. ShowPLAName: 'Afficher le nom des parkings',
  3137. ShowPLANameTitle: 'Affiche le nom du parking au milieu du lieu zone',
  3138. Item: 'Option',
  3139. PlaceMenuCustomization: "Personnalisation du menu Lieu",
  3140. ClearDescription: "Afficher le bouton «Effacer description»",
  3141. 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",
  3142. PropertiesPanel: "Panneau des propriétés",
  3143. FontSize: "Taille de police",
  3144. FontColor: "Couleur de police",
  3145. Bold: "Gras",
  3146. FontOutlineColor: "Couleur surlignage police",
  3147. FontOutlineWidth: "Épaisseur surlignage police",
  3148. ProdPL: "Force production PL",
  3149. MoveAddress: "Déplacer l'adresse en haut du panneau",
  3150. MoveAddressTitle: "Déplace l'édition d'adresse en haut du panneau de propritétés",
  3151. MoveHNEntry: "Placer n° de rue avant nom de rue",
  3152. MoveHNEntryTitle: "Place l'édition du numéro de rue avant le nom de la rue dans l'éditeur d'adresse",
  3153. ShowParkingSpaceEstimatorTool: "Afficher le simulateur de places de stationnement",
  3154. ShowParkingSpaceEstimatorToolTitle: "Affiche un bouton pour lancer le simulateur de places de stationnement",
  3155. PSEParkingSpaceEstimator: "Simulateur places de stationnement",
  3156. PSELayoutType: "Emplacements:",
  3157. PSE90degree: "A 90 degrés",
  3158. PSEAngled: "Inclinés",
  3159. PSEEstimatedNumOfSpots: "Nombre estimé de places: ",
  3160. PSESet: "Set",
  3161. PSESpotWidth: "Largeur place (m)",
  3162. PSECal: "Cal",
  3163. PSEDraw90DegreeTitle: "Cliquez pour dessiner une ligne passant à travers les emplacements de parking à 90°. Double-cliquez pour terminer le tracé et mesurer les espaces.",
  3164. PSEDrawAngledTitle: "Cliquez pour dessiner une ligne passant à travers les emplacements de parking inclinés. Double-cliquez pour terminer le tracé et mesurer les espaces.",
  3165. PSEShowPSEButton: "Afficher le simulateur de places de stationnement",
  3166. PSEShowPSEButtonTitle: "Affiche un bouton pour lancer le simulateur de places de stationnement",
  3167. PSEDisplayButtonTitle: "Ouvre le simulateur de places de stationnement",
  3168. ShowNavPointClosestSegmentOnHover: "Affiche une ligne entre le point d'entrée et le segment le plus proche",
  3169. ShowClosestSegmentSelected: "Display a line from the nav point to the point on the closest segment",
  3170. NavLink: "Link nav point",
  3171. NavLinkTitle: "Enables the nav point link on all point Places. When linked, the nav point will move to the location of the point Place when the Place is moved",
  3172. EnableGLE: "Enable Google Link Enhancer",
  3173. EnableGLETitle: "Highlights closed Google links in red, linked Google POIs > 400m from the Waze Place in teal, invalid Google links in magenta, Google POIs linked multiple times in orange, already linked POI in gray (autocomplete menu)",
  3174. OpenPUR: "Automatically open PUR",
  3175. OpenPURTitle: "Automatically opens the PUR associated with the selected Place",
  3176. HidePaymentType: "Hide payment type",
  3177. HidePaymentTypeTitle: "Hide the Payment Type section when the cost is set to Free",
  3178. GeometryMods: "Enable geometry modification options",
  3179. GeometryModsTitle: "Enables options for modifying the geometry such as: orthogonalization, ability to rotate or resize (scale up/down) area Places"
  3180. },
  3181. filter: {
  3182. PlaceFilterPanel: 'Place Filtering',
  3183. filter: 'Filter',
  3184. Hide: 'Hide',
  3185. Show: 'Show only'
  3186. },
  3187. hoursParser: {
  3188. defaultText: 'Paste Hours Here',
  3189. AddHours: 'Add hours',
  3190. AddHoursTitle: 'Add pasted hours to existing',
  3191. ReplaceHours: 'Replace all hours',
  3192. ReplaceHoursTitle: 'Replace existing hours with pasted hours',
  3193. errorSameOpenClose: 'Same open and close times detected',
  3194. errorOverlappingHours: 'Overlapping hours detected',
  3195. errorCannotParse: 'Unable to parse the provided hours'
  3196. },
  3197. GLE:{
  3198. closedPlace: 'Google indicates this place is permanently closed.\nVerify with other sources or your editor community before deleting.',
  3199. multiLinked: 'Linked more than once already. Please find and remove multiple links.',
  3200. linkedToThisPlace: 'Already linked to this place',
  3201. linkedNearby: 'Already linked to a nearby place',
  3202. linkedToXPlaces: 'This is linked to {0} places',
  3203. badLink: 'Invalid Google link. Please remove it.',
  3204. tooFar: 'The Google linked place is more than {0} meters from the Waze place. Please verify the link is correct.'
  3205. }
  3206. }
  3207. });
  3208. }
  3209.  
  3210. function setTranslations(translations) {
  3211. I18n.translations[I18n.currentLocale()].pie = translations.en;
  3212. for (var i = 0; i < Object.keys(translations).length; i++) {
  3213. var locale = Object.keys(translations)[i];
  3214. if (I18n.currentLocale() == locale) {
  3215. I18n.translations[locale].pie.prefs = translations[locale].prefs;
  3216. return;
  3217. }
  3218. }
  3219. }
  3220.  
  3221. function listPlaces(){
  3222. var category = "";
  3223. for(i=0; i<W.Config.venues.categories.length; i++){
  3224. category = W.Config.venues.categories[i];
  3225. console.log(category + " Main");
  3226. var subCategories = W.Config.venues.subcategories[category];
  3227. for(var j=0; j<subCategories.length;j++){
  3228. console.log(subCategories[j]);
  3229. }
  3230. }
  3231. }
  3232.  
  3233.  
  3234. //Obsoleted by WME update released 2017-10-24
  3235. /*function ImageDialogEnhancement(){
  3236. $('.venue-image-dialog .details').wrap("<div id='detailsWrap'></div>");
  3237. $('#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>");
  3238. var dataID = $('#detailsWrap').parent().find('img')[0].src;
  3239. dataID = /_(.+)/g.exec(dataID)[1];
  3240. $('#DeleteFromImageDialog').click(function(){
  3241. $('div[data-id="' + dataID + '"] button.image-delete-button').click();
  3242. $('.venue-image-dialog').find('.close').click();
  3243. });
  3244.  
  3245. //Image dialog navigation arrows
  3246. if(WazeWrap.getSelectedFeatures()[0].model.attributes.images.length > 1){
  3247. let thisImageIndex;
  3248. let PlaceImages = WazeWrap.getSelectedFeatures()[0].model.attributes.images;
  3249. for(let i=0; i<PlaceImages.length; i++){
  3250. if(WazeWrap.getSelectedFeatures()[0].model.attributes.images[i].id === dataID){
  3251. thisImageIndex = i;
  3252. break;
  3253. }
  3254. }
  3255. $('.modal-body').addClass('imgcon');
  3256. $('.modal-body').prepend((thisImageIndex + 1) + "/" + WazeWrap.getSelectedFeatures()[0].model.attributes.images.length);
  3257. $('.imgcon').append('<div class="imnav"><div class="prim control"></div><div class="zmim control"></div><div class="neim control"></div></div>');
  3258. $('.prim').click(function(){
  3259. let prevIndex;
  3260.  
  3261. if(thisImageIndex == 0)
  3262. prevIndex = PlaceImages.length - 1;
  3263. else
  3264. prevIndex = thisImageIndex - 1;
  3265. dataID = PlaceImages[prevIndex].id;
  3266. $('div[data-id="' + dataID +'"] img').click();
  3267. });
  3268.  
  3269. $('.neim').click(function(){
  3270. let nextIndex;
  3271.  
  3272. if(thisImageIndex == PlaceImages.length - 1)
  3273. nextIndex = 0;
  3274. else
  3275. nextIndex = thisImageIndex + 1;
  3276. dataID = PlaceImages[nextIndex].id;
  3277. $('div[data-id="' + dataID +'"] img').click();
  3278. });
  3279. }
  3280. }*/
  3281. })();