UROverview Plus (URO+)

Adds a whole bunch of features to WME, which someday I may get around to documenting properly...

  1. // ==UserScript==
  2. // @name UROverview Plus (URO+)
  3. // @namespace http://greasemonkey.chizzum.com
  4. // @description Adds a whole bunch of features to WME, which someday I may get around to documenting properly...
  5. // @include https://*.waze.com/*editor*
  6. // @exclude https://editor-beta.waze.com/*
  7. // @exclude https://beta.waze.com/*
  8. // @exclude https://www.waze.com/user/*editor/*
  9. // @exclude https://www.waze.com/*/user/*editor/*
  10. // @grant none
  11. // @version 4.15
  12. // ==/UserScript==
  13.  
  14. /*
  15. =======================================================================================================================
  16. Bug fixes - MUST BE CLEARED BEFORE RELEASE
  17. =======================================================================================================================
  18.  
  19. =======================================================================================================================
  20. Things to be checked
  21. =======================================================================================================================
  22.  
  23. */
  24.  
  25. /* JSHint Directives */
  26. /* globals $: */
  27. /* globals W: true */
  28. /* globals I18n: */
  29. /* globals OpenLayers: true */
  30. /* globals ResizeObserver: */
  31. /* globals _: */
  32. /* globals trustedTypes: */
  33. /* jshint bitwise: false */
  34. /* jshint eqnull: true */
  35. /* jshint esversion: 11 */
  36. /* jshint undef: true */
  37. /* jshint unused: true */
  38.  
  39. const uroRelease =
  40. {
  41. version : "4.15",
  42. date : "20250428",
  43. changes :
  44. [
  45. "Marker unstacking is back!",
  46. "RTC filtering working again following the latest WME changes",
  47. "RTC cloning temporarily disabled..."
  48. ]
  49. };
  50.  
  51. const uroEnums =
  52. {
  53. FP_OPTS:
  54. {
  55. filterUneditable: 0,
  56. filterInsideManagedAreas: 1,
  57. excludeMyAreas: 2,
  58. filterLockRanked: 3,
  59. filterFlagged: 4,
  60. filterNewPlace: 5,
  61. filterUpdatedDetails: 6,
  62. filterNewPhoto: 7,
  63. filterMinPURAge: 8,
  64. filterMaxPURAge: 9,
  65. invertPURFilters: 10,
  66. filterHighSeverity: 11,
  67. filterMedSeverity: 12,
  68. filterLowSeverity: 13,
  69. leavePURGeos: 14,
  70. filterCFPhone: 15,
  71. filterCFName: 16,
  72. filterCFEntryExitPoints: 17,
  73. filterCFOpeningHours: 18,
  74. filterCFAliases: 19,
  75. filterCFServices: 20,
  76. filterCFGeometry: 21,
  77. filterCFHouseNumber: 22,
  78. filterCFCategories: 23,
  79. filterCFDescription: 24,
  80. filterOnCFs: 25,
  81. thresholdMinPURDays: 26,
  82. thresholdMaxPURDays: 27,
  83. isLoggedIn: 28,
  84. userRank: 29,
  85. N_OPTS: 30
  86. },
  87. TRTC:
  88. {
  89. UNKNOWN: 0,
  90. WME: 1,
  91. WAZEFEED: 2,
  92. WAZEOTHER: 3
  93. },
  94. SRTC:
  95. {
  96. UNKNOWN: 0,
  97. EXPIRED: 1,
  98. ACTIVE: 2,
  99. FUTURE: 3
  100. },
  101. DRTC:
  102. {
  103. NONE: 0,
  104. SEG_AB: 1,
  105. SEG_BA: 2,
  106. SEG_BI: 4,
  107. TURN_OUT: 8,
  108. TURN_IN: 16
  109. }
  110. };
  111. const uroCustomURTags = ['[ROADWORKS]','[CONSTRUCTION]','[CLOSURE]','[EVENT]','[NOTE]','[WSLM]','[BOG]','[DIFFICULT]'];
  112. const uroImages =
  113. {
  114. HighlightedCameraImages :
  115. [
  116. // speed
  117. ["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEoAAABICAYAAABRGGN6AAAgH3pUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHja1Ztpchw5c4b/1yl8BACJ9ThYI3wDH9/Pi2pRombmW8YOR1gKiWSxuwpAZr5LAv3s//rP8/wHf0pz+Ymp1NxydvyJLbbQ+aa698/71bt4/79/Yv/8zn+//sQfbwpcMr7a+2Pen9d3rqefbyjxc318v/6U+blP/dzIf934/jE9Wd+PzyA/N7LwXvefn5/2eV+Pv0zn8y/Mz20/N//951hYjJW4n4UnbGv8q+9TjBFYtc5Xe/8PupL5PvJVV/5i7Z6vb39bvNP+fO1c/7zCvi/F4/LnBfm3Nfpc9+m36/YVtfBtRP7Ht+H7L+bwy/3655e1O2fVc/Y7ux4zK5W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2VTdXBwbGllcj4KICAgPHBsdXM6SW1hZ2VDcmVhdG9yPgogICAgPHJkZjpTZXEvPgogICA8L3BsdXM6SW1hZ2VDcmVhdG9yPgogICA8cGx1czpDb3B5cmlnaHRPd25lcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkNvcHlyaWdodE93bmVyPgogICA8cGx1czpMaWNlbnNvcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkxpY2Vuc29yPgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgIAo8P3hwYWNrZXQgZW5kPSJ3Ij8+txeqYAAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAd0SU1FB+IDAw8pAmNZfO0AAA7kSURBVHja1Zx5kB1FHcc/8459b+9N2GSPhBiBBAQBBeVSI4GEoFQFSIASj+CRshDFQstAgXiiJcT7SLQKUVkQhOIIRVFA1gSSYCFHAgIakFSwSNjdhGU3yR7v7b43M/7Rr/N6erpn3stuTJyqrp7p6Zk3/X2/4/v7dc84HLrNiTme6ObHHFe1pQ4hOM4kA+cfpL4H5V+sFiS9LepY7W+SFj/mGEvbYQuUqTYVUx8bOL7Wphci6sNa9UzAJLRaBSdhuZ9nAMjTah0s50BUL3WI1M4ETkI5Thr6mFRPB8Qt9fdKfVXQdJWrCrDUIbJRaEAkI2onRvUkQJ4Ckqv09wygOP8PqudoUpRUSkqrdUlzNJA8pbhAUQHJjfB0h43qOTF2SZWYVEQxSRYGSZIgJUt1Aihoz+FrNs2pBrTUQQZHB0qXIhWUtFJSSp3UpApNmiRIhVJJWOgHBlV0KpWy1CQC5MRQgYRmf1SQarZv5w3fB1k8L1hHtet9fB/OOovZMUTTq4aMpg6SemFx/zpIUoJqAk+qPKrjBAEwtct97foaC+cqWoioE6WSziRJkWPwZI7B9auGO60BlQEyr7/OUyCkxCQpNgnzfXBdOPNMPgSMKWW8VAqawXc1ah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WXsK32rUr0m7tNFcQAdMpAqASoOLCzA2L5kYXPJPvHfdzpkIFUKVKXeUQcpCiio7KthhwVI1QBVCWDV3rMSiTnkAO0P3/6HIFcKwmEDzmQO9mCDdths/wXji1Blzxb9QAAAAABJRU5ErkJggg=="],
  118. // dummy
  119. ["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABGCAYAAAB8MJLDAAAaAHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHja3ZpZcuS4eoXfsQovAfOwHIwR3oGX7++AlEpSV/e93faDw1KVUmIySfAfzgDA7P/6z2P+g6+cYjYxlZpbzpav2GLznV+qfb6eV2fj/Xm/4vsWf387bmJ+3/AcCryG58+83/M7x9OvD5T3Sm58P27KfK9T3wu5zwvfr6A76/fxDvK9UPDPcff+bdr7uR6/PM7738/3su/Ff/4dC8FYiesFb/wOjf/1uUtgBKGGzmt4fnodyfweee2cEX4fO7P774P3+duP2Nn+Hg/fQ2HsR7Dzjxi9x136cTx83sZ/G5H7dedvb5Thqv369SV256x6zn6ersdMpLJ5H8o9Q3iGwYnkKD7RyHwX/id+L/e78V15xEnGlp3kc9hpXHPeBXtcdMt1d9y+r9NNhhj99oVX76cP91gNxTc/b1Kivt3xJbSwDDnyYZK3wGH/ORZ379vu/SYPuexynOkdF3N84g/f5ncH/8n354XOUYk7Z+sTbsqCcXnVNMNQ5vSTs0iIO2/e0htfvs2XurFfEhvIYLphrjxgt+O5xEjuV22Fm+fAeclG87azK+u9ACHi3onBuEAGbHYhuexs8b44Rxwr+emM3IfoBxlwKfnlzCE3IWSSU73uzWeKu+f65J/DQAuJSDRKITUtdJIVIxhEr1VqqKeQokkp5VRSTS31HHLMKedcsjCql1BiSSWXUmpppddQY00111JrbbU33wIQllpuxbTaWuudm3Yu3fl054zehx9hxJFGHmXU0UaflM+MM808y6yzzb78Cov2X3kVs+pqq2+3KaUdd9p5l1132/1QayeceNLJp5x62umfWXNv237LmvuRub/OmnuzpozFe175lTUOl/JxC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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgCjw/eHBhY2tldCBlbmQ9InciPz73ndT8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4gMDDykcmVZBjgAADbFJREFUeNrtXGuMVcUd/805595z774X9gWlIFIVl0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M6SW1hZ2VTdXBwbGllcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkltYWdlU3VwcGxpZXI+CiAgIDxwbHVzOkltYWdlQ3JlYXRvcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkltYWdlQ3JlYXRvcj4KICAgPHBsdXM6Q29weXJpZ2h0T3duZXI+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpDb3B5cmlnaHRPd25lcj4KICAgPHBsdXM6TGljZW5zb3I+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpMaWNlbnNvcj4KICA8L3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/PvOQ5mMAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfiAwMPKBseKeVsAAAJfElEQVR42u1bXWgcxx3/ze7e7VnWl2vJ0jnCrkiKbRUbxw92nFIwwQ0plIIcDCmUvMQUTB+DyAfkrU8u5K0USvISQp5KbUoJIa2NnbYPwSGxQxI3NdhWPmxJOTknyWeddLe7eZjb3Oz//vNxurtEDxkYdnfuP7czv/l/z6xAd4vQ3Ls820rSxnPSycB7AQJtMz2r9NwkE8tzR2D0AgjuylWORjf5hLTRCsPVqQQ9Eg1u4h65qpP3NP8XMwDE5ErBEBsRjaBHYsFN3lOefYaGEw064ahBHzdoVVCoSLQFSNAjHQEyUd9wFRbRSAGIFRAihT5mJi02g2gIwgW+UgNypZwiCAixUiMAdQWEqJtWI+iSKFAQ1BUPDJXjDDCckILgN64egBoZR0J0imgHlKDDyVMgKBeok84pNVCuPuEKEG5IQag1qqcxz2BERbhySdCmJTCZSo/IvwpC/sYN3EwSIK1xnL2a2ilNkgCPPoofW5yu2NExswJhYn9ozCMFIeWAfGYkylCEyE6Qa0/vSf+8xueoaxwtYRIZsUHnyGOUIlWMOQJECCC8fh3/AeQqcyut45AkAaI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vb8rXFWoubAEXogXvkMuFCyg3ChJGlbgPg7UH5fsweh0JU/MQNh4wIOqHv3dr333HOf/xHN07oRmDMRTjoiSaSzZALjQknS6JKn1/4ALF3hlZ4AsPQJ8P+/uAVIpnxGM+IU8dzcvr+ePr34+8ZBkXWFI+omjrAe5++qi/2A9C4rs8C8g4utxhu6Y0RxHK5Wq4PzpdLou2+/XTuriIN6ENXp6NDtzRB+a8oigJNMsEQ/X0hrjdQ64Qj1tH9GRAIAFxu5iM1Y3gNQ0cQJCVGAdTLhOqMfjKKRJmY2W05iCcAJAPNMBEnPRUUMd9QtIGQUpg9gGcAbDfEYATDwPQOwAOA8gNMAvtCwuq7WNbrAGnSZTue3cyidPtP/ADr/tFL33af6gVvMPJu+CExcgNBdueO/uuPA3QLBBIbp+KDzZwrCHC2wwJi+7dTRdru4fhwLW/jdzkq5fsqko+0VR8BhpW2fTW9ogL38AL7bwDhnrzsdsOjif/UKFOvkfyhM+QYKVFliJfC7TQAAAABJRU5ErkJggg=="]
  122. ]
  123. };
  124.  
  125. let uroURDupes = [];
  126. let uroFID = -1;
  127. let uroShownFID = -1;
  128. let uroInhibitSave = true;
  129. let uroConfirmIntercepted = false;
  130. let uroMCLayer = null;
  131. let uroVenueLayer = null;
  132. let uro_uFP = [];
  133. let uroPendingURSessionIDs = [];
  134. let uroRequestedURSessionIDs = [];
  135. let uroPlacesGroupsCollapsed = [];
  136. let uroKnownProblemTypeIDs = [];
  137. let uroKnownProblemTypeNames = [];
  138. let uroPURsToHide = [];
  139. let uroNullOpenLayers = false;
  140. let uroNullURLayer = false;
  141. let uroNullProblemLayer = false;
  142. let uroNullMapViewport = false;
  143. let uroURDialogIsOpen = false;
  144. let uroHoveredURID = null;
  145. let uroSelectedURID = null;
  146. let uroURReclickAttempts = 0;
  147. let uroPendingCommentDataRefresh = false;
  148. let uroWaitingCommentDataRefresh = false;
  149. let uroExpectedCommentCount = null;
  150. let uroCachedLastCommentID = null;
  151. let uroMouseIsDown = false;
  152. let uroPopulatingRequestSessions = false;
  153. let uroHidePopupOnPanelOpen = false;
  154. let uroUserID = -1;
  155. let uroMTEMode = false;
  156. let uroDiv = null;
  157. let uroAlerts = null;
  158. let uroControls = null;
  159. let uroCtrlHides = null;
  160. let uroAMList = [];
  161. let uroManagedAreas = [];
  162. let uroIgnoreAreasUserID = null;
  163. let uroMousedOverMapComment = null;
  164. let uroMousedOverOtherObjectWithinMapComment = false;
  165. let uroRTCObjs = null;
  166. let uroUnstackedMasterID = null;
  167. let uroStackList = [];
  168. let uroStackType = null;
  169. let uroMainTickHandlerID = null;
  170. let uroMainTickStage = 0;
  171. let uroSettingsApplied = false;
  172. let uroInhibitURFiltering = false;
  173.  
  174.  
  175. const uroUtils = // utility functions
  176. {
  177. GetExtent: function()
  178. {
  179. // From DaveAcincy
  180. let extent = new OpenLayers.Bounds(W.map.getExtent());
  181. extent = extent.transform('EPSG:4326', 'EPSG:3857');
  182. return extent;
  183. },
  184. ModifyHTML: function(htmlIn)
  185. {
  186. if(typeof trustedTypes === "undefined")
  187. {
  188. return htmlIn;
  189. }
  190. else
  191. {
  192. const escapeHTMLPolicy = trustedTypes.createPolicy("forceInner", {createHTML: (to_escape) => to_escape});
  193. return escapeHTMLPolicy.createHTML(htmlIn);
  194. }
  195. },
  196. CloneObject: function(objIn)
  197. {
  198. return JSON.parse(JSON.stringify(objIn));
  199. },
  200. GetCBChecked: function(cbID)
  201. {
  202. try
  203. {
  204. return(document.getElementById(cbID).checked);
  205. }
  206. catch(err)
  207. {
  208. uroDBG.AddLog('GetCBChecked() - '+cbID+' not found!');
  209. return null;
  210. }
  211. },
  212. SetCBChecked: function(cbID, state)
  213. {
  214. try
  215. {
  216. document.getElementById(cbID).checked = state;
  217. }
  218. catch(err)
  219. {
  220. uroDBG.AddLog('SetCBChecked() - '+cbID+' not found!');
  221. }
  222. },
  223. GetElmValue: function(elmID)
  224. {
  225. try
  226. {
  227. return(document.getElementById(elmID).value);
  228. }
  229. catch(err)
  230. {
  231. uroDBG.AddLog('GetElmValue() - '+elmID+' not found!');
  232. return null;
  233. }
  234. },
  235. SetOnClick: function(elm,fn)
  236. {
  237. try
  238. {
  239. if(typeof elm == 'object')
  240. {
  241. elm.onclick = fn;
  242. }
  243. else
  244. {
  245. document.getElementById(elm).onclick = fn;
  246. }
  247. }
  248. catch(err)
  249. {
  250. uroDBG.AddLog('SetOnClick() - '+elm+' not found!');
  251. }
  252. },
  253. AddEventListener: function(elm, eventType, eventFn, eventBool)
  254. {
  255. try
  256. {
  257. document.getElementById(elm).addEventListener(eventType, eventFn, eventBool);
  258. }
  259. catch(err)
  260. {
  261. uroDBG.AddLog('AddEventListener() - '+elm+' not found!');
  262. }
  263. },
  264. DateToDays: function(dateToConvert)
  265. {
  266. let dateNow = new Date();
  267. let elapsedSinceEpoch = dateNow.getTime();
  268. let elapsedSinceEvent = elapsedSinceEpoch - dateToConvert;
  269. dateNow.setHours(0);
  270. dateNow.setMinutes(0);
  271. dateNow.setSeconds(0);
  272. dateNow.setMilliseconds(0);
  273. let elapsedSinceMidnight = elapsedSinceEpoch - dateNow.getTime();
  274. dateNow.setHours(24);
  275. let pendingUntilMidnight = elapsedSinceEpoch - dateNow.getTime();
  276. if((elapsedSinceEvent < elapsedSinceMidnight) && (elapsedSinceEvent > pendingUntilMidnight))
  277. {
  278. // event occurred today...
  279. return 0;
  280. }
  281. else if(elapsedSinceEvent < 0)
  282. {
  283. // event occurrs at some point in the future after midnight today, so return a minimum value of -1...
  284. return -1 - Math.floor((pendingUntilMidnight - elapsedSinceEvent) / 86400000);
  285. }
  286. else
  287. {
  288. // event occurred at some point prior to midnight this morning, so return a minimum value of 1...
  289. return 1 + Math.floor((elapsedSinceEvent - elapsedSinceMidnight) / 86400000);
  290. }
  291. },
  292. GetURAge: function(urObj,ageType,getRaw)
  293. {
  294. if(ageType === 0)
  295. {
  296. if((urObj.attributes.driveDate === null)||(urObj.attributes.driveDate === 0)) return -1;
  297. if(getRaw) return urObj.attributes.driveDate;
  298. else return uroUtils.DateToDays(urObj.attributes.driveDate);
  299. }
  300. else if(ageType === 1)
  301. {
  302. if((urObj.attributes.resolvedOn === null)||(urObj.attributes.resolvedOn === 0)) return -1;
  303. if(getRaw) return urObj.attributes.resolvedOn;
  304. else return uroUtils.DateToDays(urObj.attributes.resolvedOn);
  305. }
  306. else
  307. {
  308. return -1;
  309. }
  310. },
  311. GetMCAge: function(mcAttrs, ageType, getRaw)
  312. {
  313. if(ageType === 0)
  314. {
  315. if((mcAttrs.createdOn === null)||(mcAttrs.createdOn === 0)) return -1;
  316. if(getRaw) return mcAttrs.createdOn;
  317. else return uroUtils.DateToDays(mcAttrs.createdOn);
  318. }
  319. else if(ageType === 1)
  320. {
  321. if((mcAttrs.updatedOn === null)||(mcAttrs.updatedOn === 0)) return -1;
  322. if(getRaw) return mcAttrs.updatedOn;
  323. else return uroUtils.DateToDays(mcAttrs.updatedOn);
  324. }
  325. else if(ageType === 2)
  326. {
  327. if((mcAttrs.endDate === null)||(mcAttrs.endDate === 0)) return -1;
  328. let tDate = new Date(mcAttrs.endDate);
  329. if(getRaw) return tDate;
  330. else return uroUtils.DateToDays(tDate);
  331. }
  332. else
  333. {
  334. return -1;
  335. }
  336. },
  337. GetPURAge: function(purObj)
  338. {
  339. if(purObj.attributes.venueUpdateRequests[0].attributes.dateAdded !== null)
  340. {
  341. return uroUtils.DateToDays(purObj.attributes.venueUpdateRequests[0].attributes.dateAdded);
  342. }
  343. else
  344. {
  345. return -1;
  346. }
  347. },
  348. GetCameraAge: function(camObj, mode)
  349. {
  350. if(mode === 0)
  351. {
  352. if(camObj.attributes.updatedOn === null) return -1;
  353. return uroUtils.DateToDays(camObj.attributes.updatedOn);
  354. }
  355. if(mode === 1)
  356. {
  357. if(camObj.attributes.createdOn === null) return -1;
  358. return uroUtils.DateToDays(camObj.attributes.createdOn);
  359. }
  360. },
  361. GetCommentAge: function(commentObj)
  362. {
  363. if(commentObj.createdOn === null) return -1;
  364. return uroUtils.DateToDays(commentObj.createdOn);
  365. },
  366. ParseDaysAgo: function(days)
  367. {
  368. if(days === 0) return 'today';
  369. else if(days === 1) return '1 day ago';
  370. else return days+' days ago';
  371. },
  372. ParseDaysToGo: function(days)
  373. {
  374. days = 0 - days;
  375. if(days === 0) return 'today';
  376. else if(days === 1) return 'in 1 day';
  377. else return 'in '+days+' days';
  378. },
  379. GetLocalisedSpeedString: function(thisSpeed)
  380. {
  381. if(thisSpeed !== null)
  382. {
  383. let conversionFactor = 1; // default to metric
  384. let multipleFactor = 10; // default to limits being set in multiples of 10
  385. let country = null;
  386. if((W.model.getTopCountry()) && (W.model.getTopCountry().attributes.name !== undefined))
  387. {
  388. country = W.model.getTopCountry().attributes.name;
  389. }
  390. if(country !== null)
  391. {
  392. // country-specific deviations from the above...
  393. if
  394. (
  395. (country == "United Kingdom") ||
  396. (country == "Jersey") ||
  397. (country == "Guernsey") ||
  398. (country == "United States")
  399. )
  400. {
  401. // countries using MPH
  402. conversionFactor = 1.609;
  403. }
  404. if
  405. (
  406. (country == "United States") ||
  407. (country == "Guernsey")
  408. )
  409. {
  410. // countries with speed limits set in multiples of 5
  411. multipleFactor = 5;
  412. }
  413. }
  414. let speed = Math.round(thisSpeed / conversionFactor);
  415. let retval = speed;
  416. if(conversionFactor == 1) retval += "KM/H";
  417. else retval += "MPH";
  418. return retval;
  419. }
  420. else return "not set";
  421. },
  422. Clickify: function(desc, suffix)
  423. {
  424. // The terminators array consists of pairs of characters which may be found at either
  425. // end of a URL. The first entry in each pair indicates which character needs to be
  426. // found immediately prior to the URL ('' indicates any character) in order for the
  427. // second entry to be considered as a potential end of URL marker
  428. let terminators = [
  429. ['', ' '],
  430. ['', ','],
  431. ['(', ')'],
  432. ['[', ']'],
  433. ['', '\r'],
  434. ['', '\n']
  435. ];
  436. if(desc === null) return '';
  437. if(desc === undefined) return '';
  438. if(desc === '') return '';
  439. if(desc.indexOf("https: one.network") == 0)
  440. {
  441. desc = desc.replaceAll(' ','/');
  442. }
  443. desc = desc.replace(/<\/?[^>]+(>|$)/g, "");
  444. if(desc !== "null")
  445. {
  446. // At the moment we can only clickify links that start with http or https...
  447. if(desc.indexOf('http') != -1)
  448. {
  449. let links = desc.split("http");
  450. desc = '';
  451. let i, j, linkEndPos, descPostLink;
  452. for(i=0; i<links.length; i++)
  453. {
  454. if(links[i].indexOf('://') != -1)
  455. {
  456. let prefix = links[i - 1][links[i - 1].length - 1];
  457. links[i] = "http" + links[i];
  458. linkEndPos = links[i].length + 1;
  459. // work out where the end of the URL is, based on what the character immediately
  460. // preceding the "http" is
  461. for(j=0; j<terminators.length; j++)
  462. {
  463. if(links[i].indexOf(terminators[j][1]) !== -1)
  464. {
  465. if((prefix === terminators[j][0]) || (terminators[j][0] === ''))
  466. {
  467. linkEndPos = Math.min(linkEndPos, links[i].indexOf(terminators[j][1]));
  468. }
  469. }
  470. }
  471. descPostLink = '';
  472. if(linkEndPos < links[i].length)
  473. {
  474. descPostLink = links[i].slice(linkEndPos);
  475. links[i] = links[i].slice(0,linkEndPos);
  476. }
  477. desc += '<a target="_wazeUR" href="'+links[i]+'">'+links[i]+'</a>' + descPostLink;
  478. }
  479. else
  480. {
  481. desc += links[i];
  482. }
  483. }
  484. }
  485. desc = desc.replace(/\n/g,"<br>");
  486. return desc + suffix;
  487. }
  488. else
  489. {
  490. return '';
  491. }
  492. },
  493. GetUserNameFromID: function(userID)
  494. {
  495. let userName;
  496. if(W.model.users.objects[userID] != null)
  497. {
  498. userName = W.model.users.objects[userID].attributes.userName;
  499. if(userName === undefined)
  500. {
  501. userName = userID;
  502. }
  503. }
  504. else
  505. {
  506. userName = userID;
  507. }
  508. return userName;
  509. },
  510. GetUserLevelFromID: function(userID)
  511. {
  512. let userLevel = null;
  513. if(W.model.users.objects[userID] != null)
  514. {
  515. userLevel = W.model.users.objects[userID].attributes.rank + 1;
  516. }
  517. return userLevel;
  518. },
  519. GetUserNameAndRank: function(userID)
  520. {
  521. let userName;
  522. let userLevel;
  523. if(W.model.users.objects[userID] != null)
  524. {
  525. userName = W.model.users.objects[userID].attributes.userName;
  526. if(userName === undefined)
  527. {
  528. userName = userID;
  529. }
  530. else
  531. {
  532. userName = '<a href="' + (W.Config.user_profile.url + userName) + '" target="_blank">' + userName + '</a>';
  533. }
  534. userLevel = W.model.users.objects[userID].attributes.rank + 1;
  535. }
  536. else
  537. {
  538. userName = userID;
  539. userLevel = '?';
  540. }
  541. return userName + ' (' + userLevel + ')';
  542. },
  543. GetDateTimeString: function(ts)
  544. {
  545. let tDateObj = new Date(ts);
  546. let dateLocale;
  547. let timeLocale;
  548. if(uroUtils.GetCBChecked('_cbDateFmtDDMMYY')) dateLocale = 'en-gb';
  549. if(uroUtils.GetCBChecked('_cbDateFmtMMDDYY')) dateLocale = 'en-us';
  550. if(uroUtils.GetCBChecked('_cbDateFmtYYMMDD')) dateLocale = 'ja';
  551. if(uroUtils.GetCBChecked('_cbTimeFmt24H')) timeLocale = 'en-gb';
  552. if(uroUtils.GetCBChecked('_cbTimeFmt12H')) timeLocale = 'en-us';
  553. return tDateObj.toLocaleDateString(dateLocale) + ' ' + tDateObj.toLocaleTimeString(timeLocale);
  554. },
  555. ParsePxString: function(pxString)
  556. {
  557. return parseInt(pxString.split("px")[0]);
  558. },
  559. TypeCast: function(varin)
  560. {
  561. if(varin == "null") return null;
  562. if(typeof varin == "string") return parseInt(varin);
  563. return varin;
  564. },
  565. Truncate: function(val)
  566. {
  567. if(val === null) return val;
  568. if(val < 0) return Math.ceil(val);
  569. return Math.floor(val);
  570. },
  571. KeywordPresent: function(desc, keyword, caseInsensitive)
  572. {
  573. let re;
  574. if(caseInsensitive) re = RegExp(keyword,'i');
  575. else re = RegExp(keyword);
  576. if(desc.search(re) != -1) return true;
  577. else return false;
  578. },
  579. AddStyle: function(ID, css)
  580. {
  581. let head, style;
  582. head = document.getElementsByTagName('head')[0];
  583. if (!head)
  584. {
  585. return;
  586. }
  587. uroUtils.RemoveStyle(ID); // in case it is already there
  588. style = document.createElement('style');
  589. style.type = 'text/css';
  590. style.innerHTML = uroUtils.ModifyHTML(css);
  591. style.id = ID;
  592. head.appendChild(style);
  593. },
  594. RemoveStyle: function(ID)
  595. {
  596. let style = document.getElementById(ID);
  597. if (style)
  598. {
  599. style.parentNode.removeChild(style);
  600. }
  601. },
  602. GetTS: function(day, month, year, hours, mins)
  603. {
  604. let retval = new Date(0);
  605. retval.setDate(day);
  606. retval.setMonth(month - 1);
  607. retval.setYear(year);
  608. retval.setHours(hours);
  609. retval.setMinutes(mins);
  610. return retval.getTime();
  611. },
  612. ToHex: function(decValue, digits)
  613. {
  614. let modifier = 1;
  615. for(let i=0; i < digits; i++)
  616. {
  617. modifier *= 16;
  618. }
  619. // make sure decValue actually is an integer
  620. decValue = parseInt(decValue);
  621. // adding the modifier ensures we have enough digits, including
  622. // any leading zeros which may be required, for the required output
  623. decValue += modifier;
  624. let retval = decValue.toString(16);
  625. // after converting to hex with the modifier included, we'll have
  626. // as many digits as we need to represent decValue, but also an
  627. // extra leading 1, which now needs to be removed before returning
  628. // the result...
  629. retval = retval.substr(-digits);
  630. retval = retval.toUpperCase();
  631. return retval;
  632. },
  633. GetActiveSidebarTab: function()
  634. {
  635. let retval = null;
  636.  
  637. let tabIcons = document.querySelectorAll('wz-navigation-item');
  638. for(let i = 0; i < tabIcons.length; ++i)
  639. {
  640. if(tabIcons[i].selected === true)
  641. {
  642. retval = tabIcons[i].attributes['data-for'].value;
  643. break;
  644. }
  645. }
  646. return retval;
  647. },
  648. ConvertWGS84ToMercator: function(point)
  649. {
  650. return point.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
  651. },
  652. ConvertMercatorToWGS84: function(point)
  653. {
  654. return point.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
  655. },
  656. GetSelectedSegmentIDs: function()
  657. {
  658. let selDMOs = W.selectionManager.getSelectedDataModelObjects();
  659. let retval = [];
  660.  
  661. if(selDMOs.length > 0)
  662. {
  663. for(let i = 0; i < selDMOs.length; ++i)
  664. {
  665. if(selDMOs[i].type === "segment")
  666. {
  667. retval.push(selDMOs[i].attributes.id);
  668. }
  669. }
  670. }
  671.  
  672. return retval;
  673. }
  674. };
  675. const uroTabs = // script tab handling
  676. {
  677. MAX_PER_ROW: 6,
  678. IDS:
  679. {
  680. URS: 0,
  681. MPS: 1,
  682. MCS: 2,
  683. RTCS: 3,
  684. RAS: 4,
  685. PLACES: 5,
  686. ////CAMS: 6,
  687. ////MISC: 7
  688. MISC: 6
  689. },
  690. FIELDS:
  691. {
  692. TABHEADER: 0,
  693. TABBODY: 1,
  694. LINKID: 2,
  695. TABTITLE: 3,
  696. SHOWFN: 4,
  697. CLICKFN: 5,
  698. STORAGE: 6,
  699. POPULATEFN: 7
  700. },
  701. CtrlTabs: [],
  702.  
  703. SetStyleDisplay: function(elm,style)
  704. {
  705. try
  706. {
  707. if(typeof elm == 'object')
  708. {
  709. elm.style.display = style;
  710. }
  711. else
  712. {
  713. document.getElementById(elm).style.display = style;
  714. }
  715. }
  716. catch(err)
  717. {
  718. uroDBG.AddLog('SetStyleDisplay() - '+elm+' not found!');
  719. }
  720. },
  721. PopulateMP: function()
  722. {
  723. let tHTML = '';
  724. tHTML += '<input type="checkbox" id="_cbMPFilterOutsideArea">Hide MPs outside my editable area</input><br><br>';
  725. tHTML += '<b>Filter MPs by type:</b><br>';
  726. let i;
  727. for(i=0; i<uroKnownProblemTypeNames.length; i++)
  728. {
  729. tHTML += '<input type="checkbox" id="_cbMPFilter_T'+uroKnownProblemTypeIDs[i]+'">'+uroKnownProblemTypeNames[i]+'</input><br>';
  730. }
  731. tHTML += '<br><input type="checkbox" id="_cbMPFilterUnknownProblem">Unknown problem type</input><br><br>';
  732.  
  733. tHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  734. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterElgin">[Elgin]</input><br>';
  735. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTrafficCast">[TrafficCast]</input><br>';
  736. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTrafficMaster">[TM]</input><br>';
  737. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterCaltrans">[Caltrans]</input><br>';
  738. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTFL">TfL</input><br>';
  739.  
  740. tHTML += '<input type="checkbox" id="_cbMPFilterReopenedProblem">Reopened Problems</input><br><br>';
  741.  
  742. tHTML += '<input type="checkbox" id="_cbInvertMPFilter">Invert operation of type filters?</input><br>';
  743.  
  744. tHTML += '<br><b>Hide closed/solved/unidentified Problems:</b><br>';
  745. tHTML += '<input type="checkbox" id="_cbMPFilterClosed">Closed</input><br>';
  746. tHTML += '<input type="checkbox" id="_cbMPFilterSolved">Solved</input><br>';
  747. tHTML += '<input type="checkbox" id="_cbMPFilterUnidentified">Not identified</input><br><br>';
  748.  
  749. tHTML += '<input type="checkbox" id="_cbMPClosedUserIDFilter" pairedWith="_cbMPNotClosedUserIDFilter">Closed</input> or ';
  750. tHTML += '<input type="checkbox" id="_cbMPNotClosedUserIDFilter" pairedWith="_cbMPClosedUserIDFilter">Not Closed</input> by user';
  751. tHTML += '<select id="_selectMPUserID" style="width:80%; height:22px;"></select><br>';
  752.  
  753. tHTML += '<br><b>Hide problems (not turn) by severity:</b><br>';
  754. tHTML += '<input type="checkbox" id="_cbMPFilterLowSeverity">Low</input>&nbsp;&nbsp;';
  755. tHTML += '<input type="checkbox" id="_cbMPFilterMediumSeverity">Medium</input>&nbsp;&nbsp;';
  756. tHTML += '<input type="checkbox" id="_cbMPFilterHighSeverity">High</input><br>';
  757.  
  758. tHTML += '<br><b>Show MPs based on start/end dates:</b><br>';
  759. tHTML += '<input type="checkbox" id="_cbMPFilterStartDate">Start</input>&nbsp;&nbsp;';
  760. tHTML += '<input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartDay"> / ';
  761. tHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartMonth"> / ';
  762. tHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartYear"><br>';
  763. tHTML += '<input type="checkbox" id="_cbMPFilterEndDate">End</input>&nbsp;&nbsp;';
  764. tHTML += '<input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndDay"> / ';
  765. tHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndMonth"> / ';
  766. tHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndYear"><br>';
  767. tHTML += '<input type="checkbox" id="_cbMPFilterEndDatePassed">End date in the past</input>';
  768.  
  769. return tHTML;
  770. },
  771. PopulatePlaces: function()
  772. {
  773. let tHTML = '';
  774. tHTML += '<b>Filter PURs by category/status:</b><br>';
  775. tHTML += '<input type="checkbox" id="_cbFilterUneditablePlaceUpdates">Ones I can\'t edit</input><br>';
  776. tHTML += '<input type="checkbox" id="_cbPURFilterInsideManagedAreas">Ones within AM areas</input>';
  777. tHTML += '&nbsp;(<input type="checkbox" id="_cbPURExcludeUserArea">except my area)</input><br>';
  778. tHTML += '<i>Requires Area Manager layer to be enabled</i><br>';
  779. tHTML += '<input type="checkbox" id="_cbFilterLockRankedPlaceUpdates">Ones with non-zero lockRanks</input><br>';
  780. tHTML += '<input type="checkbox" id="_cbFilterNewPlacePUR">Ones for new places</input><br>';
  781. tHTML += '<input type="checkbox" id="_cbFilterUpdatedDetailsPUR">Ones for updated place details</input><br>';
  782.  
  783. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFPhone">Phone number</input><br>';
  784. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFName">Name</input><br>';
  785. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFEntryExitPoints">Entry//exit points</input><br>';
  786. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFOpeningHours">Opening hours</input><br>';
  787. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFAliases">Aliases</input><br>';
  788. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFServices">Services</input><br>';
  789. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFGeometry">Geometry</input><br>';
  790. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFHouseNumber">House number</input><br>';
  791. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFCategories">Categories</input><br>';
  792. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFDescription">Description</input><br>';
  793.  
  794. tHTML += '<input type="checkbox" id="_cbFilterNewPhotoPUR">Ones for new photos</input><br>';
  795. tHTML += '<input type="checkbox" id="_cbFilterFlaggedPUR">Ones flagged for attention</input><br>';
  796. tHTML += '<br><input type="checkbox" id="_cbInvertPURFilters">Invert PUR filters</input><br>';
  797.  
  798. tHTML += '<br><b>Filter PURs by age of submission:</b><br>';
  799. tHTML += '<input type="checkbox" id="_cbEnablePURMinAgeFilter">Hide PURs less than </input>';
  800. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputPURFilterMinDays"> days old<br>';
  801. tHTML += '<input type="checkbox" id="_cbEnablePURMaxAgeFilter">Hide PURs more than </input>';
  802. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputPURFilterMaxDays"> days old<br>';
  803.  
  804. tHTML += '<hr>';
  805.  
  806. tHTML += '<br><b>Filter Places by state:</b><br>';
  807. tHTML += 'Hide if last edited<br>';
  808. tHTML += '<input type="checkbox" id="_cbPlaceFilterEditedLessThan"> less than </input>';
  809. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterPlaceEditMinDays"> days ago<br>';
  810. tHTML += '<input type="checkbox" id="_cbPlaceFilterEditedMoreThan"> more than </input>';
  811. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterPlaceEditMaxDays"> days ago<br>';
  812.  
  813. tHTML += '<br>Hide if locked at level:<br>';
  814. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL0">1</input>';
  815. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL1">2</input>';
  816. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL2">3</input>';
  817. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL3">4</input>';
  818. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL4">5</input>';
  819. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL5">6</input>';
  820. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesStaff">Staff</input>';
  821. tHTML += '<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesAdLocked">AdLocked</input><br>';
  822.  
  823. tHTML += '<br>Hide by geometry:<br>';
  824. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAreaPlaces">Areas</input>';
  825. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePointPlaces">Points</input>';
  826.  
  827. tHTML += '<br><br><input type="checkbox" id="_cbHidePhotoPlaces" pairedWith="_cbHideNoPhotoPlaces">Hide or </input>';
  828. tHTML += '<input type="checkbox" id="_cbHideNoPhotoPlaces" pairedWith="_cbHidePhotoPlaces">show ones with photos</input><br>';
  829.  
  830. tHTML += '<input type="checkbox" id="_cbHideLinkedPlaces" pairedWith="_cbHideNoLinkedPlaces">Hide or </input>';
  831. tHTML += '<input type="checkbox" id="_cbHideNoLinkedPlaces" pairedWith="_cbHideLinkedPlaces">show ones with external links</input><br>';
  832.  
  833. tHTML += '<input type="checkbox" id="_cbHideDescribedPlaces" pairedWith="_cbHideNonDescribedPlaces">Hide or </input>';
  834. tHTML += '<input type="checkbox" id="_cbHideNonDescribedPlaces" pairedWith="_cbHideDescribedPlaces">show ones with descriptive text</input><br>';
  835.  
  836. tHTML += '<input type="checkbox" id="_cbHideKeywordPlaces" pairedWith="_cbHideNoKeywordPlaces">Hide or </input>';
  837. tHTML += '<input type="checkbox" id="_cbHideNoKeywordPlaces" pairedWith="_cbHideKeywordPlaces">show ones with a name including</input><br>';
  838. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordPlace"><br>';
  839.  
  840. tHTML += '<br><b>Show Places touched by a specific editor:</b><br>';
  841. tHTML += '<input type="checkbox" id="_cbShowOnlyPlacesCreatedBy">Created by</input>&nbsp;/&nbsp;';
  842. tHTML += '<input type="checkbox" id="_cbShowOnlyPlacesEditedBy">edited by</input><br>';
  843. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textPlacesEditor"><br>';
  844. tHTML += '<select id="_selectPlacesUserID" style="width:80%; height:22px;"></select><br>';
  845.  
  846. tHTML += '<br><b>Hide Places touched by a specific editor:</b><br>';
  847. tHTML += '<input type="checkbox" id="_cbHideOnlyPlacesCreatedBy">Created by</input>&nbsp;/&nbsp;';
  848. tHTML += '<input type="checkbox" id="_cbHideOnlyPlacesEditedBy">edited by</input><br>';
  849. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textHidePlacesEditor"><br>';
  850. tHTML += '<select id="_selectHidePlacesUserID" style="width:80%; height:22px;"></select><br>';
  851.  
  852. tHTML += '<br><br><b>Filter Places by category:</b><br>';
  853. tHTML += '<input type="checkbox" id="_cbLeavePURGeos" pairedWith="_cbHidePURsForFilteredPlaces">Keep place visible if linked PUR is hidden, or</input><br>';
  854. tHTML += '<input type="checkbox" id="_cbHidePURsForFilteredPlaces" pairedWith="_cbLeavePURGeos">Hide PURs linked to hidden places</input><br><br>';
  855.  
  856. let nCategories = W.Config.venues.categories.length;
  857. let i;
  858. if(uroPlacesGroupsCollapsed.length != nCategories)
  859. {
  860. for(i=0; i<nCategories; i++)
  861. {
  862. uroPlacesGroupsCollapsed.push(false);
  863. }
  864. }
  865.  
  866. for(i=0; i<nCategories; i++)
  867. {
  868. let parentCategory = W.Config.venues.categories[i];
  869. let localisedName = I18n.lookup("venues.categories." + parentCategory);
  870.  
  871. if(uroPlacesGroupsCollapsed[i] === true)
  872. {
  873. tHTML += '<i class="fa fa-plus-square-o" style="cursor:pointer;font-size:14px;" id="_uroPlacesGroupState-'+i+'"></i>';
  874. }
  875. else
  876. {
  877. tHTML += '<i class="fa fa-minus-square-o" style="cursor:pointer;font-size:14px;" id="_uroPlacesGroupState-'+i+'"></i>';
  878. }
  879.  
  880. tHTML += '&nbsp;<input type="checkbox" id="_cbPlacesFilter-'+parentCategory+'"><b>'+localisedName+'</b></input><br>';
  881. tHTML += '<div id="_uroPlacesGroup-'+i+'" style="padding:3px;border-width:2px;border-style:solid;border-color:#FFFFFF">';
  882.  
  883. for(let ii=0; ii<W.Config.venues.subcategories[parentCategory].length; ii++)
  884. {
  885. let subCategory = W.Config.venues.subcategories[parentCategory][ii];
  886. localisedName = I18n.lookup("venues.categories." + subCategory);
  887. tHTML += '&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbPlacesFilter-'+subCategory+'">'+localisedName+'</input><br>';
  888. }
  889. tHTML += '</div>';
  890. }
  891. tHTML += '<input type="checkbox" id="_cbFilterPrivatePlaces"><b>Residential Places</b></input><br>';
  892. tHTML += '<br><input type="checkbox" id="_cbInvertPlacesFilter">Invert Place filters?</input>';
  893.  
  894. return tHTML;
  895. },
  896. PopulateUR: function()
  897. {
  898. let iHTML = '';
  899. iHTML = '<br>';
  900.  
  901. iHTML += '<input type="checkbox" id="_cbURFilterOutsideArea">Hide URs outside my editable area</input><br>';
  902. iHTML += '<input type="checkbox" id="_cbURFilterInsideManagedAreas">Hide URs within AM areas</input>';
  903. iHTML += '&nbsp;(<input type="checkbox" id="_cbURExcludeUserArea">except my area)</input><br>';
  904. iHTML += '&nbsp;<i>Requires Area Manager layer to be enabled</i><br>';
  905. iHTML += '<input type="checkbox" id="_cbNoFilterForURInURL">Don\'t filter selected UR</input><br><br>';
  906. iHTML += '<input type="checkbox" id="_cbURFilterDupes">Show only duplicate URs</input><br><br>';
  907.  
  908. iHTML += '<b>Filter by type:</b><br>';
  909. iHTML += '<input type="checkbox" id="_cbFilterWazeAuto">Waze Automatic</input><br>';
  910. iHTML += '<input type="checkbox" id="_cbFilterIncorrectTurn">Incorrect turn</input><br>';
  911. iHTML += '<input type="checkbox" id="_cbFilterIncorrectAddress">Incorrect address</input><br>';
  912. iHTML += '<input type="checkbox" id="_cbFilterIncorrectRoute">Incorrect route</input><br>';
  913. iHTML += '<input type="checkbox" id="_cbFilterMissingRoundabout">Missing roundabout</input><br>';
  914. iHTML += '<input type="checkbox" id="_cbFilterGeneralError">General error</input><br>';
  915. iHTML += '<input type="checkbox" id="_cbFilterTurnNotAllowed">Turn not allowed</input><br>';
  916. iHTML += '<input type="checkbox" id="_cbFilterIncorrectJunction">Incorrect junction</input><br>';
  917. iHTML += '<input type="checkbox" id="_cbFilterMissingBridgeOverpass">Missing bridge overpass</input><br>';
  918. iHTML += '<input type="checkbox" id="_cbFilterWrongDrivingDirection">Wrong driving direction</input><br>';
  919. iHTML += '<input type="checkbox" id="_cbFilterMissingExit">Missing exit</input><br>';
  920. iHTML += '<input type="checkbox" id="_cbFilterMissingRoad">Missing road</input><br>';
  921. iHTML += '<input type="checkbox" id="_cbFilterBlockedRoad">Blocked road</input><br>';
  922. iHTML += '<input type="checkbox" id="_cbFilterMissingLandmark">Missing Landmark</input><br>';
  923. iHTML += '<input type="checkbox" id="_cbFilterSpeedLimits">Missing or Invalid Speed limit</input><br>';
  924. iHTML += '<input type="checkbox" id="_cbFilterUndefined">Undefined</input><br>';
  925.  
  926. iHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  927. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterRoadworks">[ROADWORKS]</input><br>';
  928. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterConstruction">[CONSTRUCTION]</input><br>';
  929. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterClosure">[CLOSURE]</input><br>';
  930. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterEvent">[EVENT]</input><br>';
  931. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterNote">[NOTE]</input><br>';
  932. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterBOG">[BOG]</input><br>';
  933. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterDifficult">[DIFFICULT]</input><br>';
  934. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterWSLM">[WSLM]</input><br><br>';
  935. iHTML += '<input type="checkbox" id="_cbInvertURFilter">Invert operation of type filters?</input><br>';
  936.  
  937. iHTML += '<hr>';
  938.  
  939. iHTML += '<br><b>Hide by state:</b><br>';
  940. iHTML += '<input type="checkbox" id="_cbFilterOpenUR">Open</input><br>';
  941. iHTML += '<input type="checkbox" id="_cbFilterClosedUR">Closed</input><br>';
  942. iHTML += '<input type="checkbox" id="_cbFilterSolved">Solved</input><br>';
  943. iHTML += '<input type="checkbox" id="_cbFilterUnidentified">Not identified</input><br><br>';
  944.  
  945.  
  946. iHTML += '<br><b>Filter by age of submission:</b><br>';
  947. iHTML += '<input type="checkbox" id="_cbEnableMinAgeFilter">Hide URs less than </input>';
  948. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMinDays"> days old<br>';
  949. iHTML += '<input type="checkbox" id="_cbEnableMaxAgeFilter">Hide URs more than </input>';
  950. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMaxDays"> days old<br>';
  951.  
  952. iHTML += '<br><b>Filter by other details:</b><br>';
  953. iHTML += '<input type="checkbox" id="_cbHideMyFollowed" pairedWith="_cbHideMyUnfollowed">Hide</input> or ';
  954. iHTML += '<input type="checkbox" id="_cbHideMyUnfollowed" pairedWith="_cbHideMyFollowed">show</input> URs I\'m following<br><br>';
  955.  
  956. iHTML += '<input type="checkbox" id="_cbURDescriptionMustBePresent" pairedWith="_cbURDescriptionMustBeAbsent">Hide</input> or ';
  957. iHTML += '<input type="checkbox" id="_cbURDescriptionMustBeAbsent" pairedWith="_cbURDescriptionMustBePresent">show</input> URs with no description<br>';
  958. iHTML += '<input type="checkbox" id="_cbEnableKeywordMustBePresent">Hide URs not including </input>';
  959. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordPresent"><br>';
  960. iHTML += '<input type="checkbox" id="_cbEnableKeywordMustBeAbsent">Hide URs including </input>';
  961. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordAbsent"><br>';
  962. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbCaseInsensitive"><i>Case-insensitive matches?</i></input><br><br>';
  963.  
  964. iHTML += 'With comments from me?<br>';
  965. iHTML += '<input type="checkbox" id="_cbHideMyComments" pairedWith="_cbHideAnyComments">Yes </input>';
  966. iHTML += '<input type="checkbox" id="_cbHideAnyComments" pairedWith="_cbHideMyComments">No</input><br>';
  967. iHTML += 'If last comment made by me?<br>';
  968. iHTML += '<input type="checkbox" id="_cbHideIfLastCommenter" pairedWith="_cbHideIfNotLastCommenter">Yes </input>';
  969. iHTML += '<input type="checkbox" id="_cbHideIfNotLastCommenter" pairedWith="_cbHideIfLastCommenter">No </input><br>';
  970. iHTML += 'If last comment made by UR reporter?<br>';
  971. iHTML += '<input type="checkbox" id="_cbHideIfReporterLastCommenter" pairedWith="_cbHideIfReporterNotLastCommenter">Yes </input>';
  972. iHTML += '<input type="checkbox" id="_cbHideIfReporterNotLastCommenter" pairedWith="_cbHideIfReporterLastCommenter">No</input><br>';
  973.  
  974. iHTML += '<input type="checkbox" id="_cbEnableMinCommentsFilter">With less than </input>';
  975. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMinComments"> comments<br>';
  976. iHTML += '<input type="checkbox" id="_cbEnableMaxCommentsFilter">With more than </input>';
  977. iHTML += '<input type="number" min="0" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMaxComments"> comments<br><br>';
  978.  
  979. iHTML += '<input type="checkbox" id="_cbEnableCommentAgeFilter2">Last comment less than </input>';
  980. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterCommentDays2"> days ago<br>';
  981. iHTML += '<input type="checkbox" id="_cbEnableCommentAgeFilter">Last comment more than </input>';
  982. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterCommentDays"> days ago<br>';
  983. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbIgnoreOtherEditorComments"><i>Ignore other editor comments?</i></input><br><br>';
  984.  
  985. iHTML += '<input type="checkbox" id="_cbURUserIDFilter">Without comments from user</input>';
  986. iHTML += '<select id="_selectURUserID" style="width:80%; height:22px;"></select><br>';
  987. iHTML += '<input type="checkbox" id="_cbURResolverIDFilter">Not resolved by user</input>';
  988. iHTML += '<select id="_selectURResolverID" style="width:80%; height:22px;"></select>';
  989.  
  990. iHTML += '<br><br><input type="checkbox" id="_cbInvertURStateFilter">Invert operation of state/age filters?</input><br>';
  991. iHTML += '<input type="checkbox" id="_cbNoFilterForTaggedURs">Don\'t apply state/age filters to tagged URs</input><br>';
  992.  
  993. return iHTML;
  994. },
  995. PopulateMC: function()
  996. {
  997. let iHTML = '';
  998. iHTML = '<br>';
  999.  
  1000. iHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  1001. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterRoadworks">[ROADWORKS]</input><br>';
  1002. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterConstruction">[CONSTRUCTION]</input><br>';
  1003. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterClosure">[CLOSURE]</input><br>';
  1004. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterEvent">[EVENT]</input><br>';
  1005. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterNote">[NOTE]</input><br>';
  1006. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterBOG">[BOG]</input><br>';
  1007. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterDifficult">[DIFFICULT]</input><br>';
  1008. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterWSLM">[WSLM]</input><br><br>';
  1009. iHTML += '<input type="checkbox" id="_cbInvertMCFilter">Invert operation of type filters?</input><br>';
  1010.  
  1011. iHTML += '<hr>';
  1012.  
  1013. iHTML += '<br><b>Filter by description/comments/following:</b><br>';
  1014. iHTML += '<input type="checkbox" id="_cbMCHideMyFollowed" pairedWith="_cbMCHideMyUnfollowed">Ones I am or </input>';
  1015. iHTML += '<input type="checkbox" id="_cbMCHideMyUnfollowed" pairedWith="_cbMCHideMyFollowed">am not following</input><br><br>';
  1016.  
  1017. iHTML += '<input type="checkbox" id="_cbMCDescriptionMustBePresent" pairedWith="_cbMCDescriptionMustBeAbsent">Hide</input> or ';
  1018. iHTML += '<input type="checkbox" id="_cbMCDescriptionMustBeAbsent" pairedWith="_cbMCDescriptionMustBePresent">show</input> MCs with no description<br>';
  1019. iHTML += '<input type="checkbox" id="_cbMCCommentsMustBePresent" pairedWith="_cbMCCommentsMustBeAbsent">Hide</input> or ';
  1020. iHTML += '<input type="checkbox" id="_cbMCCommentsMustBeAbsent" pairedWith="_cbMCCommentsMustBePresent">show</input> MCs with no comments<br>';
  1021. iHTML += '<input type="checkbox" id="_cbMCExpiryMustBePresent" pairedWith="_cbMCExpiryMustBeAbsent">Hide</input> or ';
  1022. iHTML += '<input type="checkbox" id="_cbMCExpiryMustBeAbsent" pairedWith="_cbMCExpiryMustBePresent">show</input> MCs with no expiry date<br>';
  1023. iHTML += '<input type="checkbox" id="_cbMCEnableKeywordMustBePresent">Hide MCs not including </input>';
  1024. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textMCKeywordPresent"><br>';
  1025. iHTML += '<input type="checkbox" id="_cbMCEnableKeywordMustBeAbsent">Hide MCs including </input>';
  1026. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textMCKeywordAbsent"><br>';
  1027. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCCaseInsensitive"><i>Case-insensitive matches?</i></input><br>';
  1028. iHTML += '<input type="checkbox" id="_cbMCCreatorIDFilter">Show MCs created by user</input>';
  1029. iHTML += '<select id="_selectMCCreatorID" style="width:80%; height:22px;"></select><br>';
  1030.  
  1031. iHTML += '<br><input type="checkbox" id="_cbHideWRCMCs"><b>Hide Waze_roadclosures MCs</b></input><br>';
  1032.  
  1033. iHTML += '<br><b>Hide MCs with lock level:</b><br>';
  1034. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank0">L1</input>';
  1035. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank1">L2</input>';
  1036. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank2">L3</input>';
  1037. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank3">L4</input>';
  1038. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank4">L5</input>';
  1039. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank5">L6</input>';
  1040. iHTML += '<hr>';
  1041. iHTML += '<input type="checkbox" id="_cbMCEnhancePointMCVisibility">Enhance visibility of point MCs</input>';
  1042.  
  1043. return iHTML;
  1044. },
  1045. PopulateCams: function()
  1046. {
  1047. let iHTML = '';
  1048. iHTML = '<br><b>Show Cameras created by:</b><br>';
  1049. iHTML += '<input type="checkbox" id="_cbShowWorldCams" checked>world_* users</input><br>';
  1050. iHTML += '<input type="checkbox" id="_cbShowUSACams" checked>usa_* users</input><br>';
  1051. iHTML += '<input type="checkbox" id="_cbShowNonWorldCams" checked>other users</input><br>';
  1052.  
  1053. iHTML += '<br><b>Show Cameras touched by a specific editor:</b><br>';
  1054. iHTML += '<input type="checkbox" id="_cbShowOnlyCamsCreatedBy">Created by</input>&nbsp;/&nbsp;';
  1055. iHTML += '<input type="checkbox" id="_cbShowOnlyCamsEditedBy">edited by</input><br>';
  1056. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textCameraEditor"><br>';
  1057. iHTML += '<select id="_selectCameraUserID" style="width:80%; height:22px;"></select><br>';
  1058. iHTML += '<br><input type="checkbox" id="_cbShowOnlyMyCams">Show ONLY cameras created/edited by me</input><br>';
  1059.  
  1060. iHTML += '<br><b>Show Cameras by type:</b><br>';
  1061. iHTML += '<input type="checkbox" id="_cbShowSpeedCams" checked>Speed</input><br>';
  1062. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfSpeedSet" checked> with speed data</input><br>';
  1063. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfNoSpeedSet" checked> with no speed data</input><br>';
  1064. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfInvalidSpeedSet" checked> with invalid speed data (zoom 16+)</input><br>';
  1065. iHTML += '&nbsp;&nbsp;&nbsp;<i>NOTE: slows down WME when deselected</i><br>';
  1066. iHTML += '<input type="checkbox" id="_cbShowRedLightCams" checked>Red Light</input><br>';
  1067. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfZeroSpeedSet" checked> with speed limit = 0</input><br>';
  1068. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfNonZeroSpeedSet" checked> with speed limit > 0</input><br>';
  1069. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfNoSpeedSet" checked> with no speed data</input><br>';
  1070. iHTML += '<input type="checkbox" id="_cbShowDummyCams" checked>Dummy</input><br>';
  1071.  
  1072. iHTML += '<br><b>Hide Cameras by creator:</b><br>';
  1073. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByMe">me</input>';
  1074. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank0">L1</input>';
  1075. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank1">L2</input>';
  1076. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank2">L3</input>';
  1077. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank3">L4</input>';
  1078. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank4">L5</input>';
  1079. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank5">L6</input>';
  1080.  
  1081. iHTML += '<br><b>Hide Cameras by updater:</b><br>';
  1082. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByMe">me</input>';
  1083. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank0">L1</input>';
  1084. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank1">L2</input>';
  1085. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank2">L3</input>';
  1086. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank3">L4</input>';
  1087. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank4">L5</input>';
  1088. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank5">L6</input>';
  1089.  
  1090. iHTML += '<br><br><b><input type="checkbox" id="_cbHideManualLockedCams">Show only auto-locked cameras</input></b><br>';
  1091.  
  1092. iHTML += '<br><b><input type="checkbox" id="_cbHideCWLCams">Hide cameras on watchlist</input></b><br>';
  1093.  
  1094. iHTML += '<br><b><input type="checkbox" id="_cbInvertCamFilters">Invert operation of camera filters?</input></b><br>';
  1095.  
  1096. iHTML += '<b><input type="checkbox" id="_cbHighlightInsteadOfHideCams">Highlight instead of hide</input></b><br>';
  1097. return iHTML;
  1098. },
  1099. PopulateRTC: function()
  1100. {
  1101. let iHTML = '';
  1102. iHTML = '<br><b>Hide Road Closures:</b><br>';
  1103. // Hidden checkbox to avoid errors when applying settings from previous versions of the script where this was an active control...
  1104. iHTML += '<input type="checkbox" id="_cbHideUserRTCs" style="display: none;" />';
  1105.  
  1106. iHTML += '<table style="text-align:center;">';
  1107. iHTML += '<tr><td/><td><div class="map-marker road-closure status-finished" style="margin-left:0px;margin-top:0px;" /></td><td><div class="map-marker road-closure status-active" style="margin-left:0px;margin-top:0px;" /></td><td><div class="map-marker road-closure status-not-started" style="margin-left:0px;margin-top:0px;" /></td><td>???</td></tr>';
  1108. iHTML += '<tr><td>From WME</td><td><input type="checkbox" id="_cbHideExpiredEditorRTCs" /></td><td><input type="checkbox" id="_cbHideEditorRTCs" /></td><td><input type="checkbox" id="_cbHideFutureEditorRTCs" /></td><td><input type="checkbox" id="_cbHideUnknownEditorRTCs" /></td></tr>';
  1109. iHTML += '<tr><td>From WazeFeed</td><td><input type="checkbox" id="_cbHideExpiredWazeFeedRTCs" /></td><td><input type="checkbox" id="_cbHideWazeFeedRTCs" /></td><td><input type="checkbox" id="_cbHideFutureWazeFeedRTCs" /></td><td><input type="checkbox" id="_cbHideUnknownWazeFeedRTCs" /></td></tr>';
  1110. iHTML += '<tr><td>From Staff</td><td><input type="checkbox" id="_cbHideExpiredWazeRTCs" /></td><td><input type="checkbox" id="_cbHideWazeRTCs" /></td><td><input type="checkbox" id="_cbHideFutureWazeRTCs" /></td><td><input type="checkbox" id="_cbHideUnknownWazeRTCs" /></td></tr>';
  1111. iHTML += '<tr><td>In Sidepanel</td><td><input type="checkbox" id="_cbHideExpiredSidepanelRTCs" /></td><td><input type="checkbox" id="_cbHideSidepanelRTCs" /></td><td><input type="checkbox" id="_cbHideFutureSidepanelRTCs" /></td><td><input type="checkbox" id="_cbHideUnknownSidepanelRTCs" /></td></tr>';
  1112. iHTML += '<tr><td>In Popup</td><td><input type="checkbox" id="_cbHideExpiredPopupRTCs" /></td><td><input type="checkbox" id="_cbHidePopupRTCs" /></td><td><input type="checkbox" id="_cbHideFuturePopupRTCs" /></td><td><input type="checkbox" id="_cbHideUnknownPopupRTCs" /></td></tr>';
  1113. iHTML += '</table><br>';
  1114.  
  1115. iHTML += '<input type="checkbox" id="_cbShowMTERTCs" pairedWith="_cbHideMTERTCs">Show</input> or ';
  1116. iHTML += '<input type="checkbox" id="_cbHideMTERTCs" pairedWith="_cbShowMTERTCs">hide RTCs associated with MTE: </input>';
  1117. iHTML += '<select id="_selectRTCMTE" style="width:80%; height:22px;"></select><br>';
  1118. iHTML += '<br>';
  1119. iHTML += 'Hide if:<br>';
  1120. iHTML += '<input type="checkbox" id="_cbEnableRTCDurationFilterLessThan">Duration less than </input>';
  1121. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRTCDurationLessThan"> days<br>';
  1122. iHTML += '<input type="checkbox" id="_cbEnableRTCDurationFilterMoreThan">Duration more than </input>';
  1123. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRTCDurationMoreThan"> days<br>';
  1124. iHTML += '<br><b>Filter by date/time:</b><br>';
  1125. iHTML += '<input type="checkbox" id="_cbRTCFilterShowForTS" pairedWith="_cbRTCFilterHideForTS">Show</input> or ';
  1126. iHTML += '<input type="checkbox" id="_cbRTCFilterHideForTS" pairedWith="_cbRTCFilterShowForTS">hide</input> RTCs active at<br>';
  1127. iHTML += 'Date: <input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterDay"> / ';
  1128. iHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterMonth"> / ';
  1129. iHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterYear"><br>';
  1130. iHTML += 'Time: <input type="number" min="0" max="23" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterHour">:';
  1131. iHTML += '<input type="number" min="0" max="59" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterMin">';
  1132. return iHTML;
  1133. },
  1134. PopulateRA: function()
  1135. {
  1136. let iHTML = '';
  1137. iHTML = '<br><b>Filter Restricted Areas:</b><br>';
  1138. iHTML += '<input type="checkbox" id="_cbShowSpecificRA">Show a specific area: </input>';
  1139. iHTML += '<select id="_selectRA" style="width:80%; height:22px;"></select><br><br>';
  1140.  
  1141. iHTML += '<input type="checkbox" id="_cbRAEditorIDFilter">Show areas edited by user: </input>';
  1142. iHTML += '<select id="_selectRAEditorID" style="width:80%; height:22px;"></select><br><br>';
  1143.  
  1144. iHTML += 'Hide if:<br>';
  1145. iHTML += '<input type="checkbox" id="_cbEnableRAAgeFilterLessThan">Last modified less than </input>';
  1146. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRAAgeLessThan"> days ago<br>';
  1147. iHTML += '<input type="checkbox" id="_cbEnableRAAgeFilterMoreThan">Last modified more than </input>';
  1148. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRAAgeMoreThan"> days ago<br>';
  1149. return iHTML;
  1150. },
  1151. PopulateMisc: function()
  1152. {
  1153. let iHTML = '';
  1154. iHTML += '<br><b><input type="checkbox" id="_cbHideSegmentsWhenRoadsHidden" />Hide segment layer when road layer is hidden</b><br>';
  1155. iHTML += '<br><b><input type="checkbox" id="_cbKillInertialPanning" />Stop inertial panning when mouse moves out of map area</b><br>';
  1156.  
  1157. iHTML += '<br><br><b><input type="checkbox" id="_cbCommentCount" />Show comment count on UR markers</b><br>';
  1158.  
  1159. iHTML += '<br><br><b><input type="checkbox" id="_cbAutoApplyClonedClosure" />Auto-apply cloned closures</b><br>';
  1160. iHTML += '<b><input type="checkbox" id="_cbAutoScrollClosureList" />Auto-scroll to end of closures</b><br>';
  1161.  
  1162. iHTML += '<br><br><b>Disable filtering above zoom level </b>';
  1163. iHTML += '<input type="number" min="12" max="22" value="22" size="2" style="width:50px;;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMinZoomLevel" /><br>';
  1164.  
  1165. iHTML += '<br><br><b>Marker Unstacking:</b><br>';
  1166. iHTML += 'Distance threshold: <input type="number" min="1" max="30" value="15" size="2" style="width:50px;;line-height:14px;height:22px;margin-bottom:4px;" id="_inputUnstackSensitivity" /><br>';
  1167. iHTML += 'Disable below zoom: <input type="number" min="12" max="22" value="15" size="2" style="width:50px;;line-height:14px;height:22px;margin-bottom:4px;" id="_inputUnstackZoomLevel" /><br>';
  1168.  
  1169. iHTML += '<br><br><b>Popup mouse behaviour:</b><br>';
  1170. iHTML += 'Mouseover show delay <input type="number" min="1" max="10" value="2" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputPopupEntryTimeout" /> *100ms<br>';
  1171. iHTML += 'Mouseout hide delay <input type="number" min="1" max="10" value="2" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputPopupExitTimeout" /> *100ms<br>';
  1172. iHTML += 'Auto-hide after <input type="number" min="0" max="10" value="0" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputPopupAutoHideTimeout" /> seconds<br>';
  1173.  
  1174. iHTML += '<br><br><b>Disable clustering for:</b><br>';
  1175. iHTML += '<input type="checkbox" id="_cbInhibitURClusters" />URs<br>';
  1176. iHTML += '<input type="checkbox" id="_cbInhibitMPClusters" />MPs<br>';
  1177. iHTML += '<input type="checkbox" id="_cbInhibitPUClusters" />PURs<br>';
  1178. iHTML += '<input type="checkbox" id="_cbInhibitESClusters" />ESs<br>';
  1179.  
  1180. iHTML += '<br><br><b>Disable popup for:</b><br>';
  1181. iHTML += '<input type="checkbox" id="_cbInhibitURPopup" />URs<br>';
  1182. iHTML += '<input type="checkbox" id="_cbInhibitMPPopup" />MPs<br>';
  1183. ////iHTML += '<input type="checkbox" id="_cbInhibitCamPopup" />Cameras<br>';
  1184. iHTML += '<input type="checkbox" id="_cbInhibitSegPopup" />Segments<br>';
  1185. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbInhibitSegGenericPopup" />Speed limit info<br>';
  1186. iHTML += '<input type="checkbox" id="_cbInhibitLandmarkPopup" />Places<br>';
  1187. iHTML += '<input type="checkbox" id="_cbInhibitPUPopup" />Place Updates<br>';
  1188. iHTML += '<input type="checkbox" id="_cbInhibitMapCommentPopup" />Map Comments<br>';
  1189. iHTML += '<input type="checkbox" id="_cbInhibitNodesPopup" />Junction Nodes<br>';
  1190.  
  1191. iHTML += '<br><br><b>Date/Time formatting for popups:</b><br>';
  1192. iHTML += '<input type="checkbox" id="_cbDateFmtDDMMYY" pairedWith="_cbDateFmtMMDDYY,_cbDateFmtYYMMDD" checked />day/month/year<br>';
  1193. iHTML += '<input type="checkbox" id="_cbDateFmtMMDDYY" pairedWith="_cbDateFmtDDMMYY,_cbDateFmtYYMMDD" />month/day/year<br>';
  1194. iHTML += '<input type="checkbox" id="_cbDateFmtYYMMDD" pairedWith="_cbDateFmtMMDDYY,_cbDateFmtDDMMYY" />year/month/day<br><br>';
  1195. iHTML += '<input type="checkbox" id="_cbTimeFmt24H" pairedWith="_cbTimeFmt12H" checked />24 hour<br>';
  1196. iHTML += '<input type="checkbox" id="_cbTimeFmt12H" pairedWith="_cbTimeFmt24H" />12 hour<br><br>';
  1197. iHTML += '<i>Unticked uses browser default setting</i>';
  1198.  
  1199. iHTML += '<br><br><b><input type="checkbox" id="_cbWhiteBackground" />Use custom background colour</b><br>';
  1200. iHTML += 'R:<input type="number" min="0" max="255" value="255" size="3" style="width:50px;;line-height:14px;height:22px;margin-bottom:4px;" id="_inputCustomBackgroundRed" />';
  1201. iHTML += 'G:<input type="number" min="0" max="255" value="255" size="3" style="width:50px;;line-height:14px;height:22px;margin-bottom:4px;" id="_inputCustomBackgroundGreen" />';
  1202. iHTML += 'B:<input type="number" min="0" max="255" value="255" size="3" style="width:50px;;line-height:14px;height:22px;margin-bottom:4px;" id="_inputCustomBackgroundBlue" /><br>';
  1203.  
  1204. iHTML += '<br><br><b>Replace "Next ..." button with "Done" for:</b><br>';
  1205. iHTML += '<input type="checkbox" id="_cbInhibitNURButton" />URs<br>';
  1206. iHTML += '<input type="checkbox" id="_cbInhibitNMPButton" />MPs<br>';
  1207. iHTML += '<input type="checkbox" id="_cbInhibitNPURButton" />PURs<br>';
  1208.  
  1209. iHTML += '<br><br><b>Disable on-click recentering for:</b><br>';
  1210. iHTML += '<input type="checkbox" id="_cbInhibitURCentering" />URs<br>';
  1211. iHTML += '<input type="checkbox" id="_cbInhibitMPCentering" />MPs<br>';
  1212. iHTML += '<input type="checkbox" id="_cbInhibitPURCentering" />PURs<br>';
  1213. iHTML += '<input type="checkbox" id="_cbInhibitPPURCentering" />PPURs<br>';
  1214. iHTML += '<input type="checkbox" id="_cbInhibitRPURCentering" />RPURs<br>';
  1215.  
  1216. iHTML += '<br><br><b><input type="checkbox" id="_cbHideAMLayer" />Hide Area Manager polygons</b><br>';
  1217. iHTML += '<b><input type="checkbox" id="_cbMoveAMList" />Show AMs in topbar when AM layer is active</b><br>';
  1218. iHTML += 'Hide areas for AM levels:<br>';
  1219. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAMA-L1">L1</input>';
  1220. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAMA-L2">L2</input>';
  1221. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAMA-L3">L3</input>';
  1222. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAMA-L4">L4</input>';
  1223. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAMA-L5">L5</input>';
  1224. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAMA-L6">L6</input>';
  1225. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAMA-L7">L7</input><br>';
  1226. iHTML += 'Hide areas by age:<br>';
  1227. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbEnableAMAMinAgeFilter">Less than </input>';
  1228. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterAMA-MinDays"> days old<br>';
  1229. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbEnableAMAMaxAgeFilter">More than </input>';
  1230. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterAMA-MaxDays"> days old<br>';
  1231.  
  1232. iHTML += '<br><b><input type="checkbox" id="_cbDisablePlacesFiltering" />Disable Places filtering</b><br>';
  1233.  
  1234. iHTML += '<br><br><b>Settings backup/restore/reset:</b><br>';
  1235. iHTML += '<input type="button" id="_btnSettingsToText" value="Backup" />&nbsp;&nbsp;&nbsp;';
  1236. iHTML += '<input type="button" id="_btnTextToSettings" value="Restore" />&nbsp;&nbsp;|&nbsp;&nbsp;';
  1237. iHTML += '<input type="button" id="_btnResetSettings" value="Reset" /><br><br>';
  1238. iHTML += '<textarea id="_txtSettings" value=""></textarea><br>';
  1239. iHTML += '<input type="button" id="_btnClearSettingsText" value="Clear" /><br>';
  1240.  
  1241. /*
  1242. iHTML += '<br><br><b>Debug:</b><br>';
  1243. iHTML += '<input type="button" id="_btnDebugToScreen" value="Show debug data" />';
  1244. */
  1245. return iHTML;
  1246. },
  1247. ActiveTab: function(_id)
  1248. {
  1249. let e = document.getElementById(_id);
  1250. e.style.backgroundColor = "greenyellow";
  1251. e.style.borderTop = "1px solid";
  1252. e.style.borderLeft = "1px solid";
  1253. e.style.borderRight = "1px solid";
  1254. e.style.borderBottom = "0px solid";
  1255. },
  1256. InactiveTab: function(_id)
  1257. {
  1258. let e = document.getElementById(_id);
  1259. e.style.backgroundColor = "gainsboro";
  1260. e.style.borderTop = "0px solid";
  1261. e.style.borderLeft = "0px solid";
  1262. e.style.borderRight = "0px solid";
  1263. e.style.borderBottom = "1px solid";
  1264. },
  1265. InactiveAllTabs: function()
  1266. {
  1267. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1268. {
  1269. uroTabs.InactiveTab(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABHEADER]);
  1270. uroTabs.SetStyleDisplay(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY], 'none');
  1271. }
  1272. },
  1273. ShowTab: function(tabID)
  1274. {
  1275. uroTabs.InactiveAllTabs();
  1276. uroTabs.ActiveTab(uroTabs.CtrlTabs[tabID][uroTabs.FIELDS.TABHEADER]);
  1277. uroTabs.SetStyleDisplay(uroTabs.CtrlTabs[tabID][uroTabs.FIELDS.TABBODY], 'block');
  1278. return false;
  1279. },
  1280. ShowURs: function()
  1281. {
  1282. uroTabs.ShowTab(uroTabs.IDS.URS);
  1283. return false;
  1284. },
  1285. ShowMPs: function()
  1286. {
  1287. uroTabs.ShowTab(uroTabs.IDS.MPS);
  1288. return false;
  1289. },
  1290. ShowMCs: function()
  1291. {
  1292. uroTabs.ShowTab(uroTabs.IDS.MCS);
  1293. return false;
  1294. },
  1295. ShowPlaces: function()
  1296. {
  1297. uroTabs.ShowTab(uroTabs.IDS.PLACES);
  1298. for(let idx=0;idx<uroPlacesGroupsCollapsed.length;idx++)
  1299. {
  1300. uroPlacesGroupCEHandler(idx);
  1301. }
  1302. return false;
  1303. },
  1304. ShowCams: function()
  1305. {
  1306. uroTabs.ShowTab(uroTabs.IDS.CAMS);
  1307. return false;
  1308. },
  1309. ShowMisc: function()
  1310. {
  1311. uroTabs.ShowTab(uroTabs.IDS.MISC);
  1312. return false;
  1313. },
  1314. ShowRTCs: function()
  1315. {
  1316. uroTabs.ShowTab(uroTabs.IDS.RTCS);
  1317. return false;
  1318. },
  1319. ShowRAs: function()
  1320. {
  1321. uroTabs.ShowTab(uroTabs.IDS.RAS);
  1322. return false;
  1323. },
  1324. ClickURs: function()
  1325. {
  1326. uroFilterURs();
  1327. },
  1328. ClickMPs: function()
  1329. {
  1330. uroFilterProblems();
  1331. },
  1332. ClickMCs: function()
  1333. {
  1334. uroFilterMapComments();
  1335. uroLayers.MCLayerChanged();
  1336. },
  1337. ClickPlaces: function()
  1338. {
  1339. uroFilterPlaces();
  1340. },
  1341. ClickCams: function()
  1342. {
  1343. uroFilterCameras();
  1344. },
  1345. ClickMisc: function()
  1346. {
  1347. uroFilterItems();
  1348. uroUITweaks.ChangeMapBGColour();
  1349. uroUITweaks.HideAMLayer();
  1350. uroUITweaks.HideSegments();
  1351. uroUITweaks.ChangeClustering();
  1352. },
  1353. ClickRTCs: function()
  1354. {
  1355. uroFilterRTCs();
  1356. uroClosureListHandler();
  1357. },
  1358. ClickRAs: function()
  1359. {
  1360. uroFilterRAs();
  1361. },
  1362. CreateTabHeaders: function()
  1363. {
  1364. uroTabs.CtrlTabs =
  1365. [
  1366. ['_tabURs', null, '_linkURs', 'URs', uroTabs.ShowURs, uroTabs.ClickURs, 'UROverviewUROptions', uroTabs.PopulateUR],
  1367. ['_tabMPs', null, '_linkMPs', 'MPs', uroTabs.ShowMPs, uroTabs.ClickMPs, 'UROverviewMPOptions', uroTabs.PopulateMP],
  1368. ['_tabMCs', null, '_linkMCs', 'MCs', uroTabs.ShowMCs, uroTabs.ClickMCs, 'UROverviewMCOptions', uroTabs.PopulateMC],
  1369. ['_tabRTCs', null, '_linkRTCs', 'RTCs', uroTabs.ShowRTCs, uroTabs.ClickRTCs, 'UROverviewRTCOptions', uroTabs.PopulateRTC],
  1370. ['_tabRAs', null, '_linkRAs', 'RAs', uroTabs.ShowRAs, uroTabs.ClickRAs, 'UROverviewRAOptions', uroTabs.PopulateRA],
  1371. ['_tabPlaces', null, '_linkPlaces', 'Places', uroTabs.ShowPlaces, uroTabs.ClickPlaces, 'UROverviewPlacesOptions', uroTabs.PopulatePlaces],
  1372. ////['_tabCams', null, '_linkCams', 'Cams', uroTabs.ShowCams, uroTabs.ClickCams, 'UROverviewCameraOptions', uroTabs.PopulateCams],
  1373. ['_tabMisc', null, '_linkMisc', 'Misc', uroTabs.ShowMisc, uroTabs.ClickMisc, 'UROverviewMiscOptions', uroTabs.PopulateMisc]
  1374. ];
  1375.  
  1376. let i;
  1377. let tabsTotal = uroTabs.CtrlTabs.length;
  1378. let tabsPerRow = Math.ceil(tabsTotal / Math.ceil(tabsTotal / uroTabs.MAX_PER_ROW));
  1379. let tabCount = 0;
  1380. let tabbyHTML = '';
  1381. for(i = 0; i < tabsTotal; ++i)
  1382. {
  1383. if(tabCount == 0)
  1384. {
  1385. tabbyHTML += '<table border=0 width="100%"><tr>';
  1386. }
  1387. tabbyHTML += '<td valign="center" align="center" id="'+uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABHEADER]+'">';
  1388. tabbyHTML += '<a href="#" id="'+uroTabs.CtrlTabs[i][uroTabs.FIELDS.LINKID]+'" style="text-decoration:none;font-size:12px">'+uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABTITLE]+'</a></td>';
  1389. if(((++tabCount == tabsPerRow) && (i < (tabsTotal - 1))) || (i == (tabsTotal - 1)))
  1390. {
  1391. tabbyHTML += '</tr></table>';
  1392. tabCount = 0;
  1393. }
  1394. }
  1395. return tabbyHTML;
  1396. },
  1397. CreateTabBodies: function()
  1398. {
  1399. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1400. {
  1401. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY] = document.createElement('div');
  1402. }
  1403. },
  1404. AddToDOM: function()
  1405. {
  1406. let i;
  1407. for(i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1408. {
  1409. if(uroTabs.CtrlTabs[i][uroTabs.FIELDS.POPULATEFN] != null)
  1410. {
  1411. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY].innerHTML = uroTabs.CtrlTabs[i][uroTabs.FIELDS.POPULATEFN]();
  1412. }
  1413. document.getElementById('uroControlsContainer').appendChild(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  1414. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY].onclick = uroTabs.CtrlTabs[i][uroTabs.FIELDS.CLICKFN];
  1415. }
  1416. }
  1417. };
  1418. const uroDBG = // debug output handling
  1419. {
  1420. // true enables debug output during script startup
  1421. showDebugOutput: true,
  1422. // true keeps debug output enabled after script startup
  1423. persistentDebugOutput: false,
  1424. // true enables performance monitoring debug output
  1425. performanceMonitoringOutput: false,
  1426.  
  1427. recentDebug: [],
  1428.  
  1429. Add: function(debugtext)
  1430. {
  1431. let ts = Math.round(performance.now());
  1432. if(uroDBG.recentDebug.length == 100)
  1433. {
  1434. uroDBG.recentDebug.shift();
  1435. }
  1436. uroDBG.recentDebug.push(ts+': '+debugtext);
  1437. console.debug('URO+DBG '+ts+':'+debugtext);
  1438. },
  1439. Dump: function()
  1440. {
  1441. if(uroDBG.recentDebug.length > 0)
  1442. {
  1443. document.getElementById('WazeMap').innerHTML = uroUtils.ModifyHTML('<textarea id="uroDbgOutput" style="width:100%;height:100%">');
  1444. let dbgOutput = '';
  1445. for(let i = 0; i < uroDBG.recentDebug.length; i++)
  1446. {
  1447. dbgOutput += uroDBG.recentDebug[i]+'\n';
  1448. }
  1449. document.getElementById('uroDbgOutput').textContent = dbgOutput;
  1450. }
  1451. },
  1452. Toggle: function()
  1453. {
  1454. uroDBG.showDebugOutput = !uroDBG.showDebugOutput;
  1455. let dbgMode = "none";
  1456. if(uroDBG.showDebugOutput)
  1457. {
  1458. dbgMode = "inline";
  1459. }
  1460. document.getElementById('_uroDebugMode').style.display = dbgMode;
  1461. },
  1462. PerfMon: function(source, ts)
  1463. {
  1464. if(uroDBG.performanceMonitoringOutput === true)
  1465. {
  1466. console.log(source+': '+(performance.now() - ts));
  1467. }
  1468. },
  1469. AddLog: function(logtext)
  1470. {
  1471. if(uroDBG.showDebugOutput) console.log('URO+: '+Date()+' '+logtext);
  1472. }
  1473. };
  1474. const uroAFN = // area friendly name functions
  1475. {
  1476. friendlyNames: [],
  1477. hoverTime: -1,
  1478. hoverObj: null,
  1479. overlayShown: false,
  1480. editHovered: false,
  1481. editBox: null,
  1482. friendlyAreaNames: null,
  1483. AFNObject: function(fName, area, server)
  1484. {
  1485. this.fName = fName;
  1486. this.area = area;
  1487. this.server = server;
  1488. },
  1489. UpdateName: function(name, server, area)
  1490. {
  1491. let foundExisting = false;
  1492. for(let i = 0; i < uroAFN.friendlyNames.length; i++)
  1493. {
  1494. if((uroAFN.friendlyNames[i].server == server) && (uroAFN.friendlyNames[i].area == area))
  1495. {
  1496. if(name === "")
  1497. {
  1498. this.friendlyNames.splice(i, 1);
  1499. foundExisting = true;
  1500. }
  1501. else
  1502. {
  1503. uroAFN.friendlyNames[i].fName = name;
  1504. foundExisting = true;
  1505. }
  1506. }
  1507. }
  1508. if((foundExisting === false) && (name !== ""))
  1509. {
  1510. uroAFN.friendlyNames.push(new uroAFN.AFNObject(name, area, server));
  1511. }
  1512. uroAFN.ReplaceAreaNames(true);
  1513. },
  1514. AreaNameHover: function()
  1515. {
  1516. if((uroAFN.hoverObj === null) || (uroAFN.hoverObj != this))
  1517. {
  1518. uroAFN.hoverTime = 0;
  1519. }
  1520. uroAFN.hoverObj = this;
  1521. },
  1522. AreaNameUnHover: function()
  1523. {
  1524. if(uroAFN.editHovered === true)
  1525. {
  1526. return false;
  1527. }
  1528. if(uroAFN.overlayShown)
  1529. {
  1530. uroAFN.hoverObj.removeChild(uroAFN.editBox);
  1531. }
  1532. uroAFN.hoverObj = null;
  1533. uroAFN.hoverTime = -1;
  1534. uroAFN.overlayShown = false;
  1535. },
  1536. EditHover: function()
  1537. {
  1538. uroAFN.editHovered = true;
  1539. uroUtils.AddEventListener('uroANEditBox', 'mouseout', uroAFN.EditUnHover, false);
  1540. uroUtils.AddEventListener('uroANEditBox', 'click', uroAFN.EditClick, false);
  1541. },
  1542. EditUnHover: function()
  1543. {
  1544. let newName = document.getElementById('_textAreaName').value;
  1545. // sanitise name to avoid conflicts with config storage delimiters...
  1546. newName = newName.replace(',','');
  1547. newName = newName.replace(':','');
  1548. let server = W.app.getAppRegionCode();
  1549. let area = uroAFN.GetAreaArea(uroAFN.hoverObj.parentNode.children[1].innerText);
  1550. uroAFN.hoverObj.removeChild(uroAFN.editBox);
  1551. uroAFN.overlayShown = false;
  1552. uroAFN.editHovered = false;
  1553. uroAFN.UpdateName(newName, server, area);
  1554. },
  1555. EditClick: function(e)
  1556. {
  1557. // this traps the click to prevent it falling through to the underlying area name element and
  1558. // potentially causing the map view to be relocated to that area...
  1559. e.stopPropagation();
  1560. },
  1561. GetAreaArea: function(area)
  1562. {
  1563. area = parseFloat(area.split(' ')[0]);
  1564. return area;
  1565. },
  1566. OverlaySetup: function()
  1567. {
  1568. uroAFN.overlayShown = true;
  1569. uroAFN.editBox = document.createElement('div');
  1570. uroAFN.editBox.id = "uroANEditBox";
  1571. uroAFN.editBox.style.position = "absolute";
  1572. uroAFN.editBox.style.top = '0px';
  1573. uroAFN.editBox.style.left = '0px';
  1574. uroAFN.editBox.style.width = "99%";
  1575. uroAFN.hoverObj.appendChild(uroAFN.editBox);
  1576. uroAFN.editBox.onmouseover = uroAFN.EditHover();
  1577. let existingName = uroAFN.hoverObj.innerHTML;
  1578. let italicTagPos = existingName.indexOf(' <i>');
  1579. if(italicTagPos == -1)
  1580. {
  1581. existingName = "";
  1582. }
  1583. else
  1584. {
  1585. existingName = existingName.substr(0,italicTagPos);
  1586. }
  1587. uroAFN.editBox.innerHTML = uroUtils.ModifyHTML('<input type="text" style="font-size:14px; line-height:16px; height:22px; width:100%" id="_textAreaName" value="'+existingName+'">');
  1588. },
  1589. ReplaceAreaNames: function(replaceAfterNameChange)
  1590. {
  1591. if(document.getElementById('sidepanel-areas') === undefined)
  1592. {
  1593. return;
  1594. }
  1595. if(document.getElementById('sidepanel-areas').getElementsByClassName('result-list').length === 0)
  1596. {
  1597. return;
  1598. }
  1599. if(replaceAfterNameChange === false)
  1600. {
  1601. if(document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0].id == "friendlyNamed")
  1602. {
  1603. return;
  1604. }
  1605. }
  1606. let panelRootObj = document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0];
  1607. if(panelRootObj === undefined)
  1608. {
  1609. // we get here if the user doesn't have any areas defined...
  1610. return;
  1611. }
  1612. let areaNameObjs = panelRootObj.getElementsByClassName('list-item-card-info');
  1613. if(areaNameObjs.length === 0)
  1614. {
  1615. return;
  1616. }
  1617. let localisedManagedArea = I18n.lookup("user.areas.managed_area");
  1618. for(let loop=0; loop < areaNameObjs.length; loop++)
  1619. {
  1620. if(areaNameObjs[loop].children.length === 2)
  1621. {
  1622. let title = areaNameObjs[loop].children[0].innerText;
  1623. if(title.indexOf(localisedManagedArea) > -1)
  1624. {
  1625. let area = uroAFN.GetAreaArea(areaNameObjs[loop].children[1].innerText);
  1626. areaNameObjs[loop].children[0].innerHTML = uroUtils.ModifyHTML(localisedManagedArea);
  1627. for(let fnIdx=0; fnIdx < uroAFN.friendlyNames.length; fnIdx++)
  1628. {
  1629. let fnObj = uroAFN.friendlyNames[fnIdx];
  1630. if((fnObj.area == area) && (fnObj.server == W.app.getAppRegionCode()))
  1631. {
  1632. areaNameObjs[loop].children[0].innerHTML = uroUtils.ModifyHTML(fnObj.fName +' <i>('+localisedManagedArea+')</i>');
  1633. break;
  1634. }
  1635. }
  1636. let titleObj = areaNameObjs[loop].getElementsByClassName('list-item-card-title')[0];
  1637. titleObj.addEventListener("mouseover", uroAFN.AreaNameHover, false);
  1638. titleObj.addEventListener("mouseout", uroAFN.AreaNameUnHover, false);
  1639. titleObj.style.cursor = "text";
  1640. }
  1641. }
  1642. }
  1643. document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0].id = "friendlyNamed";
  1644. },
  1645. ApplyNames: function()
  1646. {
  1647. let objects = localStorage.UROverviewFriendlyAreaNames.split(':');
  1648. uroAFN.friendlyNames = [];
  1649. for(let objIdx=0;objIdx<objects.length;objIdx++)
  1650. {
  1651. let fields = objects[objIdx].split(',');
  1652. uroAFN.friendlyNames.push(new uroAFN.AFNObject(fields[0],parseFloat(fields[1]),fields[2]));
  1653. }
  1654. uroAFN.ReplaceAreaNames(true);
  1655. }
  1656. };
  1657. const uroMarkers = // marker-related function
  1658. {
  1659. elm : null,
  1660. obj : null,
  1661. id : null,
  1662. type : null,
  1663. lastOver : null,
  1664.  
  1665. mouseX : null,
  1666. mouseY : null,
  1667. mouseButtons : null,
  1668. clientX : null,
  1669. clientY : null,
  1670. armHover : false,
  1671. pEntryTimeout : null,
  1672. inhibitSetCenter : false,
  1673. clickedOnCenter : null,
  1674. clickedOnID : null,
  1675.  
  1676. EntryTimeout: function()
  1677. {
  1678. uroMarkers.armHover = false;
  1679. if(uroMarkers.lastOver !== null)
  1680. {
  1681. if(uroMarkers.type === 'cam')
  1682. {
  1683. if(uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams') === true)
  1684. {
  1685. if(uroMarkers.lastOver !== uroMarkers.id)
  1686. {
  1687. window.setTimeout(uroFilterCameras, 50);
  1688. }
  1689. }
  1690. }
  1691. else if((uroMarkers.type == uroLayers.ID.UR) || (uroMarkers.type == uroLayers.ID.MP))
  1692. {
  1693. if(uroMarkers.type == uroLayers.ID.UR) uroHoveredURID = uroMarkers.id;
  1694. }
  1695.  
  1696. uroDBG.AddLog('hover over marker (Type ' + uroMarkers.type + ' / ID ' + uroMarkers.id + ')');
  1697. uroPopup.Generate();
  1698. }
  1699. },
  1700. MouseMove: function(e)
  1701. {
  1702. uroMarkers.buttons = e.buttons;
  1703. uroMarkers.mouseX = e.pageX - document.getElementById('map').getBoundingClientRect().left;
  1704. uroMarkers.mouseY = e.pageY - document.getElementById('map').getBoundingClientRect().top;
  1705. uroMarkers.clientX = e.clientX;
  1706. uroMarkers.clientY = e.clientY;
  1707.  
  1708. if(uroMarkers.armHover === true)
  1709. {
  1710. if(uroMarkers.pEntryTimeout !== null)
  1711. {
  1712. window.clearTimeout(uroMarkers.pEntryTimeout);
  1713. }
  1714. let eto = uroUtils.GetElmValue('_inputPopupEntryTimeout') * 100;
  1715. if(uroStackType !== null)
  1716. {
  1717. eto = 1;
  1718. }
  1719. uroMarkers.pEntryTimeout = window.setTimeout(uroMarkers.EntryTimeout, eto);
  1720. }
  1721. },
  1722. TranslateType: function(ft)
  1723. {
  1724. const TLU =
  1725. [
  1726. ["mapProblem", uroLayers.ID.MP],
  1727. ["mapUpdateRequest", uroLayers.ID.UR],
  1728. ["placeUpdate", uroLayers.ID.VPUR],
  1729. ["editSuggestionIcon", uroLayers.ID.EditSug],
  1730. ["segmentSuggestionGeoIcon", uroLayers.ID.SegSug],
  1731. ["camera", "cam"],
  1732. ["node", "node"],
  1733. ["comment", "comment"],
  1734. ["venue", "venue"],
  1735. ["segment", "segment"]
  1736. ];
  1737.  
  1738. let retval = null;
  1739. for(let i = 0; i < TLU.length; ++i)
  1740. {
  1741. if(ft == TLU[i][0])
  1742. {
  1743. retval = TLU[i][1];
  1744. break;
  1745. }
  1746. }
  1747. return retval;
  1748. },
  1749. MouseOver: function(e)
  1750. {
  1751. let elm = null;
  1752. let obj = null;
  1753. let id = null;
  1754. let markerType = null;
  1755. let ft = e?.feature?.attributes?.wazeFeature?.featureType;
  1756. if(ft !== undefined)
  1757. {
  1758. // single marker...
  1759. obj = e.feature.attributes.wazeFeature._wmeObject;
  1760. elm = W.userscripts.getMapElementByDataModel(obj);
  1761. id = e.feature.attributes.wazeFeature.id;
  1762. markerType = uroMarkers.TranslateType(ft);
  1763. uroMarkers.elm = elm;
  1764. uroMarkers.obj = obj;
  1765. uroMarkers.id = id;
  1766. uroMarkers.type = markerType;
  1767. uroMarkers.lastOver = id;
  1768. uroMarkers.armHover = true;
  1769.  
  1770. uroMarkers.AddMarkerEventHandler();
  1771. }
  1772. /*
  1773. else
  1774. {
  1775. if(e?.feature?.cluster !== undefined)
  1776. {
  1777. // cluster marker...
  1778. let cm = e.feature.cluster;
  1779. if(cm.length > 0)
  1780. {
  1781. // clusters are always of the same type, so just need to check the
  1782. // first marker within the cluster to see what the type is for all
  1783. // of them...
  1784. ft = cm[0].attributes.wazeFeature.featureType;
  1785. markerType = uroMarkers.TranslateType(ft);
  1786.  
  1787. console.debug("Cluster Marker:");
  1788. console.debug(" Type = " + ft);
  1789. console.debug(" Cluster size = " + cm.length);
  1790. console.debug(e);
  1791. }
  1792. }
  1793. }
  1794. */
  1795. },
  1796. MouseOver2: function(e)
  1797. {
  1798. let elm = null;
  1799. let obj = null;
  1800. let id = null;
  1801. let markerType = null;
  1802. let ft = e?.currentTarget?.attributes?.class?.value;
  1803. if(ft !== undefined)
  1804. {
  1805. elm = e.currentTarget;
  1806. if(ft.indexOf("permanentHazardMarker") !== -1)
  1807. {
  1808. elm = elm.parentNode;
  1809. markerType = "phCam";
  1810. }
  1811. obj = W.userscripts.getDataModelByMapElement(elm);
  1812. id = elm.attributes["data-id"].value;
  1813.  
  1814. console.debug(ft);
  1815. console.debug(id);
  1816.  
  1817. uroMarkers.elm = elm;
  1818. uroMarkers.obj = obj;
  1819. uroMarkers.id = id;
  1820. uroMarkers.type = markerType;
  1821. uroMarkers.lastOver = id;
  1822. uroMarkers.armHover = true;
  1823. }
  1824. },
  1825. RestackAfterMouseOut: function()
  1826. {
  1827. if(uroMarkers.lastOver === null)
  1828. {
  1829. let tStackType = uroStackType;
  1830. uroRestackMarkers();
  1831. uroFilterURs();
  1832. uroFilterProblems();
  1833. uroFilterPlaces();
  1834. }
  1835. },
  1836. MouseOut: function()
  1837. {
  1838. uroMarkers.lastOver = null;
  1839. if(uroMarkers.type !== null)
  1840. {
  1841. if(uroMarkers.type === 'cam')
  1842. {
  1843. if(uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams') === true)
  1844. {
  1845. window.setTimeout(uroFilterCameras, 50);
  1846. }
  1847. }
  1848. uroDBG.AddLog('hover off '+uroMarkers.type+' ID '+uroMarkers.id);
  1849. uroHoveredURID = null;
  1850.  
  1851. uroFID = -1;
  1852. if(uroStackType !== null)
  1853. {
  1854. window.setTimeout(uroMarkers.RestackAfterMouseOut, 100);
  1855. }
  1856.  
  1857. if(uroPopup.timer == -1)
  1858. {
  1859. uroPopup.timer = uroUtils.GetElmValue('_inputPopupExitTimeout');
  1860. }
  1861. }
  1862. else
  1863. {
  1864. uroDBG.AddLog('hover off unknown object...');
  1865. }
  1866. },
  1867. MouseOut2: function()
  1868. {
  1869. uroMarkers.lastOver = null;
  1870. if(uroMarkers.type !== null)
  1871. {
  1872. uroDBG.AddLog('hover off '+uroMarkers.type+' ID '+uroMarkers.id);
  1873. uroHoveredURID = null;
  1874. uroFID = -1;
  1875. if(uroPopup.timer == -1)
  1876. {
  1877. uroPopup.timer = uroUtils.GetElmValue('_inputPopupExitTimeout');
  1878. }
  1879. }
  1880. else
  1881. {
  1882. uroDBG.AddLog('hover off unknown object...');
  1883. }
  1884. },
  1885. MouseDown: function()
  1886. {
  1887. // Do this stuff in the mousedown event rather than the click event so we fire before any of the native
  1888. // click events - we need to ensure this happens for inhibiting marker centering, as we need to capture
  1889. // the markerType ahead of our interceptor function being called to deal with the centering...
  1890. if(uroMarkers.type !== null)
  1891. {
  1892. uroDBG.AddLog('clicked on '+uroMarkers.type+' marker '+uroMarkers.id);
  1893. uroMarkers.clickedOnID = uroMarkers.id;
  1894. uroMarkers.clickedOnCenter = W.map.getCenter();
  1895. uroInhibitURFiltering = true;
  1896. if(uroMarkers.inhibitSetCenter === false)
  1897. {
  1898. if(uroMarkers.Decentre() === true)
  1899. {
  1900. uroMarkers.inhibitSetCenter = true;
  1901. }
  1902. }
  1903. }
  1904. },
  1905. Decentre: function()
  1906. {
  1907. let inhibit = false;
  1908. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.UR) && (uroUtils.GetCBChecked("_cbInhibitURCentering")));
  1909. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.MP) && (uroUtils.GetCBChecked("_cbInhibitMPCentering")));
  1910. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.VPUR) && (uroUtils.GetCBChecked("_cbInhibitPURCentering")));
  1911. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.VPUR) && (uroUtils.GetCBChecked("_cbInhibitPPURCentering")));
  1912. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.VPUR) && (uroUtils.GetCBChecked("_cbInhibitRPURCentering")));
  1913. return inhibit;
  1914. },
  1915. RegisterEvents: function()
  1916. {
  1917. for(let i = 0; i < uroLayers.layers.length; ++i)
  1918. {
  1919. if(uroLayers.layers[i].regEvt === true)
  1920. {
  1921. if((uroLayers.layers[i].isFeature === true) || (uroLayers.layers[i].isFeature === null))
  1922. {
  1923. if(uroLayers.layers[i].l !== undefined)
  1924. {
  1925. uroLayers.layers[i].l.events.listeners["fe-feature-in"].push({func: uroMarkers.MouseOver});
  1926. uroLayers.layers[i].l.events.listeners["fe-feature-out"].push({func: uroMarkers.MouseOut});
  1927. }
  1928. else
  1929. {
  1930. console.debug(uroLayers[i]);
  1931. }
  1932. }
  1933. else if(uroLayers.layers[i].isFeature === false)
  1934. {
  1935. for(let j = 0; j < uroLayers.layers[i].mf.length; ++j)
  1936. {
  1937. let mMarker = uroLayers.layers[i].mf[j];
  1938. if(mMarker !== null)
  1939. {
  1940. let mIcon = null;
  1941. if(mMarker.element !== undefined)
  1942. {
  1943. if(uroLayers.layers[i].moChild === true)
  1944. {
  1945. mIcon = mMarker.element.firstChild;
  1946. }
  1947. else
  1948. {
  1949. mIcon = mMarker.element;
  1950. }
  1951. }
  1952. else if(mMarker.geometry !== undefined)
  1953. {
  1954. mIcon = document.querySelector('#'+mMarker.geometry.id);
  1955. }
  1956. else if(mMarker.tagName === "image")
  1957. {
  1958. mIcon = mMarker;
  1959. }
  1960. if((mIcon !== null) && (mIcon !== undefined))
  1961. {
  1962. mIcon.addEventListener("mouseover", uroMarkers.MouseOver2, true);
  1963. mIcon.addEventListener("mouseout", uroMarkers.MouseOut2, true);
  1964. }
  1965. }
  1966. }
  1967. }
  1968. }
  1969. }
  1970. },
  1971. AddMarkerEventHandler: function()
  1972. {
  1973. if
  1974. (
  1975. (uroMarkers.type === uroLayers.ID.UR) ||
  1976. (uroMarkers.type === uroLayers.ID.MP) ||
  1977. (uroMarkers.type === uroLayers.ID.VPUR)
  1978. )
  1979. {
  1980. let mMarker = uroGetMarker(uroMarkers.type, uroMarkers.id);
  1981. if(mMarker !== null)
  1982. {
  1983. let mIcon = null;
  1984. if(mMarker.element !== undefined)
  1985. {
  1986. mIcon = mMarker.element;
  1987. }
  1988. else if(mMarker.geometry !== undefined)
  1989. {
  1990. mIcon = document.querySelector('#'+mMarker.geometry.id);
  1991. }
  1992. else if(mMarker.tagName === "image")
  1993. {
  1994. mIcon = mMarker;
  1995. }
  1996. if((mIcon !== null) && (mIcon !== undefined))
  1997. {
  1998. mIcon.addEventListener("mousedown", uroMarkers.MouseDown, false);
  1999. }
  2000. }
  2001. }
  2002. }
  2003. };
  2004. const uroLayers = // layer functions
  2005. {
  2006. // -----------------------------------------------------------------
  2007. // NOTE CAREFULLY!
  2008. // The contents of layers and ID MUST, MUST, MUST, remain
  2009. // in sync at all times...
  2010. layers :
  2011. [
  2012. {name: "update_requests", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2013. {name: "mapProblems", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2014. {name: "place_updates", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2015. {name: "PARKING_PLACE_UPDATES", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2016. {name: "RESIDENTIAL_PLACE_UPDATES", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2017. {name: "closures", l: null, mf: null, isFeature: null, MO: null, regEvt: false, moChild: false, getMF: true},
  2018. {name: "nodes", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2019. {name: "segments", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2020. {name: "venues", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2021. {name: "mapComments", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2022. {name: "permanent_hazard_camera", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2023. {name: "closure_nodes", l: null, mf: null, isFeature: null, MO: null, regEvt: false, moChild: false, getMF: true},
  2024. {name: "turn_closure", l: null, mf: null, isFeature: null, MO: null, regEvt: false, moChild: false, getMF: true},
  2025. {name: "segment_suggestions_markers", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2026. {name: "edit_suggestions_markers", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2027. {name: "permanent_hazard_camera_markers", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: true, getMF: true}
  2028. ],
  2029. ID :
  2030. {
  2031. VPUR: -1, // used to indicate any type of PUR marker - not directly associated with any of the above layer definitions
  2032. UR: 0,
  2033. MP: 1,
  2034. PUR: 2,
  2035. PPUR: 3,
  2036. RPUR: 4,
  2037. RTC: 5,
  2038. node: 6,
  2039. seg: 7,
  2040. venue: 8,
  2041. MC: 9,
  2042. cam: 10,
  2043. RTCnode: 11,
  2044. TRTCnode: 12,
  2045. SegSug: 13,
  2046. EditSug: 14,
  2047. phCamera: 15
  2048. },
  2049. // -----------------------------------------------------------------
  2050.  
  2051. BlobMouseOut: function()
  2052. {
  2053. let blobType = this.attributes.uroBlobType;
  2054. if(blobType !== undefined)
  2055. {
  2056. let blobID = this.attributes.uroBlobID;
  2057. uroDBG.AddLog('hover off '+blobType+' ID '+blobID);
  2058. if(blobType == 'map_comment')
  2059. {
  2060. if(W.model.mapComments.objects[blobID] != undefined)
  2061. {
  2062. let geoID = W.model.mapComments.objects[blobID].attributes.geometry.id;
  2063. if(geoID.indexOf('Point') != -1)
  2064. {
  2065. // reapply visibility mods
  2066. let svgElm = document.getElementById(uroMCLayer.div.id+'_vroot');
  2067. for(let svgIdx = 0; svgIdx < svgElm.children.length; svgIdx++)
  2068. {
  2069. if(svgElm.children[svgIdx].id === geoID)
  2070. {
  2071. window.setTimeout(uroLayers.ReapplyPointMCVisibilityMods,10);
  2072. }
  2073. }
  2074. }
  2075. }
  2076. }
  2077. }
  2078. else
  2079. {
  2080. uroDBG.AddLog('hover off unknown blob...');
  2081. }
  2082. },
  2083. MCLayerChanged_changed: function()
  2084. {
  2085. uroLayers.MCLayerChanged();
  2086. },
  2087. MCLayerChanged_added: function()
  2088. {
  2089. uroLayers.MCLayerChanged();
  2090. },
  2091. MCLayerChanged_removed: function()
  2092. {
  2093. uroLayers.MCLayerChanged();
  2094. },
  2095. ReapplyPointMCVisibilityMods: function()
  2096. {
  2097. if(uroLayers.ApplyPointMCVisibilityMods() === false)
  2098. {
  2099. window.setTimeout(uroLayers.ReapplyPointMCVisibilityMods,100);
  2100. }
  2101. },
  2102. ApplyPointMCVisibilityMods: function()
  2103. {
  2104. let retval = true;
  2105. if(uroLayers.HasSelectedMCs() === true)
  2106. {
  2107. retval = false;
  2108. }
  2109. else
  2110. {
  2111. let svgElm = document.getElementById(uroMCLayer.div.id+'_vroot');
  2112. for(let svgIdx = 0; svgIdx < svgElm.children.length; svgIdx++)
  2113. {
  2114. let svgChild = svgElm.children[svgIdx];
  2115. if(svgChild.id.indexOf('Point') != -1)
  2116. {
  2117. if(uroUtils.GetCBChecked('_cbMCEnhancePointMCVisibility') === true)
  2118. {
  2119. if(svgChild.getAttribute('r') == 6)
  2120. {
  2121. svgChild.setAttribute('fill','#ffff00');
  2122. svgChild.setAttribute('fill-opacity',0.75);
  2123. svgChild.setAttribute('r',12);
  2124. svgChild.setAttribute('touchedByURO',true);
  2125. }
  2126. else if((svgChild.getAttribute('touchedByURO') === "true")&&(svgChild.getAttribute('fill') === '#ffff00'))
  2127. {
  2128. // do nothing...
  2129. }
  2130. else
  2131. {
  2132. retval = false;
  2133. break;
  2134. }
  2135. }
  2136. else
  2137. {
  2138. if((svgChild.getAttribute('touchedByURO') === "true")&&(svgChild.getAttribute('fill') === '#ffff00'))
  2139. {
  2140. svgChild.setAttribute('fill','#ffffff');
  2141. svgChild.setAttribute('fill-opacity',1);
  2142. svgChild.setAttribute('r',6);
  2143. svgChild.setAttribute('touchedByURO',false);
  2144. }
  2145. }
  2146. }
  2147. }
  2148. }
  2149. return retval;
  2150. },
  2151. HasSelectedMCs: function()
  2152. {
  2153. let retval = false;
  2154. for(let mcObj in W.model.mapComments.objects)
  2155. {
  2156. if(W.model.mapComments.objects[mcObj].isSelected() === true)
  2157. {
  2158. retval = true;
  2159. break;
  2160. }
  2161. }
  2162. return retval;
  2163. },
  2164. MCLayerChanged: function()
  2165. {
  2166. uroInit.WazeBits();
  2167. if(uroMCLayer != null)
  2168. {
  2169. if(uroLayers.HasSelectedMCs() === false)
  2170. {
  2171. uroDBG.AddLog('adding MC blob event handlers');
  2172. let mcModel = null;
  2173. for(let mObj=0; mObj<uroMCLayer.features.length; mObj++)
  2174. {
  2175. if(uroMCLayer.features[mObj]?.attributes?.wazeFeature?._wmeObject !== undefined)
  2176. {
  2177. mcModel = uroMCLayer.features[mObj].attributes.wazeFeature._wmeObject;
  2178. {
  2179. if(mcModel.selected !== true)
  2180. {
  2181. let mcBlobID = mcModel.attributes.geometry.id;
  2182. let mcID = mcModel.attributes.id;
  2183. let mcBlob = document.getElementById(mcBlobID);
  2184. if(mcBlob !== null)
  2185. {
  2186. mcBlob.addEventListener("mouseout", uroLayers.blobMouseOut, false);
  2187. mcBlob.attributes.uroBlobID = mcID;
  2188. mcBlob.attributes.uroBlobType = "map_comment";
  2189. uroDBG.AddLog('added handlers to MC '+mcID);
  2190. }
  2191. }
  2192. }
  2193. }
  2194. }
  2195. uroLayers.ApplyPointMCVisibilityMods();
  2196. }
  2197. else
  2198. {
  2199. uroDBG.AddLog('MC selected, handlers not added yet...');
  2200. }
  2201. uroFilterMapComments();
  2202. }
  2203. },
  2204. VenueLayerChanged: function()
  2205. {
  2206. uroDBG.AddLog('adding place blob event handlers');
  2207. for(let mObj=0; mObj<uroVenueLayer.features.length; mObj++)
  2208. {
  2209. // clicking on an area place now adds the polygon drag handles into the features[] array, so we need to test that
  2210. // the current array entry isn't referring to one of these handles before trying to access the attributes...
  2211. if(uroVenueLayer.features[mObj]?.attributes?.wazeFeature?._wmeObject !== undefined)
  2212. {
  2213. let mcBlobID = uroVenueLayer.features[mObj].attributes.wazeFeature._wmeObject.attributes.geometry.id;
  2214. let mcID = uroVenueLayer.features[mObj].attributes.wazeFeature._wmeObject.attributes.id;
  2215. let mcBlob = document.getElementById(mcBlobID);
  2216. if(mcBlob !== null)
  2217. {
  2218. mcBlob.addEventListener("mouseout", uroLayers.blobMouseOut, false);
  2219. mcBlob.attributes.uroBlobID = mcID;
  2220. mcBlob.attributes.uroBlobType = "place";
  2221. }
  2222. }
  2223. }
  2224. },
  2225. Observe_VenueLayer: function()
  2226. {
  2227. uroLayers.layers[uroLayers.ID.venue].MO.observe(uroVenueLayer.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2228. },
  2229. Observe_URLayer: function()
  2230. {
  2231. // As URs are now displayed as SVG image elements rather than HTML elements, and as WME likes to re-render them seemingly
  2232. // at random after they've been initially displayed, we hang the mutation observer off of the vectorRoot element, as this
  2233. // is the parent SVG element for the markers, and the MO therefore seems to trigger reliably on each change to that level
  2234. // of the SVG, including these random re-renders. It's obvious if these re-renders aren't being captured correctly, as it
  2235. // causes the comment count markers to randomly show up behind UR markers instead of always being in front of them...
  2236. uroLayers.layers[uroLayers.ID.UR].MO.observe(uroLayers.layers[uroLayers.ID.UR].l.renderer.vectorRoot,{childList: true, attributes : true, characterData : true, subtree: true});
  2237. },
  2238. URLayerChanged: function()
  2239. {
  2240. // Ignore any changes caused by unstacking markers...
  2241. if(uroStackType === null)
  2242. {
  2243. uroDBG.AddLog('UR layer change detected');
  2244. uroLayers.layers[uroLayers.ID.UR].MO.disconnect();
  2245. uroFilterURs();
  2246. uroLayers.Observe_URLayer();
  2247. }
  2248. },
  2249. PURLayerChanged: function()
  2250. {
  2251. uroDBG.AddLog('PUR layer change detected');
  2252. uroLayers.layers[uroLayers.ID.PUR].MO.disconnect();
  2253. uroFilterProblems();
  2254. uroLayers.Observe_PURLayer();
  2255. },
  2256. Observe_PURLayer: function()
  2257. {
  2258. uroLayers.layers[uroLayers.ID.PUR].MO.observe(uroLayers.layers[uroLayers.ID.PUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2259. },
  2260. PPURLayerChanged: function()
  2261. {
  2262. uroDBG.AddLog('PPUR layer change detected');
  2263. uroLayers.layers[uroLayers.ID.PPUR].MO.disconnect();
  2264. uroFilterProblems();
  2265. uroLayers.Observe_PPURLayer();
  2266. },
  2267. Observe_PPURLayer: function()
  2268. {
  2269. uroLayers.layers[uroLayers.ID.PPUR].MO.observe(uroLayers.layers[uroLayers.ID.PPUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2270. },
  2271. RPURLayerChanged: function()
  2272. {
  2273. uroDBG.AddLog('RPUR layer change detected');
  2274. uroLayers.layers[uroLayers.ID.RPUR].MO.disconnect();
  2275. uroFilterProblems();
  2276. uroLayers.Observe_RPURLayer();
  2277. },
  2278. Observe_RPURLayer: function()
  2279. {
  2280. uroLayers.layers[uroLayers.ID.RPUR].MO.observe(uroLayers.layers[uroLayers.ID.RPUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2281. },
  2282.  
  2283. RTCLayerChanged: function()
  2284. {
  2285. uroDBG.AddLog('reapplying closures filter');
  2286. uroLayers.layers[uroLayers.ID.RTC].MO.disconnect();
  2287. uroFilterRTCs();
  2288. uroLayers.Observe_RTCLayer();
  2289. },
  2290. Observe_RTCLayer: function()
  2291. {
  2292. uroLayers.layers[uroLayers.ID.RTC].MO.observe(uroLayers.layers[uroLayers.ID.RTC].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2293. },
  2294. RunChangeHandlers: function()
  2295. {
  2296. uroLayers.URLayerChanged();
  2297. uroLayers.PURLayerChanged();
  2298. uroLayers.PPURLayerChanged();
  2299. uroLayers.RPURLayerChanged();
  2300. uroLayers.VenueLayerChanged();
  2301. uroLayers.RTCLayerChanged();
  2302.  
  2303. uroLayers.MCLayerChanged();
  2304. },
  2305. InitialiseMOs: function()
  2306. {
  2307. uroLayers.layers[uroLayers.ID.UR].MO = new MutationObserver(uroLayers.URLayerChanged);
  2308. uroLayers.layers[uroLayers.ID.PUR].MO = new MutationObserver(uroLayers.PURLayerChanged);
  2309. uroLayers.layers[uroLayers.ID.PPUR].MO = new MutationObserver(uroLayers.PPURLayerChanged);
  2310. uroLayers.layers[uroLayers.ID.RPUR].MO = new MutationObserver(uroLayers.RPURLayerChanged);
  2311. uroLayers.layers[uroLayers.ID.venue].MO = new MutationObserver(uroLayers.VenueLayerChanged);
  2312. uroLayers.layers[uroLayers.ID.RTC].MO = new MutationObserver(uroLayers.RTCLayerChanged);
  2313. uroLayers.Observe_URLayer();
  2314. uroLayers.Observe_PURLayer();
  2315. uroLayers.Observe_PPURLayer();
  2316. uroLayers.Observe_RPURLayer();
  2317. uroLayers.Observe_VenueLayer();
  2318. uroLayers.Observe_RTCLayer();
  2319. },
  2320. GetMarkersOrFeatures: function(layerID)
  2321. {
  2322. let retval = null;
  2323. let findit = uroLayers.layers[layerID].l.features;
  2324. if(findit !== undefined)
  2325. {
  2326. retval = findit;
  2327. uroLayers.layers[layerID].isFeature = true;
  2328. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = features');
  2329. }
  2330. else
  2331. {
  2332. findit = uroLayers.layers[layerID].l.markers;
  2333. if(findit !== undefined)
  2334. {
  2335. retval = findit;
  2336. uroLayers.layers[layerID].isFeature = false;
  2337. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = markers');
  2338. }
  2339. }
  2340. if(retval === null)
  2341. {
  2342. uroLayers.layers[layerID].isFeature = null;
  2343. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = unknown :-/');
  2344. }
  2345. return retval;
  2346. },
  2347. Init: function()
  2348. {
  2349. for(let i = 0; i < uroLayers.layers.length; ++i)
  2350. {
  2351. uroLayers.layers[i].l = W.map.getLayerByUniqueName(uroLayers.layers[i].name);
  2352. if(uroLayers.layers[i].getMF === true)
  2353. {
  2354. uroLayers.layers[i].mf = uroLayers.GetMarkersOrFeatures(i);
  2355. }
  2356. }
  2357. }
  2358. };
  2359. const uroAlertBox = // alert box handling
  2360. {
  2361. stack: [],
  2362. tickAction: null,
  2363. crossAction: null,
  2364. inUse: false,
  2365. ABObj: function(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction)
  2366. {
  2367. this.headericon = headericon;
  2368. this.title = title;
  2369. this.content = content;
  2370. this.hasCross = hasCross;
  2371. this.tickText = tickText;
  2372. this.crossText = crossText;
  2373. this.tickAction = tickAction;
  2374. this.crossAction = crossAction;
  2375. },
  2376. Close: function()
  2377. {
  2378. document.getElementById('uroAlerts').childNodes[0].innerHTML = uroUtils.ModifyHTML('');
  2379. document.getElementById('uroAlerts').childNodes[1].innerHTML = uroUtils.ModifyHTML('');
  2380. document.getElementById('uroAlertTickBtnCaption').innerHTML = uroUtils.ModifyHTML('');
  2381. document.getElementById('uroAlertCrossBtnCaption').innerHTML = uroUtils.ModifyHTML('');
  2382. uroAlertBox.tickAction = null;
  2383. uroAlertBox.crossAction = null;
  2384. document.getElementById('uroAlerts').style.visibility = "hidden";
  2385. document.getElementById('uroAlertCrossBtn').style.visibility = "hidden";
  2386. uroAlertBox.inUse = false;
  2387. if(uroAlertBox.stack.length > 0)
  2388. {
  2389. uroAlertBox.BuildFromStack();
  2390. }
  2391. },
  2392. CloseWithTick: function()
  2393. {
  2394. if(typeof uroAlertBox.tickAction === 'function')
  2395. {
  2396. uroAlertBox.tickAction();
  2397. }
  2398. uroAlertBox.Close();
  2399. },
  2400. CloseWithCross: function()
  2401. {
  2402. if(typeof uroAlertBox.crossAction === 'function')
  2403. {
  2404. uroAlertBox.crossAction();
  2405. }
  2406. uroAlertBox.Close();
  2407. },
  2408. Show: function(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction)
  2409. {
  2410. uroAlertBox.stack.push(new uroAlertBox.ABObj(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction));
  2411. if(uroAlertBox.inUse === false)
  2412. {
  2413. uroAlertBox.BuildFromStack();
  2414. }
  2415. },
  2416. BuildFromStack: function()
  2417. {
  2418. uroAlertBox.inUse = true;
  2419. uroAlertBox.tickAction = null;
  2420. uroAlertBox.crossAction = null;
  2421. let titleContent = '<span style="font-size:14px;padding:2px;">';
  2422. titleContent += '<i class="fa '+uroAlertBox.stack[0].headericon+'"> </i>&nbsp;';
  2423. titleContent += uroAlertBox.stack[0].title;
  2424. titleContent += '</span>';
  2425. document.getElementById('uroAlerts').childNodes[0].innerHTML = uroUtils.ModifyHTML(titleContent);
  2426. document.getElementById('uroAlerts').childNodes[1].innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].content);
  2427. document.getElementById('uroAlertTickBtnCaption').innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].tickText);
  2428. if(uroAlertBox.stack[0].hasCross)
  2429. {
  2430. document.getElementById('uroAlertCrossBtnCaption').innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].crossText);
  2431. document.getElementById('uroAlertCrossBtn').style.visibility = "visible";
  2432. if(typeof uroAlertBox.stack[0].crossAction === "function")
  2433. {
  2434. uroAlertBox.crossAction = uroAlertBox.stack[0].crossAction;
  2435. }
  2436. }
  2437. else
  2438. {
  2439. document.getElementById('uroAlertCrossBtn').style.visibility = "hidden";
  2440. }
  2441. if(typeof uroAlertBox.stack[0].tickAction === "function")
  2442. {
  2443. uroAlertBox.tickAction = uroAlertBox.stack[0].tickAction;
  2444. }
  2445. document.getElementById('uroAlerts').style.visibility = "";
  2446. uroAlertBox.stack.shift();
  2447. }
  2448. };
  2449. const uroStartup = // startup messaging to users
  2450. {
  2451. ShowUpgradeNotes: function()
  2452. {
  2453. uroDBG.AddLog('let users know what\'s new in this release');
  2454.  
  2455. let releaseNotes = '';
  2456. releaseNotes += '<p>Thanks for installing URO+ '+uroRelease.version+' ('+uroRelease.date+')</p>';
  2457.  
  2458. let loop;
  2459. if(uroRelease.changes.length > 0)
  2460. {
  2461. releaseNotes += '<br>Changes since the last release:<br>';
  2462. releaseNotes += '<ul>';
  2463. for(loop=0; loop < uroRelease.changes.length; loop++)
  2464. {
  2465. releaseNotes += '<li>'+uroRelease.changes[loop];
  2466. }
  2467. releaseNotes += '</ul>';
  2468. }
  2469.  
  2470. uroAlertBox.Show('fa-info-circle', 'URO+ Release Notes', releaseNotes, false, "OK", "", null, null);
  2471. }
  2472. };
  2473. const uroConfig = // configuration handling
  2474. {
  2475. GatherSettings: function(container)
  2476. {
  2477. let options = '';
  2478. if(typeof(container) == 'string')
  2479. {
  2480. container = document.getElementById(container);
  2481. }
  2482. let urOptions = container.getElementsByTagName('input');
  2483. for (let optIdx=0;optIdx<urOptions.length;optIdx++)
  2484. {
  2485. // Don't save settings for any of the legacy input elements we've now hidden...
  2486. if(urOptions[optIdx].style.display != "none")
  2487. {
  2488. let id = urOptions[optIdx].id;
  2489. if((id.indexOf('_cb') === 0)||(id.indexOf('_text') === 0)||(id.indexOf('_input') === 0))
  2490. {
  2491. options += ':' + id;
  2492. if(urOptions[optIdx].type == 'checkbox') options += ',' + urOptions[optIdx].checked.toString();
  2493. else if((urOptions[optIdx].type == 'text')||(urOptions[optIdx].type == 'number')) options += ',' + urOptions[optIdx].value.toString();
  2494. }
  2495. }
  2496. }
  2497. return options;
  2498. },
  2499. GatherPlacesGroups: function()
  2500. {
  2501. let liststr = '';
  2502. for(let loop=0;loop<uroPlacesGroupsCollapsed.length;loop++)
  2503. {
  2504. if(loop > 0) liststr += ':';
  2505. liststr += uroPlacesGroupsCollapsed[loop];
  2506. }
  2507. return liststr;
  2508. },
  2509. GatherAFNs: function()
  2510. {
  2511. let liststr = '';
  2512. for(let loop=0; loop < uroAFN.friendlyNames.length; loop++)
  2513. {
  2514. let fnObj = uroAFN.friendlyNames[loop];
  2515. if(loop > 0) liststr += ':';
  2516.  
  2517. liststr += fnObj.fName+',';
  2518. liststr += fnObj.area+',';
  2519. liststr += fnObj.server;
  2520. }
  2521. return liststr;
  2522. },
  2523. SaveSettings: function()
  2524. {
  2525. if((uroInhibitSave) || (uroMTEMode === true) || (uroSettingsApplied === false))
  2526. {
  2527. uroDBG.AddLog('save inhibited');
  2528. return;
  2529. }
  2530.  
  2531. if (localStorage)
  2532. {
  2533. try
  2534. {
  2535. let masterEnable = uroUtils.GetCBChecked('_cbMasterEnable');
  2536. if(masterEnable !== null)
  2537. {
  2538. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  2539. {
  2540. localStorage[uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE]] = uroConfig.GatherSettings(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  2541. }
  2542. localStorage.UROverviewFriendlyAreaNames = uroConfig.GatherAFNs();
  2543. localStorage.UROverviewPlacesGroups = uroConfig.GatherPlacesGroups();
  2544. localStorage.UROverviewMasterEnable = masterEnable;
  2545. localStorage.UROverviewCurrentVersion = uroRelease.version;
  2546.  
  2547. uroDBG.AddLog('settings saved');
  2548. }
  2549. else
  2550. {
  2551. uroDBG.AddLog('master enable state not known when trying to save settings...');
  2552. }
  2553. }
  2554. catch(err)
  2555. {
  2556. uroDBG.AddLog('exception thrown during save - probably script reload whilst in MTE mode...');
  2557. }
  2558. }
  2559. else
  2560. {
  2561. uroDBG.AddLog('no localStorage, save blocked');
  2562. }
  2563. },
  2564. ApplySettings: function(settings)
  2565. {
  2566. uroSettingsApplied = true;
  2567. if(settings != undefined)
  2568. {
  2569. if(document.querySelector('#_cbMasterEnable') === null)
  2570. {
  2571. uroDBG.AddLog('master enable not found, not applying settings...');
  2572. uroSettingsApplied = false;
  2573. }
  2574. else
  2575. {
  2576. let options = settings.split(':');
  2577. for(let optIdx=0;optIdx<options.length;optIdx++)
  2578. {
  2579. let fields = options[optIdx].split(',');
  2580. if(fields[0].indexOf('_cb') === 0)
  2581. {
  2582. if(document.getElementById(fields[0]) !== null)
  2583. {
  2584. uroUtils.SetCBChecked(fields[0], (fields[1] == 'true'));
  2585. }
  2586. }
  2587. else if((fields[0].indexOf('_input') === 0)||(fields[0].indexOf('_text') === 0))
  2588. {
  2589. if(document.getElementById(fields[0]) !== null) document.getElementById(fields[0]).value = fields[1];
  2590. }
  2591. }
  2592. uroDBG.AddLog('settings applied...');
  2593. }
  2594. }
  2595. },
  2596. TranslateLegacyMPTab: function()
  2597. {
  2598. let options = localStorage.UROverviewMPOptions.split(':');
  2599. for(let optIdx=0;optIdx<options.length;optIdx++)
  2600. {
  2601. let fields = options[optIdx].split(',');
  2602. if(fields[0].indexOf('_cb') === 0)
  2603. {
  2604. if(fields[0] == '_cbMPFilterParkingLotInputAsPoint') uroUtils.SetCBChecked('_cbMPFilter_T50', (fields[1] == 'true'));
  2605. if(fields[0] == '_cbMPMissingPLP_T70') uroUtils.SetCBChecked('_cbMPFilter_T70', (fields[1] == 'true'));
  2606. if(fields[0] == '_cbMPMissingPLP_T71') uroUtils.SetCBChecked('_cbMPFilter_T71', (fields[1] == 'true'));
  2607. if(fields[0] == '_cbMPFilterDrivingDirectionMismatch') uroUtils.SetCBChecked('_cbMPFilter_T101', (fields[1] == 'true'));
  2608. if(fields[0] == '_cbMPFilterMissingJunction') uroUtils.SetCBChecked('_cbMPFilter_T102', (fields[1] == 'true'));
  2609. if(fields[0] == '_cbMPFilterMissingRoad') uroUtils.SetCBChecked('_cbMPFilter_T103', (fields[1] == 'true'));
  2610. if(fields[0] == '_cbMPFilterCrossroadsJunctionMissing') uroUtils.SetCBChecked('_cbMPFilter_T104', (fields[1] == 'true'));
  2611. if(fields[0] == '_cbMPFilterRoadTypeMismatch') uroUtils.SetCBChecked('_cbMPFilter_T105', (fields[1] == 'true'));
  2612. if(fields[0] == '_cbMPFilterRestrictedTurn') uroUtils.SetCBChecked('_cbMPFilter_T106', (fields[1] == 'true'));
  2613. if(fields[0] == '_cbMPFilterTurnProblem') uroUtils.SetCBChecked('_cbMPFilter_T200', (fields[1] == 'true'));
  2614. if(fields[0] == '_cbMPFilterRoadClosureProblem') uroUtils.SetCBChecked('_cbMPFilter_T300', (fields[1] == 'true'));
  2615. }
  2616. }
  2617. },
  2618. TranslateLegacyZoom: function()
  2619. {
  2620. let tZoom = parseInt(document.getElementById("_inputFilterMinZoomLevel").value);
  2621. if(tZoom < 12)
  2622. {
  2623. tZoom += 12;
  2624. document.getElementById("_inputFilterMinZoomLevel").value = tZoom;
  2625. }
  2626. tZoom = parseInt(document.getElementById("_inputUnstackZoomLevel").value);
  2627. if(tZoom < 12)
  2628. {
  2629. tZoom += 12;
  2630. document.getElementById("_inputUnstackZoomLevel").value = tZoom;
  2631. }
  2632. },
  2633. RemoveOldSettings: function()
  2634. {
  2635. let oldies = [
  2636. "UROverviewFeedFilterOptions",
  2637. "UROverviewCWLGroups",
  2638. "UROverviewCamWatchList",
  2639. "UROverviewPlaceWatchList",
  2640. "UROverviewSegWatchList"
  2641. ];
  2642.  
  2643. for(let i = 0; i < oldies.length; ++ i)
  2644. {
  2645. if(localStorage[oldies[i]] != undefined)
  2646. {
  2647. localStorage.removeItem(oldies[i]);
  2648. }
  2649. }
  2650. },
  2651. LoadSettings: function()
  2652. {
  2653. let isNewInstall = true;
  2654. let isUpgradeInstall = true;
  2655.  
  2656. uroDBG.AddLog('loadSettings()');
  2657. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  2658. {
  2659. if (uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE] != null)
  2660. {
  2661. uroDBG.AddLog('recover '+uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABTITLE]+' tab settings');
  2662. uroConfig.ApplySettings(localStorage[uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE]]);
  2663. isNewInstall = false;
  2664. }
  2665. }
  2666. if (localStorage.UROverviewMPOptions != null)
  2667. {
  2668. uroConfig.TranslateLegacyMPTab();
  2669. }
  2670. if (localStorage.UROverviewMiscOptions != null)
  2671. {
  2672. uroConfig.TranslateLegacyZoom();
  2673. }
  2674.  
  2675. if(localStorage.UROverviewCurrentVersion != null)
  2676. {
  2677. uroDBG.AddLog('comparing install versions');
  2678. if(localStorage.UROverviewCurrentVersion == uroRelease.version)
  2679. {
  2680. isUpgradeInstall = false;
  2681. }
  2682. }
  2683.  
  2684. if(localStorage.UROverviewFriendlyAreaNames != null)
  2685. {
  2686. uroDBG.AddLog('recover friendly area names');
  2687. uroAFN.ApplyNames();
  2688. isNewInstall = false;
  2689. }
  2690.  
  2691. if(localStorage.UROverviewMasterEnable != null)
  2692. {
  2693. uroDBG.AddLog('recover master enable state');
  2694. document.getElementById('_cbMasterEnable').checked = (localStorage.UROverviewMasterEnable == "true");
  2695. uroDBG.AddLog('enable checkbox state set...');
  2696. }
  2697.  
  2698. uroConfig.RemoveOldSettings();
  2699.  
  2700. if((isNewInstall)||(isUpgradeInstall))
  2701. {
  2702. uroStartup.ShowUpgradeNotes();
  2703. }
  2704.  
  2705. uroInhibitSave = false;
  2706. },
  2707. DefaultSettings: function()
  2708. {
  2709. uroAlertBox.Show("fa-warning", "URO+ Warning", "Resetting URO+ settings <b>cannot</b> be undone.<br>Are you <i>sure</i> you want to do this?", true, "Reset settings", "Keep settings", uroConfig.DefaultSettingsAction, null);
  2710. },
  2711. DefaultSettingsAction: function()
  2712. {
  2713. let defaultSettings = '';
  2714.  
  2715. defaultSettings += '[UROverviewUROptions][len=1849]:_cbURFilterOutsideArea,false:_cbURFilterInsideManagedAreas,false:_cbURExcludeUserArea,false:_cbNoFilterForURInURL,false:_cbURFilterDupes,false:_cbFilterWazeAuto,false:_cbFilterIncorrectTurn,false:_cbFilterIncorrectAddress,false:_cbFilterIncorrectRoute,false:_cbFilterMissingRoundabout,false:_cbFilterGeneralError,false:_cbFilterTurnNotAllowed,false:_cbFilterIncorrectJunction,false:_cbFilterMissingBridgeOverpass,false:_cbFilterWrongDrivingDirection,false:_cbFilterMissingExit,false:_cbFilterMissingRoad,false:_cbFilterBlockedRoad,false:_cbFilterMissingLandmark,false:_cbFilterSpeedLimits,false:_cbFilterUndefined,false:_cbFilterRoadworks,false:_cbFilterConstruction,false:_cbFilterClosure,false:_cbFilterEvent,false:_cbFilterNote,false:_cbFilterBOG,false:_cbFilterDifficult,false:_cbFilterWSLM,false:_cbInvertURFilter,false:_cbFilterOpenUR,false:_cbFilterClosedUR,false:_cbFilterSolved,false:_cbFilterUnidentified,false:_cbEnableMinAgeFilter,false:_inputFilterMinDays,60:_cbEnableMaxAgeFilter,false:_inputFilterMaxDays,62:_cbHideMyFollowed,false:_cbHideMyUnfollowed,false:_cbURDescriptionMustBePresent,false:_cbURDescriptionMustBeAbsent,false:_cbEnableKeywordMustBePresent,false:_textKeywordPresent,:_cbEnableKeywordMustBeAbsent,false:_textKeywordAbsent,:_cbCaseInsensitive,false:_cbHideMyComments,false:_cbHideAnyComments,false:_cbHideIfLastCommenter,false:_cbHideIfNotLastCommenter,false:_cbHideIfReporterLastCommenter,false:_cbHideIfReporterNotLastCommenter,false:_cbEnableMinCommentsFilter,false:_inputFilterMinComments,1:_cbEnableMaxCommentsFilter,false:_inputFilterMaxComments,0:_cbEnableCommentAgeFilter2,false:_inputFilterCommentDays2,:_cbEnableCommentAgeFilter,false:_inputFilterCommentDays,1:_cbIgnoreOtherEditorComments,false:_cbURUserIDFilter,false:_cbURResolverIDFilter,false:_cbInvertURStateFilter,false:_cbNoFilterForTaggedURs,false[END]';
  2716. defaultSettings += '[UROverviewMiscOptions][len=1157]:_cbHideSegmentsWhenRoadsHidden,false:_cbKillInertialPanning,false:_cbCommentCount,false:_cbAutoApplyClonedClosure,false:_cbAutoScrollClosureList,false:_inputFilterMinZoomLevel,22:_inputUnstackSensitivity,30:_inputUnstackZoomLevel,22:_inputPopupEntryTimeout,10:_inputPopupExitTimeout,2:_inputPopupAutoHideTimeout,0:_cbInhibitURClusters,false:_cbInhibitMPClusters,false:_cbInhibitPUClusters,false:_cbInhibitURPopup,false:_cbInhibitMPPopup,false:_cbInhibitCamPopup,false:_cbInhibitSegPopup,false:_cbInhibitSegGenericPopup,false:_cbInhibitLandmarkPopup,false:_cbInhibitPUPopup,false:_cbInhibitMapCommentPopup,false:_cbInhibitNodesPopup,false:_cbDateFmtDDMMYY,true:_cbDateFmtMMDDYY,false:_cbDateFmtYYMMDD,false:_cbTimeFmt24H,true:_cbTimeFmt12H,false:_cbWhiteBackground,false:_inputCustomBackgroundRed,30:_inputCustomBackgroundGreen,30:_inputCustomBackgroundBlue,30:_cbInhibitNURButton,false:_cbInhibitNMPButton,false:_cbInhibitNPURButton,false:_cbInhibitURCentering,false:_cbInhibitMPCentering,false:_cbInhibitPURCentering,false:_cbInhibitPPURCentering,false:_cbInhibitRPURCentering,false:_cbHideAMLayer,false:_cbMoveAMList,false:_cbDisablePlacesFiltering,false[END]';
  2717. defaultSettings += '[UROverviewPlacesOptions][len=6292]:_cbFilterUneditablePlaceUpdates,false:_cbPURFilterInsideManagedAreas,false:_cbPURExcludeUserArea,false:_cbFilterLockRankedPlaceUpdates,false:_cbFilterNewPlacePUR,false:_cbFilterUpdatedDetailsPUR,false:_cbPURFilterCFPhone,false:_cbPURFilterCFName,false:_cbPURFilterCFEntryExitPoints,false:_cbPURFilterCFOpeningHours,false:_cbPURFilterCFAliases,false:_cbPURFilterCFServices,false:_cbPURFilterCFGeometry,false:_cbPURFilterCFHouseNumber,false:_cbPURFilterCFCategories,false:_cbPURFilterCFDescription,false:_cbFilterNewPhotoPUR,false:_cbFilterFlaggedPUR,false:_cbInvertPURFilters,false:_cbEnablePURMinAgeFilter,false:_inputPURFilterMinDays,3:_cbEnablePURMaxAgeFilter,false:_inputPURFilterMaxDays,4:_cbPlaceFilterEditedLessThan,false:_inputFilterPlaceEditMinDays,:_cbPlaceFilterEditedMoreThan,false:_inputFilterPlaceEditMaxDays,:_cbHidePlacesL0,false:_cbHidePlacesL1,false:_cbHidePlacesL2,false:_cbHidePlacesL3,false:_cbHidePlacesL4,false:_cbHidePlacesL5,false:_cbHidePlacesStaff,false:_cbHidePlacesAdLocked,false:_cbHideAreaPlaces,false:_cbHidePointPlaces,false:_cbHidePhotoPlaces,false:_cbHideNoPhotoPlaces,false:_cbHideLinkedPlaces,false:_cbHideNoLinkedPlaces,false:_cbHideDescribedPlaces,false:_cbHideNonDescribedPlaces,false:_cbHideKeywordPlaces,false:_cbHideNoKeywordPlaces,false:_textKeywordPlace,:_cbShowOnlyPlacesCreatedBy,false:_cbShowOnlyPlacesEditedBy,false:_textPlacesEditor,theMadcabbie:_cbHideOnlyPlacesCreatedBy,false:_cbHideOnlyPlacesEditedBy,false:_textHidePlacesEditor,theMadcabbie:_cbLeavePURGeos,false:_cbHidePURsForFilteredPlaces,false:_cbPlacesFilter-CAR_SERVICES,false:_cbPlacesFilter-CAR_WASH,false:_cbPlacesFilter-CHARGING_STATION,false:_cbPlacesFilter-GARAGE_AUTOMOTIVE_SHOP,false:_cbPlacesFilter-GAS_STATION,false:_cbPlacesFilter-CRISIS_LOCATIONS,false:_cbPlacesFilter-DONATION_CENTERS,false:_cbPlacesFilter-OTHER_CRISIS_LOCATIONS,false:_cbPlacesFilter-SHELTER_LOCATIONS,false:_cbPlacesFilter-CULTURE_AND_ENTERTAINEMENT,false:_cbPlacesFilter-ART_GALLERY,false:_cbPlacesFilter-CASINO,false:_cbPlacesFilter-CLUB,false:_cbPlacesFilter-TOURIST_ATTRACTION_HISTORIC_SITE,false:_cbPlacesFilter-MOVIE_THEATER,false:_cbPlacesFilter-MUSEUM,false:_cbPlacesFilter-MUSIC_VENUE,false:_cbPlacesFilter-PERFORMING_ARTS_VENUE,false:_cbPlacesFilter-GAME_CLUB,false:_cbPlacesFilter-STADIUM_ARENA,false:_cbPlacesFilter-THEME_PARK,false:_cbPlacesFilter-ZOO_AQUARIUM,false:_cbPlacesFilter-RACING_TRACK,false:_cbPlacesFilter-THEATER,false:_cbPlacesFilter-FOOD_AND_DRINK,false:_cbPlacesFilter-RESTAURANT,false:_cbPlacesFilter-BAKERY,false:_cbPlacesFilter-DESSERT,false:_cbPlacesFilter-CAFE,false:_cbPlacesFilter-FAST_FOOD,false:_cbPlacesFilter-FOOD_COURT,false:_cbPlacesFilter-BAR,false:_cbPlacesFilter-ICE_CREAM,false:_cbPlacesFilter-LODGING,false:_cbPlacesFilter-HOTEL,false:_cbPlacesFilter-HOSTEL,false:_cbPlacesFilter-CAMPING_TRAILER_PARK,false:_cbPlacesFilter-COTTAGE_CABIN,false:_cbPlacesFilter-BED_AND_BREAKFAST,false:_cbPlacesFilter-NATURAL_FEATURES,false:_cbPlacesFilter-ISLAND,false:_cbPlacesFilter-SEA_LAKE_POOL,false:_cbPlacesFilter-RIVER_STREAM,false:_cbPlacesFilter-FOREST_GROVE,false:_cbPlacesFilter-FARM,false:_cbPlacesFilter-CANAL,false:_cbPlacesFilter-SWAMP_MARSH,false:_cbPlacesFilter-DAM,false:_cbPlacesFilter-OTHER,false:_cbPlacesFilter-CONSTRUCTION_SITE,false:_cbPlacesFilter-OUTDOORS,false:_cbPlacesFilter-PARK,false:_cbPlacesFilter-PLAYGROUND,false:_cbPlacesFilter-BEACH,false:_cbPlacesFilter-SPORTS_COURT,false:_cbPlacesFilter-GOLF_COURSE,false:_cbPlacesFilter-PLAZA,false:_cbPlacesFilter-PROMENADE,false:_cbPlacesFilter-POOL,false:_cbPlacesFilter-SCENIC_LOOKOUT_VIEWPOINT,false:_cbPlacesFilter-SKI_AREA,false:_cbPlacesFilter-PARKING_LOT,false:_cbPlacesFilter-PROFESSIONAL_AND_PUBLIC,false:_cbPlacesFilter-COLLEGE_UNIVERSITY,false:_cbPlacesFilter-SCHOOL,false:_cbPlacesFilter-CONVENTIONS_EVENT_CENTER,false:_cbPlacesFilter-GOVERNMENT,false:_cbPlacesFilter-LIBRARY,false:_cbPlacesFilter-CITY_HALL,false:_cbPlacesFilter-ORGANIZATION_OR_ASSOCIATION,false:_cbPlacesFilter-PRISON_CORRECTIONAL_FACILITY,false:_cbPlacesFilter-COURTHOUSE,false:_cbPlacesFilter-CEMETERY,false:_cbPlacesFilter-FIRE_DEPARTMENT,false:_cbPlacesFilter-POLICE_STATION,false:_cbPlacesFilter-MILITARY,false:_cbPlacesFilter-HOSPITAL_URGENT_CARE,false:_cbPlacesFilter-DOCTOR_CLINIC,false:_cbPlacesFilter-OFFICES,false:_cbPlacesFilter-POST_OFFICE,false:_cbPlacesFilter-RELIGIOUS_CENTER,false:_cbPlacesFilter-KINDERGARDEN,false:_cbPlacesFilter-FACTORY_INDUSTRIAL,false:_cbPlacesFilter-EMBASSY_CONSULATE,false:_cbPlacesFilter-INFORMATION_POINT,false:_cbPlacesFilter-EMERGENCY_SHELTER,false:_cbPlacesFilter-TRASH_AND_RECYCLING_FACILITIES,false:_cbPlacesFilter-SHOPPING_AND_SERVICES,false:_cbPlacesFilter-ARTS_AND_CRAFTS,false:_cbPlacesFilter-BANK_FINANCIAL,false:_cbPlacesFilter-SPORTING_GOODS,false:_cbPlacesFilter-BOOKSTORE,false:_cbPlacesFilter-PHOTOGRAPHY,false:_cbPlacesFilter-CAR_DEALERSHIP,false:_cbPlacesFilter-FASHION_AND_CLOTHING,false:_cbPlacesFilter-CONVENIENCE_STORE,false:_cbPlacesFilter-PERSONAL_CARE,false:_cbPlacesFilter-DEPARTMENT_STORE,false:_cbPlacesFilter-PHARMACY,false:_cbPlacesFilter-ELECTRONICS,false:_cbPlacesFilter-FLOWERS,false:_cbPlacesFilter-FURNITURE_HOME_STORE,false:_cbPlacesFilter-GIFTS,false:_cbPlacesFilter-GYM_FITNESS,false:_cbPlacesFilter-SWIMMING_POOL,false:_cbPlacesFilter-HARDWARE_STORE,false:_cbPlacesFilter-MARKET,false:_cbPlacesFilter-SUPERMARKET_GROCERY,false:_cbPlacesFilter-JEWELRY,false:_cbPlacesFilter-LAUNDRY_DRY_CLEAN,false:_cbPlacesFilter-SHOPPING_CENTER,false:_cbPlacesFilter-MUSIC_STORE,false:_cbPlacesFilter-PET_STORE_VETERINARIAN_SERVICES,false:_cbPlacesFilter-TOY_STORE,false:_cbPlacesFilter-TRAVEL_AGENCY,false:_cbPlacesFilter-ATM,false:_cbPlacesFilter-CURRENCY_EXCHANGE,false:_cbPlacesFilter-CAR_RENTAL,false:_cbPlacesFilter-TELECOM,false:_cbPlacesFilter-TRANSPORTATION,false:_cbPlacesFilter-AIRPORT,false:_cbPlacesFilter-BUS_STATION,false:_cbPlacesFilter-FERRY_PIER,false:_cbPlacesFilter-SEAPORT_MARINA_HARBOR,false:_cbPlacesFilter-SUBWAY_STATION,false:_cbPlacesFilter-TRAIN_STATION,false:_cbPlacesFilter-BRIDGE,false:_cbPlacesFilter-TUNNEL,false:_cbPlacesFilter-TAXI_STATION,false:_cbPlacesFilter-JUNCTION_INTERCHANGE,false:_cbPlacesFilter-REST_AREAS,false:_cbPlacesFilter-CARPOOL_SPOT,false:_cbFilterPrivatePlaces,false:_cbInvertPlacesFilter,false[END]';
  2718. defaultSettings += '[UROverviewPlacesGroups][len=71]false:false:false:false:false:false:false:false:false:false:false:false[END]';
  2719. defaultSettings += '[UROverviewMPOptions][len=1446]:_cbMPFilterOutsideArea,false:_cbMPFilter_T1,false:_cbMPFilter_T2,false:_cbMPFilter_T3,false:_cbMPFilter_T5,false:_cbMPFilter_T6,false:_cbMPFilter_T7,false:_cbMPFilter_T8,false:_cbMPFilter_T10,false:_cbMPFilter_T11,false:_cbMPFilter_T12,false:_cbMPFilter_T13,false:_cbMPFilter_T14,false:_cbMPFilter_T15,false:_cbMPFilter_T16,false:_cbMPFilter_T17,false:_cbMPFilter_T19,false:_cbMPFilter_T20,false:_cbMPFilter_T21,false:_cbMPFilter_T22,false:_cbMPFilter_T23,false:_cbMPFilter_T50,false:_cbMPFilter_T51,false:_cbMPFilter_T52,false:_cbMPFilter_T53,false:_cbMPFilter_T70,false:_cbMPFilter_T71,false:_cbMPFilter_T101,false:_cbMPFilter_T102,false:_cbMPFilter_T103,false:_cbMPFilter_T104,false:_cbMPFilter_T105,false:_cbMPFilter_T106,false:_cbMPFilter_T200,false:_cbMPFilter_T300,false:_cbMPFilterUnknownProblem,false:_cbFilterElgin,false:_cbFilterTrafficCast,false:_cbFilterTrafficMaster,false:_cbFilterCaltrans,false:_cbFilterTFL,false:_cbMPFilterReopenedProblem,false:_cbInvertMPFilter,false:_cbMPFilterClosed,false:_cbMPFilterSolved,false:_cbMPFilterUnidentified,false:_cbMPClosedUserIDFilter,false:_cbMPNotClosedUserIDFilter,false:_cbMPFilterLowSeverity,false:_cbMPFilterMediumSeverity,false:_cbMPFilterHighSeverity,false:_cbMPFilterStartDate,false:_inputMPFilterStartDay,:_inputMPFilterStartMonth,:_inputMPFilterStartYear,:_cbMPFilterEndDate,false:_inputMPFilterEndDay,:_inputMPFilterEndMonth,:_inputMPFilterEndYear,:_cbMPFilterEndDatePassed,false[END]';
  2720. defaultSettings += '[UROverviewMasterEnable][len=4]true[END]';
  2721. defaultSettings += '[UROverviewMCOptions][len=828]:_cbMCFilterRoadworks,false:_cbMCFilterConstruction,false:_cbMCFilterClosure,false:_cbMCFilterEvent,false:_cbMCFilterNote,false:_cbMCFilterBOG,false:_cbMCFilterDifficult,false:_cbMCFilterWSLM,false:_cbInvertMCFilter,false:_cbMCHideMyFollowed,false:_cbMCHideMyUnfollowed,false:_cbMCDescriptionMustBePresent,false:_cbMCDescriptionMustBeAbsent,false:_cbMCCommentsMustBePresent,false:_cbMCCommentsMustBeAbsent,false:_cbMCExpiryMustBePresent,false:_cbMCExpiryMustBeAbsent,false:_cbMCEnableKeywordMustBePresent,false:_textMCKeywordPresent,:_cbMCEnableKeywordMustBeAbsent,false:_textMCKeywordAbsent,:_cbMCCaseInsensitive,false:_cbMCCreatorIDFilter,false:_cbHideWRCMCs,false:_cbHideMCRank0,false:_cbHideMCRank1,false:_cbHideMCRank2,false:_cbHideMCRank3,false:_cbHideMCRank4,false:_cbHideMCRank5,false:_cbMCEnhancePointMCVisibility,false[END]';
  2722. defaultSettings += '[UROverviewRTCOptions][len=710]:_cbHideExpiredEditorRTCs,false:_cbHideEditorRTCs,false:_cbHideFutureEditorRTCs,false:_cbHideExpiredWazeFeedRTCs,false:_cbHideWazeFeedRTCs,false:_cbHideFutureWazeFeedRTCs,false:_cbHideExpiredWazeRTCs,false:_cbHideWazeRTCs,false:_cbHideFutureWazeRTCs,false:_cbHideExpiredSidepanelRTCs,false:_cbHideSidepanelRTCs,false:_cbHideFutureSidepanelRTCs,false:_cbShowMTERTCs,false:_cbHideMTERTCs,false:_cbEnableRTCDurationFilterLessThan,false:_inputFilterRTCDurationLessThan,:_cbEnableRTCDurationFilterMoreThan,false:_inputFilterRTCDurationMoreThan,:_cbRTCFilterShowForTS,false:_cbRTCFilterHideForTS,false:_inputRTCFilterDay,15:_inputRTCFilterMonth,6:_inputRTCFilterYear,2024:_inputRTCFilterHour,11:_inputRTCFilterMin,15[END]';
  2723. defaultSettings += '[UROverviewCameraOptions][len=908]:_cbShowWorldCams,true:_cbShowUSACams,true:_cbShowNonWorldCams,true:_cbShowOnlyCamsCreatedBy,false:_cbShowOnlyCamsEditedBy,false:_textCameraEditor,:_cbShowOnlyMyCams,false:_cbShowSpeedCams,true:_cbShowIfSpeedSet,true:_cbShowIfNoSpeedSet,true:_cbShowIfInvalidSpeedSet,true:_cbShowRedLightCams,true:_cbShowRLCIfZeroSpeedSet,true:_cbShowRLCIfNonZeroSpeedSet,true:_cbShowRLCIfNoSpeedSet,true:_cbShowDummyCams,true:_cbHideCreatedByMe,false:_cbHideCreatedByRank0,false:_cbHideCreatedByRank1,false:_cbHideCreatedByRank2,false:_cbHideCreatedByRank3,false:_cbHideCreatedByRank4,false:_cbHideCreatedByRank5,false:_cbHideUpdatedByMe,false:_cbHideUpdatedByRank0,false:_cbHideUpdatedByRank1,false:_cbHideUpdatedByRank2,false:_cbHideUpdatedByRank3,false:_cbHideUpdatedByRank4,false:_cbHideUpdatedByRank5,false:_cbHideManualLockedCams,false:_cbHideCWLCams,false:_cbInvertCamFilters,false:_cbHighlightInsteadOfHideCams,false[END]';
  2724. defaultSettings += '[UROverviewRAOptions][len=178]:_cbShowSpecificRA,false:_cbRAEditorIDFilter,false:_cbEnableRAAgeFilterLessThan,false:_inputFilterRAAgeLessThan,39:_cbEnableRAAgeFilterMoreThan,false:_inputFilterRAAgeMoreThan,38[END]';
  2725. defaultSettings += '[UROverviewCurrentVersion][len=3]4.5[END]';
  2726. defaultSettings += '[UROverviewFriendlyAreaNames][len=0][END]';
  2727.  
  2728. document.getElementById('_txtSettings').value = defaultSettings;
  2729. uroConfig.TextToSettings();
  2730. document.getElementById('_txtSettings').value = '';
  2731. },
  2732. SettingsToText: function()
  2733. {
  2734. let txtSettings = '';
  2735.  
  2736. uroConfig.SaveSettings();
  2737.  
  2738. for(let lsEntry in localStorage)
  2739. {
  2740. if(lsEntry.indexOf('UROverview') === 0)
  2741. {
  2742. txtSettings += '['+lsEntry+'][len=' + localStorage[lsEntry].length + ']' + localStorage[lsEntry] + '[END]\n';
  2743. }
  2744. }
  2745.  
  2746. document.getElementById('_txtSettings').value = txtSettings;
  2747. document.getElementById('_txtSettings').focus();
  2748. document.getElementById('_txtSettings').select();
  2749. },
  2750. TextToSettings: function()
  2751. {
  2752. let txtSettings = '';
  2753. txtSettings = uroUtils.GetElmValue('_txtSettings');
  2754. if(txtSettings.indexOf('[END]') == -1) return;
  2755.  
  2756. let subText = txtSettings.split('[END]');
  2757. for(let i=0;i<subText.length;i++)
  2758. {
  2759. let aPos = subText[i].indexOf('[');
  2760. let bPos = subText[i].indexOf(']');
  2761. if((aPos != -1) && (bPos != -1))
  2762. {
  2763. let settingID = subText[i].substr(aPos+1,bPos-1-aPos);
  2764. subText[i] = subText[i].substr(bPos+1);
  2765. bPos = subText[i].indexOf(']');
  2766. if(bPos != -1)
  2767. {
  2768. let settingLength = subText[i].substr(5,bPos-5);
  2769. subText[i] = subText[i].substr(bPos+1);
  2770. if(subText[i].length == settingLength)
  2771. {
  2772. localStorage[settingID] = subText[i];
  2773. }
  2774. }
  2775. }
  2776. }
  2777. uroConfig.LoadSettings();
  2778. },
  2779. ClearSettingsText: function()
  2780. {
  2781. document.getElementById('_txtSettings').value = '';
  2782. }
  2783. };
  2784. const uroRTCClone = // RTC cloning
  2785. {
  2786. ConfirmDelete : true,
  2787. ToDelete : 0,
  2788. Reason : null,
  2789. Event : null,
  2790. Direction : null,
  2791. StartDate : null,
  2792. StartTime : null,
  2793. EndDate : null,
  2794. EndTime : null,
  2795. IgnoreTraffic : null,
  2796. ClosedNodes : null,
  2797. PendingClone : -1,
  2798. PendingCloneIncrement : 0,
  2799.  
  2800. SetReact: function(elmDesc, newValue)
  2801. {
  2802. let elm = document.querySelector(elmDesc);
  2803. if(elm !== null)
  2804. {
  2805. // Some (all?) of the closure panel elements need to be focussed before we can successfully change
  2806. // their values...
  2807. elm.focus();
  2808. // https://stackoverflow.com/questions/23892547/what-is-the-best-way-to-trigger-change-or-input-event-in-react-js#46012210
  2809. let nativeInputValueSetter = Object.getOwnPropertyDescriptor(elm.__proto__, "value").set;
  2810. nativeInputValueSetter.call(elm, newValue);
  2811. let event = new Event('input', { bubbles: true });
  2812. elm.dispatchEvent(event);
  2813. }
  2814. },
  2815. Complete: function()
  2816. {
  2817. let loop;
  2818. if(document.getElementsByClassName('edit-closure').length === 0)
  2819. {
  2820. window.setTimeout(uroRTCClone.Complete,100);
  2821. return;
  2822. }
  2823.  
  2824. if(uroFixMTEDropDown(document.getElementById('closure_eventId')) == false)
  2825. {
  2826. window.setTimeout(uroRTCClone.Complete,100);
  2827. return;
  2828. }
  2829.  
  2830. if(uroRTCClone.Reason !== null)
  2831. {
  2832. uroRTCClone.SetReact('wz-text-input#closure_reason', uroRTCClone.Reason);
  2833. }
  2834. if(uroRTCClone.Direction !== null)
  2835. {
  2836. uroRTCClone.SetReact('wz-select#closure_direction', uroRTCClone.Direction);
  2837. }
  2838. if(uroRTCClone.StartDate !== null)
  2839. {
  2840. uroRTCClone.SetReact('wz-text-input#closure_startDate', uroRTCClone.StartDate);
  2841. }
  2842. if(uroRTCClone.StartTime !== null)
  2843. {
  2844. uroRTCClone.SetReact('div.form-group.start-date-form-group wz-text-input.time-picker-input', uroRTCClone.StartTime);
  2845. }
  2846. if(uroRTCClone.IgnoreTraffic !== null)
  2847. {
  2848. uroRTCClone.SetReact('wz-checkbox#closure_permanent', uroRTCClone.IgnoreTraffic);
  2849. }
  2850. if(uroRTCClone.EndDate !== null)
  2851. {
  2852. uroRTCClone.SetReact('wz-text-input#closure_endDate', uroRTCClone.EndDate);
  2853. }
  2854. if(uroRTCClone.EndTime !== null)
  2855. {
  2856. uroRTCClone.SetReact('div.form-group.end-date-form-group wz-text-input.time-picker-input', uroRTCClone.EndTime);
  2857. }
  2858.  
  2859. // the old method of setting the MTE just by changing the value attribute on closure_eventId no longer
  2860. // seems to work as expected (it runs OK from the dev console, but not within the scope of the userscript),
  2861. // so just as we do for setting the event to None, we set the event to the desired value here by finding
  2862. // the appropriate menu entry and clicking on it...
  2863. let cEvents = document.getElementById('closure_eventId').getElementsByTagName('wz-option');
  2864. for(let i of cEvents)
  2865. {
  2866. if(i.value == uroRTCClone.Event)
  2867. {
  2868. i.click();
  2869. break;
  2870. }
  2871. }
  2872.  
  2873. let nNodes = uroRTCClone.ClosedNodes.length;
  2874. if(nNodes > 0)
  2875. {
  2876. let form = $('#edit-panel .closures .edit-closure form');
  2877. let fObj = form.find('wz-toggle-switch');
  2878. for(loop = 0; loop < nNodes; ++loop)
  2879. {
  2880. if(uroRTCClone.ClosedNodes[loop] === true)
  2881. {
  2882. fObj[loop].click();
  2883. }
  2884. }
  2885. }
  2886. if(uroUtils.GetCBChecked('_cbAutoApplyClonedClosure') == true)
  2887. {
  2888. window.setTimeout(uroRTCClone.ClickSave,100);
  2889. }
  2890.  
  2891. uroRTCClone.PendingClone = -1;
  2892. },
  2893. ClickSave: function()
  2894. {
  2895. document.getElementsByClassName('closures')[0].getElementsByClassName('save-button')[0].click();
  2896. },
  2897. Copy: function()
  2898. {
  2899. // grab the current closure details from the UI...
  2900. uroRTCClone.Reason = uroGetShadowElementProperty('closure_reason', 'input', 'value');
  2901. uroRTCClone.Direction = uroGetElementProperty('closure_direction', 0, 'value');
  2902. uroRTCClone.StartDate = uroGetElementProperty('closure_startDate', 0, 'value');
  2903. uroRTCClone.StartTime = document.querySelector('.start-date-form-group').querySelector('.time-picker-input').value;
  2904. uroRTCClone.EndDate = uroGetElementProperty('closure_endDate', 0, 'value');
  2905. uroRTCClone.EndTime = document.querySelector('.end-date-form-group').querySelector('.time-picker-input').value;
  2906. uroRTCClone.Event = uroGetElementProperty('closure_eventId', 0, 'value');
  2907. uroRTCClone.IgnoreTraffic = uroGetElementProperty('closure_permanent', 0, 'checked');
  2908. uroRTCClone.ClosedNodes = [];
  2909. let nNodes = document.getElementsByClassName('fromNodeClosed').length;
  2910. if(nNodes > 0)
  2911. {
  2912. for(let loop = 0; loop < nNodes; ++loop)
  2913. {
  2914. uroRTCClone.ClosedNodes.push(document.getElementsByClassName('fromNodeClosed')[loop].checked);
  2915. }
  2916. }
  2917.  
  2918. document.getElementsByClassName('closures')[0].getElementsByClassName('cancel-button')[0].click();
  2919.  
  2920. // auto-increment the start and end dates
  2921. uroRTCClone.StartDate = uroIncrementClosureDate(uroRTCClone.StartDate,uroRTCClone.PendingCloneIncrement);
  2922. uroRTCClone.EndDate = uroIncrementClosureDate(uroRTCClone.EndDate,uroRTCClone.PendingCloneIncrement);
  2923.  
  2924. uroRTCClone.PendingClone = -2;
  2925. },
  2926. Clone: function()
  2927. {
  2928. uroRTCClone.PendingCloneIncrement = parseInt(this.id.split('-')[1]);
  2929. uroRTCClone.PendingClone = parseInt(this.id.split('-')[2]);
  2930. },
  2931. DeleteNextOnList: function()
  2932. {
  2933. let nClosures = document.querySelectorAll('.closure-item.is-editable').length;
  2934. if(nClosures > 0)
  2935. {
  2936. if (nClosures != uroRTCClone.ToDelete)
  2937. {
  2938. uroRTCClone.ToDelete = nClosures;
  2939. let ctObj = document.querySelector('.closure-item.is-editable');
  2940. let deleteMenuEntry = ctObj.querySelector('wz-menu-item.delete');
  2941. if(deleteMenuEntry !== null)
  2942. {
  2943. deleteMenuEntry.click();
  2944. }
  2945. }
  2946. window.setTimeout(uroRTCClone.DeleteNextOnList,100);
  2947. }
  2948. else
  2949. {
  2950. uroRTCClone.ConfirmDelete = true;
  2951. }
  2952. },
  2953. DeleteAll: function()
  2954. {
  2955. uroRTCClone.ConfirmDelete = true;
  2956. uroAlertBox.Show("fa-warning", "URO+ Warning", I18n.lookup("closures.delete_confirm_no_reason")+' ('+I18n.lookup("closures.apply_to_all")+')', true, "Yes", "No", uroRTCClone.DeleteAllAction, null);
  2957. },
  2958. DeleteAllAction: function()
  2959. {
  2960. uroRTCClone.ConfirmDelete = false;
  2961. let nClosures = document.getElementsByClassName('closure-item').length;
  2962. if(nClosures > 0)
  2963. {
  2964. uroRTCClone.ToDelete = -1;
  2965. uroRTCClone.DeleteNextOnList();
  2966. }
  2967. else
  2968. {
  2969. uroRTCClone.ConfirmDelete = true;
  2970. }
  2971. }
  2972. };
  2973. const uroIgnore = // ignore list
  2974. {
  2975. IsOnList: function(fid)
  2976. {
  2977. if(sessionStorage.UROverview_FID_IgnoreList.indexOf('fid:'+fid) == -1) return false;
  2978. else return true;
  2979. },
  2980. EnableControls: function()
  2981. {
  2982. let btnState = "visible";
  2983. if(sessionStorage.UROverview_FID_IgnoreList === '')
  2984. {
  2985. btnState = "hidden";
  2986. }
  2987. try
  2988. {
  2989. document.getElementById('_btnUndoLastHide').style.visibility = btnState;
  2990. document.getElementById('_btnClearSessionHides').style.visibility = btnState;
  2991. uroFilterItems();
  2992. }
  2993. catch(err)
  2994. {
  2995. uroDBG.AddLog('exception thrown in uroIgnore.EnableControls()');
  2996. }
  2997. },
  2998. Add: function()
  2999. {
  3000. if(!uroIgnore.IsOnList(uroShownFID))
  3001. {
  3002. sessionStorage.UROverview_FID_IgnoreList += 'fid:'+uroShownFID;
  3003. uroDBG.AddLog('added fid '+uroShownFID+' to ignore list');
  3004. uroDBG.AddLog(sessionStorage.UROverview_FID_IgnoreList);
  3005. uroDiv.style.visibility = 'hidden';
  3006. uroIgnore.EnableControls();
  3007.  
  3008. W.map.events.register("mousemove", null, uroFilterItemsOnMove);
  3009. }
  3010. return false;
  3011. },
  3012. RemoveLastAdded: function()
  3013. {
  3014. let ignorelist = sessionStorage.UROverview_FID_IgnoreList;
  3015. let fidpos = ignorelist.lastIndexOf('fid:');
  3016. if(fidpos != -1)
  3017. {
  3018. ignorelist = ignorelist.slice(0,fidpos);
  3019. sessionStorage.UROverview_FID_IgnoreList = ignorelist;
  3020. uroDBG.AddLog('removed last fid from ignore list');
  3021. uroDBG.AddLog(sessionStorage.UROverview_FID_IgnoreList);
  3022. uroIgnore.EnableControls();
  3023. }
  3024. },
  3025. RemoveAll: function()
  3026. {
  3027. sessionStorage.UROverview_FID_IgnoreList = '';
  3028. uroIgnore.EnableControls();
  3029. }
  3030. };
  3031. const uroPopup = // map object popup handling
  3032. {
  3033. hasIgnoreLink : null,
  3034. hasDeleteLink : null,
  3035. hasAddWatchLink : null,
  3036. hasRemoveWatchLink : null,
  3037. hasUpdateWatchLink : null,
  3038. hasOpenInNewTabLink : null,
  3039.  
  3040. isVenue : null,
  3041. isMapComment : null,
  3042. isUR : null,
  3043. isProblem : null,
  3044. isTurnProb : null,
  3045. isPlaceUpdate : null,
  3046. timer : -2,
  3047. autoHideTimer : 0,
  3048. mouseIn : false,
  3049. shown : false,
  3050. shownType : null,
  3051. newType : null,
  3052. hovered : null,
  3053. unstackedX : null,
  3054. unstackedY : null,
  3055. renderIntent : null,
  3056. pX : null,
  3057. pY : null,
  3058. suppressed : false,
  3059.  
  3060. GetFormattedLocks: function(attrs)
  3061. {
  3062. let autoLock = attrs.rank;
  3063. let userLock = attrs.lockRank;
  3064. let retval = '<b>' + I18n.lookup("edit.segment.fields.lock") + ': </b>';
  3065. if(userLock !== null)
  3066. {
  3067. retval += 'M' + (userLock+1) + ' / ';
  3068. }
  3069. retval += 'A' + (autoLock+1);
  3070. return retval;
  3071. },
  3072. UR: function()
  3073. {
  3074. let result = '';
  3075.  
  3076. // check for stacking...
  3077. if(uroShownFID != uroMarkers.id)
  3078. {
  3079. uroCheckStacking(uroLayers.ID.UR,uroMarkers.id);
  3080. }
  3081.  
  3082. if(uroUtils.GetCBChecked('_cbInhibitURPopup') === false)
  3083. {
  3084. if(uroMousedOverMapComment !== null)
  3085. {
  3086. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for UR highlight');
  3087. uroMousedOverOtherObjectWithinMapComment = true;
  3088. }
  3089.  
  3090. uroPopup.isUR = true;
  3091. uroPopup.newPopupType = uroMarkers.type;
  3092. let ureq = W.model.mapUpdateRequests.objects[uroMarkers.id];
  3093.  
  3094. if(ureq.attributes != undefined)
  3095. {
  3096. uroFID = uroMarkers.id;
  3097.  
  3098. uroDBG.AddLog('building popup for UR '+uroMarkers.id);
  3099. result = '<b>Update Request ('+uroMarkers.id+'): ' + I18n.lookup("update_requests.types." + ureq.attributes.type) + '</b><br>';
  3100.  
  3101. result += uroUtils.Clickify(ureq.attributes.description, '<br>');
  3102. let uroDaysOld = uroUtils.GetURAge(ureq,0,false);
  3103. let uroSubmittedTS = uroUtils.GetURAge(ureq,0,true);
  3104. if(uroSubmittedTS != -1)
  3105. {
  3106. uroSubmittedTS = uroUtils.GetDateTimeString(uroSubmittedTS);
  3107. }
  3108. if(uroDaysOld != -1)
  3109. {
  3110. result += '<i>Submitted ' + uroUtils.ParseDaysAgo(uroDaysOld) + ' ';
  3111. if(uroSubmittedTS != -1) result += '(' + uroSubmittedTS + ') ';
  3112. if(ureq.attributes.guestUserName != null)
  3113. {
  3114. result += 'via Livemap';
  3115. if(ureq.attributes.guestUserName !== '')
  3116. {
  3117. result += ' by '+ureq.attributes.guestUserName.replace(/<\/?[^>]+(>|$)/g, "");
  3118. }
  3119. }
  3120. result += '</i>';
  3121. }
  3122. if(ureq.attributes.resolvedOn !== null)
  3123. {
  3124. let daysResolved = uroUtils.GetURAge(ureq,1,false);
  3125. let uroResolvedTS = uroUtils.GetURAge(ureq,1,true);
  3126. if(uroResolvedTS != -1)
  3127. {
  3128. uroResolvedTS = uroUtils.GetDateTimeString(uroResolvedTS);
  3129. }
  3130.  
  3131. if(daysResolved != -1)
  3132. {
  3133. result += '<br><i>Closed ' + uroUtils.ParseDaysAgo(daysResolved) + ' ';
  3134. if(uroResolvedTS != -1) result += '(' + uroResolvedTS + ')</i>';
  3135.  
  3136. result += '<br><i>Marked as ';
  3137. if(ureq.attributes.resolution === 0) result += 'solved';
  3138. else if(ureq.attributes.resolution == 1) result += 'not identified';
  3139. else result += 'unknown';
  3140. if(ureq.attributes.resolvedBy !== null)
  3141. {
  3142. result += ' by '+uroUtils.GetUserNameAndRank(ureq.attributes.resolvedBy);
  3143. }
  3144. result += '</i>';
  3145. }
  3146. }
  3147. if(W.model.updateRequestSessions.objects[uroMarkers.id] != null)
  3148. {
  3149. let hasMyComments = uroURHasMyComments(uroMarkers.id);
  3150. let nComments = W.model.updateRequestSessions.objects[uroMarkers.id].attributes.comments.length;
  3151. result += '<br>' + nComments + ' comment';
  3152. if(nComments != 1) result += 's';
  3153. if((hasMyComments === false) && (nComments > 0)) result += ' (none by me)';
  3154. if(nComments > 0)
  3155. {
  3156. let commentDaysOld = uroUtils.GetCommentAge(W.model.updateRequestSessions.objects[uroMarkers.id].attributes.comments[nComments-1]);
  3157. if(commentDaysOld != -1)
  3158. {
  3159. result += ', last update '+uroUtils.ParseDaysAgo(commentDaysOld);
  3160. }
  3161. }
  3162. }
  3163. if(uroURDupes.length > 0)
  3164. {
  3165. let thisID = parseInt(uroMarkers.id);
  3166. for(let i = 0; i < uroURDupes.length; ++i)
  3167. {
  3168. if(uroURDupes[i][0] === thisID)
  3169. {
  3170. result += '<br><br>Duplicate of: ';
  3171. let dupes = 0;
  3172. for(let j = 0; j < uroURDupes[i][1].length; ++j)
  3173. {
  3174. if(uroURDupes[i][1][j] !== thisID)
  3175. {
  3176. if(dupes > 0)
  3177. {
  3178. result += ', ';
  3179. }
  3180. result += uroURDupes[i][1][j];
  3181. ++dupes;
  3182. }
  3183. }
  3184. }
  3185. }
  3186. }
  3187. uroPopup.result += result;
  3188. uroPopup.UMPExtras(ureq);
  3189. uroPopup.Show();
  3190. }
  3191. }
  3192. },
  3193. MP: function()
  3194. {
  3195. let result = '';
  3196.  
  3197. // check for stacking...
  3198. if(uroShownFID != uroMarkers.id)
  3199. {
  3200. uroCheckStacking(uroLayers.ID.MP,uroMarkers.id);
  3201. }
  3202.  
  3203. if(uroUtils.GetCBChecked('_cbInhibitMPPopup') === false)
  3204. {
  3205. if(uroMousedOverMapComment !== null)
  3206. {
  3207. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for MP highlight');
  3208. uroMousedOverOtherObjectWithinMapComment = true;
  3209. }
  3210.  
  3211. uroPopup.isProblem = true;
  3212. uroPopup.newPopupType = uroMarkers.type;
  3213. let ureq = W.model.mapProblems.objects[uroMarkers.id];
  3214.  
  3215. uroFID = uroMarkers.id;
  3216. uroDBG.AddLog('building popup for problem '+uroMarkers.id);
  3217. if(uroPopup.isTurnProb) result = '<b>Turn Problem ('+uroMarkers.id+'): ' + I18n.lookup("problems.types.turn.title");
  3218. else
  3219. {
  3220. result = '<b>Map Problem ('+uroMarkers.id+'): ';
  3221.  
  3222. let problemType = ureq.attributes.subType;
  3223. if(problemType == 300)
  3224. {
  3225. result += I18n.lookup("problems.panel.closure.title");
  3226. }
  3227. else
  3228. {
  3229. if(I18n.lookup("problems.types." + problemType) === undefined) result += 'Unknown problem type ('+problemType+')';
  3230. else result += I18n.lookup("problems.types." + problemType + ".title");
  3231. }
  3232. }
  3233. result += '</b><br>';
  3234.  
  3235. if(ureq.attributes.description != null)
  3236. {
  3237. result += 'Description: ' + ureq.attributes.description + '<br>';
  3238. }
  3239. if(ureq.attributes.extraInfo != null)
  3240. {
  3241. result += 'ExtraInfo: ' + uroUtils.Clickify(ureq.attributes.extraInfo, '<br>');
  3242. }
  3243. if(ureq.attributes.provider != null)
  3244. {
  3245. result += 'Provider: ' + ureq.attributes.provider + '<br>';
  3246. }
  3247. if(ureq.attributes.startTime != null)
  3248. {
  3249. result += 'From: ' + uroUtils.GetDateTimeString(ureq.attributes.startTime) + '<br>';
  3250. }
  3251. if(ureq.attributes.endTime != null)
  3252. {
  3253. result += 'To: ' + uroUtils.GetDateTimeString(ureq.attributes.endTime) + '<br>';
  3254. }
  3255. if(ureq.attributes.resolvedOn != null)
  3256. {
  3257. let daysResolved = uroUtils.GetURAge(ureq,1,false);
  3258. if(daysResolved != -1)
  3259. {
  3260. result += '<br><i>Closed ' + uroUtils.ParseDaysAgo(daysResolved) + ' ';
  3261. if(ureq.attributes.resolvedBy != null)
  3262. {
  3263. result += ' by '+uroUtils.GetUserNameAndRank(ureq.attributes.resolvedBy);
  3264. }
  3265.  
  3266. if((ureq.attributes.open === true) && (ureq.attributes.resolvedOn != null))
  3267. {
  3268. result += '<br>Reopened by Waze';
  3269. }
  3270. result += '</i>';
  3271. }
  3272. }
  3273. uroPopup.result += result;
  3274. uroPopup.UMPExtras(ureq);
  3275. }
  3276. },
  3277. PUR: function()
  3278. {
  3279. let result = '';
  3280.  
  3281. // check for stacking...
  3282. if(uroShownFID != uroMarkers.id)
  3283. {
  3284. uroCheckStacking(uroMarkers.type, uroMarkers.id);
  3285. }
  3286.  
  3287. if(uroUtils.GetCBChecked('_cbInhibitPUPopup') === false)
  3288. {
  3289. let ureq = W.model.venues.objects[uroMarkers.id];
  3290.  
  3291. uroPopup.newPopupType = uroMarkers.type;
  3292. if(uroMousedOverMapComment !== null)
  3293. {
  3294. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for PUR highlight');
  3295. uroMousedOverOtherObjectWithinMapComment = true;
  3296. }
  3297.  
  3298. uroPopup.isPlaceUpdate = true;
  3299.  
  3300. uroFID = uroMarkers.id;
  3301.  
  3302. if(uroMarkers.type == uroLayers.ID.VPUR)
  3303. {
  3304. uroDBG.AddLog('building popup for placeUpdate '+uroMarkers.id);
  3305. }
  3306.  
  3307. result = '<b>';
  3308. if(ureq.attributes.name === '') result += 'Unnamed landmark';
  3309. else result += ureq.attributes.name;
  3310. result += '</b><br>';
  3311.  
  3312. result += '<ul>';
  3313. for(let idx = 0; idx < ureq.attributes.categories.length; idx++)
  3314. {
  3315. result += '<li>' + I18n.lookup("venues.categories." + ureq.attributes.categories[idx]);
  3316. }
  3317. result += '</ul>';
  3318.  
  3319. if(ureq.attributes.residential === true)
  3320. {
  3321. result += '<i>Residential</i>';
  3322. }
  3323.  
  3324. let daysOld = uroUtils.GetPURAge(ureq);
  3325. if(daysOld != -1)
  3326. {
  3327. result += '<br><i>Submitted '+uroUtils.ParseDaysAgo(daysOld)+'</i>';
  3328. }
  3329.  
  3330. uroPopup.result += result;
  3331. uroPopup.UMPExtras(ureq);
  3332. }
  3333. },
  3334. Venue: function()
  3335. {
  3336. if(uroUtils.GetCBChecked('_cbInhibitLandmarkPopup') === false)
  3337. {
  3338. let result = '';
  3339. let navpointPos=new OpenLayers.LonLat();
  3340. {
  3341. if(uroPopup.renderIntent === 'highlight')
  3342. {
  3343. if(uroUtils.GetExtent().intersectsBounds(uroMarkers.obj.attributes.geometry.getBounds()))
  3344. {
  3345. if(uroMousedOverMapComment !== null)
  3346. {
  3347. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for place highlight');
  3348. uroMousedOverOtherObjectWithinMapComment = true;
  3349. }
  3350.  
  3351. if(uroPopup.newPopupType === null)
  3352. {
  3353. uroFID = uroMarkers.obj.attributes.id;
  3354. uroDBG.AddLog('building popup for place '+uroFID);
  3355.  
  3356. navpointPos = uroGetVenueNavPoint(uroFID);
  3357. result += '<b>';
  3358. if(uroMarkers.obj.attributes.name === '')
  3359. {
  3360. if(uroMarkers.obj.attributes.residential === true) result += '<i>Residential</i>';
  3361. else result += '<i>Unnamed</i>';
  3362. }
  3363. else result += uroUtils.Clickify(uroMarkers.obj.attributes.name, '');
  3364. if(uroMarkers.obj.attributes.externalProviderIDs.length > 0)
  3365. {
  3366. result += ' <i>(linked)</i>';
  3367. }
  3368. if(uroMarkers.obj.attributes.adLocked)
  3369. {
  3370. result += ' <i>(AdLocked)</i>';
  3371. }
  3372. result += '</b><br>';
  3373. if(uroMarkers.obj.attributes.brand !== null)
  3374. {
  3375. result += '<i>Brand: ' + uroMarkers.obj.attributes.brand + '</i><br>';
  3376. }
  3377. let vDesc = uroMarkers.obj.attributes.description;
  3378. if(vDesc !== '')
  3379. {
  3380. result += '"<i>' + uroUtils.Clickify(vDesc, '') + '</i>"<br>';
  3381. }
  3382.  
  3383. let userLock = uroMarkers.obj.attributes.lockRank;
  3384. result += '<b>Lock: </b>' + (userLock+1);
  3385.  
  3386. result += '<hr>';
  3387. result += uroGetAddress(uroMarkers.obj.attributes.streetID, uroMarkers.obj.attributes.houseNumber, false, false, false);
  3388. result += '<ul>';
  3389. for(let idx = 0; idx < uroMarkers.obj.attributes.categories.length; idx++)
  3390. {
  3391. result += '<li>' + I18n.lookup("venues.categories." + uroMarkers.obj.attributes.categories[idx]);
  3392. }
  3393. result += '</ul>';
  3394.  
  3395. let npLink = document.location.href;
  3396. let npLayers = '';
  3397. npLink = npLink.substr(0,npLink.indexOf('?zoomLevel'));
  3398. npLink += '?zoomLevel=17&lat='+navpointPos.lat+'&lon='+navpointPos.lon+npLayers;
  3399.  
  3400. let targetTab = "_uroTab_" + Math.round(Math.random()*1000000);
  3401. result += '<hr>Jump to nav point: <a href="'+npLink+'" id="_openInNewTab" target="'+targetTab+'">in new tab</a> - ';
  3402. uroPopup.hasOpenInNewTabLink = true;
  3403.  
  3404. uroPopup.newPopupType = 'venue';
  3405. uroPopup.isVenue = true;
  3406.  
  3407. uroPopup.result += result;
  3408. uroPopup.Show();
  3409. }
  3410. else
  3411. {
  3412. let otherID = uroMarkers.obj.attributes.id;
  3413. uroDBG.AddLog('venue '+otherID+' is also highlighted');
  3414. }
  3415. }
  3416. else
  3417. {
  3418. uroDBG.AddLog('landmark '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  3419. }
  3420. }
  3421. }
  3422. }
  3423. },
  3424. Camera: function()
  3425. {
  3426. if(uroUtils.GetCBChecked('_cbInhibitCamPopup') === false)
  3427. {
  3428. let result = '';
  3429. let ureq = uroMarkers.obj;
  3430.  
  3431. if(uroPopup.renderIntent === "highlight")
  3432. {
  3433. if(uroMousedOverMapComment !== null)
  3434. {
  3435. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for camera highlight');
  3436. uroMousedOverOtherObjectWithinMapComment = true;
  3437. }
  3438. uroPopup.newPopupType = 'camera';
  3439. uroFID = uroMarkers.id;
  3440. uroDBG.AddLog('building popup for camera '+uroFID);
  3441. if(I18n.lookup("edit.camera.fields.type") === undefined)
  3442. {
  3443. result += '<b>Camera: ' + ureq.TYPES[ureq.attributes.type] + '</b>';
  3444. }
  3445. else
  3446. {
  3447. result += '<b>Camera: ' + I18n.lookup("edit.camera.fields.type." + ureq.attributes.type) + '</b>';
  3448. }
  3449. result += '<br>';
  3450. result += '<b>ID:</b> ' + uroFID + ' - ';
  3451. result += uroPopup.GetFormattedLocks(uroMarkers.obj.attributes);
  3452. result += '<br>';
  3453.  
  3454. result += '<b>Created by</b> ';
  3455. let userID;
  3456.  
  3457. if(W.model.users.getByIds([ureq.attributes.createdBy])[0] != null)
  3458. {
  3459. userID = ureq.attributes.createdBy;
  3460. result += uroUtils.GetUserNameAndRank(userID);
  3461. }
  3462. else result += 'unknown';
  3463. result += ', ';
  3464. let camAge = uroUtils.GetCameraAge(ureq,1);
  3465. if(camAge != -1)
  3466. {
  3467. result += uroUtils.ParseDaysAgo(camAge);
  3468. }
  3469. else result += 'unknown days ago';
  3470. result += '<br><b>Updated by</b> ';
  3471. if(W.model.users.getByIds([ureq.attributes.updatedBy])[0] != null)
  3472. {
  3473. userID = ureq.attributes.updatedBy;
  3474. result += uroUtils.GetUserNameAndRank(userID);
  3475. }
  3476. else result += 'unknown';
  3477. result += ', ';
  3478. camAge = uroUtils.GetCameraAge(ureq,0);
  3479. if(camAge != -1)
  3480. {
  3481. result += uroUtils.ParseDaysAgo(camAge);
  3482. }
  3483. else result += 'unknown days ago';
  3484.  
  3485. if(ureq.attributes.type !== 4)
  3486. {
  3487. result += '<br><b>Speed data:</b> ';
  3488. result += uroUtils.GetLocalisedSpeedString(ureq.attributes.speed);
  3489. }
  3490. result += '<hr><ul>';
  3491. if(ureq.attributes.permissions !== 0)
  3492. {
  3493. result += '<li><a href="#" id="_deleteobject">Delete Camera</a>';
  3494. uroPopup.hasDeleteLink = true;
  3495. }
  3496. result += '</ul>';
  3497. uroPopup.result += result;
  3498. uroPopup.Show();
  3499. }
  3500. }
  3501. },
  3502. Comment: function()
  3503. {
  3504. if(uroUtils.GetCBChecked('_cbInhibitMapCommentPopup') === false)
  3505. {
  3506. if(uroMCLayer.name !== 'mapComments')
  3507. {
  3508. uroInit.WazeBits();
  3509. }
  3510. if(uroMCLayer !== null)
  3511. {
  3512. let result = '';
  3513.  
  3514. if(uroPopup.renderIntent == 'highlight')
  3515. {
  3516. let moAttrs = uroMarkers.obj.attributes;
  3517. if(uroUtils.GetExtent().intersectsBounds(moAttrs.geometry.getBounds()))
  3518. {
  3519. if(uroPopup.newPopupType === null)
  3520. {
  3521. if((uroMousedOverMapComment === moAttrs.id) && (uroMousedOverOtherObjectWithinMapComment === true))
  3522. {
  3523. uroDBG.AddLog('inhibit popup for map comment '+uroMousedOverMapComment);
  3524. }
  3525. else
  3526. {
  3527. uroMousedOverOtherObjectWithinMapComment = false;
  3528. if(moAttrs.geometry.id.indexOf('Polygon') !== -1)
  3529. {
  3530. // only capture ID for area comments...
  3531. uroMousedOverMapComment = moAttrs.id;
  3532. }
  3533. uroFID = moAttrs.id;
  3534. uroDBG.AddLog('building popup for map comment '+uroFID);
  3535.  
  3536. result += '<b>';
  3537. if(moAttrs.subject === '')
  3538. {
  3539. result += '<i>No subject</i>';
  3540. }
  3541. else result += uroUtils.Clickify(moAttrs.subject, '');
  3542. result += '</b><br>';
  3543. result += uroUtils.Clickify(moAttrs.body, '<br>');
  3544.  
  3545. let mcDaysOld = uroUtils.GetMCAge(moAttrs, 0, false);
  3546. let mcSubmittedTS = uroUtils.GetMCAge(moAttrs, 0, true);
  3547. if(mcSubmittedTS != -1)
  3548. {
  3549. mcSubmittedTS = uroUtils.GetDateTimeString(mcSubmittedTS);
  3550. }
  3551. if(mcDaysOld != -1)
  3552. {
  3553. result += '<i>Submitted ' + uroUtils.ParseDaysAgo(mcDaysOld) + ' ';
  3554. if(mcSubmittedTS != -1) result += '(' + mcSubmittedTS + ') ';
  3555. if(moAttrs.createdBy != null)
  3556. {
  3557. result += ' by '+uroUtils.GetUserNameAndRank(moAttrs.createdBy);
  3558. }
  3559. result += '</i><br>';
  3560. }
  3561. mcDaysOld = uroUtils.GetMCAge(moAttrs, 1, false);
  3562. mcSubmittedTS = uroUtils.GetMCAge(moAttrs, 1, true);
  3563. if(mcSubmittedTS != -1)
  3564. {
  3565. mcSubmittedTS = uroUtils.GetDateTimeString(mcSubmittedTS);
  3566. }
  3567. if(mcDaysOld != -1)
  3568. {
  3569. result += '<i>Updated ' + uroUtils.ParseDaysAgo(mcDaysOld) + ' ';
  3570. if(mcSubmittedTS != -1) result += '(' + mcSubmittedTS + ') ';
  3571. if(moAttrs.createdBy != null)
  3572. {
  3573. result += ' by '+uroUtils.GetUserNameAndRank(moAttrs.updatedBy);
  3574. }
  3575. result += '</i><br>';
  3576. }
  3577.  
  3578. mcDaysOld = uroUtils.GetMCAge(moAttrs,2,false);
  3579. mcSubmittedTS = uroUtils.GetMCAge(moAttrs,2,true);
  3580. if(mcDaysOld != -1)
  3581. {
  3582. result += '<i>Expires ' + uroUtils.ParseDaysToGo(mcDaysOld) + ' ';
  3583. result += '(' + uroUtils.GetDateTimeString(mcSubmittedTS) +')</i><br>';
  3584. }
  3585.  
  3586. let mcHasMyComments = false;
  3587. let mcNComments = moAttrs.conversation.length;
  3588. if(mcNComments > 0)
  3589. {
  3590. for(let j=0; j<mcNComments; j++)
  3591. {
  3592. if(moAttrs.conversation[j].userID == uroUserID)
  3593. {
  3594. mcHasMyComments = true;
  3595. break;
  3596. }
  3597. }
  3598. }
  3599. result += '<br>' + mcNComments +' comment';
  3600. if(mcNComments != 1) result += 's';
  3601. if((mcHasMyComments === false) && (mcNComments > 0)) result += ' (none by me)';
  3602.  
  3603. // add "ignore for this session" link
  3604. result += '<br><a href="#" id="_addtoignore">Hide for this session</a>';
  3605. uroPopup.hasIgnoreLink = true;
  3606.  
  3607. uroPopup.newPopupType = 'map_comment';
  3608. uroPopup.isMapComment = true;
  3609.  
  3610. uroPopup.result += result;
  3611. uroPopup.Show();
  3612. }
  3613. }
  3614. else
  3615. {
  3616. let mcOtherID = moAttrs.id;
  3617. uroDBG.AddLog('map comment '+mcOtherID+' is also highlighted');
  3618. }
  3619. }
  3620. else
  3621. {
  3622. uroDBG.AddLog('map comment '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  3623. }
  3624. }
  3625. }
  3626. }
  3627. },
  3628. AddClosureRow: function(rcObj)
  3629. {
  3630. let startDate = rcObj.attributes.startDate;
  3631. let endDate = "unknown";
  3632. if(rcObj.attributes.endDate !== null)
  3633. {
  3634. endDate = rcObj.attributes.endDate;
  3635. }
  3636. let provider = "---";
  3637. if(rcObj.attributes.provider !== null)
  3638. {
  3639. provider = rcObj.attributes.provider;
  3640. }
  3641. else if(rcObj.attributes.createdBy !== null)
  3642. {
  3643. provider = uroUtils.GetUserNameAndRank(rcObj.attributes.createdBy);
  3644. }
  3645. let reason = "---";
  3646. if(rcObj.attributes.reason !== null)
  3647. {
  3648. reason = rcObj.attributes.reason;
  3649. }
  3650. let mte = "---";
  3651. if(rcObj.attributes.eventId !== null)
  3652. {
  3653. try
  3654. {
  3655. mte = W.model.majorTrafficEvents.objects[rcObj.attributes.eventId].attributes.names[0].value;
  3656. }
  3657. catch(err)
  3658. {
  3659. }
  3660. }
  3661. let startOffset = uroGetRTCOffset(rcObj.attributes.startDate);
  3662. let duration = uroGetRTCDuration(rcObj);
  3663. let durationStr = '';
  3664.  
  3665. if(duration > 1)
  3666. {
  3667. durationStr = I18n.lookup("datetime.distance_in_words.x_days").other;
  3668. durationStr = durationStr.replace("%{count}", duration);
  3669. }
  3670. else
  3671. {
  3672. durationStr = I18n.lookup("datetime.distance_in_words.x_days").one;
  3673. if(duration === 0)
  3674. {
  3675. durationStr = "<" + durationStr;
  3676. }
  3677. }
  3678. let state = uroGetRTCState(rcObj);
  3679. let status = uroGetRTCStateText(rcObj);
  3680. let bgCol = '';
  3681. if(state === uroEnums.SRTC.EXPIRED)
  3682. {
  3683. bgCol = '#A0A0A0';
  3684. }
  3685. else if(state === uroEnums.SRTC.ACTIVE)
  3686. {
  3687. bgCol = '#FFFFFF';
  3688. }
  3689. else if(state === uroEnums.SRTC.FUTURE)
  3690. {
  3691. // For future closures, override the default status text with an indication
  3692. // of how many days until the start of the closure
  3693. if(startOffset == 0)
  3694. {
  3695. status = I18n.lookup("date.today");
  3696. status = status.charAt(0).toUpperCase() + status.slice(1);
  3697. }
  3698. else if(startOffset == 1)
  3699. {
  3700. status = I18n.lookup("datetime.distance_in_words.x_days").one;
  3701. }
  3702. else
  3703. {
  3704. status = I18n.lookup("datetime.distance_in_words.x_days").other;
  3705. status = status.replace("%{count}", startOffset);
  3706. }
  3707. bgCol = '#C0C0C0';
  3708. }
  3709. let result = '';
  3710. result += '<tr bgcolor="' + bgCol + '">';
  3711. result += '<td nowrap>' + status + '</td>';
  3712. result += '<td nowrap>' + startDate + ' to ' + endDate + ' (' + durationStr + ')</td>';
  3713. result += '<td nowrap>' + provider + '</td>';
  3714. result += '<td nowrap>' + reason + '</td>';
  3715. result += '<td nowrap>' + mte + '</td>';
  3716. result += '</td></tr>';
  3717. return result;
  3718. },
  3719. AddClosureDetails: function(cTypes, addType, addDesc)
  3720. {
  3721. let retval = '';
  3722. if((cTypes & addType) === addType)
  3723. {
  3724. retval += '<tr><td colspan=4><b>' + addDesc + ':</b></td></tr>';
  3725. for(let closure in uroRTCObjs)
  3726. {
  3727. if(uroRTCObjs.hasOwnProperty(closure))
  3728. {
  3729. let cObj = uroRTCObjs[closure];
  3730. if(cObj.direction === addType)
  3731. {
  3732. retval += uroPopup.AddClosureRow(cObj);
  3733. }
  3734. }
  3735. }
  3736. }
  3737. return retval;
  3738. },
  3739. Segment: function()
  3740. {
  3741. if(uroUtils.GetCBChecked('_cbInhibitSegPopup') === false)
  3742. {
  3743. {
  3744. if(uroUtils.GetExtent().intersectsBounds(uroMarkers.obj.attributes.geometry.getBounds()))
  3745. {
  3746. let result = '';
  3747. let doPopUp = false;
  3748. let restObj;
  3749.  
  3750. if(uroMousedOverMapComment !== null)
  3751. {
  3752. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for segment highlight');
  3753. uroMousedOverOtherObjectWithinMapComment = true;
  3754. }
  3755.  
  3756. let streetID = uroMarkers.obj.attributes.primaryStreetID;
  3757. if(streetID !== null)
  3758. {
  3759. // generic segment data
  3760. if(uroUtils.GetCBChecked('_cbInhibitSegGenericPopup') === false)
  3761. {
  3762. doPopUp = true;
  3763. uroDBG.AddLog('building popup for segment '+streetID);
  3764.  
  3765. let isToll = ((uroMarkers.obj.attributes.fwdToll == true) || (uroMarkers.obj.attributes.revToll == true));
  3766. result += uroGetAddress(streetID, null, true, false, isToll);
  3767.  
  3768. if(uroMarkers.obj.attributes.streetIDs.length > 0)
  3769. {
  3770. // list any alternate names
  3771. result += '<br>Alternate names:<br>';
  3772. for(let i = 0; i < uroMarkers.obj.attributes.streetIDs.length; ++i)
  3773. {
  3774. result += '&nbsp;<i>' + W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.name + ', ';
  3775. let cityName = "";
  3776. if(W.model.cities.objects[W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.cityID] != undefined)
  3777. {
  3778. cityName = W.model.cities.objects[W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.cityID].attributes.name;
  3779. }
  3780. if(cityName != "")
  3781. {
  3782. result += cityName;
  3783. }
  3784. else
  3785. {
  3786. result += ' no city';
  3787. }
  3788. result += '</i><br>';
  3789. }
  3790. result += '<br>';
  3791. }
  3792.  
  3793. result += '<b>ID: </b>'+uroMarkers.obj.attributes.id+' - ';
  3794. result += uroPopup.GetFormattedLocks(uroMarkers.obj.attributes);
  3795. result += ' - ';
  3796.  
  3797. let level = uroMarkers.obj.attributes.level;
  3798. result += '<b>' + I18n.lookup("edit.segment.fields.level") +': </b>';
  3799. if(level == 0)
  3800. {
  3801. result += I18n.lookup("edit.segment.levels")[0];
  3802. }
  3803. else
  3804. {
  3805. result += level;
  3806. }
  3807. result += '<br>';
  3808.  
  3809. let leBy = uroMarkers.obj.attributes.updatedBy;
  3810. let leOn = uroMarkers.obj.attributes.updatedOn;
  3811. if(leOn == null)
  3812. {
  3813. leBy = uroMarkers.obj.attributes.createdBy;
  3814. leOn = uroMarkers.obj.attributes.createdOn;
  3815. }
  3816. result += "<b>Last edit by</b> " + uroUtils.GetUserNameAndRank(leBy) + " <b>on</b> " + uroUtils.GetDateTimeString(leOn) + "<br><br>";
  3817.  
  3818. let fwdSpeed = uroMarkers.obj.attributes.fwdMaxSpeed;
  3819. let revSpeed = uroMarkers.obj.attributes.revMaxSpeed;
  3820. let fwdLanes = uroMarkers.obj.attributes.fwdLaneCount;
  3821. let revLanes = uroMarkers.obj.attributes.revLaneCount;
  3822. let fwdWidth = 'Not set';
  3823. let revWidth = 'Not set';
  3824. if(uroMarkers.obj.attributes.fromLanesInfo != null)
  3825. {
  3826. fwdWidth = uroGetLengthString(uroMarkers.obj.attributes.fromLanesInfo.laneWidth);
  3827. }
  3828. if(uroMarkers.obj.attributes.toLanesInfo != null)
  3829. {
  3830. revWidth = uroGetLengthString(uroMarkers.obj.attributes.toLanesInfo.laneWidth);
  3831. }
  3832. let fwdUnverified = uroMarkers.obj.attributes.fwdMaxSpeedUnverified;
  3833. let revUnverified = uroMarkers.obj.attributes.revMaxSpeedUnverified;
  3834. let fwdASC = ((uroMarkers.obj.attributes.fwdFlags & 1) === 1);
  3835. let revASC = ((uroMarkers.obj.attributes.revFlags & 1) === 1);
  3836. let roadType = uroMarkers.obj.attributes.roadType;
  3837. let verifyLimits = true;
  3838. if((roadType === 17) || (roadType === 20))
  3839. {
  3840. verifyLimits = false;
  3841. }
  3842.  
  3843. result += '<table border=1><tr><th>Dir</th><th>Speed</th><th>ASC</th><th>Lanes</th><th>Width</th></tr>';
  3844. if(uroMarkers.obj.attributes.fwdDirection)
  3845. {
  3846. result += '<tr><td><b>A-B</b></td><td>'+uroUtils.GetLocalisedSpeedString(fwdSpeed)+'</td><td>';
  3847. if(fwdASC == true)
  3848. {
  3849. result += 'Yes';
  3850. }
  3851. else
  3852. {
  3853. result += 'No';
  3854. }
  3855. result += '</td><td>';
  3856. if(fwdLanes > 0)
  3857. {
  3858. result += fwdLanes;
  3859. }
  3860. else
  3861. {
  3862. result += 'Not set';
  3863. }
  3864. result += '</td><td>'+fwdWidth+'</td></tr>';
  3865. }
  3866. if(uroMarkers.obj.attributes.revDirection)
  3867. {
  3868. result += '<tr><td><b>B-A</b></td><td>'+uroUtils.GetLocalisedSpeedString(revSpeed)+'</td><td>';
  3869. if(revASC == true)
  3870. {
  3871. result += 'Yes';
  3872. }
  3873. else
  3874. {
  3875. result += 'No';
  3876. }
  3877. result += '</td><td>';
  3878. if(revLanes > 0)
  3879. {
  3880. result += revLanes;
  3881. }
  3882. else
  3883. {
  3884. result += 'Not set';
  3885. }
  3886. result += '</td><td>'+revWidth+'</td></tr>';
  3887. }
  3888. result += '</table>';
  3889.  
  3890. if((uroMarkers.obj.attributes.fwdDirection) && (uroMarkers.obj.attributes.revDirection) && (fwdSpeed != revSpeed) && (!fwdUnverified) && (!revUnverified))
  3891. {
  3892. result += '<br>Two-way segment has different verified speed limits...';
  3893. }
  3894. }
  3895.  
  3896. // segment restrictions
  3897. if(uroMarkers.obj.attributes.restrictions.length > 0)
  3898. {
  3899. result += '<br><table border=1>';
  3900. doPopUp = true;
  3901. let fwdResult = '<tr><td colspan=13><b>A-B restrictions:</b></td></tr>';
  3902. let revResult = '<tr><td colspan=13><b>B-A restrictions:</b></td></tr>';
  3903. let bothResult = '<tr><td colspan=13><b>Two-way restrictions:</b></td></tr>';
  3904.  
  3905. let nABRestrictions = 0;
  3906. let nBARestrictions = 0;
  3907. let nBothRestrictions = 0;
  3908. for(let idx = 0; idx < uroMarkers.obj.attributes.restrictions.length; idx++)
  3909. {
  3910. restObj = uroMarkers.obj.attributes.restrictions[idx];
  3911. if(restObj._direction === "FWD")
  3912. {
  3913. nABRestrictions++;
  3914. fwdResult += uroFormatRestriction(restObj);
  3915. }
  3916. else if(restObj._direction === "REV")
  3917. {
  3918. nBARestrictions++;
  3919. revResult += uroFormatRestriction(restObj);
  3920. }
  3921. else if(restObj._direction === "BOTH")
  3922. {
  3923. nBothRestrictions++;
  3924. bothResult += uroFormatRestriction(restObj);
  3925. }
  3926. else
  3927. {
  3928. uroDBG.AddLog("unknown restriction direction...");
  3929. }
  3930. }
  3931. if(nABRestrictions > 0)
  3932. {
  3933. result += fwdResult;
  3934. }
  3935. if(nBARestrictions > 0)
  3936. {
  3937. result += revResult;
  3938. }
  3939. if(nBothRestrictions > 0)
  3940. {
  3941. result += bothResult;
  3942. }
  3943. result += '</table>';
  3944. }
  3945. if(uroLayers.layers[uroLayers.ID.RTC].l.getVisibility() === true)
  3946. {
  3947. let closureTypes = uroGetSelectedSegmentRTCs(uroMarkers.obj.attributes.id);
  3948. if(closureTypes !== uroEnums.DRTC.NONE)
  3949. {
  3950. result += '<br><table border=1 width="100%">';
  3951.  
  3952. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.SEG_AB, "A-B closures");
  3953. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.SEG_BA, "B-A closures");
  3954. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.SEG_BI, "Two-way closures");
  3955. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.TURN_OUT, "Outbound turn closures");
  3956. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.TURN_IN, "Inbound turn closures");
  3957. doPopUp = true;
  3958. result += '</table>';
  3959. }
  3960. }
  3961.  
  3962. if(doPopUp === true)
  3963. {
  3964. uroFID = uroMarkers.obj.attributes.id;
  3965. uroPopup.newPopupType = 'segment_restriction';
  3966. }
  3967. }
  3968. uroPopup.result += result;
  3969. uroPopup.Show();
  3970. }
  3971. else
  3972. {
  3973. uroDBG.AddLog('segment '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  3974. }
  3975. }
  3976. }
  3977. },
  3978. Node: function()
  3979. {
  3980. if(uroUtils.GetCBChecked('_cbInhibitNodesPopup') === false)
  3981. {
  3982. let result = '';
  3983. let ureq = W.model.nodes.objects[uroMarkers.id];
  3984. if(ureq === undefined)
  3985. {
  3986. uroMarkers.id = null;
  3987. }
  3988. else
  3989. {
  3990. if(uroMousedOverMapComment !== null)
  3991. {
  3992. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for node highlight');
  3993. uroMousedOverOtherObjectWithinMapComment = true;
  3994. }
  3995. uroPopup.newPopupType = 'node';
  3996. uroFID = uroMarkers.id;
  3997. uroDBG.AddLog('building popup for node '+uroFID);
  3998. result += '<b>Node: ' + uroFID + '</b><br>';
  3999.  
  4000. let nodeSegRTCs = [];
  4001. for(let k=0; k<ureq.attributes.segIDs.length; k++)
  4002. {
  4003. let nodeSegID = ureq.attributes.segIDs[k];
  4004. let nodeSegObj = W.model.segments.objects[nodeSegID];
  4005. if(nodeSegObj !== undefined)
  4006. {
  4007. let nodeStreetID = nodeSegObj.attributes.primaryStreetID;
  4008. result += uroGetAddress(nodeStreetID, null, false, true, false);
  4009. }
  4010. uroGetSelectedSegmentRTCs(nodeSegID);
  4011. nodeSegRTCs = nodeSegRTCs.concat(uroRTCObjs);
  4012. }
  4013. }
  4014. uroPopup.result += result;
  4015. uroPopup.Show();
  4016. }
  4017. },
  4018. UMPExtras: function(ureq)
  4019. {
  4020. // add "open new WME tab" link
  4021. let urPos=new OpenLayers.LonLat();
  4022. if(uroPopup.isPlaceUpdate)
  4023. {
  4024. urPos.lon = ureq.getOLGeometry().getCentroid().x;
  4025. urPos.lat = ureq.getOLGeometry().getCentroid().y;
  4026. }
  4027. else
  4028. {
  4029. if(ureq.attributes.geometry.realX === undefined)
  4030. {
  4031. urPos.lon = ureq.attributes.geometry.x;
  4032. urPos.lat = ureq.attributes.geometry.y;
  4033. }
  4034. else
  4035. {
  4036. urPos.lon = ureq.attributes.geometry.realX;
  4037. urPos.lat = ureq.attributes.geometry.realY;
  4038. }
  4039. }
  4040. urPos = uroUtils.ConvertMercatorToWGS84(urPos);
  4041. let urLink = document.location.href;
  4042. let urLayers = '';
  4043. urLink = urLink.substr(0,urLink.indexOf('?zoomLevel'));
  4044. urLink += '?zoomLevel=17&lat='+urPos.lat+'&lon='+urPos.lon+urLayers;
  4045.  
  4046. if(uroPopup.isUR) urLink += '&mapUpdateRequest='+uroMarkers.id;
  4047. else if(uroPopup.isTurnProb) urLink += '&showturn='+uroMarkers.id+'&endshow';
  4048. else if(uroPopup.isProblem) urLink += '&mapProblem='+uroMarkers.id;
  4049. else if(uroPopup.isPlaceUpdate) urLink += '&venueUpdateRequest='+uroMarkers.id;
  4050.  
  4051. let targetTab = "_uroTab_" + Math.round(Math.random()*1000000);
  4052. uroPopup.result += '<hr>Open in: <a href="'+urLink+'" id="_openInNewTab" target="'+targetTab+'">new tab</a>';
  4053. uroPopup.hasOpenInNewTabLink = true;
  4054.  
  4055. // add "open new livemap tab" link
  4056. let lmLink = null;
  4057. if(document.getElementById("livemap-link") != null)
  4058. {
  4059. uroDBG.AddLog('Livemap link in livemap-link id element');
  4060. lmLink = document.getElementById("livemap-link").href;
  4061. }
  4062. else if(document.getElementsByClassName("livemap-link") != null)
  4063. {
  4064. uroDBG.AddLog('Livemap link in livemap-link class element');
  4065. lmLink = document.getElementsByClassName("livemap-link")[0].href;
  4066. }
  4067. else
  4068. {
  4069. uroDBG.AddLog('Livemap link not found...');
  4070. }
  4071. if(lmLink !== null)
  4072. {
  4073. let zpos = lmLink.indexOf('?');
  4074. if(zpos > -1) lmLink = lmLink.substr(0,zpos);
  4075. lmLink += '?zoom=17&lat='+urPos.lat+'&lon='+urPos.lon+'&layers=BTTTT';
  4076. uroPopup.result += ' | <a href="'+lmLink+'" target="_lmTab">new livemap tab</a>';
  4077. }
  4078. if(!uroPopup.isPlaceUpdate)
  4079. {
  4080. // add "ignore for this session" link
  4081. uroPopup.result += '<br><a href="#" id="_addtoignore">Hide for this session</a>';
  4082. uroPopup.hasIgnoreLink = true;
  4083. }
  4084.  
  4085. uroPopup.Show();
  4086. },
  4087. Preamble: function()
  4088. {
  4089. let retval = true;
  4090.  
  4091. if
  4092. (
  4093. (uroMarkers.type === null) &&
  4094. (uroPopup.timer === 0)
  4095. )
  4096. {
  4097. if(uroPopup.shown === true)
  4098. {
  4099. uroPopup.Hide();
  4100. }
  4101. uroMousedOverMapComment = null;
  4102. retval = false;
  4103. }
  4104. if(retval === true)
  4105. {
  4106. if(uroMTEMode)
  4107. {
  4108. retval = false;
  4109. }
  4110. }
  4111.  
  4112. if(retval === true)
  4113. {
  4114. if(!uroInit.initialised)
  4115. {
  4116. retval = false;
  4117. }
  4118. }
  4119.  
  4120. if(retval === true)
  4121. {
  4122. if((uroMouseIsDown) && (uroMarkers.mouseButtons === 0))
  4123. {
  4124. uroDBG.AddLog('trapped erroneous mousedown state');
  4125. uroMouseIsDown = false;
  4126. }
  4127. if(uroMouseIsDown)
  4128. {
  4129. retval = false;
  4130. }
  4131. }
  4132.  
  4133. if(retval === true)
  4134. {
  4135. if(OpenLayers === null)
  4136. {
  4137. if(uroNullOpenLayers === false)
  4138. {
  4139. uroDBG.AddLog('caught null OpenLayers');
  4140. uroNullOpenLayers = true;
  4141. }
  4142. retval = false;
  4143. }
  4144. else
  4145. {
  4146. uroNullOpenLayers = false;
  4147. }
  4148. }
  4149.  
  4150. if(retval === true)
  4151. {
  4152. if(uroLayers.layers[uroLayers.ID.UR].l === null)
  4153. {
  4154. if(uroNullURLayer === false)
  4155. {
  4156. uroDBG.AddLog('caught null UR layer');
  4157. uroNullURLayer = true;
  4158. }
  4159. retval = false;
  4160. }
  4161. else
  4162. {
  4163. uroNullURLayer = false;
  4164. }
  4165. }
  4166.  
  4167. if(retval === true)
  4168. {
  4169. if(uroLayers.layers[uroLayers.ID.MP].l === null)
  4170. {
  4171. if(uroNullProblemLayer === false)
  4172. {
  4173. uroDBG.AddLog('caught null problem layer');
  4174. uroNullProblemLayer = true;
  4175. }
  4176. retval = false;
  4177. }
  4178. else
  4179. {
  4180. uroNullProblemLayer = false;
  4181. }
  4182. }
  4183.  
  4184. if(retval === true)
  4185. {
  4186. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  4187. {
  4188. retval = false;
  4189. }
  4190. }
  4191.  
  4192. if(retval === true)
  4193. {
  4194. if(uroTestPointerOutsideMap(uroMarkers.clientX, uroMarkers.clientY))
  4195. {
  4196. retval = false;
  4197. }
  4198. }
  4199.  
  4200.  
  4201. if(retval === true)
  4202. {
  4203. uroPopup.mouseX = uroMarkers.mouseX;
  4204. uroPopup.mouseY = uroMarkers.mouseY;
  4205. uroPopup.result = '';
  4206. uroPopup.hasIgnoreLink = false;
  4207. uroPopup.hasDeleteLink = false;
  4208. uroPopup.hasAddWatchLink = false;
  4209. uroPopup.hasRemoveWatchLink = false;
  4210. uroPopup.hasUpdateWatchLink = false;
  4211. uroPopup.hasOpenInNewTabLink = false;
  4212. uroPopup.isVenue = false;
  4213. uroPopup.isMapComment = false;
  4214. uroPopup.newPopupType = null;
  4215. uroPopup.ureqID = null;
  4216. uroPopup.isUR = false;
  4217. uroPopup.isProblem = false;
  4218. uroPopup.isTurnProb = false;
  4219. uroPopup.isPlaceUpdate = false;
  4220. uroPopup.renderIntent = uroGetFeatureRenderIntent(uroMarkers.obj);
  4221.  
  4222. uroInit.WazeBits();
  4223.  
  4224. let mouseLonLat = W.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(uroPopup.mouseX, uroPopup.mouseY));
  4225. let mousePoint = new OpenLayers.Geometry.Point(mouseLonLat.lon, mouseLonLat.lat);
  4226. if(uroMousedOverMapComment !== null)
  4227. {
  4228. if(W.model.mapComments.objects[uroMousedOverMapComment] === undefined)
  4229. {
  4230. uroDBG.AddLog('clearing uroMousedOverMapComment: object no longer exists in current map view');
  4231. uroMousedOverMapComment = null;
  4232. }
  4233. else if(W.model.mapComments.objects[uroMousedOverMapComment].attributes.geometry.containsPoint(mousePoint) === false)
  4234. {
  4235. uroDBG.AddLog('clearing uroMousedOverMapComment: pointer no longer within comment boundary');
  4236. uroMousedOverMapComment = null;
  4237. }
  4238. }
  4239. let popupXOffset = document.getElementById('editor-container').getBoundingClientRect().x;
  4240. let popupYOffset = $(document.getElementById("WazeMap")).offset().top;
  4241. uroPopup.pX = uroPopup.mouseX + popupXOffset + 10;
  4242. uroPopup.pY = uroPopup.mouseY + popupYOffset;
  4243. }
  4244.  
  4245. return retval;
  4246. },
  4247. Show: function()
  4248. {
  4249. if(uroPopup.suppressed === false)
  4250. {
  4251. if((uroFID != uroShownFID) || (uroPopup.newPopupType != uroPopup.shownType))
  4252. {
  4253. if(uroFID != uroShownFID) uroDBG.AddLog('FID mismatch, show popup: '+uroFID+'/'+uroShownFID);
  4254. else uroDBG.AddLog('Popup type mismatch: '+uroPopup.newPopupType+'/'+uroPopup.shownType);
  4255. uroShownFID = uroFID;
  4256. uroPopup.shownType = uroPopup.newPopupType;
  4257. uroPopup.shown = false;
  4258. }
  4259. if(uroPopup.shown === false)
  4260. {
  4261. uroPopup.shown = true;
  4262. uroDiv.style.height = "auto";
  4263. uroDiv.style.width = "auto";
  4264. uroDiv.style.overflow = "auto";
  4265. uroDiv.innerHTML = uroUtils.ModifyHTML(uroPopup.result);
  4266. if((uroFID != -1) && (uroPopup.hasIgnoreLink === true))
  4267. {
  4268. uroUtils.AddEventListener('_addtoignore','click', uroIgnore.Add, true);
  4269. }
  4270. if(uroPopup.hasOpenInNewTabLink === true)
  4271. {
  4272. uroUtils.AddEventListener('_openInNewTab','mouseup', uroOpenNewTab, true);
  4273. }
  4274. // restrict the popup width to be no wider than just under half the window width to avoid it
  4275. // completely overlapping the marker it's associated with - by keeping it to just below half
  4276. // the window width we guarantee that it'll fit either to the left or the right of the marker
  4277. // no matter how far across the screen the marker is located...
  4278. let rw = parseInt(uroDiv.clientWidth);
  4279. if(rw > (window.innerWidth * 0.45))
  4280. {
  4281. rw = (window.innerWidth * 0.45);
  4282. uroDiv.style.width = rw+'px';
  4283. }
  4284. // get the div height after any adjustment of the width above, to account for whatever content
  4285. // reflow may have occurred as a result of reducing the width...
  4286. let rh = parseInt(uroDiv.clientHeight);
  4287. // similarly restrict the popup height to avoid it dropping of the bottom of the screen if a
  4288. // segment has a bunch of closures/restrictions
  4289. rh = parseInt(uroDiv.clientHeight);
  4290. if(rh > (window.innerHeight * 0.80))
  4291. {
  4292. rh = (window.innerHeight * 0.80);
  4293. uroDiv.style.height = rh+'px';
  4294. uroDiv.style.overflow = 'scroll';
  4295. }
  4296. let origPopupX = uroPopup.pX;
  4297. let movedLeft = false;
  4298. if((uroPopup.pX + rw) > window.innerWidth)
  4299. {
  4300. // where the popup would be off the right hand side of the screen, move it completely over to the
  4301. // other side of the mouse pointer
  4302. uroPopup.pX -= (rw + 20);
  4303. if(uroPopup.pX < 0) uroPopup.pX = 0;
  4304. movedLeft = true;
  4305. }
  4306. if((uroPopup.pY + rh) > window.innerHeight)
  4307. {
  4308. // where the popup would be off the bottom of the screen, shift it up just far enough to be
  4309. // fully visible
  4310. uroPopup.pY -= (((uroPopup.pY + rh) - window.innerHeight) + 30);
  4311. }
  4312. if(uroPopup.pY < 0) uroPopup.pY = 0;
  4313. uroDiv.style.top = uroPopup.pY+'px';
  4314. uroDiv.style.left = uroPopup.pX+'px';
  4315. if(movedLeft === true)
  4316. {
  4317. // after relocating the popup to the left of the pointer, it may end up resizing itself
  4318. // which may then cause it to completely overlap the UR marker, so perform one more check
  4319. // of the div width and nudge to the left if required...
  4320. rw = parseInt(uroDiv.clientWidth);
  4321. if(rw > (window.innerWidth * 0.45))
  4322. {
  4323. rw = (window.innerWidth * 0.45);
  4324. uroDiv.style.width = rw+'px';
  4325. }
  4326. let nudgeDist = parseInt(20 + (uroPopup.pX + rw) - origPopupX);
  4327. if((uroPopup.pX + rw + 30) >= origPopupX)
  4328. {
  4329. uroDiv.style.left = parseInt(uroPopup.pX - nudgeDist)+'px';
  4330. }
  4331. }
  4332.  
  4333. uroDBG.AddLog('display popup at '+uroPopup.pX+','+uroPopup.pY);
  4334. uroDiv.style.visibility = 'visible';
  4335. uroPopup.autoHideTimer = (uroUtils.GetElmValue('_inputPopupAutoHideTimeout') * 10);
  4336. }
  4337. uroPopup.timer = -1;
  4338. }
  4339. },
  4340. Generate: function()
  4341. {
  4342. if(uroPopup.Preamble() === true)
  4343. {
  4344. if(uroMarkers.type === uroLayers.ID.UR) uroPopup.UR();
  4345. else if(uroMarkers.type === uroLayers.ID.MP) uroPopup.MP();
  4346. else if(uroMarkers.type === uroLayers.ID.VPUR) uroPopup.PUR();
  4347. else if(uroMarkers.type === "venue") uroPopup.Venue();
  4348. else if(uroMarkers.type === "cam") uroPopup.Camera();
  4349. else if(uroMarkers.type === "comment") uroPopup.Comment();
  4350. else if(uroMarkers.type === "segment") uroPopup.Segment();
  4351. else if(uroMarkers.type === "node") uroPopup.Node();
  4352. else
  4353. {
  4354. uroDBG.AddLog("request to generate popup for unhandled type - " + uroMarkers.type);
  4355. }
  4356. }
  4357. },
  4358. Hide: function()
  4359. {
  4360. if(uroPopup.shown)
  4361. {
  4362. uroDiv.style.visibility = 'hidden';
  4363. uroPopup.shown = false;
  4364. uroPopup.timer = -2;
  4365. uroShownFID = -1;
  4366. }
  4367. uroPopup.suppressed = false;
  4368. },
  4369. Suppress: function()
  4370. {
  4371. uroDiv.style.visibility = 'hidden';
  4372. window.getSelection().removeAllRanges();
  4373. uroPopup.suppressed = true;
  4374. },
  4375. MouseOver: function()
  4376. {
  4377. uroPopup.mouseIn = true;
  4378. },
  4379. MouseOut: function()
  4380. {
  4381. uroPopup.mouseIn = false;
  4382. }
  4383. };
  4384. const uroURExtras = // UR marker enhancements
  4385. {
  4386. urList : [],
  4387. URListEntry: function(id, customType, hasMyComments, nComments, ageLastComment)
  4388. {
  4389. this.id = id;
  4390. this.customType = customType;
  4391. this.hasMyComments = hasMyComments;
  4392. this.nComments = nComments;
  4393. this.ageLastComment = ageLastComment;
  4394. },
  4395. AddToList: function(urID, customType, hasMyComments, nComments, ageLastComment)
  4396. {
  4397. uroURExtras.urList.push(new uroURExtras.URListEntry(urID, customType, hasMyComments, nComments, ageLastComment));
  4398. },
  4399. RemoveCommentCounts: function()
  4400. {
  4401. let toRemove = document.querySelectorAll('#uroCommentCount');
  4402. let trCount = toRemove.length;
  4403. while(trCount > 0)
  4404. {
  4405. --trCount;
  4406. toRemove[trCount].remove();
  4407. }
  4408. },
  4409. AddCommentCounts: function()
  4410. {
  4411. // Remove existing count elements before (re-)rendering, as WME doesn't automatically do this
  4412. // for us now that the way it handles the marker layers has changed...
  4413. uroURExtras.RemoveCommentCounts();
  4414. let addCommentCount = false;
  4415. let nURs = uroURExtras.urList.length;
  4416.  
  4417. if(uroUtils.GetCBChecked('_cbMasterEnable') === true)
  4418. {
  4419. addCommentCount = ((nURs > 0) && (uroUtils.GetCBChecked('_cbCommentCount') === true));
  4420. }
  4421.  
  4422. if(addCommentCount === true)
  4423. {
  4424. for(let i = 0; i < nURs; ++i)
  4425. {
  4426. let uObj = uroURExtras.urList[i];
  4427. let nComments = uObj.nComments;
  4428. let marker = uroGetMarker(uroLayers.ID.UR, uObj.id);
  4429. if((marker !== null) && (nComments !== 0))
  4430. {
  4431. let mx = (marker.x.baseVal.value - 15);
  4432. let my = (marker.y.baseVal.value + 35);
  4433. let newSpan = '<foreignObject id="uroCommentCount" x="' + mx + '" y="' + my + '" width="100%" height="100%" style="pointer-events: none;">';
  4434.  
  4435. newSpan += '<div style="position:absolute;';
  4436. if(uObj.hasMyComments === true)
  4437. {
  4438. newSpan += 'background-color: yellow;';
  4439. }
  4440. else
  4441. {
  4442. newSpan += 'background-color: white;';
  4443. }
  4444. newSpan += 'font-size: 14px;font-weight: 800;';
  4445. newSpan += 'border-width: 1px;border-style: solid;border-radius: 12px;padding-left: 4px;padding-right: 4px;z-index: 1;';
  4446. newSpan += '">';
  4447. newSpan += nComments + 'c ';
  4448. newSpan += uObj.ageLastComment + 'd';
  4449. newSpan += '</div>';
  4450.  
  4451. newSpan += '</foreignObject>';
  4452. marker.insertAdjacentHTML("afterend", newSpan);
  4453. }
  4454. }
  4455. }
  4456. }
  4457. };
  4458. const uroInit = // script initialisation
  4459. {
  4460. initialised : false,
  4461. setupListeners : true,
  4462. finalisingListenerSetup : false,
  4463.  
  4464. WazeBitsAvailable: function()
  4465. {
  4466. uroDBG.AddLog('All WazeBits present and correct...');
  4467. W.prefs.on('change:isImperial', uroInit.Initialise);
  4468. uroLayers.Init();
  4469. // To avoid creating multiple URO tabs in the event that the initialise code
  4470. // gets called more than once, we now test for the presence of our tab and skip
  4471. // if it's already present
  4472. if(document.getElementById('uroTabHeader') === null)
  4473. {
  4474. uroInit.SetupUI();
  4475. }
  4476. },
  4477. WaitForW: function()
  4478. {
  4479. if(document.getElementsByClassName("sandbox").length > 0)
  4480. {
  4481. uroDBG.AddLog('WME practice mode detected, script is disabled...');
  4482. return;
  4483. }
  4484. if(window.W === undefined)
  4485. {
  4486. window.setTimeout(uroInit.WaitForW, 100);
  4487. return;
  4488. }
  4489. if (W.userscripts?.state?.isReady)
  4490. {
  4491. uroInit.WazeBitsAvailable();
  4492. }
  4493. else
  4494. {
  4495. document.addEventListener("wme-ready", uroInit.WazeBitsAvailable, {once: true});
  4496. }
  4497. },
  4498. AddInterceptor: function()
  4499. {
  4500. uroDBG.AddLog('Adding interceptor functions...');
  4501. // add interceptor function for window.confirm(), to inhibit the closure deletion confirmation that would
  4502. // pop up for each individual closure when we're using the delete all button - the user has already
  4503. // confirmed the delete action using our own requester
  4504. let _confirm = window.confirm;
  4505. window.confirm = function(msg)
  4506. {
  4507. let cm_delete_confirm = I18n.lookup("closures.delete_confirm").split('"')[0].trimRight(1);
  4508. if(msg.indexOf(cm_delete_confirm) != -1)
  4509. {
  4510. uroDBG.AddLog('intercepted closure delete confirmation...');
  4511. if(uroRTCClone.ConfirmDelete)
  4512. {
  4513. return _confirm(msg);
  4514. }
  4515. else
  4516. {
  4517. return true;
  4518. }
  4519. }
  4520. else if(typeof(msg) == 'undefined')
  4521. {
  4522. uroDBG.AddLog('Intercepted blank confirmation...');
  4523. return true;
  4524. }
  4525. else
  4526. {
  4527. return _confirm(msg);
  4528. }
  4529. };
  4530. uroConfirmIntercepted = true;
  4531. },
  4532. Initialise: function()
  4533. {
  4534. uroInit.initialised = false;
  4535. uroInit.setupListeners = true;
  4536. uroInit.finalisingListenerSetup = false;
  4537. uroInit.WaitForW();
  4538. },
  4539. WaitForControlsContainer: function()
  4540. {
  4541. if(document.getElementById('uroControlsContainer') === null)
  4542. {
  4543. window.setTimeout(uroInit.WaitForControlsContainer,500);
  4544. }
  4545. else
  4546. {
  4547. let updateURL = 'https://greasyfork.org/scripts/1952-uroverview-plus-uro';
  4548. uroDBG.AddLog('adding controls to sidebar container...');
  4549. let tabbyHTML = '<div id="uroTabHeader"><b><a href="'+updateURL+'" target="_blank">UROverview Plus</a></b> <label id="_uroVersion">'+uroRelease.version+'</label>';
  4550. tabbyHTML += '<label id="_uroDebugMode">(dbg)</label>';
  4551. tabbyHTML += '&nbsp;<input type="checkbox" id="_cbMasterEnable" checked>Enabled</input>';
  4552. tabbyHTML += uroTabs.CreateTabHeaders();
  4553. tabbyHTML += '</div>';
  4554. document.getElementById('uroControlsContainer').innerHTML = uroUtils.ModifyHTML(tabbyHTML);
  4555. uroTabs.CreateTabBodies();
  4556. // other sidebar elements
  4557. uroAMList = document.createElement('div');
  4558. uroAMList.style.color = "#ffff00";
  4559. uroCtrlHides = document.createElement('div');
  4560. // footer for tabs container
  4561. uroCtrlHides.id = 'uroCtrlHides';
  4562. let tHTML = '<input type="button" id="_btnUndoLastHide" value="Undo last hide" />&nbsp;&nbsp;&nbsp;';
  4563. tHTML += '<input type="button" id="_btnClearSessionHides" value="Undo all hides" /><p>';
  4564. uroCtrlHides.innerHTML = uroUtils.ModifyHTML(tHTML);
  4565. // footer for AM list
  4566. uroAMList.id = 'uroAMList';
  4567. uroTabs.CtrlTabs[0][uroTabs.FIELDS.SHOWFN]();
  4568. window.addEventListener("beforeunload", uroConfig.SaveSettings, false);
  4569. }
  4570. },
  4571. AddTab_API: async function()
  4572. {
  4573. let {tabLabel, tabPane} = W.userscripts.registerSidebarTab("URO+");
  4574. tabLabel.innerText = "URO+";
  4575. tabPane.innerHTML = uroUtils.ModifyHTML(uroControls.innerHTML);
  4576. await W.userscripts.waitForElementConnected(tabPane);
  4577. uroInit.CompleteUISetup();
  4578. },
  4579. CompleteUISetup: function()
  4580. {
  4581. uroDBG.AddLog('waiting for controls container...');
  4582. uroInit.WaitForControlsContainer();
  4583. uroGetProblemTypes();
  4584. uroTabs.AddToDOM();
  4585. document.getElementById('uroControlsContainer').appendChild(uroCtrlHides);
  4586. uroInit.WazeBits();
  4587. uroDiv.addEventListener("mouseover", uroPopup.MouseOver, false);
  4588. uroDiv.addEventListener("mouseout", uroPopup.MouseOut, false);
  4589. if(sessionStorage.UROverview_FID_IgnoreList === undefined) sessionStorage.UROverview_FID_IgnoreList = '';
  4590. if(sessionStorage.UROverview_FID_WatchList === undefined) sessionStorage.UROverview_FID_WatchList = '';
  4591. if(uroConfirmIntercepted === false) uroInit.AddInterceptor();
  4592. uroUtils.AddStyle('urostyle_UnstackedMarkers', '.map-marker.marker-selected { transform: scale(1) !important; }');
  4593. uroMainTickHandlerID = window.setInterval(uroMainTick,1000);
  4594. },
  4595. SetupUI: function()
  4596. {
  4597. // create a new div to display the UR details floaty-box
  4598. uroDiv = document.createElement('div');
  4599. uroDiv.id = "uroDiv";
  4600. uroDiv.style.position = 'absolute';
  4601. uroDiv.style.visibility = 'hidden';
  4602. uroDiv.style.top = '0';
  4603. uroDiv.style.left = '0';
  4604. uroDiv.style.zIndex = 10000;
  4605. uroDiv.style.backgroundColor = 'aliceblue';
  4606. uroDiv.style.borderWidth = '3px';
  4607. uroDiv.style.borderStyle = 'solid';
  4608. uroDiv.style.borderRadius = '10px';
  4609. uroDiv.style.boxShadow = '5px 5px 10px Silver';
  4610. uroDiv.style.padding = '4px';
  4611. document.body.appendChild(uroDiv);
  4612. // create a new div to display script alerts
  4613. uroAlerts = document.createElement('div');
  4614. uroAlerts.id = "uroAlerts";
  4615. uroAlerts.style.position = 'fixed';
  4616. uroAlerts.style.visibility = 'hidden';
  4617. uroAlerts.style.top = '50%';
  4618. uroAlerts.style.left = '50%';
  4619. uroAlerts.style.zIndex = 10000;
  4620. uroAlerts.style.backgroundColor = 'aliceblue';
  4621. uroAlerts.style.borderWidth = '3px';
  4622. uroAlerts.style.borderStyle = 'solid';
  4623. uroAlerts.style.borderRadius = '10px';
  4624. uroAlerts.style.boxShadow = '5px 5px 10px Silver';
  4625. uroAlerts.style.padding = '4px';
  4626. uroAlerts.style.webkitTransform = "translate(-50%, -50%)";
  4627. uroAlerts.style.transform = "translate(-50%, -50%)";
  4628. let alertsHTML = '<div id="header" style="padding: 4px; background-color:LightGreen; font-weight: bold;">Alert title goes here...</div>';
  4629. alertsHTML += '<div id="content" style="padding: 4px; background-color:White; overflow:auto;max-height:500px">Alert content goes here...</div>';
  4630. alertsHTML += '<div id="controls" align="center" style="padding: 4px;">';
  4631. alertsHTML += '<span id="uroAlertTickBtn" style="cursor:pointer;font-size:14px;border:thin outset black;padding:2px 10px 2px 10px;">';
  4632. alertsHTML += '<i class="fa fa-check"> </i>';
  4633. alertsHTML += '<span id="uroAlertTickBtnCaption" style="font-weight: bold;"></span>';
  4634. alertsHTML += '</span>';
  4635. alertsHTML += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  4636. alertsHTML += '<span id="uroAlertCrossBtn" style="cursor:pointer;font-size:14px;border:thin outset black;padding:2px 10px 2px 10px;">';
  4637. alertsHTML += '<i class="fa fa-times"> </i>';
  4638. alertsHTML += '<span id="uroAlertCrossBtnCaption" style="font-weight: bold;"></span>';
  4639. alertsHTML += '</span>';
  4640. alertsHTML += '</div>';
  4641. uroAlerts.innerHTML = uroUtils.ModifyHTML(alertsHTML);
  4642. document.body.appendChild(uroAlerts);
  4643. uroControls = document.createElement('section');
  4644. uroControls.style.fontSize = '12px';
  4645. uroControls.style.height = '100%';
  4646. uroControls.id = "sidepanel-uroverview";
  4647. uroControls.className = "tab-pane";
  4648. uroControls.innerHTML = uroUtils.ModifyHTML('<div id="uroControlsContainer" style="display:flex;flex-direction:column;height:80vh;"></div>');
  4649. uroInit.AddTab_API();
  4650. },
  4651. WazeBits: function()
  4652. {
  4653. uroMCLayer = null;
  4654.  
  4655. for(let i=0; i < W.map.layers.length; i++)
  4656. {
  4657. if(W.map.layers[i].name == 'mapComments') uroMCLayer = W.map.layers[i];
  4658. if(W.map.layers[i].name == 'venues') uroVenueLayer = W.map.layers[i];
  4659. }
  4660. },
  4661. FinalizeListenerSetup: function()
  4662. {
  4663. uroInit.finalisingListenerSetup = true;
  4664. // filter markers when the marker objects are modified (this happens whenever WME needs to load fresh marker data
  4665. // due to having panned/zoomed the map beyond the extents of the previously loaded data)
  4666. W.model.mapUpdateRequests.on("objectschanged", uroFilterURs_onObjectsChanged);
  4667. W.model.mapUpdateRequests.on("objectsadded", uroFilterURs_onObjectsAdded);
  4668. W.model.mapUpdateRequests.on("objectsremoved", uroFilterURs_onObjectsRemoved);
  4669. W.model.updateRequestSessions.on("objectsadded", uroUREvent_onObjectsAdded);
  4670. /*
  4671. W.model.cameras.on("objectschanged", uroFilterCameras);
  4672. W.model.cameras.on("objectsadded", uroFilterCameras);
  4673. W.model.cameras.on("objectsremoved", uroFilterCameras);
  4674. */
  4675. W.model.mapProblems.on("objectschanged", uroFilterProblems);
  4676. W.model.mapProblems.on("objectsadded", uroFilterProblems);
  4677. W.model.mapProblems.on("objectsremoved", uroFilterProblems);
  4678. W.model.venues.on("objectschanged", uroFilterPlaces);
  4679. W.model.venues.on("objectsadded", uroFilterPlaces);
  4680. W.model.venues.on("objectsremoved", uroFilterPlaces);
  4681. W.model.mapComments.on("objectschanged", uroLayers.MCLayerChanged_changed);
  4682. W.model.mapComments.on("objectsadded", uroLayers.MCLayerChanged_added);
  4683. W.model.mapComments.on("objectsremoved", uroLayers.MCLayerChanged_removed);
  4684. uroMarkers.RegisterEvents();
  4685. uroLayers.InitialiseMOs();
  4686. uroUtils.AddEventListener('_btnUndoLastHide', "click", uroIgnore.RemoveLastAdded, true);
  4687. uroUtils.AddEventListener('_btnClearSessionHides', "click", uroIgnore.RemoveAll, true);
  4688. uroIgnore.EnableControls();
  4689. uroUtils.AddEventListener('_btnSettingsToText', "click", uroConfig.SettingsToText, true);
  4690. uroUtils.AddEventListener('_btnTextToSettings', "click", uroConfig.TextToSettings, true);
  4691. uroUtils.AddEventListener('_btnResetSettings', "click", uroConfig.DefaultSettings, true);
  4692. uroUtils.AddEventListener('_btnClearSettingsText', "click", uroConfig.ClearSettingsText, true);
  4693. uroUtils.AddEventListener('_cbMasterEnable', "click", uroFilterItems_MasterEnableClick, true);
  4694. /*
  4695. uroUtils.AddEventListener('_btnDebugToScreen',"click", uroDBG.Dump, true);
  4696. */
  4697. uroUtils.AddEventListener('uroDiv', "dblclick", uroPopup.Suppress, true);
  4698. ////uroUtils.AddEventListener('_selectCameraUserID', "change", uroCamEditorSelected, true);
  4699. uroUtils.AddEventListener('_selectPlacesUserID', "change", uroPlacesEditorSelected, true);
  4700. uroUtils.AddEventListener('_selectHidePlacesUserID', "change", uroHidePlacesEditorSelected, true);
  4701. uroUtils.AddEventListener('uroAlertTickBtn', 'click', uroAlertBox.CloseWithTick, true);
  4702. uroUtils.AddEventListener('uroAlertCrossBtn', 'click', uroAlertBox.CloseWithCross, true);
  4703. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  4704. {
  4705. uroUtils.SetOnClick(uroTabs.CtrlTabs[i][uroTabs.FIELDS.LINKID], uroTabs.CtrlTabs[i][uroTabs.FIELDS.SHOWFN]);
  4706. }
  4707. for(let idx=0;idx<W.Config.venues.categories.length;idx++)
  4708. {
  4709. uroUtils.SetOnClick('_uroPlacesGroupState-'+idx,uroPlacesGroupCollapseExpand);
  4710. }
  4711. uroDBG.AddLog('finalise onload');
  4712. uroNewLookCheckDetailsRequest();
  4713. // filter markers as and when the map is moved
  4714. W.map.events.register("moveend", null, uroMapMoveEnd.Handler);
  4715. W.map.events.register("moveend", null, uroGetAMs); // uroGetAMs accesses e, so has to be called directly from the event handler
  4716. W.map.events.register("mousemove", null, uroGetAMs);
  4717. W.map.events.register("mousemove", null, uroMarkers.MouseMove);
  4718. W.map.events.registerPriority("mousedown", null, uroMouseDown);
  4719. // trap mousedown on Streetview marker drag
  4720. if(document.getElementsByClassName('street-view-control').length === 0) return;
  4721. document.getElementsByClassName('street-view-control')[0].onmousedown = uroMouseDown;
  4722. W.map.events.register("mouseup", null, uroMouseUp);
  4723. W.map.events.register("mouseout", null, uroMouseOut);
  4724. uroSetSectionTabStyles();
  4725. uroConfig.LoadSettings();
  4726. uroUITweaks.ChangeClustering();
  4727.  
  4728. uroDBG.AddLog('getting user ID...');
  4729. uroUserID = W.loginManager.user.attributes.id;
  4730. uroDBG.AddLog('...ID is '+uroUserID);
  4731. uroDBG.AddLog('filtering...');
  4732. uroFilterItems();
  4733. uroDBG.AddLog('...done');
  4734. uroDBG.showDebugOutput = uroDBG.persistentDebugOutput;
  4735. let dbgMode = "none";
  4736. if(uroDBG.showDebugOutput)
  4737. {
  4738. dbgMode = "inline";
  4739. }
  4740. document.getElementById('_uroDebugMode').style.display = dbgMode;
  4741. uroUtils.AddEventListener('_uroVersion',"click", uroDBG.Toggle, true);
  4742. // add exclusiveCB click handlers to all checkboxes with a pairedWith attribute
  4743. uroDBG.AddLog('adding exclusiveCB handlers...');
  4744. let cbList = document.getElementsByTagName('input');
  4745. for (let optIdx=0;optIdx<cbList.length;optIdx++)
  4746. {
  4747. if((cbList[optIdx].id.indexOf('_cb') === 0) && (cbList[optIdx].attributes.pairedWith != null))
  4748. {
  4749. uroUtils.SetOnClick(cbList[optIdx].id,uroExclusiveCB);
  4750. }
  4751. }
  4752. uroDBG.AddLog('...done');
  4753. // manually call the layer-change handlers on startup, since there's a good chance WME will already have
  4754. // completed its own startup layer changes before our handlers get registered, preventing the marker handlers
  4755. // from being set up as expected on any markers which are visible in the startup map view before the user forces
  4756. // a layer update by panning/zooming/etc...
  4757. uroLayers.RunChangeHandlers();
  4758.  
  4759. uroUITweaks.Setup();
  4760. uroInit.setupListeners = false;
  4761. uroMainTickStage = 0;
  4762. window.clearInterval(uroMainTickHandlerID);
  4763. window.setInterval(uroMainTick, 10);
  4764. uroInit.initialised = true;
  4765. }
  4766. };
  4767. const uroUITweaks = // native UI enhancements
  4768. {
  4769. MO_SidePanel : null,
  4770. MO_ReportPanel : null,
  4771.  
  4772. ChangeMapBGColour: function()
  4773. {
  4774. let mapviewport = document.getElementById("WazeMap").getElementsByClassName("olMapViewport")[0];
  4775. if((uroUtils.GetCBChecked('_cbWhiteBackground') === true) && (uroUtils.GetCBChecked('_cbMasterEnable') === true))
  4776. {
  4777. let customColour = '#' + uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundRed'),2);
  4778. customColour += uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundGreen'),2);
  4779. customColour += uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundBlue'),2);
  4780. mapviewport.style.setProperty('background',customColour,'important');
  4781. }
  4782. else
  4783. {
  4784. mapviewport.style.setProperty('background',"#354148",'important');
  4785. }
  4786. },
  4787. HideAMLayer: function()
  4788. {
  4789. // If this sounds like a weird function - why not just switch off the layer from the layers menu? - then
  4790. // remember that in order for URO+ to be able to display in its own tab the list of AMs under the current
  4791. // mouse pointer location, which is somewhat more useful than the list given in the topbar, it needs the
  4792. // AM layer to be activated so that the AM areas data is loaded into WME. It doesn't however need the layer
  4793. // to then be visible, and since having a bunch of purple polygons covering the map can make for a rather
  4794. // difficult editing experience, being able to hide the polys whilst retaining the area information is
  4795. // of real benefit...
  4796. if((uroUtils.GetCBChecked('_cbHideAMLayer')) && (uroUtils.GetCBChecked('_cbMasterEnable')))
  4797. {
  4798. W.map.managedAreasLayer.setOpacity(0);
  4799. }
  4800. else
  4801. {
  4802. W.map.managedAreasLayer.setOpacity(1);
  4803. }
  4804. },
  4805. HideSegments: function()
  4806. {
  4807. // Hides the vector segments when the raster segment layer is hidden
  4808. if(uroUtils.GetCBChecked('_cbHideSegmentsWhenRoadsHidden'))
  4809. {
  4810. W.map.segmentLayer.drawn = W.map.roadLayer.visibility;
  4811. W.map.nodeLayer.drawn = W.map.roadLayer.visibility;
  4812. }
  4813. else
  4814. {
  4815. W.map.segmentLayer.drawn = true;
  4816. W.map.nodeLayer.drawn = true;
  4817. }
  4818. },
  4819. SetClusteringFor: function(layerID, toDisable)
  4820. {
  4821. let strat = uroLayers.layers[layerID].l.strategies;
  4822. if((strat !== undefined) && (strat.length > 0))
  4823. {
  4824. if(toDisable === true)
  4825. {
  4826. strat[0].threshold = 100000;
  4827. }
  4828. else
  4829. {
  4830. strat[0].threshold = 10;
  4831. }
  4832. }
  4833. },
  4834. ChangeClustering: function()
  4835. {
  4836. uroUITweaks.SetClusteringFor(uroLayers.ID.UR, uroUtils.GetCBChecked('_cbInhibitURClusters'));
  4837. uroUITweaks.SetClusteringFor(uroLayers.ID.MP, uroUtils.GetCBChecked('_cbInhibitMPClusters'));
  4838. uroUITweaks.SetClusteringFor(uroLayers.ID.PUR, uroUtils.GetCBChecked('_cbInhibitPUClusters'));
  4839. uroUITweaks.SetClusteringFor(uroLayers.ID.PPUR, uroUtils.GetCBChecked('_cbInhibitPUClusters'));
  4840. uroUITweaks.SetClusteringFor(uroLayers.ID.RPUR, uroUtils.GetCBChecked('_cbInhibitPUClusters'));
  4841. uroUITweaks.SetClusteringFor(uroLayers.ID.SegSug, uroUtils.GetCBChecked('_cbInhibitESClusters'));
  4842. uroUITweaks.SetClusteringFor(uroLayers.ID.EditSug, uroUtils.GetCBChecked('_cbInhibitESClusters'));
  4843.  
  4844. // If the map is zoomed out far enough such that clustering could be occurring, perform a
  4845. // zoom in-out to force a redraw of the markers based on whatever the new clustering
  4846. // settings are...
  4847. if(W.map.getZoom() < 16)
  4848. {
  4849. W.map.zoomIn();
  4850. W.map.zoomOut();
  4851. }
  4852. },
  4853. ReportPanelChange: function()
  4854. {
  4855. // Inhibit map re-centering when opening a report
  4856. if(uroMarkers.inhibitSetCenter === true)
  4857. {
  4858. let bcr = document.querySelector('#panel-container').getBoundingClientRect();
  4859. if(bcr.width > 0)
  4860. {
  4861. uroMarkers.inhibitSetCenter = false;
  4862. W.map.setCenter(uroMarkers.clickedOnCenter);
  4863. }
  4864. }
  4865.  
  4866. // "panel-container" now also gets used to show the turn closure UI, so reuse this MO handler
  4867. // as a way to also apply the MTE dropdown fix here...
  4868. let mteDropDown = document.querySelector('#panel-container #closure_eventId');
  4869. if(mteDropDown !== undefined)
  4870. {
  4871. uroFixMTEDropDown(mteDropDown);
  4872. }
  4873. },
  4874. CheckForClosurePanel: function()
  4875. {
  4876. if(document.querySelector('.closures-list') !== null)
  4877. {
  4878. // Closure panel active
  4879. let uroMO_ClosureUI = new MutationObserver(uroClosureEditUIChanged);
  4880. uroMO_ClosureUI.disconnect();
  4881. uroMO_ClosureUI.observe(document.querySelector('wz-tab.closures-tab'),{subtree: true, attributes: true});
  4882. uroClosureEditUIChanged();
  4883.  
  4884. let cl = document.querySelector('.closures-list');
  4885. if(cl !== null)
  4886. {
  4887. let uroRO_ClosureUI = new ResizeObserver(uroScrollToEndOfClosures);
  4888. uroRO_ClosureUI.disconnect();
  4889. uroRO_ClosureUI.observe(cl);
  4890. }
  4891. uroScrollToEndOfClosures();
  4892. }
  4893. },
  4894. SidePanelChange: function()
  4895. {
  4896. // The sidepanel MO only fires when the sidepanel changes in bulk - i.e. when first rendered, or
  4897. // when changing to show details for a different type of map object. Once this version of the
  4898. // panel is open, any internal changes, such as selecting a different tab within the panel, do
  4899. // NOT trigger the MO. Consequently, if a segment is selected and the sidepanel doesn't then
  4900. // open with the closures tab already selected, the MO will fire at this point rather than at the
  4901. // point where the closures tab is selected...
  4902. //
  4903. // To ensure the closures UI enhancements are applied consistently, we therefore need to set up an
  4904. // onclick handler to deal with the sidepanel opening into a different tab and the user then
  4905. // clicking through into the closures tab after this MO has already fired, but we ALSO still need
  4906. // to check for the availability of the closures UI here as well just in case the sidepanel opens
  4907. // into the closures tab directly.
  4908. //
  4909. // Easy really...
  4910.  
  4911. let elmToClick = document.querySelector('#edit-panel');
  4912. if(elmToClick !== null)
  4913. {
  4914. uroUtils.SetOnClick(elmToClick, uroUITweaks.CheckForClosurePanel);
  4915. }
  4916. uroUITweaks.CheckForClosurePanel();
  4917. },
  4918. Setup: function()
  4919. {
  4920. uroUITweaks.MO_SidePanel = new MutationObserver(uroUITweaks.SidePanelChange);
  4921. uroUITweaks.MO_SidePanel.observe(document.getElementById('edit-panel'), {childList: true, subtree: true});
  4922. uroUITweaks.MO_ReportPanel = new MutationObserver(uroUITweaks.ReportPanelChange);
  4923. uroUITweaks.MO_ReportPanel.observe(document.getElementById('panel-container'), {childList: true, subtree: true});
  4924.  
  4925. uroUITweaks.ChangeMapBGColour();
  4926. uroUITweaks.HideAMLayer();
  4927. uroUITweaks.HideSegments();
  4928. }
  4929. };
  4930. const uroMapMoveEnd = // things that happen after a move of the map view
  4931. {
  4932. lat : null,
  4933. lon: null,
  4934. zoom: null,
  4935. Handler: function()
  4936. {
  4937. let mc = W.map.getCenter();
  4938. let z = W.map.getZoom();
  4939. if((mc.lat != this.lat) || (mc.lon != this.lon) || (z != this.zoom))
  4940. {
  4941. // Apply any filters which need to be updated when the map view changes,
  4942. // and which won't be applied via an event handler or mutation observer
  4943. // attached to the relevant layer etc...
  4944. uroFilterProblems();
  4945. uroFilterPlaces();
  4946. uroFilterCameras();
  4947. uroFilterURs();
  4948. uroFilterRAs();
  4949. uroFilterMapComments();
  4950.  
  4951. uroMiscUITweaksHandler();
  4952. uroLayers.MCLayerChanged();
  4953. this.lat = mc.lat;
  4954. this.lon = mc.lon;
  4955. this.zoom = z;
  4956. }
  4957. }
  4958. };
  4959.  
  4960.  
  4961. // ================================================================================================
  4962. // Here be the unfactored wilderness...
  4963. // ================================================================================================
  4964.  
  4965.  
  4966. function uroFixMTEDropDown(mteDropDown)
  4967. {
  4968. // Auto-selects the "None" event within the MTE dropdown element passed into the function, to avoid the user having
  4969. // to manually select it - the only time you'd need to select something other than None is when you're assigning a
  4970. // closure to a MTE, at which point you need to manually select the appropriate event from the dropdown anyway, so
  4971. // pre-selecting None doesn't increase the workload for setting up a MTE-related closure, and it reduces the workload
  4972. // for setting up other closures...
  4973. //
  4974. // The only possible negative to this hack is that it means the user can set up a MTE-related closure without being
  4975. // reminded by WME to select the appropriate event from the list, because now that we're defaulting it to None, WME
  4976. // will allow the closure to be set without complaining that no event is set... But TBH, that's a small price to pay
  4977. // compared with the far, FAR, larger irritation of forcing users to always select None for all the closures that
  4978. // get added every single day without ever needing to be associated with a MTE - if a handful of closures end up being
  4979. // added with the user having forgotten to select the MTE, then no biggie. The closure will still at least have been
  4980. // added and its effect on routing around the event will therefore still be just as it would be if the MTE had been
  4981. // associated with the closure - the only difference is that if someone then bothers to look at the overview map of the
  4982. // MTE, they won't see that particular segment listed as a closure. I can live with the tiny risk of that causing any
  4983. // real problems, when weighed up against the millions of extra clicks saved through pre-selecting None...
  4984.  
  4985. let retval = false;
  4986.  
  4987. // Make sure the closure event list is available, and that we haven't already messed with it.
  4988. if((mteDropDown !== null) && (mteDropDown.tag != "touchedByURO"))
  4989. {
  4990. // The event dropdown is now some byzantine piece of DOM manipulation to generate something which looks like a
  4991. // regular select list, but which can't be manipulated like one... The first gotcha is that the selected item
  4992. // exists only within a shadow DOM section within the dropdown rather than simply being part of the list from
  4993. // which we'd be able to read off its selected index. So to check whether or not the user has selected an
  4994. // event already, we need to drill down into this shadow DOM to get its text contents, and compare those against
  4995. // the I18n translation for the choose event text. What a palaver...
  4996. let shadowElm = mteDropDown.shadowRoot.querySelectorAll('.selected-value')[0];
  4997. if(shadowElm !== undefined)
  4998. {
  4999. let eventText = mteDropDown.shadowRoot.querySelectorAll('.selected-value')[0].innerText;
  5000. // Sometimes we get here before WME has finished rendering, so if the event text hasn't been set yet then we
  5001. // need to return false and let the caller deal with it...
  5002. if(eventText !== '')
  5003. {
  5004. if(eventText == I18n.lookup('closures.choose_event'))
  5005. {
  5006. // Having now established that, yes, the closure hasn't yet been associated with any event, it's surprisingly
  5007. // easy to change it to "None" - we just generate a click event on the first child element in the main DOM (not
  5008. // the shadow DOM this time), which replicates what the user would do to select None manually.
  5009. mteDropDown.children[0].click();
  5010. }
  5011. // Tag the event list to prevent further processing attempts whilst the edit UI for this closure remains open.
  5012. mteDropDown.tag = "touchedByURO";
  5013. retval = true;
  5014. }
  5015. }
  5016. }
  5017.  
  5018. return retval;
  5019. }
  5020. let uroPendingURSessionsTotal;
  5021. let uroFinalizeTimeoutHandle = null;
  5022. function uroFinalizeURSessionsGet()
  5023. {
  5024. if(uroPendingURSessionsTotal != uroPendingURSessionIDs.length)
  5025. {
  5026. uroPendingURSessionsTotal = uroPendingURSessionIDs.length;
  5027. if(uroFinalizeTimeoutHandle !== null)
  5028. {
  5029. window.clearTimeout(uroFinalizeTimeoutHandle);
  5030. uroFinalizeTimeoutHandle = null;
  5031. }
  5032. uroFinalizeTimeoutHandle = window.setTimeout(uroFinalizeURSessionsGet, 500);
  5033. return;
  5034. }
  5035.  
  5036. let idList = [];
  5037.  
  5038. while((idList.length < 50) && (uroPendingURSessionIDs.length))
  5039. {
  5040. let id = uroPendingURSessionIDs.shift();
  5041. idList.push(id);
  5042. }
  5043.  
  5044. if(idList.length > 0)
  5045. {
  5046. uroDBG.AddLog('grabbing '+idList.length+' updateRequestSessions, IDs: '+idList);
  5047. W.model.updateRequestSessions.getAsync(idList);
  5048. }
  5049.  
  5050. if((uroPendingURSessionIDs.length) || (uroRequestedURSessionIDs.length))
  5051. {
  5052. window.setTimeout(uroGetUpdateRequestSessions,1000);
  5053. }
  5054. else
  5055. {
  5056. uroPopulatingRequestSessions = false;
  5057. }
  5058. }
  5059. function uroGetUpdateRequestSessions()
  5060. {
  5061. uroPendingURSessionsTotal = uroPendingURSessionIDs.length;
  5062. if(uroFinalizeTimeoutHandle !== null)
  5063. {
  5064. window.clearTimeout(uroFinalizeTimeoutHandle);
  5065. uroFinalizeTimeoutHandle = null;
  5066. }
  5067. uroFinalizeTimeoutHandle = window.setTimeout(uroFinalizeURSessionsGet,500);
  5068. }
  5069. function uroRefreshUpdateRequestSessions()
  5070. {
  5071. let urcount = 0;
  5072. uroPendingURSessionIDs = [];
  5073. uroRequestedURSessionIDs = [];
  5074. uroPopulatingRequestSessions = true;
  5075. for (let urID in W.model.mapUpdateRequests.objects)
  5076. {
  5077. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urID))
  5078. {
  5079. if(W.model.updateRequestSessions.objects[urID] === undefined)
  5080. {
  5081. uroPendingURSessionIDs.push(urID);
  5082. }
  5083. urcount++;
  5084. }
  5085. }
  5086. uroGetUpdateRequestSessions();
  5087. }
  5088. function uroURHasMyComments(fid)
  5089. {
  5090. if(uroUserID === -1)
  5091. {
  5092. return false;
  5093. }
  5094. let nComments = W.model.updateRequestSessions.objects[fid].attributes.comments.length;
  5095. if(nComments === 0)
  5096. {
  5097. return false;
  5098. }
  5099.  
  5100. for(let cidx=0; cidx<nComments; cidx++)
  5101. {
  5102. if(W.model.updateRequestSessions.objects[fid].attributes.comments[cidx].userID == uroUserID)
  5103. {
  5104. return true;
  5105. }
  5106. }
  5107.  
  5108. return false;
  5109. }
  5110. function uroIsFilteringEnabled(ignoreZoom)
  5111. {
  5112. let retval = false;
  5113. if
  5114. (
  5115. (uroUtils.GetCBChecked('_cbMasterEnable') === true) &&
  5116. (
  5117. (ignoreZoom === true) ||
  5118. (W.map.getZoom() <= uroUtils.GetElmValue('_inputFilterMinZoomLevel'))
  5119. )
  5120. )
  5121. {
  5122. retval = true;
  5123. }
  5124. return retval;
  5125. }
  5126. function uroUpdateMTEList()
  5127. {
  5128. if(Object.keys(W.model.majorTrafficEvents.objects).length === 0) return;
  5129.  
  5130. let selectedIdx = null;
  5131. let idx;
  5132. let mteNames = [];
  5133. let mteIDs = [];
  5134. for(idx in W.model.majorTrafficEvents.objects)
  5135. {
  5136. if(W.model.majorTrafficEvents.objects.hasOwnProperty(idx))
  5137. {
  5138. let name = W.model.majorTrafficEvents.objects[idx].attributes.names[0]?.value;
  5139. if(mteNames.indexOf(name) == -1)
  5140. {
  5141. mteNames.push(name);
  5142. mteIDs.push(idx);
  5143. }
  5144. }
  5145. }
  5146. // check for any previously selected ID in the list, then clear it and repopulate
  5147. // using the newly gathered ID collection from above, and finally reselect the
  5148. // previously selected MTE if its still present in the new list...
  5149. let selector;
  5150. let selectedID;
  5151. let selectorEntry;
  5152.  
  5153. selector = document.getElementById('_selectRTCMTE');
  5154. selectedID = null;
  5155. if(selector.selectedOptions[0] != null)
  5156. {
  5157. selectedID = selector.selectedOptions[0].value;
  5158. }
  5159. while(selector.options.length > 0)
  5160. {
  5161. selector.options.remove(0);
  5162. }
  5163. selector.options.add(new Option('<select a MTE>', null));
  5164. if(mteNames.length > 0)
  5165. {
  5166. selectorEntry = '';
  5167. for(idx=0; idx<mteNames.length; idx++)
  5168. {
  5169. selectorEntry = mteNames[idx];
  5170. selector.options.add(new Option(selectorEntry, mteIDs[idx]));
  5171. if(mteIDs[idx] == selectedID)
  5172. {
  5173. selectedIdx = idx+1;
  5174. }
  5175. }
  5176. }
  5177.  
  5178. if(selectedIdx !== null)
  5179. {
  5180. selector.selectedIndex = selectedIdx;
  5181. }
  5182. }
  5183. function uroRTCMarkerInfo(mID, isVisible)
  5184. {
  5185. let pri = null;
  5186. let status = null;
  5187. let dir = null;
  5188. let segID = null;
  5189.  
  5190. let rtcModel = W.model.roadClosures.objects[mID];
  5191. let mObj = W.userscripts.getMapElementByDataModel(rtcModel);
  5192. if((mObj !== null) && (mObj !== undefined))
  5193. {
  5194. // Store the marker status - if we've already made a note of the original
  5195. // status by adding an "orig_"-prefixed classname, extract the status from
  5196. // that rather than from the class currently being used to display the
  5197. // marker, to preserve the original status regardless of what we may have
  5198. // done to it subsequently as a result of our RTC filtering setup...
  5199. let cList = mObj.classList;
  5200. for(let i = 0; i < cList.length; ++i)
  5201. {
  5202. if(cList[i].indexOf('orig_') != -1)
  5203. {
  5204. status = cList[i].replace('orig_', '');
  5205. }
  5206. }
  5207. if(status === null)
  5208. {
  5209. for(let i = 0; i < cList.length; ++i)
  5210. {
  5211. if(cList[i].indexOf('status-') != -1)
  5212. {
  5213. status = cList[i];
  5214. }
  5215. }
  5216. }
  5217.  
  5218. // Assign a priority level to the marker so we know whether to show or hide
  5219. // it if it's stacked up with others on the same segment - the level set here
  5220. // follows the priority used by WME to decide which closures to show normally.
  5221. if(status == "status-active")
  5222. {
  5223. pri = 2;
  5224. }
  5225. else if(status == "status-not-started")
  5226. {
  5227. pri = 1;
  5228. }
  5229. else
  5230. {
  5231. pri = 0;
  5232. }
  5233.  
  5234. // To avoid the need to cross-reference with the closure model object, use the
  5235. // classname of the arrow attached to this marker to determine if the closure is
  5236. // in the forward or reverse direction.
  5237. if(mObj.childNodes.length == 1)
  5238. {
  5239. if(mObj.childNodes[0].className.indexOf('forward') != -1)
  5240. {
  5241. dir = "fwd";
  5242. }
  5243. else if(mObj.childNodes[0].className.indexOf('backward') != -1)
  5244. {
  5245. dir = "rev";
  5246. }
  5247. }
  5248.  
  5249. segID = rtcModel.attributes.segID;
  5250. }
  5251.  
  5252. this.isVisible = isVisible;
  5253. this.segID = segID;
  5254. this.pri = pri;
  5255. this.mID = mID;
  5256. this.status = status;
  5257. this.dir = dir;
  5258. this.mObj = mObj;
  5259. }
  5260. function uroFilterRTCs()
  5261. {
  5262. let pmTStart = performance.now();
  5263. let pmFunction = "uroFilterRTCs";
  5264.  
  5265. if(uroFilterPreamble() === false) return;
  5266.  
  5267. let closureLayer = uroLayers.layers[uroLayers.ID.RTC].l;
  5268. if(closureLayer.markers.length === 0) return;
  5269.  
  5270. let uFR_filterActiveFromWME = uroUtils.GetCBChecked('_cbHideEditorRTCs');
  5271. let uFR_filterActiveFromWazeFeed = uroUtils.GetCBChecked('_cbHideWazeFeedRTCs');
  5272. let uFR_filterActiveFromWazeOther = uroUtils.GetCBChecked('_cbHideWazeRTCs');
  5273. let uFR_filterFutureFromWME = uroUtils.GetCBChecked('_cbHideFutureEditorRTCs');
  5274. let uFR_filterFutureFromWazeFeed = uroUtils.GetCBChecked('_cbHideFutureWazeFeedRTCs');
  5275. let uFR_filterFutureFromWazeOther = uroUtils.GetCBChecked('_cbHideFutureWazeRTCs');
  5276. let uFR_filterExpiredFromWME = uroUtils.GetCBChecked('_cbHideExpiredEditorRTCs');
  5277. let uFR_filterExpiredFromWazeFeed = uroUtils.GetCBChecked('_cbHideExpiredWazeFeedRTCs');
  5278. let uFR_filterExpiredFromWazeOther = uroUtils.GetCBChecked('_cbHideExpiredWazeRTCs');
  5279. let uFR_filterUnknownFromWME = uroUtils.GetCBChecked('_cbHideUnknownEditorRTCs');
  5280. let uFR_filterUnknownFromWazeFeed = uroUtils.GetCBChecked('_cbHideUnknownWazeFeedRTCs');
  5281. let uFR_filterUnknownFromWazeOther = uroUtils.GetCBChecked('_cbHideUnknownWazeRTCs');
  5282. let uFR_filterShowForMTE = uroUtils.GetCBChecked('_cbShowMTERTCs');
  5283. let uFR_filterHideForMTE = uroUtils.GetCBChecked('_cbHideMTERTCs');
  5284. let uFR_filterHideDurationLessThan = uroUtils.GetCBChecked('_cbEnableRTCDurationFilterLessThan');
  5285. let uFR_filterHideDurationMoreThan = uroUtils.GetCBChecked('_cbEnableRTCDurationFilterMoreThan');
  5286. let uFR_thresholdDurationLessThan = uroUtils.GetElmValue('_inputFilterRTCDurationLessThan');
  5287. let uFR_thresholdDurationMoreThan = uroUtils.GetElmValue('_inputFilterRTCDurationMoreThan');
  5288.  
  5289. let uFR_filterShowForTS = uroUtils.GetCBChecked('_cbRTCFilterShowForTS');
  5290. let uFR_filterHideForTS = uroUtils.GetCBChecked('_cbRTCFilterHideForTS');
  5291. let tsD = uroUtils.GetElmValue('_inputRTCFilterDay');
  5292. let tsMo = uroUtils.GetElmValue('_inputRTCFilterMonth');
  5293. let tsY = uroUtils.GetElmValue('_inputRTCFilterYear');
  5294. let tsH = uroUtils.GetElmValue('_inputRTCFilterHour');
  5295. let tsMi = uroUtils.GetElmValue('_inputRTCFilterMin');
  5296. let filterTS = uroUtils.GetTS(tsD, tsMo, tsY, tsH, tsMi);
  5297. uroUpdateMTEList();
  5298. let mteID = null;
  5299. let selectorMTE = document.getElementById('_selectRTCMTE');
  5300. if(selectorMTE?.selectedOptions[0] != null)
  5301. {
  5302. mteID = selectorMTE.selectedOptions[0].value;
  5303. }
  5304.  
  5305. let uFR_masterEnable = uroIsFilteringEnabled(false);
  5306.  
  5307. let markerInfo = [];
  5308.  
  5309. // Pass 1 - determine which filtering to apply to each of the RTC markers
  5310. let markerIdx = 0;
  5311. for (let rtcObj in W.model.roadClosures.objects)
  5312. {
  5313. let isVisible = true;
  5314.  
  5315. if(uFR_masterEnable === true)
  5316. {
  5317. let rtcModel = W.model.roadClosures.objects[rtcObj];
  5318.  
  5319. if(mteID !== null)
  5320. {
  5321. if((uFR_filterShowForMTE === true) && (rtcModel.attributes.eventId !== mteID))
  5322. {
  5323. isVisible = false;
  5324. }
  5325. if((uFR_filterHideForMTE === true) && (rtcModel.attributes.eventId === mteID))
  5326. {
  5327. isVisible = false;
  5328. }
  5329. }
  5330.  
  5331. let rtcType = uroGetRTCOrigin(rtcModel);
  5332. let rtcState = uroGetRTCState(rtcModel);
  5333.  
  5334. if(rtcType == uroEnums.TRTC.WAZEFEED)
  5335. {
  5336. if
  5337. (
  5338. ((rtcState === uroEnums.SRTC.ACTIVE) && (uFR_filterActiveFromWazeFeed === true)) ||
  5339. ((rtcState === uroEnums.SRTC.FUTURE) && (uFR_filterFutureFromWazeFeed === true)) ||
  5340. ((rtcState === uroEnums.SRTC.EXPIRED) && (uFR_filterExpiredFromWazeFeed === true)) ||
  5341. ((rtcState === uroEnums.SRTC.UNKNOWN) && (uFR_filterUnknownFromWazeFeed === true))
  5342. )
  5343. {
  5344. isVisible = false;
  5345. }
  5346. }
  5347. else if(rtcType == uroEnums.TRTC.WAZEOTHER)
  5348. {
  5349. if
  5350. (
  5351. ((rtcState === uroEnums.SRTC.ACTIVE) && (uFR_filterActiveFromWazeOther === true)) ||
  5352. ((rtcState === uroEnums.SRTC.FUTURE) && (uFR_filterFutureFromWazeOther === true)) ||
  5353. ((rtcState === uroEnums.SRTC.EXPIRED) && (uFR_filterExpiredFromWazeOther === true)) ||
  5354. ((rtcState === uroEnums.SRTC.UNKNOWN) && (uFR_filterUnknownFromWazeOther === true))
  5355. )
  5356. {
  5357. isVisible = false;
  5358. }
  5359. }
  5360. else
  5361. {
  5362. if
  5363. (
  5364. ((rtcState === uroEnums.SRTC.ACTIVE) && (uFR_filterActiveFromWME === true)) ||
  5365. ((rtcState === uroEnums.SRTC.FUTURE) && (uFR_filterFutureFromWME === true)) ||
  5366. ((rtcState === uroEnums.SRTC.EXPIRED) && (uFR_filterExpiredFromWME === true)) ||
  5367. ((rtcState === uroEnums.SRTC.UNKNOWN) && (uFR_filterUnknownFromWME === true))
  5368. )
  5369. {
  5370. isVisible = false;
  5371. }
  5372. }
  5373. let rtcDuration = uroGetRTCDuration(rtcModel);
  5374. if(uFR_filterHideDurationLessThan === true)
  5375. {
  5376. if(rtcDuration < uFR_thresholdDurationLessThan)
  5377. {
  5378. isVisible = false;
  5379. }
  5380. }
  5381. if(uFR_filterHideDurationMoreThan === true)
  5382. {
  5383. if(rtcDuration > uFR_thresholdDurationMoreThan)
  5384. {
  5385. isVisible = false;
  5386. }
  5387. }
  5388. if((uFR_filterShowForTS === true) || (uFR_filterHideForTS === true))
  5389. {
  5390. let startTS = new Date(rtcModel.attributes.startDate).getTime();
  5391. let endTS = new Date(rtcModel.attributes.endDate).getTime();
  5392. if(uFR_filterShowForTS === true)
  5393. {
  5394. if((filterTS < startTS) || (filterTS > endTS))
  5395. {
  5396. isVisible = false;
  5397. }
  5398. }
  5399. if (uFR_filterHideForTS === true)
  5400. {
  5401. if((filterTS >= startTS) && (filterTS <= endTS))
  5402. {
  5403. isVisible = false;
  5404. }
  5405. }
  5406. }
  5407. }
  5408.  
  5409. markerInfo.push(new uroRTCMarkerInfo(rtcObj, isVisible));
  5410. ++markerIdx;
  5411. }
  5412.  
  5413. // Pass 2 - based on the initial filtering results, determine which markers *actually* should be
  5414. // made visible or hidden according both to our filtering settings AND any masking of this marker
  5415. // due to the presence of other higher priority markers at the same position which have also been
  5416. // marked as visible following the filtering pass...
  5417. //
  5418. // For added merriment, we also deal with the WME limitation that prevents it displaying two
  5419. // different types of closure arrow if a segment has a one-way closure which is a higher priority
  5420. // than a closure in the opposite direction.
  5421.  
  5422. let cNodesDiv = uroLayers.layers[uroLayers.ID.RTCnode].l.div;
  5423. for (let i = 0; i < markerIdx; ++i)
  5424. {
  5425. let status = markerInfo[i].status;
  5426.  
  5427. // Only apply this pass to closures which haven't already been hidden in pass 1, AND which
  5428. // have a valid marker position
  5429. if((markerInfo[i].isVisible === true) && (markerInfo[i].pos !== null))
  5430. {
  5431. // Iterate through all the other markers, looking for any which are also still visible
  5432. // and have the same marker position as the one we're currently processing
  5433. for (let j = 0; j < markerIdx; ++j)
  5434. {
  5435. if(j != i)
  5436. {
  5437. if((markerInfo[j].isVisible === true) && (markerInfo[j].pos !== null))
  5438. {
  5439. if(markerInfo[i].segID == markerInfo[j].segID)
  5440. {
  5441. if(markerInfo[j].pri > markerInfo[i].pri)
  5442. {
  5443. if(markerInfo[j].dir == markerInfo[i].dir)
  5444. {
  5445. // Mark the currently processed marker to be hidden only if this higher priority
  5446. // marker is for a closure in the same direction - if it's not, then we need to
  5447. // leave the current marker visible so that its arrow remains visible...
  5448. markerInfo[i].isVisible = false;
  5449. break;
  5450. }
  5451. else
  5452. {
  5453. // Otherwise, if we're leaving the current marker visible then we'll need to
  5454. // alter its status class to match this higher-priority marker, so that the
  5455. // marker which is shown to the user remains correct regardless of what the
  5456. // relative stacking order of the markers is on this segment.
  5457. status = markerInfo[j].status;
  5458. }
  5459. }
  5460. }
  5461. }
  5462. }
  5463. }
  5464. }
  5465.  
  5466. let marker = markerInfo[i].mObj; //closureLayer.markers[i]?.element;
  5467. if(marker !== null)
  5468. {
  5469. let markerClass = marker.className;
  5470. if(markerClass !== "")
  5471. {
  5472. // Remove the hidden class if present - this allows markers natively hidden by WME due to being masked
  5473. // by higher priority markers to become visible again if our own filtering settings have hidden those
  5474. // higher priority marker...
  5475. markerClass = markerClass.replace(" road-closure-hidden", "");
  5476. if(markerInfo[i].isVisible == false)
  5477. {
  5478. // Apply the hidden class for any markers WE'VE decided need to be hidden
  5479. markerClass += " road-closure-hidden";
  5480. }
  5481. else
  5482. {
  5483. // For any markers which we're leaving visible, first check to see if it's a marker we haven't yet
  5484. // seen. If so, then we need to store its original status class for future reference.
  5485. if(markerClass.indexOf('orig_') == -1)
  5486. {
  5487. markerClass += (' orig_'+markerInfo[i].status);
  5488. }
  5489. // Now, to ensure this segment displays the appropriate marker for the highest priority closure
  5490. // still visible on it, we remove the existing status class and replace it with the one we
  5491. // chose above
  5492. markerClass = markerClass.replace(" status-finished"," ");
  5493. markerClass = markerClass.replace(" status-active"," ");
  5494. markerClass = markerClass.replace(" status-not-started"," ");
  5495. markerClass += ' '+status;
  5496. }
  5497. marker.className = markerClass;
  5498. let toHide = cNodesDiv.querySelectorAll("[data-id='"+markerInfo[i].mID+"']");
  5499. for(let j = 0; j < toHide.length; ++j)
  5500. {
  5501. if(markerInfo[i].isVisible === false)
  5502. {
  5503. toHide[j].style.visibility = "hidden";
  5504. }
  5505. else
  5506. {
  5507. toHide[j].style.visibility = "";
  5508. }
  5509. }
  5510. }
  5511. }
  5512. }
  5513. uroDBG.PerfMon(pmFunction, pmTStart);
  5514. }
  5515. function uroUpdateRAList()
  5516. {
  5517. if(Object.keys(W.model.restrictedDrivingAreas.objects).length === 0) return;
  5518.  
  5519. let selectedIdx = null;
  5520. let idx;
  5521. let raNames = [];
  5522. for(idx in W.model.restrictedDrivingAreas.objects)
  5523. {
  5524. if(W.model.restrictedDrivingAreas.objects.hasOwnProperty(idx))
  5525. {
  5526. let name = W.model.restrictedDrivingAreas.objects[idx].attributes.name;
  5527. if(raNames.indexOf(name) == -1)
  5528. {
  5529. raNames.push(name);
  5530. }
  5531. }
  5532. }
  5533. // check for any previously selected name in the list, then clear it and repopulate
  5534. // using the newly gathered collection from above, and finally reselect the
  5535. // previously selected MTE if its still present in the new list...
  5536. let selector;
  5537. let selectedName;
  5538. let selectorEntry;
  5539.  
  5540. selector = document.getElementById('_selectRA');
  5541. selectedName = null;
  5542. if(selector.selectedOptions[0] != null)
  5543. {
  5544. selectedName = selector.selectedOptions[0].value;
  5545. }
  5546. while(selector.options.length > 0)
  5547. {
  5548. selector.options.remove(0);
  5549. }
  5550. selector.options.add(new Option('<select a RA>', null));
  5551. if(raNames.length > 0)
  5552. {
  5553. selectorEntry = '';
  5554. for(idx=0; idx<raNames.length; idx++)
  5555. {
  5556. selectorEntry = raNames[idx];
  5557. selector.options.add(new Option(selectorEntry, selectorEntry));
  5558. if(selectorEntry == selectedName)
  5559. {
  5560. selectedIdx = idx+1;
  5561. }
  5562. }
  5563. }
  5564.  
  5565. if(selectedIdx !== null)
  5566. {
  5567. selector.selectedIndex = selectedIdx;
  5568. }
  5569. }
  5570. function uroUpdateEditorList(modelObj, listElement, useCreated, useUpdated, useResolved, useCommenter)
  5571. {
  5572. if(Object.keys(modelObj).length === 0) return;
  5573.  
  5574. let selector = document.getElementById(listElement);
  5575.  
  5576. let selectedUser = null;
  5577. if(selector.selectedOptions[0] != null)
  5578. {
  5579. selectedUser = parseInt(selector.selectedOptions[0].value);
  5580. }
  5581.  
  5582. while(selector.options.length > 0)
  5583. {
  5584. selector.options.remove(0);
  5585. }
  5586.  
  5587. let selectedIdx = null;
  5588. let listedIDs = [];
  5589. let idx;
  5590. for(idx in modelObj)
  5591. {
  5592. if(modelObj.hasOwnProperty(idx))
  5593. {
  5594. let obj;
  5595. if(useCommenter == true)
  5596. {
  5597. obj = modelObj[idx];
  5598. if(obj.attributes.comments.length > 0)
  5599. {
  5600. for(let cidx=0; cidx < obj.attributes.comments.length; cidx++)
  5601. {
  5602. let userID = obj.attributes.comments[cidx].userID;
  5603. if((listedIDs.indexOf(userID) == -1) && (userID != -1))
  5604. {
  5605. listedIDs.push(userID);
  5606. }
  5607. }
  5608. }
  5609. }
  5610. else
  5611. {
  5612. obj = modelObj[idx].attributes;
  5613. let cbID = null;
  5614. let ubID = null;
  5615. let rbID = null;
  5616. if(useCreated == true) cbID = obj.createdBy;
  5617. if(useUpdated == true) ubID = obj.updatedBy;
  5618. if(useResolved == true) ubID = obj.resolvedBy;
  5619. if((cbID !== null) && (listedIDs.indexOf(cbID) == -1))
  5620. {
  5621. listedIDs.push(cbID);
  5622. }
  5623. if((ubID !== null) && (listedIDs.indexOf(ubID) == -1))
  5624. {
  5625. listedIDs.push(ubID);
  5626. }
  5627. if((rbID !== null) && (listedIDs.indexOf(rbID) == -1))
  5628. {
  5629. listedIDs.push(rbID);
  5630. }
  5631. }
  5632. }
  5633. }
  5634.  
  5635. selector.options.add(new Option('<select a user>', null));
  5636. if(listedIDs.length > 0)
  5637. {
  5638. let users = W.model.users.getByIds(listedIDs);
  5639. let selectorEntry = '';
  5640. for(idx=0; idx<users.length; idx++)
  5641. {
  5642. if(listedIDs.indexOf(users[idx].id) != -1)
  5643. {
  5644. listedIDs.splice(listedIDs.indexOf(users[idx]), 1);
  5645. }
  5646. if(users[idx].attributes.userName === undefined)
  5647. {
  5648. selectorEntry = users[idx].attributes.id;
  5649. }
  5650. else
  5651. {
  5652. selectorEntry = users[idx].attributes.userName;
  5653. }
  5654. selector.options.add(new Option(selectorEntry, users[idx].id));
  5655. if(users[idx].attributes.id == selectedUser)
  5656. {
  5657. selectedIdx = idx+1;
  5658. }
  5659. }
  5660. }
  5661.  
  5662. if(selectedIdx !== null)
  5663. {
  5664. selector.selectedIndex = selectedIdx;
  5665. }
  5666. }
  5667. function uroGetUserID(filterNameID, tbUserName)
  5668. {
  5669. if(filterNameID === null)
  5670. {
  5671. for(let idx in W.model.users.objects)
  5672. {
  5673. if(W.model.users.objects.hasOwnProperty(idx))
  5674. {
  5675. if(W.model.users.objects[idx].attributes.userName == tbUserName)
  5676. {
  5677. filterNameID = W.model.users.objects[idx].attributes.id;
  5678. break;
  5679. }
  5680. }
  5681. }
  5682. }
  5683. return filterNameID;
  5684. }
  5685. function uroFilterRAs()
  5686. {
  5687. let pmTStart = performance.now();
  5688. let pmFunction = "uroFilterRAs";
  5689.  
  5690. if(uroFilterPreamble() === false) return;
  5691. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  5692. let filterByArea = uroUtils.GetCBChecked('_cbShowSpecificRA');
  5693. let filterByLastEditor = uroUtils.GetCBChecked('_cbRAEditorIDFilter');
  5694. let filterByMinAge = uroUtils.GetCBChecked('_cbEnableRAAgeFilterLessThan');
  5695. let filterByMaxAge = uroUtils.GetCBChecked('_cbEnableRAAgeFilterMoreThan');
  5696. let thresholdMinAge = uroUtils.GetElmValue('_inputFilterRAAgeLessThan');
  5697. let thresholdMaxAge = uroUtils.GetElmValue('_inputFilterRAAgeMoreThan');
  5698. let selectorRA = document.getElementById('_selectRA');
  5699. if(filterByArea === false)
  5700. {
  5701. while(selectorRA.options.length > 0)
  5702. {
  5703. selectorRA.options.remove(0);
  5704. }
  5705. }
  5706. let shownRA = null;
  5707. if(filterByArea === true)
  5708. {
  5709. if(selectorRA.options.length === 0)
  5710. {
  5711. uroUpdateRAList();
  5712. }
  5713. if(selectorRA.selectedOptions[0] != null)
  5714. {
  5715. shownRA = selectorRA.selectedOptions[0].value;
  5716. }
  5717. }
  5718.  
  5719. let filterNameID = null;
  5720. if(filterByLastEditor == true)
  5721. {
  5722. uroUpdateEditorList(W.model.restrictedDrivingAreas.objects, '_selectRAEditorID', true, true, false, false);
  5723. let selector = document.getElementById('_selectRAEditorID');
  5724. if(selector.selectedIndex > 0)
  5725. {
  5726. filterNameID = document.getElementById('_selectRAEditorID').selectedOptions[0].value;
  5727. }
  5728. }
  5729. let nRANames = document.querySelectorAll('.restricted-driving-area-name-marker').length;
  5730. for (let raIdx = 0; raIdx < W.map.restrictedDrivingAreaLayer.features.length; raIdx++)
  5731. {
  5732. let raObj = W.map.restrictedDrivingAreaLayer.features[raIdx].attributes.wazeFeature;
  5733. if(raObj !== undefined)
  5734. {
  5735. let raStyle = 'visible';
  5736. if(uFURs_masterEnable === true)
  5737. {
  5738. if(shownRA !== null)
  5739. {
  5740. if(raObj._wmeObject.attributes.name != shownRA) raStyle = 'hidden';
  5741. }
  5742. if(filterNameID !== null)
  5743. {
  5744. if((raObj._wmeObject.attributes.createdBy != filterNameID) && (raObj._wmeObject.attributes.updatedBy != filterNameID))
  5745. {
  5746. raStyle = 'hidden';
  5747. }
  5748. }
  5749. let raAge = uroUtils.DateToDays(raObj._wmeObject.attributes.updatedOn);
  5750. if(filterByMinAge == true)
  5751. {
  5752. if(raAge < thresholdMinAge) raStyle = 'hidden';
  5753. }
  5754. if(filterByMaxAge == true)
  5755. {
  5756. if(raAge > thresholdMaxAge) raStyle = 'hidden';
  5757. }
  5758. }
  5759. let geoID = W.map.restrictedDrivingAreaLayer.features[raIdx].geometry.id;
  5760. if(document.getElementById(geoID) !== null)
  5761. {
  5762. document.getElementById(geoID).style.visibility = raStyle;
  5763. }
  5764.  
  5765. // This doesn't always work, as the order in which the markers are listed on their layer isn't guaranteed
  5766. // to match the order in which the corresponding RA polys are listed on theirs...
  5767. if(raIdx < nRANames)
  5768. {
  5769. document.querySelectorAll('.restricted-driving-area-name-marker')[raIdx].style.visibility = raStyle;
  5770. }
  5771. }
  5772. }
  5773. uroDBG.PerfMon(pmFunction, pmTStart);
  5774. }
  5775. function uroFilterPURMarker(markerType, pu, placeStyle)
  5776. {
  5777. let vObj = W.model.venues.objects[pu];
  5778. let mObj = uroGetMarker(markerType, pu);
  5779. mObj.style.visibility = placeStyle;
  5780.  
  5781. let urEntries = vObj.attributes.venueUpdateRequests;
  5782. if(urEntries !== undefined)
  5783. {
  5784. if (urEntries.length > 1)
  5785. {
  5786. // for PURs related to multiple change requests, we also need to apply the
  5787. // filtering to the text inside the balloon that indicates how many CRs
  5788. // the PUR represents - the balloon itself gets filtered as part of the
  5789. // main marker above, but the text is in a seperate element...
  5790. let pObj = mObj.parentNode.parentNode;
  5791. let tObjs = pObj.getElementsByTagName("text");
  5792. for(let i = 0; i < tObjs.length; ++i)
  5793. {
  5794. tObjs[i].style.visibility = placeStyle;
  5795. }
  5796. }
  5797. }
  5798. }
  5799. function uroFilterPlaceMarker(markerType, pu, uFP_masterEnable)
  5800. {
  5801. let vObj = W.model.venues.objects[pu];
  5802.  
  5803. let purAge = null;
  5804. let placeStyle = 'visible';
  5805. let hasBalloon = false;
  5806.  
  5807. if(uFP_masterEnable === true)
  5808. {
  5809. if(uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] === true)
  5810. {
  5811. let tPt = [];
  5812. tPt.push(vObj.attributes.geoJSONGeometry.coordinates[0]);
  5813. tPt.push(vObj.attributes.geoJSONGeometry.coordinates[1]);
  5814. if(uroCheckGeometryWithinManagedAreas(tPt) === true) placeStyle = 'hidden';
  5815. }
  5816.  
  5817. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.filterUneditable] === true))
  5818. {
  5819. if(vObj.attributes.permissions === 0)
  5820. {
  5821. placeStyle = 'hidden';
  5822. }
  5823. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.isLoggedIn]))
  5824. {
  5825. if(uro_uFP[uroEnums.FP_OPTS.userRank] < vObj.attributes.lockRank)
  5826. {
  5827. placeStyle = 'hidden';
  5828. }
  5829. }
  5830. if((placeStyle == 'visible') && (vObj.attributes.adLocked))
  5831. {
  5832. placeStyle = 'hidden';
  5833. }
  5834. }
  5835.  
  5836. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.filterLockRanked] === true))
  5837. {
  5838. if(vObj.attributes.lockRank !== 0)
  5839. {
  5840. placeStyle = 'hidden';
  5841. }
  5842. }
  5843.  
  5844. let urEntries = vObj.attributes.venueUpdateRequests;
  5845. if((placeStyle == 'visible') && (urEntries !== undefined))
  5846. {
  5847. hasBalloon = (urEntries.length > 1);
  5848.  
  5849. for(let i = 0; i < urEntries.length; ++i)
  5850. {
  5851. let ut = urEntries[i].attributes.updateType;
  5852. if((uro_uFP[uroEnums.FP_OPTS.filterFlagged] === true) && (ut === "flag"))
  5853. {
  5854. placeStyle = 'hidden';
  5855. }
  5856. else if((uro_uFP[uroEnums.FP_OPTS.filterNewPlace] === true) && (ut === "ADD_VENUE"))
  5857. {
  5858. placeStyle = 'hidden';
  5859. }
  5860. else if((uro_uFP[uroEnums.FP_OPTS.filterUpdatedDetails] === true) && (ut === "UPDATE_VENUE"))
  5861. {
  5862. placeStyle = 'hidden';
  5863. }
  5864. else if((uro_uFP[uroEnums.FP_OPTS.filterNewPhoto] === true) && (ut === "ADD_IMAGE"))
  5865. {
  5866. placeStyle = 'hidden';
  5867. }
  5868. }
  5869.  
  5870. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.filterOnCFs] === true))
  5871. {
  5872. let nVUR = urEntries.length;
  5873. while(nVUR > 0)
  5874. {
  5875. nVUR--;
  5876. let tCF = urEntries[nVUR].attributes.changedFields;
  5877. if(tCF !== undefined)
  5878. {
  5879. if(tCF.length > 0)
  5880. {
  5881. let tFN = tCF[0].attributes.fieldName;
  5882. if((tFN == "phone") && (uro_uFP[uroEnums.FP_OPTS.filterCFPhone] === true))
  5883. {
  5884. placeStyle = 'hidden';
  5885. }
  5886. else if((tFN == "name") && (uro_uFP[uroEnums.FP_OPTS.filterCFName] === true))
  5887. {
  5888. placeStyle = 'hidden';
  5889. }
  5890. else if((tFN == "entryExitPoints") && (uro_uFP[uroEnums.FP_OPTS.filterCFEntryExitPoints] === true))
  5891. {
  5892. placeStyle = 'hidden';
  5893. }
  5894. else if((tFN == "openingHours") && (uro_uFP[uroEnums.FP_OPTS.filterCFOpeningHours] === true))
  5895. {
  5896. placeStyle = 'hidden';
  5897. }
  5898. else if((tFN == "aliases") && (uro_uFP[uroEnums.FP_OPTS.filterCFAliases] === true))
  5899. {
  5900. placeStyle = 'hidden';
  5901. }
  5902. else if((tFN == "services") && (uro_uFP[uroEnums.FP_OPTS.filterCFServices] === true))
  5903. {
  5904. placeStyle = 'hidden';
  5905. }
  5906. else if((tFN == "geometry") && (uro_uFP[uroEnums.FP_OPTS.filterCFGeometry] === true))
  5907. {
  5908. placeStyle = 'hidden';
  5909. }
  5910. else if((tFN == "houseNumber") && (uro_uFP[uroEnums.FP_OPTS.filterCFHouseNumber] === true))
  5911. {
  5912. placeStyle = 'hidden';
  5913. }
  5914. else if((tFN == "categories") && (uro_uFP[uroEnums.FP_OPTS.filterCFCategories] === true))
  5915. {
  5916. placeStyle = 'hidden';
  5917. }
  5918. else if((tFN == "description") && (uro_uFP[uroEnums.FP_OPTS.filterCFDescription] === true))
  5919. {
  5920. placeStyle = 'hidden';
  5921. }
  5922. }
  5923. }
  5924. }
  5925. }
  5926. }
  5927.  
  5928. if(uro_uFP[uroEnums.FP_OPTS.invertPURFilters] === true)
  5929. {
  5930. if(placeStyle == 'hidden') placeStyle = 'visible';
  5931. else placeStyle = 'hidden';
  5932. }
  5933.  
  5934. if(uro_uFP[uroEnums.FP_OPTS.filterMinPURAge] || uro_uFP[uroEnums.FP_OPTS.filterMaxPURAge])
  5935. {
  5936. purAge = uroUtils.GetPURAge(vObj);
  5937. if(uro_uFP[uroEnums.FP_OPTS.filterMinPURAge] === true)
  5938. {
  5939. if(purAge < uro_uFP[uroEnums.FP_OPTS.thresholdMinPURDays]) placeStyle = 'hidden';
  5940. }
  5941. if(uro_uFP[uroEnums.FP_OPTS.filterMaxPURAge] === true)
  5942. {
  5943. if(purAge > uro_uFP[uroEnums.FP_OPTS.thresholdMaxPURDays]) placeStyle = 'hidden';
  5944. }
  5945. }
  5946.  
  5947. if(uroPURsToHide.indexOf(vObj.attributes.id) !== -1)
  5948. {
  5949. placeStyle = 'hidden';
  5950. }
  5951. }
  5952.  
  5953. uroFilterPURMarker(markerType, pu, placeStyle);
  5954.  
  5955. if((uro_uFP[uroEnums.FP_OPTS.leavePURGeos] === false) && (placeStyle === 'hidden'))
  5956. {
  5957. if(vObj.model != null)
  5958. {
  5959. if(vObj.attributes.geometry != null)
  5960. {
  5961. let puGeo = document.getElementById(vObj.attributes.geometry.id);
  5962. if(puGeo !== null)
  5963. {
  5964. puGeo.style.visibility = 'hidden';
  5965. }
  5966. }
  5967. }
  5968. }
  5969. }
  5970. function uroFilterPlaces()
  5971. {
  5972. let pmTStart = performance.now();
  5973. let pmFunction = "uroFilterPlaces";
  5974.  
  5975. if(uroFilterPreamble() === false) return;
  5976.  
  5977. let moObj = uroGetHighlightedMapFeature();
  5978. let renderIntent = uroGetFeatureRenderIntent(moObj);
  5979. if(moObj != null)
  5980. {
  5981. if(moObj.featureType === 'venue')
  5982. {
  5983. if((renderIntent == 'select') || (renderIntent == 'highlightselected'))
  5984. {
  5985. return;
  5986. }
  5987. }
  5988. }
  5989.  
  5990. if(uroUtils.GetCBChecked('_cbDisablePlacesFiltering') === true) return;
  5991.  
  5992. uroUpdateVenueEditorLists();
  5993.  
  5994. let filterNameID = null;
  5995. let tbUserName = uroUtils.GetElmValue('_textPlacesEditor');
  5996. let selector = document.getElementById('_selectPlacesUserID');
  5997. if(selector.selectedIndex > 0)
  5998. {
  5999. let selUserName = document.getElementById('_selectPlacesUserID').selectedOptions[0].innerHTML;
  6000. if(selUserName == tbUserName)
  6001. {
  6002. filterNameID = document.getElementById('_selectPlacesUserID').selectedOptions[0].value;
  6003. }
  6004. }
  6005. filterNameID = uroGetUserID(filterNameID, tbUserName);
  6006.  
  6007. let filterHideNameID = null;
  6008. let tbHideUserName = uroUtils.GetElmValue('_textHidePlacesEditor');
  6009. let selectorHide = document.getElementById('_selectHidePlacesUserID');
  6010. if(selectorHide.selectedIndex > 0)
  6011. {
  6012. let selHideUserName = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].innerHTML;
  6013. if(selHideUserName == tbHideUserName)
  6014. {
  6015. filterHideNameID = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].value;
  6016. }
  6017. }
  6018. filterHideNameID = uroGetUserID(filterHideNameID, tbHideUserName);
  6019.  
  6020. let filterCats = [];
  6021. for(let i=0; i<W.Config.venues.categories.length; i++)
  6022. {
  6023. let parentCategory = W.Config.venues.categories[i];
  6024. let subCategory;
  6025.  
  6026. if(uroUtils.GetCBChecked('_cbPlacesFilter-'+parentCategory) === true)
  6027. {
  6028. filterCats.push(parentCategory);
  6029. for(let i1=0; i1<W.Config.venues.subcategories[parentCategory].length; i1++)
  6030. {
  6031. subCategory = W.Config.venues.subcategories[parentCategory][i1];
  6032. filterCats.push(subCategory);
  6033. }
  6034. }
  6035. else
  6036. {
  6037. for(let i2=0; i2<W.Config.venues.subcategories[parentCategory].length; i2++)
  6038. {
  6039. subCategory = W.Config.venues.subcategories[parentCategory][i2];
  6040. if(uroUtils.GetCBChecked('_cbPlacesFilter-'+subCategory) === true)
  6041. {
  6042. filterCats.push(subCategory);
  6043. }
  6044. }
  6045. }
  6046. }
  6047.  
  6048. let placeStyle;
  6049.  
  6050. let uFP_filterEditedLessThan = uroUtils.GetCBChecked('_cbPlaceFilterEditedLessThan');
  6051. let uFP_filterEditedMoreThan = uroUtils.GetCBChecked('_cbPlaceFilterEditedMoreThan');
  6052. let uFP_filterL0 = uroUtils.GetCBChecked('_cbHidePlacesL0');
  6053. let uFP_filterL1 = uroUtils.GetCBChecked('_cbHidePlacesL1');
  6054. let uFP_filterL2 = uroUtils.GetCBChecked('_cbHidePlacesL2');
  6055. let uFP_filterL3 = uroUtils.GetCBChecked('_cbHidePlacesL3');
  6056. let uFP_filterL4 = uroUtils.GetCBChecked('_cbHidePlacesL4');
  6057. let uFP_filterL5 = uroUtils.GetCBChecked('_cbHidePlacesL5');
  6058. let uFP_filterStaff = uroUtils.GetCBChecked('_cbHidePlacesStaff');
  6059. let uFP_filterAL = uroUtils.GetCBChecked('_cbHidePlacesAdLocked');
  6060. let uFP_filterOnLockLevel = (uFP_filterL0 || uFP_filterL1 || uFP_filterL2 || uFP_filterL3 || uFP_filterL4 || uFP_filterL5 || uFP_filterStaff);
  6061. let uFP_filterNoPhotos = uroUtils.GetCBChecked('_cbHideNoPhotoPlaces');
  6062. let uFP_filterWithPhotos = uroUtils.GetCBChecked('_cbHidePhotoPlaces');
  6063. let uFP_filterNoLinks = uroUtils.GetCBChecked('_cbHideNoLinkedPlaces');
  6064. let uFP_filterWithLinks = uroUtils.GetCBChecked('_cbHideLinkedPlaces');
  6065. let uFP_filterNoDescription = uroUtils.GetCBChecked('_cbHideNonDescribedPlaces');
  6066. let uFP_filterWithDescription = uroUtils.GetCBChecked('_cbHideDescribedPlaces');
  6067. let uFP_filterNoKeyword = uroUtils.GetCBChecked('_cbHideKeywordPlaces');
  6068. let uFP_filterKeyword = uroUtils.GetCBChecked('_cbHideNoKeywordPlaces');
  6069. let uFP_filterPrivate = uroUtils.GetCBChecked('_cbFilterPrivatePlaces');
  6070. let uFP_invertFilters = uroUtils.GetCBChecked('_cbInvertPlacesFilter');
  6071. let uFP_masterEnable = uroIsFilteringEnabled(false);
  6072. let uFP_filterAreaPlaces = uroUtils.GetCBChecked('_cbHideAreaPlaces');
  6073. let uFP_filterPointPlaces = uroUtils.GetCBChecked('_cbHidePointPlaces');
  6074. let uFP_filterCreatedBy = uroUtils.GetCBChecked('_cbShowOnlyPlacesCreatedBy');
  6075. let uFP_filterEditedBy = uroUtils.GetCBChecked('_cbShowOnlyPlacesEditedBy');
  6076. let uFP_filterHideCreatedBy = uroUtils.GetCBChecked('_cbHideOnlyPlacesCreatedBy');
  6077. let uFP_filterHideEditedBy = uroUtils.GetCBChecked('_cbHideOnlyPlacesEditedBy');
  6078.  
  6079. let uFP_hidePURsForFilteredPlaces = uroUtils.GetCBChecked('_cbHidePURsForFilteredPlaces');
  6080.  
  6081. let uFP_NameKeyword = document.getElementById('_textKeywordPlace').value.toLowerCase();
  6082. let uFP_thresholdMinDays = document.getElementById('_inputFilterPlaceEditMinDays').value;
  6083. let uFP_thresholdMaxDays = document.getElementById('_inputFilterPlaceEditMaxDays').value;
  6084.  
  6085. uroPURsToHide = [];
  6086.  
  6087. for(let v=0; v<uroVenueLayer.features.length; v++)
  6088. {
  6089. placeStyle = 'visible';
  6090. if(uFP_masterEnable === true)
  6091. {
  6092. let lmObj = uroVenueLayer.features[v];
  6093.  
  6094. // when an area place is selected, the drag points for editing the place outline now get added as objects into uroVenueLayer.features,
  6095. // however none of these objects had the .attributes.repositoryObject property - whilst the devs have now replaced this with the almost
  6096. // identical .wazeFeature._wmeObject property, it's unclear if drag points still need to be excluded from this scan, so the check
  6097. // remains in place as a "let's just make sure it has it before trying to use it"...
  6098. if(lmObj?.attributes?.wazeFeature?._wmeObject != null)
  6099. {
  6100. lmObj = lmObj.attributes.wazeFeature._wmeObject.attributes;
  6101. if(lmObj.id < 0)
  6102. {
  6103. // don't apply filtering to newly-created places - this allows the user to leave their filtering settings unchanged whilst
  6104. // adding a new place which, once saved, would then be hidden...
  6105. break;
  6106. }
  6107.  
  6108. if(uFP_filterAreaPlaces)
  6109. {
  6110. if(lmObj.geometry.id.indexOf('Polygon') !== -1)
  6111. {
  6112. placeStyle = 'hidden';
  6113. }
  6114. }
  6115. if(uFP_filterPointPlaces)
  6116. {
  6117. if(lmObj.geometry.id.indexOf('Point') !== -1)
  6118. {
  6119. placeStyle = 'hidden';
  6120. }
  6121. }
  6122.  
  6123.  
  6124. if(placeStyle == 'visible')
  6125. {
  6126. if((uFP_filterEditedLessThan) || (uFP_filterEditedMoreThan))
  6127. {
  6128. let editDate = lmObj.updatedOn;
  6129. if(editDate === undefined)
  6130. {
  6131. // where a place has never been edited since its creation, use the creation date instead...
  6132. editDate = lmObj.createdOn;
  6133. }
  6134. if(editDate != null)
  6135. {
  6136. let editDaysAgo = uroUtils.DateToDays(editDate);
  6137. if(uFP_filterEditedLessThan)
  6138. {
  6139. if(editDaysAgo < uFP_thresholdMinDays)
  6140. {
  6141. placeStyle = 'hidden';
  6142. }
  6143. }
  6144. if(uFP_filterEditedMoreThan)
  6145. {
  6146. if(editDaysAgo > uFP_thresholdMaxDays)
  6147. {
  6148. placeStyle = 'hidden';
  6149. }
  6150. }
  6151. }
  6152. }
  6153. }
  6154.  
  6155. if(placeStyle == 'visible')
  6156. {
  6157. if(uFP_filterOnLockLevel)
  6158. {
  6159. let lockLevel = lmObj.lockRank;
  6160. if ((uFP_filterL0) && (lockLevel === 0)) placeStyle = 'hidden';
  6161. if ((uFP_filterL1) && (lockLevel === 1)) placeStyle = 'hidden';
  6162. if ((uFP_filterL2) && (lockLevel === 2)) placeStyle = 'hidden';
  6163. if ((uFP_filterL3) && (lockLevel === 3)) placeStyle = 'hidden';
  6164. if ((uFP_filterL4) && (lockLevel === 4)) placeStyle = 'hidden';
  6165. if ((uFP_filterL5) && (lockLevel === 5)) placeStyle = 'hidden';
  6166. if ((uFP_filterStaff) && (lockLevel === 6)) placeStyle = 'hidden';
  6167. }
  6168. }
  6169.  
  6170. if(placeStyle == 'visible')
  6171. {
  6172. if(uFP_filterAL)
  6173. {
  6174. if(lmObj.adLocked) placeStyle = 'hidden';
  6175. }
  6176. }
  6177.  
  6178. if(placeStyle == 'visible')
  6179. {
  6180. if(uFP_filterNoPhotos || uFP_filterWithPhotos)
  6181. {
  6182. let nPhotos = 0;
  6183. for(let loop=0; loop<lmObj.images.length; loop++)
  6184. {
  6185. if(lmObj.images[loop].attributes.approved) nPhotos++;
  6186. }
  6187. if((uFP_filterNoPhotos) && (nPhotos === 0)) placeStyle = 'hidden';
  6188. if((uFP_filterWithPhotos) && (nPhotos !== 0)) placeStyle = 'hidden';
  6189. }
  6190. }
  6191.  
  6192. if(placeStyle == 'visible')
  6193. {
  6194. if(uFP_filterNoLinks || uFP_filterWithLinks)
  6195. {
  6196. let nLinks = lmObj.externalProviderIDs.length;
  6197. if((uFP_filterNoLinks) && (nLinks === 0)) placeStyle = 'hidden';
  6198. if((uFP_filterWithLinks) && (nLinks !== 0)) placeStyle = 'hidden';
  6199. }
  6200. }
  6201.  
  6202. if(placeStyle == 'visible')
  6203. {
  6204. if(uFP_filterNoDescription || uFP_filterWithDescription)
  6205. {
  6206. let lDesc = lmObj.description.length;
  6207. if((uFP_filterNoDescription) && (lDesc === 0)) placeStyle = 'hidden';
  6208. if((uFP_filterWithDescription) && (lDesc !== 0)) placeStyle = 'hidden';
  6209. }
  6210. }
  6211.  
  6212. if(placeStyle == 'visible')
  6213. {
  6214. if((uFP_filterPrivate === true) && (lmObj.residential === true))
  6215. {
  6216. placeStyle = 'hidden';
  6217. }
  6218. else
  6219. {
  6220. for(let cat=0; cat<filterCats.length; cat++)
  6221. {
  6222. if(_.includes(lmObj.categories, filterCats[cat]))
  6223. {
  6224. placeStyle = 'hidden';
  6225. break;
  6226. }
  6227. }
  6228. }
  6229. }
  6230.  
  6231. if(placeStyle == 'visible')
  6232. {
  6233. if(uFP_filterNoKeyword || uFP_filterKeyword)
  6234. {
  6235. let venueName = lmObj.name.toLowerCase();
  6236. let noKeywordMatch = true;
  6237. if(uFP_NameKeyword === '')
  6238. {
  6239. noKeywordMatch = (venueName !== '');
  6240. }
  6241. else
  6242. {
  6243. noKeywordMatch = (venueName.indexOf(uFP_NameKeyword) === -1);
  6244. }
  6245.  
  6246. if(!noKeywordMatch && uFP_filterNoKeyword) placeStyle = 'hidden';
  6247. if(noKeywordMatch && uFP_filterKeyword) placeStyle = 'hidden';
  6248. }
  6249. }
  6250.  
  6251. if(placeStyle == 'visible')
  6252. {
  6253. if(filterNameID != null)
  6254. {
  6255. if(uFP_filterCreatedBy === true)
  6256. {
  6257. if(filterNameID != lmObj.createdBy) placeStyle = 'hidden';
  6258. }
  6259. if(uFP_filterEditedBy === true)
  6260. {
  6261. if(filterNameID != lmObj.updatedBy) placeStyle = 'hidden';
  6262. }
  6263. }
  6264. }
  6265. if(placeStyle == 'visible')
  6266. {
  6267. if(filterHideNameID != null)
  6268. {
  6269. if(uFP_filterHideCreatedBy === true)
  6270. {
  6271. if(filterHideNameID == lmObj.createdBy) placeStyle = 'hidden';
  6272. }
  6273. if(uFP_filterHideEditedBy === true)
  6274. {
  6275. if(filterHideNameID == lmObj.updatedBy) placeStyle = 'hidden';
  6276. }
  6277. }
  6278. }
  6279.  
  6280. if(uFP_invertFilters === true)
  6281. {
  6282. if(placeStyle == 'hidden') placeStyle = 'visible';
  6283. else placeStyle = 'hidden';
  6284. }
  6285. }
  6286.  
  6287. if((placeStyle == 'hidden') && (uFP_hidePURsForFilteredPlaces === true))
  6288. {
  6289. uroPURsToHide.push(lmObj.id);
  6290. }
  6291. }
  6292.  
  6293. let geoID = uroVenueLayer.features[v].geometry.id;
  6294. if(document.getElementById(geoID) !== null)
  6295. {
  6296. document.getElementById(geoID).style.visibility = placeStyle;
  6297. }
  6298. }
  6299.  
  6300. uro_uFP[uroEnums.FP_OPTS.filterUneditable] = uroUtils.GetCBChecked('_cbFilterUneditablePlaceUpdates');
  6301. uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] = uroUtils.GetCBChecked('_cbPURFilterInsideManagedAreas');
  6302. uro_uFP[uroEnums.FP_OPTS.excludeMyAreas] = uroUtils.GetCBChecked('_cbPURExcludeUserArea');
  6303. uro_uFP[uroEnums.FP_OPTS.filterLockRanked] = uroUtils.GetCBChecked('_cbFilterLockRankedPlaceUpdates');
  6304. uro_uFP[uroEnums.FP_OPTS.filterFlagged] = uroUtils.GetCBChecked("_cbFilterFlaggedPUR");
  6305. uro_uFP[uroEnums.FP_OPTS.filterNewPlace] = uroUtils.GetCBChecked("_cbFilterNewPlacePUR");
  6306. uro_uFP[uroEnums.FP_OPTS.filterUpdatedDetails] = uroUtils.GetCBChecked("_cbFilterUpdatedDetailsPUR");
  6307. uro_uFP[uroEnums.FP_OPTS.filterNewPhoto] = uroUtils.GetCBChecked("_cbFilterNewPhotoPUR");
  6308. uro_uFP[uroEnums.FP_OPTS.filterMinPURAge] = uroUtils.GetCBChecked('_cbEnablePURMinAgeFilter');
  6309. uro_uFP[uroEnums.FP_OPTS.filterMaxPURAge] = uroUtils.GetCBChecked('_cbEnablePURMaxAgeFilter');
  6310. uro_uFP[uroEnums.FP_OPTS.invertPURFilters] = uroUtils.GetCBChecked('_cbInvertPURFilters');
  6311. uro_uFP[uroEnums.FP_OPTS.leavePURGeos] = uroUtils.GetCBChecked('_cbLeavePURGeos');
  6312. uro_uFP[uroEnums.FP_OPTS.filterCFPhone] = uroUtils.GetCBChecked('_cbPURFilterCFPhone');
  6313. uro_uFP[uroEnums.FP_OPTS.filterCFName] = uroUtils.GetCBChecked('_cbPURFilterCFName');
  6314. uro_uFP[uroEnums.FP_OPTS.filterCFEntryExitPoints] = uroUtils.GetCBChecked('_cbPURFilterCFEntryExitPoints');
  6315. uro_uFP[uroEnums.FP_OPTS.filterCFOpeningHours] = uroUtils.GetCBChecked('_cbPURFilterCFOpeningHours');
  6316. uro_uFP[uroEnums.FP_OPTS.filterCFAliases] = uroUtils.GetCBChecked('_cbPURFilterCFAliases');
  6317. uro_uFP[uroEnums.FP_OPTS.filterCFServices] = uroUtils.GetCBChecked('_cbPURFilterCFServices');
  6318. uro_uFP[uroEnums.FP_OPTS.filterCFGeometry] = uroUtils.GetCBChecked('_cbPURFilterCFGeometry');
  6319. uro_uFP[uroEnums.FP_OPTS.filterCFHouseNumber] = uroUtils.GetCBChecked('_cbPURFilterCFHouseNumber');
  6320. uro_uFP[uroEnums.FP_OPTS.filterCFCategories] = uroUtils.GetCBChecked('_cbPURFilterCFCategories');
  6321. uro_uFP[uroEnums.FP_OPTS.filterCFDescription] = uroUtils.GetCBChecked('_cbPURFilterCFDescription');
  6322.  
  6323. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] =
  6324. (
  6325. uro_uFP[uroEnums.FP_OPTS.filterCFPhone] ||
  6326. uro_uFP[uroEnums.FP_OPTS.filterCFName] ||
  6327. uro_uFP[uroEnums.FP_OPTS.filterCFEntryExitPoints] ||
  6328. uro_uFP[uroEnums.FP_OPTS.filterCFOpeningHours]
  6329. );
  6330. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] =
  6331. (
  6332. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] ||
  6333. uro_uFP[uroEnums.FP_OPTS.filterCFAliases] ||
  6334. uro_uFP[uroEnums.FP_OPTS.filterCFServices] ||
  6335. uro_uFP[uroEnums.FP_OPTS.filterCFGeometry]
  6336. );
  6337. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] =
  6338. (
  6339. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] ||
  6340. uro_uFP[uroEnums.FP_OPTS.filterCFHouseNumber] ||
  6341. uro_uFP[uroEnums.FP_OPTS.filterCFCategories] ||
  6342. uro_uFP[uroEnums.FP_OPTS.filterCFDescription]
  6343. );
  6344.  
  6345. uro_uFP[uroEnums.FP_OPTS.thresholdMinPURDays] = uroUtils.GetElmValue('_inputPURFilterMinDays');
  6346. uro_uFP[uroEnums.FP_OPTS.thresholdMaxPURDays] = uroUtils.GetElmValue('_inputPURFilterMaxDays');
  6347. uro_uFP[uroEnums.FP_OPTS.isLoggedIn] = W.loginManager.isLoggedIn();
  6348. uro_uFP[uroEnums.FP_OPTS.userRank] = W.loginManager.user.attributes.rank;
  6349.  
  6350. uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] = uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] && (uroGetManagedAreas() !== 0);
  6351. if(uroUtils.GetCBChecked('_cbPURExcludeUserArea') == true)
  6352. {
  6353. uroIgnoreAreasUserID = W.loginManager.user.attributes.id;
  6354. }
  6355.  
  6356. uroPrepForFilterPlaceMarker(uroLayers.ID.PUR, uFP_masterEnable);
  6357. uroPrepForFilterPlaceMarker(uroLayers.ID.PPUR, uFP_masterEnable);
  6358. uroPrepForFilterPlaceMarker(uroLayers.ID.RPUR, uFP_masterEnable);
  6359.  
  6360. uroDBG.PerfMon(pmFunction, pmTStart);
  6361. }
  6362. function uroPrepForFilterPlaceMarker(markerType, masterEnable)
  6363. {
  6364. if(uroLayers.layers[markerType].l?.getVisibility() === true)
  6365. {
  6366. let idList = uroGetMarkerIDs(markerType);
  6367. for(let pu of idList)
  6368. {
  6369. let mObj = uroGetMarker(markerType, pu);
  6370. if(mObj !== null)
  6371. {
  6372. uroFilterPlaceMarker(markerType, pu, masterEnable);
  6373. }
  6374. }
  6375. }
  6376. }
  6377. function uroGetClosestSegmentToPoint(p)
  6378. {
  6379. let retval = null;
  6380. if(W.map.getZoom() >= 16)
  6381. {
  6382. let minDist = 99999999;
  6383.  
  6384. for(let s in W.model.segments.objects)
  6385. {
  6386. if(W.model.segments.objects.hasOwnProperty(s))
  6387. {
  6388. let seg = W.model.segments.getObjectById(s);
  6389. let dist = seg.attributes.geometry.distanceTo(p);
  6390. if(dist < minDist)
  6391. {
  6392. minDist = dist;
  6393. retval = s;
  6394. }
  6395. }
  6396. }
  6397. }
  6398. return retval;
  6399. }
  6400. function uroFilterCameras()
  6401. {
  6402. //// disabled pending update for hazard-based cameras
  6403. return;
  6404.  
  6405. let pmTStart = performance.now();
  6406. let pmFunction = "uroFilterCameras";
  6407.  
  6408. if(uroFilterPreamble() === false)
  6409. {
  6410. return;
  6411. }
  6412.  
  6413. if(uroMouseIsDown === false) W.map.camerasLayer.redraw();
  6414.  
  6415. if(uroIsFilteringEnabled(false) === true)
  6416. {
  6417. uroUpdateEditorList(W.model.cameras.objects, '_selectCameraUserID', true, true, false, false);
  6418. let tbUserName = uroUtils.GetElmValue('_textCameraEditor');
  6419. let selector = document.getElementById('_selectCameraUserID');
  6420. let filterNameID = null;
  6421. if(selector.selectedIndex > 0)
  6422. {
  6423. let selUserName = document.getElementById('_selectCameraUserID').selectedOptions[0].innerHTML;
  6424. if(selUserName == tbUserName)
  6425. {
  6426. filterNameID = document.getElementById('_selectCameraUserID').selectedOptions[0].value;
  6427. }
  6428. }
  6429. filterNameID = uroGetUserID(filterNameID, tbUserName);
  6430.  
  6431. let isChecked_cbShowOnlyCamsCreatedBy = uroUtils.GetCBChecked('_cbShowOnlyCamsCreatedBy');
  6432. let isChecked_cbShowOnlyCamsEditedBy = uroUtils.GetCBChecked('_cbShowOnlyCamsEditedBy');
  6433. let isChecked_cbShowOnlyMyCams = uroUtils.GetCBChecked('_cbShowOnlyMyCams');
  6434. let isChecked_cbShowWorldCams = uroUtils.GetCBChecked('_cbShowWorldCams');
  6435. let isChecked_cbShowUSACams = uroUtils.GetCBChecked('_cbShowUSACams');
  6436. let isChecked_cbShowNonWorldCams = uroUtils.GetCBChecked('_cbShowNonWorldCams');
  6437. let isChecked_cbShowSpeedCams = uroUtils.GetCBChecked('_cbShowSpeedCams');
  6438. let isChecked_cbShowRedLightCams = uroUtils.GetCBChecked('_cbShowRedLightCams');
  6439. let isChecked_cbShowDummyCams = uroUtils.GetCBChecked('_cbShowDummyCams');
  6440. let isChecked_cbShowIfNoSpeedSet = uroUtils.GetCBChecked('_cbShowIfNoSpeedSet');
  6441. let isChecked_cbShowIfSpeedSet = uroUtils.GetCBChecked('_cbShowIfSpeedSet');
  6442. let isChecked_cbShowIfInvalidSpeedSet = uroUtils.GetCBChecked('_cbShowIfInvalidSpeedSet');
  6443. let isChecked_cbShowRLCIfNoSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfNoSpeedSet');
  6444. let isChecked_cbShowRLCIfNonZeroSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfNonZeroSpeedSet');
  6445. let isChecked_cbShowRLCIfZeroSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfZeroSpeedSet');
  6446. let isChecked_cbHideCreatedByMe = uroUtils.GetCBChecked('_cbHideCreatedByMe');
  6447. let isChecked_cbHideCreatedByRank0 = uroUtils.GetCBChecked('_cbHideCreatedByRank0');
  6448. let isChecked_cbHideCreatedByRank1 = uroUtils.GetCBChecked('_cbHideCreatedByRank1');
  6449. let isChecked_cbHideCreatedByRank2 = uroUtils.GetCBChecked('_cbHideCreatedByRank2');
  6450. let isChecked_cbHideCreatedByRank3 = uroUtils.GetCBChecked('_cbHideCreatedByRank3');
  6451. let isChecked_cbHideCreatedByRank4 = uroUtils.GetCBChecked('_cbHideCreatedByRank4');
  6452. let isChecked_cbHideCreatedByRank5 = uroUtils.GetCBChecked('_cbHideCreatedByRank5');
  6453. let isChecked_cbHideUpdatedByMe = uroUtils.GetCBChecked('_cbHideUpdatedByMe');
  6454. let isChecked_cbHideUpdatedByRank0 = uroUtils.GetCBChecked('_cbHideUpdatedByRank0');
  6455. let isChecked_cbHideUpdatedByRank1 = uroUtils.GetCBChecked('_cbHideUpdatedByRank1');
  6456. let isChecked_cbHideUpdatedByRank2 = uroUtils.GetCBChecked('_cbHideUpdatedByRank2');
  6457. let isChecked_cbHideUpdatedByRank3 = uroUtils.GetCBChecked('_cbHideUpdatedByRank3');
  6458. let isChecked_cbHideUpdatedByRank4 = uroUtils.GetCBChecked('_cbHideUpdatedByRank4');
  6459. let isChecked_cbHideUpdatedByRank5 = uroUtils.GetCBChecked('_cbHideUpdatedByRank5');
  6460. let isChecked_HideManualLockedCams = uroUtils.GetCBChecked('_cbHideManualLockedCams');
  6461. let isChecked_cbHighlightInsteadOfHideCams = uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams');
  6462. let isChecked_InvertFiltere = uroUtils.GetCBChecked('_cbInvertCamFilters');
  6463.  
  6464. let nCameras = uroLayers.layers[uroLayers.ID.cam].l.features.length;
  6465. for (let i = 0; i < nCameras; ++i)
  6466. {
  6467. let uroCamUpdater = '';
  6468. let uroCamUpdaterRank = -1;
  6469. let uroCamCreator = '';
  6470. let uroCamCreatorRank = -1;
  6471. let wf = uroLayers.layers[uroLayers.ID.cam].l.features[i].attributes.wazeFeature;
  6472. // When a camera is selected, the alignment/positioning UI elements get added to features[].
  6473. // As these elements aren't camera markers and therefore have no attributes, we need to
  6474. // ignore them to prevent errors in the filtering code below...
  6475. if(wf !== undefined)
  6476. {
  6477. let uroCam = wf._wmeObject;
  6478. let uroCamStyle = 'visible';
  6479.  
  6480. if(uroCam.attributes.createdBy !== null)
  6481. {
  6482. if(W.model.users.objects[uroCam.attributes.createdBy] != null)
  6483. {
  6484. uroCamCreator = W.model.users.objects[uroCam.attributes.createdBy].attributes.userName;
  6485. uroCamCreatorRank = W.model.users.objects[uroCam.attributes.createdBy].attributes.rank;
  6486. }
  6487. }
  6488.  
  6489. if(uroCam.attributes.updatedBy !== null)
  6490. {
  6491. if(W.model.users.objects[uroCam.attributes.updatedBy] != null)
  6492. {
  6493. uroCamUpdater = W.model.users.objects[uroCam.attributes.updatedBy].attributes.userName;
  6494. uroCamUpdaterRank = W.model.users.objects[uroCam.attributes.updatedBy].attributes.rank;
  6495. }
  6496. }
  6497.  
  6498. let uroCamType = uroCam.attributes.type;
  6499. let camIsAutoLocked = (uroCam.attributes.lockRank === null);
  6500.  
  6501. if(isChecked_HideManualLockedCams === true)
  6502. {
  6503. if(camIsAutoLocked === false) uroCamStyle = 'hidden';
  6504. }
  6505.  
  6506. if(filterNameID != null)
  6507. {
  6508. if(isChecked_cbShowOnlyCamsCreatedBy === true)
  6509. {
  6510. if(filterNameID != uroCam.attributes.createdBy) uroCamStyle = 'hidden';
  6511. }
  6512. if(isChecked_cbShowOnlyCamsEditedBy === true)
  6513. {
  6514. if(filterNameID != uroCam.attributes.updatedBy) uroCamStyle = 'hidden';
  6515. }
  6516. }
  6517.  
  6518. if(isChecked_cbShowOnlyMyCams === true)
  6519. {
  6520. if((uroUserID != uroCam.attributes.createdBy)&&(uroUserID != uroCam.attributes.updatedBy)) uroCamStyle = 'hidden';
  6521. }
  6522.  
  6523. if((isChecked_cbShowWorldCams === false) || (isChecked_cbShowUSACams === false) || (isChecked_cbShowNonWorldCams === false))
  6524. {
  6525. let posWorld = uroCamCreator.indexOf('world_');
  6526. let posUSA = uroCamCreator.indexOf('usa_');
  6527.  
  6528. if((isChecked_cbShowWorldCams === false) && (posWorld === 0)) uroCamStyle = 'hidden';
  6529. if((isChecked_cbShowUSACams === false) && (posUSA === 0)) uroCamStyle = 'hidden';
  6530. if((isChecked_cbShowNonWorldCams === false) && (posWorld !== 0) && (posUSA !== 0)) uroCamStyle = 'hidden';
  6531. }
  6532.  
  6533. if((isChecked_cbShowSpeedCams === false) || (isChecked_cbShowRedLightCams === false) || (isChecked_cbShowDummyCams === false))
  6534. {
  6535. if((isChecked_cbShowSpeedCams === false) && (uroCamType == 2)) uroCamStyle = 'hidden';
  6536. if((isChecked_cbShowRedLightCams === false) && (uroCamType == 4)) uroCamStyle = 'hidden';
  6537. if((isChecked_cbShowDummyCams === false) && (uroCamType == 3)) uroCamStyle = 'hidden';
  6538. }
  6539.  
  6540. if((isChecked_cbShowSpeedCams === true) && (uroCamType == 2))
  6541. {
  6542. if((isChecked_cbShowIfNoSpeedSet === false) && (uroCam.attributes.speed === null)) uroCamStyle = 'hidden';
  6543. if((isChecked_cbShowIfSpeedSet === false) && (uroCam.attributes.speed !== null)) uroCamStyle = 'hidden';
  6544. }
  6545.  
  6546. if((isChecked_cbShowRedLightCams === true) && (uroCamType == 4))
  6547. {
  6548. if((isChecked_cbShowRLCIfNoSpeedSet === false) && (uroCam.attributes.speed === null)) uroCamStyle = 'hidden';
  6549. if((isChecked_cbShowRLCIfNonZeroSpeedSet === false) && (uroCam.attributes.speed > 0)) uroCamStyle = 'hidden';
  6550. if((isChecked_cbShowRLCIfZeroSpeedSet === false) && (uroCam.attributes.speed === 0)) uroCamStyle = 'hidden';
  6551. }
  6552.  
  6553. if(isChecked_cbHideCreatedByMe === true)
  6554. {
  6555. if(uroUserID == uroCam.attributes.createdBy) uroCamStyle = 'hidden';
  6556. }
  6557. if((isChecked_cbHideCreatedByRank0 === true) && (uroCamCreatorRank === 0)) uroCamStyle = 'hidden';
  6558. if((isChecked_cbHideCreatedByRank1 === true) && (uroCamCreatorRank == 1)) uroCamStyle = 'hidden';
  6559. if((isChecked_cbHideCreatedByRank2 === true) && (uroCamCreatorRank == 2)) uroCamStyle = 'hidden';
  6560. if((isChecked_cbHideCreatedByRank3 === true) && (uroCamCreatorRank == 3)) uroCamStyle = 'hidden';
  6561. if((isChecked_cbHideCreatedByRank4 === true) && (uroCamCreatorRank == 4)) uroCamStyle = 'hidden';
  6562. if((isChecked_cbHideCreatedByRank5 === true) && (uroCamCreatorRank == 5)) uroCamStyle = 'hidden';
  6563.  
  6564. if(isChecked_cbHideUpdatedByMe === true)
  6565. {
  6566. if(uroUserID == uroCam.attributes.updatedBy) uroCamStyle = 'hidden';
  6567. }
  6568. if((isChecked_cbHideUpdatedByRank0 === true) && (uroCamUpdaterRank === 0)) uroCamStyle = 'hidden';
  6569. if((isChecked_cbHideUpdatedByRank1 === true) && (uroCamUpdaterRank == 1)) uroCamStyle = 'hidden';
  6570. if((isChecked_cbHideUpdatedByRank2 === true) && (uroCamUpdaterRank == 2)) uroCamStyle = 'hidden';
  6571. if((isChecked_cbHideUpdatedByRank3 === true) && (uroCamUpdaterRank == 3)) uroCamStyle = 'hidden';
  6572. if((isChecked_cbHideUpdatedByRank4 === true) && (uroCamUpdaterRank == 4)) uroCamStyle = 'hidden';
  6573. if((isChecked_cbHideUpdatedByRank5 === true) && (uroCamUpdaterRank == 5)) uroCamStyle = 'hidden';
  6574.  
  6575. if(isChecked_InvertFiltere === true)
  6576. {
  6577. if(uroCamStyle == "hidden")
  6578. {
  6579. uroCamStyle = "";
  6580. }
  6581. else
  6582. {
  6583. uroCamStyle = "hidden";
  6584. }
  6585. }
  6586.  
  6587. let uroCamGeometryID = uroLayers.layers[uroLayers.ID.cam].l.features[i].geometry.id;
  6588. let svgElm = document.getElementById(uroCamGeometryID);
  6589.  
  6590. if(svgElm !== null)
  6591. {
  6592. let origImage;
  6593. if(uroCamStyle == "hidden")
  6594. {
  6595. if(isChecked_cbHighlightInsteadOfHideCams === true)
  6596. {
  6597. // set the "highlight" camera image here...
  6598. let hrefImage = svgElm.getAttribute("xlink:href");
  6599. origImage = svgElm.getAttribute("origImage");
  6600. if((hrefImage === origImage) || (origImage === null))
  6601. {
  6602. svgElm.setAttribute("origImage", hrefImage);
  6603. svgElm.setAttribute("xlink:href", uroImages.HighlightedCameraImages[(uroCamType-2)]);
  6604.  
  6605. svgElm.addEventListener("mouseover", uroMarkers.MouseOver, false);
  6606. svgElm.addEventListener("mouseout", uroMarkers.MouseOut, false);
  6607. }
  6608. }
  6609. else
  6610. {
  6611. svgElm.remove();
  6612. }
  6613. }
  6614. else
  6615. {
  6616. // restore the original camera image here...
  6617. if(svgElm.getAttribute("origImage") !== null)
  6618. {
  6619. origImage = svgElm.getAttribute("origImage");
  6620. svgElm.setAttribute("xlink:href", origImage);
  6621. svgElm.removeAttribute("origImage");
  6622. }
  6623. }
  6624. }
  6625. }
  6626. }
  6627. }
  6628. uroDBG.PerfMon(pmFunction, pmTStart);
  6629. }
  6630. function uroFilterMapComments()
  6631. {
  6632. let pmTStart = performance.now();
  6633. let pmFunction = "uroFilterMapComments";
  6634.  
  6635. if(uroFilterPreamble() === false) return;
  6636.  
  6637. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  6638. let filterDescMustBePresent = uroUtils.GetCBChecked('_cbMCDescriptionMustBePresent');
  6639. let filterDescMustBeAbsent = uroUtils.GetCBChecked('_cbMCDescriptionMustBeAbsent');
  6640. let filterKeywordMustBePresent = uroUtils.GetCBChecked('_cbMCEnableKeywordMustBePresent');
  6641. let filterKeywordMustBeAbsent = uroUtils.GetCBChecked('_cbMCEnableKeywordMustBeAbsent');
  6642. let filterMyFollowed = uroUtils.GetCBChecked('_cbMCHideMyFollowed');
  6643. let filterMyUnfollowed = uroUtils.GetCBChecked('_cbMCHideMyUnfollowed');
  6644. let filterRoadworks = uroUtils.GetCBChecked('_cbMCFilterRoadworks');
  6645. let filterConstruction = uroUtils.GetCBChecked('_cbMCFilterConstruction');
  6646. let filterClosure = uroUtils.GetCBChecked('_cbMCFilterClosure');
  6647. let filterEvent = uroUtils.GetCBChecked('_cbMCFilterEvent');
  6648. let filterNote = uroUtils.GetCBChecked('_cbMCFilterNote');
  6649. let filterWSLM = uroUtils.GetCBChecked('_cbMCFilterWSLM');
  6650. let filterBOG = uroUtils.GetCBChecked('_cbMCFilterBOG');
  6651. let filterDifficult = uroUtils.GetCBChecked('_cbMCFilterDifficult');
  6652. let invertFilters = uroUtils.GetCBChecked('_cbInvertMCFilter');
  6653. let keywordPresent = uroUtils.GetElmValue('_textMCKeywordPresent');
  6654. let keywordAbsent = uroUtils.GetElmValue('_textMCKeywordAbsent');
  6655. let caseInsensitive = uroUtils.GetCBChecked('_cbMCCaseInsensitive');
  6656. let filterCommentsMustBePresent = uroUtils.GetCBChecked('_cbMCCommentsMustBePresent');
  6657. let filterCommentsMustBeAbsent = uroUtils.GetCBChecked('_cbMCCommentsMustBeAbsent');
  6658.  
  6659. let filterExpiryMustBePresent = uroUtils.GetCBChecked('_cbMCExpiryMustBePresent');
  6660. let filterExpiryMustBeAbsent = uroUtils.GetCBChecked('_cbMCExpiryMustBeAbsent');
  6661. let filterByCreatorEnable = uroUtils.GetCBChecked('_cbMCCreatorIDFilter');
  6662. let filterL1 = uroUtils.GetCBChecked('_cbHideMCRank0');
  6663. let filterL2 = uroUtils.GetCBChecked('_cbHideMCRank1');
  6664. let filterL3 = uroUtils.GetCBChecked('_cbHideMCRank2');
  6665. let filterL4 = uroUtils.GetCBChecked('_cbHideMCRank3');
  6666. let filterL5 = uroUtils.GetCBChecked('_cbHideMCRank4');
  6667. let filterL6 = uroUtils.GetCBChecked('_cbHideMCRank5');
  6668. let filterWRCMC = uroUtils.GetCBChecked('_cbHideWRCMCs');
  6669. let selectorCreator = document.getElementById('_selectMCCreatorID');
  6670.  
  6671. if(filterByCreatorEnable === false)
  6672. {
  6673. while(selectorCreator.options.length > 0)
  6674. {
  6675. selectorCreator.options.remove(0);
  6676. }
  6677. }
  6678. let creatorUser = null;
  6679. if(filterByCreatorEnable === true)
  6680. {
  6681. if(selectorCreator.options.length === 0)
  6682. {
  6683. uroUpdateEditorList(W.model.mapComments.objects, '_selectMCCreatorID', true, false, false, false);
  6684. }
  6685. if(selectorCreator.selectedOptions[0] != null)
  6686. {
  6687. creatorUser = parseInt(selectorCreator.selectedOptions[0].value);
  6688. }
  6689. }
  6690.  
  6691. for (let mcIdx = 0; mcIdx < uroMCLayer.features.length; mcIdx++)
  6692. {
  6693. {
  6694. let mcObj = uroMCLayer?.features[mcIdx]?.attributes?.wazeFeature?._wmeObject;
  6695. if(mcObj !== undefined)
  6696. {
  6697. let desc = '';
  6698. if(mcObj.attributes.subject !== null) desc += mcObj.attributes.subject.replace(/<\/?[^>]+(>|$)/g, "");
  6699. if(mcObj.attributes.body !== null) desc += mcObj.attributes.body.replace(/<\/?[^>]+(>|$)/g, "");
  6700. let nComments = mcObj.attributes.conversation.length;
  6701. if(nComments > 0)
  6702. {
  6703. for(let cIdx=0; cIdx < nComments; cIdx++)
  6704. {
  6705. desc += mcObj.attributes.conversation[cIdx].text.replace(/<\/?[^>]+(>|$)/g, "");
  6706. }
  6707. }
  6708.  
  6709. let mcStyle = 'visible';
  6710. if(uroIgnore.IsOnList(mcObj.attributes.id)) mcStyle = 'hidden';
  6711. if(uFURs_masterEnable === true)
  6712. {
  6713. let ukroadworks_ur = false;
  6714. let construction_ur = false;
  6715. let closure_ur = false;
  6716. let event_ur = false;
  6717. let note_ur = false;
  6718. let wslm_ur = false;
  6719. let bog_ur = false;
  6720. let difficult_ur = false;
  6721.  
  6722. let filterByNotIncludedKeyword = false;
  6723. let filterByIncludedKeyword = true;
  6724.  
  6725. let customType = uroGetCustomType(null, "mc", desc);
  6726. if(customType === 0) ukroadworks_ur = true;
  6727. else if(customType === 1) construction_ur = true;
  6728. else if(customType === 2) closure_ur = true;
  6729. else if(customType === 3) event_ur = true;
  6730. else if(customType === 4) note_ur = true;
  6731. else if(customType === 5) wslm_ur = true;
  6732. else if(customType === 6) bog_ur = true;
  6733. else if(customType === 7) difficult_ur = true;
  6734.  
  6735. let rank = mcObj.attributes.lockRank;
  6736. let expiry = mcObj.attributes.endDate;
  6737.  
  6738. // keywords
  6739. if(mcStyle == 'visible')
  6740. {
  6741. if(filterDescMustBePresent === true)
  6742. {
  6743. if(desc === '') mcStyle = 'hidden';
  6744. }
  6745. if(filterDescMustBeAbsent === true)
  6746. {
  6747. if(desc !== '') mcStyle = 'hidden';
  6748. }
  6749.  
  6750. if(filterCommentsMustBePresent === true)
  6751. {
  6752. if(nComments === 0) mcStyle = 'hidden';
  6753. }
  6754. if(filterCommentsMustBeAbsent === true)
  6755. {
  6756. if(nComments > 0) mcStyle = 'hidden';
  6757. }
  6758.  
  6759. if(filterKeywordMustBePresent === true)
  6760. {
  6761. let keywordIsPresentInDesc = uroUtils.KeywordPresent(desc,keywordPresent,caseInsensitive);
  6762. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInDesc));
  6763. }
  6764. if(filterKeywordMustBeAbsent === true)
  6765. {
  6766. let keywordIsAbsentInDesc = uroUtils.KeywordPresent(desc,keywordAbsent,caseInsensitive);
  6767. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInDesc);
  6768. }
  6769.  
  6770. filterByNotIncludedKeyword = (filterByNotIncludedKeyword && filterKeywordMustBeAbsent);
  6771. filterByIncludedKeyword = (filterByIncludedKeyword && filterKeywordMustBePresent);
  6772. if(filterByNotIncludedKeyword || filterByIncludedKeyword)
  6773. {
  6774. mcStyle = 'hidden';
  6775. }
  6776.  
  6777. }
  6778.  
  6779. //lock rank
  6780. if(mcStyle == 'visible')
  6781. {
  6782. if((filterL1 === true) && (rank == 0)) mcStyle = 'hidden';
  6783. if((filterL2 === true) && (rank == 1)) mcStyle = 'hidden';
  6784. if((filterL3 === true) && (rank == 2)) mcStyle = 'hidden';
  6785. if((filterL4 === true) && (rank == 3)) mcStyle = 'hidden';
  6786. if((filterL5 === true) && (rank == 4)) mcStyle = 'hidden';
  6787. if((filterL6 === true) && (rank == 5)) mcStyle = 'hidden';
  6788. }
  6789.  
  6790. // expiry
  6791. if(mcStyle == 'visible')
  6792. {
  6793. if((filterExpiryMustBePresent === true) && (expiry === null)) mcStyle = 'hidden';
  6794. if((filterExpiryMustBeAbsent === true) && (expiry != null)) mcStyle = 'hidden';
  6795. }
  6796.  
  6797. // is following?
  6798. if(mcStyle == 'visible')
  6799. {
  6800. if(mcObj.attributes.isFollowing === true)
  6801. {
  6802. if(filterMyFollowed === true) mcStyle = 'hidden';
  6803. }
  6804. else
  6805. {
  6806. if(filterMyUnfollowed === true) mcStyle = 'hidden';
  6807. }
  6808. }
  6809.  
  6810. if(mcStyle == 'visible')
  6811. {
  6812. if(creatorUser !== null)
  6813. {
  6814. if(mcObj.attributes.createdBy != creatorUser) mcStyle = 'hidden';
  6815. }
  6816. if(filterWRCMC === true)
  6817. {
  6818. if(mcObj.attributes.createdBy == 304740435) mcStyle = 'hidden';
  6819. }
  6820. }
  6821.  
  6822. // custom tags
  6823. if(mcStyle == 'visible')
  6824. {
  6825. if(ukroadworks_ur === true)
  6826. {
  6827. if(filterRoadworks === true) mcStyle = 'hidden';
  6828. }
  6829. else if(construction_ur === true)
  6830. {
  6831. if(filterConstruction === true) mcStyle = 'hidden';
  6832. }
  6833. else if(closure_ur === true)
  6834. {
  6835. if(filterClosure === true) mcStyle = 'hidden';
  6836. }
  6837. else if(event_ur === true)
  6838. {
  6839. if(filterEvent === true) mcStyle = 'hidden';
  6840. }
  6841. else if(note_ur === true)
  6842. {
  6843. if(filterNote === true) mcStyle = 'hidden';
  6844. }
  6845. else if(wslm_ur === true)
  6846. {
  6847. if(filterWSLM === true) mcStyle = 'hidden';
  6848. }
  6849. else if(bog_ur === true)
  6850. {
  6851. if(filterBOG === true) mcStyle = 'hidden';
  6852. }
  6853. else if(difficult_ur === true)
  6854. {
  6855. if(filterDifficult === true) mcStyle = 'hidden';
  6856. }
  6857.  
  6858. if(invertFilters === true)
  6859. {
  6860. if(mcStyle == 'hidden') mcStyle = 'visible';
  6861. else mcStyle = 'hidden';
  6862. }
  6863. }
  6864. }
  6865.  
  6866. let geoID = uroMCLayer.features[mcIdx].geometry.id;
  6867. if(document.getElementById(geoID) !== null)
  6868. {
  6869. document.getElementById(geoID).style.visibility = mcStyle;
  6870. }
  6871. }
  6872. }
  6873. }
  6874. uroDBG.PerfMon(pmFunction, pmTStart);
  6875. }
  6876. function uroFilterURs_onObjectsChanged()
  6877. {
  6878. if(uroFilterPreamble())
  6879. {
  6880. if(uroURDialogIsOpen === true)
  6881. {
  6882. uroFilterURs();
  6883. }
  6884. }
  6885. }
  6886. function uroFilterURs_onObjectsAdded()
  6887. {
  6888. if(uroFilterPreamble())
  6889. {
  6890. }
  6891. }
  6892. function uroFilterURs_onObjectsRemoved()
  6893. {
  6894. if(uroFilterPreamble())
  6895. {
  6896. }
  6897. }
  6898. function uroGetManagedAreas()
  6899. {
  6900. uroManagedAreas = [];
  6901. uroIgnoreAreasUserID = null;
  6902.  
  6903. for(let maObj in W.model.managedAreas.objects)
  6904. {
  6905. if(W.model.managedAreas.objects.hasOwnProperty(maObj))
  6906. {
  6907. uroManagedAreas.push(W.model.managedAreas.objects[maObj]);
  6908. }
  6909. }
  6910. return uroManagedAreas.length;
  6911. }
  6912. function uroCheckGeometryWithinManagedAreas(geo)
  6913. {
  6914. let retval = false;
  6915. let ignoreUserMA = false;
  6916.  
  6917. // If we're ignoring the user's managed area, then we first check to see if
  6918. // the geopoint lies within that - if so then we can skip checking all the
  6919. // other areas in the list...
  6920. if(uroIgnoreAreasUserID !== null)
  6921. {
  6922. for(let uma = 0; uma < uroManagedAreas.length; ++uma)
  6923. {
  6924. if(uroIgnoreAreasUserID == uroManagedAreas[uma].attributes.userID)
  6925. {
  6926. ignoreUserMA = uroContainsPoint(uroManagedAreas[uma].attributes.geoJSONGeometry.coordinates[0], geo);
  6927. break;
  6928. }
  6929. }
  6930. }
  6931.  
  6932. // Point either isn't within the user's area, or we're not ignoring it, so
  6933. // check the rest of the areas in the list
  6934. if(ignoreUserMA == false)
  6935. {
  6936. for(let ma = 0; ma < uroManagedAreas.length; ++ma)
  6937. {
  6938. if(uroIgnoreAreasUserID != uroManagedAreas[ma].attributes.userID)
  6939. {
  6940. retval = uroContainsPoint(uroManagedAreas[ma].attributes.geoJSONGeometry.coordinates[0], geo);
  6941. break;
  6942. }
  6943. }
  6944. }
  6945.  
  6946. return retval;
  6947. }
  6948. function uroGetURDriveGeoms()
  6949. {
  6950. let retval = [];
  6951.  
  6952. for (let urobj in W.model.mapUpdateRequests.objects)
  6953. {
  6954. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urobj))
  6955. {
  6956. let ureq = W.model.mapUpdateRequests.objects[urobj];
  6957. let ureqID = ureq.attributes.id;
  6958.  
  6959. let hasGeo = false;
  6960. let thisRet = [];
  6961. thisRet.push(ureqID);
  6962. thisRet.push(null);
  6963. thisRet.push([]);
  6964.  
  6965. let latMin = 9999;
  6966. let latMax = -9999;
  6967. let lonMin = 9999;
  6968. let lonMax = -9999;
  6969.  
  6970. let urs = W.model.updateRequestSessions.objects[ureqID];
  6971. if((urs !== undefined) && (urs.attributes.driveGeometry !== undefined))
  6972. {
  6973. let cPairs = [];
  6974. for(let i = 0; i < urs.attributes.driveGeometry.coordinates.length; ++i)
  6975. {
  6976. for(let j = 0; j < urs.attributes.driveGeometry.coordinates[i].length; ++j)
  6977. {
  6978. if((i === 0) || (j > 0))
  6979. {
  6980. let coords = urs.attributes.driveGeometry.coordinates[i][j];
  6981. cPairs.push(coords);
  6982.  
  6983. if(coords[0] > lonMax)
  6984. {
  6985. lonMax = coords[0];
  6986. }
  6987. if(coords[0] < lonMin)
  6988. {
  6989. lonMin = coords[0];
  6990. }
  6991. if(coords[1] > latMax)
  6992. {
  6993. latMax = coords[1];
  6994. }
  6995. if(coords[1] < latMin)
  6996. {
  6997. latMin = coords[1];
  6998. }
  6999.  
  7000. hasGeo = true;
  7001. }
  7002. }
  7003. }
  7004. let bbox = [];
  7005. bbox.push(lonMin);
  7006. bbox.push(lonMax);
  7007. bbox.push(latMin);
  7008. bbox.push(latMax);
  7009. thisRet.push(bbox);
  7010. thisRet.push(cPairs);
  7011. }
  7012.  
  7013. if(hasGeo === true)
  7014. {
  7015. retval.push(thisRet);
  7016. }
  7017. }
  7018. }
  7019. return retval;
  7020. }
  7021. function uroCompareDriveGeos(geoA, geoB)
  7022. {
  7023. const matchLength = 5;
  7024. let retval = false;
  7025.  
  7026. if((geoA.length >= matchLength) && (geoB.length >= matchLength))
  7027. {
  7028. for(let i = 0; i < (geoA.length - matchLength); ++i)
  7029. {
  7030. for(let j = 0; j < (geoB.length - matchLength); ++j)
  7031. {
  7032. if((geoA[i][0] == geoB[j][0]) && (geoA[i][1] == geoB[j][1]))
  7033. {
  7034. retval = true;
  7035. for(let k = 1; k < matchLength; ++k)
  7036. {
  7037. if((geoA[i+k][0] != geoB[j+k][0]) || (geoA[i+k][1] != geoB[j+k][1]))
  7038. {
  7039. retval = false;
  7040. break;
  7041. }
  7042. }
  7043. }
  7044. if(retval === true)
  7045. {
  7046. break;
  7047. }
  7048. }
  7049.  
  7050. if(retval === true)
  7051. {
  7052. break;
  7053. }
  7054. }
  7055. }
  7056. return retval;
  7057. }
  7058. function uroCompareDriveBBoxes(bbA, bbB)
  7059. {
  7060. let retval = true;
  7061.  
  7062. if
  7063. (
  7064. (bbA[0] > bbB[1]) ||
  7065. (bbA[1] < bbB[0]) ||
  7066. (bbA[2] > bbB[3]) ||
  7067. (bbA[3] < bbB[2])
  7068. )
  7069. {
  7070. retval = false;
  7071. }
  7072.  
  7073. return retval;
  7074. }
  7075. function uroGetURDupes()
  7076. {
  7077. uroURDupes = [];
  7078.  
  7079. // To determine which URs are duplicates of one another (i.e. have been raised by the same user
  7080. // during the same section of a journey), we first compare the geometries of the drive tracks
  7081. // attached to any URs which have them - as this is based on the users GPS position rather than
  7082. // the WME map data, it makes it vanishingly unlikely that any two users would have identical
  7083. // GPS positions (especially given the level of accuracy to which the track points are stored)
  7084. // even if they were driving exactly the same route at the same speed, in the same lane etc.
  7085. //
  7086. // To accelerate this geometry comparison, we start by performing a simple bounding box overlap
  7087. // check for the two geometries under consideration - if there's no overlap then there can't be
  7088. // any geometry match, so no need to continue onto the more detailed comparision of the GPS
  7089. // tracks themselves...
  7090. let driveGeos = uroGetURDriveGeoms();
  7091. if(driveGeos.length > 1)
  7092. {
  7093. for(let i = 0; i < (driveGeos.length - 1); ++i)
  7094. {
  7095. if(driveGeos[i].length !== 5)
  7096. {
  7097. driveGeos[i][1] = false;
  7098. }
  7099. else
  7100. {
  7101. for(let j = (i + 1); j < driveGeos.length; ++j)
  7102. {
  7103. if(driveGeos[j].length === 5)
  7104. {
  7105. let geoMatch = uroCompareDriveBBoxes(driveGeos[i][3], driveGeos[j][3]);
  7106. if(geoMatch === true)
  7107. {
  7108. geoMatch = uroCompareDriveGeos(driveGeos[i][4], driveGeos[j][4]);
  7109. if(geoMatch === true)
  7110. {
  7111. driveGeos[i][2].push(driveGeos[j][0]);
  7112. driveGeos[j][2].push(driveGeos[i][0]);
  7113. }
  7114. }
  7115. }
  7116. }
  7117. }
  7118. }
  7119.  
  7120. for(let i = 0; i < driveGeos.length; ++i)
  7121. {
  7122. if(driveGeos[i][2].length > 0)
  7123. {
  7124. let res = [];
  7125. res.push(driveGeos[i][0]);
  7126. res.push(driveGeos[i][2]);
  7127. uroURDupes.push(res);
  7128. }
  7129. }
  7130. }
  7131.  
  7132. // Once we've done the initial drive track comparision, uroURDupes will contain a list of
  7133. // all the URs which were matched up based on that. However, as the track comparision is
  7134. // inherently limited by the amount of track data included with each UR, this initial
  7135. // comparison may mean some more widely spaced URs aren't flagged as duplicates simply
  7136. // because there's insufficient overlap between their tracks, even though there may have
  7137. // been further URs dropped inbetween to which they were matched.
  7138. //
  7139. // e.g. if a user drops 4 URs along a section of their journey, spaced such that each of
  7140. // the GPS tracks generates a comparison match with the UR either side of it, but no
  7141. // further than that, we would get:
  7142. //
  7143. // UR A......UR B.......UR C......UR D
  7144. //
  7145. // Matches: A to B, B to A & C, C to B & D, D to C
  7146. //
  7147. // Note how, although we know all of these URs are in fact duplicates, and can infer this
  7148. // from seeing that e.g. A is flagged only as a duplicate of B, however as B is flagged as
  7149. // a duplicate of A & C, and C is flagged as a duplicate of B & D, A MUST therefore be a
  7150. // duplicate of B, C & D...
  7151. //
  7152. // To fix this, we now run a merging pass over each of the entries in uroURDupes - for
  7153. // each entry we see if its ID appears in any of the other entries as a duplicate, and
  7154. // if so we merge the duplicates for both entries.
  7155.  
  7156. for(let i = 0; i < uroURDupes.length; ++i)
  7157. {
  7158. let urID = uroURDupes[i][0];
  7159. for(let j = 0; j < uroURDupes.length; ++j)
  7160. {
  7161. if(i != j)
  7162. {
  7163. if(uroURDupes[j][1].includes(urID) === true)
  7164. {
  7165. // https://stackoverflow.com/questions/1584370/how-to-merge-two-arrays-in-javascript-and-de-duplicate-items
  7166. let mergedDupes = [...new Set([...uroURDupes[i][1], ...uroURDupes[j][1]])];
  7167. uroURDupes[i][1] = mergedDupes;
  7168. uroURDupes[j][1] = mergedDupes;
  7169. }
  7170. }
  7171. }
  7172. }
  7173. }
  7174. function uroFilterURs()
  7175. {
  7176. let pmTStart = performance.now();
  7177. let pmFunction = "uroFilterURs";
  7178.  
  7179. if(uroUserID === -1)
  7180. {
  7181. return;
  7182. }
  7183.  
  7184. if(uroInhibitURFiltering === true)
  7185. {
  7186. return;
  7187. }
  7188.  
  7189.  
  7190. // compatibility fix for URComments - based on code supplied by RickZabel
  7191. let hasActiveURFilters = false;
  7192. if(uroIsFilteringEnabled(false) === true)
  7193. {
  7194. let urTabInputs = uroTabs.CtrlTabs[uroTabs.IDS.URS][uroTabs.FIELDS.TABBODY].getElementsByTagName('input');
  7195. for(let loop = 0; loop < urTabInputs.length; loop++)
  7196. {
  7197. if(urTabInputs[loop].type == 'checkbox')
  7198. {
  7199. let ignoreCB = false;
  7200. ignoreCB = ignoreCB || (urTabInputs[loop].id == '_cbCaseInsensitive');
  7201. ignoreCB = ignoreCB || (urTabInputs[loop].id == '_cbNoFilterForTaggedURs');
  7202. if((urTabInputs[loop].checked) && (ignoreCB === false))
  7203. {
  7204. hasActiveURFilters = true;
  7205. break;
  7206. }
  7207. }
  7208. }
  7209. }
  7210. sessionStorage.UROverview_hasActiveURFilters = hasActiveURFilters;
  7211. if(uroFilterPreamble() === false) return;
  7212. uroRefreshUpdateRequestSessions();
  7213. let selectorResolver = document.getElementById('_selectURResolverID');
  7214. let selectorCommentUser = document.getElementById('_selectURUserID');
  7215. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === false)
  7216. {
  7217. while(selectorResolver.options.length > 0)
  7218. {
  7219. selectorResolver.options.remove(0);
  7220. }
  7221. }
  7222. if(uroUtils.GetCBChecked('_cbURUserIDFilter') === false)
  7223. {
  7224. while(selectorCommentUser.options.length > 0)
  7225. {
  7226. selectorCommentUser.options.remove(0);
  7227. }
  7228. }
  7229. if(Object.keys(W.model.updateRequestSessions.objects).length === 0)
  7230. {
  7231. // This may be the case if the user has disabled the UR layer, so call
  7232. // AddCommentCounts to clear any existing ones from the map view...
  7233. uroURExtras.AddCommentCounts();
  7234. return;
  7235. }
  7236. let commenterUser = null;
  7237. if(uroUtils.GetCBChecked('_cbURUserIDFilter') === true)
  7238. {
  7239. if(selectorCommentUser.options.length === 0)
  7240. {
  7241. uroUpdateEditorList(W.model.updateRequestSessions.objects, '_selectURUserID', false, false, false, true);
  7242. }
  7243. if(selectorCommentUser.selectedOptions[0] != null)
  7244. {
  7245. commenterUser = parseInt(selectorCommentUser.selectedOptions[0].value);
  7246. }
  7247. }
  7248. let resolverUser = null;
  7249. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === true)
  7250. {
  7251. if(selectorResolver.options.length === 0)
  7252. {
  7253. uroUpdateEditorList(W.model.mapUpdateRequests.objects, '_selectURResolverID', false, false, true, false);
  7254. }
  7255. if(selectorResolver.selectedOptions[0] != null)
  7256. {
  7257. resolverUser = parseInt(selectorResolver.selectedOptions[0].value);
  7258. }
  7259. }
  7260. uroURExtras.urList = [];
  7261. uroGetURDupes();
  7262.  
  7263. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  7264. let filterOutsideEditableArea = uroUtils.GetCBChecked('_cbURFilterOutsideArea');
  7265. let filterInsideManagedAreas = uroUtils.GetCBChecked('_cbURFilterInsideManagedAreas');
  7266. let filterSolved = uroUtils.GetCBChecked('_cbFilterSolved');
  7267. let filterUnidentified = uroUtils.GetCBChecked('_cbFilterUnidentified');
  7268. let filterClosed = uroUtils.GetCBChecked('_cbFilterClosedUR');
  7269. let filterOpen = uroUtils.GetCBChecked('_cbFilterOpenUR');
  7270. let filterDescMustBePresent = uroUtils.GetCBChecked('_cbURDescriptionMustBePresent');
  7271. let filterDescMustBeAbsent = uroUtils.GetCBChecked('_cbURDescriptionMustBeAbsent');
  7272. let filterKeywordMustBePresent = uroUtils.GetCBChecked('_cbEnableKeywordMustBePresent');
  7273. let filterKeywordMustBeAbsent = uroUtils.GetCBChecked('_cbEnableKeywordMustBeAbsent');
  7274. let filterMinURAge = uroUtils.GetCBChecked('_cbEnableMinAgeFilter');
  7275. let filterMaxURAge = uroUtils.GetCBChecked('_cbEnableMaxAgeFilter');
  7276. let filterMinComments = uroUtils.GetCBChecked('_cbEnableMinCommentsFilter');
  7277. let filterMaxComments = uroUtils.GetCBChecked('_cbEnableMaxCommentsFilter');
  7278. let filterReporterLastCommenter = uroUtils.GetCBChecked('_cbHideIfReporterLastCommenter');
  7279. let filterReporterNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfReporterNotLastCommenter');
  7280. let filterHideAnyComments = uroUtils.GetCBChecked('_cbHideAnyComments');
  7281. let filterHideNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfNotLastCommenter');
  7282. let filterHideMyComments = uroUtils.GetCBChecked('_cbHideMyComments');
  7283. let filterIfLastCommenter = uroUtils.GetCBChecked('_cbHideIfLastCommenter');
  7284. let filterIfNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfNotLastCommenter');
  7285. let filterCommentMinAge = uroUtils.GetCBChecked('_cbEnableCommentAgeFilter2');
  7286. let filterCommentMaxAge = uroUtils.GetCBChecked('_cbEnableCommentAgeFilter');
  7287. let filterUserID = uroUtils.GetCBChecked('_cbURUserIDFilter');
  7288. let filterMyFollowed = uroUtils.GetCBChecked('_cbHideMyFollowed');
  7289. let filterMyUnfollowed = uroUtils.GetCBChecked('_cbHideMyUnfollowed');
  7290.  
  7291. let filterWazeAuto = uroUtils.GetCBChecked('_cbFilterWazeAuto');
  7292. let filterRoadworks = uroUtils.GetCBChecked('_cbFilterRoadworks');
  7293. let filterConstruction = uroUtils.GetCBChecked('_cbFilterConstruction');
  7294. let filterClosure = uroUtils.GetCBChecked('_cbFilterClosure');
  7295. let filterEvent = uroUtils.GetCBChecked('_cbFilterEvent');
  7296. let filterNote = uroUtils.GetCBChecked('_cbFilterNote');
  7297. let filterWSLM = uroUtils.GetCBChecked('_cbFilterWSLM');
  7298. let filterBOG = uroUtils.GetCBChecked('_cbFilterBOG');
  7299. let filterDifficult = uroUtils.GetCBChecked('_cbFilterDifficult');
  7300.  
  7301. let filterIncorrectTurn = uroUtils.GetCBChecked('_cbFilterIncorrectTurn');
  7302. let filterIncorrectAddress = uroUtils.GetCBChecked('_cbFilterIncorrectAddress');
  7303. let filterIncorrectRoute = uroUtils.GetCBChecked('_cbFilterIncorrectRoute');
  7304. let filterMissingRoundabout = uroUtils.GetCBChecked('_cbFilterMissingRoundabout');
  7305. let filterGeneralError = uroUtils.GetCBChecked('_cbFilterGeneralError');
  7306. let filterTurnNotAllowed = uroUtils.GetCBChecked('_cbFilterTurnNotAllowed');
  7307. let filterIncorrectJunction = uroUtils.GetCBChecked('_cbFilterIncorrectJunction');
  7308. let filterMissingBridgeOverpass = uroUtils.GetCBChecked('_cbFilterMissingBridgeOverpass');
  7309. let filterWrongDrivingDirection = uroUtils.GetCBChecked('_cbFilterWrongDrivingDirection');
  7310. let filterMissingExit = uroUtils.GetCBChecked('_cbFilterMissingExit');
  7311. let filterMissingRoad = uroUtils.GetCBChecked('_cbFilterMissingRoad');
  7312. let filterMissingLandmark = uroUtils.GetCBChecked('_cbFilterMissingLandmark');
  7313. let filterNativeSpeedLimit = uroUtils.GetCBChecked('_cbFilterSpeedLimits');
  7314. let filterBlockedRoad = uroUtils.GetCBChecked('_cbFilterBlockedRoad');
  7315. let filterUndefined = uroUtils.GetCBChecked('_cbFilterUndefined');
  7316.  
  7317. let invertURFilters = uroUtils.GetCBChecked('_cbInvertURFilter');
  7318. let invertURStateFilters = uroUtils.GetCBChecked('_cbInvertURStateFilter');
  7319. let noFilterTaggedURs = uroUtils.GetCBChecked('_cbNoFilterForTaggedURs');
  7320. let noFilterURInURL = uroUtils.GetCBChecked('_cbNoFilterForURInURL');
  7321. let showOnlyDupes = uroUtils.GetCBChecked('_cbURFilterDupes');
  7322.  
  7323. let keywordPresent = uroUtils.GetElmValue('_textKeywordPresent');
  7324. let keywordAbsent = uroUtils.GetElmValue('_textKeywordAbsent');
  7325. let caseInsensitive = uroUtils.GetCBChecked('_cbCaseInsensitive');
  7326. let thresholdMinAge = uroUtils.GetElmValue('_inputFilterMinDays');
  7327. let thresholdMaxAge = uroUtils.GetElmValue('_inputFilterMaxDays');
  7328. let thresholdMinComments = uroUtils.GetElmValue('_inputFilterMinComments');
  7329. let thresholdMaxComments = uroUtils.GetElmValue('_inputFilterMaxComments');
  7330. let thresholdMaxCommentAge = uroUtils.GetElmValue('_inputFilterCommentDays');
  7331. let thresholdMinCommentAge = uroUtils.GetElmValue('_inputFilterCommentDays2');
  7332. let ignoreOtherEditorComments = uroUtils.GetCBChecked('_cbIgnoreOtherEditorComments');
  7333. let urcFilteringIsActive = false;
  7334. let urcCB = document.getElementById('URCommentsFilterEnabled');
  7335. if(urcCB !== null)
  7336. {
  7337. if(urcCB.checked)
  7338. {
  7339. urcFilteringIsActive = true;
  7340. }
  7341. }
  7342. urcCB = document.getElementById('URCommentUROOnlyMyUR');
  7343. if(urcCB !== null)
  7344. {
  7345. if(urcCB.checked)
  7346. {
  7347. urcFilteringIsActive = true;
  7348. }
  7349. }
  7350. urcCB = document.getElementById('URCommentUROHideTagged');
  7351. if(urcCB !== null)
  7352. {
  7353. if(urcCB.checked)
  7354. {
  7355. urcFilteringIsActive = true;
  7356. }
  7357. }
  7358.  
  7359. filterInsideManagedAreas = filterInsideManagedAreas && (uroGetManagedAreas() !== 0);
  7360. if(uroUtils.GetCBChecked('_cbURExcludeUserArea') == true)
  7361. {
  7362. uroIgnoreAreasUserID = W.loginManager.user.attributes.id;
  7363. }
  7364.  
  7365. for (let urobj in W.model.mapUpdateRequests.objects)
  7366. {
  7367. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urobj))
  7368. {
  7369. let ureq = W.model.mapUpdateRequests.objects[urobj];
  7370. let ureqID = ureq.attributes.id;
  7371.  
  7372. let urStyle = 'visible';
  7373. let inhibitFiltering = ((ureqID == uroSelectedURID) && (noFilterURInURL));
  7374.  
  7375. let hasMyComments = false;
  7376. let nComments = 0;
  7377. let desc = ureq.attributes.description;
  7378. let customType = uroGetCustomType(ureqID, uroLayers.ID.UR, desc);
  7379. let ageLastComment = null;
  7380. if(W.model.updateRequestSessions.objects[ureqID] != null)
  7381. {
  7382. nComments = W.model.updateRequestSessions.objects[ureqID].attributes.comments.length;
  7383. if(nComments != 0)
  7384. {
  7385. ageLastComment = uroUtils.GetCommentAge(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1]);
  7386. }
  7387. if((uFURs_masterEnable === false) && (nComments === 0))
  7388. {
  7389. // when master enable is turned off, we want to make sure that all URs, including ones that were previously hidden, are correctly
  7390. // displayed in their native form - i.e. no comment count or custom conversation bubbles. The easiest way to achieve this is to
  7391. // force the AddCommentCounts code to test for the presence of these bubbles on each UR, which we do by setting a non-zero
  7392. // comment count for each UR... For URs which genuinely do have no comments we use -1 to indicate that we're not really setting
  7393. // a comment count, but that we still need to do something that wouldn't be achieved by using 0.
  7394. nComments = -1;
  7395. }
  7396. }
  7397.  
  7398. // check UR against current session ignore list...
  7399. if(uroIgnore.IsOnList(ureqID)) urStyle = 'hidden';
  7400.  
  7401. if((uFURs_masterEnable === true) && (inhibitFiltering === false))
  7402. {
  7403. let wazeauto_ur = false;
  7404. let ukroadworks_ur = false;
  7405. let construction_ur = false;
  7406. let closure_ur = false;
  7407. let event_ur = false;
  7408. let note_ur = false;
  7409. let wslm_ur = false;
  7410. let bog_ur = false;
  7411. let difficult_ur = false;
  7412.  
  7413. let filterByNotIncludedKeyword = false;
  7414. let filterByIncludedKeyword = true;
  7415.  
  7416. if(desc !== null) desc = desc.replace(/<\/?[^>]+(>|$)/g, "");
  7417. else desc = '';
  7418.  
  7419. if(customType === 0) ukroadworks_ur = true;
  7420. else if(customType === 1) construction_ur = true;
  7421. else if(customType === 2) closure_ur = true;
  7422. else if(customType === 3) event_ur = true;
  7423. else if(customType === 4) note_ur = true;
  7424. else if(customType === 5) wslm_ur = true;
  7425. else if(customType === 6) bog_ur = true;
  7426. else if(customType === 7) difficult_ur = true;
  7427.  
  7428. // check UR against editable area...
  7429.  
  7430. if(filterOutsideEditableArea === true)
  7431. {
  7432. if(ureq.canEdit() === false) urStyle = 'hidden';
  7433. }
  7434.  
  7435. if(filterInsideManagedAreas === true)
  7436. {
  7437. if(uroCheckGeometryWithinManagedAreas(ureq.attributes.geoJSONGeometry.coordinates) === true) urStyle = 'hidden';
  7438. }
  7439.  
  7440. if(showOnlyDupes === true)
  7441. {
  7442. let isDupe = false;
  7443. for(let i = 0; i < uroURDupes.length; ++i)
  7444. {
  7445. if(uroURDupes[i][0] === ureqID)
  7446. {
  7447. isDupe = true;
  7448. break;
  7449. }
  7450. }
  7451. if(isDupe === false) urStyle = 'hidden';
  7452. }
  7453.  
  7454. // state-age filtering
  7455. if(urStyle == 'visible')
  7456. {
  7457. // check against closed/not identified filtering if enabled...
  7458. if(filterSolved === true)
  7459. {
  7460. if(ureq.attributes.resolution === 0) urStyle = 'hidden';
  7461. }
  7462. if(filterUnidentified === true)
  7463. {
  7464. if(ureq.attributes.resolution == 1) urStyle = 'hidden';
  7465. }
  7466.  
  7467. if((ureq.attributes.resolvedOn !== null) && (filterClosed === true))
  7468. {
  7469. urStyle = 'hidden';
  7470. }
  7471.  
  7472. if((ureq.attributes.resolvedOn === null) && (filterOpen === true))
  7473. {
  7474. urStyle = 'hidden';
  7475. }
  7476.  
  7477. if(urStyle == 'visible')
  7478. {
  7479. // check UR against keyword filtering if enabled...
  7480. if(filterDescMustBePresent === true)
  7481. {
  7482. if(desc === '') urStyle = 'hidden';
  7483. }
  7484. if(filterDescMustBeAbsent === true)
  7485. {
  7486. if(desc !== '') urStyle = 'hidden';
  7487. }
  7488.  
  7489. if(filterKeywordMustBePresent === true)
  7490. {
  7491. let keywordIsPresentInDesc = uroUtils.KeywordPresent(desc,keywordPresent,caseInsensitive);
  7492. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInDesc));
  7493. }
  7494. if(filterKeywordMustBeAbsent === true)
  7495. {
  7496. let keywordIsAbsentInDesc = uroUtils.KeywordPresent(desc,keywordAbsent,caseInsensitive);
  7497. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInDesc);
  7498. }
  7499. }
  7500.  
  7501. if(urStyle == 'visible')
  7502. {
  7503. // do age-based filtering if enabled
  7504. if(filterMinURAge === true)
  7505. {
  7506. if(uroUtils.GetURAge(ureq,0,false) < thresholdMinAge) urStyle = 'hidden';
  7507. }
  7508. if(filterMaxURAge === true)
  7509. {
  7510. if(uroUtils.GetURAge(ureq,0,false) > thresholdMaxAge) urStyle = 'hidden';
  7511. }
  7512. }
  7513.  
  7514. if(urStyle == 'visible')
  7515. {
  7516. if(resolverUser !== null)
  7517. {
  7518. if(ureq.attributes.resolvedBy != resolverUser) urStyle = 'hidden';
  7519. }
  7520. }
  7521.  
  7522. if(urStyle == 'visible')
  7523. {
  7524. // do comments/following filtering
  7525. if(W.model.updateRequestSessions.objects[ureqID] != null)
  7526. {
  7527. nComments = W.model.updateRequestSessions.objects[ureqID].attributes.comments.length;
  7528. let commentDaysOld = -1;
  7529.  
  7530.  
  7531. if(filterMinComments === true)
  7532. {
  7533. if(nComments < thresholdMinComments) urStyle = 'hidden';
  7534. }
  7535. if(filterMaxComments === true)
  7536. {
  7537. if(nComments > thresholdMaxComments) urStyle = 'hidden';
  7538. }
  7539.  
  7540.  
  7541. if(nComments > 0)
  7542. {
  7543. let reporterIsLastCommenter = false;
  7544. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1].userID == -1) reporterIsLastCommenter = true;
  7545.  
  7546. if(filterReporterLastCommenter === true)
  7547. {
  7548. if(reporterIsLastCommenter === true) urStyle = 'hidden';
  7549. }
  7550. else if(filterReporterNotLastCommenter === true)
  7551. {
  7552. if(reporterIsLastCommenter === false) urStyle = 'hidden';
  7553. }
  7554.  
  7555. hasMyComments = uroURHasMyComments(ureqID);
  7556. if(hasMyComments === false)
  7557. {
  7558. if(filterHideAnyComments === true) urStyle = 'hidden';
  7559. if(filterHideNotLastCommenter === true) urStyle = 'hidden';
  7560. }
  7561. else
  7562. {
  7563. if(filterHideMyComments === true) urStyle = 'hidden';
  7564.  
  7565. let userIsLastCommenter = false;
  7566. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1].userID == uroUserID) userIsLastCommenter = true;
  7567.  
  7568. if(filterIfLastCommenter === true)
  7569. {
  7570. if(userIsLastCommenter === true) urStyle = 'hidden';
  7571. }
  7572. else if(filterIfNotLastCommenter === true)
  7573. {
  7574. if(userIsLastCommenter === false) urStyle = 'hidden';
  7575. }
  7576. }
  7577.  
  7578. let cidx;
  7579. if(ignoreOtherEditorComments === false)
  7580. {
  7581. commentDaysOld = ageLastComment;
  7582. }
  7583. else
  7584. {
  7585. for(cidx=0; cidx<nComments; cidx++)
  7586. {
  7587. let cObj = W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx];
  7588. if((cObj.userID == uroUserID) || (cObj.userID == -1))
  7589. {
  7590. commentDaysOld = uroUtils.GetCommentAge(cObj);
  7591. }
  7592. }
  7593. }
  7594. if((filterCommentMinAge === true) && (commentDaysOld != -1))
  7595. {
  7596. if(thresholdMinCommentAge > commentDaysOld) urStyle = 'hidden';
  7597. }
  7598. if((filterCommentMaxAge === true) && (commentDaysOld != -1))
  7599. {
  7600. if(thresholdMaxCommentAge < commentDaysOld) urStyle = 'hidden';
  7601. }
  7602.  
  7603. if((commenterUser !== null) && (urStyle != 'hidden'))
  7604. {
  7605. urStyle = 'hidden';
  7606. for(cidx=0; cidx<nComments; cidx++)
  7607. {
  7608. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx].userID == commenterUser)
  7609. {
  7610. urStyle = 'visible';
  7611. break;
  7612. }
  7613. }
  7614. }
  7615.  
  7616. let commentText = '';
  7617. for(cidx=0; cidx<nComments; cidx++)
  7618. {
  7619. commentText += W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx].text;
  7620. }
  7621.  
  7622. if(filterKeywordMustBePresent === true)
  7623. {
  7624. let keywordIsPresentInComments = uroUtils.KeywordPresent(commentText,keywordPresent,caseInsensitive);
  7625. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInComments));
  7626. }
  7627. if(filterKeywordMustBeAbsent === true)
  7628. {
  7629. let keywordIsAbsentInComments = uroUtils.KeywordPresent(commentText,keywordAbsent,caseInsensitive);
  7630. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInComments);
  7631. }
  7632. }
  7633. else
  7634. {
  7635. if(filterUserID === true)
  7636. {
  7637. urStyle = 'hidden';
  7638. }
  7639. }
  7640.  
  7641. filterByNotIncludedKeyword = (filterByNotIncludedKeyword && filterKeywordMustBeAbsent);
  7642. filterByIncludedKeyword = (filterByIncludedKeyword && filterKeywordMustBePresent);
  7643. if(filterByNotIncludedKeyword || filterByIncludedKeyword)
  7644. {
  7645. urStyle = 'hidden';
  7646. }
  7647.  
  7648. if(W.model.updateRequestSessions.objects[ureqID].attributes.isFollowing === true)
  7649. {
  7650. if(filterMyFollowed === true) urStyle = 'hidden';
  7651. }
  7652. else
  7653. {
  7654. if(filterMyUnfollowed === true) urStyle = 'hidden';
  7655. }
  7656. }
  7657. }
  7658.  
  7659. if(invertURStateFilters === true)
  7660. {
  7661. if(urStyle == 'hidden') urStyle = 'visible';
  7662. else urStyle = 'hidden';
  7663. }
  7664. }
  7665.  
  7666. // type filtering
  7667. if(urStyle == 'visible')
  7668. {
  7669. // Test for Waze automatic URs before any others - these always (?) get inserted as General Error URs,
  7670. // so we can't filter them by type...
  7671. if(desc.indexOf('Waze Automatic:') != -1)
  7672. {
  7673. wazeauto_ur = true;
  7674. }
  7675.  
  7676. if(wazeauto_ur === true)
  7677. {
  7678. if(filterWazeAuto === true) urStyle = 'hidden';
  7679. }
  7680.  
  7681. else if(ukroadworks_ur === true)
  7682. {
  7683. if(filterRoadworks === true) urStyle = 'hidden';
  7684. }
  7685. else if(construction_ur === true)
  7686. {
  7687. if(filterConstruction === true) urStyle = 'hidden';
  7688. }
  7689. else if(closure_ur === true)
  7690. {
  7691. if(filterClosure === true) urStyle = 'hidden';
  7692. }
  7693. else if(event_ur === true)
  7694. {
  7695. if(filterEvent === true) urStyle = 'hidden';
  7696. }
  7697. else if(note_ur === true)
  7698. {
  7699. if(filterNote === true) urStyle = 'hidden';
  7700. }
  7701. else if(wslm_ur === true)
  7702. {
  7703. if(filterWSLM === true) urStyle = 'hidden';
  7704. }
  7705. else if(bog_ur === true)
  7706. {
  7707. if(filterBOG === true) urStyle = 'hidden';
  7708. }
  7709. else if(difficult_ur === true)
  7710. {
  7711. if(filterDifficult === true) urStyle = 'hidden';
  7712. }
  7713.  
  7714. else if(ureq.attributes.type == 6)
  7715. {
  7716. if(filterIncorrectTurn === true) urStyle = 'hidden';
  7717. }
  7718. else if(ureq.attributes.type == 7)
  7719. {
  7720. if (filterIncorrectAddress === true) urStyle = 'hidden';
  7721. }
  7722. else if(ureq.attributes.type == 8)
  7723. {
  7724. if(filterIncorrectRoute === true) urStyle = 'hidden';
  7725. }
  7726. else if(ureq.attributes.type == 9)
  7727. {
  7728. if(filterMissingRoundabout === true) urStyle = 'hidden';
  7729. }
  7730. else if(ureq.attributes.type == 10)
  7731. {
  7732. if(filterGeneralError === true) urStyle = 'hidden';
  7733. }
  7734. else if(ureq.attributes.type == 11)
  7735. {
  7736. if(filterTurnNotAllowed === true) urStyle = 'hidden';
  7737. }
  7738. else if(ureq.attributes.type == 12)
  7739. {
  7740. if(filterIncorrectJunction === true) urStyle = 'hidden';
  7741. }
  7742. else if(ureq.attributes.type == 13)
  7743. {
  7744. if(filterMissingBridgeOverpass === true) urStyle = 'hidden';
  7745. }
  7746. else if(ureq.attributes.type == 14)
  7747. {
  7748. if(filterWrongDrivingDirection === true) urStyle = 'hidden';
  7749. }
  7750. else if(ureq.attributes.type == 15)
  7751. {
  7752. if(filterMissingExit === true) urStyle = 'hidden';
  7753. }
  7754. else if(ureq.attributes.type == 16)
  7755. {
  7756. if(filterMissingRoad === true) urStyle = 'hidden';
  7757. }
  7758. else if(ureq.attributes.type == 18)
  7759. {
  7760. if(filterMissingLandmark === true) urStyle = 'hidden';
  7761. }
  7762. else if(ureq.attributes.type == 19)
  7763. {
  7764. if(filterBlockedRoad === true) urStyle = 'hidden';
  7765. }
  7766. else if(ureq.attributes.type == 23)
  7767. {
  7768. if(filterNativeSpeedLimit === true) urStyle = 'hidden';
  7769. }
  7770. else if(filterUndefined === true) urStyle = 'hidden';
  7771.  
  7772. if(invertURFilters === true)
  7773. {
  7774. if(urStyle == 'hidden') urStyle = 'visible';
  7775. else urStyle = 'hidden';
  7776. }
  7777. }
  7778.  
  7779. // stage-age filtering override for tagged URs
  7780. if(noFilterTaggedURs === true)
  7781. {
  7782. if(ukroadworks_ur === true)
  7783. {
  7784. if(filterRoadworks === false) urStyle = 'visible';
  7785. }
  7786. else if(construction_ur === true)
  7787. {
  7788. if(filterConstruction === false) urStyle = 'visible';
  7789. }
  7790. else if(closure_ur === true)
  7791. {
  7792. if(filterClosure === false) urStyle = 'visible';
  7793. }
  7794. else if(event_ur === true)
  7795. {
  7796. if(filterEvent === false) urStyle = 'visible';
  7797. }
  7798. else if(note_ur === true)
  7799. {
  7800. if(filterNote === false) urStyle = 'visible';
  7801. }
  7802. else if(wslm_ur === true)
  7803. {
  7804. if(filterWSLM === false) urStyle = 'visible';
  7805. }
  7806. }
  7807. }
  7808. // only touch marker visibility if we've got active filter settings, or if URComments is not
  7809. // doing any filtering of its own
  7810. if((hasActiveURFilters === true) || (urcFilteringIsActive === false) || (uFURs_masterEnable === false))
  7811. {
  7812. let urMarker = uroGetMarker(uroLayers.ID.UR,urobj);
  7813. if(urMarker !== null)
  7814. {
  7815. urMarker.style.visibility = urStyle;
  7816. }
  7817. }
  7818. if(urStyle != 'hidden')
  7819. {
  7820. uroURExtras.AddToList(ureqID, customType, hasMyComments, nComments, ageLastComment);
  7821. }
  7822. }
  7823. }
  7824. uroURExtras.AddCommentCounts();
  7825. uroDBG.PerfMon(pmFunction, pmTStart);
  7826. }
  7827. function uroGetProblemTypes()
  7828. {
  7829. uroKnownProblemTypeIDs = [];
  7830. uroKnownProblemTypeNames = [];
  7831. let tProblemList = I18n.lookup("problems.types");
  7832. for(let tObj in tProblemList)
  7833. {
  7834. if(tObj !== undefined)
  7835. {
  7836. uroKnownProblemTypeIDs.push(parseInt(tObj));
  7837. uroKnownProblemTypeNames.push(tProblemList[tObj].title);
  7838. }
  7839. }
  7840. }
  7841. function uroFilterProblems()
  7842. {
  7843. let pmTStart = performance.now();
  7844. let pmFunction = "uroFilterProblems";
  7845.  
  7846. if(uroFilterPreamble() === false) return;
  7847. let selector;
  7848.  
  7849. if((uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter') === false) && (uroUtils.GetCBChecked('_cbMPClosedUserIDFilter') === false))
  7850. {
  7851. selector = document.getElementById('_selectMPUserID');
  7852. while(selector.options.length > 0)
  7853. {
  7854. selector.options.remove(0);
  7855. }
  7856. }
  7857.  
  7858. let solverUser = null;
  7859. if((uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter') === true) || (uroUtils.GetCBChecked('_cbMPClosedUserIDFilter') === true))
  7860. {
  7861. selector = document.getElementById('_selectMPUserID');
  7862. if(selector.options.length === 0)
  7863. {
  7864. uroUpdateEditorList(W.model.mapProblems.objects, '_selectMPUserID', false, false, true, false);
  7865. }
  7866. if(selector.selectedOptions[0] != null)
  7867. {
  7868. solverUser = parseInt(selector.selectedOptions[0].value);
  7869. }
  7870. }
  7871.  
  7872. let uFP_masterEnable = uroIsFilteringEnabled(false);
  7873. let filter_OutsideEditableArea = uroUtils.GetCBChecked('_cbMPFilterOutsideArea');
  7874. let filter_Solved = uroUtils.GetCBChecked('_cbMPFilterSolved');
  7875. let filter_Unidentified = uroUtils.GetCBChecked('_cbMPFilterUnidentified');
  7876. let filter_Closed = uroUtils.GetCBChecked('_cbMPFilterClosed');
  7877. let filter_NotClosedUserID = uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter');
  7878. let filter_ClosedUserID = uroUtils.GetCBChecked('_cbMPClosedUserIDFilter');
  7879. let filter_Reopened = uroUtils.GetCBChecked('_cbMPFilterReopenedProblem');
  7880.  
  7881. let filter_LowSeverity = uroUtils.GetCBChecked('_cbMPFilterLowSeverity');
  7882. let filter_MediumSeverity = uroUtils.GetCBChecked('_cbMPFilterMediumSeverity');
  7883. let filter_HighSeverity = uroUtils.GetCBChecked('_cbMPFilterHighSeverity');
  7884.  
  7885. let filterTypes = [];
  7886. let i;
  7887. for(i=0; i<uroKnownProblemTypeIDs.length; i++)
  7888. {
  7889. if(uroUtils.GetCBChecked('_cbMPFilter_T'+uroKnownProblemTypeIDs[i])) filterTypes.push(uroKnownProblemTypeIDs[i]);
  7890. }
  7891. let filter_TypeUnknown = uroUtils.GetCBChecked('_cbMPFilterUnknownProblem');
  7892.  
  7893. let filter_TaggedElgin = uroUtils.GetCBChecked('_cbFilterElgin');
  7894. let filter_TaggedTrafficCast = uroUtils.GetCBChecked('_cbFilterTrafficCast');
  7895. let filter_TaggedTrafficMaster = uroUtils.GetCBChecked('_cbFilterTrafficMaster');
  7896. let filter_TaggedCaltrans = uroUtils.GetCBChecked('_cbFilterCaltrans');
  7897. let filter_TaggedTFL = uroUtils.GetCBChecked('_cbFilterTFL');
  7898.  
  7899. let filter_Invert = uroUtils.GetCBChecked('_cbInvertMPFilter');
  7900.  
  7901. let filter_StartDateEnabled = uroUtils.GetCBChecked('_cbMPFilterStartDate');
  7902. let filter_EndDateEnabled = uroUtils.GetCBChecked('_cbMPFilterEndDate');
  7903. let filter_EndDatePassed = uroUtils.GetCBChecked('_cbMPFilterEndDatePassed');
  7904.  
  7905. let tsD = uroUtils.GetElmValue('_inputMPFilterStartDay');
  7906. let tsM = uroUtils.GetElmValue('_inputMPFilterStartMonth');
  7907. let tsY = uroUtils.GetElmValue('_inputMPFilterStartYear');
  7908. let startDate = uroUtils.GetTS(tsD, tsM, tsY, 0, 0);
  7909.  
  7910. tsD = uroUtils.GetElmValue('_inputMPFilterEndDay');
  7911. tsM = uroUtils.GetElmValue('_inputMPFilterEndMonth');
  7912. tsY = uroUtils.GetElmValue('_inputMPFilterEndYear');
  7913. let endDate = uroUtils.GetTS(tsD, tsM, tsY, 0, 0);
  7914. let nowTime = (new Date()).getTime();
  7915.  
  7916. for (let urobj in W.model.mapProblems.objects)
  7917. {
  7918. if(W.model.mapProblems.objects.hasOwnProperty(urobj))
  7919. {
  7920. let problem = W.model.mapProblems.objects[urobj];
  7921.  
  7922. if(problem.attributes.origJSONGeo === undefined)
  7923. {
  7924. // Store a copy of the original marker position if we haven't already done so
  7925. problem.attributes.origJSONGeo = uroUtils.CloneObject(problem.attributes.geoJSONGeometry);
  7926. }
  7927. else
  7928. {
  7929. // Restore the original position if we do have a copy of it, to undo any adjustments
  7930. // that may have been made in the last filtering pass
  7931. problem.attributes.geoJSONGeometry = uroUtils.CloneObject(problem.attributes.origJSONGeo);
  7932. }
  7933.  
  7934.  
  7935. let ureqID = problem.attributes.id;
  7936.  
  7937. let problemStyle = 'visible';
  7938. // check problem against current session ignore list...
  7939. if(uroIgnore.IsOnList(ureqID)) problemStyle = 'hidden';
  7940.  
  7941. if(uFP_masterEnable === true)
  7942. {
  7943. if(filter_OutsideEditableArea === true)
  7944. {
  7945. if(problem.canEdit() === false)
  7946. {
  7947. problemStyle = 'hidden';
  7948. }
  7949. }
  7950.  
  7951. if(filter_EndDatePassed == true)
  7952. {
  7953. if(problem.attributes.endTime > nowTime)
  7954. {
  7955. problemStyle = 'hidden';
  7956. }
  7957. }
  7958. if(filter_StartDateEnabled == true)
  7959. {
  7960. let tStart = new Date(problem.attributes.startTime);
  7961. tStart.setHours(0);
  7962. tStart.setMinutes(0);
  7963. tStart.setSeconds(0);
  7964. tStart = tStart.getTime();
  7965. if(tStart != startDate)
  7966. {
  7967. problemStyle = 'hidden';
  7968. }
  7969. }
  7970. if(filter_EndDateEnabled == true)
  7971. {
  7972. let tEnd = new Date(problem.attributes.endTime);
  7973. tEnd.setHours(0);
  7974. tEnd.setMinutes(0);
  7975. tEnd.setSeconds(0);
  7976. tEnd = tEnd.getTime();
  7977. if(tEnd != endDate)
  7978. {
  7979. problemStyle = 'hidden';
  7980. }
  7981. }
  7982.  
  7983. // check against closed/not identified filtering if enabled...
  7984. let geoID = problem.getOLGeometry().id;
  7985. if(geoID !== null)
  7986. {
  7987. if(document.getElementById(geoID) !== null)
  7988. {
  7989. let problem_marker_img = document.getElementById(geoID).href.baseVal;
  7990. if(filter_Solved === true)
  7991. {
  7992. if(problem_marker_img.indexOf('_solved') != -1) problemStyle = 'hidden';
  7993. }
  7994. if(filter_Unidentified === true)
  7995. {
  7996. if(problem_marker_img.indexOf('_rejected') != -1) problemStyle = 'hidden';
  7997. }
  7998. }
  7999. }
  8000.  
  8001. if(filter_Closed === true)
  8002. {
  8003. if(problem.attributes.open === false)
  8004. {
  8005. problemStyle = 'hidden';
  8006. }
  8007. }
  8008.  
  8009. if(problemStyle == 'visible')
  8010. {
  8011. if(solverUser !== null)
  8012. {
  8013. if((filter_NotClosedUserID === true) && (problem.attributes.resolvedBy == solverUser)) problemStyle = 'hidden';
  8014. if((filter_ClosedUserID === true) && (problem.attributes.resolvedBy != solverUser)) problemStyle = 'hidden';
  8015. }
  8016. }
  8017.  
  8018. if(problemStyle == 'visible')
  8019. {
  8020. let problemType = problem.attributes.subType;
  8021. let desc = '';
  8022. if(problem.attributes.description != null)
  8023. {
  8024. desc = problem.attributes.description;
  8025. }
  8026. let customType = uroGetCustomType(ureqID, uroLayers.ID.MP, desc);
  8027.  
  8028. if(customType === 100)
  8029. {
  8030. if(filter_TaggedElgin === true) problemStyle = 'hidden';
  8031. }
  8032. else if(customType === 101)
  8033. {
  8034. if(filter_TaggedTrafficCast === true) problemStyle = 'hidden';
  8035. }
  8036. else if(customType === 102)
  8037. {
  8038. if(filter_TaggedTrafficMaster === true) problemStyle = 'hidden';
  8039. }
  8040. else if(customType === 103)
  8041. {
  8042. if(filter_TaggedCaltrans === true) problemStyle = 'hidden';
  8043. }
  8044. else if(customType === 104)
  8045. {
  8046. if(filter_TaggedTFL === true) problemStyle = 'hidden';
  8047. }
  8048. else if(uroKnownProblemTypeIDs.indexOf(problemType) !== -1)
  8049. {
  8050. if(filterTypes.indexOf(problemType) !== -1)
  8051. {
  8052. problemStyle = 'hidden';
  8053. }
  8054. }
  8055. else if(filter_TypeUnknown === true) problemStyle = 'hidden';
  8056.  
  8057. if(filter_Reopened === true)
  8058. {
  8059. if((problem.attributes.open === true) && (problem.attributes.resolvedOn !== null))
  8060. {
  8061. problemStyle = 'hidden';
  8062. }
  8063. }
  8064.  
  8065.  
  8066. if(filter_Invert === true)
  8067. {
  8068. if(problemStyle == 'hidden') problemStyle = 'visible';
  8069. else problemStyle = 'hidden';
  8070. }
  8071.  
  8072.  
  8073. if(problem.attributes.weight <= 3)
  8074. {
  8075. if(filter_LowSeverity === true) problemStyle = 'hidden';
  8076. }
  8077. else if(problem.attributes.weight <= 7)
  8078. {
  8079. if(filter_MediumSeverity === true) problemStyle = 'hidden';
  8080. }
  8081. else if(filter_HighSeverity === true) problemStyle = 'hidden';
  8082. }
  8083. }
  8084.  
  8085. let marker = uroGetMarker(uroLayers.ID.MP, urobj);
  8086. if(marker !== null)
  8087. {
  8088. marker.style.visibility = problemStyle;
  8089. if(problemStyle === 'hidden')
  8090. {
  8091. // To ensure WME displays the details for the topmost marker that's
  8092. // left visible in a stack, alter the coords for any hidden markers
  8093. // to place them in a location that isn't likely to be clicked on...
  8094. problem.attributes.geoJSONGeometry.coordinates[0] = 0;
  8095. problem.attributes.geoJSONGeometry.coordinates[1] = 90;
  8096. }
  8097. }
  8098. }
  8099. }
  8100.  
  8101. uroDBG.PerfMon(pmFunction, pmTStart);
  8102. }
  8103. function uroFilterPreamble()
  8104. {
  8105. let mapviewport = document.getElementsByClassName("olMapViewport")[0];
  8106. if(mapviewport === null)
  8107. {
  8108. if(uroNullMapViewport === false)
  8109. {
  8110. uroDBG.AddLog('caught null mapviewport');
  8111. uroNullMapViewport = true;
  8112. }
  8113. return false;
  8114. }
  8115.  
  8116. let uiElms = uroTabs.CtrlTabs[uroTabs.IDS.MISC][uroTabs.FIELDS.TABBODY];
  8117. if(uiElms == null)
  8118. {
  8119. uroDBG.AddLog('caught missing UI');
  8120. return false;
  8121. }
  8122. if(uiElms.innerHTML.length === 0)
  8123. {
  8124. uroDBG.AddLog('caught empty UI');
  8125. return false;
  8126. }
  8127.  
  8128. if(uroSettingsApplied === false)
  8129. {
  8130. return false;
  8131. }
  8132.  
  8133. uroNullMapViewport = false;
  8134.  
  8135. return true;
  8136. }
  8137. function uroFilterItems_MasterEnableClick()
  8138. {
  8139. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  8140. {
  8141. uroPopup.Hide();
  8142. }
  8143. uroFilterItems();
  8144. }
  8145. function uroFilterItems()
  8146. {
  8147. uroFilterProblems();
  8148. uroFilterPlaces();
  8149. uroFilterCameras();
  8150. uroFilterURs();
  8151. uroFilterRTCs();
  8152. uroFilterRAs();
  8153. uroFilterMapComments();
  8154. }
  8155. function uroFilterItemsOnMove()
  8156. {
  8157. W.map.events.unregister('mousemove',null,uroFilterItemsOnMove);
  8158. uroFilterItems();
  8159. }
  8160. function uroCheckCommentsForTag(idSrc)
  8161. {
  8162. let ursObj = W.model.updateRequestSessions.objects[idSrc];
  8163. if(typeof(ursObj) == 'undefined') return -1;
  8164. if(ursObj.attributes.comments.length === 0) return -1;
  8165.  
  8166. for(let idx=ursObj.attributes.comments.length-1; idx>=0; idx--)
  8167. {
  8168. for(let tag=0; tag<uroCustomURTags.length; tag++)
  8169. {
  8170. let keyword = uroCustomURTags[tag];
  8171. if(ursObj.attributes.comments[idx].text.indexOf(keyword) != -1)
  8172. {
  8173. return tag;
  8174. }
  8175. }
  8176. }
  8177. return -1;
  8178. }
  8179. function uroGetCustomType(idSrc, markerType, desc)
  8180. {
  8181. let provider = '';
  8182. if(desc === null) desc = '';
  8183. if(markerType == uroLayers.ID.UR)
  8184. {
  8185. let ureq = W.model.mapUpdateRequests.objects[idSrc];
  8186. // early test for native speed limit URs
  8187. if(ureq.attributes.type == 23) return 98;
  8188. }
  8189. else if(markerType == uroLayers.ID.MP)
  8190. {
  8191. let mp = W.model.mapProblems.objects[idSrc];
  8192. if(mp.attributes.provider != null)
  8193. {
  8194. provider = mp.attributes.provider;
  8195. }
  8196. }
  8197.  
  8198. if(desc !== '')
  8199. {
  8200. if((markerType == uroLayers.ID.UR) || (markerType == 'mc'))
  8201. {
  8202. for(let tag=0; tag<uroCustomURTags.length; tag++)
  8203. {
  8204. let keyword = uroCustomURTags[tag];
  8205. if(desc.indexOf(keyword) != -1)
  8206. {
  8207. return tag;
  8208. }
  8209. }
  8210. }
  8211.  
  8212. if(markerType == uroLayers.ID.MP)
  8213. {
  8214. if(desc.indexOf('[Elgin]') != -1) return 100;
  8215. if(desc.indexOf('[ELGIN]') != -1) return 100;
  8216. if(desc.indexOf('[elginroadworks]') != -1) return 100;
  8217. if(desc.indexOf('[one.network]') != -1) return 100;
  8218. if(desc.indexOf('[TrafficCast]') != -1) return 101;
  8219. if(desc.indexOf('[TM]') != -1) return 102;
  8220. if(desc.indexOf('[Caltrans]') != -1) return 103;
  8221. if(desc.indexOf('[TfL Open Data]') != -1) return 104;
  8222. if(provider.indexOf('London TFL Closures') != -1) return 104;
  8223. }
  8224. }
  8225.  
  8226. if(markerType == uroLayers.ID.UR)
  8227. {
  8228. return uroCheckCommentsForTag(idSrc);
  8229. }
  8230.  
  8231. return -1;
  8232. }
  8233. function uroGetRestrictionLanes(disposition)
  8234. {
  8235. let retval = '';
  8236. if(disposition == 1) retval += 'All lanes';
  8237. else if(disposition == 2) retval += 'Left lane';
  8238. else if(disposition == 3) retval += 'Middle lane';
  8239. else if(disposition == 4) retval += 'Right lane';
  8240. else retval += ' - ';
  8241. return retval;
  8242. }
  8243. function uroGetRestrictionLaneType(laneType)
  8244. {
  8245. let retval = '';
  8246. if(laneType === null) retval += ' - ';
  8247. else
  8248. {
  8249. if(laneType == 1) retval += 'HOV';
  8250. else if(laneType == 2) retval += 'HOT';
  8251. else if(laneType == 3) retval += 'Express';
  8252. else if(laneType == 4) retval += 'Bus lane';
  8253. else if(laneType == 5) retval += 'Fast lane';
  8254. else retval += ' - ';
  8255. }
  8256. return retval;
  8257. }
  8258. let uroVehicleTypes =
  8259. [
  8260. [1280, 'fa-car'],
  8261. [1024, 'fa-motorcycle'],
  8262. [272, 'fa-taxi'],
  8263. [1808, 'fa-bolt']
  8264. ];
  8265. function uroGetRestrictionVehicleTypes(restObj, allowInit, profileKey)
  8266. {
  8267. let i;
  8268. let j;
  8269. let k;
  8270. let tVT;
  8271. let retval = [];
  8272. for(i = 0; i < uroVehicleTypes.length; ++i)
  8273. {
  8274. retval.push(allowInit);
  8275. }
  8276. let tRest = restObj._driveProfiles.get(profileKey);
  8277. if(tRest !== undefined)
  8278. {
  8279. for(i = 0; i < tRest._driveProfiles.length; ++i)
  8280. {
  8281. tVT = tRest._driveProfiles[i].getVehicleTypes();
  8282. {
  8283. if(tVT.length > 0)
  8284. {
  8285. for(j = 0; j < tVT.length; ++j)
  8286. {
  8287. for(k = 0; k < uroVehicleTypes.length; ++k)
  8288. {
  8289. if(tVT[j] == uroVehicleTypes[k][0])
  8290. {
  8291. retval[k] = !allowInit;
  8292. }
  8293. }
  8294. }
  8295. }
  8296. }
  8297. }
  8298. }
  8299. return retval;
  8300. }
  8301. function uroFormatRestriction(restObj)
  8302. {
  8303. let retval = '';
  8304.  
  8305. if(restObj._defaultType == "DIFFICULT")
  8306. {
  8307. retval = '<tr><td colspan=13>Difficult Turn';
  8308. }
  8309. else
  8310. {
  8311. let roDays = null;
  8312. let roFromDate = null;
  8313. let roToDate = null;
  8314. let roFromTime = null;
  8315. let roToTime = null;
  8316. let roRepeats = false;
  8317. let roAllDay = false;
  8318. if(restObj._days !== undefined)
  8319. {
  8320. roDays = restObj._days;
  8321. roFromDate = restObj._fromDate;
  8322. roToDate = restObj._toDate;
  8323. roFromTime = restObj._fromTime;
  8324. roToTime = restObj._toTime;
  8325. }
  8326. else if(restObj._timeFrames.length > 0)
  8327. {
  8328. if(restObj._timeFrames[0]._weekdays !== undefined)
  8329. {
  8330. roDays = restObj._timeFrames[0]._weekdays;
  8331. roFromDate = restObj._timeFrames[0]._startDate;
  8332. roToDate = restObj._timeFrames[0]._endDate;
  8333. roFromTime = restObj._timeFrames[0]._fromTime;
  8334. roToTime = restObj._timeFrames[0]._toTime;
  8335. roRepeats = restObj._timeFrames[0]._repeatYearly;
  8336. }
  8337. }
  8338.  
  8339. if((roFromTime === null) && (roToTime === null))
  8340. {
  8341. roFromTime = "0:00";
  8342. roToTime = "23:59";
  8343. roAllDay = true;
  8344. }
  8345.  
  8346. let hasExpired = false;
  8347. let isFuture = false;
  8348. let tNow = Date.now();
  8349. let tFrom = null;
  8350. let tTo = null;
  8351. if(roFromDate !== null)
  8352. {
  8353. tFrom = new Date(roFromDate + " " + roFromTime);
  8354. isFuture = (tFrom.getTime() > tNow);
  8355. }
  8356. if(roToDate !== null)
  8357. {
  8358. tTo = new Date(roToDate + " " + roToTime);
  8359. hasExpired = (tTo.getTime() < tNow);
  8360. }
  8361. if((hasExpired === true) && (roRepeats === true))
  8362. {
  8363. while(tTo.getTime() < tNow)
  8364. {
  8365. tFrom.setFullYear(tFrom.getFullYear() + 1);
  8366. tTo.setFullYear(tTo.getFullYear() + 1);
  8367. }
  8368. isFuture = (tFrom.getTime() > tNow);
  8369. hasExpired = false;
  8370. }
  8371.  
  8372.  
  8373. if(isFuture === true)
  8374. {
  8375. retval = '<tr bgcolor="#8080FF">';
  8376. }
  8377. else if(hasExpired === true)
  8378. {
  8379. retval = '<tr bgcolor="#FFFFC0">';
  8380. }
  8381. else
  8382. {
  8383. retval = '<tr>';
  8384. }
  8385.  
  8386. if(roDays === null)
  8387. {
  8388. roDays = 127;
  8389. }
  8390.  
  8391. retval += '<td style="text-align:center;">';
  8392. if((roDays & 1) == 1) retval += 'M';
  8393. else retval += '-';
  8394. retval += '</td><td style="text-align:center;">';
  8395. if((roDays & 2) == 2) retval += 'Tu';
  8396. else retval += '-';
  8397. retval += '</td><td style="text-align:center;">';
  8398. if((roDays & 4) == 4) retval += 'W';
  8399. else retval += '-';
  8400. retval += '</td><td style="text-align:center;">';
  8401. if((roDays & 8) == 8) retval += 'Th';
  8402. else retval += '-';
  8403. retval += '</td><td style="text-align:center;">';
  8404. if((roDays & 16) == 16) retval += 'F';
  8405. else retval += '-';
  8406. retval += '</td><td style="text-align:center;">';
  8407. if((roDays & 32) == 32) retval += 'Sa';
  8408. else retval += '-';
  8409. retval += '</td><td style="text-align:center;">';
  8410. if((roDays & 64) == 64) retval += 'Su';
  8411. else retval += '-';
  8412.  
  8413. retval += '</td><td nowrap style="text-align:center;">';
  8414.  
  8415. if(roFromDate === null) retval += 'All dates';
  8416. else retval += tFrom.toISOString().slice(0,10) + ' to ' + tTo.toISOString().slice(0,10);
  8417. if(roRepeats === true)
  8418. {
  8419. retval += '&nbsp;<i class="fa fa-repeat"> </i>';
  8420. }
  8421.  
  8422. retval += '</td><td nowrap style="text-align:center;">';
  8423.  
  8424. if((restObj._allDay === true) || (roAllDay === true)) retval += 'All day';
  8425. else retval += roFromTime + ' to ' + roToTime;
  8426.  
  8427. retval += '</td><td nowrap style="text-align:center;">';
  8428.  
  8429. retval += uroGetRestrictionLanes(restObj._disposition);
  8430.  
  8431. retval += '</td><td nowrap style="text-align:center;">';
  8432.  
  8433. retval += uroGetRestrictionLaneType(restObj._laneType);
  8434.  
  8435. retval += '</td><td nowrap style="text-align:center;">';
  8436.  
  8437. // for brevity, the popup only displays the allowed/prohibited restriction for the driveable vehicle types in the app...
  8438. let typesAllowed = [];
  8439. if((restObj._defaultType == "BLOCKED") || (restObj._defaultType == "TOLL"))
  8440. {
  8441. if(restObj._defaultType == "TOLL")
  8442. {
  8443. retval += I18n.lookup('restrictions.editing.segment.toll_road');
  8444. }
  8445. typesAllowed = uroGetRestrictionVehicleTypes(restObj, false, "FREE");
  8446. }
  8447. else
  8448. {
  8449. typesAllowed = uroGetRestrictionVehicleTypes(restObj, true, "BLOCKED");
  8450. }
  8451.  
  8452. let i;
  8453. for(i = 0; i < uroVehicleTypes.length; ++i)
  8454. {
  8455. if(typesAllowed[i] === true)
  8456. {
  8457. retval += '<i class="fa '+uroVehicleTypes[i][1]+'" style="color:#000000;"> </i>&nbsp;';
  8458. }
  8459. else
  8460. {
  8461. retval += '<i class="fa '+uroVehicleTypes[i][1]+'" style="color:#d0d0d0;"> </i>&nbsp;';
  8462. }
  8463. }
  8464.  
  8465. retval += '</td><td>';
  8466. retval += uroUtils.Clickify(restObj._description, '');
  8467. }
  8468.  
  8469. retval += '</td></tr>';
  8470.  
  8471. return retval;
  8472. }
  8473. function uroOpenURDialog(urID)
  8474. {
  8475. let t = {showNext: false, nextButtonString: I18n.lookup('problems.panel.done')};
  8476. let urObj = W.model.mapUpdateRequests.objects[urID];
  8477. W.reqres.request("problems:browse", _.extend(t, {problem: urObj}));
  8478. }
  8479. function uroDoesLayerHaveMF(markerType)
  8480. {
  8481. let mtList = uroGetMarkerTypeList(markerType);
  8482. let mfAvailable = false;
  8483. while(mtList.length > 0)
  8484. {
  8485. let mt = mtList.pop();
  8486. if(uroLayers.layers[mt].mf !== null)
  8487. {
  8488. mfAvailable = true;
  8489. break;
  8490. }
  8491. }
  8492. return mfAvailable;
  8493. }
  8494. function uroRestackMarkers()
  8495. {
  8496. if(uroStackList.length === 0) return;
  8497.  
  8498. if(uroDoesLayerHaveMF(uroStackType) === true)
  8499. {
  8500. uroDBG.AddLog('restacking markers...');
  8501. // strip off the .realX/realY attributes from any UR object we've previously added it to, to allow
  8502. // the native recentering to work again...
  8503. let idList = uroGetMarkerIDs(uroStackType);
  8504. for(let marker of idList)
  8505. {
  8506. let testMarkerAttributes = uroGetAttributes(uroStackType, marker);
  8507. if(testMarkerAttributes.geometry.realX != null)
  8508. {
  8509. testMarkerAttributes.geometry.x = testMarkerAttributes.geometry.realX;
  8510. testMarkerAttributes.geometry.y = testMarkerAttributes.geometry.realY;
  8511. delete(testMarkerAttributes.geometry.realX);
  8512. delete(testMarkerAttributes.geometry.realY);
  8513. }
  8514. }
  8515. // now restack any markers that were repositioned...
  8516. for(let idx=0; idx<uroStackList.length; idx++)
  8517. {
  8518. let urM = uroGetMarker(uroStackType, uroStackList[idx]);
  8519. if(urM != null)
  8520. {
  8521. urM.style.transform = "";
  8522. }
  8523. }
  8524. uroStackList = [];
  8525. uroUnstackedMasterID = null;
  8526. uroStackType = null;
  8527. uroDBG.AddLog('...stacked!');
  8528. }
  8529. }
  8530. function uroIsIDAlreadyUnstacked(idSrc)
  8531. {
  8532. if(uroStackList.length === 0) return false;
  8533. for(let idx=0; idx<uroStackList.length; idx++)
  8534. {
  8535. if(uroStackList[idx] == idSrc) return true;
  8536. }
  8537. return false;
  8538. }
  8539. function uroHideOtherMarkers(stackType)
  8540. {
  8541. const stackTypes = [uroLayers.ID.VPUR, uroLayers.ID.UR, uroLayers.ID.MP];
  8542.  
  8543. for(let st of stackTypes)
  8544. {
  8545. let listIDs = uroGetMarkerIDs(st);
  8546. for(let mID of listIDs)
  8547. {
  8548. let toHideMarker = uroGetMarker(st, mID);
  8549. if(toHideMarker !== null)
  8550. {
  8551. if((uroIsIDAlreadyUnstacked(mID) === false) || (st !== stackType))
  8552. {
  8553. if(st === uroLayers.ID.VPUR)
  8554. {
  8555. uroFilterPURMarker(st, mID, 'hidden');
  8556. }
  8557. else
  8558. {
  8559. toHideMarker.style.visibility = 'hidden';
  8560. }
  8561. }
  8562. }
  8563. }
  8564. }
  8565. }
  8566. function uroCheckStacking(stackType, masterID)
  8567. {
  8568. if(typeof(masterID) === 'number')
  8569. {
  8570. masterID = masterID.toString();
  8571. }
  8572.  
  8573. if(uroIsIDAlreadyUnstacked(masterID) === true) return;
  8574. if(uroStackType !== null) return;
  8575.  
  8576. // Do the uroGetMarkerIDs call here, as this refreshes the .mf entries in uroLayers,
  8577. // which is needed for uroGetMarker to be able to find the marker if the layer markers
  8578. // have been updated by WME...
  8579. let idList = uroGetMarkerIDs(stackType);
  8580.  
  8581. let masterObj = uroGetMarker(stackType, masterID);
  8582. if(masterObj === null) return;
  8583.  
  8584. uroDBG.AddLog('checking for marker stack, masterID: '+masterID+', stackType: '+stackType);
  8585. let stackList = [];
  8586. stackList.push(masterID);
  8587. let threshSquared = uroUtils.GetElmValue('_inputUnstackSensitivity');
  8588. threshSquared *= threshSquared;
  8589.  
  8590. let bcr = masterObj.getBoundingClientRect();
  8591. let unstackedX = (bcr.left + bcr.right) / 2;
  8592. let unstackedY = (bcr.top + bcr.bottom) / 2;
  8593.  
  8594. let offset = 0.000000001;
  8595. if(uroDoesLayerHaveMF(stackType) === true)
  8596. {
  8597. let showOpen = true;
  8598. let showClosed = false;
  8599. let showTypes = null;
  8600. if(stackType === uroLayers.ID.UR)
  8601. {
  8602. showTypes = W?.issueTrackerController?.app?.attributes?.issueTrackerFilter?.attributes?.mapUpdateRequestsFilter?.attributes?.status;
  8603. }
  8604. else if(stackType === uroLayers.ID.MP)
  8605. {
  8606. showTypes = W?.issueTrackerController?.app?.attributes?.issueTrackerFilter?.attributes?.mapProblemsFilter?.attributes?.status;
  8607. }
  8608. if(showTypes !== null)
  8609. {
  8610. showOpen = ((showTypes == 'OPEN') || (showTypes == 'BOTH'));
  8611. showClosed = ((showTypes == 'CLOSED') || (showTypes == 'BOTH'));
  8612. }
  8613.  
  8614. for(let marker of idList)
  8615. {
  8616. let testMarkerObj = uroGetMarker(stackType, marker);
  8617. let testMarkerAttributes = uroGetAttributes(stackType, marker);
  8618. if((testMarkerAttributes !== null) && (testMarkerObj !== null))
  8619. {
  8620. // if multiple markers are stacked exactly on top of one another, WME will always open up the one which it would have rendered on the
  8621. // top of the stack in the absence of any URO+ filtering, regardless of which UR pin actually receives the click event. To prevent
  8622. // this, we give each pin in the stack a unique set of false coordinates, storing the original coordinates in newly created
  8623. // properties so they can be restored later on.
  8624. //
  8625. // As of 3.169, the offset added to create the false coordinates has now been changed to a fractional value as opposed to the large integer
  8626. // it previously was, as the latter method has now been seen to cause problems with displaying the "A" marker when a road closure request MP
  8627. // is being viewed. By using a small fractional offset added to each stacked marker, the risk of accidentally setting the offset coords to
  8628. // those of another marker is low
  8629. if(testMarkerAttributes.geometry.realX === undefined)
  8630. {
  8631. testMarkerAttributes.geometry.realX = testMarkerAttributes.geometry.x;
  8632. testMarkerAttributes.geometry.x += offset;
  8633. testMarkerAttributes.geometry.realY = testMarkerAttributes.geometry.y;
  8634. testMarkerAttributes.geometry.y += offset;
  8635. offset += 0.000000001;
  8636. }
  8637.  
  8638. let includeInStack = (testMarkerObj.style.visibility != 'hidden');
  8639. let isClosed = (testMarkerAttributes.open === false);
  8640. includeInStack = includeInStack && ((isClosed && showClosed) || (!isClosed && showOpen));
  8641. if(includeInStack)
  8642. {
  8643. let tmID = testMarkerAttributes.id;
  8644. if(typeof(tmID) === 'number')
  8645. {
  8646. tmID = tmID.toString();
  8647. }
  8648. if(tmID != masterID)
  8649. {
  8650. let bcr = testMarkerObj.getBoundingClientRect();
  8651. let tmx = (bcr.left + bcr.right) / 2;
  8652. let tmy = (bcr.top + bcr.bottom) / 2;
  8653. let xdiff = unstackedX - tmx;
  8654. let ydiff = unstackedY - tmy;
  8655. let distSquared = ((xdiff * xdiff) + (ydiff * ydiff));
  8656. if(distSquared < threshSquared)
  8657. {
  8658. stackList.push(tmID);
  8659. }
  8660. }
  8661. }
  8662. }
  8663. }
  8664. }
  8665.  
  8666. let inhibitUnstacking = (W.map.getZoom() < uroUtils.GetElmValue('_inputUnstackZoomLevel'));
  8667. inhibitUnstacking = inhibitUnstacking || (stackList.length < 2);
  8668.  
  8669. if(inhibitUnstacking == false)
  8670. {
  8671. uroStackType = stackType;
  8672. if(uroUnstackedMasterID != masterID)
  8673. {
  8674. uroDBG.AddLog('unstacked ID mismatch, relocating markers...');
  8675. uroRestackMarkers();
  8676. uroUnstackedMasterID = masterID;
  8677. uroStackList = [];
  8678.  
  8679. // push the highlighted marker onto the stacklist so uroIsIDAlreadyUnstacked() will return true
  8680. uroStackList.push(masterID);
  8681.  
  8682. let offsetX = 0;
  8683. let offsetY = 0;
  8684. for(let shoveIdx=0; shoveIdx < stackList.length; shoveIdx++)
  8685. {
  8686. let fid = stackList[shoveIdx];
  8687. let stackMarker = uroGetMarker(stackType, fid);
  8688. if(stackMarker !== null)
  8689. {
  8690. let bcr = stackMarker.getBoundingClientRect();
  8691. let smx = (bcr.left + bcr.right) / 2;
  8692. let smy = (bcr.top + bcr.bottom) / 2;
  8693. let newX = unstackedX - smx + offsetX;
  8694. let newY = unstackedY - smy - offsetY;
  8695. uroStackList.push(fid);
  8696. stackMarker.style.transform = "translate("+newX+"px, "+newY+"px)";
  8697. offsetX += 10;
  8698. offsetY += 25;
  8699. }
  8700. }
  8701.  
  8702.  
  8703. // hide other markers to prevent confusion with the unstacked markers
  8704. uroHideOtherMarkers(stackType);
  8705. // also hide the comment counts we add to URs, both so that they don't hang around
  8706. // after we've hidden the respective UR markers not in the current stack, and also
  8707. // because even for the ones that are in the stack, the counts would get in the
  8708. // way unless we repositioned them, which seems like extra effort that isn't really
  8709. // worthwhile given that once a user is into the realms of unstacking a UR cluster,
  8710. // they've probably already gleaned all the info they need from the counts and can
  8711. // do without them whilst handling the stack...
  8712. uroURExtras.RemoveCommentCounts();
  8713. }
  8714. }
  8715. else
  8716. {
  8717. uroRestackMarkers();
  8718. }
  8719. }
  8720. function uroGetVenueNavPoint(uroFID)
  8721. {
  8722. let retval = W.map.getUnprojectedCenter(); // allow the function to return a safe value in case we can't find the requested venue object...
  8723.  
  8724. let vObj = W.model.venues.objects[uroFID];
  8725. if(vObj !== undefined)
  8726. {
  8727. if(vObj.attributes.entryExitPoints.length > 0)
  8728. {
  8729. // if the venue has any navpoints defined, use the position of the first one
  8730. let tPoint = vObj.attributes.entryExitPoints[0].getPoint();
  8731. retval.lon = tPoint.coordinates[0];
  8732. retval.lat = tPoint.coordinates[1];
  8733. }
  8734. else
  8735. {
  8736. // otherwise use the centrepoint of the venue point or polygon
  8737. let tPoint = vObj.attributes.geometry.getCentroid();
  8738. let tLL = new OpenLayers.LonLat();
  8739. tLL.lon = tPoint.x;
  8740. tLL.lat = tPoint.y;
  8741. tLL = uroUtils.ConvertMercatorToWGS84(tLL);
  8742. retval.lon = tLL.lon;
  8743. retval.lat = tLL.lat;
  8744. }
  8745. }
  8746. return retval;
  8747. }
  8748. function uroOpenNewTab()
  8749. {
  8750. // flush the current settings into localStorage before the new tab opens, so that when its instance of
  8751. // URO+ fires up it'll have the same settings as this one
  8752. uroConfig.SaveSettings();
  8753. return true;
  8754. }
  8755. function uroGetRTCDuration(rcObj)
  8756. {
  8757. let duration = new Date(rcObj.attributes.endDate) - new Date(rcObj.attributes.startDate);
  8758. return Math.floor(duration / 86400000);
  8759. }
  8760. function uroGetRTCOffset(rcDate)
  8761. {
  8762. let dateObj = new Date(rcDate);
  8763. return (0 - uroUtils.DateToDays(dateObj));
  8764. }
  8765. function uroGetRTCOrigin(rcObj)
  8766. {
  8767. let retval = uroEnums.TRTC.UNKNOWN;
  8768.  
  8769. if(rcObj !== undefined)
  8770. {
  8771. if(rcObj.attributes.createdBy == -5)
  8772. {
  8773. retval = uroEnums.TRTC.WAZEFEED;
  8774. }
  8775. else if((W.model.users.objects[rcObj.attributes.createdBy] !== undefined) && (W.model.users.objects[rcObj.attributes.createdBy].attributes.rank == 6))
  8776. {
  8777. retval = uroEnums.TRTC.WAZEOTHER;
  8778. }
  8779. else
  8780. {
  8781. retval = uroEnums.TRTC.WME;
  8782. }
  8783. }
  8784.  
  8785. return retval;
  8786. }
  8787. function uroGetRTCState(rcObj)
  8788. {
  8789. let retval = uroEnums.SRTC.UNKNOWN;
  8790. let rcStatus = rcObj.attributes.closureStatus;
  8791.  
  8792. if(rcStatus !== undefined)
  8793. {
  8794. if(rcStatus === "ACTIVE")
  8795. {
  8796. retval = uroEnums.SRTC.ACTIVE;
  8797. }
  8798. else if(rcStatus === "NOT_STARTED")
  8799. {
  8800. retval = uroEnums.SRTC.FUTURE;
  8801. }
  8802. else if(rcStatus.indexOf("FINISHED") != -1)
  8803. {
  8804. retval = uroEnums.SRTC.EXPIRED;
  8805. }
  8806. // Haven't seen one of these yet, so assuming it should be treated
  8807. // the same as an expired closure...
  8808. else if(rcStatus === "SUSPENDED")
  8809. {
  8810. retval = uroEnums.SRTC.EXPIRED;
  8811. }
  8812. }
  8813.  
  8814. return retval;
  8815. }
  8816. function uroGetRTCStateText(rcObj)
  8817. {
  8818. let retval = "---";
  8819. let i18 = I18n.lookup("closures.statuses")[rcObj.attributes.closureStatus];
  8820. if(i18 !== undefined)
  8821. {
  8822. retval = i18;
  8823. }
  8824. return retval;
  8825. }
  8826. function uroGetAddress(streetID, houseNumber, formatForSegmentPopup, formatForNodePopup, showAsToll)
  8827. {
  8828. let result = '';
  8829. if((houseNumber !== undefined) && (houseNumber !== null))
  8830. {
  8831. result += houseNumber + ' ';
  8832. }
  8833.  
  8834. if(streetID != null)
  8835. {
  8836. let streetName = I18n.lookup('edit.address.no_street');
  8837. let doesStreetIDExist = true;
  8838. if(W.model.streets.objects[streetID] === undefined)
  8839. {
  8840. streetName = 'non-existent streetID';
  8841. doesStreetIDExist = false;
  8842. }
  8843. else
  8844. {
  8845. if((streetName !== null) && (W.model.streets.objects[streetID].attributes.isEmpty === false))
  8846. {
  8847. streetName = W.model.streets.objects[streetID].attributes.name;
  8848. }
  8849. }
  8850. if(formatForSegmentPopup === true)
  8851. {
  8852. if(showAsToll == true)
  8853. {
  8854. result += '<i class="fa fa-credit-card"></i> ';
  8855. }
  8856. result += '<b>'+streetName+'</b><br>';
  8857. }
  8858. else
  8859. {
  8860. result += streetName + ', ';
  8861. }
  8862.  
  8863. if(doesStreetIDExist === true)
  8864. {
  8865. let cityName = I18n.lookup('edit.address.no_city');
  8866. let doesCityIDExist = true;
  8867. let cityID = W.model.streets.objects[streetID].attributes.cityID;
  8868. if(W.model.cities.objects[cityID] === undefined)
  8869. {
  8870. cityName = 'non-existent cityID';
  8871. doesCityIDExist = false;
  8872. }
  8873. else
  8874. {
  8875. if(W.model.cities.objects[cityID].attributes.name !== "")
  8876. {
  8877. cityName = W.model.cities.objects[cityID].attributes.name;
  8878. }
  8879. }
  8880. result += cityName + ', ';
  8881.  
  8882. if(doesCityIDExist === true)
  8883. {
  8884. let stateID = W.model.cities.objects[cityID].attributes.stateID;
  8885. if(W.model.states.objects[stateID] === undefined)
  8886. {
  8887. result += 'non-existent stateID';
  8888. }
  8889. else
  8890. {
  8891. result += W.model.states.objects[stateID].attributes.name;
  8892. }
  8893. }
  8894. }
  8895. }
  8896. result += '<br>';
  8897.  
  8898. return result;
  8899. }
  8900. function uroGetSelectedSegmentRTCs(segID)
  8901. {
  8902. let closureTypes = uroEnums.DRTC.NONE;
  8903. let RTCObjs = [];
  8904. let selectedSegs = [];
  8905.  
  8906. if(segID === null)
  8907. {
  8908. // segID should always be set to a valid segment ID if we're being called from the segment mouseover
  8909. // handler, so if it's null it implies we've instead been called from the closure panel handler where
  8910. // we might therefore be dealing with a multi-segment selection...
  8911. selectedSegs = W.selectionManager.getSegmentSelection().segments;
  8912. }
  8913.  
  8914. if((selectedSegs.length > 0) || (segID !== null))
  8915. {
  8916. let filterExpired = uroUtils.GetCBChecked('_cbHideExpiredPopupRTCs');
  8917. let filterCurrent = uroUtils.GetCBChecked('_cbHidePopupRTCs');
  8918. let filterFuture = uroUtils.GetCBChecked('_cbHideFuturePopupRTCs');
  8919. let filterUnknown = uroUtils.GetCBChecked('_cbHideUnknownPopupRTCs');
  8920.  
  8921. for(let roadClosure in W.model.roadClosures.objects)
  8922. {
  8923. if(W.model.roadClosures.objects.hasOwnProperty(roadClosure))
  8924. {
  8925. let rcObj = W.model.roadClosures.objects[roadClosure];
  8926. let rcState = uroGetRTCState(rcObj);
  8927. let ignore = ((rcState === uroEnums.SRTC.EXPIRED) && (filterExpired === true));
  8928. ignore = ignore || ((rcState === uroEnums.SRTC.ACTIVE) && (filterCurrent === true));
  8929. ignore = ignore || ((rcState === uroEnums.SRTC.FUTURE) && (filterFuture === true));
  8930. ignore = ignore || ((rcState === uroEnums.SRTC.UNKNOWN) && (filterUnknown === true));
  8931.  
  8932. if(ignore === false)
  8933. {
  8934. rcObj.segIDs = [rcObj.attributes.segID]; // copy the segID property into an array so we can push extra segIDs into it later...
  8935.  
  8936. // set a direction value corresponding to the A-B or B-A setting - if we later end up combining an A-B and B-A closure
  8937. // into a two-way closure, we can then change the direction value to indicate this as well
  8938. if(rcObj.attributes.forward === true)
  8939. {
  8940. rcObj.direction = uroEnums.DRTC.SEG_AB;
  8941. }
  8942. else
  8943. {
  8944. rcObj.direction = uroEnums.DRTC.SEG_BA;
  8945. }
  8946.  
  8947. // for each of the selected or moused-over segments, find all the closures which have matching segIDs
  8948. if(segID !== null)
  8949. {
  8950. if(rcObj.attributes.segID == segID)
  8951. {
  8952. RTCObjs.push(rcObj);
  8953. }
  8954. }
  8955. else
  8956. {
  8957. for(let i = 0; i < selectedSegs.length; ++i)
  8958. {
  8959. if(rcObj.attributes.segID == selectedSegs[i].attributes.id)
  8960. {
  8961. RTCObjs.push(rcObj);
  8962. break;
  8963. }
  8964. }
  8965. }
  8966. }
  8967. }
  8968. }
  8969.  
  8970. // RTCObjs now contains all of the segment closures relating to all of the segments of interest, so
  8971. // we can begin to organise them such that by the time we exit this function, the array will then contain
  8972. // an optimised list of closures that matches up to the list shown in the closure sidepanel, taking into
  8973. // account closures applying to all segments vs some, closures that can be merged into two-ways etc.
  8974.  
  8975. // first sort the closure by their start date, with a secondary sort by direction for those closures
  8976. // that have the same start date
  8977. RTCObjs = RTCObjs.sort(function(a,b)
  8978. {
  8979. if(a.attributes.startDate === b.attributes.startDate)
  8980. {
  8981. if(a.direction == uroEnums.DRTC.SEG_AB) return -1;
  8982. return 1;
  8983. }
  8984. if(a.attributes.startDate > b.attributes.startDate) return 1;
  8985. return -1;
  8986. });
  8987.  
  8988. // if we've got at least two closures in the sorted list, we then test adjacent list entries
  8989. // to see if they contain closure details which are identical except for their segment IDs, and
  8990. // combine them if so
  8991. if(RTCObjs.length > 1)
  8992. {
  8993. let i = 0;
  8994. while(i < (RTCObjs.length - 1))
  8995. {
  8996. if(
  8997. (RTCObjs[i].attributes.createdBy == RTCObjs[i+1].attributes.createdBy) &&
  8998. (RTCObjs[i].attributes.endDate == RTCObjs[i+1].attributes.endDate) &&
  8999. (RTCObjs[i].attributes.eventId == RTCObjs[i+1].attributes.eventId) &&
  9000. (RTCObjs[i].attributes.location == RTCObjs[i+1].attributes.location) &&
  9001. (RTCObjs[i].attributes.reason == RTCObjs[i+1].attributes.reason) &&
  9002. (RTCObjs[i].attributes.startDate == RTCObjs[i+1].attributes.startDate) &&
  9003. (RTCObjs[i].direction == RTCObjs[i+1].direction)
  9004. )
  9005. {
  9006. RTCObjs[i].segIDs.push(RTCObjs[i+1].attributes.segID);
  9007. RTCObjs.splice(i+1, 1);
  9008. }
  9009. else
  9010. {
  9011. ++i;
  9012. }
  9013. }
  9014. }
  9015.  
  9016. // after that first trimming of the list, if there are still two or more entries then
  9017. // we perform a second pass, this time merging any adjacent entries which have the same
  9018. // segment IDs in their segIDs arrays - these are two-way closures applying to all those
  9019. // segments, and so we also change the direction value to indicate two-way vs A-B or B-A
  9020. if(RTCObjs.length > 1)
  9021. {
  9022. let i = 0;
  9023. while(i < (RTCObjs.length - 1))
  9024. {
  9025. if
  9026. (
  9027. (RTCObjs[i].segIDs.sort().join(',') == RTCObjs[i+1].segIDs.sort().join(',')) &&
  9028. (RTCObjs[i].attributes.createdBy == RTCObjs[i+1].attributes.createdBy) &&
  9029. (RTCObjs[i].attributes.endDate == RTCObjs[i+1].attributes.endDate) &&
  9030. (RTCObjs[i].attributes.eventId == RTCObjs[i+1].attributes.eventId) &&
  9031. (RTCObjs[i].attributes.location == RTCObjs[i+1].attributes.location) &&
  9032. (RTCObjs[i].attributes.reason == RTCObjs[i+1].attributes.reason) &&
  9033. (RTCObjs[i].attributes.startDate == RTCObjs[i+1].attributes.startDate)
  9034. )
  9035. {
  9036. RTCObjs[i].direction = uroEnums.DRTC.SEG_BI;
  9037. RTCObjs.splice(i+1, 1);
  9038. }
  9039. ++i;
  9040. }
  9041. }
  9042. }
  9043.  
  9044. let RTTCObjs = [];
  9045. if(segID !== null)
  9046. {
  9047. // If we've been called from the segment popup handler, we now also check for any turn closures
  9048. // associated with this segment, so that their details can also be shown in the popup...
  9049. for(let turnClosure in W.model.turnClosures.objects)
  9050. {
  9051. if(W.model.turnClosures.objects.hasOwnProperty(turnClosure))
  9052. {
  9053. let tcObj = W.model.turnClosures.objects[turnClosure];
  9054. if(tcObj.attributes.fromSegID === segID)
  9055. {
  9056. tcObj.direction = uroEnums.DRTC.TURN_OUT;
  9057. RTTCObjs.push(tcObj);
  9058. }
  9059. else if(tcObj.attributes.toSegID === segID)
  9060. {
  9061. tcObj.direction = uroEnums.DRTC.TURN_IN;
  9062. RTTCObjs.push(tcObj);
  9063. }
  9064. }
  9065. }
  9066.  
  9067. if(RTTCObjs.length > 1)
  9068. {
  9069. RTTCObjs = RTTCObjs.sort(function(a,b)
  9070. {
  9071. if(a.attributes.startDate === b.attributes.startDate)
  9072. {
  9073. if(a.direction == uroEnums.DRTC.TURN_OUT) return -1;
  9074. return 1;
  9075. }
  9076. if(a.attributes.startDate > b.attributes.startDate) return 1;
  9077. return -1;
  9078. });
  9079. }
  9080. }
  9081.  
  9082. uroRTCObjs = RTCObjs.concat(RTTCObjs);
  9083. for(let i = 0; i < uroRTCObjs.length; ++i)
  9084. {
  9085. closureTypes |= uroRTCObjs[i].direction;
  9086. }
  9087.  
  9088. // the closure list ordering at this point doesn't always match up to the order used by the closures panel when
  9089. // a mixture of "all segment" and "some segment" closures are present - need to work out what ordering rules
  9090. // WME is using here...
  9091. return closureTypes;
  9092. }
  9093. function uroGetLengthString(length)
  9094. {
  9095. let retval = '';
  9096. if(length == null)
  9097. {
  9098. retval = "Default";
  9099. }
  9100. else if(W.model.isImperial == true)
  9101. {
  9102. retval = (length / (12 * 2.54)).toFixed(1) + "ft";
  9103. }
  9104. else
  9105. {
  9106. retval = (length / 100).toFixed(1) + "m";
  9107. }
  9108.  
  9109. return retval;
  9110. }
  9111. function uroGetHighlightedMapFeature()
  9112. {
  9113. let featureID = W.selectionManager.mouseInFeature;
  9114. let retval = null;
  9115.  
  9116. if(featureID !== undefined)
  9117. {
  9118. let isSelected = W.selectionManager.isSelected(featureID);
  9119. if(isSelected === false)
  9120. {
  9121. retval = W.selectionManager.getObjectByFeatureId(featureID);
  9122. }
  9123. }
  9124. return retval;
  9125. }
  9126. function uroGetFeatureRenderIntent(moObj)
  9127. {
  9128. let retval = "unknown";
  9129.  
  9130. if(moObj !== null)
  9131. {
  9132. let isSelected = moObj.selected;
  9133.  
  9134. if(isSelected === true)
  9135. {
  9136. retval = "highlightselected";
  9137. }
  9138. else
  9139. {
  9140. retval = "highlight";
  9141. }
  9142. }
  9143.  
  9144. return retval;
  9145. }
  9146. function uroExclusiveCB()
  9147. {
  9148. let cbChecked = uroUtils.GetCBChecked(this.id);
  9149.  
  9150. if(cbChecked === true)
  9151. {
  9152. let pairedList = this.attributes.pairedWith.value.split(',');
  9153. for(let i=0; i<pairedList.length; i++)
  9154. {
  9155. uroUtils.SetCBChecked(pairedList[i], false);
  9156. }
  9157. }
  9158. }
  9159. function uroContainsPoint(geo, point)
  9160. {
  9161. let retval = false;
  9162. try
  9163. {
  9164. let j = 1;
  9165. for(let i = 0; i < geo.length; ++i)
  9166. {
  9167. if
  9168. (
  9169. ((point[1] >= geo[i][1]) && (point[1] <= geo[j][1])) ||
  9170. ((point[1] >= geo[j][1]) && (point[1] <= geo[i][1]))
  9171. )
  9172. {
  9173. let lx = geo[i][0];
  9174. if(geo[i][1] != geo[j][1])
  9175. {
  9176. let g = ((point[1] - geo[i][1]) / (geo[j][1] - geo[i][1]));
  9177. lx += (g * (geo[j][0] - geo[i][0]));
  9178. }
  9179.  
  9180. if(point[0] <= lx)
  9181. {
  9182. retval = !retval;
  9183. }
  9184. }
  9185. if(++j == geo.length)
  9186. {
  9187. j = 0;
  9188. }
  9189. }
  9190. }
  9191. catch
  9192. {
  9193. }
  9194. return retval;
  9195. }
  9196. function uroGetAMs(e)
  9197. {
  9198. if(uroMTEMode) return;
  9199. if(!uroFilterPreamble) return;
  9200. if(!uroInit.initialised) return;
  9201. if(document.getElementById("uroAMList") == null) return;
  9202. if(document.getElementsByClassName('topbar') == null) return;
  9203.  
  9204. if(uroUtils.GetCBChecked("_cbMoveAMList") === false)
  9205. {
  9206. document.getElementsByClassName('area-managers-region')[0].style.display = "block";
  9207. uroAMList.innerHTML = uroUtils.ModifyHTML("");
  9208. document.getElementsByClassName('topbar')[0].style.backgroundColor=null;
  9209. return;
  9210. }
  9211.  
  9212. document.getElementsByClassName('topbar')[0].style.backgroundColor="#000000";
  9213. document.getElementsByClassName('topbar')[0].style.height="auto";
  9214. document.getElementsByClassName('area-managers-region')[0].style.display = "none";
  9215.  
  9216. let amList = '';
  9217. let tName = '';
  9218. if(W.map.managedAreasLayer.getVisibility() === true)
  9219. {
  9220. let mouseX = e.pageX - document.getElementById('map').getBoundingClientRect().left;
  9221. let mouseY = e.pageY - document.getElementById('map').getBoundingClientRect().top;
  9222. let mousePixel = W.map.getLonLatFromPixel(new OpenLayers.Pixel(mouseX, mouseY));
  9223. let mousePoint = [];
  9224. mousePoint.push(mousePixel.lon);
  9225. mousePoint.push(mousePixel.lat);
  9226.  
  9227. let hideL1Areas = uroUtils.GetCBChecked("_cbHideAMA-L1");
  9228. let hideL2Areas = uroUtils.GetCBChecked("_cbHideAMA-L2");
  9229. let hideL3Areas = uroUtils.GetCBChecked("_cbHideAMA-L3");
  9230. let hideL4Areas = uroUtils.GetCBChecked("_cbHideAMA-L4");
  9231. let hideL5Areas = uroUtils.GetCBChecked("_cbHideAMA-L5");
  9232. let hideL6Areas = uroUtils.GetCBChecked("_cbHideAMA-L6");
  9233. let hideL7Areas = uroUtils.GetCBChecked("_cbHideAMA-L7");
  9234.  
  9235. let hideNewAreas = uroUtils.GetCBChecked("_cbEnableAMAMinAgeFilter");
  9236. let areaMinAge = uroUtils.GetElmValue("_inputFilterAMA-MinDays");
  9237. let hideOldAreas = uroUtils.GetCBChecked("_cbEnableAMAMaxAgeFilter");
  9238. let areaMaxAge = uroUtils.GetElmValue("_inputFilterAMA-MaxDays");
  9239.  
  9240. for(let amObj in W.model.managedAreas.objects)
  9241. {
  9242. let ama = W.model.managedAreas.objects[amObj];
  9243. let userID = ama.attributes.userID;
  9244. let userLevel = uroUtils.GetUserLevelFromID(userID);
  9245.  
  9246. let hideArea = false;
  9247. hideArea = hideArea || ((hideL1Areas === true) && (userLevel === 1));
  9248. hideArea = hideArea || ((hideL2Areas === true) && (userLevel === 2));
  9249. hideArea = hideArea || ((hideL3Areas === true) && (userLevel === 3));
  9250. hideArea = hideArea || ((hideL4Areas === true) && (userLevel === 4));
  9251. hideArea = hideArea || ((hideL5Areas === true) && (userLevel === 5));
  9252. hideArea = hideArea || ((hideL6Areas === true) && (userLevel === 6));
  9253. hideArea = hideArea || ((hideL7Areas === true) && (userLevel === 7));
  9254.  
  9255. if((hideNewAreas === true) || (hideOldAreas === true))
  9256. {
  9257. let amaDaysAgo = uroUtils.DateToDays(ama.attributes.createdOn);
  9258. hideArea = hideArea || ((hideNewAreas === true) && (amaDaysAgo < areaMinAge));
  9259. hideArea = hideArea || ((hideOldAreas === true) && (amaDaysAgo > areaMaxAge));
  9260. }
  9261.  
  9262. if(hideArea === false)
  9263. {
  9264. let nc = ama.attributes.geoJSONGeometry.coordinates.length;
  9265. for(let i = 0; i < nc; ++i)
  9266. {
  9267. let geo = ama.attributes.geoJSONGeometry.coordinates[i];
  9268. if(uroContainsPoint(geo, mousePoint) === true)
  9269. {
  9270. let amName = uroUtils.GetUserNameFromID(ama.attributes.userID);
  9271. if(amList.indexOf(amName) === -1)
  9272. {
  9273. if(amList !== '') amList += ', ';
  9274. tName = uroUtils.GetUserNameAndRank(ama.attributes.userID);
  9275. if(tName.indexOf('a href') !== -1)
  9276. {
  9277. tName = tName.replace('a href', 'a style="color:#c0c0ff;" href');
  9278. }
  9279. amList += tName;
  9280. break;
  9281. }
  9282. }
  9283. }
  9284. }
  9285. }
  9286. if(amList === '')
  9287. {
  9288. amList = 'none';
  9289. }
  9290. amList = "&nbsp;-&nbsp;<b>Area Managers:</b> "+amList;
  9291. }
  9292. document.getElementById("uroAMList").innerHTML = uroUtils.ModifyHTML(amList);
  9293. }
  9294. function uroNewTabAtMouseLoc(x, y)
  9295. {
  9296. let tPix = new OpenLayers.Pixel(x,y);
  9297. let mPos = uroUtils.ConvertMercatorToWGS84(W.map.getLonLatFromPixel(tPix));
  9298. let nZoom = W.map.getZoom();
  9299. if(nZoom < 17) nZoom = 17;
  9300. let nHref = window.location.origin + window.location.pathname;
  9301. nHref += '?lon=' + mPos.lon;
  9302. nHref += '&lat=' + mPos.lat;
  9303. nHref += '&zoomLevel=' + nZoom;
  9304. window.open(nHref);
  9305. }
  9306. function uroMouseDown(e)
  9307. {
  9308. uroMouseIsDown = true;
  9309. if((e.altKey === true) && (e.ctrlKey === true))
  9310. {
  9311. uroNewTabAtMouseLoc(e.offsetX, e.offsetY);
  9312. }
  9313. }
  9314. function uroMouseUp()
  9315. {
  9316. uroMouseIsDown = false;
  9317. }
  9318. function uroTestPointerOutsideMap(mX, mY)
  9319. {
  9320. let mapElm = document.getElementById("map");
  9321. if(mapElm === undefined) return;
  9322. let mapBCR = mapElm.getBoundingClientRect();
  9323.  
  9324. if
  9325. (
  9326. (mX < mapBCR.left) ||
  9327. (mX > mapBCR.right) ||
  9328. (mY < mapBCR.top) ||
  9329. (mY > mapBCR.bottom)
  9330. )
  9331. {
  9332. if(uroUtils.GetCBChecked('_cbKillInertialPanning') === true)
  9333. {
  9334. let controller = null;
  9335. if (W.map.navigationControl)
  9336. {
  9337. controller = W.map.navigationControl;
  9338. }
  9339. else if(W.map.controls.find(control => control.CLASS_NAME == 'OpenLayers.Control.Navigation'))
  9340. {
  9341. controller = W.map.controls.find(control => control.CLASS_NAME == 'OpenLayers.Control.Navigation');
  9342. }
  9343. if (controller !== null)
  9344. {
  9345. controller.dragPan.panMapStart();
  9346. }
  9347. }
  9348. return true;
  9349. }
  9350. else
  9351. {
  9352. return false;
  9353. }
  9354. }
  9355. function uroMouseOut(e)
  9356. {
  9357. if(uroTestPointerOutsideMap(e.clientX, e.clientY))
  9358. {
  9359. uroPopup.Hide();
  9360. }
  9361. }
  9362. function uroUREvent_onObjectsAdded()
  9363. {
  9364. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === true)
  9365. {
  9366. uroUpdateEditorList(W.model.mapUpdateRequests.objects, '_selectURResolverID', false, false, true, false);
  9367. }
  9368. if(uroPopulatingRequestSessions === false)
  9369. {
  9370. uroFilterURs();
  9371. }
  9372. }
  9373. function uroGetSelectedURCommentCount()
  9374. {
  9375. if(W.model.updateRequestSessions.objects[uroSelectedURID] != null)
  9376. {
  9377. let cachedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  9378. uroDBG.AddLog(uroSelectedURID+':'+cachedCommentCount+' '+uroExpectedCommentCount);
  9379.  
  9380. // if there aren't the same number of cached comments as there are comments in the UR dialog list, initiate
  9381. // a refresh of the comment data...
  9382. if(cachedCommentCount != uroExpectedCommentCount)
  9383. {
  9384. if(uroPendingCommentDataRefresh === true)
  9385. {
  9386. if(cachedCommentCount > 0)
  9387. {
  9388. uroCachedLastCommentID = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments[cachedCommentCount-1].id;
  9389. }
  9390. else
  9391. {
  9392. uroCachedLastCommentID = null;
  9393. }
  9394. uroDBG.AddLog('updateRequestSessions refresh required for UR '+uroSelectedURID);
  9395. if(uroCachedLastCommentID !== null)
  9396. {
  9397. uroDBG.AddLog('last comment ID for this UR is '+uroCachedLastCommentID);
  9398. }
  9399. else
  9400. {
  9401. uroDBG.AddLog('first comment for this UR, no previous comment to ID');
  9402. }
  9403. let idList = [];
  9404. idList.push(uroSelectedURID);
  9405. // need to delete the existing cache object first, as .get() is only capable of creating new objects,
  9406. // it doesn't seem able to update an existing object with new data
  9407. W.model.updateRequestSessions.remove(W.model.updateRequestSessions.objects[uroSelectedURID]);
  9408. W.model.updateRequestSessions.getAsync(idList);
  9409.  
  9410. // the call to .get() initiates a XMLHttpRequest for the data, so we now need to switch modes - the
  9411. // refresh process has started so we're no longer pending, but we are now waiting for the XMLHttpRequest
  9412. // to return something...
  9413. uroPendingCommentDataRefresh = false;
  9414. uroWaitingCommentDataRefresh = true;
  9415. }
  9416. else
  9417. {
  9418. if(cachedCommentCount > 0)
  9419. {
  9420. let currentLastCommentID = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments[cachedCommentCount-1].id;
  9421. if(currentLastCommentID == uroCachedLastCommentID)
  9422. {
  9423. // most recent comment loaded for this UR is the same one that was present at the start of this
  9424. // refresh process, so kick back into pending mode so we can retry the .get()...
  9425. uroDBG.AddLog('latest comment ID still the same, reverting to pending mode...');
  9426. uroPendingCommentDataRefresh = true;
  9427. }
  9428. else
  9429. {
  9430. // something may have gone awry here - the most recent comment loaded for this UR doesn't have the
  9431. // same ID as the one present at the start of the refresh process, yet the comment counts still don't
  9432. // match up, which suggests either a comment got lost along the way or someone else has commented on
  9433. // the same UR at almost the same time. To get out of the loop this would create, assume that a
  9434. // mismatch in the IDs means the .get() has completed successfully no matter what the new comment
  9435. // count is, and take this new count to be the count we were expecting all along...
  9436. uroDBG.AddLog('latest comment ID different, but expected count not correct...');
  9437. uroExpectedCommentCount = cachedCommentCount;
  9438. }
  9439. }
  9440. else
  9441. {
  9442. uroDBG.AddLog('first comment on this UR not received yet, reverting to pending mode...');
  9443. uroPendingCommentDataRefresh = true;
  9444. }
  9445. }
  9446.  
  9447. }
  9448. else
  9449. {
  9450. // if the WME session is loaded with a UR already selected, such that WME has opened the UR dialog as part
  9451. // of the session startup process, adding new comments to the UR cause the cached data to be updated immediately.
  9452. // This prevents URO+ from switching into waiting mode in the above block of code, so we have to instead do
  9453. // it here by comparing the cached count against the expected count following the Send click event.
  9454. if(cachedCommentCount >= uroExpectedCommentCount)
  9455. {
  9456. uroPendingCommentDataRefresh = false;
  9457. uroWaitingCommentDataRefresh = true;
  9458. uroExpectedCommentCount = null;
  9459. }
  9460.  
  9461. // once the cached data has been updated, refilter the URs so that the new comment count is taken into account
  9462. // immediately for filtering and display purposes
  9463. if(uroWaitingCommentDataRefresh === true)
  9464. {
  9465. uroWaitingCommentDataRefresh = false;
  9466. uroFilterURs();
  9467. uroDBG.AddLog('refresh complete');
  9468. }
  9469. }
  9470. }
  9471. }
  9472. function uroAddedComment()
  9473. {
  9474. // when the user clicks the Send button to submit a new UR comment, this event handler fires before the new comment is
  9475. // posted to the server and thus also before the comment list gets updated in the UR dialog. So we take the current
  9476. // comment count and, if the new comment edit box isn't empty, increment it by 1 to get the expected count. Then we
  9477. // set the pending flag true to initiate a session refresh on the next 100ms tick
  9478. uroExpectedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  9479. if(document.getElementsByClassName('new-comment-text')[0].value !== '')
  9480. {
  9481. uroExpectedCommentCount++;
  9482. uroDBG.AddLog('new comment added to UR '+uroSelectedURID+', cache refresh required...');
  9483. uroPendingCommentDataRefresh = true;
  9484. }
  9485. else
  9486. {
  9487. uroPendingCommentDataRefresh = false;
  9488. }
  9489. }
  9490. function uroInhibitNextUpdateRequestButton(e)
  9491. {
  9492. e.stopPropagation();
  9493.  
  9494. let doClick = true;
  9495. if(document.getElementsByClassName('form-control new-comment-text').length > 0)
  9496. {
  9497. if(document.getElementsByClassName('form-control new-comment-text')[0].textLength > 0)
  9498. {
  9499. uroAlertBox.Show("fa-warning", "URO+ Warning", "Comment not sent, close report panel anyway?", true, "Yes", "No", uroCloseReportPanel, null);
  9500. // set doClick to false here, as uroCloseReportPanel will be called by the alert box handler if required...
  9501. doClick = false;
  9502. }
  9503. }
  9504. // no alert box has been generated, so close the panel
  9505. if(doClick)
  9506. {
  9507. uroCloseReportPanel();
  9508. }
  9509. }
  9510. function uroCloseReportPanel()
  9511. {
  9512. document.getElementsByClassName('close-panel')[0].click();
  9513. }
  9514. function uroIncrementClosureDate(oldDate, incByDays)
  9515. {
  9516. // Thanks to WME no longer using consistent ISO8601 date formatting when displaying
  9517. // closure details, parsing the date string is now somewhat more involved. Thanks devs...
  9518.  
  9519. // Default to returning the existing date, just in case we can't increment it
  9520. let retval = oldDate;
  9521. let sepChar = null;
  9522.  
  9523. // Search through oldDate for a non-digit character, so we know what's
  9524. // being used to seperate the year, month and date values by this locale...
  9525. for(let i = 0; i < oldDate.length; ++i)
  9526. {
  9527. if((oldDate[i] < '0') || (oldDate[i] > '9'))
  9528. {
  9529. sepChar = oldDate[i];
  9530. break;
  9531. }
  9532. }
  9533.  
  9534. if(sepChar != null)
  9535. {
  9536. // First build a "probe" date object we can use to determine what the user's WME locale
  9537. // does with dates.
  9538. let incDate = new Date();
  9539. incDate.setFullYear(3000);
  9540. incDate.setMonth(10);
  9541. incDate.setDate(22);
  9542.  
  9543. // With these three carefully chosen date elements set, we now generate a localised datestring
  9544. // using the WME locale setting - the first character of which then tells us the date
  9545. // format - 1 = MDY (ack ptui), 2 = DMY (good), 3 = YMD (sweet!)
  9546. let localeDate = incDate.toLocaleDateString(I18n.locale);
  9547. let dateFormat = localeDate[0];
  9548.  
  9549. // Now we know the seperator character and the date format, so we can finally start to parse
  9550. // the existing date string...
  9551. let oldDateBits = oldDate.split(sepChar);
  9552. let datePos;
  9553. let monthPos;
  9554. let yearPos;
  9555. if(dateFormat == '1')
  9556. {
  9557. datePos = 1;
  9558. monthPos = 0;
  9559. yearPos = 2;
  9560. }
  9561. else if(dateFormat == '2')
  9562. {
  9563. datePos = 0;
  9564. monthPos = 1;
  9565. yearPos = 2;
  9566. }
  9567. else
  9568. {
  9569. datePos = 2;
  9570. monthPos = 1;
  9571. yearPos = 0;
  9572. }
  9573. incDate.setFullYear(parseInt(oldDateBits[yearPos]));
  9574. incDate.setMonth(parseInt(oldDateBits[monthPos]) - 1);
  9575. incDate.setDate(parseInt(oldDateBits[datePos]));
  9576. let tDate = new Date(incDate.getTime());
  9577. incDate.setDate(tDate.getDate() + incByDays);
  9578.  
  9579. retval = incDate.toLocaleDateString(I18n.locale);
  9580.  
  9581. // Except for those pesky locales where toLocaleDateString() doesn't *quite*
  9582. // return what WME is expecting. Because, you know, why make it easy for
  9583. // scripters when you can chuck in a few subtle curveballs like this, eh...
  9584.  
  9585. if(I18n.locale == 'bg')
  9586. {
  9587. // Remove the "r." suffix
  9588. retval = retval.split(" ")[0] + " ";
  9589. }
  9590. }
  9591. return retval;
  9592. }
  9593. function uroGetElementProperty(elmName, elmOffset, elmProperty)
  9594. {
  9595. let retval = null;
  9596. if(document.getElementsByName(elmName).length > elmOffset)
  9597. {
  9598. retval = document.getElementsByName(elmName)[elmOffset][elmProperty];
  9599. }
  9600. else if(document.getElementById(elmName) !== null)
  9601. {
  9602. retval = document.getElementById(elmName)[elmProperty];
  9603. }
  9604. return retval;
  9605. }
  9606. function uroGetShadowElementProperty(elmName, shadowElmType, property)
  9607. {
  9608. let retval = null;
  9609. let tObj = document.getElementById(elmName);
  9610. if(tObj !== null)
  9611. {
  9612. let sObj = tObj.shadowRoot.querySelector(shadowElmType);
  9613. if(sObj !== null)
  9614. {
  9615. retval = sObj[property];
  9616. }
  9617. }
  9618. return retval;
  9619. }
  9620. let rtcTotal = null;
  9621. let rtcSegIDs = null;
  9622. function uroScrollToEndOfClosures()
  9623. {
  9624. let cItems = document.querySelectorAll('.closure-item');
  9625. let nClosures = cItems.length;
  9626. let segIDs = uroUtils.GetSelectedSegmentIDs();
  9627. let sameSegs = false;
  9628. if((segIDs !== null) && (rtcSegIDs !== null))
  9629. {
  9630. if(segIDs.length == rtcSegIDs.length)
  9631. {
  9632. sameSegs = true;
  9633. for(let i = 0; i < segIDs.length; ++i)
  9634. {
  9635. if(segIDs[i] != rtcSegIDs[i])
  9636. {
  9637. sameSegs = false;
  9638. break;
  9639. }
  9640. }
  9641. }
  9642. }
  9643. if(sameSegs === false)
  9644. {
  9645. rtcTotal = null;
  9646. rtcSegIDs = segIDs;
  9647. }
  9648. if(nClosures > rtcTotal)
  9649. {
  9650. if(cItems[0].getBoundingClientRect().height != 0)
  9651. {
  9652. rtcTotal = nClosures;
  9653. if(uroUtils.GetCBChecked('_cbAutoScrollClosureList') == true)
  9654. {
  9655. // Scroll to the end of the closure tab, as that's where the closure you're most likely to be cloning
  9656. // is located...
  9657. cItems[cItems.length - 1].scrollIntoView();
  9658. }
  9659. }
  9660. }
  9661. }
  9662. function uroClosureEditUIChanged()
  9663. {
  9664. if(document.getElementsByClassName('edit-closure').length === 1)
  9665. {
  9666. // note: this also fires when the UI is closed, due to the change events triggered as its elements are removed
  9667. // prior to the tab itself closing...
  9668.  
  9669. let notReady = 0;
  9670. let mteDropDown = document.getElementById('closure_eventId');
  9671. if(document.getElementById('closure_reason').shadowRoot.querySelector('input') === null) notReady += 1;
  9672. if(document.getElementById('closure_direction').shadowRoot.querySelector('.selected-value') === null) notReady += 2;
  9673. else if(document.getElementById('closure_direction').shadowRoot.querySelector('.selected-value').innerText === "") notReady += 4;
  9674. if(document.getElementById('closure_startDate') === null) notReady += 8;
  9675. if(document.getElementById('closure_endDate') === null) notReady += 16;
  9676. if(mteDropDown.shadowRoot.querySelector('.selected-value') === null) notReady += 32;
  9677. else if(mteDropDown.shadowRoot.querySelector('.selected-value').innerText === "") notReady += 64;
  9678. if(document.getElementById('closure_permanent').shadowRoot.querySelector('.wz-checkbox') === null) notReady += 128;
  9679. if(notReady === 0)
  9680. {
  9681. if(uroRTCClone.PendingClone === -3)
  9682. {
  9683. uroRTCClone.Complete();
  9684. }
  9685. else if(uroRTCClone.PendingClone !== -1)
  9686. {
  9687. uroRTCClone.Copy();
  9688. }
  9689. else
  9690. {
  9691. uroFixMTEDropDown(mteDropDown);
  9692. }
  9693. }
  9694. }
  9695. else
  9696. {
  9697. if(uroRTCClone.PendingClone === -2)
  9698. {
  9699. // generate a click event on the Add a closure button to open up the closure editing UI, then
  9700. // wait for the UI to finish opening...
  9701. document.getElementsByClassName('add-closure-button')[0].click();
  9702. uroRTCClone.PendingClone = -3;
  9703. }
  9704. uroClosureListHandler();
  9705. }
  9706. }
  9707. function uroTSTPopupHandler()
  9708. {
  9709. if(document.getElementsByClassName('panel')[0] === undefined)
  9710. {
  9711. uroHidePopupOnPanelOpen = true;
  9712. }
  9713.  
  9714. if(uroPopup.shown === true)
  9715. {
  9716. let hidePopup = false;
  9717.  
  9718. if(document.getElementsByClassName('panel')[0] != null)
  9719. {
  9720. if(uroHidePopupOnPanelOpen === true)
  9721. {
  9722. hidePopup = true;
  9723. uroHidePopupOnPanelOpen = false;
  9724. }
  9725. }
  9726.  
  9727. if(hidePopup === true)
  9728. {
  9729. uroPopup.Hide();
  9730. }
  9731. }
  9732.  
  9733. if((uroAFN.hoverObj !== null) && (uroAFN.hoverTime != -1) && (uroAFN.overlayShown === false))
  9734. {
  9735. if(++uroAFN.hoverTime > 5)
  9736. {
  9737. uroAFN.OverlaySetup();
  9738. }
  9739. }
  9740. uroAFN.ReplaceAreaNames(false);
  9741.  
  9742. if(uroPopup.autoHideTimer > 0)
  9743. {
  9744. if(--uroPopup.autoHideTimer === 0)
  9745. {
  9746. uroPopup.Hide();
  9747. }
  9748. }
  9749.  
  9750. if(uroPopup.timer > 0)
  9751. {
  9752. if(uroPopup.mouseIn === false)
  9753. {
  9754. uroPopup.timer--;
  9755. }
  9756. }
  9757. if(uroPopup.timer === 0)
  9758. {
  9759. uroPopup.Hide();
  9760. }
  9761. }
  9762. function uroTSTNextBtnHandler()
  9763. {
  9764. // replaces the "next xxx" button on UR, MP and PUR editing UIs
  9765.  
  9766. // Correctly determining what WME is displaying for the "next" button in the UR/MP/(P)PUR panel is not trivial due to
  9767. // inconsistencies in the panel behaviour depending on whether it was opened by clicking directly on the relevant
  9768. // marker, or by clicking on the associated feed entry... For PURs, there's also the added complication of multi-part
  9769. // update requests, where the same marker/panel are used to access more than one request and where, therefore, we need
  9770. // to enable access to all requests contained within the PUR, but still inhibit the "next" button once the last
  9771. // request in the multi-part sequence has been viewed.
  9772. //
  9773. // For directly-accesed markers, the "next" button caption is:
  9774. //
  9775. // URs = "Next update request" (update_requests.panel.next)
  9776. // MPs = "Next map problem" (problems.panel.next)
  9777. // PURs = "Next place" for single-part PURs or for the last part of a multi-part PUR (venues.update_requests.panel.next_venue)
  9778. // = "Next" for all but the last part of a multi-part PUR (venues.update_requests.panel.next)
  9779. // PPURs = "Next place" (venues.update_requests.panel.next_venue)
  9780. //
  9781. // For markers accessed via the feed, the "next" button caption always appears to be "Next issue" (feed.issues.next)
  9782.  
  9783.  
  9784.  
  9785. let reportPanel = document.querySelector('#panel-container');
  9786.  
  9787. if(reportPanel.childElementCount > 0)
  9788. {
  9789. let nurButton = reportPanel.getElementsByClassName('next')[0];
  9790. if(nurButton === undefined)
  9791. {
  9792. nurButton = reportPanel.getElementsByClassName('next-venue')[0];
  9793. }
  9794. if(nurButton !== undefined)
  9795. {
  9796. let doneString = I18n.lookup('problems.panel.done');
  9797. let btnCaptionIsNextPlace = (nurButton.innerHTML.indexOf(I18n.lookup('venues.update_requests.panel.next_venue')) !== -1);
  9798. let btnCaptionIsDefaultUR = (nurButton.innerHTML.indexOf(I18n.lookup('update_requests.panel.next')) !== -1);
  9799. let btnCaptionIsDefaultMP = (nurButton.innerHTML.indexOf(I18n.lookup('problems.panel.next')) !== -1);
  9800. let btnCaptionIsNextIssue = (nurButton.innerHTML.indexOf(I18n.lookup('feed.issues.next')) !== -1);
  9801.  
  9802. let updateButton = false;
  9803.  
  9804. let panelClass = reportPanel.childNodes[0].childNodes[0].className;
  9805. let isURorMPPanel = (panelClass.indexOf('problem-edit') !== -1);
  9806. let isPURPanel = (panelClass.indexOf('place-update') !== -1);
  9807.  
  9808. if(isURorMPPanel === true)
  9809. {
  9810. // user has enabled UR button mod?
  9811. if(uroUtils.GetCBChecked('_cbInhibitNURButton') === true)
  9812. {
  9813. // the native UR panel button will always either be "Next update request" or "Next issue"
  9814. updateButton = ((btnCaptionIsDefaultUR) || (btnCaptionIsNextIssue));
  9815. }
  9816.  
  9817. // user has enabled MP button mod?
  9818. if(uroUtils.GetCBChecked('_cbInhibitNMPButton') === true)
  9819. {
  9820. // there's no way to determine if the edit panel has been opened for a UR or a MP, however as MPs
  9821. // don't currently appear in the feed, the native button only uses "Next map problem" as its caption
  9822. updateButton = (updateButton || btnCaptionIsDefaultMP);
  9823. }
  9824. }
  9825. else if(isPURPanel === true)
  9826. {
  9827. if(uroUtils.GetCBChecked('_cbInhibitNPURButton') === true)
  9828. {
  9829. // for a (P)PUR, only modify the button if it's showing the "Next place" or "Next issue" caption, to
  9830. // avoid messing up the "Next" button used to move to the next part of a multi-part PUR...
  9831. updateButton = ((btnCaptionIsNextPlace === true) || (btnCaptionIsNextIssue));
  9832. }
  9833. }
  9834.  
  9835. if(updateButton === true)
  9836. {
  9837. uroDBG.AddLog('inhibit Next UR/MP/PUR button');
  9838.  
  9839. // alter the button caption
  9840. nurButton.innerHTML = uroUtils.ModifyHTML(doneString);
  9841. // Add a new click handler to override the native one - this acts both to prevent the normal action of the "Next UR/MP/PUR" button in
  9842. // moving to the next UR/MP/PUR, and also allows us to warn about closing the UR panel if there's an unsent comment...
  9843. nurButton.addEventListener("click", uroInhibitNextUpdateRequestButton, false);
  9844. }
  9845. }
  9846. uroInhibitURFiltering = false;
  9847. }
  9848. }
  9849. function uroTSTCommentAddedHandler()
  9850. {
  9851. // test for the opening or closing of the UR editing dialog so we can detect when a new comment is added
  9852. let URDialogIsOpen = false;
  9853. let panelOpen = (document.getElementById('panel-container').firstChild !== null);
  9854.  
  9855. if(panelOpen)
  9856. {
  9857. URDialogIsOpen = (document.getElementById('panel-container').getElementsByClassName('conversation').length > 0);
  9858. }
  9859.  
  9860. if(URDialogIsOpen)
  9861. {
  9862. let thisSelectedURID = document.getElementsByClassName('permalink')[0].href.split('&mapUpdateRequest=');
  9863. if(thisSelectedURID.length > 1)
  9864. {
  9865. thisSelectedURID = thisSelectedURID[1].split('&')[0];
  9866. }
  9867. else
  9868. {
  9869. thisSelectedURID = null;
  9870. }
  9871.  
  9872. if((thisSelectedURID != uroSelectedURID) || ((thisSelectedURID != uroMarkers.clickedOnID) && (uroMarkers.clickedOnID != null)))
  9873. {
  9874. // if the user selects a new UR whilst the editing dialog is still open, treat it in the
  9875. // same way as if the user had selected that UR with the dialog closed
  9876. uroURDialogIsOpen = false;
  9877. uroSelectedURID = null;
  9878. }
  9879.  
  9880. if(((uroURDialogIsOpen === false) && (uroSelectedURID === null)) || (uroURReclickAttempts > 0))
  9881. {
  9882. // user is editing a new UR
  9883.  
  9884. // add our own click event handler to the Send button, so we can do stuff whenever a new comment is added
  9885. if(document.getElementsByClassName('new-comment-form').length > 0)
  9886. {
  9887. if(document.getElementsByClassName('new-comment-form')[0].getElementsByClassName('send-button').length > 0)
  9888. {
  9889. document.getElementsByClassName('new-comment-form')[0].getElementsByClassName('send-button')[0].addEventListener("click", uroAddedComment, false);
  9890.  
  9891. uroSelectedURID = thisSelectedURID;
  9892. uroDBG.AddLog('user is editing UR '+uroSelectedURID);
  9893. uroExpectedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  9894.  
  9895. if((uroHoveredURID !== null) && (uroSelectedURID !== null) && (parseInt(uroHoveredURID) !== parseInt(uroSelectedURID)))
  9896. {
  9897. if(uroURReclickAttempts === 0)
  9898. {
  9899. uroDBG.AddLog('DANGER, WILL ROBINSON! You clicked on UR ID '+uroHoveredURID+' but WME has loaded the details for UR ID '+uroSelectedURID+' instead, attempting to fix...');
  9900. }
  9901. if(++uroURReclickAttempts < 3)
  9902. {
  9903. //uroRestackMarkers();
  9904. let urMarker = uroGetMarker(uroLayers.ID.UR,uroHoveredURID);
  9905. if(urMarker !== null)
  9906. {
  9907. let urMarkerAttributes = uroGetAttributes(uroLayers.ID.UR, uroHoveredURID);
  9908. if(urMarkerAttributes !== null)
  9909. {
  9910. urMarkerAttributes.geometry.x = urMarkerAttributes.geometry.realX;
  9911. urMarkerAttributes.geometry.y = urMarkerAttributes.geometry.realY;
  9912. uroOpenURDialog(uroHoveredURID);
  9913. }
  9914. }
  9915. return;
  9916. }
  9917. else
  9918. {
  9919. uroDBG.AddLog('Woe is me, attempting to open UR ID '+uroHoveredURID+' has failed...');
  9920. uroAlertBox.Show('fa-warning', 'URO+ Warning', 'WME may have opened the details panel for a different UR to the one you selected, proceed with caution', false, "OK", "", null, null);
  9921. }
  9922. }
  9923. uroURReclickAttempts = 0;
  9924. uroFilterURs();
  9925. }
  9926. }
  9927. }
  9928. }
  9929. else if(uroURDialogIsOpen === true)
  9930. {
  9931. // dialog was open and has now been closed
  9932. uroSelectedURID = null;
  9933. uroMarkers.clickedOnID = null;
  9934. uroFilterURs();
  9935. }
  9936. uroURDialogIsOpen = URDialogIsOpen;
  9937.  
  9938. if(((uroPendingCommentDataRefresh === true) || (uroWaitingCommentDataRefresh === true)) && (uroSelectedURID !== null))
  9939. {
  9940. uroDBG.AddLog('check completion of comment data refresh for UR '+uroSelectedURID+' ('+uroPendingCommentDataRefresh+','+uroWaitingCommentDataRefresh+')');
  9941. uroGetSelectedURCommentCount();
  9942. }
  9943.  
  9944. }
  9945. function uroClosureListHandler()
  9946. {
  9947. // Handles adjustments to the closure list in the sidepanel...
  9948. //
  9949. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  9950. {
  9951. return;
  9952. }
  9953.  
  9954. // List entry filtering
  9955. let nEntries = document.querySelectorAll('.closure-item').length;
  9956. if(nEntries > 0)
  9957. {
  9958. let filterExpired = uroUtils.GetCBChecked('_cbHideExpiredSidepanelRTCs');
  9959. let filterCurrent = uroUtils.GetCBChecked('_cbHideSidepanelRTCs');
  9960. let filterFuture = uroUtils.GetCBChecked('_cbHideFutureSidepanelRTCs');
  9961. let filterUnknown = uroUtils.GetCBChecked('_cbHideUnknownSidepanelRTCs');
  9962. for(let i = 0; i < nEntries; ++i)
  9963. {
  9964. let hide = false;
  9965. let cElm = document.querySelectorAll('.closure-item')[i];
  9966. let ciSrc = cElm.querySelector('wz-image-chip')?.imageSrc;
  9967. if(ciSrc != undefined)
  9968. {
  9969. hide ||= ((ciSrc.indexOf('finished') != -1) && (filterExpired == true));
  9970. hide ||= ((ciSrc.indexOf('active') != -1) && (filterCurrent == true));
  9971. hide ||= ((ciSrc.indexOf('not-started') != -1) && (filterFuture == true));
  9972. hide ||= ((ciSrc === "") && (filterUnknown == true));
  9973. }
  9974.  
  9975. if(hide == true)
  9976. {
  9977. cElm.parentElement.style.display = "none";
  9978. }
  9979. else
  9980. {
  9981. cElm.parentElement.style.display = "block";
  9982. }
  9983. }
  9984. }
  9985.  
  9986. //// Temporarily disabled cloning...
  9987. return;
  9988.  
  9989. // Closure cloning controls
  9990. if((document.querySelectorAll('.closures-list').length > 0) && (document.querySelector('.closures-list').getAttribute('touchedbyuro') === null))
  9991. {
  9992. let nClosures;
  9993. let cLoop;
  9994. let btnElm;
  9995.  
  9996. // Cloning doesn't work with certain locales due to the way the date strings are formatted...
  9997. if
  9998. (
  9999. (I18n.locale == "fa-IR") ||
  10000. (I18n.locale == 'ar') ||
  10001. (I18n.locale == 'zh') ||
  10002. (I18n.locale == 'ko')
  10003. )
  10004. {
  10005. // Sorry :-(
  10006. }
  10007. else
  10008. {
  10009. // for the others, are there any closures defined for all of the selected segment(s)...
  10010. if(document.getElementsByClassName('full-closures').length > 0)
  10011. {
  10012. nClosures = document.getElementsByClassName('full-closures')[0].querySelectorAll('.closure-item.is-editable').length;
  10013. if(nClosures > 0)
  10014. {
  10015. // Force a refresh of uroRTCObjs for the selected segment, as this is no longer guaranteed to have already occurred...
  10016. let selectedSegIDs = uroUtils.GetSelectedSegmentIDs();
  10017. if(selectedSegIDs.length > 0)
  10018. {
  10019. uroGetSelectedSegmentRTCs(selectedSegIDs[0]);
  10020.  
  10021. // and if so, have we already added the clone icon?
  10022. for(cLoop = 0; cLoop < nClosures; cLoop++)
  10023. {
  10024. btnElm = document.getElementsByClassName('full-closures')[0].querySelectorAll('.closure-item.is-editable')[cLoop].getElementsByClassName('closure-title')[0];
  10025. if((btnElm.innerHTML.indexOf('_uroCloneClosure-') == -1) && (uroGetRTCOrigin(uroRTCObjs[cLoop]) !== uroEnums.TRTC.UNKNOWN))
  10026. {
  10027. let newNode = document.createElement("div");
  10028. let anchorID1 = '_uroCloneClosure-1-'+cLoop;
  10029. let anchorID2 = '_uroCloneClosure-7-'+cLoop;
  10030. let newAnchor = '<a id="'+anchorID1+'" href="#">';
  10031. newAnchor += "<i style='font-size: 150%; cursor: copy' class='fa fa-copy'></i>";
  10032. newAnchor += "</a><sup>+1</sup>&nbsp;";
  10033. newAnchor += '<a id="'+anchorID2+'" href="#">';
  10034. newAnchor += "<i style='font-size: 150%; cursor: copy' class='fa fa-copy'></i>";
  10035. newAnchor += "</a><sup>+7</sup>";
  10036. newNode.innerHTML = uroUtils.ModifyHTML(newAnchor);
  10037. btnElm.prepend(newNode);
  10038. uroUtils.AddEventListener(anchorID1,"click",uroRTCClone.Clone,false);
  10039. uroUtils.AddEventListener(anchorID2,"click",uroRTCClone.Clone,false);
  10040.  
  10041. let chipElm = btnElm.querySelector("wz-image-chip");
  10042. chipElm.innerHTML = chipElm.innerHTML.split('>')[0] + '>';
  10043. }
  10044. }
  10045. }
  10046. }
  10047. }
  10048. }
  10049.  
  10050. // if there's more than one closure (full or partial) listed, also add the delete all button if not already present
  10051. nClosures = document.querySelectorAll('.closure-item.is-editable').length;
  10052. if(nClosures > 0)
  10053. {
  10054. if(document.getElementById('_btnDeleteAllClosures') === null)
  10055. {
  10056. let daDiv = document.createElement('wz-button');
  10057. daDiv.className = 'delete-all-button btn is-expanded'; //btn-primary';
  10058. daDiv.id = '_btnDeleteAllClosures';
  10059.  
  10060. let tHTML = '<i class="fa fa-trash"></i> '+I18n.lookup("closures.delete_confirm_no_reason");
  10061. if(nClosures > 1)
  10062. {
  10063. tHTML += ' ('+I18n.lookup("closures.apply_to_all")+')';
  10064. }
  10065. daDiv.innerHTML = uroUtils.ModifyHTML(tHTML);
  10066. daDiv.style.width = '100%';
  10067. daDiv.style.marginBottom = '10px';
  10068.  
  10069. let acBtn = document.getElementsByClassName('add-closure-button')[0];
  10070. if(acBtn !== undefined)
  10071. {
  10072. acBtn.parentNode.insertBefore(daDiv, acBtn.nextSibling);
  10073. uroUtils.AddEventListener('_btnDeleteAllClosures',"click", uroRTCClone.DeleteAll, false);
  10074. }
  10075. }
  10076. }
  10077.  
  10078. document.querySelector('.closures-list').setAttribute('touchedbyuro','true');
  10079. }
  10080. }
  10081. function uroMiscUITweaksHandler()
  10082. {
  10083. if(uroFilterPreamble())
  10084. {
  10085. // clickifies the ExtraInfo URL present in some MPs
  10086. {
  10087. if(document.getElementById('panel-container').getElementsByClassName('extraInfo').length > 0)
  10088. {
  10089. if(document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].touchedByURO === undefined)
  10090. {
  10091. let tDesc = document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].innerHTML;
  10092. tDesc = uroUtils.Clickify(tDesc, '');
  10093. document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].innerHTML = uroUtils.ModifyHTML(tDesc);
  10094. document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].touchedByURO = true;
  10095. }
  10096. }
  10097. }
  10098. }
  10099. }
  10100. function uroMainTick()
  10101. {
  10102. if(uroMTEMode) return;
  10103. if(uroInit.setupListeners)
  10104. {
  10105. if(uroInit.finalisingListenerSetup === false)
  10106. {
  10107. if(W.loginManager.isLoggedIn())
  10108. {
  10109. if(document.getElementsByClassName('topbar').length === 0) return;
  10110. uroInit.FinalizeListenerSetup();
  10111. document.getElementsByClassName('topbar')[0].appendChild(uroAMList);
  10112. }
  10113. }
  10114. }
  10115. else
  10116. {
  10117. if(uroUtils.GetCBChecked('_cbMasterEnable') === true)
  10118. {
  10119. // do one maintick handler call in each 10ms cycle to minimise the time stuck within the maintick handler without
  10120. // unduly affecting the overall response time for each individual handler
  10121.  
  10122. if(uroMainTickStage === 0) uroTSTPopupHandler();
  10123. if(uroMainTickStage == 1) uroTSTNextBtnHandler();
  10124. if(uroMainTickStage == 2) uroTSTCommentAddedHandler();
  10125. if(uroMainTickStage == 4) uroMiscUITweaksHandler();
  10126.  
  10127. if(++uroMainTickStage == 6) uroMainTickStage = 0;
  10128. }
  10129. }
  10130. }
  10131. function uroNewLookCheckDetailsRequest()
  10132. {
  10133. let thisurl = document.location.href;
  10134. let doRetry = true;
  10135. let urID;
  10136. let endmarkerpos = thisurl.indexOf('&endshow');
  10137. let showmarkerpos = thisurl.indexOf('&showturn=');
  10138.  
  10139. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10140. {
  10141. showmarkerpos += 10;
  10142. uroDBG.AddLog('showturn tab opened');
  10143. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10144. uroDBG.AddLog(' turn problem ID = '+urID);
  10145.  
  10146. try
  10147. {
  10148. uroGetMarker(uroLayers.ID.MP,urID).click();
  10149. doRetry = false;
  10150. }
  10151. catch(err)
  10152. {
  10153. uroDBG.AddLog('problems not fully loaded, retrying...');
  10154. }
  10155.  
  10156. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10157. }
  10158. }
  10159. function uroUpdateVenueEditorLists()
  10160. {
  10161. if(Object.keys(W.model.venues.objects).length === 0) return;
  10162.  
  10163. // build the list of all userIDs contained in the currently loaded venue objects
  10164. let selectedIdx = null;
  10165. let listedIDs = [];
  10166. let idx;
  10167. for(idx in W.model.venues.objects)
  10168. {
  10169. if(W.model.venues.objects.hasOwnProperty(idx))
  10170. {
  10171. let obj = W.model.venues.objects[idx].attributes;
  10172. let cbID = obj.createdBy;
  10173. let ubID = obj.updatedBy;
  10174.  
  10175. if((cbID !== null) && (listedIDs.indexOf(cbID) == -1))
  10176. {
  10177. listedIDs.push(cbID);
  10178. }
  10179. if((ubID !== null) && (ubID !== cbID) && (listedIDs.indexOf(ubID) == -1))
  10180. {
  10181. listedIDs.push(ubID);
  10182. }
  10183. }
  10184. }
  10185.  
  10186. // check for any previously selected userIDs in the two selector lists, then clear both lists
  10187. // and repopulate using the newly gathered ID collection from above, and finally reselect the
  10188. // previously selected user if they're still present in the new list...
  10189. let selector;
  10190. let selectedUser;
  10191. let users = W.model.users.getByIds(listedIDs);
  10192. let selectorEntry;
  10193.  
  10194. for(let i=0; i<2; i++)
  10195. {
  10196. if(i === 0) selector = document.getElementById('_selectPlacesUserID');
  10197. else selector = document.getElementById('_selectHidePlacesUserID');
  10198.  
  10199. selectedUser = null;
  10200. if(selector.selectedOptions[0] != null)
  10201. {
  10202. selectedUser = parseInt(selector.selectedOptions[0].value);
  10203. }
  10204. while(selector.options.length > 0)
  10205. {
  10206. selector.options.remove(0);
  10207. }
  10208. selector.options.add(new Option('<select a user>', null));
  10209. if(listedIDs.length > 0)
  10210. {
  10211. selectorEntry = '';
  10212. for(idx=0; idx<users.length; idx++)
  10213. {
  10214. if(users[idx].attributes.userName === undefined)
  10215. {
  10216. selectorEntry = users[idx].attributes.id;
  10217. }
  10218. else
  10219. {
  10220. selectorEntry = users[idx].attributes.userName;
  10221. }
  10222. selector.options.add(new Option(selectorEntry, users[idx].id));
  10223. if(users[idx].attributes.id == selectedUser)
  10224. {
  10225. selectedIdx = idx+1;
  10226. }
  10227. }
  10228. }
  10229.  
  10230. if(selectedIdx !== null)
  10231. {
  10232. selector.selectedIndex = selectedIdx;
  10233. }
  10234. }
  10235. }
  10236. function uroPlacesEditorSelected()
  10237. {
  10238. let selector = document.getElementById('_selectPlacesUserID');
  10239. if(selector.selectedIndex > 0)
  10240. {
  10241. document.getElementById('_textPlacesEditor').value = document.getElementById('_selectPlacesUserID').selectedOptions[0].innerHTML;
  10242. }
  10243. }
  10244. function uroHidePlacesEditorSelected()
  10245. {
  10246. let selector = document.getElementById('_selectHidePlacesUserID');
  10247. if(selector.selectedIndex > 0)
  10248. {
  10249. document.getElementById('_textHidePlacesEditor').value = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].innerHTML;
  10250. }
  10251. }
  10252. /*
  10253. function uroCamEditorSelected()
  10254. {
  10255. let selector = document.getElementById('_selectCameraUserID');
  10256. if(selector.selectedIndex > 0)
  10257. {
  10258. document.getElementById('_textCameraEditor').value = document.getElementById('_selectCameraUserID').selectedOptions[0].innerHTML;
  10259. }
  10260. }
  10261. */
  10262. function uroSetStyles(obj)
  10263. {
  10264. obj.style.fontSize = '12px';
  10265. obj.style.lineHeight = '100%';
  10266. obj.style.flex = '1';
  10267. obj.style.overflowY = 'auto';
  10268. }
  10269. function uroSetSectionTabStyles()
  10270. {
  10271. for(let i =0; i < uroTabs.CtrlTabs.length; ++i)
  10272. {
  10273. uroSetStyles(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  10274. }
  10275. }
  10276. function uroPlacesGroupCEHandler(groupidx)
  10277. {
  10278. if(uroPlacesGroupsCollapsed[groupidx] === false)
  10279. {
  10280. document.getElementById('_uroPlacesGroup-'+groupidx).style.display = "block";
  10281. document.getElementById('_uroPlacesGroupState-'+groupidx).className = "fa fa-minus-square-o";
  10282. }
  10283. else
  10284. {
  10285. document.getElementById('_uroPlacesGroup-'+groupidx).style.display = "none";
  10286. document.getElementById('_uroPlacesGroupState-'+groupidx).className = "fa fa-plus-square-o";
  10287. }
  10288. }
  10289. function uroPlacesGroupCollapseExpand()
  10290. {
  10291. let groupidx = this.id.substr(21);
  10292. if(uroPlacesGroupsCollapsed[groupidx] === true) uroPlacesGroupsCollapsed[groupidx] = false;
  10293. else uroPlacesGroupsCollapsed[groupidx] = true;
  10294. uroPlacesGroupCEHandler(groupidx);
  10295. return false;
  10296. }
  10297. function uroGetMarkerIDs(markerType)
  10298. {
  10299. let idList = [];
  10300. let mtList = uroGetMarkerTypeList(markerType);
  10301.  
  10302. while(mtList.length > 0)
  10303. {
  10304. let mt = mtList.pop();
  10305. if(uroLayers.layers[mt].mf !== null)
  10306. {
  10307. // Refresh .mf, as this is no longer guaranteed to have been set up as a reference to
  10308. // whatever's in the current W.map.layers object...
  10309. uroLayers.layers[mt].mf = uroLayers.GetMarkersOrFeatures(mt);
  10310. for(let i = 0; i < uroLayers.layers[mt].mf.length; ++i)
  10311. {
  10312. let dID = uroLayers.layers[mt].mf[i]?.element?.attributes['data-id']?.value;
  10313. if(dID === undefined)
  10314. {
  10315. dID = uroLayers.layers[mt].mf[i]?.attributes?.wazeFeature?.id;
  10316. }
  10317. if(dID !== undefined)
  10318. {
  10319. if(typeof dID === "number")
  10320. {
  10321. dID = dID.toString();
  10322. }
  10323. idList.push(dID);
  10324. }
  10325. }
  10326. }
  10327. }
  10328. return idList;
  10329. }
  10330. function uroGetAttributes(markerType, markerID)
  10331. {
  10332. if(markerType == uroLayers.ID.UR) return W.model.mapUpdateRequests.objects[markerID].attributes;
  10333. if(markerType == uroLayers.ID.MP) return W.model.mapProblems.objects[markerID].attributes;
  10334. if(markerType == uroLayers.ID.VPUR) return W.model.venues.objects[markerID].attributes;
  10335. if(markerType == uroLayers.ID.SegSug) return W.model.segmentSuggestions.objects[markerID].attributes;
  10336. return null;
  10337. }
  10338. function uroGetMarker(markerType, markerID)
  10339. {
  10340. if(typeof(markerID) === 'number')
  10341. {
  10342. markerID = markerID.toString();
  10343. }
  10344.  
  10345. let retval = null;
  10346.  
  10347. if(markerID !== null)
  10348. {
  10349. let mObj = null;
  10350. if(markerType === uroLayers.ID.UR)
  10351. {
  10352. mObj = W.model.mapUpdateRequests.getObjectById(markerID);
  10353. }
  10354. else if(markerType === uroLayers.ID.MP)
  10355. {
  10356. mObj = W.model.mapProblems.getObjectById(markerID);
  10357. }
  10358. else if(markerType === uroLayers.ID.RTC)
  10359. {
  10360. mObj = W.model.roadClosures.getObjectById(markerID);
  10361. }
  10362. else if(markerType === uroLayers.ID.SegSug)
  10363. {
  10364. mObj = W.model.segmentSuggestions.getObjectById(markerID);
  10365. }
  10366.  
  10367. if(mObj !== null)
  10368. {
  10369. retval = W.userscripts.getMapElementByDataModel(mObj);
  10370. }
  10371. else
  10372. {
  10373. retval = uroFindMarkerOnLayer(markerType, markerID);
  10374. }
  10375. }
  10376. return retval;
  10377. }
  10378. function uroGetMarkerTypeList(markerType)
  10379. {
  10380. let mtList = [];
  10381. if(markerType === uroLayers.ID.VPUR)
  10382. {
  10383. mtList.push(uroLayers.ID.PUR);
  10384. mtList.push(uroLayers.ID.PPUR);
  10385. mtList.push(uroLayers.ID.RPUR);
  10386. }
  10387. else
  10388. {
  10389. mtList.push(markerType);
  10390. }
  10391. return mtList;
  10392. }
  10393. function uroFindMarkerOnLayer(markerType, markerID)
  10394. {
  10395. retval = null;
  10396. let mtList = uroGetMarkerTypeList(markerType);
  10397.  
  10398. while(mtList.length > 0)
  10399. {
  10400. let mt = mtList.pop();
  10401. for(let i = 0; i < uroLayers.layers[mt].mf.length; ++i)
  10402. {
  10403. if(uroLayers.layers[mt].mf[i]?.attributes?.wazeFeature?.id === markerID)
  10404. {
  10405. let geoID = uroLayers.layers[mt].mf[i].geometry.id;
  10406. retval = document.getElementById(geoID);
  10407. break;
  10408. }
  10409. }
  10410. if(retval !== null)
  10411. {
  10412. break;
  10413. }
  10414. }
  10415. return retval;
  10416. }
  10417.  
  10418. uroInit.Initialise();