UROverview Plus (URO+)

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

当前为 2025-02-24 提交的版本,查看 最新版本

  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.13
  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 require: */
  31. /* globals ResizeObserver: */
  32. /* globals _: */
  33. /* globals trustedTypes: */
  34. /* jshint bitwise: false */
  35. /* jshint eqnull: true */
  36. /* jshint esversion: 11 */
  37. /* jshint undef: true */
  38. /* jshint unused: true */
  39.  
  40. const uroRelease =
  41. {
  42. version : "4.13",
  43. date : "20250224",
  44. changes :
  45. [
  46. "Settings are now saved again..."
  47. ]
  48. };
  49.  
  50. const uroEnums =
  51. {
  52. FP_OPTS:
  53. {
  54. filterUneditable: 0,
  55. filterInsideManagedAreas: 1,
  56. excludeMyAreas: 2,
  57. filterLockRanked: 3,
  58. filterFlagged: 4,
  59. filterNewPlace: 5,
  60. filterUpdatedDetails: 6,
  61. filterNewPhoto: 7,
  62. filterMinPURAge: 8,
  63. filterMaxPURAge: 9,
  64. invertPURFilters: 10,
  65. filterHighSeverity: 11,
  66. filterMedSeverity: 12,
  67. filterLowSeverity: 13,
  68. leavePURGeos: 14,
  69. filterCFPhone: 15,
  70. filterCFName: 16,
  71. filterCFEntryExitPoints: 17,
  72. filterCFOpeningHours: 18,
  73. filterCFAliases: 19,
  74. filterCFServices: 20,
  75. filterCFGeometry: 21,
  76. filterCFHouseNumber: 22,
  77. filterCFCategories: 23,
  78. filterCFDescription: 24,
  79. filterOnCFs: 25,
  80. thresholdMinPURDays: 26,
  81. thresholdMaxPURDays: 27,
  82. isLoggedIn: 28,
  83. userRank: 29,
  84. N_OPTS: 30
  85. },
  86. TRTC:
  87. {
  88. UNKNOWN: 0,
  89. WME: 1,
  90. WAZEFEED: 2,
  91. WAZEOTHER: 3
  92. },
  93. SRTC:
  94. {
  95. UNKNOWN: 0,
  96. EXPIRED: 1,
  97. ACTIVE: 2,
  98. FUTURE: 3
  99. },
  100. DRTC:
  101. {
  102. NONE: 0,
  103. SEG_AB: 1,
  104. SEG_BA: 2,
  105. SEG_BI: 4,
  106. TURN_OUT: 8,
  107. TURN_IN: 16
  108. }
  109. };
  110. const uroCustomURTags = ['[ROADWORKS]','[CONSTRUCTION]','[CLOSURE]','[EVENT]','[NOTE]','[WSLM]','[BOG]','[DIFFICULT]'];
  111. const uroImages =
  112. {
  113. HighlightedCameraImages :
  114. [
  115. // speed
  116. ["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/Y7ux4zK5Wfz6T8O4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bGllcj4KICAgPHBsdXM6SW1hZ2VDcmVhdG9yPgogICAgPHJkZjpTZXEvPgogICA8L3BsdXM6SW1hZ2VDcmVhdG9yPgogICA8cGx1czpDb3B5cmlnaHRPd25lcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkNvcHlyaWdodE93bmVyPgogICA8cGx1czpMaWNlbnNvcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkxpY2Vuc29yPgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgIAo8P3hwYWNrZXQgZW5kPSJ3Ij8+txeqYAAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAd0SU1FB+IDAw8pAmNZfO0AAA7kSURBVHja1Zx5kB1FHcc/8459b+9N2GSPhBiBBAQBBeVSI4GEoFQFSIASj+CRshDFQstAgXiiJcT7SLQKUVkQhOIIRVFA1gSSYCFHAgIakFSwSNjdhGU3yR7v7b43M/7Rr/N6erpn3stuTJyqrp7p6Zk3/X2/4/v7dc84HLrNiTme6ObHHFe1pQ4hOM4kA+cfpL4H5V+sFiS9LepY7W+SFj/mGEvbYQuUqTYVUx8bOL7Wphci6sNa9UzAJLRaBSdhuZ9nAMjTah0s50BUL3WI1M4ETkI5Thr6mFRPB8Qt9fdKfVXQdJWrCrDUIbJRaEAkI2onRvUkQJ4Ckqv09wygOP8PqudoUpRUSkqrdUlzNJA8pbhAUQHJjfB0h43qOTF2SZWYVEQxSRYGSZIgJUt1Aihoz+FrNs2pBrTUQQZHB0qXIhWUtFJSSp3UpApNmiRIhVJJWOgHBlV0KpWy1CQC5MRQgYRmf1SQarZv5w3fB1k8L1hHtet9fB/OOovZMUTTq4aMpg6SemFx/zpIUoJqAk+qPKrjBAEwtct97foaC+cqWoioE6WSziRJkWPwZI7B9auGO60BlQEyr7/OUyCkxCQpNgnzfXBdOPNMPgSMKWW8VAqawXc1ahFJSlOTp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r0m7tNFcQAdMpAqASoOLCzA2L5kYXPJPvHfdzpkIFUKVKXeUQcpCiio7KthhwVI1QBVCWDV3rMSiTnkAO0P3/6HIFcKwmEDzmQO9mCDdths/wXji1Blzxb9QAAAAABJRU5ErkJggg=="],
  117. // dummy
  118. ["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/JxCSc4ScoZ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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgCjw/eHBhY2tldCBlbmQ9InciPz73ndT8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4gMDDykcmVZBjgAADbFJREFUeNrtXGuMVcUd/805595z774X9gWlIFIVl0dJUWEht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2VTdXBwbGllcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkltYWdlU3VwcGxpZXI+CiAgIDxwbHVzOkltYWdlQ3JlYXRvcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkltYWdlQ3JlYXRvcj4KICAgPHBsdXM6Q29weXJpZ2h0T3duZXI+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpDb3B5cmlnaHRPd25lcj4KICAgPHBsdXM6TGljZW5zb3I+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpMaWNlbnNvcj4KICA8L3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/PvOQ5mMAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfiAwMPKBseKeVsAAAJfElEQVR42u1bXWgcxx3/ze7e7VnWl2vJ0jnCrkiKbRUbxw92nFIwwQ0plIIcDCmUvMQUTB+DyAfkrU8u5K0USvISQp5KbUoJIa2NnbYPwSGxQxI3NdhWPmxJOTknyWeddLe7eZjb3Oz//vNxurtEDxkYdnfuP7czv/l/z6xAd4vQ3Ls820rSxnPSycB7AQJtMz2r9NwkE8tzR2D0AgjuylWORjf5hLTRCsPVqQQ9Eg1u4h65qpP3NP8XMwDE5ErBEBsRjaBHYsFN3lOefYaGEw064ahBHzdoVVCoSLQFSNAjHQEyUd9wFRbRSAGIFRAihT5mJi02g2gIwgW+UgNypZwiCAixUiMAdQWEqJtWI+iSKFAQ1BUPDJXjDDCckILgN64egBoZR0J0imgHlKDDyVMgKBeok84pNVCuPuEKEG5IQag1qqcxz2BERbhySdCmJTCZSo/IvwpC/sYN3EwSIK1xnL2a2ilNkgCPPoofW5yu2NExswJhYn9ozCMFIeWAfGYkylCEyE6Qa0/vSf+8xueoaxwtYRIZsUHnyGOUIlWMOQJECCC8fh3/AeQqcyut45AkAaIIOHoUPw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oubAEXogXvkMuFCyg3ChJGlbgPg7UH5fsweh0JU/MQNh4wIOqHv3dr333HOf/xHN07oRmDMRTjoiSaSzZALjQknS6JKn1/4ALF3hlZ4AsPQJ8P+/uAVIpnxGM+IU8dzcvr+ePr34+8ZBkXWFI+omjrAe5++qi/2A9C4rs8C8g4utxhu6Y0RxHK5Wq4PzpdLou2+/XTuriIN6ENXp6NDtzRB+a8oigJNMsEQ/X0hrjdQ64Qj1tH9GRAIAFxu5iM1Y3gNQ0cQJCVGAdTLhOqMfjKKRJmY2W05iCcAJAPNMBEnPRUUMd9QtIGQUpg9gGcAbDfEYATDwPQOwAOA8gNMAvtCwuq7WNbrAGnSZTue3cyidPtP/ADr/tFL33af6gVvMPJu+CExcgNBdueO/uuPA3QLBBIbp+KDzZwrCHC2wwJi+7dTRdru4fhwLW/jdzkq5fsqko+0VR8BhpW2fTW9ogL38AL7bwDhnrzsdsOjif/UKFOvkfyhM+QYKVFliJfC7TQAAAABJRU5ErkJggg=="]
  121. ]
  122. };
  123.  
  124. let uroURDupes = [];
  125. let uroFID = -1;
  126. let uroShownFID = -1;
  127. let uroInhibitSave = true;
  128. let uroConfirmIntercepted = false;
  129. let uroMCLayer = null;
  130. let uroVenueLayer = null;
  131. let uro_uFP = [];
  132. let uroPendingURSessionIDs = [];
  133. let uroRequestedURSessionIDs = [];
  134. let uroPlacesGroupsCollapsed = [];
  135. let uroKnownProblemTypeIDs = [];
  136. let uroKnownProblemTypeNames = [];
  137. let uroPURsToHide = [];
  138. let uroNullOpenLayers = false;
  139. let uroNullURLayer = false;
  140. let uroNullProblemLayer = false;
  141. let uroNullMapViewport = false;
  142. let uroURDialogIsOpen = false;
  143. let uroHoveredURID = null;
  144. let uroSelectedURID = null;
  145. let uroURReclickAttempts = 0;
  146. let uroPendingCommentDataRefresh = false;
  147. let uroWaitingCommentDataRefresh = false;
  148. let uroExpectedCommentCount = null;
  149. let uroCachedLastCommentID = null;
  150. let uroMouseIsDown = false;
  151. let uroPopulatingRequestSessions = false;
  152. let uroHidePopupOnPanelOpen = false;
  153. let uroUserID = -1;
  154. let uroMTEMode = false;
  155. let uroDiv = null;
  156. let uroAlerts = null;
  157. let uroControls = null;
  158. let uroCtrlHides = null;
  159. let uroAMList = [];
  160. let uroManagedAreas = [];
  161. let uroIgnoreAreasUserID = null;
  162. let uroMousedOverMapComment = null;
  163. let uroMousedOverOtherObjectWithinMapComment = false;
  164. let uroRTCObjs = null;
  165. let uroUnstackedMasterID = null;
  166. let uroStackList = [];
  167. let uroStackType = null;
  168. let uroMainTickHandlerID = null;
  169. let uroMainTickStage = 0;
  170. let uroSettingsApplied = false;
  171. let uroInhibitURFiltering = false;
  172.  
  173.  
  174. const uroUtils = // utility functions
  175. {
  176. GetExtent: function()
  177. {
  178. // From DaveAcincy
  179. let extent = new OpenLayers.Bounds(W.map.getExtent());
  180. extent = extent.transform('EPSG:4326', 'EPSG:3857');
  181. return extent;
  182. },
  183. ModifyHTML: function(htmlIn)
  184. {
  185. if(typeof trustedTypes === "undefined")
  186. {
  187. return htmlIn;
  188. }
  189. else
  190. {
  191. const escapeHTMLPolicy = trustedTypes.createPolicy("forceInner", {createHTML: (to_escape) => to_escape});
  192. return escapeHTMLPolicy.createHTML(htmlIn);
  193. }
  194. },
  195. CloneObject: function(objIn)
  196. {
  197. return JSON.parse(JSON.stringify(objIn));
  198. },
  199. GetCBChecked: function(cbID)
  200. {
  201. try
  202. {
  203. return(document.getElementById(cbID).checked);
  204. }
  205. catch(err)
  206. {
  207. uroDBG.AddLog('GetCBChecked() - '+cbID+' not found!');
  208. return null;
  209. }
  210. },
  211. SetCBChecked: function(cbID, state)
  212. {
  213. try
  214. {
  215. document.getElementById(cbID).checked = state;
  216. }
  217. catch(err)
  218. {
  219. uroDBG.AddLog('SetCBChecked() - '+cbID+' not found!');
  220. }
  221. },
  222. GetElmValue: function(elmID)
  223. {
  224. try
  225. {
  226. return(document.getElementById(elmID).value);
  227. }
  228. catch(err)
  229. {
  230. uroDBG.AddLog('GetElmValue() - '+elmID+' not found!');
  231. return null;
  232. }
  233. },
  234. SetOnClick: function(elm,fn)
  235. {
  236. try
  237. {
  238. if(typeof elm == 'object')
  239. {
  240. elm.onclick = fn;
  241. }
  242. else
  243. {
  244. document.getElementById(elm).onclick = fn;
  245. }
  246. }
  247. catch(err)
  248. {
  249. uroDBG.AddLog('SetOnClick() - '+elm+' not found!');
  250. }
  251. },
  252. AddEventListener: function(elm, eventType, eventFn, eventBool)
  253. {
  254. try
  255. {
  256. document.getElementById(elm).addEventListener(eventType, eventFn, eventBool);
  257. }
  258. catch(err)
  259. {
  260. uroDBG.AddLog('AddEventListener() - '+elm+' not found!');
  261. }
  262. },
  263. DateToDays: function(dateToConvert)
  264. {
  265. let dateNow = new Date();
  266. let elapsedSinceEpoch = dateNow.getTime();
  267. let elapsedSinceEvent = elapsedSinceEpoch - dateToConvert;
  268. dateNow.setHours(0);
  269. dateNow.setMinutes(0);
  270. dateNow.setSeconds(0);
  271. dateNow.setMilliseconds(0);
  272. let elapsedSinceMidnight = elapsedSinceEpoch - dateNow.getTime();
  273. dateNow.setHours(24);
  274. let pendingUntilMidnight = elapsedSinceEpoch - dateNow.getTime();
  275. if((elapsedSinceEvent < elapsedSinceMidnight) && (elapsedSinceEvent > pendingUntilMidnight))
  276. {
  277. // event occurred today...
  278. return 0;
  279. }
  280. else if(elapsedSinceEvent < 0)
  281. {
  282. // event occurrs at some point in the future after midnight today, so return a minimum value of -1...
  283. return -1 - Math.floor((pendingUntilMidnight - elapsedSinceEvent) / 86400000);
  284. }
  285. else
  286. {
  287. // event occurred at some point prior to midnight this morning, so return a minimum value of 1...
  288. return 1 + Math.floor((elapsedSinceEvent - elapsedSinceMidnight) / 86400000);
  289. }
  290. },
  291. GetURAge: function(urObj,ageType,getRaw)
  292. {
  293. if(ageType === 0)
  294. {
  295. if((urObj.attributes.driveDate === null)||(urObj.attributes.driveDate === 0)) return -1;
  296. if(getRaw) return urObj.attributes.driveDate;
  297. else return uroUtils.DateToDays(urObj.attributes.driveDate);
  298. }
  299. else if(ageType === 1)
  300. {
  301. if((urObj.attributes.resolvedOn === null)||(urObj.attributes.resolvedOn === 0)) return -1;
  302. if(getRaw) return urObj.attributes.resolvedOn;
  303. else return uroUtils.DateToDays(urObj.attributes.resolvedOn);
  304. }
  305. else
  306. {
  307. return -1;
  308. }
  309. },
  310. GetMCAge: function(mcAttrs, ageType, getRaw)
  311. {
  312. if(ageType === 0)
  313. {
  314. if((mcAttrs.createdOn === null)||(mcAttrs.createdOn === 0)) return -1;
  315. if(getRaw) return mcAttrs.createdOn;
  316. else return uroUtils.DateToDays(mcAttrs.createdOn);
  317. }
  318. else if(ageType === 1)
  319. {
  320. if((mcAttrs.updatedOn === null)||(mcAttrs.updatedOn === 0)) return -1;
  321. if(getRaw) return mcAttrs.updatedOn;
  322. else return uroUtils.DateToDays(mcAttrs.updatedOn);
  323. }
  324. else if(ageType === 2)
  325. {
  326. if((mcAttrs.endDate === null)||(mcAttrs.endDate === 0)) return -1;
  327. let tDate = new Date(mcAttrs.endDate);
  328. if(getRaw) return tDate;
  329. else return uroUtils.DateToDays(tDate);
  330. }
  331. else
  332. {
  333. return -1;
  334. }
  335. },
  336. GetPURAge: function(purObj)
  337. {
  338. if(purObj.attributes.venueUpdateRequests[0].attributes.dateAdded !== null)
  339. {
  340. return uroUtils.DateToDays(purObj.attributes.venueUpdateRequests[0].attributes.dateAdded);
  341. }
  342. else
  343. {
  344. return -1;
  345. }
  346. },
  347. GetCameraAge: function(camObj, mode)
  348. {
  349. if(mode === 0)
  350. {
  351. if(camObj.attributes.updatedOn === null) return -1;
  352. return uroUtils.DateToDays(camObj.attributes.updatedOn);
  353. }
  354. if(mode === 1)
  355. {
  356. if(camObj.attributes.createdOn === null) return -1;
  357. return uroUtils.DateToDays(camObj.attributes.createdOn);
  358. }
  359. },
  360. GetCommentAge: function(commentObj)
  361. {
  362. if(commentObj.createdOn === null) return -1;
  363. return uroUtils.DateToDays(commentObj.createdOn);
  364. },
  365. ParseDaysAgo: function(days)
  366. {
  367. if(days === 0) return 'today';
  368. else if(days === 1) return '1 day ago';
  369. else return days+' days ago';
  370. },
  371. ParseDaysToGo: function(days)
  372. {
  373. days = 0 - days;
  374. if(days === 0) return 'today';
  375. else if(days === 1) return 'in 1 day';
  376. else return 'in '+days+' days';
  377. },
  378. GetLocalisedSpeedString: function(thisSpeed)
  379. {
  380. if(thisSpeed !== null)
  381. {
  382. let conversionFactor = 1; // default to metric
  383. let multipleFactor = 10; // default to limits being set in multiples of 10
  384. let country = null;
  385. if((W.model.getTopCountry()) && (W.model.getTopCountry().attributes.name !== undefined))
  386. {
  387. country = W.model.getTopCountry().attributes.name;
  388. }
  389. if(country !== null)
  390. {
  391. // country-specific deviations from the above...
  392. if
  393. (
  394. (country == "United Kingdom") ||
  395. (country == "Jersey") ||
  396. (country == "Guernsey") ||
  397. (country == "United States")
  398. )
  399. {
  400. // countries using MPH
  401. conversionFactor = 1.609;
  402. }
  403. if
  404. (
  405. (country == "United States") ||
  406. (country == "Guernsey")
  407. )
  408. {
  409. // countries with speed limits set in multiples of 5
  410. multipleFactor = 5;
  411. }
  412. }
  413. let speed = Math.round(thisSpeed / conversionFactor);
  414. let retval = speed;
  415. if(conversionFactor == 1) retval += "KM/H";
  416. else retval += "MPH";
  417. return retval;
  418. }
  419. else return "not set";
  420. },
  421. Clickify: function(desc, suffix)
  422. {
  423. // The terminators array consists of pairs of characters which may be found at either
  424. // end of a URL. The first entry in each pair indicates which character needs to be
  425. // found immediately prior to the URL ('' indicates any character) in order for the
  426. // second entry to be considered as a potential end of URL marker
  427. let terminators = [
  428. ['', ' '],
  429. ['', ','],
  430. ['(', ')'],
  431. ['[', ']'],
  432. ['', '\r'],
  433. ['', '\n']
  434. ];
  435. if(desc === null) return '';
  436. if(desc === undefined) return '';
  437. if(desc === '') return '';
  438. if(desc.indexOf("https: one.network") == 0)
  439. {
  440. desc = desc.replaceAll(' ','/');
  441. }
  442. desc = desc.replace(/<\/?[^>]+(>|$)/g, "");
  443. if(desc !== "null")
  444. {
  445. // At the moment we can only clickify links that start with http or https...
  446. if(desc.indexOf('http') != -1)
  447. {
  448. let links = desc.split("http");
  449. desc = '';
  450. let i, j, linkEndPos, descPostLink;
  451. for(i=0; i<links.length; i++)
  452. {
  453. if(links[i].indexOf('://') != -1)
  454. {
  455. let prefix = links[i - 1][links[i - 1].length - 1];
  456. links[i] = "http" + links[i];
  457. linkEndPos = links[i].length + 1;
  458. // work out where the end of the URL is, based on what the character immediately
  459. // preceding the "http" is
  460. for(j=0; j<terminators.length; j++)
  461. {
  462. if(links[i].indexOf(terminators[j][1]) !== -1)
  463. {
  464. if((prefix === terminators[j][0]) || (terminators[j][0] === ''))
  465. {
  466. linkEndPos = Math.min(linkEndPos, links[i].indexOf(terminators[j][1]));
  467. }
  468. }
  469. }
  470. descPostLink = '';
  471. if(linkEndPos < links[i].length)
  472. {
  473. descPostLink = links[i].slice(linkEndPos);
  474. links[i] = links[i].slice(0,linkEndPos);
  475. }
  476. desc += '<a target="_wazeUR" href="'+links[i]+'">'+links[i]+'</a>' + descPostLink;
  477. }
  478. else
  479. {
  480. desc += links[i];
  481. }
  482. }
  483. }
  484. desc = desc.replace(/\n/g,"<br>");
  485. return desc + suffix;
  486. }
  487. else
  488. {
  489. return '';
  490. }
  491. },
  492. GetUserNameFromID: function(userID)
  493. {
  494. let userName;
  495. if(W.model.users.objects[userID] != null)
  496. {
  497. userName = W.model.users.objects[userID].attributes.userName;
  498. if(userName === undefined)
  499. {
  500. userName = userID;
  501. }
  502. }
  503. else
  504. {
  505. userName = userID;
  506. }
  507. return userName;
  508. },
  509. GetUserLevelFromID: function(userID)
  510. {
  511. let userLevel = undefined;
  512. if(W.model.users.objects[userID] != null)
  513. {
  514. userLevel = W.model.users.objects[userID].attributes.rank + 1;
  515. }
  516. return userLevel;
  517. },
  518. GetUserNameAndRank: function(userID)
  519. {
  520. let userName;
  521. let userLevel;
  522. if(W.model.users.objects[userID] != null)
  523. {
  524. userName = W.model.users.objects[userID].attributes.userName;
  525. if(userName === undefined)
  526. {
  527. userName = userID;
  528. }
  529. else
  530. {
  531. userName = '<a href="' + (W.Config.user_profile.url + userName) + '" target="_blank">' + userName + '</a>';
  532. }
  533. userLevel = W.model.users.objects[userID].attributes.rank + 1;
  534. }
  535. else
  536. {
  537. userName = userID;
  538. userLevel = '?';
  539. }
  540. return userName + ' (' + userLevel + ')';
  541. },
  542. GetDateTimeString: function(ts)
  543. {
  544. let tDateObj = new Date(ts);
  545. let dateLocale;
  546. let timeLocale;
  547. if(uroUtils.GetCBChecked('_cbDateFmtDDMMYY')) dateLocale = 'en-gb';
  548. if(uroUtils.GetCBChecked('_cbDateFmtMMDDYY')) dateLocale = 'en-us';
  549. if(uroUtils.GetCBChecked('_cbDateFmtYYMMDD')) dateLocale = 'ja';
  550. if(uroUtils.GetCBChecked('_cbTimeFmt24H')) timeLocale = 'en-gb';
  551. if(uroUtils.GetCBChecked('_cbTimeFmt12H')) timeLocale = 'en-us';
  552. return tDateObj.toLocaleDateString(dateLocale) + ' ' + tDateObj.toLocaleTimeString(timeLocale);
  553. },
  554. ParsePxString: function(pxString)
  555. {
  556. return parseInt(pxString.split("px")[0]);
  557. },
  558. TypeCast: function(varin)
  559. {
  560. if(varin == "null") return null;
  561. if(typeof varin == "string") return parseInt(varin);
  562. return varin;
  563. },
  564. Truncate: function(val)
  565. {
  566. if(val === null) return val;
  567. if(val < 0) return Math.ceil(val);
  568. return Math.floor(val);
  569. },
  570. KeywordPresent: function(desc, keyword, caseInsensitive)
  571. {
  572. let re;
  573. if(caseInsensitive) re = RegExp(keyword,'i');
  574. else re = RegExp(keyword);
  575. if(desc.search(re) != -1) return true;
  576. else return false;
  577. },
  578. AddStyle: function(ID, css)
  579. {
  580. let head, style;
  581. head = document.getElementsByTagName('head')[0];
  582. if (!head)
  583. {
  584. return;
  585. }
  586. uroUtils.RemoveStyle(ID); // in case it is already there
  587. style = document.createElement('style');
  588. style.type = 'text/css';
  589. style.innerHTML = uroUtils.ModifyHTML(css);
  590. style.id = ID;
  591. head.appendChild(style);
  592. },
  593. RemoveStyle: function(ID)
  594. {
  595. let style = document.getElementById(ID);
  596. if (style)
  597. {
  598. style.parentNode.removeChild(style);
  599. }
  600. },
  601. GetTS: function(day, month, year, hours, mins)
  602. {
  603. let retval = new Date(0);
  604. retval.setDate(day);
  605. retval.setMonth(month - 1);
  606. retval.setYear(year);
  607. retval.setHours(hours);
  608. retval.setMinutes(mins);
  609. return retval.getTime();
  610. },
  611. ToHex: function(decValue, digits)
  612. {
  613. let modifier = 1;
  614. for(let i=0; i < digits; i++)
  615. {
  616. modifier *= 16;
  617. }
  618. // make sure decValue actually is an integer
  619. decValue = parseInt(decValue);
  620. // adding the modifier ensures we have enough digits, including
  621. // any leading zeros which may be required, for the required output
  622. decValue += modifier;
  623. let retval = decValue.toString(16);
  624. // after converting to hex with the modifier included, we'll have
  625. // as many digits as we need to represent decValue, but also an
  626. // extra leading 1, which now needs to be removed before returning
  627. // the result...
  628. retval = retval.substr(-digits);
  629. retval = retval.toUpperCase();
  630. return retval;
  631. },
  632. GetActiveSidebarTab: function()
  633. {
  634. let retval = null;
  635.  
  636. let tabIcons = document.querySelectorAll('wz-navigation-item');
  637. for(let i = 0; i < tabIcons.length; ++i)
  638. {
  639. if(tabIcons[i].selected === true)
  640. {
  641. retval = tabIcons[i].attributes['data-for'].value;
  642. break;
  643. }
  644. }
  645. return retval;
  646. },
  647. IsClosureUIActive: function()
  648. {
  649. let retval = false;
  650.  
  651. if(W.selectionManager.getSelectedWMEFeatures()[0]?.featureType === 'segment')
  652. {
  653. let ast = uroUtils.GetActiveSidebarTab();
  654. if(ast === 'feature_editor')
  655. {
  656. retval = document.querySelector('wz-tab.closures-tab').attributes['is-active'].value !== 'false';
  657. }
  658. }
  659.  
  660. return retval;
  661. },
  662. ConvertWGS84ToMercator: function(point)
  663. {
  664. return point.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
  665. },
  666. ConvertMercatorToWGS84: function(point)
  667. {
  668. return point.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
  669. },
  670. GetSelectedSegmentIDs: function()
  671. {
  672. let selDMOs = W.selectionManager.getSelectedDataModelObjects();
  673. let retval = [];
  674.  
  675. if(selDMOs.length > 0)
  676. {
  677. for(let i = 0; i < selDMOs.length; ++i)
  678. {
  679. if(selDMOs[i].type === "segment")
  680. {
  681. retval.push(selDMOs[i].attributes.id);
  682. }
  683. }
  684. }
  685.  
  686. return retval;
  687. }
  688. };
  689. const uroTabs = // script tab handling
  690. {
  691. MAX_PER_ROW: 6,
  692. IDS:
  693. {
  694. URS: 0,
  695. MPS: 1,
  696. MCS: 2,
  697. RTCS: 3,
  698. RAS: 4,
  699. PLACES: 5,
  700. ////CAMS: 6,
  701. ////MISC: 7
  702. MISC: 6
  703. },
  704. FIELDS:
  705. {
  706. TABHEADER: 0,
  707. TABBODY: 1,
  708. LINKID: 2,
  709. TABTITLE: 3,
  710. SHOWFN: 4,
  711. CLICKFN: 5,
  712. STORAGE: 6,
  713. POPULATEFN: 7
  714. },
  715. CtrlTabs: [],
  716.  
  717. SetStyleDisplay: function(elm,style)
  718. {
  719. try
  720. {
  721. if(typeof elm == 'object')
  722. {
  723. elm.style.display = style;
  724. }
  725. else
  726. {
  727. document.getElementById(elm).style.display = style;
  728. }
  729. }
  730. catch(err)
  731. {
  732. uroDBG.AddLog('SetStyleDisplay() - '+elm+' not found!');
  733. }
  734. },
  735. PopulateMP: function()
  736. {
  737. let tHTML = '';
  738. tHTML += '<input type="checkbox" id="_cbMPFilterOutsideArea">Hide MPs outside my editable area</input><br><br>';
  739. tHTML += '<b>Filter MPs by type:</b><br>';
  740. let i;
  741. for(i=0; i<uroKnownProblemTypeNames.length; i++)
  742. {
  743. tHTML += '<input type="checkbox" id="_cbMPFilter_T'+uroKnownProblemTypeIDs[i]+'">'+uroKnownProblemTypeNames[i]+'</input><br>';
  744. }
  745. tHTML += '<br><input type="checkbox" id="_cbMPFilterUnknownProblem">Unknown problem type</input><br><br>';
  746.  
  747. tHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  748. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterElgin">[Elgin]</input><br>';
  749. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTrafficCast">[TrafficCast]</input><br>';
  750. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTrafficMaster">[TM]</input><br>';
  751. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterCaltrans">[Caltrans]</input><br>';
  752. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterTFL">TfL</input><br>';
  753.  
  754. tHTML += '<input type="checkbox" id="_cbMPFilterReopenedProblem">Reopened Problems</input><br><br>';
  755.  
  756. tHTML += '<input type="checkbox" id="_cbInvertMPFilter">Invert operation of type filters?</input><br>';
  757.  
  758. tHTML += '<br><b>Hide closed/solved/unidentified Problems:</b><br>';
  759. tHTML += '<input type="checkbox" id="_cbMPFilterClosed">Closed</input><br>';
  760. tHTML += '<input type="checkbox" id="_cbMPFilterSolved">Solved</input><br>';
  761. tHTML += '<input type="checkbox" id="_cbMPFilterUnidentified">Not identified</input><br><br>';
  762.  
  763. tHTML += '<input type="checkbox" id="_cbMPClosedUserIDFilter" pairedWith="_cbMPNotClosedUserIDFilter">Closed</input> or ';
  764. tHTML += '<input type="checkbox" id="_cbMPNotClosedUserIDFilter" pairedWith="_cbMPClosedUserIDFilter">Not Closed</input> by user';
  765. tHTML += '<select id="_selectMPUserID" style="width:80%; height:22px;"></select><br>';
  766.  
  767. tHTML += '<br><b>Hide problems (not turn) by severity:</b><br>';
  768. tHTML += '<input type="checkbox" id="_cbMPFilterLowSeverity">Low</input>&nbsp;&nbsp;';
  769. tHTML += '<input type="checkbox" id="_cbMPFilterMediumSeverity">Medium</input>&nbsp;&nbsp;';
  770. tHTML += '<input type="checkbox" id="_cbMPFilterHighSeverity">High</input><br>';
  771.  
  772. tHTML += '<br><b>Show MPs based on start/end dates:</b><br>';
  773. tHTML += '<input type="checkbox" id="_cbMPFilterStartDate">Start</input>&nbsp;&nbsp;';
  774. tHTML += '<input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartDay"> / ';
  775. tHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartMonth"> / ';
  776. tHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterStartYear"><br>';
  777. tHTML += '<input type="checkbox" id="_cbMPFilterEndDate">End</input>&nbsp;&nbsp;';
  778. tHTML += '<input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndDay"> / ';
  779. tHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndMonth"> / ';
  780. tHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputMPFilterEndYear"><br>';
  781. tHTML += '<input type="checkbox" id="_cbMPFilterEndDatePassed">End date in the past</input>';
  782.  
  783. return tHTML;
  784. },
  785. PopulatePlaces: function()
  786. {
  787. let tHTML = '';
  788. tHTML += '<b>Filter PURs by category/status:</b><br>';
  789. tHTML += '<input type="checkbox" id="_cbFilterUneditablePlaceUpdates">Ones I can\'t edit</input><br>';
  790. tHTML += '<input type="checkbox" id="_cbPURFilterInsideManagedAreas">Ones within AM areas</input>';
  791. tHTML += '&nbsp;(<input type="checkbox" id="_cbPURExcludeUserArea">except my area)</input><br>';
  792. tHTML += '<i>Requires Area Manager layer to be enabled</i><br>';
  793. tHTML += '<input type="checkbox" id="_cbFilterLockRankedPlaceUpdates">Ones with non-zero lockRanks</input><br>';
  794. tHTML += '<input type="checkbox" id="_cbFilterNewPlacePUR">Ones for new places</input><br>';
  795. tHTML += '<input type="checkbox" id="_cbFilterUpdatedDetailsPUR">Ones for updated place details</input><br>';
  796.  
  797. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFPhone">Phone number</input><br>';
  798. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFName">Name</input><br>';
  799. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFEntryExitPoints">Entry//exit points</input><br>';
  800. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFOpeningHours">Opening hours</input><br>';
  801. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFAliases">Aliases</input><br>';
  802. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFServices">Services</input><br>';
  803. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFGeometry">Geometry</input><br>';
  804. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFHouseNumber">House number</input><br>';
  805. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFCategories">Categories</input><br>';
  806. tHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbPURFilterCFDescription">Description</input><br>';
  807.  
  808. tHTML += '<input type="checkbox" id="_cbFilterNewPhotoPUR">Ones for new photos</input><br>';
  809. tHTML += '<input type="checkbox" id="_cbFilterFlaggedPUR">Ones flagged for attention</input><br>';
  810. tHTML += '<br><input type="checkbox" id="_cbInvertPURFilters">Invert PUR filters</input><br>';
  811.  
  812. tHTML += '<br><b>Filter PURs by age of submission:</b><br>';
  813. tHTML += '<input type="checkbox" id="_cbEnablePURMinAgeFilter">Hide PURs less than </input>';
  814. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputPURFilterMinDays"> days old<br>';
  815. tHTML += '<input type="checkbox" id="_cbEnablePURMaxAgeFilter">Hide PURs more than </input>';
  816. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputPURFilterMaxDays"> days old<br>';
  817.  
  818. tHTML += '<hr>';
  819.  
  820. tHTML += '<br><b>Filter Places by state:</b><br>';
  821. tHTML += 'Hide if last edited<br>';
  822. tHTML += '<input type="checkbox" id="_cbPlaceFilterEditedLessThan"> less than </input>';
  823. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterPlaceEditMinDays"> days ago<br>';
  824. tHTML += '<input type="checkbox" id="_cbPlaceFilterEditedMoreThan"> more than </input>';
  825. tHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterPlaceEditMaxDays"> days ago<br>';
  826.  
  827. tHTML += '<br>Hide if locked at level:<br>';
  828. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL0">1</input>';
  829. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL1">2</input>';
  830. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL2">3</input>';
  831. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL3">4</input>';
  832. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL4">5</input>';
  833. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesL5">6</input>';
  834. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesStaff">Staff</input>';
  835. tHTML += '<br>&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePlacesAdLocked">AdLocked</input><br>';
  836.  
  837. tHTML += '<br>Hide by geometry:<br>';
  838. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAreaPlaces">Areas</input>';
  839. tHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHidePointPlaces">Points</input>';
  840.  
  841. tHTML += '<br><br><input type="checkbox" id="_cbHidePhotoPlaces" pairedWith="_cbHideNoPhotoPlaces">Hide or </input>';
  842. tHTML += '<input type="checkbox" id="_cbHideNoPhotoPlaces" pairedWith="_cbHidePhotoPlaces">show ones with photos</input><br>';
  843.  
  844. tHTML += '<input type="checkbox" id="_cbHideLinkedPlaces" pairedWith="_cbHideNoLinkedPlaces">Hide or </input>';
  845. tHTML += '<input type="checkbox" id="_cbHideNoLinkedPlaces" pairedWith="_cbHideLinkedPlaces">show ones with external links</input><br>';
  846.  
  847. tHTML += '<input type="checkbox" id="_cbHideDescribedPlaces" pairedWith="_cbHideNonDescribedPlaces">Hide or </input>';
  848. tHTML += '<input type="checkbox" id="_cbHideNonDescribedPlaces" pairedWith="_cbHideDescribedPlaces">show ones with descriptive text</input><br>';
  849.  
  850. tHTML += '<input type="checkbox" id="_cbHideKeywordPlaces" pairedWith="_cbHideNoKeywordPlaces">Hide or </input>';
  851. tHTML += '<input type="checkbox" id="_cbHideNoKeywordPlaces" pairedWith="_cbHideKeywordPlaces">show ones with a name including</input><br>';
  852. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordPlace"><br>';
  853.  
  854. tHTML += '<br><b>Show Places touched by a specific editor:</b><br>';
  855. tHTML += '<input type="checkbox" id="_cbShowOnlyPlacesCreatedBy">Created by</input>&nbsp;/&nbsp;';
  856. tHTML += '<input type="checkbox" id="_cbShowOnlyPlacesEditedBy">edited by</input><br>';
  857. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textPlacesEditor"><br>';
  858. tHTML += '<select id="_selectPlacesUserID" style="width:80%; height:22px;"></select><br>';
  859.  
  860. tHTML += '<br><b>Hide Places touched by a specific editor:</b><br>';
  861. tHTML += '<input type="checkbox" id="_cbHideOnlyPlacesCreatedBy">Created by</input>&nbsp;/&nbsp;';
  862. tHTML += '<input type="checkbox" id="_cbHideOnlyPlacesEditedBy">edited by</input><br>';
  863. tHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textHidePlacesEditor"><br>';
  864. tHTML += '<select id="_selectHidePlacesUserID" style="width:80%; height:22px;"></select><br>';
  865.  
  866. tHTML += '<br><br><b>Filter Places by category:</b><br>';
  867. tHTML += '<input type="checkbox" id="_cbLeavePURGeos" pairedWith="_cbHidePURsForFilteredPlaces">Keep place visible if linked PUR is hidden, or</input><br>';
  868. tHTML += '<input type="checkbox" id="_cbHidePURsForFilteredPlaces" pairedWith="_cbLeavePURGeos">Hide PURs linked to hidden places</input><br><br>';
  869.  
  870. let nCategories = W.Config.venues.categories.length;
  871. let i;
  872. if(uroPlacesGroupsCollapsed.length != nCategories)
  873. {
  874. for(i=0; i<nCategories; i++)
  875. {
  876. uroPlacesGroupsCollapsed.push(false);
  877. }
  878. }
  879.  
  880. for(i=0; i<nCategories; i++)
  881. {
  882. let parentCategory = W.Config.venues.categories[i];
  883. let localisedName = I18n.lookup("venues.categories." + parentCategory);
  884.  
  885. if(uroPlacesGroupsCollapsed[i] === true)
  886. {
  887. tHTML += '<i class="fa fa-plus-square-o" style="cursor:pointer;font-size:14px;" id="_uroPlacesGroupState-'+i+'"></i>';
  888. }
  889. else
  890. {
  891. tHTML += '<i class="fa fa-minus-square-o" style="cursor:pointer;font-size:14px;" id="_uroPlacesGroupState-'+i+'"></i>';
  892. }
  893.  
  894. tHTML += '&nbsp;<input type="checkbox" id="_cbPlacesFilter-'+parentCategory+'"><b>'+localisedName+'</b></input><br>';
  895. tHTML += '<div id="_uroPlacesGroup-'+i+'" style="padding:3px;border-width:2px;border-style:solid;border-color:#FFFFFF">';
  896.  
  897. for(let ii=0; ii<W.Config.venues.subcategories[parentCategory].length; ii++)
  898. {
  899. let subCategory = W.Config.venues.subcategories[parentCategory][ii];
  900. localisedName = I18n.lookup("venues.categories." + subCategory);
  901. tHTML += '&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbPlacesFilter-'+subCategory+'">'+localisedName+'</input><br>';
  902. }
  903. tHTML += '</div>';
  904. }
  905. tHTML += '<input type="checkbox" id="_cbFilterPrivatePlaces"><b>Residential Places</b></input><br>';
  906. tHTML += '<br><input type="checkbox" id="_cbInvertPlacesFilter">Invert Place filters?</input>';
  907.  
  908. return tHTML;
  909. },
  910. PopulateUR: function()
  911. {
  912. let iHTML = '';
  913. iHTML = '<br>';
  914.  
  915. iHTML += '<input type="checkbox" id="_cbURFilterOutsideArea">Hide URs outside my editable area</input><br>';
  916. iHTML += '<input type="checkbox" id="_cbURFilterInsideManagedAreas">Hide URs within AM areas</input>';
  917. iHTML += '&nbsp;(<input type="checkbox" id="_cbURExcludeUserArea">except my area)</input><br>';
  918. iHTML += '&nbsp;<i>Requires Area Manager layer to be enabled</i><br>';
  919. iHTML += '<input type="checkbox" id="_cbNoFilterForURInURL">Don\'t filter selected UR</input><br><br>';
  920. iHTML += '<input type="checkbox" id="_cbURFilterDupes">Show only duplicate URs</input><br><br>';
  921.  
  922. iHTML += '<b>Filter by type:</b><br>';
  923. iHTML += '<input type="checkbox" id="_cbFilterWazeAuto">Waze Automatic</input><br>';
  924. iHTML += '<input type="checkbox" id="_cbFilterIncorrectTurn">Incorrect turn</input><br>';
  925. iHTML += '<input type="checkbox" id="_cbFilterIncorrectAddress">Incorrect address</input><br>';
  926. iHTML += '<input type="checkbox" id="_cbFilterIncorrectRoute">Incorrect route</input><br>';
  927. iHTML += '<input type="checkbox" id="_cbFilterMissingRoundabout">Missing roundabout</input><br>';
  928. iHTML += '<input type="checkbox" id="_cbFilterGeneralError">General error</input><br>';
  929. iHTML += '<input type="checkbox" id="_cbFilterTurnNotAllowed">Turn not allowed</input><br>';
  930. iHTML += '<input type="checkbox" id="_cbFilterIncorrectJunction">Incorrect junction</input><br>';
  931. iHTML += '<input type="checkbox" id="_cbFilterMissingBridgeOverpass">Missing bridge overpass</input><br>';
  932. iHTML += '<input type="checkbox" id="_cbFilterWrongDrivingDirection">Wrong driving direction</input><br>';
  933. iHTML += '<input type="checkbox" id="_cbFilterMissingExit">Missing exit</input><br>';
  934. iHTML += '<input type="checkbox" id="_cbFilterMissingRoad">Missing road</input><br>';
  935. iHTML += '<input type="checkbox" id="_cbFilterBlockedRoad">Blocked road</input><br>';
  936. iHTML += '<input type="checkbox" id="_cbFilterMissingLandmark">Missing Landmark</input><br>';
  937. iHTML += '<input type="checkbox" id="_cbFilterSpeedLimits">Missing or Invalid Speed limit</input><br>';
  938. iHTML += '<input type="checkbox" id="_cbFilterUndefined">Undefined</input><br>';
  939.  
  940. iHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  941. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterRoadworks">[ROADWORKS]</input><br>';
  942. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterConstruction">[CONSTRUCTION]</input><br>';
  943. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterClosure">[CLOSURE]</input><br>';
  944. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterEvent">[EVENT]</input><br>';
  945. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterNote">[NOTE]</input><br>';
  946. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterBOG">[BOG]</input><br>';
  947. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterDifficult">[DIFFICULT]</input><br>';
  948. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbFilterWSLM">[WSLM]</input><br><br>';
  949. iHTML += '<input type="checkbox" id="_cbInvertURFilter">Invert operation of type filters?</input><br>';
  950.  
  951. iHTML += '<hr>';
  952.  
  953. iHTML += '<br><b>Hide by state:</b><br>';
  954. iHTML += '<input type="checkbox" id="_cbFilterOpenUR">Open</input><br>';
  955. iHTML += '<input type="checkbox" id="_cbFilterClosedUR">Closed</input><br>';
  956. iHTML += '<input type="checkbox" id="_cbFilterSolved">Solved</input><br>';
  957. iHTML += '<input type="checkbox" id="_cbFilterUnidentified">Not identified</input><br><br>';
  958.  
  959.  
  960. iHTML += '<br><b>Filter by age of submission:</b><br>';
  961. iHTML += '<input type="checkbox" id="_cbEnableMinAgeFilter">Hide URs less than </input>';
  962. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMinDays"> days old<br>';
  963. iHTML += '<input type="checkbox" id="_cbEnableMaxAgeFilter">Hide URs more than </input>';
  964. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMaxDays"> days old<br>';
  965.  
  966. iHTML += '<br><b>Filter by other details:</b><br>';
  967. iHTML += '<input type="checkbox" id="_cbHideMyFollowed" pairedWith="_cbHideMyUnfollowed">Hide</input> or ';
  968. iHTML += '<input type="checkbox" id="_cbHideMyUnfollowed" pairedWith="_cbHideMyFollowed">show</input> URs I\'m following<br><br>';
  969.  
  970. iHTML += '<input type="checkbox" id="_cbURDescriptionMustBePresent" pairedWith="_cbURDescriptionMustBeAbsent">Hide</input> or ';
  971. iHTML += '<input type="checkbox" id="_cbURDescriptionMustBeAbsent" pairedWith="_cbURDescriptionMustBePresent">show</input> URs with no description<br>';
  972. iHTML += '<input type="checkbox" id="_cbEnableKeywordMustBePresent">Hide URs not including </input>';
  973. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordPresent"><br>';
  974. iHTML += '<input type="checkbox" id="_cbEnableKeywordMustBeAbsent">Hide URs including </input>';
  975. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textKeywordAbsent"><br>';
  976. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbCaseInsensitive"><i>Case-insensitive matches?</i></input><br><br>';
  977.  
  978. iHTML += 'With comments from me?<br>';
  979. iHTML += '<input type="checkbox" id="_cbHideMyComments" pairedWith="_cbHideAnyComments">Yes </input>';
  980. iHTML += '<input type="checkbox" id="_cbHideAnyComments" pairedWith="_cbHideMyComments">No</input><br>';
  981. iHTML += 'If last comment made by me?<br>';
  982. iHTML += '<input type="checkbox" id="_cbHideIfLastCommenter" pairedWith="_cbHideIfNotLastCommenter">Yes </input>';
  983. iHTML += '<input type="checkbox" id="_cbHideIfNotLastCommenter" pairedWith="_cbHideIfLastCommenter">No </input><br>';
  984. iHTML += 'If last comment made by UR reporter?<br>';
  985. iHTML += '<input type="checkbox" id="_cbHideIfReporterLastCommenter" pairedWith="_cbHideIfReporterNotLastCommenter">Yes </input>';
  986. iHTML += '<input type="checkbox" id="_cbHideIfReporterNotLastCommenter" pairedWith="_cbHideIfReporterLastCommenter">No</input><br>';
  987.  
  988. iHTML += '<input type="checkbox" id="_cbEnableMinCommentsFilter">With less than </input>';
  989. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMinComments"> comments<br>';
  990. iHTML += '<input type="checkbox" id="_cbEnableMaxCommentsFilter">With more than </input>';
  991. iHTML += '<input type="number" min="0" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterMaxComments"> comments<br><br>';
  992.  
  993. iHTML += '<input type="checkbox" id="_cbEnableCommentAgeFilter2">Last comment less than </input>';
  994. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterCommentDays2"> days ago<br>';
  995. iHTML += '<input type="checkbox" id="_cbEnableCommentAgeFilter">Last comment more than </input>';
  996. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterCommentDays"> days ago<br>';
  997. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbIgnoreOtherEditorComments"><i>Ignore other editor comments?</i></input><br><br>';
  998.  
  999. iHTML += '<input type="checkbox" id="_cbURUserIDFilter">Without comments from user</input>';
  1000. iHTML += '<select id="_selectURUserID" style="width:80%; height:22px;"></select><br>';
  1001. iHTML += '<input type="checkbox" id="_cbURResolverIDFilter">Not resolved by user</input>';
  1002. iHTML += '<select id="_selectURResolverID" style="width:80%; height:22px;"></select>';
  1003.  
  1004. iHTML += '<br><br><input type="checkbox" id="_cbInvertURStateFilter">Invert operation of state/age filters?</input><br>';
  1005. iHTML += '<input type="checkbox" id="_cbNoFilterForTaggedURs">Don\'t apply state/age filters to tagged URs</input><br>';
  1006.  
  1007. return iHTML;
  1008. },
  1009. PopulateMC: function()
  1010. {
  1011. let iHTML = '';
  1012. iHTML = '<br>';
  1013.  
  1014. iHTML += '&nbsp;&nbsp;<i>Specially tagged types</i><br>';
  1015. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterRoadworks">[ROADWORKS]</input><br>';
  1016. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterConstruction">[CONSTRUCTION]</input><br>';
  1017. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterClosure">[CLOSURE]</input><br>';
  1018. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterEvent">[EVENT]</input><br>';
  1019. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterNote">[NOTE]</input><br>';
  1020. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterBOG">[BOG]</input><br>';
  1021. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterDifficult">[DIFFICULT]</input><br>';
  1022. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCFilterWSLM">[WSLM]</input><br><br>';
  1023. iHTML += '<input type="checkbox" id="_cbInvertMCFilter">Invert operation of type filters?</input><br>';
  1024.  
  1025. iHTML += '<hr>';
  1026.  
  1027. iHTML += '<br><b>Filter by description/comments/following:</b><br>';
  1028. iHTML += '<input type="checkbox" id="_cbMCHideMyFollowed" pairedWith="_cbMCHideMyUnfollowed">Ones I am or </input>';
  1029. iHTML += '<input type="checkbox" id="_cbMCHideMyUnfollowed" pairedWith="_cbMCHideMyFollowed">am not following</input><br><br>';
  1030.  
  1031. iHTML += '<input type="checkbox" id="_cbMCDescriptionMustBePresent" pairedWith="_cbMCDescriptionMustBeAbsent">Hide</input> or ';
  1032. iHTML += '<input type="checkbox" id="_cbMCDescriptionMustBeAbsent" pairedWith="_cbMCDescriptionMustBePresent">show</input> MCs with no description<br>';
  1033. iHTML += '<input type="checkbox" id="_cbMCCommentsMustBePresent" pairedWith="_cbMCCommentsMustBeAbsent">Hide</input> or ';
  1034. iHTML += '<input type="checkbox" id="_cbMCCommentsMustBeAbsent" pairedWith="_cbMCCommentsMustBePresent">show</input> MCs with no comments<br>';
  1035. iHTML += '<input type="checkbox" id="_cbMCExpiryMustBePresent" pairedWith="_cbMCExpiryMustBeAbsent">Hide</input> or ';
  1036. iHTML += '<input type="checkbox" id="_cbMCExpiryMustBeAbsent" pairedWith="_cbMCExpiryMustBePresent">show</input> MCs with no expiry date<br>';
  1037. iHTML += '<input type="checkbox" id="_cbMCEnableKeywordMustBePresent">Hide MCs not including </input>';
  1038. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textMCKeywordPresent"><br>';
  1039. iHTML += '<input type="checkbox" id="_cbMCEnableKeywordMustBeAbsent">Hide MCs including </input>';
  1040. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textMCKeywordAbsent"><br>';
  1041. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbMCCaseInsensitive"><i>Case-insensitive matches?</i></input><br>';
  1042. iHTML += '<input type="checkbox" id="_cbMCCreatorIDFilter">Show MCs created by user</input>';
  1043. iHTML += '<select id="_selectMCCreatorID" style="width:80%; height:22px;"></select><br>';
  1044.  
  1045. iHTML += '<br><input type="checkbox" id="_cbHideWRCMCs"><b>Hide Waze_roadclosures MCs</b></input><br>';
  1046.  
  1047. iHTML += '<br><b>Hide MCs with lock level:</b><br>';
  1048. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank0">L1</input>';
  1049. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank1">L2</input>';
  1050. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank2">L3</input>';
  1051. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank3">L4</input>';
  1052. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank4">L5</input>';
  1053. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideMCRank5">L6</input>';
  1054. iHTML += '<hr>';
  1055. iHTML += '<input type="checkbox" id="_cbMCEnhancePointMCVisibility">Enhance visibility of point MCs</input>';
  1056.  
  1057. return iHTML;
  1058. },
  1059. PopulateCams: function()
  1060. {
  1061. let iHTML = '';
  1062. iHTML = '<br><b>Show Cameras created by:</b><br>';
  1063. iHTML += '<input type="checkbox" id="_cbShowWorldCams" checked>world_* users</input><br>';
  1064. iHTML += '<input type="checkbox" id="_cbShowUSACams" checked>usa_* users</input><br>';
  1065. iHTML += '<input type="checkbox" id="_cbShowNonWorldCams" checked>other users</input><br>';
  1066.  
  1067. iHTML += '<br><b>Show Cameras touched by a specific editor:</b><br>';
  1068. iHTML += '<input type="checkbox" id="_cbShowOnlyCamsCreatedBy">Created by</input>&nbsp;/&nbsp;';
  1069. iHTML += '<input type="checkbox" id="_cbShowOnlyCamsEditedBy">edited by</input><br>';
  1070. iHTML += '<input type="text" style="font-size:14px; line-height:16px; height:22px; margin-bottom:4px;" id="_textCameraEditor"><br>';
  1071. iHTML += '<select id="_selectCameraUserID" style="width:80%; height:22px;"></select><br>';
  1072. iHTML += '<br><input type="checkbox" id="_cbShowOnlyMyCams">Show ONLY cameras created/edited by me</input><br>';
  1073.  
  1074. iHTML += '<br><b>Show Cameras by type:</b><br>';
  1075. iHTML += '<input type="checkbox" id="_cbShowSpeedCams" checked>Speed</input><br>';
  1076. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfSpeedSet" checked> with speed data</input><br>';
  1077. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfNoSpeedSet" checked> with no speed data</input><br>';
  1078. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowIfInvalidSpeedSet" checked> with invalid speed data (zoom 16+)</input><br>';
  1079. iHTML += '&nbsp;&nbsp;&nbsp;<i>NOTE: slows down WME when deselected</i><br>';
  1080. iHTML += '<input type="checkbox" id="_cbShowRedLightCams" checked>Red Light</input><br>';
  1081. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfZeroSpeedSet" checked> with speed limit = 0</input><br>';
  1082. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfNonZeroSpeedSet" checked> with speed limit > 0</input><br>';
  1083. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbShowRLCIfNoSpeedSet" checked> with no speed data</input><br>';
  1084. iHTML += '<input type="checkbox" id="_cbShowDummyCams" checked>Dummy</input><br>';
  1085.  
  1086. iHTML += '<br><b>Hide Cameras by creator:</b><br>';
  1087. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByMe">me</input>';
  1088. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank0">L1</input>';
  1089. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank1">L2</input>';
  1090. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank2">L3</input>';
  1091. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank3">L4</input>';
  1092. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank4">L5</input>';
  1093. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideCreatedByRank5">L6</input>';
  1094.  
  1095. iHTML += '<br><b>Hide Cameras by updater:</b><br>';
  1096. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByMe">me</input>';
  1097. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank0">L1</input>';
  1098. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank1">L2</input>';
  1099. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank2">L3</input>';
  1100. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank3">L4</input>';
  1101. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank4">L5</input>';
  1102. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideUpdatedByRank5">L6</input>';
  1103.  
  1104. iHTML += '<br><br><b><input type="checkbox" id="_cbHideManualLockedCams">Show only auto-locked cameras</input></b><br>';
  1105.  
  1106. iHTML += '<br><b><input type="checkbox" id="_cbHideCWLCams">Hide cameras on watchlist</input></b><br>';
  1107.  
  1108. iHTML += '<br><b><input type="checkbox" id="_cbInvertCamFilters">Invert operation of camera filters?</input></b><br>';
  1109.  
  1110. iHTML += '<b><input type="checkbox" id="_cbHighlightInsteadOfHideCams">Highlight instead of hide</input></b><br>';
  1111. return iHTML;
  1112. },
  1113. PopulateRTC: function()
  1114. {
  1115. let iHTML = '';
  1116. iHTML = '<br><b>Hide Road Closures:</b><br>';
  1117. // Hidden checkbox to avoid errors when applying settings from previous versions of the script where this was an active control...
  1118. iHTML += '<input type="checkbox" id="_cbHideUserRTCs" style="display: none;" />';
  1119.  
  1120. iHTML += '<table style="text-align:center;">';
  1121. 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>';
  1122. 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>';
  1123. 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>';
  1124. 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>';
  1125. 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>';
  1126. iHTML += '</table><br>';
  1127.  
  1128. iHTML += '<input type="checkbox" id="_cbShowMTERTCs" pairedWith="_cbHideMTERTCs">Show</input> or ';
  1129. iHTML += '<input type="checkbox" id="_cbHideMTERTCs" pairedWith="_cbShowMTERTCs">hide RTCs associated with MTE: </input>';
  1130. iHTML += '<select id="_selectRTCMTE" style="width:80%; height:22px;"></select><br>';
  1131. iHTML += '<br>';
  1132. iHTML += 'Hide if:<br>';
  1133. iHTML += '<input type="checkbox" id="_cbEnableRTCDurationFilterLessThan">Duration less than </input>';
  1134. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRTCDurationLessThan"> days<br>';
  1135. iHTML += '<input type="checkbox" id="_cbEnableRTCDurationFilterMoreThan">Duration more than </input>';
  1136. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRTCDurationMoreThan"> days<br>';
  1137. iHTML += '<br><b>Filter by date/time:</b><br>';
  1138. iHTML += '<input type="checkbox" id="_cbRTCFilterShowForTS" pairedWith="_cbRTCFilterHideForTS">Show</input> or ';
  1139. iHTML += '<input type="checkbox" id="_cbRTCFilterHideForTS" pairedWith="_cbRTCFilterShowForTS">hide</input> RTCs active at<br>';
  1140. iHTML += 'Date: <input type="number" min="1" max="31" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterDay"> / ';
  1141. iHTML += '<input type="number" min="1" max="12" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterMonth"> / ';
  1142. iHTML += '<input type="number" min="2010" max="2100" size="4" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterYear"><br>';
  1143. iHTML += 'Time: <input type="number" min="0" max="23" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterHour">:';
  1144. iHTML += '<input type="number" min="0" max="59" size="2" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputRTCFilterMin">';
  1145. return iHTML;
  1146. },
  1147. PopulateRA: function()
  1148. {
  1149. let iHTML = '';
  1150. iHTML = '<br><b>Filter Restricted Areas:</b><br>';
  1151. iHTML += '<input type="checkbox" id="_cbShowSpecificRA">Show a specific area: </input>';
  1152. iHTML += '<select id="_selectRA" style="width:80%; height:22px;"></select><br><br>';
  1153.  
  1154. iHTML += '<input type="checkbox" id="_cbRAEditorIDFilter">Show areas edited by user: </input>';
  1155. iHTML += '<select id="_selectRAEditorID" style="width:80%; height:22px;"></select><br><br>';
  1156.  
  1157. iHTML += 'Hide if:<br>';
  1158. iHTML += '<input type="checkbox" id="_cbEnableRAAgeFilterLessThan">Last modified less than </input>';
  1159. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRAAgeLessThan"> days ago<br>';
  1160. iHTML += '<input type="checkbox" id="_cbEnableRAAgeFilterMoreThan">Last modified more than </input>';
  1161. iHTML += '<input type="number" min="1" size="3" style="width:50px;line-height:14px;height:22px;margin-bottom:4px;" id="_inputFilterRAAgeMoreThan"> days ago<br>';
  1162. return iHTML;
  1163. },
  1164. PopulateMisc: function()
  1165. {
  1166. let iHTML = '';
  1167. iHTML += '<br><b><input type="checkbox" id="_cbHideSegmentsWhenRoadsHidden" />Hide segment layer when road layer is hidden</b><br>';
  1168. iHTML += '<br><b><input type="checkbox" id="_cbKillInertialPanning" />Stop inertial panning when mouse moves out of map area</b><br>';
  1169.  
  1170. iHTML += '<br><br><b><input type="checkbox" id="_cbCommentCount" />Show comment count on UR markers</b><br>';
  1171.  
  1172. iHTML += '<br><br><b><input type="checkbox" id="_cbAutoApplyClonedClosure" />Auto-apply cloned closures</b><br>';
  1173. iHTML += '<b><input type="checkbox" id="_cbAutoScrollClosureList" />Auto-scroll to end of closures</b><br>';
  1174.  
  1175. iHTML += '<br><br><b>Disable filtering above zoom level </b>';
  1176. 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>';
  1177.  
  1178. iHTML += '<br><br><b>Marker Unstacking:</b><br>';
  1179. 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>';
  1180. 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>';
  1181.  
  1182. iHTML += '<br><br><b>Popup mouse behaviour:</b><br>';
  1183. 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>';
  1184. 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>';
  1185. 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>';
  1186.  
  1187. iHTML += '<br><br><b>Disable clustering for:</b><br>';
  1188. iHTML += '<input type="checkbox" id="_cbInhibitURClusters" />URs<br>';
  1189. iHTML += '<input type="checkbox" id="_cbInhibitMPClusters" />MPs<br>';
  1190. iHTML += '<input type="checkbox" id="_cbInhibitPUClusters" />PURs<br>';
  1191. iHTML += '<input type="checkbox" id="_cbInhibitESClusters" />ESs<br>';
  1192.  
  1193. iHTML += '<br><br><b>Disable popup for:</b><br>';
  1194. iHTML += '<input type="checkbox" id="_cbInhibitURPopup" />URs<br>';
  1195. iHTML += '<input type="checkbox" id="_cbInhibitMPPopup" />MPs<br>';
  1196. ////iHTML += '<input type="checkbox" id="_cbInhibitCamPopup" />Cameras<br>';
  1197. iHTML += '<input type="checkbox" id="_cbInhibitSegPopup" />Segments<br>';
  1198. iHTML += '&nbsp;&nbsp;<input type="checkbox" id="_cbInhibitSegGenericPopup" />Speed limit info<br>';
  1199. iHTML += '<input type="checkbox" id="_cbInhibitLandmarkPopup" />Places<br>';
  1200. iHTML += '<input type="checkbox" id="_cbInhibitPUPopup" />Place Updates<br>';
  1201. iHTML += '<input type="checkbox" id="_cbInhibitMapCommentPopup" />Map Comments<br>';
  1202. iHTML += '<input type="checkbox" id="_cbInhibitNodesPopup" />Junction Nodes<br>';
  1203.  
  1204. iHTML += '<br><br><b>Date/Time formatting for popups:</b><br>';
  1205. iHTML += '<input type="checkbox" id="_cbDateFmtDDMMYY" pairedWith="_cbDateFmtMMDDYY,_cbDateFmtYYMMDD" checked />day/month/year<br>';
  1206. iHTML += '<input type="checkbox" id="_cbDateFmtMMDDYY" pairedWith="_cbDateFmtDDMMYY,_cbDateFmtYYMMDD" />month/day/year<br>';
  1207. iHTML += '<input type="checkbox" id="_cbDateFmtYYMMDD" pairedWith="_cbDateFmtMMDDYY,_cbDateFmtDDMMYY" />year/month/day<br><br>';
  1208. iHTML += '<input type="checkbox" id="_cbTimeFmt24H" pairedWith="_cbTimeFmt12H" checked />24 hour<br>';
  1209. iHTML += '<input type="checkbox" id="_cbTimeFmt12H" pairedWith="_cbTimeFmt24H" />12 hour<br><br>';
  1210. iHTML += '<i>Unticked uses browser default setting</i>';
  1211.  
  1212. iHTML += '<br><br><b><input type="checkbox" id="_cbWhiteBackground" />Use custom background colour</b><br>';
  1213. 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" />';
  1214. 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" />';
  1215. 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>';
  1216.  
  1217. iHTML += '<br><br><b>Replace "Next ..." button with "Done" for:</b><br>';
  1218. iHTML += '<input type="checkbox" id="_cbInhibitNURButton" />URs<br>';
  1219. iHTML += '<input type="checkbox" id="_cbInhibitNMPButton" />MPs<br>';
  1220. iHTML += '<input type="checkbox" id="_cbInhibitNPURButton" />PURs<br>';
  1221.  
  1222. iHTML += '<br><br><b>Disable on-click recentering for:</b><br>';
  1223. iHTML += '<input type="checkbox" id="_cbInhibitURCentering" />URs<br>';
  1224. iHTML += '<input type="checkbox" id="_cbInhibitMPCentering" />MPs<br>';
  1225. iHTML += '<input type="checkbox" id="_cbInhibitPURCentering" />PURs<br>';
  1226. iHTML += '<input type="checkbox" id="_cbInhibitPPURCentering" />PPURs<br>';
  1227. iHTML += '<input type="checkbox" id="_cbInhibitRPURCentering" />RPURs<br>';
  1228.  
  1229. iHTML += '<br><br><b><input type="checkbox" id="_cbHideAMLayer" />Hide Area Manager polygons</b><br>';
  1230. iHTML += '<b><input type="checkbox" id="_cbMoveAMList" />Show AMs in topbar when AM layer is active</b><br>';
  1231. iHTML += 'Hide areas for AM levels:<br>';
  1232. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAMA-L1">L1</input>';
  1233. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAMA-L2">L2</input>';
  1234. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAMA-L3">L3</input>';
  1235. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAMA-L4">L4</input>';
  1236. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAMA-L5">L5</input>';
  1237. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAMA-L6">L6</input>';
  1238. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbHideAMA-L7">L7</input><br>';
  1239. iHTML += 'Hide areas by age:<br>';
  1240. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbEnableAMAMinAgeFilter">Less than </input>';
  1241. 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>';
  1242. iHTML += '&nbsp;&nbsp;&nbsp;<input type="checkbox" id="_cbEnableAMAMaxAgeFilter">More than </input>';
  1243. 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>';
  1244.  
  1245. iHTML += '<br><b><input type="checkbox" id="_cbDisablePlacesFiltering" />Disable Places filtering</b><br>';
  1246.  
  1247. iHTML += '<br><br><b>Settings backup/restore/reset:</b><br>';
  1248. iHTML += '<input type="button" id="_btnSettingsToText" value="Backup" />&nbsp;&nbsp;&nbsp;';
  1249. iHTML += '<input type="button" id="_btnTextToSettings" value="Restore" />&nbsp;&nbsp;|&nbsp;&nbsp;';
  1250. iHTML += '<input type="button" id="_btnResetSettings" value="Reset" /><br><br>';
  1251. iHTML += '<textarea id="_txtSettings" value=""></textarea><br>';
  1252. iHTML += '<input type="button" id="_btnClearSettingsText" value="Clear" /><br>';
  1253.  
  1254. /*
  1255. iHTML += '<br><br><b>Debug:</b><br>';
  1256. iHTML += '<input type="button" id="_btnDebugToScreen" value="Show debug data" />';
  1257. */
  1258. return iHTML;
  1259. },
  1260. ActiveTab: function(_id)
  1261. {
  1262. let e = document.getElementById(_id);
  1263. e.style.backgroundColor = "greenyellow";
  1264. e.style.borderTop = "1px solid";
  1265. e.style.borderLeft = "1px solid";
  1266. e.style.borderRight = "1px solid";
  1267. e.style.borderBottom = "0px solid";
  1268. },
  1269. InactiveTab: function(_id)
  1270. {
  1271. let e = document.getElementById(_id);
  1272. e.style.backgroundColor = "gainsboro";
  1273. e.style.borderTop = "0px solid";
  1274. e.style.borderLeft = "0px solid";
  1275. e.style.borderRight = "0px solid";
  1276. e.style.borderBottom = "1px solid";
  1277. },
  1278. InactiveAllTabs: function()
  1279. {
  1280. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1281. {
  1282. uroTabs.InactiveTab(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABHEADER]);
  1283. uroTabs.SetStyleDisplay(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY], 'none');
  1284. }
  1285. },
  1286. ShowTab: function(tabID)
  1287. {
  1288. uroTabs.InactiveAllTabs();
  1289. uroTabs.ActiveTab(uroTabs.CtrlTabs[tabID][uroTabs.FIELDS.TABHEADER]);
  1290. uroTabs.SetStyleDisplay(uroTabs.CtrlTabs[tabID][uroTabs.FIELDS.TABBODY], 'block');
  1291. return false;
  1292. },
  1293. ShowURs: function()
  1294. {
  1295. uroTabs.ShowTab(uroTabs.IDS.URS);
  1296. return false;
  1297. },
  1298. ShowMPs: function()
  1299. {
  1300. uroTabs.ShowTab(uroTabs.IDS.MPS);
  1301. return false;
  1302. },
  1303. ShowMCs: function()
  1304. {
  1305. uroTabs.ShowTab(uroTabs.IDS.MCS);
  1306. return false;
  1307. },
  1308. ShowPlaces: function()
  1309. {
  1310. uroTabs.ShowTab(uroTabs.IDS.PLACES);
  1311. for(let idx=0;idx<uroPlacesGroupsCollapsed.length;idx++)
  1312. {
  1313. uroPlacesGroupCEHandler(idx);
  1314. }
  1315. return false;
  1316. },
  1317. ShowCams: function()
  1318. {
  1319. uroTabs.ShowTab(uroTabs.IDS.CAMS);
  1320. return false;
  1321. },
  1322. ShowMisc: function()
  1323. {
  1324. uroTabs.ShowTab(uroTabs.IDS.MISC);
  1325. return false;
  1326. },
  1327. ShowRTCs: function()
  1328. {
  1329. uroTabs.ShowTab(uroTabs.IDS.RTCS);
  1330. return false;
  1331. },
  1332. ShowRAs: function()
  1333. {
  1334. uroTabs.ShowTab(uroTabs.IDS.RAS);
  1335. return false;
  1336. },
  1337. ClickURs: function()
  1338. {
  1339. uroFilterURs();
  1340. },
  1341. ClickMPs: function()
  1342. {
  1343. uroFilterProblems();
  1344. },
  1345. ClickMCs: function()
  1346. {
  1347. uroFilterMapComments();
  1348. uroLayers.MCLayerChanged();
  1349. },
  1350. ClickPlaces: function()
  1351. {
  1352. uroFilterPlaces();
  1353. },
  1354. ClickCams: function()
  1355. {
  1356. uroFilterCameras();
  1357. },
  1358. ClickMisc: function()
  1359. {
  1360. uroFilterItems();
  1361. uroUITweaks.ChangeMapBGColour();
  1362. uroUITweaks.HideAMLayer();
  1363. uroUITweaks.HideSegments();
  1364. uroUITweaks.ChangeClustering();
  1365. },
  1366. ClickRTCs: function()
  1367. {
  1368. uroFilterRTCs();
  1369. uroClosureListHandler();
  1370. },
  1371. ClickRAs: function()
  1372. {
  1373. uroFilterRAs();
  1374. },
  1375. CreateTabHeaders: function()
  1376. {
  1377. uroTabs.CtrlTabs =
  1378. [
  1379. ['_tabURs', null, '_linkURs', 'URs', uroTabs.ShowURs, uroTabs.ClickURs, 'UROverviewUROptions', uroTabs.PopulateUR],
  1380. ['_tabMPs', null, '_linkMPs', 'MPs', uroTabs.ShowMPs, uroTabs.ClickMPs, 'UROverviewMPOptions', uroTabs.PopulateMP],
  1381. ['_tabMCs', null, '_linkMCs', 'MCs', uroTabs.ShowMCs, uroTabs.ClickMCs, 'UROverviewMCOptions', uroTabs.PopulateMC],
  1382. ['_tabRTCs', null, '_linkRTCs', 'RTCs', uroTabs.ShowRTCs, uroTabs.ClickRTCs, 'UROverviewRTCOptions', uroTabs.PopulateRTC],
  1383. ['_tabRAs', null, '_linkRAs', 'RAs', uroTabs.ShowRAs, uroTabs.ClickRAs, 'UROverviewRAOptions', uroTabs.PopulateRA],
  1384. ['_tabPlaces', null, '_linkPlaces', 'Places', uroTabs.ShowPlaces, uroTabs.ClickPlaces, 'UROverviewPlacesOptions', uroTabs.PopulatePlaces],
  1385. ////['_tabCams', null, '_linkCams', 'Cams', uroTabs.ShowCams, uroTabs.ClickCams, 'UROverviewCameraOptions', uroTabs.PopulateCams],
  1386. ['_tabMisc', null, '_linkMisc', 'Misc', uroTabs.ShowMisc, uroTabs.ClickMisc, 'UROverviewMiscOptions', uroTabs.PopulateMisc]
  1387. ];
  1388.  
  1389. let i;
  1390. let tabsTotal = uroTabs.CtrlTabs.length;
  1391. let tabsPerRow = Math.ceil(tabsTotal / Math.ceil(tabsTotal / uroTabs.MAX_PER_ROW));
  1392. let tabCount = 0;
  1393. let tabbyHTML = '';
  1394. for(i = 0; i < tabsTotal; ++i)
  1395. {
  1396. if(tabCount == 0)
  1397. {
  1398. tabbyHTML += '<table border=0 width="100%"><tr>';
  1399. }
  1400. tabbyHTML += '<td valign="center" align="center" id="'+uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABHEADER]+'">';
  1401. 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>';
  1402. if(((++tabCount == tabsPerRow) && (i < (tabsTotal - 1))) || (i == (tabsTotal - 1)))
  1403. {
  1404. tabbyHTML += '</tr></table>';
  1405. tabCount = 0;
  1406. }
  1407. }
  1408. return tabbyHTML;
  1409. },
  1410. CreateTabBodies: function()
  1411. {
  1412. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1413. {
  1414. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY] = document.createElement('div');
  1415. }
  1416. },
  1417. AddToDOM: function()
  1418. {
  1419. let i;
  1420. for(i = 0; i < uroTabs.CtrlTabs.length; ++i)
  1421. {
  1422. if(uroTabs.CtrlTabs[i][uroTabs.FIELDS.POPULATEFN] != null)
  1423. {
  1424. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY].innerHTML = uroTabs.CtrlTabs[i][uroTabs.FIELDS.POPULATEFN]();
  1425. }
  1426. document.getElementById('uroControlsContainer').appendChild(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  1427. uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY].onclick = uroTabs.CtrlTabs[i][uroTabs.FIELDS.CLICKFN];
  1428. }
  1429. }
  1430. };
  1431. const uroDBG = // debug output handling
  1432. {
  1433. // true enables debug output during script startup
  1434. showDebugOutput: true,
  1435. // true keeps debug output enabled after script startup
  1436. persistentDebugOutput: false,
  1437. // true enables performance monitoring debug output
  1438. performanceMonitoringOutput: false,
  1439.  
  1440. recentDebug: [],
  1441.  
  1442. Add: function(debugtext)
  1443. {
  1444. let ts = Math.round(performance.now());
  1445. if(uroDBG.recentDebug.length == 100)
  1446. {
  1447. uroDBG.recentDebug.shift();
  1448. }
  1449. uroDBG.recentDebug.push(ts+': '+debugtext);
  1450. console.debug('URO+DBG '+ts+':'+debugtext);
  1451. },
  1452. Dump: function()
  1453. {
  1454. if(uroDBG.recentDebug.length > 0)
  1455. {
  1456. document.getElementById('WazeMap').innerHTML = uroUtils.ModifyHTML('<textarea id="uroDbgOutput" style="width:100%;height:100%">');
  1457. let dbgOutput = '';
  1458. for(let i = 0; i < uroDBG.recentDebug.length; i++)
  1459. {
  1460. dbgOutput += uroDBG.recentDebug[i]+'\n';
  1461. }
  1462. document.getElementById('uroDbgOutput').textContent = dbgOutput;
  1463. }
  1464. },
  1465. Toggle: function()
  1466. {
  1467. uroDBG.showDebugOutput = !uroDBG.showDebugOutput;
  1468. let dbgMode = "none";
  1469. if(uroDBG.showDebugOutput)
  1470. {
  1471. dbgMode = "inline";
  1472. }
  1473. document.getElementById('_uroDebugMode').style.display = dbgMode;
  1474. },
  1475. PerfMon: function(source, ts)
  1476. {
  1477. if(uroDBG.performanceMonitoringOutput === true)
  1478. {
  1479. console.log(source+': '+(performance.now() - ts));
  1480. }
  1481. },
  1482. AddLog: function(logtext)
  1483. {
  1484. if(uroDBG.showDebugOutput) console.log('URO+: '+Date()+' '+logtext);
  1485. }
  1486. };
  1487. const uroAFN = // area friendly name functions
  1488. {
  1489. friendlyNames: [],
  1490. hoverTime: -1,
  1491. hoverObj: null,
  1492. overlayShown: false,
  1493. editHovered: false,
  1494. editBox: null,
  1495. friendlyAreaNames: null,
  1496. AFNObject: function(fName, area, server)
  1497. {
  1498. this.fName = fName;
  1499. this.area = area;
  1500. this.server = server;
  1501. },
  1502. UpdateName: function(name, server, area)
  1503. {
  1504. let foundExisting = false;
  1505. for(let i = 0; i < uroAFN.friendlyNames.length; i++)
  1506. {
  1507. if((uroAFN.friendlyNames[i].server == server) && (uroAFN.friendlyNames[i].area == area))
  1508. {
  1509. if(name === "")
  1510. {
  1511. this.friendlyNames.splice(i, 1);
  1512. foundExisting = true;
  1513. }
  1514. else
  1515. {
  1516. uroAFN.friendlyNames[i].fName = name;
  1517. foundExisting = true;
  1518. }
  1519. }
  1520. }
  1521. if((foundExisting === false) && (name !== ""))
  1522. {
  1523. uroAFN.friendlyNames.push(new uroAFN.AFNObject(name, area, server));
  1524. }
  1525. uroAFN.ReplaceAreaNames(true);
  1526. },
  1527. AreaNameHover: function()
  1528. {
  1529. if((uroAFN.hoverObj === null) || (uroAFN.hoverObj != this))
  1530. {
  1531. uroAFN.hoverTime = 0;
  1532. }
  1533. uroAFN.hoverObj = this;
  1534. },
  1535. AreaNameUnHover: function()
  1536. {
  1537. if(uroAFN.editHovered === true)
  1538. {
  1539. return false;
  1540. }
  1541. if(uroAFN.overlayShown)
  1542. {
  1543. uroAFN.hoverObj.removeChild(uroAFN.editBox);
  1544. }
  1545. uroAFN.hoverObj = null;
  1546. uroAFN.hoverTime = -1;
  1547. uroAFN.overlayShown = false;
  1548. },
  1549. EditHover: function()
  1550. {
  1551. uroAFN.editHovered = true;
  1552. uroUtils.AddEventListener('uroANEditBox', 'mouseout', uroAFN.EditUnHover, false);
  1553. uroUtils.AddEventListener('uroANEditBox', 'click', uroAFN.EditClick, false);
  1554. },
  1555. EditUnHover: function()
  1556. {
  1557. let newName = document.getElementById('_textAreaName').value;
  1558. // sanitise name to avoid conflicts with config storage delimiters...
  1559. newName = newName.replace(',','');
  1560. newName = newName.replace(':','');
  1561. let server = W.app.getAppRegionCode();
  1562. let area = uroAFN.GetAreaArea(uroAFN.hoverObj.parentNode.children[1].innerText);
  1563. uroAFN.hoverObj.removeChild(uroAFN.editBox);
  1564. uroAFN.overlayShown = false;
  1565. uroAFN.editHovered = false;
  1566. uroAFN.UpdateName(newName, server, area);
  1567. },
  1568. EditClick: function(e)
  1569. {
  1570. // this traps the click to prevent it falling through to the underlying area name element and
  1571. // potentially causing the map view to be relocated to that area...
  1572. e.stopPropagation();
  1573. },
  1574. GetAreaArea: function(area)
  1575. {
  1576. area = parseFloat(area.split(' ')[0]);
  1577. return area;
  1578. },
  1579. OverlaySetup: function()
  1580. {
  1581. uroAFN.overlayShown = true;
  1582. uroAFN.editBox = document.createElement('div');
  1583. uroAFN.editBox.id = "uroANEditBox";
  1584. uroAFN.editBox.style.position = "absolute";
  1585. uroAFN.editBox.style.top = '0px';
  1586. uroAFN.editBox.style.left = '0px';
  1587. uroAFN.editBox.style.width = "99%";
  1588. uroAFN.hoverObj.appendChild(uroAFN.editBox);
  1589. uroAFN.editBox.onmouseover = uroAFN.EditHover();
  1590. let existingName = uroAFN.hoverObj.innerHTML;
  1591. let italicTagPos = existingName.indexOf(' <i>');
  1592. if(italicTagPos == -1)
  1593. {
  1594. existingName = "";
  1595. }
  1596. else
  1597. {
  1598. existingName = existingName.substr(0,italicTagPos);
  1599. }
  1600. uroAFN.editBox.innerHTML = uroUtils.ModifyHTML('<input type="text" style="font-size:14px; line-height:16px; height:22px; width:100%" id="_textAreaName" value="'+existingName+'">');
  1601. },
  1602. ReplaceAreaNames: function(replaceAfterNameChange)
  1603. {
  1604. if(document.getElementById('sidepanel-areas') === undefined)
  1605. {
  1606. return;
  1607. }
  1608. if(document.getElementById('sidepanel-areas').getElementsByClassName('result-list').length === 0)
  1609. {
  1610. return;
  1611. }
  1612. if(replaceAfterNameChange === false)
  1613. {
  1614. if(document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0].id == "friendlyNamed")
  1615. {
  1616. return;
  1617. }
  1618. }
  1619. let panelRootObj = document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0];
  1620. if(panelRootObj === undefined)
  1621. {
  1622. // we get here if the user doesn't have any areas defined...
  1623. return;
  1624. }
  1625. let areaNameObjs = panelRootObj.getElementsByClassName('list-item-card-info');
  1626. if(areaNameObjs.length === 0)
  1627. {
  1628. return;
  1629. }
  1630. let localisedManagedArea = I18n.lookup("user.areas.managed_area");
  1631. for(let loop=0; loop < areaNameObjs.length; loop++)
  1632. {
  1633. if(areaNameObjs[loop].children.length === 2)
  1634. {
  1635. let title = areaNameObjs[loop].children[0].innerText;
  1636. if(title.indexOf(localisedManagedArea) > -1)
  1637. {
  1638. let area = uroAFN.GetAreaArea(areaNameObjs[loop].children[1].innerText);
  1639. areaNameObjs[loop].children[0].innerHTML = uroUtils.ModifyHTML(localisedManagedArea);
  1640. for(let fnIdx=0; fnIdx < uroAFN.friendlyNames.length; fnIdx++)
  1641. {
  1642. let fnObj = uroAFN.friendlyNames[fnIdx];
  1643. if((fnObj.area == area) && (fnObj.server == W.app.getAppRegionCode()))
  1644. {
  1645. areaNameObjs[loop].children[0].innerHTML = uroUtils.ModifyHTML(fnObj.fName +' <i>('+localisedManagedArea+')</i>');
  1646. break;
  1647. }
  1648. }
  1649. let titleObj = areaNameObjs[loop].getElementsByClassName('list-item-card-title')[0];
  1650. titleObj.addEventListener("mouseover", uroAFN.AreaNameHover, false);
  1651. titleObj.addEventListener("mouseout", uroAFN.AreaNameUnHover, false);
  1652. titleObj.style.cursor = "text";
  1653. }
  1654. }
  1655. }
  1656. document.getElementById('sidepanel-areas').getElementsByClassName('result-list')[0].id = "friendlyNamed";
  1657. },
  1658. ApplyNames: function()
  1659. {
  1660. let objects = localStorage.UROverviewFriendlyAreaNames.split(':');
  1661. uroAFN.friendlyNames = [];
  1662. for(let objIdx=0;objIdx<objects.length;objIdx++)
  1663. {
  1664. let fields = objects[objIdx].split(',');
  1665. uroAFN.friendlyNames.push(new uroAFN.AFNObject(fields[0],parseFloat(fields[1]),fields[2]));
  1666. }
  1667. uroAFN.ReplaceAreaNames(true);
  1668. }
  1669. };
  1670. const uroMarkers = // marker-related function
  1671. {
  1672. elm : null,
  1673. obj : null,
  1674. id : null,
  1675. type : null,
  1676. lastOver : null,
  1677.  
  1678. mouseX : null,
  1679. mouseY : null,
  1680. mouseButtons : null,
  1681. clientX : null,
  1682. clientY : null,
  1683. armHover : false,
  1684. entryTimeout : null,
  1685. inhibitSetCenter : false,
  1686. clickedOnCenter : null,
  1687. clickedOnID : null,
  1688.  
  1689. EntryTimeout: function()
  1690. {
  1691. uroMarkers.armHover = false;
  1692. if(uroMarkers.lastOver !== null)
  1693. {
  1694. if(uroMarkers.type === 'cam')
  1695. {
  1696. if(uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams') === true)
  1697. {
  1698. if(uroMarkers.lastOver !== uroMarkers.id)
  1699. {
  1700. window.setTimeout(uroFilterCameras, 50);
  1701. }
  1702. }
  1703. }
  1704. else if((uroMarkers.type == uroLayers.ID.UR) || (uroMarkers.type == uroLayers.ID.MP))
  1705. {
  1706. if(uroMarkers.type == uroLayers.ID.UR) uroHoveredURID = uroMarkers.id;
  1707. }
  1708.  
  1709. uroDBG.AddLog('hover over marker (Type ' + uroMarkers.type + ' / ID ' + uroMarkers.id + ')');
  1710. uroPopup.Generate();
  1711. }
  1712. },
  1713. MouseMove: function(e)
  1714. {
  1715. uroMarkers.buttons = e.buttons;
  1716. uroMarkers.mouseX = e.pageX - document.getElementById('map').getBoundingClientRect().left;
  1717. uroMarkers.mouseY = e.pageY - document.getElementById('map').getBoundingClientRect().top;
  1718. uroMarkers.clientX = e.clientX;
  1719. uroMarkers.clientY = e.clientY;
  1720.  
  1721. if(uroMarkers.armHover === true)
  1722. {
  1723. let eto = uroUtils.GetElmValue('_inputPopupEntryTimeout') * 100;
  1724. if(uroMarkers.entryTimeout !== null)
  1725. {
  1726. window.clearTimeout(uroMarkers.entryTimeout);
  1727. }
  1728. uroMarkers.entryTimeout = window.setTimeout(uroMarkers.EntryTimeout, eto);
  1729. }
  1730. },
  1731. TranslateType: function(ft)
  1732. {
  1733. const TLU =
  1734. [
  1735. ["mapProblem", uroLayers.ID.MP],
  1736. ["mapUpdateRequest", uroLayers.ID.UR],
  1737. ["placeUpdate", uroLayers.ID.PUR],
  1738. ["segmentSuggestionGeoIcon", uroLayers.ID.SegSug],
  1739. ["camera", "cam"],
  1740. ["node", "node"],
  1741. ["comment", "comment"],
  1742. ["venue", "venue"],
  1743. ["segment", "segment"]
  1744. ];
  1745.  
  1746. let retval = null;
  1747. for(let i = 0; i < TLU.length; ++i)
  1748. {
  1749. if(ft == TLU[i][0])
  1750. {
  1751. retval = TLU[i][1];
  1752. break;
  1753. }
  1754. }
  1755. return retval;
  1756. },
  1757. MouseOver: function(e)
  1758. {
  1759. let elm = null;
  1760. let obj = null;
  1761. let id = null;
  1762. let markerType = null;
  1763. let ft = e?.feature?.attributes?.wazeFeature?.featureType;
  1764. if(ft !== undefined)
  1765. {
  1766. // single marker...
  1767. obj = e.feature.attributes.wazeFeature._wmeObject;
  1768. elm = W.userscripts.getMapElementByDataModel(obj);
  1769. id = e.feature.attributes.wazeFeature.id;
  1770. markerType = uroMarkers.TranslateType(ft);
  1771.  
  1772. uroMarkers.elm = elm;
  1773. uroMarkers.obj = obj;
  1774. uroMarkers.id = id;
  1775. uroMarkers.type = markerType;
  1776. uroMarkers.lastOver = id;
  1777. uroMarkers.armHover = true;
  1778.  
  1779. uroMarkers.AddMarkerEventHandler();
  1780. }
  1781. /*
  1782. else
  1783. {
  1784. if(e?.feature?.cluster !== undefined)
  1785. {
  1786. // cluster marker...
  1787. let cm = e.feature.cluster;
  1788. if(cm.length > 0)
  1789. {
  1790. // clusters are always of the same type, so just need to check the
  1791. // first marker within the cluster to see what the type is for all
  1792. // of them...
  1793. ft = cm[0].attributes.wazeFeature.featureType;
  1794. markerType = uroMarkers.TranslateType(ft);
  1795.  
  1796. console.debug("Cluster Marker:");
  1797. console.debug(" Type = " + ft);
  1798. console.debug(" Cluster size = " + cm.length);
  1799. console.debug(e);
  1800. }
  1801. }
  1802. }
  1803. */
  1804. },
  1805. MouseOver2: function(e)
  1806. {
  1807. let elm = null;
  1808. let obj = null;
  1809. let id = null;
  1810. let markerType = null;
  1811. let ft = e?.currentTarget?.attributes?.class?.value;
  1812. if(ft !== undefined)
  1813. {
  1814. elm = e.currentTarget;
  1815. if(ft.indexOf("permanentHazardMarker") !== -1)
  1816. {
  1817. elm = elm.parentNode;
  1818. markerType = "phCam";
  1819. }
  1820. obj = W.userscripts.getDataModelByMapElement(elm);
  1821. id = elm.attributes["data-id"].value;
  1822.  
  1823. console.debug(ft);
  1824. console.debug(id);
  1825.  
  1826. uroMarkers.elm = elm;
  1827. uroMarkers.obj = obj;
  1828. uroMarkers.id = id;
  1829. uroMarkers.type = markerType;
  1830. uroMarkers.lastOver = id;
  1831. uroMarkers.armHover = true;
  1832. }
  1833. },
  1834. MouseOut: function()
  1835. {
  1836. uroMarkers.lastOver = null;
  1837. if(uroMarkers.type !== null)
  1838. {
  1839. if(uroMarkers.type === 'cam')
  1840. {
  1841. if(uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams') === true)
  1842. {
  1843. window.setTimeout(uroFilterCameras, 50);
  1844. }
  1845. }
  1846. uroDBG.AddLog('hover off '+uroMarkers.type+' ID '+uroMarkers.id);
  1847. uroHoveredURID = null;
  1848.  
  1849. uroFID = -1;
  1850. if(uroStackType !== null)
  1851. {
  1852. let tStackType = uroStackType;
  1853. uroRestackMarkers();
  1854. if(tStackType == 1)
  1855. {
  1856. uroFilterURs();
  1857. }
  1858. else if(tStackType == 2)
  1859. {
  1860. uroFilterProblems();
  1861. }
  1862. else if(tStackType == 3)
  1863. {
  1864. uroFilterPlaces();
  1865. }
  1866. }
  1867.  
  1868. if(uroPopup.timer == -1)
  1869. {
  1870. uroPopup.timer = uroUtils.GetElmValue('_inputPopupExitTimeout');
  1871. }
  1872. }
  1873. else
  1874. {
  1875. uroDBG.AddLog('hover off unknown object...');
  1876. }
  1877. },
  1878. MouseOut2: function()
  1879. {
  1880. uroMarkers.lastOver = null;
  1881. if(uroMarkers.type !== null)
  1882. {
  1883. uroDBG.AddLog('hover off '+uroMarkers.type+' ID '+uroMarkers.id);
  1884. uroHoveredURID = null;
  1885. uroFID = -1;
  1886. if(uroPopup.timer == -1)
  1887. {
  1888. uroPopup.timer = uroUtils.GetElmValue('_inputPopupExitTimeout');
  1889. }
  1890. }
  1891. else
  1892. {
  1893. uroDBG.AddLog('hover off unknown object...');
  1894. }
  1895. },
  1896. MouseDown: function()
  1897. {
  1898. // Do this stuff in the mousedown event rather than the click event so we fire before any of the native
  1899. // click events - we need to ensure this happens for inhibiting marker centering, as we need to capture
  1900. // the markerType ahead of our interceptor function being called to deal with the centering...
  1901. if(uroMarkers.type !== null)
  1902. {
  1903. uroDBG.AddLog('clicked on '+uroMarkers.type+' marker '+uroMarkers.id);
  1904. uroMarkers.clickedOnID = uroMarkers.id;
  1905. uroMarkers.clickedOnCenter = W.map.getCenter();
  1906. uroInhibitURFiltering = true;
  1907. if(uroMarkers.inhibitSetCenter === false)
  1908. {
  1909. if(uroMarkers.Decentre() === true)
  1910. {
  1911. uroMarkers.inhibitSetCenter = true;
  1912. }
  1913. }
  1914. }
  1915. },
  1916. Decentre: function()
  1917. {
  1918. let inhibit = false;
  1919. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.UR) && (uroUtils.GetCBChecked("_cbInhibitURCentering")));
  1920. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.MP) && (uroUtils.GetCBChecked("_cbInhibitMPCentering")));
  1921. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.PUR) && (uroUtils.GetCBChecked("_cbInhibitPURCentering")));
  1922. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.PPUR) && (uroUtils.GetCBChecked("_cbInhibitPPURCentering")));
  1923. inhibit = inhibit || ((uroMarkers.type == uroLayers.ID.RPUR) && (uroUtils.GetCBChecked("_cbInhibitRPURCentering")));
  1924. return inhibit;
  1925. },
  1926. RegisterEvents: function()
  1927. {
  1928. for(let i = 0; i < uroLayers.layers.length; ++i)
  1929. {
  1930. if(uroLayers.layers[i].regEvt === true)
  1931. {
  1932. if((uroLayers.layers[i].isFeature === true) || (uroLayers.layers[i].isFeature === null))
  1933. {
  1934. if(uroLayers.layers[i].l !== undefined)
  1935. {
  1936. uroLayers.layers[i].l.events.listeners["fe-feature-in"].push({func: uroMarkers.MouseOver});
  1937. uroLayers.layers[i].l.events.listeners["fe-feature-out"].push({func: uroMarkers.MouseOut});
  1938. }
  1939. else
  1940. {
  1941. console.debug(uroLayers[i]);
  1942. }
  1943. }
  1944. else if(uroLayers.layers[i].isFeature === false)
  1945. {
  1946. for(let j = 0; j < uroLayers.layers[i].mf.length; ++j)
  1947. {
  1948. let mMarker = uroLayers.layers[i].mf[j];
  1949. if(mMarker !== null)
  1950. {
  1951. let mIcon = null;
  1952. if(mMarker.element !== undefined)
  1953. {
  1954. if(uroLayers.layers[i].moChild === true)
  1955. {
  1956. mIcon = mMarker.element.firstChild;
  1957. }
  1958. else
  1959. {
  1960. mIcon = mMarker.element;
  1961. }
  1962. }
  1963. else if(mMarker.geometry !== undefined)
  1964. {
  1965. mIcon = document.querySelector('#'+mMarker.geometry.id);
  1966. }
  1967. else if(mMarker.tagName === "image")
  1968. {
  1969. mIcon = mMarker;
  1970. }
  1971. if((mIcon !== null) && (mIcon !== undefined))
  1972. {
  1973. mIcon.addEventListener("mouseover", uroMarkers.MouseOver2, true);
  1974. mIcon.addEventListener("mouseout", uroMarkers.MouseOut2, true);
  1975. }
  1976. }
  1977. }
  1978. }
  1979. }
  1980. }
  1981. },
  1982. AddMarkerEventHandler: function()
  1983. {
  1984. if
  1985. (
  1986. (uroMarkers.type === uroLayers.ID.UR) ||
  1987. (uroMarkers.type === uroLayers.ID.MP) ||
  1988. (uroMarkers.type === uroLayers.ID.PUR) ||
  1989. (uroMarkers.type === uroLayers.ID.PPUR) ||
  1990. (uroMarkers.type === uroLayers.ID.RPUR)
  1991. )
  1992. {
  1993. let mMarker = uroGetMarker(uroMarkers.type, uroMarkers.id);
  1994. if(mMarker !== null)
  1995. {
  1996. let mIcon = null;
  1997. if(mMarker.element !== undefined)
  1998. {
  1999. mIcon = mMarker.element;
  2000. }
  2001. else if(mMarker.geometry !== undefined)
  2002. {
  2003. mIcon = document.querySelector('#'+mMarker.geometry.id);
  2004. }
  2005. else if(mMarker.tagName === "image")
  2006. {
  2007. mIcon = mMarker;
  2008. }
  2009. if((mIcon !== null) && (mIcon !== undefined))
  2010. {
  2011. mIcon.addEventListener("mousedown", uroMarkers.MouseDown, false);
  2012. }
  2013. }
  2014. }
  2015. }
  2016. };
  2017. const uroLayers = // layer functions
  2018. {
  2019. // -----------------------------------------------------------------
  2020. // NOTE CAREFULLY!
  2021. // The contents of layers and ID MUST, MUST, MUST, remain
  2022. // in sync at all times...
  2023. layers :
  2024. [
  2025. {name: "update_requests", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2026. {name: "mapProblems", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2027. {name: "place_updates", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2028. {name: "PARKING_PLACE_UPDATES", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2029. {name: "RESIDENTIAL_PLACE_UPDATES", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2030. {name: "closures", l: null, mf: null, isFeature: null, MO: null, regEvt: false, moChild: false, getMF: true},
  2031. {name: "nodes", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2032. {name: "segments", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2033. {name: "venues", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2034. {name: "mapComments", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2035. {name: "permanent_hazard_camera", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: false},
  2036. {name: "closure_nodes", l: null, mf: null, isFeature: null, MO: null, regEvt: false, moChild: false, getMF: true},
  2037. {name: "turn_closure", l: null, mf: null, isFeature: null, MO: null, regEvt: false, moChild: false, getMF: true},
  2038. {name: "segment_suggestions_markers", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2039. {name: "edit_suggestions_markers", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: false, getMF: true},
  2040. {name: "permanent_hazard_camera_markers", l: null, mf: null, isFeature: null, MO: null, regEvt: true, moChild: true, getMF: true}
  2041. ],
  2042. ID :
  2043. {
  2044. UR: 0,
  2045. MP: 1,
  2046. PUR: 2,
  2047. PPUR: 3,
  2048. RPUR: 4,
  2049. RTC: 5,
  2050. node: 6,
  2051. seg: 7,
  2052. venue: 8,
  2053. MC: 9,
  2054. cam: 10,
  2055. RTCnode: 11,
  2056. TRTCnode: 12,
  2057. SegSug: 13,
  2058. EditSug: 14,
  2059. phCamera: 15
  2060. },
  2061. // -----------------------------------------------------------------
  2062.  
  2063. BlobMouseOut: function()
  2064. {
  2065. let blobType = this.attributes.uroBlobType;
  2066. if(blobType !== undefined)
  2067. {
  2068. let blobID = this.attributes.uroBlobID;
  2069. uroDBG.AddLog('hover off '+blobType+' ID '+blobID);
  2070. if(blobType == 'map_comment')
  2071. {
  2072. if(W.model.mapComments.objects[blobID] != undefined)
  2073. {
  2074. let geoID = W.model.mapComments.objects[blobID].attributes.geometry.id;
  2075. if(geoID.indexOf('Point') != -1)
  2076. {
  2077. // reapply visibility mods
  2078. let svgElm = document.getElementById(uroMCLayer.div.id+'_vroot');
  2079. for(let svgIdx = 0; svgIdx < svgElm.children.length; svgIdx++)
  2080. {
  2081. if(svgElm.children[svgIdx].id === geoID)
  2082. {
  2083. window.setTimeout(uroLayers.ReapplyPointMCVisibilityMods,10);
  2084. }
  2085. }
  2086. }
  2087. }
  2088. }
  2089. }
  2090. else
  2091. {
  2092. uroDBG.AddLog('hover off unknown blob...');
  2093. }
  2094. },
  2095. MCLayerChanged_changed: function()
  2096. {
  2097. uroLayers.MCLayerChanged();
  2098. },
  2099. MCLayerChanged_added: function()
  2100. {
  2101. uroLayers.MCLayerChanged();
  2102. },
  2103. MCLayerChanged_removed: function()
  2104. {
  2105. uroLayers.MCLayerChanged();
  2106. },
  2107. ReapplyPointMCVisibilityMods: function()
  2108. {
  2109. if(uroLayers.ApplyPointMCVisibilityMods() === false)
  2110. {
  2111. window.setTimeout(uroLayers.ReapplyPointMCVisibilityMods,100);
  2112. }
  2113. },
  2114. ApplyPointMCVisibilityMods: function()
  2115. {
  2116. let retval = true;
  2117. if(uroLayers.HasSelectedMCs() === true)
  2118. {
  2119. retval = false;
  2120. }
  2121. else
  2122. {
  2123. let svgElm = document.getElementById(uroMCLayer.div.id+'_vroot');
  2124. for(let svgIdx = 0; svgIdx < svgElm.children.length; svgIdx++)
  2125. {
  2126. let svgChild = svgElm.children[svgIdx];
  2127. if(svgChild.id.indexOf('Point') != -1)
  2128. {
  2129. if(uroUtils.GetCBChecked('_cbMCEnhancePointMCVisibility') === true)
  2130. {
  2131. if(svgChild.getAttribute('r') == 6)
  2132. {
  2133. svgChild.setAttribute('fill','#ffff00');
  2134. svgChild.setAttribute('fill-opacity',0.75);
  2135. svgChild.setAttribute('r',12);
  2136. svgChild.setAttribute('touchedByURO',true);
  2137. }
  2138. else if((svgChild.getAttribute('touchedByURO') === "true")&&(svgChild.getAttribute('fill') === '#ffff00'))
  2139. {
  2140. // do nothing...
  2141. }
  2142. else
  2143. {
  2144. retval = false;
  2145. break;
  2146. }
  2147. }
  2148. else
  2149. {
  2150. if((svgChild.getAttribute('touchedByURO') === "true")&&(svgChild.getAttribute('fill') === '#ffff00'))
  2151. {
  2152. svgChild.setAttribute('fill','#ffffff');
  2153. svgChild.setAttribute('fill-opacity',1);
  2154. svgChild.setAttribute('r',6);
  2155. svgChild.setAttribute('touchedByURO',false);
  2156. }
  2157. }
  2158. }
  2159. }
  2160. }
  2161. return retval;
  2162. },
  2163. HasSelectedMCs: function()
  2164. {
  2165. let retval = false;
  2166. for(let mcObj in W.model.mapComments.objects)
  2167. {
  2168. if(W.model.mapComments.objects[mcObj].isSelected() === true)
  2169. {
  2170. retval = true;
  2171. break;
  2172. }
  2173. }
  2174. return retval;
  2175. },
  2176. MCLayerChanged: function()
  2177. {
  2178. uroInit.WazeBits();
  2179. if(uroMCLayer != null)
  2180. {
  2181. if(uroLayers.HasSelectedMCs() === false)
  2182. {
  2183. uroDBG.AddLog('adding MC blob event handlers');
  2184. let mcModel = null;
  2185. for(let mObj=0; mObj<uroMCLayer.features.length; mObj++)
  2186. {
  2187. if(uroMCLayer.features[mObj]?.attributes?.wazeFeature?._wmeObject !== undefined)
  2188. {
  2189. mcModel = uroMCLayer.features[mObj].attributes.wazeFeature._wmeObject;
  2190. {
  2191. if(mcModel.selected !== true)
  2192. {
  2193. let mcBlobID = mcModel.attributes.geometry.id;
  2194. let mcID = mcModel.attributes.id;
  2195. let mcBlob = document.getElementById(mcBlobID);
  2196. if(mcBlob !== null)
  2197. {
  2198. mcBlob.addEventListener("mouseout", uroLayers.blobMouseOut, false);
  2199. mcBlob.attributes.uroBlobID = mcID;
  2200. mcBlob.attributes.uroBlobType = "map_comment";
  2201. uroDBG.AddLog('added handlers to MC '+mcID);
  2202. }
  2203. }
  2204. }
  2205. }
  2206. }
  2207. uroLayers.ApplyPointMCVisibilityMods();
  2208. }
  2209. else
  2210. {
  2211. uroDBG.AddLog('MC selected, handlers not added yet...');
  2212. }
  2213. uroFilterMapComments();
  2214. }
  2215. },
  2216. VenueLayerChanged: function()
  2217. {
  2218. uroDBG.AddLog('adding place blob event handlers');
  2219. for(let mObj=0; mObj<uroVenueLayer.features.length; mObj++)
  2220. {
  2221. // clicking on an area place now adds the polygon drag handles into the features[] array, so we need to test that
  2222. // the current array entry isn't referring to one of these handles before trying to access the attributes...
  2223. if(uroVenueLayer.features[mObj]?.attributes?.wazeFeature?._wmeObject !== undefined)
  2224. {
  2225. let mcBlobID = uroVenueLayer.features[mObj].attributes.wazeFeature._wmeObject.attributes.geometry.id;
  2226. let mcID = uroVenueLayer.features[mObj].attributes.wazeFeature._wmeObject.attributes.id;
  2227. let mcBlob = document.getElementById(mcBlobID);
  2228. if(mcBlob !== null)
  2229. {
  2230. mcBlob.addEventListener("mouseout", uroLayers.blobMouseOut, false);
  2231. mcBlob.attributes.uroBlobID = mcID;
  2232. mcBlob.attributes.uroBlobType = "place";
  2233. }
  2234. }
  2235. }
  2236. },
  2237. Observe_VenueLayer: function()
  2238. {
  2239. uroLayers.layers[uroLayers.ID.venue].MO.observe(uroVenueLayer.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2240. },
  2241. Observe_URLayer: function()
  2242. {
  2243. // As URs are now displayed as SVG image elements rather than HTML elements, and as WME likes to re-render them seemingly
  2244. // at random after they've been initially displayed, we hang the mutation observer off of the vectorRoot element, as this
  2245. // is the parent SVG element for the markers, and the MO therefore seems to trigger reliably on each change to that level
  2246. // of the SVG, including these random re-renders. It's obvious if these re-renders aren't being captured correctly, as it
  2247. // causes the comment count markers to randomly show up behind UR markers instead of always being in front of them...
  2248. uroLayers.layers[uroLayers.ID.UR].MO.observe(uroLayers.layers[uroLayers.ID.UR].l.renderer.vectorRoot,{childList: true, attributes : true, characterData : true, subtree: true});
  2249. },
  2250. URLayerChanged: function()
  2251. {
  2252. uroDBG.AddLog('UR layer change detected');
  2253. uroLayers.layers[uroLayers.ID.UR].MO.disconnect();
  2254. uroFilterURs();
  2255. uroLayers.Observe_URLayer();
  2256. },
  2257. PURLayerChanged: function()
  2258. {
  2259. uroDBG.AddLog('PUR layer change detected');
  2260. uroLayers.layers[uroLayers.ID.PUR].MO.disconnect();
  2261. uroFilterProblems();
  2262. uroLayers.Observe_PURLayer();
  2263. },
  2264. Observe_PURLayer: function()
  2265. {
  2266. uroLayers.layers[uroLayers.ID.PUR].MO.observe(uroLayers.layers[uroLayers.ID.PUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2267. },
  2268. PPURLayerChanged: function()
  2269. {
  2270. uroDBG.AddLog('PPUR layer change detected');
  2271. uroLayers.layers[uroLayers.ID.PPUR].MO.disconnect();
  2272. uroFilterProblems();
  2273. uroLayers.Observe_PPURLayer();
  2274. },
  2275. Observe_PPURLayer: function()
  2276. {
  2277. uroLayers.layers[uroLayers.ID.PPUR].MO.observe(uroLayers.layers[uroLayers.ID.PPUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2278. },
  2279. RPURLayerChanged: function()
  2280. {
  2281. uroDBG.AddLog('RPUR layer change detected');
  2282. uroLayers.layers[uroLayers.ID.RPUR].MO.disconnect();
  2283. uroFilterProblems();
  2284. uroLayers.Observe_RPURLayer();
  2285. },
  2286. Observe_RPURLayer: function()
  2287. {
  2288. uroLayers.layers[uroLayers.ID.RPUR].MO.observe(uroLayers.layers[uroLayers.ID.RPUR].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2289. },
  2290.  
  2291. RTCLayerChanged: function()
  2292. {
  2293. uroDBG.AddLog('reapplying closures filter');
  2294. uroLayers.layers[uroLayers.ID.RTC].MO.disconnect();
  2295. uroFilterRTCs();
  2296. uroLayers.Observe_RTCLayer();
  2297. },
  2298. Observe_RTCLayer: function()
  2299. {
  2300. uroLayers.layers[uroLayers.ID.RTC].MO.observe(uroLayers.layers[uroLayers.ID.RTC].l.div,{childList: true, attributes : true, characterData : true, subtree: true});
  2301. },
  2302. RunChangeHandlers: function()
  2303. {
  2304. uroLayers.URLayerChanged();
  2305. uroLayers.PURLayerChanged();
  2306. uroLayers.PPURLayerChanged();
  2307. uroLayers.RPURLayerChanged();
  2308. uroLayers.VenueLayerChanged();
  2309. uroLayers.RTCLayerChanged();
  2310.  
  2311. uroLayers.MCLayerChanged();
  2312. },
  2313. InitialiseMOs: function()
  2314. {
  2315. uroLayers.layers[uroLayers.ID.UR].MO = new MutationObserver(uroLayers.URLayerChanged);
  2316. uroLayers.layers[uroLayers.ID.PUR].MO = new MutationObserver(uroLayers.PURLayerChanged);
  2317. uroLayers.layers[uroLayers.ID.PPUR].MO = new MutationObserver(uroLayers.PPURLayerChanged);
  2318. uroLayers.layers[uroLayers.ID.RPUR].MO = new MutationObserver(uroLayers.RPURLayerChanged);
  2319. uroLayers.layers[uroLayers.ID.venue].MO = new MutationObserver(uroLayers.VenueLayerChanged);
  2320. uroLayers.layers[uroLayers.ID.RTC].MO = new MutationObserver(uroLayers.RTCLayerChanged);
  2321. uroLayers.Observe_URLayer();
  2322. uroLayers.Observe_PURLayer();
  2323. uroLayers.Observe_PPURLayer();
  2324. uroLayers.Observe_RPURLayer();
  2325. uroLayers.Observe_VenueLayer();
  2326. uroLayers.Observe_RTCLayer();
  2327. },
  2328. GetMarkersOrFeatures: function(layerID)
  2329. {
  2330. let retval = null;
  2331. let findit = uroLayers.layers[layerID].l.features;
  2332. if(findit !== undefined)
  2333. {
  2334. retval = findit;
  2335. uroLayers.layers[layerID].isFeature = true;
  2336. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = features');
  2337. }
  2338. else
  2339. {
  2340. findit = uroLayers.layers[layerID].l.markers;
  2341. if(findit !== undefined)
  2342. {
  2343. retval = findit;
  2344. uroLayers.layers[layerID].isFeature = false;
  2345. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = markers');
  2346. }
  2347. }
  2348. if(retval === null)
  2349. {
  2350. uroLayers.layers[layerID].isFeature = null;
  2351. uroDBG.AddLog(uroLayers.layers[layerID].name + ' = unknown :-/');
  2352. }
  2353. return retval;
  2354. },
  2355. Init: function()
  2356. {
  2357. for(let i = 0; i < uroLayers.layers.length; ++i)
  2358. {
  2359. uroLayers.layers[i].l = W.map.getLayerByUniqueName(uroLayers.layers[i].name);
  2360. if(uroLayers.layers[i].getMF === true)
  2361. {
  2362. uroLayers.layers[i].mf = uroLayers.GetMarkersOrFeatures(i);
  2363. }
  2364. }
  2365. }
  2366. };
  2367. const uroAlertBox = // alert box handling
  2368. {
  2369. stack: [],
  2370. tickAction: null,
  2371. crossAction: null,
  2372. inUse: false,
  2373. ABObj: function(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction)
  2374. {
  2375. this.headericon = headericon;
  2376. this.title = title;
  2377. this.content = content;
  2378. this.hasCross = hasCross;
  2379. this.tickText = tickText;
  2380. this.crossText = crossText;
  2381. this.tickAction = tickAction;
  2382. this.crossAction = crossAction;
  2383. },
  2384. Close: function()
  2385. {
  2386. document.getElementById('uroAlerts').childNodes[0].innerHTML = uroUtils.ModifyHTML('');
  2387. document.getElementById('uroAlerts').childNodes[1].innerHTML = uroUtils.ModifyHTML('');
  2388. document.getElementById('uroAlertTickBtnCaption').innerHTML = uroUtils.ModifyHTML('');
  2389. document.getElementById('uroAlertCrossBtnCaption').innerHTML = uroUtils.ModifyHTML('');
  2390. uroAlertBox.tickAction = null;
  2391. uroAlertBox.crossAction = null;
  2392. document.getElementById('uroAlerts').style.visibility = "hidden";
  2393. document.getElementById('uroAlertCrossBtn').style.visibility = "hidden";
  2394. uroAlertBox.inUse = false;
  2395. if(uroAlertBox.stack.length > 0)
  2396. {
  2397. uroAlertBox.BuildFromStack();
  2398. }
  2399. },
  2400. CloseWithTick: function()
  2401. {
  2402. if(typeof uroAlertBox.tickAction === 'function')
  2403. {
  2404. uroAlertBox.tickAction();
  2405. }
  2406. uroAlertBox.Close();
  2407. },
  2408. CloseWithCross: function()
  2409. {
  2410. if(typeof uroAlertBox.crossAction === 'function')
  2411. {
  2412. uroAlertBox.crossAction();
  2413. }
  2414. uroAlertBox.Close();
  2415. },
  2416. Show: function(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction)
  2417. {
  2418. uroAlertBox.stack.push(new uroAlertBox.ABObj(headericon, title, content, hasCross, tickText, crossText, tickAction, crossAction));
  2419. if(uroAlertBox.inUse === false)
  2420. {
  2421. uroAlertBox.BuildFromStack();
  2422. }
  2423. },
  2424. BuildFromStack: function()
  2425. {
  2426. uroAlertBox.inUse = true;
  2427. uroAlertBox.tickAction = null;
  2428. uroAlertBox.crossAction = null;
  2429. let titleContent = '<span style="font-size:14px;padding:2px;">';
  2430. titleContent += '<i class="fa '+uroAlertBox.stack[0].headericon+'"> </i>&nbsp;';
  2431. titleContent += uroAlertBox.stack[0].title;
  2432. titleContent += '</span>';
  2433. document.getElementById('uroAlerts').childNodes[0].innerHTML = uroUtils.ModifyHTML(titleContent);
  2434. document.getElementById('uroAlerts').childNodes[1].innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].content);
  2435. document.getElementById('uroAlertTickBtnCaption').innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].tickText);
  2436. if(uroAlertBox.stack[0].hasCross)
  2437. {
  2438. document.getElementById('uroAlertCrossBtnCaption').innerHTML = uroUtils.ModifyHTML(uroAlertBox.stack[0].crossText);
  2439. document.getElementById('uroAlertCrossBtn').style.visibility = "visible";
  2440. if(typeof uroAlertBox.stack[0].crossAction === "function")
  2441. {
  2442. uroAlertBox.crossAction = uroAlertBox.stack[0].crossAction;
  2443. }
  2444. }
  2445. else
  2446. {
  2447. document.getElementById('uroAlertCrossBtn').style.visibility = "hidden";
  2448. }
  2449. if(typeof uroAlertBox.stack[0].tickAction === "function")
  2450. {
  2451. uroAlertBox.tickAction = uroAlertBox.stack[0].tickAction;
  2452. }
  2453. document.getElementById('uroAlerts').style.visibility = "";
  2454. uroAlertBox.stack.shift();
  2455. }
  2456. };
  2457. const uroStartup = // startup messaging to users
  2458. {
  2459. ShowUpgradeNotes: function()
  2460. {
  2461. uroDBG.AddLog('let users know what\'s new in this release');
  2462.  
  2463. let releaseNotes = '';
  2464. releaseNotes += '<p>Thanks for installing URO+ '+uroRelease.version+' ('+uroRelease.date+')</p>';
  2465.  
  2466. let loop;
  2467. if(uroRelease.changes.length > 0)
  2468. {
  2469. releaseNotes += '<br>Changes since the last release:<br>';
  2470. releaseNotes += '<ul>';
  2471. for(loop=0; loop < uroRelease.changes.length; loop++)
  2472. {
  2473. releaseNotes += '<li>'+uroRelease.changes[loop];
  2474. }
  2475. releaseNotes += '</ul>';
  2476. }
  2477.  
  2478. uroAlertBox.Show('fa-info-circle', 'URO+ Release Notes', releaseNotes, false, "OK", "", null, null);
  2479. }
  2480. };
  2481. const uroConfig = // configuration handling
  2482. {
  2483. GatherSettings: function(container)
  2484. {
  2485. let options = '';
  2486. if(typeof(container) == 'string')
  2487. {
  2488. container = document.getElementById(container);
  2489. }
  2490. let urOptions = container.getElementsByTagName('input');
  2491. for (let optIdx=0;optIdx<urOptions.length;optIdx++)
  2492. {
  2493. // Don't save settings for any of the legacy input elements we've now hidden...
  2494. if(urOptions[optIdx].style.display != "none")
  2495. {
  2496. let id = urOptions[optIdx].id;
  2497. if((id.indexOf('_cb') === 0)||(id.indexOf('_text') === 0)||(id.indexOf('_input') === 0))
  2498. {
  2499. options += ':' + id;
  2500. if(urOptions[optIdx].type == 'checkbox') options += ',' + urOptions[optIdx].checked.toString();
  2501. else if((urOptions[optIdx].type == 'text')||(urOptions[optIdx].type == 'number')) options += ',' + urOptions[optIdx].value.toString();
  2502. }
  2503. }
  2504. }
  2505. return options;
  2506. },
  2507. GatherPlacesGroups: function()
  2508. {
  2509. let liststr = '';
  2510. for(let loop=0;loop<uroPlacesGroupsCollapsed.length;loop++)
  2511. {
  2512. if(loop > 0) liststr += ':';
  2513. liststr += uroPlacesGroupsCollapsed[loop];
  2514. }
  2515. return liststr;
  2516. },
  2517. GatherAFNs: function()
  2518. {
  2519. let liststr = '';
  2520. for(let loop=0; loop < uroAFN.friendlyNames.length; loop++)
  2521. {
  2522. let fnObj = uroAFN.friendlyNames[loop];
  2523. if(loop > 0) liststr += ':';
  2524.  
  2525. liststr += fnObj.fName+',';
  2526. liststr += fnObj.area+',';
  2527. liststr += fnObj.server;
  2528. }
  2529. return liststr;
  2530. },
  2531. SaveSettings: function()
  2532. {
  2533. if((uroInhibitSave) || (uroMTEMode === true) || (uroSettingsApplied === false))
  2534. {
  2535. uroDBG.AddLog('save inhibited');
  2536. return;
  2537. }
  2538.  
  2539. if (localStorage)
  2540. {
  2541. try
  2542. {
  2543. let masterEnable = uroUtils.GetCBChecked('_cbMasterEnable');
  2544. if(masterEnable !== null)
  2545. {
  2546. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  2547. {
  2548. localStorage[uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE]] = uroConfig.GatherSettings(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  2549. }
  2550. localStorage.UROverviewFriendlyAreaNames = uroConfig.GatherAFNs();
  2551. localStorage.UROverviewPlacesGroups = uroConfig.GatherPlacesGroups();
  2552. localStorage.UROverviewMasterEnable = masterEnable;
  2553. localStorage.UROverviewCurrentVersion = uroRelease.version;
  2554.  
  2555. uroDBG.AddLog('settings saved');
  2556. }
  2557. else
  2558. {
  2559. uroDBG.AddLog('master enable state not known when trying to save settings...');
  2560. }
  2561. }
  2562. catch(err)
  2563. {
  2564. uroDBG.AddLog('exception thrown during save - probably script reload whilst in MTE mode...');
  2565. }
  2566. }
  2567. else
  2568. {
  2569. uroDBG.AddLog('no localStorage, save blocked');
  2570. }
  2571. },
  2572. ApplySettings: function(settings)
  2573. {
  2574. uroSettingsApplied = true;
  2575. if(settings != undefined)
  2576. {
  2577. if(document.querySelector('#_cbMasterEnable') === null)
  2578. {
  2579. uroDBG.AddLog('master enable not found, not applying settings...');
  2580. uroSettingsApplied = false;
  2581. }
  2582. else
  2583. {
  2584. let options = settings.split(':');
  2585. for(let optIdx=0;optIdx<options.length;optIdx++)
  2586. {
  2587. let fields = options[optIdx].split(',');
  2588. if(fields[0].indexOf('_cb') === 0)
  2589. {
  2590. if(document.getElementById(fields[0]) !== null)
  2591. {
  2592. uroUtils.SetCBChecked(fields[0], (fields[1] == 'true'));
  2593. }
  2594. }
  2595. else if((fields[0].indexOf('_input') === 0)||(fields[0].indexOf('_text') === 0))
  2596. {
  2597. if(document.getElementById(fields[0]) !== null) document.getElementById(fields[0]).value = fields[1];
  2598. }
  2599. }
  2600. uroDBG.AddLog('settings applied...');
  2601. }
  2602. }
  2603. },
  2604. TranslateLegacyMPTab: function()
  2605. {
  2606. let options = localStorage.UROverviewMPOptions.split(':');
  2607. for(let optIdx=0;optIdx<options.length;optIdx++)
  2608. {
  2609. let fields = options[optIdx].split(',');
  2610. if(fields[0].indexOf('_cb') === 0)
  2611. {
  2612. if(fields[0] == '_cbMPFilterParkingLotInputAsPoint') uroUtils.SetCBChecked('_cbMPFilter_T50', (fields[1] == 'true'));
  2613. if(fields[0] == '_cbMPMissingPLP_T70') uroUtils.SetCBChecked('_cbMPFilter_T70', (fields[1] == 'true'));
  2614. if(fields[0] == '_cbMPMissingPLP_T71') uroUtils.SetCBChecked('_cbMPFilter_T71', (fields[1] == 'true'));
  2615. if(fields[0] == '_cbMPFilterDrivingDirectionMismatch') uroUtils.SetCBChecked('_cbMPFilter_T101', (fields[1] == 'true'));
  2616. if(fields[0] == '_cbMPFilterMissingJunction') uroUtils.SetCBChecked('_cbMPFilter_T102', (fields[1] == 'true'));
  2617. if(fields[0] == '_cbMPFilterMissingRoad') uroUtils.SetCBChecked('_cbMPFilter_T103', (fields[1] == 'true'));
  2618. if(fields[0] == '_cbMPFilterCrossroadsJunctionMissing') uroUtils.SetCBChecked('_cbMPFilter_T104', (fields[1] == 'true'));
  2619. if(fields[0] == '_cbMPFilterRoadTypeMismatch') uroUtils.SetCBChecked('_cbMPFilter_T105', (fields[1] == 'true'));
  2620. if(fields[0] == '_cbMPFilterRestrictedTurn') uroUtils.SetCBChecked('_cbMPFilter_T106', (fields[1] == 'true'));
  2621. if(fields[0] == '_cbMPFilterTurnProblem') uroUtils.SetCBChecked('_cbMPFilter_T200', (fields[1] == 'true'));
  2622. if(fields[0] == '_cbMPFilterRoadClosureProblem') uroUtils.SetCBChecked('_cbMPFilter_T300', (fields[1] == 'true'));
  2623. }
  2624. }
  2625. },
  2626. TranslateLegacyZoom: function()
  2627. {
  2628. let tZoom = parseInt(document.getElementById("_inputFilterMinZoomLevel").value);
  2629. if(tZoom < 12)
  2630. {
  2631. tZoom += 12;
  2632. document.getElementById("_inputFilterMinZoomLevel").value = tZoom;
  2633. }
  2634. tZoom = parseInt(document.getElementById("_inputUnstackZoomLevel").value);
  2635. if(tZoom < 12)
  2636. {
  2637. tZoom += 12;
  2638. document.getElementById("_inputUnstackZoomLevel").value = tZoom;
  2639. }
  2640. },
  2641. RemoveOldSettings: function()
  2642. {
  2643. let oldies = [
  2644. "UROverviewFeedFilterOptions",
  2645. "UROverviewCWLGroups",
  2646. "UROverviewCamWatchList",
  2647. "UROverviewPlaceWatchList",
  2648. "UROverviewSegWatchList"
  2649. ];
  2650.  
  2651. for(let i = 0; i < oldies.length; ++ i)
  2652. {
  2653. if(localStorage[oldies[i]] != undefined)
  2654. {
  2655. localStorage.removeItem(oldies[i]);
  2656. }
  2657. }
  2658. },
  2659. LoadSettings: function()
  2660. {
  2661. let isNewInstall = true;
  2662. let isUpgradeInstall = true;
  2663.  
  2664. uroDBG.AddLog('loadSettings()');
  2665. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  2666. {
  2667. if (uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE] != null)
  2668. {
  2669. uroDBG.AddLog('recover '+uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABTITLE]+' tab settings');
  2670. uroConfig.ApplySettings(localStorage[uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE]]);
  2671. isNewInstall = false;
  2672. }
  2673. }
  2674. if (localStorage.UROverviewMPOptions != null)
  2675. {
  2676. uroConfig.TranslateLegacyMPTab();
  2677. }
  2678. if (localStorage.UROverviewMiscOptions != null)
  2679. {
  2680. uroConfig.TranslateLegacyZoom();
  2681. }
  2682.  
  2683. if(localStorage.UROverviewCurrentVersion != null)
  2684. {
  2685. uroDBG.AddLog('comparing install versions');
  2686. if(localStorage.UROverviewCurrentVersion == uroRelease.version)
  2687. {
  2688. isUpgradeInstall = false;
  2689. }
  2690. }
  2691.  
  2692. if(localStorage.UROverviewFriendlyAreaNames != null)
  2693. {
  2694. uroDBG.AddLog('recover friendly area names');
  2695. uroAFN.ApplyNames();
  2696. isNewInstall = false;
  2697. }
  2698.  
  2699. if(localStorage.UROverviewMasterEnable != null)
  2700. {
  2701. uroDBG.AddLog('recover master enable state');
  2702. document.getElementById('_cbMasterEnable').checked = (localStorage.UROverviewMasterEnable == "true");
  2703. uroDBG.AddLog('enable checkbox state set...');
  2704. }
  2705.  
  2706. uroConfig.RemoveOldSettings();
  2707.  
  2708. if((isNewInstall)||(isUpgradeInstall))
  2709. {
  2710. uroStartup.ShowUpgradeNotes();
  2711. }
  2712.  
  2713. uroInhibitSave = false;
  2714. },
  2715. DefaultSettings: function()
  2716. {
  2717. 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);
  2718. },
  2719. DefaultSettingsAction: function()
  2720. {
  2721. let defaultSettings = '';
  2722.  
  2723. 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]';
  2724. 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]';
  2725. 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]';
  2726. defaultSettings += '[UROverviewPlacesGroups][len=71]false:false:false:false:false:false:false:false:false:false:false:false[END]';
  2727. 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]';
  2728. defaultSettings += '[UROverviewMasterEnable][len=4]true[END]';
  2729. 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]';
  2730. 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]';
  2731. 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]';
  2732. defaultSettings += '[UROverviewRAOptions][len=178]:_cbShowSpecificRA,false:_cbRAEditorIDFilter,false:_cbEnableRAAgeFilterLessThan,false:_inputFilterRAAgeLessThan,39:_cbEnableRAAgeFilterMoreThan,false:_inputFilterRAAgeMoreThan,38[END]';
  2733. defaultSettings += '[UROverviewCurrentVersion][len=3]4.5[END]';
  2734. defaultSettings += '[UROverviewFriendlyAreaNames][len=0][END]';
  2735.  
  2736. document.getElementById('_txtSettings').value = defaultSettings;
  2737. uroConfig.TextToSettings();
  2738. document.getElementById('_txtSettings').value = '';
  2739. },
  2740. SettingsToText: function()
  2741. {
  2742. let txtSettings = '';
  2743.  
  2744. uroConfig.SaveSettings();
  2745.  
  2746. for(let lsEntry in localStorage)
  2747. {
  2748. if(lsEntry.indexOf('UROverview') === 0)
  2749. {
  2750. txtSettings += '['+lsEntry+'][len=' + localStorage[lsEntry].length + ']' + localStorage[lsEntry] + '[END]\n';
  2751. }
  2752. }
  2753.  
  2754. document.getElementById('_txtSettings').value = txtSettings;
  2755. document.getElementById('_txtSettings').focus();
  2756. document.getElementById('_txtSettings').select();
  2757. },
  2758. TextToSettings: function()
  2759. {
  2760. let txtSettings = '';
  2761. txtSettings = uroUtils.GetElmValue('_txtSettings');
  2762. if(txtSettings.indexOf('[END]') == -1) return;
  2763.  
  2764. let subText = txtSettings.split('[END]');
  2765. for(let i=0;i<subText.length;i++)
  2766. {
  2767. let aPos = subText[i].indexOf('[');
  2768. let bPos = subText[i].indexOf(']');
  2769. if((aPos != -1) && (bPos != -1))
  2770. {
  2771. let settingID = subText[i].substr(aPos+1,bPos-1-aPos);
  2772. subText[i] = subText[i].substr(bPos+1);
  2773. bPos = subText[i].indexOf(']');
  2774. if(bPos != -1)
  2775. {
  2776. let settingLength = subText[i].substr(5,bPos-5);
  2777. subText[i] = subText[i].substr(bPos+1);
  2778. if(subText[i].length == settingLength)
  2779. {
  2780. localStorage[settingID] = subText[i];
  2781. }
  2782. }
  2783. }
  2784. }
  2785. uroConfig.LoadSettings();
  2786. },
  2787. ClearSettingsText: function()
  2788. {
  2789. document.getElementById('_txtSettings').value = '';
  2790. }
  2791. };
  2792. const uroRTCClone = // RTC cloning
  2793. {
  2794. ConfirmDelete : true,
  2795. ToDelete : 0,
  2796. Reason : null,
  2797. Event : null,
  2798. Direction : null,
  2799. StartDate : null,
  2800. StartTime : null,
  2801. EndDate : null,
  2802. EndTime : null,
  2803. IgnoreTraffic : null,
  2804. ClosedNodes : null,
  2805. PendingClone : -1,
  2806. PendingCloneIncrement : 0,
  2807.  
  2808. Complete: function()
  2809. {
  2810. let loop;
  2811. if(document.getElementsByClassName('edit-closure').length === 0)
  2812. {
  2813. window.setTimeout(uroRTCClone.Complete,100);
  2814. return;
  2815. }
  2816.  
  2817. if(uroFixMTEDropDown(document.getElementById('closure_eventId')) == false)
  2818. {
  2819. window.setTimeout(uroRTCClone.Complete,100);
  2820. return;
  2821. }
  2822.  
  2823. // need to generate a change event on each of the form fields, because WME appears to be silently populating some hidden
  2824. // closure object with the details as they're entered manually, and if we just set the form values without then forcing
  2825. // the change event as well then WME will end up using its default values instead of the ones we've so lovingly copied...
  2826. let form = $('#edit-panel .closures .edit-closure form');
  2827.  
  2828. if(uroRTCClone.Reason !== null)
  2829. {
  2830. let fObj = form.find('wz-text-input#closure_reason');
  2831. fObj.val(uroRTCClone.Reason);
  2832. fObj.change();
  2833. }
  2834. if(uroRTCClone.Direction !== null)
  2835. {
  2836. let fObj = form.find('wz-select#closure_direction');
  2837. fObj[0].value = uroRTCClone.Direction;
  2838. fObj.change();
  2839. }
  2840. if(uroRTCClone.StartDate !== null)
  2841. {
  2842. let fObj = form.find('input#closure_startDate');
  2843. fObj.val(uroRTCClone.StartDate);
  2844. fObj.change();
  2845. }
  2846. if(uroRTCClone.StartTime !== null)
  2847. {
  2848. let fObj = form.find('div.form-group.start-date-form-group input.time-picker-input');
  2849. fObj.focus();
  2850. fObj.val(uroRTCClone.StartTime);
  2851. fObj.change();
  2852. }
  2853.  
  2854. if(uroRTCClone.IgnoreTraffic !== null)
  2855. {
  2856. let fObj = form.find('wz-checkbox#closure_permanent');
  2857. fObj.val(uroRTCClone.IgnoreTraffic);
  2858. fObj.change();
  2859. }
  2860. if(uroRTCClone.EndTime !== null)
  2861. {
  2862. let fObj = form.find('div.form-group.end-date-form-group input.time-picker-input');
  2863. fObj.focus();
  2864. fObj.val(uroRTCClone.EndTime);
  2865. fObj.change();
  2866. }
  2867.  
  2868. // the current version of WME wipes any existing end date as soon as the end time is altered, so we now need
  2869. // to set the date after the time instead of before as in earlier versions of this function...
  2870. if(uroRTCClone.EndDate !== null)
  2871. {
  2872. let fObj = form.find('input#closure_endDate');
  2873. fObj.val(uroRTCClone.EndDate);
  2874. fObj.change();
  2875. }
  2876.  
  2877. // the old method of setting the MTE just by changing the value attribute on closure_eventId no longer
  2878. // seems to work as expected (it runs OK from the dev console, but not within the scope of the userscript),
  2879. // so just as we do for setting the event to None, we set the event to the desired value here by finding
  2880. // the appropriate menu entry and clicking on it...
  2881. let cEvents = document.getElementById('closure_eventId').getElementsByTagName('wz-option');
  2882. for(let i of cEvents)
  2883. {
  2884. if(i.value == uroRTCClone.Event)
  2885. {
  2886. i.click();
  2887. break;
  2888. }
  2889. }
  2890.  
  2891. let nNodes = uroRTCClone.ClosedNodes.length;
  2892. if(nNodes > 0)
  2893. {
  2894. let fObj = form.find('wz-toggle-switch');
  2895. for(loop = 0; loop < nNodes; ++loop)
  2896. {
  2897. if(uroRTCClone.ClosedNodes[loop] === true)
  2898. {
  2899. fObj[loop].click();
  2900. }
  2901. }
  2902. }
  2903. if(uroUtils.GetCBChecked('_cbAutoApplyClonedClosure') == true)
  2904. {
  2905. window.setTimeout(uroRTCClone.ClickSave,100);
  2906. }
  2907.  
  2908. uroRTCClone.PendingClone = -1;
  2909. },
  2910. ClickSave: function()
  2911. {
  2912. document.getElementsByClassName('closures')[0].getElementsByClassName('save-button')[0].click();
  2913. },
  2914. Copy: function()
  2915. {
  2916. // grab the current closure details from the UI...
  2917. uroRTCClone.Reason = uroGetShadowElementProperty('closure_reason', 'input', 'value');
  2918. uroRTCClone.Direction = uroGetElementProperty('closure_direction', 0, 'value');
  2919. uroRTCClone.StartDate = uroGetElementProperty('closure_startDate', 0, 'value');
  2920. uroRTCClone.StartTime = document.querySelector('.start-date-form-group').querySelector('.time-picker-input').value;
  2921. uroRTCClone.EndDate = uroGetElementProperty('closure_endDate', 0, 'value');
  2922. uroRTCClone.EndTime = document.querySelector('.end-date-form-group').querySelector('.time-picker-input').value;
  2923. uroRTCClone.Event = uroGetElementProperty('closure_eventId', 0, 'value');
  2924. uroRTCClone.IgnoreTraffic = uroGetElementProperty('closure_permanent', 0, 'checked');
  2925. uroRTCClone.ClosedNodes = [];
  2926. let nNodes = document.getElementsByClassName('fromNodeClosed').length;
  2927. if(nNodes > 0)
  2928. {
  2929. for(let loop = 0; loop < nNodes; ++loop)
  2930. {
  2931. uroRTCClone.ClosedNodes.push(document.getElementsByClassName('fromNodeClosed')[loop].checked);
  2932. }
  2933. }
  2934.  
  2935. document.getElementsByClassName('closures')[0].getElementsByClassName('cancel-button')[0].click();
  2936.  
  2937. // auto-increment the start and end dates
  2938. uroRTCClone.StartDate = uroIncrementClosureDate(uroRTCClone.StartDate,uroRTCClone.PendingCloneIncrement);
  2939. uroRTCClone.EndDate = uroIncrementClosureDate(uroRTCClone.EndDate,uroRTCClone.PendingCloneIncrement);
  2940.  
  2941. uroRTCClone.PendingClone = -2;
  2942. },
  2943. Clone: function()
  2944. {
  2945. uroRTCClone.PendingCloneIncrement = parseInt(this.id.split('-')[1]);
  2946. uroRTCClone.PendingClone = parseInt(this.id.split('-')[2]);
  2947. },
  2948. DeleteNextOnList: function()
  2949. {
  2950. let nClosures = document.querySelectorAll('.closure-item.is-editable').length;
  2951. if(nClosures > 0)
  2952. {
  2953. if (nClosures != uroRTCClone.ToDelete)
  2954. {
  2955. uroRTCClone.ToDelete = nClosures;
  2956. let ctObj = document.querySelector('.closure-item.is-editable');
  2957. let deleteMenuEntry = ctObj.querySelector('wz-menu-item.delete');
  2958. if(deleteMenuEntry !== null)
  2959. {
  2960. deleteMenuEntry.click();
  2961. }
  2962. }
  2963. window.setTimeout(uroRTCClone.DeleteNextOnList,100);
  2964. }
  2965. else
  2966. {
  2967. uroRTCClone.ConfirmDelete = true;
  2968. }
  2969. },
  2970. DeleteAll: function()
  2971. {
  2972. uroRTCClone.ConfirmDelete = true;
  2973. 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);
  2974. },
  2975. DeleteAllAction: function()
  2976. {
  2977. uroRTCClone.ConfirmDelete = false;
  2978. let nClosures = document.getElementsByClassName('closure-item').length;
  2979. if(nClosures > 0)
  2980. {
  2981. uroRTCClone.ToDelete = -1;
  2982. uroRTCClone.DeleteNextOnList();
  2983. }
  2984. else
  2985. {
  2986. uroRTCClone.ConfirmDelete = true;
  2987. }
  2988. }
  2989. };
  2990. const uroIgnore = // ignore list
  2991. {
  2992. IsOnList: function(fid)
  2993. {
  2994. if(sessionStorage.UROverview_FID_IgnoreList.indexOf('fid:'+fid) == -1) return false;
  2995. else return true;
  2996. },
  2997. EnableControls: function()
  2998. {
  2999. let btnState = "visible";
  3000. if(sessionStorage.UROverview_FID_IgnoreList === '')
  3001. {
  3002. btnState = "hidden";
  3003. }
  3004. try
  3005. {
  3006. document.getElementById('_btnUndoLastHide').style.visibility = btnState;
  3007. document.getElementById('_btnClearSessionHides').style.visibility = btnState;
  3008. uroFilterItems();
  3009. }
  3010. catch(err)
  3011. {
  3012. uroDBG.AddLog('exception thrown in uroIgnore.EnableControls()');
  3013. }
  3014. },
  3015. Add: function()
  3016. {
  3017. if(!uroIgnore.IsOnList(uroShownFID))
  3018. {
  3019. sessionStorage.UROverview_FID_IgnoreList += 'fid:'+uroShownFID;
  3020. uroDBG.AddLog('added fid '+uroShownFID+' to ignore list');
  3021. uroDBG.AddLog(sessionStorage.UROverview_FID_IgnoreList);
  3022. uroDiv.style.visibility = 'hidden';
  3023. uroIgnore.EnableControls();
  3024.  
  3025. W.map.events.register("mousemove", null, uroFilterItemsOnMove);
  3026. }
  3027. return false;
  3028. },
  3029. RemoveLastAdded: function()
  3030. {
  3031. let ignorelist = sessionStorage.UROverview_FID_IgnoreList;
  3032. let fidpos = ignorelist.lastIndexOf('fid:');
  3033. if(fidpos != -1)
  3034. {
  3035. ignorelist = ignorelist.slice(0,fidpos);
  3036. sessionStorage.UROverview_FID_IgnoreList = ignorelist;
  3037. uroDBG.AddLog('removed last fid from ignore list');
  3038. uroDBG.AddLog(sessionStorage.UROverview_FID_IgnoreList);
  3039. uroIgnore.EnableControls();
  3040. }
  3041. },
  3042. RemoveAll: function()
  3043. {
  3044. sessionStorage.UROverview_FID_IgnoreList = '';
  3045. uroIgnore.EnableControls();
  3046. }
  3047. };
  3048. const uroPopup = // map object popup handling
  3049. {
  3050. hasIgnoreLink : null,
  3051. hasDeleteLink : null,
  3052. hasAddWatchLink : null,
  3053. hasRemoveWatchLink : null,
  3054. hasUpdateWatchLink : null,
  3055. hasRecentreSessionLink : null,
  3056. hasOpenInNewTabLink : null,
  3057.  
  3058. isVenue : null,
  3059. isMapComment : null,
  3060. isUR : null,
  3061. isProblem : null,
  3062. isTurnProb : null,
  3063. isPlaceUpdate : null,
  3064. timer : -2,
  3065. autoHideTimer : 0,
  3066. mouseIn : false,
  3067. shown : false,
  3068. shownType : null,
  3069. newType : null,
  3070. hovered : null,
  3071. unstackedX : null,
  3072. unstackedY : null,
  3073. renderIntent : null,
  3074. pX : null,
  3075. pY : null,
  3076. suppressed : false,
  3077.  
  3078. GetFormattedLocks: function(attrs)
  3079. {
  3080. let autoLock = attrs.rank;
  3081. let userLock = attrs.lockRank;
  3082. let retval = '<b>' + I18n.lookup("edit.segment.fields.lock") + ': </b>';
  3083. if(userLock !== null)
  3084. {
  3085. retval += 'M' + (userLock+1) + ' / ';
  3086. }
  3087. retval += 'A' + (autoLock+1);
  3088. return retval;
  3089. },
  3090. UR: function()
  3091. {
  3092. let result = '';
  3093.  
  3094. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  3095. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  3096. // check for stacking...
  3097. if(uroShownFID != uroMarkers.id)
  3098. {
  3099. uroCheckStacking(uroLayers.ID.UR,uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  3100. }
  3101.  
  3102. if(uroUtils.GetCBChecked('_cbInhibitURPopup') === false)
  3103. {
  3104. if(uroMousedOverMapComment !== null)
  3105. {
  3106. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for UR highlight');
  3107. uroMousedOverOtherObjectWithinMapComment = true;
  3108. }
  3109.  
  3110. uroPopup.isUR = true;
  3111. uroPopup.newPopupType = uroMarkers.type;
  3112. let ureq = W.model.mapUpdateRequests.objects[uroMarkers.id];
  3113.  
  3114. if(ureq.attributes != undefined)
  3115. {
  3116. uroFID = uroMarkers.id;
  3117.  
  3118. uroDBG.AddLog('building popup for UR '+uroMarkers.id);
  3119. result = '<b>Update Request ('+uroMarkers.id+'): ' + I18n.lookup("update_requests.types." + ureq.attributes.type) + '</b><br>';
  3120.  
  3121. result += uroUtils.Clickify(ureq.attributes.description, '<br>');
  3122. let uroDaysOld = uroUtils.GetURAge(ureq,0,false);
  3123. let uroSubmittedTS = uroUtils.GetURAge(ureq,0,true);
  3124. if(uroSubmittedTS != -1)
  3125. {
  3126. uroSubmittedTS = uroUtils.GetDateTimeString(uroSubmittedTS);
  3127. }
  3128. if(uroDaysOld != -1)
  3129. {
  3130. result += '<i>Submitted ' + uroUtils.ParseDaysAgo(uroDaysOld) + ' ';
  3131. if(uroSubmittedTS != -1) result += '(' + uroSubmittedTS + ') ';
  3132. if(ureq.attributes.guestUserName != null)
  3133. {
  3134. result += 'via Livemap';
  3135. if(ureq.attributes.guestUserName !== '')
  3136. {
  3137. result += ' by '+ureq.attributes.guestUserName.replace(/<\/?[^>]+(>|$)/g, "");
  3138. }
  3139. }
  3140. result += '</i>';
  3141. }
  3142. if(ureq.attributes.resolvedOn !== null)
  3143. {
  3144. let daysResolved = uroUtils.GetURAge(ureq,1,false);
  3145. let uroResolvedTS = uroUtils.GetURAge(ureq,1,true);
  3146. if(uroResolvedTS != -1)
  3147. {
  3148. uroResolvedTS = uroUtils.GetDateTimeString(uroResolvedTS);
  3149. }
  3150.  
  3151. if(daysResolved != -1)
  3152. {
  3153. result += '<br><i>Closed ' + uroUtils.ParseDaysAgo(daysResolved) + ' ';
  3154. if(uroResolvedTS != -1) result += '(' + uroResolvedTS + ')</i>';
  3155.  
  3156. result += '<br><i>Marked as ';
  3157. if(ureq.attributes.resolution === 0) result += 'solved';
  3158. else if(ureq.attributes.resolution == 1) result += 'not identified';
  3159. else result += 'unknown';
  3160. if(ureq.attributes.resolvedBy !== null)
  3161. {
  3162. result += ' by '+uroUtils.GetUserNameAndRank(ureq.attributes.resolvedBy);
  3163. }
  3164. result += '</i>';
  3165. }
  3166. }
  3167. if(W.model.updateRequestSessions.objects[uroMarkers.id] != null)
  3168. {
  3169. let hasMyComments = uroURHasMyComments(uroMarkers.id);
  3170. let nComments = W.model.updateRequestSessions.objects[uroMarkers.id].attributes.comments.length;
  3171. result += '<br>' + nComments + ' comment';
  3172. if(nComments != 1) result += 's';
  3173. if((hasMyComments === false) && (nComments > 0)) result += ' (none by me)';
  3174. if(nComments > 0)
  3175. {
  3176. let commentDaysOld = uroUtils.GetCommentAge(W.model.updateRequestSessions.objects[uroMarkers.id].attributes.comments[nComments-1]);
  3177. if(commentDaysOld != -1)
  3178. {
  3179. result += ', last update '+uroUtils.ParseDaysAgo(commentDaysOld);
  3180. }
  3181. }
  3182. }
  3183. if(uroURDupes.length > 0)
  3184. {
  3185. let thisID = parseInt(uroMarkers.id);
  3186. for(let i = 0; i < uroURDupes.length; ++i)
  3187. {
  3188. if(uroURDupes[i][0] === thisID)
  3189. {
  3190. result += '<br><br>Duplicate of: ';
  3191. let dupes = 0;
  3192. for(let j = 0; j < uroURDupes[i][1].length; ++j)
  3193. {
  3194. if(uroURDupes[i][1][j] !== thisID)
  3195. {
  3196. if(dupes > 0)
  3197. {
  3198. result += ', ';
  3199. }
  3200. result += uroURDupes[i][1][j];
  3201. ++dupes;
  3202. }
  3203. }
  3204. }
  3205. }
  3206. }
  3207. uroPopup.result += result;
  3208. uroPopup.UMPExtras(ureq);
  3209. uroPopup.Show();
  3210. }
  3211. }
  3212. },
  3213. MP: function()
  3214. {
  3215. let result = '';
  3216.  
  3217. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  3218. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  3219. // check for stacking...
  3220. if(uroShownFID != uroMarkers.id)
  3221. {
  3222. ////uroCheckStacking(uroLayers.ID.MP,uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  3223. }
  3224.  
  3225. if(uroUtils.GetCBChecked('_cbInhibitMPPopup') === false)
  3226. {
  3227. if(uroMousedOverMapComment !== null)
  3228. {
  3229. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for MP highlight');
  3230. uroMousedOverOtherObjectWithinMapComment = true;
  3231. }
  3232.  
  3233. uroPopup.isProblem = true;
  3234. uroPopup.newPopupType = uroMarkers.type;
  3235. let ureq = W.model.mapProblems.objects[uroMarkers.id];
  3236.  
  3237. uroFID = uroMarkers.id;
  3238. uroDBG.AddLog('building popup for problem '+uroMarkers.id);
  3239. if(uroPopup.isTurnProb) result = '<b>Turn Problem ('+uroMarkers.id+'): ' + I18n.lookup("problems.types.turn.title");
  3240. else
  3241. {
  3242. result = '<b>Map Problem ('+uroMarkers.id+'): ';
  3243.  
  3244. let problemType = ureq.attributes.subType;
  3245. if(problemType == 300)
  3246. {
  3247. result += I18n.lookup("problems.panel.closure.title");
  3248. }
  3249. else
  3250. {
  3251. if(I18n.lookup("problems.types." + problemType) === undefined) result += 'Unknown problem type ('+problemType+')';
  3252. else result += I18n.lookup("problems.types." + problemType + ".title");
  3253. }
  3254. }
  3255. result += '</b><br>';
  3256.  
  3257. if(ureq.attributes.description != null)
  3258. {
  3259. result += 'Description: ' + ureq.attributes.description + '<br>';
  3260. }
  3261. if(ureq.attributes.extraInfo != null)
  3262. {
  3263. result += 'ExtraInfo: ' + uroUtils.Clickify(ureq.attributes.extraInfo, '<br>');
  3264. }
  3265. if(ureq.attributes.provider != null)
  3266. {
  3267. result += 'Provider: ' + ureq.attributes.provider + '<br>';
  3268. }
  3269. if(ureq.attributes.startTime != null)
  3270. {
  3271. result += 'From: ' + uroUtils.GetDateTimeString(ureq.attributes.startTime) + '<br>';
  3272. }
  3273. if(ureq.attributes.endTime != null)
  3274. {
  3275. result += 'To: ' + uroUtils.GetDateTimeString(ureq.attributes.endTime) + '<br>';
  3276. }
  3277. if(ureq.attributes.resolvedOn != null)
  3278. {
  3279. let daysResolved = uroUtils.GetURAge(ureq,1,false);
  3280. if(daysResolved != -1)
  3281. {
  3282. result += '<br><i>Closed ' + uroUtils.ParseDaysAgo(daysResolved) + ' ';
  3283. if(ureq.attributes.resolvedBy != null)
  3284. {
  3285. result += ' by '+uroUtils.GetUserNameAndRank(ureq.attributes.resolvedBy);
  3286. }
  3287.  
  3288. if((ureq.attributes.open === true) && (ureq.attributes.resolvedOn != null))
  3289. {
  3290. result += '<br>Reopened by Waze';
  3291. }
  3292. result += '</i>';
  3293. }
  3294. }
  3295. uroPopup.result += result;
  3296. uroPopup.UMPExtras(ureq);
  3297. }
  3298. },
  3299. PUR: function()
  3300. {
  3301. if(uroMarkers?.elm?.style == undefined)
  3302. {
  3303. return;
  3304. }
  3305.  
  3306. let result = '';
  3307.  
  3308. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  3309. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  3310.  
  3311. if(uroShownFID != uroMarkers.id)
  3312. {
  3313. // check for stacking...
  3314. uroCheckStacking(uroMarkers.type, uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  3315. }
  3316.  
  3317. if(uroUtils.GetCBChecked('_cbInhibitPUPopup') === false)
  3318. {
  3319. let ureq = W.model.venues.objects[uroMarkers.id];
  3320.  
  3321. uroPopup.newPopupType = uroMarkers.type;
  3322. if(uroMousedOverMapComment !== null)
  3323. {
  3324. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for PUR highlight');
  3325. uroMousedOverOtherObjectWithinMapComment = true;
  3326. }
  3327.  
  3328. uroPopup.isPlaceUpdate = true;
  3329.  
  3330. uroFID = uroMarkers.id;
  3331.  
  3332. if(uroMarkers.type == uroLayers.ID.PUR)
  3333. {
  3334. uroDBG.AddLog('building popup for placeUpdate '+uroMarkers.id);
  3335. }
  3336. else if(uroMarkers.type == uroLayers.ID.RPUR)
  3337. {
  3338. uroDBG.AddLog('building popup for residentialPlaceUpdate '+uroMarkers.id);
  3339. }
  3340. else
  3341. {
  3342. uroDBG.AddLog('building popup for parkingPlaceUpdate '+uroMarkers.id);
  3343. }
  3344.  
  3345. result = '<b>';
  3346. if(ureq.attributes.name === '') result += 'Unnamed landmark';
  3347. else result += ureq.attributes.name;
  3348. result += '</b><br>';
  3349.  
  3350. result += '<ul>';
  3351. for(let idx = 0; idx < ureq.attributes.categories.length; idx++)
  3352. {
  3353. result += '<li>' + I18n.lookup("venues.categories." + ureq.attributes.categories[idx]);
  3354. }
  3355. result += '</ul>';
  3356.  
  3357. if(ureq.attributes.residential === true)
  3358. {
  3359. result += '<i>Residential</i>';
  3360. }
  3361.  
  3362. let daysOld = uroUtils.GetPURAge(ureq);
  3363. if(daysOld != -1)
  3364. {
  3365. result += '<br><i>Submitted '+uroUtils.ParseDaysAgo(daysOld)+'</i>';
  3366. }
  3367.  
  3368. uroPopup.result += result;
  3369. uroPopup.UMPExtras(ureq);
  3370. }
  3371. },
  3372. Venue: function()
  3373. {
  3374. if(uroUtils.GetCBChecked('_cbInhibitLandmarkPopup') === false)
  3375. {
  3376. let result = '';
  3377. let navpointPos=new OpenLayers.LonLat();
  3378. {
  3379. if(uroPopup.renderIntent === 'highlight')
  3380. {
  3381. if(uroUtils.GetExtent().intersectsBounds(uroMarkers.obj.attributes.geometry.getBounds()))
  3382. {
  3383. if(uroMousedOverMapComment !== null)
  3384. {
  3385. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for place highlight');
  3386. uroMousedOverOtherObjectWithinMapComment = true;
  3387. }
  3388.  
  3389. if(uroPopup.newPopupType === null)
  3390. {
  3391. uroFID = uroMarkers.obj.attributes.id;
  3392. uroDBG.AddLog('building popup for place '+uroFID);
  3393.  
  3394. navpointPos = uroGetVenueNavPoint(uroFID);
  3395. result += '<b>';
  3396. if(uroMarkers.obj.attributes.name === '')
  3397. {
  3398. if(uroMarkers.obj.attributes.residential === true) result += '<i>Residential</i>';
  3399. else result += '<i>Unnamed</i>';
  3400. }
  3401. else result += uroUtils.Clickify(uroMarkers.obj.attributes.name, '');
  3402. if(uroMarkers.obj.attributes.externalProviderIDs.length > 0)
  3403. {
  3404. result += ' <i>(linked)</i>';
  3405. }
  3406. if(uroMarkers.obj.attributes.adLocked)
  3407. {
  3408. result += ' <i>(AdLocked)</i>';
  3409. }
  3410. result += '</b><br>';
  3411. if(uroMarkers.obj.attributes.brand !== null)
  3412. {
  3413. result += '<i>Brand: ' + uroMarkers.obj.attributes.brand + '</i><br>';
  3414. }
  3415. let vDesc = uroMarkers.obj.attributes.description;
  3416. if(vDesc !== '')
  3417. {
  3418. result += '"<i>' + uroUtils.Clickify(vDesc, '') + '</i>"<br>';
  3419. }
  3420.  
  3421. let userLock = uroMarkers.obj.attributes.lockRank;
  3422. result += '<b>Lock: </b>' + (userLock+1);
  3423.  
  3424. result += '<hr>';
  3425. result += uroGetAddress(uroMarkers.obj.attributes.streetID, uroMarkers.obj.attributes.houseNumber, false, false, false);
  3426. result += '<ul>';
  3427. for(let idx = 0; idx < uroMarkers.obj.attributes.categories.length; idx++)
  3428. {
  3429. result += '<li>' + I18n.lookup("venues.categories." + uroMarkers.obj.attributes.categories[idx]);
  3430. }
  3431. result += '</ul>';
  3432.  
  3433. let npLink = document.location.href;
  3434. let npLayers = '';
  3435. npLink = npLink.substr(0,npLink.indexOf('?zoomLevel'));
  3436. npLink += '?zoomLevel=17&lat='+navpointPos.lat+'&lon='+navpointPos.lon+npLayers;
  3437.  
  3438. let targetTab = "_uroTab_" + Math.round(Math.random()*1000000);
  3439. result += '<hr>Jump to nav point: <a href="'+npLink+'" id="_openInNewTab" target="'+targetTab+'">in new tab</a> - ';
  3440. uroPopup.hasOpenInNewTabLink = true;
  3441. result += '<a href="#" id="_recentreSession">in this tab</a>';
  3442. uroPopup.hasRecentreSessionLink = true;
  3443.  
  3444. uroPopup.newPopupType = 'venue';
  3445. uroPopup.isVenue = true;
  3446.  
  3447. uroPopup.result += result;
  3448. uroPopup.Show();
  3449. }
  3450. else
  3451. {
  3452. let otherID = uroMarkers.obj.attributes.id;
  3453. uroDBG.AddLog('venue '+otherID+' is also highlighted');
  3454. }
  3455. }
  3456. else
  3457. {
  3458. uroDBG.AddLog('landmark '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  3459. }
  3460. }
  3461. }
  3462. }
  3463. },
  3464. Camera: function()
  3465. {
  3466. if(uroUtils.GetCBChecked('_cbInhibitCamPopup') === false)
  3467. {
  3468. let result = '';
  3469. let ureq = uroMarkers.obj;
  3470.  
  3471. if(uroPopup.renderIntent === "highlight")
  3472. {
  3473. if(uroMousedOverMapComment !== null)
  3474. {
  3475. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for camera highlight');
  3476. uroMousedOverOtherObjectWithinMapComment = true;
  3477. }
  3478. uroPopup.newPopupType = 'camera';
  3479. uroFID = uroMarkers.id;
  3480. uroDBG.AddLog('building popup for camera '+uroFID);
  3481. if(I18n.lookup("edit.camera.fields.type") === undefined)
  3482. {
  3483. result += '<b>Camera: ' + ureq.TYPES[ureq.attributes.type] + '</b>';
  3484. }
  3485. else
  3486. {
  3487. result += '<b>Camera: ' + I18n.lookup("edit.camera.fields.type." + ureq.attributes.type) + '</b>';
  3488. }
  3489. result += '<br>';
  3490. result += '<b>ID:</b> ' + uroFID + ' - ';
  3491. result += uroPopup.GetFormattedLocks(uroMarkers.obj.attributes);
  3492. result += '<br>';
  3493.  
  3494. result += '<b>Created by</b> ';
  3495. let userID;
  3496.  
  3497. if(W.model.users.getByIds([ureq.attributes.createdBy])[0] != null)
  3498. {
  3499. userID = ureq.attributes.createdBy;
  3500. result += uroUtils.GetUserNameAndRank(userID);
  3501. }
  3502. else result += 'unknown';
  3503. result += ', ';
  3504. let camAge = uroUtils.GetCameraAge(ureq,1);
  3505. if(camAge != -1)
  3506. {
  3507. result += uroUtils.ParseDaysAgo(camAge);
  3508. }
  3509. else result += 'unknown days ago';
  3510. result += '<br><b>Updated by</b> ';
  3511. if(W.model.users.getByIds([ureq.attributes.updatedBy])[0] != null)
  3512. {
  3513. userID = ureq.attributes.updatedBy;
  3514. result += uroUtils.GetUserNameAndRank(userID);
  3515. }
  3516. else result += 'unknown';
  3517. result += ', ';
  3518. camAge = uroUtils.GetCameraAge(ureq,0);
  3519. if(camAge != -1)
  3520. {
  3521. result += uroUtils.ParseDaysAgo(camAge);
  3522. }
  3523. else result += 'unknown days ago';
  3524.  
  3525. if(ureq.attributes.type !== 4)
  3526. {
  3527. result += '<br><b>Speed data:</b> ';
  3528. result += uroUtils.GetLocalisedSpeedString(ureq.attributes.speed);
  3529. if(uroIsCamSpeedValid(ureq) === false)
  3530. {
  3531. result += ' (differs to nearest segment)';
  3532. }
  3533. }
  3534. result += '<hr><ul>';
  3535. if(ureq.attributes.permissions !== 0)
  3536. {
  3537. result += '<li><a href="#" id="_deleteobject">Delete Camera</a>';
  3538. uroPopup.hasDeleteLink = true;
  3539. }
  3540. result += '</ul>';
  3541. uroPopup.result += result;
  3542. uroPopup.Show();
  3543. }
  3544. }
  3545. },
  3546. Comment: function()
  3547. {
  3548. if(uroUtils.GetCBChecked('_cbInhibitMapCommentPopup') === false)
  3549. {
  3550. if(uroMCLayer.name !== 'mapComments')
  3551. {
  3552. uroInit.WazeBits();
  3553. }
  3554. if(uroMCLayer !== null)
  3555. {
  3556. let result = '';
  3557.  
  3558. if(uroPopup.renderIntent == 'highlight')
  3559. {
  3560. let moAttrs = uroMarkers.obj.attributes;
  3561. if(uroUtils.GetExtent().intersectsBounds(moAttrs.geometry.getBounds()))
  3562. {
  3563. if(uroPopup.newPopupType === null)
  3564. {
  3565. if((uroMousedOverMapComment === moAttrs.id) && (uroMousedOverOtherObjectWithinMapComment === true))
  3566. {
  3567. uroDBG.AddLog('inhibit popup for map comment '+uroMousedOverMapComment);
  3568. }
  3569. else
  3570. {
  3571. uroMousedOverOtherObjectWithinMapComment = false;
  3572. if(moAttrs.geometry.id.indexOf('Polygon') !== -1)
  3573. {
  3574. // only capture ID for area comments...
  3575. uroMousedOverMapComment = moAttrs.id;
  3576. }
  3577. uroFID = moAttrs.id;
  3578. uroDBG.AddLog('building popup for map comment '+uroFID);
  3579.  
  3580. result += '<b>';
  3581. if(moAttrs.subject === '')
  3582. {
  3583. result += '<i>No subject</i>';
  3584. }
  3585. else result += uroUtils.Clickify(moAttrs.subject, '');
  3586. result += '</b><br>';
  3587. result += uroUtils.Clickify(moAttrs.body, '<br>');
  3588.  
  3589. let mcDaysOld = uroUtils.GetMCAge(moAttrs, 0, false);
  3590. let mcSubmittedTS = uroUtils.GetMCAge(moAttrs, 0, true);
  3591. if(mcSubmittedTS != -1)
  3592. {
  3593. mcSubmittedTS = uroUtils.GetDateTimeString(mcSubmittedTS);
  3594. }
  3595. if(mcDaysOld != -1)
  3596. {
  3597. result += '<i>Submitted ' + uroUtils.ParseDaysAgo(mcDaysOld) + ' ';
  3598. if(mcSubmittedTS != -1) result += '(' + mcSubmittedTS + ') ';
  3599. if(moAttrs.createdBy != null)
  3600. {
  3601. result += ' by '+uroUtils.GetUserNameAndRank(moAttrs.createdBy);
  3602. }
  3603. result += '</i><br>';
  3604. }
  3605. mcDaysOld = uroUtils.GetMCAge(moAttrs, 1, false);
  3606. mcSubmittedTS = uroUtils.GetMCAge(moAttrs, 1, true);
  3607. if(mcSubmittedTS != -1)
  3608. {
  3609. mcSubmittedTS = uroUtils.GetDateTimeString(mcSubmittedTS);
  3610. }
  3611. if(mcDaysOld != -1)
  3612. {
  3613. result += '<i>Updated ' + uroUtils.ParseDaysAgo(mcDaysOld) + ' ';
  3614. if(mcSubmittedTS != -1) result += '(' + mcSubmittedTS + ') ';
  3615. if(moAttrs.createdBy != null)
  3616. {
  3617. result += ' by '+uroUtils.GetUserNameAndRank(moAttrs.updatedBy);
  3618. }
  3619. result += '</i><br>';
  3620. }
  3621.  
  3622. mcDaysOld = uroUtils.GetMCAge(moAttrs,2,false);
  3623. mcSubmittedTS = uroUtils.GetMCAge(moAttrs,2,true);
  3624. if(mcDaysOld != -1)
  3625. {
  3626. result += '<i>Expires ' + uroUtils.ParseDaysToGo(mcDaysOld) + ' ';
  3627. result += '(' + uroUtils.GetDateTimeString(mcSubmittedTS) +')</i><br>';
  3628. }
  3629.  
  3630. let mcHasMyComments = false;
  3631. let mcNComments = moAttrs.conversation.length;
  3632. if(mcNComments > 0)
  3633. {
  3634. for(let j=0; j<mcNComments; j++)
  3635. {
  3636. if(moAttrs.conversation[j].userID == uroUserID)
  3637. {
  3638. mcHasMyComments = true;
  3639. break;
  3640. }
  3641. }
  3642. }
  3643. result += '<br>' + mcNComments +' comment';
  3644. if(mcNComments != 1) result += 's';
  3645. if((mcHasMyComments === false) && (mcNComments > 0)) result += ' (none by me)';
  3646.  
  3647. // add "ignore for this session" link
  3648. result += '<br><a href="#" id="_addtoignore">Hide for this session</a>';
  3649. uroPopup.hasIgnoreLink = true;
  3650.  
  3651. uroPopup.newPopupType = 'map_comment';
  3652. uroPopup.isMapComment = true;
  3653.  
  3654. uroPopup.result += result;
  3655. uroPopup.Show();
  3656. }
  3657. }
  3658. else
  3659. {
  3660. let mcOtherID = moAttrs.id;
  3661. uroDBG.AddLog('map comment '+mcOtherID+' is also highlighted');
  3662. }
  3663. }
  3664. else
  3665. {
  3666. uroDBG.AddLog('map comment '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  3667. }
  3668. }
  3669. }
  3670. }
  3671. },
  3672. AddClosureRow: function(rcObj)
  3673. {
  3674. let startDate = rcObj.attributes.startDate;
  3675. let endDate = "unknown";
  3676. if(rcObj.attributes.endDate !== null)
  3677. {
  3678. endDate = rcObj.attributes.endDate;
  3679. }
  3680. let provider = "---";
  3681. if(rcObj.attributes.provider !== null)
  3682. {
  3683. provider = rcObj.attributes.provider;
  3684. }
  3685. else if(rcObj.attributes.createdBy !== null)
  3686. {
  3687. provider = uroUtils.GetUserNameAndRank(rcObj.attributes.createdBy);
  3688. }
  3689. let reason = "---";
  3690. if(rcObj.attributes.reason !== null)
  3691. {
  3692. reason = rcObj.attributes.reason;
  3693. }
  3694. let mte = "---";
  3695. if(rcObj.attributes.eventId !== null)
  3696. {
  3697. try
  3698. {
  3699. mte = W.model.majorTrafficEvents.objects[rcObj.attributes.eventId].attributes.names[0].value;
  3700. }
  3701. catch(err)
  3702. {
  3703. }
  3704. }
  3705. let startOffset = uroGetRTCOffset(rcObj.attributes.startDate);
  3706. let duration = uroGetRTCDuration(rcObj);
  3707. let durationStr = '';
  3708.  
  3709. if(duration > 1)
  3710. {
  3711. durationStr = I18n.lookup("datetime.distance_in_words.x_days").other;
  3712. durationStr = durationStr.replace("%{count}", duration);
  3713. }
  3714. else
  3715. {
  3716. durationStr = I18n.lookup("datetime.distance_in_words.x_days").one;
  3717. if(duration === 0)
  3718. {
  3719. durationStr = "<" + durationStr;
  3720. }
  3721. }
  3722. let state = uroGetRTCState(rcObj);
  3723. let status = uroGetRTCStateText(rcObj);
  3724. let bgCol = '';
  3725. if(state === uroEnums.SRTC.EXPIRED)
  3726. {
  3727. bgCol = '#A0A0A0';
  3728. }
  3729. else if(state === uroEnums.SRTC.ACTIVE)
  3730. {
  3731. bgCol = '#FFFFFF';
  3732. }
  3733. else if(state === uroEnums.SRTC.FUTURE)
  3734. {
  3735. // For future closures, override the default status text with an indication
  3736. // of how many days until the start of the closure
  3737. if(startOffset == 0)
  3738. {
  3739. status = I18n.lookup("date.today");
  3740. status = status.charAt(0).toUpperCase() + status.slice(1);
  3741. }
  3742. else if(startOffset == 1)
  3743. {
  3744. status = I18n.lookup("datetime.distance_in_words.x_days").one;
  3745. }
  3746. else
  3747. {
  3748. status = I18n.lookup("datetime.distance_in_words.x_days").other;
  3749. status = status.replace("%{count}", startOffset);
  3750. }
  3751. bgCol = '#C0C0C0';
  3752. }
  3753. let result = '';
  3754. result += '<tr bgcolor="' + bgCol + '">';
  3755. result += '<td nowrap>' + status + '</td>';
  3756. result += '<td nowrap>' + startDate + ' to ' + endDate + ' (' + durationStr + ')</td>';
  3757. result += '<td nowrap>' + provider + '</td>';
  3758. result += '<td nowrap>' + reason + '</td>';
  3759. result += '<td nowrap>' + mte + '</td>';
  3760. result += '</td></tr>';
  3761. return result;
  3762. },
  3763. AddClosureDetails: function(cTypes, addType, addDesc)
  3764. {
  3765. let retval = '';
  3766. if((cTypes & addType) === addType)
  3767. {
  3768. retval += '<tr><td colspan=4><b>' + addDesc + ':</b></td></tr>';
  3769. for(let closure in uroRTCObjs)
  3770. {
  3771. if(uroRTCObjs.hasOwnProperty(closure))
  3772. {
  3773. let cObj = uroRTCObjs[closure];
  3774. if(cObj.direction === addType)
  3775. {
  3776. retval += uroPopup.AddClosureRow(cObj);
  3777. }
  3778. }
  3779. }
  3780. }
  3781. return retval;
  3782. },
  3783. Segment: function()
  3784. {
  3785. if(uroUtils.GetCBChecked('_cbInhibitSegPopup') === false)
  3786. {
  3787. {
  3788. if(uroUtils.GetExtent().intersectsBounds(uroMarkers.obj.attributes.geometry.getBounds()))
  3789. {
  3790. let result = '';
  3791. let doPopUp = false;
  3792. let restObj;
  3793.  
  3794. if(uroMousedOverMapComment !== null)
  3795. {
  3796. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for segment highlight');
  3797. uroMousedOverOtherObjectWithinMapComment = true;
  3798. }
  3799.  
  3800. let streetID = uroMarkers.obj.attributes.primaryStreetID;
  3801. if(streetID !== null)
  3802. {
  3803. // generic segment data
  3804. if(uroUtils.GetCBChecked('_cbInhibitSegGenericPopup') === false)
  3805. {
  3806. doPopUp = true;
  3807. uroDBG.AddLog('building popup for segment '+streetID);
  3808.  
  3809. let isToll = ((uroMarkers.obj.attributes.fwdToll == true) || (uroMarkers.obj.attributes.revToll == true));
  3810. result += uroGetAddress(streetID, null, true, false, isToll);
  3811.  
  3812. if(uroMarkers.obj.attributes.streetIDs.length > 0)
  3813. {
  3814. // list any alternate names
  3815. result += '<br>Alternate names:<br>';
  3816. for(let i = 0; i < uroMarkers.obj.attributes.streetIDs.length; ++i)
  3817. {
  3818. result += '&nbsp;<i>' + W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.name + ', ';
  3819. let cityName = "";
  3820. if(W.model.cities.objects[W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.cityID] != undefined)
  3821. {
  3822. cityName = W.model.cities.objects[W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.cityID].attributes.name;
  3823. }
  3824. if(cityName != "")
  3825. {
  3826. result += cityName;
  3827. }
  3828. else
  3829. {
  3830. result += ' no city';
  3831. }
  3832. result += '</i><br>';
  3833. }
  3834. result += '<br>';
  3835. }
  3836.  
  3837. result += '<b>ID: </b>'+uroMarkers.obj.attributes.id+' - ';
  3838. result += uroPopup.GetFormattedLocks(uroMarkers.obj.attributes);
  3839. result += ' - ';
  3840.  
  3841. let level = uroMarkers.obj.attributes.level;
  3842. result += '<b>' + I18n.lookup("edit.segment.fields.level") +': </b>';
  3843. if(level == 0)
  3844. {
  3845. result += I18n.lookup("edit.segment.levels")[0];
  3846. }
  3847. else
  3848. {
  3849. result += level;
  3850. }
  3851. result += '<br>';
  3852.  
  3853. let leBy = uroMarkers.obj.attributes.updatedBy;
  3854. let leOn = uroMarkers.obj.attributes.updatedOn;
  3855. if(leOn == null)
  3856. {
  3857. leBy = uroMarkers.obj.attributes.createdBy;
  3858. leOn = uroMarkers.obj.attributes.createdOn;
  3859. }
  3860. result += "<b>Last edit by</b> " + uroUtils.GetUserNameAndRank(leBy) + " <b>on</b> " + uroUtils.GetDateTimeString(leOn) + "<br><br>";
  3861.  
  3862. let fwdSpeed = uroMarkers.obj.attributes.fwdMaxSpeed;
  3863. let revSpeed = uroMarkers.obj.attributes.revMaxSpeed;
  3864. let fwdLanes = uroMarkers.obj.attributes.fwdLaneCount;
  3865. let revLanes = uroMarkers.obj.attributes.revLaneCount;
  3866. let fwdWidth = 'Not set';
  3867. let revWidth = 'Not set';
  3868. if(uroMarkers.obj.attributes.fromLanesInfo != null)
  3869. {
  3870. fwdWidth = uroGetLengthString(uroMarkers.obj.attributes.fromLanesInfo.laneWidth);
  3871. }
  3872. if(uroMarkers.obj.attributes.toLanesInfo != null)
  3873. {
  3874. revWidth = uroGetLengthString(uroMarkers.obj.attributes.toLanesInfo.laneWidth);
  3875. }
  3876. let fwdUnverified = uroMarkers.obj.attributes.fwdMaxSpeedUnverified;
  3877. let revUnverified = uroMarkers.obj.attributes.revMaxSpeedUnverified;
  3878. let fwdASC = ((uroMarkers.obj.attributes.fwdFlags & 1) === 1);
  3879. let revASC = ((uroMarkers.obj.attributes.revFlags & 1) === 1);
  3880. let roadType = uroMarkers.obj.attributes.roadType;
  3881. let verifyLimits = true;
  3882. if((roadType === 17) || (roadType === 20))
  3883. {
  3884. verifyLimits = false;
  3885. }
  3886.  
  3887. result += '<table border=1><tr><th>Dir</th><th>Speed</th><th>ASC</th><th>Lanes</th><th>Width</th></tr>';
  3888. if(uroMarkers.obj.attributes.fwdDirection)
  3889. {
  3890. result += '<tr><td><b>A-B</b></td><td>'+uroUtils.GetLocalisedSpeedString(fwdSpeed)+'</td><td>';
  3891. if(fwdASC == true)
  3892. {
  3893. result += 'Yes';
  3894. }
  3895. else
  3896. {
  3897. result += 'No';
  3898. }
  3899. result += '</td><td>';
  3900. if(fwdLanes > 0)
  3901. {
  3902. result += fwdLanes;
  3903. }
  3904. else
  3905. {
  3906. result += 'Not set';
  3907. }
  3908. result += '</td><td>'+fwdWidth+'</td></tr>';
  3909. }
  3910. if(uroMarkers.obj.attributes.revDirection)
  3911. {
  3912. result += '<tr><td><b>B-A</b></td><td>'+uroUtils.GetLocalisedSpeedString(revSpeed)+'</td><td>';
  3913. if(revASC == true)
  3914. {
  3915. result += 'Yes';
  3916. }
  3917. else
  3918. {
  3919. result += 'No';
  3920. }
  3921. result += '</td><td>';
  3922. if(revLanes > 0)
  3923. {
  3924. result += revLanes;
  3925. }
  3926. else
  3927. {
  3928. result += 'Not set';
  3929. }
  3930. result += '</td><td>'+revWidth+'</td></tr>';
  3931. }
  3932. result += '</table>';
  3933.  
  3934. if((uroMarkers.obj.attributes.fwdDirection) && (uroMarkers.obj.attributes.revDirection) && (fwdSpeed != revSpeed) && (!fwdUnverified) && (!revUnverified))
  3935. {
  3936. result += '<br>Two-way segment has different verified speed limits...';
  3937. }
  3938. }
  3939.  
  3940. // segment restrictions
  3941. if(uroMarkers.obj.attributes.restrictions.length > 0)
  3942. {
  3943. result += '<br><table border=1>';
  3944. doPopUp = true;
  3945. let fwdResult = '<tr><td colspan=13><b>A-B restrictions:</b></td></tr>';
  3946. let revResult = '<tr><td colspan=13><b>B-A restrictions:</b></td></tr>';
  3947. let bothResult = '<tr><td colspan=13><b>Two-way restrictions:</b></td></tr>';
  3948.  
  3949. let nABRestrictions = 0;
  3950. let nBARestrictions = 0;
  3951. let nBothRestrictions = 0;
  3952. for(let idx = 0; idx < uroMarkers.obj.attributes.restrictions.length; idx++)
  3953. {
  3954. restObj = uroMarkers.obj.attributes.restrictions[idx];
  3955. if(restObj._direction === "FWD")
  3956. {
  3957. nABRestrictions++;
  3958. fwdResult += uroFormatRestriction(restObj);
  3959. }
  3960. else if(restObj._direction === "REV")
  3961. {
  3962. nBARestrictions++;
  3963. revResult += uroFormatRestriction(restObj);
  3964. }
  3965. else if(restObj._direction === "BOTH")
  3966. {
  3967. nBothRestrictions++;
  3968. bothResult += uroFormatRestriction(restObj);
  3969. }
  3970. else
  3971. {
  3972. uroDBG.AddLog("unknown restriction direction...");
  3973. }
  3974. }
  3975. if(nABRestrictions > 0)
  3976. {
  3977. result += fwdResult;
  3978. }
  3979. if(nBARestrictions > 0)
  3980. {
  3981. result += revResult;
  3982. }
  3983. if(nBothRestrictions > 0)
  3984. {
  3985. result += bothResult;
  3986. }
  3987. result += '</table>';
  3988. }
  3989. if(uroLayers.layers[uroLayers.ID.RTC].l.getVisibility() === true)
  3990. {
  3991. let closureTypes = uroGetSelectedSegmentRTCs(uroMarkers.obj.attributes.id);
  3992. if(closureTypes !== uroEnums.DRTC.NONE)
  3993. {
  3994. result += '<br><table border=1 width="100%">';
  3995.  
  3996. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.SEG_AB, "A-B closures");
  3997. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.SEG_BA, "B-A closures");
  3998. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.SEG_BI, "Two-way closures");
  3999. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.TURN_OUT, "Outbound turn closures");
  4000. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.TURN_IN, "Inbound turn closures");
  4001. doPopUp = true;
  4002. result += '</table>';
  4003. }
  4004. }
  4005.  
  4006. if(doPopUp === true)
  4007. {
  4008. uroFID = uroMarkers.obj.attributes.id;
  4009. uroPopup.newPopupType = 'segment_restriction';
  4010. }
  4011. }
  4012. uroPopup.result += result;
  4013. uroPopup.Show();
  4014. }
  4015. else
  4016. {
  4017. uroDBG.AddLog('segment '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  4018. }
  4019. }
  4020. }
  4021. },
  4022. Node: function()
  4023. {
  4024. if(uroUtils.GetCBChecked('_cbInhibitNodesPopup') === false)
  4025. {
  4026. let result = '';
  4027. let ureq = W.model.nodes.objects[uroMarkers.id];
  4028. if(ureq === undefined)
  4029. {
  4030. uroMarkers.id = null;
  4031. }
  4032. else
  4033. {
  4034. if(uroMousedOverMapComment !== null)
  4035. {
  4036. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for node highlight');
  4037. uroMousedOverOtherObjectWithinMapComment = true;
  4038. }
  4039. uroPopup.newPopupType = 'node';
  4040. uroFID = uroMarkers.id;
  4041. uroDBG.AddLog('building popup for node '+uroFID);
  4042. result += '<b>Node: ' + uroFID + '</b><br>';
  4043.  
  4044. let nodeSegRTCs = [];
  4045. for(let k=0; k<ureq.attributes.segIDs.length; k++)
  4046. {
  4047. let nodeSegID = ureq.attributes.segIDs[k];
  4048. let nodeSegObj = W.model.segments.objects[nodeSegID];
  4049. if(nodeSegObj !== undefined)
  4050. {
  4051. let nodeStreetID = nodeSegObj.attributes.primaryStreetID;
  4052. result += uroGetAddress(nodeStreetID, null, false, true, false);
  4053. }
  4054. uroGetSelectedSegmentRTCs(nodeSegID);
  4055. nodeSegRTCs = nodeSegRTCs.concat(uroRTCObjs);
  4056. }
  4057. }
  4058. uroPopup.result += result;
  4059. uroPopup.Show();
  4060. }
  4061. },
  4062. UMPExtras: function(ureq)
  4063. {
  4064. // add "open new WME tab" link
  4065. let urPos=new OpenLayers.LonLat();
  4066. if(uroPopup.isPlaceUpdate)
  4067. {
  4068. urPos.lon = ureq.getOLGeometry().getCentroid().x;
  4069. urPos.lat = ureq.getOLGeometry().getCentroid().y;
  4070. }
  4071. else
  4072. {
  4073. if(ureq.attributes.geometry.realX === undefined)
  4074. {
  4075. urPos.lon = ureq.attributes.geometry.x;
  4076. urPos.lat = ureq.attributes.geometry.y;
  4077. }
  4078. else
  4079. {
  4080. urPos.lon = ureq.attributes.geometry.realX;
  4081. urPos.lat = ureq.attributes.geometry.realY;
  4082. }
  4083. }
  4084. urPos = uroUtils.ConvertMercatorToWGS84(urPos);
  4085. let urLink = document.location.href;
  4086. let urLayers = '';
  4087. urLink = urLink.substr(0,urLink.indexOf('?zoomLevel'));
  4088. urLink += '?zoomLevel=17&lat='+urPos.lat+'&lon='+urPos.lon+urLayers;
  4089.  
  4090. if(uroPopup.isUR) urLink += '&mapUpdateRequest='+uroMarkers.id;
  4091. else if(uroPopup.isTurnProb) urLink += '&showturn='+uroMarkers.id+'&endshow';
  4092. else if(uroPopup.isProblem) urLink += '&mapProblem='+uroMarkers.id;
  4093. else if(uroPopup.isPlaceUpdate)
  4094. {
  4095. if(uroMarkers.type == uroLayers.ID.PUR)
  4096. {
  4097. urLink += '&showpur='+uroMarkers.id+'&endshow';
  4098. }
  4099. else
  4100. {
  4101. urLink += '&showppur='+uroMarkers.id+'&endshow';
  4102. }
  4103. }
  4104.  
  4105. let targetTab = "_uroTab_" + Math.round(Math.random()*1000000);
  4106. uroPopup.result += '<hr><ul><li><a href="'+urLink+'" id="_openInNewTab" target="'+targetTab+'">Open in new tab</a> - ';
  4107. uroPopup.hasOpenInNewTabLink = true;
  4108. uroPopup.result += '<a href="#" id="_recentreSession">centre in current tab</a>';
  4109. uroPopup.hasRecentreSessionLink = true;
  4110.  
  4111. // add "open new livemap tab" link
  4112. let lmLink = null;
  4113. if(document.getElementById("livemap-link") != null)
  4114. {
  4115. uroDBG.AddLog('Livemap link in livemap-link id element');
  4116. lmLink = document.getElementById("livemap-link").href;
  4117. }
  4118. else if(document.getElementsByClassName("livemap-link") != null)
  4119. {
  4120. uroDBG.AddLog('Livemap link in livemap-link class element');
  4121. lmLink = document.getElementsByClassName("livemap-link")[0].href;
  4122. }
  4123. else
  4124. {
  4125. uroDBG.AddLog('Livemap link not found...');
  4126. }
  4127. if(lmLink !== null)
  4128. {
  4129. let zpos = lmLink.indexOf('?');
  4130. if(zpos > -1) lmLink = lmLink.substr(0,zpos);
  4131. lmLink += '?zoom=17&lat='+urPos.lat+'&lon='+urPos.lon+'&layers=BTTTT';
  4132. uroPopup.result += '<li><a href="'+lmLink+'" target="_lmTab">Open in new livemap tab</a>';
  4133. }
  4134. if(!uroPopup.isPlaceUpdate)
  4135. {
  4136. // add "ignore for this session" link
  4137. uroPopup.result += '<li><a href="#" id="_addtoignore">Hide for this session</a></ul>';
  4138. uroPopup.hasIgnoreLink = true;
  4139. }
  4140.  
  4141. uroPopup.Show();
  4142. },
  4143. Preamble: function()
  4144. {
  4145. let retval = true;
  4146.  
  4147. if
  4148. (
  4149. (uroMarkers.type === null) &&
  4150. (uroPopup.timer === 0)
  4151. )
  4152. {
  4153. if(uroPopup.shown === true)
  4154. {
  4155. uroPopup.Hide();
  4156. }
  4157. uroMousedOverMapComment = null;
  4158. retval = false;
  4159. }
  4160. if(retval === true)
  4161. {
  4162. if(uroMTEMode)
  4163. {
  4164. retval = false;
  4165. }
  4166. }
  4167.  
  4168. if(retval === true)
  4169. {
  4170. if(!uroInit.initialised)
  4171. {
  4172. retval = false;
  4173. }
  4174. }
  4175.  
  4176. if(retval === true)
  4177. {
  4178. if((uroMouseIsDown) && (uroMarkers.mouseButtons === 0))
  4179. {
  4180. uroDBG.AddLog('trapped erroneous mousedown state');
  4181. uroMouseIsDown = false;
  4182. }
  4183. if(uroMouseIsDown)
  4184. {
  4185. retval = false;
  4186. }
  4187. }
  4188.  
  4189. if(retval === true)
  4190. {
  4191. if(OpenLayers === null)
  4192. {
  4193. if(uroNullOpenLayers === false)
  4194. {
  4195. uroDBG.AddLog('caught null OpenLayers');
  4196. uroNullOpenLayers = true;
  4197. }
  4198. retval = false;
  4199. }
  4200. else
  4201. {
  4202. uroNullOpenLayers = false;
  4203. }
  4204. }
  4205.  
  4206. if(retval === true)
  4207. {
  4208. if(uroLayers.layers[uroLayers.ID.UR].l === null)
  4209. {
  4210. if(uroNullURLayer === false)
  4211. {
  4212. uroDBG.AddLog('caught null UR layer');
  4213. uroNullURLayer = true;
  4214. }
  4215. retval = false;
  4216. }
  4217. else
  4218. {
  4219. uroNullURLayer = false;
  4220. }
  4221. }
  4222.  
  4223. if(retval === true)
  4224. {
  4225. if(uroLayers.layers[uroLayers.ID.MP].l === null)
  4226. {
  4227. if(uroNullProblemLayer === false)
  4228. {
  4229. uroDBG.AddLog('caught null problem layer');
  4230. uroNullProblemLayer = true;
  4231. }
  4232. retval = false;
  4233. }
  4234. else
  4235. {
  4236. uroNullProblemLayer = false;
  4237. }
  4238. }
  4239.  
  4240. if(retval === true)
  4241. {
  4242. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  4243. {
  4244. retval = false;
  4245. }
  4246. }
  4247.  
  4248. if(retval === true)
  4249. {
  4250. if(uroTestPointerOutsideMap(uroMarkers.clientX, uroMarkers.clientY))
  4251. {
  4252. retval = false;
  4253. }
  4254. }
  4255.  
  4256.  
  4257. if(retval === true)
  4258. {
  4259. uroPopup.mouseX = uroMarkers.mouseX;
  4260. uroPopup.mouseY = uroMarkers.mouseY;
  4261. uroPopup.result = '';
  4262. uroPopup.hasIgnoreLink = false;
  4263. uroPopup.hasDeleteLink = false;
  4264. uroPopup.hasAddWatchLink = false;
  4265. uroPopup.hasRemoveWatchLink = false;
  4266. uroPopup.hasUpdateWatchLink = false;
  4267. uroPopup.hasRecentreSessionLink = false;
  4268. uroPopup.hasOpenInNewTabLink = false;
  4269. uroPopup.isVenue = false;
  4270. uroPopup.isMapComment = false;
  4271. uroPopup.newPopupType = null;
  4272. uroPopup.ureqID = null;
  4273. uroPopup.isUR = false;
  4274. uroPopup.isProblem = false;
  4275. uroPopup.isTurnProb = false;
  4276. uroPopup.isPlaceUpdate = false;
  4277. uroPopup.renderIntent = uroGetFeatureRenderIntent(uroMarkers.obj);
  4278.  
  4279. uroInit.WazeBits();
  4280.  
  4281. let mouseLonLat = W.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(uroPopup.mouseX, uroPopup.mouseY));
  4282. let mousePoint = new OpenLayers.Geometry.Point(mouseLonLat.lon, mouseLonLat.lat);
  4283. if(uroMousedOverMapComment !== null)
  4284. {
  4285. if(W.model.mapComments.objects[uroMousedOverMapComment] === undefined)
  4286. {
  4287. uroDBG.AddLog('clearing uroMousedOverMapComment: object no longer exists in current map view');
  4288. uroMousedOverMapComment = null;
  4289. }
  4290. else if(W.model.mapComments.objects[uroMousedOverMapComment].attributes.geometry.containsPoint(mousePoint) === false)
  4291. {
  4292. uroDBG.AddLog('clearing uroMousedOverMapComment: pointer no longer within comment boundary');
  4293. uroMousedOverMapComment = null;
  4294. }
  4295. }
  4296. let popupXOffset = document.getElementById('editor-container').getBoundingClientRect().x;
  4297. let popupYOffset = $(document.getElementById("WazeMap")).offset().top;
  4298. uroPopup.pX = uroPopup.mouseX + popupXOffset + 10;
  4299. uroPopup.pY = uroPopup.mouseY + popupYOffset;
  4300. }
  4301.  
  4302. return retval;
  4303. },
  4304. Show: function()
  4305. {
  4306. if(uroPopup.suppressed === false)
  4307. {
  4308. if((uroFID != uroShownFID) || (uroPopup.newPopupType != uroPopup.shownType))
  4309. {
  4310. if(uroFID != uroShownFID) uroDBG.AddLog('FID mismatch, show popup: '+uroFID+'/'+uroShownFID);
  4311. else uroDBG.AddLog('Popup type mismatch: '+uroPopup.newPopupType+'/'+uroPopup.shownType);
  4312. uroShownFID = uroFID;
  4313. uroPopup.shownType = uroPopup.newPopupType;
  4314. uroPopup.shown = false;
  4315. }
  4316. if(uroPopup.shown === false)
  4317. {
  4318. uroPopup.shown = true;
  4319. uroDiv.style.height = "auto";
  4320. uroDiv.style.width = "auto";
  4321. uroDiv.style.overflow = "auto";
  4322. uroDiv.innerHTML = uroUtils.ModifyHTML(uroPopup.result);
  4323. if((uroFID != -1) && (uroPopup.hasIgnoreLink === true))
  4324. {
  4325. uroUtils.AddEventListener('_addtoignore','click', uroIgnore.Add, true);
  4326. }
  4327. if(uroPopup.hasOpenInNewTabLink === true)
  4328. {
  4329. uroUtils.AddEventListener('_openInNewTab','mouseup', uroOpenNewTab, true);
  4330. }
  4331. if(uroPopup.hasRecentreSessionLink === true)
  4332. {
  4333. if(uroPopup.isUR) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnUR, true);
  4334. else if((uroPopup.isProblem)||(uroPopup.isTurnProb)) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnMP, true);
  4335. else if(uroPopup.isPlaceUpdate)
  4336. {
  4337. if(uroPopup.newPopupType == uroLayers.ID.PUR)
  4338. {
  4339. uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnPUR, true);
  4340. }
  4341. else
  4342. {
  4343. uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnPPUR, true);
  4344. }
  4345. }
  4346. else if(uroPopup.isVenue) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnVenueNavPoint, true);
  4347. }
  4348. // restrict the popup width to be no wider than just under half the window width to avoid it
  4349. // completely overlapping the marker it's associated with - by keeping it to just below half
  4350. // the window width we guarantee that it'll fit either to the left or the right of the marker
  4351. // no matter how far across the screen the marker is located...
  4352. let rw = parseInt(uroDiv.clientWidth);
  4353. if(rw > (window.innerWidth * 0.45))
  4354. {
  4355. rw = (window.innerWidth * 0.45);
  4356. uroDiv.style.width = rw+'px';
  4357. }
  4358. // get the div height after any adjustment of the width above, to account for whatever content
  4359. // reflow may have occurred as a result of reducing the width...
  4360. let rh = parseInt(uroDiv.clientHeight);
  4361. // similarly restrict the popup height to avoid it dropping of the bottom of the screen if a
  4362. // segment has a bunch of closures/restrictions
  4363. rh = parseInt(uroDiv.clientHeight);
  4364. if(rh > (window.innerHeight * 0.80))
  4365. {
  4366. rh = (window.innerHeight * 0.80);
  4367. uroDiv.style.height = rh+'px';
  4368. uroDiv.style.overflow = 'scroll';
  4369. }
  4370. let origPopupX = uroPopup.pX;
  4371. let movedLeft = false;
  4372. if((uroPopup.pX + rw) > window.innerWidth)
  4373. {
  4374. // where the popup would be off the right hand side of the screen, move it completely over to the
  4375. // other side of the mouse pointer
  4376. uroPopup.pX -= (rw + 20);
  4377. if(uroPopup.pX < 0) uroPopup.pX = 0;
  4378. movedLeft = true;
  4379. }
  4380. if((uroPopup.pY + rh) > window.innerHeight)
  4381. {
  4382. // where the popup would be off the bottom of the screen, shift it up just far enough to be
  4383. // fully visible
  4384. uroPopup.pY -= (((uroPopup.pY + rh) - window.innerHeight) + 30);
  4385. }
  4386. if(uroPopup.pY < 0) uroPopup.pY = 0;
  4387. uroDiv.style.top = uroPopup.pY+'px';
  4388. uroDiv.style.left = uroPopup.pX+'px';
  4389. if(movedLeft === true)
  4390. {
  4391. // after relocating the popup to the left of the pointer, it may end up resizing itself
  4392. // which may then cause it to completely overlap the UR marker, so perform one more check
  4393. // of the div width and nudge to the left if required...
  4394. rw = parseInt(uroDiv.clientWidth);
  4395. if(rw > (window.innerWidth * 0.45))
  4396. {
  4397. rw = (window.innerWidth * 0.45);
  4398. uroDiv.style.width = rw+'px';
  4399. }
  4400. let nudgeDist = parseInt(20 + (uroPopup.pX + rw) - origPopupX);
  4401. if((uroPopup.pX + rw + 30) >= origPopupX)
  4402. {
  4403. uroDiv.style.left = parseInt(uroPopup.pX - nudgeDist)+'px';
  4404. }
  4405. }
  4406.  
  4407. uroDBG.AddLog('display popup at '+uroPopup.pX+','+uroPopup.pY);
  4408. uroDiv.style.visibility = 'visible';
  4409. uroPopup.autoHideTimer = (uroUtils.GetElmValue('_inputPopupAutoHideTimeout') * 10);
  4410. }
  4411. uroPopup.timer = -1;
  4412. }
  4413. },
  4414. Generate: function()
  4415. {
  4416. if(uroPopup.Preamble() === true)
  4417. {
  4418. if(uroMarkers.type === uroLayers.ID.UR) uroPopup.UR();
  4419. else if(uroMarkers.type === uroLayers.ID.MP) uroPopup.MP();
  4420. else if((uroMarkers.type === uroLayers.ID.PUR)||(uroMarkers.type === uroLayers.ID.PPUR)||(uroMarkers.type === uroLayers.ID.RPUR)) uroPopup.PUR();
  4421. else if(uroMarkers.type === "venue") uroPopup.Venue();
  4422. else if(uroMarkers.type === "cam") uroPopup.Camera();
  4423. else if(uroMarkers.type === "comment") uroPopup.Comment();
  4424. else if(uroMarkers.type === "segment") uroPopup.Segment();
  4425. else if(uroMarkers.type === "node") uroPopup.Node();
  4426. else
  4427. {
  4428. uroDBG.AddLog("request to generate popup for unknown type - " + uroMarkers.type);
  4429. }
  4430. }
  4431. },
  4432. Hide: function()
  4433. {
  4434. if(uroPopup.shown)
  4435. {
  4436. uroDiv.style.visibility = 'hidden';
  4437. uroPopup.shown = false;
  4438. uroPopup.timer = -2;
  4439. uroShownFID = -1;
  4440. }
  4441. uroPopup.suppressed = false;
  4442. },
  4443. Suppress: function()
  4444. {
  4445. uroDiv.style.visibility = 'hidden';
  4446. window.getSelection().removeAllRanges();
  4447. uroPopup.suppressed = true;
  4448. },
  4449. MouseOver: function()
  4450. {
  4451. uroPopup.mouseIn = true;
  4452. },
  4453. MouseOut: function()
  4454. {
  4455. uroPopup.mouseIn = false;
  4456. }
  4457. };
  4458. const uroURExtras = // UR marker enhancements
  4459. {
  4460. urList : [],
  4461. URListEntry: function(id, customType, hasMyComments, nComments, ageLastComment)
  4462. {
  4463. this.id = id;
  4464. this.customType = customType;
  4465. this.hasMyComments = hasMyComments;
  4466. this.nComments = nComments;
  4467. this.ageLastComment = ageLastComment;
  4468. },
  4469. AddToList: function(urID, customType, hasMyComments, nComments, ageLastComment)
  4470. {
  4471. uroURExtras.urList.push(new uroURExtras.URListEntry(urID, customType, hasMyComments, nComments, ageLastComment));
  4472. },
  4473. AddCommentCounts: function()
  4474. {
  4475. // Remove existing count elements before (re-)rendering, as WME doesn't automatically do this
  4476. // for us now that the way it handles the marker layers has changed...
  4477. let toRemove = document.querySelectorAll('#uroCommentCount');
  4478. let trCount = toRemove.length;
  4479. while(trCount > 0)
  4480. {
  4481. --trCount;
  4482. toRemove[trCount].remove();
  4483. }
  4484. let addCommentCount = false;
  4485. let nURs = uroURExtras.urList.length;
  4486.  
  4487. if(uroUtils.GetCBChecked('_cbMasterEnable') === true)
  4488. {
  4489. addCommentCount = ((nURs > 0) && (uroUtils.GetCBChecked('_cbCommentCount') === true));
  4490. }
  4491.  
  4492. if(addCommentCount === true)
  4493. {
  4494. for(let i = 0; i < nURs; ++i)
  4495. {
  4496. let uObj = uroURExtras.urList[i];
  4497. let nComments = uObj.nComments;
  4498. let marker = uroGetMarker(uroLayers.ID.UR, uObj.id);
  4499. if((marker !== null) && (nComments !== 0))
  4500. {
  4501. let mx = (marker.x.baseVal.value - 15);
  4502. let my = (marker.y.baseVal.value + 35);
  4503. let newSpan = '<foreignObject id="uroCommentCount" x="' + mx + '" y="' + my + '" width="100%" height="100%" style="pointer-events: none;">';
  4504.  
  4505. newSpan += '<div style="position:absolute;';
  4506. if(uObj.hasMyComments === true)
  4507. {
  4508. newSpan += 'background-color: yellow;';
  4509. }
  4510. else
  4511. {
  4512. newSpan += 'background-color: white;';
  4513. }
  4514. newSpan += 'font-size: 14px;font-weight: 800;';
  4515. newSpan += 'border-width: 1px;border-style: solid;border-radius: 12px;padding-left: 4px;padding-right: 4px;z-index: 1;';
  4516. newSpan += '">';
  4517. newSpan += nComments + 'c ';
  4518. newSpan += uObj.ageLastComment + 'd';
  4519. newSpan += '</div>';
  4520.  
  4521. newSpan += '</foreignObject>';
  4522. marker.insertAdjacentHTML("afterend", newSpan);
  4523. }
  4524. }
  4525. }
  4526. }
  4527. };
  4528. const uroInit = // script initialisation
  4529. {
  4530. initialised : false,
  4531. setupListeners : true,
  4532. finalisingListenerSetup : false,
  4533.  
  4534. WazeBitsAvailable: function()
  4535. {
  4536. uroDBG.AddLog('All WazeBits present and correct...');
  4537. W.prefs.on('change:isImperial', uroInit.Initialise);
  4538. uroLayers.Init();
  4539. // To avoid creating multiple URO tabs in the event that the initialise code
  4540. // gets called more than once, we now test for the presence of our tab and skip
  4541. // if it's already present
  4542. if(document.getElementById('uroTabHeader') === null)
  4543. {
  4544. uroInit.SetupUI();
  4545. }
  4546. },
  4547. WaitForW: function()
  4548. {
  4549. if(document.getElementsByClassName("sandbox").length > 0)
  4550. {
  4551. uroDBG.AddLog('WME practice mode detected, script is disabled...');
  4552. return;
  4553. }
  4554. if(window.W === undefined)
  4555. {
  4556. window.setTimeout(uroInit.WaitForW, 100);
  4557. return;
  4558. }
  4559. if (W.userscripts?.state?.isReady)
  4560. {
  4561. uroInit.WazeBitsAvailable();
  4562. }
  4563. else
  4564. {
  4565. document.addEventListener("wme-ready", uroInit.WazeBitsAvailable, {once: true});
  4566. }
  4567. },
  4568. AddInterceptor: function()
  4569. {
  4570. uroDBG.AddLog('Adding interceptor functions...');
  4571. // add interceptor function for window.confirm(), to inhibit the closure deletion confirmation that would
  4572. // pop up for each individual closure when we're using the delete all button - the user has already
  4573. // confirmed the delete action using our own requester
  4574. let _confirm = window.confirm;
  4575. window.confirm = function(msg)
  4576. {
  4577. let cm_delete_confirm = I18n.lookup("closures.delete_confirm").split('"')[0].trimRight(1);
  4578. if(msg.indexOf(cm_delete_confirm) != -1)
  4579. {
  4580. uroDBG.AddLog('intercepted closure delete confirmation...');
  4581. if(uroRTCClone.ConfirmDelete)
  4582. {
  4583. return _confirm(msg);
  4584. }
  4585. else
  4586. {
  4587. return true;
  4588. }
  4589. }
  4590. else if(typeof(msg) == 'undefined')
  4591. {
  4592. uroDBG.AddLog('Intercepted blank confirmation...');
  4593. return true;
  4594. }
  4595. else
  4596. {
  4597. return _confirm(msg);
  4598. }
  4599. };
  4600. uroConfirmIntercepted = true;
  4601. },
  4602. Initialise: function()
  4603. {
  4604. uroInit.initialised = false;
  4605. uroInit.setupListeners = true;
  4606. uroInit.finalisingListenerSetup = false;
  4607. uroInit.WaitForW();
  4608. },
  4609. WaitForControlsContainer: function()
  4610. {
  4611. if(document.getElementById('uroControlsContainer') === null)
  4612. {
  4613. window.setTimeout(uroInit.WaitForControlsContainer,500);
  4614. }
  4615. else
  4616. {
  4617. let updateURL = 'https://greasyfork.org/scripts/1952-uroverview-plus-uro';
  4618. uroDBG.AddLog('adding controls to sidebar container...');
  4619. let tabbyHTML = '<div id="uroTabHeader"><b><a href="'+updateURL+'" target="_blank">UROverview Plus</a></b> <label id="_uroVersion">'+uroRelease.version+'</label>';
  4620. tabbyHTML += '<label id="_uroDebugMode">(dbg)</label>';
  4621. tabbyHTML += '&nbsp;<input type="checkbox" id="_cbMasterEnable" checked>Enabled</input>';
  4622. tabbyHTML += uroTabs.CreateTabHeaders();
  4623. tabbyHTML += '</div>';
  4624. document.getElementById('uroControlsContainer').innerHTML = uroUtils.ModifyHTML(tabbyHTML);
  4625. uroTabs.CreateTabBodies();
  4626. // other sidebar elements
  4627. uroAMList = document.createElement('div');
  4628. uroAMList.style.color = "#ffff00";
  4629. uroCtrlHides = document.createElement('div');
  4630. // footer for tabs container
  4631. uroCtrlHides.id = 'uroCtrlHides';
  4632. let tHTML = '<input type="button" id="_btnUndoLastHide" value="Undo last hide" />&nbsp;&nbsp;&nbsp;';
  4633. tHTML += '<input type="button" id="_btnClearSessionHides" value="Undo all hides" /><p>';
  4634. uroCtrlHides.innerHTML = uroUtils.ModifyHTML(tHTML);
  4635. // footer for AM list
  4636. uroAMList.id = 'uroAMList';
  4637. uroTabs.CtrlTabs[0][uroTabs.FIELDS.SHOWFN]();
  4638. window.addEventListener("beforeunload", uroConfig.SaveSettings, false);
  4639. }
  4640. },
  4641. AddTab_API: async function()
  4642. {
  4643. let {tabLabel, tabPane} = W.userscripts.registerSidebarTab("URO+");
  4644. tabLabel.innerText = "URO+";
  4645. tabPane.innerHTML = uroUtils.ModifyHTML(uroControls.innerHTML);
  4646. await W.userscripts.waitForElementConnected(tabPane);
  4647. uroInit.CompleteUISetup();
  4648. },
  4649. CompleteUISetup: function()
  4650. {
  4651. uroDBG.AddLog('waiting for controls container...');
  4652. uroInit.WaitForControlsContainer();
  4653. uroGetProblemTypes();
  4654. uroTabs.AddToDOM();
  4655. document.getElementById('uroControlsContainer').appendChild(uroCtrlHides);
  4656. uroInit.WazeBits();
  4657. uroDiv.addEventListener("mouseover", uroPopup.MouseOver, false);
  4658. uroDiv.addEventListener("mouseout", uroPopup.MouseOut, false);
  4659. if(sessionStorage.UROverview_FID_IgnoreList === undefined) sessionStorage.UROverview_FID_IgnoreList = '';
  4660. if(sessionStorage.UROverview_FID_WatchList === undefined) sessionStorage.UROverview_FID_WatchList = '';
  4661. if(uroConfirmIntercepted === false) uroInit.AddInterceptor();
  4662. uroUtils.AddStyle('urostyle_UnstackedMarkers', '.map-marker.marker-selected { transform: scale(1) !important; }');
  4663. uroMainTickHandlerID = window.setInterval(uroMainTick,1000);
  4664. },
  4665. SetupUI: function()
  4666. {
  4667. // create a new div to display the UR details floaty-box
  4668. uroDiv = document.createElement('div');
  4669. uroDiv.id = "uroDiv";
  4670. uroDiv.style.position = 'absolute';
  4671. uroDiv.style.visibility = 'hidden';
  4672. uroDiv.style.top = '0';
  4673. uroDiv.style.left = '0';
  4674. uroDiv.style.zIndex = 10000;
  4675. uroDiv.style.backgroundColor = 'aliceblue';
  4676. uroDiv.style.borderWidth = '3px';
  4677. uroDiv.style.borderStyle = 'solid';
  4678. uroDiv.style.borderRadius = '10px';
  4679. uroDiv.style.boxShadow = '5px 5px 10px Silver';
  4680. uroDiv.style.padding = '4px';
  4681. document.body.appendChild(uroDiv);
  4682. // create a new div to display script alerts
  4683. uroAlerts = document.createElement('div');
  4684. uroAlerts.id = "uroAlerts";
  4685. uroAlerts.style.position = 'fixed';
  4686. uroAlerts.style.visibility = 'hidden';
  4687. uroAlerts.style.top = '50%';
  4688. uroAlerts.style.left = '50%';
  4689. uroAlerts.style.zIndex = 10000;
  4690. uroAlerts.style.backgroundColor = 'aliceblue';
  4691. uroAlerts.style.borderWidth = '3px';
  4692. uroAlerts.style.borderStyle = 'solid';
  4693. uroAlerts.style.borderRadius = '10px';
  4694. uroAlerts.style.boxShadow = '5px 5px 10px Silver';
  4695. uroAlerts.style.padding = '4px';
  4696. uroAlerts.style.webkitTransform = "translate(-50%, -50%)";
  4697. uroAlerts.style.transform = "translate(-50%, -50%)";
  4698. let alertsHTML = '<div id="header" style="padding: 4px; background-color:LightGreen; font-weight: bold;">Alert title goes here...</div>';
  4699. alertsHTML += '<div id="content" style="padding: 4px; background-color:White; overflow:auto;max-height:500px">Alert content goes here...</div>';
  4700. alertsHTML += '<div id="controls" align="center" style="padding: 4px;">';
  4701. alertsHTML += '<span id="uroAlertTickBtn" style="cursor:pointer;font-size:14px;border:thin outset black;padding:2px 10px 2px 10px;">';
  4702. alertsHTML += '<i class="fa fa-check"> </i>';
  4703. alertsHTML += '<span id="uroAlertTickBtnCaption" style="font-weight: bold;"></span>';
  4704. alertsHTML += '</span>';
  4705. alertsHTML += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  4706. alertsHTML += '<span id="uroAlertCrossBtn" style="cursor:pointer;font-size:14px;border:thin outset black;padding:2px 10px 2px 10px;">';
  4707. alertsHTML += '<i class="fa fa-times"> </i>';
  4708. alertsHTML += '<span id="uroAlertCrossBtnCaption" style="font-weight: bold;"></span>';
  4709. alertsHTML += '</span>';
  4710. alertsHTML += '</div>';
  4711. uroAlerts.innerHTML = uroUtils.ModifyHTML(alertsHTML);
  4712. document.body.appendChild(uroAlerts);
  4713. uroControls = document.createElement('section');
  4714. uroControls.style.fontSize = '12px';
  4715. uroControls.style.height = '100%';
  4716. uroControls.id = "sidepanel-uroverview";
  4717. uroControls.className = "tab-pane";
  4718. uroControls.innerHTML = uroUtils.ModifyHTML('<div id="uroControlsContainer" style="display:flex;flex-direction:column;height:80vh;"></div>');
  4719. uroInit.AddTab_API();
  4720. },
  4721. WazeBits: function()
  4722. {
  4723. uroMCLayer = null;
  4724.  
  4725. for(let i=0; i < W.map.layers.length; i++)
  4726. {
  4727. if(W.map.layers[i].name == 'mapComments') uroMCLayer = W.map.layers[i];
  4728. if(W.map.layers[i].name == 'venues') uroVenueLayer = W.map.layers[i];
  4729. }
  4730. },
  4731. FinalizeListenerSetup: function()
  4732. {
  4733. uroInit.finalisingListenerSetup = true;
  4734. // filter markers when the marker objects are modified (this happens whenever WME needs to load fresh marker data
  4735. // due to having panned/zoomed the map beyond the extents of the previously loaded data)
  4736. W.model.mapUpdateRequests.on("objectschanged", uroFilterURs_onObjectsChanged);
  4737. W.model.mapUpdateRequests.on("objectsadded", uroFilterURs_onObjectsAdded);
  4738. W.model.mapUpdateRequests.on("objectsremoved", uroFilterURs_onObjectsRemoved);
  4739. W.model.updateRequestSessions.on("objectsadded", uroUREvent_onObjectsAdded);
  4740. /*
  4741. W.model.cameras.on("objectschanged", uroFilterCameras);
  4742. W.model.cameras.on("objectsadded", uroFilterCameras);
  4743. W.model.cameras.on("objectsremoved", uroFilterCameras);
  4744. */
  4745. W.model.mapProblems.on("objectschanged", uroFilterProblems);
  4746. W.model.mapProblems.on("objectsadded", uroFilterProblems);
  4747. W.model.mapProblems.on("objectsremoved", uroFilterProblems);
  4748. W.model.venues.on("objectschanged", uroFilterPlaces);
  4749. W.model.venues.on("objectsadded", uroFilterPlaces);
  4750. W.model.venues.on("objectsremoved", uroFilterPlaces);
  4751. W.model.mapComments.on("objectschanged", uroLayers.MCLayerChanged_changed);
  4752. W.model.mapComments.on("objectsadded", uroLayers.MCLayerChanged_added);
  4753. W.model.mapComments.on("objectsremoved", uroLayers.MCLayerChanged_removed);
  4754. uroMarkers.RegisterEvents();
  4755. uroLayers.InitialiseMOs();
  4756. uroUtils.AddEventListener('_btnUndoLastHide', "click", uroIgnore.RemoveLastAdded, true);
  4757. uroUtils.AddEventListener('_btnClearSessionHides', "click", uroIgnore.RemoveAll, true);
  4758. uroIgnore.EnableControls();
  4759. uroUtils.AddEventListener('_btnSettingsToText', "click", uroConfig.SettingsToText, true);
  4760. uroUtils.AddEventListener('_btnTextToSettings', "click", uroConfig.TextToSettings, true);
  4761. uroUtils.AddEventListener('_btnResetSettings', "click", uroConfig.DefaultSettings, true);
  4762. uroUtils.AddEventListener('_btnClearSettingsText', "click", uroConfig.ClearSettingsText, true);
  4763. uroUtils.AddEventListener('_cbMasterEnable', "click", uroFilterItems_MasterEnableClick, true);
  4764. /*
  4765. uroUtils.AddEventListener('_btnDebugToScreen',"click", uroDBG.Dump, true);
  4766. */
  4767. uroUtils.AddEventListener('uroDiv', "dblclick", uroPopup.Suppress, true);
  4768. ////uroUtils.AddEventListener('_selectCameraUserID', "change", uroCamEditorSelected, true);
  4769. uroUtils.AddEventListener('_selectPlacesUserID', "change", uroPlacesEditorSelected, true);
  4770. uroUtils.AddEventListener('_selectHidePlacesUserID', "change", uroHidePlacesEditorSelected, true);
  4771. uroUtils.AddEventListener('uroAlertTickBtn', 'click', uroAlertBox.CloseWithTick, true);
  4772. uroUtils.AddEventListener('uroAlertCrossBtn', 'click', uroAlertBox.CloseWithCross, true);
  4773. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  4774. {
  4775. uroUtils.SetOnClick(uroTabs.CtrlTabs[i][uroTabs.FIELDS.LINKID], uroTabs.CtrlTabs[i][uroTabs.FIELDS.SHOWFN]);
  4776. }
  4777. for(let idx=0;idx<W.Config.venues.categories.length;idx++)
  4778. {
  4779. uroUtils.SetOnClick('_uroPlacesGroupState-'+idx,uroPlacesGroupCollapseExpand);
  4780. }
  4781. uroDBG.AddLog('finalise onload');
  4782. uroNewLookCheckDetailsRequest();
  4783. // filter markers as and when the map is moved
  4784. W.map.events.register("moveend", null, uroMapMoveEnd.Handler);
  4785. W.map.events.register("moveend", null, uroGetAMs); // uroGetAMs accesses e, so has to be called directly from the event handler
  4786. W.map.events.register("mousemove", null, uroGetAMs);
  4787. W.map.events.register("mousemove", null, uroMarkers.MouseMove);
  4788. W.map.events.registerPriority("mousedown", null, uroMouseDown);
  4789. // trap mousedown on Streetview marker drag
  4790. if(document.getElementsByClassName('street-view-control').length === 0) return;
  4791. document.getElementsByClassName('street-view-control')[0].onmousedown = uroMouseDown;
  4792. W.map.events.register("mouseup", null, uroMouseUp);
  4793. W.map.events.register("mouseout", null, uroMouseOut);
  4794. uroSetSectionTabStyles();
  4795. uroConfig.LoadSettings();
  4796. uroUITweaks.ChangeClustering();
  4797.  
  4798. uroDBG.AddLog('getting user ID...');
  4799. uroUserID = W.loginManager.user.attributes.id;
  4800. uroDBG.AddLog('...ID is '+uroUserID);
  4801. uroDBG.AddLog('filtering...');
  4802. uroFilterItems();
  4803. uroDBG.AddLog('...done');
  4804. uroDBG.showDebugOutput = uroDBG.persistentDebugOutput;
  4805. let dbgMode = "none";
  4806. if(uroDBG.showDebugOutput)
  4807. {
  4808. dbgMode = "inline";
  4809. }
  4810. document.getElementById('_uroDebugMode').style.display = dbgMode;
  4811. uroUtils.AddEventListener('_uroVersion',"click", uroDBG.Toggle, true);
  4812. // add exclusiveCB click handlers to all checkboxes with a pairedWith attribute
  4813. uroDBG.AddLog('adding exclusiveCB handlers...');
  4814. let cbList = document.getElementsByTagName('input');
  4815. for (let optIdx=0;optIdx<cbList.length;optIdx++)
  4816. {
  4817. if((cbList[optIdx].id.indexOf('_cb') === 0) && (cbList[optIdx].attributes.pairedWith != null))
  4818. {
  4819. uroUtils.SetOnClick(cbList[optIdx].id,uroExclusiveCB);
  4820. }
  4821. }
  4822. uroDBG.AddLog('...done');
  4823. // manually call the layer-change handlers on startup, since there's a good chance WME will already have
  4824. // completed its own startup layer changes before our handlers get registered, preventing the marker handlers
  4825. // from being set up as expected on any markers which are visible in the startup map view before the user forces
  4826. // a layer update by panning/zooming/etc...
  4827. uroLayers.RunChangeHandlers();
  4828.  
  4829. uroUITweaks.Setup();
  4830. uroInit.setupListeners = false;
  4831. uroMainTickStage = 0;
  4832. window.clearInterval(uroMainTickHandlerID);
  4833. window.setInterval(uroMainTick, 10);
  4834. uroInit.initialised = true;
  4835. }
  4836. };
  4837. const uroUITweaks = // native UI enhancements
  4838. {
  4839. MO_SidePanel : null,
  4840. MO_ReportPanel : null,
  4841.  
  4842. ChangeMapBGColour: function()
  4843. {
  4844. let mapviewport = document.getElementById("WazeMap").getElementsByClassName("olMapViewport")[0];
  4845. if((uroUtils.GetCBChecked('_cbWhiteBackground') === true) && (uroUtils.GetCBChecked('_cbMasterEnable') === true))
  4846. {
  4847. let customColour = '#' + uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundRed'),2);
  4848. customColour += uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundGreen'),2);
  4849. customColour += uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundBlue'),2);
  4850. mapviewport.style.setProperty('background',customColour,'important');
  4851. }
  4852. else
  4853. {
  4854. mapviewport.style.setProperty('background',"#354148",'important');
  4855. }
  4856. },
  4857. HideAMLayer: function()
  4858. {
  4859. // If this sounds like a weird function - why not just switch off the layer from the layers menu? - then
  4860. // remember that in order for URO+ to be able to display in its own tab the list of AMs under the current
  4861. // mouse pointer location, which is somewhat more useful than the list given in the topbar, it needs the
  4862. // AM layer to be activated so that the AM areas data is loaded into WME. It doesn't however need the layer
  4863. // to then be visible, and since having a bunch of purple polygons covering the map can make for a rather
  4864. // difficult editing experience, being able to hide the polys whilst retaining the area information is
  4865. // of real benefit...
  4866. if((uroUtils.GetCBChecked('_cbHideAMLayer')) && (uroUtils.GetCBChecked('_cbMasterEnable')))
  4867. {
  4868. W.map.managedAreasLayer.setOpacity(0);
  4869. }
  4870. else
  4871. {
  4872. W.map.managedAreasLayer.setOpacity(1);
  4873. }
  4874. },
  4875. HideSegments: function()
  4876. {
  4877. // Hides the vector segments when the raster segment layer is hidden
  4878. if(uroUtils.GetCBChecked('_cbHideSegmentsWhenRoadsHidden'))
  4879. {
  4880. W.map.segmentLayer.drawn = W.map.roadLayer.visibility;
  4881. W.map.nodeLayer.drawn = W.map.roadLayer.visibility;
  4882. }
  4883. else
  4884. {
  4885. W.map.segmentLayer.drawn = true;
  4886. W.map.nodeLayer.drawn = true;
  4887. }
  4888. },
  4889. SetClusteringFor: function(layerID, toDisable)
  4890. {
  4891. let strat = uroLayers.layers[layerID].l.strategies;
  4892. if((strat !== undefined) && (strat.length > 0))
  4893. {
  4894. if(toDisable === true)
  4895. {
  4896. strat[0].threshold = 100000;
  4897. }
  4898. else
  4899. {
  4900. strat[0].threshold = 10;
  4901. }
  4902. }
  4903. },
  4904. ChangeClustering: function()
  4905. {
  4906. uroUITweaks.SetClusteringFor(uroLayers.ID.UR, uroUtils.GetCBChecked('_cbInhibitURClusters'));
  4907. uroUITweaks.SetClusteringFor(uroLayers.ID.MP, uroUtils.GetCBChecked('_cbInhibitMPClusters'));
  4908. uroUITweaks.SetClusteringFor(uroLayers.ID.PUR, uroUtils.GetCBChecked('_cbInhibitPUClusters'));
  4909. uroUITweaks.SetClusteringFor(uroLayers.ID.PPUR, uroUtils.GetCBChecked('_cbInhibitPUClusters'));
  4910. uroUITweaks.SetClusteringFor(uroLayers.ID.RPUR, uroUtils.GetCBChecked('_cbInhibitPUClusters'));
  4911. uroUITweaks.SetClusteringFor(uroLayers.ID.SegSug, uroUtils.GetCBChecked('_cbInhibitESClusters'));
  4912. uroUITweaks.SetClusteringFor(uroLayers.ID.EditSug, uroUtils.GetCBChecked('_cbInhibitESClusters'));
  4913.  
  4914. // If the map is zoomed out far enough such that clustering could be occurring, perform a
  4915. // zoom in-out to force a redraw of the markers based on whatever the new clustering
  4916. // settings are...
  4917. if(W.map.getZoom() < 16)
  4918. {
  4919. W.map.zoomIn();
  4920. W.map.zoomOut();
  4921. }
  4922. },
  4923. ReportPanelChange: function()
  4924. {
  4925. // Inhibit map re-centering when opening a report
  4926. if(uroMarkers.inhibitSetCenter === true)
  4927. {
  4928. let bcr = document.querySelector('#panel-container').getBoundingClientRect();
  4929. if(bcr.width > 0)
  4930. {
  4931. uroMarkers.inhibitSetCenter = false;
  4932. W.map.setCenter(uroMarkers.clickedOnCenter);
  4933. }
  4934. }
  4935.  
  4936. // "panel-container" now also gets used to show the turn closure UI, so reuse this MO handler
  4937. // as a way to also apply the MTE dropdown fix here...
  4938. let mteDropDown = document.querySelector('#panel-container #closure_eventId');
  4939. if(mteDropDown !== undefined)
  4940. {
  4941. uroFixMTEDropDown(mteDropDown);
  4942. }
  4943. },
  4944. CheckForClosurePanel: function()
  4945. {
  4946. if(uroUtils.IsClosureUIActive() === true)
  4947. {
  4948. // Closure panel active
  4949. let uroMO_ClosureUI = new MutationObserver(uroClosureEditUIChanged);
  4950. uroMO_ClosureUI.disconnect();
  4951. uroMO_ClosureUI.observe(document.querySelector('wz-tab.closures-tab'),{subtree: true, attributes: true});
  4952. uroClosureEditUIChanged();
  4953.  
  4954. let cl = document.querySelector('.closures-list');
  4955. if(cl !== null)
  4956. {
  4957. let uroRO_ClosureUI = new ResizeObserver(uroScrollToEndOfClosures);
  4958. uroRO_ClosureUI.disconnect();
  4959. uroRO_ClosureUI.observe(cl);
  4960. }
  4961. uroScrollToEndOfClosures();
  4962. }
  4963. },
  4964. SidePanelChange: function()
  4965. {
  4966. // The sidepanel MO only fires when the sidepanel changes in bulk - i.e. when first rendered, or
  4967. // when changing to show details for a different type of map object. Once this version of the
  4968. // panel is open, any internal changes, such as selecting a different tab within the panel, do
  4969. // NOT trigger the MO. Consequently, if a segment is selected and the sidepanel doesn't then
  4970. // open with the closures tab already selected, the MO will fire at this point rather than at the
  4971. // point where the closures tab is selected...
  4972. //
  4973. // To ensure the closures UI enhancements are applied consistently, we therefore need to set up an
  4974. // onclick handler to deal with the sidepanel opening into a different tab and the user then
  4975. // clicking through into the closures tab after this MO has already fired, but we ALSO still need
  4976. // to check for the availability of the closures UI here as well just in case the sidepanel opens
  4977. // into the closures tab directly.
  4978. //
  4979. // Easy really...
  4980.  
  4981. let elmToClick = document.querySelector('#edit-panel');
  4982. if(elmToClick !== null)
  4983. {
  4984. uroUtils.SetOnClick(elmToClick, uroUITweaks.CheckForClosurePanel);
  4985. }
  4986. uroUITweaks.CheckForClosurePanel();
  4987. },
  4988. Setup: function()
  4989. {
  4990. uroUITweaks.MO_SidePanel = new MutationObserver(uroUITweaks.SidePanelChange);
  4991. uroUITweaks.MO_SidePanel.observe(document.getElementById('edit-panel'), {childList: true, subtree: true});
  4992. uroUITweaks.MO_ReportPanel = new MutationObserver(uroUITweaks.ReportPanelChange);
  4993. uroUITweaks.MO_ReportPanel.observe(document.getElementById('panel-container'), {childList: true, subtree: true});
  4994.  
  4995. uroUITweaks.ChangeMapBGColour();
  4996. uroUITweaks.HideAMLayer();
  4997. uroUITweaks.HideSegments();
  4998. }
  4999. };
  5000. const uroMapMoveEnd = // things that happen after a move of the map view
  5001. {
  5002. lat : null,
  5003. lon: null,
  5004. zoom: null,
  5005. Handler: function()
  5006. {
  5007. let mc = W.map.getCenter();
  5008. let z = W.map.getZoom();
  5009. if((mc.lat != this.lat) || (mc.lon != this.lon) || (z != this.zoom))
  5010. {
  5011. // Apply any filters which need to be updated when the map view changes,
  5012. // and which won't be applied via an event handler or mutation observer
  5013. // attached to the relevant layer etc...
  5014. uroFilterProblems();
  5015. uroFilterPlaces();
  5016. uroFilterCameras();
  5017. uroFilterURs();
  5018. uroFilterRAs();
  5019. uroFilterMapComments();
  5020.  
  5021. uroMiscUITweaksHandler();
  5022. uroLayers.MCLayerChanged();
  5023. this.lat = mc.lat;
  5024. this.lon = mc.lon;
  5025. this.zoom = z;
  5026. }
  5027. }
  5028. };
  5029.  
  5030.  
  5031. // ================================================================================================
  5032. // Here be the unfactored wilderness...
  5033. // ================================================================================================
  5034.  
  5035.  
  5036. function uroFixMTEDropDown(mteDropDown)
  5037. {
  5038. // Auto-selects the "None" event within the MTE dropdown element passed into the function, to avoid the user having
  5039. // to manually select it - the only time you'd need to select something other than None is when you're assigning a
  5040. // closure to a MTE, at which point you need to manually select the appropriate event from the dropdown anyway, so
  5041. // pre-selecting None doesn't increase the workload for setting up a MTE-related closure, and it reduces the workload
  5042. // for setting up other closures...
  5043. //
  5044. // The only possible negative to this hack is that it means the user can set up a MTE-related closure without being
  5045. // reminded by WME to select the appropriate event from the list, because now that we're defaulting it to None, WME
  5046. // will allow the closure to be set without complaining that no event is set... But TBH, that's a small price to pay
  5047. // compared with the far, FAR, larger irritation of forcing users to always select None for all the closures that
  5048. // get added every single day without ever needing to be associated with a MTE - if a handful of closures end up being
  5049. // added with the user having forgotten to select the MTE, then no biggie. The closure will still at least have been
  5050. // added and its effect on routing around the event will therefore still be just as it would be if the MTE had been
  5051. // associated with the closure - the only difference is that if someone then bothers to look at the overview map of the
  5052. // MTE, they won't see that particular segment listed as a closure. I can live with the tiny risk of that causing any
  5053. // real problems, when weighed up against the millions of extra clicks saved through pre-selecting None...
  5054.  
  5055. let retval = false;
  5056.  
  5057. // Make sure the closure event list is available, and that we haven't already messed with it.
  5058. if((mteDropDown !== null) && (mteDropDown.tag != "touchedByURO"))
  5059. {
  5060. // The event dropdown is now some byzantine piece of DOM manipulation to generate something which looks like a
  5061. // regular select list, but which can't be manipulated like one... The first gotcha is that the selected item
  5062. // exists only within a shadow DOM section within the dropdown rather than simply being part of the list from
  5063. // which we'd be able to read off its selected index. So to check whether or not the user has selected an
  5064. // event already, we need to drill down into this shadow DOM to get its text contents, and compare those against
  5065. // the I18n translation for the choose event text. What a palaver...
  5066. let shadowElm = mteDropDown.shadowRoot.querySelectorAll('.selected-value')[0];
  5067. if(shadowElm !== undefined)
  5068. {
  5069. let eventText = mteDropDown.shadowRoot.querySelectorAll('.selected-value')[0].innerText;
  5070. // Sometimes we get here before WME has finished rendering, so if the event text hasn't been set yet then we
  5071. // need to return false and let the caller deal with it...
  5072. if(eventText !== '')
  5073. {
  5074. if(eventText == I18n.lookup('closures.choose_event'))
  5075. {
  5076. // Having now established that, yes, the closure hasn't yet been associated with any event, it's surprisingly
  5077. // easy to change it to "None" - we just generate a click event on the first child element in the main DOM (not
  5078. // the shadow DOM this time), which replicates what the user would do to select None manually.
  5079. mteDropDown.children[0].click();
  5080. }
  5081. // Tag the event list to prevent further processing attempts whilst the edit UI for this closure remains open.
  5082. mteDropDown.tag = "touchedByURO";
  5083. retval = true;
  5084. }
  5085. }
  5086. }
  5087.  
  5088. return retval;
  5089. }
  5090. let uroPendingURSessionsTotal;
  5091. let uroFinalizeTimeoutHandle = null;
  5092. function uroFinalizeURSessionsGet()
  5093. {
  5094. if(uroPendingURSessionsTotal != uroPendingURSessionIDs.length)
  5095. {
  5096. uroPendingURSessionsTotal = uroPendingURSessionIDs.length;
  5097. if(uroFinalizeTimeoutHandle !== null)
  5098. {
  5099. window.clearTimeout(uroFinalizeTimeoutHandle);
  5100. uroFinalizeTimeoutHandle = null;
  5101. }
  5102. uroFinalizeTimeoutHandle = window.setTimeout(uroFinalizeURSessionsGet, 500);
  5103. return;
  5104. }
  5105.  
  5106. let idList = [];
  5107.  
  5108. while((idList.length < 50) && (uroPendingURSessionIDs.length))
  5109. {
  5110. let id = uroPendingURSessionIDs.shift();
  5111. idList.push(id);
  5112. }
  5113.  
  5114. if(idList.length > 0)
  5115. {
  5116. uroDBG.AddLog('grabbing '+idList.length+' updateRequestSessions, IDs: '+idList);
  5117. W.model.updateRequestSessions.getAsync(idList);
  5118. }
  5119.  
  5120. if((uroPendingURSessionIDs.length) || (uroRequestedURSessionIDs.length))
  5121. {
  5122. window.setTimeout(uroGetUpdateRequestSessions,1000);
  5123. }
  5124. else
  5125. {
  5126. uroPopulatingRequestSessions = false;
  5127. }
  5128. }
  5129. function uroGetUpdateRequestSessions()
  5130. {
  5131. uroPendingURSessionsTotal = uroPendingURSessionIDs.length;
  5132. if(uroFinalizeTimeoutHandle !== null)
  5133. {
  5134. window.clearTimeout(uroFinalizeTimeoutHandle);
  5135. uroFinalizeTimeoutHandle = null;
  5136. }
  5137. uroFinalizeTimeoutHandle = window.setTimeout(uroFinalizeURSessionsGet,500);
  5138. }
  5139. function uroRefreshUpdateRequestSessions()
  5140. {
  5141. let urcount = 0;
  5142. uroPendingURSessionIDs = [];
  5143. uroRequestedURSessionIDs = [];
  5144. uroPopulatingRequestSessions = true;
  5145. for (let urID in W.model.mapUpdateRequests.objects)
  5146. {
  5147. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urID))
  5148. {
  5149. if(W.model.updateRequestSessions.objects[urID] === undefined)
  5150. {
  5151. uroPendingURSessionIDs.push(urID);
  5152. }
  5153. urcount++;
  5154. }
  5155. }
  5156. uroGetUpdateRequestSessions();
  5157. }
  5158. function uroURHasMyComments(fid)
  5159. {
  5160. if(uroUserID === -1)
  5161. {
  5162. return false;
  5163. }
  5164. let nComments = W.model.updateRequestSessions.objects[fid].attributes.comments.length;
  5165. if(nComments === 0)
  5166. {
  5167. return false;
  5168. }
  5169.  
  5170. for(let cidx=0; cidx<nComments; cidx++)
  5171. {
  5172. if(W.model.updateRequestSessions.objects[fid].attributes.comments[cidx].userID == uroUserID)
  5173. {
  5174. return true;
  5175. }
  5176. }
  5177.  
  5178. return false;
  5179. }
  5180. function uroIsFilteringEnabled(ignoreZoom)
  5181. {
  5182. let retval = false;
  5183. if
  5184. (
  5185. (uroUtils.GetCBChecked('_cbMasterEnable') === true) &&
  5186. (
  5187. (ignoreZoom === true) ||
  5188. (W.map.getZoom() <= uroUtils.GetElmValue('_inputFilterMinZoomLevel'))
  5189. )
  5190. )
  5191. {
  5192. retval = true;
  5193. }
  5194. return retval;
  5195. }
  5196. function uroUpdateMTEList()
  5197. {
  5198. if(Object.keys(W.model.majorTrafficEvents.objects).length === 0) return;
  5199.  
  5200. let selectedIdx = null;
  5201. let idx;
  5202. let mteNames = [];
  5203. let mteIDs = [];
  5204. for(idx in W.model.majorTrafficEvents.objects)
  5205. {
  5206. if(W.model.majorTrafficEvents.objects.hasOwnProperty(idx))
  5207. {
  5208. let name = W.model.majorTrafficEvents.objects[idx].attributes.names[0]?.value;
  5209. if(mteNames.indexOf(name) == -1)
  5210. {
  5211. mteNames.push(name);
  5212. mteIDs.push(idx);
  5213. }
  5214. }
  5215. }
  5216. // check for any previously selected ID in the list, then clear it and repopulate
  5217. // using the newly gathered ID collection from above, and finally reselect the
  5218. // previously selected MTE if its still present in the new list...
  5219. let selector;
  5220. let selectedID;
  5221. let selectorEntry;
  5222.  
  5223. selector = document.getElementById('_selectRTCMTE');
  5224. selectedID = null;
  5225. if(selector.selectedOptions[0] != null)
  5226. {
  5227. selectedID = selector.selectedOptions[0].value;
  5228. }
  5229. while(selector.options.length > 0)
  5230. {
  5231. selector.options.remove(0);
  5232. }
  5233. selector.options.add(new Option('<select a MTE>', null));
  5234. if(mteNames.length > 0)
  5235. {
  5236. selectorEntry = '';
  5237. for(idx=0; idx<mteNames.length; idx++)
  5238. {
  5239. selectorEntry = mteNames[idx];
  5240. selector.options.add(new Option(selectorEntry, mteIDs[idx]));
  5241. if(mteIDs[idx] == selectedID)
  5242. {
  5243. selectedIdx = idx+1;
  5244. }
  5245. }
  5246. }
  5247.  
  5248. if(selectedIdx !== null)
  5249. {
  5250. selector.selectedIndex = selectedIdx;
  5251. }
  5252. }
  5253. function uroRTCMarkerInfo(mIdx, isVisible)
  5254. {
  5255. let pri = null;
  5256. let status = null;
  5257. let dir = null;
  5258. let pos = null;
  5259. let mID = null;
  5260.  
  5261. let mObj = uroLayers.layers[uroLayers.ID.RTC].l.markers[mIdx];
  5262. if(mObj !== undefined)
  5263. {
  5264. // Store the marker status - if we've already made a note of the original
  5265. // status by adding an "orig_"-prefixed classname, extract the status from
  5266. // that rather than from the class currently being used to display the
  5267. // marker, to preserve the original status regardless of what we may have
  5268. // done to it subsequently as a result of our RTC filtering setup...
  5269. let cList = mObj.element.classList;
  5270. for(let i = 0; i < cList.length; ++i)
  5271. {
  5272. if(cList[i].indexOf('orig_') != -1)
  5273. {
  5274. status = cList[i].replace('orig_', '');
  5275. }
  5276. }
  5277. if(status === null)
  5278. {
  5279. for(let i = 0; i < cList.length; ++i)
  5280. {
  5281. if(cList[i].indexOf('status-') != -1)
  5282. {
  5283. status = cList[i];
  5284. }
  5285. }
  5286. }
  5287.  
  5288. // Assign a priority level to the marker so we know whether to show or hide
  5289. // it if it's stacked up with others on the same segment - the level set here
  5290. // follows the priority used by WME to decide which closures to show normally.
  5291. if(status == "status-active")
  5292. {
  5293. pri = 2;
  5294. }
  5295. else if(status == "status-not-started")
  5296. {
  5297. pri = 1;
  5298. }
  5299. else
  5300. {
  5301. pri = 0;
  5302. }
  5303.  
  5304. // To avoid the need to cross-reference with the closure model object, use the
  5305. // classname of the arrow attached to this marker to determine if the closure is
  5306. // in the forward or reverse direction.
  5307. if(mObj.element.childNodes.length == 1)
  5308. {
  5309. if(mObj.element.childNodes[0].className.indexOf('forward') != -1)
  5310. {
  5311. dir = "fwd";
  5312. }
  5313. else if(mObj.element.childNodes[0].className.indexOf('backward') != -1)
  5314. {
  5315. dir = "rev";
  5316. }
  5317. }
  5318.  
  5319. pos = mObj.px;
  5320. mID = mObj.element.dataset.id;
  5321. }
  5322.  
  5323. this.isVisible = isVisible;
  5324. this.pos = pos;
  5325. this.pri = pri;
  5326. this.mID = mID;
  5327. this.status = status;
  5328. this.dir = dir;
  5329. }
  5330. function uroFilterRTCs()
  5331. {
  5332. let pmTStart = performance.now();
  5333. let pmFunction = "uroFilterRTCs";
  5334.  
  5335. if(uroFilterPreamble() === false) return;
  5336.  
  5337. let closureLayer = uroLayers.layers[uroLayers.ID.RTC].l;
  5338. if(closureLayer.markers.length === 0) return;
  5339.  
  5340. let uFR_filterActiveFromWME = uroUtils.GetCBChecked('_cbHideEditorRTCs');
  5341. let uFR_filterActiveFromWazeFeed = uroUtils.GetCBChecked('_cbHideWazeFeedRTCs');
  5342. let uFR_filterActiveFromWazeOther = uroUtils.GetCBChecked('_cbHideWazeRTCs');
  5343. let uFR_filterFutureFromWME = uroUtils.GetCBChecked('_cbHideFutureEditorRTCs');
  5344. let uFR_filterFutureFromWazeFeed = uroUtils.GetCBChecked('_cbHideFutureWazeFeedRTCs');
  5345. let uFR_filterFutureFromWazeOther = uroUtils.GetCBChecked('_cbHideFutureWazeRTCs');
  5346. let uFR_filterExpiredFromWME = uroUtils.GetCBChecked('_cbHideExpiredEditorRTCs');
  5347. let uFR_filterExpiredFromWazeFeed = uroUtils.GetCBChecked('_cbHideExpiredWazeFeedRTCs');
  5348. let uFR_filterExpiredFromWazeOther = uroUtils.GetCBChecked('_cbHideExpiredWazeRTCs');
  5349. let uFR_filterUnknownFromWME = uroUtils.GetCBChecked('_cbHideUnknownEditorRTCs');
  5350. let uFR_filterUnknownFromWazeFeed = uroUtils.GetCBChecked('_cbHideUnknownWazeFeedRTCs');
  5351. let uFR_filterUnknownFromWazeOther = uroUtils.GetCBChecked('_cbHideUnknownWazeRTCs');
  5352. let uFR_filterShowForMTE = uroUtils.GetCBChecked('_cbShowMTERTCs');
  5353. let uFR_filterHideForMTE = uroUtils.GetCBChecked('_cbHideMTERTCs');
  5354. let uFR_filterHideDurationLessThan = uroUtils.GetCBChecked('_cbEnableRTCDurationFilterLessThan');
  5355. let uFR_filterHideDurationMoreThan = uroUtils.GetCBChecked('_cbEnableRTCDurationFilterMoreThan');
  5356. let uFR_thresholdDurationLessThan = uroUtils.GetElmValue('_inputFilterRTCDurationLessThan');
  5357. let uFR_thresholdDurationMoreThan = uroUtils.GetElmValue('_inputFilterRTCDurationMoreThan');
  5358.  
  5359. let uFR_filterShowForTS = uroUtils.GetCBChecked('_cbRTCFilterShowForTS');
  5360. let uFR_filterHideForTS = uroUtils.GetCBChecked('_cbRTCFilterHideForTS');
  5361. let tsD = uroUtils.GetElmValue('_inputRTCFilterDay');
  5362. let tsMo = uroUtils.GetElmValue('_inputRTCFilterMonth');
  5363. let tsY = uroUtils.GetElmValue('_inputRTCFilterYear');
  5364. let tsH = uroUtils.GetElmValue('_inputRTCFilterHour');
  5365. let tsMi = uroUtils.GetElmValue('_inputRTCFilterMin');
  5366. let filterTS = uroUtils.GetTS(tsD, tsMo, tsY, tsH, tsMi);
  5367. uroUpdateMTEList();
  5368. let mteID = null;
  5369. let selectorMTE = document.getElementById('_selectRTCMTE');
  5370. if(selectorMTE?.selectedOptions[0] != null)
  5371. {
  5372. mteID = selectorMTE.selectedOptions[0].value;
  5373. }
  5374.  
  5375. let uFR_masterEnable = uroIsFilteringEnabled(false);
  5376.  
  5377. let markerInfo = [];
  5378.  
  5379. // Pass 1 - determine which filtering to apply to each of the RTC markers
  5380. let markerIdx = 0;
  5381. for (let rtcObj in W.model.roadClosures.objects)
  5382. {
  5383. let isVisible = true;
  5384.  
  5385. if(uFR_masterEnable === true)
  5386. {
  5387. let rtcModel = W.model.roadClosures.objects[rtcObj];
  5388.  
  5389. if(mteID !== null)
  5390. {
  5391. if((uFR_filterShowForMTE === true) && (rtcModel.attributes.eventId !== mteID))
  5392. {
  5393. isVisible = false;
  5394. }
  5395. if((uFR_filterHideForMTE === true) && (rtcModel.attributes.eventId === mteID))
  5396. {
  5397. isVisible = false;
  5398. }
  5399. }
  5400.  
  5401. let rtcType = uroGetRTCOrigin(rtcModel);
  5402. let rtcState = uroGetRTCState(rtcModel);
  5403.  
  5404. if(rtcType == uroEnums.TRTC.WAZEFEED)
  5405. {
  5406. if
  5407. (
  5408. ((rtcState === uroEnums.SRTC.ACTIVE) && (uFR_filterActiveFromWazeFeed === true)) ||
  5409. ((rtcState === uroEnums.SRTC.FUTURE) && (uFR_filterFutureFromWazeFeed === true)) ||
  5410. ((rtcState === uroEnums.SRTC.EXPIRED) && (uFR_filterExpiredFromWazeFeed === true)) ||
  5411. ((rtcState === uroEnums.SRTC.UNKNOWN) && (uFR_filterUnknownFromWazeFeed === true))
  5412. )
  5413. {
  5414. isVisible = false;
  5415. }
  5416. }
  5417. else if(rtcType == uroEnums.TRTC.WAZEOTHER)
  5418. {
  5419. if
  5420. (
  5421. ((rtcState === uroEnums.SRTC.ACTIVE) && (uFR_filterActiveFromWazeOther === true)) ||
  5422. ((rtcState === uroEnums.SRTC.FUTURE) && (uFR_filterFutureFromWazeOther === true)) ||
  5423. ((rtcState === uroEnums.SRTC.EXPIRED) && (uFR_filterExpiredFromWazeOther === true)) ||
  5424. ((rtcState === uroEnums.SRTC.UNKNOWN) && (uFR_filterUnknownFromWazeOther === true))
  5425. )
  5426. {
  5427. isVisible = false;
  5428. }
  5429. }
  5430. else
  5431. {
  5432. if
  5433. (
  5434. ((rtcState === uroEnums.SRTC.ACTIVE) && (uFR_filterActiveFromWME === true)) ||
  5435. ((rtcState === uroEnums.SRTC.FUTURE) && (uFR_filterFutureFromWME === true)) ||
  5436. ((rtcState === uroEnums.SRTC.EXPIRED) && (uFR_filterExpiredFromWME === true)) ||
  5437. ((rtcState === uroEnums.SRTC.UNKNOWN) && (uFR_filterUnknownFromWME === true))
  5438. )
  5439. {
  5440. isVisible = false;
  5441. }
  5442. }
  5443. let rtcDuration = uroGetRTCDuration(rtcModel);
  5444. if(uFR_filterHideDurationLessThan === true)
  5445. {
  5446. if(rtcDuration < uFR_thresholdDurationLessThan)
  5447. {
  5448. isVisible = false;
  5449. }
  5450. }
  5451. if(uFR_filterHideDurationMoreThan === true)
  5452. {
  5453. if(rtcDuration > uFR_thresholdDurationMoreThan)
  5454. {
  5455. isVisible = false;
  5456. }
  5457. }
  5458. if((uFR_filterShowForTS === true) || (uFR_filterHideForTS === true))
  5459. {
  5460. let startTS = new Date(rtcModel.attributes.startDate).getTime();
  5461. let endTS = new Date(rtcModel.attributes.endDate).getTime();
  5462. if(uFR_filterShowForTS === true)
  5463. {
  5464. if((filterTS < startTS) || (filterTS > endTS))
  5465. {
  5466. isVisible = false;
  5467. }
  5468. }
  5469. if (uFR_filterHideForTS === true)
  5470. {
  5471. if((filterTS >= startTS) && (filterTS <= endTS))
  5472. {
  5473. isVisible = false;
  5474. }
  5475. }
  5476. }
  5477. }
  5478.  
  5479. markerInfo.push(new uroRTCMarkerInfo(markerIdx, isVisible));
  5480. ++markerIdx;
  5481. }
  5482.  
  5483. // Pass 2 - based on the initial filtering results, determine which markers *actually* should be
  5484. // made visible or hidden according both to our filtering settings AND any masking of this marker
  5485. // due to the presence of other higher priority markers at the same position which have also been
  5486. // marked as visible following the filtering pass...
  5487. //
  5488. // For added merriment, we also deal with the WME limitation that prevents it displaying two
  5489. // different types of closure arrow if a segment has a one-way closure which is a higher priority
  5490. // than a closure in the opposite direction.
  5491.  
  5492. let cNodesDiv = uroLayers.layers[uroLayers.ID.RTCnode].l.div;
  5493. for (let i = 0; i < markerIdx; ++i)
  5494. {
  5495. let status = markerInfo[i].status;
  5496.  
  5497. // Only apply this pass to closures which haven't already been hidden in pass 1, AND which
  5498. // have a valid marker position
  5499. if((markerInfo[i].isVisible === true) && (markerInfo[i].pos !== null))
  5500. {
  5501. // Iterate through all the other markers, looking for any which are also still visible
  5502. // and have the same marker position as the one we're currently processing
  5503. for (let j = 0; j < markerIdx; ++j)
  5504. {
  5505. if(j != i)
  5506. {
  5507. if((markerInfo[j].isVisible === true) && (markerInfo[j].pos !== null))
  5508. {
  5509. if((markerInfo[i].pos.x == markerInfo[j].pos.x) && (markerInfo[i].pos.y == markerInfo[j].pos.y))
  5510. {
  5511. if(markerInfo[j].pri > markerInfo[i].pri)
  5512. {
  5513. if(markerInfo[j].dir == markerInfo[i].dir)
  5514. {
  5515. // Mark the currently processed marker to be hidden only if this higher priority
  5516. // marker is for a closure in the same direction - if it's not, then we need to
  5517. // leave the current marker visible so that its arrow remains visible...
  5518. markerInfo[i].isVisible = false;
  5519. break;
  5520. }
  5521. else
  5522. {
  5523. // Otherwise, if we're leaving the current marker visible then we'll need to
  5524. // alter its status class to match this higher-priority marker, so that the
  5525. // marker which is shown to the user remains correct regardless of what the
  5526. // relative stacking order of the markers is on this segment.
  5527. status = markerInfo[j].status;
  5528. }
  5529. }
  5530. }
  5531. }
  5532. }
  5533. }
  5534. }
  5535.  
  5536. let marker = closureLayer.markers[i].element;
  5537. let markerClass = marker.className;
  5538.  
  5539. // Remove the hidden class if present - this allows markers natively hidden by WME due to being masked
  5540. // by higher priority markers to become visible again if our own filtering settings have hidden those
  5541. // higher priority marker...
  5542. markerClass = markerClass.replace(" road-closure-hidden", "");
  5543. if(markerInfo[i].isVisible == false)
  5544. {
  5545. // Apply the hidden class for any markers WE'VE decided need to be hidden
  5546. markerClass += " road-closure-hidden";
  5547. }
  5548. else
  5549. {
  5550. // For any markers which we're leaving visible, first check to see if it's a marker we haven't yet
  5551. // seen. If so, then we need to store its original status class for future reference.
  5552. if(markerClass.indexOf('orig_') == -1)
  5553. {
  5554. markerClass += (' orig_'+markerInfo[i].status);
  5555. }
  5556. // Now, to ensure this segment displays the appropriate marker for the highest priority closure
  5557. // still visible on it, we remove the existing status class and replace it with the one we
  5558. // chose above
  5559. markerClass = markerClass.replace(" status-finished"," ");
  5560. markerClass = markerClass.replace(" status-active"," ");
  5561. markerClass = markerClass.replace(" status-not-started"," ");
  5562. markerClass += ' '+status;
  5563. }
  5564. marker.className = markerClass;
  5565. let toHide = cNodesDiv.querySelectorAll("[data-id='"+markerInfo[i].mID+"']");
  5566. for(let j = 0; j < toHide.length; ++j)
  5567. {
  5568. if(markerInfo[i].isVisible === false)
  5569. {
  5570. toHide[j].style.visibility = "hidden";
  5571. }
  5572. else
  5573. {
  5574. toHide[j].style.visibility = "";
  5575. }
  5576. }
  5577. }
  5578.  
  5579. uroDBG.PerfMon(pmFunction, pmTStart);
  5580. }
  5581. function uroUpdateRAList()
  5582. {
  5583. if(Object.keys(W.model.restrictedDrivingAreas.objects).length === 0) return;
  5584.  
  5585. let selectedIdx = null;
  5586. let idx;
  5587. let raNames = [];
  5588. for(idx in W.model.restrictedDrivingAreas.objects)
  5589. {
  5590. if(W.model.restrictedDrivingAreas.objects.hasOwnProperty(idx))
  5591. {
  5592. let name = W.model.restrictedDrivingAreas.objects[idx].attributes.name;
  5593. if(raNames.indexOf(name) == -1)
  5594. {
  5595. raNames.push(name);
  5596. }
  5597. }
  5598. }
  5599. // check for any previously selected name in the list, then clear it and repopulate
  5600. // using the newly gathered collection from above, and finally reselect the
  5601. // previously selected MTE if its still present in the new list...
  5602. let selector;
  5603. let selectedName;
  5604. let selectorEntry;
  5605.  
  5606. selector = document.getElementById('_selectRA');
  5607. selectedName = null;
  5608. if(selector.selectedOptions[0] != null)
  5609. {
  5610. selectedName = selector.selectedOptions[0].value;
  5611. }
  5612. while(selector.options.length > 0)
  5613. {
  5614. selector.options.remove(0);
  5615. }
  5616. selector.options.add(new Option('<select a RA>', null));
  5617. if(raNames.length > 0)
  5618. {
  5619. selectorEntry = '';
  5620. for(idx=0; idx<raNames.length; idx++)
  5621. {
  5622. selectorEntry = raNames[idx];
  5623. selector.options.add(new Option(selectorEntry, selectorEntry));
  5624. if(selectorEntry == selectedName)
  5625. {
  5626. selectedIdx = idx+1;
  5627. }
  5628. }
  5629. }
  5630.  
  5631. if(selectedIdx !== null)
  5632. {
  5633. selector.selectedIndex = selectedIdx;
  5634. }
  5635. }
  5636. function uroUpdateEditorList(modelObj, listElement, useCreated, useUpdated, useResolved, useCommenter)
  5637. {
  5638. if(Object.keys(modelObj).length === 0) return;
  5639.  
  5640. let selector = document.getElementById(listElement);
  5641.  
  5642. let selectedUser = null;
  5643. if(selector.selectedOptions[0] != null)
  5644. {
  5645. selectedUser = parseInt(selector.selectedOptions[0].value);
  5646. }
  5647.  
  5648. while(selector.options.length > 0)
  5649. {
  5650. selector.options.remove(0);
  5651. }
  5652.  
  5653. let selectedIdx = null;
  5654. let listedIDs = [];
  5655. let idx;
  5656. for(idx in modelObj)
  5657. {
  5658. if(modelObj.hasOwnProperty(idx))
  5659. {
  5660. let obj;
  5661. if(useCommenter == true)
  5662. {
  5663. obj = modelObj[idx];
  5664. if(obj.attributes.comments.length > 0)
  5665. {
  5666. for(let cidx=0; cidx < obj.attributes.comments.length; cidx++)
  5667. {
  5668. let userID = obj.attributes.comments[cidx].userID;
  5669. if((listedIDs.indexOf(userID) == -1) && (userID != -1))
  5670. {
  5671. listedIDs.push(userID);
  5672. }
  5673. }
  5674. }
  5675. }
  5676. else
  5677. {
  5678. obj = modelObj[idx].attributes;
  5679. let cbID = null;
  5680. let ubID = null;
  5681. let rbID = null;
  5682. if(useCreated == true) cbID = obj.createdBy;
  5683. if(useUpdated == true) ubID = obj.updatedBy;
  5684. if(useResolved == true) ubID = obj.resolvedBy;
  5685. if((cbID !== null) && (listedIDs.indexOf(cbID) == -1))
  5686. {
  5687. listedIDs.push(cbID);
  5688. }
  5689. if((ubID !== null) && (listedIDs.indexOf(ubID) == -1))
  5690. {
  5691. listedIDs.push(ubID);
  5692. }
  5693. if((rbID !== null) && (listedIDs.indexOf(rbID) == -1))
  5694. {
  5695. listedIDs.push(rbID);
  5696. }
  5697. }
  5698. }
  5699. }
  5700.  
  5701. selector.options.add(new Option('<select a user>', null));
  5702. if(listedIDs.length > 0)
  5703. {
  5704. let users = W.model.users.getByIds(listedIDs);
  5705. let selectorEntry = '';
  5706. for(idx=0; idx<users.length; idx++)
  5707. {
  5708. if(listedIDs.indexOf(users[idx].id) != -1)
  5709. {
  5710. listedIDs.splice(listedIDs.indexOf(users[idx]), 1);
  5711. }
  5712. if(users[idx].attributes.userName === undefined)
  5713. {
  5714. selectorEntry = users[idx].attributes.id;
  5715. }
  5716. else
  5717. {
  5718. selectorEntry = users[idx].attributes.userName;
  5719. }
  5720. selector.options.add(new Option(selectorEntry, users[idx].id));
  5721. if(users[idx].attributes.id == selectedUser)
  5722. {
  5723. selectedIdx = idx+1;
  5724. }
  5725. }
  5726. }
  5727.  
  5728. if(selectedIdx !== null)
  5729. {
  5730. selector.selectedIndex = selectedIdx;
  5731. }
  5732. }
  5733. function uroGetUserID(filterNameID, tbUserName)
  5734. {
  5735. if(filterNameID === null)
  5736. {
  5737. for(let idx in W.model.users.objects)
  5738. {
  5739. if(W.model.users.objects.hasOwnProperty(idx))
  5740. {
  5741. if(W.model.users.objects[idx].attributes.userName == tbUserName)
  5742. {
  5743. filterNameID = W.model.users.objects[idx].attributes.id;
  5744. break;
  5745. }
  5746. }
  5747. }
  5748. }
  5749. return filterNameID;
  5750. }
  5751. function uroFilterRAs()
  5752. {
  5753. let pmTStart = performance.now();
  5754. let pmFunction = "uroFilterRAs";
  5755.  
  5756. if(uroFilterPreamble() === false) return;
  5757. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  5758. let filterByArea = uroUtils.GetCBChecked('_cbShowSpecificRA');
  5759. let filterByLastEditor = uroUtils.GetCBChecked('_cbRAEditorIDFilter');
  5760. let filterByMinAge = uroUtils.GetCBChecked('_cbEnableRAAgeFilterLessThan');
  5761. let filterByMaxAge = uroUtils.GetCBChecked('_cbEnableRAAgeFilterMoreThan');
  5762. let thresholdMinAge = uroUtils.GetElmValue('_inputFilterRAAgeLessThan');
  5763. let thresholdMaxAge = uroUtils.GetElmValue('_inputFilterRAAgeMoreThan');
  5764. let selectorRA = document.getElementById('_selectRA');
  5765. if(filterByArea === false)
  5766. {
  5767. while(selectorRA.options.length > 0)
  5768. {
  5769. selectorRA.options.remove(0);
  5770. }
  5771. }
  5772. let shownRA = null;
  5773. if(filterByArea === true)
  5774. {
  5775. if(selectorRA.options.length === 0)
  5776. {
  5777. uroUpdateRAList();
  5778. }
  5779. if(selectorRA.selectedOptions[0] != null)
  5780. {
  5781. shownRA = selectorRA.selectedOptions[0].value;
  5782. }
  5783. }
  5784.  
  5785. let filterNameID = null;
  5786. if(filterByLastEditor == true)
  5787. {
  5788. uroUpdateEditorList(W.model.restrictedDrivingAreas.objects, '_selectRAEditorID', true, true, false, false);
  5789. let selector = document.getElementById('_selectRAEditorID');
  5790. if(selector.selectedIndex > 0)
  5791. {
  5792. filterNameID = document.getElementById('_selectRAEditorID').selectedOptions[0].value;
  5793. }
  5794. }
  5795. let nRANames = document.querySelectorAll('.restricted-driving-area-name-marker').length;
  5796. for (let raIdx = 0; raIdx < W.map.restrictedDrivingAreaLayer.features.length; raIdx++)
  5797. {
  5798. let raObj = W.map.restrictedDrivingAreaLayer.features[raIdx].attributes.wazeFeature;
  5799. if(raObj !== undefined)
  5800. {
  5801. let raStyle = 'visible';
  5802. if(uFURs_masterEnable === true)
  5803. {
  5804. if(shownRA !== null)
  5805. {
  5806. if(raObj._wmeObject.attributes.name != shownRA) raStyle = 'hidden';
  5807. }
  5808. if(filterNameID !== null)
  5809. {
  5810. if((raObj._wmeObject.attributes.createdBy != filterNameID) && (raObj._wmeObject.attributes.updatedBy != filterNameID))
  5811. {
  5812. raStyle = 'hidden';
  5813. }
  5814. }
  5815. let raAge = uroUtils.DateToDays(raObj._wmeObject.attributes.updatedOn);
  5816. if(filterByMinAge == true)
  5817. {
  5818. if(raAge < thresholdMinAge) raStyle = 'hidden';
  5819. }
  5820. if(filterByMaxAge == true)
  5821. {
  5822. if(raAge > thresholdMaxAge) raStyle = 'hidden';
  5823. }
  5824. }
  5825. let geoID = W.map.restrictedDrivingAreaLayer.features[raIdx].geometry.id;
  5826. if(document.getElementById(geoID) !== null)
  5827. {
  5828. document.getElementById(geoID).style.visibility = raStyle;
  5829. }
  5830.  
  5831. // This doesn't always work, as the order in which the markers are listed on their layer isn't guaranteed
  5832. // to match the order in which the corresponding RA polys are listed on theirs...
  5833. if(raIdx < nRANames)
  5834. {
  5835. document.querySelectorAll('.restricted-driving-area-name-marker')[raIdx].style.visibility = raStyle;
  5836. }
  5837. }
  5838. }
  5839. uroDBG.PerfMon(pmFunction, pmTStart);
  5840. }
  5841. function uroFilterPlaceMarker(mObj, vObj, uFP_masterEnable)
  5842. {
  5843. if((mObj === undefined) || (vObj === undefined))
  5844. {
  5845. return;
  5846. }
  5847.  
  5848. let purAge = null;
  5849. let placeStyle = 'visible';
  5850. let hasBalloon = false;
  5851.  
  5852. if(uFP_masterEnable === true)
  5853. {
  5854. if(uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] === true)
  5855. {
  5856. let tPt = [];
  5857. tPt.push(vObj.attributes.geoJSONGeometry.coordinates[0]);
  5858. tPt.push(vObj.attributes.geoJSONGeometry.coordinates[1]);
  5859. if(uroCheckGeometryWithinManagedAreas(tPt) === true) placeStyle = 'hidden';
  5860. }
  5861.  
  5862. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.filterUneditable] === true))
  5863. {
  5864. if(vObj.attributes.permissions === 0)
  5865. {
  5866. placeStyle = 'hidden';
  5867. }
  5868. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.isLoggedIn]))
  5869. {
  5870. if(uro_uFP[uroEnums.FP_OPTS.userRank] < vObj.attributes.lockRank)
  5871. {
  5872. placeStyle = 'hidden';
  5873. }
  5874. }
  5875. if((placeStyle == 'visible') && (vObj.attributes.adLocked))
  5876. {
  5877. placeStyle = 'hidden';
  5878. }
  5879. }
  5880.  
  5881. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.filterLockRanked] === true))
  5882. {
  5883. if(vObj.attributes.lockRank !== 0)
  5884. {
  5885. placeStyle = 'hidden';
  5886. }
  5887. }
  5888.  
  5889. let urEntries = vObj.attributes.venueUpdateRequests;
  5890. if((placeStyle == 'visible') && (urEntries !== undefined))
  5891. {
  5892. hasBalloon = (urEntries.length > 1);
  5893.  
  5894. for(let i = 0; i < urEntries.length; ++i)
  5895. {
  5896. let ut = urEntries[i].attributes.updateType;
  5897. if((uro_uFP[uroEnums.FP_OPTS.filterFlagged] === true) && (ut === "flag"))
  5898. {
  5899. placeStyle = 'hidden';
  5900. }
  5901. else if((uro_uFP[uroEnums.FP_OPTS.filterNewPlace] === true) && (ut === "ADD_VENUE"))
  5902. {
  5903. placeStyle = 'hidden';
  5904. }
  5905. else if((uro_uFP[uroEnums.FP_OPTS.filterUpdatedDetails] === true) && (ut === "UPDATE_VENUE"))
  5906. {
  5907. placeStyle = 'hidden';
  5908. }
  5909. else if((uro_uFP[uroEnums.FP_OPTS.filterNewPhoto] === true) && (ut === "ADD_IMAGE"))
  5910. {
  5911. placeStyle = 'hidden';
  5912. }
  5913. }
  5914.  
  5915. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.filterOnCFs] === true))
  5916. {
  5917. let nVUR = urEntries.length;
  5918. while(nVUR > 0)
  5919. {
  5920. nVUR--;
  5921. let tCF = urEntries[nVUR].attributes.changedFields;
  5922. if(tCF !== undefined)
  5923. {
  5924. if(tCF.length > 0)
  5925. {
  5926. let tFN = tCF[0].attributes.fieldName;
  5927. if((tFN == "phone") && (uro_uFP[uroEnums.FP_OPTS.filterCFPhone] === true))
  5928. {
  5929. placeStyle = 'hidden';
  5930. }
  5931. else if((tFN == "name") && (uro_uFP[uroEnums.FP_OPTS.filterCFName] === true))
  5932. {
  5933. placeStyle = 'hidden';
  5934. }
  5935. else if((tFN == "entryExitPoints") && (uro_uFP[uroEnums.FP_OPTS.filterCFEntryExitPoints] === true))
  5936. {
  5937. placeStyle = 'hidden';
  5938. }
  5939. else if((tFN == "openingHours") && (uro_uFP[uroEnums.FP_OPTS.filterCFOpeningHours] === true))
  5940. {
  5941. placeStyle = 'hidden';
  5942. }
  5943. else if((tFN == "aliases") && (uro_uFP[uroEnums.FP_OPTS.filterCFAliases] === true))
  5944. {
  5945. placeStyle = 'hidden';
  5946. }
  5947. else if((tFN == "services") && (uro_uFP[uroEnums.FP_OPTS.filterCFServices] === true))
  5948. {
  5949. placeStyle = 'hidden';
  5950. }
  5951. else if((tFN == "geometry") && (uro_uFP[uroEnums.FP_OPTS.filterCFGeometry] === true))
  5952. {
  5953. placeStyle = 'hidden';
  5954. }
  5955. else if((tFN == "houseNumber") && (uro_uFP[uroEnums.FP_OPTS.filterCFHouseNumber] === true))
  5956. {
  5957. placeStyle = 'hidden';
  5958. }
  5959. else if((tFN == "categories") && (uro_uFP[uroEnums.FP_OPTS.filterCFCategories] === true))
  5960. {
  5961. placeStyle = 'hidden';
  5962. }
  5963. else if((tFN == "description") && (uro_uFP[uroEnums.FP_OPTS.filterCFDescription] === true))
  5964. {
  5965. placeStyle = 'hidden';
  5966. }
  5967. }
  5968. }
  5969. }
  5970. }
  5971. }
  5972.  
  5973. if(uro_uFP[uroEnums.FP_OPTS.invertPURFilters] === true)
  5974. {
  5975. if(placeStyle == 'hidden') placeStyle = 'visible';
  5976. else placeStyle = 'hidden';
  5977. }
  5978.  
  5979. if(uro_uFP[uroEnums.FP_OPTS.filterMinPURAge] || uro_uFP[uroEnums.FP_OPTS.filterMaxPURAge])
  5980. {
  5981. purAge = uroUtils.GetPURAge(vObj);
  5982. if(uro_uFP[uroEnums.FP_OPTS.filterMinPURAge] === true)
  5983. {
  5984. if(purAge < uro_uFP[uroEnums.FP_OPTS.thresholdMinPURDays]) placeStyle = 'hidden';
  5985. }
  5986. if(uro_uFP[uroEnums.FP_OPTS.filterMaxPURAge] === true)
  5987. {
  5988. if(purAge > uro_uFP[uroEnums.FP_OPTS.thresholdMaxPURDays]) placeStyle = 'hidden';
  5989. }
  5990. }
  5991.  
  5992. if(uroPURsToHide.indexOf(vObj.attributes.id) !== -1)
  5993. {
  5994. placeStyle = 'hidden';
  5995. }
  5996. }
  5997.  
  5998. mObj.style.visibility = placeStyle;
  5999. if(hasBalloon === true)
  6000. {
  6001. // for PURs related to multiple change requests, we also need to apply the
  6002. // filtering to the text inside the balloon that indicates how many CRs
  6003. // the PUR represents - the balloon itself gets filtered as part of the
  6004. // main marker above, but the text is in a seperate element...
  6005. let pObj = mObj.parentNode.parentNode;
  6006. let tObjs = pObj.getElementsByTagName("text");
  6007. for(let i = 0; i < tObjs.length; ++i)
  6008. {
  6009. tObjs[i].style.visibility = placeStyle;
  6010. }
  6011. }
  6012.  
  6013. if((uro_uFP[uroEnums.FP_OPTS.leavePURGeos] === false) && (placeStyle === 'hidden'))
  6014. {
  6015. if(vObj.model != null)
  6016. {
  6017. if(vObj.attributes.geometry != null)
  6018. {
  6019. let puGeo = document.getElementById(vObj.attributes.geometry.id);
  6020. if(puGeo !== null)
  6021. {
  6022. puGeo.style.visibility = 'hidden';
  6023. }
  6024. }
  6025. }
  6026. }
  6027. }
  6028. function uroFilterPlaces()
  6029. {
  6030. let pmTStart = performance.now();
  6031. let pmFunction = "uroFilterPlaces";
  6032.  
  6033. if(uroFilterPreamble() === false) return;
  6034.  
  6035. let moObj = uroGetHighlightedMapFeature();
  6036. let renderIntent = uroGetFeatureRenderIntent(moObj);
  6037. if(moObj != null)
  6038. {
  6039. if(moObj.featureType === 'venue')
  6040. {
  6041. if((renderIntent == 'select') || (renderIntent == 'highlightselected'))
  6042. {
  6043. return;
  6044. }
  6045. }
  6046. }
  6047.  
  6048. if(uroUtils.GetCBChecked('_cbDisablePlacesFiltering') === true) return;
  6049.  
  6050. uroUpdateVenueEditorLists();
  6051.  
  6052. let filterNameID = null;
  6053. let tbUserName = uroUtils.GetElmValue('_textPlacesEditor');
  6054. let selector = document.getElementById('_selectPlacesUserID');
  6055. if(selector.selectedIndex > 0)
  6056. {
  6057. let selUserName = document.getElementById('_selectPlacesUserID').selectedOptions[0].innerHTML;
  6058. if(selUserName == tbUserName)
  6059. {
  6060. filterNameID = document.getElementById('_selectPlacesUserID').selectedOptions[0].value;
  6061. }
  6062. }
  6063. filterNameID = uroGetUserID(filterNameID, tbUserName);
  6064.  
  6065. let filterHideNameID = null;
  6066. let tbHideUserName = uroUtils.GetElmValue('_textHidePlacesEditor');
  6067. let selectorHide = document.getElementById('_selectHidePlacesUserID');
  6068. if(selectorHide.selectedIndex > 0)
  6069. {
  6070. let selHideUserName = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].innerHTML;
  6071. if(selHideUserName == tbHideUserName)
  6072. {
  6073. filterHideNameID = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].value;
  6074. }
  6075. }
  6076. filterHideNameID = uroGetUserID(filterHideNameID, tbHideUserName);
  6077.  
  6078. let filterCats = [];
  6079. for(let i=0; i<W.Config.venues.categories.length; i++)
  6080. {
  6081. let parentCategory = W.Config.venues.categories[i];
  6082. let subCategory;
  6083.  
  6084. if(uroUtils.GetCBChecked('_cbPlacesFilter-'+parentCategory) === true)
  6085. {
  6086. filterCats.push(parentCategory);
  6087. for(let i1=0; i1<W.Config.venues.subcategories[parentCategory].length; i1++)
  6088. {
  6089. subCategory = W.Config.venues.subcategories[parentCategory][i1];
  6090. filterCats.push(subCategory);
  6091. }
  6092. }
  6093. else
  6094. {
  6095. for(let i2=0; i2<W.Config.venues.subcategories[parentCategory].length; i2++)
  6096. {
  6097. subCategory = W.Config.venues.subcategories[parentCategory][i2];
  6098. if(uroUtils.GetCBChecked('_cbPlacesFilter-'+subCategory) === true)
  6099. {
  6100. filterCats.push(subCategory);
  6101. }
  6102. }
  6103. }
  6104. }
  6105.  
  6106. let placeStyle;
  6107.  
  6108. let uFP_filterEditedLessThan = uroUtils.GetCBChecked('_cbPlaceFilterEditedLessThan');
  6109. let uFP_filterEditedMoreThan = uroUtils.GetCBChecked('_cbPlaceFilterEditedMoreThan');
  6110. let uFP_filterL0 = uroUtils.GetCBChecked('_cbHidePlacesL0');
  6111. let uFP_filterL1 = uroUtils.GetCBChecked('_cbHidePlacesL1');
  6112. let uFP_filterL2 = uroUtils.GetCBChecked('_cbHidePlacesL2');
  6113. let uFP_filterL3 = uroUtils.GetCBChecked('_cbHidePlacesL3');
  6114. let uFP_filterL4 = uroUtils.GetCBChecked('_cbHidePlacesL4');
  6115. let uFP_filterL5 = uroUtils.GetCBChecked('_cbHidePlacesL5');
  6116. let uFP_filterStaff = uroUtils.GetCBChecked('_cbHidePlacesStaff');
  6117. let uFP_filterAL = uroUtils.GetCBChecked('_cbHidePlacesAdLocked');
  6118. let uFP_filterOnLockLevel = (uFP_filterL0 || uFP_filterL1 || uFP_filterL2 || uFP_filterL3 || uFP_filterL4 || uFP_filterL5 || uFP_filterStaff);
  6119. let uFP_filterNoPhotos = uroUtils.GetCBChecked('_cbHideNoPhotoPlaces');
  6120. let uFP_filterWithPhotos = uroUtils.GetCBChecked('_cbHidePhotoPlaces');
  6121. let uFP_filterNoLinks = uroUtils.GetCBChecked('_cbHideNoLinkedPlaces');
  6122. let uFP_filterWithLinks = uroUtils.GetCBChecked('_cbHideLinkedPlaces');
  6123. let uFP_filterNoDescription = uroUtils.GetCBChecked('_cbHideNonDescribedPlaces');
  6124. let uFP_filterWithDescription = uroUtils.GetCBChecked('_cbHideDescribedPlaces');
  6125. let uFP_filterNoKeyword = uroUtils.GetCBChecked('_cbHideKeywordPlaces');
  6126. let uFP_filterKeyword = uroUtils.GetCBChecked('_cbHideNoKeywordPlaces');
  6127. let uFP_filterPrivate = uroUtils.GetCBChecked('_cbFilterPrivatePlaces');
  6128. let uFP_invertFilters = uroUtils.GetCBChecked('_cbInvertPlacesFilter');
  6129. let uFP_masterEnable = uroIsFilteringEnabled(false);
  6130. let uFP_filterAreaPlaces = uroUtils.GetCBChecked('_cbHideAreaPlaces');
  6131. let uFP_filterPointPlaces = uroUtils.GetCBChecked('_cbHidePointPlaces');
  6132. let uFP_filterCreatedBy = uroUtils.GetCBChecked('_cbShowOnlyPlacesCreatedBy');
  6133. let uFP_filterEditedBy = uroUtils.GetCBChecked('_cbShowOnlyPlacesEditedBy');
  6134. let uFP_filterHideCreatedBy = uroUtils.GetCBChecked('_cbHideOnlyPlacesCreatedBy');
  6135. let uFP_filterHideEditedBy = uroUtils.GetCBChecked('_cbHideOnlyPlacesEditedBy');
  6136.  
  6137. let uFP_hidePURsForFilteredPlaces = uroUtils.GetCBChecked('_cbHidePURsForFilteredPlaces');
  6138.  
  6139. let uFP_NameKeyword = document.getElementById('_textKeywordPlace').value.toLowerCase();
  6140. let uFP_thresholdMinDays = document.getElementById('_inputFilterPlaceEditMinDays').value;
  6141. let uFP_thresholdMaxDays = document.getElementById('_inputFilterPlaceEditMaxDays').value;
  6142.  
  6143. uroPURsToHide = [];
  6144.  
  6145. for(let v=0; v<uroVenueLayer.features.length; v++)
  6146. {
  6147. placeStyle = 'visible';
  6148. if(uFP_masterEnable === true)
  6149. {
  6150. let lmObj = uroVenueLayer.features[v];
  6151.  
  6152. // when an area place is selected, the drag points for editing the place outline now get added as objects into uroVenueLayer.features,
  6153. // however none of these objects had the .attributes.repositoryObject property - whilst the devs have now replaced this with the almost
  6154. // identical .wazeFeature._wmeObject property, it's unclear if drag points still need to be excluded from this scan, so the check
  6155. // remains in place as a "let's just make sure it has it before trying to use it"...
  6156. if(lmObj?.attributes?.wazeFeature?._wmeObject != null)
  6157. {
  6158. lmObj = lmObj.attributes.wazeFeature._wmeObject.attributes;
  6159. if(lmObj.id < 0)
  6160. {
  6161. // don't apply filtering to newly-created places - this allows the user to leave their filtering settings unchanged whilst
  6162. // adding a new place which, once saved, would then be hidden...
  6163. break;
  6164. }
  6165.  
  6166. if(uFP_filterAreaPlaces)
  6167. {
  6168. if(lmObj.geometry.id.indexOf('Polygon') !== -1)
  6169. {
  6170. placeStyle = 'hidden';
  6171. }
  6172. }
  6173. if(uFP_filterPointPlaces)
  6174. {
  6175. if(lmObj.geometry.id.indexOf('Point') !== -1)
  6176. {
  6177. placeStyle = 'hidden';
  6178. }
  6179. }
  6180.  
  6181.  
  6182. if(placeStyle == 'visible')
  6183. {
  6184. if((uFP_filterEditedLessThan) || (uFP_filterEditedMoreThan))
  6185. {
  6186. let editDate = lmObj.updatedOn;
  6187. if(editDate === undefined)
  6188. {
  6189. // where a place has never been edited since its creation, use the creation date instead...
  6190. editDate = lmObj.createdOn;
  6191. }
  6192. if(editDate != null)
  6193. {
  6194. let editDaysAgo = uroUtils.DateToDays(editDate);
  6195. if(uFP_filterEditedLessThan)
  6196. {
  6197. if(editDaysAgo < uFP_thresholdMinDays)
  6198. {
  6199. placeStyle = 'hidden';
  6200. }
  6201. }
  6202. if(uFP_filterEditedMoreThan)
  6203. {
  6204. if(editDaysAgo > uFP_thresholdMaxDays)
  6205. {
  6206. placeStyle = 'hidden';
  6207. }
  6208. }
  6209. }
  6210. }
  6211. }
  6212.  
  6213. if(placeStyle == 'visible')
  6214. {
  6215. if(uFP_filterOnLockLevel)
  6216. {
  6217. let lockLevel = lmObj.lockRank;
  6218. if ((uFP_filterL0) && (lockLevel === 0)) placeStyle = 'hidden';
  6219. if ((uFP_filterL1) && (lockLevel === 1)) placeStyle = 'hidden';
  6220. if ((uFP_filterL2) && (lockLevel === 2)) placeStyle = 'hidden';
  6221. if ((uFP_filterL3) && (lockLevel === 3)) placeStyle = 'hidden';
  6222. if ((uFP_filterL4) && (lockLevel === 4)) placeStyle = 'hidden';
  6223. if ((uFP_filterL5) && (lockLevel === 5)) placeStyle = 'hidden';
  6224. if ((uFP_filterStaff) && (lockLevel === 6)) placeStyle = 'hidden';
  6225. }
  6226. }
  6227.  
  6228. if(placeStyle == 'visible')
  6229. {
  6230. if(uFP_filterAL)
  6231. {
  6232. if(lmObj.adLocked) placeStyle = 'hidden';
  6233. }
  6234. }
  6235.  
  6236. if(placeStyle == 'visible')
  6237. {
  6238. if(uFP_filterNoPhotos || uFP_filterWithPhotos)
  6239. {
  6240. let nPhotos = 0;
  6241. for(let loop=0; loop<lmObj.images.length; loop++)
  6242. {
  6243. if(lmObj.images[loop].attributes.approved) nPhotos++;
  6244. }
  6245. if((uFP_filterNoPhotos) && (nPhotos === 0)) placeStyle = 'hidden';
  6246. if((uFP_filterWithPhotos) && (nPhotos !== 0)) placeStyle = 'hidden';
  6247. }
  6248. }
  6249.  
  6250. if(placeStyle == 'visible')
  6251. {
  6252. if(uFP_filterNoLinks || uFP_filterWithLinks)
  6253. {
  6254. let nLinks = lmObj.externalProviderIDs.length;
  6255. if((uFP_filterNoLinks) && (nLinks === 0)) placeStyle = 'hidden';
  6256. if((uFP_filterWithLinks) && (nLinks !== 0)) placeStyle = 'hidden';
  6257. }
  6258. }
  6259.  
  6260. if(placeStyle == 'visible')
  6261. {
  6262. if(uFP_filterNoDescription || uFP_filterWithDescription)
  6263. {
  6264. let lDesc = lmObj.description.length;
  6265. if((uFP_filterNoDescription) && (lDesc === 0)) placeStyle = 'hidden';
  6266. if((uFP_filterWithDescription) && (lDesc !== 0)) placeStyle = 'hidden';
  6267. }
  6268. }
  6269.  
  6270. if(placeStyle == 'visible')
  6271. {
  6272. if((uFP_filterPrivate === true) && (lmObj.residential === true))
  6273. {
  6274. placeStyle = 'hidden';
  6275. }
  6276. else
  6277. {
  6278. for(let cat=0; cat<filterCats.length; cat++)
  6279. {
  6280. if(_.includes(lmObj.categories, filterCats[cat]))
  6281. {
  6282. placeStyle = 'hidden';
  6283. break;
  6284. }
  6285. }
  6286. }
  6287. }
  6288.  
  6289. if(placeStyle == 'visible')
  6290. {
  6291. if(uFP_filterNoKeyword || uFP_filterKeyword)
  6292. {
  6293. let venueName = lmObj.name.toLowerCase();
  6294. let noKeywordMatch = true;
  6295. if(uFP_NameKeyword === '')
  6296. {
  6297. noKeywordMatch = (venueName !== '');
  6298. }
  6299. else
  6300. {
  6301. noKeywordMatch = (venueName.indexOf(uFP_NameKeyword) === -1);
  6302. }
  6303.  
  6304. if(!noKeywordMatch && uFP_filterNoKeyword) placeStyle = 'hidden';
  6305. if(noKeywordMatch && uFP_filterKeyword) placeStyle = 'hidden';
  6306. }
  6307. }
  6308.  
  6309. if(placeStyle == 'visible')
  6310. {
  6311. if(filterNameID != null)
  6312. {
  6313. if(uFP_filterCreatedBy === true)
  6314. {
  6315. if(filterNameID != lmObj.createdBy) placeStyle = 'hidden';
  6316. }
  6317. if(uFP_filterEditedBy === true)
  6318. {
  6319. if(filterNameID != lmObj.updatedBy) placeStyle = 'hidden';
  6320. }
  6321. }
  6322. }
  6323. if(placeStyle == 'visible')
  6324. {
  6325. if(filterHideNameID != null)
  6326. {
  6327. if(uFP_filterHideCreatedBy === true)
  6328. {
  6329. if(filterHideNameID == lmObj.createdBy) placeStyle = 'hidden';
  6330. }
  6331. if(uFP_filterHideEditedBy === true)
  6332. {
  6333. if(filterHideNameID == lmObj.updatedBy) placeStyle = 'hidden';
  6334. }
  6335. }
  6336. }
  6337.  
  6338. if(uFP_invertFilters === true)
  6339. {
  6340. if(placeStyle == 'hidden') placeStyle = 'visible';
  6341. else placeStyle = 'hidden';
  6342. }
  6343. }
  6344.  
  6345. if((placeStyle == 'hidden') && (uFP_hidePURsForFilteredPlaces === true))
  6346. {
  6347. uroPURsToHide.push(lmObj.id);
  6348. }
  6349. }
  6350.  
  6351. let geoID = uroVenueLayer.features[v].geometry.id;
  6352. if(document.getElementById(geoID) !== null)
  6353. {
  6354. document.getElementById(geoID).style.visibility = placeStyle;
  6355. }
  6356. }
  6357.  
  6358. uro_uFP[uroEnums.FP_OPTS.filterUneditable] = uroUtils.GetCBChecked('_cbFilterUneditablePlaceUpdates');
  6359. uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] = uroUtils.GetCBChecked('_cbPURFilterInsideManagedAreas');
  6360. uro_uFP[uroEnums.FP_OPTS.excludeMyAreas] = uroUtils.GetCBChecked('_cbPURExcludeUserArea');
  6361. uro_uFP[uroEnums.FP_OPTS.filterLockRanked] = uroUtils.GetCBChecked('_cbFilterLockRankedPlaceUpdates');
  6362. uro_uFP[uroEnums.FP_OPTS.filterFlagged] = uroUtils.GetCBChecked("_cbFilterFlaggedPUR");
  6363. uro_uFP[uroEnums.FP_OPTS.filterNewPlace] = uroUtils.GetCBChecked("_cbFilterNewPlacePUR");
  6364. uro_uFP[uroEnums.FP_OPTS.filterUpdatedDetails] = uroUtils.GetCBChecked("_cbFilterUpdatedDetailsPUR");
  6365. uro_uFP[uroEnums.FP_OPTS.filterNewPhoto] = uroUtils.GetCBChecked("_cbFilterNewPhotoPUR");
  6366. uro_uFP[uroEnums.FP_OPTS.filterMinPURAge] = uroUtils.GetCBChecked('_cbEnablePURMinAgeFilter');
  6367. uro_uFP[uroEnums.FP_OPTS.filterMaxPURAge] = uroUtils.GetCBChecked('_cbEnablePURMaxAgeFilter');
  6368. uro_uFP[uroEnums.FP_OPTS.invertPURFilters] = uroUtils.GetCBChecked('_cbInvertPURFilters');
  6369. uro_uFP[uroEnums.FP_OPTS.leavePURGeos] = uroUtils.GetCBChecked('_cbLeavePURGeos');
  6370. uro_uFP[uroEnums.FP_OPTS.filterCFPhone] = uroUtils.GetCBChecked('_cbPURFilterCFPhone');
  6371. uro_uFP[uroEnums.FP_OPTS.filterCFName] = uroUtils.GetCBChecked('_cbPURFilterCFName');
  6372. uro_uFP[uroEnums.FP_OPTS.filterCFEntryExitPoints] = uroUtils.GetCBChecked('_cbPURFilterCFEntryExitPoints');
  6373. uro_uFP[uroEnums.FP_OPTS.filterCFOpeningHours] = uroUtils.GetCBChecked('_cbPURFilterCFOpeningHours');
  6374. uro_uFP[uroEnums.FP_OPTS.filterCFAliases] = uroUtils.GetCBChecked('_cbPURFilterCFAliases');
  6375. uro_uFP[uroEnums.FP_OPTS.filterCFServices] = uroUtils.GetCBChecked('_cbPURFilterCFServices');
  6376. uro_uFP[uroEnums.FP_OPTS.filterCFGeometry] = uroUtils.GetCBChecked('_cbPURFilterCFGeometry');
  6377. uro_uFP[uroEnums.FP_OPTS.filterCFHouseNumber] = uroUtils.GetCBChecked('_cbPURFilterCFHouseNumber');
  6378. uro_uFP[uroEnums.FP_OPTS.filterCFCategories] = uroUtils.GetCBChecked('_cbPURFilterCFCategories');
  6379. uro_uFP[uroEnums.FP_OPTS.filterCFDescription] = uroUtils.GetCBChecked('_cbPURFilterCFDescription');
  6380.  
  6381. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] =
  6382. (
  6383. uro_uFP[uroEnums.FP_OPTS.filterCFPhone] ||
  6384. uro_uFP[uroEnums.FP_OPTS.filterCFName] ||
  6385. uro_uFP[uroEnums.FP_OPTS.filterCFEntryExitPoints] ||
  6386. uro_uFP[uroEnums.FP_OPTS.filterCFOpeningHours]
  6387. );
  6388. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] =
  6389. (
  6390. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] ||
  6391. uro_uFP[uroEnums.FP_OPTS.filterCFAliases] ||
  6392. uro_uFP[uroEnums.FP_OPTS.filterCFServices] ||
  6393. uro_uFP[uroEnums.FP_OPTS.filterCFGeometry]
  6394. );
  6395. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] =
  6396. (
  6397. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] ||
  6398. uro_uFP[uroEnums.FP_OPTS.filterCFHouseNumber] ||
  6399. uro_uFP[uroEnums.FP_OPTS.filterCFCategories] ||
  6400. uro_uFP[uroEnums.FP_OPTS.filterCFDescription]
  6401. );
  6402.  
  6403. uro_uFP[uroEnums.FP_OPTS.thresholdMinPURDays] = uroUtils.GetElmValue('_inputPURFilterMinDays');
  6404. uro_uFP[uroEnums.FP_OPTS.thresholdMaxPURDays] = uroUtils.GetElmValue('_inputPURFilterMaxDays');
  6405. uro_uFP[uroEnums.FP_OPTS.isLoggedIn] = W.loginManager.isLoggedIn();
  6406. uro_uFP[uroEnums.FP_OPTS.userRank] = W.loginManager.user.attributes.rank;
  6407.  
  6408. uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] = uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] && (uroGetManagedAreas() !== 0);
  6409. if(uroUtils.GetCBChecked('_cbPURExcludeUserArea') == true)
  6410. {
  6411. uroIgnoreAreasUserID = W.loginManager.user.attributes.id;
  6412. }
  6413.  
  6414. uroPrepForFilterPlaceMarker(uroLayers.ID.PUR, uFP_masterEnable);
  6415. uroPrepForFilterPlaceMarker(uroLayers.ID.PPUR, uFP_masterEnable);
  6416. uroPrepForFilterPlaceMarker(uroLayers.ID.RPUR, uFP_masterEnable);
  6417.  
  6418. uroDBG.PerfMon(pmFunction, pmTStart);
  6419. }
  6420. function uroPrepForFilterPlaceMarker(markerType, masterEnable)
  6421. {
  6422. if(uroLayers.layers[markerType].l?.getVisibility() === true)
  6423. {
  6424. let pu;
  6425. let mObj;
  6426. let vObj;
  6427. let idList = uroGetMarkerIDs(markerType);
  6428. for(pu of idList)
  6429. {
  6430. mObj = uroGetMarker(markerType, pu);
  6431. if(mObj !== null)
  6432. {
  6433. vObj = W.model.venues.objects[pu];
  6434. uroFilterPlaceMarker(mObj, vObj, masterEnable);
  6435. }
  6436. }
  6437. }
  6438. }
  6439. function uroGetClosestSegmentToPoint(p)
  6440. {
  6441. let retval = null;
  6442. if(W.map.getZoom() >= 16)
  6443. {
  6444. let minDist = 99999999;
  6445.  
  6446. for(let s in W.model.segments.objects)
  6447. {
  6448. if(W.model.segments.objects.hasOwnProperty(s))
  6449. {
  6450. let seg = W.model.segments.getObjectById(s);
  6451. let dist = seg.attributes.geometry.distanceTo(p);
  6452. if(dist < minDist)
  6453. {
  6454. minDist = dist;
  6455. retval = s;
  6456. }
  6457. }
  6458. }
  6459. }
  6460. return retval;
  6461. }
  6462. function uroIsCamSpeedValid(camObj)
  6463. {
  6464. let retval = true;
  6465.  
  6466. let cPoint = camObj.attributes.geometry.getCentroid();
  6467. let nSeg = uroGetClosestSegmentToPoint(cPoint);
  6468. if(nSeg !== null)
  6469. {
  6470. let fwdSpeed = W.model.segments.getObjectById(nSeg).attributes.fwdMaxSpeed;
  6471. let revSpeed = W.model.segments.getObjectById(nSeg).attributes.revMaxSpeed;
  6472. let camSpeed = camObj.attributes.speed;
  6473. if(W.model.isImperial == true)
  6474. {
  6475. fwdSpeed = Math.round(fwdSpeed / 1.609);
  6476. revSpeed = Math.round(revSpeed / 1.609);
  6477. camSpeed = Math.round(camSpeed / 1.609);
  6478. }
  6479. if((camSpeed !== fwdSpeed) && (camSpeed !== revSpeed))
  6480. {
  6481. retval = false;
  6482. }
  6483. }
  6484.  
  6485. return retval;
  6486. }
  6487. function uroFilterCameras()
  6488. {
  6489. //// disabled pending update for hazard-based cameras
  6490. return;
  6491.  
  6492. let pmTStart = performance.now();
  6493. let pmFunction = "uroFilterCameras";
  6494.  
  6495. if(uroFilterPreamble() === false)
  6496. {
  6497. return;
  6498. }
  6499.  
  6500. if(uroMouseIsDown === false) W.map.camerasLayer.redraw();
  6501.  
  6502. if(uroIsFilteringEnabled(false) === true)
  6503. {
  6504. uroUpdateEditorList(W.model.cameras.objects, '_selectCameraUserID', true, true, false, false);
  6505. let tbUserName = uroUtils.GetElmValue('_textCameraEditor');
  6506. let selector = document.getElementById('_selectCameraUserID');
  6507. let filterNameID = null;
  6508. if(selector.selectedIndex > 0)
  6509. {
  6510. let selUserName = document.getElementById('_selectCameraUserID').selectedOptions[0].innerHTML;
  6511. if(selUserName == tbUserName)
  6512. {
  6513. filterNameID = document.getElementById('_selectCameraUserID').selectedOptions[0].value;
  6514. }
  6515. }
  6516. filterNameID = uroGetUserID(filterNameID, tbUserName);
  6517.  
  6518. let isChecked_cbShowOnlyCamsCreatedBy = uroUtils.GetCBChecked('_cbShowOnlyCamsCreatedBy');
  6519. let isChecked_cbShowOnlyCamsEditedBy = uroUtils.GetCBChecked('_cbShowOnlyCamsEditedBy');
  6520. let isChecked_cbShowOnlyMyCams = uroUtils.GetCBChecked('_cbShowOnlyMyCams');
  6521. let isChecked_cbShowWorldCams = uroUtils.GetCBChecked('_cbShowWorldCams');
  6522. let isChecked_cbShowUSACams = uroUtils.GetCBChecked('_cbShowUSACams');
  6523. let isChecked_cbShowNonWorldCams = uroUtils.GetCBChecked('_cbShowNonWorldCams');
  6524. let isChecked_cbShowSpeedCams = uroUtils.GetCBChecked('_cbShowSpeedCams');
  6525. let isChecked_cbShowRedLightCams = uroUtils.GetCBChecked('_cbShowRedLightCams');
  6526. let isChecked_cbShowDummyCams = uroUtils.GetCBChecked('_cbShowDummyCams');
  6527. let isChecked_cbShowIfNoSpeedSet = uroUtils.GetCBChecked('_cbShowIfNoSpeedSet');
  6528. let isChecked_cbShowIfSpeedSet = uroUtils.GetCBChecked('_cbShowIfSpeedSet');
  6529. let isChecked_cbShowIfInvalidSpeedSet = uroUtils.GetCBChecked('_cbShowIfInvalidSpeedSet');
  6530. let isChecked_cbShowRLCIfNoSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfNoSpeedSet');
  6531. let isChecked_cbShowRLCIfNonZeroSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfNonZeroSpeedSet');
  6532. let isChecked_cbShowRLCIfZeroSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfZeroSpeedSet');
  6533. let isChecked_cbHideCreatedByMe = uroUtils.GetCBChecked('_cbHideCreatedByMe');
  6534. let isChecked_cbHideCreatedByRank0 = uroUtils.GetCBChecked('_cbHideCreatedByRank0');
  6535. let isChecked_cbHideCreatedByRank1 = uroUtils.GetCBChecked('_cbHideCreatedByRank1');
  6536. let isChecked_cbHideCreatedByRank2 = uroUtils.GetCBChecked('_cbHideCreatedByRank2');
  6537. let isChecked_cbHideCreatedByRank3 = uroUtils.GetCBChecked('_cbHideCreatedByRank3');
  6538. let isChecked_cbHideCreatedByRank4 = uroUtils.GetCBChecked('_cbHideCreatedByRank4');
  6539. let isChecked_cbHideCreatedByRank5 = uroUtils.GetCBChecked('_cbHideCreatedByRank5');
  6540. let isChecked_cbHideUpdatedByMe = uroUtils.GetCBChecked('_cbHideUpdatedByMe');
  6541. let isChecked_cbHideUpdatedByRank0 = uroUtils.GetCBChecked('_cbHideUpdatedByRank0');
  6542. let isChecked_cbHideUpdatedByRank1 = uroUtils.GetCBChecked('_cbHideUpdatedByRank1');
  6543. let isChecked_cbHideUpdatedByRank2 = uroUtils.GetCBChecked('_cbHideUpdatedByRank2');
  6544. let isChecked_cbHideUpdatedByRank3 = uroUtils.GetCBChecked('_cbHideUpdatedByRank3');
  6545. let isChecked_cbHideUpdatedByRank4 = uroUtils.GetCBChecked('_cbHideUpdatedByRank4');
  6546. let isChecked_cbHideUpdatedByRank5 = uroUtils.GetCBChecked('_cbHideUpdatedByRank5');
  6547. let isChecked_HideManualLockedCams = uroUtils.GetCBChecked('_cbHideManualLockedCams');
  6548. let isChecked_cbHighlightInsteadOfHideCams = uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams');
  6549. let isChecked_InvertFiltere = uroUtils.GetCBChecked('_cbInvertCamFilters');
  6550.  
  6551. let nCameras = uroLayers.layers[uroLayers.ID.cam].l.features.length;
  6552. for (let i = 0; i < nCameras; ++i)
  6553. {
  6554. let uroCamUpdater = '';
  6555. let uroCamUpdaterRank = -1;
  6556. let uroCamCreator = '';
  6557. let uroCamCreatorRank = -1;
  6558. let wf = uroLayers.layers[uroLayers.ID.cam].l.features[i].attributes.wazeFeature;
  6559. // When a camera is selected, the alignment/positioning UI elements get added to features[].
  6560. // As these elements aren't camera markers and therefore have no attributes, we need to
  6561. // ignore them to prevent errors in the filtering code below...
  6562. if(wf !== undefined)
  6563. {
  6564. let uroCam = wf._wmeObject;
  6565. let uroCamStyle = 'visible';
  6566.  
  6567. if(uroCam.attributes.createdBy !== null)
  6568. {
  6569. if(W.model.users.objects[uroCam.attributes.createdBy] != null)
  6570. {
  6571. uroCamCreator = W.model.users.objects[uroCam.attributes.createdBy].attributes.userName;
  6572. uroCamCreatorRank = W.model.users.objects[uroCam.attributes.createdBy].attributes.rank;
  6573. }
  6574. }
  6575.  
  6576. if(uroCam.attributes.updatedBy !== null)
  6577. {
  6578. if(W.model.users.objects[uroCam.attributes.updatedBy] != null)
  6579. {
  6580. uroCamUpdater = W.model.users.objects[uroCam.attributes.updatedBy].attributes.userName;
  6581. uroCamUpdaterRank = W.model.users.objects[uroCam.attributes.updatedBy].attributes.rank;
  6582. }
  6583. }
  6584.  
  6585. let uroCamType = uroCam.attributes.type;
  6586. let camIsAutoLocked = (uroCam.attributes.lockRank === null);
  6587.  
  6588. if(isChecked_HideManualLockedCams === true)
  6589. {
  6590. if(camIsAutoLocked === false) uroCamStyle = 'hidden';
  6591. }
  6592.  
  6593. if(filterNameID != null)
  6594. {
  6595. if(isChecked_cbShowOnlyCamsCreatedBy === true)
  6596. {
  6597. if(filterNameID != uroCam.attributes.createdBy) uroCamStyle = 'hidden';
  6598. }
  6599. if(isChecked_cbShowOnlyCamsEditedBy === true)
  6600. {
  6601. if(filterNameID != uroCam.attributes.updatedBy) uroCamStyle = 'hidden';
  6602. }
  6603. }
  6604.  
  6605. if(isChecked_cbShowOnlyMyCams === true)
  6606. {
  6607. if((uroUserID != uroCam.attributes.createdBy)&&(uroUserID != uroCam.attributes.updatedBy)) uroCamStyle = 'hidden';
  6608. }
  6609.  
  6610. if((isChecked_cbShowWorldCams === false) || (isChecked_cbShowUSACams === false) || (isChecked_cbShowNonWorldCams === false))
  6611. {
  6612. let posWorld = uroCamCreator.indexOf('world_');
  6613. let posUSA = uroCamCreator.indexOf('usa_');
  6614.  
  6615. if((isChecked_cbShowWorldCams === false) && (posWorld === 0)) uroCamStyle = 'hidden';
  6616. if((isChecked_cbShowUSACams === false) && (posUSA === 0)) uroCamStyle = 'hidden';
  6617. if((isChecked_cbShowNonWorldCams === false) && (posWorld !== 0) && (posUSA !== 0)) uroCamStyle = 'hidden';
  6618. }
  6619.  
  6620. if((isChecked_cbShowSpeedCams === false) || (isChecked_cbShowRedLightCams === false) || (isChecked_cbShowDummyCams === false))
  6621. {
  6622. if((isChecked_cbShowSpeedCams === false) && (uroCamType == 2)) uroCamStyle = 'hidden';
  6623. if((isChecked_cbShowRedLightCams === false) && (uroCamType == 4)) uroCamStyle = 'hidden';
  6624. if((isChecked_cbShowDummyCams === false) && (uroCamType == 3)) uroCamStyle = 'hidden';
  6625. }
  6626.  
  6627. if((isChecked_cbShowSpeedCams === true) && (uroCamType == 2))
  6628. {
  6629. if((isChecked_cbShowIfNoSpeedSet === false) && (uroCam.attributes.speed === null)) uroCamStyle = 'hidden';
  6630. if((isChecked_cbShowIfSpeedSet === false) && (uroCam.attributes.speed !== null)) uroCamStyle = 'hidden';
  6631. if(isChecked_cbShowIfInvalidSpeedSet === false)
  6632. {
  6633. if(uroIsCamSpeedValid(uroCam) === false)
  6634. {
  6635. uroCamStyle = 'hidden';
  6636. }
  6637. }
  6638. }
  6639.  
  6640. if((isChecked_cbShowRedLightCams === true) && (uroCamType == 4))
  6641. {
  6642. if((isChecked_cbShowRLCIfNoSpeedSet === false) && (uroCam.attributes.speed === null)) uroCamStyle = 'hidden';
  6643. if((isChecked_cbShowRLCIfNonZeroSpeedSet === false) && (uroCam.attributes.speed > 0)) uroCamStyle = 'hidden';
  6644. if((isChecked_cbShowRLCIfZeroSpeedSet === false) && (uroCam.attributes.speed === 0)) uroCamStyle = 'hidden';
  6645. }
  6646.  
  6647. if(isChecked_cbHideCreatedByMe === true)
  6648. {
  6649. if(uroUserID == uroCam.attributes.createdBy) uroCamStyle = 'hidden';
  6650. }
  6651. if((isChecked_cbHideCreatedByRank0 === true) && (uroCamCreatorRank === 0)) uroCamStyle = 'hidden';
  6652. if((isChecked_cbHideCreatedByRank1 === true) && (uroCamCreatorRank == 1)) uroCamStyle = 'hidden';
  6653. if((isChecked_cbHideCreatedByRank2 === true) && (uroCamCreatorRank == 2)) uroCamStyle = 'hidden';
  6654. if((isChecked_cbHideCreatedByRank3 === true) && (uroCamCreatorRank == 3)) uroCamStyle = 'hidden';
  6655. if((isChecked_cbHideCreatedByRank4 === true) && (uroCamCreatorRank == 4)) uroCamStyle = 'hidden';
  6656. if((isChecked_cbHideCreatedByRank5 === true) && (uroCamCreatorRank == 5)) uroCamStyle = 'hidden';
  6657.  
  6658. if(isChecked_cbHideUpdatedByMe === true)
  6659. {
  6660. if(uroUserID == uroCam.attributes.updatedBy) uroCamStyle = 'hidden';
  6661. }
  6662. if((isChecked_cbHideUpdatedByRank0 === true) && (uroCamUpdaterRank === 0)) uroCamStyle = 'hidden';
  6663. if((isChecked_cbHideUpdatedByRank1 === true) && (uroCamUpdaterRank == 1)) uroCamStyle = 'hidden';
  6664. if((isChecked_cbHideUpdatedByRank2 === true) && (uroCamUpdaterRank == 2)) uroCamStyle = 'hidden';
  6665. if((isChecked_cbHideUpdatedByRank3 === true) && (uroCamUpdaterRank == 3)) uroCamStyle = 'hidden';
  6666. if((isChecked_cbHideUpdatedByRank4 === true) && (uroCamUpdaterRank == 4)) uroCamStyle = 'hidden';
  6667. if((isChecked_cbHideUpdatedByRank5 === true) && (uroCamUpdaterRank == 5)) uroCamStyle = 'hidden';
  6668.  
  6669. if(isChecked_InvertFiltere === true)
  6670. {
  6671. if(uroCamStyle == "hidden")
  6672. {
  6673. uroCamStyle = "";
  6674. }
  6675. else
  6676. {
  6677. uroCamStyle = "hidden";
  6678. }
  6679. }
  6680.  
  6681. let uroCamGeometryID = uroLayers.layers[uroLayers.ID.cam].l.features[i].geometry.id;
  6682. let svgElm = document.getElementById(uroCamGeometryID);
  6683.  
  6684. if(svgElm !== null)
  6685. {
  6686. let origImage;
  6687. if(uroCamStyle == "hidden")
  6688. {
  6689. if(isChecked_cbHighlightInsteadOfHideCams === true)
  6690. {
  6691. // set the "highlight" camera image here...
  6692. let hrefImage = svgElm.getAttribute("xlink:href");
  6693. origImage = svgElm.getAttribute("origImage");
  6694. if((hrefImage === origImage) || (origImage === null))
  6695. {
  6696. svgElm.setAttribute("origImage", hrefImage);
  6697. svgElm.setAttribute("xlink:href", uroImages.HighlightedCameraImages[(uroCamType-2)]);
  6698.  
  6699. svgElm.addEventListener("mouseover", uroMarkers.MouseOver, false);
  6700. svgElm.addEventListener("mouseout", uroMarkers.MouseOut, false);
  6701. }
  6702. }
  6703. else
  6704. {
  6705. svgElm.remove();
  6706. }
  6707. }
  6708. else
  6709. {
  6710. // restore the original camera image here...
  6711. if(svgElm.getAttribute("origImage") !== null)
  6712. {
  6713. origImage = svgElm.getAttribute("origImage");
  6714. svgElm.setAttribute("xlink:href", origImage);
  6715. svgElm.removeAttribute("origImage");
  6716. }
  6717. }
  6718. }
  6719. }
  6720. }
  6721. }
  6722. uroDBG.PerfMon(pmFunction, pmTStart);
  6723. }
  6724. function uroFilterMapComments()
  6725. {
  6726. let pmTStart = performance.now();
  6727. let pmFunction = "uroFilterMapComments";
  6728.  
  6729. if(uroFilterPreamble() === false) return;
  6730.  
  6731. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  6732. let filterDescMustBePresent = uroUtils.GetCBChecked('_cbMCDescriptionMustBePresent');
  6733. let filterDescMustBeAbsent = uroUtils.GetCBChecked('_cbMCDescriptionMustBeAbsent');
  6734. let filterKeywordMustBePresent = uroUtils.GetCBChecked('_cbMCEnableKeywordMustBePresent');
  6735. let filterKeywordMustBeAbsent = uroUtils.GetCBChecked('_cbMCEnableKeywordMustBeAbsent');
  6736. let filterMyFollowed = uroUtils.GetCBChecked('_cbMCHideMyFollowed');
  6737. let filterMyUnfollowed = uroUtils.GetCBChecked('_cbMCHideMyUnfollowed');
  6738. let filterRoadworks = uroUtils.GetCBChecked('_cbMCFilterRoadworks');
  6739. let filterConstruction = uroUtils.GetCBChecked('_cbMCFilterConstruction');
  6740. let filterClosure = uroUtils.GetCBChecked('_cbMCFilterClosure');
  6741. let filterEvent = uroUtils.GetCBChecked('_cbMCFilterEvent');
  6742. let filterNote = uroUtils.GetCBChecked('_cbMCFilterNote');
  6743. let filterWSLM = uroUtils.GetCBChecked('_cbMCFilterWSLM');
  6744. let filterBOG = uroUtils.GetCBChecked('_cbMCFilterBOG');
  6745. let filterDifficult = uroUtils.GetCBChecked('_cbMCFilterDifficult');
  6746. let invertFilters = uroUtils.GetCBChecked('_cbInvertMCFilter');
  6747. let keywordPresent = uroUtils.GetElmValue('_textMCKeywordPresent');
  6748. let keywordAbsent = uroUtils.GetElmValue('_textMCKeywordAbsent');
  6749. let caseInsensitive = uroUtils.GetCBChecked('_cbMCCaseInsensitive');
  6750. let filterCommentsMustBePresent = uroUtils.GetCBChecked('_cbMCCommentsMustBePresent');
  6751. let filterCommentsMustBeAbsent = uroUtils.GetCBChecked('_cbMCCommentsMustBeAbsent');
  6752.  
  6753. let filterExpiryMustBePresent = uroUtils.GetCBChecked('_cbMCExpiryMustBePresent');
  6754. let filterExpiryMustBeAbsent = uroUtils.GetCBChecked('_cbMCExpiryMustBeAbsent');
  6755. let filterByCreatorEnable = uroUtils.GetCBChecked('_cbMCCreatorIDFilter');
  6756. let filterL1 = uroUtils.GetCBChecked('_cbHideMCRank0');
  6757. let filterL2 = uroUtils.GetCBChecked('_cbHideMCRank1');
  6758. let filterL3 = uroUtils.GetCBChecked('_cbHideMCRank2');
  6759. let filterL4 = uroUtils.GetCBChecked('_cbHideMCRank3');
  6760. let filterL5 = uroUtils.GetCBChecked('_cbHideMCRank4');
  6761. let filterL6 = uroUtils.GetCBChecked('_cbHideMCRank5');
  6762. let filterWRCMC = uroUtils.GetCBChecked('_cbHideWRCMCs');
  6763. let selectorCreator = document.getElementById('_selectMCCreatorID');
  6764.  
  6765. if(filterByCreatorEnable === false)
  6766. {
  6767. while(selectorCreator.options.length > 0)
  6768. {
  6769. selectorCreator.options.remove(0);
  6770. }
  6771. }
  6772. let creatorUser = null;
  6773. if(filterByCreatorEnable === true)
  6774. {
  6775. if(selectorCreator.options.length === 0)
  6776. {
  6777. uroUpdateEditorList(W.model.mapComments.objects, '_selectMCCreatorID', true, false, false, false);
  6778. }
  6779. if(selectorCreator.selectedOptions[0] != null)
  6780. {
  6781. creatorUser = parseInt(selectorCreator.selectedOptions[0].value);
  6782. }
  6783. }
  6784.  
  6785. for (let mcIdx = 0; mcIdx < uroMCLayer.features.length; mcIdx++)
  6786. {
  6787. {
  6788. let mcObj = uroMCLayer?.features[mcIdx]?.attributes?.wazeFeature?._wmeObject;
  6789. if(mcObj !== undefined)
  6790. {
  6791. let desc = '';
  6792. if(mcObj.attributes.subject !== null) desc += mcObj.attributes.subject.replace(/<\/?[^>]+(>|$)/g, "");
  6793. if(mcObj.attributes.body !== null) desc += mcObj.attributes.body.replace(/<\/?[^>]+(>|$)/g, "");
  6794. let nComments = mcObj.attributes.conversation.length;
  6795. if(nComments > 0)
  6796. {
  6797. for(let cIdx=0; cIdx < nComments; cIdx++)
  6798. {
  6799. desc += mcObj.attributes.conversation[cIdx].text.replace(/<\/?[^>]+(>|$)/g, "");
  6800. }
  6801. }
  6802.  
  6803. let mcStyle = 'visible';
  6804. if(uroIgnore.IsOnList(mcObj.attributes.id)) mcStyle = 'hidden';
  6805. if(uFURs_masterEnable === true)
  6806. {
  6807. let ukroadworks_ur = false;
  6808. let construction_ur = false;
  6809. let closure_ur = false;
  6810. let event_ur = false;
  6811. let note_ur = false;
  6812. let wslm_ur = false;
  6813. let bog_ur = false;
  6814. let difficult_ur = false;
  6815.  
  6816. let filterByNotIncludedKeyword = false;
  6817. let filterByIncludedKeyword = true;
  6818.  
  6819. let customType = uroGetCustomType(null, "mc", desc);
  6820. if(customType === 0) ukroadworks_ur = true;
  6821. else if(customType === 1) construction_ur = true;
  6822. else if(customType === 2) closure_ur = true;
  6823. else if(customType === 3) event_ur = true;
  6824. else if(customType === 4) note_ur = true;
  6825. else if(customType === 5) wslm_ur = true;
  6826. else if(customType === 6) bog_ur = true;
  6827. else if(customType === 7) difficult_ur = true;
  6828.  
  6829. let rank = mcObj.attributes.lockRank;
  6830. let expiry = mcObj.attributes.endDate;
  6831.  
  6832. // keywords
  6833. if(mcStyle == 'visible')
  6834. {
  6835. if(filterDescMustBePresent === true)
  6836. {
  6837. if(desc === '') mcStyle = 'hidden';
  6838. }
  6839. if(filterDescMustBeAbsent === true)
  6840. {
  6841. if(desc !== '') mcStyle = 'hidden';
  6842. }
  6843.  
  6844. if(filterCommentsMustBePresent === true)
  6845. {
  6846. if(nComments === 0) mcStyle = 'hidden';
  6847. }
  6848. if(filterCommentsMustBeAbsent === true)
  6849. {
  6850. if(nComments > 0) mcStyle = 'hidden';
  6851. }
  6852.  
  6853. if(filterKeywordMustBePresent === true)
  6854. {
  6855. let keywordIsPresentInDesc = uroUtils.KeywordPresent(desc,keywordPresent,caseInsensitive);
  6856. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInDesc));
  6857. }
  6858. if(filterKeywordMustBeAbsent === true)
  6859. {
  6860. let keywordIsAbsentInDesc = uroUtils.KeywordPresent(desc,keywordAbsent,caseInsensitive);
  6861. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInDesc);
  6862. }
  6863.  
  6864. filterByNotIncludedKeyword = (filterByNotIncludedKeyword && filterKeywordMustBeAbsent);
  6865. filterByIncludedKeyword = (filterByIncludedKeyword && filterKeywordMustBePresent);
  6866. if(filterByNotIncludedKeyword || filterByIncludedKeyword)
  6867. {
  6868. mcStyle = 'hidden';
  6869. }
  6870.  
  6871. }
  6872.  
  6873. //lock rank
  6874. if(mcStyle == 'visible')
  6875. {
  6876. if((filterL1 === true) && (rank == 0)) mcStyle = 'hidden';
  6877. if((filterL2 === true) && (rank == 1)) mcStyle = 'hidden';
  6878. if((filterL3 === true) && (rank == 2)) mcStyle = 'hidden';
  6879. if((filterL4 === true) && (rank == 3)) mcStyle = 'hidden';
  6880. if((filterL5 === true) && (rank == 4)) mcStyle = 'hidden';
  6881. if((filterL6 === true) && (rank == 5)) mcStyle = 'hidden';
  6882. }
  6883.  
  6884. // expiry
  6885. if(mcStyle == 'visible')
  6886. {
  6887. if((filterExpiryMustBePresent === true) && (expiry === null)) mcStyle = 'hidden';
  6888. if((filterExpiryMustBeAbsent === true) && (expiry != null)) mcStyle = 'hidden';
  6889. }
  6890.  
  6891. // is following?
  6892. if(mcStyle == 'visible')
  6893. {
  6894. if(mcObj.attributes.isFollowing === true)
  6895. {
  6896. if(filterMyFollowed === true) mcStyle = 'hidden';
  6897. }
  6898. else
  6899. {
  6900. if(filterMyUnfollowed === true) mcStyle = 'hidden';
  6901. }
  6902. }
  6903.  
  6904. if(mcStyle == 'visible')
  6905. {
  6906. if(creatorUser !== null)
  6907. {
  6908. if(mcObj.attributes.createdBy != creatorUser) mcStyle = 'hidden';
  6909. }
  6910. if(filterWRCMC === true)
  6911. {
  6912. if(mcObj.attributes.createdBy == 304740435) mcStyle = 'hidden';
  6913. }
  6914. }
  6915.  
  6916. // custom tags
  6917. if(mcStyle == 'visible')
  6918. {
  6919. if(ukroadworks_ur === true)
  6920. {
  6921. if(filterRoadworks === true) mcStyle = 'hidden';
  6922. }
  6923. else if(construction_ur === true)
  6924. {
  6925. if(filterConstruction === true) mcStyle = 'hidden';
  6926. }
  6927. else if(closure_ur === true)
  6928. {
  6929. if(filterClosure === true) mcStyle = 'hidden';
  6930. }
  6931. else if(event_ur === true)
  6932. {
  6933. if(filterEvent === true) mcStyle = 'hidden';
  6934. }
  6935. else if(note_ur === true)
  6936. {
  6937. if(filterNote === true) mcStyle = 'hidden';
  6938. }
  6939. else if(wslm_ur === true)
  6940. {
  6941. if(filterWSLM === true) mcStyle = 'hidden';
  6942. }
  6943. else if(bog_ur === true)
  6944. {
  6945. if(filterBOG === true) mcStyle = 'hidden';
  6946. }
  6947. else if(difficult_ur === true)
  6948. {
  6949. if(filterDifficult === true) mcStyle = 'hidden';
  6950. }
  6951.  
  6952. if(invertFilters === true)
  6953. {
  6954. if(mcStyle == 'hidden') mcStyle = 'visible';
  6955. else mcStyle = 'hidden';
  6956. }
  6957. }
  6958. }
  6959.  
  6960. let geoID = uroMCLayer.features[mcIdx].geometry.id;
  6961. if(document.getElementById(geoID) !== null)
  6962. {
  6963. document.getElementById(geoID).style.visibility = mcStyle;
  6964. }
  6965. }
  6966. }
  6967. }
  6968. uroDBG.PerfMon(pmFunction, pmTStart);
  6969. }
  6970. function uroFilterURs_onObjectsChanged()
  6971. {
  6972. if(uroFilterPreamble())
  6973. {
  6974. if(uroURDialogIsOpen === true)
  6975. {
  6976. uroFilterURs();
  6977. }
  6978. }
  6979. }
  6980. function uroFilterURs_onObjectsAdded()
  6981. {
  6982. if(uroFilterPreamble())
  6983. {
  6984. }
  6985. }
  6986. function uroFilterURs_onObjectsRemoved()
  6987. {
  6988. if(uroFilterPreamble())
  6989. {
  6990. }
  6991. }
  6992. function uroGetManagedAreas()
  6993. {
  6994. uroManagedAreas = [];
  6995. uroIgnoreAreasUserID = null;
  6996.  
  6997. for(let maObj in W.model.managedAreas.objects)
  6998. {
  6999. if(W.model.managedAreas.objects.hasOwnProperty(maObj))
  7000. {
  7001. uroManagedAreas.push(W.model.managedAreas.objects[maObj]);
  7002. }
  7003. }
  7004. return uroManagedAreas.length;
  7005. }
  7006. function uroCheckGeometryWithinManagedAreas(geo)
  7007. {
  7008. let retval = false;
  7009. let ignoreUserMA = false;
  7010.  
  7011. // If we're ignoring the user's managed area, then we first check to see if
  7012. // the geopoint lies within that - if so then we can skip checking all the
  7013. // other areas in the list...
  7014. if(uroIgnoreAreasUserID !== null)
  7015. {
  7016. for(let uma = 0; uma < uroManagedAreas.length; ++uma)
  7017. {
  7018. if(uroIgnoreAreasUserID == uroManagedAreas[uma].attributes.userID)
  7019. {
  7020. ignoreUserMA = uroContainsPoint(uroManagedAreas[uma].attributes.geoJSONGeometry.coordinates[0], geo);
  7021. break;
  7022. }
  7023. }
  7024. }
  7025.  
  7026. // Point either isn't within the user's area, or we're not ignoring it, so
  7027. // check the rest of the areas in the list
  7028. if(ignoreUserMA == false)
  7029. {
  7030. for(let ma = 0; ma < uroManagedAreas.length; ++ma)
  7031. {
  7032. if(uroIgnoreAreasUserID != uroManagedAreas[ma].attributes.userID)
  7033. {
  7034. retval = uroContainsPoint(uroManagedAreas[ma].attributes.geoJSONGeometry.coordinates[0], geo);
  7035. break;
  7036. }
  7037. }
  7038. }
  7039.  
  7040. return retval;
  7041. }
  7042. function uroGetURDriveGeoms()
  7043. {
  7044. let retval = [];
  7045.  
  7046. for (let urobj in W.model.mapUpdateRequests.objects)
  7047. {
  7048. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urobj))
  7049. {
  7050. let ureq = W.model.mapUpdateRequests.objects[urobj];
  7051. let ureqID = ureq.attributes.id;
  7052.  
  7053. let hasGeo = false;
  7054. let thisRet = [];
  7055. thisRet.push(ureqID);
  7056. thisRet.push(null);
  7057. thisRet.push([]);
  7058.  
  7059. let latMin = 9999;
  7060. let latMax = -9999;
  7061. let lonMin = 9999;
  7062. let lonMax = -9999;
  7063.  
  7064. let urs = W.model.updateRequestSessions.objects[ureqID];
  7065. if((urs !== undefined) && (urs.attributes.driveGeometry !== undefined))
  7066. {
  7067. let cPairs = [];
  7068. for(let i = 0; i < urs.attributes.driveGeometry.coordinates.length; ++i)
  7069. {
  7070. for(let j = 0; j < urs.attributes.driveGeometry.coordinates[i].length; ++j)
  7071. {
  7072. if((i === 0) || (j > 0))
  7073. {
  7074. let coords = urs.attributes.driveGeometry.coordinates[i][j];
  7075. cPairs.push(coords);
  7076.  
  7077. if(coords[0] > lonMax)
  7078. {
  7079. lonMax = coords[0];
  7080. }
  7081. if(coords[0] < lonMin)
  7082. {
  7083. lonMin = coords[0];
  7084. }
  7085. if(coords[1] > latMax)
  7086. {
  7087. latMax = coords[1];
  7088. }
  7089. if(coords[1] < latMin)
  7090. {
  7091. latMin = coords[1];
  7092. }
  7093.  
  7094. hasGeo = true;
  7095. }
  7096. }
  7097. }
  7098. let bbox = [];
  7099. bbox.push(lonMin);
  7100. bbox.push(lonMax);
  7101. bbox.push(latMin);
  7102. bbox.push(latMax);
  7103. thisRet.push(bbox);
  7104. thisRet.push(cPairs);
  7105. }
  7106.  
  7107. if(hasGeo === true)
  7108. {
  7109. retval.push(thisRet);
  7110. }
  7111. }
  7112. }
  7113. return retval;
  7114. }
  7115. function uroCompareDriveGeos(geoA, geoB)
  7116. {
  7117. const matchLength = 5;
  7118. let retval = false;
  7119.  
  7120. if((geoA.length >= matchLength) && (geoB.length >= matchLength))
  7121. {
  7122. for(let i = 0; i < (geoA.length - matchLength); ++i)
  7123. {
  7124. for(let j = 0; j < (geoB.length - matchLength); ++j)
  7125. {
  7126. if((geoA[i][0] == geoB[j][0]) && (geoA[i][1] == geoB[j][1]))
  7127. {
  7128. retval = true;
  7129. for(let k = 1; k < matchLength; ++k)
  7130. {
  7131. if((geoA[i+k][0] != geoB[j+k][0]) || (geoA[i+k][1] != geoB[j+k][1]))
  7132. {
  7133. retval = false;
  7134. break;
  7135. }
  7136. }
  7137. }
  7138. if(retval === true)
  7139. {
  7140. break;
  7141. }
  7142. }
  7143.  
  7144. if(retval === true)
  7145. {
  7146. break;
  7147. }
  7148. }
  7149. }
  7150. return retval;
  7151. }
  7152. function uroCompareDriveBBoxes(bbA, bbB)
  7153. {
  7154. let retval = true;
  7155.  
  7156. if
  7157. (
  7158. (bbA[0] > bbB[1]) ||
  7159. (bbA[1] < bbB[0]) ||
  7160. (bbA[2] > bbB[3]) ||
  7161. (bbA[3] < bbB[2])
  7162. )
  7163. {
  7164. retval = false;
  7165. }
  7166.  
  7167. return retval;
  7168. }
  7169. function uroGetURDupes()
  7170. {
  7171. uroURDupes = [];
  7172.  
  7173. // To determine which URs are duplicates of one another (i.e. have been raised by the same user
  7174. // during the same section of a journey), we first compare the geometries of the drive tracks
  7175. // attached to any URs which have them - as this is based on the users GPS position rather than
  7176. // the WME map data, it makes it vanishingly unlikely that any two users would have identical
  7177. // GPS positions (especially given the level of accuracy to which the track points are stored)
  7178. // even if they were driving exactly the same route at the same speed, in the same lane etc.
  7179. //
  7180. // To accelerate this geometry comparison, we start by performing a simple bounding box overlap
  7181. // check for the two geometries under consideration - if there's no overlap then there can't be
  7182. // any geometry match, so no need to continue onto the more detailed comparision of the GPS
  7183. // tracks themselves...
  7184. let driveGeos = uroGetURDriveGeoms();
  7185. if(driveGeos.length > 1)
  7186. {
  7187. for(let i = 0; i < (driveGeos.length - 1); ++i)
  7188. {
  7189. if(driveGeos[i].length !== 5)
  7190. {
  7191. driveGeos[i][1] = false;
  7192. }
  7193. else
  7194. {
  7195. for(let j = (i + 1); j < driveGeos.length; ++j)
  7196. {
  7197. if(driveGeos[j].length === 5)
  7198. {
  7199. let geoMatch = uroCompareDriveBBoxes(driveGeos[i][3], driveGeos[j][3]);
  7200. if(geoMatch === true)
  7201. {
  7202. geoMatch = uroCompareDriveGeos(driveGeos[i][4], driveGeos[j][4]);
  7203. if(geoMatch === true)
  7204. {
  7205. driveGeos[i][2].push(driveGeos[j][0]);
  7206. driveGeos[j][2].push(driveGeos[i][0]);
  7207. }
  7208. }
  7209. }
  7210. }
  7211. }
  7212. }
  7213.  
  7214. for(let i = 0; i < driveGeos.length; ++i)
  7215. {
  7216. if(driveGeos[i][2].length > 0)
  7217. {
  7218. let res = [];
  7219. res.push(driveGeos[i][0]);
  7220. res.push(driveGeos[i][2]);
  7221. uroURDupes.push(res);
  7222. }
  7223. }
  7224. }
  7225.  
  7226. // Once we've done the initial drive track comparision, uroURDupes will contain a list of
  7227. // all the URs which were matched up based on that. However, as the track comparision is
  7228. // inherently limited by the amount of track data included with each UR, this initial
  7229. // comparison may mean some more widely spaced URs aren't flagged as duplicates simply
  7230. // because there's insufficient overlap between their tracks, even though there may have
  7231. // been further URs dropped inbetween to which they were matched.
  7232. //
  7233. // e.g. if a user drops 4 URs along a section of their journey, spaced such that each of
  7234. // the GPS tracks generates a comparison match with the UR either side of it, but no
  7235. // further than that, we would get:
  7236. //
  7237. // UR A......UR B.......UR C......UR D
  7238. //
  7239. // Matches: A to B, B to A & C, C to B & D, D to C
  7240. //
  7241. // Note how, although we know all of these URs are in fact duplicates, and can infer this
  7242. // from seeing that e.g. A is flagged only as a duplicate of B, however as B is flagged as
  7243. // a duplicate of A & C, and C is flagged as a duplicate of B & D, A MUST therefore be a
  7244. // duplicate of B, C & D...
  7245. //
  7246. // To fix this, we now run a merging pass over each of the entries in uroURDupes - for
  7247. // each entry we see if its ID appears in any of the other entries as a duplicate, and
  7248. // if so we merge the duplicates for both entries.
  7249.  
  7250. for(let i = 0; i < uroURDupes.length; ++i)
  7251. {
  7252. let urID = uroURDupes[i][0];
  7253. for(let j = 0; j < uroURDupes.length; ++j)
  7254. {
  7255. if(i != j)
  7256. {
  7257. if(uroURDupes[j][1].includes(urID) === true)
  7258. {
  7259. // https://stackoverflow.com/questions/1584370/how-to-merge-two-arrays-in-javascript-and-de-duplicate-items
  7260. let mergedDupes = [...new Set([...uroURDupes[i][1], ...uroURDupes[j][1]])];
  7261. uroURDupes[i][1] = mergedDupes;
  7262. uroURDupes[j][1] = mergedDupes;
  7263. }
  7264. }
  7265. }
  7266. }
  7267. }
  7268. function uroFilterURs()
  7269. {
  7270. let pmTStart = performance.now();
  7271. let pmFunction = "uroFilterURs";
  7272.  
  7273. if(uroUserID === -1)
  7274. {
  7275. return;
  7276. }
  7277.  
  7278. if(uroInhibitURFiltering === true)
  7279. {
  7280. return;
  7281. }
  7282.  
  7283.  
  7284. // compatibility fix for URComments - based on code supplied by RickZabel
  7285. let hasActiveURFilters = false;
  7286. if(uroIsFilteringEnabled(false) === true)
  7287. {
  7288. let urTabInputs = uroTabs.CtrlTabs[uroTabs.IDS.URS][uroTabs.FIELDS.TABBODY].getElementsByTagName('input');
  7289. for(let loop = 0; loop < urTabInputs.length; loop++)
  7290. {
  7291. if(urTabInputs[loop].type == 'checkbox')
  7292. {
  7293. let ignoreCB = false;
  7294. ignoreCB = ignoreCB || (urTabInputs[loop].id == '_cbCaseInsensitive');
  7295. ignoreCB = ignoreCB || (urTabInputs[loop].id == '_cbNoFilterForTaggedURs');
  7296. if((urTabInputs[loop].checked) && (ignoreCB === false))
  7297. {
  7298. hasActiveURFilters = true;
  7299. break;
  7300. }
  7301. }
  7302. }
  7303. }
  7304. sessionStorage.UROverview_hasActiveURFilters = hasActiveURFilters;
  7305. if(uroFilterPreamble() === false) return;
  7306. uroRefreshUpdateRequestSessions();
  7307. let selectorResolver = document.getElementById('_selectURResolverID');
  7308. let selectorCommentUser = document.getElementById('_selectURUserID');
  7309. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === false)
  7310. {
  7311. while(selectorResolver.options.length > 0)
  7312. {
  7313. selectorResolver.options.remove(0);
  7314. }
  7315. }
  7316. if(uroUtils.GetCBChecked('_cbURUserIDFilter') === false)
  7317. {
  7318. while(selectorCommentUser.options.length > 0)
  7319. {
  7320. selectorCommentUser.options.remove(0);
  7321. }
  7322. }
  7323. if(Object.keys(W.model.updateRequestSessions.objects).length === 0)
  7324. {
  7325. // This may be the case if the user has disabled the UR layer, so call
  7326. // AddCommentCounts to clear any existing ones from the map view...
  7327. uroURExtras.AddCommentCounts();
  7328. return;
  7329. }
  7330. let commenterUser = null;
  7331. if(uroUtils.GetCBChecked('_cbURUserIDFilter') === true)
  7332. {
  7333. if(selectorCommentUser.options.length === 0)
  7334. {
  7335. uroUpdateEditorList(W.model.updateRequestSessions.objects, '_selectURUserID', false, false, false, true);
  7336. }
  7337. if(selectorCommentUser.selectedOptions[0] != null)
  7338. {
  7339. commenterUser = parseInt(selectorCommentUser.selectedOptions[0].value);
  7340. }
  7341. }
  7342. let resolverUser = null;
  7343. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === true)
  7344. {
  7345. if(selectorResolver.options.length === 0)
  7346. {
  7347. uroUpdateEditorList(W.model.mapUpdateRequests.objects, '_selectURResolverID', false, false, true, false);
  7348. }
  7349. if(selectorResolver.selectedOptions[0] != null)
  7350. {
  7351. resolverUser = parseInt(selectorResolver.selectedOptions[0].value);
  7352. }
  7353. }
  7354. uroURExtras.urList = [];
  7355. uroGetURDupes();
  7356.  
  7357. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  7358. let filterOutsideEditableArea = uroUtils.GetCBChecked('_cbURFilterOutsideArea');
  7359. let filterInsideManagedAreas = uroUtils.GetCBChecked('_cbURFilterInsideManagedAreas');
  7360. let filterSolved = uroUtils.GetCBChecked('_cbFilterSolved');
  7361. let filterUnidentified = uroUtils.GetCBChecked('_cbFilterUnidentified');
  7362. let filterClosed = uroUtils.GetCBChecked('_cbFilterClosedUR');
  7363. let filterOpen = uroUtils.GetCBChecked('_cbFilterOpenUR');
  7364. let filterDescMustBePresent = uroUtils.GetCBChecked('_cbURDescriptionMustBePresent');
  7365. let filterDescMustBeAbsent = uroUtils.GetCBChecked('_cbURDescriptionMustBeAbsent');
  7366. let filterKeywordMustBePresent = uroUtils.GetCBChecked('_cbEnableKeywordMustBePresent');
  7367. let filterKeywordMustBeAbsent = uroUtils.GetCBChecked('_cbEnableKeywordMustBeAbsent');
  7368. let filterMinURAge = uroUtils.GetCBChecked('_cbEnableMinAgeFilter');
  7369. let filterMaxURAge = uroUtils.GetCBChecked('_cbEnableMaxAgeFilter');
  7370. let filterMinComments = uroUtils.GetCBChecked('_cbEnableMinCommentsFilter');
  7371. let filterMaxComments = uroUtils.GetCBChecked('_cbEnableMaxCommentsFilter');
  7372. let filterReporterLastCommenter = uroUtils.GetCBChecked('_cbHideIfReporterLastCommenter');
  7373. let filterReporterNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfReporterNotLastCommenter');
  7374. let filterHideAnyComments = uroUtils.GetCBChecked('_cbHideAnyComments');
  7375. let filterHideNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfNotLastCommenter');
  7376. let filterHideMyComments = uroUtils.GetCBChecked('_cbHideMyComments');
  7377. let filterIfLastCommenter = uroUtils.GetCBChecked('_cbHideIfLastCommenter');
  7378. let filterIfNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfNotLastCommenter');
  7379. let filterCommentMinAge = uroUtils.GetCBChecked('_cbEnableCommentAgeFilter2');
  7380. let filterCommentMaxAge = uroUtils.GetCBChecked('_cbEnableCommentAgeFilter');
  7381. let filterUserID = uroUtils.GetCBChecked('_cbURUserIDFilter');
  7382. let filterMyFollowed = uroUtils.GetCBChecked('_cbHideMyFollowed');
  7383. let filterMyUnfollowed = uroUtils.GetCBChecked('_cbHideMyUnfollowed');
  7384.  
  7385. let filterWazeAuto = uroUtils.GetCBChecked('_cbFilterWazeAuto');
  7386. let filterRoadworks = uroUtils.GetCBChecked('_cbFilterRoadworks');
  7387. let filterConstruction = uroUtils.GetCBChecked('_cbFilterConstruction');
  7388. let filterClosure = uroUtils.GetCBChecked('_cbFilterClosure');
  7389. let filterEvent = uroUtils.GetCBChecked('_cbFilterEvent');
  7390. let filterNote = uroUtils.GetCBChecked('_cbFilterNote');
  7391. let filterWSLM = uroUtils.GetCBChecked('_cbFilterWSLM');
  7392. let filterBOG = uroUtils.GetCBChecked('_cbFilterBOG');
  7393. let filterDifficult = uroUtils.GetCBChecked('_cbFilterDifficult');
  7394.  
  7395. let filterIncorrectTurn = uroUtils.GetCBChecked('_cbFilterIncorrectTurn');
  7396. let filterIncorrectAddress = uroUtils.GetCBChecked('_cbFilterIncorrectAddress');
  7397. let filterIncorrectRoute = uroUtils.GetCBChecked('_cbFilterIncorrectRoute');
  7398. let filterMissingRoundabout = uroUtils.GetCBChecked('_cbFilterMissingRoundabout');
  7399. let filterGeneralError = uroUtils.GetCBChecked('_cbFilterGeneralError');
  7400. let filterTurnNotAllowed = uroUtils.GetCBChecked('_cbFilterTurnNotAllowed');
  7401. let filterIncorrectJunction = uroUtils.GetCBChecked('_cbFilterIncorrectJunction');
  7402. let filterMissingBridgeOverpass = uroUtils.GetCBChecked('_cbFilterMissingBridgeOverpass');
  7403. let filterWrongDrivingDirection = uroUtils.GetCBChecked('_cbFilterWrongDrivingDirection');
  7404. let filterMissingExit = uroUtils.GetCBChecked('_cbFilterMissingExit');
  7405. let filterMissingRoad = uroUtils.GetCBChecked('_cbFilterMissingRoad');
  7406. let filterMissingLandmark = uroUtils.GetCBChecked('_cbFilterMissingLandmark');
  7407. let filterNativeSpeedLimit = uroUtils.GetCBChecked('_cbFilterSpeedLimits');
  7408. let filterBlockedRoad = uroUtils.GetCBChecked('_cbFilterBlockedRoad');
  7409. let filterUndefined = uroUtils.GetCBChecked('_cbFilterUndefined');
  7410.  
  7411. let invertURFilters = uroUtils.GetCBChecked('_cbInvertURFilter');
  7412. let invertURStateFilters = uroUtils.GetCBChecked('_cbInvertURStateFilter');
  7413. let noFilterTaggedURs = uroUtils.GetCBChecked('_cbNoFilterForTaggedURs');
  7414. let noFilterURInURL = uroUtils.GetCBChecked('_cbNoFilterForURInURL');
  7415. let showOnlyDupes = uroUtils.GetCBChecked('_cbURFilterDupes');
  7416.  
  7417. let keywordPresent = uroUtils.GetElmValue('_textKeywordPresent');
  7418. let keywordAbsent = uroUtils.GetElmValue('_textKeywordAbsent');
  7419. let caseInsensitive = uroUtils.GetCBChecked('_cbCaseInsensitive');
  7420. let thresholdMinAge = uroUtils.GetElmValue('_inputFilterMinDays');
  7421. let thresholdMaxAge = uroUtils.GetElmValue('_inputFilterMaxDays');
  7422. let thresholdMinComments = uroUtils.GetElmValue('_inputFilterMinComments');
  7423. let thresholdMaxComments = uroUtils.GetElmValue('_inputFilterMaxComments');
  7424. let thresholdMaxCommentAge = uroUtils.GetElmValue('_inputFilterCommentDays');
  7425. let thresholdMinCommentAge = uroUtils.GetElmValue('_inputFilterCommentDays2');
  7426. let ignoreOtherEditorComments = uroUtils.GetCBChecked('_cbIgnoreOtherEditorComments');
  7427. let urcFilteringIsActive = false;
  7428. let urcCB = document.getElementById('URCommentsFilterEnabled');
  7429. if(urcCB !== null)
  7430. {
  7431. if(urcCB.checked)
  7432. {
  7433. urcFilteringIsActive = true;
  7434. }
  7435. }
  7436. urcCB = document.getElementById('URCommentUROOnlyMyUR');
  7437. if(urcCB !== null)
  7438. {
  7439. if(urcCB.checked)
  7440. {
  7441. urcFilteringIsActive = true;
  7442. }
  7443. }
  7444. urcCB = document.getElementById('URCommentUROHideTagged');
  7445. if(urcCB !== null)
  7446. {
  7447. if(urcCB.checked)
  7448. {
  7449. urcFilteringIsActive = true;
  7450. }
  7451. }
  7452.  
  7453. filterInsideManagedAreas = filterInsideManagedAreas && (uroGetManagedAreas() !== 0);
  7454. if(uroUtils.GetCBChecked('_cbURExcludeUserArea') == true)
  7455. {
  7456. uroIgnoreAreasUserID = W.loginManager.user.attributes.id;
  7457. }
  7458.  
  7459. for (let urobj in W.model.mapUpdateRequests.objects)
  7460. {
  7461. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urobj))
  7462. {
  7463. let ureq = W.model.mapUpdateRequests.objects[urobj];
  7464. let ureqID = ureq.attributes.id;
  7465.  
  7466. let urStyle = 'visible';
  7467. let inhibitFiltering = ((ureqID == uroSelectedURID) && (noFilterURInURL));
  7468.  
  7469. let hasMyComments = false;
  7470. let nComments = 0;
  7471. let desc = ureq.attributes.description;
  7472. let customType = uroGetCustomType(ureqID, uroLayers.ID.UR, desc);
  7473. let ageLastComment = null;
  7474. if(W.model.updateRequestSessions.objects[ureqID] != null)
  7475. {
  7476. nComments = W.model.updateRequestSessions.objects[ureqID].attributes.comments.length;
  7477. if(nComments != 0)
  7478. {
  7479. ageLastComment = uroUtils.GetCommentAge(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1]);
  7480. }
  7481. if((uFURs_masterEnable === false) && (nComments === 0))
  7482. {
  7483. // when master enable is turned off, we want to make sure that all URs, including ones that were previously hidden, are correctly
  7484. // displayed in their native form - i.e. no comment count or custom conversation bubbles. The easiest way to achieve this is to
  7485. // force the AddCommentCounts code to test for the presence of these bubbles on each UR, which we do by setting a non-zero
  7486. // comment count for each UR... For URs which genuinely do have no comments we use -1 to indicate that we're not really setting
  7487. // a comment count, but that we still need to do something that wouldn't be achieved by using 0.
  7488. nComments = -1;
  7489. }
  7490. }
  7491.  
  7492. // check UR against current session ignore list...
  7493. if(uroIgnore.IsOnList(ureqID)) urStyle = 'hidden';
  7494.  
  7495. if((uFURs_masterEnable === true) && (inhibitFiltering === false))
  7496. {
  7497. let wazeauto_ur = false;
  7498. let ukroadworks_ur = false;
  7499. let construction_ur = false;
  7500. let closure_ur = false;
  7501. let event_ur = false;
  7502. let note_ur = false;
  7503. let wslm_ur = false;
  7504. let bog_ur = false;
  7505. let difficult_ur = false;
  7506.  
  7507. let filterByNotIncludedKeyword = false;
  7508. let filterByIncludedKeyword = true;
  7509.  
  7510. if(desc !== null) desc = desc.replace(/<\/?[^>]+(>|$)/g, "");
  7511. else desc = '';
  7512.  
  7513. if(customType === 0) ukroadworks_ur = true;
  7514. else if(customType === 1) construction_ur = true;
  7515. else if(customType === 2) closure_ur = true;
  7516. else if(customType === 3) event_ur = true;
  7517. else if(customType === 4) note_ur = true;
  7518. else if(customType === 5) wslm_ur = true;
  7519. else if(customType === 6) bog_ur = true;
  7520. else if(customType === 7) difficult_ur = true;
  7521.  
  7522. // check UR against editable area...
  7523.  
  7524. if(filterOutsideEditableArea === true)
  7525. {
  7526. if(ureq.canEdit() === false) urStyle = 'hidden';
  7527. }
  7528.  
  7529. if(filterInsideManagedAreas === true)
  7530. {
  7531. if(uroCheckGeometryWithinManagedAreas(ureq.attributes.geoJSONGeometry.coordinates) === true) urStyle = 'hidden';
  7532. }
  7533.  
  7534. if(showOnlyDupes === true)
  7535. {
  7536. let isDupe = false;
  7537. for(let i = 0; i < uroURDupes.length; ++i)
  7538. {
  7539. if(uroURDupes[i][0] === ureqID)
  7540. {
  7541. isDupe = true;
  7542. break;
  7543. }
  7544. }
  7545. if(isDupe === false) urStyle = 'hidden';
  7546. }
  7547.  
  7548. // state-age filtering
  7549. if(urStyle == 'visible')
  7550. {
  7551. // check against closed/not identified filtering if enabled...
  7552. if(filterSolved === true)
  7553. {
  7554. if(ureq.attributes.resolution === 0) urStyle = 'hidden';
  7555. }
  7556. if(filterUnidentified === true)
  7557. {
  7558. if(ureq.attributes.resolution == 1) urStyle = 'hidden';
  7559. }
  7560.  
  7561. if((ureq.attributes.resolvedOn !== null) && (filterClosed === true))
  7562. {
  7563. urStyle = 'hidden';
  7564. }
  7565.  
  7566. if((ureq.attributes.resolvedOn === null) && (filterOpen === true))
  7567. {
  7568. urStyle = 'hidden';
  7569. }
  7570.  
  7571. if(urStyle == 'visible')
  7572. {
  7573. // check UR against keyword filtering if enabled...
  7574. if(filterDescMustBePresent === true)
  7575. {
  7576. if(desc === '') urStyle = 'hidden';
  7577. }
  7578. if(filterDescMustBeAbsent === true)
  7579. {
  7580. if(desc !== '') urStyle = 'hidden';
  7581. }
  7582.  
  7583. if(filterKeywordMustBePresent === true)
  7584. {
  7585. let keywordIsPresentInDesc = uroUtils.KeywordPresent(desc,keywordPresent,caseInsensitive);
  7586. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInDesc));
  7587. }
  7588. if(filterKeywordMustBeAbsent === true)
  7589. {
  7590. let keywordIsAbsentInDesc = uroUtils.KeywordPresent(desc,keywordAbsent,caseInsensitive);
  7591. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInDesc);
  7592. }
  7593. }
  7594.  
  7595. if(urStyle == 'visible')
  7596. {
  7597. // do age-based filtering if enabled
  7598. if(filterMinURAge === true)
  7599. {
  7600. if(uroUtils.GetURAge(ureq,0,false) < thresholdMinAge) urStyle = 'hidden';
  7601. }
  7602. if(filterMaxURAge === true)
  7603. {
  7604. if(uroUtils.GetURAge(ureq,0,false) > thresholdMaxAge) urStyle = 'hidden';
  7605. }
  7606. }
  7607.  
  7608. if(urStyle == 'visible')
  7609. {
  7610. if(resolverUser !== null)
  7611. {
  7612. if(ureq.attributes.resolvedBy != resolverUser) urStyle = 'hidden';
  7613. }
  7614. }
  7615.  
  7616. if(urStyle == 'visible')
  7617. {
  7618. // do comments/following filtering
  7619. if(W.model.updateRequestSessions.objects[ureqID] != null)
  7620. {
  7621. nComments = W.model.updateRequestSessions.objects[ureqID].attributes.comments.length;
  7622. let commentDaysOld = -1;
  7623.  
  7624.  
  7625. if(filterMinComments === true)
  7626. {
  7627. if(nComments < thresholdMinComments) urStyle = 'hidden';
  7628. }
  7629. if(filterMaxComments === true)
  7630. {
  7631. if(nComments > thresholdMaxComments) urStyle = 'hidden';
  7632. }
  7633.  
  7634.  
  7635. if(nComments > 0)
  7636. {
  7637. let reporterIsLastCommenter = false;
  7638. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1].userID == -1) reporterIsLastCommenter = true;
  7639.  
  7640. if(filterReporterLastCommenter === true)
  7641. {
  7642. if(reporterIsLastCommenter === true) urStyle = 'hidden';
  7643. }
  7644. else if(filterReporterNotLastCommenter === true)
  7645. {
  7646. if(reporterIsLastCommenter === false) urStyle = 'hidden';
  7647. }
  7648.  
  7649. hasMyComments = uroURHasMyComments(ureqID);
  7650. if(hasMyComments === false)
  7651. {
  7652. if(filterHideAnyComments === true) urStyle = 'hidden';
  7653. if(filterHideNotLastCommenter === true) urStyle = 'hidden';
  7654. }
  7655. else
  7656. {
  7657. if(filterHideMyComments === true) urStyle = 'hidden';
  7658.  
  7659. let userIsLastCommenter = false;
  7660. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1].userID == uroUserID) userIsLastCommenter = true;
  7661.  
  7662. if(filterIfLastCommenter === true)
  7663. {
  7664. if(userIsLastCommenter === true) urStyle = 'hidden';
  7665. }
  7666. else if(filterIfNotLastCommenter === true)
  7667. {
  7668. if(userIsLastCommenter === false) urStyle = 'hidden';
  7669. }
  7670. }
  7671.  
  7672. let cidx;
  7673. if(ignoreOtherEditorComments === false)
  7674. {
  7675. commentDaysOld = ageLastComment;
  7676. }
  7677. else
  7678. {
  7679. for(cidx=0; cidx<nComments; cidx++)
  7680. {
  7681. let cObj = W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx];
  7682. if((cObj.userID == uroUserID) || (cObj.userID == -1))
  7683. {
  7684. commentDaysOld = uroUtils.GetCommentAge(cObj);
  7685. }
  7686. }
  7687. }
  7688. if((filterCommentMinAge === true) && (commentDaysOld != -1))
  7689. {
  7690. if(thresholdMinCommentAge > commentDaysOld) urStyle = 'hidden';
  7691. }
  7692. if((filterCommentMaxAge === true) && (commentDaysOld != -1))
  7693. {
  7694. if(thresholdMaxCommentAge < commentDaysOld) urStyle = 'hidden';
  7695. }
  7696.  
  7697. if((commenterUser !== null) && (urStyle != 'hidden'))
  7698. {
  7699. urStyle = 'hidden';
  7700. for(cidx=0; cidx<nComments; cidx++)
  7701. {
  7702. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx].userID == commenterUser)
  7703. {
  7704. urStyle = 'visible';
  7705. break;
  7706. }
  7707. }
  7708. }
  7709.  
  7710. let commentText = '';
  7711. for(cidx=0; cidx<nComments; cidx++)
  7712. {
  7713. commentText += W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx].text;
  7714. }
  7715.  
  7716. if(filterKeywordMustBePresent === true)
  7717. {
  7718. let keywordIsPresentInComments = uroUtils.KeywordPresent(commentText,keywordPresent,caseInsensitive);
  7719. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInComments));
  7720. }
  7721. if(filterKeywordMustBeAbsent === true)
  7722. {
  7723. let keywordIsAbsentInComments = uroUtils.KeywordPresent(commentText,keywordAbsent,caseInsensitive);
  7724. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInComments);
  7725. }
  7726. }
  7727. else
  7728. {
  7729. if(filterUserID === true)
  7730. {
  7731. urStyle = 'hidden';
  7732. }
  7733. }
  7734.  
  7735. filterByNotIncludedKeyword = (filterByNotIncludedKeyword && filterKeywordMustBeAbsent);
  7736. filterByIncludedKeyword = (filterByIncludedKeyword && filterKeywordMustBePresent);
  7737. if(filterByNotIncludedKeyword || filterByIncludedKeyword)
  7738. {
  7739. urStyle = 'hidden';
  7740. }
  7741.  
  7742. if(W.model.updateRequestSessions.objects[ureqID].attributes.isFollowing === true)
  7743. {
  7744. if(filterMyFollowed === true) urStyle = 'hidden';
  7745. }
  7746. else
  7747. {
  7748. if(filterMyUnfollowed === true) urStyle = 'hidden';
  7749. }
  7750. }
  7751. }
  7752.  
  7753. if(invertURStateFilters === true)
  7754. {
  7755. if(urStyle == 'hidden') urStyle = 'visible';
  7756. else urStyle = 'hidden';
  7757. }
  7758. }
  7759.  
  7760. // type filtering
  7761. if(urStyle == 'visible')
  7762. {
  7763. // Test for Waze automatic URs before any others - these always (?) get inserted as General Error URs,
  7764. // so we can't filter them by type...
  7765. if(desc.indexOf('Waze Automatic:') != -1)
  7766. {
  7767. wazeauto_ur = true;
  7768. }
  7769.  
  7770. if(wazeauto_ur === true)
  7771. {
  7772. if(filterWazeAuto === true) urStyle = 'hidden';
  7773. }
  7774.  
  7775. else if(ukroadworks_ur === true)
  7776. {
  7777. if(filterRoadworks === true) urStyle = 'hidden';
  7778. }
  7779. else if(construction_ur === true)
  7780. {
  7781. if(filterConstruction === true) urStyle = 'hidden';
  7782. }
  7783. else if(closure_ur === true)
  7784. {
  7785. if(filterClosure === true) urStyle = 'hidden';
  7786. }
  7787. else if(event_ur === true)
  7788. {
  7789. if(filterEvent === true) urStyle = 'hidden';
  7790. }
  7791. else if(note_ur === true)
  7792. {
  7793. if(filterNote === true) urStyle = 'hidden';
  7794. }
  7795. else if(wslm_ur === true)
  7796. {
  7797. if(filterWSLM === true) urStyle = 'hidden';
  7798. }
  7799. else if(bog_ur === true)
  7800. {
  7801. if(filterBOG === true) urStyle = 'hidden';
  7802. }
  7803. else if(difficult_ur === true)
  7804. {
  7805. if(filterDifficult === true) urStyle = 'hidden';
  7806. }
  7807.  
  7808. else if(ureq.attributes.type == 6)
  7809. {
  7810. if(filterIncorrectTurn === true) urStyle = 'hidden';
  7811. }
  7812. else if(ureq.attributes.type == 7)
  7813. {
  7814. if (filterIncorrectAddress === true) urStyle = 'hidden';
  7815. }
  7816. else if(ureq.attributes.type == 8)
  7817. {
  7818. if(filterIncorrectRoute === true) urStyle = 'hidden';
  7819. }
  7820. else if(ureq.attributes.type == 9)
  7821. {
  7822. if(filterMissingRoundabout === true) urStyle = 'hidden';
  7823. }
  7824. else if(ureq.attributes.type == 10)
  7825. {
  7826. if(filterGeneralError === true) urStyle = 'hidden';
  7827. }
  7828. else if(ureq.attributes.type == 11)
  7829. {
  7830. if(filterTurnNotAllowed === true) urStyle = 'hidden';
  7831. }
  7832. else if(ureq.attributes.type == 12)
  7833. {
  7834. if(filterIncorrectJunction === true) urStyle = 'hidden';
  7835. }
  7836. else if(ureq.attributes.type == 13)
  7837. {
  7838. if(filterMissingBridgeOverpass === true) urStyle = 'hidden';
  7839. }
  7840. else if(ureq.attributes.type == 14)
  7841. {
  7842. if(filterWrongDrivingDirection === true) urStyle = 'hidden';
  7843. }
  7844. else if(ureq.attributes.type == 15)
  7845. {
  7846. if(filterMissingExit === true) urStyle = 'hidden';
  7847. }
  7848. else if(ureq.attributes.type == 16)
  7849. {
  7850. if(filterMissingRoad === true) urStyle = 'hidden';
  7851. }
  7852. else if(ureq.attributes.type == 18)
  7853. {
  7854. if(filterMissingLandmark === true) urStyle = 'hidden';
  7855. }
  7856. else if(ureq.attributes.type == 19)
  7857. {
  7858. if(filterBlockedRoad === true) urStyle = 'hidden';
  7859. }
  7860. else if(ureq.attributes.type == 23)
  7861. {
  7862. if(filterNativeSpeedLimit === true) urStyle = 'hidden';
  7863. }
  7864. else if(filterUndefined === true) urStyle = 'hidden';
  7865.  
  7866. if(invertURFilters === true)
  7867. {
  7868. if(urStyle == 'hidden') urStyle = 'visible';
  7869. else urStyle = 'hidden';
  7870. }
  7871. }
  7872.  
  7873. // stage-age filtering override for tagged URs
  7874. if(noFilterTaggedURs === true)
  7875. {
  7876. if(ukroadworks_ur === true)
  7877. {
  7878. if(filterRoadworks === false) urStyle = 'visible';
  7879. }
  7880. else if(construction_ur === true)
  7881. {
  7882. if(filterConstruction === false) urStyle = 'visible';
  7883. }
  7884. else if(closure_ur === true)
  7885. {
  7886. if(filterClosure === false) urStyle = 'visible';
  7887. }
  7888. else if(event_ur === true)
  7889. {
  7890. if(filterEvent === false) urStyle = 'visible';
  7891. }
  7892. else if(note_ur === true)
  7893. {
  7894. if(filterNote === false) urStyle = 'visible';
  7895. }
  7896. else if(wslm_ur === true)
  7897. {
  7898. if(filterWSLM === false) urStyle = 'visible';
  7899. }
  7900. }
  7901. }
  7902. // only touch marker visibility if we've got active filter settings, or if URComments is not
  7903. // doing any filtering of its own
  7904. if((hasActiveURFilters === true) || (urcFilteringIsActive === false) || (uFURs_masterEnable === false))
  7905. {
  7906. let urMarker = uroGetMarker(uroLayers.ID.UR,urobj);
  7907. if(urMarker !== null)
  7908. {
  7909. urMarker.style.visibility = urStyle;
  7910. }
  7911. }
  7912. if(urStyle != 'hidden')
  7913. {
  7914. uroURExtras.AddToList(ureqID, customType, hasMyComments, nComments, ageLastComment);
  7915. }
  7916. }
  7917. }
  7918. uroURExtras.AddCommentCounts();
  7919. uroDBG.PerfMon(pmFunction, pmTStart);
  7920. }
  7921. function uroGetProblemTypes()
  7922. {
  7923. uroKnownProblemTypeIDs = [];
  7924. uroKnownProblemTypeNames = [];
  7925. let tProblemList = I18n.lookup("problems.types");
  7926. for(let tObj in tProblemList)
  7927. {
  7928. if(tObj !== undefined)
  7929. {
  7930. uroKnownProblemTypeIDs.push(parseInt(tObj));
  7931. uroKnownProblemTypeNames.push(tProblemList[tObj].title);
  7932. }
  7933. }
  7934. }
  7935. function uroFilterProblems()
  7936. {
  7937. let pmTStart = performance.now();
  7938. let pmFunction = "uroFilterProblems";
  7939.  
  7940. if(uroFilterPreamble() === false) return;
  7941. let selector;
  7942.  
  7943. if((uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter') === false) && (uroUtils.GetCBChecked('_cbMPClosedUserIDFilter') === false))
  7944. {
  7945. selector = document.getElementById('_selectMPUserID');
  7946. while(selector.options.length > 0)
  7947. {
  7948. selector.options.remove(0);
  7949. }
  7950. }
  7951.  
  7952. let solverUser = null;
  7953. if((uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter') === true) || (uroUtils.GetCBChecked('_cbMPClosedUserIDFilter') === true))
  7954. {
  7955. selector = document.getElementById('_selectMPUserID');
  7956. if(selector.options.length === 0)
  7957. {
  7958. uroUpdateEditorList(W.model.mapProblems.objects, '_selectMPUserID', false, false, true, false);
  7959. }
  7960. if(selector.selectedOptions[0] != null)
  7961. {
  7962. solverUser = parseInt(selector.selectedOptions[0].value);
  7963. }
  7964. }
  7965.  
  7966. let uFP_masterEnable = uroIsFilteringEnabled(false);
  7967. let filter_OutsideEditableArea = uroUtils.GetCBChecked('_cbMPFilterOutsideArea');
  7968. let filter_Solved = uroUtils.GetCBChecked('_cbMPFilterSolved');
  7969. let filter_Unidentified = uroUtils.GetCBChecked('_cbMPFilterUnidentified');
  7970. let filter_Closed = uroUtils.GetCBChecked('_cbMPFilterClosed');
  7971. let filter_NotClosedUserID = uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter');
  7972. let filter_ClosedUserID = uroUtils.GetCBChecked('_cbMPClosedUserIDFilter');
  7973. let filter_Reopened = uroUtils.GetCBChecked('_cbMPFilterReopenedProblem');
  7974.  
  7975. let filter_LowSeverity = uroUtils.GetCBChecked('_cbMPFilterLowSeverity');
  7976. let filter_MediumSeverity = uroUtils.GetCBChecked('_cbMPFilterMediumSeverity');
  7977. let filter_HighSeverity = uroUtils.GetCBChecked('_cbMPFilterHighSeverity');
  7978.  
  7979. let filterTypes = [];
  7980. let i;
  7981. for(i=0; i<uroKnownProblemTypeIDs.length; i++)
  7982. {
  7983. if(uroUtils.GetCBChecked('_cbMPFilter_T'+uroKnownProblemTypeIDs[i])) filterTypes.push(uroKnownProblemTypeIDs[i]);
  7984. }
  7985. let filter_TypeUnknown = uroUtils.GetCBChecked('_cbMPFilterUnknownProblem');
  7986.  
  7987. let filter_TaggedElgin = uroUtils.GetCBChecked('_cbFilterElgin');
  7988. let filter_TaggedTrafficCast = uroUtils.GetCBChecked('_cbFilterTrafficCast');
  7989. let filter_TaggedTrafficMaster = uroUtils.GetCBChecked('_cbFilterTrafficMaster');
  7990. let filter_TaggedCaltrans = uroUtils.GetCBChecked('_cbFilterCaltrans');
  7991. let filter_TaggedTFL = uroUtils.GetCBChecked('_cbFilterTFL');
  7992.  
  7993. let filter_Invert = uroUtils.GetCBChecked('_cbInvertMPFilter');
  7994.  
  7995. let filter_StartDateEnabled = uroUtils.GetCBChecked('_cbMPFilterStartDate');
  7996. let filter_EndDateEnabled = uroUtils.GetCBChecked('_cbMPFilterEndDate');
  7997. let filter_EndDatePassed = uroUtils.GetCBChecked('_cbMPFilterEndDatePassed');
  7998.  
  7999. let tsD = uroUtils.GetElmValue('_inputMPFilterStartDay');
  8000. let tsM = uroUtils.GetElmValue('_inputMPFilterStartMonth');
  8001. let tsY = uroUtils.GetElmValue('_inputMPFilterStartYear');
  8002. let startDate = uroUtils.GetTS(tsD, tsM, tsY, 0, 0);
  8003.  
  8004. tsD = uroUtils.GetElmValue('_inputMPFilterEndDay');
  8005. tsM = uroUtils.GetElmValue('_inputMPFilterEndMonth');
  8006. tsY = uroUtils.GetElmValue('_inputMPFilterEndYear');
  8007. let endDate = uroUtils.GetTS(tsD, tsM, tsY, 0, 0);
  8008. let nowTime = (new Date()).getTime();
  8009.  
  8010. for (let urobj in W.model.mapProblems.objects)
  8011. {
  8012. if(W.model.mapProblems.objects.hasOwnProperty(urobj))
  8013. {
  8014. let problem = W.model.mapProblems.objects[urobj];
  8015.  
  8016. if(problem.attributes.origJSONGeo === undefined)
  8017. {
  8018. // Store a copy of the original marker position if we haven't already done so
  8019. problem.attributes.origJSONGeo = uroUtils.CloneObject(problem.attributes.geoJSONGeometry);
  8020. }
  8021. else
  8022. {
  8023. // Restore the original position if we do have a copy of it, to undo any adjustments
  8024. // that may have been made in the last filtering pass
  8025. problem.attributes.geoJSONGeometry = uroUtils.CloneObject(problem.attributes.origJSONGeo);
  8026. }
  8027.  
  8028.  
  8029. let ureqID = problem.attributes.id;
  8030.  
  8031. let problemStyle = 'visible';
  8032. // check problem against current session ignore list...
  8033. if(uroIgnore.IsOnList(ureqID)) problemStyle = 'hidden';
  8034.  
  8035. if(uFP_masterEnable === true)
  8036. {
  8037. if(filter_OutsideEditableArea === true)
  8038. {
  8039. if(problem.canEdit() === false)
  8040. {
  8041. problemStyle = 'hidden';
  8042. }
  8043. }
  8044.  
  8045. if(filter_EndDatePassed == true)
  8046. {
  8047. if(problem.attributes.endTime > nowTime)
  8048. {
  8049. problemStyle = 'hidden';
  8050. }
  8051. }
  8052. if(filter_StartDateEnabled == true)
  8053. {
  8054. let tStart = new Date(problem.attributes.startTime);
  8055. tStart.setHours(0);
  8056. tStart.setMinutes(0);
  8057. tStart.setSeconds(0);
  8058. tStart = tStart.getTime();
  8059. if(tStart != startDate)
  8060. {
  8061. problemStyle = 'hidden';
  8062. }
  8063. }
  8064. if(filter_EndDateEnabled == true)
  8065. {
  8066. let tEnd = new Date(problem.attributes.endTime);
  8067. tEnd.setHours(0);
  8068. tEnd.setMinutes(0);
  8069. tEnd.setSeconds(0);
  8070. tEnd = tEnd.getTime();
  8071. if(tEnd != endDate)
  8072. {
  8073. problemStyle = 'hidden';
  8074. }
  8075. }
  8076.  
  8077. // check against closed/not identified filtering if enabled...
  8078. let geoID = problem.getOLGeometry().id;
  8079. if(geoID !== null)
  8080. {
  8081. if(document.getElementById(geoID) !== null)
  8082. {
  8083. let problem_marker_img = document.getElementById(geoID).href.baseVal;
  8084. if(filter_Solved === true)
  8085. {
  8086. if(problem_marker_img.indexOf('_solved') != -1) problemStyle = 'hidden';
  8087. }
  8088. if(filter_Unidentified === true)
  8089. {
  8090. if(problem_marker_img.indexOf('_rejected') != -1) problemStyle = 'hidden';
  8091. }
  8092. }
  8093. }
  8094.  
  8095. if(filter_Closed === true)
  8096. {
  8097. if(problem.attributes.open === false)
  8098. {
  8099. problemStyle = 'hidden';
  8100. }
  8101. }
  8102.  
  8103. if(problemStyle == 'visible')
  8104. {
  8105. if(solverUser !== null)
  8106. {
  8107. if((filter_NotClosedUserID === true) && (problem.attributes.resolvedBy == solverUser)) problemStyle = 'hidden';
  8108. if((filter_ClosedUserID === true) && (problem.attributes.resolvedBy != solverUser)) problemStyle = 'hidden';
  8109. }
  8110. }
  8111.  
  8112. if(problemStyle == 'visible')
  8113. {
  8114. let problemType = problem.attributes.subType;
  8115. let desc = '';
  8116. if(problem.attributes.description != null)
  8117. {
  8118. desc = problem.attributes.description;
  8119. }
  8120. let customType = uroGetCustomType(ureqID, uroLayers.ID.MP, desc);
  8121.  
  8122. if(customType === 100)
  8123. {
  8124. if(filter_TaggedElgin === true) problemStyle = 'hidden';
  8125. }
  8126. else if(customType === 101)
  8127. {
  8128. if(filter_TaggedTrafficCast === true) problemStyle = 'hidden';
  8129. }
  8130. else if(customType === 102)
  8131. {
  8132. if(filter_TaggedTrafficMaster === true) problemStyle = 'hidden';
  8133. }
  8134. else if(customType === 103)
  8135. {
  8136. if(filter_TaggedCaltrans === true) problemStyle = 'hidden';
  8137. }
  8138. else if(customType === 104)
  8139. {
  8140. if(filter_TaggedTFL === true) problemStyle = 'hidden';
  8141. }
  8142. else if(uroKnownProblemTypeIDs.indexOf(problemType) !== -1)
  8143. {
  8144. if(filterTypes.indexOf(problemType) !== -1)
  8145. {
  8146. problemStyle = 'hidden';
  8147. }
  8148. }
  8149. else if(filter_TypeUnknown === true) problemStyle = 'hidden';
  8150.  
  8151. if(filter_Reopened === true)
  8152. {
  8153. if((problem.attributes.open === true) && (problem.attributes.resolvedOn !== null))
  8154. {
  8155. problemStyle = 'hidden';
  8156. }
  8157. }
  8158.  
  8159.  
  8160. if(filter_Invert === true)
  8161. {
  8162. if(problemStyle == 'hidden') problemStyle = 'visible';
  8163. else problemStyle = 'hidden';
  8164. }
  8165.  
  8166.  
  8167. if(problem.attributes.weight <= 3)
  8168. {
  8169. if(filter_LowSeverity === true) problemStyle = 'hidden';
  8170. }
  8171. else if(problem.attributes.weight <= 7)
  8172. {
  8173. if(filter_MediumSeverity === true) problemStyle = 'hidden';
  8174. }
  8175. else if(filter_HighSeverity === true) problemStyle = 'hidden';
  8176. }
  8177. }
  8178.  
  8179. let marker = uroGetMarker(uroLayers.ID.MP, urobj);
  8180. if(marker !== null)
  8181. {
  8182. marker.style.visibility = problemStyle;
  8183. if(problemStyle === 'hidden')
  8184. {
  8185. // To ensure WME displays the details for the topmost marker that's
  8186. // left visible in a stack, alter the coords for any hidden markers
  8187. // to place them in a location that isn't likely to be clicked on...
  8188. problem.attributes.geoJSONGeometry.coordinates[0] = 0;
  8189. problem.attributes.geoJSONGeometry.coordinates[1] = 90;
  8190. }
  8191. }
  8192. }
  8193. }
  8194.  
  8195. uroDBG.PerfMon(pmFunction, pmTStart);
  8196. }
  8197. function uroFilterPreamble()
  8198. {
  8199. let mapviewport = document.getElementsByClassName("olMapViewport")[0];
  8200. if(mapviewport === null)
  8201. {
  8202. if(uroNullMapViewport === false)
  8203. {
  8204. uroDBG.AddLog('caught null mapviewport');
  8205. uroNullMapViewport = true;
  8206. }
  8207. return false;
  8208. }
  8209.  
  8210. let uiElms = uroTabs.CtrlTabs[uroTabs.IDS.MISC][uroTabs.FIELDS.TABBODY];
  8211. if(uiElms == null)
  8212. {
  8213. uroDBG.AddLog('caught missing UI');
  8214. return false;
  8215. }
  8216. if(uiElms.innerHTML.length === 0)
  8217. {
  8218. uroDBG.AddLog('caught empty UI');
  8219. return false;
  8220. }
  8221.  
  8222. if(uroSettingsApplied === false)
  8223. {
  8224. return false;
  8225. }
  8226.  
  8227. uroNullMapViewport = false;
  8228.  
  8229. return true;
  8230. }
  8231. function uroFilterItems_MasterEnableClick()
  8232. {
  8233. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  8234. {
  8235. uroPopup.Hide();
  8236. }
  8237. uroFilterItems();
  8238. }
  8239. function uroFilterItems()
  8240. {
  8241. uroFilterProblems();
  8242. uroFilterPlaces();
  8243. uroFilterCameras();
  8244. uroFilterURs();
  8245. uroFilterRTCs();
  8246. uroFilterRAs();
  8247. uroFilterMapComments();
  8248. }
  8249. function uroFilterItemsOnMove()
  8250. {
  8251. W.map.events.unregister('mousemove',null,uroFilterItemsOnMove);
  8252. uroFilterItems();
  8253. }
  8254. function uroCheckCommentsForTag(idSrc)
  8255. {
  8256. let ursObj = W.model.updateRequestSessions.objects[idSrc];
  8257. if(typeof(ursObj) == 'undefined') return -1;
  8258. if(ursObj.attributes.comments.length === 0) return -1;
  8259.  
  8260. for(let idx=ursObj.attributes.comments.length-1; idx>=0; idx--)
  8261. {
  8262. for(let tag=0; tag<uroCustomURTags.length; tag++)
  8263. {
  8264. let keyword = uroCustomURTags[tag];
  8265. if(ursObj.attributes.comments[idx].text.indexOf(keyword) != -1)
  8266. {
  8267. return tag;
  8268. }
  8269. }
  8270. }
  8271. return -1;
  8272. }
  8273. function uroGetCustomType(idSrc, markerType, desc)
  8274. {
  8275. let provider = '';
  8276. if(desc === null) desc = '';
  8277. if(markerType == uroLayers.ID.UR)
  8278. {
  8279. let ureq = W.model.mapUpdateRequests.objects[idSrc];
  8280. // early test for native speed limit URs
  8281. if(ureq.attributes.type == 23) return 98;
  8282. }
  8283. else if(markerType == uroLayers.ID.MP)
  8284. {
  8285. let mp = W.model.mapProblems.objects[idSrc];
  8286. if(mp.attributes.provider != null)
  8287. {
  8288. provider = mp.attributes.provider;
  8289. }
  8290. }
  8291.  
  8292. if(desc !== '')
  8293. {
  8294. if((markerType == uroLayers.ID.UR) || (markerType == 'mc'))
  8295. {
  8296. for(let tag=0; tag<uroCustomURTags.length; tag++)
  8297. {
  8298. let keyword = uroCustomURTags[tag];
  8299. if(desc.indexOf(keyword) != -1)
  8300. {
  8301. return tag;
  8302. }
  8303. }
  8304. }
  8305.  
  8306. if(markerType == uroLayers.ID.MP)
  8307. {
  8308. if(desc.indexOf('[Elgin]') != -1) return 100;
  8309. if(desc.indexOf('[ELGIN]') != -1) return 100;
  8310. if(desc.indexOf('[elginroadworks]') != -1) return 100;
  8311. if(desc.indexOf('[one.network]') != -1) return 100;
  8312. if(desc.indexOf('[TrafficCast]') != -1) return 101;
  8313. if(desc.indexOf('[TM]') != -1) return 102;
  8314. if(desc.indexOf('[Caltrans]') != -1) return 103;
  8315. if(desc.indexOf('[TfL Open Data]') != -1) return 104;
  8316. if(provider.indexOf('London TFL Closures') != -1) return 104;
  8317. }
  8318. }
  8319.  
  8320. if(markerType == uroLayers.ID.UR)
  8321. {
  8322. return uroCheckCommentsForTag(idSrc);
  8323. }
  8324.  
  8325. return -1;
  8326. }
  8327. function uroGetRestrictionLanes(disposition)
  8328. {
  8329. let retval = '';
  8330. if(disposition == 1) retval += 'All lanes';
  8331. else if(disposition == 2) retval += 'Left lane';
  8332. else if(disposition == 3) retval += 'Middle lane';
  8333. else if(disposition == 4) retval += 'Right lane';
  8334. else retval += ' - ';
  8335. return retval;
  8336. }
  8337. function uroGetRestrictionLaneType(laneType)
  8338. {
  8339. let retval = '';
  8340. if(laneType === null) retval += ' - ';
  8341. else
  8342. {
  8343. if(laneType == 1) retval += 'HOV';
  8344. else if(laneType == 2) retval += 'HOT';
  8345. else if(laneType == 3) retval += 'Express';
  8346. else if(laneType == 4) retval += 'Bus lane';
  8347. else if(laneType == 5) retval += 'Fast lane';
  8348. else retval += ' - ';
  8349. }
  8350. return retval;
  8351. }
  8352. let uroVehicleTypes =
  8353. [
  8354. [1280, 'fa-car'],
  8355. [1024, 'fa-motorcycle'],
  8356. [272, 'fa-taxi'],
  8357. [1808, 'fa-bolt']
  8358. ];
  8359. function uroGetRestrictionVehicleTypes(restObj, allowInit, profileKey)
  8360. {
  8361. let i;
  8362. let j;
  8363. let k;
  8364. let tVT;
  8365. let retval = [];
  8366. for(i = 0; i < uroVehicleTypes.length; ++i)
  8367. {
  8368. retval.push(allowInit);
  8369. }
  8370. let tRest = restObj._driveProfiles.get(profileKey);
  8371. if(tRest !== undefined)
  8372. {
  8373. for(i = 0; i < tRest._driveProfiles.length; ++i)
  8374. {
  8375. tVT = tRest._driveProfiles[i].getVehicleTypes();
  8376. {
  8377. if(tVT.length > 0)
  8378. {
  8379. for(j = 0; j < tVT.length; ++j)
  8380. {
  8381. for(k = 0; k < uroVehicleTypes.length; ++k)
  8382. {
  8383. if(tVT[j] == uroVehicleTypes[k][0])
  8384. {
  8385. retval[k] = !allowInit;
  8386. }
  8387. }
  8388. }
  8389. }
  8390. }
  8391. }
  8392. }
  8393. return retval;
  8394. }
  8395. function uroFormatRestriction(restObj)
  8396. {
  8397. let retval = '';
  8398.  
  8399. if(restObj._defaultType == "DIFFICULT")
  8400. {
  8401. retval = '<tr><td colspan=13>Difficult Turn';
  8402. }
  8403. else
  8404. {
  8405. let roDays = null;
  8406. let roFromDate = null;
  8407. let roToDate = null;
  8408. let roFromTime = null;
  8409. let roToTime = null;
  8410. let roRepeats = false;
  8411. let roAllDay = false;
  8412. if(restObj._days !== undefined)
  8413. {
  8414. roDays = restObj._days;
  8415. roFromDate = restObj._fromDate;
  8416. roToDate = restObj._toDate;
  8417. roFromTime = restObj._fromTime;
  8418. roToTime = restObj._toTime;
  8419. }
  8420. else if(restObj._timeFrames.length > 0)
  8421. {
  8422. if(restObj._timeFrames[0]._weekdays !== undefined)
  8423. {
  8424. roDays = restObj._timeFrames[0]._weekdays;
  8425. roFromDate = restObj._timeFrames[0]._startDate;
  8426. roToDate = restObj._timeFrames[0]._endDate;
  8427. roFromTime = restObj._timeFrames[0]._fromTime;
  8428. roToTime = restObj._timeFrames[0]._toTime;
  8429. roRepeats = restObj._timeFrames[0]._repeatYearly;
  8430. }
  8431. }
  8432.  
  8433. if((roFromTime === null) && (roToTime === null))
  8434. {
  8435. roFromTime = "0:00";
  8436. roToTime = "23:59";
  8437. roAllDay = true;
  8438. }
  8439.  
  8440. let hasExpired = false;
  8441. let isFuture = false;
  8442. let tNow = Date.now();
  8443. let tFrom = null;
  8444. let tTo = null;
  8445. if(roFromDate !== null)
  8446. {
  8447. tFrom = new Date(roFromDate + " " + roFromTime);
  8448. isFuture = (tFrom.getTime() > tNow);
  8449. }
  8450. if(roToDate !== null)
  8451. {
  8452. tTo = new Date(roToDate + " " + roToTime);
  8453. hasExpired = (tTo.getTime() < tNow);
  8454. }
  8455. if((hasExpired === true) && (roRepeats === true))
  8456. {
  8457. while(tTo.getTime() < tNow)
  8458. {
  8459. tFrom.setFullYear(tFrom.getFullYear() + 1);
  8460. tTo.setFullYear(tTo.getFullYear() + 1);
  8461. }
  8462. isFuture = (tFrom.getTime() > tNow);
  8463. hasExpired = false;
  8464. }
  8465.  
  8466.  
  8467. if(isFuture === true)
  8468. {
  8469. retval = '<tr bgcolor="#8080FF">';
  8470. }
  8471. else if(hasExpired === true)
  8472. {
  8473. retval = '<tr bgcolor="#FFFFC0">';
  8474. }
  8475. else
  8476. {
  8477. retval = '<tr>';
  8478. }
  8479.  
  8480. if(roDays === null)
  8481. {
  8482. roDays = 127;
  8483. }
  8484.  
  8485. retval += '<td style="text-align:center;">';
  8486. if((roDays & 1) == 1) retval += 'M';
  8487. else retval += '-';
  8488. retval += '</td><td style="text-align:center;">';
  8489. if((roDays & 2) == 2) retval += 'Tu';
  8490. else retval += '-';
  8491. retval += '</td><td style="text-align:center;">';
  8492. if((roDays & 4) == 4) retval += 'W';
  8493. else retval += '-';
  8494. retval += '</td><td style="text-align:center;">';
  8495. if((roDays & 8) == 8) retval += 'Th';
  8496. else retval += '-';
  8497. retval += '</td><td style="text-align:center;">';
  8498. if((roDays & 16) == 16) retval += 'F';
  8499. else retval += '-';
  8500. retval += '</td><td style="text-align:center;">';
  8501. if((roDays & 32) == 32) retval += 'Sa';
  8502. else retval += '-';
  8503. retval += '</td><td style="text-align:center;">';
  8504. if((roDays & 64) == 64) retval += 'Su';
  8505. else retval += '-';
  8506.  
  8507. retval += '</td><td nowrap style="text-align:center;">';
  8508.  
  8509. if(roFromDate === null) retval += 'All dates';
  8510. else retval += tFrom.toISOString().slice(0,10) + ' to ' + tTo.toISOString().slice(0,10);
  8511. if(roRepeats === true)
  8512. {
  8513. retval += '&nbsp;<i class="fa fa-repeat"> </i>';
  8514. }
  8515.  
  8516. retval += '</td><td nowrap style="text-align:center;">';
  8517.  
  8518. if((restObj._allDay === true) || (roAllDay === true)) retval += 'All day';
  8519. else retval += roFromTime + ' to ' + roToTime;
  8520.  
  8521. retval += '</td><td nowrap style="text-align:center;">';
  8522.  
  8523. retval += uroGetRestrictionLanes(restObj._disposition);
  8524.  
  8525. retval += '</td><td nowrap style="text-align:center;">';
  8526.  
  8527. retval += uroGetRestrictionLaneType(restObj._laneType);
  8528.  
  8529. retval += '</td><td nowrap style="text-align:center;">';
  8530.  
  8531. // for brevity, the popup only displays the allowed/prohibited restriction for the driveable vehicle types in the app...
  8532. let typesAllowed = [];
  8533. if((restObj._defaultType == "BLOCKED") || (restObj._defaultType == "TOLL"))
  8534. {
  8535. if(restObj._defaultType == "TOLL")
  8536. {
  8537. retval += I18n.lookup('restrictions.editing.segment.toll_road');
  8538. }
  8539. typesAllowed = uroGetRestrictionVehicleTypes(restObj, false, "FREE");
  8540. }
  8541. else
  8542. {
  8543. typesAllowed = uroGetRestrictionVehicleTypes(restObj, true, "BLOCKED");
  8544. }
  8545.  
  8546. let i;
  8547. for(i = 0; i < uroVehicleTypes.length; ++i)
  8548. {
  8549. if(typesAllowed[i] === true)
  8550. {
  8551. retval += '<i class="fa '+uroVehicleTypes[i][1]+'" style="color:#000000;"> </i>&nbsp;';
  8552. }
  8553. else
  8554. {
  8555. retval += '<i class="fa '+uroVehicleTypes[i][1]+'" style="color:#d0d0d0;"> </i>&nbsp;';
  8556. }
  8557. }
  8558.  
  8559. retval += '</td><td>';
  8560. retval += uroUtils.Clickify(restObj._description, '');
  8561. }
  8562.  
  8563. retval += '</td></tr>';
  8564.  
  8565. return retval;
  8566. }
  8567. function uroOpenURDialog(urID)
  8568. {
  8569. let t = {showNext: false, nextButtonString: I18n.lookup('problems.panel.done')};
  8570. let urObj = W.model.mapUpdateRequests.objects[urID];
  8571. W.reqres.request("problems:browse", _.extend(t, {problem: urObj}));
  8572. }
  8573. function uroRecentreSessionOnUR()
  8574. {
  8575. //uroGetMarker(uroLayers.ID.UR, uroShownFID).element.click();
  8576. uroOpenURDialog(uroShownFID);
  8577. W.map.moveTo(uroGetMarker(uroLayers.ID.UR, uroShownFID).lonlat, 17);
  8578. uroPopup.Hide();
  8579. return false;
  8580. }
  8581. function uroRecentreSessionOnMP()
  8582. {
  8583. uroGetMarker(uroLayers.ID.MP, uroShownFID).element.click();
  8584. W.map.moveTo(uroGetMarker(uroLayers.ID.MP, uroShownFID).lonlat, 17);
  8585. uroPopup.Hide();
  8586. return false;
  8587. }
  8588. function uroRecentreSessionOnPUR()
  8589. {
  8590. uroGetMarker(uroLayers.ID.PUR, uroShownFID).element.click();
  8591. W.map.moveTo(uroGetMarker(uroLayers.ID.PUR, uroShownFID).lonlat, 17);
  8592. uroPopup.Hide();
  8593. return false;
  8594. }
  8595. function uroRecentreSessionOnPPUR()
  8596. {
  8597. uroGetMarker(uroLayers.ID.PPUR, uroShownFID).element.click();
  8598. W.map.moveTo(uroGetMarker(uroLayers.ID.PPUR, uroShownFID).lonlat, 17);
  8599. uroPopup.Hide();
  8600. return false;
  8601. }
  8602. function uroRecentreSessionOnVenueNavPoint()
  8603. {
  8604. W.map.moveTo(uroGetVenueNavPoint(uroShownFID), 17);
  8605. uroPopup.Hide();
  8606. return false;
  8607. }
  8608. function uroStackListObj(fid,x,y)
  8609. {
  8610. this.fid = fid;
  8611. this.x = uroUtils.TypeCast(x);
  8612. this.y = uroUtils.TypeCast(y);
  8613. }
  8614. function uroRestackMarkers()
  8615. {
  8616. if(uroStackList.length === 0) return;
  8617.  
  8618. if(uroLayers.layers[uroStackType].mf !== null)
  8619. {
  8620. uroDBG.AddLog('restacking markers...');
  8621. // strip off the .realX/realY attributes from any UR object we've previously added it to, to allow
  8622. // the native recentering to work again...
  8623. let idList = uroGetMarkerIDs(uroStackType);
  8624. for(let marker of idList)
  8625. {
  8626. let testMarkerAttributes = uroGetAttributes(uroStackType, marker);
  8627. if(testMarkerAttributes.geometry.realX != null)
  8628. {
  8629. testMarkerAttributes.geometry.x = testMarkerAttributes.geometry.realX;
  8630. testMarkerAttributes.geometry.y = testMarkerAttributes.geometry.realY;
  8631. delete(testMarkerAttributes.geometry.realX);
  8632. delete(testMarkerAttributes.geometry.realY);
  8633. }
  8634. }
  8635. // now restack any markers that were repositioned...
  8636. for(let idx=0; idx<uroStackList.length; idx++)
  8637. {
  8638. let orig_x = uroStackList[idx].x + 'px';
  8639. let orig_y = uroStackList[idx].y + 'px';
  8640. let fid = uroStackList[idx].fid;
  8641.  
  8642. if(uroGetMarker(uroStackType, fid) != null)
  8643. {
  8644. uroGetMarker(uroStackType, fid).element.style.left = orig_x;
  8645. uroGetMarker(uroStackType, fid).element.style.top = orig_y;
  8646. }
  8647. }
  8648. uroStackList = [];
  8649. uroUnstackedMasterID = null;
  8650. uroStackType = null;
  8651. uroDBG.AddLog('...stacked!');
  8652. }
  8653. }
  8654. function uroIsIDAlreadyUnstacked(idSrc)
  8655. {
  8656. if(uroStackList.length === 0) return false;
  8657. for(let idx=0; idx<uroStackList.length; idx++)
  8658. {
  8659. if(uroStackList[idx].fid == idSrc) return true;
  8660. }
  8661. return false;
  8662. }
  8663. function uroCheckStacking(stackType, masterID, unstackedX, unstackedY)
  8664. {
  8665. //// disabled pending fix...
  8666. return;
  8667. if(typeof(masterID) === 'number')
  8668. {
  8669. masterID = masterID.toString();
  8670. }
  8671.  
  8672. if(uroIsIDAlreadyUnstacked(masterID) === true) return;
  8673. if(uroStackType !== null) return;
  8674.  
  8675. uroDBG.AddLog('checking for marker stack, masterID: '+masterID+', stackType: '+stackType);
  8676. let stackList = [];
  8677. stackList.push(masterID);
  8678. let threshSquared = uroUtils.GetElmValue('_inputUnstackSensitivity');
  8679. threshSquared *= threshSquared;
  8680.  
  8681. let marker;
  8682.  
  8683. let offset = 0.000000001;
  8684. if(uroLayers.layers[stackType].mf !== null)
  8685. {
  8686. let idList = uroGetMarkerIDs(stackType);
  8687. let showOpen = true;
  8688. let showClosed = false;
  8689. let showTypes = null;
  8690. if(stackType === uroLayers.ID.UR)
  8691. {
  8692. showTypes = W?.issueTrackerController?.app?.attributes?.issueTrackerFilter?.attributes?.mapUpdateRequestsFilter?.attributes?.status;
  8693. }
  8694. else if(stackType === uroLayers.ID.MP)
  8695. {
  8696. showTypes = W?.issueTrackerController?.app?.attributes?.issueTrackerFilter?.attributes?.mapProblemsFilter?.attributes?.status;
  8697. }
  8698. if(showTypes !== null)
  8699. {
  8700. showOpen = ((showTypes == 'OPEN') || (showTypes == 'BOTH'));
  8701. showClosed = ((showTypes == 'CLOSED') || (showTypes == 'BOTH'));
  8702. }
  8703.  
  8704. for(marker of idList)
  8705. {
  8706. let testMarkerObj = uroGetMarker(stackType, marker);
  8707. let testMarkerAttributes = uroGetAttributes(stackType, marker);
  8708. if((testMarkerAttributes !== null) && (testMarkerObj !== null))
  8709. {
  8710. // 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
  8711. // top of the stack in the absence of any URO+ filtering, regardless of which UR pin actually receives the click event. To prevent
  8712. // this, we give each pin in the stack a unique set of false coordinates, storing the original coordinates in newly created
  8713. // properties so they can be restored later on.
  8714. //
  8715. // 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
  8716. // 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
  8717. // is being viewed. By using a small fractional offset added to each stacked marker, the risk of accidentally setting the offset coords to
  8718. // those of another marker is low
  8719. if(testMarkerAttributes.geometry.realX === undefined)
  8720. {
  8721. testMarkerAttributes.geometry.realX = testMarkerAttributes.geometry.x;
  8722. testMarkerAttributes.geometry.x += offset;
  8723. testMarkerAttributes.geometry.realY = testMarkerAttributes.geometry.y;
  8724. testMarkerAttributes.geometry.y += offset;
  8725. offset += 0.000000001;
  8726. }
  8727.  
  8728. let includeInStack = (testMarkerObj.element.style.visibility != 'hidden');
  8729. let isClosed = testMarkerObj.element.classList.contains("recently-closed");
  8730. includeInStack = includeInStack && ((isClosed && showClosed) || (!isClosed && showOpen));
  8731. if(includeInStack)
  8732. {
  8733. if(testMarkerAttributes.id != masterID)
  8734. {
  8735. let bcr = testMarkerObj.element.getBoundingClientRect();
  8736. let xdiff = unstackedX - bcr.x;
  8737. let ydiff = unstackedY - bcr.y;
  8738. let distSquared = ((xdiff * xdiff) + (ydiff * ydiff));
  8739. if(distSquared < threshSquared)
  8740. {
  8741. stackList.push(testMarkerAttributes.id);
  8742. }
  8743. }
  8744. }
  8745. }
  8746. }
  8747. }
  8748.  
  8749. let inhibitUnstacking = (W.map.getZoom() < uroUtils.GetElmValue('_inputUnstackZoomLevel'));
  8750. inhibitUnstacking = inhibitUnstacking || (stackList.length < 2);
  8751.  
  8752. if(inhibitUnstacking == false)
  8753. {
  8754. uroStackType = stackType;
  8755. if(uroUnstackedMasterID != masterID)
  8756. {
  8757. uroDBG.AddLog('unstacked ID mismatch, relocating markers...');
  8758. uroRestackMarkers();
  8759. uroUnstackedMasterID = masterID;
  8760. uroStackList = [];
  8761.  
  8762. // push the highlighted marker onto the stacklist so uroIsIDAlreadyUnstacked() will return true
  8763. uroStackList.push(new uroStackListObj(masterID,unstackedX,unstackedY));
  8764.  
  8765. for(let shoveIdx=0; shoveIdx < stackList.length; shoveIdx++)
  8766. {
  8767. let fid = stackList[shoveIdx];
  8768. let stackMarker = uroGetMarker(stackType, fid);
  8769. if(stackMarker !== null)
  8770. {
  8771. let x = uroUtils.ParsePxString(stackMarker.element.style.left);
  8772. let y = uroUtils.ParsePxString(stackMarker.element.style.top);
  8773. // store the unstacked marker positions so they can be reinstated later
  8774. uroStackList.push(new uroStackListObj(fid,x,y));
  8775. stackMarker.element.style.left = unstackedX + 'px';
  8776. stackMarker.element.style.top = unstackedY + 'px';
  8777. unstackedX += 5;
  8778. unstackedY -= 20;
  8779. }
  8780. }
  8781.  
  8782.  
  8783. // hide other markers to prevent confusion with the unstacked markers
  8784. let listIDs = uroGetMarkerIDs(stackType);
  8785. for(marker in listIDs)
  8786. {
  8787. if(listIDs.hasOwnProperty(marker))
  8788. {
  8789. let toHideMarker = uroGetMarker(stackType, marker);
  8790. if(toHideMarker !== null)
  8791. {
  8792. let toHideID = toHideMarker.id;
  8793. if(uroIsIDAlreadyUnstacked(toHideID) === false)
  8794. {
  8795. toHideMarker = uroGetMarker(stackType, toHideID);
  8796. if(toHideMarker !== null)
  8797. {
  8798. toHideMarker.element.style.visibility = 'hidden';
  8799. }
  8800. }
  8801. }
  8802. }
  8803. }
  8804. }
  8805. }
  8806. else
  8807. {
  8808. uroRestackMarkers();
  8809. }
  8810. }
  8811. function uroGetVenueNavPoint(uroFID)
  8812. {
  8813. let retval = W.map.getUnprojectedCenter(); // allow the function to return a safe value in case we can't find the requested venue object...
  8814.  
  8815. let vObj = W.model.venues.objects[uroFID];
  8816. if(vObj !== undefined)
  8817. {
  8818. if(vObj.attributes.entryExitPoints.length > 0)
  8819. {
  8820. // if the venue has any navpoints defined, use the position of the first one
  8821. let tPoint = vObj.attributes.entryExitPoints[0].getPoint();
  8822. retval.lon = tPoint.coordinates[0];
  8823. retval.lat = tPoint.coordinates[1];
  8824. }
  8825. else
  8826. {
  8827. // otherwise use the centrepoint of the venue point or polygon
  8828. let tPoint = vObj.attributes.geometry.getCentroid();
  8829. let tLL = new OpenLayers.LonLat();
  8830. tLL.lon = tPoint.x;
  8831. tLL.lat = tPoint.y;
  8832. tLL = uroUtils.ConvertMercatorToWGS84(tLL);
  8833. retval.lon = tLL.lon;
  8834. retval.lat = tLL.lat;
  8835. }
  8836. }
  8837. return retval;
  8838. }
  8839. function uroOpenNewTab()
  8840. {
  8841. // flush the current settings into localStorage before the new tab opens, so that when its instance of
  8842. // URO+ fires up it'll have the same settings as this one
  8843. uroConfig.SaveSettings();
  8844. return true;
  8845. }
  8846. function uroGetRTCDuration(rcObj)
  8847. {
  8848. let duration = new Date(rcObj.attributes.endDate) - new Date(rcObj.attributes.startDate);
  8849. return Math.floor(duration / 86400000);
  8850. }
  8851. function uroGetRTCOffset(rcDate)
  8852. {
  8853. let dateObj = new Date(rcDate);
  8854. return (0 - uroUtils.DateToDays(dateObj));
  8855. }
  8856. function uroGetRTCOrigin(rcObj)
  8857. {
  8858. let retval = uroEnums.TRTC.UNKNOWN;
  8859.  
  8860. if(rcObj !== undefined)
  8861. {
  8862. if(rcObj.attributes.createdBy == -5)
  8863. {
  8864. retval = uroEnums.TRTC.WAZEFEED;
  8865. }
  8866. else if((W.model.users.objects[rcObj.attributes.createdBy] !== undefined) && (W.model.users.objects[rcObj.attributes.createdBy].attributes.rank == 6))
  8867. {
  8868. retval = uroEnums.TRTC.WAZEOTHER;
  8869. }
  8870. else
  8871. {
  8872. retval = uroEnums.TRTC.WME;
  8873. }
  8874. }
  8875.  
  8876. return retval;
  8877. }
  8878. function uroGetRTCState(rcObj)
  8879. {
  8880. let retval = uroEnums.SRTC.UNKNOWN;
  8881. let rcStatus = rcObj.attributes.closureStatus;
  8882.  
  8883. if(rcStatus !== undefined)
  8884. {
  8885. if(rcStatus === "ACTIVE")
  8886. {
  8887. retval = uroEnums.SRTC.ACTIVE;
  8888. }
  8889. else if(rcStatus === "NOT_STARTED")
  8890. {
  8891. retval = uroEnums.SRTC.FUTURE;
  8892. }
  8893. else if(rcStatus.indexOf("FINISHED") != -1)
  8894. {
  8895. retval = uroEnums.SRTC.EXPIRED;
  8896. }
  8897. // Haven't seen one of these yet, so assuming it should be treated
  8898. // the same as an expired closure...
  8899. else if(rcStatus === "SUSPENDED")
  8900. {
  8901. retval = uroEnums.SRTC.EXPIRED;
  8902. }
  8903. }
  8904.  
  8905. return retval;
  8906. }
  8907. function uroGetRTCStateText(rcObj)
  8908. {
  8909. let retval = "---";
  8910. let i18 = I18n.lookup("closures.statuses")[rcObj.attributes.closureStatus];
  8911. if(i18 !== undefined)
  8912. {
  8913. retval = i18;
  8914. }
  8915. return retval;
  8916. }
  8917. function uroGetAddress(streetID, houseNumber, formatForSegmentPopup, formatForNodePopup, showAsToll)
  8918. {
  8919. let result = '';
  8920. if((houseNumber !== undefined) && (houseNumber !== null))
  8921. {
  8922. result += houseNumber + ' ';
  8923. }
  8924.  
  8925. if(streetID != null)
  8926. {
  8927. let streetName = I18n.lookup('edit.address.no_street');
  8928. let doesStreetIDExist = true;
  8929. if(W.model.streets.objects[streetID] === undefined)
  8930. {
  8931. streetName = 'non-existent streetID';
  8932. doesStreetIDExist = false;
  8933. }
  8934. else
  8935. {
  8936. if((streetName !== null) && (W.model.streets.objects[streetID].attributes.isEmpty === false))
  8937. {
  8938. streetName = W.model.streets.objects[streetID].attributes.name;
  8939. }
  8940. }
  8941. if(formatForSegmentPopup === true)
  8942. {
  8943. if(showAsToll == true)
  8944. {
  8945. result += '<i class="fa fa-credit-card"></i> ';
  8946. }
  8947. result += '<b>'+streetName+'</b><br>';
  8948. }
  8949. else
  8950. {
  8951. result += streetName + ', ';
  8952. }
  8953.  
  8954. if(doesStreetIDExist === true)
  8955. {
  8956. let cityName = I18n.lookup('edit.address.no_city');
  8957. let doesCityIDExist = true;
  8958. let cityID = W.model.streets.objects[streetID].attributes.cityID;
  8959. if(W.model.cities.objects[cityID] === undefined)
  8960. {
  8961. cityName = 'non-existent cityID';
  8962. doesCityIDExist = false;
  8963. }
  8964. else
  8965. {
  8966. if(W.model.cities.objects[cityID].attributes.name !== "")
  8967. {
  8968. cityName = W.model.cities.objects[cityID].attributes.name;
  8969. }
  8970. }
  8971. result += cityName + ', ';
  8972.  
  8973. if(doesCityIDExist === true)
  8974. {
  8975. let stateID = W.model.cities.objects[cityID].attributes.stateID;
  8976. if(W.model.states.objects[stateID] === undefined)
  8977. {
  8978. result += 'non-existent stateID';
  8979. }
  8980. else
  8981. {
  8982. result += W.model.states.objects[stateID].attributes.name;
  8983. }
  8984. }
  8985. }
  8986. }
  8987. result += '<br>';
  8988.  
  8989. return result;
  8990. }
  8991. function uroGetSelectedSegmentRTCs(segID)
  8992. {
  8993. let closureTypes = uroEnums.DRTC.NONE;
  8994. let RTCObjs = [];
  8995. let selectedSegs = [];
  8996.  
  8997. if(segID === null)
  8998. {
  8999. // segID should always be set to a valid segment ID if we're being called from the segment mouseover
  9000. // handler, so if it's null it implies we've instead been called from the closure panel handler where
  9001. // we might therefore be dealing with a multi-segment selection...
  9002. selectedSegs = W.selectionManager.getSegmentSelection().segments;
  9003. }
  9004.  
  9005. if((selectedSegs.length > 0) || (segID !== null))
  9006. {
  9007. for(let roadClosure in W.model.roadClosures.objects)
  9008. {
  9009. if(W.model.roadClosures.objects.hasOwnProperty(roadClosure))
  9010. {
  9011. let rcObj = W.model.roadClosures.objects[roadClosure];
  9012. rcObj.segIDs = [rcObj.attributes.segID]; // copy the segID property into an array so we can push extra segIDs into it later...
  9013.  
  9014. // 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
  9015. // into a two-way closure, we can then change the direction value to indicate this as well
  9016. if(rcObj.attributes.forward === true)
  9017. {
  9018. rcObj.direction = uroEnums.DRTC.SEG_AB;
  9019. }
  9020. else
  9021. {
  9022. rcObj.direction = uroEnums.DRTC.SEG_BA;
  9023. }
  9024.  
  9025. // for each of the selected or moused-over segments, find all the closures which have matching segIDs
  9026. if(segID !== null)
  9027. {
  9028. if(rcObj.attributes.segID == segID)
  9029. {
  9030. RTCObjs.push(rcObj);
  9031. }
  9032. }
  9033. else
  9034. {
  9035. for(let i = 0; i < selectedSegs.length; ++i)
  9036. {
  9037. if(rcObj.attributes.segID == selectedSegs[i].attributes.id)
  9038. {
  9039. RTCObjs.push(rcObj);
  9040. break;
  9041. }
  9042. }
  9043. }
  9044. }
  9045. }
  9046.  
  9047. // RTCObjs now contains all of the segment closures relating to all of the segments of interest, so
  9048. // we can begin to organise them such that by the time we exit this function, the array will then contain
  9049. // an optimised list of closures that matches up to the list shown in the closure sidepanel, taking into
  9050. // account closures applying to all segments vs some, closures that can be merged into two-ways etc.
  9051.  
  9052. // first sort the closure by their start date, with a secondary sort by direction for those closures
  9053. // that have the same start date
  9054. RTCObjs = RTCObjs.sort(function(a,b)
  9055. {
  9056. if(a.attributes.startDate === b.attributes.startDate)
  9057. {
  9058. if(a.direction == uroEnums.DRTC.SEG_AB) return -1;
  9059. return 1;
  9060. }
  9061. if(a.attributes.startDate > b.attributes.startDate) return 1;
  9062. return -1;
  9063. });
  9064.  
  9065. // if we've got at least two closures in the sorted list, we then test adjacent list entries
  9066. // to see if they contain closure details which are identical except for their segment IDs, and
  9067. // combine them if so
  9068. if(RTCObjs.length > 1)
  9069. {
  9070. let i = 0;
  9071. while(i < (RTCObjs.length - 1))
  9072. {
  9073. if(
  9074. (RTCObjs[i].attributes.createdBy == RTCObjs[i+1].attributes.createdBy) &&
  9075. (RTCObjs[i].attributes.endDate == RTCObjs[i+1].attributes.endDate) &&
  9076. (RTCObjs[i].attributes.eventId == RTCObjs[i+1].attributes.eventId) &&
  9077. (RTCObjs[i].attributes.location == RTCObjs[i+1].attributes.location) &&
  9078. (RTCObjs[i].attributes.reason == RTCObjs[i+1].attributes.reason) &&
  9079. (RTCObjs[i].attributes.startDate == RTCObjs[i+1].attributes.startDate) &&
  9080. (RTCObjs[i].direction == RTCObjs[i+1].direction)
  9081. )
  9082. {
  9083. RTCObjs[i].segIDs.push(RTCObjs[i+1].attributes.segID);
  9084. RTCObjs.splice(i+1, 1);
  9085. }
  9086. else
  9087. {
  9088. ++i;
  9089. }
  9090. }
  9091. }
  9092.  
  9093. // after that first trimming of the list, if there are still two or more entries then
  9094. // we perform a second pass, this time merging any adjacent entries which have the same
  9095. // segment IDs in their segIDs arrays - these are two-way closures applying to all those
  9096. // segments, and so we also change the direction value to indicate two-way vs A-B or B-A
  9097. if(RTCObjs.length > 1)
  9098. {
  9099. let i = 0;
  9100. while(i < (RTCObjs.length - 1))
  9101. {
  9102. if
  9103. (
  9104. (RTCObjs[i].segIDs.sort().join(',') == RTCObjs[i+1].segIDs.sort().join(',')) &&
  9105. (RTCObjs[i].attributes.createdBy == RTCObjs[i+1].attributes.createdBy) &&
  9106. (RTCObjs[i].attributes.endDate == RTCObjs[i+1].attributes.endDate) &&
  9107. (RTCObjs[i].attributes.eventId == RTCObjs[i+1].attributes.eventId) &&
  9108. (RTCObjs[i].attributes.location == RTCObjs[i+1].attributes.location) &&
  9109. (RTCObjs[i].attributes.reason == RTCObjs[i+1].attributes.reason) &&
  9110. (RTCObjs[i].attributes.startDate == RTCObjs[i+1].attributes.startDate)
  9111. )
  9112. {
  9113. RTCObjs[i].direction = uroEnums.DRTC.SEG_BI;
  9114. RTCObjs.splice(i+1, 1);
  9115. }
  9116. ++i;
  9117. }
  9118. }
  9119. }
  9120.  
  9121. let RTTCObjs = [];
  9122. if(segID !== null)
  9123. {
  9124. // If we've been called from the segment popup handler, we now also check for any turn closures
  9125. // associated with this segment, so that their details can also be shown in the popup...
  9126. for(let turnClosure in W.model.turnClosures.objects)
  9127. {
  9128. if(W.model.turnClosures.objects.hasOwnProperty(turnClosure))
  9129. {
  9130. let tcObj = W.model.turnClosures.objects[turnClosure];
  9131. if(tcObj.attributes.fromSegID === segID)
  9132. {
  9133. tcObj.direction = uroEnums.DRTC.TURN_OUT;
  9134. RTTCObjs.push(tcObj);
  9135. }
  9136. else if(tcObj.attributes.toSegID === segID)
  9137. {
  9138. tcObj.direction = uroEnums.DRTC.TURN_IN;
  9139. RTTCObjs.push(tcObj);
  9140. }
  9141. }
  9142. }
  9143.  
  9144. if(RTTCObjs.length > 1)
  9145. {
  9146. RTTCObjs = RTTCObjs.sort(function(a,b)
  9147. {
  9148. if(a.attributes.startDate === b.attributes.startDate)
  9149. {
  9150. if(a.direction == uroEnums.DRTC.TURN_OUT) return -1;
  9151. return 1;
  9152. }
  9153. if(a.attributes.startDate > b.attributes.startDate) return 1;
  9154. return -1;
  9155. });
  9156. }
  9157. }
  9158.  
  9159. uroRTCObjs = RTCObjs.concat(RTTCObjs);
  9160. for(let i = 0; i < uroRTCObjs.length; ++i)
  9161. {
  9162. closureTypes |= uroRTCObjs[i].direction;
  9163. }
  9164.  
  9165. // the closure list ordering at this point doesn't always match up to the order used by the closures panel when
  9166. // a mixture of "all segment" and "some segment" closures are present - need to work out what ordering rules
  9167. // WME is using here...
  9168. return closureTypes;
  9169. }
  9170. function uroGetLengthString(length)
  9171. {
  9172. let retval = '';
  9173. if(length == null)
  9174. {
  9175. retval = "Default";
  9176. }
  9177. else if(W.model.isImperial == true)
  9178. {
  9179. retval = (length / (12 * 2.54)).toFixed(1) + "ft";
  9180. }
  9181. else
  9182. {
  9183. retval = (length / 100).toFixed(1) + "m";
  9184. }
  9185.  
  9186. return retval;
  9187. }
  9188. function uroGetHighlightedMapFeature()
  9189. {
  9190. let featureID = W.selectionManager.mouseInFeature;
  9191. let retval = null;
  9192.  
  9193. if(featureID !== undefined)
  9194. {
  9195. let isSelected = W.selectionManager.isSelected(featureID);
  9196. if(isSelected === false)
  9197. {
  9198. retval = W.selectionManager.getObjectByFeatureId(featureID);
  9199. }
  9200. }
  9201. return retval;
  9202. }
  9203. function uroGetFeatureRenderIntent(moObj)
  9204. {
  9205. let retval = "unknown";
  9206.  
  9207. if(moObj !== null)
  9208. {
  9209. let isSelected = moObj.selected;
  9210.  
  9211. if(isSelected === true)
  9212. {
  9213. retval = "highlightselected";
  9214. }
  9215. else
  9216. {
  9217. retval = "highlight";
  9218. }
  9219. }
  9220.  
  9221. return retval;
  9222. }
  9223. function uroExclusiveCB()
  9224. {
  9225. let cbChecked = uroUtils.GetCBChecked(this.id);
  9226.  
  9227. if(cbChecked === true)
  9228. {
  9229. let pairedList = this.attributes.pairedWith.value.split(',');
  9230. for(let i=0; i<pairedList.length; i++)
  9231. {
  9232. uroUtils.SetCBChecked(pairedList[i], false);
  9233. }
  9234. }
  9235. }
  9236. function uroContainsPoint(geo, point)
  9237. {
  9238. let retval = false;
  9239. try
  9240. {
  9241. let j = 1;
  9242. for(let i = 0; i < geo.length; ++i)
  9243. {
  9244. if
  9245. (
  9246. ((point[1] >= geo[i][1]) && (point[1] <= geo[j][1])) ||
  9247. ((point[1] >= geo[j][1]) && (point[1] <= geo[i][1]))
  9248. )
  9249. {
  9250. let lx = geo[i][0];
  9251. if(geo[i][1] != geo[j][1])
  9252. {
  9253. let g = ((point[1] - geo[i][1]) / (geo[j][1] - geo[i][1]));
  9254. lx += (g * (geo[j][0] - geo[i][0]));
  9255. }
  9256.  
  9257. if(point[0] <= lx)
  9258. {
  9259. retval = !retval;
  9260. }
  9261. }
  9262. if(++j == geo.length)
  9263. {
  9264. j = 0;
  9265. }
  9266. }
  9267. }
  9268. catch
  9269. {
  9270. }
  9271. return retval;
  9272. }
  9273. function uroGetAMs(e)
  9274. {
  9275. if(uroMTEMode) return;
  9276. if(!uroFilterPreamble) return;
  9277. if(!uroInit.initialised) return;
  9278. if(document.getElementById("uroAMList") == null) return;
  9279. if(document.getElementsByClassName('topbar') == null) return;
  9280.  
  9281. if(uroUtils.GetCBChecked("_cbMoveAMList") === false)
  9282. {
  9283. document.getElementsByClassName('area-managers-region')[0].style.display = "block";
  9284. uroAMList.innerHTML = uroUtils.ModifyHTML("");
  9285. document.getElementsByClassName('topbar')[0].style.backgroundColor=null;
  9286. return;
  9287. }
  9288.  
  9289. document.getElementsByClassName('topbar')[0].style.backgroundColor="#000000";
  9290. document.getElementsByClassName('topbar')[0].style.height="auto";
  9291. document.getElementsByClassName('area-managers-region')[0].style.display = "none";
  9292.  
  9293. let amList = '';
  9294. let tName = '';
  9295. if(W.map.managedAreasLayer.getVisibility() === true)
  9296. {
  9297. let mouseX = e.pageX - document.getElementById('map').getBoundingClientRect().left;
  9298. let mouseY = e.pageY - document.getElementById('map').getBoundingClientRect().top;
  9299. let mousePixel = W.map.getLonLatFromPixel(new OpenLayers.Pixel(mouseX, mouseY));
  9300. let mousePoint = [];
  9301. mousePoint.push(mousePixel.lon);
  9302. mousePoint.push(mousePixel.lat);
  9303.  
  9304. let hideL1Areas = uroUtils.GetCBChecked("_cbHideAMA-L1");
  9305. let hideL2Areas = uroUtils.GetCBChecked("_cbHideAMA-L2");
  9306. let hideL3Areas = uroUtils.GetCBChecked("_cbHideAMA-L3");
  9307. let hideL4Areas = uroUtils.GetCBChecked("_cbHideAMA-L4");
  9308. let hideL5Areas = uroUtils.GetCBChecked("_cbHideAMA-L5");
  9309. let hideL6Areas = uroUtils.GetCBChecked("_cbHideAMA-L6");
  9310. let hideL7Areas = uroUtils.GetCBChecked("_cbHideAMA-L7");
  9311.  
  9312. let hideNewAreas = uroUtils.GetCBChecked("_cbEnableAMAMinAgeFilter");
  9313. let areaMinAge = uroUtils.GetElmValue("_inputFilterAMA-MinDays");
  9314. let hideOldAreas = uroUtils.GetCBChecked("_cbEnableAMAMaxAgeFilter");
  9315. let areaMaxAge = uroUtils.GetElmValue("_inputFilterAMA-MaxDays");
  9316.  
  9317. for(let amObj in W.model.managedAreas.objects)
  9318. {
  9319. let ama = W.model.managedAreas.objects[amObj];
  9320. let userID = ama.attributes.userID;
  9321. let userLevel = uroUtils.GetUserLevelFromID(userID);
  9322.  
  9323. let hideArea = false;
  9324. hideArea = hideArea || ((hideL1Areas === true) && (userLevel === 1));
  9325. hideArea = hideArea || ((hideL2Areas === true) && (userLevel === 2));
  9326. hideArea = hideArea || ((hideL3Areas === true) && (userLevel === 3));
  9327. hideArea = hideArea || ((hideL4Areas === true) && (userLevel === 4));
  9328. hideArea = hideArea || ((hideL5Areas === true) && (userLevel === 5));
  9329. hideArea = hideArea || ((hideL6Areas === true) && (userLevel === 6));
  9330. hideArea = hideArea || ((hideL7Areas === true) && (userLevel === 7));
  9331.  
  9332. if((hideNewAreas === true) || (hideOldAreas === true))
  9333. {
  9334. let amaDaysAgo = uroUtils.DateToDays(ama.attributes.createdOn);
  9335. hideArea = hideArea || ((hideNewAreas === true) && (amaDaysAgo < areaMinAge));
  9336. hideArea = hideArea || ((hideOldAreas === true) && (amaDaysAgo > areaMaxAge));
  9337. }
  9338.  
  9339. if(hideArea === false)
  9340. {
  9341. let nc = ama.attributes.geoJSONGeometry.coordinates.length;
  9342. for(let i = 0; i < nc; ++i)
  9343. {
  9344. let geo = ama.attributes.geoJSONGeometry.coordinates[i];
  9345. if(uroContainsPoint(geo, mousePoint) === true)
  9346. {
  9347. let amName = uroUtils.GetUserNameFromID(ama.attributes.userID);
  9348. if(amList.indexOf(amName) === -1)
  9349. {
  9350. if(amList !== '') amList += ', ';
  9351. tName = uroUtils.GetUserNameAndRank(ama.attributes.userID);
  9352. if(tName.indexOf('a href') !== -1)
  9353. {
  9354. tName = tName.replace('a href', 'a style="color:#c0c0ff;" href');
  9355. }
  9356. amList += tName;
  9357. break;
  9358. }
  9359. }
  9360. }
  9361. }
  9362. }
  9363. if(amList === '')
  9364. {
  9365. amList = 'none';
  9366. }
  9367. amList = "&nbsp;-&nbsp;<b>Area Managers:</b> "+amList;
  9368. }
  9369. document.getElementById("uroAMList").innerHTML = uroUtils.ModifyHTML(amList);
  9370. }
  9371. function uroNewTabAtMouseLoc(x, y)
  9372. {
  9373. let tPix = new OpenLayers.Pixel(x,y);
  9374. let mPos = uroUtils.ConvertMercatorToWGS84(W.map.getLonLatFromPixel(tPix));
  9375. let nZoom = W.map.getZoom();
  9376. if(nZoom < 17) nZoom = 17;
  9377. let nHref = window.location.origin + window.location.pathname;
  9378. nHref += '?lon=' + mPos.lon;
  9379. nHref += '&lat=' + mPos.lat;
  9380. nHref += '&zoomLevel=' + nZoom;
  9381. window.open(nHref);
  9382. }
  9383. function uroMouseDown(e)
  9384. {
  9385. uroMouseIsDown = true;
  9386. if((e.altKey === true) && (e.ctrlKey === true))
  9387. {
  9388. uroNewTabAtMouseLoc(e.offsetX, e.offsetY);
  9389. }
  9390. }
  9391. function uroMouseUp()
  9392. {
  9393. uroMouseIsDown = false;
  9394. }
  9395. function uroTestPointerOutsideMap(mX, mY)
  9396. {
  9397. let mapElm = document.getElementById("map");
  9398. if(mapElm === undefined) return;
  9399. let mapBCR = mapElm.getBoundingClientRect();
  9400.  
  9401. if
  9402. (
  9403. (mX < mapBCR.left) ||
  9404. (mX > mapBCR.right) ||
  9405. (mY < mapBCR.top) ||
  9406. (mY > mapBCR.bottom)
  9407. )
  9408. {
  9409. if(uroUtils.GetCBChecked('_cbKillInertialPanning') === true)
  9410. {
  9411. let controller = null;
  9412. if (W.map.navigationControl)
  9413. {
  9414. controller = W.map.navigationControl;
  9415. }
  9416. else if(W.map.controls.find(control => control.CLASS_NAME == 'OpenLayers.Control.Navigation'))
  9417. {
  9418. controller = W.map.controls.find(control => control.CLASS_NAME == 'OpenLayers.Control.Navigation');
  9419. }
  9420. if (controller !== null)
  9421. {
  9422. controller.dragPan.panMapStart();
  9423. }
  9424. }
  9425. return true;
  9426. }
  9427. else
  9428. {
  9429. return false;
  9430. }
  9431. }
  9432. function uroMouseOut(e)
  9433. {
  9434. if(uroTestPointerOutsideMap(e.clientX, e.clientY))
  9435. {
  9436. uroPopup.Hide();
  9437. }
  9438. }
  9439. function uroUREvent_onObjectsAdded()
  9440. {
  9441. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === true)
  9442. {
  9443. uroUpdateEditorList(W.model.mapUpdateRequests.objects, '_selectURResolverID', false, false, true, false);
  9444. }
  9445. if(uroPopulatingRequestSessions === false)
  9446. {
  9447. uroFilterURs();
  9448. }
  9449. }
  9450. function uroGetSelectedURCommentCount()
  9451. {
  9452. if(W.model.updateRequestSessions.objects[uroSelectedURID] != null)
  9453. {
  9454. let cachedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  9455. uroDBG.AddLog(uroSelectedURID+':'+cachedCommentCount+' '+uroExpectedCommentCount);
  9456.  
  9457. // if there aren't the same number of cached comments as there are comments in the UR dialog list, initiate
  9458. // a refresh of the comment data...
  9459. if(cachedCommentCount != uroExpectedCommentCount)
  9460. {
  9461. if(uroPendingCommentDataRefresh === true)
  9462. {
  9463. if(cachedCommentCount > 0)
  9464. {
  9465. uroCachedLastCommentID = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments[cachedCommentCount-1].id;
  9466. }
  9467. else
  9468. {
  9469. uroCachedLastCommentID = null;
  9470. }
  9471. uroDBG.AddLog('updateRequestSessions refresh required for UR '+uroSelectedURID);
  9472. if(uroCachedLastCommentID !== null)
  9473. {
  9474. uroDBG.AddLog('last comment ID for this UR is '+uroCachedLastCommentID);
  9475. }
  9476. else
  9477. {
  9478. uroDBG.AddLog('first comment for this UR, no previous comment to ID');
  9479. }
  9480. let idList = [];
  9481. idList.push(uroSelectedURID);
  9482. // need to delete the existing cache object first, as .get() is only capable of creating new objects,
  9483. // it doesn't seem able to update an existing object with new data
  9484. W.model.updateRequestSessions.remove(W.model.updateRequestSessions.objects[uroSelectedURID]);
  9485. W.model.updateRequestSessions.getAsync(idList);
  9486.  
  9487. // the call to .get() initiates a XMLHttpRequest for the data, so we now need to switch modes - the
  9488. // refresh process has started so we're no longer pending, but we are now waiting for the XMLHttpRequest
  9489. // to return something...
  9490. uroPendingCommentDataRefresh = false;
  9491. uroWaitingCommentDataRefresh = true;
  9492. }
  9493. else
  9494. {
  9495. if(cachedCommentCount > 0)
  9496. {
  9497. let currentLastCommentID = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments[cachedCommentCount-1].id;
  9498. if(currentLastCommentID == uroCachedLastCommentID)
  9499. {
  9500. // most recent comment loaded for this UR is the same one that was present at the start of this
  9501. // refresh process, so kick back into pending mode so we can retry the .get()...
  9502. uroDBG.AddLog('latest comment ID still the same, reverting to pending mode...');
  9503. uroPendingCommentDataRefresh = true;
  9504. }
  9505. else
  9506. {
  9507. // something may have gone awry here - the most recent comment loaded for this UR doesn't have the
  9508. // same ID as the one present at the start of the refresh process, yet the comment counts still don't
  9509. // match up, which suggests either a comment got lost along the way or someone else has commented on
  9510. // the same UR at almost the same time. To get out of the loop this would create, assume that a
  9511. // mismatch in the IDs means the .get() has completed successfully no matter what the new comment
  9512. // count is, and take this new count to be the count we were expecting all along...
  9513. uroDBG.AddLog('latest comment ID different, but expected count not correct...');
  9514. uroExpectedCommentCount = cachedCommentCount;
  9515. }
  9516. }
  9517. else
  9518. {
  9519. uroDBG.AddLog('first comment on this UR not received yet, reverting to pending mode...');
  9520. uroPendingCommentDataRefresh = true;
  9521. }
  9522. }
  9523.  
  9524. }
  9525. else
  9526. {
  9527. // if the WME session is loaded with a UR already selected, such that WME has opened the UR dialog as part
  9528. // of the session startup process, adding new comments to the UR cause the cached data to be updated immediately.
  9529. // This prevents URO+ from switching into waiting mode in the above block of code, so we have to instead do
  9530. // it here by comparing the cached count against the expected count following the Send click event.
  9531. if(cachedCommentCount >= uroExpectedCommentCount)
  9532. {
  9533. uroPendingCommentDataRefresh = false;
  9534. uroWaitingCommentDataRefresh = true;
  9535. uroExpectedCommentCount = null;
  9536. }
  9537.  
  9538. // once the cached data has been updated, refilter the URs so that the new comment count is taken into account
  9539. // immediately for filtering and display purposes
  9540. if(uroWaitingCommentDataRefresh === true)
  9541. {
  9542. uroWaitingCommentDataRefresh = false;
  9543. uroFilterURs();
  9544. uroDBG.AddLog('refresh complete');
  9545. }
  9546. }
  9547. }
  9548. }
  9549. function uroAddedComment()
  9550. {
  9551. // when the user clicks the Send button to submit a new UR comment, this event handler fires before the new comment is
  9552. // posted to the server and thus also before the comment list gets updated in the UR dialog. So we take the current
  9553. // comment count and, if the new comment edit box isn't empty, increment it by 1 to get the expected count. Then we
  9554. // set the pending flag true to initiate a session refresh on the next 100ms tick
  9555. uroExpectedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  9556. if(document.getElementsByClassName('new-comment-text')[0].value !== '')
  9557. {
  9558. uroExpectedCommentCount++;
  9559. uroDBG.AddLog('new comment added to UR '+uroSelectedURID+', cache refresh required...');
  9560. uroPendingCommentDataRefresh = true;
  9561. }
  9562. else
  9563. {
  9564. uroPendingCommentDataRefresh = false;
  9565. }
  9566. }
  9567. function uroInhibitNextUpdateRequestButton(e)
  9568. {
  9569. e.stopPropagation();
  9570.  
  9571. let doClick = true;
  9572. if(document.getElementsByClassName('form-control new-comment-text').length > 0)
  9573. {
  9574. if(document.getElementsByClassName('form-control new-comment-text')[0].textLength > 0)
  9575. {
  9576. uroAlertBox.Show("fa-warning", "URO+ Warning", "Comment not sent, close report panel anyway?", true, "Yes", "No", uroCloseReportPanel, null);
  9577. // set doClick to false here, as uroCloseReportPanel will be called by the alert box handler if required...
  9578. doClick = false;
  9579. }
  9580. }
  9581. // no alert box has been generated, so close the panel
  9582. if(doClick)
  9583. {
  9584. uroCloseReportPanel();
  9585. }
  9586. }
  9587. function uroCloseReportPanel()
  9588. {
  9589. document.getElementsByClassName('close-panel')[0].click();
  9590. }
  9591. function uroIncrementClosureDate(oldDate, incByDays)
  9592. {
  9593. // Thanks to WME no longer using consistent ISO8601 date formatting when displaying
  9594. // closure details, parsing the date string is now somewhat more involved. Thanks devs...
  9595.  
  9596. // Default to returning the existing date, just in case we can't increment it
  9597. let retval = oldDate;
  9598. let sepChar = null;
  9599.  
  9600. // Search through oldDate for a non-digit character, so we know what's
  9601. // being used to seperate the year, month and date values by this locale...
  9602. for(let i = 0; i < oldDate.length; ++i)
  9603. {
  9604. if((oldDate[i] < '0') || (oldDate[i] > '9'))
  9605. {
  9606. sepChar = oldDate[i];
  9607. break;
  9608. }
  9609. }
  9610.  
  9611. if(sepChar != null)
  9612. {
  9613. // First build a "probe" date object we can use to determine what the user's WME locale
  9614. // does with dates.
  9615. let incDate = new Date();
  9616. incDate.setFullYear(3000);
  9617. incDate.setMonth(10);
  9618. incDate.setDate(22);
  9619.  
  9620. // With these three carefully chosen date elements set, we now generate a localised datestring
  9621. // using the WME locale setting - the first character of which then tells us the date
  9622. // format - 1 = MDY (ack ptui), 2 = DMY (good), 3 = YMD (sweet!)
  9623. let localeDate = incDate.toLocaleDateString(I18n.locale);
  9624. let dateFormat = localeDate[0];
  9625.  
  9626. // Now we know the seperator character and the date format, so we can finally start to parse
  9627. // the existing date string...
  9628. let oldDateBits = oldDate.split(sepChar);
  9629. let datePos;
  9630. let monthPos;
  9631. let yearPos;
  9632. if(dateFormat == '1')
  9633. {
  9634. datePos = 1;
  9635. monthPos = 0;
  9636. yearPos = 2;
  9637. }
  9638. else if(dateFormat == '2')
  9639. {
  9640. datePos = 0;
  9641. monthPos = 1;
  9642. yearPos = 2;
  9643. }
  9644. else
  9645. {
  9646. datePos = 2;
  9647. monthPos = 1;
  9648. yearPos = 0;
  9649. }
  9650. incDate.setFullYear(parseInt(oldDateBits[yearPos]));
  9651. incDate.setMonth(parseInt(oldDateBits[monthPos]) - 1);
  9652. incDate.setDate(parseInt(oldDateBits[datePos]));
  9653. let tDate = new Date(incDate.getTime());
  9654. incDate.setDate(tDate.getDate() + incByDays);
  9655.  
  9656. retval = incDate.toLocaleDateString(I18n.locale);
  9657.  
  9658. // Except for those pesky locales where toLocaleDateString() doesn't *quite*
  9659. // return what WME is expecting. Because, you know, why make it easy for
  9660. // scripters when you can chuck in a few subtle curveballs like this, eh...
  9661.  
  9662. if(I18n.locale == 'bg')
  9663. {
  9664. // Remove the "r." suffix
  9665. retval = retval.split(" ")[0] + " ";
  9666. }
  9667. }
  9668. return retval;
  9669. }
  9670. function uroGetElementProperty(elmName, elmOffset, elmProperty)
  9671. {
  9672. let retval = null;
  9673. if(document.getElementsByName(elmName).length > elmOffset)
  9674. {
  9675. retval = document.getElementsByName(elmName)[elmOffset][elmProperty];
  9676. }
  9677. else if(document.getElementById(elmName) !== null)
  9678. {
  9679. retval = document.getElementById(elmName)[elmProperty];
  9680. }
  9681. return retval;
  9682. }
  9683. function uroGetShadowElementProperty(elmName, shadowElmType, property)
  9684. {
  9685. let retval = null;
  9686. let tObj = document.getElementById(elmName);
  9687. if(tObj !== null)
  9688. {
  9689. let sObj = tObj.shadowRoot.querySelector(shadowElmType);
  9690. if(sObj !== null)
  9691. {
  9692. retval = sObj[property];
  9693. }
  9694. }
  9695. return retval;
  9696. }
  9697. let rtcTotal = null;
  9698. let rtcSegIDs = null;
  9699. function uroScrollToEndOfClosures()
  9700. {
  9701. let cItems = document.querySelectorAll('.closure-item');
  9702. let nClosures = cItems.length;
  9703. let segIDs = uroUtils.GetSelectedSegmentIDs();
  9704. let sameSegs = false;
  9705. if((segIDs !== null) && (rtcSegIDs !== null))
  9706. {
  9707. if(segIDs.length == rtcSegIDs.length)
  9708. {
  9709. sameSegs = true;
  9710. for(let i = 0; i < segIDs.length; ++i)
  9711. {
  9712. if(segIDs[i] != rtcSegIDs[i])
  9713. {
  9714. sameSegs = false;
  9715. break;
  9716. }
  9717. }
  9718. }
  9719. }
  9720. if(sameSegs === false)
  9721. {
  9722. rtcTotal = null;
  9723. rtcSegIDs = segIDs;
  9724. }
  9725. if(nClosures > rtcTotal)
  9726. {
  9727. if(cItems[0].getBoundingClientRect().height != 0)
  9728. {
  9729. rtcTotal = nClosures;
  9730. if(uroUtils.GetCBChecked('_cbAutoScrollClosureList') == true)
  9731. {
  9732. // Scroll to the end of the closure tab, as that's where the closure you're most likely to be cloning
  9733. // is located...
  9734. cItems[cItems.length - 1].scrollIntoView();
  9735. }
  9736. }
  9737. }
  9738. }
  9739. function uroClosureEditUIChanged()
  9740. {
  9741. if(document.getElementsByClassName('edit-closure').length === 1)
  9742. {
  9743. // note: this also fires when the UI is closed, due to the change events triggered as its elements are removed
  9744. // prior to the tab itself closing...
  9745.  
  9746. let notReady = 0;
  9747. let mteDropDown = document.getElementById('closure_eventId');
  9748. if(document.getElementById('closure_reason').shadowRoot.querySelector('input') === null) notReady += 1;
  9749. if(document.getElementById('closure_direction').shadowRoot.querySelector('.selected-value') === null) notReady += 2;
  9750. else if(document.getElementById('closure_direction').shadowRoot.querySelector('.selected-value').innerText === "") notReady += 4;
  9751. if(document.getElementById('closure_startDate') === null) notReady += 8;
  9752. if(document.getElementById('closure_endDate') === null) notReady += 16;
  9753. if(mteDropDown.shadowRoot.querySelector('.selected-value') === null) notReady += 32;
  9754. else if(mteDropDown.shadowRoot.querySelector('.selected-value').innerText === "") notReady += 64;
  9755. if(document.getElementById('closure_permanent').shadowRoot.querySelector('.wz-checkbox') === null) notReady += 128;
  9756. if(notReady === 0)
  9757. {
  9758. if(uroRTCClone.PendingClone === -3)
  9759. {
  9760. uroRTCClone.Complete();
  9761. }
  9762. else if(uroRTCClone.PendingClone !== -1)
  9763. {
  9764. uroRTCClone.Copy();
  9765. }
  9766. else
  9767. {
  9768. uroFixMTEDropDown(mteDropDown);
  9769. }
  9770. }
  9771. }
  9772. else
  9773. {
  9774. if(uroRTCClone.PendingClone === -2)
  9775. {
  9776. // generate a click event on the Add a closure button to open up the closure editing UI, then
  9777. // wait for the UI to finish opening...
  9778. document.getElementsByClassName('add-closure-button')[0].click();
  9779. uroRTCClone.PendingClone = -3;
  9780. }
  9781. uroClosureListHandler();
  9782. }
  9783. }
  9784. function uroTSTPopupHandler()
  9785. {
  9786. if(document.getElementsByClassName('panel')[0] === undefined)
  9787. {
  9788. uroHidePopupOnPanelOpen = true;
  9789. }
  9790.  
  9791. if(uroPopup.shown === true)
  9792. {
  9793. let hidePopup = false;
  9794.  
  9795. if(document.getElementsByClassName('panel')[0] != null)
  9796. {
  9797. if(uroHidePopupOnPanelOpen === true)
  9798. {
  9799. hidePopup = true;
  9800. uroHidePopupOnPanelOpen = false;
  9801. }
  9802. }
  9803.  
  9804. if(hidePopup === true)
  9805. {
  9806. uroPopup.Hide();
  9807. }
  9808. }
  9809.  
  9810. if((uroAFN.hoverObj !== null) && (uroAFN.hoverTime != -1) && (uroAFN.overlayShown === false))
  9811. {
  9812. if(++uroAFN.hoverTime > 5)
  9813. {
  9814. uroAFN.OverlaySetup();
  9815. }
  9816. }
  9817. uroAFN.ReplaceAreaNames(false);
  9818.  
  9819. if(uroPopup.autoHideTimer > 0)
  9820. {
  9821. if(--uroPopup.autoHideTimer === 0)
  9822. {
  9823. uroPopup.Hide();
  9824. }
  9825. }
  9826.  
  9827. if(uroPopup.timer > 0)
  9828. {
  9829. if(uroPopup.mouseIn === false)
  9830. {
  9831. uroPopup.timer--;
  9832. }
  9833. }
  9834. if(uroPopup.timer === 0)
  9835. {
  9836. uroPopup.Hide();
  9837. }
  9838. }
  9839. function uroTSTNextBtnHandler()
  9840. {
  9841. // replaces the "next xxx" button on UR, MP and PUR editing UIs
  9842.  
  9843. // Correctly determining what WME is displaying for the "next" button in the UR/MP/(P)PUR panel is not trivial due to
  9844. // inconsistencies in the panel behaviour depending on whether it was opened by clicking directly on the relevant
  9845. // marker, or by clicking on the associated feed entry... For PURs, there's also the added complication of multi-part
  9846. // update requests, where the same marker/panel are used to access more than one request and where, therefore, we need
  9847. // to enable access to all requests contained within the PUR, but still inhibit the "next" button once the last
  9848. // request in the multi-part sequence has been viewed.
  9849. //
  9850. // For directly-accesed markers, the "next" button caption is:
  9851. //
  9852. // URs = "Next update request" (update_requests.panel.next)
  9853. // MPs = "Next map problem" (problems.panel.next)
  9854. // PURs = "Next place" for single-part PURs or for the last part of a multi-part PUR (venues.update_requests.panel.next_venue)
  9855. // = "Next" for all but the last part of a multi-part PUR (venues.update_requests.panel.next)
  9856. // PPURs = "Next place" (venues.update_requests.panel.next_venue)
  9857. //
  9858. // For markers accessed via the feed, the "next" button caption always appears to be "Next issue" (feed.issues.next)
  9859.  
  9860.  
  9861.  
  9862. let reportPanel = document.querySelector('#panel-container');
  9863.  
  9864. if(reportPanel.childElementCount > 0)
  9865. {
  9866. let nurButton = reportPanel.getElementsByClassName('next')[0];
  9867. if(nurButton === undefined)
  9868. {
  9869. nurButton = reportPanel.getElementsByClassName('next-venue')[0];
  9870. }
  9871. if(nurButton !== undefined)
  9872. {
  9873. let doneString = I18n.lookup('problems.panel.done');
  9874. let btnCaptionIsNextPlace = (nurButton.innerHTML.indexOf(I18n.lookup('venues.update_requests.panel.next_venue')) !== -1);
  9875. let btnCaptionIsDefaultUR = (nurButton.innerHTML.indexOf(I18n.lookup('update_requests.panel.next')) !== -1);
  9876. let btnCaptionIsDefaultMP = (nurButton.innerHTML.indexOf(I18n.lookup('problems.panel.next')) !== -1);
  9877. let btnCaptionIsNextIssue = (nurButton.innerHTML.indexOf(I18n.lookup('feed.issues.next')) !== -1);
  9878.  
  9879. let updateButton = false;
  9880.  
  9881. let panelClass = reportPanel.childNodes[0].childNodes[0].className;
  9882. let isURorMPPanel = (panelClass.indexOf('problem-edit') !== -1);
  9883. let isPURPanel = (panelClass.indexOf('place-update') !== -1);
  9884.  
  9885. if(isURorMPPanel === true)
  9886. {
  9887. // user has enabled UR button mod?
  9888. if(uroUtils.GetCBChecked('_cbInhibitNURButton') === true)
  9889. {
  9890. // the native UR panel button will always either be "Next update request" or "Next issue"
  9891. updateButton = ((btnCaptionIsDefaultUR) || (btnCaptionIsNextIssue));
  9892. }
  9893.  
  9894. // user has enabled MP button mod?
  9895. if(uroUtils.GetCBChecked('_cbInhibitNMPButton') === true)
  9896. {
  9897. // there's no way to determine if the edit panel has been opened for a UR or a MP, however as MPs
  9898. // don't currently appear in the feed, the native button only uses "Next map problem" as its caption
  9899. updateButton = (updateButton || btnCaptionIsDefaultMP);
  9900. }
  9901. }
  9902. else if(isPURPanel === true)
  9903. {
  9904. if(uroUtils.GetCBChecked('_cbInhibitNPURButton') === true)
  9905. {
  9906. // for a (P)PUR, only modify the button if it's showing the "Next place" or "Next issue" caption, to
  9907. // avoid messing up the "Next" button used to move to the next part of a multi-part PUR...
  9908. updateButton = ((btnCaptionIsNextPlace === true) || (btnCaptionIsNextIssue));
  9909. }
  9910. }
  9911.  
  9912. if(updateButton === true)
  9913. {
  9914. uroDBG.AddLog('inhibit Next UR/MP/PUR button');
  9915.  
  9916. // alter the button caption
  9917. nurButton.innerHTML = uroUtils.ModifyHTML(doneString);
  9918. // 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
  9919. // moving to the next UR/MP/PUR, and also allows us to warn about closing the UR panel if there's an unsent comment...
  9920. nurButton.addEventListener("click", uroInhibitNextUpdateRequestButton, false);
  9921. }
  9922. }
  9923. uroInhibitURFiltering = false;
  9924. }
  9925. }
  9926. function uroTSTCommentAddedHandler()
  9927. {
  9928. // test for the opening or closing of the UR editing dialog so we can detect when a new comment is added
  9929. let URDialogIsOpen = false;
  9930. let panelOpen = (document.getElementById('panel-container').firstChild !== null);
  9931.  
  9932. if(panelOpen)
  9933. {
  9934. URDialogIsOpen = (document.getElementById('panel-container').getElementsByClassName('conversation').length > 0);
  9935. }
  9936.  
  9937. if(URDialogIsOpen)
  9938. {
  9939. let thisSelectedURID = document.getElementsByClassName('permalink')[0].href.split('&mapUpdateRequest=');
  9940. if(thisSelectedURID.length > 1)
  9941. {
  9942. thisSelectedURID = thisSelectedURID[1].split('&')[0];
  9943. }
  9944. else
  9945. {
  9946. thisSelectedURID = null;
  9947. }
  9948.  
  9949. if((thisSelectedURID != uroSelectedURID) || ((thisSelectedURID != uroMarkers.clickedOnID) && (uroMarkers.clickedOnID != null)))
  9950. {
  9951. // if the user selects a new UR whilst the editing dialog is still open, treat it in the
  9952. // same way as if the user had selected that UR with the dialog closed
  9953. uroURDialogIsOpen = false;
  9954. uroSelectedURID = null;
  9955. }
  9956.  
  9957. if(((uroURDialogIsOpen === false) && (uroSelectedURID === null)) || (uroURReclickAttempts > 0))
  9958. {
  9959. // user is editing a new UR
  9960.  
  9961. // add our own click event handler to the Send button, so we can do stuff whenever a new comment is added
  9962. if(document.getElementsByClassName('new-comment-form').length > 0)
  9963. {
  9964. if(document.getElementsByClassName('new-comment-form')[0].getElementsByClassName('send-button').length > 0)
  9965. {
  9966. document.getElementsByClassName('new-comment-form')[0].getElementsByClassName('send-button')[0].addEventListener("click", uroAddedComment, false);
  9967.  
  9968. uroSelectedURID = thisSelectedURID;
  9969. uroDBG.AddLog('user is editing UR '+uroSelectedURID);
  9970. uroExpectedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  9971.  
  9972. if((uroHoveredURID !== null) && (uroSelectedURID !== null) && (parseInt(uroHoveredURID) !== parseInt(uroSelectedURID)))
  9973. {
  9974. if(uroURReclickAttempts === 0)
  9975. {
  9976. 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...');
  9977. }
  9978. if(++uroURReclickAttempts < 3)
  9979. {
  9980. //uroRestackMarkers();
  9981. let urMarker = uroGetMarker(uroLayers.ID.UR,uroHoveredURID);
  9982. if(urMarker !== null)
  9983. {
  9984. let urMarkerAttributes = uroGetAttributes(uroLayers.ID.UR, uroHoveredURID);
  9985. if(urMarkerAttributes !== null)
  9986. {
  9987. urMarkerAttributes.geometry.x = urMarkerAttributes.geometry.realX;
  9988. urMarkerAttributes.geometry.y = urMarkerAttributes.geometry.realY;
  9989. uroOpenURDialog(uroHoveredURID);
  9990. }
  9991. }
  9992. return;
  9993. }
  9994. else
  9995. {
  9996. uroDBG.AddLog('Woe is me, attempting to open UR ID '+uroHoveredURID+' has failed...');
  9997. 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);
  9998. }
  9999. }
  10000. uroURReclickAttempts = 0;
  10001. uroFilterURs();
  10002. }
  10003. }
  10004. }
  10005. }
  10006. else if(uroURDialogIsOpen === true)
  10007. {
  10008. // dialog was open and has now been closed
  10009. uroSelectedURID = null;
  10010. uroMarkers.clickedOnID = null;
  10011. uroFilterURs();
  10012. }
  10013. uroURDialogIsOpen = URDialogIsOpen;
  10014.  
  10015. if(((uroPendingCommentDataRefresh === true) || (uroWaitingCommentDataRefresh === true)) && (uroSelectedURID !== null))
  10016. {
  10017. uroDBG.AddLog('check completion of comment data refresh for UR '+uroSelectedURID+' ('+uroPendingCommentDataRefresh+','+uroWaitingCommentDataRefresh+')');
  10018. uroGetSelectedURCommentCount();
  10019. }
  10020.  
  10021. }
  10022. function uroClosureListHandler()
  10023. {
  10024. // Handles adjustments to the closure list in the sidepanel...
  10025. //
  10026. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  10027. {
  10028. return;
  10029. }
  10030.  
  10031. // List entry filtering
  10032. let nEntries = document.querySelectorAll('.closure-item').length;
  10033. if(nEntries > 0)
  10034. {
  10035. let filterExpired = uroUtils.GetCBChecked('_cbHideExpiredSidepanelRTCs');
  10036. let filterCurrent = uroUtils.GetCBChecked('_cbHideSidepanelRTCs');
  10037. let filterFuture = uroUtils.GetCBChecked('_cbHideFutureSidepanelRTCs');
  10038. let filterUnknown = uroUtils.GetCBChecked('_cbHideUnknownSidepanelRTCs');
  10039. for(let i = 0; i < nEntries; ++i)
  10040. {
  10041. let hide = false;
  10042. let cElm = document.querySelectorAll('.closure-item')[i];
  10043. let ciSrc = cElm.querySelector('img')?.src;
  10044. if(ciSrc != undefined)
  10045. {
  10046. hide |= ((ciSrc.indexOf('finished') != -1) && (filterExpired == true));
  10047. hide |= ((ciSrc.indexOf('active') != -1) && (filterCurrent == true));
  10048. hide |= ((ciSrc.indexOf('not-started') != -1) && (filterFuture == true));
  10049. hide |= ((ciSrc === "") && (filterUnknown == true));
  10050. }
  10051.  
  10052. if(hide == true)
  10053. {
  10054. cElm.style.display = "none";
  10055. }
  10056. else
  10057. {
  10058. cElm.style.display = "block";
  10059. }
  10060. }
  10061. }
  10062.  
  10063. // Closure cloning controls
  10064. if((document.querySelectorAll('.closures-list').length > 0) && (document.querySelector('.closures-list').getAttribute('touchedbyuro') === null))
  10065. {
  10066. let nClosures;
  10067. let cLoop;
  10068. let btnElm;
  10069.  
  10070. // Cloning doesn't work with certain locales due to the way the date strings are formatted...
  10071. if
  10072. (
  10073. (I18n.locale == "fa-IR") ||
  10074. (I18n.locale == 'ar') ||
  10075. (I18n.locale == 'zh') ||
  10076. (I18n.locale == 'ko')
  10077. )
  10078. {
  10079. // Sorry :-(
  10080. }
  10081. else
  10082. {
  10083. // for the others, are there any closures defined for all of the selected segment(s)...
  10084. if(document.getElementsByClassName('full-closures').length > 0)
  10085. {
  10086. nClosures = document.getElementsByClassName('full-closures')[0].querySelectorAll('.closure-item.is-editable').length;
  10087. if(nClosures > 0)
  10088. {
  10089. // Force a refresh of uroRTCObjs for the selected segment, as this is no longer guaranteed to have already occurred...
  10090. let selectedSegIDs = uroUtils.GetSelectedSegmentIDs();
  10091. if(selectedSegIDs.length > 0)
  10092. {
  10093. uroGetSelectedSegmentRTCs(selectedSegIDs[0]);
  10094.  
  10095. // and if so, have we already added the clone icon?
  10096. for(cLoop = 0; cLoop < nClosures; cLoop++)
  10097. {
  10098. btnElm = document.getElementsByClassName('full-closures')[0].querySelectorAll('.closure-item.is-editable')[cLoop].getElementsByClassName('closure-title')[0];
  10099. if((btnElm.innerHTML.indexOf('_uroCloneClosure-') == -1) && (uroGetRTCOrigin(uroRTCObjs[cLoop]) !== uroEnums.TRTC.UNKNOWN))
  10100. {
  10101. let newNode = document.createElement("div");
  10102. let anchorID1 = '_uroCloneClosure-1-'+cLoop;
  10103. let anchorID2 = '_uroCloneClosure-7-'+cLoop;
  10104. let newAnchor = '<a id="'+anchorID1+'" href="#">';
  10105. newAnchor += "<i style='font-size: 150%; cursor: copy' class='fa fa-copy'></i>";
  10106. newAnchor += "</a><sup>+1</sup>&nbsp;";
  10107. newAnchor += '<a id="'+anchorID2+'" href="#">';
  10108. newAnchor += "<i style='font-size: 150%; cursor: copy' class='fa fa-copy'></i>";
  10109. newAnchor += "</a><sup>+7</sup>";
  10110. newNode.innerHTML = uroUtils.ModifyHTML(newAnchor);
  10111. btnElm.prepend(newNode);
  10112. uroUtils.AddEventListener(anchorID1,"click",uroRTCClone.Clone,false);
  10113. uroUtils.AddEventListener(anchorID2,"click",uroRTCClone.Clone,false);
  10114.  
  10115. let chipElm = btnElm.querySelector("wz-image-chip");
  10116. chipElm.innerHTML = chipElm.innerHTML.split('>')[0] + '>';
  10117. }
  10118. }
  10119. }
  10120. }
  10121. }
  10122. }
  10123.  
  10124. // if there's more than one closure (full or partial) listed, also add the delete all button if not already present
  10125. nClosures = document.querySelectorAll('.closure-item.is-editable').length;
  10126. if(nClosures > 0)
  10127. {
  10128. if(document.getElementById('_btnDeleteAllClosures') === null)
  10129. {
  10130. let daDiv = document.createElement('wz-button');
  10131. daDiv.className = 'delete-all-button btn is-expanded'; //btn-primary';
  10132. daDiv.id = '_btnDeleteAllClosures';
  10133.  
  10134. let tHTML = '<i class="fa fa-trash"></i> '+I18n.lookup("closures.delete_confirm_no_reason");
  10135. if(nClosures > 1)
  10136. {
  10137. tHTML += ' ('+I18n.lookup("closures.apply_to_all")+')';
  10138. }
  10139. daDiv.innerHTML = uroUtils.ModifyHTML(tHTML);
  10140. daDiv.style.width = '100%';
  10141. daDiv.style.marginBottom = '10px';
  10142.  
  10143. let acBtn = document.getElementsByClassName('add-closure-button')[0];
  10144. if(acBtn !== undefined)
  10145. {
  10146. acBtn.parentNode.insertBefore(daDiv, acBtn.nextSibling);
  10147. uroUtils.AddEventListener('_btnDeleteAllClosures',"click", uroRTCClone.DeleteAll, false);
  10148. }
  10149. }
  10150. }
  10151.  
  10152. document.querySelector('.closures-list').setAttribute('touchedbyuro','true');
  10153. }
  10154. }
  10155. function uroMiscUITweaksHandler()
  10156. {
  10157. if(uroFilterPreamble())
  10158. {
  10159. // clickifies the ExtraInfo URL present in some MPs
  10160. {
  10161. if(document.getElementById('panel-container').getElementsByClassName('extraInfo').length > 0)
  10162. {
  10163. if(document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].touchedByURO === undefined)
  10164. {
  10165. let tDesc = document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].innerHTML;
  10166. tDesc = uroUtils.Clickify(tDesc, '');
  10167. document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].innerHTML = uroUtils.ModifyHTML(tDesc);
  10168. document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].touchedByURO = true;
  10169. }
  10170. }
  10171. }
  10172. }
  10173. }
  10174. function uroMainTick()
  10175. {
  10176. if(uroMTEMode) return;
  10177. if(uroInit.setupListeners)
  10178. {
  10179. if(uroInit.finalisingListenerSetup === false)
  10180. {
  10181. if(W.loginManager.isLoggedIn())
  10182. {
  10183. if(document.getElementsByClassName('topbar').length === 0) return;
  10184. uroInit.FinalizeListenerSetup();
  10185. document.getElementsByClassName('topbar')[0].appendChild(uroAMList);
  10186. }
  10187. }
  10188. }
  10189. else
  10190. {
  10191. if(uroUtils.GetCBChecked('_cbMasterEnable') === true)
  10192. {
  10193. // do one maintick handler call in each 10ms cycle to minimise the time stuck within the maintick handler without
  10194. // unduly affecting the overall response time for each individual handler
  10195.  
  10196. if(uroMainTickStage === 0) uroTSTPopupHandler();
  10197. if(uroMainTickStage == 1) uroTSTNextBtnHandler();
  10198. if(uroMainTickStage == 2) uroTSTCommentAddedHandler();
  10199. if(uroMainTickStage == 4) uroMiscUITweaksHandler();
  10200.  
  10201. if(++uroMainTickStage == 6) uroMainTickStage = 0;
  10202. }
  10203. }
  10204. }
  10205. function uroNewLookCheckDetailsRequest()
  10206. {
  10207. let thisurl = document.location.href;
  10208. let doRetry = true;
  10209. let urID;
  10210. let endmarkerpos = thisurl.indexOf('&endshow');
  10211. let showmarkerpos = thisurl.indexOf('&showturn=');
  10212.  
  10213. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10214. {
  10215. showmarkerpos += 10;
  10216. uroDBG.AddLog('showturn tab opened');
  10217. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10218. uroDBG.AddLog(' turn problem ID = '+urID);
  10219.  
  10220. try
  10221. {
  10222. uroGetMarker(uroLayers.ID.MP,urID).element.click();
  10223. doRetry = false;
  10224. }
  10225. catch(err)
  10226. {
  10227. uroDBG.AddLog('problems not fully loaded, retrying...');
  10228. }
  10229.  
  10230. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10231. }
  10232. else
  10233. {
  10234. showmarkerpos = thisurl.indexOf('&showpur=');
  10235. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10236. {
  10237. showmarkerpos += 9;
  10238. uroDBG.AddLog('showPUR tab opened');
  10239. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10240. uroDBG.AddLog(' PUR ID = '+urID);
  10241.  
  10242. try
  10243. {
  10244. uroGetMarker(uroLayers.ID.PUR, urID).element.click();
  10245. doRetry = false;
  10246. }
  10247. catch(err)
  10248. {
  10249. uroDBG.AddLog('PURs not fully loaded, retrying...');
  10250. }
  10251.  
  10252. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10253. }
  10254.  
  10255. else
  10256. {
  10257. showmarkerpos = thisurl.indexOf('&showppur=');
  10258. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10259. {
  10260. showmarkerpos += 10;
  10261. uroDBG.AddLog('showPPUR tab opened');
  10262. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10263. uroDBG.AddLog(' PPUR ID = '+urID);
  10264.  
  10265. try
  10266. {
  10267. uroGetMarker(uroLayers.ID.PPUR, urID).element.click();
  10268. doRetry = false;
  10269. }
  10270. catch(err)
  10271. {
  10272. uroDBG.AddLog('PPURs not fully loaded, retrying...');
  10273. }
  10274.  
  10275. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10276. }
  10277. }
  10278. }
  10279.  
  10280. }
  10281. function uroUpdateVenueEditorLists()
  10282. {
  10283. if(Object.keys(W.model.venues.objects).length === 0) return;
  10284.  
  10285. // build the list of all userIDs contained in the currently loaded venue objects
  10286. let selectedIdx = null;
  10287. let listedIDs = [];
  10288. let idx;
  10289. for(idx in W.model.venues.objects)
  10290. {
  10291. if(W.model.venues.objects.hasOwnProperty(idx))
  10292. {
  10293. let obj = W.model.venues.objects[idx].attributes;
  10294. let cbID = obj.createdBy;
  10295. let ubID = obj.updatedBy;
  10296.  
  10297. if((cbID !== null) && (listedIDs.indexOf(cbID) == -1))
  10298. {
  10299. listedIDs.push(cbID);
  10300. }
  10301. if((ubID !== null) && (ubID !== cbID) && (listedIDs.indexOf(ubID) == -1))
  10302. {
  10303. listedIDs.push(ubID);
  10304. }
  10305. }
  10306. }
  10307.  
  10308. // check for any previously selected userIDs in the two selector lists, then clear both lists
  10309. // and repopulate using the newly gathered ID collection from above, and finally reselect the
  10310. // previously selected user if they're still present in the new list...
  10311. let selector;
  10312. let selectedUser;
  10313. let users = W.model.users.getByIds(listedIDs);
  10314. let selectorEntry;
  10315.  
  10316. for(let i=0; i<2; i++)
  10317. {
  10318. if(i === 0) selector = document.getElementById('_selectPlacesUserID');
  10319. else selector = document.getElementById('_selectHidePlacesUserID');
  10320.  
  10321. selectedUser = null;
  10322. if(selector.selectedOptions[0] != null)
  10323. {
  10324. selectedUser = parseInt(selector.selectedOptions[0].value);
  10325. }
  10326. while(selector.options.length > 0)
  10327. {
  10328. selector.options.remove(0);
  10329. }
  10330. selector.options.add(new Option('<select a user>', null));
  10331. if(listedIDs.length > 0)
  10332. {
  10333. selectorEntry = '';
  10334. for(idx=0; idx<users.length; idx++)
  10335. {
  10336. if(users[idx].attributes.userName === undefined)
  10337. {
  10338. selectorEntry = users[idx].attributes.id;
  10339. }
  10340. else
  10341. {
  10342. selectorEntry = users[idx].attributes.userName;
  10343. }
  10344. selector.options.add(new Option(selectorEntry, users[idx].id));
  10345. if(users[idx].attributes.id == selectedUser)
  10346. {
  10347. selectedIdx = idx+1;
  10348. }
  10349. }
  10350. }
  10351.  
  10352. if(selectedIdx !== null)
  10353. {
  10354. selector.selectedIndex = selectedIdx;
  10355. }
  10356. }
  10357. }
  10358. function uroPlacesEditorSelected()
  10359. {
  10360. let selector = document.getElementById('_selectPlacesUserID');
  10361. if(selector.selectedIndex > 0)
  10362. {
  10363. document.getElementById('_textPlacesEditor').value = document.getElementById('_selectPlacesUserID').selectedOptions[0].innerHTML;
  10364. }
  10365. }
  10366. function uroHidePlacesEditorSelected()
  10367. {
  10368. let selector = document.getElementById('_selectHidePlacesUserID');
  10369. if(selector.selectedIndex > 0)
  10370. {
  10371. document.getElementById('_textHidePlacesEditor').value = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].innerHTML;
  10372. }
  10373. }
  10374. function uroCamEditorSelected()
  10375. {
  10376. let selector = document.getElementById('_selectCameraUserID');
  10377. if(selector.selectedIndex > 0)
  10378. {
  10379. document.getElementById('_textCameraEditor').value = document.getElementById('_selectCameraUserID').selectedOptions[0].innerHTML;
  10380. }
  10381. }
  10382. function uroSetStyles(obj)
  10383. {
  10384. obj.style.fontSize = '12px';
  10385. obj.style.lineHeight = '100%';
  10386. obj.style.flex = '1';
  10387. obj.style.overflowY = 'auto';
  10388. }
  10389. function uroSetSectionTabStyles()
  10390. {
  10391. for(let i =0; i < uroTabs.CtrlTabs.length; ++i)
  10392. {
  10393. uroSetStyles(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  10394. }
  10395. }
  10396. function uroPlacesGroupCEHandler(groupidx)
  10397. {
  10398. if(uroPlacesGroupsCollapsed[groupidx] === false)
  10399. {
  10400. document.getElementById('_uroPlacesGroup-'+groupidx).style.display = "block";
  10401. document.getElementById('_uroPlacesGroupState-'+groupidx).className = "fa fa-minus-square-o";
  10402. }
  10403. else
  10404. {
  10405. document.getElementById('_uroPlacesGroup-'+groupidx).style.display = "none";
  10406. document.getElementById('_uroPlacesGroupState-'+groupidx).className = "fa fa-plus-square-o";
  10407. }
  10408. }
  10409. function uroPlacesGroupCollapseExpand()
  10410. {
  10411. let groupidx = this.id.substr(21);
  10412. if(uroPlacesGroupsCollapsed[groupidx] === true) uroPlacesGroupsCollapsed[groupidx] = false;
  10413. else uroPlacesGroupsCollapsed[groupidx] = true;
  10414. uroPlacesGroupCEHandler(groupidx);
  10415. return false;
  10416. }
  10417. function uroGetMarkerIDs(markerType)
  10418. {
  10419. let idList = [];
  10420.  
  10421. if(uroLayers.layers[markerType].mf !== null)
  10422. {
  10423. // Refresh .mf, as this is no longer guaranteed to have been set up as a reference to
  10424. // whatever's in the current W.map.layers object...
  10425. uroLayers.layers[markerType].mf = uroLayers.GetMarkersOrFeatures(markerType);
  10426. for(let i = 0; i < uroLayers.layers[markerType].mf.length; ++i)
  10427. {
  10428. let dID = uroLayers.layers[markerType].mf[i]?.element?.attributes['data-id']?.value;
  10429. if(dID === undefined)
  10430. {
  10431. dID = uroLayers.layers[markerType].mf[i]?.attributes?.wazeFeature?.id;
  10432. }
  10433. if(dID !== undefined)
  10434. {
  10435. idList.push(dID);
  10436. }
  10437. }
  10438. }
  10439. return idList;
  10440. }
  10441. function uroGetAttributes(markerType, markerID)
  10442. {
  10443. if(markerType == uroLayers.ID.UR) return W.model.mapUpdateRequests.objects[markerID].attributes;
  10444. if(markerType == uroLayers.ID.MP) return W.model.mapProblems.objects[markerID].attributes;
  10445. return null;
  10446. }
  10447. function uroGetMarker(markerType, markerID)
  10448. {
  10449. if(typeof(markerID) === 'number')
  10450. {
  10451. markerID = markerID.toString();
  10452. }
  10453.  
  10454. let retval = null;
  10455.  
  10456. if(markerID !== null)
  10457. {
  10458. let mObj = null;
  10459. if(markerType === uroLayers.ID.UR)
  10460. {
  10461. mObj = W.model.mapUpdateRequests.getObjectById(markerID);
  10462. }
  10463. else if(markerType === uroLayers.ID.MP)
  10464. {
  10465. mObj = W.model.mapProblems.getObjectById(markerID);
  10466. }
  10467. else if(markerType === uroLayers.ID.RTC)
  10468. {
  10469. mObj = W.model.roadClosures.getObjectById(markerID);
  10470. }
  10471.  
  10472. if(mObj !== null)
  10473. {
  10474. retval = W.userscripts.getMapElementByDataModel(mObj);
  10475. }
  10476. else
  10477. {
  10478. for(let i = 0; i < uroLayers.layers[markerType].mf.length; ++i)
  10479. {
  10480. if(uroLayers.layers[markerType].mf[i]?.attributes?.wazeFeature?.id === markerID)
  10481. {
  10482. let geoID = uroLayers.layers[markerType].mf[i].geometry.id;
  10483. retval = document.getElementById(geoID);
  10484. break;
  10485. }
  10486. }
  10487. }
  10488. }
  10489. return retval;
  10490. }
  10491.  
  10492. uroInit.Initialise();