UROverview Plus (URO+)

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

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

  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.12
  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.12",
  43. date : "20250223",
  44. changes :
  45. [
  46. "Compatibility update"
  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/Y7ux4zK5Wfz6T8O4R3G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cj4KICAgPHBsdXM6SW1hZ2VDcmVhdG9yPgogICAgPHJkZjpTZXEvPgogICA8L3BsdXM6SW1hZ2VDcmVhdG9yPgogICA8cGx1czpDb3B5cmlnaHRPd25lcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkNvcHlyaWdodE93bmVyPgogICA8cGx1czpMaWNlbnNvcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkxpY2Vuc29yPgogIDwvcmRmOkRlc2NyaXB0aW9uPgogPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgIAo8P3hwYWNrZXQgZW5kPSJ3Ij8+txeqYAAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAd0SU1FB+IDAw8pAmNZfO0AAA7kSURBVHja1Zx5kB1FHcc/8459b+9N2GSPhBiBBAQBBeVSI4GEoFQFSIASj+CRshDFQstAgXiiJcT7SLQKUVkQhOIIRVFA1gSSYCFHAgIakFSwSNjdhGU3yR7v7b43M/7Rr/N6erpn3stuTJyqrp7p6Zk3/X2/4/v7dc84HLrNiTme6ObHHFe1pQ4hOM4kA+cfpL4H5V+sFiS9LepY7W+SFj/mGEvbYQuUqTYVUx8bOL7Wphci6sNa9UzAJLRaBSdhuZ9nAMjTah0s50BUL3WI1M4ETkI5Thr6mFRPB8Qt9fdKfVXQdJWrCrDUIbJRaEAkI2onRvUkQJ4Ckqv09wygOP8PqudoUpRUSkqrdUlzNJA8pbhAUQHJjfB0h43qOTF2SZWYVEQxSRYGSZIgJUt1Aihoz+FrNs2pBrTUQQZHB0qXIhWUtFJSSp3UpApNmiRIhVJJWOgHBlV0KpWy1CQC5MRQgYRmf1SQarZv5w3fB1k8L1hHtet9fB/OOovZMUTTq4aMpg6SemFx/zpIUoJqAk+qPKrjBAEwtct97foaC+cqWoioE6WSziRJkWPwZI7B9auGO60BlQEyr7/OUyCkxCQpNgnzfXBdOPNMPgSMKWW8VAqawXc1ahFJSlOTpHI2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7tNFcQAdMpAqASoOLCzA2L5kYXPJPvHfdzpkIFUKVKXeUQcpCiio7KthhwVI1QBVCWDV3rMSiTnkAO0P3/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/JxCSc4ScoZGfP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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgCjw/eHBhY2tldCBlbmQ9InciPz73ndT8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4gMDDykcmVZBjgAADbFJREFUeNrtXGuMVcUd/805595z774X9gWlIFIVl0dJUWEhtSDo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TdXBwbGllcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkltYWdlU3VwcGxpZXI+CiAgIDxwbHVzOkltYWdlQ3JlYXRvcj4KICAgIDxyZGY6U2VxLz4KICAgPC9wbHVzOkltYWdlQ3JlYXRvcj4KICAgPHBsdXM6Q29weXJpZ2h0T3duZXI+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpDb3B5cmlnaHRPd25lcj4KICAgPHBsdXM6TGljZW5zb3I+CiAgICA8cmRmOlNlcS8+CiAgIDwvcGx1czpMaWNlbnNvcj4KICA8L3JkZjpEZXNjcmlwdGlvbj4KIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAKPD94cGFja2V0IGVuZD0idyI/PvOQ5mMAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAALiMAAC4jAXilP3YAAAAHdElNRQfiAwMPKBseKeVsAAAJfElEQVR42u1bXWgcxx3/ze7e7VnWl2vJ0jnCrkiKbRUbxw92nFIwwQ0plIIcDCmUvMQUTB+DyAfkrU8u5K0USvISQp5KbUoJIa2NnbYPwSGxQxI3NdhWPmxJOTknyWeddLe7eZjb3Oz//vNxurtEDxkYdnfuP7czv/l/z6xAd4vQ3Ls820rSxnPSycB7AQJtMz2r9NwkE8tzR2D0AgjuylWORjf5hLTRCsPVqQQ9Eg1u4h65qpP3NP8XMwDE5ErBEBsRjaBHYsFN3lOefYaGEw064ahBHzdoVVCoSLQFSNAjHQEyUd9wFRbRSAGIFRAihT5mJi02g2gIwgW+UgNypZwiCAixUiMAdQWEqJtWI+iSKFAQ1BUPDJXjDDCckILgN64egBoZR0J0imgHlKDDyVMgKBeok84pNVCuPuEKEG5IQag1qqcxz2BERbhySdCmJTCZSo/IvwpC/sYN3EwSIK1xnL2a2ilNkgCPPoofW5yu2NExswJhYn9ozCMFIeWAfGYkylCEyE6Qa0/vSf+8xueoaxwtYRIZsUHnyGOUIlWMOQJECCC8fh3/AeQqcyut45AkAaIIOHoUPwOwpt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EXogXvkMuFCyg3ChJGlbgPg7UH5fsweh0JU/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.  
  2551. localStorage.UROverviewCamWatchList = uroConfig.GatherCamWatchList();
  2552. localStorage.UROverviewCWLGroups = uroConfig.GatherCWLGroups();
  2553. localStorage.UROverviewFriendlyAreaNames = uroConfig.GatherAFNs();
  2554. localStorage.UROverviewPlacesGroups = uroConfig.GatherPlacesGroups();
  2555.  
  2556. localStorage.UROverviewMasterEnable = masterEnable;
  2557. localStorage.UROverviewCurrentVersion = uroRelease.version;
  2558.  
  2559. uroDBG.AddLog('settings saved');
  2560. }
  2561. else
  2562. {
  2563. uroDBG.AddLog('master enable state not known when trying to save settings...');
  2564. }
  2565. }
  2566. catch(err)
  2567. {
  2568. uroDBG.AddLog('exception thrown during save - probably script reload whilst in MTE mode...');
  2569. }
  2570. }
  2571. else
  2572. {
  2573. uroDBG.AddLog('no localStorage, save blocked');
  2574. }
  2575. },
  2576. ApplySettings: function(settings)
  2577. {
  2578. uroSettingsApplied = true;
  2579. if(settings != undefined)
  2580. {
  2581. if(document.querySelector('#_cbMasterEnable') === null)
  2582. {
  2583. uroDBG.AddLog('master enable not found, not applying settings...');
  2584. uroSettingsApplied = false;
  2585. }
  2586. else
  2587. {
  2588. let options = settings.split(':');
  2589. for(let optIdx=0;optIdx<options.length;optIdx++)
  2590. {
  2591. let fields = options[optIdx].split(',');
  2592. if(fields[0].indexOf('_cb') === 0)
  2593. {
  2594. if(document.getElementById(fields[0]) !== null)
  2595. {
  2596. uroUtils.SetCBChecked(fields[0], (fields[1] == 'true'));
  2597. }
  2598. }
  2599. else if((fields[0].indexOf('_input') === 0)||(fields[0].indexOf('_text') === 0))
  2600. {
  2601. if(document.getElementById(fields[0]) !== null) document.getElementById(fields[0]).value = fields[1];
  2602. }
  2603. }
  2604. uroDBG.AddLog('settings applied...');
  2605. }
  2606. }
  2607. },
  2608. TranslateLegacyMPTab: function()
  2609. {
  2610. let options = localStorage.UROverviewMPOptions.split(':');
  2611. for(let optIdx=0;optIdx<options.length;optIdx++)
  2612. {
  2613. let fields = options[optIdx].split(',');
  2614. if(fields[0].indexOf('_cb') === 0)
  2615. {
  2616. if(fields[0] == '_cbMPFilterParkingLotInputAsPoint') uroUtils.SetCBChecked('_cbMPFilter_T50', (fields[1] == 'true'));
  2617. if(fields[0] == '_cbMPMissingPLP_T70') uroUtils.SetCBChecked('_cbMPFilter_T70', (fields[1] == 'true'));
  2618. if(fields[0] == '_cbMPMissingPLP_T71') uroUtils.SetCBChecked('_cbMPFilter_T71', (fields[1] == 'true'));
  2619. if(fields[0] == '_cbMPFilterDrivingDirectionMismatch') uroUtils.SetCBChecked('_cbMPFilter_T101', (fields[1] == 'true'));
  2620. if(fields[0] == '_cbMPFilterMissingJunction') uroUtils.SetCBChecked('_cbMPFilter_T102', (fields[1] == 'true'));
  2621. if(fields[0] == '_cbMPFilterMissingRoad') uroUtils.SetCBChecked('_cbMPFilter_T103', (fields[1] == 'true'));
  2622. if(fields[0] == '_cbMPFilterCrossroadsJunctionMissing') uroUtils.SetCBChecked('_cbMPFilter_T104', (fields[1] == 'true'));
  2623. if(fields[0] == '_cbMPFilterRoadTypeMismatch') uroUtils.SetCBChecked('_cbMPFilter_T105', (fields[1] == 'true'));
  2624. if(fields[0] == '_cbMPFilterRestrictedTurn') uroUtils.SetCBChecked('_cbMPFilter_T106', (fields[1] == 'true'));
  2625. if(fields[0] == '_cbMPFilterTurnProblem') uroUtils.SetCBChecked('_cbMPFilter_T200', (fields[1] == 'true'));
  2626. if(fields[0] == '_cbMPFilterRoadClosureProblem') uroUtils.SetCBChecked('_cbMPFilter_T300', (fields[1] == 'true'));
  2627. }
  2628. }
  2629. },
  2630. TranslateLegacyZoom: function()
  2631. {
  2632. let tZoom = parseInt(document.getElementById("_inputFilterMinZoomLevel").value);
  2633. if(tZoom < 12)
  2634. {
  2635. tZoom += 12;
  2636. document.getElementById("_inputFilterMinZoomLevel").value = tZoom;
  2637. }
  2638. tZoom = parseInt(document.getElementById("_inputUnstackZoomLevel").value);
  2639. if(tZoom < 12)
  2640. {
  2641. tZoom += 12;
  2642. document.getElementById("_inputUnstackZoomLevel").value = tZoom;
  2643. }
  2644. },
  2645. LoadSettings: function()
  2646. {
  2647. let isNewInstall = true;
  2648. let isUpgradeInstall = true;
  2649.  
  2650. uroDBG.AddLog('loadSettings()');
  2651. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  2652. {
  2653. if (uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE] != null)
  2654. {
  2655. uroDBG.AddLog('recover '+uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABTITLE]+' tab settings');
  2656. uroConfig.ApplySettings(localStorage[uroTabs.CtrlTabs[i][uroTabs.FIELDS.STORAGE]]);
  2657. isNewInstall = false;
  2658. }
  2659. }
  2660. if (localStorage.UROverviewMPOptions != null)
  2661. {
  2662. uroConfig.TranslateLegacyMPTab();
  2663. }
  2664. if (localStorage.UROverviewMiscOptions != null)
  2665. {
  2666. uroConfig.TranslateLegacyZoom();
  2667. }
  2668.  
  2669. if(localStorage.UROverviewCurrentVersion != null)
  2670. {
  2671. uroDBG.AddLog('comparing install versions');
  2672. if(localStorage.UROverviewCurrentVersion == uroRelease.version)
  2673. {
  2674. isUpgradeInstall = false;
  2675. }
  2676. }
  2677.  
  2678. if(localStorage.UROverviewFriendlyAreaNames != null)
  2679. {
  2680. uroDBG.AddLog('recover friendly area names');
  2681. uroAFN.ApplyNames();
  2682. isNewInstall = false;
  2683. }
  2684.  
  2685. if(localStorage.UROverviewMasterEnable != null)
  2686. {
  2687. uroDBG.AddLog('recover master enable state');
  2688. document.getElementById('_cbMasterEnable').checked = (localStorage.UROverviewMasterEnable == "true");
  2689. uroDBG.AddLog('enable checkbox state set...');
  2690. }
  2691.  
  2692. // Remove old settings
  2693. if(localStorage.UROverviewCWLGroups != undefined)
  2694. {
  2695. localStorage.removeItem("UROverviewCWLGroups");
  2696. }
  2697. if(localStorage.UROverviewCamWatchList != undefined)
  2698. {
  2699. localStorage.removeItem("UROverviewCamWatchList");
  2700. }
  2701.  
  2702. if((isNewInstall)||(isUpgradeInstall))
  2703. {
  2704. uroStartup.ShowUpgradeNotes();
  2705. }
  2706.  
  2707. uroInhibitSave = false;
  2708. },
  2709. DefaultSettings: function()
  2710. {
  2711. 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);
  2712. },
  2713. DefaultSettingsAction: function()
  2714. {
  2715. let defaultSettings = '';
  2716.  
  2717. 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]';
  2718. 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]';
  2719. 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]';
  2720. defaultSettings += '[UROverviewPlacesGroups][len=71]false:false:false:false:false:false:false:false:false:false:false:false[END]';
  2721. 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]';
  2722. defaultSettings += '[UROverviewMasterEnable][len=4]true[END]';
  2723. defaultSettings += '[UROverviewCWLGroups][len=16]0,No group,false[END]';
  2724. 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]';
  2725. 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]';
  2726. 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]';
  2727. defaultSettings += '[UROverviewRAOptions][len=178]:_cbShowSpecificRA,false:_cbRAEditorIDFilter,false:_cbEnableRAAgeFilterLessThan,false:_inputFilterRAAgeLessThan,39:_cbEnableRAAgeFilterMoreThan,false:_inputFilterRAAgeMoreThan,38[END]';
  2728. defaultSettings += '[UROverviewCurrentVersion][len=3]4.5[END]';
  2729. defaultSettings += '[UROverviewCamWatchList][len=0][END]';
  2730. defaultSettings += '[UROverviewFriendlyAreaNames][len=0][END]';
  2731. defaultSettings += '[UROverviewPlaceWatchList][len=0][END]';
  2732. defaultSettings += '[UROverviewSegWatchList][len=0][END]';
  2733.  
  2734. document.getElementById('_txtSettings').value = defaultSettings;
  2735. uroConfig.TextToSettings();
  2736. document.getElementById('_txtSettings').value = '';
  2737. },
  2738. SettingsToText: function()
  2739. {
  2740. let txtSettings = '';
  2741.  
  2742. uroConfig.SaveSettings();
  2743.  
  2744. for(let lsEntry in localStorage)
  2745. {
  2746. if(lsEntry.indexOf('UROverview') === 0)
  2747. {
  2748. txtSettings += '['+lsEntry+'][len=' + localStorage[lsEntry].length + ']' + localStorage[lsEntry] + '[END]\n';
  2749. }
  2750. }
  2751.  
  2752. document.getElementById('_txtSettings').value = txtSettings;
  2753. document.getElementById('_txtSettings').focus();
  2754. document.getElementById('_txtSettings').select();
  2755. },
  2756. TextToSettings: function()
  2757. {
  2758. let txtSettings = '';
  2759. txtSettings = uroUtils.GetElmValue('_txtSettings');
  2760. if(txtSettings.indexOf('[END]') == -1) return;
  2761.  
  2762. let subText = txtSettings.split('[END]');
  2763. for(let i=0;i<subText.length;i++)
  2764. {
  2765. let aPos = subText[i].indexOf('[');
  2766. let bPos = subText[i].indexOf(']');
  2767. if((aPos != -1) && (bPos != -1))
  2768. {
  2769. let settingID = subText[i].substr(aPos+1,bPos-1-aPos);
  2770. subText[i] = subText[i].substr(bPos+1);
  2771. bPos = subText[i].indexOf(']');
  2772. if(bPos != -1)
  2773. {
  2774. let settingLength = subText[i].substr(5,bPos-5);
  2775. subText[i] = subText[i].substr(bPos+1);
  2776. if(subText[i].length == settingLength)
  2777. {
  2778. localStorage[settingID] = subText[i];
  2779. }
  2780. }
  2781. }
  2782. }
  2783. uroConfig.LoadSettings();
  2784. },
  2785. ClearSettingsText: function()
  2786. {
  2787. document.getElementById('_txtSettings').value = '';
  2788. }
  2789. };
  2790. const uroRTCClone = // RTC cloning
  2791. {
  2792. ConfirmDelete : true,
  2793. ToDelete : 0,
  2794. Reason : null,
  2795. Event : null,
  2796. Direction : null,
  2797. StartDate : null,
  2798. StartTime : null,
  2799. EndDate : null,
  2800. EndTime : null,
  2801. IgnoreTraffic : null,
  2802. ClosedNodes : null,
  2803. PendingClone : -1,
  2804. PendingCloneIncrement : 0,
  2805.  
  2806. Complete: function()
  2807. {
  2808. let loop;
  2809. if(document.getElementsByClassName('edit-closure').length === 0)
  2810. {
  2811. window.setTimeout(uroRTCClone.Complete,100);
  2812. return;
  2813. }
  2814.  
  2815. if(uroFixMTEDropDown(document.getElementById('closure_eventId')) == false)
  2816. {
  2817. window.setTimeout(uroRTCClone.Complete,100);
  2818. return;
  2819. }
  2820.  
  2821. // need to generate a change event on each of the form fields, because WME appears to be silently populating some hidden
  2822. // closure object with the details as they're entered manually, and if we just set the form values without then forcing
  2823. // the change event as well then WME will end up using its default values instead of the ones we've so lovingly copied...
  2824. let form = $('#edit-panel .closures .edit-closure form');
  2825.  
  2826. if(uroRTCClone.Reason !== null)
  2827. {
  2828. let fObj = form.find('wz-text-input#closure_reason');
  2829. fObj.val(uroRTCClone.Reason);
  2830. fObj.change();
  2831. }
  2832. if(uroRTCClone.Direction !== null)
  2833. {
  2834. let fObj = form.find('wz-select#closure_direction');
  2835. fObj[0].value = uroRTCClone.Direction;
  2836. fObj.change();
  2837. }
  2838. if(uroRTCClone.StartDate !== null)
  2839. {
  2840. let fObj = form.find('input#closure_startDate');
  2841. fObj.val(uroRTCClone.StartDate);
  2842. fObj.change();
  2843. }
  2844. if(uroRTCClone.StartTime !== null)
  2845. {
  2846. let fObj = form.find('div.form-group.start-date-form-group input.time-picker-input');
  2847. fObj.focus();
  2848. fObj.val(uroRTCClone.StartTime);
  2849. fObj.change();
  2850. }
  2851.  
  2852. if(uroRTCClone.IgnoreTraffic !== null)
  2853. {
  2854. let fObj = form.find('wz-checkbox#closure_permanent');
  2855. fObj.val(uroRTCClone.IgnoreTraffic);
  2856. fObj.change();
  2857. }
  2858. if(uroRTCClone.EndTime !== null)
  2859. {
  2860. let fObj = form.find('div.form-group.end-date-form-group input.time-picker-input');
  2861. fObj.focus();
  2862. fObj.val(uroRTCClone.EndTime);
  2863. fObj.change();
  2864. }
  2865.  
  2866. // the current version of WME wipes any existing end date as soon as the end time is altered, so we now need
  2867. // to set the date after the time instead of before as in earlier versions of this function...
  2868. if(uroRTCClone.EndDate !== null)
  2869. {
  2870. let fObj = form.find('input#closure_endDate');
  2871. fObj.val(uroRTCClone.EndDate);
  2872. fObj.change();
  2873. }
  2874.  
  2875. // the old method of setting the MTE just by changing the value attribute on closure_eventId no longer
  2876. // seems to work as expected (it runs OK from the dev console, but not within the scope of the userscript),
  2877. // so just as we do for setting the event to None, we set the event to the desired value here by finding
  2878. // the appropriate menu entry and clicking on it...
  2879. let cEvents = document.getElementById('closure_eventId').getElementsByTagName('wz-option');
  2880. for(let i of cEvents)
  2881. {
  2882. if(i.value == uroRTCClone.Event)
  2883. {
  2884. i.click();
  2885. break;
  2886. }
  2887. }
  2888.  
  2889. let nNodes = uroRTCClone.ClosedNodes.length;
  2890. if(nNodes > 0)
  2891. {
  2892. let fObj = form.find('wz-toggle-switch');
  2893. for(loop = 0; loop < nNodes; ++loop)
  2894. {
  2895. if(uroRTCClone.ClosedNodes[loop] === true)
  2896. {
  2897. fObj[loop].click();
  2898. }
  2899. }
  2900. }
  2901. if(uroUtils.GetCBChecked('_cbAutoApplyClonedClosure') == true)
  2902. {
  2903. window.setTimeout(uroRTCClone.ClickSave,100);
  2904. }
  2905.  
  2906. uroRTCClone.PendingClone = -1;
  2907. },
  2908. ClickSave: function()
  2909. {
  2910. document.getElementsByClassName('closures')[0].getElementsByClassName('save-button')[0].click();
  2911. },
  2912. Copy: function()
  2913. {
  2914. // grab the current closure details from the UI...
  2915. uroRTCClone.Reason = uroGetShadowElementProperty('closure_reason', 'input', 'value');
  2916. uroRTCClone.Direction = uroGetElementProperty('closure_direction', 0, 'value');
  2917. uroRTCClone.StartDate = uroGetElementProperty('closure_startDate', 0, 'value');
  2918. uroRTCClone.StartTime = document.querySelector('.start-date-form-group').querySelector('.time-picker-input').value;
  2919. uroRTCClone.EndDate = uroGetElementProperty('closure_endDate', 0, 'value');
  2920. uroRTCClone.EndTime = document.querySelector('.end-date-form-group').querySelector('.time-picker-input').value;
  2921. uroRTCClone.Event = uroGetElementProperty('closure_eventId', 0, 'value');
  2922. uroRTCClone.IgnoreTraffic = uroGetElementProperty('closure_permanent', 0, 'checked');
  2923. uroRTCClone.ClosedNodes = [];
  2924. let nNodes = document.getElementsByClassName('fromNodeClosed').length;
  2925. if(nNodes > 0)
  2926. {
  2927. for(let loop = 0; loop < nNodes; ++loop)
  2928. {
  2929. uroRTCClone.ClosedNodes.push(document.getElementsByClassName('fromNodeClosed')[loop].checked);
  2930. }
  2931. }
  2932.  
  2933. document.getElementsByClassName('closures')[0].getElementsByClassName('cancel-button')[0].click();
  2934.  
  2935. // auto-increment the start and end dates
  2936. uroRTCClone.StartDate = uroIncrementClosureDate(uroRTCClone.StartDate,uroRTCClone.PendingCloneIncrement);
  2937. uroRTCClone.EndDate = uroIncrementClosureDate(uroRTCClone.EndDate,uroRTCClone.PendingCloneIncrement);
  2938.  
  2939. uroRTCClone.PendingClone = -2;
  2940. },
  2941. Clone: function()
  2942. {
  2943. uroRTCClone.PendingCloneIncrement = parseInt(this.id.split('-')[1]);
  2944. uroRTCClone.PendingClone = parseInt(this.id.split('-')[2]);
  2945. },
  2946. DeleteNextOnList: function()
  2947. {
  2948. let nClosures = document.querySelectorAll('.closure-item.is-editable').length;
  2949. if(nClosures > 0)
  2950. {
  2951. if (nClosures != uroRTCClone.ToDelete)
  2952. {
  2953. uroRTCClone.ToDelete = nClosures;
  2954. let ctObj = document.querySelector('.closure-item.is-editable');
  2955. let deleteMenuEntry = ctObj.querySelector('wz-menu-item.delete');
  2956. if(deleteMenuEntry !== null)
  2957. {
  2958. deleteMenuEntry.click();
  2959. }
  2960. }
  2961. window.setTimeout(uroRTCClone.DeleteNextOnList,100);
  2962. }
  2963. else
  2964. {
  2965. uroRTCClone.ConfirmDelete = true;
  2966. }
  2967. },
  2968. DeleteAll: function()
  2969. {
  2970. uroRTCClone.ConfirmDelete = true;
  2971. 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);
  2972. },
  2973. DeleteAllAction: function()
  2974. {
  2975. uroRTCClone.ConfirmDelete = false;
  2976. let nClosures = document.getElementsByClassName('closure-item').length;
  2977. if(nClosures > 0)
  2978. {
  2979. uroRTCClone.ToDelete = -1;
  2980. uroRTCClone.DeleteNextOnList();
  2981. }
  2982. else
  2983. {
  2984. uroRTCClone.ConfirmDelete = true;
  2985. }
  2986. }
  2987. };
  2988. const uroIgnore = // ignore list
  2989. {
  2990. IsOnList: function(fid)
  2991. {
  2992. if(sessionStorage.UROverview_FID_IgnoreList.indexOf('fid:'+fid) == -1) return false;
  2993. else return true;
  2994. },
  2995. EnableControls: function()
  2996. {
  2997. let btnState = "visible";
  2998. if(sessionStorage.UROverview_FID_IgnoreList === '')
  2999. {
  3000. btnState = "hidden";
  3001. }
  3002. try
  3003. {
  3004. document.getElementById('_btnUndoLastHide').style.visibility = btnState;
  3005. document.getElementById('_btnClearSessionHides').style.visibility = btnState;
  3006. uroFilterItems();
  3007. }
  3008. catch(err)
  3009. {
  3010. uroDBG.AddLog('exception thrown in uroIgnore.EnableControls()');
  3011. }
  3012. },
  3013. Add: function()
  3014. {
  3015. if(!uroIgnore.IsOnList(uroShownFID))
  3016. {
  3017. sessionStorage.UROverview_FID_IgnoreList += 'fid:'+uroShownFID;
  3018. uroDBG.AddLog('added fid '+uroShownFID+' to ignore list');
  3019. uroDBG.AddLog(sessionStorage.UROverview_FID_IgnoreList);
  3020. uroDiv.style.visibility = 'hidden';
  3021. uroIgnore.EnableControls();
  3022.  
  3023. W.map.events.register("mousemove", null, uroFilterItemsOnMove);
  3024. }
  3025. return false;
  3026. },
  3027. RemoveLastAdded: function()
  3028. {
  3029. let ignorelist = sessionStorage.UROverview_FID_IgnoreList;
  3030. let fidpos = ignorelist.lastIndexOf('fid:');
  3031. if(fidpos != -1)
  3032. {
  3033. ignorelist = ignorelist.slice(0,fidpos);
  3034. sessionStorage.UROverview_FID_IgnoreList = ignorelist;
  3035. uroDBG.AddLog('removed last fid from ignore list');
  3036. uroDBG.AddLog(sessionStorage.UROverview_FID_IgnoreList);
  3037. uroIgnore.EnableControls();
  3038. }
  3039. },
  3040. RemoveAll: function()
  3041. {
  3042. sessionStorage.UROverview_FID_IgnoreList = '';
  3043. uroIgnore.EnableControls();
  3044. }
  3045. };
  3046. const uroPopup = // map object popup handling
  3047. {
  3048. hasIgnoreLink : null,
  3049. hasDeleteLink : null,
  3050. hasAddWatchLink : null,
  3051. hasRemoveWatchLink : null,
  3052. hasUpdateWatchLink : null,
  3053. hasRecentreSessionLink : null,
  3054. hasOpenInNewTabLink : null,
  3055.  
  3056. isVenue : null,
  3057. isMapComment : null,
  3058. isUR : null,
  3059. isProblem : null,
  3060. isTurnProb : null,
  3061. isPlaceUpdate : null,
  3062. timer : -2,
  3063. autoHideTimer : 0,
  3064. mouseIn : false,
  3065. shown : false,
  3066. shownType : null,
  3067. newType : null,
  3068. hovered : null,
  3069. unstackedX : null,
  3070. unstackedY : null,
  3071. renderIntent : null,
  3072. pX : null,
  3073. pY : null,
  3074. suppressed : false,
  3075.  
  3076. GetFormattedLocks: function(attrs)
  3077. {
  3078. let autoLock = attrs.rank;
  3079. let userLock = attrs.lockRank;
  3080. let retval = '<b>' + I18n.lookup("edit.segment.fields.lock") + ': </b>';
  3081. if(userLock !== null)
  3082. {
  3083. retval += 'M' + (userLock+1) + ' / ';
  3084. }
  3085. retval += 'A' + (autoLock+1);
  3086. return retval;
  3087. },
  3088. UR: function()
  3089. {
  3090. let result = '';
  3091.  
  3092. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  3093. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  3094. // check for stacking...
  3095. if(uroShownFID != uroMarkers.id)
  3096. {
  3097. uroCheckStacking(uroLayers.ID.UR,uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  3098. }
  3099.  
  3100. if(uroUtils.GetCBChecked('_cbInhibitURPopup') === false)
  3101. {
  3102. if(uroMousedOverMapComment !== null)
  3103. {
  3104. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for UR highlight');
  3105. uroMousedOverOtherObjectWithinMapComment = true;
  3106. }
  3107.  
  3108. uroPopup.isUR = true;
  3109. uroPopup.newPopupType = uroMarkers.type;
  3110. let ureq = W.model.mapUpdateRequests.objects[uroMarkers.id];
  3111.  
  3112. if(ureq.attributes != undefined)
  3113. {
  3114. uroFID = uroMarkers.id;
  3115.  
  3116. uroDBG.AddLog('building popup for UR '+uroMarkers.id);
  3117. result = '<b>Update Request ('+uroMarkers.id+'): ' + I18n.lookup("update_requests.types." + ureq.attributes.type) + '</b><br>';
  3118.  
  3119. result += uroUtils.Clickify(ureq.attributes.description, '<br>');
  3120. let uroDaysOld = uroUtils.GetURAge(ureq,0,false);
  3121. let uroSubmittedTS = uroUtils.GetURAge(ureq,0,true);
  3122. if(uroSubmittedTS != -1)
  3123. {
  3124. uroSubmittedTS = uroUtils.GetDateTimeString(uroSubmittedTS);
  3125. }
  3126. if(uroDaysOld != -1)
  3127. {
  3128. result += '<i>Submitted ' + uroUtils.ParseDaysAgo(uroDaysOld) + ' ';
  3129. if(uroSubmittedTS != -1) result += '(' + uroSubmittedTS + ') ';
  3130. if(ureq.attributes.guestUserName != null)
  3131. {
  3132. result += 'via Livemap';
  3133. if(ureq.attributes.guestUserName !== '')
  3134. {
  3135. result += ' by '+ureq.attributes.guestUserName.replace(/<\/?[^>]+(>|$)/g, "");
  3136. }
  3137. }
  3138. result += '</i>';
  3139. }
  3140. if(ureq.attributes.resolvedOn !== null)
  3141. {
  3142. let daysResolved = uroUtils.GetURAge(ureq,1,false);
  3143. let uroResolvedTS = uroUtils.GetURAge(ureq,1,true);
  3144. if(uroResolvedTS != -1)
  3145. {
  3146. uroResolvedTS = uroUtils.GetDateTimeString(uroResolvedTS);
  3147. }
  3148.  
  3149. if(daysResolved != -1)
  3150. {
  3151. result += '<br><i>Closed ' + uroUtils.ParseDaysAgo(daysResolved) + ' ';
  3152. if(uroResolvedTS != -1) result += '(' + uroResolvedTS + ')</i>';
  3153.  
  3154. result += '<br><i>Marked as ';
  3155. if(ureq.attributes.resolution === 0) result += 'solved';
  3156. else if(ureq.attributes.resolution == 1) result += 'not identified';
  3157. else result += 'unknown';
  3158. if(ureq.attributes.resolvedBy !== null)
  3159. {
  3160. result += ' by '+uroUtils.GetUserNameAndRank(ureq.attributes.resolvedBy);
  3161. }
  3162. result += '</i>';
  3163. }
  3164. }
  3165. if(W.model.updateRequestSessions.objects[uroMarkers.id] != null)
  3166. {
  3167. let hasMyComments = uroURHasMyComments(uroMarkers.id);
  3168. let nComments = W.model.updateRequestSessions.objects[uroMarkers.id].attributes.comments.length;
  3169. result += '<br>' + nComments + ' comment';
  3170. if(nComments != 1) result += 's';
  3171. if((hasMyComments === false) && (nComments > 0)) result += ' (none by me)';
  3172. if(nComments > 0)
  3173. {
  3174. let commentDaysOld = uroUtils.GetCommentAge(W.model.updateRequestSessions.objects[uroMarkers.id].attributes.comments[nComments-1]);
  3175. if(commentDaysOld != -1)
  3176. {
  3177. result += ', last update '+uroUtils.ParseDaysAgo(commentDaysOld);
  3178. }
  3179. }
  3180. }
  3181. if(uroURDupes.length > 0)
  3182. {
  3183. let thisID = parseInt(uroMarkers.id);
  3184. for(let i = 0; i < uroURDupes.length; ++i)
  3185. {
  3186. if(uroURDupes[i][0] === thisID)
  3187. {
  3188. result += '<br><br>Duplicate of: ';
  3189. let dupes = 0;
  3190. for(let j = 0; j < uroURDupes[i][1].length; ++j)
  3191. {
  3192. if(uroURDupes[i][1][j] !== thisID)
  3193. {
  3194. if(dupes > 0)
  3195. {
  3196. result += ', ';
  3197. }
  3198. result += uroURDupes[i][1][j];
  3199. ++dupes;
  3200. }
  3201. }
  3202. }
  3203. }
  3204. }
  3205. uroPopup.result += result;
  3206. uroPopup.UMPExtras(ureq);
  3207. uroPopup.Show();
  3208. }
  3209. }
  3210. },
  3211. MP: function()
  3212. {
  3213. let result = '';
  3214.  
  3215. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  3216. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  3217. // check for stacking...
  3218. if(uroShownFID != uroMarkers.id)
  3219. {
  3220. ////uroCheckStacking(uroLayers.ID.MP,uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  3221. }
  3222.  
  3223. if(uroUtils.GetCBChecked('_cbInhibitMPPopup') === false)
  3224. {
  3225. if(uroMousedOverMapComment !== null)
  3226. {
  3227. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for MP highlight');
  3228. uroMousedOverOtherObjectWithinMapComment = true;
  3229. }
  3230.  
  3231. uroPopup.isProblem = true;
  3232. uroPopup.newPopupType = uroMarkers.type;
  3233. let ureq = W.model.mapProblems.objects[uroMarkers.id];
  3234.  
  3235. uroFID = uroMarkers.id;
  3236. uroDBG.AddLog('building popup for problem '+uroMarkers.id);
  3237. if(uroPopup.isTurnProb) result = '<b>Turn Problem ('+uroMarkers.id+'): ' + I18n.lookup("problems.types.turn.title");
  3238. else
  3239. {
  3240. result = '<b>Map Problem ('+uroMarkers.id+'): ';
  3241.  
  3242. let problemType = ureq.attributes.subType;
  3243. if(problemType == 300)
  3244. {
  3245. result += I18n.lookup("problems.panel.closure.title");
  3246. }
  3247. else
  3248. {
  3249. if(I18n.lookup("problems.types." + problemType) === undefined) result += 'Unknown problem type ('+problemType+')';
  3250. else result += I18n.lookup("problems.types." + problemType + ".title");
  3251. }
  3252. }
  3253. result += '</b><br>';
  3254.  
  3255. if(ureq.attributes.description != null)
  3256. {
  3257. result += 'Description: ' + ureq.attributes.description + '<br>';
  3258. }
  3259. if(ureq.attributes.extraInfo != null)
  3260. {
  3261. result += 'ExtraInfo: ' + uroUtils.Clickify(ureq.attributes.extraInfo, '<br>');
  3262. }
  3263. if(ureq.attributes.provider != null)
  3264. {
  3265. result += 'Provider: ' + ureq.attributes.provider + '<br>';
  3266. }
  3267. if(ureq.attributes.startTime != null)
  3268. {
  3269. result += 'From: ' + uroUtils.GetDateTimeString(ureq.attributes.startTime) + '<br>';
  3270. }
  3271. if(ureq.attributes.endTime != null)
  3272. {
  3273. result += 'To: ' + uroUtils.GetDateTimeString(ureq.attributes.endTime) + '<br>';
  3274. }
  3275. if(ureq.attributes.resolvedOn != null)
  3276. {
  3277. let daysResolved = uroUtils.GetURAge(ureq,1,false);
  3278. if(daysResolved != -1)
  3279. {
  3280. result += '<br><i>Closed ' + uroUtils.ParseDaysAgo(daysResolved) + ' ';
  3281. if(ureq.attributes.resolvedBy != null)
  3282. {
  3283. result += ' by '+uroUtils.GetUserNameAndRank(ureq.attributes.resolvedBy);
  3284. }
  3285.  
  3286. if((ureq.attributes.open === true) && (ureq.attributes.resolvedOn != null))
  3287. {
  3288. result += '<br>Reopened by Waze';
  3289. }
  3290. result += '</i>';
  3291. }
  3292. }
  3293. uroPopup.result += result;
  3294. uroPopup.UMPExtras(ureq);
  3295. }
  3296. },
  3297. PUR: function()
  3298. {
  3299. if(uroMarkers?.elm?.style == undefined)
  3300. {
  3301. return;
  3302. }
  3303.  
  3304. let result = '';
  3305.  
  3306. uroPopup.unstackedX = uroUtils.ParsePxString(uroMarkers.elm.style.left);
  3307. uroPopup.unstackedY = uroUtils.ParsePxString(uroMarkers.elm.style.top);
  3308.  
  3309. if(uroShownFID != uroMarkers.id)
  3310. {
  3311. // check for stacking...
  3312. uroCheckStacking(uroMarkers.type, uroMarkers.id, uroPopup.unstackedX, uroPopup.unstackedY);
  3313. }
  3314.  
  3315. if(uroUtils.GetCBChecked('_cbInhibitPUPopup') === false)
  3316. {
  3317. let ureq = W.model.venues.objects[uroMarkers.id];
  3318.  
  3319. uroPopup.newPopupType = uroMarkers.type;
  3320. if(uroMousedOverMapComment !== null)
  3321. {
  3322. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for PUR highlight');
  3323. uroMousedOverOtherObjectWithinMapComment = true;
  3324. }
  3325.  
  3326. uroPopup.isPlaceUpdate = true;
  3327.  
  3328. uroFID = uroMarkers.id;
  3329.  
  3330. if(uroMarkers.type == uroLayers.ID.PUR)
  3331. {
  3332. uroDBG.AddLog('building popup for placeUpdate '+uroMarkers.id);
  3333. }
  3334. else if(uroMarkers.type == uroLayers.ID.RPUR)
  3335. {
  3336. uroDBG.AddLog('building popup for residentialPlaceUpdate '+uroMarkers.id);
  3337. }
  3338. else
  3339. {
  3340. uroDBG.AddLog('building popup for parkingPlaceUpdate '+uroMarkers.id);
  3341. }
  3342.  
  3343. result = '<b>';
  3344. if(ureq.attributes.name === '') result += 'Unnamed landmark';
  3345. else result += ureq.attributes.name;
  3346. result += '</b><br>';
  3347.  
  3348. result += '<ul>';
  3349. for(let idx = 0; idx < ureq.attributes.categories.length; idx++)
  3350. {
  3351. result += '<li>' + I18n.lookup("venues.categories." + ureq.attributes.categories[idx]);
  3352. }
  3353. result += '</ul>';
  3354.  
  3355. if(ureq.attributes.residential === true)
  3356. {
  3357. result += '<i>Residential</i>';
  3358. }
  3359.  
  3360. let daysOld = uroUtils.GetPURAge(ureq);
  3361. if(daysOld != -1)
  3362. {
  3363. result += '<br><i>Submitted '+uroUtils.ParseDaysAgo(daysOld)+'</i>';
  3364. }
  3365.  
  3366. uroPopup.result += result;
  3367. uroPopup.UMPExtras(ureq);
  3368. }
  3369. },
  3370. Venue: function()
  3371. {
  3372. if(uroUtils.GetCBChecked('_cbInhibitLandmarkPopup') === false)
  3373. {
  3374. let result = '';
  3375. let navpointPos=new OpenLayers.LonLat();
  3376. {
  3377. if(uroPopup.renderIntent === 'highlight')
  3378. {
  3379. if(uroUtils.GetExtent().intersectsBounds(uroMarkers.obj.attributes.geometry.getBounds()))
  3380. {
  3381. if(uroMousedOverMapComment !== null)
  3382. {
  3383. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for place highlight');
  3384. uroMousedOverOtherObjectWithinMapComment = true;
  3385. }
  3386.  
  3387. if(uroPopup.newPopupType === null)
  3388. {
  3389. uroFID = uroMarkers.obj.attributes.id;
  3390. uroDBG.AddLog('building popup for place '+uroFID);
  3391.  
  3392. navpointPos = uroGetVenueNavPoint(uroFID);
  3393. result += '<b>';
  3394. if(uroMarkers.obj.attributes.name === '')
  3395. {
  3396. if(uroMarkers.obj.attributes.residential === true) result += '<i>Residential</i>';
  3397. else result += '<i>Unnamed</i>';
  3398. }
  3399. else result += uroUtils.Clickify(uroMarkers.obj.attributes.name, '');
  3400. if(uroMarkers.obj.attributes.externalProviderIDs.length > 0)
  3401. {
  3402. result += ' <i>(linked)</i>';
  3403. }
  3404. if(uroMarkers.obj.attributes.adLocked)
  3405. {
  3406. result += ' <i>(AdLocked)</i>';
  3407. }
  3408. result += '</b><br>';
  3409. if(uroMarkers.obj.attributes.brand !== null)
  3410. {
  3411. result += '<i>Brand: ' + uroMarkers.obj.attributes.brand + '</i><br>';
  3412. }
  3413. let vDesc = uroMarkers.obj.attributes.description;
  3414. if(vDesc !== '')
  3415. {
  3416. result += '"<i>' + uroUtils.Clickify(vDesc, '') + '</i>"<br>';
  3417. }
  3418.  
  3419. let userLock = uroMarkers.obj.attributes.lockRank;
  3420. result += '<b>Lock: </b>' + (userLock+1);
  3421.  
  3422. result += '<hr>';
  3423. result += uroGetAddress(uroMarkers.obj.attributes.streetID, uroMarkers.obj.attributes.houseNumber, false, false, false);
  3424. result += '<ul>';
  3425. for(let idx = 0; idx < uroMarkers.obj.attributes.categories.length; idx++)
  3426. {
  3427. result += '<li>' + I18n.lookup("venues.categories." + uroMarkers.obj.attributes.categories[idx]);
  3428. }
  3429. result += '</ul>';
  3430.  
  3431. let npLink = document.location.href;
  3432. let npLayers = '';
  3433. npLink = npLink.substr(0,npLink.indexOf('?zoomLevel'));
  3434. npLink += '?zoomLevel=17&lat='+navpointPos.lat+'&lon='+navpointPos.lon+npLayers;
  3435.  
  3436. let targetTab = "_uroTab_" + Math.round(Math.random()*1000000);
  3437. result += '<hr>Jump to nav point: <a href="'+npLink+'" id="_openInNewTab" target="'+targetTab+'">in new tab</a> - ';
  3438. uroPopup.hasOpenInNewTabLink = true;
  3439. result += '<a href="#" id="_recentreSession">in this tab</a>';
  3440. uroPopup.hasRecentreSessionLink = true;
  3441.  
  3442. uroPopup.newPopupType = 'venue';
  3443. uroPopup.isVenue = true;
  3444.  
  3445. uroPopup.result += result;
  3446. uroPopup.Show();
  3447. }
  3448. else
  3449. {
  3450. let otherID = uroMarkers.obj.attributes.id;
  3451. uroDBG.AddLog('venue '+otherID+' is also highlighted');
  3452. }
  3453. }
  3454. else
  3455. {
  3456. uroDBG.AddLog('landmark '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  3457. }
  3458. }
  3459. }
  3460. }
  3461. },
  3462. Camera: function()
  3463. {
  3464. if(uroUtils.GetCBChecked('_cbInhibitCamPopup') === false)
  3465. {
  3466. let result = '';
  3467. let ureq = uroMarkers.obj;
  3468.  
  3469. if(uroPopup.renderIntent === "highlight")
  3470. {
  3471. if(uroMousedOverMapComment !== null)
  3472. {
  3473. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for camera highlight');
  3474. uroMousedOverOtherObjectWithinMapComment = true;
  3475. }
  3476. uroPopup.newPopupType = 'camera';
  3477. uroFID = uroMarkers.id;
  3478. uroDBG.AddLog('building popup for camera '+uroFID);
  3479. if(I18n.lookup("edit.camera.fields.type") === undefined)
  3480. {
  3481. result += '<b>Camera: ' + ureq.TYPES[ureq.attributes.type] + '</b>';
  3482. }
  3483. else
  3484. {
  3485. result += '<b>Camera: ' + I18n.lookup("edit.camera.fields.type." + ureq.attributes.type) + '</b>';
  3486. }
  3487. result += '<br>';
  3488. result += '<b>ID:</b> ' + uroFID + ' - ';
  3489. result += uroPopup.GetFormattedLocks(uroMarkers.obj.attributes);
  3490. result += '<br>';
  3491.  
  3492. result += '<b>Created by</b> ';
  3493. let userID;
  3494.  
  3495. if(W.model.users.getByIds([ureq.attributes.createdBy])[0] != null)
  3496. {
  3497. userID = ureq.attributes.createdBy;
  3498. result += uroUtils.GetUserNameAndRank(userID);
  3499. }
  3500. else result += 'unknown';
  3501. result += ', ';
  3502. let camAge = uroUtils.GetCameraAge(ureq,1);
  3503. if(camAge != -1)
  3504. {
  3505. result += uroUtils.ParseDaysAgo(camAge);
  3506. }
  3507. else result += 'unknown days ago';
  3508. result += '<br><b>Updated by</b> ';
  3509. if(W.model.users.getByIds([ureq.attributes.updatedBy])[0] != null)
  3510. {
  3511. userID = ureq.attributes.updatedBy;
  3512. result += uroUtils.GetUserNameAndRank(userID);
  3513. }
  3514. else result += 'unknown';
  3515. result += ', ';
  3516. camAge = uroUtils.GetCameraAge(ureq,0);
  3517. if(camAge != -1)
  3518. {
  3519. result += uroUtils.ParseDaysAgo(camAge);
  3520. }
  3521. else result += 'unknown days ago';
  3522.  
  3523. if(ureq.attributes.type !== 4)
  3524. {
  3525. result += '<br><b>Speed data:</b> ';
  3526. result += uroUtils.GetLocalisedSpeedString(ureq.attributes.speed);
  3527. if(uroIsCamSpeedValid(ureq) === false)
  3528. {
  3529. result += ' (differs to nearest segment)';
  3530. }
  3531. }
  3532. result += '<hr><ul>';
  3533. if(ureq.attributes.permissions !== 0)
  3534. {
  3535. result += '<li><a href="#" id="_deleteobject">Delete Camera</a>';
  3536. uroPopup.hasDeleteLink = true;
  3537. }
  3538. result += '</ul>';
  3539. uroPopup.result += result;
  3540. uroPopup.Show();
  3541. }
  3542. }
  3543. },
  3544. Comment: function()
  3545. {
  3546. if(uroUtils.GetCBChecked('_cbInhibitMapCommentPopup') === false)
  3547. {
  3548. if(uroMCLayer.name !== 'mapComments')
  3549. {
  3550. uroInit.WazeBits();
  3551. }
  3552. if(uroMCLayer !== null)
  3553. {
  3554. let result = '';
  3555.  
  3556. if(uroPopup.renderIntent == 'highlight')
  3557. {
  3558. let moAttrs = uroMarkers.obj.attributes;
  3559. if(uroUtils.GetExtent().intersectsBounds(moAttrs.geometry.getBounds()))
  3560. {
  3561. if(uroPopup.newPopupType === null)
  3562. {
  3563. if((uroMousedOverMapComment === moAttrs.id) && (uroMousedOverOtherObjectWithinMapComment === true))
  3564. {
  3565. uroDBG.AddLog('inhibit popup for map comment '+uroMousedOverMapComment);
  3566. }
  3567. else
  3568. {
  3569. uroMousedOverOtherObjectWithinMapComment = false;
  3570. if(moAttrs.geometry.id.indexOf('Polygon') !== -1)
  3571. {
  3572. // only capture ID for area comments...
  3573. uroMousedOverMapComment = moAttrs.id;
  3574. }
  3575. uroFID = moAttrs.id;
  3576. uroDBG.AddLog('building popup for map comment '+uroFID);
  3577.  
  3578. result += '<b>';
  3579. if(moAttrs.subject === '')
  3580. {
  3581. result += '<i>No subject</i>';
  3582. }
  3583. else result += uroUtils.Clickify(moAttrs.subject, '');
  3584. result += '</b><br>';
  3585. result += uroUtils.Clickify(moAttrs.body, '<br>');
  3586.  
  3587. let mcDaysOld = uroUtils.GetMCAge(moAttrs, 0, false);
  3588. let mcSubmittedTS = uroUtils.GetMCAge(moAttrs, 0, true);
  3589. if(mcSubmittedTS != -1)
  3590. {
  3591. mcSubmittedTS = uroUtils.GetDateTimeString(mcSubmittedTS);
  3592. }
  3593. if(mcDaysOld != -1)
  3594. {
  3595. result += '<i>Submitted ' + uroUtils.ParseDaysAgo(mcDaysOld) + ' ';
  3596. if(mcSubmittedTS != -1) result += '(' + mcSubmittedTS + ') ';
  3597. if(moAttrs.createdBy != null)
  3598. {
  3599. result += ' by '+uroUtils.GetUserNameAndRank(moAttrs.createdBy);
  3600. }
  3601. result += '</i><br>';
  3602. }
  3603. mcDaysOld = uroUtils.GetMCAge(moAttrs, 1, false);
  3604. mcSubmittedTS = uroUtils.GetMCAge(moAttrs, 1, true);
  3605. if(mcSubmittedTS != -1)
  3606. {
  3607. mcSubmittedTS = uroUtils.GetDateTimeString(mcSubmittedTS);
  3608. }
  3609. if(mcDaysOld != -1)
  3610. {
  3611. result += '<i>Updated ' + uroUtils.ParseDaysAgo(mcDaysOld) + ' ';
  3612. if(mcSubmittedTS != -1) result += '(' + mcSubmittedTS + ') ';
  3613. if(moAttrs.createdBy != null)
  3614. {
  3615. result += ' by '+uroUtils.GetUserNameAndRank(moAttrs.updatedBy);
  3616. }
  3617. result += '</i><br>';
  3618. }
  3619.  
  3620. mcDaysOld = uroUtils.GetMCAge(moAttrs,2,false);
  3621. mcSubmittedTS = uroUtils.GetMCAge(moAttrs,2,true);
  3622. if(mcDaysOld != -1)
  3623. {
  3624. result += '<i>Expires ' + uroUtils.ParseDaysToGo(mcDaysOld) + ' ';
  3625. result += '(' + uroUtils.GetDateTimeString(mcSubmittedTS) +')</i><br>';
  3626. }
  3627.  
  3628. let mcHasMyComments = false;
  3629. let mcNComments = moAttrs.conversation.length;
  3630. if(mcNComments > 0)
  3631. {
  3632. for(let j=0; j<mcNComments; j++)
  3633. {
  3634. if(moAttrs.conversation[j].userID == uroUserID)
  3635. {
  3636. mcHasMyComments = true;
  3637. break;
  3638. }
  3639. }
  3640. }
  3641. result += '<br>' + mcNComments +' comment';
  3642. if(mcNComments != 1) result += 's';
  3643. if((mcHasMyComments === false) && (mcNComments > 0)) result += ' (none by me)';
  3644.  
  3645. // add "ignore for this session" link
  3646. result += '<br><a href="#" id="_addtoignore">Hide for this session</a>';
  3647. uroPopup.hasIgnoreLink = true;
  3648.  
  3649. uroPopup.newPopupType = 'map_comment';
  3650. uroPopup.isMapComment = true;
  3651.  
  3652. uroPopup.result += result;
  3653. uroPopup.Show();
  3654. }
  3655. }
  3656. else
  3657. {
  3658. let mcOtherID = moAttrs.id;
  3659. uroDBG.AddLog('map comment '+mcOtherID+' is also highlighted');
  3660. }
  3661. }
  3662. else
  3663. {
  3664. uroDBG.AddLog('map comment '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  3665. }
  3666. }
  3667. }
  3668. }
  3669. },
  3670. AddClosureRow: function(rcObj)
  3671. {
  3672. let startDate = rcObj.attributes.startDate;
  3673. let endDate = "unknown";
  3674. if(rcObj.attributes.endDate !== null)
  3675. {
  3676. endDate = rcObj.attributes.endDate;
  3677. }
  3678. let provider = "---";
  3679. if(rcObj.attributes.provider !== null)
  3680. {
  3681. provider = rcObj.attributes.provider;
  3682. }
  3683. else if(rcObj.attributes.createdBy !== null)
  3684. {
  3685. provider = uroUtils.GetUserNameAndRank(rcObj.attributes.createdBy);
  3686. }
  3687. let reason = "---";
  3688. if(rcObj.attributes.reason !== null)
  3689. {
  3690. reason = rcObj.attributes.reason;
  3691. }
  3692. let mte = "---";
  3693. if(rcObj.attributes.eventId !== null)
  3694. {
  3695. try
  3696. {
  3697. mte = W.model.majorTrafficEvents.objects[rcObj.attributes.eventId].attributes.names[0].value;
  3698. }
  3699. catch(err)
  3700. {
  3701. }
  3702. }
  3703. let startOffset = uroGetRTCOffset(rcObj.attributes.startDate);
  3704. let duration = uroGetRTCDuration(rcObj);
  3705. let durationStr = '';
  3706.  
  3707. if(duration > 1)
  3708. {
  3709. durationStr = I18n.lookup("datetime.distance_in_words.x_days").other;
  3710. durationStr = durationStr.replace("%{count}", duration);
  3711. }
  3712. else
  3713. {
  3714. durationStr = I18n.lookup("datetime.distance_in_words.x_days").one;
  3715. if(duration === 0)
  3716. {
  3717. durationStr = "<" + durationStr;
  3718. }
  3719. }
  3720. let state = uroGetRTCState(rcObj);
  3721. let status = uroGetRTCStateText(rcObj);
  3722. let bgCol = '';
  3723. if(state === uroEnums.SRTC.EXPIRED)
  3724. {
  3725. bgCol = '#A0A0A0';
  3726. }
  3727. else if(state === uroEnums.SRTC.ACTIVE)
  3728. {
  3729. bgCol = '#FFFFFF';
  3730. }
  3731. else if(state === uroEnums.SRTC.FUTURE)
  3732. {
  3733. // For future closures, override the default status text with an indication
  3734. // of how many days until the start of the closure
  3735. if(startOffset == 0)
  3736. {
  3737. status = I18n.lookup("date.today");
  3738. status = status.charAt(0).toUpperCase() + status.slice(1);
  3739. }
  3740. else if(startOffset == 1)
  3741. {
  3742. status = I18n.lookup("datetime.distance_in_words.x_days").one;
  3743. }
  3744. else
  3745. {
  3746. status = I18n.lookup("datetime.distance_in_words.x_days").other;
  3747. status = status.replace("%{count}", startOffset);
  3748. }
  3749. bgCol = '#C0C0C0';
  3750. }
  3751. let result = '';
  3752. result += '<tr bgcolor="' + bgCol + '">';
  3753. result += '<td nowrap>' + status + '</td>';
  3754. result += '<td nowrap>' + startDate + ' to ' + endDate + ' (' + durationStr + ')</td>';
  3755. result += '<td nowrap>' + provider + '</td>';
  3756. result += '<td nowrap>' + reason + '</td>';
  3757. result += '<td nowrap>' + mte + '</td>';
  3758. result += '</td></tr>';
  3759. return result;
  3760. },
  3761. AddClosureDetails: function(cTypes, addType, addDesc)
  3762. {
  3763. let retval = '';
  3764. if((cTypes & addType) === addType)
  3765. {
  3766. retval += '<tr><td colspan=4><b>' + addDesc + ':</b></td></tr>';
  3767. for(let closure in uroRTCObjs)
  3768. {
  3769. if(uroRTCObjs.hasOwnProperty(closure))
  3770. {
  3771. let cObj = uroRTCObjs[closure];
  3772. if(cObj.direction === addType)
  3773. {
  3774. retval += uroPopup.AddClosureRow(cObj);
  3775. }
  3776. }
  3777. }
  3778. }
  3779. return retval;
  3780. },
  3781. Segment: function()
  3782. {
  3783. if(uroUtils.GetCBChecked('_cbInhibitSegPopup') === false)
  3784. {
  3785. {
  3786. if(uroUtils.GetExtent().intersectsBounds(uroMarkers.obj.attributes.geometry.getBounds()))
  3787. {
  3788. let result = '';
  3789. let doPopUp = false;
  3790. let restObj;
  3791.  
  3792. if(uroMousedOverMapComment !== null)
  3793. {
  3794. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for segment highlight');
  3795. uroMousedOverOtherObjectWithinMapComment = true;
  3796. }
  3797.  
  3798. let streetID = uroMarkers.obj.attributes.primaryStreetID;
  3799. if(streetID !== null)
  3800. {
  3801. // generic segment data
  3802. if(uroUtils.GetCBChecked('_cbInhibitSegGenericPopup') === false)
  3803. {
  3804. doPopUp = true;
  3805. uroDBG.AddLog('building popup for segment '+streetID);
  3806.  
  3807. let isToll = ((uroMarkers.obj.attributes.fwdToll == true) || (uroMarkers.obj.attributes.revToll == true));
  3808. result += uroGetAddress(streetID, null, true, false, isToll);
  3809.  
  3810. if(uroMarkers.obj.attributes.streetIDs.length > 0)
  3811. {
  3812. // list any alternate names
  3813. result += '<br>Alternate names:<br>';
  3814. for(let i = 0; i < uroMarkers.obj.attributes.streetIDs.length; ++i)
  3815. {
  3816. result += '&nbsp;<i>' + W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.name + ', ';
  3817. let cityName = "";
  3818. if(W.model.cities.objects[W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.cityID] != undefined)
  3819. {
  3820. cityName = W.model.cities.objects[W.model.streets.objects[uroMarkers.obj.attributes.streetIDs[i]].attributes.cityID].attributes.name;
  3821. }
  3822. if(cityName != "")
  3823. {
  3824. result += cityName;
  3825. }
  3826. else
  3827. {
  3828. result += ' no city';
  3829. }
  3830. result += '</i><br>';
  3831. }
  3832. result += '<br>';
  3833. }
  3834.  
  3835. result += '<b>ID: </b>'+uroMarkers.obj.attributes.id+' - ';
  3836. result += uroPopup.GetFormattedLocks(uroMarkers.obj.attributes);
  3837. result += ' - ';
  3838.  
  3839. let level = uroMarkers.obj.attributes.level;
  3840. result += '<b>' + I18n.lookup("edit.segment.fields.level") +': </b>';
  3841. if(level == 0)
  3842. {
  3843. result += I18n.lookup("edit.segment.levels")[0];
  3844. }
  3845. else
  3846. {
  3847. result += level;
  3848. }
  3849. result += '<br>';
  3850.  
  3851. let leBy = uroMarkers.obj.attributes.updatedBy;
  3852. let leOn = uroMarkers.obj.attributes.updatedOn;
  3853. if(leOn == null)
  3854. {
  3855. leBy = uroMarkers.obj.attributes.createdBy;
  3856. leOn = uroMarkers.obj.attributes.createdOn;
  3857. }
  3858. result += "<b>Last edit by</b> " + uroUtils.GetUserNameAndRank(leBy) + " <b>on</b> " + uroUtils.GetDateTimeString(leOn) + "<br><br>";
  3859.  
  3860. let fwdSpeed = uroMarkers.obj.attributes.fwdMaxSpeed;
  3861. let revSpeed = uroMarkers.obj.attributes.revMaxSpeed;
  3862. let fwdLanes = uroMarkers.obj.attributes.fwdLaneCount;
  3863. let revLanes = uroMarkers.obj.attributes.revLaneCount;
  3864. let fwdWidth = 'Not set';
  3865. let revWidth = 'Not set';
  3866. if(uroMarkers.obj.attributes.fromLanesInfo != null)
  3867. {
  3868. fwdWidth = uroGetLengthString(uroMarkers.obj.attributes.fromLanesInfo.laneWidth);
  3869. }
  3870. if(uroMarkers.obj.attributes.toLanesInfo != null)
  3871. {
  3872. revWidth = uroGetLengthString(uroMarkers.obj.attributes.toLanesInfo.laneWidth);
  3873. }
  3874. let fwdUnverified = uroMarkers.obj.attributes.fwdMaxSpeedUnverified;
  3875. let revUnverified = uroMarkers.obj.attributes.revMaxSpeedUnverified;
  3876. let fwdASC = ((uroMarkers.obj.attributes.fwdFlags & 1) === 1);
  3877. let revASC = ((uroMarkers.obj.attributes.revFlags & 1) === 1);
  3878. let roadType = uroMarkers.obj.attributes.roadType;
  3879. let verifyLimits = true;
  3880. if((roadType === 17) || (roadType === 20))
  3881. {
  3882. verifyLimits = false;
  3883. }
  3884.  
  3885. result += '<table border=1><tr><th>Dir</th><th>Speed</th><th>ASC</th><th>Lanes</th><th>Width</th></tr>';
  3886. if(uroMarkers.obj.attributes.fwdDirection)
  3887. {
  3888. result += '<tr><td><b>A-B</b></td><td>'+uroUtils.GetLocalisedSpeedString(fwdSpeed)+'</td><td>';
  3889. if(fwdASC == true)
  3890. {
  3891. result += 'Yes';
  3892. }
  3893. else
  3894. {
  3895. result += 'No';
  3896. }
  3897. result += '</td><td>';
  3898. if(fwdLanes > 0)
  3899. {
  3900. result += fwdLanes;
  3901. }
  3902. else
  3903. {
  3904. result += 'Not set';
  3905. }
  3906. result += '</td><td>'+fwdWidth+'</td></tr>';
  3907. }
  3908. if(uroMarkers.obj.attributes.revDirection)
  3909. {
  3910. result += '<tr><td><b>B-A</b></td><td>'+uroUtils.GetLocalisedSpeedString(revSpeed)+'</td><td>';
  3911. if(revASC == true)
  3912. {
  3913. result += 'Yes';
  3914. }
  3915. else
  3916. {
  3917. result += 'No';
  3918. }
  3919. result += '</td><td>';
  3920. if(revLanes > 0)
  3921. {
  3922. result += revLanes;
  3923. }
  3924. else
  3925. {
  3926. result += 'Not set';
  3927. }
  3928. result += '</td><td>'+revWidth+'</td></tr>';
  3929. }
  3930. result += '</table>';
  3931.  
  3932. if((uroMarkers.obj.attributes.fwdDirection) && (uroMarkers.obj.attributes.revDirection) && (fwdSpeed != revSpeed) && (!fwdUnverified) && (!revUnverified))
  3933. {
  3934. result += '<br>Two-way segment has different verified speed limits...';
  3935. }
  3936. }
  3937.  
  3938. // segment restrictions
  3939. if(uroMarkers.obj.attributes.restrictions.length > 0)
  3940. {
  3941. result += '<br><table border=1>';
  3942. doPopUp = true;
  3943. let fwdResult = '<tr><td colspan=13><b>A-B restrictions:</b></td></tr>';
  3944. let revResult = '<tr><td colspan=13><b>B-A restrictions:</b></td></tr>';
  3945. let bothResult = '<tr><td colspan=13><b>Two-way restrictions:</b></td></tr>';
  3946.  
  3947. let nABRestrictions = 0;
  3948. let nBARestrictions = 0;
  3949. let nBothRestrictions = 0;
  3950. for(let idx = 0; idx < uroMarkers.obj.attributes.restrictions.length; idx++)
  3951. {
  3952. restObj = uroMarkers.obj.attributes.restrictions[idx];
  3953. if(restObj._direction === "FWD")
  3954. {
  3955. nABRestrictions++;
  3956. fwdResult += uroFormatRestriction(restObj);
  3957. }
  3958. else if(restObj._direction === "REV")
  3959. {
  3960. nBARestrictions++;
  3961. revResult += uroFormatRestriction(restObj);
  3962. }
  3963. else if(restObj._direction === "BOTH")
  3964. {
  3965. nBothRestrictions++;
  3966. bothResult += uroFormatRestriction(restObj);
  3967. }
  3968. else
  3969. {
  3970. uroDBG.AddLog("unknown restriction direction...");
  3971. }
  3972. }
  3973. if(nABRestrictions > 0)
  3974. {
  3975. result += fwdResult;
  3976. }
  3977. if(nBARestrictions > 0)
  3978. {
  3979. result += revResult;
  3980. }
  3981. if(nBothRestrictions > 0)
  3982. {
  3983. result += bothResult;
  3984. }
  3985. result += '</table>';
  3986. }
  3987. if(uroLayers.layers[uroLayers.ID.RTC].l.getVisibility() === true)
  3988. {
  3989. let closureTypes = uroGetSelectedSegmentRTCs(uroMarkers.obj.attributes.id);
  3990. if(closureTypes !== uroEnums.DRTC.NONE)
  3991. {
  3992. result += '<br><table border=1 width="100%">';
  3993.  
  3994. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.SEG_AB, "A-B closures");
  3995. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.SEG_BA, "B-A closures");
  3996. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.SEG_BI, "Two-way closures");
  3997. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.TURN_OUT, "Outbound turn closures");
  3998. result += uroPopup.AddClosureDetails(closureTypes, uroEnums.DRTC.TURN_IN, "Inbound turn closures");
  3999. doPopUp = true;
  4000. result += '</table>';
  4001. }
  4002. }
  4003.  
  4004. if(doPopUp === true)
  4005. {
  4006. uroFID = uroMarkers.obj.attributes.id;
  4007. uroPopup.newPopupType = 'segment_restriction';
  4008. }
  4009. }
  4010. uroPopup.result += result;
  4011. uroPopup.Show();
  4012. }
  4013. else
  4014. {
  4015. uroDBG.AddLog('segment '+uroFID+' has renderIntent==highlight but is offscreen... blocking popup');
  4016. }
  4017. }
  4018. }
  4019. },
  4020. Node: function()
  4021. {
  4022. if(uroUtils.GetCBChecked('_cbInhibitNodesPopup') === false)
  4023. {
  4024. let result = '';
  4025. let ureq = W.model.nodes.objects[uroMarkers.id];
  4026. if(ureq === undefined)
  4027. {
  4028. uroMarkers.id = null;
  4029. }
  4030. else
  4031. {
  4032. if(uroMousedOverMapComment !== null)
  4033. {
  4034. uroDBG.AddLog('setting uroMousedOverOtherObjectWithinMapComment for node highlight');
  4035. uroMousedOverOtherObjectWithinMapComment = true;
  4036. }
  4037. uroPopup.newPopupType = 'node';
  4038. uroFID = uroMarkers.id;
  4039. uroDBG.AddLog('building popup for node '+uroFID);
  4040. result += '<b>Node: ' + uroFID + '</b><br>';
  4041.  
  4042. let nodeSegRTCs = [];
  4043. for(let k=0; k<ureq.attributes.segIDs.length; k++)
  4044. {
  4045. let nodeSegID = ureq.attributes.segIDs[k];
  4046. let nodeSegObj = W.model.segments.objects[nodeSegID];
  4047. if(nodeSegObj !== undefined)
  4048. {
  4049. let nodeStreetID = nodeSegObj.attributes.primaryStreetID;
  4050. result += uroGetAddress(nodeStreetID, null, false, true, false);
  4051. }
  4052. uroGetSelectedSegmentRTCs(nodeSegID);
  4053. nodeSegRTCs = nodeSegRTCs.concat(uroRTCObjs);
  4054. }
  4055. }
  4056. uroPopup.result += result;
  4057. uroPopup.Show();
  4058. }
  4059. },
  4060. UMPExtras: function(ureq)
  4061. {
  4062. // add "open new WME tab" link
  4063. let urPos=new OpenLayers.LonLat();
  4064. if(uroPopup.isPlaceUpdate)
  4065. {
  4066. urPos.lon = ureq.getOLGeometry().getCentroid().x;
  4067. urPos.lat = ureq.getOLGeometry().getCentroid().y;
  4068. }
  4069. else
  4070. {
  4071. if(ureq.attributes.geometry.realX === undefined)
  4072. {
  4073. urPos.lon = ureq.attributes.geometry.x;
  4074. urPos.lat = ureq.attributes.geometry.y;
  4075. }
  4076. else
  4077. {
  4078. urPos.lon = ureq.attributes.geometry.realX;
  4079. urPos.lat = ureq.attributes.geometry.realY;
  4080. }
  4081. }
  4082. urPos = uroUtils.ConvertMercatorToWGS84(urPos);
  4083. let urLink = document.location.href;
  4084. let urLayers = '';
  4085. urLink = urLink.substr(0,urLink.indexOf('?zoomLevel'));
  4086. urLink += '?zoomLevel=17&lat='+urPos.lat+'&lon='+urPos.lon+urLayers;
  4087.  
  4088. if(uroPopup.isUR) urLink += '&mapUpdateRequest='+uroMarkers.id;
  4089. else if(uroPopup.isTurnProb) urLink += '&showturn='+uroMarkers.id+'&endshow';
  4090. else if(uroPopup.isProblem) urLink += '&mapProblem='+uroMarkers.id;
  4091. else if(uroPopup.isPlaceUpdate)
  4092. {
  4093. if(uroMarkers.type == uroLayers.ID.PUR)
  4094. {
  4095. urLink += '&showpur='+uroMarkers.id+'&endshow';
  4096. }
  4097. else
  4098. {
  4099. urLink += '&showppur='+uroMarkers.id+'&endshow';
  4100. }
  4101. }
  4102.  
  4103. let targetTab = "_uroTab_" + Math.round(Math.random()*1000000);
  4104. uroPopup.result += '<hr><ul><li><a href="'+urLink+'" id="_openInNewTab" target="'+targetTab+'">Open in new tab</a> - ';
  4105. uroPopup.hasOpenInNewTabLink = true;
  4106. uroPopup.result += '<a href="#" id="_recentreSession">centre in current tab</a>';
  4107. uroPopup.hasRecentreSessionLink = true;
  4108.  
  4109. // add "open new livemap tab" link
  4110. let lmLink = null;
  4111. if(document.getElementById("livemap-link") != null)
  4112. {
  4113. uroDBG.AddLog('Livemap link in livemap-link id element');
  4114. lmLink = document.getElementById("livemap-link").href;
  4115. }
  4116. else if(document.getElementsByClassName("livemap-link") != null)
  4117. {
  4118. uroDBG.AddLog('Livemap link in livemap-link class element');
  4119. lmLink = document.getElementsByClassName("livemap-link")[0].href;
  4120. }
  4121. else
  4122. {
  4123. uroDBG.AddLog('Livemap link not found...');
  4124. }
  4125. if(lmLink !== null)
  4126. {
  4127. let zpos = lmLink.indexOf('?');
  4128. if(zpos > -1) lmLink = lmLink.substr(0,zpos);
  4129. lmLink += '?zoom=17&lat='+urPos.lat+'&lon='+urPos.lon+'&layers=BTTTT';
  4130. uroPopup.result += '<li><a href="'+lmLink+'" target="_lmTab">Open in new livemap tab</a>';
  4131. }
  4132. if(!uroPopup.isPlaceUpdate)
  4133. {
  4134. // add "ignore for this session" link
  4135. uroPopup.result += '<li><a href="#" id="_addtoignore">Hide for this session</a></ul>';
  4136. uroPopup.hasIgnoreLink = true;
  4137. }
  4138.  
  4139. uroPopup.Show();
  4140. },
  4141. Preamble: function()
  4142. {
  4143. let retval = true;
  4144.  
  4145. if
  4146. (
  4147. (uroMarkers.type === null) &&
  4148. (uroPopup.timer === 0)
  4149. )
  4150. {
  4151. if(uroPopup.shown === true)
  4152. {
  4153. uroPopup.Hide();
  4154. }
  4155. uroMousedOverMapComment = null;
  4156. retval = false;
  4157. }
  4158. if(retval === true)
  4159. {
  4160. if(uroMTEMode)
  4161. {
  4162. retval = false;
  4163. }
  4164. }
  4165.  
  4166. if(retval === true)
  4167. {
  4168. if(!uroInit.initialised)
  4169. {
  4170. retval = false;
  4171. }
  4172. }
  4173.  
  4174. if(retval === true)
  4175. {
  4176. if((uroMouseIsDown) && (uroMarkers.mouseButtons === 0))
  4177. {
  4178. uroDBG.AddLog('trapped erroneous mousedown state');
  4179. uroMouseIsDown = false;
  4180. }
  4181. if(uroMouseIsDown)
  4182. {
  4183. retval = false;
  4184. }
  4185. }
  4186.  
  4187. if(retval === true)
  4188. {
  4189. if(OpenLayers === null)
  4190. {
  4191. if(uroNullOpenLayers === false)
  4192. {
  4193. uroDBG.AddLog('caught null OpenLayers');
  4194. uroNullOpenLayers = true;
  4195. }
  4196. retval = false;
  4197. }
  4198. else
  4199. {
  4200. uroNullOpenLayers = false;
  4201. }
  4202. }
  4203.  
  4204. if(retval === true)
  4205. {
  4206. if(uroLayers.layers[uroLayers.ID.UR].l === null)
  4207. {
  4208. if(uroNullURLayer === false)
  4209. {
  4210. uroDBG.AddLog('caught null UR layer');
  4211. uroNullURLayer = true;
  4212. }
  4213. retval = false;
  4214. }
  4215. else
  4216. {
  4217. uroNullURLayer = false;
  4218. }
  4219. }
  4220.  
  4221. if(retval === true)
  4222. {
  4223. if(uroLayers.layers[uroLayers.ID.MP].l === null)
  4224. {
  4225. if(uroNullProblemLayer === false)
  4226. {
  4227. uroDBG.AddLog('caught null problem layer');
  4228. uroNullProblemLayer = true;
  4229. }
  4230. retval = false;
  4231. }
  4232. else
  4233. {
  4234. uroNullProblemLayer = false;
  4235. }
  4236. }
  4237.  
  4238. if(retval === true)
  4239. {
  4240. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  4241. {
  4242. retval = false;
  4243. }
  4244. }
  4245.  
  4246. if(retval === true)
  4247. {
  4248. if(uroTestPointerOutsideMap(uroMarkers.clientX, uroMarkers.clientY))
  4249. {
  4250. retval = false;
  4251. }
  4252. }
  4253.  
  4254.  
  4255. if(retval === true)
  4256. {
  4257. uroPopup.mouseX = uroMarkers.mouseX;
  4258. uroPopup.mouseY = uroMarkers.mouseY;
  4259. uroPopup.result = '';
  4260. uroPopup.hasIgnoreLink = false;
  4261. uroPopup.hasDeleteLink = false;
  4262. uroPopup.hasAddWatchLink = false;
  4263. uroPopup.hasRemoveWatchLink = false;
  4264. uroPopup.hasUpdateWatchLink = false;
  4265. uroPopup.hasRecentreSessionLink = false;
  4266. uroPopup.hasOpenInNewTabLink = false;
  4267. uroPopup.isVenue = false;
  4268. uroPopup.isMapComment = false;
  4269. uroPopup.newPopupType = null;
  4270. uroPopup.ureqID = null;
  4271. uroPopup.isUR = false;
  4272. uroPopup.isProblem = false;
  4273. uroPopup.isTurnProb = false;
  4274. uroPopup.isPlaceUpdate = false;
  4275. uroPopup.renderIntent = uroGetFeatureRenderIntent(uroMarkers.obj);
  4276.  
  4277. uroInit.WazeBits();
  4278.  
  4279. let mouseLonLat = W.map.getLonLatFromViewPortPx(new OpenLayers.Pixel(uroPopup.mouseX, uroPopup.mouseY));
  4280. let mousePoint = new OpenLayers.Geometry.Point(mouseLonLat.lon, mouseLonLat.lat);
  4281. if(uroMousedOverMapComment !== null)
  4282. {
  4283. if(W.model.mapComments.objects[uroMousedOverMapComment] === undefined)
  4284. {
  4285. uroDBG.AddLog('clearing uroMousedOverMapComment: object no longer exists in current map view');
  4286. uroMousedOverMapComment = null;
  4287. }
  4288. else if(W.model.mapComments.objects[uroMousedOverMapComment].attributes.geometry.containsPoint(mousePoint) === false)
  4289. {
  4290. uroDBG.AddLog('clearing uroMousedOverMapComment: pointer no longer within comment boundary');
  4291. uroMousedOverMapComment = null;
  4292. }
  4293. }
  4294. let popupXOffset = document.getElementById('editor-container').getBoundingClientRect().x;
  4295. let popupYOffset = $(document.getElementById("WazeMap")).offset().top;
  4296. uroPopup.pX = uroPopup.mouseX + popupXOffset + 10;
  4297. uroPopup.pY = uroPopup.mouseY + popupYOffset;
  4298. }
  4299.  
  4300. return retval;
  4301. },
  4302. Show: function()
  4303. {
  4304. if(uroPopup.suppressed === false)
  4305. {
  4306. if((uroFID != uroShownFID) || (uroPopup.newPopupType != uroPopup.shownType))
  4307. {
  4308. if(uroFID != uroShownFID) uroDBG.AddLog('FID mismatch, show popup: '+uroFID+'/'+uroShownFID);
  4309. else uroDBG.AddLog('Popup type mismatch: '+uroPopup.newPopupType+'/'+uroPopup.shownType);
  4310. uroShownFID = uroFID;
  4311. uroPopup.shownType = uroPopup.newPopupType;
  4312. uroPopup.shown = false;
  4313. }
  4314. if(uroPopup.shown === false)
  4315. {
  4316. uroPopup.shown = true;
  4317. uroDiv.style.height = "auto";
  4318. uroDiv.style.width = "auto";
  4319. uroDiv.style.overflow = "auto";
  4320. uroDiv.innerHTML = uroUtils.ModifyHTML(uroPopup.result);
  4321. if((uroFID != -1) && (uroPopup.hasIgnoreLink === true))
  4322. {
  4323. uroUtils.AddEventListener('_addtoignore','click', uroIgnore.Add, true);
  4324. }
  4325. if(uroPopup.hasOpenInNewTabLink === true)
  4326. {
  4327. uroUtils.AddEventListener('_openInNewTab','mouseup', uroOpenNewTab, true);
  4328. }
  4329. if(uroPopup.hasRecentreSessionLink === true)
  4330. {
  4331. if(uroPopup.isUR) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnUR, true);
  4332. else if((uroPopup.isProblem)||(uroPopup.isTurnProb)) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnMP, true);
  4333. else if(uroPopup.isPlaceUpdate)
  4334. {
  4335. if(uroPopup.newPopupType == uroLayers.ID.PUR)
  4336. {
  4337. uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnPUR, true);
  4338. }
  4339. else
  4340. {
  4341. uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnPPUR, true);
  4342. }
  4343. }
  4344. else if(uroPopup.isVenue) uroUtils.AddEventListener('_recentreSession', 'click', uroRecentreSessionOnVenueNavPoint, true);
  4345. }
  4346. // restrict the popup width to be no wider than just under half the window width to avoid it
  4347. // completely overlapping the marker it's associated with - by keeping it to just below half
  4348. // the window width we guarantee that it'll fit either to the left or the right of the marker
  4349. // no matter how far across the screen the marker is located...
  4350. let rw = parseInt(uroDiv.clientWidth);
  4351. if(rw > (window.innerWidth * 0.45))
  4352. {
  4353. rw = (window.innerWidth * 0.45);
  4354. uroDiv.style.width = rw+'px';
  4355. }
  4356. // get the div height after any adjustment of the width above, to account for whatever content
  4357. // reflow may have occurred as a result of reducing the width...
  4358. let rh = parseInt(uroDiv.clientHeight);
  4359. // similarly restrict the popup height to avoid it dropping of the bottom of the screen if a
  4360. // segment has a bunch of closures/restrictions
  4361. rh = parseInt(uroDiv.clientHeight);
  4362. if(rh > (window.innerHeight * 0.80))
  4363. {
  4364. rh = (window.innerHeight * 0.80);
  4365. uroDiv.style.height = rh+'px';
  4366. uroDiv.style.overflow = 'scroll';
  4367. }
  4368. let origPopupX = uroPopup.pX;
  4369. let movedLeft = false;
  4370. if((uroPopup.pX + rw) > window.innerWidth)
  4371. {
  4372. // where the popup would be off the right hand side of the screen, move it completely over to the
  4373. // other side of the mouse pointer
  4374. uroPopup.pX -= (rw + 20);
  4375. if(uroPopup.pX < 0) uroPopup.pX = 0;
  4376. movedLeft = true;
  4377. }
  4378. if((uroPopup.pY + rh) > window.innerHeight)
  4379. {
  4380. // where the popup would be off the bottom of the screen, shift it up just far enough to be
  4381. // fully visible
  4382. uroPopup.pY -= (((uroPopup.pY + rh) - window.innerHeight) + 30);
  4383. }
  4384. if(uroPopup.pY < 0) uroPopup.pY = 0;
  4385. uroDiv.style.top = uroPopup.pY+'px';
  4386. uroDiv.style.left = uroPopup.pX+'px';
  4387. if(movedLeft === true)
  4388. {
  4389. // after relocating the popup to the left of the pointer, it may end up resizing itself
  4390. // which may then cause it to completely overlap the UR marker, so perform one more check
  4391. // of the div width and nudge to the left if required...
  4392. rw = parseInt(uroDiv.clientWidth);
  4393. if(rw > (window.innerWidth * 0.45))
  4394. {
  4395. rw = (window.innerWidth * 0.45);
  4396. uroDiv.style.width = rw+'px';
  4397. }
  4398. let nudgeDist = parseInt(20 + (uroPopup.pX + rw) - origPopupX);
  4399. if((uroPopup.pX + rw + 30) >= origPopupX)
  4400. {
  4401. uroDiv.style.left = parseInt(uroPopup.pX - nudgeDist)+'px';
  4402. }
  4403. }
  4404.  
  4405. uroDBG.AddLog('display popup at '+uroPopup.pX+','+uroPopup.pY);
  4406. uroDiv.style.visibility = 'visible';
  4407. uroPopup.autoHideTimer = (uroUtils.GetElmValue('_inputPopupAutoHideTimeout') * 10);
  4408. }
  4409. uroPopup.timer = -1;
  4410. }
  4411. },
  4412. Generate: function()
  4413. {
  4414. if(uroPopup.Preamble() === true)
  4415. {
  4416. if(uroMarkers.type === uroLayers.ID.UR) uroPopup.UR();
  4417. else if(uroMarkers.type === uroLayers.ID.MP) uroPopup.MP();
  4418. else if((uroMarkers.type === uroLayers.ID.PUR)||(uroMarkers.type === uroLayers.ID.PPUR)||(uroMarkers.type === uroLayers.ID.RPUR)) uroPopup.PUR();
  4419. else if(uroMarkers.type === "venue") uroPopup.Venue();
  4420. else if(uroMarkers.type === "cam") uroPopup.Camera();
  4421. else if(uroMarkers.type === "comment") uroPopup.Comment();
  4422. else if(uroMarkers.type === "segment") uroPopup.Segment();
  4423. else if(uroMarkers.type === "node") uroPopup.Node();
  4424. else
  4425. {
  4426. uroDBG.AddLog("request to generate popup for unknown type - " + uroMarkers.type);
  4427. }
  4428. }
  4429. },
  4430. Hide: function()
  4431. {
  4432. if(uroPopup.shown)
  4433. {
  4434. uroDiv.style.visibility = 'hidden';
  4435. uroPopup.shown = false;
  4436. uroPopup.timer = -2;
  4437. uroShownFID = -1;
  4438. }
  4439. uroPopup.suppressed = false;
  4440. },
  4441. Suppress: function()
  4442. {
  4443. uroDiv.style.visibility = 'hidden';
  4444. window.getSelection().removeAllRanges();
  4445. uroPopup.suppressed = true;
  4446. },
  4447. MouseOver: function()
  4448. {
  4449. uroPopup.mouseIn = true;
  4450. },
  4451. MouseOut: function()
  4452. {
  4453. uroPopup.mouseIn = false;
  4454. }
  4455. };
  4456. const uroURExtras = // UR marker enhancements
  4457. {
  4458. urList : [],
  4459. URListEntry: function(id, customType, hasMyComments, nComments, ageLastComment)
  4460. {
  4461. this.id = id;
  4462. this.customType = customType;
  4463. this.hasMyComments = hasMyComments;
  4464. this.nComments = nComments;
  4465. this.ageLastComment = ageLastComment;
  4466. },
  4467. AddToList: function(urID, customType, hasMyComments, nComments, ageLastComment)
  4468. {
  4469. uroURExtras.urList.push(new uroURExtras.URListEntry(urID, customType, hasMyComments, nComments, ageLastComment));
  4470. },
  4471. AddCommentCounts: function()
  4472. {
  4473. // Remove existing count elements before (re-)rendering, as WME doesn't automatically do this
  4474. // for us now that the way it handles the marker layers has changed...
  4475. let toRemove = document.querySelectorAll('#uroCommentCount');
  4476. let trCount = toRemove.length;
  4477. while(trCount > 0)
  4478. {
  4479. --trCount;
  4480. toRemove[trCount].remove();
  4481. }
  4482. let addCommentCount = false;
  4483. let nURs = uroURExtras.urList.length;
  4484.  
  4485. if(uroUtils.GetCBChecked('_cbMasterEnable') === true)
  4486. {
  4487. addCommentCount = ((nURs > 0) && (uroUtils.GetCBChecked('_cbCommentCount') === true));
  4488. }
  4489.  
  4490. if(addCommentCount === true)
  4491. {
  4492. for(let i = 0; i < nURs; ++i)
  4493. {
  4494. let uObj = uroURExtras.urList[i];
  4495. let nComments = uObj.nComments;
  4496. let marker = uroGetMarker(uroLayers.ID.UR, uObj.id);
  4497. if((marker !== null) && (nComments !== 0))
  4498. {
  4499. let mx = (marker.x.baseVal.value - 15);
  4500. let my = (marker.y.baseVal.value + 35);
  4501. let newSpan = '<foreignObject id="uroCommentCount" x="' + mx + '" y="' + my + '" width="100%" height="100%" style="pointer-events: none;">';
  4502.  
  4503. newSpan += '<div style="position:absolute;';
  4504. if(uObj.hasMyComments === true)
  4505. {
  4506. newSpan += 'background-color: yellow;';
  4507. }
  4508. else
  4509. {
  4510. newSpan += 'background-color: white;';
  4511. }
  4512. newSpan += 'font-size: 14px;font-weight: 800;';
  4513. newSpan += 'border-width: 1px;border-style: solid;border-radius: 12px;padding-left: 4px;padding-right: 4px;z-index: 1;';
  4514. newSpan += '">';
  4515. newSpan += nComments + 'c ';
  4516. newSpan += uObj.ageLastComment + 'd';
  4517. newSpan += '</div>';
  4518.  
  4519. newSpan += '</foreignObject>';
  4520. marker.insertAdjacentHTML("afterend", newSpan);
  4521. }
  4522. }
  4523. }
  4524. }
  4525. };
  4526. const uroInit = // script initialisation
  4527. {
  4528. initialised : false,
  4529. setupListeners : true,
  4530. finalisingListenerSetup : false,
  4531.  
  4532. WazeBitsAvailable: function()
  4533. {
  4534. uroDBG.AddLog('All WazeBits present and correct...');
  4535. W.prefs.on('change:isImperial', uroInit.Initialise);
  4536. uroLayers.Init();
  4537. // To avoid creating multiple URO tabs in the event that the initialise code
  4538. // gets called more than once, we now test for the presence of our tab and skip
  4539. // if it's already present
  4540. if(document.getElementById('uroTabHeader') === null)
  4541. {
  4542. uroInit.SetupUI();
  4543. }
  4544. },
  4545. WaitForW: function()
  4546. {
  4547. if(document.getElementsByClassName("sandbox").length > 0)
  4548. {
  4549. uroDBG.AddLog('WME practice mode detected, script is disabled...');
  4550. return;
  4551. }
  4552. if(window.W === undefined)
  4553. {
  4554. window.setTimeout(uroInit.WaitForW, 100);
  4555. return;
  4556. }
  4557. if (W.userscripts?.state?.isReady)
  4558. {
  4559. uroInit.WazeBitsAvailable();
  4560. }
  4561. else
  4562. {
  4563. document.addEventListener("wme-ready", uroInit.WazeBitsAvailable, {once: true});
  4564. }
  4565. },
  4566. AddInterceptor: function()
  4567. {
  4568. uroDBG.AddLog('Adding interceptor functions...');
  4569. // add interceptor function for window.confirm(), to inhibit the closure deletion confirmation that would
  4570. // pop up for each individual closure when we're using the delete all button - the user has already
  4571. // confirmed the delete action using our own requester
  4572. let _confirm = window.confirm;
  4573. window.confirm = function(msg)
  4574. {
  4575. let cm_delete_confirm = I18n.lookup("closures.delete_confirm").split('"')[0].trimRight(1);
  4576. if(msg.indexOf(cm_delete_confirm) != -1)
  4577. {
  4578. uroDBG.AddLog('intercepted closure delete confirmation...');
  4579. if(uroRTCClone.ConfirmDelete)
  4580. {
  4581. return _confirm(msg);
  4582. }
  4583. else
  4584. {
  4585. return true;
  4586. }
  4587. }
  4588. else if(typeof(msg) == 'undefined')
  4589. {
  4590. uroDBG.AddLog('Intercepted blank confirmation...');
  4591. return true;
  4592. }
  4593. else
  4594. {
  4595. return _confirm(msg);
  4596. }
  4597. };
  4598. uroConfirmIntercepted = true;
  4599. },
  4600. Initialise: function()
  4601. {
  4602. uroInit.initialised = false;
  4603. uroInit.setupListeners = true;
  4604. uroInit.finalisingListenerSetup = false;
  4605. uroInit.WaitForW();
  4606. },
  4607. WaitForControlsContainer: function()
  4608. {
  4609. if(document.getElementById('uroControlsContainer') === null)
  4610. {
  4611. window.setTimeout(uroInit.WaitForControlsContainer,500);
  4612. }
  4613. else
  4614. {
  4615. let updateURL = 'https://greasyfork.org/scripts/1952-uroverview-plus-uro';
  4616. uroDBG.AddLog('adding controls to sidebar container...');
  4617. let tabbyHTML = '<div id="uroTabHeader"><b><a href="'+updateURL+'" target="_blank">UROverview Plus</a></b> <label id="_uroVersion">'+uroRelease.version+'</label>';
  4618. tabbyHTML += '<label id="_uroDebugMode">(dbg)</label>';
  4619. tabbyHTML += '&nbsp;<input type="checkbox" id="_cbMasterEnable" checked>Enabled</input>';
  4620. tabbyHTML += uroTabs.CreateTabHeaders();
  4621. tabbyHTML += '</div>';
  4622. document.getElementById('uroControlsContainer').innerHTML = uroUtils.ModifyHTML(tabbyHTML);
  4623. uroTabs.CreateTabBodies();
  4624. // other sidebar elements
  4625. uroAMList = document.createElement('div');
  4626. uroAMList.style.color = "#ffff00";
  4627. uroCtrlHides = document.createElement('div');
  4628. // footer for tabs container
  4629. uroCtrlHides.id = 'uroCtrlHides';
  4630. let tHTML = '<input type="button" id="_btnUndoLastHide" value="Undo last hide" />&nbsp;&nbsp;&nbsp;';
  4631. tHTML += '<input type="button" id="_btnClearSessionHides" value="Undo all hides" /><p>';
  4632. uroCtrlHides.innerHTML = uroUtils.ModifyHTML(tHTML);
  4633. // footer for AM list
  4634. uroAMList.id = 'uroAMList';
  4635. uroTabs.CtrlTabs[0][uroTabs.FIELDS.SHOWFN]();
  4636. window.addEventListener("beforeunload", uroConfig.SaveSettings, false);
  4637. }
  4638. },
  4639. AddTab_API: async function()
  4640. {
  4641. let {tabLabel, tabPane} = W.userscripts.registerSidebarTab("URO+");
  4642. tabLabel.innerText = "URO+";
  4643. tabPane.innerHTML = uroUtils.ModifyHTML(uroControls.innerHTML);
  4644. await W.userscripts.waitForElementConnected(tabPane);
  4645. uroInit.CompleteUISetup();
  4646. },
  4647. CompleteUISetup: function()
  4648. {
  4649. uroDBG.AddLog('waiting for controls container...');
  4650. uroInit.WaitForControlsContainer();
  4651. uroGetProblemTypes();
  4652. uroTabs.AddToDOM();
  4653. document.getElementById('uroControlsContainer').appendChild(uroCtrlHides);
  4654. uroInit.WazeBits();
  4655. uroDiv.addEventListener("mouseover", uroPopup.MouseOver, false);
  4656. uroDiv.addEventListener("mouseout", uroPopup.MouseOut, false);
  4657. if(sessionStorage.UROverview_FID_IgnoreList === undefined) sessionStorage.UROverview_FID_IgnoreList = '';
  4658. if(sessionStorage.UROverview_FID_WatchList === undefined) sessionStorage.UROverview_FID_WatchList = '';
  4659. if(uroConfirmIntercepted === false) uroInit.AddInterceptor();
  4660. uroUtils.AddStyle('urostyle_UnstackedMarkers', '.map-marker.marker-selected { transform: scale(1) !important; }');
  4661. uroMainTickHandlerID = window.setInterval(uroMainTick,1000);
  4662. },
  4663. SetupUI: function()
  4664. {
  4665. // create a new div to display the UR details floaty-box
  4666. uroDiv = document.createElement('div');
  4667. uroDiv.id = "uroDiv";
  4668. uroDiv.style.position = 'absolute';
  4669. uroDiv.style.visibility = 'hidden';
  4670. uroDiv.style.top = '0';
  4671. uroDiv.style.left = '0';
  4672. uroDiv.style.zIndex = 10000;
  4673. uroDiv.style.backgroundColor = 'aliceblue';
  4674. uroDiv.style.borderWidth = '3px';
  4675. uroDiv.style.borderStyle = 'solid';
  4676. uroDiv.style.borderRadius = '10px';
  4677. uroDiv.style.boxShadow = '5px 5px 10px Silver';
  4678. uroDiv.style.padding = '4px';
  4679. document.body.appendChild(uroDiv);
  4680. // create a new div to display script alerts
  4681. uroAlerts = document.createElement('div');
  4682. uroAlerts.id = "uroAlerts";
  4683. uroAlerts.style.position = 'fixed';
  4684. uroAlerts.style.visibility = 'hidden';
  4685. uroAlerts.style.top = '50%';
  4686. uroAlerts.style.left = '50%';
  4687. uroAlerts.style.zIndex = 10000;
  4688. uroAlerts.style.backgroundColor = 'aliceblue';
  4689. uroAlerts.style.borderWidth = '3px';
  4690. uroAlerts.style.borderStyle = 'solid';
  4691. uroAlerts.style.borderRadius = '10px';
  4692. uroAlerts.style.boxShadow = '5px 5px 10px Silver';
  4693. uroAlerts.style.padding = '4px';
  4694. uroAlerts.style.webkitTransform = "translate(-50%, -50%)";
  4695. uroAlerts.style.transform = "translate(-50%, -50%)";
  4696. let alertsHTML = '<div id="header" style="padding: 4px; background-color:LightGreen; font-weight: bold;">Alert title goes here...</div>';
  4697. alertsHTML += '<div id="content" style="padding: 4px; background-color:White; overflow:auto;max-height:500px">Alert content goes here...</div>';
  4698. alertsHTML += '<div id="controls" align="center" style="padding: 4px;">';
  4699. alertsHTML += '<span id="uroAlertTickBtn" style="cursor:pointer;font-size:14px;border:thin outset black;padding:2px 10px 2px 10px;">';
  4700. alertsHTML += '<i class="fa fa-check"> </i>';
  4701. alertsHTML += '<span id="uroAlertTickBtnCaption" style="font-weight: bold;"></span>';
  4702. alertsHTML += '</span>';
  4703. alertsHTML += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  4704. alertsHTML += '<span id="uroAlertCrossBtn" style="cursor:pointer;font-size:14px;border:thin outset black;padding:2px 10px 2px 10px;">';
  4705. alertsHTML += '<i class="fa fa-times"> </i>';
  4706. alertsHTML += '<span id="uroAlertCrossBtnCaption" style="font-weight: bold;"></span>';
  4707. alertsHTML += '</span>';
  4708. alertsHTML += '</div>';
  4709. uroAlerts.innerHTML = uroUtils.ModifyHTML(alertsHTML);
  4710. document.body.appendChild(uroAlerts);
  4711. uroControls = document.createElement('section');
  4712. uroControls.style.fontSize = '12px';
  4713. uroControls.style.height = '100%';
  4714. uroControls.id = "sidepanel-uroverview";
  4715. uroControls.className = "tab-pane";
  4716. uroControls.innerHTML = uroUtils.ModifyHTML('<div id="uroControlsContainer" style="display:flex;flex-direction:column;height:80vh;"></div>');
  4717. uroInit.AddTab_API();
  4718. },
  4719. WazeBits: function()
  4720. {
  4721. uroMCLayer = null;
  4722.  
  4723. for(let i=0; i < W.map.layers.length; i++)
  4724. {
  4725. if(W.map.layers[i].name == 'mapComments') uroMCLayer = W.map.layers[i];
  4726. if(W.map.layers[i].name == 'venues') uroVenueLayer = W.map.layers[i];
  4727. }
  4728. },
  4729. FinalizeListenerSetup: function()
  4730. {
  4731. uroInit.finalisingListenerSetup = true;
  4732. // filter markers when the marker objects are modified (this happens whenever WME needs to load fresh marker data
  4733. // due to having panned/zoomed the map beyond the extents of the previously loaded data)
  4734. W.model.mapUpdateRequests.on("objectschanged", uroFilterURs_onObjectsChanged);
  4735. W.model.mapUpdateRequests.on("objectsadded", uroFilterURs_onObjectsAdded);
  4736. W.model.mapUpdateRequests.on("objectsremoved", uroFilterURs_onObjectsRemoved);
  4737. W.model.updateRequestSessions.on("objectsadded", uroUREvent_onObjectsAdded);
  4738. /*
  4739. W.model.cameras.on("objectschanged", uroFilterCameras);
  4740. W.model.cameras.on("objectsadded", uroFilterCameras);
  4741. W.model.cameras.on("objectsremoved", uroFilterCameras);
  4742. */
  4743. W.model.mapProblems.on("objectschanged", uroFilterProblems);
  4744. W.model.mapProblems.on("objectsadded", uroFilterProblems);
  4745. W.model.mapProblems.on("objectsremoved", uroFilterProblems);
  4746. W.model.venues.on("objectschanged", uroFilterPlaces);
  4747. W.model.venues.on("objectsadded", uroFilterPlaces);
  4748. W.model.venues.on("objectsremoved", uroFilterPlaces);
  4749. W.model.mapComments.on("objectschanged", uroLayers.MCLayerChanged_changed);
  4750. W.model.mapComments.on("objectsadded", uroLayers.MCLayerChanged_added);
  4751. W.model.mapComments.on("objectsremoved", uroLayers.MCLayerChanged_removed);
  4752. uroMarkers.RegisterEvents();
  4753. uroLayers.InitialiseMOs();
  4754. uroUtils.AddEventListener('_btnUndoLastHide', "click", uroIgnore.RemoveLastAdded, true);
  4755. uroUtils.AddEventListener('_btnClearSessionHides', "click", uroIgnore.RemoveAll, true);
  4756. uroIgnore.EnableControls();
  4757. uroUtils.AddEventListener('_btnSettingsToText', "click", uroConfig.SettingsToText, true);
  4758. uroUtils.AddEventListener('_btnTextToSettings', "click", uroConfig.TextToSettings, true);
  4759. uroUtils.AddEventListener('_btnResetSettings', "click", uroConfig.DefaultSettings, true);
  4760. uroUtils.AddEventListener('_btnClearSettingsText', "click", uroConfig.ClearSettingsText, true);
  4761. uroUtils.AddEventListener('_cbMasterEnable', "click", uroFilterItems_MasterEnableClick, true);
  4762. /*
  4763. uroUtils.AddEventListener('_btnDebugToScreen',"click", uroDBG.Dump, true);
  4764. */
  4765. uroUtils.AddEventListener('uroDiv', "dblclick", uroPopup.Suppress, true);
  4766. uroUtils.AddEventListener('_selectCameraUserID', "change", uroCamEditorSelected, true);
  4767. uroUtils.AddEventListener('_selectPlacesUserID', "change", uroPlacesEditorSelected, true);
  4768. uroUtils.AddEventListener('_selectHidePlacesUserID', "change", uroHidePlacesEditorSelected, true);
  4769. uroUtils.AddEventListener('uroAlertTickBtn', 'click', uroAlertBox.CloseWithTick, true);
  4770. uroUtils.AddEventListener('uroAlertCrossBtn', 'click', uroAlertBox.CloseWithCross, true);
  4771. for(let i = 0; i < uroTabs.CtrlTabs.length; ++i)
  4772. {
  4773. uroUtils.SetOnClick(uroTabs.CtrlTabs[i][uroTabs.FIELDS.LINKID], uroTabs.CtrlTabs[i][uroTabs.FIELDS.SHOWFN]);
  4774. }
  4775. for(let idx=0;idx<W.Config.venues.categories.length;idx++)
  4776. {
  4777. uroUtils.SetOnClick('_uroPlacesGroupState-'+idx,uroPlacesGroupCollapseExpand);
  4778. }
  4779. uroDBG.AddLog('finalise onload');
  4780. uroNewLookCheckDetailsRequest();
  4781. // filter markers as and when the map is moved
  4782. W.map.events.register("moveend", null, uroMapMoveEnd.Handler);
  4783. W.map.events.register("moveend", null, uroGetAMs); // uroGetAMs accesses e, so has to be called directly from the event handler
  4784. W.map.events.register("mousemove", null, uroGetAMs);
  4785. W.map.events.register("mousemove", null, uroMarkers.MouseMove);
  4786. W.map.events.registerPriority("mousedown", null, uroMouseDown);
  4787. // trap mousedown on Streetview marker drag
  4788. if(document.getElementsByClassName('street-view-control').length === 0) return;
  4789. document.getElementsByClassName('street-view-control')[0].onmousedown = uroMouseDown;
  4790. W.map.events.register("mouseup", null, uroMouseUp);
  4791. W.map.events.register("mouseout", null, uroMouseOut);
  4792. uroSetSectionTabStyles();
  4793. uroConfig.LoadSettings();
  4794. uroUITweaks.ChangeClustering();
  4795.  
  4796. uroDBG.AddLog('getting user ID...');
  4797. uroUserID = W.loginManager.user.attributes.id;
  4798. uroDBG.AddLog('...ID is '+uroUserID);
  4799. uroDBG.AddLog('filtering...');
  4800. uroFilterItems();
  4801. uroDBG.AddLog('...done');
  4802. uroDBG.showDebugOutput = uroDBG.persistentDebugOutput;
  4803. let dbgMode = "none";
  4804. if(uroDBG.showDebugOutput)
  4805. {
  4806. dbgMode = "inline";
  4807. }
  4808. document.getElementById('_uroDebugMode').style.display = dbgMode;
  4809. uroUtils.AddEventListener('_uroVersion',"click", uroDBG.Toggle, true);
  4810. // add exclusiveCB click handlers to all checkboxes with a pairedWith attribute
  4811. uroDBG.AddLog('adding exclusiveCB handlers...');
  4812. let cbList = document.getElementsByTagName('input');
  4813. for (let optIdx=0;optIdx<cbList.length;optIdx++)
  4814. {
  4815. if((cbList[optIdx].id.indexOf('_cb') === 0) && (cbList[optIdx].attributes.pairedWith != null))
  4816. {
  4817. uroUtils.SetOnClick(cbList[optIdx].id,uroExclusiveCB);
  4818. }
  4819. }
  4820. uroDBG.AddLog('...done');
  4821. // manually call the layer-change handlers on startup, since there's a good chance WME will already have
  4822. // completed its own startup layer changes before our handlers get registered, preventing the marker handlers
  4823. // from being set up as expected on any markers which are visible in the startup map view before the user forces
  4824. // a layer update by panning/zooming/etc...
  4825. uroLayers.RunChangeHandlers();
  4826.  
  4827. uroUITweaks.Setup();
  4828. uroInit.setupListeners = false;
  4829. uroMainTickStage = 0;
  4830. window.clearInterval(uroMainTickHandlerID);
  4831. window.setInterval(uroMainTick, 10);
  4832. uroInit.initialised = true;
  4833. }
  4834. };
  4835. const uroUITweaks = // native UI enhancements
  4836. {
  4837. MO_SidePanel : null,
  4838. MO_ReportPanel : null,
  4839.  
  4840. ChangeMapBGColour: function()
  4841. {
  4842. let mapviewport = document.getElementById("WazeMap").getElementsByClassName("olMapViewport")[0];
  4843. if((uroUtils.GetCBChecked('_cbWhiteBackground') === true) && (uroUtils.GetCBChecked('_cbMasterEnable') === true))
  4844. {
  4845. let customColour = '#' + uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundRed'),2);
  4846. customColour += uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundGreen'),2);
  4847. customColour += uroUtils.ToHex(uroUtils.GetElmValue('_inputCustomBackgroundBlue'),2);
  4848. mapviewport.style.setProperty('background',customColour,'important');
  4849. }
  4850. else
  4851. {
  4852. mapviewport.style.setProperty('background',"#354148",'important');
  4853. }
  4854. },
  4855. HideAMLayer: function()
  4856. {
  4857. // If this sounds like a weird function - why not just switch off the layer from the layers menu? - then
  4858. // remember that in order for URO+ to be able to display in its own tab the list of AMs under the current
  4859. // mouse pointer location, which is somewhat more useful than the list given in the topbar, it needs the
  4860. // AM layer to be activated so that the AM areas data is loaded into WME. It doesn't however need the layer
  4861. // to then be visible, and since having a bunch of purple polygons covering the map can make for a rather
  4862. // difficult editing experience, being able to hide the polys whilst retaining the area information is
  4863. // of real benefit...
  4864. if((uroUtils.GetCBChecked('_cbHideAMLayer')) && (uroUtils.GetCBChecked('_cbMasterEnable')))
  4865. {
  4866. W.map.managedAreasLayer.setOpacity(0);
  4867. }
  4868. else
  4869. {
  4870. W.map.managedAreasLayer.setOpacity(1);
  4871. }
  4872. },
  4873. HideSegments: function()
  4874. {
  4875. // Hides the vector segments when the raster segment layer is hidden
  4876. if(uroUtils.GetCBChecked('_cbHideSegmentsWhenRoadsHidden'))
  4877. {
  4878. W.map.segmentLayer.drawn = W.map.roadLayer.visibility;
  4879. W.map.nodeLayer.drawn = W.map.roadLayer.visibility;
  4880. }
  4881. else
  4882. {
  4883. W.map.segmentLayer.drawn = true;
  4884. W.map.nodeLayer.drawn = true;
  4885. }
  4886. },
  4887. SetClusteringFor: function(layerID, toDisable)
  4888. {
  4889. let strat = uroLayers.layers[layerID].l.strategies;
  4890. if((strat !== undefined) && (strat.length > 0))
  4891. {
  4892. if(toDisable === true)
  4893. {
  4894. strat[0].threshold = 100000;
  4895. }
  4896. else
  4897. {
  4898. strat[0].threshold = 10;
  4899. }
  4900. }
  4901. },
  4902. ChangeClustering: function()
  4903. {
  4904. uroUITweaks.SetClusteringFor(uroLayers.ID.UR, uroUtils.GetCBChecked('_cbInhibitURClusters'));
  4905. uroUITweaks.SetClusteringFor(uroLayers.ID.MP, uroUtils.GetCBChecked('_cbInhibitMPClusters'));
  4906. uroUITweaks.SetClusteringFor(uroLayers.ID.PUR, uroUtils.GetCBChecked('_cbInhibitPUClusters'));
  4907. uroUITweaks.SetClusteringFor(uroLayers.ID.PPUR, uroUtils.GetCBChecked('_cbInhibitPUClusters'));
  4908. uroUITweaks.SetClusteringFor(uroLayers.ID.RPUR, uroUtils.GetCBChecked('_cbInhibitPUClusters'));
  4909. uroUITweaks.SetClusteringFor(uroLayers.ID.SegSug, uroUtils.GetCBChecked('_cbInhibitESClusters'));
  4910. uroUITweaks.SetClusteringFor(uroLayers.ID.EditSug, uroUtils.GetCBChecked('_cbInhibitESClusters'));
  4911.  
  4912. // If the map is zoomed out far enough such that clustering could be occurring, perform a
  4913. // zoom in-out to force a redraw of the markers based on whatever the new clustering
  4914. // settings are...
  4915. if(W.map.getZoom() < 16)
  4916. {
  4917. W.map.zoomIn();
  4918. W.map.zoomOut();
  4919. }
  4920. },
  4921. ReportPanelChange: function()
  4922. {
  4923. // Inhibit map re-centering when opening a report
  4924. if(uroMarkers.inhibitSetCenter === true)
  4925. {
  4926. let bcr = document.querySelector('#panel-container').getBoundingClientRect();
  4927. if(bcr.width > 0)
  4928. {
  4929. uroMarkers.inhibitSetCenter = false;
  4930. W.map.setCenter(uroMarkers.clickedOnCenter);
  4931. }
  4932. }
  4933.  
  4934. // "panel-container" now also gets used to show the turn closure UI, so reuse this MO handler
  4935. // as a way to also apply the MTE dropdown fix here...
  4936. let mteDropDown = document.querySelector('#panel-container #closure_eventId');
  4937. if(mteDropDown !== undefined)
  4938. {
  4939. uroFixMTEDropDown(mteDropDown);
  4940. }
  4941. },
  4942. CheckForClosurePanel: function()
  4943. {
  4944. if(uroUtils.IsClosureUIActive() === true)
  4945. {
  4946. // Closure panel active
  4947. let uroMO_ClosureUI = new MutationObserver(uroClosureEditUIChanged);
  4948. uroMO_ClosureUI.disconnect();
  4949. uroMO_ClosureUI.observe(document.querySelector('wz-tab.closures-tab'),{subtree: true, attributes: true});
  4950. uroClosureEditUIChanged();
  4951.  
  4952. let cl = document.querySelector('.closures-list');
  4953. if(cl !== null)
  4954. {
  4955. let uroRO_ClosureUI = new ResizeObserver(uroScrollToEndOfClosures);
  4956. uroRO_ClosureUI.disconnect();
  4957. uroRO_ClosureUI.observe(cl);
  4958. }
  4959. uroScrollToEndOfClosures();
  4960. }
  4961. },
  4962. SidePanelChange: function()
  4963. {
  4964. // The sidepanel MO only fires when the sidepanel changes in bulk - i.e. when first rendered, or
  4965. // when changing to show details for a different type of map object. Once this version of the
  4966. // panel is open, any internal changes, such as selecting a different tab within the panel, do
  4967. // NOT trigger the MO. Consequently, if a segment is selected and the sidepanel doesn't then
  4968. // open with the closures tab already selected, the MO will fire at this point rather than at the
  4969. // point where the closures tab is selected...
  4970. //
  4971. // To ensure the closures UI enhancements are applied consistently, we therefore need to set up an
  4972. // onclick handler to deal with the sidepanel opening into a different tab and the user then
  4973. // clicking through into the closures tab after this MO has already fired, but we ALSO still need
  4974. // to check for the availability of the closures UI here as well just in case the sidepanel opens
  4975. // into the closures tab directly.
  4976. //
  4977. // Easy really...
  4978.  
  4979. let elmToClick = document.querySelector('#edit-panel');
  4980. if(elmToClick !== null)
  4981. {
  4982. uroUtils.SetOnClick(elmToClick, uroUITweaks.CheckForClosurePanel);
  4983. }
  4984. uroUITweaks.CheckForClosurePanel();
  4985. },
  4986. Setup: function()
  4987. {
  4988. uroUITweaks.MO_SidePanel = new MutationObserver(uroUITweaks.SidePanelChange);
  4989. uroUITweaks.MO_SidePanel.observe(document.getElementById('edit-panel'), {childList: true, subtree: true});
  4990. uroUITweaks.MO_ReportPanel = new MutationObserver(uroUITweaks.ReportPanelChange);
  4991. uroUITweaks.MO_ReportPanel.observe(document.getElementById('panel-container'), {childList: true, subtree: true});
  4992.  
  4993. uroUITweaks.ChangeMapBGColour();
  4994. uroUITweaks.HideAMLayer();
  4995. uroUITweaks.HideSegments();
  4996. }
  4997. };
  4998. const uroMapMoveEnd = // things that happen after a move of the map view
  4999. {
  5000. lat : null,
  5001. lon: null,
  5002. zoom: null,
  5003. Handler: function()
  5004. {
  5005. let mc = W.map.getCenter();
  5006. let z = W.map.getZoom();
  5007. if((mc.lat != this.lat) || (mc.lon != this.lon) || (z != this.zoom))
  5008. {
  5009. // Apply any filters which need to be updated when the map view changes,
  5010. // and which won't be applied via an event handler or mutation observer
  5011. // attached to the relevant layer etc...
  5012. uroFilterProblems();
  5013. uroFilterPlaces();
  5014. uroFilterCameras();
  5015. uroFilterURs();
  5016. uroFilterRAs();
  5017. uroFilterMapComments();
  5018.  
  5019. uroMiscUITweaksHandler();
  5020. uroLayers.MCLayerChanged();
  5021. this.lat = mc.lat;
  5022. this.lon = mc.lon;
  5023. this.zoom = z;
  5024. }
  5025. }
  5026. };
  5027.  
  5028.  
  5029. // ================================================================================================
  5030. // Here be the unfactored wilderness...
  5031. // ================================================================================================
  5032.  
  5033.  
  5034. function uroFixMTEDropDown(mteDropDown)
  5035. {
  5036. // Auto-selects the "None" event within the MTE dropdown element passed into the function, to avoid the user having
  5037. // to manually select it - the only time you'd need to select something other than None is when you're assigning a
  5038. // closure to a MTE, at which point you need to manually select the appropriate event from the dropdown anyway, so
  5039. // pre-selecting None doesn't increase the workload for setting up a MTE-related closure, and it reduces the workload
  5040. // for setting up other closures...
  5041. //
  5042. // The only possible negative to this hack is that it means the user can set up a MTE-related closure without being
  5043. // reminded by WME to select the appropriate event from the list, because now that we're defaulting it to None, WME
  5044. // will allow the closure to be set without complaining that no event is set... But TBH, that's a small price to pay
  5045. // compared with the far, FAR, larger irritation of forcing users to always select None for all the closures that
  5046. // get added every single day without ever needing to be associated with a MTE - if a handful of closures end up being
  5047. // added with the user having forgotten to select the MTE, then no biggie. The closure will still at least have been
  5048. // added and its effect on routing around the event will therefore still be just as it would be if the MTE had been
  5049. // associated with the closure - the only difference is that if someone then bothers to look at the overview map of the
  5050. // MTE, they won't see that particular segment listed as a closure. I can live with the tiny risk of that causing any
  5051. // real problems, when weighed up against the millions of extra clicks saved through pre-selecting None...
  5052.  
  5053. let retval = false;
  5054.  
  5055. // Make sure the closure event list is available, and that we haven't already messed with it.
  5056. if((mteDropDown !== null) && (mteDropDown.tag != "touchedByURO"))
  5057. {
  5058. // The event dropdown is now some byzantine piece of DOM manipulation to generate something which looks like a
  5059. // regular select list, but which can't be manipulated like one... The first gotcha is that the selected item
  5060. // exists only within a shadow DOM section within the dropdown rather than simply being part of the list from
  5061. // which we'd be able to read off its selected index. So to check whether or not the user has selected an
  5062. // event already, we need to drill down into this shadow DOM to get its text contents, and compare those against
  5063. // the I18n translation for the choose event text. What a palaver...
  5064. let shadowElm = mteDropDown.shadowRoot.querySelectorAll('.selected-value')[0];
  5065. if(shadowElm !== undefined)
  5066. {
  5067. let eventText = mteDropDown.shadowRoot.querySelectorAll('.selected-value')[0].innerText;
  5068. // Sometimes we get here before WME has finished rendering, so if the event text hasn't been set yet then we
  5069. // need to return false and let the caller deal with it...
  5070. if(eventText !== '')
  5071. {
  5072. if(eventText == I18n.lookup('closures.choose_event'))
  5073. {
  5074. // Having now established that, yes, the closure hasn't yet been associated with any event, it's surprisingly
  5075. // easy to change it to "None" - we just generate a click event on the first child element in the main DOM (not
  5076. // the shadow DOM this time), which replicates what the user would do to select None manually.
  5077. mteDropDown.children[0].click();
  5078. }
  5079. // Tag the event list to prevent further processing attempts whilst the edit UI for this closure remains open.
  5080. mteDropDown.tag = "touchedByURO";
  5081. retval = true;
  5082. }
  5083. }
  5084. }
  5085.  
  5086. return retval;
  5087. }
  5088. let uroPendingURSessionsTotal;
  5089. let uroFinalizeTimeoutHandle = null;
  5090. function uroFinalizeURSessionsGet()
  5091. {
  5092. if(uroPendingURSessionsTotal != uroPendingURSessionIDs.length)
  5093. {
  5094. uroPendingURSessionsTotal = uroPendingURSessionIDs.length;
  5095. if(uroFinalizeTimeoutHandle !== null)
  5096. {
  5097. window.clearTimeout(uroFinalizeTimeoutHandle);
  5098. uroFinalizeTimeoutHandle = null;
  5099. }
  5100. uroFinalizeTimeoutHandle = window.setTimeout(uroFinalizeURSessionsGet, 500);
  5101. return;
  5102. }
  5103.  
  5104. let idList = [];
  5105.  
  5106. while((idList.length < 50) && (uroPendingURSessionIDs.length))
  5107. {
  5108. let id = uroPendingURSessionIDs.shift();
  5109. idList.push(id);
  5110. }
  5111.  
  5112. if(idList.length > 0)
  5113. {
  5114. uroDBG.AddLog('grabbing '+idList.length+' updateRequestSessions, IDs: '+idList);
  5115. W.model.updateRequestSessions.getAsync(idList);
  5116. }
  5117.  
  5118. if((uroPendingURSessionIDs.length) || (uroRequestedURSessionIDs.length))
  5119. {
  5120. window.setTimeout(uroGetUpdateRequestSessions,1000);
  5121. }
  5122. else
  5123. {
  5124. uroPopulatingRequestSessions = false;
  5125. }
  5126. }
  5127. function uroGetUpdateRequestSessions()
  5128. {
  5129. uroPendingURSessionsTotal = uroPendingURSessionIDs.length;
  5130. if(uroFinalizeTimeoutHandle !== null)
  5131. {
  5132. window.clearTimeout(uroFinalizeTimeoutHandle);
  5133. uroFinalizeTimeoutHandle = null;
  5134. }
  5135. uroFinalizeTimeoutHandle = window.setTimeout(uroFinalizeURSessionsGet,500);
  5136. }
  5137. function uroRefreshUpdateRequestSessions()
  5138. {
  5139. let urcount = 0;
  5140. uroPendingURSessionIDs = [];
  5141. uroRequestedURSessionIDs = [];
  5142. uroPopulatingRequestSessions = true;
  5143. for (let urID in W.model.mapUpdateRequests.objects)
  5144. {
  5145. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urID))
  5146. {
  5147. if(W.model.updateRequestSessions.objects[urID] === undefined)
  5148. {
  5149. uroPendingURSessionIDs.push(urID);
  5150. }
  5151. urcount++;
  5152. }
  5153. }
  5154. uroGetUpdateRequestSessions();
  5155. }
  5156. function uroURHasMyComments(fid)
  5157. {
  5158. if(uroUserID === -1)
  5159. {
  5160. return false;
  5161. }
  5162. let nComments = W.model.updateRequestSessions.objects[fid].attributes.comments.length;
  5163. if(nComments === 0)
  5164. {
  5165. return false;
  5166. }
  5167.  
  5168. for(let cidx=0; cidx<nComments; cidx++)
  5169. {
  5170. if(W.model.updateRequestSessions.objects[fid].attributes.comments[cidx].userID == uroUserID)
  5171. {
  5172. return true;
  5173. }
  5174. }
  5175.  
  5176. return false;
  5177. }
  5178. function uroIsFilteringEnabled(ignoreZoom)
  5179. {
  5180. let retval = false;
  5181. if
  5182. (
  5183. (uroUtils.GetCBChecked('_cbMasterEnable') === true) &&
  5184. (
  5185. (ignoreZoom === true) ||
  5186. (W.map.getZoom() <= uroUtils.GetElmValue('_inputFilterMinZoomLevel'))
  5187. )
  5188. )
  5189. {
  5190. retval = true;
  5191. }
  5192. return retval;
  5193. }
  5194. function uroUpdateMTEList()
  5195. {
  5196. if(Object.keys(W.model.majorTrafficEvents.objects).length === 0) return;
  5197.  
  5198. let selectedIdx = null;
  5199. let idx;
  5200. let mteNames = [];
  5201. let mteIDs = [];
  5202. for(idx in W.model.majorTrafficEvents.objects)
  5203. {
  5204. if(W.model.majorTrafficEvents.objects.hasOwnProperty(idx))
  5205. {
  5206. let name = W.model.majorTrafficEvents.objects[idx].attributes.names[0]?.value;
  5207. if(mteNames.indexOf(name) == -1)
  5208. {
  5209. mteNames.push(name);
  5210. mteIDs.push(idx);
  5211. }
  5212. }
  5213. }
  5214. // check for any previously selected ID in the list, then clear it and repopulate
  5215. // using the newly gathered ID collection from above, and finally reselect the
  5216. // previously selected MTE if its still present in the new list...
  5217. let selector;
  5218. let selectedID;
  5219. let selectorEntry;
  5220.  
  5221. selector = document.getElementById('_selectRTCMTE');
  5222. selectedID = null;
  5223. if(selector.selectedOptions[0] != null)
  5224. {
  5225. selectedID = selector.selectedOptions[0].value;
  5226. }
  5227. while(selector.options.length > 0)
  5228. {
  5229. selector.options.remove(0);
  5230. }
  5231. selector.options.add(new Option('<select a MTE>', null));
  5232. if(mteNames.length > 0)
  5233. {
  5234. selectorEntry = '';
  5235. for(idx=0; idx<mteNames.length; idx++)
  5236. {
  5237. selectorEntry = mteNames[idx];
  5238. selector.options.add(new Option(selectorEntry, mteIDs[idx]));
  5239. if(mteIDs[idx] == selectedID)
  5240. {
  5241. selectedIdx = idx+1;
  5242. }
  5243. }
  5244. }
  5245.  
  5246. if(selectedIdx !== null)
  5247. {
  5248. selector.selectedIndex = selectedIdx;
  5249. }
  5250. }
  5251. function uroRTCMarkerInfo(mIdx, isVisible)
  5252. {
  5253. let pri = null;
  5254. let status = null;
  5255. let dir = null;
  5256. let pos = null;
  5257. let mID = null;
  5258.  
  5259. let mObj = uroLayers.layers[uroLayers.ID.RTC].l.markers[mIdx];
  5260. if(mObj !== undefined)
  5261. {
  5262. // Store the marker status - if we've already made a note of the original
  5263. // status by adding an "orig_"-prefixed classname, extract the status from
  5264. // that rather than from the class currently being used to display the
  5265. // marker, to preserve the original status regardless of what we may have
  5266. // done to it subsequently as a result of our RTC filtering setup...
  5267. let cList = mObj.element.classList;
  5268. for(let i = 0; i < cList.length; ++i)
  5269. {
  5270. if(cList[i].indexOf('orig_') != -1)
  5271. {
  5272. status = cList[i].replace('orig_', '');
  5273. }
  5274. }
  5275. if(status === null)
  5276. {
  5277. for(let i = 0; i < cList.length; ++i)
  5278. {
  5279. if(cList[i].indexOf('status-') != -1)
  5280. {
  5281. status = cList[i];
  5282. }
  5283. }
  5284. }
  5285.  
  5286. // Assign a priority level to the marker so we know whether to show or hide
  5287. // it if it's stacked up with others on the same segment - the level set here
  5288. // follows the priority used by WME to decide which closures to show normally.
  5289. if(status == "status-active")
  5290. {
  5291. pri = 2;
  5292. }
  5293. else if(status == "status-not-started")
  5294. {
  5295. pri = 1;
  5296. }
  5297. else
  5298. {
  5299. pri = 0;
  5300. }
  5301.  
  5302. // To avoid the need to cross-reference with the closure model object, use the
  5303. // classname of the arrow attached to this marker to determine if the closure is
  5304. // in the forward or reverse direction.
  5305. if(mObj.element.childNodes.length == 1)
  5306. {
  5307. if(mObj.element.childNodes[0].className.indexOf('forward') != -1)
  5308. {
  5309. dir = "fwd";
  5310. }
  5311. else if(mObj.element.childNodes[0].className.indexOf('backward') != -1)
  5312. {
  5313. dir = "rev";
  5314. }
  5315. }
  5316.  
  5317. pos = mObj.px;
  5318. mID = mObj.element.dataset.id;
  5319. }
  5320.  
  5321. this.isVisible = isVisible;
  5322. this.pos = pos;
  5323. this.pri = pri;
  5324. this.mID = mID;
  5325. this.status = status;
  5326. this.dir = dir;
  5327. }
  5328. function uroFilterRTCs()
  5329. {
  5330. let pmTStart = performance.now();
  5331. let pmFunction = "uroFilterRTCs";
  5332.  
  5333. if(uroFilterPreamble() === false) return;
  5334.  
  5335. let closureLayer = uroLayers.layers[uroLayers.ID.RTC].l;
  5336. if(closureLayer.markers.length === 0) return;
  5337.  
  5338. let uFR_filterActiveFromWME = uroUtils.GetCBChecked('_cbHideEditorRTCs');
  5339. let uFR_filterActiveFromWazeFeed = uroUtils.GetCBChecked('_cbHideWazeFeedRTCs');
  5340. let uFR_filterActiveFromWazeOther = uroUtils.GetCBChecked('_cbHideWazeRTCs');
  5341. let uFR_filterFutureFromWME = uroUtils.GetCBChecked('_cbHideFutureEditorRTCs');
  5342. let uFR_filterFutureFromWazeFeed = uroUtils.GetCBChecked('_cbHideFutureWazeFeedRTCs');
  5343. let uFR_filterFutureFromWazeOther = uroUtils.GetCBChecked('_cbHideFutureWazeRTCs');
  5344. let uFR_filterExpiredFromWME = uroUtils.GetCBChecked('_cbHideExpiredEditorRTCs');
  5345. let uFR_filterExpiredFromWazeFeed = uroUtils.GetCBChecked('_cbHideExpiredWazeFeedRTCs');
  5346. let uFR_filterExpiredFromWazeOther = uroUtils.GetCBChecked('_cbHideExpiredWazeRTCs');
  5347. let uFR_filterUnknownFromWME = uroUtils.GetCBChecked('_cbHideUnknownEditorRTCs');
  5348. let uFR_filterUnknownFromWazeFeed = uroUtils.GetCBChecked('_cbHideUnknownWazeFeedRTCs');
  5349. let uFR_filterUnknownFromWazeOther = uroUtils.GetCBChecked('_cbHideUnknownWazeRTCs');
  5350. let uFR_filterShowForMTE = uroUtils.GetCBChecked('_cbShowMTERTCs');
  5351. let uFR_filterHideForMTE = uroUtils.GetCBChecked('_cbHideMTERTCs');
  5352. let uFR_filterHideDurationLessThan = uroUtils.GetCBChecked('_cbEnableRTCDurationFilterLessThan');
  5353. let uFR_filterHideDurationMoreThan = uroUtils.GetCBChecked('_cbEnableRTCDurationFilterMoreThan');
  5354. let uFR_thresholdDurationLessThan = uroUtils.GetElmValue('_inputFilterRTCDurationLessThan');
  5355. let uFR_thresholdDurationMoreThan = uroUtils.GetElmValue('_inputFilterRTCDurationMoreThan');
  5356.  
  5357. let uFR_filterShowForTS = uroUtils.GetCBChecked('_cbRTCFilterShowForTS');
  5358. let uFR_filterHideForTS = uroUtils.GetCBChecked('_cbRTCFilterHideForTS');
  5359. let tsD = uroUtils.GetElmValue('_inputRTCFilterDay');
  5360. let tsMo = uroUtils.GetElmValue('_inputRTCFilterMonth');
  5361. let tsY = uroUtils.GetElmValue('_inputRTCFilterYear');
  5362. let tsH = uroUtils.GetElmValue('_inputRTCFilterHour');
  5363. let tsMi = uroUtils.GetElmValue('_inputRTCFilterMin');
  5364. let filterTS = uroUtils.GetTS(tsD, tsMo, tsY, tsH, tsMi);
  5365. uroUpdateMTEList();
  5366. let mteID = null;
  5367. let selectorMTE = document.getElementById('_selectRTCMTE');
  5368. if(selectorMTE?.selectedOptions[0] != null)
  5369. {
  5370. mteID = selectorMTE.selectedOptions[0].value;
  5371. }
  5372.  
  5373. let uFR_masterEnable = uroIsFilteringEnabled(false);
  5374.  
  5375. let markerInfo = [];
  5376.  
  5377. // Pass 1 - determine which filtering to apply to each of the RTC markers
  5378. let markerIdx = 0;
  5379. for (let rtcObj in W.model.roadClosures.objects)
  5380. {
  5381. let isVisible = true;
  5382.  
  5383. if(uFR_masterEnable === true)
  5384. {
  5385. let rtcModel = W.model.roadClosures.objects[rtcObj];
  5386.  
  5387. if(mteID !== null)
  5388. {
  5389. if((uFR_filterShowForMTE === true) && (rtcModel.attributes.eventId !== mteID))
  5390. {
  5391. isVisible = false;
  5392. }
  5393. if((uFR_filterHideForMTE === true) && (rtcModel.attributes.eventId === mteID))
  5394. {
  5395. isVisible = false;
  5396. }
  5397. }
  5398.  
  5399. let rtcType = uroGetRTCOrigin(rtcModel);
  5400. let rtcState = uroGetRTCState(rtcModel);
  5401.  
  5402. if(rtcType == uroEnums.TRTC.WAZEFEED)
  5403. {
  5404. if
  5405. (
  5406. ((rtcState === uroEnums.SRTC.ACTIVE) && (uFR_filterActiveFromWazeFeed === true)) ||
  5407. ((rtcState === uroEnums.SRTC.FUTURE) && (uFR_filterFutureFromWazeFeed === true)) ||
  5408. ((rtcState === uroEnums.SRTC.EXPIRED) && (uFR_filterExpiredFromWazeFeed === true)) ||
  5409. ((rtcState === uroEnums.SRTC.UNKNOWN) && (uFR_filterUnknownFromWazeFeed === true))
  5410. )
  5411. {
  5412. isVisible = false;
  5413. }
  5414. }
  5415. else if(rtcType == uroEnums.TRTC.WAZEOTHER)
  5416. {
  5417. if
  5418. (
  5419. ((rtcState === uroEnums.SRTC.ACTIVE) && (uFR_filterActiveFromWazeOther === true)) ||
  5420. ((rtcState === uroEnums.SRTC.FUTURE) && (uFR_filterFutureFromWazeOther === true)) ||
  5421. ((rtcState === uroEnums.SRTC.EXPIRED) && (uFR_filterExpiredFromWazeOther === true)) ||
  5422. ((rtcState === uroEnums.SRTC.UNKNOWN) && (uFR_filterUnknownFromWazeOther === true))
  5423. )
  5424. {
  5425. isVisible = false;
  5426. }
  5427. }
  5428. else
  5429. {
  5430. if
  5431. (
  5432. ((rtcState === uroEnums.SRTC.ACTIVE) && (uFR_filterActiveFromWME === true)) ||
  5433. ((rtcState === uroEnums.SRTC.FUTURE) && (uFR_filterFutureFromWME === true)) ||
  5434. ((rtcState === uroEnums.SRTC.EXPIRED) && (uFR_filterExpiredFromWME === true)) ||
  5435. ((rtcState === uroEnums.SRTC.UNKNOWN) && (uFR_filterUnknownFromWME === true))
  5436. )
  5437. {
  5438. isVisible = false;
  5439. }
  5440. }
  5441. let rtcDuration = uroGetRTCDuration(rtcModel);
  5442. if(uFR_filterHideDurationLessThan === true)
  5443. {
  5444. if(rtcDuration < uFR_thresholdDurationLessThan)
  5445. {
  5446. isVisible = false;
  5447. }
  5448. }
  5449. if(uFR_filterHideDurationMoreThan === true)
  5450. {
  5451. if(rtcDuration > uFR_thresholdDurationMoreThan)
  5452. {
  5453. isVisible = false;
  5454. }
  5455. }
  5456. if((uFR_filterShowForTS === true) || (uFR_filterHideForTS === true))
  5457. {
  5458. let startTS = new Date(rtcModel.attributes.startDate).getTime();
  5459. let endTS = new Date(rtcModel.attributes.endDate).getTime();
  5460. if(uFR_filterShowForTS === true)
  5461. {
  5462. if((filterTS < startTS) || (filterTS > endTS))
  5463. {
  5464. isVisible = false;
  5465. }
  5466. }
  5467. if (uFR_filterHideForTS === true)
  5468. {
  5469. if((filterTS >= startTS) && (filterTS <= endTS))
  5470. {
  5471. isVisible = false;
  5472. }
  5473. }
  5474. }
  5475. }
  5476.  
  5477. markerInfo.push(new uroRTCMarkerInfo(markerIdx, isVisible));
  5478. ++markerIdx;
  5479. }
  5480.  
  5481. // Pass 2 - based on the initial filtering results, determine which markers *actually* should be
  5482. // made visible or hidden according both to our filtering settings AND any masking of this marker
  5483. // due to the presence of other higher priority markers at the same position which have also been
  5484. // marked as visible following the filtering pass...
  5485. //
  5486. // For added merriment, we also deal with the WME limitation that prevents it displaying two
  5487. // different types of closure arrow if a segment has a one-way closure which is a higher priority
  5488. // than a closure in the opposite direction.
  5489.  
  5490. let cNodesDiv = uroLayers.layers[uroLayers.ID.RTCnode].l.div;
  5491. for (let i = 0; i < markerIdx; ++i)
  5492. {
  5493. let status = markerInfo[i].status;
  5494.  
  5495. // Only apply this pass to closures which haven't already been hidden in pass 1, AND which
  5496. // have a valid marker position
  5497. if((markerInfo[i].isVisible === true) && (markerInfo[i].pos !== null))
  5498. {
  5499. // Iterate through all the other markers, looking for any which are also still visible
  5500. // and have the same marker position as the one we're currently processing
  5501. for (let j = 0; j < markerIdx; ++j)
  5502. {
  5503. if(j != i)
  5504. {
  5505. if((markerInfo[j].isVisible === true) && (markerInfo[j].pos !== null))
  5506. {
  5507. if((markerInfo[i].pos.x == markerInfo[j].pos.x) && (markerInfo[i].pos.y == markerInfo[j].pos.y))
  5508. {
  5509. if(markerInfo[j].pri > markerInfo[i].pri)
  5510. {
  5511. if(markerInfo[j].dir == markerInfo[i].dir)
  5512. {
  5513. // Mark the currently processed marker to be hidden only if this higher priority
  5514. // marker is for a closure in the same direction - if it's not, then we need to
  5515. // leave the current marker visible so that its arrow remains visible...
  5516. markerInfo[i].isVisible = false;
  5517. break;
  5518. }
  5519. else
  5520. {
  5521. // Otherwise, if we're leaving the current marker visible then we'll need to
  5522. // alter its status class to match this higher-priority marker, so that the
  5523. // marker which is shown to the user remains correct regardless of what the
  5524. // relative stacking order of the markers is on this segment.
  5525. status = markerInfo[j].status;
  5526. }
  5527. }
  5528. }
  5529. }
  5530. }
  5531. }
  5532. }
  5533.  
  5534. let marker = closureLayer.markers[i].element;
  5535. let markerClass = marker.className;
  5536.  
  5537. // Remove the hidden class if present - this allows markers natively hidden by WME due to being masked
  5538. // by higher priority markers to become visible again if our own filtering settings have hidden those
  5539. // higher priority marker...
  5540. markerClass = markerClass.replace(" road-closure-hidden", "");
  5541. if(markerInfo[i].isVisible == false)
  5542. {
  5543. // Apply the hidden class for any markers WE'VE decided need to be hidden
  5544. markerClass += " road-closure-hidden";
  5545. }
  5546. else
  5547. {
  5548. // For any markers which we're leaving visible, first check to see if it's a marker we haven't yet
  5549. // seen. If so, then we need to store its original status class for future reference.
  5550. if(markerClass.indexOf('orig_') == -1)
  5551. {
  5552. markerClass += (' orig_'+markerInfo[i].status);
  5553. }
  5554. // Now, to ensure this segment displays the appropriate marker for the highest priority closure
  5555. // still visible on it, we remove the existing status class and replace it with the one we
  5556. // chose above
  5557. markerClass = markerClass.replace(" status-finished"," ");
  5558. markerClass = markerClass.replace(" status-active"," ");
  5559. markerClass = markerClass.replace(" status-not-started"," ");
  5560. markerClass += ' '+status;
  5561. }
  5562. marker.className = markerClass;
  5563. let toHide = cNodesDiv.querySelectorAll("[data-id='"+markerInfo[i].mID+"']");
  5564. for(let j = 0; j < toHide.length; ++j)
  5565. {
  5566. if(markerInfo[i].isVisible === false)
  5567. {
  5568. toHide[j].style.visibility = "hidden";
  5569. }
  5570. else
  5571. {
  5572. toHide[j].style.visibility = "";
  5573. }
  5574. }
  5575. }
  5576.  
  5577. uroDBG.PerfMon(pmFunction, pmTStart);
  5578. }
  5579. function uroUpdateRAList()
  5580. {
  5581. if(Object.keys(W.model.restrictedDrivingAreas.objects).length === 0) return;
  5582.  
  5583. let selectedIdx = null;
  5584. let idx;
  5585. let raNames = [];
  5586. for(idx in W.model.restrictedDrivingAreas.objects)
  5587. {
  5588. if(W.model.restrictedDrivingAreas.objects.hasOwnProperty(idx))
  5589. {
  5590. let name = W.model.restrictedDrivingAreas.objects[idx].attributes.name;
  5591. if(raNames.indexOf(name) == -1)
  5592. {
  5593. raNames.push(name);
  5594. }
  5595. }
  5596. }
  5597. // check for any previously selected name in the list, then clear it and repopulate
  5598. // using the newly gathered collection from above, and finally reselect the
  5599. // previously selected MTE if its still present in the new list...
  5600. let selector;
  5601. let selectedName;
  5602. let selectorEntry;
  5603.  
  5604. selector = document.getElementById('_selectRA');
  5605. selectedName = null;
  5606. if(selector.selectedOptions[0] != null)
  5607. {
  5608. selectedName = selector.selectedOptions[0].value;
  5609. }
  5610. while(selector.options.length > 0)
  5611. {
  5612. selector.options.remove(0);
  5613. }
  5614. selector.options.add(new Option('<select a RA>', null));
  5615. if(raNames.length > 0)
  5616. {
  5617. selectorEntry = '';
  5618. for(idx=0; idx<raNames.length; idx++)
  5619. {
  5620. selectorEntry = raNames[idx];
  5621. selector.options.add(new Option(selectorEntry, selectorEntry));
  5622. if(selectorEntry == selectedName)
  5623. {
  5624. selectedIdx = idx+1;
  5625. }
  5626. }
  5627. }
  5628.  
  5629. if(selectedIdx !== null)
  5630. {
  5631. selector.selectedIndex = selectedIdx;
  5632. }
  5633. }
  5634. function uroUpdateEditorList(modelObj, listElement, useCreated, useUpdated, useResolved, useCommenter)
  5635. {
  5636. if(Object.keys(modelObj).length === 0) return;
  5637.  
  5638. let selector = document.getElementById(listElement);
  5639.  
  5640. let selectedUser = null;
  5641. if(selector.selectedOptions[0] != null)
  5642. {
  5643. selectedUser = parseInt(selector.selectedOptions[0].value);
  5644. }
  5645.  
  5646. while(selector.options.length > 0)
  5647. {
  5648. selector.options.remove(0);
  5649. }
  5650.  
  5651. let selectedIdx = null;
  5652. let listedIDs = [];
  5653. let idx;
  5654. for(idx in modelObj)
  5655. {
  5656. if(modelObj.hasOwnProperty(idx))
  5657. {
  5658. let obj;
  5659. if(useCommenter == true)
  5660. {
  5661. obj = modelObj[idx];
  5662. if(obj.attributes.comments.length > 0)
  5663. {
  5664. for(let cidx=0; cidx < obj.attributes.comments.length; cidx++)
  5665. {
  5666. let userID = obj.attributes.comments[cidx].userID;
  5667. if((listedIDs.indexOf(userID) == -1) && (userID != -1))
  5668. {
  5669. listedIDs.push(userID);
  5670. }
  5671. }
  5672. }
  5673. }
  5674. else
  5675. {
  5676. obj = modelObj[idx].attributes;
  5677. let cbID = null;
  5678. let ubID = null;
  5679. let rbID = null;
  5680. if(useCreated == true) cbID = obj.createdBy;
  5681. if(useUpdated == true) ubID = obj.updatedBy;
  5682. if(useResolved == true) ubID = obj.resolvedBy;
  5683. if((cbID !== null) && (listedIDs.indexOf(cbID) == -1))
  5684. {
  5685. listedIDs.push(cbID);
  5686. }
  5687. if((ubID !== null) && (listedIDs.indexOf(ubID) == -1))
  5688. {
  5689. listedIDs.push(ubID);
  5690. }
  5691. if((rbID !== null) && (listedIDs.indexOf(rbID) == -1))
  5692. {
  5693. listedIDs.push(rbID);
  5694. }
  5695. }
  5696. }
  5697. }
  5698.  
  5699. selector.options.add(new Option('<select a user>', null));
  5700. if(listedIDs.length > 0)
  5701. {
  5702. let users = W.model.users.getByIds(listedIDs);
  5703. let selectorEntry = '';
  5704. for(idx=0; idx<users.length; idx++)
  5705. {
  5706. if(listedIDs.indexOf(users[idx].id) != -1)
  5707. {
  5708. listedIDs.splice(listedIDs.indexOf(users[idx]), 1);
  5709. }
  5710. if(users[idx].attributes.userName === undefined)
  5711. {
  5712. selectorEntry = users[idx].attributes.id;
  5713. }
  5714. else
  5715. {
  5716. selectorEntry = users[idx].attributes.userName;
  5717. }
  5718. selector.options.add(new Option(selectorEntry, users[idx].id));
  5719. if(users[idx].attributes.id == selectedUser)
  5720. {
  5721. selectedIdx = idx+1;
  5722. }
  5723. }
  5724. }
  5725.  
  5726. if(selectedIdx !== null)
  5727. {
  5728. selector.selectedIndex = selectedIdx;
  5729. }
  5730. }
  5731. function uroGetUserID(filterNameID, tbUserName)
  5732. {
  5733. if(filterNameID === null)
  5734. {
  5735. for(let idx in W.model.users.objects)
  5736. {
  5737. if(W.model.users.objects.hasOwnProperty(idx))
  5738. {
  5739. if(W.model.users.objects[idx].attributes.userName == tbUserName)
  5740. {
  5741. filterNameID = W.model.users.objects[idx].attributes.id;
  5742. break;
  5743. }
  5744. }
  5745. }
  5746. }
  5747. return filterNameID;
  5748. }
  5749. function uroFilterRAs()
  5750. {
  5751. let pmTStart = performance.now();
  5752. let pmFunction = "uroFilterRAs";
  5753.  
  5754. if(uroFilterPreamble() === false) return;
  5755. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  5756. let filterByArea = uroUtils.GetCBChecked('_cbShowSpecificRA');
  5757. let filterByLastEditor = uroUtils.GetCBChecked('_cbRAEditorIDFilter');
  5758. let filterByMinAge = uroUtils.GetCBChecked('_cbEnableRAAgeFilterLessThan');
  5759. let filterByMaxAge = uroUtils.GetCBChecked('_cbEnableRAAgeFilterMoreThan');
  5760. let thresholdMinAge = uroUtils.GetElmValue('_inputFilterRAAgeLessThan');
  5761. let thresholdMaxAge = uroUtils.GetElmValue('_inputFilterRAAgeMoreThan');
  5762. let selectorRA = document.getElementById('_selectRA');
  5763. if(filterByArea === false)
  5764. {
  5765. while(selectorRA.options.length > 0)
  5766. {
  5767. selectorRA.options.remove(0);
  5768. }
  5769. }
  5770. let shownRA = null;
  5771. if(filterByArea === true)
  5772. {
  5773. if(selectorRA.options.length === 0)
  5774. {
  5775. uroUpdateRAList();
  5776. }
  5777. if(selectorRA.selectedOptions[0] != null)
  5778. {
  5779. shownRA = selectorRA.selectedOptions[0].value;
  5780. }
  5781. }
  5782.  
  5783. let filterNameID = null;
  5784. if(filterByLastEditor == true)
  5785. {
  5786. uroUpdateEditorList(W.model.restrictedDrivingAreas.objects, '_selectRAEditorID', true, true, false, false);
  5787. let selector = document.getElementById('_selectRAEditorID');
  5788. if(selector.selectedIndex > 0)
  5789. {
  5790. filterNameID = document.getElementById('_selectRAEditorID').selectedOptions[0].value;
  5791. }
  5792. }
  5793. let nRANames = document.querySelectorAll('.restricted-driving-area-name-marker').length;
  5794. for (let raIdx = 0; raIdx < W.map.restrictedDrivingAreaLayer.features.length; raIdx++)
  5795. {
  5796. let raObj = W.map.restrictedDrivingAreaLayer.features[raIdx].attributes.wazeFeature;
  5797. if(raObj !== undefined)
  5798. {
  5799. let raStyle = 'visible';
  5800. if(uFURs_masterEnable === true)
  5801. {
  5802. if(shownRA !== null)
  5803. {
  5804. if(raObj._wmeObject.attributes.name != shownRA) raStyle = 'hidden';
  5805. }
  5806. if(filterNameID !== null)
  5807. {
  5808. if((raObj._wmeObject.attributes.createdBy != filterNameID) && (raObj._wmeObject.attributes.updatedBy != filterNameID))
  5809. {
  5810. raStyle = 'hidden';
  5811. }
  5812. }
  5813. let raAge = uroUtils.DateToDays(raObj._wmeObject.attributes.updatedOn);
  5814. if(filterByMinAge == true)
  5815. {
  5816. if(raAge < thresholdMinAge) raStyle = 'hidden';
  5817. }
  5818. if(filterByMaxAge == true)
  5819. {
  5820. if(raAge > thresholdMaxAge) raStyle = 'hidden';
  5821. }
  5822. }
  5823. let geoID = W.map.restrictedDrivingAreaLayer.features[raIdx].geometry.id;
  5824. if(document.getElementById(geoID) !== null)
  5825. {
  5826. document.getElementById(geoID).style.visibility = raStyle;
  5827. }
  5828.  
  5829. // This doesn't always work, as the order in which the markers are listed on their layer isn't guaranteed
  5830. // to match the order in which the corresponding RA polys are listed on theirs...
  5831. if(raIdx < nRANames)
  5832. {
  5833. document.querySelectorAll('.restricted-driving-area-name-marker')[raIdx].style.visibility = raStyle;
  5834. }
  5835. }
  5836. }
  5837. uroDBG.PerfMon(pmFunction, pmTStart);
  5838. }
  5839. function uroFilterPlaceMarker(mObj, vObj, uFP_masterEnable)
  5840. {
  5841. if((mObj === undefined) || (vObj === undefined))
  5842. {
  5843. return;
  5844. }
  5845.  
  5846. let purAge = null;
  5847. let placeStyle = 'visible';
  5848. let hasBalloon = false;
  5849.  
  5850. if(uFP_masterEnable === true)
  5851. {
  5852. if(uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] === true)
  5853. {
  5854. let tPt = [];
  5855. tPt.push(vObj.attributes.geoJSONGeometry.coordinates[0]);
  5856. tPt.push(vObj.attributes.geoJSONGeometry.coordinates[1]);
  5857. if(uroCheckGeometryWithinManagedAreas(tPt) === true) placeStyle = 'hidden';
  5858. }
  5859.  
  5860. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.filterUneditable] === true))
  5861. {
  5862. if(vObj.attributes.permissions === 0)
  5863. {
  5864. placeStyle = 'hidden';
  5865. }
  5866. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.isLoggedIn]))
  5867. {
  5868. if(uro_uFP[uroEnums.FP_OPTS.userRank] < vObj.attributes.lockRank)
  5869. {
  5870. placeStyle = 'hidden';
  5871. }
  5872. }
  5873. if((placeStyle == 'visible') && (vObj.attributes.adLocked))
  5874. {
  5875. placeStyle = 'hidden';
  5876. }
  5877. }
  5878.  
  5879. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.filterLockRanked] === true))
  5880. {
  5881. if(vObj.attributes.lockRank !== 0)
  5882. {
  5883. placeStyle = 'hidden';
  5884. }
  5885. }
  5886.  
  5887. let urEntries = vObj.attributes.venueUpdateRequests;
  5888. if((placeStyle == 'visible') && (urEntries !== undefined))
  5889. {
  5890. hasBalloon = (urEntries.length > 1);
  5891.  
  5892. for(let i = 0; i < urEntries.length; ++i)
  5893. {
  5894. let ut = urEntries[i].attributes.updateType;
  5895. if((uro_uFP[uroEnums.FP_OPTS.filterFlagged] === true) && (ut === "flag"))
  5896. {
  5897. placeStyle = 'hidden';
  5898. }
  5899. else if((uro_uFP[uroEnums.FP_OPTS.filterNewPlace] === true) && (ut === "ADD_VENUE"))
  5900. {
  5901. placeStyle = 'hidden';
  5902. }
  5903. else if((uro_uFP[uroEnums.FP_OPTS.filterUpdatedDetails] === true) && (ut === "UPDATE_VENUE"))
  5904. {
  5905. placeStyle = 'hidden';
  5906. }
  5907. else if((uro_uFP[uroEnums.FP_OPTS.filterNewPhoto] === true) && (ut === "ADD_IMAGE"))
  5908. {
  5909. placeStyle = 'hidden';
  5910. }
  5911. }
  5912.  
  5913. if((placeStyle == 'visible') && (uro_uFP[uroEnums.FP_OPTS.filterOnCFs] === true))
  5914. {
  5915. let nVUR = urEntries.length;
  5916. while(nVUR > 0)
  5917. {
  5918. nVUR--;
  5919. let tCF = urEntries[nVUR].attributes.changedFields;
  5920. if(tCF !== undefined)
  5921. {
  5922. if(tCF.length > 0)
  5923. {
  5924. let tFN = tCF[0].attributes.fieldName;
  5925. if((tFN == "phone") && (uro_uFP[uroEnums.FP_OPTS.filterCFPhone] === true))
  5926. {
  5927. placeStyle = 'hidden';
  5928. }
  5929. else if((tFN == "name") && (uro_uFP[uroEnums.FP_OPTS.filterCFName] === true))
  5930. {
  5931. placeStyle = 'hidden';
  5932. }
  5933. else if((tFN == "entryExitPoints") && (uro_uFP[uroEnums.FP_OPTS.filterCFEntryExitPoints] === true))
  5934. {
  5935. placeStyle = 'hidden';
  5936. }
  5937. else if((tFN == "openingHours") && (uro_uFP[uroEnums.FP_OPTS.filterCFOpeningHours] === true))
  5938. {
  5939. placeStyle = 'hidden';
  5940. }
  5941. else if((tFN == "aliases") && (uro_uFP[uroEnums.FP_OPTS.filterCFAliases] === true))
  5942. {
  5943. placeStyle = 'hidden';
  5944. }
  5945. else if((tFN == "services") && (uro_uFP[uroEnums.FP_OPTS.filterCFServices] === true))
  5946. {
  5947. placeStyle = 'hidden';
  5948. }
  5949. else if((tFN == "geometry") && (uro_uFP[uroEnums.FP_OPTS.filterCFGeometry] === true))
  5950. {
  5951. placeStyle = 'hidden';
  5952. }
  5953. else if((tFN == "houseNumber") && (uro_uFP[uroEnums.FP_OPTS.filterCFHouseNumber] === true))
  5954. {
  5955. placeStyle = 'hidden';
  5956. }
  5957. else if((tFN == "categories") && (uro_uFP[uroEnums.FP_OPTS.filterCFCategories] === true))
  5958. {
  5959. placeStyle = 'hidden';
  5960. }
  5961. else if((tFN == "description") && (uro_uFP[uroEnums.FP_OPTS.filterCFDescription] === true))
  5962. {
  5963. placeStyle = 'hidden';
  5964. }
  5965. }
  5966. }
  5967. }
  5968. }
  5969. }
  5970.  
  5971. if(uro_uFP[uroEnums.FP_OPTS.invertPURFilters] === true)
  5972. {
  5973. if(placeStyle == 'hidden') placeStyle = 'visible';
  5974. else placeStyle = 'hidden';
  5975. }
  5976.  
  5977. if(uro_uFP[uroEnums.FP_OPTS.filterMinPURAge] || uro_uFP[uroEnums.FP_OPTS.filterMaxPURAge])
  5978. {
  5979. purAge = uroUtils.GetPURAge(vObj);
  5980. if(uro_uFP[uroEnums.FP_OPTS.filterMinPURAge] === true)
  5981. {
  5982. if(purAge < uro_uFP[uroEnums.FP_OPTS.thresholdMinPURDays]) placeStyle = 'hidden';
  5983. }
  5984. if(uro_uFP[uroEnums.FP_OPTS.filterMaxPURAge] === true)
  5985. {
  5986. if(purAge > uro_uFP[uroEnums.FP_OPTS.thresholdMaxPURDays]) placeStyle = 'hidden';
  5987. }
  5988. }
  5989.  
  5990. if(uroPURsToHide.indexOf(vObj.attributes.id) !== -1)
  5991. {
  5992. placeStyle = 'hidden';
  5993. }
  5994. }
  5995.  
  5996. mObj.style.visibility = placeStyle;
  5997. if(hasBalloon === true)
  5998. {
  5999. // for PURs related to multiple change requests, we also need to apply the
  6000. // filtering to the text inside the balloon that indicates how many CRs
  6001. // the PUR represents - the balloon itself gets filtered as part of the
  6002. // main marker above, but the text is in a seperate element...
  6003. let pObj = mObj.parentNode.parentNode;
  6004. let tObjs = pObj.getElementsByTagName("text");
  6005. for(let i = 0; i < tObjs.length; ++i)
  6006. {
  6007. tObjs[i].style.visibility = placeStyle;
  6008. }
  6009. }
  6010.  
  6011. if((uro_uFP[uroEnums.FP_OPTS.leavePURGeos] === false) && (placeStyle === 'hidden'))
  6012. {
  6013. if(vObj.model != null)
  6014. {
  6015. if(vObj.attributes.geometry != null)
  6016. {
  6017. let puGeo = document.getElementById(vObj.attributes.geometry.id);
  6018. if(puGeo !== null)
  6019. {
  6020. puGeo.style.visibility = 'hidden';
  6021. }
  6022. }
  6023. }
  6024. }
  6025. }
  6026. function uroFilterPlaces()
  6027. {
  6028. let pmTStart = performance.now();
  6029. let pmFunction = "uroFilterPlaces";
  6030.  
  6031. if(uroFilterPreamble() === false) return;
  6032.  
  6033. let moObj = uroGetHighlightedMapFeature();
  6034. let renderIntent = uroGetFeatureRenderIntent(moObj);
  6035. if(moObj != null)
  6036. {
  6037. if(moObj.featureType === 'venue')
  6038. {
  6039. if((renderIntent == 'select') || (renderIntent == 'highlightselected'))
  6040. {
  6041. return;
  6042. }
  6043. }
  6044. }
  6045.  
  6046. if(uroUtils.GetCBChecked('_cbDisablePlacesFiltering') === true) return;
  6047.  
  6048. uroUpdateVenueEditorLists();
  6049.  
  6050. let filterNameID = null;
  6051. let tbUserName = uroUtils.GetElmValue('_textPlacesEditor');
  6052. let selector = document.getElementById('_selectPlacesUserID');
  6053. if(selector.selectedIndex > 0)
  6054. {
  6055. let selUserName = document.getElementById('_selectPlacesUserID').selectedOptions[0].innerHTML;
  6056. if(selUserName == tbUserName)
  6057. {
  6058. filterNameID = document.getElementById('_selectPlacesUserID').selectedOptions[0].value;
  6059. }
  6060. }
  6061. filterNameID = uroGetUserID(filterNameID, tbUserName);
  6062.  
  6063. let filterHideNameID = null;
  6064. let tbHideUserName = uroUtils.GetElmValue('_textHidePlacesEditor');
  6065. let selectorHide = document.getElementById('_selectHidePlacesUserID');
  6066. if(selectorHide.selectedIndex > 0)
  6067. {
  6068. let selHideUserName = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].innerHTML;
  6069. if(selHideUserName == tbHideUserName)
  6070. {
  6071. filterHideNameID = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].value;
  6072. }
  6073. }
  6074. filterHideNameID = uroGetUserID(filterHideNameID, tbHideUserName);
  6075.  
  6076. let filterCats = [];
  6077. for(let i=0; i<W.Config.venues.categories.length; i++)
  6078. {
  6079. let parentCategory = W.Config.venues.categories[i];
  6080. let subCategory;
  6081.  
  6082. if(uroUtils.GetCBChecked('_cbPlacesFilter-'+parentCategory) === true)
  6083. {
  6084. filterCats.push(parentCategory);
  6085. for(let i1=0; i1<W.Config.venues.subcategories[parentCategory].length; i1++)
  6086. {
  6087. subCategory = W.Config.venues.subcategories[parentCategory][i1];
  6088. filterCats.push(subCategory);
  6089. }
  6090. }
  6091. else
  6092. {
  6093. for(let i2=0; i2<W.Config.venues.subcategories[parentCategory].length; i2++)
  6094. {
  6095. subCategory = W.Config.venues.subcategories[parentCategory][i2];
  6096. if(uroUtils.GetCBChecked('_cbPlacesFilter-'+subCategory) === true)
  6097. {
  6098. filterCats.push(subCategory);
  6099. }
  6100. }
  6101. }
  6102. }
  6103.  
  6104. let placeStyle;
  6105.  
  6106. let uFP_filterEditedLessThan = uroUtils.GetCBChecked('_cbPlaceFilterEditedLessThan');
  6107. let uFP_filterEditedMoreThan = uroUtils.GetCBChecked('_cbPlaceFilterEditedMoreThan');
  6108. let uFP_filterL0 = uroUtils.GetCBChecked('_cbHidePlacesL0');
  6109. let uFP_filterL1 = uroUtils.GetCBChecked('_cbHidePlacesL1');
  6110. let uFP_filterL2 = uroUtils.GetCBChecked('_cbHidePlacesL2');
  6111. let uFP_filterL3 = uroUtils.GetCBChecked('_cbHidePlacesL3');
  6112. let uFP_filterL4 = uroUtils.GetCBChecked('_cbHidePlacesL4');
  6113. let uFP_filterL5 = uroUtils.GetCBChecked('_cbHidePlacesL5');
  6114. let uFP_filterStaff = uroUtils.GetCBChecked('_cbHidePlacesStaff');
  6115. let uFP_filterAL = uroUtils.GetCBChecked('_cbHidePlacesAdLocked');
  6116. let uFP_filterOnLockLevel = (uFP_filterL0 || uFP_filterL1 || uFP_filterL2 || uFP_filterL3 || uFP_filterL4 || uFP_filterL5 || uFP_filterStaff);
  6117. let uFP_filterNoPhotos = uroUtils.GetCBChecked('_cbHideNoPhotoPlaces');
  6118. let uFP_filterWithPhotos = uroUtils.GetCBChecked('_cbHidePhotoPlaces');
  6119. let uFP_filterNoLinks = uroUtils.GetCBChecked('_cbHideNoLinkedPlaces');
  6120. let uFP_filterWithLinks = uroUtils.GetCBChecked('_cbHideLinkedPlaces');
  6121. let uFP_filterNoDescription = uroUtils.GetCBChecked('_cbHideNonDescribedPlaces');
  6122. let uFP_filterWithDescription = uroUtils.GetCBChecked('_cbHideDescribedPlaces');
  6123. let uFP_filterNoKeyword = uroUtils.GetCBChecked('_cbHideKeywordPlaces');
  6124. let uFP_filterKeyword = uroUtils.GetCBChecked('_cbHideNoKeywordPlaces');
  6125. let uFP_filterPrivate = uroUtils.GetCBChecked('_cbFilterPrivatePlaces');
  6126. let uFP_invertFilters = uroUtils.GetCBChecked('_cbInvertPlacesFilter');
  6127. let uFP_masterEnable = uroIsFilteringEnabled(false);
  6128. let uFP_filterAreaPlaces = uroUtils.GetCBChecked('_cbHideAreaPlaces');
  6129. let uFP_filterPointPlaces = uroUtils.GetCBChecked('_cbHidePointPlaces');
  6130. let uFP_filterCreatedBy = uroUtils.GetCBChecked('_cbShowOnlyPlacesCreatedBy');
  6131. let uFP_filterEditedBy = uroUtils.GetCBChecked('_cbShowOnlyPlacesEditedBy');
  6132. let uFP_filterHideCreatedBy = uroUtils.GetCBChecked('_cbHideOnlyPlacesCreatedBy');
  6133. let uFP_filterHideEditedBy = uroUtils.GetCBChecked('_cbHideOnlyPlacesEditedBy');
  6134.  
  6135. let uFP_hidePURsForFilteredPlaces = uroUtils.GetCBChecked('_cbHidePURsForFilteredPlaces');
  6136.  
  6137. let uFP_NameKeyword = document.getElementById('_textKeywordPlace').value.toLowerCase();
  6138. let uFP_thresholdMinDays = document.getElementById('_inputFilterPlaceEditMinDays').value;
  6139. let uFP_thresholdMaxDays = document.getElementById('_inputFilterPlaceEditMaxDays').value;
  6140.  
  6141. uroPURsToHide = [];
  6142.  
  6143. for(let v=0; v<uroVenueLayer.features.length; v++)
  6144. {
  6145. placeStyle = 'visible';
  6146. if(uFP_masterEnable === true)
  6147. {
  6148. let lmObj = uroVenueLayer.features[v];
  6149.  
  6150. // when an area place is selected, the drag points for editing the place outline now get added as objects into uroVenueLayer.features,
  6151. // however none of these objects had the .attributes.repositoryObject property - whilst the devs have now replaced this with the almost
  6152. // identical .wazeFeature._wmeObject property, it's unclear if drag points still need to be excluded from this scan, so the check
  6153. // remains in place as a "let's just make sure it has it before trying to use it"...
  6154. if(lmObj?.attributes?.wazeFeature?._wmeObject != null)
  6155. {
  6156. lmObj = lmObj.attributes.wazeFeature._wmeObject.attributes;
  6157. if(lmObj.id < 0)
  6158. {
  6159. // don't apply filtering to newly-created places - this allows the user to leave their filtering settings unchanged whilst
  6160. // adding a new place which, once saved, would then be hidden...
  6161. break;
  6162. }
  6163.  
  6164. if(uFP_filterAreaPlaces)
  6165. {
  6166. if(lmObj.geometry.id.indexOf('Polygon') !== -1)
  6167. {
  6168. placeStyle = 'hidden';
  6169. }
  6170. }
  6171. if(uFP_filterPointPlaces)
  6172. {
  6173. if(lmObj.geometry.id.indexOf('Point') !== -1)
  6174. {
  6175. placeStyle = 'hidden';
  6176. }
  6177. }
  6178.  
  6179.  
  6180. if(placeStyle == 'visible')
  6181. {
  6182. if((uFP_filterEditedLessThan) || (uFP_filterEditedMoreThan))
  6183. {
  6184. let editDate = lmObj.updatedOn;
  6185. if(editDate === undefined)
  6186. {
  6187. // where a place has never been edited since its creation, use the creation date instead...
  6188. editDate = lmObj.createdOn;
  6189. }
  6190. if(editDate != null)
  6191. {
  6192. let editDaysAgo = uroUtils.DateToDays(editDate);
  6193. if(uFP_filterEditedLessThan)
  6194. {
  6195. if(editDaysAgo < uFP_thresholdMinDays)
  6196. {
  6197. placeStyle = 'hidden';
  6198. }
  6199. }
  6200. if(uFP_filterEditedMoreThan)
  6201. {
  6202. if(editDaysAgo > uFP_thresholdMaxDays)
  6203. {
  6204. placeStyle = 'hidden';
  6205. }
  6206. }
  6207. }
  6208. }
  6209. }
  6210.  
  6211. if(placeStyle == 'visible')
  6212. {
  6213. if(uFP_filterOnLockLevel)
  6214. {
  6215. let lockLevel = lmObj.lockRank;
  6216. if ((uFP_filterL0) && (lockLevel === 0)) placeStyle = 'hidden';
  6217. if ((uFP_filterL1) && (lockLevel === 1)) placeStyle = 'hidden';
  6218. if ((uFP_filterL2) && (lockLevel === 2)) placeStyle = 'hidden';
  6219. if ((uFP_filterL3) && (lockLevel === 3)) placeStyle = 'hidden';
  6220. if ((uFP_filterL4) && (lockLevel === 4)) placeStyle = 'hidden';
  6221. if ((uFP_filterL5) && (lockLevel === 5)) placeStyle = 'hidden';
  6222. if ((uFP_filterStaff) && (lockLevel === 6)) placeStyle = 'hidden';
  6223. }
  6224. }
  6225.  
  6226. if(placeStyle == 'visible')
  6227. {
  6228. if(uFP_filterAL)
  6229. {
  6230. if(lmObj.adLocked) placeStyle = 'hidden';
  6231. }
  6232. }
  6233.  
  6234. if(placeStyle == 'visible')
  6235. {
  6236. if(uFP_filterNoPhotos || uFP_filterWithPhotos)
  6237. {
  6238. let nPhotos = 0;
  6239. for(let loop=0; loop<lmObj.images.length; loop++)
  6240. {
  6241. if(lmObj.images[loop].attributes.approved) nPhotos++;
  6242. }
  6243. if((uFP_filterNoPhotos) && (nPhotos === 0)) placeStyle = 'hidden';
  6244. if((uFP_filterWithPhotos) && (nPhotos !== 0)) placeStyle = 'hidden';
  6245. }
  6246. }
  6247.  
  6248. if(placeStyle == 'visible')
  6249. {
  6250. if(uFP_filterNoLinks || uFP_filterWithLinks)
  6251. {
  6252. let nLinks = lmObj.externalProviderIDs.length;
  6253. if((uFP_filterNoLinks) && (nLinks === 0)) placeStyle = 'hidden';
  6254. if((uFP_filterWithLinks) && (nLinks !== 0)) placeStyle = 'hidden';
  6255. }
  6256. }
  6257.  
  6258. if(placeStyle == 'visible')
  6259. {
  6260. if(uFP_filterNoDescription || uFP_filterWithDescription)
  6261. {
  6262. let lDesc = lmObj.description.length;
  6263. if((uFP_filterNoDescription) && (lDesc === 0)) placeStyle = 'hidden';
  6264. if((uFP_filterWithDescription) && (lDesc !== 0)) placeStyle = 'hidden';
  6265. }
  6266. }
  6267.  
  6268. if(placeStyle == 'visible')
  6269. {
  6270. if((uFP_filterPrivate === true) && (lmObj.residential === true))
  6271. {
  6272. placeStyle = 'hidden';
  6273. }
  6274. else
  6275. {
  6276. for(let cat=0; cat<filterCats.length; cat++)
  6277. {
  6278. if(_.includes(lmObj.categories, filterCats[cat]))
  6279. {
  6280. placeStyle = 'hidden';
  6281. break;
  6282. }
  6283. }
  6284. }
  6285. }
  6286.  
  6287. if(placeStyle == 'visible')
  6288. {
  6289. if(uFP_filterNoKeyword || uFP_filterKeyword)
  6290. {
  6291. let venueName = lmObj.name.toLowerCase();
  6292. let noKeywordMatch = true;
  6293. if(uFP_NameKeyword === '')
  6294. {
  6295. noKeywordMatch = (venueName !== '');
  6296. }
  6297. else
  6298. {
  6299. noKeywordMatch = (venueName.indexOf(uFP_NameKeyword) === -1);
  6300. }
  6301.  
  6302. if(!noKeywordMatch && uFP_filterNoKeyword) placeStyle = 'hidden';
  6303. if(noKeywordMatch && uFP_filterKeyword) placeStyle = 'hidden';
  6304. }
  6305. }
  6306.  
  6307. if(placeStyle == 'visible')
  6308. {
  6309. if(filterNameID != null)
  6310. {
  6311. if(uFP_filterCreatedBy === true)
  6312. {
  6313. if(filterNameID != lmObj.createdBy) placeStyle = 'hidden';
  6314. }
  6315. if(uFP_filterEditedBy === true)
  6316. {
  6317. if(filterNameID != lmObj.updatedBy) placeStyle = 'hidden';
  6318. }
  6319. }
  6320. }
  6321. if(placeStyle == 'visible')
  6322. {
  6323. if(filterHideNameID != null)
  6324. {
  6325. if(uFP_filterHideCreatedBy === true)
  6326. {
  6327. if(filterHideNameID == lmObj.createdBy) placeStyle = 'hidden';
  6328. }
  6329. if(uFP_filterHideEditedBy === true)
  6330. {
  6331. if(filterHideNameID == lmObj.updatedBy) placeStyle = 'hidden';
  6332. }
  6333. }
  6334. }
  6335.  
  6336. if(uFP_invertFilters === true)
  6337. {
  6338. if(placeStyle == 'hidden') placeStyle = 'visible';
  6339. else placeStyle = 'hidden';
  6340. }
  6341. }
  6342.  
  6343. if((placeStyle == 'hidden') && (uFP_hidePURsForFilteredPlaces === true))
  6344. {
  6345. uroPURsToHide.push(lmObj.id);
  6346. }
  6347. }
  6348.  
  6349. let geoID = uroVenueLayer.features[v].geometry.id;
  6350. if(document.getElementById(geoID) !== null)
  6351. {
  6352. document.getElementById(geoID).style.visibility = placeStyle;
  6353. }
  6354. }
  6355.  
  6356. uro_uFP[uroEnums.FP_OPTS.filterUneditable] = uroUtils.GetCBChecked('_cbFilterUneditablePlaceUpdates');
  6357. uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] = uroUtils.GetCBChecked('_cbPURFilterInsideManagedAreas');
  6358. uro_uFP[uroEnums.FP_OPTS.excludeMyAreas] = uroUtils.GetCBChecked('_cbPURExcludeUserArea');
  6359. uro_uFP[uroEnums.FP_OPTS.filterLockRanked] = uroUtils.GetCBChecked('_cbFilterLockRankedPlaceUpdates');
  6360. uro_uFP[uroEnums.FP_OPTS.filterFlagged] = uroUtils.GetCBChecked("_cbFilterFlaggedPUR");
  6361. uro_uFP[uroEnums.FP_OPTS.filterNewPlace] = uroUtils.GetCBChecked("_cbFilterNewPlacePUR");
  6362. uro_uFP[uroEnums.FP_OPTS.filterUpdatedDetails] = uroUtils.GetCBChecked("_cbFilterUpdatedDetailsPUR");
  6363. uro_uFP[uroEnums.FP_OPTS.filterNewPhoto] = uroUtils.GetCBChecked("_cbFilterNewPhotoPUR");
  6364. uro_uFP[uroEnums.FP_OPTS.filterMinPURAge] = uroUtils.GetCBChecked('_cbEnablePURMinAgeFilter');
  6365. uro_uFP[uroEnums.FP_OPTS.filterMaxPURAge] = uroUtils.GetCBChecked('_cbEnablePURMaxAgeFilter');
  6366. uro_uFP[uroEnums.FP_OPTS.invertPURFilters] = uroUtils.GetCBChecked('_cbInvertPURFilters');
  6367. uro_uFP[uroEnums.FP_OPTS.leavePURGeos] = uroUtils.GetCBChecked('_cbLeavePURGeos');
  6368. uro_uFP[uroEnums.FP_OPTS.filterCFPhone] = uroUtils.GetCBChecked('_cbPURFilterCFPhone');
  6369. uro_uFP[uroEnums.FP_OPTS.filterCFName] = uroUtils.GetCBChecked('_cbPURFilterCFName');
  6370. uro_uFP[uroEnums.FP_OPTS.filterCFEntryExitPoints] = uroUtils.GetCBChecked('_cbPURFilterCFEntryExitPoints');
  6371. uro_uFP[uroEnums.FP_OPTS.filterCFOpeningHours] = uroUtils.GetCBChecked('_cbPURFilterCFOpeningHours');
  6372. uro_uFP[uroEnums.FP_OPTS.filterCFAliases] = uroUtils.GetCBChecked('_cbPURFilterCFAliases');
  6373. uro_uFP[uroEnums.FP_OPTS.filterCFServices] = uroUtils.GetCBChecked('_cbPURFilterCFServices');
  6374. uro_uFP[uroEnums.FP_OPTS.filterCFGeometry] = uroUtils.GetCBChecked('_cbPURFilterCFGeometry');
  6375. uro_uFP[uroEnums.FP_OPTS.filterCFHouseNumber] = uroUtils.GetCBChecked('_cbPURFilterCFHouseNumber');
  6376. uro_uFP[uroEnums.FP_OPTS.filterCFCategories] = uroUtils.GetCBChecked('_cbPURFilterCFCategories');
  6377. uro_uFP[uroEnums.FP_OPTS.filterCFDescription] = uroUtils.GetCBChecked('_cbPURFilterCFDescription');
  6378.  
  6379. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] =
  6380. (
  6381. uro_uFP[uroEnums.FP_OPTS.filterCFPhone] ||
  6382. uro_uFP[uroEnums.FP_OPTS.filterCFName] ||
  6383. uro_uFP[uroEnums.FP_OPTS.filterCFEntryExitPoints] ||
  6384. uro_uFP[uroEnums.FP_OPTS.filterCFOpeningHours]
  6385. );
  6386. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] =
  6387. (
  6388. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] ||
  6389. uro_uFP[uroEnums.FP_OPTS.filterCFAliases] ||
  6390. uro_uFP[uroEnums.FP_OPTS.filterCFServices] ||
  6391. uro_uFP[uroEnums.FP_OPTS.filterCFGeometry]
  6392. );
  6393. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] =
  6394. (
  6395. uro_uFP[uroEnums.FP_OPTS.filterOnCFs] ||
  6396. uro_uFP[uroEnums.FP_OPTS.filterCFHouseNumber] ||
  6397. uro_uFP[uroEnums.FP_OPTS.filterCFCategories] ||
  6398. uro_uFP[uroEnums.FP_OPTS.filterCFDescription]
  6399. );
  6400.  
  6401. uro_uFP[uroEnums.FP_OPTS.thresholdMinPURDays] = uroUtils.GetElmValue('_inputPURFilterMinDays');
  6402. uro_uFP[uroEnums.FP_OPTS.thresholdMaxPURDays] = uroUtils.GetElmValue('_inputPURFilterMaxDays');
  6403. uro_uFP[uroEnums.FP_OPTS.isLoggedIn] = W.loginManager.isLoggedIn();
  6404. uro_uFP[uroEnums.FP_OPTS.userRank] = W.loginManager.user.attributes.rank;
  6405.  
  6406. uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] = uro_uFP[uroEnums.FP_OPTS.filterInsideManagedAreas] && (uroGetManagedAreas() !== 0);
  6407. if(uroUtils.GetCBChecked('_cbPURExcludeUserArea') == true)
  6408. {
  6409. uroIgnoreAreasUserID = W.loginManager.user.attributes.id;
  6410. }
  6411.  
  6412. uroPrepForFilterPlaceMarker(uroLayers.ID.PUR, uFP_masterEnable);
  6413. uroPrepForFilterPlaceMarker(uroLayers.ID.PPUR, uFP_masterEnable);
  6414. uroPrepForFilterPlaceMarker(uroLayers.ID.RPUR, uFP_masterEnable);
  6415.  
  6416. uroDBG.PerfMon(pmFunction, pmTStart);
  6417. }
  6418. function uroPrepForFilterPlaceMarker(markerType, masterEnable)
  6419. {
  6420. if(uroLayers.layers[markerType].l?.getVisibility() === true)
  6421. {
  6422. let pu;
  6423. let mObj;
  6424. let vObj;
  6425. let idList = uroGetMarkerIDs(markerType);
  6426. for(pu of idList)
  6427. {
  6428. mObj = uroGetMarker(markerType, pu);
  6429. if(mObj !== null)
  6430. {
  6431. vObj = W.model.venues.objects[pu];
  6432. uroFilterPlaceMarker(mObj, vObj, masterEnable);
  6433. }
  6434. }
  6435. }
  6436. }
  6437. function uroGetClosestSegmentToPoint(p)
  6438. {
  6439. let retval = null;
  6440. if(W.map.getZoom() >= 16)
  6441. {
  6442. let minDist = 99999999;
  6443.  
  6444. for(let s in W.model.segments.objects)
  6445. {
  6446. if(W.model.segments.objects.hasOwnProperty(s))
  6447. {
  6448. let seg = W.model.segments.getObjectById(s);
  6449. let dist = seg.attributes.geometry.distanceTo(p);
  6450. if(dist < minDist)
  6451. {
  6452. minDist = dist;
  6453. retval = s;
  6454. }
  6455. }
  6456. }
  6457. }
  6458. return retval;
  6459. }
  6460. function uroIsCamSpeedValid(camObj)
  6461. {
  6462. let retval = true;
  6463.  
  6464. let cPoint = camObj.attributes.geometry.getCentroid();
  6465. let nSeg = uroGetClosestSegmentToPoint(cPoint);
  6466. if(nSeg !== null)
  6467. {
  6468. let fwdSpeed = W.model.segments.getObjectById(nSeg).attributes.fwdMaxSpeed;
  6469. let revSpeed = W.model.segments.getObjectById(nSeg).attributes.revMaxSpeed;
  6470. let camSpeed = camObj.attributes.speed;
  6471. if(W.model.isImperial == true)
  6472. {
  6473. fwdSpeed = Math.round(fwdSpeed / 1.609);
  6474. revSpeed = Math.round(revSpeed / 1.609);
  6475. camSpeed = Math.round(camSpeed / 1.609);
  6476. }
  6477. if((camSpeed !== fwdSpeed) && (camSpeed !== revSpeed))
  6478. {
  6479. retval = false;
  6480. }
  6481. }
  6482.  
  6483. return retval;
  6484. }
  6485. function uroFilterCameras()
  6486. {
  6487. //// disabled pending update for hazard-based cameras
  6488. return;
  6489.  
  6490. let pmTStart = performance.now();
  6491. let pmFunction = "uroFilterCameras";
  6492.  
  6493. if(uroFilterPreamble() === false)
  6494. {
  6495. return;
  6496. }
  6497.  
  6498. if(uroMouseIsDown === false) W.map.camerasLayer.redraw();
  6499.  
  6500. if(uroIsFilteringEnabled(false) === true)
  6501. {
  6502. uroUpdateEditorList(W.model.cameras.objects, '_selectCameraUserID', true, true, false, false);
  6503. let tbUserName = uroUtils.GetElmValue('_textCameraEditor');
  6504. let selector = document.getElementById('_selectCameraUserID');
  6505. let filterNameID = null;
  6506. if(selector.selectedIndex > 0)
  6507. {
  6508. let selUserName = document.getElementById('_selectCameraUserID').selectedOptions[0].innerHTML;
  6509. if(selUserName == tbUserName)
  6510. {
  6511. filterNameID = document.getElementById('_selectCameraUserID').selectedOptions[0].value;
  6512. }
  6513. }
  6514. filterNameID = uroGetUserID(filterNameID, tbUserName);
  6515.  
  6516. let isChecked_cbShowOnlyCamsCreatedBy = uroUtils.GetCBChecked('_cbShowOnlyCamsCreatedBy');
  6517. let isChecked_cbShowOnlyCamsEditedBy = uroUtils.GetCBChecked('_cbShowOnlyCamsEditedBy');
  6518. let isChecked_cbShowOnlyMyCams = uroUtils.GetCBChecked('_cbShowOnlyMyCams');
  6519. let isChecked_cbShowWorldCams = uroUtils.GetCBChecked('_cbShowWorldCams');
  6520. let isChecked_cbShowUSACams = uroUtils.GetCBChecked('_cbShowUSACams');
  6521. let isChecked_cbShowNonWorldCams = uroUtils.GetCBChecked('_cbShowNonWorldCams');
  6522. let isChecked_cbShowSpeedCams = uroUtils.GetCBChecked('_cbShowSpeedCams');
  6523. let isChecked_cbShowRedLightCams = uroUtils.GetCBChecked('_cbShowRedLightCams');
  6524. let isChecked_cbShowDummyCams = uroUtils.GetCBChecked('_cbShowDummyCams');
  6525. let isChecked_cbShowIfNoSpeedSet = uroUtils.GetCBChecked('_cbShowIfNoSpeedSet');
  6526. let isChecked_cbShowIfSpeedSet = uroUtils.GetCBChecked('_cbShowIfSpeedSet');
  6527. let isChecked_cbShowIfInvalidSpeedSet = uroUtils.GetCBChecked('_cbShowIfInvalidSpeedSet');
  6528. let isChecked_cbShowRLCIfNoSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfNoSpeedSet');
  6529. let isChecked_cbShowRLCIfNonZeroSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfNonZeroSpeedSet');
  6530. let isChecked_cbShowRLCIfZeroSpeedSet = uroUtils.GetCBChecked('_cbShowRLCIfZeroSpeedSet');
  6531. let isChecked_cbHideCreatedByMe = uroUtils.GetCBChecked('_cbHideCreatedByMe');
  6532. let isChecked_cbHideCreatedByRank0 = uroUtils.GetCBChecked('_cbHideCreatedByRank0');
  6533. let isChecked_cbHideCreatedByRank1 = uroUtils.GetCBChecked('_cbHideCreatedByRank1');
  6534. let isChecked_cbHideCreatedByRank2 = uroUtils.GetCBChecked('_cbHideCreatedByRank2');
  6535. let isChecked_cbHideCreatedByRank3 = uroUtils.GetCBChecked('_cbHideCreatedByRank3');
  6536. let isChecked_cbHideCreatedByRank4 = uroUtils.GetCBChecked('_cbHideCreatedByRank4');
  6537. let isChecked_cbHideCreatedByRank5 = uroUtils.GetCBChecked('_cbHideCreatedByRank5');
  6538. let isChecked_cbHideUpdatedByMe = uroUtils.GetCBChecked('_cbHideUpdatedByMe');
  6539. let isChecked_cbHideUpdatedByRank0 = uroUtils.GetCBChecked('_cbHideUpdatedByRank0');
  6540. let isChecked_cbHideUpdatedByRank1 = uroUtils.GetCBChecked('_cbHideUpdatedByRank1');
  6541. let isChecked_cbHideUpdatedByRank2 = uroUtils.GetCBChecked('_cbHideUpdatedByRank2');
  6542. let isChecked_cbHideUpdatedByRank3 = uroUtils.GetCBChecked('_cbHideUpdatedByRank3');
  6543. let isChecked_cbHideUpdatedByRank4 = uroUtils.GetCBChecked('_cbHideUpdatedByRank4');
  6544. let isChecked_cbHideUpdatedByRank5 = uroUtils.GetCBChecked('_cbHideUpdatedByRank5');
  6545. let isChecked_HideManualLockedCams = uroUtils.GetCBChecked('_cbHideManualLockedCams');
  6546. let isChecked_cbHighlightInsteadOfHideCams = uroUtils.GetCBChecked('_cbHighlightInsteadOfHideCams');
  6547. let isChecked_InvertFiltere = uroUtils.GetCBChecked('_cbInvertCamFilters');
  6548.  
  6549. let nCameras = uroLayers.layers[uroLayers.ID.cam].l.features.length;
  6550. for (let i = 0; i < nCameras; ++i)
  6551. {
  6552. let uroCamUpdater = '';
  6553. let uroCamUpdaterRank = -1;
  6554. let uroCamCreator = '';
  6555. let uroCamCreatorRank = -1;
  6556. let wf = uroLayers.layers[uroLayers.ID.cam].l.features[i].attributes.wazeFeature;
  6557. // When a camera is selected, the alignment/positioning UI elements get added to features[].
  6558. // As these elements aren't camera markers and therefore have no attributes, we need to
  6559. // ignore them to prevent errors in the filtering code below...
  6560. if(wf !== undefined)
  6561. {
  6562. let uroCam = wf._wmeObject;
  6563. let uroCamStyle = 'visible';
  6564.  
  6565. if(uroCam.attributes.createdBy !== null)
  6566. {
  6567. if(W.model.users.objects[uroCam.attributes.createdBy] != null)
  6568. {
  6569. uroCamCreator = W.model.users.objects[uroCam.attributes.createdBy].attributes.userName;
  6570. uroCamCreatorRank = W.model.users.objects[uroCam.attributes.createdBy].attributes.rank;
  6571. }
  6572. }
  6573.  
  6574. if(uroCam.attributes.updatedBy !== null)
  6575. {
  6576. if(W.model.users.objects[uroCam.attributes.updatedBy] != null)
  6577. {
  6578. uroCamUpdater = W.model.users.objects[uroCam.attributes.updatedBy].attributes.userName;
  6579. uroCamUpdaterRank = W.model.users.objects[uroCam.attributes.updatedBy].attributes.rank;
  6580. }
  6581. }
  6582.  
  6583. let uroCamType = uroCam.attributes.type;
  6584. let camIsAutoLocked = (uroCam.attributes.lockRank === null);
  6585.  
  6586. if(isChecked_HideManualLockedCams === true)
  6587. {
  6588. if(camIsAutoLocked === false) uroCamStyle = 'hidden';
  6589. }
  6590.  
  6591. if(filterNameID != null)
  6592. {
  6593. if(isChecked_cbShowOnlyCamsCreatedBy === true)
  6594. {
  6595. if(filterNameID != uroCam.attributes.createdBy) uroCamStyle = 'hidden';
  6596. }
  6597. if(isChecked_cbShowOnlyCamsEditedBy === true)
  6598. {
  6599. if(filterNameID != uroCam.attributes.updatedBy) uroCamStyle = 'hidden';
  6600. }
  6601. }
  6602.  
  6603. if(isChecked_cbShowOnlyMyCams === true)
  6604. {
  6605. if((uroUserID != uroCam.attributes.createdBy)&&(uroUserID != uroCam.attributes.updatedBy)) uroCamStyle = 'hidden';
  6606. }
  6607.  
  6608. if((isChecked_cbShowWorldCams === false) || (isChecked_cbShowUSACams === false) || (isChecked_cbShowNonWorldCams === false))
  6609. {
  6610. let posWorld = uroCamCreator.indexOf('world_');
  6611. let posUSA = uroCamCreator.indexOf('usa_');
  6612.  
  6613. if((isChecked_cbShowWorldCams === false) && (posWorld === 0)) uroCamStyle = 'hidden';
  6614. if((isChecked_cbShowUSACams === false) && (posUSA === 0)) uroCamStyle = 'hidden';
  6615. if((isChecked_cbShowNonWorldCams === false) && (posWorld !== 0) && (posUSA !== 0)) uroCamStyle = 'hidden';
  6616. }
  6617.  
  6618. if((isChecked_cbShowSpeedCams === false) || (isChecked_cbShowRedLightCams === false) || (isChecked_cbShowDummyCams === false))
  6619. {
  6620. if((isChecked_cbShowSpeedCams === false) && (uroCamType == 2)) uroCamStyle = 'hidden';
  6621. if((isChecked_cbShowRedLightCams === false) && (uroCamType == 4)) uroCamStyle = 'hidden';
  6622. if((isChecked_cbShowDummyCams === false) && (uroCamType == 3)) uroCamStyle = 'hidden';
  6623. }
  6624.  
  6625. if((isChecked_cbShowSpeedCams === true) && (uroCamType == 2))
  6626. {
  6627. if((isChecked_cbShowIfNoSpeedSet === false) && (uroCam.attributes.speed === null)) uroCamStyle = 'hidden';
  6628. if((isChecked_cbShowIfSpeedSet === false) && (uroCam.attributes.speed !== null)) uroCamStyle = 'hidden';
  6629. if(isChecked_cbShowIfInvalidSpeedSet === false)
  6630. {
  6631. if(uroIsCamSpeedValid(uroCam) === false)
  6632. {
  6633. uroCamStyle = 'hidden';
  6634. }
  6635. }
  6636. }
  6637.  
  6638. if((isChecked_cbShowRedLightCams === true) && (uroCamType == 4))
  6639. {
  6640. if((isChecked_cbShowRLCIfNoSpeedSet === false) && (uroCam.attributes.speed === null)) uroCamStyle = 'hidden';
  6641. if((isChecked_cbShowRLCIfNonZeroSpeedSet === false) && (uroCam.attributes.speed > 0)) uroCamStyle = 'hidden';
  6642. if((isChecked_cbShowRLCIfZeroSpeedSet === false) && (uroCam.attributes.speed === 0)) uroCamStyle = 'hidden';
  6643. }
  6644.  
  6645. if(isChecked_cbHideCreatedByMe === true)
  6646. {
  6647. if(uroUserID == uroCam.attributes.createdBy) uroCamStyle = 'hidden';
  6648. }
  6649. if((isChecked_cbHideCreatedByRank0 === true) && (uroCamCreatorRank === 0)) uroCamStyle = 'hidden';
  6650. if((isChecked_cbHideCreatedByRank1 === true) && (uroCamCreatorRank == 1)) uroCamStyle = 'hidden';
  6651. if((isChecked_cbHideCreatedByRank2 === true) && (uroCamCreatorRank == 2)) uroCamStyle = 'hidden';
  6652. if((isChecked_cbHideCreatedByRank3 === true) && (uroCamCreatorRank == 3)) uroCamStyle = 'hidden';
  6653. if((isChecked_cbHideCreatedByRank4 === true) && (uroCamCreatorRank == 4)) uroCamStyle = 'hidden';
  6654. if((isChecked_cbHideCreatedByRank5 === true) && (uroCamCreatorRank == 5)) uroCamStyle = 'hidden';
  6655.  
  6656. if(isChecked_cbHideUpdatedByMe === true)
  6657. {
  6658. if(uroUserID == uroCam.attributes.updatedBy) uroCamStyle = 'hidden';
  6659. }
  6660. if((isChecked_cbHideUpdatedByRank0 === true) && (uroCamUpdaterRank === 0)) uroCamStyle = 'hidden';
  6661. if((isChecked_cbHideUpdatedByRank1 === true) && (uroCamUpdaterRank == 1)) uroCamStyle = 'hidden';
  6662. if((isChecked_cbHideUpdatedByRank2 === true) && (uroCamUpdaterRank == 2)) uroCamStyle = 'hidden';
  6663. if((isChecked_cbHideUpdatedByRank3 === true) && (uroCamUpdaterRank == 3)) uroCamStyle = 'hidden';
  6664. if((isChecked_cbHideUpdatedByRank4 === true) && (uroCamUpdaterRank == 4)) uroCamStyle = 'hidden';
  6665. if((isChecked_cbHideUpdatedByRank5 === true) && (uroCamUpdaterRank == 5)) uroCamStyle = 'hidden';
  6666.  
  6667. if(isChecked_InvertFiltere === true)
  6668. {
  6669. if(uroCamStyle == "hidden")
  6670. {
  6671. uroCamStyle = "";
  6672. }
  6673. else
  6674. {
  6675. uroCamStyle = "hidden";
  6676. }
  6677. }
  6678.  
  6679. let uroCamGeometryID = uroLayers.layers[uroLayers.ID.cam].l.features[i].geometry.id;
  6680. let svgElm = document.getElementById(uroCamGeometryID);
  6681.  
  6682. if(svgElm !== null)
  6683. {
  6684. let origImage;
  6685. if(uroCamStyle == "hidden")
  6686. {
  6687. if(isChecked_cbHighlightInsteadOfHideCams === true)
  6688. {
  6689. // set the "highlight" camera image here...
  6690. let hrefImage = svgElm.getAttribute("xlink:href");
  6691. origImage = svgElm.getAttribute("origImage");
  6692. if((hrefImage === origImage) || (origImage === null))
  6693. {
  6694. svgElm.setAttribute("origImage", hrefImage);
  6695. svgElm.setAttribute("xlink:href", uroImages.HighlightedCameraImages[(uroCamType-2)]);
  6696.  
  6697. svgElm.addEventListener("mouseover", uroMarkers.MouseOver, false);
  6698. svgElm.addEventListener("mouseout", uroMarkers.MouseOut, false);
  6699. }
  6700. }
  6701. else
  6702. {
  6703. svgElm.remove();
  6704. }
  6705. }
  6706. else
  6707. {
  6708. // restore the original camera image here...
  6709. if(svgElm.getAttribute("origImage") !== null)
  6710. {
  6711. origImage = svgElm.getAttribute("origImage");
  6712. svgElm.setAttribute("xlink:href", origImage);
  6713. svgElm.removeAttribute("origImage");
  6714. }
  6715. }
  6716. }
  6717. }
  6718. }
  6719. }
  6720. uroDBG.PerfMon(pmFunction, pmTStart);
  6721. }
  6722. function uroFilterMapComments()
  6723. {
  6724. let pmTStart = performance.now();
  6725. let pmFunction = "uroFilterMapComments";
  6726.  
  6727. if(uroFilterPreamble() === false) return;
  6728.  
  6729. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  6730. let filterDescMustBePresent = uroUtils.GetCBChecked('_cbMCDescriptionMustBePresent');
  6731. let filterDescMustBeAbsent = uroUtils.GetCBChecked('_cbMCDescriptionMustBeAbsent');
  6732. let filterKeywordMustBePresent = uroUtils.GetCBChecked('_cbMCEnableKeywordMustBePresent');
  6733. let filterKeywordMustBeAbsent = uroUtils.GetCBChecked('_cbMCEnableKeywordMustBeAbsent');
  6734. let filterMyFollowed = uroUtils.GetCBChecked('_cbMCHideMyFollowed');
  6735. let filterMyUnfollowed = uroUtils.GetCBChecked('_cbMCHideMyUnfollowed');
  6736. let filterRoadworks = uroUtils.GetCBChecked('_cbMCFilterRoadworks');
  6737. let filterConstruction = uroUtils.GetCBChecked('_cbMCFilterConstruction');
  6738. let filterClosure = uroUtils.GetCBChecked('_cbMCFilterClosure');
  6739. let filterEvent = uroUtils.GetCBChecked('_cbMCFilterEvent');
  6740. let filterNote = uroUtils.GetCBChecked('_cbMCFilterNote');
  6741. let filterWSLM = uroUtils.GetCBChecked('_cbMCFilterWSLM');
  6742. let filterBOG = uroUtils.GetCBChecked('_cbMCFilterBOG');
  6743. let filterDifficult = uroUtils.GetCBChecked('_cbMCFilterDifficult');
  6744. let invertFilters = uroUtils.GetCBChecked('_cbInvertMCFilter');
  6745. let keywordPresent = uroUtils.GetElmValue('_textMCKeywordPresent');
  6746. let keywordAbsent = uroUtils.GetElmValue('_textMCKeywordAbsent');
  6747. let caseInsensitive = uroUtils.GetCBChecked('_cbMCCaseInsensitive');
  6748. let filterCommentsMustBePresent = uroUtils.GetCBChecked('_cbMCCommentsMustBePresent');
  6749. let filterCommentsMustBeAbsent = uroUtils.GetCBChecked('_cbMCCommentsMustBeAbsent');
  6750.  
  6751. let filterExpiryMustBePresent = uroUtils.GetCBChecked('_cbMCExpiryMustBePresent');
  6752. let filterExpiryMustBeAbsent = uroUtils.GetCBChecked('_cbMCExpiryMustBeAbsent');
  6753. let filterByCreatorEnable = uroUtils.GetCBChecked('_cbMCCreatorIDFilter');
  6754. let filterL1 = uroUtils.GetCBChecked('_cbHideMCRank0');
  6755. let filterL2 = uroUtils.GetCBChecked('_cbHideMCRank1');
  6756. let filterL3 = uroUtils.GetCBChecked('_cbHideMCRank2');
  6757. let filterL4 = uroUtils.GetCBChecked('_cbHideMCRank3');
  6758. let filterL5 = uroUtils.GetCBChecked('_cbHideMCRank4');
  6759. let filterL6 = uroUtils.GetCBChecked('_cbHideMCRank5');
  6760. let filterWRCMC = uroUtils.GetCBChecked('_cbHideWRCMCs');
  6761. let selectorCreator = document.getElementById('_selectMCCreatorID');
  6762.  
  6763. if(filterByCreatorEnable === false)
  6764. {
  6765. while(selectorCreator.options.length > 0)
  6766. {
  6767. selectorCreator.options.remove(0);
  6768. }
  6769. }
  6770. let creatorUser = null;
  6771. if(filterByCreatorEnable === true)
  6772. {
  6773. if(selectorCreator.options.length === 0)
  6774. {
  6775. uroUpdateEditorList(W.model.mapComments.objects, '_selectMCCreatorID', true, false, false, false);
  6776. }
  6777. if(selectorCreator.selectedOptions[0] != null)
  6778. {
  6779. creatorUser = parseInt(selectorCreator.selectedOptions[0].value);
  6780. }
  6781. }
  6782.  
  6783. for (let mcIdx = 0; mcIdx < uroMCLayer.features.length; mcIdx++)
  6784. {
  6785. {
  6786. let mcObj = uroMCLayer?.features[mcIdx]?.attributes?.wazeFeature?._wmeObject;
  6787. if(mcObj !== undefined)
  6788. {
  6789. let desc = '';
  6790. if(mcObj.attributes.subject !== null) desc += mcObj.attributes.subject.replace(/<\/?[^>]+(>|$)/g, "");
  6791. if(mcObj.attributes.body !== null) desc += mcObj.attributes.body.replace(/<\/?[^>]+(>|$)/g, "");
  6792. let nComments = mcObj.attributes.conversation.length;
  6793. if(nComments > 0)
  6794. {
  6795. for(let cIdx=0; cIdx < nComments; cIdx++)
  6796. {
  6797. desc += mcObj.attributes.conversation[cIdx].text.replace(/<\/?[^>]+(>|$)/g, "");
  6798. }
  6799. }
  6800.  
  6801. let mcStyle = 'visible';
  6802. if(uroIgnore.IsOnList(mcObj.attributes.id)) mcStyle = 'hidden';
  6803. if(uFURs_masterEnable === true)
  6804. {
  6805. let ukroadworks_ur = false;
  6806. let construction_ur = false;
  6807. let closure_ur = false;
  6808. let event_ur = false;
  6809. let note_ur = false;
  6810. let wslm_ur = false;
  6811. let bog_ur = false;
  6812. let difficult_ur = false;
  6813.  
  6814. let filterByNotIncludedKeyword = false;
  6815. let filterByIncludedKeyword = true;
  6816.  
  6817. let customType = uroGetCustomType(null, "mc", desc);
  6818. if(customType === 0) ukroadworks_ur = true;
  6819. else if(customType === 1) construction_ur = true;
  6820. else if(customType === 2) closure_ur = true;
  6821. else if(customType === 3) event_ur = true;
  6822. else if(customType === 4) note_ur = true;
  6823. else if(customType === 5) wslm_ur = true;
  6824. else if(customType === 6) bog_ur = true;
  6825. else if(customType === 7) difficult_ur = true;
  6826.  
  6827. let rank = mcObj.attributes.lockRank;
  6828. let expiry = mcObj.attributes.endDate;
  6829.  
  6830. // keywords
  6831. if(mcStyle == 'visible')
  6832. {
  6833. if(filterDescMustBePresent === true)
  6834. {
  6835. if(desc === '') mcStyle = 'hidden';
  6836. }
  6837. if(filterDescMustBeAbsent === true)
  6838. {
  6839. if(desc !== '') mcStyle = 'hidden';
  6840. }
  6841.  
  6842. if(filterCommentsMustBePresent === true)
  6843. {
  6844. if(nComments === 0) mcStyle = 'hidden';
  6845. }
  6846. if(filterCommentsMustBeAbsent === true)
  6847. {
  6848. if(nComments > 0) mcStyle = 'hidden';
  6849. }
  6850.  
  6851. if(filterKeywordMustBePresent === true)
  6852. {
  6853. let keywordIsPresentInDesc = uroUtils.KeywordPresent(desc,keywordPresent,caseInsensitive);
  6854. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInDesc));
  6855. }
  6856. if(filterKeywordMustBeAbsent === true)
  6857. {
  6858. let keywordIsAbsentInDesc = uroUtils.KeywordPresent(desc,keywordAbsent,caseInsensitive);
  6859. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInDesc);
  6860. }
  6861.  
  6862. filterByNotIncludedKeyword = (filterByNotIncludedKeyword && filterKeywordMustBeAbsent);
  6863. filterByIncludedKeyword = (filterByIncludedKeyword && filterKeywordMustBePresent);
  6864. if(filterByNotIncludedKeyword || filterByIncludedKeyword)
  6865. {
  6866. mcStyle = 'hidden';
  6867. }
  6868.  
  6869. }
  6870.  
  6871. //lock rank
  6872. if(mcStyle == 'visible')
  6873. {
  6874. if((filterL1 === true) && (rank == 0)) mcStyle = 'hidden';
  6875. if((filterL2 === true) && (rank == 1)) mcStyle = 'hidden';
  6876. if((filterL3 === true) && (rank == 2)) mcStyle = 'hidden';
  6877. if((filterL4 === true) && (rank == 3)) mcStyle = 'hidden';
  6878. if((filterL5 === true) && (rank == 4)) mcStyle = 'hidden';
  6879. if((filterL6 === true) && (rank == 5)) mcStyle = 'hidden';
  6880. }
  6881.  
  6882. // expiry
  6883. if(mcStyle == 'visible')
  6884. {
  6885. if((filterExpiryMustBePresent === true) && (expiry === null)) mcStyle = 'hidden';
  6886. if((filterExpiryMustBeAbsent === true) && (expiry != null)) mcStyle = 'hidden';
  6887. }
  6888.  
  6889. // is following?
  6890. if(mcStyle == 'visible')
  6891. {
  6892. if(mcObj.attributes.isFollowing === true)
  6893. {
  6894. if(filterMyFollowed === true) mcStyle = 'hidden';
  6895. }
  6896. else
  6897. {
  6898. if(filterMyUnfollowed === true) mcStyle = 'hidden';
  6899. }
  6900. }
  6901.  
  6902. if(mcStyle == 'visible')
  6903. {
  6904. if(creatorUser !== null)
  6905. {
  6906. if(mcObj.attributes.createdBy != creatorUser) mcStyle = 'hidden';
  6907. }
  6908. if(filterWRCMC === true)
  6909. {
  6910. if(mcObj.attributes.createdBy == 304740435) mcStyle = 'hidden';
  6911. }
  6912. }
  6913.  
  6914. // custom tags
  6915. if(mcStyle == 'visible')
  6916. {
  6917. if(ukroadworks_ur === true)
  6918. {
  6919. if(filterRoadworks === true) mcStyle = 'hidden';
  6920. }
  6921. else if(construction_ur === true)
  6922. {
  6923. if(filterConstruction === true) mcStyle = 'hidden';
  6924. }
  6925. else if(closure_ur === true)
  6926. {
  6927. if(filterClosure === true) mcStyle = 'hidden';
  6928. }
  6929. else if(event_ur === true)
  6930. {
  6931. if(filterEvent === true) mcStyle = 'hidden';
  6932. }
  6933. else if(note_ur === true)
  6934. {
  6935. if(filterNote === true) mcStyle = 'hidden';
  6936. }
  6937. else if(wslm_ur === true)
  6938. {
  6939. if(filterWSLM === true) mcStyle = 'hidden';
  6940. }
  6941. else if(bog_ur === true)
  6942. {
  6943. if(filterBOG === true) mcStyle = 'hidden';
  6944. }
  6945. else if(difficult_ur === true)
  6946. {
  6947. if(filterDifficult === true) mcStyle = 'hidden';
  6948. }
  6949.  
  6950. if(invertFilters === true)
  6951. {
  6952. if(mcStyle == 'hidden') mcStyle = 'visible';
  6953. else mcStyle = 'hidden';
  6954. }
  6955. }
  6956. }
  6957.  
  6958. let geoID = uroMCLayer.features[mcIdx].geometry.id;
  6959. if(document.getElementById(geoID) !== null)
  6960. {
  6961. document.getElementById(geoID).style.visibility = mcStyle;
  6962. }
  6963. }
  6964. }
  6965. }
  6966. uroDBG.PerfMon(pmFunction, pmTStart);
  6967. }
  6968. function uroFilterURs_onObjectsChanged()
  6969. {
  6970. if(uroFilterPreamble())
  6971. {
  6972. if(uroURDialogIsOpen === true)
  6973. {
  6974. uroFilterURs();
  6975. }
  6976. }
  6977. }
  6978. function uroFilterURs_onObjectsAdded()
  6979. {
  6980. if(uroFilterPreamble())
  6981. {
  6982. }
  6983. }
  6984. function uroFilterURs_onObjectsRemoved()
  6985. {
  6986. if(uroFilterPreamble())
  6987. {
  6988. }
  6989. }
  6990. function uroGetManagedAreas()
  6991. {
  6992. uroManagedAreas = [];
  6993. uroIgnoreAreasUserID = null;
  6994.  
  6995. for(let maObj in W.model.managedAreas.objects)
  6996. {
  6997. if(W.model.managedAreas.objects.hasOwnProperty(maObj))
  6998. {
  6999. uroManagedAreas.push(W.model.managedAreas.objects[maObj]);
  7000. }
  7001. }
  7002. return uroManagedAreas.length;
  7003. }
  7004. function uroCheckGeometryWithinManagedAreas(geo)
  7005. {
  7006. let retval = false;
  7007. let ignoreUserMA = false;
  7008.  
  7009. // If we're ignoring the user's managed area, then we first check to see if
  7010. // the geopoint lies within that - if so then we can skip checking all the
  7011. // other areas in the list...
  7012. if(uroIgnoreAreasUserID !== null)
  7013. {
  7014. for(let uma = 0; uma < uroManagedAreas.length; ++uma)
  7015. {
  7016. if(uroIgnoreAreasUserID == uroManagedAreas[uma].attributes.userID)
  7017. {
  7018. ignoreUserMA = uroContainsPoint(uroManagedAreas[uma].attributes.geoJSONGeometry.coordinates[0], geo);
  7019. break;
  7020. }
  7021. }
  7022. }
  7023.  
  7024. // Point either isn't within the user's area, or we're not ignoring it, so
  7025. // check the rest of the areas in the list
  7026. if(ignoreUserMA == false)
  7027. {
  7028. for(let ma = 0; ma < uroManagedAreas.length; ++ma)
  7029. {
  7030. if(uroIgnoreAreasUserID != uroManagedAreas[ma].attributes.userID)
  7031. {
  7032. retval = uroContainsPoint(uroManagedAreas[ma].attributes.geoJSONGeometry.coordinates[0], geo);
  7033. break;
  7034. }
  7035. }
  7036. }
  7037.  
  7038. return retval;
  7039. }
  7040. function uroGetURDriveGeoms()
  7041. {
  7042. let retval = [];
  7043.  
  7044. for (let urobj in W.model.mapUpdateRequests.objects)
  7045. {
  7046. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urobj))
  7047. {
  7048. let ureq = W.model.mapUpdateRequests.objects[urobj];
  7049. let ureqID = ureq.attributes.id;
  7050.  
  7051. let hasGeo = false;
  7052. let thisRet = [];
  7053. thisRet.push(ureqID);
  7054. thisRet.push(null);
  7055. thisRet.push([]);
  7056.  
  7057. let latMin = 9999;
  7058. let latMax = -9999;
  7059. let lonMin = 9999;
  7060. let lonMax = -9999;
  7061.  
  7062. let urs = W.model.updateRequestSessions.objects[ureqID];
  7063. if((urs !== undefined) && (urs.attributes.driveGeometry !== undefined))
  7064. {
  7065. let cPairs = [];
  7066. for(let i = 0; i < urs.attributes.driveGeometry.coordinates.length; ++i)
  7067. {
  7068. for(let j = 0; j < urs.attributes.driveGeometry.coordinates[i].length; ++j)
  7069. {
  7070. if((i === 0) || (j > 0))
  7071. {
  7072. let coords = urs.attributes.driveGeometry.coordinates[i][j];
  7073. cPairs.push(coords);
  7074.  
  7075. if(coords[0] > lonMax)
  7076. {
  7077. lonMax = coords[0];
  7078. }
  7079. if(coords[0] < lonMin)
  7080. {
  7081. lonMin = coords[0];
  7082. }
  7083. if(coords[1] > latMax)
  7084. {
  7085. latMax = coords[1];
  7086. }
  7087. if(coords[1] < latMin)
  7088. {
  7089. latMin = coords[1];
  7090. }
  7091.  
  7092. hasGeo = true;
  7093. }
  7094. }
  7095. }
  7096. let bbox = [];
  7097. bbox.push(lonMin);
  7098. bbox.push(lonMax);
  7099. bbox.push(latMin);
  7100. bbox.push(latMax);
  7101. thisRet.push(bbox);
  7102. thisRet.push(cPairs);
  7103. }
  7104.  
  7105. if(hasGeo === true)
  7106. {
  7107. retval.push(thisRet);
  7108. }
  7109. }
  7110. }
  7111. return retval;
  7112. }
  7113. function uroCompareDriveGeos(geoA, geoB)
  7114. {
  7115. const matchLength = 5;
  7116. let retval = false;
  7117.  
  7118. if((geoA.length >= matchLength) && (geoB.length >= matchLength))
  7119. {
  7120. for(let i = 0; i < (geoA.length - matchLength); ++i)
  7121. {
  7122. for(let j = 0; j < (geoB.length - matchLength); ++j)
  7123. {
  7124. if((geoA[i][0] == geoB[j][0]) && (geoA[i][1] == geoB[j][1]))
  7125. {
  7126. retval = true;
  7127. for(let k = 1; k < matchLength; ++k)
  7128. {
  7129. if((geoA[i+k][0] != geoB[j+k][0]) || (geoA[i+k][1] != geoB[j+k][1]))
  7130. {
  7131. retval = false;
  7132. break;
  7133. }
  7134. }
  7135. }
  7136. if(retval === true)
  7137. {
  7138. break;
  7139. }
  7140. }
  7141.  
  7142. if(retval === true)
  7143. {
  7144. break;
  7145. }
  7146. }
  7147. }
  7148. return retval;
  7149. }
  7150. function uroCompareDriveBBoxes(bbA, bbB)
  7151. {
  7152. let retval = true;
  7153.  
  7154. if
  7155. (
  7156. (bbA[0] > bbB[1]) ||
  7157. (bbA[1] < bbB[0]) ||
  7158. (bbA[2] > bbB[3]) ||
  7159. (bbA[3] < bbB[2])
  7160. )
  7161. {
  7162. retval = false;
  7163. }
  7164.  
  7165. return retval;
  7166. }
  7167. function uroGetURDupes()
  7168. {
  7169. uroURDupes = [];
  7170.  
  7171. // To determine which URs are duplicates of one another (i.e. have been raised by the same user
  7172. // during the same section of a journey), we first compare the geometries of the drive tracks
  7173. // attached to any URs which have them - as this is based on the users GPS position rather than
  7174. // the WME map data, it makes it vanishingly unlikely that any two users would have identical
  7175. // GPS positions (especially given the level of accuracy to which the track points are stored)
  7176. // even if they were driving exactly the same route at the same speed, in the same lane etc.
  7177. //
  7178. // To accelerate this geometry comparison, we start by performing a simple bounding box overlap
  7179. // check for the two geometries under consideration - if there's no overlap then there can't be
  7180. // any geometry match, so no need to continue onto the more detailed comparision of the GPS
  7181. // tracks themselves...
  7182. let driveGeos = uroGetURDriveGeoms();
  7183. if(driveGeos.length > 1)
  7184. {
  7185. for(let i = 0; i < (driveGeos.length - 1); ++i)
  7186. {
  7187. if(driveGeos[i].length !== 5)
  7188. {
  7189. driveGeos[i][1] = false;
  7190. }
  7191. else
  7192. {
  7193. for(let j = (i + 1); j < driveGeos.length; ++j)
  7194. {
  7195. if(driveGeos[j].length === 5)
  7196. {
  7197. let geoMatch = uroCompareDriveBBoxes(driveGeos[i][3], driveGeos[j][3]);
  7198. if(geoMatch === true)
  7199. {
  7200. geoMatch = uroCompareDriveGeos(driveGeos[i][4], driveGeos[j][4]);
  7201. if(geoMatch === true)
  7202. {
  7203. driveGeos[i][2].push(driveGeos[j][0]);
  7204. driveGeos[j][2].push(driveGeos[i][0]);
  7205. }
  7206. }
  7207. }
  7208. }
  7209. }
  7210. }
  7211.  
  7212. for(let i = 0; i < driveGeos.length; ++i)
  7213. {
  7214. if(driveGeos[i][2].length > 0)
  7215. {
  7216. let res = [];
  7217. res.push(driveGeos[i][0]);
  7218. res.push(driveGeos[i][2]);
  7219. uroURDupes.push(res);
  7220. }
  7221. }
  7222. }
  7223.  
  7224. // Once we've done the initial drive track comparision, uroURDupes will contain a list of
  7225. // all the URs which were matched up based on that. However, as the track comparision is
  7226. // inherently limited by the amount of track data included with each UR, this initial
  7227. // comparison may mean some more widely spaced URs aren't flagged as duplicates simply
  7228. // because there's insufficient overlap between their tracks, even though there may have
  7229. // been further URs dropped inbetween to which they were matched.
  7230. //
  7231. // e.g. if a user drops 4 URs along a section of their journey, spaced such that each of
  7232. // the GPS tracks generates a comparison match with the UR either side of it, but no
  7233. // further than that, we would get:
  7234. //
  7235. // UR A......UR B.......UR C......UR D
  7236. //
  7237. // Matches: A to B, B to A & C, C to B & D, D to C
  7238. //
  7239. // Note how, although we know all of these URs are in fact duplicates, and can infer this
  7240. // from seeing that e.g. A is flagged only as a duplicate of B, however as B is flagged as
  7241. // a duplicate of A & C, and C is flagged as a duplicate of B & D, A MUST therefore be a
  7242. // duplicate of B, C & D...
  7243. //
  7244. // To fix this, we now run a merging pass over each of the entries in uroURDupes - for
  7245. // each entry we see if its ID appears in any of the other entries as a duplicate, and
  7246. // if so we merge the duplicates for both entries.
  7247.  
  7248. for(let i = 0; i < uroURDupes.length; ++i)
  7249. {
  7250. let urID = uroURDupes[i][0];
  7251. for(let j = 0; j < uroURDupes.length; ++j)
  7252. {
  7253. if(i != j)
  7254. {
  7255. if(uroURDupes[j][1].includes(urID) === true)
  7256. {
  7257. // https://stackoverflow.com/questions/1584370/how-to-merge-two-arrays-in-javascript-and-de-duplicate-items
  7258. let mergedDupes = [...new Set([...uroURDupes[i][1], ...uroURDupes[j][1]])];
  7259. uroURDupes[i][1] = mergedDupes;
  7260. uroURDupes[j][1] = mergedDupes;
  7261. }
  7262. }
  7263. }
  7264. }
  7265. }
  7266. function uroFilterURs()
  7267. {
  7268. let pmTStart = performance.now();
  7269. let pmFunction = "uroFilterURs";
  7270.  
  7271. if(uroUserID === -1)
  7272. {
  7273. return;
  7274. }
  7275.  
  7276. if(uroInhibitURFiltering === true)
  7277. {
  7278. return;
  7279. }
  7280.  
  7281.  
  7282. // compatibility fix for URComments - based on code supplied by RickZabel
  7283. let hasActiveURFilters = false;
  7284. if(uroIsFilteringEnabled(false) === true)
  7285. {
  7286. let urTabInputs = uroTabs.CtrlTabs[uroTabs.IDS.URS][uroTabs.FIELDS.TABBODY].getElementsByTagName('input');
  7287. for(let loop = 0; loop < urTabInputs.length; loop++)
  7288. {
  7289. if(urTabInputs[loop].type == 'checkbox')
  7290. {
  7291. let ignoreCB = false;
  7292. ignoreCB = ignoreCB || (urTabInputs[loop].id == '_cbCaseInsensitive');
  7293. ignoreCB = ignoreCB || (urTabInputs[loop].id == '_cbNoFilterForTaggedURs');
  7294. if((urTabInputs[loop].checked) && (ignoreCB === false))
  7295. {
  7296. hasActiveURFilters = true;
  7297. break;
  7298. }
  7299. }
  7300. }
  7301. }
  7302. sessionStorage.UROverview_hasActiveURFilters = hasActiveURFilters;
  7303. if(uroFilterPreamble() === false) return;
  7304. uroRefreshUpdateRequestSessions();
  7305. let selectorResolver = document.getElementById('_selectURResolverID');
  7306. let selectorCommentUser = document.getElementById('_selectURUserID');
  7307. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === false)
  7308. {
  7309. while(selectorResolver.options.length > 0)
  7310. {
  7311. selectorResolver.options.remove(0);
  7312. }
  7313. }
  7314. if(uroUtils.GetCBChecked('_cbURUserIDFilter') === false)
  7315. {
  7316. while(selectorCommentUser.options.length > 0)
  7317. {
  7318. selectorCommentUser.options.remove(0);
  7319. }
  7320. }
  7321. if(Object.keys(W.model.updateRequestSessions.objects).length === 0)
  7322. {
  7323. // This may be the case if the user has disabled the UR layer, so call
  7324. // AddCommentCounts to clear any existing ones from the map view...
  7325. uroURExtras.AddCommentCounts();
  7326. return;
  7327. }
  7328. let commenterUser = null;
  7329. if(uroUtils.GetCBChecked('_cbURUserIDFilter') === true)
  7330. {
  7331. if(selectorCommentUser.options.length === 0)
  7332. {
  7333. uroUpdateEditorList(W.model.updateRequestSessions.objects, '_selectURUserID', false, false, false, true);
  7334. }
  7335. if(selectorCommentUser.selectedOptions[0] != null)
  7336. {
  7337. commenterUser = parseInt(selectorCommentUser.selectedOptions[0].value);
  7338. }
  7339. }
  7340. let resolverUser = null;
  7341. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === true)
  7342. {
  7343. if(selectorResolver.options.length === 0)
  7344. {
  7345. uroUpdateEditorList(W.model.mapUpdateRequests.objects, '_selectURResolverID', false, false, true, false);
  7346. }
  7347. if(selectorResolver.selectedOptions[0] != null)
  7348. {
  7349. resolverUser = parseInt(selectorResolver.selectedOptions[0].value);
  7350. }
  7351. }
  7352. uroURExtras.urList = [];
  7353. uroGetURDupes();
  7354.  
  7355. let uFURs_masterEnable = uroIsFilteringEnabled(false);
  7356. let filterOutsideEditableArea = uroUtils.GetCBChecked('_cbURFilterOutsideArea');
  7357. let filterInsideManagedAreas = uroUtils.GetCBChecked('_cbURFilterInsideManagedAreas');
  7358. let filterSolved = uroUtils.GetCBChecked('_cbFilterSolved');
  7359. let filterUnidentified = uroUtils.GetCBChecked('_cbFilterUnidentified');
  7360. let filterClosed = uroUtils.GetCBChecked('_cbFilterClosedUR');
  7361. let filterOpen = uroUtils.GetCBChecked('_cbFilterOpenUR');
  7362. let filterDescMustBePresent = uroUtils.GetCBChecked('_cbURDescriptionMustBePresent');
  7363. let filterDescMustBeAbsent = uroUtils.GetCBChecked('_cbURDescriptionMustBeAbsent');
  7364. let filterKeywordMustBePresent = uroUtils.GetCBChecked('_cbEnableKeywordMustBePresent');
  7365. let filterKeywordMustBeAbsent = uroUtils.GetCBChecked('_cbEnableKeywordMustBeAbsent');
  7366. let filterMinURAge = uroUtils.GetCBChecked('_cbEnableMinAgeFilter');
  7367. let filterMaxURAge = uroUtils.GetCBChecked('_cbEnableMaxAgeFilter');
  7368. let filterMinComments = uroUtils.GetCBChecked('_cbEnableMinCommentsFilter');
  7369. let filterMaxComments = uroUtils.GetCBChecked('_cbEnableMaxCommentsFilter');
  7370. let filterReporterLastCommenter = uroUtils.GetCBChecked('_cbHideIfReporterLastCommenter');
  7371. let filterReporterNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfReporterNotLastCommenter');
  7372. let filterHideAnyComments = uroUtils.GetCBChecked('_cbHideAnyComments');
  7373. let filterHideNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfNotLastCommenter');
  7374. let filterHideMyComments = uroUtils.GetCBChecked('_cbHideMyComments');
  7375. let filterIfLastCommenter = uroUtils.GetCBChecked('_cbHideIfLastCommenter');
  7376. let filterIfNotLastCommenter = uroUtils.GetCBChecked('_cbHideIfNotLastCommenter');
  7377. let filterCommentMinAge = uroUtils.GetCBChecked('_cbEnableCommentAgeFilter2');
  7378. let filterCommentMaxAge = uroUtils.GetCBChecked('_cbEnableCommentAgeFilter');
  7379. let filterUserID = uroUtils.GetCBChecked('_cbURUserIDFilter');
  7380. let filterMyFollowed = uroUtils.GetCBChecked('_cbHideMyFollowed');
  7381. let filterMyUnfollowed = uroUtils.GetCBChecked('_cbHideMyUnfollowed');
  7382.  
  7383. let filterWazeAuto = uroUtils.GetCBChecked('_cbFilterWazeAuto');
  7384. let filterRoadworks = uroUtils.GetCBChecked('_cbFilterRoadworks');
  7385. let filterConstruction = uroUtils.GetCBChecked('_cbFilterConstruction');
  7386. let filterClosure = uroUtils.GetCBChecked('_cbFilterClosure');
  7387. let filterEvent = uroUtils.GetCBChecked('_cbFilterEvent');
  7388. let filterNote = uroUtils.GetCBChecked('_cbFilterNote');
  7389. let filterWSLM = uroUtils.GetCBChecked('_cbFilterWSLM');
  7390. let filterBOG = uroUtils.GetCBChecked('_cbFilterBOG');
  7391. let filterDifficult = uroUtils.GetCBChecked('_cbFilterDifficult');
  7392.  
  7393. let filterIncorrectTurn = uroUtils.GetCBChecked('_cbFilterIncorrectTurn');
  7394. let filterIncorrectAddress = uroUtils.GetCBChecked('_cbFilterIncorrectAddress');
  7395. let filterIncorrectRoute = uroUtils.GetCBChecked('_cbFilterIncorrectRoute');
  7396. let filterMissingRoundabout = uroUtils.GetCBChecked('_cbFilterMissingRoundabout');
  7397. let filterGeneralError = uroUtils.GetCBChecked('_cbFilterGeneralError');
  7398. let filterTurnNotAllowed = uroUtils.GetCBChecked('_cbFilterTurnNotAllowed');
  7399. let filterIncorrectJunction = uroUtils.GetCBChecked('_cbFilterIncorrectJunction');
  7400. let filterMissingBridgeOverpass = uroUtils.GetCBChecked('_cbFilterMissingBridgeOverpass');
  7401. let filterWrongDrivingDirection = uroUtils.GetCBChecked('_cbFilterWrongDrivingDirection');
  7402. let filterMissingExit = uroUtils.GetCBChecked('_cbFilterMissingExit');
  7403. let filterMissingRoad = uroUtils.GetCBChecked('_cbFilterMissingRoad');
  7404. let filterMissingLandmark = uroUtils.GetCBChecked('_cbFilterMissingLandmark');
  7405. let filterNativeSpeedLimit = uroUtils.GetCBChecked('_cbFilterSpeedLimits');
  7406. let filterBlockedRoad = uroUtils.GetCBChecked('_cbFilterBlockedRoad');
  7407. let filterUndefined = uroUtils.GetCBChecked('_cbFilterUndefined');
  7408.  
  7409. let invertURFilters = uroUtils.GetCBChecked('_cbInvertURFilter');
  7410. let invertURStateFilters = uroUtils.GetCBChecked('_cbInvertURStateFilter');
  7411. let noFilterTaggedURs = uroUtils.GetCBChecked('_cbNoFilterForTaggedURs');
  7412. let noFilterURInURL = uroUtils.GetCBChecked('_cbNoFilterForURInURL');
  7413. let showOnlyDupes = uroUtils.GetCBChecked('_cbURFilterDupes');
  7414.  
  7415. let keywordPresent = uroUtils.GetElmValue('_textKeywordPresent');
  7416. let keywordAbsent = uroUtils.GetElmValue('_textKeywordAbsent');
  7417. let caseInsensitive = uroUtils.GetCBChecked('_cbCaseInsensitive');
  7418. let thresholdMinAge = uroUtils.GetElmValue('_inputFilterMinDays');
  7419. let thresholdMaxAge = uroUtils.GetElmValue('_inputFilterMaxDays');
  7420. let thresholdMinComments = uroUtils.GetElmValue('_inputFilterMinComments');
  7421. let thresholdMaxComments = uroUtils.GetElmValue('_inputFilterMaxComments');
  7422. let thresholdMaxCommentAge = uroUtils.GetElmValue('_inputFilterCommentDays');
  7423. let thresholdMinCommentAge = uroUtils.GetElmValue('_inputFilterCommentDays2');
  7424. let ignoreOtherEditorComments = uroUtils.GetCBChecked('_cbIgnoreOtherEditorComments');
  7425. let urcFilteringIsActive = false;
  7426. let urcCB = document.getElementById('URCommentsFilterEnabled');
  7427. if(urcCB !== null)
  7428. {
  7429. if(urcCB.checked)
  7430. {
  7431. urcFilteringIsActive = true;
  7432. }
  7433. }
  7434. urcCB = document.getElementById('URCommentUROOnlyMyUR');
  7435. if(urcCB !== null)
  7436. {
  7437. if(urcCB.checked)
  7438. {
  7439. urcFilteringIsActive = true;
  7440. }
  7441. }
  7442. urcCB = document.getElementById('URCommentUROHideTagged');
  7443. if(urcCB !== null)
  7444. {
  7445. if(urcCB.checked)
  7446. {
  7447. urcFilteringIsActive = true;
  7448. }
  7449. }
  7450.  
  7451. filterInsideManagedAreas = filterInsideManagedAreas && (uroGetManagedAreas() !== 0);
  7452. if(uroUtils.GetCBChecked('_cbURExcludeUserArea') == true)
  7453. {
  7454. uroIgnoreAreasUserID = W.loginManager.user.attributes.id;
  7455. }
  7456.  
  7457. for (let urobj in W.model.mapUpdateRequests.objects)
  7458. {
  7459. if(W.model.mapUpdateRequests.objects.hasOwnProperty(urobj))
  7460. {
  7461. let ureq = W.model.mapUpdateRequests.objects[urobj];
  7462. let ureqID = ureq.attributes.id;
  7463.  
  7464. let urStyle = 'visible';
  7465. let inhibitFiltering = ((ureqID == uroSelectedURID) && (noFilterURInURL));
  7466.  
  7467. let hasMyComments = false;
  7468. let nComments = 0;
  7469. let desc = ureq.attributes.description;
  7470. let customType = uroGetCustomType(ureqID, uroLayers.ID.UR, desc);
  7471. let ageLastComment = null;
  7472. if(W.model.updateRequestSessions.objects[ureqID] != null)
  7473. {
  7474. nComments = W.model.updateRequestSessions.objects[ureqID].attributes.comments.length;
  7475. if(nComments != 0)
  7476. {
  7477. ageLastComment = uroUtils.GetCommentAge(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1]);
  7478. }
  7479. if((uFURs_masterEnable === false) && (nComments === 0))
  7480. {
  7481. // when master enable is turned off, we want to make sure that all URs, including ones that were previously hidden, are correctly
  7482. // displayed in their native form - i.e. no comment count or custom conversation bubbles. The easiest way to achieve this is to
  7483. // force the AddCommentCounts code to test for the presence of these bubbles on each UR, which we do by setting a non-zero
  7484. // comment count for each UR... For URs which genuinely do have no comments we use -1 to indicate that we're not really setting
  7485. // a comment count, but that we still need to do something that wouldn't be achieved by using 0.
  7486. nComments = -1;
  7487. }
  7488. }
  7489.  
  7490. // check UR against current session ignore list...
  7491. if(uroIgnore.IsOnList(ureqID)) urStyle = 'hidden';
  7492.  
  7493. if((uFURs_masterEnable === true) && (inhibitFiltering === false))
  7494. {
  7495. let wazeauto_ur = false;
  7496. let ukroadworks_ur = false;
  7497. let construction_ur = false;
  7498. let closure_ur = false;
  7499. let event_ur = false;
  7500. let note_ur = false;
  7501. let wslm_ur = false;
  7502. let bog_ur = false;
  7503. let difficult_ur = false;
  7504.  
  7505. let filterByNotIncludedKeyword = false;
  7506. let filterByIncludedKeyword = true;
  7507.  
  7508. if(desc !== null) desc = desc.replace(/<\/?[^>]+(>|$)/g, "");
  7509. else desc = '';
  7510.  
  7511. if(customType === 0) ukroadworks_ur = true;
  7512. else if(customType === 1) construction_ur = true;
  7513. else if(customType === 2) closure_ur = true;
  7514. else if(customType === 3) event_ur = true;
  7515. else if(customType === 4) note_ur = true;
  7516. else if(customType === 5) wslm_ur = true;
  7517. else if(customType === 6) bog_ur = true;
  7518. else if(customType === 7) difficult_ur = true;
  7519.  
  7520. // check UR against editable area...
  7521.  
  7522. if(filterOutsideEditableArea === true)
  7523. {
  7524. if(ureq.canEdit() === false) urStyle = 'hidden';
  7525. }
  7526.  
  7527. if(filterInsideManagedAreas === true)
  7528. {
  7529. if(uroCheckGeometryWithinManagedAreas(ureq.attributes.geoJSONGeometry.coordinates) === true) urStyle = 'hidden';
  7530. }
  7531.  
  7532. if(showOnlyDupes === true)
  7533. {
  7534. let isDupe = false;
  7535. for(let i = 0; i < uroURDupes.length; ++i)
  7536. {
  7537. if(uroURDupes[i][0] === ureqID)
  7538. {
  7539. isDupe = true;
  7540. break;
  7541. }
  7542. }
  7543. if(isDupe === false) urStyle = 'hidden';
  7544. }
  7545.  
  7546. // state-age filtering
  7547. if(urStyle == 'visible')
  7548. {
  7549. // check against closed/not identified filtering if enabled...
  7550. if(filterSolved === true)
  7551. {
  7552. if(ureq.attributes.resolution === 0) urStyle = 'hidden';
  7553. }
  7554. if(filterUnidentified === true)
  7555. {
  7556. if(ureq.attributes.resolution == 1) urStyle = 'hidden';
  7557. }
  7558.  
  7559. if((ureq.attributes.resolvedOn !== null) && (filterClosed === true))
  7560. {
  7561. urStyle = 'hidden';
  7562. }
  7563.  
  7564. if((ureq.attributes.resolvedOn === null) && (filterOpen === true))
  7565. {
  7566. urStyle = 'hidden';
  7567. }
  7568.  
  7569. if(urStyle == 'visible')
  7570. {
  7571. // check UR against keyword filtering if enabled...
  7572. if(filterDescMustBePresent === true)
  7573. {
  7574. if(desc === '') urStyle = 'hidden';
  7575. }
  7576. if(filterDescMustBeAbsent === true)
  7577. {
  7578. if(desc !== '') urStyle = 'hidden';
  7579. }
  7580.  
  7581. if(filterKeywordMustBePresent === true)
  7582. {
  7583. let keywordIsPresentInDesc = uroUtils.KeywordPresent(desc,keywordPresent,caseInsensitive);
  7584. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInDesc));
  7585. }
  7586. if(filterKeywordMustBeAbsent === true)
  7587. {
  7588. let keywordIsAbsentInDesc = uroUtils.KeywordPresent(desc,keywordAbsent,caseInsensitive);
  7589. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInDesc);
  7590. }
  7591. }
  7592.  
  7593. if(urStyle == 'visible')
  7594. {
  7595. // do age-based filtering if enabled
  7596. if(filterMinURAge === true)
  7597. {
  7598. if(uroUtils.GetURAge(ureq,0,false) < thresholdMinAge) urStyle = 'hidden';
  7599. }
  7600. if(filterMaxURAge === true)
  7601. {
  7602. if(uroUtils.GetURAge(ureq,0,false) > thresholdMaxAge) urStyle = 'hidden';
  7603. }
  7604. }
  7605.  
  7606. if(urStyle == 'visible')
  7607. {
  7608. if(resolverUser !== null)
  7609. {
  7610. if(ureq.attributes.resolvedBy != resolverUser) urStyle = 'hidden';
  7611. }
  7612. }
  7613.  
  7614. if(urStyle == 'visible')
  7615. {
  7616. // do comments/following filtering
  7617. if(W.model.updateRequestSessions.objects[ureqID] != null)
  7618. {
  7619. nComments = W.model.updateRequestSessions.objects[ureqID].attributes.comments.length;
  7620. let commentDaysOld = -1;
  7621.  
  7622.  
  7623. if(filterMinComments === true)
  7624. {
  7625. if(nComments < thresholdMinComments) urStyle = 'hidden';
  7626. }
  7627. if(filterMaxComments === true)
  7628. {
  7629. if(nComments > thresholdMaxComments) urStyle = 'hidden';
  7630. }
  7631.  
  7632.  
  7633. if(nComments > 0)
  7634. {
  7635. let reporterIsLastCommenter = false;
  7636. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1].userID == -1) reporterIsLastCommenter = true;
  7637.  
  7638. if(filterReporterLastCommenter === true)
  7639. {
  7640. if(reporterIsLastCommenter === true) urStyle = 'hidden';
  7641. }
  7642. else if(filterReporterNotLastCommenter === true)
  7643. {
  7644. if(reporterIsLastCommenter === false) urStyle = 'hidden';
  7645. }
  7646.  
  7647. hasMyComments = uroURHasMyComments(ureqID);
  7648. if(hasMyComments === false)
  7649. {
  7650. if(filterHideAnyComments === true) urStyle = 'hidden';
  7651. if(filterHideNotLastCommenter === true) urStyle = 'hidden';
  7652. }
  7653. else
  7654. {
  7655. if(filterHideMyComments === true) urStyle = 'hidden';
  7656.  
  7657. let userIsLastCommenter = false;
  7658. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[nComments-1].userID == uroUserID) userIsLastCommenter = true;
  7659.  
  7660. if(filterIfLastCommenter === true)
  7661. {
  7662. if(userIsLastCommenter === true) urStyle = 'hidden';
  7663. }
  7664. else if(filterIfNotLastCommenter === true)
  7665. {
  7666. if(userIsLastCommenter === false) urStyle = 'hidden';
  7667. }
  7668. }
  7669.  
  7670. let cidx;
  7671. if(ignoreOtherEditorComments === false)
  7672. {
  7673. commentDaysOld = ageLastComment;
  7674. }
  7675. else
  7676. {
  7677. for(cidx=0; cidx<nComments; cidx++)
  7678. {
  7679. let cObj = W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx];
  7680. if((cObj.userID == uroUserID) || (cObj.userID == -1))
  7681. {
  7682. commentDaysOld = uroUtils.GetCommentAge(cObj);
  7683. }
  7684. }
  7685. }
  7686. if((filterCommentMinAge === true) && (commentDaysOld != -1))
  7687. {
  7688. if(thresholdMinCommentAge > commentDaysOld) urStyle = 'hidden';
  7689. }
  7690. if((filterCommentMaxAge === true) && (commentDaysOld != -1))
  7691. {
  7692. if(thresholdMaxCommentAge < commentDaysOld) urStyle = 'hidden';
  7693. }
  7694.  
  7695. if((commenterUser !== null) && (urStyle != 'hidden'))
  7696. {
  7697. urStyle = 'hidden';
  7698. for(cidx=0; cidx<nComments; cidx++)
  7699. {
  7700. if(W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx].userID == commenterUser)
  7701. {
  7702. urStyle = 'visible';
  7703. break;
  7704. }
  7705. }
  7706. }
  7707.  
  7708. let commentText = '';
  7709. for(cidx=0; cidx<nComments; cidx++)
  7710. {
  7711. commentText += W.model.updateRequestSessions.objects[ureqID].attributes.comments[cidx].text;
  7712. }
  7713.  
  7714. if(filterKeywordMustBePresent === true)
  7715. {
  7716. let keywordIsPresentInComments = uroUtils.KeywordPresent(commentText,keywordPresent,caseInsensitive);
  7717. filterByIncludedKeyword = (filterByIncludedKeyword && (!keywordIsPresentInComments));
  7718. }
  7719. if(filterKeywordMustBeAbsent === true)
  7720. {
  7721. let keywordIsAbsentInComments = uroUtils.KeywordPresent(commentText,keywordAbsent,caseInsensitive);
  7722. filterByNotIncludedKeyword = (filterByNotIncludedKeyword || keywordIsAbsentInComments);
  7723. }
  7724. }
  7725. else
  7726. {
  7727. if(filterUserID === true)
  7728. {
  7729. urStyle = 'hidden';
  7730. }
  7731. }
  7732.  
  7733. filterByNotIncludedKeyword = (filterByNotIncludedKeyword && filterKeywordMustBeAbsent);
  7734. filterByIncludedKeyword = (filterByIncludedKeyword && filterKeywordMustBePresent);
  7735. if(filterByNotIncludedKeyword || filterByIncludedKeyword)
  7736. {
  7737. urStyle = 'hidden';
  7738. }
  7739.  
  7740. if(W.model.updateRequestSessions.objects[ureqID].attributes.isFollowing === true)
  7741. {
  7742. if(filterMyFollowed === true) urStyle = 'hidden';
  7743. }
  7744. else
  7745. {
  7746. if(filterMyUnfollowed === true) urStyle = 'hidden';
  7747. }
  7748. }
  7749. }
  7750.  
  7751. if(invertURStateFilters === true)
  7752. {
  7753. if(urStyle == 'hidden') urStyle = 'visible';
  7754. else urStyle = 'hidden';
  7755. }
  7756. }
  7757.  
  7758. // type filtering
  7759. if(urStyle == 'visible')
  7760. {
  7761. // Test for Waze automatic URs before any others - these always (?) get inserted as General Error URs,
  7762. // so we can't filter them by type...
  7763. if(desc.indexOf('Waze Automatic:') != -1)
  7764. {
  7765. wazeauto_ur = true;
  7766. }
  7767.  
  7768. if(wazeauto_ur === true)
  7769. {
  7770. if(filterWazeAuto === true) urStyle = 'hidden';
  7771. }
  7772.  
  7773. else if(ukroadworks_ur === true)
  7774. {
  7775. if(filterRoadworks === true) urStyle = 'hidden';
  7776. }
  7777. else if(construction_ur === true)
  7778. {
  7779. if(filterConstruction === true) urStyle = 'hidden';
  7780. }
  7781. else if(closure_ur === true)
  7782. {
  7783. if(filterClosure === true) urStyle = 'hidden';
  7784. }
  7785. else if(event_ur === true)
  7786. {
  7787. if(filterEvent === true) urStyle = 'hidden';
  7788. }
  7789. else if(note_ur === true)
  7790. {
  7791. if(filterNote === true) urStyle = 'hidden';
  7792. }
  7793. else if(wslm_ur === true)
  7794. {
  7795. if(filterWSLM === true) urStyle = 'hidden';
  7796. }
  7797. else if(bog_ur === true)
  7798. {
  7799. if(filterBOG === true) urStyle = 'hidden';
  7800. }
  7801. else if(difficult_ur === true)
  7802. {
  7803. if(filterDifficult === true) urStyle = 'hidden';
  7804. }
  7805.  
  7806. else if(ureq.attributes.type == 6)
  7807. {
  7808. if(filterIncorrectTurn === true) urStyle = 'hidden';
  7809. }
  7810. else if(ureq.attributes.type == 7)
  7811. {
  7812. if (filterIncorrectAddress === true) urStyle = 'hidden';
  7813. }
  7814. else if(ureq.attributes.type == 8)
  7815. {
  7816. if(filterIncorrectRoute === true) urStyle = 'hidden';
  7817. }
  7818. else if(ureq.attributes.type == 9)
  7819. {
  7820. if(filterMissingRoundabout === true) urStyle = 'hidden';
  7821. }
  7822. else if(ureq.attributes.type == 10)
  7823. {
  7824. if(filterGeneralError === true) urStyle = 'hidden';
  7825. }
  7826. else if(ureq.attributes.type == 11)
  7827. {
  7828. if(filterTurnNotAllowed === true) urStyle = 'hidden';
  7829. }
  7830. else if(ureq.attributes.type == 12)
  7831. {
  7832. if(filterIncorrectJunction === true) urStyle = 'hidden';
  7833. }
  7834. else if(ureq.attributes.type == 13)
  7835. {
  7836. if(filterMissingBridgeOverpass === true) urStyle = 'hidden';
  7837. }
  7838. else if(ureq.attributes.type == 14)
  7839. {
  7840. if(filterWrongDrivingDirection === true) urStyle = 'hidden';
  7841. }
  7842. else if(ureq.attributes.type == 15)
  7843. {
  7844. if(filterMissingExit === true) urStyle = 'hidden';
  7845. }
  7846. else if(ureq.attributes.type == 16)
  7847. {
  7848. if(filterMissingRoad === true) urStyle = 'hidden';
  7849. }
  7850. else if(ureq.attributes.type == 18)
  7851. {
  7852. if(filterMissingLandmark === true) urStyle = 'hidden';
  7853. }
  7854. else if(ureq.attributes.type == 19)
  7855. {
  7856. if(filterBlockedRoad === true) urStyle = 'hidden';
  7857. }
  7858. else if(ureq.attributes.type == 23)
  7859. {
  7860. if(filterNativeSpeedLimit === true) urStyle = 'hidden';
  7861. }
  7862. else if(filterUndefined === true) urStyle = 'hidden';
  7863.  
  7864. if(invertURFilters === true)
  7865. {
  7866. if(urStyle == 'hidden') urStyle = 'visible';
  7867. else urStyle = 'hidden';
  7868. }
  7869. }
  7870.  
  7871. // stage-age filtering override for tagged URs
  7872. if(noFilterTaggedURs === true)
  7873. {
  7874. if(ukroadworks_ur === true)
  7875. {
  7876. if(filterRoadworks === false) urStyle = 'visible';
  7877. }
  7878. else if(construction_ur === true)
  7879. {
  7880. if(filterConstruction === false) urStyle = 'visible';
  7881. }
  7882. else if(closure_ur === true)
  7883. {
  7884. if(filterClosure === false) urStyle = 'visible';
  7885. }
  7886. else if(event_ur === true)
  7887. {
  7888. if(filterEvent === false) urStyle = 'visible';
  7889. }
  7890. else if(note_ur === true)
  7891. {
  7892. if(filterNote === false) urStyle = 'visible';
  7893. }
  7894. else if(wslm_ur === true)
  7895. {
  7896. if(filterWSLM === false) urStyle = 'visible';
  7897. }
  7898. }
  7899. }
  7900. // only touch marker visibility if we've got active filter settings, or if URComments is not
  7901. // doing any filtering of its own
  7902. if((hasActiveURFilters === true) || (urcFilteringIsActive === false) || (uFURs_masterEnable === false))
  7903. {
  7904. let urMarker = uroGetMarker(uroLayers.ID.UR,urobj);
  7905. if(urMarker !== null)
  7906. {
  7907. urMarker.style.visibility = urStyle;
  7908. }
  7909. }
  7910. if(urStyle != 'hidden')
  7911. {
  7912. uroURExtras.AddToList(ureqID, customType, hasMyComments, nComments, ageLastComment);
  7913. }
  7914. }
  7915. }
  7916. uroURExtras.AddCommentCounts();
  7917. uroDBG.PerfMon(pmFunction, pmTStart);
  7918. }
  7919. function uroGetProblemTypes()
  7920. {
  7921. uroKnownProblemTypeIDs = [];
  7922. uroKnownProblemTypeNames = [];
  7923. let tProblemList = I18n.lookup("problems.types");
  7924. for(let tObj in tProblemList)
  7925. {
  7926. if(tObj !== undefined)
  7927. {
  7928. uroKnownProblemTypeIDs.push(parseInt(tObj));
  7929. uroKnownProblemTypeNames.push(tProblemList[tObj].title);
  7930. }
  7931. }
  7932. }
  7933. function uroFilterProblems()
  7934. {
  7935. let pmTStart = performance.now();
  7936. let pmFunction = "uroFilterProblems";
  7937.  
  7938. if(uroFilterPreamble() === false) return;
  7939. let selector;
  7940.  
  7941. if((uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter') === false) && (uroUtils.GetCBChecked('_cbMPClosedUserIDFilter') === false))
  7942. {
  7943. selector = document.getElementById('_selectMPUserID');
  7944. while(selector.options.length > 0)
  7945. {
  7946. selector.options.remove(0);
  7947. }
  7948. }
  7949.  
  7950. let solverUser = null;
  7951. if((uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter') === true) || (uroUtils.GetCBChecked('_cbMPClosedUserIDFilter') === true))
  7952. {
  7953. selector = document.getElementById('_selectMPUserID');
  7954. if(selector.options.length === 0)
  7955. {
  7956. uroUpdateEditorList(W.model.mapProblems.objects, '_selectMPUserID', false, false, true, false);
  7957. }
  7958. if(selector.selectedOptions[0] != null)
  7959. {
  7960. solverUser = parseInt(selector.selectedOptions[0].value);
  7961. }
  7962. }
  7963.  
  7964. let uFP_masterEnable = uroIsFilteringEnabled(false);
  7965. let filter_OutsideEditableArea = uroUtils.GetCBChecked('_cbMPFilterOutsideArea');
  7966. let filter_Solved = uroUtils.GetCBChecked('_cbMPFilterSolved');
  7967. let filter_Unidentified = uroUtils.GetCBChecked('_cbMPFilterUnidentified');
  7968. let filter_Closed = uroUtils.GetCBChecked('_cbMPFilterClosed');
  7969. let filter_NotClosedUserID = uroUtils.GetCBChecked('_cbMPNotClosedUserIDFilter');
  7970. let filter_ClosedUserID = uroUtils.GetCBChecked('_cbMPClosedUserIDFilter');
  7971. let filter_Reopened = uroUtils.GetCBChecked('_cbMPFilterReopenedProblem');
  7972.  
  7973. let filter_LowSeverity = uroUtils.GetCBChecked('_cbMPFilterLowSeverity');
  7974. let filter_MediumSeverity = uroUtils.GetCBChecked('_cbMPFilterMediumSeverity');
  7975. let filter_HighSeverity = uroUtils.GetCBChecked('_cbMPFilterHighSeverity');
  7976.  
  7977. let filterTypes = [];
  7978. let i;
  7979. for(i=0; i<uroKnownProblemTypeIDs.length; i++)
  7980. {
  7981. if(uroUtils.GetCBChecked('_cbMPFilter_T'+uroKnownProblemTypeIDs[i])) filterTypes.push(uroKnownProblemTypeIDs[i]);
  7982. }
  7983. let filter_TypeUnknown = uroUtils.GetCBChecked('_cbMPFilterUnknownProblem');
  7984.  
  7985. let filter_TaggedElgin = uroUtils.GetCBChecked('_cbFilterElgin');
  7986. let filter_TaggedTrafficCast = uroUtils.GetCBChecked('_cbFilterTrafficCast');
  7987. let filter_TaggedTrafficMaster = uroUtils.GetCBChecked('_cbFilterTrafficMaster');
  7988. let filter_TaggedCaltrans = uroUtils.GetCBChecked('_cbFilterCaltrans');
  7989. let filter_TaggedTFL = uroUtils.GetCBChecked('_cbFilterTFL');
  7990.  
  7991. let filter_Invert = uroUtils.GetCBChecked('_cbInvertMPFilter');
  7992.  
  7993. let filter_StartDateEnabled = uroUtils.GetCBChecked('_cbMPFilterStartDate');
  7994. let filter_EndDateEnabled = uroUtils.GetCBChecked('_cbMPFilterEndDate');
  7995. let filter_EndDatePassed = uroUtils.GetCBChecked('_cbMPFilterEndDatePassed');
  7996.  
  7997. let tsD = uroUtils.GetElmValue('_inputMPFilterStartDay');
  7998. let tsM = uroUtils.GetElmValue('_inputMPFilterStartMonth');
  7999. let tsY = uroUtils.GetElmValue('_inputMPFilterStartYear');
  8000. let startDate = uroUtils.GetTS(tsD, tsM, tsY, 0, 0);
  8001.  
  8002. tsD = uroUtils.GetElmValue('_inputMPFilterEndDay');
  8003. tsM = uroUtils.GetElmValue('_inputMPFilterEndMonth');
  8004. tsY = uroUtils.GetElmValue('_inputMPFilterEndYear');
  8005. let endDate = uroUtils.GetTS(tsD, tsM, tsY, 0, 0);
  8006. let nowTime = (new Date()).getTime();
  8007.  
  8008. for (let urobj in W.model.mapProblems.objects)
  8009. {
  8010. if(W.model.mapProblems.objects.hasOwnProperty(urobj))
  8011. {
  8012. let problem = W.model.mapProblems.objects[urobj];
  8013.  
  8014. if(problem.attributes.origJSONGeo === undefined)
  8015. {
  8016. // Store a copy of the original marker position if we haven't already done so
  8017. problem.attributes.origJSONGeo = uroUtils.CloneObject(problem.attributes.geoJSONGeometry);
  8018. }
  8019. else
  8020. {
  8021. // Restore the original position if we do have a copy of it, to undo any adjustments
  8022. // that may have been made in the last filtering pass
  8023. problem.attributes.geoJSONGeometry = uroUtils.CloneObject(problem.attributes.origJSONGeo);
  8024. }
  8025.  
  8026.  
  8027. let ureqID = problem.attributes.id;
  8028.  
  8029. let problemStyle = 'visible';
  8030. // check problem against current session ignore list...
  8031. if(uroIgnore.IsOnList(ureqID)) problemStyle = 'hidden';
  8032.  
  8033. if(uFP_masterEnable === true)
  8034. {
  8035. if(filter_OutsideEditableArea === true)
  8036. {
  8037. if(problem.canEdit() === false)
  8038. {
  8039. problemStyle = 'hidden';
  8040. }
  8041. }
  8042.  
  8043. if(filter_EndDatePassed == true)
  8044. {
  8045. if(problem.attributes.endTime > nowTime)
  8046. {
  8047. problemStyle = 'hidden';
  8048. }
  8049. }
  8050. if(filter_StartDateEnabled == true)
  8051. {
  8052. let tStart = new Date(problem.attributes.startTime);
  8053. tStart.setHours(0);
  8054. tStart.setMinutes(0);
  8055. tStart.setSeconds(0);
  8056. tStart = tStart.getTime();
  8057. if(tStart != startDate)
  8058. {
  8059. problemStyle = 'hidden';
  8060. }
  8061. }
  8062. if(filter_EndDateEnabled == true)
  8063. {
  8064. let tEnd = new Date(problem.attributes.endTime);
  8065. tEnd.setHours(0);
  8066. tEnd.setMinutes(0);
  8067. tEnd.setSeconds(0);
  8068. tEnd = tEnd.getTime();
  8069. if(tEnd != endDate)
  8070. {
  8071. problemStyle = 'hidden';
  8072. }
  8073. }
  8074.  
  8075. // check against closed/not identified filtering if enabled...
  8076. let geoID = problem.getOLGeometry().id;
  8077. if(geoID !== null)
  8078. {
  8079. if(document.getElementById(geoID) !== null)
  8080. {
  8081. let problem_marker_img = document.getElementById(geoID).href.baseVal;
  8082. if(filter_Solved === true)
  8083. {
  8084. if(problem_marker_img.indexOf('_solved') != -1) problemStyle = 'hidden';
  8085. }
  8086. if(filter_Unidentified === true)
  8087. {
  8088. if(problem_marker_img.indexOf('_rejected') != -1) problemStyle = 'hidden';
  8089. }
  8090. }
  8091. }
  8092.  
  8093. if(filter_Closed === true)
  8094. {
  8095. if(problem.attributes.open === false)
  8096. {
  8097. problemStyle = 'hidden';
  8098. }
  8099. }
  8100.  
  8101. if(problemStyle == 'visible')
  8102. {
  8103. if(solverUser !== null)
  8104. {
  8105. if((filter_NotClosedUserID === true) && (problem.attributes.resolvedBy == solverUser)) problemStyle = 'hidden';
  8106. if((filter_ClosedUserID === true) && (problem.attributes.resolvedBy != solverUser)) problemStyle = 'hidden';
  8107. }
  8108. }
  8109.  
  8110. if(problemStyle == 'visible')
  8111. {
  8112. let problemType = problem.attributes.subType;
  8113. let desc = '';
  8114. if(problem.attributes.description != null)
  8115. {
  8116. desc = problem.attributes.description;
  8117. }
  8118. let customType = uroGetCustomType(ureqID, uroLayers.ID.MP, desc);
  8119.  
  8120. if(customType === 100)
  8121. {
  8122. if(filter_TaggedElgin === true) problemStyle = 'hidden';
  8123. }
  8124. else if(customType === 101)
  8125. {
  8126. if(filter_TaggedTrafficCast === true) problemStyle = 'hidden';
  8127. }
  8128. else if(customType === 102)
  8129. {
  8130. if(filter_TaggedTrafficMaster === true) problemStyle = 'hidden';
  8131. }
  8132. else if(customType === 103)
  8133. {
  8134. if(filter_TaggedCaltrans === true) problemStyle = 'hidden';
  8135. }
  8136. else if(customType === 104)
  8137. {
  8138. if(filter_TaggedTFL === true) problemStyle = 'hidden';
  8139. }
  8140. else if(uroKnownProblemTypeIDs.indexOf(problemType) !== -1)
  8141. {
  8142. if(filterTypes.indexOf(problemType) !== -1)
  8143. {
  8144. problemStyle = 'hidden';
  8145. }
  8146. }
  8147. else if(filter_TypeUnknown === true) problemStyle = 'hidden';
  8148.  
  8149. if(filter_Reopened === true)
  8150. {
  8151. if((problem.attributes.open === true) && (problem.attributes.resolvedOn !== null))
  8152. {
  8153. problemStyle = 'hidden';
  8154. }
  8155. }
  8156.  
  8157.  
  8158. if(filter_Invert === true)
  8159. {
  8160. if(problemStyle == 'hidden') problemStyle = 'visible';
  8161. else problemStyle = 'hidden';
  8162. }
  8163.  
  8164.  
  8165. if(problem.attributes.weight <= 3)
  8166. {
  8167. if(filter_LowSeverity === true) problemStyle = 'hidden';
  8168. }
  8169. else if(problem.attributes.weight <= 7)
  8170. {
  8171. if(filter_MediumSeverity === true) problemStyle = 'hidden';
  8172. }
  8173. else if(filter_HighSeverity === true) problemStyle = 'hidden';
  8174. }
  8175. }
  8176.  
  8177. let marker = uroGetMarker(uroLayers.ID.MP, urobj);
  8178. if(marker !== null)
  8179. {
  8180. marker.style.visibility = problemStyle;
  8181. if(problemStyle === 'hidden')
  8182. {
  8183. // To ensure WME displays the details for the topmost marker that's
  8184. // left visible in a stack, alter the coords for any hidden markers
  8185. // to place them in a location that isn't likely to be clicked on...
  8186. problem.attributes.geoJSONGeometry.coordinates[0] = 0;
  8187. problem.attributes.geoJSONGeometry.coordinates[1] = 90;
  8188. }
  8189. }
  8190. }
  8191. }
  8192.  
  8193. uroDBG.PerfMon(pmFunction, pmTStart);
  8194. }
  8195. function uroFilterPreamble()
  8196. {
  8197. let mapviewport = document.getElementsByClassName("olMapViewport")[0];
  8198. if(mapviewport === null)
  8199. {
  8200. if(uroNullMapViewport === false)
  8201. {
  8202. uroDBG.AddLog('caught null mapviewport');
  8203. uroNullMapViewport = true;
  8204. }
  8205. return false;
  8206. }
  8207.  
  8208. let uiElms = uroTabs.CtrlTabs[uroTabs.IDS.MISC][uroTabs.FIELDS.TABBODY];
  8209. if(uiElms == null)
  8210. {
  8211. uroDBG.AddLog('caught missing UI');
  8212. return false;
  8213. }
  8214. if(uiElms.innerHTML.length === 0)
  8215. {
  8216. uroDBG.AddLog('caught empty UI');
  8217. return false;
  8218. }
  8219.  
  8220. if(uroSettingsApplied === false)
  8221. {
  8222. return false;
  8223. }
  8224.  
  8225. uroNullMapViewport = false;
  8226.  
  8227. return true;
  8228. }
  8229. function uroFilterItems_MasterEnableClick()
  8230. {
  8231. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  8232. {
  8233. uroPopup.Hide();
  8234. }
  8235. uroFilterItems();
  8236. }
  8237. function uroFilterItems()
  8238. {
  8239. uroFilterProblems();
  8240. uroFilterPlaces();
  8241. uroFilterCameras();
  8242. uroFilterURs();
  8243. uroFilterRTCs();
  8244. uroFilterRAs();
  8245. uroFilterMapComments();
  8246. }
  8247. function uroFilterItemsOnMove()
  8248. {
  8249. W.map.events.unregister('mousemove',null,uroFilterItemsOnMove);
  8250. uroFilterItems();
  8251. }
  8252. function uroCheckCommentsForTag(idSrc)
  8253. {
  8254. let ursObj = W.model.updateRequestSessions.objects[idSrc];
  8255. if(typeof(ursObj) == 'undefined') return -1;
  8256. if(ursObj.attributes.comments.length === 0) return -1;
  8257.  
  8258. for(let idx=ursObj.attributes.comments.length-1; idx>=0; idx--)
  8259. {
  8260. for(let tag=0; tag<uroCustomURTags.length; tag++)
  8261. {
  8262. let keyword = uroCustomURTags[tag];
  8263. if(ursObj.attributes.comments[idx].text.indexOf(keyword) != -1)
  8264. {
  8265. return tag;
  8266. }
  8267. }
  8268. }
  8269. return -1;
  8270. }
  8271. function uroGetCustomType(idSrc, markerType, desc)
  8272. {
  8273. let provider = '';
  8274. if(desc === null) desc = '';
  8275. if(markerType == uroLayers.ID.UR)
  8276. {
  8277. let ureq = W.model.mapUpdateRequests.objects[idSrc];
  8278. // early test for native speed limit URs
  8279. if(ureq.attributes.type == 23) return 98;
  8280. }
  8281. else if(markerType == uroLayers.ID.MP)
  8282. {
  8283. let mp = W.model.mapProblems.objects[idSrc];
  8284. if(mp.attributes.provider != null)
  8285. {
  8286. provider = mp.attributes.provider;
  8287. }
  8288. }
  8289.  
  8290. if(desc !== '')
  8291. {
  8292. if((markerType == uroLayers.ID.UR) || (markerType == 'mc'))
  8293. {
  8294. for(let tag=0; tag<uroCustomURTags.length; tag++)
  8295. {
  8296. let keyword = uroCustomURTags[tag];
  8297. if(desc.indexOf(keyword) != -1)
  8298. {
  8299. return tag;
  8300. }
  8301. }
  8302. }
  8303.  
  8304. if(markerType == uroLayers.ID.MP)
  8305. {
  8306. if(desc.indexOf('[Elgin]') != -1) return 100;
  8307. if(desc.indexOf('[ELGIN]') != -1) return 100;
  8308. if(desc.indexOf('[elginroadworks]') != -1) return 100;
  8309. if(desc.indexOf('[one.network]') != -1) return 100;
  8310. if(desc.indexOf('[TrafficCast]') != -1) return 101;
  8311. if(desc.indexOf('[TM]') != -1) return 102;
  8312. if(desc.indexOf('[Caltrans]') != -1) return 103;
  8313. if(desc.indexOf('[TfL Open Data]') != -1) return 104;
  8314. if(provider.indexOf('London TFL Closures') != -1) return 104;
  8315. }
  8316. }
  8317.  
  8318. if(markerType == uroLayers.ID.UR)
  8319. {
  8320. return uroCheckCommentsForTag(idSrc);
  8321. }
  8322.  
  8323. return -1;
  8324. }
  8325. function uroGetRestrictionLanes(disposition)
  8326. {
  8327. let retval = '';
  8328. if(disposition == 1) retval += 'All lanes';
  8329. else if(disposition == 2) retval += 'Left lane';
  8330. else if(disposition == 3) retval += 'Middle lane';
  8331. else if(disposition == 4) retval += 'Right lane';
  8332. else retval += ' - ';
  8333. return retval;
  8334. }
  8335. function uroGetRestrictionLaneType(laneType)
  8336. {
  8337. let retval = '';
  8338. if(laneType === null) retval += ' - ';
  8339. else
  8340. {
  8341. if(laneType == 1) retval += 'HOV';
  8342. else if(laneType == 2) retval += 'HOT';
  8343. else if(laneType == 3) retval += 'Express';
  8344. else if(laneType == 4) retval += 'Bus lane';
  8345. else if(laneType == 5) retval += 'Fast lane';
  8346. else retval += ' - ';
  8347. }
  8348. return retval;
  8349. }
  8350. let uroVehicleTypes =
  8351. [
  8352. [1280, 'fa-car'],
  8353. [1024, 'fa-motorcycle'],
  8354. [272, 'fa-taxi'],
  8355. [1808, 'fa-bolt']
  8356. ];
  8357. function uroGetRestrictionVehicleTypes(restObj, allowInit, profileKey)
  8358. {
  8359. let i;
  8360. let j;
  8361. let k;
  8362. let tVT;
  8363. let retval = [];
  8364. for(i = 0; i < uroVehicleTypes.length; ++i)
  8365. {
  8366. retval.push(allowInit);
  8367. }
  8368. let tRest = restObj._driveProfiles.get(profileKey);
  8369. if(tRest !== undefined)
  8370. {
  8371. for(i = 0; i < tRest._driveProfiles.length; ++i)
  8372. {
  8373. tVT = tRest._driveProfiles[i].getVehicleTypes();
  8374. {
  8375. if(tVT.length > 0)
  8376. {
  8377. for(j = 0; j < tVT.length; ++j)
  8378. {
  8379. for(k = 0; k < uroVehicleTypes.length; ++k)
  8380. {
  8381. if(tVT[j] == uroVehicleTypes[k][0])
  8382. {
  8383. retval[k] = !allowInit;
  8384. }
  8385. }
  8386. }
  8387. }
  8388. }
  8389. }
  8390. }
  8391. return retval;
  8392. }
  8393. function uroFormatRestriction(restObj)
  8394. {
  8395. let retval = '';
  8396.  
  8397. if(restObj._defaultType == "DIFFICULT")
  8398. {
  8399. retval = '<tr><td colspan=13>Difficult Turn';
  8400. }
  8401. else
  8402. {
  8403. let roDays = null;
  8404. let roFromDate = null;
  8405. let roToDate = null;
  8406. let roFromTime = null;
  8407. let roToTime = null;
  8408. let roRepeats = false;
  8409. let roAllDay = false;
  8410. if(restObj._days !== undefined)
  8411. {
  8412. roDays = restObj._days;
  8413. roFromDate = restObj._fromDate;
  8414. roToDate = restObj._toDate;
  8415. roFromTime = restObj._fromTime;
  8416. roToTime = restObj._toTime;
  8417. }
  8418. else if(restObj._timeFrames.length > 0)
  8419. {
  8420. if(restObj._timeFrames[0]._weekdays !== undefined)
  8421. {
  8422. roDays = restObj._timeFrames[0]._weekdays;
  8423. roFromDate = restObj._timeFrames[0]._startDate;
  8424. roToDate = restObj._timeFrames[0]._endDate;
  8425. roFromTime = restObj._timeFrames[0]._fromTime;
  8426. roToTime = restObj._timeFrames[0]._toTime;
  8427. roRepeats = restObj._timeFrames[0]._repeatYearly;
  8428. }
  8429. }
  8430.  
  8431. if((roFromTime === null) && (roToTime === null))
  8432. {
  8433. roFromTime = "0:00";
  8434. roToTime = "23:59";
  8435. roAllDay = true;
  8436. }
  8437.  
  8438. let hasExpired = false;
  8439. let isFuture = false;
  8440. let tNow = Date.now();
  8441. let tFrom = null;
  8442. let tTo = null;
  8443. if(roFromDate !== null)
  8444. {
  8445. tFrom = new Date(roFromDate + " " + roFromTime);
  8446. isFuture = (tFrom.getTime() > tNow);
  8447. }
  8448. if(roToDate !== null)
  8449. {
  8450. tTo = new Date(roToDate + " " + roToTime);
  8451. hasExpired = (tTo.getTime() < tNow);
  8452. }
  8453. if((hasExpired === true) && (roRepeats === true))
  8454. {
  8455. while(tTo.getTime() < tNow)
  8456. {
  8457. tFrom.setFullYear(tFrom.getFullYear() + 1);
  8458. tTo.setFullYear(tTo.getFullYear() + 1);
  8459. }
  8460. isFuture = (tFrom.getTime() > tNow);
  8461. hasExpired = false;
  8462. }
  8463.  
  8464.  
  8465. if(isFuture === true)
  8466. {
  8467. retval = '<tr bgcolor="#8080FF">';
  8468. }
  8469. else if(hasExpired === true)
  8470. {
  8471. retval = '<tr bgcolor="#FFFFC0">';
  8472. }
  8473. else
  8474. {
  8475. retval = '<tr>';
  8476. }
  8477.  
  8478. if(roDays === null)
  8479. {
  8480. roDays = 127;
  8481. }
  8482.  
  8483. retval += '<td style="text-align:center;">';
  8484. if((roDays & 1) == 1) retval += 'M';
  8485. else retval += '-';
  8486. retval += '</td><td style="text-align:center;">';
  8487. if((roDays & 2) == 2) retval += 'Tu';
  8488. else retval += '-';
  8489. retval += '</td><td style="text-align:center;">';
  8490. if((roDays & 4) == 4) retval += 'W';
  8491. else retval += '-';
  8492. retval += '</td><td style="text-align:center;">';
  8493. if((roDays & 8) == 8) retval += 'Th';
  8494. else retval += '-';
  8495. retval += '</td><td style="text-align:center;">';
  8496. if((roDays & 16) == 16) retval += 'F';
  8497. else retval += '-';
  8498. retval += '</td><td style="text-align:center;">';
  8499. if((roDays & 32) == 32) retval += 'Sa';
  8500. else retval += '-';
  8501. retval += '</td><td style="text-align:center;">';
  8502. if((roDays & 64) == 64) retval += 'Su';
  8503. else retval += '-';
  8504.  
  8505. retval += '</td><td nowrap style="text-align:center;">';
  8506.  
  8507. if(roFromDate === null) retval += 'All dates';
  8508. else retval += tFrom.toISOString().slice(0,10) + ' to ' + tTo.toISOString().slice(0,10);
  8509. if(roRepeats === true)
  8510. {
  8511. retval += '&nbsp;<i class="fa fa-repeat"> </i>';
  8512. }
  8513.  
  8514. retval += '</td><td nowrap style="text-align:center;">';
  8515.  
  8516. if((restObj._allDay === true) || (roAllDay === true)) retval += 'All day';
  8517. else retval += roFromTime + ' to ' + roToTime;
  8518.  
  8519. retval += '</td><td nowrap style="text-align:center;">';
  8520.  
  8521. retval += uroGetRestrictionLanes(restObj._disposition);
  8522.  
  8523. retval += '</td><td nowrap style="text-align:center;">';
  8524.  
  8525. retval += uroGetRestrictionLaneType(restObj._laneType);
  8526.  
  8527. retval += '</td><td nowrap style="text-align:center;">';
  8528.  
  8529. // for brevity, the popup only displays the allowed/prohibited restriction for the driveable vehicle types in the app...
  8530. let typesAllowed = [];
  8531. if((restObj._defaultType == "BLOCKED") || (restObj._defaultType == "TOLL"))
  8532. {
  8533. if(restObj._defaultType == "TOLL")
  8534. {
  8535. retval += I18n.lookup('restrictions.editing.segment.toll_road');
  8536. }
  8537. typesAllowed = uroGetRestrictionVehicleTypes(restObj, false, "FREE");
  8538. }
  8539. else
  8540. {
  8541. typesAllowed = uroGetRestrictionVehicleTypes(restObj, true, "BLOCKED");
  8542. }
  8543.  
  8544. let i;
  8545. for(i = 0; i < uroVehicleTypes.length; ++i)
  8546. {
  8547. if(typesAllowed[i] === true)
  8548. {
  8549. retval += '<i class="fa '+uroVehicleTypes[i][1]+'" style="color:#000000;"> </i>&nbsp;';
  8550. }
  8551. else
  8552. {
  8553. retval += '<i class="fa '+uroVehicleTypes[i][1]+'" style="color:#d0d0d0;"> </i>&nbsp;';
  8554. }
  8555. }
  8556.  
  8557. retval += '</td><td>';
  8558. retval += uroUtils.Clickify(restObj._description, '');
  8559. }
  8560.  
  8561. retval += '</td></tr>';
  8562.  
  8563. return retval;
  8564. }
  8565. function uroOpenURDialog(urID)
  8566. {
  8567. let t = {showNext: false, nextButtonString: I18n.lookup('problems.panel.done')};
  8568. let urObj = W.model.mapUpdateRequests.objects[urID];
  8569. W.reqres.request("problems:browse", _.extend(t, {problem: urObj}));
  8570. }
  8571. function uroRecentreSessionOnUR()
  8572. {
  8573. //uroGetMarker(uroLayers.ID.UR, uroShownFID).element.click();
  8574. uroOpenURDialog(uroShownFID);
  8575. W.map.moveTo(uroGetMarker(uroLayers.ID.UR, uroShownFID).lonlat, 17);
  8576. uroPopup.Hide();
  8577. return false;
  8578. }
  8579. function uroRecentreSessionOnMP()
  8580. {
  8581. uroGetMarker(uroLayers.ID.MP, uroShownFID).element.click();
  8582. W.map.moveTo(uroGetMarker(uroLayers.ID.MP, uroShownFID).lonlat, 17);
  8583. uroPopup.Hide();
  8584. return false;
  8585. }
  8586. function uroRecentreSessionOnPUR()
  8587. {
  8588. uroGetMarker(uroLayers.ID.PUR, uroShownFID).element.click();
  8589. W.map.moveTo(uroGetMarker(uroLayers.ID.PUR, uroShownFID).lonlat, 17);
  8590. uroPopup.Hide();
  8591. return false;
  8592. }
  8593. function uroRecentreSessionOnPPUR()
  8594. {
  8595. uroGetMarker(uroLayers.ID.PPUR, uroShownFID).element.click();
  8596. W.map.moveTo(uroGetMarker(uroLayers.ID.PPUR, uroShownFID).lonlat, 17);
  8597. uroPopup.Hide();
  8598. return false;
  8599. }
  8600. function uroRecentreSessionOnVenueNavPoint()
  8601. {
  8602. W.map.moveTo(uroGetVenueNavPoint(uroShownFID), 17);
  8603. uroPopup.Hide();
  8604. return false;
  8605. }
  8606. function uroStackListObj(fid,x,y)
  8607. {
  8608. this.fid = fid;
  8609. this.x = uroUtils.TypeCast(x);
  8610. this.y = uroUtils.TypeCast(y);
  8611. }
  8612. function uroRestackMarkers()
  8613. {
  8614. if(uroStackList.length === 0) return;
  8615.  
  8616. if(uroLayers.layers[uroStackType].mf !== null)
  8617. {
  8618. uroDBG.AddLog('restacking markers...');
  8619. // strip off the .realX/realY attributes from any UR object we've previously added it to, to allow
  8620. // the native recentering to work again...
  8621. let idList = uroGetMarkerIDs(uroStackType);
  8622. for(let marker of idList)
  8623. {
  8624. let testMarkerAttributes = uroGetAttributes(uroStackType, marker);
  8625. if(testMarkerAttributes.geometry.realX != null)
  8626. {
  8627. testMarkerAttributes.geometry.x = testMarkerAttributes.geometry.realX;
  8628. testMarkerAttributes.geometry.y = testMarkerAttributes.geometry.realY;
  8629. delete(testMarkerAttributes.geometry.realX);
  8630. delete(testMarkerAttributes.geometry.realY);
  8631. }
  8632. }
  8633. // now restack any markers that were repositioned...
  8634. for(let idx=0; idx<uroStackList.length; idx++)
  8635. {
  8636. let orig_x = uroStackList[idx].x + 'px';
  8637. let orig_y = uroStackList[idx].y + 'px';
  8638. let fid = uroStackList[idx].fid;
  8639.  
  8640. if(uroGetMarker(uroStackType, fid) != null)
  8641. {
  8642. uroGetMarker(uroStackType, fid).element.style.left = orig_x;
  8643. uroGetMarker(uroStackType, fid).element.style.top = orig_y;
  8644. }
  8645. }
  8646. uroStackList = [];
  8647. uroUnstackedMasterID = null;
  8648. uroStackType = null;
  8649. uroDBG.AddLog('...stacked!');
  8650. }
  8651. }
  8652. function uroIsIDAlreadyUnstacked(idSrc)
  8653. {
  8654. if(uroStackList.length === 0) return false;
  8655. for(let idx=0; idx<uroStackList.length; idx++)
  8656. {
  8657. if(uroStackList[idx].fid == idSrc) return true;
  8658. }
  8659. return false;
  8660. }
  8661. function uroCheckStacking(stackType, masterID, unstackedX, unstackedY)
  8662. {
  8663. //// disabled pending fix...
  8664. return;
  8665. if(typeof(masterID) === 'number')
  8666. {
  8667. masterID = masterID.toString();
  8668. }
  8669.  
  8670. if(uroIsIDAlreadyUnstacked(masterID) === true) return;
  8671. if(uroStackType !== null) return;
  8672.  
  8673. uroDBG.AddLog('checking for marker stack, masterID: '+masterID+', stackType: '+stackType);
  8674. let stackList = [];
  8675. stackList.push(masterID);
  8676. let threshSquared = uroUtils.GetElmValue('_inputUnstackSensitivity');
  8677. threshSquared *= threshSquared;
  8678.  
  8679. let marker;
  8680.  
  8681. let offset = 0.000000001;
  8682. if(uroLayers.layers[stackType].mf !== null)
  8683. {
  8684. let idList = uroGetMarkerIDs(stackType);
  8685. let showOpen = true;
  8686. let showClosed = false;
  8687. let showTypes = null;
  8688. if(stackType === uroLayers.ID.UR)
  8689. {
  8690. showTypes = W?.issueTrackerController?.app?.attributes?.issueTrackerFilter?.attributes?.mapUpdateRequestsFilter?.attributes?.status;
  8691. }
  8692. else if(stackType === uroLayers.ID.MP)
  8693. {
  8694. showTypes = W?.issueTrackerController?.app?.attributes?.issueTrackerFilter?.attributes?.mapProblemsFilter?.attributes?.status;
  8695. }
  8696. if(showTypes !== null)
  8697. {
  8698. showOpen = ((showTypes == 'OPEN') || (showTypes == 'BOTH'));
  8699. showClosed = ((showTypes == 'CLOSED') || (showTypes == 'BOTH'));
  8700. }
  8701.  
  8702. for(marker of idList)
  8703. {
  8704. let testMarkerObj = uroGetMarker(stackType, marker);
  8705. let testMarkerAttributes = uroGetAttributes(stackType, marker);
  8706. if((testMarkerAttributes !== null) && (testMarkerObj !== null))
  8707. {
  8708. // 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
  8709. // top of the stack in the absence of any URO+ filtering, regardless of which UR pin actually receives the click event. To prevent
  8710. // this, we give each pin in the stack a unique set of false coordinates, storing the original coordinates in newly created
  8711. // properties so they can be restored later on.
  8712. //
  8713. // 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
  8714. // 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
  8715. // is being viewed. By using a small fractional offset added to each stacked marker, the risk of accidentally setting the offset coords to
  8716. // those of another marker is low
  8717. if(testMarkerAttributes.geometry.realX === undefined)
  8718. {
  8719. testMarkerAttributes.geometry.realX = testMarkerAttributes.geometry.x;
  8720. testMarkerAttributes.geometry.x += offset;
  8721. testMarkerAttributes.geometry.realY = testMarkerAttributes.geometry.y;
  8722. testMarkerAttributes.geometry.y += offset;
  8723. offset += 0.000000001;
  8724. }
  8725.  
  8726. let includeInStack = (testMarkerObj.element.style.visibility != 'hidden');
  8727. let isClosed = testMarkerObj.element.classList.contains("recently-closed");
  8728. includeInStack = includeInStack && ((isClosed && showClosed) || (!isClosed && showOpen));
  8729. if(includeInStack)
  8730. {
  8731. if(testMarkerAttributes.id != masterID)
  8732. {
  8733. let bcr = testMarkerObj.element.getBoundingClientRect();
  8734. let xdiff = unstackedX - bcr.x;
  8735. let ydiff = unstackedY - bcr.y;
  8736. let distSquared = ((xdiff * xdiff) + (ydiff * ydiff));
  8737. if(distSquared < threshSquared)
  8738. {
  8739. stackList.push(testMarkerAttributes.id);
  8740. }
  8741. }
  8742. }
  8743. }
  8744. }
  8745. }
  8746.  
  8747. let inhibitUnstacking = (W.map.getZoom() < uroUtils.GetElmValue('_inputUnstackZoomLevel'));
  8748. inhibitUnstacking = inhibitUnstacking || (stackList.length < 2);
  8749.  
  8750. if(inhibitUnstacking == false)
  8751. {
  8752. uroStackType = stackType;
  8753. if(uroUnstackedMasterID != masterID)
  8754. {
  8755. uroDBG.AddLog('unstacked ID mismatch, relocating markers...');
  8756. uroRestackMarkers();
  8757. uroUnstackedMasterID = masterID;
  8758. uroStackList = [];
  8759.  
  8760. // push the highlighted marker onto the stacklist so uroIsIDAlreadyUnstacked() will return true
  8761. uroStackList.push(new uroStackListObj(masterID,unstackedX,unstackedY));
  8762.  
  8763. for(let shoveIdx=0; shoveIdx < stackList.length; shoveIdx++)
  8764. {
  8765. let fid = stackList[shoveIdx];
  8766. let stackMarker = uroGetMarker(stackType, fid);
  8767. if(stackMarker !== null)
  8768. {
  8769. let x = uroUtils.ParsePxString(stackMarker.element.style.left);
  8770. let y = uroUtils.ParsePxString(stackMarker.element.style.top);
  8771. // store the unstacked marker positions so they can be reinstated later
  8772. uroStackList.push(new uroStackListObj(fid,x,y));
  8773. stackMarker.element.style.left = unstackedX + 'px';
  8774. stackMarker.element.style.top = unstackedY + 'px';
  8775. unstackedX += 5;
  8776. unstackedY -= 20;
  8777. }
  8778. }
  8779.  
  8780.  
  8781. // hide other markers to prevent confusion with the unstacked markers
  8782. let listIDs = uroGetMarkerIDs(stackType);
  8783. for(marker in listIDs)
  8784. {
  8785. if(listIDs.hasOwnProperty(marker))
  8786. {
  8787. let toHideMarker = uroGetMarker(stackType, marker);
  8788. if(toHideMarker !== null)
  8789. {
  8790. let toHideID = toHideMarker.id;
  8791. if(uroIsIDAlreadyUnstacked(toHideID) === false)
  8792. {
  8793. toHideMarker = uroGetMarker(stackType, toHideID);
  8794. if(toHideMarker !== null)
  8795. {
  8796. toHideMarker.element.style.visibility = 'hidden';
  8797. }
  8798. }
  8799. }
  8800. }
  8801. }
  8802. }
  8803. }
  8804. else
  8805. {
  8806. uroRestackMarkers();
  8807. }
  8808. }
  8809. function uroGetVenueNavPoint(uroFID)
  8810. {
  8811. let retval = W.map.getUnprojectedCenter(); // allow the function to return a safe value in case we can't find the requested venue object...
  8812.  
  8813. let vObj = W.model.venues.objects[uroFID];
  8814. if(vObj !== undefined)
  8815. {
  8816. if(vObj.attributes.entryExitPoints.length > 0)
  8817. {
  8818. // if the venue has any navpoints defined, use the position of the first one
  8819. let tPoint = vObj.attributes.entryExitPoints[0].getPoint();
  8820. retval.lon = tPoint.coordinates[0];
  8821. retval.lat = tPoint.coordinates[1];
  8822. }
  8823. else
  8824. {
  8825. // otherwise use the centrepoint of the venue point or polygon
  8826. let tPoint = vObj.attributes.geometry.getCentroid();
  8827. let tLL = new OpenLayers.LonLat();
  8828. tLL.lon = tPoint.x;
  8829. tLL.lat = tPoint.y;
  8830. tLL = uroUtils.ConvertMercatorToWGS84(tLL);
  8831. retval.lon = tLL.lon;
  8832. retval.lat = tLL.lat;
  8833. }
  8834. }
  8835. return retval;
  8836. }
  8837. function uroOpenNewTab()
  8838. {
  8839. // flush the current settings into localStorage before the new tab opens, so that when its instance of
  8840. // URO+ fires up it'll have the same settings as this one
  8841. uroConfig.SaveSettings();
  8842. return true;
  8843. }
  8844. function uroGetRTCDuration(rcObj)
  8845. {
  8846. let duration = new Date(rcObj.attributes.endDate) - new Date(rcObj.attributes.startDate);
  8847. return Math.floor(duration / 86400000);
  8848. }
  8849. function uroGetRTCOffset(rcDate)
  8850. {
  8851. let dateObj = new Date(rcDate);
  8852. return (0 - uroUtils.DateToDays(dateObj));
  8853. }
  8854. function uroGetRTCOrigin(rcObj)
  8855. {
  8856. let retval = uroEnums.TRTC.UNKNOWN;
  8857.  
  8858. if(rcObj !== undefined)
  8859. {
  8860. if(rcObj.attributes.createdBy == -5)
  8861. {
  8862. retval = uroEnums.TRTC.WAZEFEED;
  8863. }
  8864. else if((W.model.users.objects[rcObj.attributes.createdBy] !== undefined) && (W.model.users.objects[rcObj.attributes.createdBy].attributes.rank == 6))
  8865. {
  8866. retval = uroEnums.TRTC.WAZEOTHER;
  8867. }
  8868. else
  8869. {
  8870. retval = uroEnums.TRTC.WME;
  8871. }
  8872. }
  8873.  
  8874. return retval;
  8875. }
  8876. function uroGetRTCState(rcObj)
  8877. {
  8878. let retval = uroEnums.SRTC.UNKNOWN;
  8879. let rcStatus = rcObj.attributes.closureStatus;
  8880.  
  8881. if(rcStatus !== undefined)
  8882. {
  8883. if(rcStatus === "ACTIVE")
  8884. {
  8885. retval = uroEnums.SRTC.ACTIVE;
  8886. }
  8887. else if(rcStatus === "NOT_STARTED")
  8888. {
  8889. retval = uroEnums.SRTC.FUTURE;
  8890. }
  8891. else if(rcStatus.indexOf("FINISHED") != -1)
  8892. {
  8893. retval = uroEnums.SRTC.EXPIRED;
  8894. }
  8895. // Haven't seen one of these yet, so assuming it should be treated
  8896. // the same as an expired closure...
  8897. else if(rcStatus === "SUSPENDED")
  8898. {
  8899. retval = uroEnums.SRTC.EXPIRED;
  8900. }
  8901. }
  8902.  
  8903. return retval;
  8904. }
  8905. function uroGetRTCStateText(rcObj)
  8906. {
  8907. let retval = "---";
  8908. let i18 = I18n.lookup("closures.statuses")[rcObj.attributes.closureStatus];
  8909. if(i18 !== undefined)
  8910. {
  8911. retval = i18;
  8912. }
  8913. return retval;
  8914. }
  8915. function uroGetAddress(streetID, houseNumber, formatForSegmentPopup, formatForNodePopup, showAsToll)
  8916. {
  8917. let result = '';
  8918. if((houseNumber !== undefined) && (houseNumber !== null))
  8919. {
  8920. result += houseNumber + ' ';
  8921. }
  8922.  
  8923. if(streetID != null)
  8924. {
  8925. let streetName = I18n.lookup('edit.address.no_street');
  8926. let doesStreetIDExist = true;
  8927. if(W.model.streets.objects[streetID] === undefined)
  8928. {
  8929. streetName = 'non-existent streetID';
  8930. doesStreetIDExist = false;
  8931. }
  8932. else
  8933. {
  8934. if((streetName !== null) && (W.model.streets.objects[streetID].attributes.isEmpty === false))
  8935. {
  8936. streetName = W.model.streets.objects[streetID].attributes.name;
  8937. }
  8938. }
  8939. if(formatForSegmentPopup === true)
  8940. {
  8941. if(showAsToll == true)
  8942. {
  8943. result += '<i class="fa fa-credit-card"></i> ';
  8944. }
  8945. result += '<b>'+streetName+'</b><br>';
  8946. }
  8947. else
  8948. {
  8949. result += streetName + ', ';
  8950. }
  8951.  
  8952. if(doesStreetIDExist === true)
  8953. {
  8954. let cityName = I18n.lookup('edit.address.no_city');
  8955. let doesCityIDExist = true;
  8956. let cityID = W.model.streets.objects[streetID].attributes.cityID;
  8957. if(W.model.cities.objects[cityID] === undefined)
  8958. {
  8959. cityName = 'non-existent cityID';
  8960. doesCityIDExist = false;
  8961. }
  8962. else
  8963. {
  8964. if(W.model.cities.objects[cityID].attributes.name !== "")
  8965. {
  8966. cityName = W.model.cities.objects[cityID].attributes.name;
  8967. }
  8968. }
  8969. result += cityName + ', ';
  8970.  
  8971. if(doesCityIDExist === true)
  8972. {
  8973. let stateID = W.model.cities.objects[cityID].attributes.stateID;
  8974. if(W.model.states.objects[stateID] === undefined)
  8975. {
  8976. result += 'non-existent stateID';
  8977. }
  8978. else
  8979. {
  8980. result += W.model.states.objects[stateID].attributes.name;
  8981. }
  8982. }
  8983. }
  8984. }
  8985. result += '<br>';
  8986.  
  8987. return result;
  8988. }
  8989. function uroGetSelectedSegmentRTCs(segID)
  8990. {
  8991. let closureTypes = uroEnums.DRTC.NONE;
  8992. let RTCObjs = [];
  8993. let selectedSegs = [];
  8994.  
  8995. if(segID === null)
  8996. {
  8997. // segID should always be set to a valid segment ID if we're being called from the segment mouseover
  8998. // handler, so if it's null it implies we've instead been called from the closure panel handler where
  8999. // we might therefore be dealing with a multi-segment selection...
  9000. selectedSegs = W.selectionManager.getSegmentSelection().segments;
  9001. }
  9002.  
  9003. if((selectedSegs.length > 0) || (segID !== null))
  9004. {
  9005. for(let roadClosure in W.model.roadClosures.objects)
  9006. {
  9007. if(W.model.roadClosures.objects.hasOwnProperty(roadClosure))
  9008. {
  9009. let rcObj = W.model.roadClosures.objects[roadClosure];
  9010. rcObj.segIDs = [rcObj.attributes.segID]; // copy the segID property into an array so we can push extra segIDs into it later...
  9011.  
  9012. // 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
  9013. // into a two-way closure, we can then change the direction value to indicate this as well
  9014. if(rcObj.attributes.forward === true)
  9015. {
  9016. rcObj.direction = uroEnums.DRTC.SEG_AB;
  9017. }
  9018. else
  9019. {
  9020. rcObj.direction = uroEnums.DRTC.SEG_BA;
  9021. }
  9022.  
  9023. // for each of the selected or moused-over segments, find all the closures which have matching segIDs
  9024. if(segID !== null)
  9025. {
  9026. if(rcObj.attributes.segID == segID)
  9027. {
  9028. RTCObjs.push(rcObj);
  9029. }
  9030. }
  9031. else
  9032. {
  9033. for(let i = 0; i < selectedSegs.length; ++i)
  9034. {
  9035. if(rcObj.attributes.segID == selectedSegs[i].attributes.id)
  9036. {
  9037. RTCObjs.push(rcObj);
  9038. break;
  9039. }
  9040. }
  9041. }
  9042. }
  9043. }
  9044.  
  9045. // RTCObjs now contains all of the segment closures relating to all of the segments of interest, so
  9046. // we can begin to organise them such that by the time we exit this function, the array will then contain
  9047. // an optimised list of closures that matches up to the list shown in the closure sidepanel, taking into
  9048. // account closures applying to all segments vs some, closures that can be merged into two-ways etc.
  9049.  
  9050. // first sort the closure by their start date, with a secondary sort by direction for those closures
  9051. // that have the same start date
  9052. RTCObjs = RTCObjs.sort(function(a,b)
  9053. {
  9054. if(a.attributes.startDate === b.attributes.startDate)
  9055. {
  9056. if(a.direction == uroEnums.DRTC.SEG_AB) return -1;
  9057. return 1;
  9058. }
  9059. if(a.attributes.startDate > b.attributes.startDate) return 1;
  9060. return -1;
  9061. });
  9062.  
  9063. // if we've got at least two closures in the sorted list, we then test adjacent list entries
  9064. // to see if they contain closure details which are identical except for their segment IDs, and
  9065. // combine them if so
  9066. if(RTCObjs.length > 1)
  9067. {
  9068. let i = 0;
  9069. while(i < (RTCObjs.length - 1))
  9070. {
  9071. if(
  9072. (RTCObjs[i].attributes.createdBy == RTCObjs[i+1].attributes.createdBy) &&
  9073. (RTCObjs[i].attributes.endDate == RTCObjs[i+1].attributes.endDate) &&
  9074. (RTCObjs[i].attributes.eventId == RTCObjs[i+1].attributes.eventId) &&
  9075. (RTCObjs[i].attributes.location == RTCObjs[i+1].attributes.location) &&
  9076. (RTCObjs[i].attributes.reason == RTCObjs[i+1].attributes.reason) &&
  9077. (RTCObjs[i].attributes.startDate == RTCObjs[i+1].attributes.startDate) &&
  9078. (RTCObjs[i].direction == RTCObjs[i+1].direction)
  9079. )
  9080. {
  9081. RTCObjs[i].segIDs.push(RTCObjs[i+1].attributes.segID);
  9082. RTCObjs.splice(i+1, 1);
  9083. }
  9084. else
  9085. {
  9086. ++i;
  9087. }
  9088. }
  9089. }
  9090.  
  9091. // after that first trimming of the list, if there are still two or more entries then
  9092. // we perform a second pass, this time merging any adjacent entries which have the same
  9093. // segment IDs in their segIDs arrays - these are two-way closures applying to all those
  9094. // segments, and so we also change the direction value to indicate two-way vs A-B or B-A
  9095. if(RTCObjs.length > 1)
  9096. {
  9097. let i = 0;
  9098. while(i < (RTCObjs.length - 1))
  9099. {
  9100. if
  9101. (
  9102. (RTCObjs[i].segIDs.sort().join(',') == RTCObjs[i+1].segIDs.sort().join(',')) &&
  9103. (RTCObjs[i].attributes.createdBy == RTCObjs[i+1].attributes.createdBy) &&
  9104. (RTCObjs[i].attributes.endDate == RTCObjs[i+1].attributes.endDate) &&
  9105. (RTCObjs[i].attributes.eventId == RTCObjs[i+1].attributes.eventId) &&
  9106. (RTCObjs[i].attributes.location == RTCObjs[i+1].attributes.location) &&
  9107. (RTCObjs[i].attributes.reason == RTCObjs[i+1].attributes.reason) &&
  9108. (RTCObjs[i].attributes.startDate == RTCObjs[i+1].attributes.startDate)
  9109. )
  9110. {
  9111. RTCObjs[i].direction = uroEnums.DRTC.SEG_BI;
  9112. RTCObjs.splice(i+1, 1);
  9113. }
  9114. ++i;
  9115. }
  9116. }
  9117. }
  9118.  
  9119. let RTTCObjs = [];
  9120. if(segID !== null)
  9121. {
  9122. // If we've been called from the segment popup handler, we now also check for any turn closures
  9123. // associated with this segment, so that their details can also be shown in the popup...
  9124. for(let turnClosure in W.model.turnClosures.objects)
  9125. {
  9126. if(W.model.turnClosures.objects.hasOwnProperty(turnClosure))
  9127. {
  9128. let tcObj = W.model.turnClosures.objects[turnClosure];
  9129. if(tcObj.attributes.fromSegID === segID)
  9130. {
  9131. tcObj.direction = uroEnums.DRTC.TURN_OUT;
  9132. RTTCObjs.push(tcObj);
  9133. }
  9134. else if(tcObj.attributes.toSegID === segID)
  9135. {
  9136. tcObj.direction = uroEnums.DRTC.TURN_IN;
  9137. RTTCObjs.push(tcObj);
  9138. }
  9139. }
  9140. }
  9141.  
  9142. if(RTTCObjs.length > 1)
  9143. {
  9144. RTTCObjs = RTTCObjs.sort(function(a,b)
  9145. {
  9146. if(a.attributes.startDate === b.attributes.startDate)
  9147. {
  9148. if(a.direction == uroEnums.DRTC.TURN_OUT) return -1;
  9149. return 1;
  9150. }
  9151. if(a.attributes.startDate > b.attributes.startDate) return 1;
  9152. return -1;
  9153. });
  9154. }
  9155. }
  9156.  
  9157. uroRTCObjs = RTCObjs.concat(RTTCObjs);
  9158. for(let i = 0; i < uroRTCObjs.length; ++i)
  9159. {
  9160. closureTypes |= uroRTCObjs[i].direction;
  9161. }
  9162.  
  9163. // the closure list ordering at this point doesn't always match up to the order used by the closures panel when
  9164. // a mixture of "all segment" and "some segment" closures are present - need to work out what ordering rules
  9165. // WME is using here...
  9166. return closureTypes;
  9167. }
  9168. function uroGetLengthString(length)
  9169. {
  9170. let retval = '';
  9171. if(length == null)
  9172. {
  9173. retval = "Default";
  9174. }
  9175. else if(W.model.isImperial == true)
  9176. {
  9177. retval = (length / (12 * 2.54)).toFixed(1) + "ft";
  9178. }
  9179. else
  9180. {
  9181. retval = (length / 100).toFixed(1) + "m";
  9182. }
  9183.  
  9184. return retval;
  9185. }
  9186. function uroGetHighlightedMapFeature()
  9187. {
  9188. let featureID = W.selectionManager.mouseInFeature;
  9189. let retval = null;
  9190.  
  9191. if(featureID !== undefined)
  9192. {
  9193. let isSelected = W.selectionManager.isSelected(featureID);
  9194. if(isSelected === false)
  9195. {
  9196. retval = W.selectionManager.getObjectByFeatureId(featureID);
  9197. }
  9198. }
  9199. return retval;
  9200. }
  9201. function uroGetFeatureRenderIntent(moObj)
  9202. {
  9203. let retval = "unknown";
  9204.  
  9205. if(moObj !== null)
  9206. {
  9207. let isSelected = moObj.selected;
  9208.  
  9209. if(isSelected === true)
  9210. {
  9211. retval = "highlightselected";
  9212. }
  9213. else
  9214. {
  9215. retval = "highlight";
  9216. }
  9217. }
  9218.  
  9219. return retval;
  9220. }
  9221. function uroExclusiveCB()
  9222. {
  9223. let cbChecked = uroUtils.GetCBChecked(this.id);
  9224.  
  9225. if(cbChecked === true)
  9226. {
  9227. let pairedList = this.attributes.pairedWith.value.split(',');
  9228. for(let i=0; i<pairedList.length; i++)
  9229. {
  9230. uroUtils.SetCBChecked(pairedList[i], false);
  9231. }
  9232. }
  9233. }
  9234. function uroContainsPoint(geo, point)
  9235. {
  9236. let retval = false;
  9237. try
  9238. {
  9239. let j = 1;
  9240. for(let i = 0; i < geo.length; ++i)
  9241. {
  9242. if
  9243. (
  9244. ((point[1] >= geo[i][1]) && (point[1] <= geo[j][1])) ||
  9245. ((point[1] >= geo[j][1]) && (point[1] <= geo[i][1]))
  9246. )
  9247. {
  9248. let lx = geo[i][0];
  9249. if(geo[i][1] != geo[j][1])
  9250. {
  9251. let g = ((point[1] - geo[i][1]) / (geo[j][1] - geo[i][1]));
  9252. lx += (g * (geo[j][0] - geo[i][0]));
  9253. }
  9254.  
  9255. if(point[0] <= lx)
  9256. {
  9257. retval = !retval;
  9258. }
  9259. }
  9260. if(++j == geo.length)
  9261. {
  9262. j = 0;
  9263. }
  9264. }
  9265. }
  9266. catch
  9267. {
  9268. }
  9269. return retval;
  9270. }
  9271. function uroGetAMs(e)
  9272. {
  9273. if(uroMTEMode) return;
  9274. if(!uroFilterPreamble) return;
  9275. if(!uroInit.initialised) return;
  9276. if(document.getElementById("uroAMList") == null) return;
  9277. if(document.getElementsByClassName('topbar') == null) return;
  9278.  
  9279. if(uroUtils.GetCBChecked("_cbMoveAMList") === false)
  9280. {
  9281. document.getElementsByClassName('area-managers-region')[0].style.display = "block";
  9282. uroAMList.innerHTML = uroUtils.ModifyHTML("");
  9283. document.getElementsByClassName('topbar')[0].style.backgroundColor=null;
  9284. return;
  9285. }
  9286.  
  9287. document.getElementsByClassName('topbar')[0].style.backgroundColor="#000000";
  9288. document.getElementsByClassName('topbar')[0].style.height="auto";
  9289. document.getElementsByClassName('area-managers-region')[0].style.display = "none";
  9290.  
  9291. let amList = '';
  9292. let tName = '';
  9293. if(W.map.managedAreasLayer.getVisibility() === true)
  9294. {
  9295. let mouseX = e.pageX - document.getElementById('map').getBoundingClientRect().left;
  9296. let mouseY = e.pageY - document.getElementById('map').getBoundingClientRect().top;
  9297. let mousePixel = W.map.getLonLatFromPixel(new OpenLayers.Pixel(mouseX, mouseY));
  9298. let mousePoint = [];
  9299. mousePoint.push(mousePixel.lon);
  9300. mousePoint.push(mousePixel.lat);
  9301.  
  9302. let hideL1Areas = uroUtils.GetCBChecked("_cbHideAMA-L1");
  9303. let hideL2Areas = uroUtils.GetCBChecked("_cbHideAMA-L2");
  9304. let hideL3Areas = uroUtils.GetCBChecked("_cbHideAMA-L3");
  9305. let hideL4Areas = uroUtils.GetCBChecked("_cbHideAMA-L4");
  9306. let hideL5Areas = uroUtils.GetCBChecked("_cbHideAMA-L5");
  9307. let hideL6Areas = uroUtils.GetCBChecked("_cbHideAMA-L6");
  9308. let hideL7Areas = uroUtils.GetCBChecked("_cbHideAMA-L7");
  9309.  
  9310. let hideNewAreas = uroUtils.GetCBChecked("_cbEnableAMAMinAgeFilter");
  9311. let areaMinAge = uroUtils.GetElmValue("_inputFilterAMA-MinDays");
  9312. let hideOldAreas = uroUtils.GetCBChecked("_cbEnableAMAMaxAgeFilter");
  9313. let areaMaxAge = uroUtils.GetElmValue("_inputFilterAMA-MaxDays");
  9314.  
  9315. for(let amObj in W.model.managedAreas.objects)
  9316. {
  9317. let ama = W.model.managedAreas.objects[amObj];
  9318. let userID = ama.attributes.userID;
  9319. let userLevel = uroUtils.GetUserLevelFromID(userID);
  9320.  
  9321. let hideArea = false;
  9322. hideArea = hideArea || ((hideL1Areas === true) && (userLevel === 1));
  9323. hideArea = hideArea || ((hideL2Areas === true) && (userLevel === 2));
  9324. hideArea = hideArea || ((hideL3Areas === true) && (userLevel === 3));
  9325. hideArea = hideArea || ((hideL4Areas === true) && (userLevel === 4));
  9326. hideArea = hideArea || ((hideL5Areas === true) && (userLevel === 5));
  9327. hideArea = hideArea || ((hideL6Areas === true) && (userLevel === 6));
  9328. hideArea = hideArea || ((hideL7Areas === true) && (userLevel === 7));
  9329.  
  9330. if((hideNewAreas === true) || (hideOldAreas === true))
  9331. {
  9332. let amaDaysAgo = uroUtils.DateToDays(ama.attributes.createdOn);
  9333. hideArea = hideArea || ((hideNewAreas === true) && (amaDaysAgo < areaMinAge));
  9334. hideArea = hideArea || ((hideOldAreas === true) && (amaDaysAgo > areaMaxAge));
  9335. }
  9336.  
  9337. if(hideArea === false)
  9338. {
  9339. let nc = ama.attributes.geoJSONGeometry.coordinates.length;
  9340. for(let i = 0; i < nc; ++i)
  9341. {
  9342. let geo = ama.attributes.geoJSONGeometry.coordinates[i];
  9343. if(uroContainsPoint(geo, mousePoint) === true)
  9344. {
  9345. let amName = uroUtils.GetUserNameFromID(ama.attributes.userID);
  9346. if(amList.indexOf(amName) === -1)
  9347. {
  9348. if(amList !== '') amList += ', ';
  9349. tName = uroUtils.GetUserNameAndRank(ama.attributes.userID);
  9350. if(tName.indexOf('a href') !== -1)
  9351. {
  9352. tName = tName.replace('a href', 'a style="color:#c0c0ff;" href');
  9353. }
  9354. amList += tName;
  9355. break;
  9356. }
  9357. }
  9358. }
  9359. }
  9360. }
  9361. if(amList === '')
  9362. {
  9363. amList = 'none';
  9364. }
  9365. amList = "&nbsp;-&nbsp;<b>Area Managers:</b> "+amList;
  9366. }
  9367. document.getElementById("uroAMList").innerHTML = uroUtils.ModifyHTML(amList);
  9368. }
  9369. function uroNewTabAtMouseLoc(x, y)
  9370. {
  9371. let tPix = new OpenLayers.Pixel(x,y);
  9372. let mPos = uroUtils.ConvertMercatorToWGS84(W.map.getLonLatFromPixel(tPix));
  9373. let nZoom = W.map.getZoom();
  9374. if(nZoom < 17) nZoom = 17;
  9375. let nHref = window.location.origin + window.location.pathname;
  9376. nHref += '?lon=' + mPos.lon;
  9377. nHref += '&lat=' + mPos.lat;
  9378. nHref += '&zoomLevel=' + nZoom;
  9379. window.open(nHref);
  9380. }
  9381. function uroMouseDown(e)
  9382. {
  9383. uroMouseIsDown = true;
  9384. if((e.altKey === true) && (e.ctrlKey === true))
  9385. {
  9386. uroNewTabAtMouseLoc(e.offsetX, e.offsetY);
  9387. }
  9388. }
  9389. function uroMouseUp()
  9390. {
  9391. uroMouseIsDown = false;
  9392. }
  9393. function uroTestPointerOutsideMap(mX, mY)
  9394. {
  9395. let mapElm = document.getElementById("map");
  9396. if(mapElm === undefined) return;
  9397. let mapBCR = mapElm.getBoundingClientRect();
  9398.  
  9399. if
  9400. (
  9401. (mX < mapBCR.left) ||
  9402. (mX > mapBCR.right) ||
  9403. (mY < mapBCR.top) ||
  9404. (mY > mapBCR.bottom)
  9405. )
  9406. {
  9407. if(uroUtils.GetCBChecked('_cbKillInertialPanning') === true)
  9408. {
  9409. let controller = null;
  9410. if (W.map.navigationControl)
  9411. {
  9412. controller = W.map.navigationControl;
  9413. }
  9414. else if(W.map.controls.find(control => control.CLASS_NAME == 'OpenLayers.Control.Navigation'))
  9415. {
  9416. controller = W.map.controls.find(control => control.CLASS_NAME == 'OpenLayers.Control.Navigation');
  9417. }
  9418. if (controller !== null)
  9419. {
  9420. controller.dragPan.panMapStart();
  9421. }
  9422. }
  9423. return true;
  9424. }
  9425. else
  9426. {
  9427. return false;
  9428. }
  9429. }
  9430. function uroMouseOut(e)
  9431. {
  9432. if(uroTestPointerOutsideMap(e.clientX, e.clientY))
  9433. {
  9434. uroPopup.Hide();
  9435. }
  9436. }
  9437. function uroUREvent_onObjectsAdded()
  9438. {
  9439. if(uroUtils.GetCBChecked('_cbURResolverIDFilter') === true)
  9440. {
  9441. uroUpdateEditorList(W.model.mapUpdateRequests.objects, '_selectURResolverID', false, false, true, false);
  9442. }
  9443. if(uroPopulatingRequestSessions === false)
  9444. {
  9445. uroFilterURs();
  9446. }
  9447. }
  9448. function uroGetSelectedURCommentCount()
  9449. {
  9450. if(W.model.updateRequestSessions.objects[uroSelectedURID] != null)
  9451. {
  9452. let cachedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  9453. uroDBG.AddLog(uroSelectedURID+':'+cachedCommentCount+' '+uroExpectedCommentCount);
  9454.  
  9455. // if there aren't the same number of cached comments as there are comments in the UR dialog list, initiate
  9456. // a refresh of the comment data...
  9457. if(cachedCommentCount != uroExpectedCommentCount)
  9458. {
  9459. if(uroPendingCommentDataRefresh === true)
  9460. {
  9461. if(cachedCommentCount > 0)
  9462. {
  9463. uroCachedLastCommentID = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments[cachedCommentCount-1].id;
  9464. }
  9465. else
  9466. {
  9467. uroCachedLastCommentID = null;
  9468. }
  9469. uroDBG.AddLog('updateRequestSessions refresh required for UR '+uroSelectedURID);
  9470. if(uroCachedLastCommentID !== null)
  9471. {
  9472. uroDBG.AddLog('last comment ID for this UR is '+uroCachedLastCommentID);
  9473. }
  9474. else
  9475. {
  9476. uroDBG.AddLog('first comment for this UR, no previous comment to ID');
  9477. }
  9478. let idList = [];
  9479. idList.push(uroSelectedURID);
  9480. // need to delete the existing cache object first, as .get() is only capable of creating new objects,
  9481. // it doesn't seem able to update an existing object with new data
  9482. W.model.updateRequestSessions.remove(W.model.updateRequestSessions.objects[uroSelectedURID]);
  9483. W.model.updateRequestSessions.getAsync(idList);
  9484.  
  9485. // the call to .get() initiates a XMLHttpRequest for the data, so we now need to switch modes - the
  9486. // refresh process has started so we're no longer pending, but we are now waiting for the XMLHttpRequest
  9487. // to return something...
  9488. uroPendingCommentDataRefresh = false;
  9489. uroWaitingCommentDataRefresh = true;
  9490. }
  9491. else
  9492. {
  9493. if(cachedCommentCount > 0)
  9494. {
  9495. let currentLastCommentID = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments[cachedCommentCount-1].id;
  9496. if(currentLastCommentID == uroCachedLastCommentID)
  9497. {
  9498. // most recent comment loaded for this UR is the same one that was present at the start of this
  9499. // refresh process, so kick back into pending mode so we can retry the .get()...
  9500. uroDBG.AddLog('latest comment ID still the same, reverting to pending mode...');
  9501. uroPendingCommentDataRefresh = true;
  9502. }
  9503. else
  9504. {
  9505. // something may have gone awry here - the most recent comment loaded for this UR doesn't have the
  9506. // same ID as the one present at the start of the refresh process, yet the comment counts still don't
  9507. // match up, which suggests either a comment got lost along the way or someone else has commented on
  9508. // the same UR at almost the same time. To get out of the loop this would create, assume that a
  9509. // mismatch in the IDs means the .get() has completed successfully no matter what the new comment
  9510. // count is, and take this new count to be the count we were expecting all along...
  9511. uroDBG.AddLog('latest comment ID different, but expected count not correct...');
  9512. uroExpectedCommentCount = cachedCommentCount;
  9513. }
  9514. }
  9515. else
  9516. {
  9517. uroDBG.AddLog('first comment on this UR not received yet, reverting to pending mode...');
  9518. uroPendingCommentDataRefresh = true;
  9519. }
  9520. }
  9521.  
  9522. }
  9523. else
  9524. {
  9525. // if the WME session is loaded with a UR already selected, such that WME has opened the UR dialog as part
  9526. // of the session startup process, adding new comments to the UR cause the cached data to be updated immediately.
  9527. // This prevents URO+ from switching into waiting mode in the above block of code, so we have to instead do
  9528. // it here by comparing the cached count against the expected count following the Send click event.
  9529. if(cachedCommentCount >= uroExpectedCommentCount)
  9530. {
  9531. uroPendingCommentDataRefresh = false;
  9532. uroWaitingCommentDataRefresh = true;
  9533. uroExpectedCommentCount = null;
  9534. }
  9535.  
  9536. // once the cached data has been updated, refilter the URs so that the new comment count is taken into account
  9537. // immediately for filtering and display purposes
  9538. if(uroWaitingCommentDataRefresh === true)
  9539. {
  9540. uroWaitingCommentDataRefresh = false;
  9541. uroFilterURs();
  9542. uroDBG.AddLog('refresh complete');
  9543. }
  9544. }
  9545. }
  9546. }
  9547. function uroAddedComment()
  9548. {
  9549. // when the user clicks the Send button to submit a new UR comment, this event handler fires before the new comment is
  9550. // posted to the server and thus also before the comment list gets updated in the UR dialog. So we take the current
  9551. // comment count and, if the new comment edit box isn't empty, increment it by 1 to get the expected count. Then we
  9552. // set the pending flag true to initiate a session refresh on the next 100ms tick
  9553. uroExpectedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  9554. if(document.getElementsByClassName('new-comment-text')[0].value !== '')
  9555. {
  9556. uroExpectedCommentCount++;
  9557. uroDBG.AddLog('new comment added to UR '+uroSelectedURID+', cache refresh required...');
  9558. uroPendingCommentDataRefresh = true;
  9559. }
  9560. else
  9561. {
  9562. uroPendingCommentDataRefresh = false;
  9563. }
  9564. }
  9565. function uroInhibitNextUpdateRequestButton(e)
  9566. {
  9567. e.stopPropagation();
  9568.  
  9569. let doClick = true;
  9570. if(document.getElementsByClassName('form-control new-comment-text').length > 0)
  9571. {
  9572. if(document.getElementsByClassName('form-control new-comment-text')[0].textLength > 0)
  9573. {
  9574. uroAlertBox.Show("fa-warning", "URO+ Warning", "Comment not sent, close report panel anyway?", true, "Yes", "No", uroCloseReportPanel, null);
  9575. // set doClick to false here, as uroCloseReportPanel will be called by the alert box handler if required...
  9576. doClick = false;
  9577. }
  9578. }
  9579. // no alert box has been generated, so close the panel
  9580. if(doClick)
  9581. {
  9582. uroCloseReportPanel();
  9583. }
  9584. }
  9585. function uroCloseReportPanel()
  9586. {
  9587. document.getElementsByClassName('close-panel')[0].click();
  9588. }
  9589. function uroIncrementClosureDate(oldDate, incByDays)
  9590. {
  9591. // Thanks to WME no longer using consistent ISO8601 date formatting when displaying
  9592. // closure details, parsing the date string is now somewhat more involved. Thanks devs...
  9593.  
  9594. // Default to returning the existing date, just in case we can't increment it
  9595. let retval = oldDate;
  9596. let sepChar = null;
  9597.  
  9598. // Search through oldDate for a non-digit character, so we know what's
  9599. // being used to seperate the year, month and date values by this locale...
  9600. for(let i = 0; i < oldDate.length; ++i)
  9601. {
  9602. if((oldDate[i] < '0') || (oldDate[i] > '9'))
  9603. {
  9604. sepChar = oldDate[i];
  9605. break;
  9606. }
  9607. }
  9608.  
  9609. if(sepChar != null)
  9610. {
  9611. // First build a "probe" date object we can use to determine what the user's WME locale
  9612. // does with dates.
  9613. let incDate = new Date();
  9614. incDate.setFullYear(3000);
  9615. incDate.setMonth(10);
  9616. incDate.setDate(22);
  9617.  
  9618. // With these three carefully chosen date elements set, we now generate a localised datestring
  9619. // using the WME locale setting - the first character of which then tells us the date
  9620. // format - 1 = MDY (ack ptui), 2 = DMY (good), 3 = YMD (sweet!)
  9621. let localeDate = incDate.toLocaleDateString(I18n.locale);
  9622. let dateFormat = localeDate[0];
  9623.  
  9624. // Now we know the seperator character and the date format, so we can finally start to parse
  9625. // the existing date string...
  9626. let oldDateBits = oldDate.split(sepChar);
  9627. let datePos;
  9628. let monthPos;
  9629. let yearPos;
  9630. if(dateFormat == '1')
  9631. {
  9632. datePos = 1;
  9633. monthPos = 0;
  9634. yearPos = 2;
  9635. }
  9636. else if(dateFormat == '2')
  9637. {
  9638. datePos = 0;
  9639. monthPos = 1;
  9640. yearPos = 2;
  9641. }
  9642. else
  9643. {
  9644. datePos = 2;
  9645. monthPos = 1;
  9646. yearPos = 0;
  9647. }
  9648. incDate.setFullYear(parseInt(oldDateBits[yearPos]));
  9649. incDate.setMonth(parseInt(oldDateBits[monthPos]) - 1);
  9650. incDate.setDate(parseInt(oldDateBits[datePos]));
  9651. let tDate = new Date(incDate.getTime());
  9652. incDate.setDate(tDate.getDate() + incByDays);
  9653.  
  9654. retval = incDate.toLocaleDateString(I18n.locale);
  9655.  
  9656. // Except for those pesky locales where toLocaleDateString() doesn't *quite*
  9657. // return what WME is expecting. Because, you know, why make it easy for
  9658. // scripters when you can chuck in a few subtle curveballs like this, eh...
  9659.  
  9660. if(I18n.locale == 'bg')
  9661. {
  9662. // Remove the "r." suffix
  9663. retval = retval.split(" ")[0] + " ";
  9664. }
  9665. }
  9666. return retval;
  9667. }
  9668. function uroGetElementProperty(elmName, elmOffset, elmProperty)
  9669. {
  9670. let retval = null;
  9671. if(document.getElementsByName(elmName).length > elmOffset)
  9672. {
  9673. retval = document.getElementsByName(elmName)[elmOffset][elmProperty];
  9674. }
  9675. else if(document.getElementById(elmName) !== null)
  9676. {
  9677. retval = document.getElementById(elmName)[elmProperty];
  9678. }
  9679. return retval;
  9680. }
  9681. function uroGetShadowElementProperty(elmName, shadowElmType, property)
  9682. {
  9683. let retval = null;
  9684. let tObj = document.getElementById(elmName);
  9685. if(tObj !== null)
  9686. {
  9687. let sObj = tObj.shadowRoot.querySelector(shadowElmType);
  9688. if(sObj !== null)
  9689. {
  9690. retval = sObj[property];
  9691. }
  9692. }
  9693. return retval;
  9694. }
  9695. let rtcTotal = null;
  9696. let rtcSegIDs = null;
  9697. function uroScrollToEndOfClosures()
  9698. {
  9699. let cItems = document.querySelectorAll('.closure-item');
  9700. let nClosures = cItems.length;
  9701. let segIDs = uroUtils.GetSelectedSegmentIDs();
  9702. let sameSegs = false;
  9703. if((segIDs !== null) && (rtcSegIDs !== null))
  9704. {
  9705. if(segIDs.length == rtcSegIDs.length)
  9706. {
  9707. sameSegs = true;
  9708. for(let i = 0; i < segIDs.length; ++i)
  9709. {
  9710. if(segIDs[i] != rtcSegIDs[i])
  9711. {
  9712. sameSegs = false;
  9713. break;
  9714. }
  9715. }
  9716. }
  9717. }
  9718. if(sameSegs === false)
  9719. {
  9720. rtcTotal = null;
  9721. rtcSegIDs = segIDs;
  9722. }
  9723. if(nClosures > rtcTotal)
  9724. {
  9725. if(cItems[0].getBoundingClientRect().height != 0)
  9726. {
  9727. rtcTotal = nClosures;
  9728. if(uroUtils.GetCBChecked('_cbAutoScrollClosureList') == true)
  9729. {
  9730. // Scroll to the end of the closure tab, as that's where the closure you're most likely to be cloning
  9731. // is located...
  9732. cItems[cItems.length - 1].scrollIntoView();
  9733. }
  9734. }
  9735. }
  9736. }
  9737. function uroClosureEditUIChanged()
  9738. {
  9739. if(document.getElementsByClassName('edit-closure').length === 1)
  9740. {
  9741. // note: this also fires when the UI is closed, due to the change events triggered as its elements are removed
  9742. // prior to the tab itself closing...
  9743.  
  9744. let notReady = 0;
  9745. let mteDropDown = document.getElementById('closure_eventId');
  9746. if(document.getElementById('closure_reason').shadowRoot.querySelector('input') === null) notReady += 1;
  9747. if(document.getElementById('closure_direction').shadowRoot.querySelector('.selected-value') === null) notReady += 2;
  9748. else if(document.getElementById('closure_direction').shadowRoot.querySelector('.selected-value').innerText === "") notReady += 4;
  9749. if(document.getElementById('closure_startDate') === null) notReady += 8;
  9750. if(document.getElementById('closure_endDate') === null) notReady += 16;
  9751. if(mteDropDown.shadowRoot.querySelector('.selected-value') === null) notReady += 32;
  9752. else if(mteDropDown.shadowRoot.querySelector('.selected-value').innerText === "") notReady += 64;
  9753. if(document.getElementById('closure_permanent').shadowRoot.querySelector('.wz-checkbox') === null) notReady += 128;
  9754. if(notReady === 0)
  9755. {
  9756. if(uroRTCClone.PendingClone === -3)
  9757. {
  9758. uroRTCClone.Complete();
  9759. }
  9760. else if(uroRTCClone.PendingClone !== -1)
  9761. {
  9762. uroRTCClone.Copy();
  9763. }
  9764. else
  9765. {
  9766. uroFixMTEDropDown(mteDropDown);
  9767. }
  9768. }
  9769. }
  9770. else
  9771. {
  9772. if(uroRTCClone.PendingClone === -2)
  9773. {
  9774. // generate a click event on the Add a closure button to open up the closure editing UI, then
  9775. // wait for the UI to finish opening...
  9776. document.getElementsByClassName('add-closure-button')[0].click();
  9777. uroRTCClone.PendingClone = -3;
  9778. }
  9779. uroClosureListHandler();
  9780. }
  9781. }
  9782. function uroTSTPopupHandler()
  9783. {
  9784. if(document.getElementsByClassName('panel')[0] === undefined)
  9785. {
  9786. uroHidePopupOnPanelOpen = true;
  9787. }
  9788.  
  9789. if(uroPopup.shown === true)
  9790. {
  9791. let hidePopup = false;
  9792.  
  9793. if(document.getElementsByClassName('panel')[0] != null)
  9794. {
  9795. if(uroHidePopupOnPanelOpen === true)
  9796. {
  9797. hidePopup = true;
  9798. uroHidePopupOnPanelOpen = false;
  9799. }
  9800. }
  9801.  
  9802. if(hidePopup === true)
  9803. {
  9804. uroPopup.Hide();
  9805. }
  9806. }
  9807.  
  9808. if((uroAFN.hoverObj !== null) && (uroAFN.hoverTime != -1) && (uroAFN.overlayShown === false))
  9809. {
  9810. if(++uroAFN.hoverTime > 5)
  9811. {
  9812. uroAFN.OverlaySetup();
  9813. }
  9814. }
  9815. uroAFN.ReplaceAreaNames(false);
  9816.  
  9817. if(uroPopup.autoHideTimer > 0)
  9818. {
  9819. if(--uroPopup.autoHideTimer === 0)
  9820. {
  9821. uroPopup.Hide();
  9822. }
  9823. }
  9824.  
  9825. if(uroPopup.timer > 0)
  9826. {
  9827. if(uroPopup.mouseIn === false)
  9828. {
  9829. uroPopup.timer--;
  9830. }
  9831. }
  9832. if(uroPopup.timer === 0)
  9833. {
  9834. uroPopup.Hide();
  9835. }
  9836. }
  9837. function uroTSTNextBtnHandler()
  9838. {
  9839. // replaces the "next xxx" button on UR, MP and PUR editing UIs
  9840.  
  9841. // Correctly determining what WME is displaying for the "next" button in the UR/MP/(P)PUR panel is not trivial due to
  9842. // inconsistencies in the panel behaviour depending on whether it was opened by clicking directly on the relevant
  9843. // marker, or by clicking on the associated feed entry... For PURs, there's also the added complication of multi-part
  9844. // update requests, where the same marker/panel are used to access more than one request and where, therefore, we need
  9845. // to enable access to all requests contained within the PUR, but still inhibit the "next" button once the last
  9846. // request in the multi-part sequence has been viewed.
  9847. //
  9848. // For directly-accesed markers, the "next" button caption is:
  9849. //
  9850. // URs = "Next update request" (update_requests.panel.next)
  9851. // MPs = "Next map problem" (problems.panel.next)
  9852. // PURs = "Next place" for single-part PURs or for the last part of a multi-part PUR (venues.update_requests.panel.next_venue)
  9853. // = "Next" for all but the last part of a multi-part PUR (venues.update_requests.panel.next)
  9854. // PPURs = "Next place" (venues.update_requests.panel.next_venue)
  9855. //
  9856. // For markers accessed via the feed, the "next" button caption always appears to be "Next issue" (feed.issues.next)
  9857.  
  9858.  
  9859.  
  9860. let reportPanel = document.querySelector('#panel-container');
  9861.  
  9862. if(reportPanel.childElementCount > 0)
  9863. {
  9864. let nurButton = reportPanel.getElementsByClassName('next')[0];
  9865. if(nurButton === undefined)
  9866. {
  9867. nurButton = reportPanel.getElementsByClassName('next-venue')[0];
  9868. }
  9869. if(nurButton !== undefined)
  9870. {
  9871. let doneString = I18n.lookup('problems.panel.done');
  9872. let btnCaptionIsNextPlace = (nurButton.innerHTML.indexOf(I18n.lookup('venues.update_requests.panel.next_venue')) !== -1);
  9873. let btnCaptionIsDefaultUR = (nurButton.innerHTML.indexOf(I18n.lookup('update_requests.panel.next')) !== -1);
  9874. let btnCaptionIsDefaultMP = (nurButton.innerHTML.indexOf(I18n.lookup('problems.panel.next')) !== -1);
  9875. let btnCaptionIsNextIssue = (nurButton.innerHTML.indexOf(I18n.lookup('feed.issues.next')) !== -1);
  9876.  
  9877. let updateButton = false;
  9878.  
  9879. let panelClass = reportPanel.childNodes[0].childNodes[0].className;
  9880. let isURorMPPanel = (panelClass.indexOf('problem-edit') !== -1);
  9881. let isPURPanel = (panelClass.indexOf('place-update') !== -1);
  9882.  
  9883. if(isURorMPPanel === true)
  9884. {
  9885. // user has enabled UR button mod?
  9886. if(uroUtils.GetCBChecked('_cbInhibitNURButton') === true)
  9887. {
  9888. // the native UR panel button will always either be "Next update request" or "Next issue"
  9889. updateButton = ((btnCaptionIsDefaultUR) || (btnCaptionIsNextIssue));
  9890. }
  9891.  
  9892. // user has enabled MP button mod?
  9893. if(uroUtils.GetCBChecked('_cbInhibitNMPButton') === true)
  9894. {
  9895. // there's no way to determine if the edit panel has been opened for a UR or a MP, however as MPs
  9896. // don't currently appear in the feed, the native button only uses "Next map problem" as its caption
  9897. updateButton = (updateButton || btnCaptionIsDefaultMP);
  9898. }
  9899. }
  9900. else if(isPURPanel === true)
  9901. {
  9902. if(uroUtils.GetCBChecked('_cbInhibitNPURButton') === true)
  9903. {
  9904. // for a (P)PUR, only modify the button if it's showing the "Next place" or "Next issue" caption, to
  9905. // avoid messing up the "Next" button used to move to the next part of a multi-part PUR...
  9906. updateButton = ((btnCaptionIsNextPlace === true) || (btnCaptionIsNextIssue));
  9907. }
  9908. }
  9909.  
  9910. if(updateButton === true)
  9911. {
  9912. uroDBG.AddLog('inhibit Next UR/MP/PUR button');
  9913.  
  9914. // alter the button caption
  9915. nurButton.innerHTML = uroUtils.ModifyHTML(doneString);
  9916. // 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
  9917. // moving to the next UR/MP/PUR, and also allows us to warn about closing the UR panel if there's an unsent comment...
  9918. nurButton.addEventListener("click", uroInhibitNextUpdateRequestButton, false);
  9919. }
  9920. }
  9921. uroInhibitURFiltering = false;
  9922. }
  9923. }
  9924. function uroTSTCommentAddedHandler()
  9925. {
  9926. // test for the opening or closing of the UR editing dialog so we can detect when a new comment is added
  9927. let URDialogIsOpen = false;
  9928. let panelOpen = (document.getElementById('panel-container').firstChild !== null);
  9929.  
  9930. if(panelOpen)
  9931. {
  9932. URDialogIsOpen = (document.getElementById('panel-container').getElementsByClassName('conversation').length > 0);
  9933. }
  9934.  
  9935. if(URDialogIsOpen)
  9936. {
  9937. let thisSelectedURID = document.getElementsByClassName('permalink')[0].href.split('&mapUpdateRequest=');
  9938. if(thisSelectedURID.length > 1)
  9939. {
  9940. thisSelectedURID = thisSelectedURID[1].split('&')[0];
  9941. }
  9942. else
  9943. {
  9944. thisSelectedURID = null;
  9945. }
  9946.  
  9947. if((thisSelectedURID != uroSelectedURID) || ((thisSelectedURID != uroMarkers.clickedOnID) && (uroMarkers.clickedOnID != null)))
  9948. {
  9949. // if the user selects a new UR whilst the editing dialog is still open, treat it in the
  9950. // same way as if the user had selected that UR with the dialog closed
  9951. uroURDialogIsOpen = false;
  9952. uroSelectedURID = null;
  9953. }
  9954.  
  9955. if(((uroURDialogIsOpen === false) && (uroSelectedURID === null)) || (uroURReclickAttempts > 0))
  9956. {
  9957. // user is editing a new UR
  9958.  
  9959. // add our own click event handler to the Send button, so we can do stuff whenever a new comment is added
  9960. if(document.getElementsByClassName('new-comment-form').length > 0)
  9961. {
  9962. if(document.getElementsByClassName('new-comment-form')[0].getElementsByClassName('send-button').length > 0)
  9963. {
  9964. document.getElementsByClassName('new-comment-form')[0].getElementsByClassName('send-button')[0].addEventListener("click", uroAddedComment, false);
  9965.  
  9966. uroSelectedURID = thisSelectedURID;
  9967. uroDBG.AddLog('user is editing UR '+uroSelectedURID);
  9968. uroExpectedCommentCount = W.model.updateRequestSessions.objects[uroSelectedURID].attributes.comments.length;
  9969.  
  9970. if((uroHoveredURID !== null) && (uroSelectedURID !== null) && (parseInt(uroHoveredURID) !== parseInt(uroSelectedURID)))
  9971. {
  9972. if(uroURReclickAttempts === 0)
  9973. {
  9974. 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...');
  9975. }
  9976. if(++uroURReclickAttempts < 3)
  9977. {
  9978. //uroRestackMarkers();
  9979. let urMarker = uroGetMarker(uroLayers.ID.UR,uroHoveredURID);
  9980. if(urMarker !== null)
  9981. {
  9982. let urMarkerAttributes = uroGetAttributes(uroLayers.ID.UR, uroHoveredURID);
  9983. if(urMarkerAttributes !== null)
  9984. {
  9985. urMarkerAttributes.geometry.x = urMarkerAttributes.geometry.realX;
  9986. urMarkerAttributes.geometry.y = urMarkerAttributes.geometry.realY;
  9987. uroOpenURDialog(uroHoveredURID);
  9988. }
  9989. }
  9990. return;
  9991. }
  9992. else
  9993. {
  9994. uroDBG.AddLog('Woe is me, attempting to open UR ID '+uroHoveredURID+' has failed...');
  9995. 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);
  9996. }
  9997. }
  9998. uroURReclickAttempts = 0;
  9999. uroFilterURs();
  10000. }
  10001. }
  10002. }
  10003. }
  10004. else if(uroURDialogIsOpen === true)
  10005. {
  10006. // dialog was open and has now been closed
  10007. uroSelectedURID = null;
  10008. uroMarkers.clickedOnID = null;
  10009. uroFilterURs();
  10010. }
  10011. uroURDialogIsOpen = URDialogIsOpen;
  10012.  
  10013. if(((uroPendingCommentDataRefresh === true) || (uroWaitingCommentDataRefresh === true)) && (uroSelectedURID !== null))
  10014. {
  10015. uroDBG.AddLog('check completion of comment data refresh for UR '+uroSelectedURID+' ('+uroPendingCommentDataRefresh+','+uroWaitingCommentDataRefresh+')');
  10016. uroGetSelectedURCommentCount();
  10017. }
  10018.  
  10019. }
  10020. function uroClosureListHandler()
  10021. {
  10022. // Handles adjustments to the closure list in the sidepanel...
  10023. //
  10024. if(uroUtils.GetCBChecked('_cbMasterEnable') === false)
  10025. {
  10026. return;
  10027. }
  10028.  
  10029. // List entry filtering
  10030. let nEntries = document.querySelectorAll('.closure-item').length;
  10031. if(nEntries > 0)
  10032. {
  10033. let filterExpired = uroUtils.GetCBChecked('_cbHideExpiredSidepanelRTCs');
  10034. let filterCurrent = uroUtils.GetCBChecked('_cbHideSidepanelRTCs');
  10035. let filterFuture = uroUtils.GetCBChecked('_cbHideFutureSidepanelRTCs');
  10036. let filterUnknown = uroUtils.GetCBChecked('_cbHideUnknownSidepanelRTCs');
  10037. for(let i = 0; i < nEntries; ++i)
  10038. {
  10039. let hide = false;
  10040. let cElm = document.querySelectorAll('.closure-item')[i];
  10041. let ciSrc = cElm.querySelector('img')?.src;
  10042. if(ciSrc != undefined)
  10043. {
  10044. hide |= ((ciSrc.indexOf('finished') != -1) && (filterExpired == true));
  10045. hide |= ((ciSrc.indexOf('active') != -1) && (filterCurrent == true));
  10046. hide |= ((ciSrc.indexOf('not-started') != -1) && (filterFuture == true));
  10047. hide |= ((ciSrc === "") && (filterUnknown == true));
  10048. }
  10049.  
  10050. if(hide == true)
  10051. {
  10052. cElm.style.display = "none";
  10053. }
  10054. else
  10055. {
  10056. cElm.style.display = "block";
  10057. }
  10058. }
  10059. }
  10060.  
  10061. // Closure cloning controls
  10062. if((document.querySelectorAll('.closures-list').length > 0) && (document.querySelector('.closures-list').getAttribute('touchedbyuro') === null))
  10063. {
  10064. let nClosures;
  10065. let cLoop;
  10066. let btnElm;
  10067.  
  10068. // Cloning doesn't work with certain locales due to the way the date strings are formatted...
  10069. if
  10070. (
  10071. (I18n.locale == "fa-IR") ||
  10072. (I18n.locale == 'ar') ||
  10073. (I18n.locale == 'zh') ||
  10074. (I18n.locale == 'ko')
  10075. )
  10076. {
  10077. // Sorry :-(
  10078. }
  10079. else
  10080. {
  10081. // for the others, are there any closures defined for all of the selected segment(s)...
  10082. if(document.getElementsByClassName('full-closures').length > 0)
  10083. {
  10084. nClosures = document.getElementsByClassName('full-closures')[0].querySelectorAll('.closure-item.is-editable').length;
  10085. if(nClosures > 0)
  10086. {
  10087. // Force a refresh of uroRTCObjs for the selected segment, as this is no longer guaranteed to have already occurred...
  10088. let selectedSegIDs = uroUtils.GetSelectedSegmentIDs();
  10089. if(selectedSegIDs.length > 0)
  10090. {
  10091. uroGetSelectedSegmentRTCs(selectedSegIDs[0]);
  10092.  
  10093. // and if so, have we already added the clone icon?
  10094. for(cLoop = 0; cLoop < nClosures; cLoop++)
  10095. {
  10096. btnElm = document.getElementsByClassName('full-closures')[0].querySelectorAll('.closure-item.is-editable')[cLoop].getElementsByClassName('closure-title')[0];
  10097. if((btnElm.innerHTML.indexOf('_uroCloneClosure-') == -1) && (uroGetRTCOrigin(uroRTCObjs[cLoop]) !== uroEnums.TRTC.UNKNOWN))
  10098. {
  10099. let newNode = document.createElement("div");
  10100. let anchorID1 = '_uroCloneClosure-1-'+cLoop;
  10101. let anchorID2 = '_uroCloneClosure-7-'+cLoop;
  10102. let newAnchor = '<a id="'+anchorID1+'" href="#">';
  10103. newAnchor += "<i style='font-size: 150%; cursor: copy' class='fa fa-copy'></i>";
  10104. newAnchor += "</a><sup>+1</sup>&nbsp;";
  10105. newAnchor += '<a id="'+anchorID2+'" href="#">';
  10106. newAnchor += "<i style='font-size: 150%; cursor: copy' class='fa fa-copy'></i>";
  10107. newAnchor += "</a><sup>+7</sup>";
  10108. newNode.innerHTML = uroUtils.ModifyHTML(newAnchor);
  10109. btnElm.prepend(newNode);
  10110. uroUtils.AddEventListener(anchorID1,"click",uroRTCClone.Clone,false);
  10111. uroUtils.AddEventListener(anchorID2,"click",uroRTCClone.Clone,false);
  10112.  
  10113. let chipElm = btnElm.querySelector("wz-image-chip");
  10114. chipElm.innerHTML = chipElm.innerHTML.split('>')[0] + '>';
  10115. }
  10116. }
  10117. }
  10118. }
  10119. }
  10120. }
  10121.  
  10122. // if there's more than one closure (full or partial) listed, also add the delete all button if not already present
  10123. nClosures = document.querySelectorAll('.closure-item.is-editable').length;
  10124. if(nClosures > 0)
  10125. {
  10126. if(document.getElementById('_btnDeleteAllClosures') === null)
  10127. {
  10128. let daDiv = document.createElement('wz-button');
  10129. daDiv.className = 'delete-all-button btn is-expanded'; //btn-primary';
  10130. daDiv.id = '_btnDeleteAllClosures';
  10131.  
  10132. let tHTML = '<i class="fa fa-trash"></i> '+I18n.lookup("closures.delete_confirm_no_reason");
  10133. if(nClosures > 1)
  10134. {
  10135. tHTML += ' ('+I18n.lookup("closures.apply_to_all")+')';
  10136. }
  10137. daDiv.innerHTML = uroUtils.ModifyHTML(tHTML);
  10138. daDiv.style.width = '100%';
  10139. daDiv.style.marginBottom = '10px';
  10140.  
  10141. let acBtn = document.getElementsByClassName('add-closure-button')[0];
  10142. if(acBtn !== undefined)
  10143. {
  10144. acBtn.parentNode.insertBefore(daDiv, acBtn.nextSibling);
  10145. uroUtils.AddEventListener('_btnDeleteAllClosures',"click", uroRTCClone.DeleteAll, false);
  10146. }
  10147. }
  10148. }
  10149.  
  10150. document.querySelector('.closures-list').setAttribute('touchedbyuro','true');
  10151. }
  10152. }
  10153. function uroMiscUITweaksHandler()
  10154. {
  10155. if(uroFilterPreamble())
  10156. {
  10157. // clickifies the ExtraInfo URL present in some MPs
  10158. {
  10159. if(document.getElementById('panel-container').getElementsByClassName('extraInfo').length > 0)
  10160. {
  10161. if(document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].touchedByURO === undefined)
  10162. {
  10163. let tDesc = document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].innerHTML;
  10164. tDesc = uroUtils.Clickify(tDesc, '');
  10165. document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].innerHTML = uroUtils.ModifyHTML(tDesc);
  10166. document.getElementById('panel-container').getElementsByClassName('extraInfo')[0].touchedByURO = true;
  10167. }
  10168. }
  10169. }
  10170. }
  10171. }
  10172. function uroMainTick()
  10173. {
  10174. if(uroMTEMode) return;
  10175. if(uroInit.setupListeners)
  10176. {
  10177. if(uroInit.finalisingListenerSetup === false)
  10178. {
  10179. if(W.loginManager.isLoggedIn())
  10180. {
  10181. if(document.getElementsByClassName('topbar').length === 0) return;
  10182. uroInit.FinalizeListenerSetup();
  10183. document.getElementsByClassName('topbar')[0].appendChild(uroAMList);
  10184. }
  10185. }
  10186. }
  10187. else
  10188. {
  10189. if(uroUtils.GetCBChecked('_cbMasterEnable') === true)
  10190. {
  10191. // do one maintick handler call in each 10ms cycle to minimise the time stuck within the maintick handler without
  10192. // unduly affecting the overall response time for each individual handler
  10193.  
  10194. if(uroMainTickStage === 0) uroTSTPopupHandler();
  10195. if(uroMainTickStage == 1) uroTSTNextBtnHandler();
  10196. if(uroMainTickStage == 2) uroTSTCommentAddedHandler();
  10197. if(uroMainTickStage == 4) uroMiscUITweaksHandler();
  10198.  
  10199. if(++uroMainTickStage == 6) uroMainTickStage = 0;
  10200. }
  10201. }
  10202. }
  10203. function uroNewLookCheckDetailsRequest()
  10204. {
  10205. let thisurl = document.location.href;
  10206. let doRetry = true;
  10207. let urID;
  10208. let endmarkerpos = thisurl.indexOf('&endshow');
  10209. let showmarkerpos = thisurl.indexOf('&showturn=');
  10210.  
  10211. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10212. {
  10213. showmarkerpos += 10;
  10214. uroDBG.AddLog('showturn tab opened');
  10215. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10216. uroDBG.AddLog(' turn problem ID = '+urID);
  10217.  
  10218. try
  10219. {
  10220. uroGetMarker(uroLayers.ID.MP,urID).element.click();
  10221. doRetry = false;
  10222. }
  10223. catch(err)
  10224. {
  10225. uroDBG.AddLog('problems not fully loaded, retrying...');
  10226. }
  10227.  
  10228. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10229. }
  10230. else
  10231. {
  10232. showmarkerpos = thisurl.indexOf('&showpur=');
  10233. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10234. {
  10235. showmarkerpos += 9;
  10236. uroDBG.AddLog('showPUR tab opened');
  10237. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10238. uroDBG.AddLog(' PUR ID = '+urID);
  10239.  
  10240. try
  10241. {
  10242. uroGetMarker(uroLayers.ID.PUR, urID).element.click();
  10243. doRetry = false;
  10244. }
  10245. catch(err)
  10246. {
  10247. uroDBG.AddLog('PURs not fully loaded, retrying...');
  10248. }
  10249.  
  10250. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10251. }
  10252.  
  10253. else
  10254. {
  10255. showmarkerpos = thisurl.indexOf('&showppur=');
  10256. if((endmarkerpos != -1) && (showmarkerpos != -1))
  10257. {
  10258. showmarkerpos += 10;
  10259. uroDBG.AddLog('showPPUR tab opened');
  10260. urID = thisurl.substr(showmarkerpos,endmarkerpos-showmarkerpos);
  10261. uroDBG.AddLog(' PPUR ID = '+urID);
  10262.  
  10263. try
  10264. {
  10265. uroGetMarker(uroLayers.ID.PPUR, urID).element.click();
  10266. doRetry = false;
  10267. }
  10268. catch(err)
  10269. {
  10270. uroDBG.AddLog('PPURs not fully loaded, retrying...');
  10271. }
  10272.  
  10273. if(doRetry) window.setTimeout(uroNewLookCheckDetailsRequest,500);
  10274. }
  10275. }
  10276. }
  10277.  
  10278. }
  10279. function uroUpdateVenueEditorLists()
  10280. {
  10281. if(Object.keys(W.model.venues.objects).length === 0) return;
  10282.  
  10283. // build the list of all userIDs contained in the currently loaded venue objects
  10284. let selectedIdx = null;
  10285. let listedIDs = [];
  10286. let idx;
  10287. for(idx in W.model.venues.objects)
  10288. {
  10289. if(W.model.venues.objects.hasOwnProperty(idx))
  10290. {
  10291. let obj = W.model.venues.objects[idx].attributes;
  10292. let cbID = obj.createdBy;
  10293. let ubID = obj.updatedBy;
  10294.  
  10295. if((cbID !== null) && (listedIDs.indexOf(cbID) == -1))
  10296. {
  10297. listedIDs.push(cbID);
  10298. }
  10299. if((ubID !== null) && (ubID !== cbID) && (listedIDs.indexOf(ubID) == -1))
  10300. {
  10301. listedIDs.push(ubID);
  10302. }
  10303. }
  10304. }
  10305.  
  10306. // check for any previously selected userIDs in the two selector lists, then clear both lists
  10307. // and repopulate using the newly gathered ID collection from above, and finally reselect the
  10308. // previously selected user if they're still present in the new list...
  10309. let selector;
  10310. let selectedUser;
  10311. let users = W.model.users.getByIds(listedIDs);
  10312. let selectorEntry;
  10313.  
  10314. for(let i=0; i<2; i++)
  10315. {
  10316. if(i === 0) selector = document.getElementById('_selectPlacesUserID');
  10317. else selector = document.getElementById('_selectHidePlacesUserID');
  10318.  
  10319. selectedUser = null;
  10320. if(selector.selectedOptions[0] != null)
  10321. {
  10322. selectedUser = parseInt(selector.selectedOptions[0].value);
  10323. }
  10324. while(selector.options.length > 0)
  10325. {
  10326. selector.options.remove(0);
  10327. }
  10328. selector.options.add(new Option('<select a user>', null));
  10329. if(listedIDs.length > 0)
  10330. {
  10331. selectorEntry = '';
  10332. for(idx=0; idx<users.length; idx++)
  10333. {
  10334. if(users[idx].attributes.userName === undefined)
  10335. {
  10336. selectorEntry = users[idx].attributes.id;
  10337. }
  10338. else
  10339. {
  10340. selectorEntry = users[idx].attributes.userName;
  10341. }
  10342. selector.options.add(new Option(selectorEntry, users[idx].id));
  10343. if(users[idx].attributes.id == selectedUser)
  10344. {
  10345. selectedIdx = idx+1;
  10346. }
  10347. }
  10348. }
  10349.  
  10350. if(selectedIdx !== null)
  10351. {
  10352. selector.selectedIndex = selectedIdx;
  10353. }
  10354. }
  10355. }
  10356. function uroPlacesEditorSelected()
  10357. {
  10358. let selector = document.getElementById('_selectPlacesUserID');
  10359. if(selector.selectedIndex > 0)
  10360. {
  10361. document.getElementById('_textPlacesEditor').value = document.getElementById('_selectPlacesUserID').selectedOptions[0].innerHTML;
  10362. }
  10363. }
  10364. function uroHidePlacesEditorSelected()
  10365. {
  10366. let selector = document.getElementById('_selectHidePlacesUserID');
  10367. if(selector.selectedIndex > 0)
  10368. {
  10369. document.getElementById('_textHidePlacesEditor').value = document.getElementById('_selectHidePlacesUserID').selectedOptions[0].innerHTML;
  10370. }
  10371. }
  10372. function uroCamEditorSelected()
  10373. {
  10374. let selector = document.getElementById('_selectCameraUserID');
  10375. if(selector.selectedIndex > 0)
  10376. {
  10377. document.getElementById('_textCameraEditor').value = document.getElementById('_selectCameraUserID').selectedOptions[0].innerHTML;
  10378. }
  10379. }
  10380. function uroSetStyles(obj)
  10381. {
  10382. obj.style.fontSize = '12px';
  10383. obj.style.lineHeight = '100%';
  10384. obj.style.flex = '1';
  10385. obj.style.overflowY = 'auto';
  10386. }
  10387. function uroSetSectionTabStyles()
  10388. {
  10389. for(let i =0; i < uroTabs.CtrlTabs.length; ++i)
  10390. {
  10391. uroSetStyles(uroTabs.CtrlTabs[i][uroTabs.FIELDS.TABBODY]);
  10392. }
  10393. }
  10394. function uroPlacesGroupCEHandler(groupidx)
  10395. {
  10396. if(uroPlacesGroupsCollapsed[groupidx] === false)
  10397. {
  10398. document.getElementById('_uroPlacesGroup-'+groupidx).style.display = "block";
  10399. document.getElementById('_uroPlacesGroupState-'+groupidx).className = "fa fa-minus-square-o";
  10400. }
  10401. else
  10402. {
  10403. document.getElementById('_uroPlacesGroup-'+groupidx).style.display = "none";
  10404. document.getElementById('_uroPlacesGroupState-'+groupidx).className = "fa fa-plus-square-o";
  10405. }
  10406. }
  10407. function uroPlacesGroupCollapseExpand()
  10408. {
  10409. let groupidx = this.id.substr(21);
  10410. if(uroPlacesGroupsCollapsed[groupidx] === true) uroPlacesGroupsCollapsed[groupidx] = false;
  10411. else uroPlacesGroupsCollapsed[groupidx] = true;
  10412. uroPlacesGroupCEHandler(groupidx);
  10413. return false;
  10414. }
  10415. function uroGetMarkerIDs(markerType)
  10416. {
  10417. let idList = [];
  10418.  
  10419. if(uroLayers.layers[markerType].mf !== null)
  10420. {
  10421. // Refresh .mf, as this is no longer guaranteed to have been set up as a reference to
  10422. // whatever's in the current W.map.layers object...
  10423. uroLayers.layers[markerType].mf = uroLayers.GetMarkersOrFeatures(markerType);
  10424. for(let i = 0; i < uroLayers.layers[markerType].mf.length; ++i)
  10425. {
  10426. let dID = uroLayers.layers[markerType].mf[i]?.element?.attributes['data-id']?.value;
  10427. if(dID === undefined)
  10428. {
  10429. dID = uroLayers.layers[markerType].mf[i]?.attributes?.wazeFeature?.id;
  10430. }
  10431. if(dID !== undefined)
  10432. {
  10433. idList.push(dID);
  10434. }
  10435. }
  10436. }
  10437. return idList;
  10438. }
  10439. function uroGetAttributes(markerType, markerID)
  10440. {
  10441. if(markerType == uroLayers.ID.UR) return W.model.mapUpdateRequests.objects[markerID].attributes;
  10442. if(markerType == uroLayers.ID.MP) return W.model.mapProblems.objects[markerID].attributes;
  10443. return null;
  10444. }
  10445. function uroGetMarker(markerType, markerID)
  10446. {
  10447. if(typeof(markerID) === 'number')
  10448. {
  10449. markerID = markerID.toString();
  10450. }
  10451.  
  10452. let retval = null;
  10453.  
  10454. if(markerID !== null)
  10455. {
  10456. let mObj = null;
  10457. if(markerType === uroLayers.ID.UR)
  10458. {
  10459. mObj = W.model.mapUpdateRequests.getObjectById(markerID);
  10460. }
  10461. else if(markerType === uroLayers.ID.MP)
  10462. {
  10463. mObj = W.model.mapProblems.getObjectById(markerID);
  10464. }
  10465. else if(markerType === uroLayers.ID.RTC)
  10466. {
  10467. mObj = W.model.roadClosures.getObjectById(markerID);
  10468. }
  10469.  
  10470. if(mObj !== null)
  10471. {
  10472. retval = W.userscripts.getMapElementByDataModel(mObj);
  10473. }
  10474. else
  10475. {
  10476. for(let i = 0; i < uroLayers.layers[markerType].mf.length; ++i)
  10477. {
  10478. if(uroLayers.layers[markerType].mf[i]?.attributes?.wazeFeature?.id === markerID)
  10479. {
  10480. let geoID = uroLayers.layers[markerType].mf[i].geometry.id;
  10481. retval = document.getElementById(geoID);
  10482. break;
  10483. }
  10484. }
  10485. }
  10486. }
  10487. return retval;
  10488. }
  10489.  
  10490. uroInit.Initialise();